ServiceAcceptMessage.cs 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. using System;
  2. using Renci.SshNet.Common;
  3. namespace Renci.SshNet.Messages.Transport
  4. {
  5. /// <summary>
  6. /// Represents SSH_MSG_SERVICE_ACCEPT message.
  7. /// </summary>
  8. [Message("SSH_MSG_SERVICE_ACCEPT", MessageNumber)]
  9. public class ServiceAcceptMessage : Message
  10. {
  11. internal const byte MessageNumber = 6;
  12. /// <summary>
  13. /// Gets the name of the service.
  14. /// </summary>
  15. /// <value>
  16. /// The name of the service.
  17. /// </value>
  18. public ServiceName ServiceName { get; private set; }
  19. /// <summary>
  20. /// Called when type specific data need to be loaded.
  21. /// </summary>
  22. protected override void LoadData()
  23. {
  24. #if TUNING
  25. ServiceName = ReadBinary().ToServiceName();
  26. #else
  27. var serviceName = ReadAsciiString();
  28. switch (serviceName)
  29. {
  30. case "ssh-userauth":
  31. ServiceName = ServiceName.UserAuthentication;
  32. break;
  33. case "ssh-connection":
  34. ServiceName = ServiceName.Connection;
  35. break;
  36. }
  37. #endif
  38. }
  39. /// <summary>
  40. /// Called when type specific data need to be saved.
  41. /// </summary>
  42. protected override void SaveData()
  43. {
  44. throw new NotImplementedException();
  45. }
  46. }
  47. }