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

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

Issue 180723003: Land Recent QUIC Changes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix unintialized memory error Created 6 years, 9 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 | « net/quic/congestion_control/tcp_loss_algorithm_test.cc ('k') | net/quic/quic_connection.cc » ('j') | no next file with comments »
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 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 // Called when a StreamFrame has been parsed. 141 // Called when a StreamFrame has been parsed.
142 virtual void OnStreamFrame(const QuicStreamFrame& frame) = 0; 142 virtual void OnStreamFrame(const QuicStreamFrame& frame) = 0;
143 143
144 // Called when a AckFrame has been parsed. 144 // Called when a AckFrame has been parsed.
145 virtual void OnAckFrame(const QuicAckFrame& frame) = 0; 145 virtual void OnAckFrame(const QuicAckFrame& frame) = 0;
146 146
147 // Called when a CongestionFeedbackFrame has been parsed. 147 // Called when a CongestionFeedbackFrame has been parsed.
148 virtual void OnCongestionFeedbackFrame( 148 virtual void OnCongestionFeedbackFrame(
149 const QuicCongestionFeedbackFrame& frame) = 0; 149 const QuicCongestionFeedbackFrame& frame) = 0;
150 150
151 // Called when a StopWaitingFrame has been parsed.
152 virtual void OnStopWaitingFrame(const QuicStopWaitingFrame& frame) = 0;
153
151 // Called when a RstStreamFrame has been parsed. 154 // Called when a RstStreamFrame has been parsed.
152 virtual void OnRstStreamFrame(const QuicRstStreamFrame& frame) = 0; 155 virtual void OnRstStreamFrame(const QuicRstStreamFrame& frame) = 0;
153 156
154 // Called when a ConnectionCloseFrame has been parsed. 157 // Called when a ConnectionCloseFrame has been parsed.
155 virtual void OnConnectionCloseFrame( 158 virtual void OnConnectionCloseFrame(
156 const QuicConnectionCloseFrame& frame) = 0; 159 const QuicConnectionCloseFrame& frame) = 0;
157 160
158 // Called when a public reset packet has been received. 161 // Called when a public reset packet has been received.
159 virtual void OnPublicResetPacket(const QuicPublicResetPacket& packet) = 0; 162 virtual void OnPublicResetPacket(const QuicPublicResetPacket& packet) = 0;
160 163
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 virtual void OnRevivedPacket() OVERRIDE; 298 virtual void OnRevivedPacket() OVERRIDE;
296 virtual bool OnUnauthenticatedPublicHeader( 299 virtual bool OnUnauthenticatedPublicHeader(
297 const QuicPacketPublicHeader& header) OVERRIDE; 300 const QuicPacketPublicHeader& header) OVERRIDE;
298 virtual bool OnUnauthenticatedHeader(const QuicPacketHeader& header) OVERRIDE; 301 virtual bool OnUnauthenticatedHeader(const QuicPacketHeader& header) OVERRIDE;
299 virtual bool OnPacketHeader(const QuicPacketHeader& header) OVERRIDE; 302 virtual bool OnPacketHeader(const QuicPacketHeader& header) OVERRIDE;
300 virtual void OnFecProtectedPayload(base::StringPiece payload) OVERRIDE; 303 virtual void OnFecProtectedPayload(base::StringPiece payload) OVERRIDE;
301 virtual bool OnStreamFrame(const QuicStreamFrame& frame) OVERRIDE; 304 virtual bool OnStreamFrame(const QuicStreamFrame& frame) OVERRIDE;
302 virtual bool OnAckFrame(const QuicAckFrame& frame) OVERRIDE; 305 virtual bool OnAckFrame(const QuicAckFrame& frame) OVERRIDE;
303 virtual bool OnCongestionFeedbackFrame( 306 virtual bool OnCongestionFeedbackFrame(
304 const QuicCongestionFeedbackFrame& frame) OVERRIDE; 307 const QuicCongestionFeedbackFrame& frame) OVERRIDE;
308 virtual bool OnStopWaitingFrame(const QuicStopWaitingFrame& frame) OVERRIDE;
305 virtual bool OnRstStreamFrame(const QuicRstStreamFrame& frame) OVERRIDE; 309 virtual bool OnRstStreamFrame(const QuicRstStreamFrame& frame) OVERRIDE;
306 virtual bool OnConnectionCloseFrame( 310 virtual bool OnConnectionCloseFrame(
307 const QuicConnectionCloseFrame& frame) OVERRIDE; 311 const QuicConnectionCloseFrame& frame) OVERRIDE;
308 virtual bool OnGoAwayFrame(const QuicGoAwayFrame& frame) OVERRIDE; 312 virtual bool OnGoAwayFrame(const QuicGoAwayFrame& frame) OVERRIDE;
309 virtual bool OnWindowUpdateFrame(const QuicWindowUpdateFrame& frame) OVERRIDE; 313 virtual bool OnWindowUpdateFrame(const QuicWindowUpdateFrame& frame) OVERRIDE;
310 virtual bool OnBlockedFrame(const QuicBlockedFrame& frame) OVERRIDE; 314 virtual bool OnBlockedFrame(const QuicBlockedFrame& frame) OVERRIDE;
311 virtual void OnFecData(const QuicFecData& fec) OVERRIDE; 315 virtual void OnFecData(const QuicFecData& fec) OVERRIDE;
312 virtual void OnPacketComplete() OVERRIDE; 316 virtual void OnPacketComplete() OVERRIDE;
313 317
314 // QuicPacketGenerator::DelegateInterface 318 // QuicPacketGenerator::DelegateInterface
315 virtual bool ShouldGeneratePacket(TransmissionType transmission_type, 319 virtual bool ShouldGeneratePacket(TransmissionType transmission_type,
316 HasRetransmittableData retransmittable, 320 HasRetransmittableData retransmittable,
317 IsHandshake handshake) OVERRIDE; 321 IsHandshake handshake) OVERRIDE;
318 virtual QuicAckFrame* CreateAckFrame() OVERRIDE; 322 virtual QuicAckFrame* CreateAckFrame() OVERRIDE;
319 virtual QuicCongestionFeedbackFrame* CreateFeedbackFrame() OVERRIDE; 323 virtual QuicCongestionFeedbackFrame* CreateFeedbackFrame() OVERRIDE;
324 virtual QuicStopWaitingFrame* CreateStopWaitingFrame() OVERRIDE;
320 virtual bool OnSerializedPacket(const SerializedPacket& packet) OVERRIDE; 325 virtual bool OnSerializedPacket(const SerializedPacket& packet) OVERRIDE;
321 326
322 // Accessors 327 // Accessors
323 void set_visitor(QuicConnectionVisitorInterface* visitor) { 328 void set_visitor(QuicConnectionVisitorInterface* visitor) {
324 visitor_ = visitor; 329 visitor_ = visitor;
325 } 330 }
326 void set_debug_visitor(QuicConnectionDebugVisitorInterface* debug_visitor) { 331 void set_debug_visitor(QuicConnectionDebugVisitorInterface* debug_visitor) {
327 debug_visitor_ = debug_visitor; 332 debug_visitor_ = debug_visitor;
328 packet_generator_.set_debug_delegate(debug_visitor); 333 packet_generator_.set_debug_delegate(debug_visitor);
329 } 334 }
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
418 const QuicDecrypter* decrypter() const; 423 const QuicDecrypter* decrypter() const;
419 const QuicDecrypter* alternative_decrypter() const; 424 const QuicDecrypter* alternative_decrypter() const;
420 425
421 bool is_server() const { return is_server_; } 426 bool is_server() const { return is_server_; }
422 427
423 // Returns the underlying sent packet manager. 428 // Returns the underlying sent packet manager.
424 const QuicSentPacketManager& sent_packet_manager() const { 429 const QuicSentPacketManager& sent_packet_manager() const {
425 return sent_packet_manager_; 430 return sent_packet_manager_;
426 } 431 }
427 432
433 // Make sure a stop waiting we got from our peer is sane.
434 bool ValidateStopWaitingFrame(const QuicStopWaitingFrame& stop_waiting);
435
428 bool CanWrite(TransmissionType transmission_type, 436 bool CanWrite(TransmissionType transmission_type,
429 HasRetransmittableData retransmittable, 437 HasRetransmittableData retransmittable,
430 IsHandshake handshake); 438 IsHandshake handshake);
431 439
432 protected: 440 protected:
433 // Send a packet to the peer using encryption |level|. If |sequence_number| 441 // Send a packet to the peer using encryption |level|. If |sequence_number|
434 // is present in the |retransmission_map_|, then contents of this packet will 442 // is present in the |retransmission_map_|, then contents of this packet will
435 // be retransmitted with a new sequence number if it's not acked by the peer. 443 // be retransmitted with a new sequence number if it's not acked by the peer.
436 // Deletes |packet| if WritePacket call succeeds, or transfers ownership to 444 // Deletes |packet| if WritePacket call succeeds, or transfers ownership to
437 // QueuedPacket, ultimately deleted in WriteQueuedPackets. Updates the 445 // QueuedPacket, ultimately deleted in WriteQueuedPackets. Updates the
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
542 550
543 // Attempts to process any queued undecryptable packets. 551 // Attempts to process any queued undecryptable packets.
544 void MaybeProcessUndecryptablePackets(); 552 void MaybeProcessUndecryptablePackets();
545 553
546 // If a packet can be revived from the current FEC group, then 554 // If a packet can be revived from the current FEC group, then
547 // revive and process the packet. 555 // revive and process the packet.
548 void MaybeProcessRevivedPacket(); 556 void MaybeProcessRevivedPacket();
549 557
550 void ProcessAckFrame(const QuicAckFrame& incoming_ack); 558 void ProcessAckFrame(const QuicAckFrame& incoming_ack);
551 559
552 // Update the |sent_info| for an outgoing ack. 560 void ProcessStopWaitingFrame(const QuicStopWaitingFrame& stop_waiting);
553 void UpdateSentPacketInfo(SentPacketInfo* sent_info); 561
562 // Update |stop_waiting| for an outgoing ack.
563 void UpdateStopWaiting(QuicStopWaitingFrame* stop_waiting);
554 564
555 // Queues an ack or sets the ack alarm when an incoming packet arrives that 565 // Queues an ack or sets the ack alarm when an incoming packet arrives that
556 // should be acked. 566 // should be acked.
557 void MaybeQueueAck(); 567 void MaybeQueueAck();
558 568
559 // Checks if the last packet should instigate an ack. 569 // Checks if the last packet should instigate an ack.
560 bool ShouldLastPacketInstigateAck() const; 570 bool ShouldLastPacketInstigateAck() const;
561 571
562 // Checks if the peer is waiting for packets that have been given up on, and 572 // Checks if the peer is waiting for packets that have been given up on, and
563 // therefore an ack frame should be sent with a larger least_unacked. 573 // therefore an ack frame should be sent with a larger least_unacked.
(...skipping 26 matching lines...) Expand all
590 // client. 600 // client.
591 IPEndPoint self_address_; 601 IPEndPoint self_address_;
592 IPEndPoint peer_address_; 602 IPEndPoint peer_address_;
593 603
594 bool last_packet_revived_; // True if the last packet was revived from FEC. 604 bool last_packet_revived_; // True if the last packet was revived from FEC.
595 size_t last_size_; // Size of the last received packet. 605 size_t last_size_; // Size of the last received packet.
596 QuicPacketHeader last_header_; 606 QuicPacketHeader last_header_;
597 std::vector<QuicStreamFrame> last_stream_frames_; 607 std::vector<QuicStreamFrame> last_stream_frames_;
598 std::vector<QuicAckFrame> last_ack_frames_; 608 std::vector<QuicAckFrame> last_ack_frames_;
599 std::vector<QuicCongestionFeedbackFrame> last_congestion_frames_; 609 std::vector<QuicCongestionFeedbackFrame> last_congestion_frames_;
610 std::vector<QuicStopWaitingFrame> last_stop_waiting_frames_;
600 std::vector<QuicRstStreamFrame> last_rst_frames_; 611 std::vector<QuicRstStreamFrame> last_rst_frames_;
601 std::vector<QuicGoAwayFrame> last_goaway_frames_; 612 std::vector<QuicGoAwayFrame> last_goaway_frames_;
602 std::vector<QuicWindowUpdateFrame> last_window_update_frames_; 613 std::vector<QuicWindowUpdateFrame> last_window_update_frames_;
603 std::vector<QuicBlockedFrame> last_blocked_frames_; 614 std::vector<QuicBlockedFrame> last_blocked_frames_;
604 std::vector<QuicConnectionCloseFrame> last_close_frames_; 615 std::vector<QuicConnectionCloseFrame> last_close_frames_;
605 616
606 QuicCongestionFeedbackFrame outgoing_congestion_feedback_; 617 QuicCongestionFeedbackFrame outgoing_congestion_feedback_;
607 618
608 // Track some peer state so we can do less bookkeeping 619 // Track some peer state so we can do less bookkeeping
609 // Largest sequence sent by the peer which had an ack frame (latest ack info). 620 // Largest sequence sent by the peer which had an ack frame (latest ack info).
610 QuicPacketSequenceNumber largest_seen_packet_with_ack_; 621 QuicPacketSequenceNumber largest_seen_packet_with_ack_;
611 622
623 // Largest sequence number sent by the peer which had a stop waiting frame.
624 QuicPacketSequenceNumber largest_seen_packet_with_stop_waiting_;
625
612 // Collection of packets which were received before encryption was 626 // Collection of packets which were received before encryption was
613 // established, but which could not be decrypted. We buffer these on 627 // established, but which could not be decrypted. We buffer these on
614 // the assumption that they could not be processed because they were 628 // the assumption that they could not be processed because they were
615 // sent with the INITIAL encryption and the CHLO message was lost. 629 // sent with the INITIAL encryption and the CHLO message was lost.
616 std::deque<QuicEncryptedPacket*> undecryptable_packets_; 630 std::deque<QuicEncryptedPacket*> undecryptable_packets_;
617 631
618 // When the version negotiation packet could not be sent because the socket 632 // When the version negotiation packet could not be sent because the socket
619 // was not writable, this is set to true. 633 // was not writable, this is set to true.
620 bool pending_version_negotiation_packet_; 634 bool pending_version_negotiation_packet_;
621 635
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
703 // If non-empty this contains the set of versions received in a 717 // If non-empty this contains the set of versions received in a
704 // version negotiation packet. 718 // version negotiation packet.
705 QuicVersionVector server_supported_versions_; 719 QuicVersionVector server_supported_versions_;
706 720
707 DISALLOW_COPY_AND_ASSIGN(QuicConnection); 721 DISALLOW_COPY_AND_ASSIGN(QuicConnection);
708 }; 722 };
709 723
710 } // namespace net 724 } // namespace net
711 725
712 #endif // NET_QUIC_QUIC_CONNECTION_H_ 726 #endif // NET_QUIC_QUIC_CONNECTION_H_
OLDNEW
« no previous file with comments | « net/quic/congestion_control/tcp_loss_algorithm_test.cc ('k') | net/quic/quic_connection.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698