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_FRAME_H_ | 5 #ifndef NET_WEBSOCKETS_WEBSOCKET_FRAME_H_ |
6 #define NET_WEBSOCKETS_WEBSOCKET_FRAME_H_ | 6 #define NET_WEBSOCKETS_WEBSOCKET_FRAME_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
13 #include "net/base/net_export.h" | 13 #include "net/base/net_export.h" |
14 | 14 |
15 namespace net { | 15 namespace net { |
16 | 16 |
17 class IOBufferWithSize; | 17 class IOBufferWithSize; |
18 | 18 |
19 // Error values for WebSocket framing. | |
20 // This values are compatible to RFC6455 defined status codes. | |
21 enum WebSocketError { | |
22 WS_OK = 1000, | |
23 WS_ERR_PROTOCOL_ERROR = 1002, | |
24 WS_ERR_MESSAGE_TOO_BIG = 1009 | |
mmenke
2012/08/01 14:44:59
It's a bit long, but I think it's worth writing WE
Takashi Toyoshima
2012/08/02 08:11:35
Done.
| |
25 }; | |
mmenke
2012/08/01 14:44:59
Wonder if it makes sense to move these to their ow
Takashi Toyoshima
2012/08/02 08:11:35
Done.
| |
26 | |
19 // Represents a WebSocket frame header. | 27 // Represents a WebSocket frame header. |
20 // | 28 // |
21 // Members of this class correspond to each element in WebSocket frame header | 29 // Members of this class correspond to each element in WebSocket frame header |
22 // (see http://tools.ietf.org/html/rfc6455#section-5.2). | 30 // (see http://tools.ietf.org/html/rfc6455#section-5.2). |
23 struct NET_EXPORT_PRIVATE WebSocketFrameHeader { | 31 struct NET_EXPORT_PRIVATE WebSocketFrameHeader { |
24 typedef int OpCode; | 32 typedef int OpCode; |
25 static const OpCode kOpCodeContinuation; | 33 static const OpCode kOpCodeContinuation; |
26 static const OpCode kOpCodeText; | 34 static const OpCode kOpCodeText; |
27 static const OpCode kOpCodeBinary; | 35 static const OpCode kOpCodeBinary; |
28 static const OpCode kOpCodeClose; | 36 static const OpCode kOpCodeClose; |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
125 // used for unmasking a WebSocket frame. | 133 // used for unmasking a WebSocket frame. |
126 NET_EXPORT_PRIVATE void MaskWebSocketFramePayload( | 134 NET_EXPORT_PRIVATE void MaskWebSocketFramePayload( |
127 const WebSocketMaskingKey& masking_key, | 135 const WebSocketMaskingKey& masking_key, |
128 uint64 frame_offset, | 136 uint64 frame_offset, |
129 char* data, | 137 char* data, |
130 int data_size); | 138 int data_size); |
131 | 139 |
132 } // namespace net | 140 } // namespace net |
133 | 141 |
134 #endif // NET_WEBSOCKETS_WEBSOCKET_FRAME_H_ | 142 #endif // NET_WEBSOCKETS_WEBSOCKET_FRAME_H_ |
OLD | NEW |