Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(66)

Side by Side Diff: net/websockets/websocket_frame_parser.h

Issue 14850012: Add missing status codes to WebSocketError enum. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Remove other mux status codes. Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « net/websockets/websocket_frame.cc ('k') | net/websockets/websocket_frame_parser.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_PARSER_H_ 5 #ifndef NET_WEBSOCKETS_WEBSOCKET_FRAME_PARSER_H_
6 #define NET_WEBSOCKETS_WEBSOCKET_FRAME_PARSER_H_ 6 #define NET_WEBSOCKETS_WEBSOCKET_FRAME_PARSER_H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 22 matching lines...) Expand all
33 // If the parser encounters invalid payload length format, Decode() fails 33 // If the parser encounters invalid payload length format, Decode() fails
34 // and returns false. Once Decode() has failed, the parser refuses to decode 34 // and returns false. Once Decode() has failed, the parser refuses to decode
35 // any more data and future invocations of Decode() will simply return false. 35 // any more data and future invocations of Decode() will simply return false.
36 // 36 //
37 // Payload data of parsed WebSocket frames may be incomplete; see comments in 37 // Payload data of parsed WebSocket frames may be incomplete; see comments in
38 // websocket_frame.h for more details. 38 // websocket_frame.h for more details.
39 bool Decode(const char* data, 39 bool Decode(const char* data,
40 size_t length, 40 size_t length,
41 ScopedVector<WebSocketFrameChunk>* frame_chunks); 41 ScopedVector<WebSocketFrameChunk>* frame_chunks);
42 42
43 // Returns WEB_SOCKET_OK if the parser has not failed to decode WebSocket 43 // Returns kWebSocketNormalClosure if the parser has not failed to decode
44 // frames. Otherwise returns WebSocketError which is defined in 44 // WebSocket frames. Otherwise returns WebSocketError which is defined in
45 // websocket_errors.h. We can convert net::WebSocketError to net::Error by 45 // websocket_errors.h. We can convert net::WebSocketError to net::Error by
46 // using WebSocketErrorToNetError(). 46 // using WebSocketErrorToNetError().
47 WebSocketError websocket_error() const { return websocket_error_; } 47 WebSocketError websocket_error() const { return websocket_error_; }
48 48
49 private: 49 private:
50 // Tries to decode a frame header from |current_read_pos_|. 50 // Tries to decode a frame header from |current_read_pos_|.
51 // If successful, this function updates |current_read_pos_|, 51 // If successful, this function updates |current_read_pos_|,
52 // |current_frame_header_|, and |masking_key_| (if available). 52 // |current_frame_header_|, and |masking_key_| (if available).
53 // This function may set |failed_| to true if it observes a corrupt frame. 53 // This function may set |failed_| to true if it observes a corrupt frame.
54 // If there is not enough data in the remaining buffer to parse a frame 54 // If there is not enough data in the remaining buffer to parse a frame
(...skipping 23 matching lines...) Expand all
78 uint64 frame_offset_; 78 uint64 frame_offset_;
79 79
80 WebSocketError websocket_error_; 80 WebSocketError websocket_error_;
81 81
82 DISALLOW_COPY_AND_ASSIGN(WebSocketFrameParser); 82 DISALLOW_COPY_AND_ASSIGN(WebSocketFrameParser);
83 }; 83 };
84 84
85 } // namespace net 85 } // namespace net
86 86
87 #endif // NET_WEBSOCKETS_WEBSOCKET_FRAME_PARSER_H_ 87 #endif // NET_WEBSOCKETS_WEBSOCKET_FRAME_PARSER_H_
OLDNEW
« no previous file with comments | « net/websockets/websocket_frame.cc ('k') | net/websockets/websocket_frame_parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698