| 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 <stdint.h> |
| 8 #include <vector> | 9 #include <vector> |
| 9 | 10 |
| 10 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 11 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
| 12 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
| 13 #include "net/base/net_export.h" | 14 #include "net/base/net_export.h" |
| 14 | 15 |
| 15 namespace net { | 16 namespace net { |
| 16 | 17 |
| 17 class IOBuffer; | 18 class IOBuffer; |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 void CopyFrom(const WebSocketFrameHeader& source); | 77 void CopyFrom(const WebSocketFrameHeader& source); |
| 77 | 78 |
| 78 // Members below correspond to each item in WebSocket frame header. | 79 // Members below correspond to each item in WebSocket frame header. |
| 79 // See <http://tools.ietf.org/html/rfc6455#section-5.2> for details. | 80 // See <http://tools.ietf.org/html/rfc6455#section-5.2> for details. |
| 80 bool final; | 81 bool final; |
| 81 bool reserved1; | 82 bool reserved1; |
| 82 bool reserved2; | 83 bool reserved2; |
| 83 bool reserved3; | 84 bool reserved3; |
| 84 OpCode opcode; | 85 OpCode opcode; |
| 85 bool masked; | 86 bool masked; |
| 86 uint64 payload_length; | 87 uint64_t payload_length; |
| 87 | 88 |
| 88 private: | 89 private: |
| 89 DISALLOW_COPY_AND_ASSIGN(WebSocketFrameHeader); | 90 DISALLOW_COPY_AND_ASSIGN(WebSocketFrameHeader); |
| 90 }; | 91 }; |
| 91 | 92 |
| 92 // Contains an entire WebSocket frame including payload. This is used by APIs | 93 // Contains an entire WebSocket frame including payload. This is used by APIs |
| 93 // that are not concerned about retaining the original frame boundaries (because | 94 // that are not concerned about retaining the original frame boundaries (because |
| 94 // frames may need to be split in order for the data to fit in memory). | 95 // frames may need to be split in order for the data to fit in memory). |
| 95 struct NET_EXPORT_PRIVATE WebSocketFrame { | 96 struct NET_EXPORT_PRIVATE WebSocketFrame { |
| 96 // A frame must always have an opcode, so this parameter is compulsory. | 97 // A frame must always have an opcode, so this parameter is compulsory. |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 // to the given payload data. | 180 // to the given payload data. |
| 180 // | 181 // |
| 181 // This function masks |data| with |masking_key|, assuming |data| is partial | 182 // This function masks |data| with |masking_key|, assuming |data| is partial |
| 182 // data starting from |frame_offset| bytes from the beginning of the payload | 183 // data starting from |frame_offset| bytes from the beginning of the payload |
| 183 // data. | 184 // data. |
| 184 // | 185 // |
| 185 // Since frame masking is a reversible operation, this function can also be | 186 // Since frame masking is a reversible operation, this function can also be |
| 186 // used for unmasking a WebSocket frame. | 187 // used for unmasking a WebSocket frame. |
| 187 NET_EXPORT void MaskWebSocketFramePayload( | 188 NET_EXPORT void MaskWebSocketFramePayload( |
| 188 const WebSocketMaskingKey& masking_key, | 189 const WebSocketMaskingKey& masking_key, |
| 189 uint64 frame_offset, | 190 uint64_t frame_offset, |
| 190 char* data, | 191 char* data, |
| 191 int data_size); | 192 int data_size); |
| 192 | 193 |
| 193 } // namespace net | 194 } // namespace net |
| 194 | 195 |
| 195 #endif // NET_WEBSOCKETS_WEBSOCKET_FRAME_H_ | 196 #endif // NET_WEBSOCKETS_WEBSOCKET_FRAME_H_ |
| OLD | NEW |