| 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 // This file contains some protocol structures for use with Spdy. | 5 // This file contains some protocol structures for use with Spdy. |
| 6 | 6 |
| 7 #ifndef NET_SPDY_SPDY_PROTOCOL_H_ | 7 #ifndef NET_SPDY_SPDY_PROTOCOL_H_ |
| 8 #define NET_SPDY_SPDY_PROTOCOL_H_ | 8 #define NET_SPDY_SPDY_PROTOCOL_H_ |
| 9 | 9 |
| 10 #include <limits> | 10 #include <limits> |
| (...skipping 485 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 496 SpdyStreamId stream_id_; | 496 SpdyStreamId stream_id_; |
| 497 uint32 status_; | 497 uint32 status_; |
| 498 }; | 498 }; |
| 499 | 499 |
| 500 // A SETTINGS Control Frame structure. | 500 // A SETTINGS Control Frame structure. |
| 501 struct SpdySettingsControlFrameBlock : SpdyFrameBlock { | 501 struct SpdySettingsControlFrameBlock : SpdyFrameBlock { |
| 502 uint32 num_entries_; | 502 uint32 num_entries_; |
| 503 // Variable data here. | 503 // Variable data here. |
| 504 }; | 504 }; |
| 505 | 505 |
| 506 // A PING Control Frame structure. | |
| 507 struct SpdyPingControlFrameBlock : SpdyFrameBlock { | |
| 508 uint32 unique_id_; | |
| 509 }; | |
| 510 | |
| 511 // TODO(avd): remove this struct | 506 // TODO(avd): remove this struct |
| 512 // A CREDENTIAL Control Frame structure. | 507 // A CREDENTIAL Control Frame structure. |
| 513 struct SpdyCredentialControlFrameBlock : SpdyFrameBlock { | 508 struct SpdyCredentialControlFrameBlock : SpdyFrameBlock { |
| 514 uint16 slot_; | 509 uint16 slot_; |
| 515 uint32 proof_len_; | 510 uint32 proof_len_; |
| 516 // Variable data here. | 511 // Variable data here. |
| 517 // proof data | 512 // proof data |
| 518 // for each certificate: unit32 certificate_len + certificate_data[i] | 513 // for each certificate: unit32 certificate_len + certificate_data[i] |
| 519 }; | 514 }; |
| 520 | 515 |
| (...skipping 584 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1105 private: | 1100 private: |
| 1106 const struct SpdySettingsControlFrameBlock* block() const { | 1101 const struct SpdySettingsControlFrameBlock* block() const { |
| 1107 return static_cast<SpdySettingsControlFrameBlock*>(frame_); | 1102 return static_cast<SpdySettingsControlFrameBlock*>(frame_); |
| 1108 } | 1103 } |
| 1109 struct SpdySettingsControlFrameBlock* mutable_block() { | 1104 struct SpdySettingsControlFrameBlock* mutable_block() { |
| 1110 return static_cast<SpdySettingsControlFrameBlock*>(frame_); | 1105 return static_cast<SpdySettingsControlFrameBlock*>(frame_); |
| 1111 } | 1106 } |
| 1112 DISALLOW_COPY_AND_ASSIGN(SpdySettingsControlFrame); | 1107 DISALLOW_COPY_AND_ASSIGN(SpdySettingsControlFrame); |
| 1113 }; | 1108 }; |
| 1114 | 1109 |
| 1115 class SpdyPingControlFrame : public SpdyControlFrame { | |
| 1116 public: | |
| 1117 SpdyPingControlFrame() : SpdyControlFrame(size()) {} | |
| 1118 SpdyPingControlFrame(char* data, bool owns_buffer) | |
| 1119 : SpdyControlFrame(data, owns_buffer) {} | |
| 1120 | |
| 1121 uint32 unique_id() const { | |
| 1122 return ntohl(block()->unique_id_); | |
| 1123 } | |
| 1124 | |
| 1125 void set_unique_id(uint32 unique_id) { | |
| 1126 mutable_block()->unique_id_ = htonl(unique_id); | |
| 1127 } | |
| 1128 | |
| 1129 static size_t size() { return sizeof(SpdyPingControlFrameBlock); } | |
| 1130 | |
| 1131 private: | |
| 1132 const struct SpdyPingControlFrameBlock* block() const { | |
| 1133 return static_cast<SpdyPingControlFrameBlock*>(frame_); | |
| 1134 } | |
| 1135 struct SpdyPingControlFrameBlock* mutable_block() { | |
| 1136 return static_cast<SpdyPingControlFrameBlock*>(frame_); | |
| 1137 } | |
| 1138 }; | |
| 1139 | |
| 1140 class SpdyCredentialControlFrame : public SpdyControlFrame { | 1110 class SpdyCredentialControlFrame : public SpdyControlFrame { |
| 1141 public: | 1111 public: |
| 1142 SpdyCredentialControlFrame() : SpdyControlFrame(size()) {} | 1112 SpdyCredentialControlFrame() : SpdyControlFrame(size()) {} |
| 1143 SpdyCredentialControlFrame(char* data, bool owns_buffer) | 1113 SpdyCredentialControlFrame(char* data, bool owns_buffer) |
| 1144 : SpdyControlFrame(data, owns_buffer) {} | 1114 : SpdyControlFrame(data, owns_buffer) {} |
| 1145 | 1115 |
| 1146 const char* payload() const { | 1116 const char* payload() const { |
| 1147 return reinterpret_cast<const char*>(block()) + SpdyFrame::kHeaderSize; | 1117 return reinterpret_cast<const char*>(block()) + SpdyFrame::kHeaderSize; |
| 1148 } | 1118 } |
| 1149 | 1119 |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1187 } | 1157 } |
| 1188 struct SpdyHeadersControlFrameBlock* mutable_block() { | 1158 struct SpdyHeadersControlFrameBlock* mutable_block() { |
| 1189 return static_cast<SpdyHeadersControlFrameBlock*>(frame_); | 1159 return static_cast<SpdyHeadersControlFrameBlock*>(frame_); |
| 1190 } | 1160 } |
| 1191 DISALLOW_COPY_AND_ASSIGN(SpdyHeadersControlFrame); | 1161 DISALLOW_COPY_AND_ASSIGN(SpdyHeadersControlFrame); |
| 1192 }; | 1162 }; |
| 1193 | 1163 |
| 1194 } // namespace net | 1164 } // namespace net |
| 1195 | 1165 |
| 1196 #endif // NET_SPDY_SPDY_PROTOCOL_H_ | 1166 #endif // NET_SPDY_SPDY_PROTOCOL_H_ |
| OLD | NEW |