| 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_SPDY_SPDY_FRAMER_H_ | 5 #ifndef NET_SPDY_SPDY_FRAMER_H_ |
| 6 #define NET_SPDY_SPDY_FRAMER_H_ | 6 #define NET_SPDY_SPDY_FRAMER_H_ |
| 7 | 7 |
| 8 #include <list> | 8 #include <list> |
| 9 #include <map> | 9 #include <map> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 } // namespace test | 49 } // namespace test |
| 50 | 50 |
| 51 // A datastructure for holding a set of headers from a HEADERS, PUSH_PROMISE, | 51 // A datastructure for holding a set of headers from a HEADERS, PUSH_PROMISE, |
| 52 // SYN_STREAM, or SYN_REPLY frame. | 52 // SYN_STREAM, or SYN_REPLY frame. |
| 53 typedef std::map<std::string, std::string> SpdyHeaderBlock; | 53 typedef std::map<std::string, std::string> SpdyHeaderBlock; |
| 54 | 54 |
| 55 // A datastructure for holding the ID and flag fields for SETTINGS. | 55 // A datastructure for holding the ID and flag fields for SETTINGS. |
| 56 // Conveniently handles converstion to/from wire format. | 56 // Conveniently handles converstion to/from wire format. |
| 57 class NET_EXPORT_PRIVATE SettingsFlagsAndId { | 57 class NET_EXPORT_PRIVATE SettingsFlagsAndId { |
| 58 public: | 58 public: |
| 59 static SettingsFlagsAndId FromWireFormat(net::SpdyMajorVersion version, | 59 static SettingsFlagsAndId FromWireFormat(SpdyMajorVersion version, |
| 60 uint32 wire); | 60 uint32 wire); |
| 61 | 61 |
| 62 SettingsFlagsAndId() : flags_(0), id_(0) {} | 62 SettingsFlagsAndId() : flags_(0), id_(0) {} |
| 63 | 63 |
| 64 // TODO(hkhalil): restrict to enums instead of free-form ints. | 64 // TODO(hkhalil): restrict to enums instead of free-form ints. |
| 65 SettingsFlagsAndId(uint8 flags, uint32 id); | 65 SettingsFlagsAndId(uint8 flags, uint32 id); |
| 66 | 66 |
| 67 uint32 GetWireFormat(net::SpdyMajorVersion version) const; | 67 uint32 GetWireFormat(SpdyMajorVersion version) const; |
| 68 | 68 |
| 69 uint32 id() const { return id_; } | 69 uint32 id() const { return id_; } |
| 70 uint8 flags() const { return flags_; } | 70 uint8 flags() const { return flags_; } |
| 71 | 71 |
| 72 private: | 72 private: |
| 73 static void ConvertFlagsAndIdForSpdy2(uint32* val); | 73 static void ConvertFlagsAndIdForSpdy2(uint32* val); |
| 74 | 74 |
| 75 uint8 flags_; | 75 uint8 flags_; |
| 76 uint32 id_; | 76 uint32 id_; |
| 77 }; | 77 }; |
| (...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 314 // Constant for invalid (or unknown) stream IDs. | 314 // Constant for invalid (or unknown) stream IDs. |
| 315 static const SpdyStreamId kInvalidStream; | 315 static const SpdyStreamId kInvalidStream; |
| 316 | 316 |
| 317 // The maximum size of header data chunks delivered to the framer visitor | 317 // The maximum size of header data chunks delivered to the framer visitor |
| 318 // through OnControlFrameHeaderData. (It is exposed here for unit test | 318 // through OnControlFrameHeaderData. (It is exposed here for unit test |
| 319 // purposes.) | 319 // purposes.) |
| 320 static const size_t kHeaderDataChunkMaxSize; | 320 static const size_t kHeaderDataChunkMaxSize; |
| 321 | 321 |
| 322 // Serializes a SpdyHeaderBlock. | 322 // Serializes a SpdyHeaderBlock. |
| 323 static void WriteHeaderBlock(SpdyFrameBuilder* frame, | 323 static void WriteHeaderBlock(SpdyFrameBuilder* frame, |
| 324 const net::SpdyMajorVersion spdy_version, | 324 const SpdyMajorVersion spdy_version, |
| 325 const SpdyHeaderBlock* headers); | 325 const SpdyHeaderBlock* headers); |
| 326 | 326 |
| 327 // Retrieve serialized length of SpdyHeaderBlock. | 327 // Retrieve serialized length of SpdyHeaderBlock. |
| 328 // TODO(hkhalil): Remove, or move to quic code. | 328 // TODO(hkhalil): Remove, or move to quic code. |
| 329 static size_t GetSerializedLength( | 329 static size_t GetSerializedLength( |
| 330 const net::SpdyMajorVersion spdy_version, | 330 const SpdyMajorVersion spdy_version, |
| 331 const SpdyHeaderBlock* headers); | 331 const SpdyHeaderBlock* headers); |
| 332 | 332 |
| 333 // Create a new Framer, provided a SPDY version. | 333 // Create a new Framer, provided a SPDY version. |
| 334 explicit SpdyFramer(SpdyMajorVersion version); | 334 explicit SpdyFramer(SpdyMajorVersion version); |
| 335 virtual ~SpdyFramer(); | 335 virtual ~SpdyFramer(); |
| 336 | 336 |
| 337 // Set callbacks to be called from the framer. A visitor must be set, or | 337 // Set callbacks to be called from the framer. A visitor must be set, or |
| 338 // else the framer will likely crash. It is acceptable for the visitor | 338 // else the framer will likely crash. It is acceptable for the visitor |
| 339 // to do nothing. If this is called multiple times, only the last visitor | 339 // to do nothing. If this is called multiple times, only the last visitor |
| 340 // will be used. | 340 // will be used. |
| (...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 741 | 741 |
| 742 // Returns true if the given StringPiece contains any upper case | 742 // Returns true if the given StringPiece contains any upper case |
| 743 // characters. Assumes ASCII input. | 743 // characters. Assumes ASCII input. |
| 744 // Implemented here for cross-compatibility with Chromium. | 744 // Implemented here for cross-compatibility with Chromium. |
| 745 bool ContainsUpperASCII(base::StringPiece s) const; | 745 bool ContainsUpperASCII(base::StringPiece s) const; |
| 746 }; | 746 }; |
| 747 | 747 |
| 748 } // namespace net | 748 } // namespace net |
| 749 | 749 |
| 750 #endif // NET_SPDY_SPDY_FRAMER_H_ | 750 #endif // NET_SPDY_SPDY_FRAMER_H_ |
| OLD | NEW |