CloseStatusCode.cs 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. #region License
  2. /*
  3. * CloseStatusCode.cs
  4. *
  5. * The MIT License
  6. *
  7. * Copyright (c) 2012-2016 sta.blockhead
  8. *
  9. * Permission is hereby granted, free of charge, to any person obtaining a copy
  10. * of this software and associated documentation files (the "Software"), to deal
  11. * in the Software without restriction, including without limitation the rights
  12. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  13. * copies of the Software, and to permit persons to whom the Software is
  14. * furnished to do so, subject to the following conditions:
  15. *
  16. * The above copyright notice and this permission notice shall be included in
  17. * all copies or substantial portions of the Software.
  18. *
  19. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  20. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  21. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  22. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  23. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  24. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  25. * THE SOFTWARE.
  26. */
  27. #endregion
  28. using System;
  29. namespace WebSocketSharp
  30. {
  31. /// <summary>
  32. /// Indicates the status code for the WebSocket connection close.
  33. /// </summary>
  34. /// <remarks>
  35. /// <para>
  36. /// The values of this enumeration are defined in
  37. /// <see href="http://tools.ietf.org/html/rfc6455#section-7.4">
  38. /// Section 7.4</see> of RFC 6455.
  39. /// </para>
  40. /// <para>
  41. /// "Reserved value" cannot be sent as a status code in
  42. /// closing handshake by an endpoint.
  43. /// </para>
  44. /// </remarks>
  45. public enum CloseStatusCode : ushort
  46. {
  47. /// <summary>
  48. /// Equivalent to close status 1000. Indicates normal close.
  49. /// </summary>
  50. Normal = 1000,
  51. /// <summary>
  52. /// Equivalent to close status 1001. Indicates that an endpoint is
  53. /// going away.
  54. /// </summary>
  55. Away = 1001,
  56. /// <summary>
  57. /// Equivalent to close status 1002. Indicates that an endpoint is
  58. /// terminating the connection due to a protocol error.
  59. /// </summary>
  60. ProtocolError = 1002,
  61. /// <summary>
  62. /// Equivalent to close status 1003. Indicates that an endpoint is
  63. /// terminating the connection because it has received a type of
  64. /// data that it cannot accept.
  65. /// </summary>
  66. UnsupportedData = 1003,
  67. /// <summary>
  68. /// Equivalent to close status 1004. Still undefined. A Reserved value.
  69. /// </summary>
  70. Undefined = 1004,
  71. /// <summary>
  72. /// Equivalent to close status 1005. Indicates that no status code was
  73. /// actually present. A Reserved value.
  74. /// </summary>
  75. NoStatus = 1005,
  76. /// <summary>
  77. /// Equivalent to close status 1006. Indicates that the connection was
  78. /// closed abnormally. A Reserved value.
  79. /// </summary>
  80. Abnormal = 1006,
  81. /// <summary>
  82. /// Equivalent to close status 1007. Indicates that an endpoint is
  83. /// terminating the connection because it has received a message that
  84. /// contains data that is not consistent with the type of the message.
  85. /// </summary>
  86. InvalidData = 1007,
  87. /// <summary>
  88. /// Equivalent to close status 1008. Indicates that an endpoint is
  89. /// terminating the connection because it has received a message that
  90. /// violates its policy.
  91. /// </summary>
  92. PolicyViolation = 1008,
  93. /// <summary>
  94. /// Equivalent to close status 1009. Indicates that an endpoint is
  95. /// terminating the connection because it has received a message that
  96. /// is too big to process.
  97. /// </summary>
  98. TooBig = 1009,
  99. /// <summary>
  100. /// Equivalent to close status 1010. Indicates that a client is
  101. /// terminating the connection because it has expected the server to
  102. /// negotiate one or more extension, but the server did not return
  103. /// them in the handshake response.
  104. /// </summary>
  105. MandatoryExtension = 1010,
  106. /// <summary>
  107. /// Equivalent to close status 1011. Indicates that a server is
  108. /// terminating the connection because it has encountered an unexpected
  109. /// condition that prevented it from fulfilling the request.
  110. /// </summary>
  111. ServerError = 1011,
  112. /// <summary>
  113. /// Equivalent to close status 1015. Indicates that the connection was
  114. /// closed due to a failure to perform a TLS handshake. A Reserved value.
  115. /// </summary>
  116. TlsHandshakeFailure = 1015
  117. }
  118. }