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 NET_EXPORT_PRIVATE QuicCryptoStream |
| 26 : public ReliableQuicStream, |
| 27 public CryptoFramerVisitorInterface { |
| 28 |
| 29 public: |
| 30 explicit QuicCryptoStream(QuicSession* session); |
| 31 |
| 32 // CryptoFramerVisitorInterface implementation |
| 33 virtual void OnError(CryptoFramer* framer) OVERRIDE; |
| 34 virtual void OnHandshakeMessage(const CryptoHandshakeMessage& message) = 0; |
| 35 |
| 36 // ReliableQuicStream implementation |
| 37 virtual uint32 ProcessData(const char* data, uint32 data_len) OVERRIDE; |
| 38 |
| 39 // Sends |message| to the peer. |
| 40 void SendHandshakeMessage(const CryptoHandshakeMessage& message); |
| 41 |
| 42 bool handshake_complete() { return handshake_complete_; } |
| 43 |
| 44 protected: |
| 45 // Closes the connection |
| 46 void CloseConnection(QuicErrorCode error); |
| 47 |
| 48 void set_handshake_complete(bool complete) { |
| 49 handshake_complete_ = complete; |
| 50 } |
| 51 |
| 52 private: |
| 53 CryptoFramer crypto_framer_; |
| 54 bool handshake_complete_; |
| 55 }; |
| 56 |
| 57 } // namespace net |
| 58 |
| 59 #endif // NET_QUIC_QUIC_CRYPTO_STREAM_H_ |
OLD | NEW |