summaryrefslogtreecommitdiffstats
path: root/net/quic/quic_packet_creator.h
diff options
context:
space:
mode:
authordanzh <danzh@chromium.org>2015-12-17 18:06:40 -0800
committerCommit bot <commit-bot@chromium.org>2015-12-18 02:08:15 +0000
commitb75513444e93402841273fe294473982e99c2ba8 (patch)
tree15778a8256eb1c09dd9944f4f371dac2735a8938 /net/quic/quic_packet_creator.h
parent0acd6f5020c864d6653d2050c6f72d803e8cff20 (diff)
downloadchromium_src-b75513444e93402841273fe294473982e99c2ba8.zip
chromium_src-b75513444e93402841273fe294473982e99c2ba8.tar.gz
chromium_src-b75513444e93402841273fe294473982e99c2ba8.tar.bz2
Landing Recent QUIC changes until 12/14/2015 21:22:02 UTC
*********************************************************** Except for: cl/110183490: Actually use RFC 7539 encrypters and decrypters in QUIC. Protected by --gfe2_reloadable_flag_quic_use_rfc7539. cl/110165324: Add new RFC 7539 variants of ChaCha20 Poly 1305 encrypters and decrypters to QUIC. n/a - not currently used *********************************************************** relnote: Adds a --body_hex flag to quic_client_bin to allow POST message body to be specified as a hex string, converted with a2b_hex before sending. e.g../quic_client_bin--body_hex="68656c6c6f2c20776f726c6421" This is helpful for gRPC-over-QUIC testing. n/a (toy quic client) Merge internal change: 110185550 https://codereview.chromium.org/1532113002/ relnote: Turn on the trailers support flag in the toy QUIC client. n/a (quic toy client) Merge internal change: 110183495 https://codereview.chromium.org/1531783002/ relnote: Set QuicPacketCreator's should_fec_protect_next_packet only within QuicPacketCreator. No functional change. Merge internal change: 110177994 https://codereview.chromium.org/1531603002/ relnote: Fix a bug protected by gfe_reloadable_flag_quic_respect_send_alarm where acks would not be sent immediately. Merge internal change: 110173060 https://codereview.chromium.org/1531543004/ relnote: Make QuicSpdyStream::WriteTrailers virtual for tests. No behavior change. Merge internal change: 110021608 https://codereview.chromium.org/1529953003/ relnote: Remove QuicPacketGenerator::OnSerializedPacket with functionality in QuicPacketCreator. No functional change. Merge internal change: 110015448 https://codereview.chromium.org/1525303003/ relnote: Rename QuicSpdyServerStream to QuicSimpleServerStream. No behavior change. Merge internal change: 110008813 https://codereview.chromium.org/1521993006/ relnote: Reduce size of body data sent in Trailers test. n/a (test only) Merge internal change: 109918216 https://codereview.chromium.org/1526993003/ relnote: Change QuicConnection::ValidateAckFrame's DLOG(ERROR) to LOG(WARNING) in order to understand why the acks are invalid. Merge internal change: 109916867 https://codereview.chromium.org/1530443004/ relnote: Cleanup: Put QUIC test-only MockRandom class in the gfe_quic::test namespace n/a (test only) Merge internal change: 109828260 https://codereview.chromium.org/1523333002/ relnote: Clarify comments in QuicSession related to ownership of streams. n/a (comment only) Merge internal change: 109790831 https://codereview.chromium.org/1527013002/ relnote: Remove needs_padding from QuicPacketCreator AddFrame. Non functional change. Merge internal change: 109748558 https://codereview.chromium.org/1529843002/ relnote: Deprecate --gfe_reloadable_flag_quic_packet_creator_prefetch. Merge internal change: 109634576 https://codereview.chromium.org/1526083002/ R=rch@chromium.org BUG= Review URL: https://codereview.chromium.org/1536703002 Cr-Commit-Position: refs/heads/master@{#365981}
Diffstat (limited to 'net/quic/quic_packet_creator.h')
-rw-r--r--net/quic/quic_packet_creator.h37
1 files changed, 21 insertions, 16 deletions
diff --git a/net/quic/quic_packet_creator.h b/net/quic/quic_packet_creator.h
index f06e55a..9d23338 100644
--- a/net/quic/quic_packet_creator.h
+++ b/net/quic/quic_packet_creator.h
@@ -38,8 +38,11 @@ class NET_EXPORT_PRIVATE QuicPacketCreator {
public:
virtual ~DelegateInterface() {}
// Called when a packet is serialized. Delegate does not take the ownership
- // of |serialized_packet|.
+ // of |serialized_packet|, but may take ownership of |packet.packet|
+ // and |packet.retransmittable_frames|. If it does so, they must be set
+ // to nullptr.
virtual void OnSerializedPacket(SerializedPacket* serialized_packet) = 0;
+ virtual void CloseConnection(QuicErrorCode error, bool from_peer) = 0;
// Called when current FEC group is reset (closed).
virtual void OnResetFecGroup() = 0;
};
@@ -177,6 +180,12 @@ class NET_EXPORT_PRIVATE QuicPacketCreator {
// Identical to AddSavedFrame, but allows the frame to be padded.
bool AddPaddedSavedFrame(const QuicFrame& frame);
+ // Adds |listener| to the next serialized packet and notifies the
+ // std::listener
+ // with |length| as the number of acked bytes.
+ void AddAckListener(QuicAckListenerInterface* listener,
+ QuicPacketLength length);
+
// Creates a version negotiation packet which supports |supported_versions|.
// Caller owns the created packet. Also, sets the entropy hash of the
// serialized packet to a random bool and returns that value as a member of
@@ -260,14 +269,6 @@ class NET_EXPORT_PRIVATE QuicPacketCreator {
rtt_multiplier_for_fec_timeout_ = rtt_multiplier_for_fec_timeout;
}
- bool should_fec_protect_next_packet() {
- return should_fec_protect_next_packet_;
- }
-
- void set_should_fec_protect_next_packet(bool should_fec_protect_next_packet) {
- should_fec_protect_next_packet_ = should_fec_protect_next_packet;
- }
-
void set_debug_delegate(DebugDelegate* debug_delegate) {
debug_delegate_ = debug_delegate;
}
@@ -311,13 +312,10 @@ class NET_EXPORT_PRIVATE QuicPacketCreator {
bool fec_flag,
QuicPacketHeader* header);
- // Allows a frame to be added without creating retransmittable frames.
- // Particularly useful for retransmits using SerializeAllFrames().
- // If current open packet cannot accommodate |frame|, returns false and
- // flushes all pending frames.
- bool AddFrame(const QuicFrame& frame,
- bool save_retransmittable_frames,
- bool needs_padding);
+ // Adds a |frame| if there is space and returns false and flushes all pending
+ // frames if there isn't room. If |save_retransmittable_frames| is true,
+ // saves the |frame| in the next SerializedPacket.
+ bool AddFrame(const QuicFrame& frame, bool save_retransmittable_frames);
// Adds a padding frame to the current packet only if the current packet
// contains a handshake message, and there is sufficient room to fit a
@@ -334,6 +332,10 @@ class NET_EXPORT_PRIVATE QuicPacketCreator {
// Fails if |buffer_len| isn't long enough for the encrypted packet.
SerializedPacket SerializePacket(char* encrypted_buffer, size_t buffer_len);
+ // Called after a new SerialiedPacket is created to call the delegate's
+ // OnSerializedPacket, reset state, and potentially flush FEC groups.
+ void OnSerializedPacket(SerializedPacket* packet);
+
// Turn on FEC protection for subsequent packets. If no FEC group is currently
// open, this method flushes current open packet and then turns FEC on.
void MaybeStartFecProtection();
@@ -412,6 +414,9 @@ class NET_EXPORT_PRIVATE QuicPacketCreator {
scoped_ptr<RetransmittableFrames> queued_retransmittable_frames_;
// If true, the packet will be padded up to |max_packet_length_|.
bool needs_padding_;
+ // Stores ack std::listeners that should be attached to the next packet.
+ std::list<AckListenerWrapper> ack_listeners_;
+
// FEC policy that specifies when to send FEC packet.
FecSendPolicy fec_send_policy_;
// Timeout used for FEC alarm. Can be set to zero initially or if the SRTT has