| | | 1 | | namespace Renci.SshNet.Messages.Connection |
| | | 2 | | { |
| | | 3 | | /// <summary> |
| | | 4 | | /// Represents SSH_MSG_CHANNEL_OPEN_CONFIRMATION message. |
| | | 5 | | /// </summary> |
| | | 6 | | [Message("SSH_MSG_CHANNEL_OPEN_CONFIRMATION", 91)] |
| | | 7 | | public class ChannelOpenConfirmationMessage : ChannelMessage |
| | | 8 | | { |
| | | 9 | | /// <summary> |
| | | 10 | | /// Gets the remote channel number. |
| | | 11 | | /// </summary> |
| | 3916 | 12 | | public uint RemoteChannelNumber { get; private set; } |
| | | 13 | | |
| | | 14 | | /// <summary> |
| | | 15 | | /// Gets the initial size of the window. |
| | | 16 | | /// </summary> |
| | | 17 | | /// <value> |
| | | 18 | | /// The initial size of the window. |
| | | 19 | | /// </value> |
| | 3916 | 20 | | public uint InitialWindowSize { get; private set; } |
| | | 21 | | |
| | | 22 | | /// <summary> |
| | | 23 | | /// Gets the maximum size of the packet. |
| | | 24 | | /// </summary> |
| | | 25 | | /// <value> |
| | | 26 | | /// The maximum size of the packet. |
| | | 27 | | /// </value> |
| | 3916 | 28 | | public uint MaximumPacketSize { get; private set; } |
| | | 29 | | |
| | | 30 | | /// <summary> |
| | | 31 | | /// Gets the size of the message in bytes. |
| | | 32 | | /// </summary> |
| | | 33 | | /// <value> |
| | | 34 | | /// The size of the messages in bytes. |
| | | 35 | | /// </value> |
| | | 36 | | protected override int BufferCapacity |
| | | 37 | | { |
| | | 38 | | get |
| | 2 | 39 | | { |
| | 2 | 40 | | var capacity = base.BufferCapacity; |
| | 2 | 41 | | capacity += 4; // RemoteChannelNumber |
| | 2 | 42 | | capacity += 4; // InitialWindowSize |
| | 2 | 43 | | capacity += 4; // MaximumPacketSize |
| | 2 | 44 | | return capacity; |
| | 2 | 45 | | } |
| | | 46 | | } |
| | | 47 | | |
| | | 48 | | /// <summary> |
| | | 49 | | /// Initializes a new instance of the <see cref="ChannelOpenConfirmationMessage"/> class. |
| | | 50 | | /// </summary> |
| | 1707 | 51 | | public ChannelOpenConfirmationMessage() |
| | 1707 | 52 | | { |
| | 1707 | 53 | | } |
| | | 54 | | |
| | | 55 | | /// <summary> |
| | | 56 | | /// Initializes a new instance of the <see cref="ChannelOpenConfirmationMessage"/> class. |
| | | 57 | | /// </summary> |
| | | 58 | | /// <param name="localChannelNumber">The local channel number.</param> |
| | | 59 | | /// <param name="initialWindowSize">Initial size of the window.</param> |
| | | 60 | | /// <param name="maximumPacketSize">Maximum size of the packet.</param> |
| | | 61 | | /// <param name="remoteChannelNumber">The remote channel number.</param> |
| | | 62 | | public ChannelOpenConfirmationMessage(uint localChannelNumber, uint initialWindowSize, uint maximumPacketSize, u |
| | 251 | 63 | | : base(localChannelNumber) |
| | 251 | 64 | | { |
| | 251 | 65 | | InitialWindowSize = initialWindowSize; |
| | 251 | 66 | | MaximumPacketSize = maximumPacketSize; |
| | 251 | 67 | | RemoteChannelNumber = remoteChannelNumber; |
| | 251 | 68 | | } |
| | | 69 | | |
| | | 70 | | /// <summary> |
| | | 71 | | /// Called when type specific data need to be loaded. |
| | | 72 | | /// </summary> |
| | | 73 | | protected override void LoadData() |
| | 1707 | 74 | | { |
| | 1707 | 75 | | base.LoadData(); |
| | 1707 | 76 | | RemoteChannelNumber = ReadUInt32(); |
| | 1707 | 77 | | InitialWindowSize = ReadUInt32(); |
| | 1707 | 78 | | MaximumPacketSize = ReadUInt32(); |
| | 1707 | 79 | | } |
| | | 80 | | |
| | | 81 | | /// <summary> |
| | | 82 | | /// Called when type specific data need to be saved. |
| | | 83 | | /// </summary> |
| | | 84 | | protected override void SaveData() |
| | 2 | 85 | | { |
| | 2 | 86 | | base.SaveData(); |
| | 2 | 87 | | Write(RemoteChannelNumber); |
| | 2 | 88 | | Write(InitialWindowSize); |
| | 2 | 89 | | Write(MaximumPacketSize); |
| | 2 | 90 | | } |
| | | 91 | | |
| | | 92 | | internal override void Process(Session session) |
| | 1707 | 93 | | { |
| | 1707 | 94 | | session.OnChannelOpenConfirmationReceived(this); |
| | 1707 | 95 | | } |
| | | 96 | | } |
| | | 97 | | } |