Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(196)

Unified Diff: net/quic/quic_crypto_stream.h

Issue 11367082: Add QuicStream and friends to QUIC code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/net.gyp ('k') | net/quic/quic_crypto_stream.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/quic/quic_crypto_stream.h
diff --git a/net/quic/quic_crypto_stream.h b/net/quic/quic_crypto_stream.h
new file mode 100644
index 0000000000000000000000000000000000000000..dfcd66ca4d3f758f53caee87ae297f6920bb471b
--- /dev/null
+++ b/net/quic/quic_crypto_stream.h
@@ -0,0 +1,59 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef NET_QUIC_QUIC_CRYPTO_STREAM_H_
+#define NET_QUIC_QUIC_CRYPTO_STREAM_H_
+
+#include "net/quic/crypto/crypto_framer.h"
+#include "net/quic/reliable_quic_stream.h"
+
+namespace net {
+
+class QuicSession;
+
+// Crypto handshake messages in QUIC take place over a reserved
+// reliable stream with the id 1. Each endpoint (client and server)
+// will allocate an instance of a subclass of QuicCryptoStream
+// to send and receive handshake messages. (In the normal 1-RTT
+// handshake, the client will send a client hello, CHLO, message.
+// The server will receive this message and respond with a server
+// hello message, SHLO. At this point both sides will have established
+// a crypto context they can use to send encrypted messages.
+//
+// For more details: http://goto.google.com/quic-crypto
+class NET_EXPORT_PRIVATE QuicCryptoStream
+ : public ReliableQuicStream,
+ public CryptoFramerVisitorInterface {
+
+ public:
+ explicit QuicCryptoStream(QuicSession* session);
+
+ // CryptoFramerVisitorInterface implementation
+ virtual void OnError(CryptoFramer* framer) OVERRIDE;
+ virtual void OnHandshakeMessage(const CryptoHandshakeMessage& message) = 0;
+
+ // ReliableQuicStream implementation
+ virtual uint32 ProcessData(const char* data, uint32 data_len) OVERRIDE;
+
+ // Sends |message| to the peer.
+ void SendHandshakeMessage(const CryptoHandshakeMessage& message);
+
+ bool handshake_complete() { return handshake_complete_; }
+
+ protected:
+ // Closes the connection
+ void CloseConnection(QuicErrorCode error);
+
+ void set_handshake_complete(bool complete) {
+ handshake_complete_ = complete;
+ }
+
+ private:
+ CryptoFramer crypto_framer_;
+ bool handshake_complete_;
+};
+
+} // namespace net
+
+#endif // NET_QUIC_QUIC_CRYPTO_STREAM_H_
« no previous file with comments | « net/net.gyp ('k') | net/quic/quic_crypto_stream.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698