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_QUIC_CORE_QUIC_FRAMER_H_ | 5 #ifndef NET_QUIC_CORE_QUIC_FRAMER_H_ |
6 #define NET_QUIC_CORE_QUIC_FRAMER_H_ | 6 #define NET_QUIC_CORE_QUIC_FRAMER_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
11 #include <memory> | 11 #include <memory> |
12 #include <string> | 12 #include <string> |
13 #include <unordered_map> | 13 #include <unordered_map> |
14 #include <unordered_set> | 14 #include <unordered_set> |
15 #include <vector> | 15 #include <vector> |
16 | 16 |
17 #include "base/logging.h" | 17 #include "base/logging.h" |
18 #include "base/macros.h" | 18 #include "base/macros.h" |
19 #include "base/strings/string_piece.h" | 19 #include "base/strings/string_piece.h" |
20 #include "net/base/net_export.h" | |
21 #include "net/quic/core/quic_packets.h" | 20 #include "net/quic/core/quic_packets.h" |
| 21 #include "net/quic/platform/api/quic_export.h" |
22 | 22 |
23 namespace net { | 23 namespace net { |
24 | 24 |
25 namespace test { | 25 namespace test { |
26 class QuicFramerPeer; | 26 class QuicFramerPeer; |
27 } // namespace test | 27 } // namespace test |
28 | 28 |
29 class QuicDataReader; | 29 class QuicDataReader; |
30 class QuicDataWriter; | 30 class QuicDataWriter; |
31 class QuicDecrypter; | 31 class QuicDecrypter; |
(...skipping 23 matching lines...) Expand all Loading... |
55 const size_t kNumberOfNackRangesSize = 1; | 55 const size_t kNumberOfNackRangesSize = 1; |
56 // Size in bytes reserved for the number of ack blocks in ack frames. | 56 // Size in bytes reserved for the number of ack blocks in ack frames. |
57 const size_t kNumberOfAckBlocksSize = 1; | 57 const size_t kNumberOfAckBlocksSize = 1; |
58 // Maximum number of missing packet ranges that can fit within an ack frame. | 58 // Maximum number of missing packet ranges that can fit within an ack frame. |
59 const size_t kMaxNackRanges = (1 << (kNumberOfNackRangesSize * 8)) - 1; | 59 const size_t kMaxNackRanges = (1 << (kNumberOfNackRangesSize * 8)) - 1; |
60 // Maximum number of ack blocks that can fit within an ack frame. | 60 // Maximum number of ack blocks that can fit within an ack frame. |
61 const size_t kMaxAckBlocks = (1 << (kNumberOfAckBlocksSize * 8)) - 1; | 61 const size_t kMaxAckBlocks = (1 << (kNumberOfAckBlocksSize * 8)) - 1; |
62 | 62 |
63 // This class receives callbacks from the framer when packets | 63 // This class receives callbacks from the framer when packets |
64 // are processed. | 64 // are processed. |
65 class NET_EXPORT_PRIVATE QuicFramerVisitorInterface { | 65 class QUIC_EXPORT_PRIVATE QuicFramerVisitorInterface { |
66 public: | 66 public: |
67 virtual ~QuicFramerVisitorInterface() {} | 67 virtual ~QuicFramerVisitorInterface() {} |
68 | 68 |
69 // Called if an error is detected in the QUIC protocol. | 69 // Called if an error is detected in the QUIC protocol. |
70 virtual void OnError(QuicFramer* framer) = 0; | 70 virtual void OnError(QuicFramer* framer) = 0; |
71 | 71 |
72 // Called only when |perspective_| is IS_SERVER and the the framer gets a | 72 // Called only when |perspective_| is IS_SERVER and the the framer gets a |
73 // packet with version flag true and the version on the packet doesn't match | 73 // packet with version flag true and the version on the packet doesn't match |
74 // |quic_version_|. The visitor should return true after it updates the | 74 // |quic_version_|. The visitor should return true after it updates the |
75 // version of the |framer_| to |received_version| or false to stop processing | 75 // version of the |framer_| to |received_version| or false to stop processing |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 | 141 |
142 // Called when a PathCloseFrame has been parsed. | 142 // Called when a PathCloseFrame has been parsed. |
143 virtual bool OnPathCloseFrame(const QuicPathCloseFrame& frame) = 0; | 143 virtual bool OnPathCloseFrame(const QuicPathCloseFrame& frame) = 0; |
144 | 144 |
145 // Called when a packet has been completely processed. | 145 // Called when a packet has been completely processed. |
146 virtual void OnPacketComplete() = 0; | 146 virtual void OnPacketComplete() = 0; |
147 }; | 147 }; |
148 | 148 |
149 // Class for parsing and constructing QUIC packets. It has a | 149 // Class for parsing and constructing QUIC packets. It has a |
150 // QuicFramerVisitorInterface that is called when packets are parsed. | 150 // QuicFramerVisitorInterface that is called when packets are parsed. |
151 class NET_EXPORT_PRIVATE QuicFramer { | 151 class QUIC_EXPORT_PRIVATE QuicFramer { |
152 public: | 152 public: |
153 // Constructs a new framer that installs a kNULL QuicEncrypter and | 153 // Constructs a new framer that installs a kNULL QuicEncrypter and |
154 // QuicDecrypter for level ENCRYPTION_NONE. |supported_versions| specifies the | 154 // QuicDecrypter for level ENCRYPTION_NONE. |supported_versions| specifies the |
155 // list of supported QUIC versions. |quic_version_| is set to the maximum | 155 // list of supported QUIC versions. |quic_version_| is set to the maximum |
156 // version in |supported_versions|. | 156 // version in |supported_versions|. |
157 QuicFramer(const QuicVersionVector& supported_versions, | 157 QuicFramer(const QuicVersionVector& supported_versions, |
158 QuicTime creation_time, | 158 QuicTime creation_time, |
159 Perspective perspective); | 159 Perspective perspective); |
160 | 160 |
161 virtual ~QuicFramer(); | 161 virtual ~QuicFramer(); |
(...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
548 QuicTime::Delta last_timestamp_; | 548 QuicTime::Delta last_timestamp_; |
549 // The diversification nonce from the last received packet. | 549 // The diversification nonce from the last received packet. |
550 DiversificationNonce last_nonce_; | 550 DiversificationNonce last_nonce_; |
551 | 551 |
552 DISALLOW_COPY_AND_ASSIGN(QuicFramer); | 552 DISALLOW_COPY_AND_ASSIGN(QuicFramer); |
553 }; | 553 }; |
554 | 554 |
555 } // namespace net | 555 } // namespace net |
556 | 556 |
557 #endif // NET_QUIC_CORE_QUIC_FRAMER_H_ | 557 #endif // NET_QUIC_CORE_QUIC_FRAMER_H_ |
OLD | NEW |