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