OLD | NEW |
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 <stddef.h> | 10 #include <stddef.h> |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 // the server and thus the encryption key has been updated. Therefore the | 50 // the server and thus the encryption key has been updated. Therefore the |
51 // connection should resend any packets that were sent under | 51 // connection should resend any packets that were sent under |
52 // ENCRYPTION_INITIAL. (Client only.) | 52 // ENCRYPTION_INITIAL. (Client only.) |
53 ENCRYPTION_REESTABLISHED, | 53 ENCRYPTION_REESTABLISHED, |
54 // HANDSHAKE_CONFIRMED, in a client, indicates the the server has accepted | 54 // HANDSHAKE_CONFIRMED, in a client, indicates the the server has accepted |
55 // our handshake. In a server it indicates that a full, valid client hello | 55 // our handshake. In a server it indicates that a full, valid client hello |
56 // has been received. (Client and server.) | 56 // has been received. (Client and server.) |
57 HANDSHAKE_CONFIRMED, | 57 HANDSHAKE_CONFIRMED, |
58 }; | 58 }; |
59 | 59 |
60 // Takes ownership of |connection|. | 60 // Does not take ownership of |connection|. |
61 QuicSession(QuicConnection* connection, const QuicConfig& config); | 61 QuicSession(QuicConnection* connection, const QuicConfig& config); |
62 | 62 |
63 ~QuicSession() override; | 63 ~QuicSession() override; |
64 | 64 |
65 virtual void Initialize(); | 65 virtual void Initialize(); |
66 | 66 |
67 // QuicConnectionVisitorInterface methods: | 67 // QuicConnectionVisitorInterface methods: |
68 void OnStreamFrame(const QuicStreamFrame& frame) override; | 68 void OnStreamFrame(const QuicStreamFrame& frame) override; |
69 void OnRstStream(const QuicRstStreamFrame& frame) override; | 69 void OnRstStream(const QuicRstStreamFrame& frame) override; |
70 void OnGoAway(const QuicGoAwayFrame& frame) override; | 70 void OnGoAway(const QuicGoAwayFrame& frame) override; |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 | 148 |
149 // Returns mutable config for this session. Returned config is owned | 149 // Returns mutable config for this session. Returned config is owned |
150 // by QuicSession. | 150 // by QuicSession. |
151 QuicConfig* config(); | 151 QuicConfig* config(); |
152 | 152 |
153 // Returns true if the stream existed previously and has been closed. | 153 // Returns true if the stream existed previously and has been closed. |
154 // Returns false if the stream is still active or if the stream has | 154 // Returns false if the stream is still active or if the stream has |
155 // not yet been created. | 155 // not yet been created. |
156 bool IsClosedStream(QuicStreamId id); | 156 bool IsClosedStream(QuicStreamId id); |
157 | 157 |
158 QuicConnection* connection() { return connection_.get(); } | 158 QuicConnection* connection() { return connection_; } |
159 const QuicConnection* connection() const { return connection_.get(); } | 159 const QuicConnection* connection() const { return connection_; } |
160 size_t num_active_requests() const { return dynamic_stream_map_.size(); } | 160 size_t num_active_requests() const { return dynamic_stream_map_.size(); } |
161 const IPEndPoint& peer_address() const { return connection_->peer_address(); } | 161 const IPEndPoint& peer_address() const { return connection_->peer_address(); } |
162 QuicConnectionId connection_id() const { | 162 QuicConnectionId connection_id() const { |
163 return connection_->connection_id(); | 163 return connection_->connection_id(); |
164 } | 164 } |
165 | 165 |
166 // Returns the number of currently open streams, excluding the reserved | 166 // Returns the number of currently open streams, excluding the reserved |
167 // headers and crypto streams, and never counting unfinished streams. | 167 // headers and crypto streams, and never counting unfinished streams. |
168 virtual size_t GetNumActiveStreams() const; | 168 virtual size_t GetNumActiveStreams() const; |
169 | 169 |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
345 | 345 |
346 // Called in OnConfigNegotiated when we receive a new connection level flow | 346 // Called in OnConfigNegotiated when we receive a new connection level flow |
347 // control window in a negotiated config. Closes the connection if invalid. | 347 // control window in a negotiated config. Closes the connection if invalid. |
348 void OnNewSessionFlowControlWindow(QuicStreamOffset new_window); | 348 void OnNewSessionFlowControlWindow(QuicStreamOffset new_window); |
349 | 349 |
350 // Keep track of highest received byte offset of locally closed streams, while | 350 // Keep track of highest received byte offset of locally closed streams, while |
351 // waiting for a definitive final highest offset from the peer. | 351 // waiting for a definitive final highest offset from the peer. |
352 std::map<QuicStreamId, QuicStreamOffset> | 352 std::map<QuicStreamId, QuicStreamOffset> |
353 locally_closed_streams_highest_offset_; | 353 locally_closed_streams_highest_offset_; |
354 | 354 |
355 std::unique_ptr<QuicConnection> connection_; | 355 QuicConnection* connection_; |
356 | 356 |
357 std::vector<ReliableQuicStream*> closed_streams_; | 357 std::vector<ReliableQuicStream*> closed_streams_; |
358 | 358 |
359 QuicConfig config_; | 359 QuicConfig config_; |
360 | 360 |
361 // The maximum number of outgoing streams this connection can open. | 361 // The maximum number of outgoing streams this connection can open. |
362 size_t max_open_outgoing_streams_; | 362 size_t max_open_outgoing_streams_; |
363 | 363 |
364 // The maximum number of incoming streams this connection will allow. | 364 // The maximum number of incoming streams this connection will allow. |
365 size_t max_open_incoming_streams_; | 365 size_t max_open_incoming_streams_; |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
407 // The stream id which was last popped in OnCanWrite, or 0, if not under the | 407 // The stream id which was last popped in OnCanWrite, or 0, if not under the |
408 // call stack of OnCanWrite. | 408 // call stack of OnCanWrite. |
409 QuicStreamId currently_writing_stream_id_; | 409 QuicStreamId currently_writing_stream_id_; |
410 | 410 |
411 DISALLOW_COPY_AND_ASSIGN(QuicSession); | 411 DISALLOW_COPY_AND_ASSIGN(QuicSession); |
412 }; | 412 }; |
413 | 413 |
414 } // namespace net | 414 } // namespace net |
415 | 415 |
416 #endif // NET_QUIC_QUIC_SESSION_H_ | 416 #endif // NET_QUIC_QUIC_SESSION_H_ |
OLD | NEW |