| | | 1 | | namespace Renci.SshNet.Messages.Connection |
| | | 2 | | { |
| | | 3 | | /// <summary> |
| | | 4 | | /// Represents "xon-xoff" type channel request information. |
| | | 5 | | /// </summary> |
| | | 6 | | internal sealed class XonXoffRequestInfo : RequestInfo |
| | | 7 | | { |
| | | 8 | | /// <summary> |
| | | 9 | | /// Channel request type. |
| | | 10 | | /// </summary> |
| | | 11 | | public const string Name = "xon-xoff"; |
| | | 12 | | |
| | | 13 | | /// <summary> |
| | | 14 | | /// Gets the name of the request. |
| | | 15 | | /// </summary> |
| | | 16 | | /// <value> |
| | | 17 | | /// The name of the request. |
| | | 18 | | /// </value> |
| | | 19 | | public override string RequestName |
| | | 20 | | { |
| | 0 | 21 | | get { return Name; } |
| | | 22 | | } |
| | | 23 | | |
| | | 24 | | /// <summary> |
| | | 25 | | /// Gets or sets a value indicating whether client can do. |
| | | 26 | | /// </summary> |
| | | 27 | | /// <value> |
| | | 28 | | /// <see langword="true"/> if client can do; otherwise, <see langword="false"/>. |
| | | 29 | | /// </value> |
| | 0 | 30 | | public bool ClientCanDo { get; set; } |
| | | 31 | | |
| | | 32 | | /// <summary> |
| | | 33 | | /// Gets the size of the message in bytes. |
| | | 34 | | /// </summary> |
| | | 35 | | /// <value> |
| | | 36 | | /// The size of the messages in bytes. |
| | | 37 | | /// </value> |
| | | 38 | | protected override int BufferCapacity |
| | | 39 | | { |
| | | 40 | | get |
| | 0 | 41 | | { |
| | 0 | 42 | | var capacity = base.BufferCapacity; |
| | 0 | 43 | | capacity += 1; // ClientCanDo |
| | 0 | 44 | | return capacity; |
| | 0 | 45 | | } |
| | | 46 | | } |
| | | 47 | | |
| | | 48 | | /// <summary> |
| | | 49 | | /// Initializes a new instance of the <see cref="XonXoffRequestInfo"/> class. |
| | | 50 | | /// </summary> |
| | 2804 | 51 | | public XonXoffRequestInfo() |
| | 2804 | 52 | | { |
| | 2804 | 53 | | WantReply = false; |
| | 2804 | 54 | | } |
| | | 55 | | |
| | | 56 | | /// <summary> |
| | | 57 | | /// Initializes a new instance of the <see cref="XonXoffRequestInfo"/> class. |
| | | 58 | | /// </summary> |
| | | 59 | | /// <param name="clientCanDo">if set to <see langword="true"/> [client can do].</param> |
| | | 60 | | public XonXoffRequestInfo(bool clientCanDo) |
| | 0 | 61 | | : this() |
| | 0 | 62 | | { |
| | 0 | 63 | | ClientCanDo = clientCanDo; |
| | 0 | 64 | | } |
| | | 65 | | |
| | | 66 | | /// <summary> |
| | | 67 | | /// Called when type specific data need to be loaded. |
| | | 68 | | /// </summary> |
| | | 69 | | protected override void LoadData() |
| | 0 | 70 | | { |
| | 0 | 71 | | base.LoadData(); |
| | | 72 | | |
| | 0 | 73 | | ClientCanDo = ReadBoolean(); |
| | 0 | 74 | | } |
| | | 75 | | |
| | | 76 | | /// <summary> |
| | | 77 | | /// Called when type specific data need to be saved. |
| | | 78 | | /// </summary> |
| | | 79 | | protected override void SaveData() |
| | 0 | 80 | | { |
| | 0 | 81 | | base.SaveData(); |
| | | 82 | | |
| | 0 | 83 | | Write(ClientCanDo); |
| | 0 | 84 | | } |
| | | 85 | | } |
| | | 86 | | } |