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

Side by Side Diff: net/quic/quic_session.h

Issue 14718011: Land Recent QUIC Changes (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 7 months 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 | Annotate | Revision Log
« no previous file with comments | « net/quic/quic_protocol.cc ('k') | net/quic/quic_session.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 // A QuicSession, which demuxes a single connection to individual streams. 5 // A QuicSession, which demuxes a single connection to individual streams.
6 6
7 #ifndef NET_QUIC_QUIC_SESSION_H_ 7 #ifndef NET_QUIC_QUIC_SESSION_H_
8 #define NET_QUIC_QUIC_SESSION_H_ 8 #define NET_QUIC_QUIC_SESSION_H_
9 9
10 #include <vector> 10 #include <vector>
(...skipping 13 matching lines...) Expand all
24 class QuicCryptoStream; 24 class QuicCryptoStream;
25 class ReliableQuicStream; 25 class ReliableQuicStream;
26 class VisitorShim; 26 class VisitorShim;
27 27
28 namespace test { 28 namespace test {
29 class QuicSessionPeer; 29 class QuicSessionPeer;
30 } // namespace test 30 } // namespace test
31 31
32 class NET_EXPORT_PRIVATE QuicSession : public QuicConnectionVisitorInterface { 32 class NET_EXPORT_PRIVATE QuicSession : public QuicConnectionVisitorInterface {
33 public: 33 public:
34 // CryptoHandshakeEvent enumerates the events generated by a QuicCryptoStream.
35 enum CryptoHandshakeEvent {
36 // ENCRYPTION_FIRST_ESTABLISHED indicates that a full client hello has been
37 // sent by a client and that subsequent packets will be encrypted. (Client
38 // only.)
39 ENCRYPTION_FIRST_ESTABLISHED,
40 // ENCRYPTION_REESTABLISHED indicates that a client hello was rejected by
41 // the server and thus the encryption key has been updated. Therefore the
42 // connection should resend any packets that were sent under
43 // ENCRYPTION_INITIAL. (Client only.)
44 ENCRYPTION_REESTABLISHED,
45 // HANDSHAKE_CONFIRMED, in a client, indicates the the server has accepted
46 // our handshake. In a server it indicates that a full, valid client hello
47 // has been received. (Client and server.)
48 HANDSHAKE_CONFIRMED,
49 };
50
34 QuicSession(QuicConnection* connection, bool is_server); 51 QuicSession(QuicConnection* connection, bool is_server);
35 52
36 virtual ~QuicSession(); 53 virtual ~QuicSession();
37 54
38 // QuicConnectionVisitorInterface methods: 55 // QuicConnectionVisitorInterface methods:
39 virtual bool OnPacket(const IPEndPoint& self_address, 56 virtual bool OnPacket(const IPEndPoint& self_address,
40 const IPEndPoint& peer_address, 57 const IPEndPoint& peer_address,
41 const QuicPacketHeader& header, 58 const QuicPacketHeader& header,
42 const std::vector<QuicStreamFrame>& frame) OVERRIDE; 59 const std::vector<QuicStreamFrame>& frame) OVERRIDE;
43 virtual void OnRstStream(const QuicRstStreamFrame& frame) OVERRIDE; 60 virtual void OnRstStream(const QuicRstStreamFrame& frame) OVERRIDE;
(...skipping 14 matching lines...) Expand all
58 bool fin); 75 bool fin);
59 // Called by streams when they want to close the stream in both directions. 76 // Called by streams when they want to close the stream in both directions.
60 virtual void SendRstStream(QuicStreamId id, QuicRstStreamErrorCode error); 77 virtual void SendRstStream(QuicStreamId id, QuicRstStreamErrorCode error);
61 78
62 // Called when the session wants to go away and not accept any new streams. 79 // Called when the session wants to go away and not accept any new streams.
63 void SendGoAway(QuicErrorCode error_code, const std::string& reason); 80 void SendGoAway(QuicErrorCode error_code, const std::string& reason);
64 81
65 // Removes the stream associated with 'stream_id' from the active stream map. 82 // Removes the stream associated with 'stream_id' from the active stream map.
66 virtual void CloseStream(QuicStreamId stream_id); 83 virtual void CloseStream(QuicStreamId stream_id);
67 84
68 // Returns true once the crypto handshake is complete. 85 // Returns true if outgoing packets will be encrypted, even if the server
69 virtual bool IsCryptoHandshakeComplete(); 86 // hasn't confirmed the handshake yet.
87 virtual bool IsEncryptionEstablished();
70 88
71 // Called by the QuicCryptoStream when the handshake completes. 89 // For a client, returns true if the server has confirmed our handshake. For
72 // If |error| is QUIC_NO_ERROR then the handshake was succesful, 90 // a server, returns true if a full, valid client hello has been received.
73 // otherwise it failed. 91 virtual bool IsCryptoHandshakeConfirmed();
74 virtual void OnCryptoHandshakeComplete(QuicErrorCode error); 92
93 // Called by the QuicCryptoStream when the handshake enters a new state.
94 //
95 // Clients will call this function in the order:
96 // ENCRYPTION_FIRST_ESTABLISHED
97 // zero or more ENCRYPTION_REESTABLISHED
98 // HANDSHAKE_CONFIRMED
99 //
100 // Servers will simply call it once with HANDSHAKE_CONFIRMED.
101 virtual void OnCryptoHandshakeEvent(CryptoHandshakeEvent event);
75 102
76 // Returns true if the stream existed previously and has been closed. 103 // Returns true if the stream existed previously and has been closed.
77 // Returns false if the stream is still active or if the stream has 104 // Returns false if the stream is still active or if the stream has
78 // not yet been created. 105 // not yet been created.
79 bool IsClosedStream(QuicStreamId id); 106 bool IsClosedStream(QuicStreamId id);
80 107
81 QuicConnection* connection() { return connection_.get(); } 108 QuicConnection* connection() { return connection_.get(); }
82 size_t num_active_requests() const { return stream_map_.size(); } 109 size_t num_active_requests() const { return stream_map_.size(); }
83 const IPEndPoint& peer_address() const { 110 const IPEndPoint& peer_address() const {
84 return connection_->peer_address(); 111 return connection_->peer_address();
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 bool goaway_received_; 203 bool goaway_received_;
177 // Whether a GoAway has been sent. 204 // Whether a GoAway has been sent.
178 bool goaway_sent_; 205 bool goaway_sent_;
179 206
180 DISALLOW_COPY_AND_ASSIGN(QuicSession); 207 DISALLOW_COPY_AND_ASSIGN(QuicSession);
181 }; 208 };
182 209
183 } // namespace net 210 } // namespace net
184 211
185 #endif // NET_QUIC_QUIC_SESSION_H_ 212 #endif // NET_QUIC_QUIC_SESSION_H_
OLDNEW
« no previous file with comments | « net/quic/quic_protocol.cc ('k') | net/quic/quic_session.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698