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 505 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
516 // Variable data here. | 516 // Variable data here. |
517 // proof data | 517 // proof data |
518 // for each certificate: unit32 certificate_len + certificate_data[i] | 518 // for each certificate: unit32 certificate_len + certificate_data[i] |
519 }; | 519 }; |
520 | 520 |
521 // A HEADERS Control Frame structure. | 521 // A HEADERS Control Frame structure. |
522 struct SpdyHeadersControlFrameBlock : SpdyFrameBlock { | 522 struct SpdyHeadersControlFrameBlock : SpdyFrameBlock { |
523 SpdyStreamId stream_id_; | 523 SpdyStreamId stream_id_; |
524 }; | 524 }; |
525 | 525 |
526 // A WINDOW_UPDATE Control Frame structure | |
527 struct SpdyWindowUpdateControlFrameBlock : SpdyFrameBlock { | |
528 SpdyStreamId stream_id_; | |
529 uint32 delta_window_size_; | |
530 }; | |
531 | |
532 #pragma pack(pop) | 526 #pragma pack(pop) |
533 | 527 |
534 class SpdyFrame; | 528 class SpdyFrame; |
535 typedef SpdyFrame SpdySerializedFrame; | 529 typedef SpdyFrame SpdySerializedFrame; |
536 | 530 |
537 class SpdyFramer; | 531 class SpdyFramer; |
538 class SpdyFrameBuilder; | 532 class SpdyFrameBuilder; |
539 | 533 |
540 // Intermediate representation for SPDY frames. | 534 // Intermediate representation for SPDY frames. |
541 // TODO(hkhalil): Rename this class to SpdyFrame when the existing SpdyFrame is | 535 // TODO(hkhalil): Rename this class to SpdyFrame when the existing SpdyFrame is |
(...skipping 648 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1190 private: | 1184 private: |
1191 const struct SpdyHeadersControlFrameBlock* block() const { | 1185 const struct SpdyHeadersControlFrameBlock* block() const { |
1192 return static_cast<SpdyHeadersControlFrameBlock*>(frame_); | 1186 return static_cast<SpdyHeadersControlFrameBlock*>(frame_); |
1193 } | 1187 } |
1194 struct SpdyHeadersControlFrameBlock* mutable_block() { | 1188 struct SpdyHeadersControlFrameBlock* mutable_block() { |
1195 return static_cast<SpdyHeadersControlFrameBlock*>(frame_); | 1189 return static_cast<SpdyHeadersControlFrameBlock*>(frame_); |
1196 } | 1190 } |
1197 DISALLOW_COPY_AND_ASSIGN(SpdyHeadersControlFrame); | 1191 DISALLOW_COPY_AND_ASSIGN(SpdyHeadersControlFrame); |
1198 }; | 1192 }; |
1199 | 1193 |
1200 // A WINDOW_UPDATE frame. | |
1201 class SpdyWindowUpdateControlFrame : public SpdyControlFrame { | |
1202 public: | |
1203 SpdyWindowUpdateControlFrame() : SpdyControlFrame(size()) {} | |
1204 SpdyWindowUpdateControlFrame(char* data, bool owns_buffer) | |
1205 : SpdyControlFrame(data, owns_buffer) {} | |
1206 | |
1207 SpdyStreamId stream_id() const { | |
1208 return ntohl(block()->stream_id_) & kStreamIdMask; | |
1209 } | |
1210 | |
1211 uint32 delta_window_size() const { | |
1212 return ntohl(block()->delta_window_size_); | |
1213 } | |
1214 | |
1215 void set_delta_window_size(uint32 delta_window_size) { | |
1216 mutable_block()->delta_window_size_ = htonl(delta_window_size); | |
1217 } | |
1218 | |
1219 // Returns the size of the SpdyWindowUpdateControlFrameBlock structure. | |
1220 // Note: this is not the size of the SpdyWindowUpdateControlFrame class. | |
1221 static size_t size() { return sizeof(SpdyWindowUpdateControlFrameBlock); } | |
1222 | |
1223 private: | |
1224 const struct SpdyWindowUpdateControlFrameBlock* block() const { | |
1225 return static_cast<SpdyWindowUpdateControlFrameBlock*>(frame_); | |
1226 } | |
1227 struct SpdyWindowUpdateControlFrameBlock* mutable_block() { | |
1228 return static_cast<SpdyWindowUpdateControlFrameBlock*>(frame_); | |
1229 } | |
1230 | |
1231 DISALLOW_COPY_AND_ASSIGN(SpdyWindowUpdateControlFrame); | |
1232 }; | |
1233 | |
1234 } // namespace net | 1194 } // namespace net |
1235 | 1195 |
1236 #endif // NET_SPDY_SPDY_PROTOCOL_H_ | 1196 #endif // NET_SPDY_SPDY_PROTOCOL_H_ |
OLD | NEW |