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

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

Issue 11958018: Queueing QUIC frames to be resent instead of packets and packing RST frames with acks and congestio… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 11 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
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 // Some helpers for quic packet creation. 5 // Some helpers for quic packet creation.
6 6
7 #ifndef NET_QUIC_QUIC_PACKET_CREATOR_H_ 7 #ifndef NET_QUIC_QUIC_PACKET_CREATOR_H_
8 #define NET_QUIC_QUIC_PACKET_CREATOR_H_ 8 #define NET_QUIC_QUIC_PACKET_CREATOR_H_
9 9
10 #include <utility> 10 #include <utility>
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 QuicPacketCreator(QuicGuid guid, QuicFramer* framer); 45 QuicPacketCreator(QuicGuid guid, QuicFramer* framer);
46 46
47 virtual ~QuicPacketCreator(); 47 virtual ~QuicPacketCreator();
48 48
49 // QuicFecBuilderInterface 49 // QuicFecBuilderInterface
50 virtual void OnBuiltFecProtectedPayload(const QuicPacketHeader& header, 50 virtual void OnBuiltFecProtectedPayload(const QuicPacketHeader& header,
51 base::StringPiece payload) OVERRIDE; 51 base::StringPiece payload) OVERRIDE;
52 52
53 typedef std::pair<QuicPacketSequenceNumber, QuicPacket*> PacketPair; 53 typedef std::pair<QuicPacketSequenceNumber, QuicPacket*> PacketPair;
54 54
55 // Serializes all frames into a single packet. All frames must fit into a
56 // single packet.
57 PacketPair SerializeAllFrames(const QuicFrames& frames);
58
55 // Serializes as many non-fec frames as can fit into a single packet. 59 // Serializes as many non-fec frames as can fit into a single packet.
56 // num_serialized is set to the number of frames serialized into the packet. 60 // num_serialized is set to the number of frames serialized into the packet.
57 PacketPair SerializeFrames(const QuicFrames& frames, size_t* num_serialized); 61 PacketPair SerializeFrames(const QuicFrames& frames, size_t* num_serialized);
58 62
59 // Converts a raw payload to a series of QuicPackets. Returns the number of 63 // Converts a raw payload to a series of QuicPackets and matching frames in
60 // bytes consumed from data. 64 // those packets. Returns the number of bytes consumed from data.
61 // If data is empty and fin is true, the expected behavior is to consume the 65 // If data is empty and fin is true, the expected behavior is to consume the
62 // fin but return 0. 66 // fin but return 0.
63 size_t DataToStream(QuicStreamId id, 67 size_t DataToStream(QuicStreamId id,
64 base::StringPiece data, 68 base::StringPiece data,
65 QuicStreamOffset offset, 69 QuicStreamOffset offset,
66 bool fin, 70 bool fin,
67 std::vector<PacketPair>* packets); 71 std::vector<PacketPair>* packets,
68 72 QuicFrames* packetized_frames);
69 PacketPair ResetStream(QuicStreamId id,
70 QuicStreamOffset offset,
71 QuicErrorCode error);
72 73
73 PacketPair CloseConnection(QuicConnectionCloseFrame* close_frame); 74 PacketPair CloseConnection(QuicConnectionCloseFrame* close_frame);
74 75
75 // Increments the current sequence number in QuicPacketCreator and sets it
76 // into the packet and returns the new sequence number.
77 QuicPacketSequenceNumber SetNewSequenceNumber(QuicPacket* packet);
78
79 QuicPacketSequenceNumber sequence_number() const { 76 QuicPacketSequenceNumber sequence_number() const {
80 return sequence_number_; 77 return sequence_number_;
81 } 78 }
82 79
83 void set_sequence_number(QuicPacketSequenceNumber s) { 80 void set_sequence_number(QuicPacketSequenceNumber s) {
84 sequence_number_ = s; 81 sequence_number_ = s;
85 } 82 }
86 83
87 Options* options() { 84 Options* options() {
88 return &options_; 85 return &options_;
89 } 86 }
90 87
91 private: 88 private:
92 void FillPacketHeader(QuicFecGroupNumber fec_group, 89 void FillPacketHeader(QuicFecGroupNumber fec_group,
93 QuicPacketFlags flags, 90 QuicPacketFlags flags,
94 QuicPacketHeader* header); 91 QuicPacketHeader* header);
95 92
96 Options options_; 93 Options options_;
97 QuicGuid guid_; 94 QuicGuid guid_;
98 QuicFramer* framer_; 95 QuicFramer* framer_;
99 QuicPacketSequenceNumber sequence_number_; 96 QuicPacketSequenceNumber sequence_number_;
100 QuicFecGroupNumber fec_group_number_; 97 QuicFecGroupNumber fec_group_number_;
101 scoped_ptr<QuicFecGroup> fec_group_; 98 scoped_ptr<QuicFecGroup> fec_group_;
102 99
103 }; 100 };
104 101
105 } // namespace net 102 } // namespace net
106 103
107 #endif // NET_QUIC_QUIC_PACKET_CREATOR_H_ 104 #endif // NET_QUIC_QUIC_PACKET_CREATOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698