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 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
296 // Called when the underlying connection becomes writable to allow queued | 296 // Called when the underlying connection becomes writable to allow queued |
297 // writes to happen. | 297 // writes to happen. |
298 virtual void OnCanWrite() OVERRIDE; | 298 virtual void OnCanWrite() OVERRIDE; |
299 | 299 |
300 // Called when a packet has been finally sent to the network. | 300 // Called when a packet has been finally sent to the network. |
301 bool OnPacketSent(WriteResult result); | 301 bool OnPacketSent(WriteResult result); |
302 | 302 |
303 // If the socket is not blocked, writes queued packets. | 303 // If the socket is not blocked, writes queued packets. |
304 void WriteIfNotBlocked(); | 304 void WriteIfNotBlocked(); |
305 | 305 |
306 // Do any work which logically would be done in OnPacket but can not be | |
307 // safely done until the packet is validated. Returns true if the packet | |
308 // can be handled, false otherwise. | |
309 virtual bool ProcessValidatedPacket(); | |
310 | |
311 // The version of the protocol this connection is using. | 306 // The version of the protocol this connection is using. |
312 QuicVersion version() const { return framer_.version(); } | 307 QuicVersion version() const { return framer_.version(); } |
313 | 308 |
314 // The versions of the protocol that this connection supports. | 309 // The versions of the protocol that this connection supports. |
315 const QuicVersionVector& supported_versions() const { | 310 const QuicVersionVector& supported_versions() const { |
316 return framer_.supported_versions(); | 311 return framer_.supported_versions(); |
317 } | 312 } |
318 | 313 |
319 // From QuicFramerVisitorInterface | 314 // From QuicFramerVisitorInterface |
320 virtual void OnError(QuicFramer* framer) OVERRIDE; | 315 virtual void OnError(QuicFramer* framer) OVERRIDE; |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
483 // outgoing packet. | 478 // outgoing packet. |
484 ScopedPacketBundler(QuicConnection* connection, AckBundling send_ack); | 479 ScopedPacketBundler(QuicConnection* connection, AckBundling send_ack); |
485 ~ScopedPacketBundler(); | 480 ~ScopedPacketBundler(); |
486 | 481 |
487 private: | 482 private: |
488 QuicConnection* connection_; | 483 QuicConnection* connection_; |
489 bool already_in_batch_mode_; | 484 bool already_in_batch_mode_; |
490 }; | 485 }; |
491 | 486 |
492 protected: | 487 protected: |
| 488 // Do any work which logically would be done in OnPacket but can not be |
| 489 // safely done until the packet is validated. Returns true if the packet |
| 490 // can be handled, false otherwise. |
| 491 virtual bool ProcessValidatedPacket(); |
| 492 |
493 // Send a packet to the peer using encryption |level|. If |sequence_number| | 493 // Send a packet to the peer using encryption |level|. If |sequence_number| |
494 // is present in the |retransmission_map_|, then contents of this packet will | 494 // is present in the |retransmission_map_|, then contents of this packet will |
495 // be retransmitted with a new sequence number if it's not acked by the peer. | 495 // be retransmitted with a new sequence number if it's not acked by the peer. |
496 // Deletes |packet| if WritePacket call succeeds, or transfers ownership to | 496 // Deletes |packet| if WritePacket call succeeds, or transfers ownership to |
497 // QueuedPacket, ultimately deleted in WriteQueuedPackets. Updates the | 497 // QueuedPacket, ultimately deleted in WriteQueuedPackets. Updates the |
498 // entropy map corresponding to |sequence_number| using |entropy_hash|. | 498 // entropy map corresponding to |sequence_number| using |entropy_hash|. |
499 // |transmission_type| and |retransmittable| are supplied to the congestion | 499 // |transmission_type| and |retransmittable| are supplied to the congestion |
500 // manager, and when |forced| is true, it bypasses the congestion manager. | 500 // manager, and when |forced| is true, it bypasses the congestion manager. |
501 // TODO(wtc): none of the callers check the return value. | 501 // TODO(wtc): none of the callers check the return value. |
502 virtual bool SendOrQueuePacket(EncryptionLevel level, | 502 virtual bool SendOrQueuePacket(EncryptionLevel level, |
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
773 // If non-empty this contains the set of versions received in a | 773 // If non-empty this contains the set of versions received in a |
774 // version negotiation packet. | 774 // version negotiation packet. |
775 QuicVersionVector server_supported_versions_; | 775 QuicVersionVector server_supported_versions_; |
776 | 776 |
777 DISALLOW_COPY_AND_ASSIGN(QuicConnection); | 777 DISALLOW_COPY_AND_ASSIGN(QuicConnection); |
778 }; | 778 }; |
779 | 779 |
780 } // namespace net | 780 } // namespace net |
781 | 781 |
782 #endif // NET_QUIC_QUIC_CONNECTION_H_ | 782 #endif // NET_QUIC_QUIC_CONNECTION_H_ |
OLD | NEW |