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 3 // found in the LICENSE file. 4 5 #ifndef NET_QUIC_QUIC_CRYPTO_SERVER_STREAM_H_ 6 #define NET_QUIC_QUIC_CRYPTO_SERVER_STREAM_H_ 7 8 #include <string> 9 10 #include "net/quic/crypto/crypto_handshake.h" 11 #include "net/quic/quic_config.h" 12 #include "net/quic/quic_crypto_stream.h" 13 14 namespace net { 15 16 class CryptoHandshakeMessage; 17 class QuicCryptoServerConfig; 18 class QuicSession; 19 20 namespace test { 21 class CryptoTestUtils; 22 } // namespace test 23 24 class NET_EXPORT_PRIVATE QuicCryptoServerStream : public QuicCryptoStream { 25 public: 26 QuicCryptoServerStream(const QuicCryptoServerConfig& crypto_config, 27 QuicSession* session); 28 explicit QuicCryptoServerStream(QuicSession* session); 29 virtual ~QuicCryptoServerStream(); 30 31 // CryptoFramerVisitorInterface implementation 32 virtual void OnHandshakeMessage( 33 const CryptoHandshakeMessage& message) OVERRIDE; 34 35 // GetBase64SHA256ClientChannelID sets |*output| to the base64 encoded, 36 // SHA-256 hash of the client's ChannelID key and returns true, if the client 37 // presented a ChannelID. Otherwise it returns false. 38 bool GetBase64SHA256ClientChannelID(std::string* output) const; 39 40 protected: 41 virtual QuicErrorCode ProcessClientHello( 42 const CryptoHandshakeMessage& message, 43 CryptoHandshakeMessage* reply, 44 std::string* error_details); 45 46 const QuicCryptoServerConfig* crypto_config() { return &crypto_config_; } 47 48 private: 49 friend class test::CryptoTestUtils; 50 51 // crypto_config_ contains crypto parameters for the handshake. 52 const QuicCryptoServerConfig& crypto_config_; 53 }; 54 55 } // namespace net 56 57 #endif // NET_QUIC_QUIC_CRYPTO_SERVER_STREAM_H_ 58