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 2 and 3 | 5 // This file contains some protocol structures for use with SPDY 2 and 3 |
6 // The SPDY 2 spec can be found at: | 6 // The SPDY 2 spec can be found at: |
7 // http://dev.chromium.org/spdy/spdy-protocol/spdy-protocol-draft2 | 7 // http://dev.chromium.org/spdy/spdy-protocol/spdy-protocol-draft2 |
8 // The SPDY 3 spec can be found at: | 8 // The SPDY 3 spec can be found at: |
9 // http://dev.chromium.org/spdy/spdy-protocol/spdy-protocol-draft3 | 9 // http://dev.chromium.org/spdy/spdy-protocol/spdy-protocol-draft3 |
10 | 10 |
(...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
377 | 377 |
378 // A SPDY priority is a number between 0 and 7 (inclusive). | 378 // A SPDY priority is a number between 0 and 7 (inclusive). |
379 // SPDY priority range is version-dependent. For SPDY 2 and below, priority is a | 379 // SPDY priority range is version-dependent. For SPDY 2 and below, priority is a |
380 // number between 0 and 3. | 380 // number between 0 and 3. |
381 typedef uint8 SpdyPriority; | 381 typedef uint8 SpdyPriority; |
382 | 382 |
383 typedef std::map<std::string, std::string> SpdyNameValueBlock; | 383 typedef std::map<std::string, std::string> SpdyNameValueBlock; |
384 | 384 |
385 typedef uint64 SpdyPingId; | 385 typedef uint64 SpdyPingId; |
386 | 386 |
| 387 // TODO(hkhalil): Add direct testing for this? It won't increase coverage any, |
| 388 // but is good to do anyway. |
| 389 class SpdyConstants { |
| 390 public: |
| 391 // Returns true if a given on-the-wire enumeration of a frame type is valid |
| 392 // for a given protocol version, false otherwise. |
| 393 static bool IsValidFrameType(SpdyMajorVersion version, int frame_type_field); |
| 394 |
| 395 // Parses a frame type from an on-the-wire enumeration of a given protocol |
| 396 // version. |
| 397 // Behavior is undefined for invalid frame type fields; consumers should first |
| 398 // use IsValidFrameType() to verify validity of frame type fields. |
| 399 static SpdyFrameType ParseFrameType(SpdyMajorVersion version, |
| 400 int frame_type_field); |
| 401 |
| 402 // Serializes a given frame type to the on-the-wire enumeration value for the |
| 403 // given protocol version. |
| 404 // Returns -1 on failure (I.E. Invalid frame type for the given version). |
| 405 static int SerializeFrameType(SpdyMajorVersion version, |
| 406 SpdyFrameType frame_type); |
| 407 }; |
| 408 |
387 class SpdyFrame; | 409 class SpdyFrame; |
388 typedef SpdyFrame SpdySerializedFrame; | 410 typedef SpdyFrame SpdySerializedFrame; |
389 | 411 |
390 class SpdyFrameVisitor; | 412 class SpdyFrameVisitor; |
391 | 413 |
392 // Intermediate representation for SPDY frames. | 414 // Intermediate representation for SPDY frames. |
393 // TODO(hkhalil): Rename this class to SpdyFrame when the existing SpdyFrame is | 415 // TODO(hkhalil): Rename this class to SpdyFrame when the existing SpdyFrame is |
394 // gone. | 416 // gone. |
395 class NET_EXPORT_PRIVATE SpdyFrameIR { | 417 class NET_EXPORT_PRIVATE SpdyFrameIR { |
396 public: | 418 public: |
(...skipping 473 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
870 SpdyFrameVisitor() {} | 892 SpdyFrameVisitor() {} |
871 virtual ~SpdyFrameVisitor() {} | 893 virtual ~SpdyFrameVisitor() {} |
872 | 894 |
873 private: | 895 private: |
874 DISALLOW_COPY_AND_ASSIGN(SpdyFrameVisitor); | 896 DISALLOW_COPY_AND_ASSIGN(SpdyFrameVisitor); |
875 }; | 897 }; |
876 | 898 |
877 } // namespace net | 899 } // namespace net |
878 | 900 |
879 #endif // NET_SPDY_SPDY_PROTOCOL_H_ | 901 #endif // NET_SPDY_SPDY_PROTOCOL_H_ |
OLD | NEW |