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_QUIC_CRYPTO_SERVER_STREAM_H_ | 5 #ifndef NET_QUIC_QUIC_CRYPTO_SERVER_STREAM_H_ |
6 #define NET_QUIC_QUIC_CRYPTO_SERVER_STREAM_H_ | 6 #define NET_QUIC_QUIC_CRYPTO_SERVER_STREAM_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "net/quic/crypto/crypto_handshake.h" | 10 #include "net/quic/crypto/crypto_handshake.h" |
(...skipping 15 matching lines...) Expand all Loading... |
26 | 26 |
27 // Receives a notification when the server hello (SHLO) has been ACKed by the | 27 // Receives a notification when the server hello (SHLO) has been ACKed by the |
28 // peer. At this point we disable HANDSHAKE_MODE in the sent packet manager. | 28 // peer. At this point we disable HANDSHAKE_MODE in the sent packet manager. |
29 class NET_EXPORT_PRIVATE ServerHelloNotifier : public | 29 class NET_EXPORT_PRIVATE ServerHelloNotifier : public |
30 QuicAckNotifier::DelegateInterface { | 30 QuicAckNotifier::DelegateInterface { |
31 public: | 31 public: |
32 explicit ServerHelloNotifier(QuicCryptoServerStream* stream) | 32 explicit ServerHelloNotifier(QuicCryptoServerStream* stream) |
33 : server_stream_(stream) {} | 33 : server_stream_(stream) {} |
34 | 34 |
35 // QuicAckNotifier::DelegateInterface implementation | 35 // QuicAckNotifier::DelegateInterface implementation |
36 virtual void OnAckNotification( | 36 void OnAckNotification(int num_original_packets, |
37 int num_original_packets, | 37 int num_original_bytes, |
38 int num_original_bytes, | 38 int num_retransmitted_packets, |
39 int num_retransmitted_packets, | 39 int num_retransmitted_bytes, |
40 int num_retransmitted_bytes, | 40 QuicTime::Delta delta_largest_observed) override; |
41 QuicTime::Delta delta_largest_observed) override; | |
42 | 41 |
43 private: | 42 private: |
44 virtual ~ServerHelloNotifier() {} | 43 ~ServerHelloNotifier() override {} |
45 | 44 |
46 QuicCryptoServerStream* server_stream_; | 45 QuicCryptoServerStream* server_stream_; |
47 | 46 |
48 DISALLOW_COPY_AND_ASSIGN(ServerHelloNotifier); | 47 DISALLOW_COPY_AND_ASSIGN(ServerHelloNotifier); |
49 }; | 48 }; |
50 | 49 |
51 class NET_EXPORT_PRIVATE QuicCryptoServerStream : public QuicCryptoStream { | 50 class NET_EXPORT_PRIVATE QuicCryptoServerStream : public QuicCryptoStream { |
52 public: | 51 public: |
53 QuicCryptoServerStream(const QuicCryptoServerConfig& crypto_config, | 52 QuicCryptoServerStream(const QuicCryptoServerConfig& crypto_config, |
54 QuicSession* session); | 53 QuicSession* session); |
55 virtual ~QuicCryptoServerStream(); | 54 ~QuicCryptoServerStream() override; |
56 | 55 |
57 // Cancel any outstanding callbacks, such as asynchronous validation of client | 56 // Cancel any outstanding callbacks, such as asynchronous validation of client |
58 // hello. | 57 // hello. |
59 void CancelOutstandingCallbacks(); | 58 void CancelOutstandingCallbacks(); |
60 | 59 |
61 // CryptoFramerVisitorInterface implementation | 60 // CryptoFramerVisitorInterface implementation |
62 virtual void OnHandshakeMessage( | 61 void OnHandshakeMessage(const CryptoHandshakeMessage& message) override; |
63 const CryptoHandshakeMessage& message) override; | |
64 | 62 |
65 // GetBase64SHA256ClientChannelID sets |*output| to the base64 encoded, | 63 // GetBase64SHA256ClientChannelID sets |*output| to the base64 encoded, |
66 // SHA-256 hash of the client's ChannelID key and returns true, if the client | 64 // SHA-256 hash of the client's ChannelID key and returns true, if the client |
67 // presented a ChannelID. Otherwise it returns false. | 65 // presented a ChannelID. Otherwise it returns false. |
68 bool GetBase64SHA256ClientChannelID(std::string* output) const; | 66 bool GetBase64SHA256ClientChannelID(std::string* output) const; |
69 | 67 |
70 uint8 num_handshake_messages() const { return num_handshake_messages_; } | 68 uint8 num_handshake_messages() const { return num_handshake_messages_; } |
71 | 69 |
72 int num_server_config_update_messages_sent() const { | 70 int num_server_config_update_messages_sent() const { |
73 return num_server_config_update_messages_sent_; | 71 return num_server_config_update_messages_sent_; |
(...skipping 29 matching lines...) Expand all Loading... |
103 private: | 101 private: |
104 friend class test::CryptoTestUtils; | 102 friend class test::CryptoTestUtils; |
105 | 103 |
106 class ValidateCallback : public ValidateClientHelloResultCallback { | 104 class ValidateCallback : public ValidateClientHelloResultCallback { |
107 public: | 105 public: |
108 explicit ValidateCallback(QuicCryptoServerStream* parent); | 106 explicit ValidateCallback(QuicCryptoServerStream* parent); |
109 // To allow the parent to detach itself from the callback before deletion. | 107 // To allow the parent to detach itself from the callback before deletion. |
110 void Cancel(); | 108 void Cancel(); |
111 | 109 |
112 // From ValidateClientHelloResultCallback | 110 // From ValidateClientHelloResultCallback |
113 virtual void RunImpl(const CryptoHandshakeMessage& client_hello, | 111 void RunImpl(const CryptoHandshakeMessage& client_hello, |
114 const Result& result) override; | 112 const Result& result) override; |
115 | 113 |
116 private: | 114 private: |
117 QuicCryptoServerStream* parent_; | 115 QuicCryptoServerStream* parent_; |
118 | 116 |
119 DISALLOW_COPY_AND_ASSIGN(ValidateCallback); | 117 DISALLOW_COPY_AND_ASSIGN(ValidateCallback); |
120 }; | 118 }; |
121 | 119 |
122 // Invoked by ValidateCallback::RunImpl once initial validation of | 120 // Invoked by ValidateCallback::RunImpl once initial validation of |
123 // the client hello is complete. Finishes processing of the client | 121 // the client hello is complete. Finishes processing of the client |
124 // hello message and handles handshake success/failure. | 122 // hello message and handles handshake success/failure. |
(...skipping 20 matching lines...) Expand all Loading... |
145 // store here, and send back in future STKs if we have no better bandwidth | 143 // store here, and send back in future STKs if we have no better bandwidth |
146 // estimate to send. | 144 // estimate to send. |
147 scoped_ptr<CachedNetworkParameters> previous_cached_network_params_; | 145 scoped_ptr<CachedNetworkParameters> previous_cached_network_params_; |
148 | 146 |
149 DISALLOW_COPY_AND_ASSIGN(QuicCryptoServerStream); | 147 DISALLOW_COPY_AND_ASSIGN(QuicCryptoServerStream); |
150 }; | 148 }; |
151 | 149 |
152 } // namespace net | 150 } // namespace net |
153 | 151 |
154 #endif // NET_QUIC_QUIC_CRYPTO_SERVER_STREAM_H_ | 152 #endif // NET_QUIC_QUIC_CRYPTO_SERVER_STREAM_H_ |
OLD | NEW |