namespace Renci.SshNet.Messages.Connection { /// /// Represents SSH_MSG_GLOBAL_REQUEST message. /// [Message("SSH_MSG_GLOBAL_REQUEST", 80)] public class GlobalRequestMessage : Message { private byte[] _requestName; /// /// Gets the name of the request. /// /// /// The name of the request. /// public string RequestName { get { return Ascii.GetString(_requestName, 0, _requestName.Length); } } /// /// Gets a value indicating whether message reply should be sent.. /// /// /// true if message reply should be sent; otherwise, false. /// public bool WantReply { 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; capacity += 4; // RequestName length capacity += _requestName.Length; // RequestName capacity += 1; // WantReply return capacity; } } /// /// Initializes a new instance of the class. /// public GlobalRequestMessage() { } /// /// Initializes a new instance of the class. /// /// Name of the request. /// if set to true [want reply]. internal GlobalRequestMessage(byte[] requestName, bool wantReply) { _requestName = requestName; WantReply = wantReply; } /// /// Called when type specific data need to be loaded. /// protected override void LoadData() { _requestName = ReadBinary(); WantReply = ReadBoolean(); } /// /// Called when type specific data need to be saved. /// protected override void SaveData() { WriteBinaryString(_requestName); Write(WantReply); } internal override void Process(Session session) { session.OnGlobalRequestReceived(this); } } }