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 // The entity that handles framing writes for a Quic client or server. | 5 // The entity that handles framing writes for a Quic client or server. |
6 // Each QuicSession will have a connection associated with it. | 6 // Each QuicSession will have a connection associated with it. |
7 // | 7 // |
8 // On the server side, the Dispatcher handles the raw reads, and hands off | 8 // On the server side, the Dispatcher handles the raw reads, and hands off |
9 // packets via ProcessUdpPacket for framing and processing. | 9 // packets via ProcessUdpPacket for framing and processing. |
10 // | 10 // |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 const QuicVersionVector& supported_versions); | 223 const QuicVersionVector& supported_versions); |
224 virtual ~QuicConnection(); | 224 virtual ~QuicConnection(); |
225 | 225 |
226 // Sets connection parameters from the supplied |config|. | 226 // Sets connection parameters from the supplied |config|. |
227 void SetFromConfig(const QuicConfig& config); | 227 void SetFromConfig(const QuicConfig& config); |
228 | 228 |
229 // Send the data in |data| to the peer in as few packets as possible. | 229 // Send the data in |data| to the peer in as few packets as possible. |
230 // Returns a pair with the number of bytes consumed from data, and a boolean | 230 // Returns a pair with the number of bytes consumed from data, and a boolean |
231 // indicating if the fin bit was consumed. This does not indicate the data | 231 // indicating if the fin bit was consumed. This does not indicate the data |
232 // has been sent on the wire: it may have been turned into a packet and queued | 232 // has been sent on the wire: it may have been turned into a packet and queued |
233 // if the socket was unexpectedly blocked. | 233 // if the socket was unexpectedly blocked. |fec_protection| indicates if |
| 234 // data is to be FEC protected. Note that data that is sent immediately |
| 235 // following MUST_FEC_PROTECT data may get protected by falling within the |
| 236 // same FEC group. |
234 // If |delegate| is provided, then it will be informed once ACKs have been | 237 // If |delegate| is provided, then it will be informed once ACKs have been |
235 // received for all the packets written in this call. | 238 // received for all the packets written in this call. |
236 // The |delegate| is not owned by the QuicConnection and must outlive it. | 239 // The |delegate| is not owned by the QuicConnection and must outlive it. |
237 QuicConsumedData SendStreamData(QuicStreamId id, | 240 QuicConsumedData SendStreamData(QuicStreamId id, |
238 const IOVector& data, | 241 const IOVector& data, |
239 QuicStreamOffset offset, | 242 QuicStreamOffset offset, |
240 bool fin, | 243 bool fin, |
| 244 FecProtection fec_protection, |
241 QuicAckNotifier::DelegateInterface* delegate); | 245 QuicAckNotifier::DelegateInterface* delegate); |
242 | 246 |
243 // Send a RST_STREAM frame to the peer. | 247 // Send a RST_STREAM frame to the peer. |
244 virtual void SendRstStream(QuicStreamId id, | 248 virtual void SendRstStream(QuicStreamId id, |
245 QuicRstStreamErrorCode error, | 249 QuicRstStreamErrorCode error, |
246 QuicStreamOffset bytes_written); | 250 QuicStreamOffset bytes_written); |
247 | 251 |
248 // Send a BLOCKED frame to the peer. | 252 // Send a BLOCKED frame to the peer. |
249 virtual void SendBlocked(QuicStreamId id); | 253 virtual void SendBlocked(QuicStreamId id); |
250 | 254 |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
349 void set_debug_visitor(QuicConnectionDebugVisitor* debug_visitor) { | 353 void set_debug_visitor(QuicConnectionDebugVisitor* debug_visitor) { |
350 debug_visitor_ = debug_visitor; | 354 debug_visitor_ = debug_visitor; |
351 packet_generator_.set_debug_delegate(debug_visitor); | 355 packet_generator_.set_debug_delegate(debug_visitor); |
352 sent_packet_manager_.set_debug_delegate(debug_visitor); | 356 sent_packet_manager_.set_debug_delegate(debug_visitor); |
353 } | 357 } |
354 const IPEndPoint& self_address() const { return self_address_; } | 358 const IPEndPoint& self_address() const { return self_address_; } |
355 const IPEndPoint& peer_address() const { return peer_address_; } | 359 const IPEndPoint& peer_address() const { return peer_address_; } |
356 QuicConnectionId connection_id() const { return connection_id_; } | 360 QuicConnectionId connection_id() const { return connection_id_; } |
357 const QuicClock* clock() const { return clock_; } | 361 const QuicClock* clock() const { return clock_; } |
358 QuicRandom* random_generator() const { return random_generator_; } | 362 QuicRandom* random_generator() const { return random_generator_; } |
359 size_t max_packet_length() const { | 363 size_t max_packet_length() const; |
360 return packet_creator_.max_packet_length(); | 364 void set_max_packet_length(size_t length); |
361 } | |
362 void set_max_packet_length(size_t length) { | |
363 return packet_creator_.set_max_packet_length(length); | |
364 } | |
365 | 365 |
366 bool connected() const { return connected_; } | 366 bool connected() const { return connected_; } |
367 | 367 |
368 // Must only be called on client connections. | 368 // Must only be called on client connections. |
369 const QuicVersionVector& server_supported_versions() const { | 369 const QuicVersionVector& server_supported_versions() const { |
370 DCHECK(!is_server_); | 370 DCHECK(!is_server_); |
371 return server_supported_versions_; | 371 return server_supported_versions_; |
372 } | 372 } |
373 | 373 |
374 size_t NumFecGroups() const { return group_map_.size(); } | 374 size_t NumFecGroups() const { return group_map_.size(); } |
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
695 // An alarm that is scheduled when the connection can still write and there | 695 // An alarm that is scheduled when the connection can still write and there |
696 // may be more data to send. | 696 // may be more data to send. |
697 scoped_ptr<QuicAlarm> resume_writes_alarm_; | 697 scoped_ptr<QuicAlarm> resume_writes_alarm_; |
698 // An alarm that fires when the connection may have timed out. | 698 // An alarm that fires when the connection may have timed out. |
699 scoped_ptr<QuicAlarm> timeout_alarm_; | 699 scoped_ptr<QuicAlarm> timeout_alarm_; |
700 // An alarm that fires when a ping should be sent. | 700 // An alarm that fires when a ping should be sent. |
701 scoped_ptr<QuicAlarm> ping_alarm_; | 701 scoped_ptr<QuicAlarm> ping_alarm_; |
702 | 702 |
703 QuicConnectionVisitorInterface* visitor_; | 703 QuicConnectionVisitorInterface* visitor_; |
704 QuicConnectionDebugVisitor* debug_visitor_; | 704 QuicConnectionDebugVisitor* debug_visitor_; |
705 QuicPacketCreator packet_creator_; | |
706 QuicPacketGenerator packet_generator_; | 705 QuicPacketGenerator packet_generator_; |
707 | 706 |
708 // Network idle time before we kill of this connection. | 707 // Network idle time before we kill of this connection. |
709 QuicTime::Delta idle_network_timeout_; | 708 QuicTime::Delta idle_network_timeout_; |
710 // Overall connection timeout. | 709 // Overall connection timeout. |
711 QuicTime::Delta overall_connection_timeout_; | 710 QuicTime::Delta overall_connection_timeout_; |
712 | 711 |
713 // Statistics for this session. | 712 // Statistics for this session. |
714 QuicConnectionStats stats_; | 713 QuicConnectionStats stats_; |
715 | 714 |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
759 // If non-empty this contains the set of versions received in a | 758 // If non-empty this contains the set of versions received in a |
760 // version negotiation packet. | 759 // version negotiation packet. |
761 QuicVersionVector server_supported_versions_; | 760 QuicVersionVector server_supported_versions_; |
762 | 761 |
763 DISALLOW_COPY_AND_ASSIGN(QuicConnection); | 762 DISALLOW_COPY_AND_ASSIGN(QuicConnection); |
764 }; | 763 }; |
765 | 764 |
766 } // namespace net | 765 } // namespace net |
767 | 766 |
768 #endif // NET_QUIC_QUIC_CONNECTION_H_ | 767 #endif // NET_QUIC_QUIC_CONNECTION_H_ |
OLD | NEW |