namespace Renci.SshNet.Messages.Connection { /// /// Represents "subsystem" type channel request information /// internal class SubsystemRequestInfo : RequestInfo { private byte[] _subsystemName; /// /// Channel request name /// public const string Name = "subsystem"; /// /// Gets the name of the request. /// /// /// The name of the request. /// public override string RequestName { get { return Name; } } /// /// Gets the name of the subsystem. /// /// /// The name of the subsystem. /// public string SubsystemName { get { return Ascii.GetString(_subsystemName, 0, _subsystemName.Length); } private set { _subsystemName = Ascii.GetBytes(value); } } protected override int BufferCapacity { get { var capacity = base.BufferCapacity; capacity += 4; // SubsystemName length capacity += _subsystemName.Length; // SubsystemName return capacity; } } /// /// Initializes a new instance of the class. /// public SubsystemRequestInfo() { WantReply = true; } /// /// Initializes a new instance of the class. /// /// The subsystem. public SubsystemRequestInfo(string subsystem) : this() { SubsystemName = subsystem; } /// /// Called when type specific data need to be loaded. /// protected override void LoadData() { base.LoadData(); _subsystemName = ReadBinary(); } /// /// Called when type specific data need to be saved. /// protected override void SaveData() { base.SaveData(); WriteBinaryString(_subsystemName); } } }