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_connection.h" | 5 #include "net/quic/quic_connection.h" |
6 | 6 |
7 #include <ostream> | 7 #include <ostream> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
(...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
458 HasRetransmittableData retransmittable, | 458 HasRetransmittableData retransmittable, |
459 bool has_ack, | 459 bool has_ack, |
460 bool has_pending_frames) { | 460 bool has_pending_frames) { |
461 char buffer[kMaxPacketSize]; | 461 char buffer[kMaxPacketSize]; |
462 size_t encrypted_length = | 462 size_t encrypted_length = |
463 QuicConnectionPeer::GetFramer(this)->EncryptPayload( | 463 QuicConnectionPeer::GetFramer(this)->EncryptPayload( |
464 ENCRYPTION_NONE, path_id, packet_number, *packet, buffer, | 464 ENCRYPTION_NONE, path_id, packet_number, *packet, buffer, |
465 kMaxPacketSize); | 465 kMaxPacketSize); |
466 delete packet; | 466 delete packet; |
467 SerializedPacket serialized_packet( | 467 SerializedPacket serialized_packet( |
468 kDefaultPathId, packet_number, PACKET_6BYTE_PACKET_NUMBER, | 468 kDefaultPathId, packet_number, PACKET_6BYTE_PACKET_NUMBER, buffer, |
469 new QuicEncryptedPacket(buffer, encrypted_length, false), entropy_hash, | 469 encrypted_length, entropy_hash, has_ack, has_pending_frames); |
470 has_ack, has_pending_frames); | |
471 if (retransmittable == HAS_RETRANSMITTABLE_DATA) { | 470 if (retransmittable == HAS_RETRANSMITTABLE_DATA) { |
472 serialized_packet.retransmittable_frames.push_back( | 471 serialized_packet.retransmittable_frames.push_back( |
473 QuicFrame(new QuicStreamFrame())); | 472 QuicFrame(new QuicStreamFrame())); |
474 } | 473 } |
475 OnSerializedPacket(&serialized_packet); | 474 OnSerializedPacket(&serialized_packet); |
476 } | 475 } |
477 | 476 |
478 QuicConsumedData SendStreamDataWithString( | 477 QuicConsumedData SendStreamDataWithString( |
479 QuicStreamId id, | 478 QuicStreamId id, |
480 StringPiece data, | 479 StringPiece data, |
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
766 QuicPacketEntropyHash ProcessFramePacket(QuicFrame frame) { | 765 QuicPacketEntropyHash ProcessFramePacket(QuicFrame frame) { |
767 QuicFrames frames; | 766 QuicFrames frames; |
768 frames.push_back(QuicFrame(frame)); | 767 frames.push_back(QuicFrame(frame)); |
769 QuicPacketCreatorPeer::SetSendVersionInPacket( | 768 QuicPacketCreatorPeer::SetSendVersionInPacket( |
770 &peer_creator_, connection_.perspective() == Perspective::IS_SERVER); | 769 &peer_creator_, connection_.perspective() == Perspective::IS_SERVER); |
771 | 770 |
772 char buffer[kMaxPacketSize]; | 771 char buffer[kMaxPacketSize]; |
773 SerializedPacket serialized_packet = | 772 SerializedPacket serialized_packet = |
774 QuicPacketCreatorPeer::SerializeAllFrames(&peer_creator_, frames, | 773 QuicPacketCreatorPeer::SerializeAllFrames(&peer_creator_, frames, |
775 buffer, kMaxPacketSize); | 774 buffer, kMaxPacketSize); |
776 scoped_ptr<QuicEncryptedPacket> encrypted(serialized_packet.packet); | 775 connection_.ProcessUdpPacket( |
777 connection_.ProcessUdpPacket(kSelfAddress, kPeerAddress, *encrypted); | 776 kSelfAddress, kPeerAddress, |
| 777 QuicEncryptedPacket(serialized_packet.encrypted_buffer, |
| 778 serialized_packet.encrypted_length)); |
778 return serialized_packet.entropy_hash; | 779 return serialized_packet.entropy_hash; |
779 } | 780 } |
780 | 781 |
781 QuicPacketEntropyHash ProcessFramePacketAtLevel(QuicPathId path_id, | 782 QuicPacketEntropyHash ProcessFramePacketAtLevel(QuicPathId path_id, |
782 QuicPacketNumber number, | 783 QuicPacketNumber number, |
783 QuicFrame frame, | 784 QuicFrame frame, |
784 EncryptionLevel level) { | 785 EncryptionLevel level) { |
785 QuicPacketHeader header; | 786 QuicPacketHeader header; |
786 header.public_header.connection_id = connection_id_; | 787 header.public_header.connection_id = connection_id_; |
787 header.public_header.packet_number_length = packet_number_length_; | 788 header.public_header.packet_number_length = packet_number_length_; |
(...skipping 4717 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5505 QuicStreamFrame stream_frame(1u, false, 0u, StringPiece()); | 5506 QuicStreamFrame stream_frame(1u, false, 0u, StringPiece()); |
5506 EXPECT_DFATAL(ProcessFramePacket(QuicFrame(&stream_frame)), | 5507 EXPECT_DFATAL(ProcessFramePacket(QuicFrame(&stream_frame)), |
5507 "Received a packet with multipath flag on when multipath is " | 5508 "Received a packet with multipath flag on when multipath is " |
5508 "not enabled."); | 5509 "not enabled."); |
5509 EXPECT_FALSE(connection_.connected()); | 5510 EXPECT_FALSE(connection_.connected()); |
5510 } | 5511 } |
5511 | 5512 |
5512 } // namespace | 5513 } // namespace |
5513 } // namespace test | 5514 } // namespace test |
5514 } // namespace net | 5515 } // namespace net |
OLD | NEW |