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

Side by Side Diff: net/quic/core/quic_crypto_stream.h

Issue 2487613002: Landing Recent QUIC changes until 12:43 PM, Nov 5, 2016 UTC+8 (Closed)
Patch Set: Created 4 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 unified diff | Download patch
« no previous file with comments | « net/quic/core/quic_crypto_server_stream_test.cc ('k') | net/quic/core/quic_crypto_stream.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_STREAM_H_ 5 #ifndef NET_QUIC_QUIC_CRYPTO_STREAM_H_
6 #define NET_QUIC_QUIC_CRYPTO_STREAM_H_ 6 #define NET_QUIC_QUIC_CRYPTO_STREAM_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
11 #include "net/base/net_export.h" 11 #include "net/base/net_export.h"
12 #include "net/quic/core/crypto/crypto_framer.h" 12 #include "net/quic/core/crypto/crypto_framer.h"
13 #include "net/quic/core/crypto/crypto_utils.h" 13 #include "net/quic/core/crypto/crypto_utils.h"
14 #include "net/quic/core/quic_config.h" 14 #include "net/quic/core/quic_config.h"
15 #include "net/quic/core/quic_protocol.h" 15 #include "net/quic/core/quic_protocol.h"
16 #include "net/quic/core/reliable_quic_stream.h" 16 #include "net/quic/core/quic_stream.h"
17 17
18 namespace net { 18 namespace net {
19 19
20 class CryptoHandshakeMessage; 20 class CryptoHandshakeMessage;
21 class QuicSession; 21 class QuicSession;
22 22
23 // Crypto handshake messages in QUIC take place over a reserved 23 // Crypto handshake messages in QUIC take place over a reserved stream with the
24 // reliable stream with the id 1. Each endpoint (client and server) 24 // id 1. Each endpoint (client and server) will allocate an instance of a
25 // will allocate an instance of a subclass of QuicCryptoStream 25 // subclass of QuicCryptoStream to send and receive handshake messages. (In the
26 // to send and receive handshake messages. (In the normal 1-RTT 26 // normal 1-RTT handshake, the client will send a client hello, CHLO, message.
27 // handshake, the client will send a client hello, CHLO, message. 27 // The server will receive this message and respond with a server hello message,
28 // The server will receive this message and respond with a server 28 // SHLO. At this point both sides will have established a crypto context they
29 // hello message, SHLO. At this point both sides will have established 29 // can use to send encrypted messages.
30 // a crypto context they can use to send encrypted messages.
31 // 30 //
32 // For more details: http://goto.google.com/quic-crypto 31 // For more details:
32 // https://docs.google.com/document/d/1g5nIXAIkN_Y-7XJW5K45IblHd_L2f5LTaDUDwvZ5L 6g/edit?usp=sharing
33 class NET_EXPORT_PRIVATE QuicCryptoStream 33 class NET_EXPORT_PRIVATE QuicCryptoStream
34 : public ReliableQuicStream, 34 : public QuicStream,
35 public CryptoFramerVisitorInterface { 35 public CryptoFramerVisitorInterface {
36 public: 36 public:
37 explicit QuicCryptoStream(QuicSession* session); 37 explicit QuicCryptoStream(QuicSession* session);
38 38
39 ~QuicCryptoStream() override; 39 ~QuicCryptoStream() override;
40 40
41 // Returns the per-packet framing overhead associated with sending a 41 // Returns the per-packet framing overhead associated with sending a
42 // handshake message for |version|. 42 // handshake message for |version|.
43 static QuicByteCount CryptoMessageFramingOverhead(QuicVersion version); 43 static QuicByteCount CryptoMessageFramingOverhead(QuicVersion version);
44 44
45 // CryptoFramerVisitorInterface implementation 45 // CryptoFramerVisitorInterface implementation
46 void OnError(CryptoFramer* framer) override; 46 void OnError(CryptoFramer* framer) override;
47 void OnHandshakeMessage(const CryptoHandshakeMessage& message) override; 47 void OnHandshakeMessage(const CryptoHandshakeMessage& message) override;
48 48
49 // ReliableQuicStream implementation 49 // QuicStream implementation
50 void OnDataAvailable() override; 50 void OnDataAvailable() override;
51 51
52 // Sends |message| to the peer. 52 // Sends |message| to the peer.
53 // TODO(wtc): return a success/failure status. 53 // TODO(wtc): return a success/failure status.
54 void SendHandshakeMessage(const CryptoHandshakeMessage& message); 54 void SendHandshakeMessage(const CryptoHandshakeMessage& message);
55 55
56 // Performs key extraction to derive a new secret of |result_len| bytes 56 // Performs key extraction to derive a new secret of |result_len| bytes
57 // dependent on |label|, |context|, and the stream's negotiated subkey secret. 57 // dependent on |label|, |context|, and the stream's negotiated subkey secret.
58 // Returns false if the handshake has not been confirmed or the parameters are 58 // Returns false if the handshake has not been confirmed or the parameters are
59 // invalid (e.g. |label| contains null bytes); returns true on success. 59 // invalid (e.g. |label| contains null bytes); returns true on success.
(...skipping 25 matching lines...) Expand all
85 85
86 private: 86 private:
87 CryptoFramer crypto_framer_; 87 CryptoFramer crypto_framer_;
88 88
89 DISALLOW_COPY_AND_ASSIGN(QuicCryptoStream); 89 DISALLOW_COPY_AND_ASSIGN(QuicCryptoStream);
90 }; 90 };
91 91
92 } // namespace net 92 } // namespace net
93 93
94 #endif // NET_QUIC_QUIC_CRYPTO_STREAM_H_ 94 #endif // NET_QUIC_QUIC_CRYPTO_STREAM_H_
OLDNEW
« no previous file with comments | « net/quic/core/quic_crypto_server_stream_test.cc ('k') | net/quic/core/quic_crypto_stream.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698