Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removes MessageAttribute in favor of properties on Message class #1270

Merged
merged 3 commits into from
Dec 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 18 additions & 1 deletion src/Renci.SshNet/Messages/Authentication/BannerMessage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,29 @@
/// <summary>
/// Represents SSH_MSG_USERAUTH_BANNER message.
/// </summary>
[Message("SSH_MSG_USERAUTH_BANNER", 53)]
public class BannerMessage : Message
{
private byte[] _message;
private byte[] _language;

/// <inheritdoc />
public override string MessageName
{
get
{
return "SSH_MSG_USERAUTH_BANNER";
}
}

/// <inheritdoc />
public override byte MessageNumber
{
get
{
return 53;
}
}

/// <summary>
/// Gets banner message.
/// </summary>
Expand Down
19 changes: 18 additions & 1 deletion src/Renci.SshNet/Messages/Authentication/FailureMessage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,26 @@ namespace Renci.SshNet.Messages.Authentication
/// <summary>
/// Represents SSH_MSG_USERAUTH_FAILURE message.
/// </summary>
[Message("SSH_MSG_USERAUTH_FAILURE", 51)]
public class FailureMessage : Message
{
/// <inheritdoc />
public override string MessageName
{
get
{
return "SSH_MSG_USERAUTH_FAILURE";
}
}

/// <inheritdoc />
public override byte MessageNumber
{
get
{
return 51;
}
}

/// <summary>
/// Gets or sets the allowed authentications if available.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,26 @@ namespace Renci.SshNet.Messages.Authentication
/// <summary>
/// Represents SSH_MSG_USERAUTH_INFO_REQUEST message.
/// </summary>
[Message("SSH_MSG_USERAUTH_INFO_REQUEST", 60)]
internal sealed class InformationRequestMessage : Message
{
/// <inheritdoc />
public override string MessageName
{
get
{
return "SSH_MSG_USERAUTH_INFO_REQUEST";
}
}

/// <inheritdoc />
public override byte MessageNumber
{
get
{
return 60;
}
}

/// <summary>
/// Gets information request name.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,26 @@ namespace Renci.SshNet.Messages.Authentication
/// <summary>
/// Represents SSH_MSG_USERAUTH_INFO_RESPONSE message.
/// </summary>
[Message("SSH_MSG_USERAUTH_INFO_RESPONSE", 61)]
internal sealed class InformationResponseMessage : Message
{
/// <inheritdoc />
public override string MessageName
{
get
{
return "SSH_MSG_USERAUTH_INFO_RESPONSE";
}
}

/// <inheritdoc />
public override byte MessageNumber
{
get
{
return 61;
}
}

/// <summary>
/// Gets authentication responses.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,26 @@
/// <summary>
/// Represents SSH_MSG_USERAUTH_PASSWD_CHANGEREQ message.
/// </summary>
[Message("SSH_MSG_USERAUTH_PASSWD_CHANGEREQ", 60)]
internal sealed class PasswordChangeRequiredMessage : Message
{
/// <inheritdoc />
public override string MessageName
{
get
{
return "SSH_MSG_USERAUTH_PASSWD_CHANGEREQ";
}
}

/// <inheritdoc />
public override byte MessageNumber
{
get
{
return 60;
}
}

/// <summary>
/// Gets password change request message as UTF-8 encoded byte array.
/// </summary>
Expand Down
19 changes: 18 additions & 1 deletion src/Renci.SshNet/Messages/Authentication/PublicKeyMessage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,26 @@
/// <summary>
/// Represents SSH_MSG_USERAUTH_PK_OK message.
/// </summary>
[Message("SSH_MSG_USERAUTH_PK_OK", 60)]
internal sealed class PublicKeyMessage : Message
{
/// <inheritdoc />
public override string MessageName
{
get
{
return "SSH_MSG_USERAUTH_PK_OK";
}
}

/// <inheritdoc />
public override byte MessageNumber
{
get
{
return 60;
}
}

/// <summary>
/// Gets the name of the public key algorithm as ASCII encoded byte array.
/// </summary>
Expand Down
19 changes: 18 additions & 1 deletion src/Renci.SshNet/Messages/Authentication/RequestMessage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,26 @@ namespace Renci.SshNet.Messages.Authentication
/// <summary>
/// Represents SSH_MSG_USERAUTH_REQUEST message. Server as a base message for other user authentication requests.
/// </summary>
[Message("SSH_MSG_USERAUTH_REQUEST", AuthenticationMessageCode)]
public abstract class RequestMessage : Message
{
/// <inheritdoc />
public override string MessageName
{
get
{
return "SSH_MSG_USERAUTH_REQUEST";
}
}

/// <inheritdoc />
public override byte MessageNumber
{
get
{
return AuthenticationMessageCode;
}
}

/// <summary>
/// Returns the authentication message code for <c>SSH_MSG_USERAUTH_REQUEST</c>.
/// </summary>
Expand Down
19 changes: 18 additions & 1 deletion src/Renci.SshNet/Messages/Authentication/SuccessMessage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,26 @@
/// <summary>
/// Represents SSH_MSG_USERAUTH_SUCCESS message.
/// </summary>
[Message("SSH_MSG_USERAUTH_SUCCESS", 52)]
public class SuccessMessage : Message
{
/// <inheritdoc />
public override string MessageName
{
get
{
return "SSH_MSG_USERAUTH_SUCCESS";
}
}

/// <inheritdoc />
public override byte MessageNumber
{
get
{
return 52;
}
}

/// <summary>
/// Called when type specific data need to be loaded.
/// </summary>
Expand Down
19 changes: 18 additions & 1 deletion src/Renci.SshNet/Messages/Connection/ChannelCloseMessage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,26 @@
/// <summary>
/// Represents SSH_MSG_CHANNEL_CLOSE message.
/// </summary>
[Message("SSH_MSG_CHANNEL_CLOSE", 97)]
public class ChannelCloseMessage : ChannelMessage
{
/// <inheritdoc />
public override string MessageName
{
get
{
return "SSH_MSG_CHANNEL_CLOSE";
}
}

/// <inheritdoc />
public override byte MessageNumber
{
get
{
return 97;
}
}

/// <summary>
/// Initializes a new instance of the <see cref="ChannelCloseMessage"/> class.
/// </summary>
Expand Down
19 changes: 17 additions & 2 deletions src/Renci.SshNet/Messages/Connection/ChannelDataMessage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,25 @@ namespace Renci.SshNet.Messages.Connection
/// <summary>
/// Represents SSH_MSG_CHANNEL_DATA message.
/// </summary>
[Message("SSH_MSG_CHANNEL_DATA", MessageNumber)]
public class ChannelDataMessage : ChannelMessage
{
internal const byte MessageNumber = 94;
/// <inheritdoc />
public override string MessageName
{
get
{
return "SSH_MSG_CHANNEL_DATA";
}
}

/// <inheritdoc />
public override byte MessageNumber
{
get
{
return 94;
}
}

/// <summary>
/// Gets the message data.
Expand Down
19 changes: 18 additions & 1 deletion src/Renci.SshNet/Messages/Connection/ChannelEofMessage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,26 @@
/// <summary>
/// Represents SSH_MSG_CHANNEL_EOF message.
/// </summary>
[Message("SSH_MSG_CHANNEL_EOF", 96)]
public class ChannelEofMessage : ChannelMessage
{
/// <inheritdoc />
public override string MessageName
{
get
{
return "SSH_MSG_CHANNEL_EOF";
}
}

/// <inheritdoc />
public override byte MessageNumber
{
get
{
return 96;
}
}

/// <summary>
/// Initializes a new instance of the <see cref="ChannelEofMessage"/> class.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,26 @@
/// <summary>
/// Represents SSH_MSG_CHANNEL_EXTENDED_DATA message.
/// </summary>
[Message("SSH_MSG_CHANNEL_EXTENDED_DATA", 95)]
public class ChannelExtendedDataMessage : ChannelMessage
{
/// <inheritdoc />
public override string MessageName
{
get
{
return "SSH_MSG_CHANNEL_EXTENDED_DATA";
}
}

/// <inheritdoc />
public override byte MessageNumber
{
get
{
return 95;
}
}

/// <summary>
/// Gets message data type code.
/// </summary>
Expand Down
19 changes: 18 additions & 1 deletion src/Renci.SshNet/Messages/Connection/ChannelFailureMessage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,26 @@
/// <summary>
/// Represents SSH_MSG_CHANNEL_FAILURE message.
/// </summary>
[Message("SSH_MSG_CHANNEL_FAILURE", 100)]
public class ChannelFailureMessage : ChannelMessage
{
/// <inheritdoc />
public override string MessageName
{
get
{
return "SSH_MSG_CHANNEL_FAILURE";
}
}

/// <inheritdoc />
public override byte MessageNumber
{
get
{
return 100;
}
}

/// <summary>
/// Initializes a new instance of the <see cref="ChannelFailureMessage"/> class.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,28 @@ namespace Renci.SshNet.Messages.Connection
/// <summary>
/// Represents SSH_MSG_CHANNEL_OPEN message.
/// </summary>
[Message("SSH_MSG_CHANNEL_OPEN", MessageNumber)]
public class ChannelOpenMessage : Message
{
internal const byte MessageNumber = 90;

private byte[] _infoBytes;

/// <inheritdoc />
public override string MessageName
{
get
{
return "SSH_MSG_CHANNEL_OPEN";
}
}

/// <inheritdoc />
public override byte MessageNumber
{
get
{
return 90;
}
}

/// <summary>
/// Gets the type of the channel as ASCII encoded byte array.
/// </summary>
Expand Down
Loading