| Index: net/tools/quic/stateless_rejector.h
|
| diff --git a/net/tools/quic/stateless_rejector.h b/net/tools/quic/stateless_rejector.h
|
| index 39c03a1d896cdfdf906fc1089bc31fd04366614d..b092f957edba2293000c690fa80b139704c6917b 100644
|
| --- a/net/tools/quic/stateless_rejector.h
|
| +++ b/net/tools/quic/stateless_rejector.h
|
| @@ -17,6 +17,7 @@ namespace net {
|
| class StatelessRejector {
|
| public:
|
| enum State {
|
| + UNKNOWN, // State has not yet been determined
|
| UNSUPPORTED, // Stateless rejects are not supported
|
| FAILED, // There was an error processing the CHLO.
|
| ACCEPTED, // The CHLO was accepted
|
| @@ -35,13 +36,24 @@ class StatelessRejector {
|
|
|
| ~StatelessRejector();
|
|
|
| - // Called when |chlo| is received for |connection_id| to determine
|
| - // if it should be statelessly rejected.
|
| + // Called when |chlo| is received for |connection_id|.
|
| void OnChlo(QuicVersion version,
|
| QuicConnectionId connection_id,
|
| QuicConnectionId server_designated_connection_id,
|
| const CryptoHandshakeMessage& chlo);
|
|
|
| + class ProcessDoneCallback {
|
| + public:
|
| + virtual ~ProcessDoneCallback() = default;
|
| + virtual void Run(std::unique_ptr<StatelessRejector> rejector) = 0;
|
| + };
|
| +
|
| + // Perform processing to determine whether the CHLO received in OnChlo should
|
| + // be statelessly rejected, and invoke the callback once a decision has been
|
| + // made.
|
| + static void Process(std::unique_ptr<StatelessRejector> rejector,
|
| + std::unique_ptr<ProcessDoneCallback> cb);
|
| +
|
| // Returns the state of the rejector after OnChlo() has been called.
|
| State state() const { return state_; }
|
|
|
| @@ -51,6 +63,9 @@ class StatelessRejector {
|
| // Returns the error details when state() returns FAILED.
|
| std::string error_details() const { return error_details_; }
|
|
|
| + // Returns the connection ID.
|
| + QuicConnectionId connection_id() const { return connection_id_; }
|
| +
|
| // Returns the SREJ message when state() returns REJECTED.
|
| const CryptoHandshakeMessage& reply() const { return reply_; }
|
|
|
| @@ -62,7 +77,9 @@ class StatelessRejector {
|
|
|
| void ProcessClientHello(
|
| const CryptoHandshakeMessage& client_hello,
|
| - const ValidateClientHelloResultCallback::Result& result);
|
| + const ValidateClientHelloResultCallback::Result& result,
|
| + std::unique_ptr<StatelessRejector> rejector,
|
| + std::unique_ptr<StatelessRejector::ProcessDoneCallback> cb);
|
|
|
| State state_;
|
| QuicErrorCode error_;
|
| @@ -78,7 +95,7 @@ class StatelessRejector {
|
| QuicRandom* random_;
|
| const QuicCryptoServerConfig* crypto_config_;
|
| QuicCompressedCertsCache* compressed_certs_cache_;
|
| - const CryptoHandshakeMessage* chlo_;
|
| + CryptoHandshakeMessage chlo_;
|
| CryptoHandshakeMessage reply_;
|
| CryptoFramer crypto_framer_;
|
| QuicCryptoProof proof_;
|
|
|