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 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
229 QUEUED, | 229 QUEUED, |
230 CONNECTION_CLOSE | 230 CONNECTION_CLOSE |
231 }; | 231 }; |
232 | 232 |
233 enum AckBundling { | 233 enum AckBundling { |
234 NO_ACK = 0, | 234 NO_ACK = 0, |
235 SEND_ACK = 1, | 235 SEND_ACK = 1, |
236 BUNDLE_PENDING_ACK = 2, | 236 BUNDLE_PENDING_ACK = 2, |
237 }; | 237 }; |
238 | 238 |
239 // Constructs a new QuicConnection for |connection_id| and |address|. | 239 class PacketWriterFactory { |
240 // |helper| must outlive this connection, and if |owns_writer| is false, so | 240 public: |
241 // must |writer|. | 241 virtual ~PacketWriterFactory() {} |
| 242 |
| 243 virtual QuicPacketWriter* Create(QuicConnection* connection) const = 0; |
| 244 }; |
| 245 |
| 246 // Constructs a new QuicConnection for |connection_id| and |address|. Invokes |
| 247 // writer_factory->Create() to get a writer; |owns_writer| specifies whether |
| 248 // the connection takes ownership of the returned writer. |helper| must |
| 249 // outlive this connection. |
242 QuicConnection(QuicConnectionId connection_id, | 250 QuicConnection(QuicConnectionId connection_id, |
243 IPEndPoint address, | 251 IPEndPoint address, |
244 QuicConnectionHelperInterface* helper, | 252 QuicConnectionHelperInterface* helper, |
245 QuicPacketWriter* writer, | 253 const PacketWriterFactory& writer_factory, |
246 bool owns_writer, | 254 bool owns_writer, |
247 bool is_server, | 255 bool is_server, |
248 const QuicVersionVector& supported_versions); | 256 const QuicVersionVector& supported_versions); |
249 virtual ~QuicConnection(); | 257 virtual ~QuicConnection(); |
250 | 258 |
251 // Sets connection parameters from the supplied |config|. | 259 // Sets connection parameters from the supplied |config|. |
252 void SetFromConfig(const QuicConfig& config); | 260 void SetFromConfig(const QuicConfig& config); |
253 | 261 |
254 // Send the data in |data| to the peer in as few packets as possible. | 262 // Send the data in |data| to the peer in as few packets as possible. |
255 // Returns a pair with the number of bytes consumed from data, and a boolean | 263 // Returns a pair with the number of bytes consumed from data, and a boolean |
(...skipping 539 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
795 // If non-empty this contains the set of versions received in a | 803 // If non-empty this contains the set of versions received in a |
796 // version negotiation packet. | 804 // version negotiation packet. |
797 QuicVersionVector server_supported_versions_; | 805 QuicVersionVector server_supported_versions_; |
798 | 806 |
799 DISALLOW_COPY_AND_ASSIGN(QuicConnection); | 807 DISALLOW_COPY_AND_ASSIGN(QuicConnection); |
800 }; | 808 }; |
801 | 809 |
802 } // namespace net | 810 } // namespace net |
803 | 811 |
804 #endif // NET_QUIC_QUIC_CONNECTION_H_ | 812 #endif // NET_QUIC_QUIC_CONNECTION_H_ |
OLD | NEW |