| 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 #include "net/quic/quic_protocol.h" | 5 #include "net/quic/quic_protocol.h" |
| 6 | 6 |
| 7 #include "base/stl_util.h" | 7 #include "base/stl_util.h" |
| 8 #include "net/quic/quic_flags.h" | 8 #include "net/quic/quic_flags.h" |
| 9 #include "net/quic/quic_utils.h" | 9 #include "net/quic/quic_utils.h" |
| 10 | 10 |
| (...skipping 679 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 690 packet_number_length_)); | 690 packet_number_length_)); |
| 691 } | 691 } |
| 692 | 692 |
| 693 StringPiece QuicPacket::Plaintext() const { | 693 StringPiece QuicPacket::Plaintext() const { |
| 694 const size_t start_of_encrypted_data = GetStartOfEncryptedData( | 694 const size_t start_of_encrypted_data = GetStartOfEncryptedData( |
| 695 connection_id_length_, includes_version_, packet_number_length_); | 695 connection_id_length_, includes_version_, packet_number_length_); |
| 696 return StringPiece(data() + start_of_encrypted_data, | 696 return StringPiece(data() + start_of_encrypted_data, |
| 697 length() - start_of_encrypted_data); | 697 length() - start_of_encrypted_data); |
| 698 } | 698 } |
| 699 | 699 |
| 700 RetransmittableFrames::RetransmittableFrames(EncryptionLevel level) | 700 RetransmittableFrames::RetransmittableFrames() |
| 701 : encryption_level_(level), | 701 : has_crypto_handshake_(NOT_HANDSHAKE), needs_padding_(false) { |
| 702 has_crypto_handshake_(NOT_HANDSHAKE), | |
| 703 needs_padding_(false) { | |
| 704 // TODO(ianswett): Consider using an inlined vector instead, since this | 702 // TODO(ianswett): Consider using an inlined vector instead, since this |
| 705 // is very frequently a single frame. | 703 // is very frequently a single frame. |
| 706 frames_.reserve(2); | 704 frames_.reserve(2); |
| 707 } | 705 } |
| 708 | 706 |
| 709 RetransmittableFrames::~RetransmittableFrames() { | 707 RetransmittableFrames::~RetransmittableFrames() { |
| 710 for (QuicFrame& frame : frames_) { | 708 for (QuicFrame& frame : frames_) { |
| 711 switch (frame.type) { | 709 switch (frame.type) { |
| 712 // Frames smaller than a pointer are inlined, so don't need to be deleted. | 710 // Frames smaller than a pointer are inlined, so don't need to be deleted. |
| 713 case PADDING_FRAME: | 711 case PADDING_FRAME: |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 837 return new QuicEncryptedPacket(buffer, this->length(), true); | 835 return new QuicEncryptedPacket(buffer, this->length(), true); |
| 838 } | 836 } |
| 839 | 837 |
| 840 ostream& operator<<(ostream& os, const QuicEncryptedPacket& s) { | 838 ostream& operator<<(ostream& os, const QuicEncryptedPacket& s) { |
| 841 os << s.length() << "-byte data"; | 839 os << s.length() << "-byte data"; |
| 842 return os; | 840 return os; |
| 843 } | 841 } |
| 844 | 842 |
| 845 TransmissionInfo::TransmissionInfo() | 843 TransmissionInfo::TransmissionInfo() |
| 846 : retransmittable_frames(nullptr), | 844 : retransmittable_frames(nullptr), |
| 845 encryption_level(ENCRYPTION_NONE), |
| 847 packet_number_length(PACKET_1BYTE_PACKET_NUMBER), | 846 packet_number_length(PACKET_1BYTE_PACKET_NUMBER), |
| 848 bytes_sent(0), | 847 bytes_sent(0), |
| 849 nack_count(0), | 848 nack_count(0), |
| 850 sent_time(QuicTime::Zero()), | 849 sent_time(QuicTime::Zero()), |
| 851 transmission_type(NOT_RETRANSMISSION), | 850 transmission_type(NOT_RETRANSMISSION), |
| 852 in_flight(false), | 851 in_flight(false), |
| 853 is_unackable(false), | 852 is_unackable(false), |
| 854 is_fec_packet(false), | 853 is_fec_packet(false), |
| 855 all_transmissions(nullptr), | 854 all_transmissions(nullptr), |
| 856 retransmission(0) {} | 855 retransmission(0) {} |
| 857 | 856 |
| 858 TransmissionInfo::TransmissionInfo( | 857 TransmissionInfo::TransmissionInfo( |
| 859 RetransmittableFrames* retransmittable_frames, | 858 RetransmittableFrames* retransmittable_frames, |
| 859 EncryptionLevel level, |
| 860 QuicPacketNumberLength packet_number_length, | 860 QuicPacketNumberLength packet_number_length, |
| 861 TransmissionType transmission_type, | 861 TransmissionType transmission_type, |
| 862 QuicTime sent_time, | 862 QuicTime sent_time, |
| 863 QuicPacketLength bytes_sent, | 863 QuicPacketLength bytes_sent, |
| 864 bool is_fec_packet) | 864 bool is_fec_packet) |
| 865 : retransmittable_frames(retransmittable_frames), | 865 : retransmittable_frames(retransmittable_frames), |
| 866 encryption_level(level), |
| 866 packet_number_length(packet_number_length), | 867 packet_number_length(packet_number_length), |
| 867 bytes_sent(bytes_sent), | 868 bytes_sent(bytes_sent), |
| 868 nack_count(0), | 869 nack_count(0), |
| 869 sent_time(sent_time), | 870 sent_time(sent_time), |
| 870 transmission_type(transmission_type), | 871 transmission_type(transmission_type), |
| 871 in_flight(false), | 872 in_flight(false), |
| 872 is_unackable(false), | 873 is_unackable(false), |
| 873 is_fec_packet(is_fec_packet), | 874 is_fec_packet(is_fec_packet), |
| 874 all_transmissions(nullptr), | 875 all_transmissions(nullptr), |
| 875 retransmission(0) {} | 876 retransmission(0) {} |
| 876 | 877 |
| 877 TransmissionInfo::~TransmissionInfo() {} | 878 TransmissionInfo::~TransmissionInfo() {} |
| 878 | 879 |
| 879 } // namespace net | 880 } // namespace net |
| OLD | NEW |