ExitSignalRequestInfo.cs 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. namespace Renci.SshNet.Messages.Connection
  2. {
  3. /// <summary>
  4. /// Represents "exit-signal" type channel request information
  5. /// </summary>
  6. internal class ExitSignalRequestInfo : RequestInfo
  7. {
  8. /// <summary>
  9. /// Channel request name
  10. /// </summary>
  11. public const string NAME = "exit-signal";
  12. /// <summary>
  13. /// Gets the name of the request.
  14. /// </summary>
  15. /// <value>
  16. /// The name of the request.
  17. /// </value>
  18. public override string RequestName
  19. {
  20. get { return NAME; }
  21. }
  22. /// <summary>
  23. /// Gets the name of the signal.
  24. /// </summary>
  25. /// <value>
  26. /// The name of the signal.
  27. /// </value>
  28. public string SignalName { get; private set; }
  29. /// <summary>
  30. /// Gets a value indicating whether core is dumped.
  31. /// </summary>
  32. /// <value>
  33. /// <c>true</c> if core is dumped; otherwise, <c>false</c>.
  34. /// </value>
  35. public bool CoreDumped { get; private set; }
  36. /// <summary>
  37. /// Gets the error message.
  38. /// </summary>
  39. public string ErrorMessage { get; private set; }
  40. /// <summary>
  41. /// Gets message language.
  42. /// </summary>
  43. public string Language { get; private set; }
  44. /// <summary>
  45. /// Initializes a new instance of the <see cref="ExitSignalRequestInfo"/> class.
  46. /// </summary>
  47. public ExitSignalRequestInfo()
  48. {
  49. this.WantReply = false;
  50. }
  51. /// <summary>
  52. /// Initializes a new instance of the <see cref="ExitSignalRequestInfo"/> class.
  53. /// </summary>
  54. /// <param name="signalName">Name of the signal.</param>
  55. /// <param name="coreDumped">if set to <c>true</c> then core is dumped.</param>
  56. /// <param name="errorMessage">The error message.</param>
  57. /// <param name="language">The language.</param>
  58. public ExitSignalRequestInfo(string signalName, bool coreDumped, string errorMessage, string language)
  59. : this()
  60. {
  61. this.SignalName = signalName;
  62. this.CoreDumped = coreDumped;
  63. this.ErrorMessage = errorMessage;
  64. this.Language = language;
  65. }
  66. /// <summary>
  67. /// Called when type specific data need to be loaded.
  68. /// </summary>
  69. protected override void LoadData()
  70. {
  71. base.LoadData();
  72. this.SignalName = this.ReadAsciiString();
  73. this.CoreDumped = this.ReadBoolean();
  74. this.ErrorMessage = this.ReadString();
  75. this.Language = this.ReadString();
  76. }
  77. /// <summary>
  78. /// Called when type specific data need to be saved.
  79. /// </summary>
  80. protected override void SaveData()
  81. {
  82. base.SaveData();
  83. this.WriteAscii(this.SignalName);
  84. this.Write(this.CoreDumped);
  85. this.Write(this.ErrorMessage);
  86. this.Write(this.Language);
  87. }
  88. }
  89. }