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

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

Issue 19858003: * Removed QuicTag kQuicVersion1 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix compiler errors Created 7 years, 5 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 | « no previous file | net/quic/quic_connection.cc » ('j') | net/quic/quic_connection_test.cc » ('J')
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 // 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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 int rv) = 0; 94 int rv) = 0;
95 95
96 // Called when a packet has been received, but before it is 96 // Called when a packet has been received, but before it is
97 // validated or parsed. 97 // validated or parsed.
98 virtual void OnPacketReceived(const IPEndPoint& self_address, 98 virtual void OnPacketReceived(const IPEndPoint& self_address,
99 const IPEndPoint& peer_address, 99 const IPEndPoint& peer_address,
100 const QuicEncryptedPacket& packet) = 0; 100 const QuicEncryptedPacket& packet) = 0;
101 101
102 // Called when the protocol version on the received packet doensn't match 102 // Called when the protocol version on the received packet doensn't match
103 // current protocol version of the connection. 103 // current protocol version of the connection.
104 virtual void OnProtocolVersionMismatch(QuicTag version) = 0; 104 virtual void OnProtocolVersionMismatch(QuicVersion version) = 0;
105 105
106 // Called when the complete header of a packet has been parsed. 106 // Called when the complete header of a packet has been parsed.
107 virtual void OnPacketHeader(const QuicPacketHeader& header) = 0; 107 virtual void OnPacketHeader(const QuicPacketHeader& header) = 0;
108 108
109 // Called when a StreamFrame has been parsed. 109 // Called when a StreamFrame has been parsed.
110 virtual void OnStreamFrame(const QuicStreamFrame& frame) = 0; 110 virtual void OnStreamFrame(const QuicStreamFrame& frame) = 0;
111 111
112 // Called when a AckFrame has been parsed. 112 // Called when a AckFrame has been parsed.
113 virtual void OnAckFrame(const QuicAckFrame& frame) = 0; 113 virtual void OnAckFrame(const QuicAckFrame& frame) = 0;
114 114
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 enum RetransmissionType { 213 enum RetransmissionType {
214 INITIAL_ENCRYPTION_ONLY, 214 INITIAL_ENCRYPTION_ONLY,
215 ALL_PACKETS 215 ALL_PACKETS
216 }; 216 };
217 217
218 // Constructs a new QuicConnection for the specified |guid| and |address|. 218 // Constructs a new QuicConnection for the specified |guid| and |address|.
219 // |helper| will be owned by this connection. 219 // |helper| will be owned by this connection.
220 QuicConnection(QuicGuid guid, 220 QuicConnection(QuicGuid guid,
221 IPEndPoint address, 221 IPEndPoint address,
222 QuicConnectionHelperInterface* helper, 222 QuicConnectionHelperInterface* helper,
223 bool is_server); 223 bool is_server,
224 QuicVersion version);
224 virtual ~QuicConnection(); 225 virtual ~QuicConnection();
225 226
226 static void DeleteEnclosedFrame(QuicFrame* frame); 227 static void DeleteEnclosedFrame(QuicFrame* frame);
227 228
228 // Send the data payload to the peer. 229 // Send the data payload to the peer.
229 // 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
230 // 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
231 // 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
232 // if the socket was unexpectedly blocked. 233 // if the socket was unexpectedly blocked.
233 QuicConsumedData SendStreamData(QuicStreamId id, 234 QuicConsumedData SendStreamData(QuicStreamId id,
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
269 // Called when the underlying connection becomes writable to allow 270 // Called when the underlying connection becomes writable to allow
270 // queued writes to happen. Returns false if the socket has become blocked. 271 // queued writes to happen. Returns false if the socket has become blocked.
271 virtual bool OnCanWrite() OVERRIDE; 272 virtual bool OnCanWrite() OVERRIDE;
272 273
273 // Do any work which logically would be done in OnPacket but can not be 274 // Do any work which logically would be done in OnPacket but can not be
274 // safely done until the packet is validated. Returns true if the packet 275 // safely done until the packet is validated. Returns true if the packet
275 // can be handled, false otherwise. 276 // can be handled, false otherwise.
276 bool ProcessValidatedPacket(); 277 bool ProcessValidatedPacket();
277 278
278 // The version of the protocol this connection is using. 279 // The version of the protocol this connection is using.
279 QuicTag version() const { return framer_.version(); } 280 QuicVersion version() const { return framer_.version(); }
280 281
281 // From QuicFramerVisitorInterface 282 // From QuicFramerVisitorInterface
282 virtual void OnError(QuicFramer* framer) OVERRIDE; 283 virtual void OnError(QuicFramer* framer) OVERRIDE;
283 virtual bool OnProtocolVersionMismatch(QuicTag received_version) OVERRIDE; 284 virtual bool OnProtocolVersionMismatch(QuicVersion received_version) OVERRIDE;
284 virtual void OnPacket() OVERRIDE; 285 virtual void OnPacket() OVERRIDE;
285 virtual void OnPublicResetPacket( 286 virtual void OnPublicResetPacket(
286 const QuicPublicResetPacket& packet) OVERRIDE; 287 const QuicPublicResetPacket& packet) OVERRIDE;
287 virtual void OnVersionNegotiationPacket( 288 virtual void OnVersionNegotiationPacket(
288 const QuicVersionNegotiationPacket& packet) OVERRIDE; 289 const QuicVersionNegotiationPacket& packet) OVERRIDE;
289 virtual void OnRevivedPacket() OVERRIDE; 290 virtual void OnRevivedPacket() OVERRIDE;
290 virtual bool OnPacketHeader(const QuicPacketHeader& header) OVERRIDE; 291 virtual bool OnPacketHeader(const QuicPacketHeader& header) OVERRIDE;
291 virtual void OnFecProtectedPayload(base::StringPiece payload) OVERRIDE; 292 virtual void OnFecProtectedPayload(base::StringPiece payload) OVERRIDE;
292 virtual bool OnStreamFrame(const QuicStreamFrame& frame) OVERRIDE; 293 virtual bool OnStreamFrame(const QuicStreamFrame& frame) OVERRIDE;
293 virtual bool OnAckFrame(const QuicAckFrame& frame) OVERRIDE; 294 virtual bool OnAckFrame(const QuicAckFrame& frame) OVERRIDE;
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
441 int WritePacketToWire(QuicPacketSequenceNumber sequence_number, 442 int WritePacketToWire(QuicPacketSequenceNumber sequence_number,
442 EncryptionLevel level, 443 EncryptionLevel level,
443 const QuicEncryptedPacket& packet, 444 const QuicEncryptedPacket& packet,
444 int* error); 445 int* error);
445 446
446 // Make sure an ack we got from our peer is sane. 447 // Make sure an ack we got from our peer is sane.
447 bool ValidateAckFrame(const QuicAckFrame& incoming_ack); 448 bool ValidateAckFrame(const QuicAckFrame& incoming_ack);
448 449
449 QuicConnectionHelperInterface* helper() { return helper_.get(); } 450 QuicConnectionHelperInterface* helper() { return helper_.get(); }
450 451
451 protected: 452 // Selects and updates the version of the protocol being used by selecting a
453 // version from |available_versions| which is also supported. Returns true if
454 // such a version exists, false otherwise.
455 bool SelectMutualVersion(const QuicVersionVector& available_versions);
456
452 QuicFramer framer_; 457 QuicFramer framer_;
453 458
454 private: 459 private:
455 friend class test::QuicConnectionPeer; 460 friend class test::QuicConnectionPeer;
456 461
457 // Packets which have not been written to the wire. 462 // Packets which have not been written to the wire.
458 // Owns the QuicPacket* packet. 463 // Owns the QuicPacket* packet.
459 struct QueuedPacket { 464 struct QueuedPacket {
460 QueuedPacket(QuicPacketSequenceNumber sequence_number, 465 QueuedPacket(QuicPacketSequenceNumber sequence_number,
461 QuicPacket* packet, 466 QuicPacket* packet,
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
512 typedef linked_hash_map<QuicPacketSequenceNumber, 517 typedef linked_hash_map<QuicPacketSequenceNumber,
513 RetransmittableFrames*> UnackedPacketMap; 518 RetransmittableFrames*> UnackedPacketMap;
514 typedef std::map<QuicFecGroupNumber, QuicFecGroup*> FecGroupMap; 519 typedef std::map<QuicFecGroupNumber, QuicFecGroup*> FecGroupMap;
515 typedef base::hash_map<QuicPacketSequenceNumber, 520 typedef base::hash_map<QuicPacketSequenceNumber,
516 RetransmissionInfo> RetransmissionMap; 521 RetransmissionInfo> RetransmissionMap;
517 typedef std::priority_queue<RetransmissionTime, 522 typedef std::priority_queue<RetransmissionTime,
518 std::vector<RetransmissionTime>, 523 std::vector<RetransmissionTime>,
519 RetransmissionTimeComparator> 524 RetransmissionTimeComparator>
520 RetransmissionTimeouts; 525 RetransmissionTimeouts;
521 526
522 // Selects and updates the version of the protocol being used by selecting a
523 // version from |available_versions| which is also supported. Returns true if
524 // such a version exists, false otherwise.
525 bool SelectMutualVersion(const QuicTagVector& available_versions);
526 // Sends a version negotiation packet to the peer. 527 // Sends a version negotiation packet to the peer.
527 void SendVersionNegotiationPacket(); 528 void SendVersionNegotiationPacket();
528 529
529 void SetupRetransmission(QuicPacketSequenceNumber sequence_number, 530 void SetupRetransmission(QuicPacketSequenceNumber sequence_number,
530 EncryptionLevel level); 531 EncryptionLevel level);
531 bool IsRetransmission(QuicPacketSequenceNumber sequence_number); 532 bool IsRetransmission(QuicPacketSequenceNumber sequence_number);
532 533
533 void SetupAbandonFecTimer(QuicPacketSequenceNumber sequence_number); 534 void SetupAbandonFecTimer(QuicPacketSequenceNumber sequence_number);
534 535
535 // Drop packet corresponding to |sequence_number| by deleting entries from 536 // Drop packet corresponding to |sequence_number| by deleting entries from
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
702 // Set to true if the udp packet headers have a new self or peer address. 703 // Set to true if the udp packet headers have a new self or peer address.
703 // This is checked later on validating a data or version negotiation packet. 704 // This is checked later on validating a data or version negotiation packet.
704 bool address_migrating_; 705 bool address_migrating_;
705 706
706 DISALLOW_COPY_AND_ASSIGN(QuicConnection); 707 DISALLOW_COPY_AND_ASSIGN(QuicConnection);
707 }; 708 };
708 709
709 } // namespace net 710 } // namespace net
710 711
711 #endif // NET_QUIC_QUIC_CONNECTION_H_ 712 #endif // NET_QUIC_QUIC_CONNECTION_H_
OLDNEW
« no previous file with comments | « no previous file | net/quic/quic_connection.cc » ('j') | net/quic/quic_connection_test.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698