namespace Renci.SshNet.Messages.Connection { /// /// Represents SSH_MSG_REQUEST_SUCCESS message. /// [Message("SSH_MSG_REQUEST_SUCCESS", 81)] public class RequestSuccessMessage : Message { /// /// Gets the bound port. /// public uint? BoundPort { get; private set; } /// /// Gets the size of the message in bytes. /// /// /// The size of the messages in bytes. /// protected override int BufferCapacity { get { var capacity = base.BufferCapacity; if (BoundPort.HasValue) { capacity += 4; // BoundPort } return capacity; } } /// /// Initializes a new instance of the class. /// public RequestSuccessMessage() { } /// /// Initializes a new instance of the class. /// /// The bound port. public RequestSuccessMessage(uint boundPort) { BoundPort = boundPort; } /// /// Called when type specific data need to be loaded. /// protected override void LoadData() { if (!IsEndOfData) { BoundPort = ReadUInt32(); } } /// /// Called when type specific data need to be saved. /// protected override void SaveData() { if (BoundPort.HasValue) { Write(BoundPort.Value); } } internal override void Process(Session session) { session.OnRequestSuccessReceived(this); } } }