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_CRYPTO_CRYPTO_FRAMER_H_ | 5 #ifndef NET_QUIC_CORE_CRYPTO_CRYPTO_FRAMER_H_ |
6 #define NET_QUIC_CORE_CRYPTO_CRYPTO_FRAMER_H_ | 6 #define NET_QUIC_CORE_CRYPTO_CRYPTO_FRAMER_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
11 #include <utility> | 11 #include <utility> |
12 #include <vector> | 12 #include <vector> |
13 | 13 |
14 #include "base/logging.h" | 14 #include "base/logging.h" |
15 #include "base/strings/string_piece.h" | 15 #include "base/strings/string_piece.h" |
16 #include "net/base/net_export.h" | |
17 #include "net/quic/core/crypto/crypto_handshake_message.h" | 16 #include "net/quic/core/crypto/crypto_handshake_message.h" |
18 #include "net/quic/core/quic_packets.h" | 17 #include "net/quic/core/quic_packets.h" |
| 18 #include "net/quic/platform/api/quic_export.h" |
19 | 19 |
20 namespace net { | 20 namespace net { |
21 | 21 |
22 class CryptoFramer; | 22 class CryptoFramer; |
23 class QuicData; | 23 class QuicData; |
24 class QuicDataWriter; | 24 class QuicDataWriter; |
25 | 25 |
26 class NET_EXPORT_PRIVATE CryptoFramerVisitorInterface { | 26 class QUIC_EXPORT_PRIVATE CryptoFramerVisitorInterface { |
27 public: | 27 public: |
28 virtual ~CryptoFramerVisitorInterface() {} | 28 virtual ~CryptoFramerVisitorInterface() {} |
29 | 29 |
30 // Called if an error is detected. | 30 // Called if an error is detected. |
31 virtual void OnError(CryptoFramer* framer) = 0; | 31 virtual void OnError(CryptoFramer* framer) = 0; |
32 | 32 |
33 // Called when a complete handshake message has been parsed. | 33 // Called when a complete handshake message has been parsed. |
34 virtual void OnHandshakeMessage(const CryptoHandshakeMessage& message) = 0; | 34 virtual void OnHandshakeMessage(const CryptoHandshakeMessage& message) = 0; |
35 }; | 35 }; |
36 | 36 |
37 // A class for framing the crypto messages that are exchanged in a QUIC | 37 // A class for framing the crypto messages that are exchanged in a QUIC |
38 // session. | 38 // session. |
39 class NET_EXPORT_PRIVATE CryptoFramer { | 39 class QUIC_EXPORT_PRIVATE CryptoFramer { |
40 public: | 40 public: |
41 CryptoFramer(); | 41 CryptoFramer(); |
42 | 42 |
43 virtual ~CryptoFramer(); | 43 virtual ~CryptoFramer(); |
44 | 44 |
45 // ParseMessage parses exactly one message from the given StringPiece. If | 45 // ParseMessage parses exactly one message from the given StringPiece. If |
46 // there is an error, the message is truncated, or the message has trailing | 46 // there is an error, the message is truncated, or the message has trailing |
47 // garbage then nullptr will be returned. | 47 // garbage then nullptr will be returned. |
48 static CryptoHandshakeMessage* ParseMessage(base::StringPiece in); | 48 static CryptoHandshakeMessage* ParseMessage(base::StringPiece in); |
49 | 49 |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 // tags_and_lengths_ contains the tags that are currently being parsed and | 108 // tags_and_lengths_ contains the tags that are currently being parsed and |
109 // their lengths. | 109 // their lengths. |
110 std::vector<std::pair<QuicTag, size_t>> tags_and_lengths_; | 110 std::vector<std::pair<QuicTag, size_t>> tags_and_lengths_; |
111 // Cumulative length of all values in the message currently being parsed. | 111 // Cumulative length of all values in the message currently being parsed. |
112 size_t values_len_; | 112 size_t values_len_; |
113 }; | 113 }; |
114 | 114 |
115 } // namespace net | 115 } // namespace net |
116 | 116 |
117 #endif // NET_QUIC_CORE_CRYPTO_CRYPTO_FRAMER_H_ | 117 #endif // NET_QUIC_CORE_CRYPTO_CRYPTO_FRAMER_H_ |
OLD | NEW |