OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #pragma once | 9 #pragma once |
10 | 10 |
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
295 }; | 295 }; |
296 | 296 |
297 // A WINDOW_UPDATE Control Frame structure | 297 // A WINDOW_UPDATE Control Frame structure |
298 struct SpdyWindowUpdateControlFrameBlock : SpdyFrameBlock { | 298 struct SpdyWindowUpdateControlFrameBlock : SpdyFrameBlock { |
299 SpdyStreamId stream_id_; | 299 SpdyStreamId stream_id_; |
300 uint32 delta_window_size_; | 300 uint32 delta_window_size_; |
301 }; | 301 }; |
302 | 302 |
303 // A structure for the 8 bit flags and 24 bit ID fields. | 303 // A structure for the 8 bit flags and 24 bit ID fields. |
304 union SettingsFlagsAndId { | 304 union SettingsFlagsAndId { |
305 uint8 flags_[4]; // 8 bits | |
306 uint32 id_; // 24 bits | |
307 | |
308 SettingsFlagsAndId(uint32 val) : id_(val) {} | 305 SettingsFlagsAndId(uint32 val) : id_(val) {} |
309 uint8 flags() const { return flags_[0]; } | 306 uint8 flags() const { return flags_[0]; } |
310 void set_flags(uint8 flags) { flags_[0] = flags; } | 307 void set_flags(uint8 flags) { flags_[0] = flags; } |
311 uint32 id() const { return (ntohl(id_) & kSettingsIdMask); } | 308 uint32 id() const { return (ntohl(id_) & kSettingsIdMask); } |
312 void set_id(uint32 id) { | 309 void set_id(uint32 id) { |
313 DCHECK_EQ(0u, (id & ~kSettingsIdMask)); | 310 DCHECK_EQ(0u, (id & ~kSettingsIdMask)); |
314 id = htonl(id & kSettingsIdMask); | 311 id = htonl(id & kSettingsIdMask); |
315 id_ = flags() | id; | 312 id_ = flags() | id; |
316 } | 313 } |
| 314 |
| 315 uint8 flags_[4]; // 8 bits |
| 316 uint32 id_; // 24 bits |
317 }; | 317 }; |
318 | 318 |
319 #pragma pack(pop) | 319 #pragma pack(pop) |
320 | 320 |
321 // ------------------------------------------------------------------------- | 321 // ------------------------------------------------------------------------- |
322 // Wrapper classes for various SPDY frames. | 322 // Wrapper classes for various SPDY frames. |
323 | 323 |
324 // All Spdy Frame types derive from this SpdyFrame class. | 324 // All Spdy Frame types derive from this SpdyFrame class. |
325 class SpdyFrame { | 325 class SpdyFrame { |
326 public: | 326 public: |
(...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
727 struct SpdyWindowUpdateControlFrameBlock* mutable_block() { | 727 struct SpdyWindowUpdateControlFrameBlock* mutable_block() { |
728 return static_cast<SpdyWindowUpdateControlFrameBlock*>(frame_); | 728 return static_cast<SpdyWindowUpdateControlFrameBlock*>(frame_); |
729 } | 729 } |
730 | 730 |
731 DISALLOW_COPY_AND_ASSIGN(SpdyWindowUpdateControlFrame); | 731 DISALLOW_COPY_AND_ASSIGN(SpdyWindowUpdateControlFrame); |
732 }; | 732 }; |
733 | 733 |
734 } // namespace spdy | 734 } // namespace spdy |
735 | 735 |
736 #endif // NET_SPDY_SPDY_PROTOCOL_H_ | 736 #endif // NET_SPDY_SPDY_PROTOCOL_H_ |
OLD | NEW |