OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_STATELESS_REJECTOR_H_ | 5 #ifndef NET_QUIC_STATELESS_REJECTOR_H_ |
6 #define NET_QUIC_STATELESS_REJECTOR_H_ | 6 #define NET_QUIC_STATELESS_REJECTOR_H_ |
7 | 7 |
8 #include "base/strings/string_piece.h" | 8 #include "base/strings/string_piece.h" |
9 #include "net/quic/core/crypto/crypto_framer.h" | 9 #include "net/quic/core/crypto/crypto_framer.h" |
10 #include "net/quic/core/crypto/quic_crypto_server_config.h" | 10 #include "net/quic/core/crypto/quic_crypto_server_config.h" |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 class ProcessDoneCallback { | 45 class ProcessDoneCallback { |
46 public: | 46 public: |
47 virtual ~ProcessDoneCallback() = default; | 47 virtual ~ProcessDoneCallback() = default; |
48 virtual void Run(std::unique_ptr<StatelessRejector> rejector) = 0; | 48 virtual void Run(std::unique_ptr<StatelessRejector> rejector) = 0; |
49 }; | 49 }; |
50 | 50 |
51 // Perform processing to determine whether the CHLO received in OnChlo should | 51 // Perform processing to determine whether the CHLO received in OnChlo should |
52 // be statelessly rejected, and invoke the callback once a decision has been | 52 // be statelessly rejected, and invoke the callback once a decision has been |
53 // made. | 53 // made. |
54 static void Process(std::unique_ptr<StatelessRejector> rejector, | 54 static void Process(std::unique_ptr<StatelessRejector> rejector, |
55 std::unique_ptr<ProcessDoneCallback> cb); | 55 std::unique_ptr<ProcessDoneCallback> done_cb); |
56 | 56 |
57 // Returns the state of the rejector after OnChlo() has been called. | 57 // Returns the state of the rejector after OnChlo() has been called. |
58 State state() const { return state_; } | 58 State state() const { return state_; } |
59 | 59 |
60 // Returns the error code when state() returns FAILED. | 60 // Returns the error code when state() returns FAILED. |
61 QuicErrorCode error() const { return error_; } | 61 QuicErrorCode error() const { return error_; } |
62 | 62 |
63 // Returns the error details when state() returns FAILED. | 63 // Returns the error details when state() returns FAILED. |
64 std::string error_details() const { return error_details_; } | 64 std::string error_details() const { return error_details_; } |
65 | 65 |
66 // Returns the connection ID. | 66 // Returns the connection ID. |
67 QuicConnectionId connection_id() const { return connection_id_; } | 67 QuicConnectionId connection_id() const { return connection_id_; } |
68 | 68 |
69 // Returns the SREJ message when state() returns REJECTED. | 69 // Returns the SREJ message when state() returns REJECTED. |
70 const CryptoHandshakeMessage& reply() const { return reply_; } | 70 const CryptoHandshakeMessage& reply() const { return reply_; } |
71 | 71 |
72 private: | 72 private: |
73 // Helper class which is passed in to | 73 // Helper class which is passed in to |
74 // QuicCryptoServerConfig::ValidateClientHello. | 74 // QuicCryptoServerConfig::ValidateClientHello. |
75 class ValidateCallback; | 75 class ValidateCallback; |
76 friend class ValidateCallback; | 76 friend class ValidateCallback; |
77 | 77 |
78 void ProcessClientHello( | 78 void ProcessClientHello( |
79 const ValidateClientHelloResultCallback::Result& result, | 79 scoped_refptr<ValidateClientHelloResultCallback::Result> result, |
80 std::unique_ptr<StatelessRejector> rejector, | 80 std::unique_ptr<StatelessRejector> rejector, |
81 std::unique_ptr<StatelessRejector::ProcessDoneCallback> cb); | 81 std::unique_ptr<StatelessRejector::ProcessDoneCallback> done_cb); |
82 | 82 |
83 State state_; | 83 State state_; |
84 QuicErrorCode error_; | 84 QuicErrorCode error_; |
85 std::string error_details_; | 85 std::string error_details_; |
86 QuicVersion version_; | 86 QuicVersion version_; |
87 QuicVersionVector versions_; | 87 QuicVersionVector versions_; |
88 QuicConnectionId connection_id_; | 88 QuicConnectionId connection_id_; |
89 QuicConnectionId server_designated_connection_id_; | 89 QuicConnectionId server_designated_connection_id_; |
90 QuicByteCount chlo_packet_size_; | 90 QuicByteCount chlo_packet_size_; |
91 IPEndPoint client_address_; | 91 IPEndPoint client_address_; |
92 IPEndPoint server_address_; | 92 IPEndPoint server_address_; |
93 const QuicClock* clock_; | 93 const QuicClock* clock_; |
94 QuicRandom* random_; | 94 QuicRandom* random_; |
95 const QuicCryptoServerConfig* crypto_config_; | 95 const QuicCryptoServerConfig* crypto_config_; |
96 QuicCompressedCertsCache* compressed_certs_cache_; | 96 QuicCompressedCertsCache* compressed_certs_cache_; |
97 CryptoHandshakeMessage chlo_; | 97 CryptoHandshakeMessage chlo_; |
98 CryptoHandshakeMessage reply_; | 98 CryptoHandshakeMessage reply_; |
99 CryptoFramer crypto_framer_; | 99 CryptoFramer crypto_framer_; |
100 QuicCryptoProof proof_; | 100 QuicCryptoProof proof_; |
101 | 101 |
102 DISALLOW_COPY_AND_ASSIGN(StatelessRejector); | 102 DISALLOW_COPY_AND_ASSIGN(StatelessRejector); |
103 }; | 103 }; |
104 | 104 |
105 } // namespace net | 105 } // namespace net |
106 | 106 |
107 #endif // NET_QUIC_STATELESS_REJECTOR_H_ | 107 #endif // NET_QUIC_STATELESS_REJECTOR_H_ |
OLD | NEW |