Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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_STREAM_H_ | |
| 6 #define NET_QUIC_QUIC_CRYPTO_STREAM_H_ | |
| 7 | |
| 8 #include "net/quic/crypto/crypto_framer.h" | |
| 9 #include "net/quic/reliable_quic_stream.h" | |
| 10 | |
| 11 namespace net { | |
| 12 | |
| 13 class QuicSession; | |
| 14 | |
| 15 // Crypto handshake messages in QUIC take place over a reserved | |
| 16 // reliable stream with the id 1. Each endpoint (client and server) | |
| 17 // will allocate an instance of a subclass of QuicCryptoStream | |
| 18 // to send and receive handshake messages. (In the normal 1-RTT | |
| 19 // handshake, the client will send a client hello, CHLO, message. | |
| 20 // The server will receive this message and respond with a server | |
| 21 // hello message, SHLO. At this point both sides will have established | |
| 22 // a crypto context they can use to send encrypted messages. | |
| 23 // | |
| 24 // For more details: http://goto.google.com/quic-crypto | |
| 25 class QuicCryptoStream : public ReliableQuicStream, | |
| 26 public CryptoFramerVisitorInterface { | |
| 27 | |
| 28 public: | |
| 29 explicit QuicCryptoStream(QuicSession* session); | |
| 30 | |
| 31 // CryptoFramerVisitorInterface implementation | |
| 32 virtual void OnError(CryptoFramer* framer) OVERRIDE; | |
| 33 virtual void OnHandshakeMessage(const CryptoHandshakeMessage& message) = 0; | |
| 34 | |
| 35 // ReliableQuicStream implementation | |
| 36 virtual uint32 ProcessData(const char* data, uint32 data_len) OVERRIDE; | |
| 37 | |
| 38 // Sends |message| to the peer. | |
| 39 void SendHandshakeMessage(const CryptoHandshakeMessage& message); | |
| 40 | |
| 41 bool handshake_complete() { return handshake_complete_; } | |
| 42 | |
| 43 protected: | |
| 44 // Closes the connection | |
| 45 void CloseConnection(QuicErrorCode error); | |
| 46 | |
| 47 void set_handshake_complete(bool complete) { | |
| 48 handshake_complete_ = complete; | |
| 49 } | |
| 50 | |
| 51 private: | |
| 52 CryptoFramer crypto_framer_; | |
| 53 bool handshake_complete_; | |
| 54 }; | |
|
jar (doing other things)
2012/10/31 22:37:37
nit: NO_COPY_AND_ASSIGN macro.
Ryan Hamilton
2012/11/01 22:52:20
Fixed upstream.
| |
| 55 | |
| 56 } // namespace net | |
| 57 | |
| 58 #endif // NET_QUIC_QUIC_CRYPTO_STREAM_H_ | |
| OLD | NEW |