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 <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 | 57 |
58 // TODO(hkhalil): restrict to enums instead of free-form ints. | 58 // TODO(hkhalil): restrict to enums instead of free-form ints. |
59 SettingsFlagsAndId(uint8_t flags, uint32_t id); | 59 SettingsFlagsAndId(uint8_t flags, uint32_t id); |
60 | 60 |
61 uint32_t GetWireFormat(SpdyMajorVersion version) const; | 61 uint32_t GetWireFormat(SpdyMajorVersion version) const; |
62 | 62 |
63 uint32_t id() const { return id_; } | 63 uint32_t id() const { return id_; } |
64 uint8_t flags() const { return flags_; } | 64 uint8_t flags() const { return flags_; } |
65 | 65 |
66 private: | 66 private: |
67 static void ConvertFlagsAndIdForSpdy2(uint32_t* val); | |
68 | |
69 uint8_t flags_; | 67 uint8_t flags_; |
70 uint32_t id_; | 68 uint32_t id_; |
71 }; | 69 }; |
72 | 70 |
73 // SettingsMap has unique (flags, value) pair for given SpdySettingsIds ID. | 71 // SettingsMap has unique (flags, value) pair for given SpdySettingsIds ID. |
74 typedef std::pair<SpdySettingsFlags, uint32_t> SettingsFlagsAndValue; | 72 typedef std::pair<SpdySettingsFlags, uint32_t> SettingsFlagsAndValue; |
75 typedef std::map<SpdySettingsIds, SettingsFlagsAndValue> SettingsMap; | 73 typedef std::map<SpdySettingsIds, SettingsFlagsAndValue> SettingsMap; |
76 | 74 |
77 // SpdyFramerVisitorInterface is a set of callbacks for the SpdyFramer. | 75 // SpdyFramerVisitorInterface is a set of callbacks for the SpdyFramer. |
78 // Implement this interface to receive event callbacks as frames are | 76 // Implement this interface to receive event callbacks as frames are |
(...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
541 // For debugging. | 539 // For debugging. |
542 static const char* StateToString(int state); | 540 static const char* StateToString(int state); |
543 static const char* ErrorCodeToString(int error_code); | 541 static const char* ErrorCodeToString(int error_code); |
544 static const char* StatusCodeToString(int status_code); | 542 static const char* StatusCodeToString(int status_code); |
545 static const char* FrameTypeToString(SpdyFrameType type); | 543 static const char* FrameTypeToString(SpdyFrameType type); |
546 | 544 |
547 SpdyMajorVersion protocol_version() const { return protocol_version_; } | 545 SpdyMajorVersion protocol_version() const { return protocol_version_; } |
548 | 546 |
549 bool probable_http_response() const { return probable_http_response_; } | 547 bool probable_http_response() const { return probable_http_response_; } |
550 | 548 |
551 SpdyPriority GetLowestPriority() const { | 549 SpdyPriority GetLowestPriority() const { return 7; } |
552 return protocol_version_ < SPDY3 ? 3 : 7; | |
553 } | |
554 | 550 |
555 SpdyPriority GetHighestPriority() const { return 0; } | 551 SpdyPriority GetHighestPriority() const { return 0; } |
556 | 552 |
557 // Interpolates SpdyPriority values into SPDY4/HTTP2 priority weights, | 553 // Interpolates SpdyPriority values into SPDY4/HTTP2 priority weights, |
558 // and vice versa. | 554 // and vice versa. |
559 static uint8_t MapPriorityToWeight(SpdyPriority priority); | 555 static uint8_t MapPriorityToWeight(SpdyPriority priority); |
560 static SpdyPriority MapWeightToPriority(uint8_t weight); | 556 static SpdyPriority MapWeightToPriority(uint8_t weight); |
561 | 557 |
562 // Deliver the given control frame's compressed headers block to the visitor | 558 // Deliver the given control frame's compressed headers block to the visitor |
563 // in decompressed form, in chunks. Returns true if the visitor has | 559 // in decompressed form, in chunks. Returns true if the visitor has |
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
796 bool end_stream_when_done_; | 792 bool end_stream_when_done_; |
797 | 793 |
798 // If true, then ProcessInput returns after processing a full frame, | 794 // If true, then ProcessInput returns after processing a full frame, |
799 // rather than reading all available input. | 795 // rather than reading all available input. |
800 bool process_single_input_frame_ = false; | 796 bool process_single_input_frame_ = false; |
801 }; | 797 }; |
802 | 798 |
803 } // namespace net | 799 } // namespace net |
804 | 800 |
805 #endif // NET_SPDY_SPDY_FRAMER_H_ | 801 #endif // NET_SPDY_SPDY_FRAMER_H_ |
OLD | NEW |