| Index: net/quic/quic_packet_creator.h
|
| diff --git a/net/quic/quic_packet_creator.h b/net/quic/quic_packet_creator.h
|
| index b5eb9b85da3b4f2f272eef8287588f9dcceda3e8..23301ec53391794930c6f6cc40142ecc1a843d73 100644
|
| --- a/net/quic/quic_packet_creator.h
|
| +++ b/net/quic/quic_packet_creator.h
|
| @@ -20,10 +20,10 @@
|
|
|
| namespace net {
|
|
|
| +class QuicRandom;
|
| +
|
| class NET_EXPORT_PRIVATE QuicPacketCreator : public QuicFecBuilderInterface {
|
| public:
|
| - typedef std::pair<QuicPacketSequenceNumber, QuicPacket*> PacketPair;
|
| -
|
| // Options for controlling how packets are created.
|
| struct Options {
|
| Options()
|
| @@ -38,7 +38,10 @@ class NET_EXPORT_PRIVATE QuicPacketCreator : public QuicFecBuilderInterface {
|
| size_t max_packets_per_fec_group;
|
| };
|
|
|
| - QuicPacketCreator(QuicGuid guid, QuicFramer* framer);
|
| + // QuicRandom* required for packet entropy.
|
| + QuicPacketCreator(QuicGuid guid,
|
| + QuicFramer* framer,
|
| + QuicRandom* random_generator);
|
|
|
| virtual ~QuicPacketCreator();
|
|
|
| @@ -54,6 +57,8 @@ class NET_EXPORT_PRIVATE QuicPacketCreator : public QuicFecBuilderInterface {
|
| // and there is not already an FEC group open.
|
| void MaybeStartFEC();
|
|
|
| + bool HasRoomForStreamFrame() const;
|
| +
|
| // Converts a raw payload to a frame which fits into the currently open
|
| // packet if there is one. Returns the number of bytes consumed from data.
|
| // If data is empty and fin is true, the expected behavior is to consume the
|
| @@ -64,30 +69,41 @@ class NET_EXPORT_PRIVATE QuicPacketCreator : public QuicFecBuilderInterface {
|
| bool fin,
|
| QuicFrame* frame);
|
|
|
| - // Serializes all frames into a single packet. All frames must fit into a
|
| - // single packet.
|
| - PacketPair SerializeAllFrames(const QuicFrames& frames);
|
| + // Serializes all frames into a single packet. All frames must fit into a
|
| + // single packet. Also, sets the entropy hash of the serialized packet to a
|
| + // random bool and returns that value as a member of SerializedPacket.
|
| + // Never returns an RetransmittableFrames in SerializedPacket
|
| + SerializedPacket SerializeAllFrames(const QuicFrames& frames);
|
|
|
| // Returns true if there are frames pending to be serialized.
|
| bool HasPendingFrames();
|
|
|
| // Returns the number of bytes which are free to frames in the current packet.
|
| - size_t BytesFree();
|
| + size_t BytesFree() const;
|
|
|
| // Adds |frame| to the packet creator's list of frames to be serialized.
|
| // Returns false if the frame doesn't fit into the current packet.
|
| - bool AddFrame(const QuicFrame& frame);
|
| + bool AddSavedFrame(const QuicFrame& frame);
|
|
|
| // Serializes all frames which have been added and adds any which should be
|
| - // retransmitted to |retransmittable_frames| if it's not NULL.
|
| - PacketPair SerializePacket(QuicFrames* retransmittable_frames);
|
| -
|
| - // Packetize FEC data.
|
| - PacketPair SerializeFec();
|
| + // retransmitted to |retransmittable_frames| if it's not NULL. All frames must
|
| + // fit into a single packet. Sets the entropy hash of the serialized
|
| + // packet to a random bool and returns that value as a member of
|
| + // SerializedPacket. Also, sets |serialized_frames| in the SerializedPacket
|
| + // to the corresponding RetransmittableFrames if any frames are to be
|
| + // retransmitted.
|
| + SerializedPacket SerializePacket();
|
| +
|
| + // Packetize FEC data. All frames must fit into a single packet. Also, sets
|
| + // the entropy hash of the serialized packet to a random bool and returns
|
| + // that value as a member of SerializedPacket.
|
| + SerializedPacket SerializeFec();
|
|
|
| // Creates a packet with connection close frame. Caller owns the created
|
| - // packet.
|
| - PacketPair CloseConnection(QuicConnectionCloseFrame* close_frame);
|
| + // packet. Also, sets the entropy hash of the serialized packet to a random
|
| + // bool and returns that value as a member of SerializedPacket.
|
| + SerializedPacket SerializeConnectionClose(
|
| + QuicConnectionCloseFrame* close_frame);
|
|
|
| QuicPacketSequenceNumber sequence_number() const {
|
| return sequence_number_;
|
| @@ -105,17 +121,24 @@ class NET_EXPORT_PRIVATE QuicPacketCreator : public QuicFecBuilderInterface {
|
| static bool ShouldRetransmit(const QuicFrame& frame);
|
|
|
| void FillPacketHeader(QuicFecGroupNumber fec_group,
|
| - QuicPacketPrivateFlags flags,
|
| + bool fec_flag,
|
| + bool fec_entropy_flag,
|
| QuicPacketHeader* header);
|
|
|
| + // Allows a frame to be added without creating retransmittable frames.
|
| + // Particularly useful for retransmits using SerializeAllFrames().
|
| + bool AddFrame(const QuicFrame& frame, bool save_retransmittable_frames);
|
| +
|
| Options options_;
|
| QuicGuid guid_;
|
| QuicFramer* framer_;
|
| + QuicRandom* random_generator_;
|
| QuicPacketSequenceNumber sequence_number_;
|
| QuicFecGroupNumber fec_group_number_;
|
| scoped_ptr<QuicFecGroup> fec_group_;
|
| size_t packet_size_;
|
| QuicFrames queued_frames_;
|
| + scoped_ptr<RetransmittableFrames> queued_retransmittable_frames_;
|
| };
|
|
|
| } // namespace net
|
|
|