CloseStatusCode.cs 3.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. namespace SocketHttpListener
  2. {
  3. /// <summary>
  4. /// Contains the values of the status code for the WebSocket connection close.
  5. /// </summary>
  6. /// <remarks>
  7. /// <para>
  8. /// The values of the status code are defined in
  9. /// <see href="http://tools.ietf.org/html/rfc6455#section-7.4">Section 7.4</see>
  10. /// of RFC 6455.
  11. /// </para>
  12. /// <para>
  13. /// "Reserved value" must not be set as a status code in a close control frame
  14. /// by an endpoint. It's designated for use in applications expecting a status
  15. /// code to indicate that the connection was closed due to the system grounds.
  16. /// </para>
  17. /// </remarks>
  18. public enum CloseStatusCode : ushort
  19. {
  20. /// <summary>
  21. /// Equivalent to close status 1000.
  22. /// Indicates a normal close.
  23. /// </summary>
  24. Normal = 1000,
  25. /// <summary>
  26. /// Equivalent to close status 1001.
  27. /// Indicates that an endpoint is going away.
  28. /// </summary>
  29. Away = 1001,
  30. /// <summary>
  31. /// Equivalent to close status 1002.
  32. /// Indicates that an endpoint is terminating the connection due to a protocol error.
  33. /// </summary>
  34. ProtocolError = 1002,
  35. /// <summary>
  36. /// Equivalent to close status 1003.
  37. /// Indicates that an endpoint is terminating the connection because it has received
  38. /// an unacceptable type message.
  39. /// </summary>
  40. IncorrectData = 1003,
  41. /// <summary>
  42. /// Equivalent to close status 1004.
  43. /// Still undefined. Reserved value.
  44. /// </summary>
  45. Undefined = 1004,
  46. /// <summary>
  47. /// Equivalent to close status 1005.
  48. /// Indicates that no status code was actually present. Reserved value.
  49. /// </summary>
  50. NoStatusCode = 1005,
  51. /// <summary>
  52. /// Equivalent to close status 1006.
  53. /// Indicates that the connection was closed abnormally. Reserved value.
  54. /// </summary>
  55. Abnormal = 1006,
  56. /// <summary>
  57. /// Equivalent to close status 1007.
  58. /// Indicates that an endpoint is terminating the connection because it has received
  59. /// a message that contains a data that isn't consistent with the type of the message.
  60. /// </summary>
  61. InconsistentData = 1007,
  62. /// <summary>
  63. /// Equivalent to close status 1008.
  64. /// Indicates that an endpoint is terminating the connection because it has received
  65. /// a message that violates its policy.
  66. /// </summary>
  67. PolicyViolation = 1008,
  68. /// <summary>
  69. /// Equivalent to close status 1009.
  70. /// Indicates that an endpoint is terminating the connection because it has received
  71. /// a message that is too big to process.
  72. /// </summary>
  73. TooBig = 1009,
  74. /// <summary>
  75. /// Equivalent to close status 1010.
  76. /// Indicates that the client is terminating the connection because it has expected
  77. /// the server to negotiate one or more extension, but the server didn't return them
  78. /// in the handshake response.
  79. /// </summary>
  80. IgnoreExtension = 1010,
  81. /// <summary>
  82. /// Equivalent to close status 1011.
  83. /// Indicates that the server is terminating the connection because it has encountered
  84. /// an unexpected condition that prevented it from fulfilling the request.
  85. /// </summary>
  86. ServerError = 1011,
  87. /// <summary>
  88. /// Equivalent to close status 1015.
  89. /// Indicates that the connection was closed due to a failure to perform a TLS handshake.
  90. /// Reserved value.
  91. /// </summary>
  92. TlsHandshakeFailure = 1015
  93. }
  94. }