OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef NET_WEBSOCKETS_WEBSOCKET_ERRORS_H_ | 5 #ifndef NET_WEBSOCKETS_WEBSOCKET_ERRORS_H_ |
6 #define NET_WEBSOCKETS_WEBSOCKET_ERRORS_H_ | 6 #define NET_WEBSOCKETS_WEBSOCKET_ERRORS_H_ |
7 | 7 |
8 #include "net/base/net_errors.h" | 8 #include "net/base/net_errors.h" |
9 | 9 |
10 namespace net { | 10 namespace net { |
11 | 11 |
12 // Error values for WebSocket framing. | 12 // Reason codes used with close messages. NoStatusReceived, |
13 // This values are compatible to RFC6455 defined status codes. | 13 // AbnormalClosure and TlsHandshake are special in that they |
14 // should never be sent on the wire; they are only used within the | |
15 // implementation. | |
14 enum WebSocketError { | 16 enum WebSocketError { |
15 WEB_SOCKET_OK = 1000, | 17 // Status codes in the range 0 to 999 are not used. |
16 WEB_SOCKET_ERR_PROTOCOL_ERROR = 1002, | 18 |
17 WEB_SOCKET_ERR_MESSAGE_TOO_BIG = 1009 | 19 // The following are standard codes defined by RFC6455. |
20 kWebSocketNormalClosure = 1000, | |
21 kWebSocketErrorGoingAway = 1001, | |
22 kWebSocketErrorProtocolError = 1002, | |
23 kWebSocketErrorUnsupportedData = 1003, | |
24 kWebSocketErrorNoStatusReceived = 1005, | |
25 kWebSocketErrorAbnormalClosure = 1006, | |
26 kWebSocketErrorInvalidFramePayloadData = 1007, | |
27 kWebSocketErrorPolicyViolation = 1008, | |
28 kWebSocketErrorMessageTooBig = 1009, | |
29 kWebSocketErrorMandatoryExtension = 1010, | |
30 kWebSocketErrorInternalServerError = 1011, | |
31 kWebSocketErrorTlsHandshake = 1015, | |
32 | |
33 // The following codes are defined in the | |
34 // draft-ietf-hybi-websocket-multiplexing spec and so are subject to change. | |
35 // Codes starting with 2000 apply to the physical connection. They are used | |
36 // for dropping the control channel. | |
tyoshino (SeeGerritForStatus)
2013/05/02 13:56:22
drop reason code of multiplexing spec are used onl
Adam Rice
2013/05/04 09:51:53
I thought it was necessary to include them to make
| |
37 kWebSocketErrorPhysicalConnectionFailed = 2000, | |
38 kWebSocketErrorInvalidEncapsulatingMessage = 2001, | |
39 kWebSocketErrorChannelIdTruncated = 2002, | |
40 kWebSocketErrorEncapsulatedFrameIsTruncated = 2003, | |
41 kWebSocketErrorUnknownMuxOpcode = 2004, | |
42 kWebSocketErrorInvalidMuxControlBlock = 2005, | |
43 kWebSocketErrorChannelAlreadyExists = 2006, | |
44 kWebSocketErrorNewChannelSlotViolation = 2007, | |
45 kWebSocketErrorNewChannelSlotOverFlow = 2008, | |
46 kWebSocketErrorBadRequest = 2009, | |
47 kWebSocketErrorUnknownRequestEncoding = 2010, | |
48 kWebSocketErrorBadResponse = 2011, | |
49 kWebSocketErrorUnknownResponseEncoding = 2012, | |
50 | |
51 // The range 1000-2999 is reserved by RFC6455 for use by the WebSocket | |
52 // protocol and public extensions. | |
53 kWebSocketErrorProtocolReservedMax = 2999, | |
54 | |
55 // Codes starting with 3000 apply to the logical connection in the | |
56 // draft-ietf-hybi-websocket-multiplexing spec | |
57 kWebSocketErrorLogicalChannelFailed = 3000, | |
58 kWebSocketErrorSendQuotaViolation = 3005, | |
59 kWebSocketErrorSendQuotaOverflow = 3006, | |
60 kWebSocketErrorIdleTimeout = 3007, | |
61 kWebSocketErrorDropChannelAck = 3008, | |
62 kWebSocketErrorBadFragmentation = 3009, | |
63 | |
64 // The range 3000-3999 is reserved by RFC6455 for registered use by libraries, | |
65 // frameworks and applications. | |
66 kWebSocketErrorRegisteredReservedMax = 3999, | |
67 | |
68 // The range 4000-4999 is reserved by RFC6455 for private use by prior | |
69 // agreement of the endpoints. | |
70 kWebSocketErrorPrivateReservedMin = 4000, | |
71 kWebSocketErrorPrivateReservedMax = 4999, | |
18 }; | 72 }; |
19 | 73 |
20 // Convert WebSocketError to net::Error defined in net/base/net_errors.h. | 74 // Convert WebSocketError to net::Error defined in net/base/net_errors.h. |
21 NET_EXPORT_PRIVATE Error WebSocketErrorToNetError(WebSocketError error); | 75 NET_EXPORT_PRIVATE Error WebSocketErrorToNetError(WebSocketError error); |
22 | 76 |
23 } // namespace net | 77 } // namespace net |
24 | 78 |
25 #endif // NET_WEBSOCKETS_WEBSOCKET_FRAME_H_ | 79 #endif // NET_WEBSOCKETS_WEBSOCKET_ERRORS_H_ |
tyoshino (SeeGerritForStatus)
2013/05/02 13:56:22
good catch.
| |
OLD | NEW |