| | | 1 | | namespace Renci.SshNet.Messages.Connection |
| | | 2 | | { |
| | | 3 | | /// <summary> |
| | | 4 | | /// Represents "break" type channel request information. |
| | | 5 | | /// </summary> |
| | | 6 | | internal sealed class BreakRequestInfo : RequestInfo |
| | | 7 | | { |
| | | 8 | | /// <summary> |
| | | 9 | | /// Channel request name. |
| | | 10 | | /// </summary> |
| | | 11 | | public const string Name = "break"; |
| | | 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 break length in milliseconds. |
| | | 26 | | /// </summary> |
| | 0 | 27 | | public uint BreakLength { get; private set; } |
| | | 28 | | |
| | | 29 | | /// <summary> |
| | | 30 | | /// Gets the size of the message in bytes. |
| | | 31 | | /// </summary> |
| | | 32 | | /// <value> |
| | | 33 | | /// The size of the messages in bytes. |
| | | 34 | | /// </value> |
| | | 35 | | protected override int BufferCapacity |
| | | 36 | | { |
| | | 37 | | get |
| | 0 | 38 | | { |
| | 0 | 39 | | var capacity = base.BufferCapacity; |
| | 0 | 40 | | capacity += 4; // BreakLength |
| | 0 | 41 | | return capacity; |
| | 0 | 42 | | } |
| | | 43 | | } |
| | | 44 | | |
| | | 45 | | /// <summary> |
| | | 46 | | /// Initializes a new instance of the <see cref="BreakRequestInfo"/> class. |
| | | 47 | | /// </summary> |
| | 0 | 48 | | public BreakRequestInfo() |
| | 0 | 49 | | { |
| | 0 | 50 | | WantReply = true; |
| | 0 | 51 | | } |
| | | 52 | | |
| | | 53 | | /// <summary> |
| | | 54 | | /// Initializes a new instance of the <see cref="BreakRequestInfo"/> class. |
| | | 55 | | /// </summary> |
| | | 56 | | /// <param name="breakLength">Length of the break.</param> |
| | | 57 | | public BreakRequestInfo(uint breakLength) |
| | 0 | 58 | | : this() |
| | 0 | 59 | | { |
| | 0 | 60 | | BreakLength = breakLength; |
| | 0 | 61 | | } |
| | | 62 | | |
| | | 63 | | /// <summary> |
| | | 64 | | /// Called when type specific data need to be loaded. |
| | | 65 | | /// </summary> |
| | | 66 | | protected override void LoadData() |
| | 0 | 67 | | { |
| | 0 | 68 | | base.LoadData(); |
| | | 69 | | |
| | 0 | 70 | | BreakLength = ReadUInt32(); |
| | 0 | 71 | | } |
| | | 72 | | |
| | | 73 | | /// <summary> |
| | | 74 | | /// Called when type specific data need to be saved. |
| | | 75 | | /// </summary> |
| | | 76 | | protected override void SaveData() |
| | 0 | 77 | | { |
| | 0 | 78 | | base.SaveData(); |
| | | 79 | | |
| | 0 | 80 | | Write(BreakLength); |
| | 0 | 81 | | } |
| | | 82 | | } |
| | | 83 | | } |