Add path_id to QuicAckFrame and QuicStopWaitingFrame structs (Wire format does not change yet).

The path_id in these two frames are needed to write multipath sent/received packet managers.

Merge internal change: 109409136
https://codereview.chromium.org/1521663002/

change the public construtor of QuicStreamFrame to not take const char*. Prevent crash on windows due to undeterministic argument evaluation order.

Merge internal change: 109333756
https://codereview.chromium.org/1515253002/

If a QUIC client sends an STK but no SCID, use the primary config to attempt to validate it. Protected by FLAGS_quic_validate_stk_without_scid

Re-landing cl/109238062 (plus flag protection) which was rolled back.

Merge internal change: 109330357
https://codereview.chromium.org/1519893002/

Make QuicPacketGenerator and QuicPacketCreator path-aware (not in use currently).

QuicPacketGenerator:
Add function SetCurrentPath.

QuicPacketCreator:
Add function SetCurrentPath.
Add current_path_ and multipath_packet_number_.

Merge internal change: 109319437
https://codereview.chromium.org/1512763014/

Pull out the QUIC trailing header key ":final-offset" into a string constant. No behavior change.

Merge internal change: 109296307
https://codereview.chromium.org/1518873003/

Add an end-to-end test to reproduce the QUIC TOO_MANY_REJECTS problem.

Merge internal change: 109246210
https://codereview.chromium.org/1518993002/

QUIC inchoate CHLOs may now include an SCID.

Merge internal change: 109238070
https://codereview.chromium.org/1514303002/

Change the memset in QuicWriteBlockList's constructor to be safer.  No functional change.

Suggested in https://codereview.chromium.org/1470713003/diff/100001/net/quic/quic_write_blocked_list.cc

Merge internal change: 109233513
https://codereview.chromium.org/1520613005/

Add a new set_chlo_multiplier() method to QuicCryptoServerConfig to change the amount of amplification attack protection is required. Only called in tests.

Merge internal change: 109228560
https://codereview.chromium.org/1513253004/

Refine QuicSession::HasOpenDynamicStreams() to use comparison. No behavior change.

Replace implicit int to bool conversion with comparison operation in QuicSession.

Merge internal change: 109226224
https://codereview.chromium.org/1519623003/

Add new methods to allow QuicServerSession to initiate a stream.

n/a(new unused method in QuicServerSession to prepare for Quic Server Push)

Merge internal change: 109209620
https://codereview.chromium.org/1517113002/

add 3 new fields in QuicSession which count incoming streams and are used in condition check while creating a new stream. Protected by FLAGS_quic_distinguish_incoming_outgoing_streams, on by default.

The three variables are:
num_dynamic_incoming_streams_;
num_draining_incoming_streams_;
num_locally_closed_incoming_streams_highest_offset_;

Merge internal change: 109194594
https://codereview.chromium.org/1504333011/

Add a test for receiving Headers, Body+FIN, Trailers in QuicSpdyStream.

n/a (test only)

Merge internal change: 109194547
https://codereview.chromium.org/1519463003/

Add HTTP/2 Trailers support to QuicSpdy{Server,Client}Stream. Protected behind existing FLAGS_quic_supports_trailers.

Merge internal change: 109193759
https://codereview.chromium.org/1518653002/

Add an unused WriteTrailers method to QuicSpdyStream. Protected behind existing FLAGS_quic_supports_trailers

Merge internal change: 109188553
https://codereview.chromium.org/1508853012/

QuicSpdyStream::FinishedReadingTrailers now checks for received FIN as secondary indication that trailers have been read. Protected behind existing FLAGS_quic_supports_trailers

Merge internal change: 109187066
https://codereview.chromium.org/1519453002/

Remove kStartOfHashData and QuicData::BeforePlaintext.  No functional change.

Merge internal change: 109151090
https://codereview.chromium.org/1514473006/

Add a new QUIC common cert set to reflect the new GIA cert.

Merge internal change: 109136151
https://codereview.chromium.org/1510223005/

Increase the multiplier of the CHLO message size that a REJ message must stay under when the client doesn't present a valid source-address token from 2 to 3.

Merge internal change: 109122060
https://codereview.chromium.org/1513993002/

QUIC: Always use primary config when getting proof

When calling ProofSource::GetProof, always use the primary config. Since
the QuicCryptoServerConfig's primary config could change partway through
processing the handshake, this also stores the primary config's SCID in
the state maintained by QuicCryptoServerStream.

fix QUIC_PROOF_INVALID bug in QUIC_VERSION_26, gated by
FLAGS_quic_use_primary_config_for_proof

Merge internal change: 109113945
https://codereview.chromium.org/1513193002/

Change a bunch of log messages from DLOG(INFO) to DVLOG(1), capitalize messages, and make their output consistent with variable names.

n/a (DLOG only)

Merge internal change: 109113290
https://codereview.chromium.org/1508393003/

Deleting DLOG message in QuicStreamSequencer. I don't think it's useful - the flag will go away soon and will always use this - and more importantly it access the id() field of the incomplete ReliableQuicStream. This constructor is called during initialization of ReliableQuicStream, and before the id_ field in ReliableQuicStream is initialized.

n/a (deleting DLOG)

Merge internal change: 109113068
https://codereview.chromium.org/1513163002/

Add ack_frame_updated_ to ReceivePacketManager (not in use currently).

Merge internal change: 109108430
https://codereview.chromium.org/1515743003/

Add has_ack and has_stop_waiting to QuicPacketCreator and remove them from QuicPacketGenerator.  No functional change.

Merge internal change: 109007771
https://codereview.chromium.org/1512123004/

n/a (delete unused variable in test)

Merge internal change: 108972933
https://codereview.chromium.org/1515703004/

QuicSpdyStream supports receiving trailing headers frames. Flag protected by FLAGS_quic_support_trailers

This is not expected to cause changes in production, as no client should
be sending Trailers. That said, this is being flag protected as it does
potentially change behavior, and the FLAG is intended to cover further CLs as
Trailers support is fleshed out.

Merge internal change: 108972403
https://codereview.chromium.org/1518483003/

[email protected]
BUG=

Review URL: https://codereview.chromium.org/1515353002

Cr-Commit-Position: refs/heads/master@{#364987}
diff --git a/net/quic/quic_protocol.h b/net/quic/quic_protocol.h
index a879ec5f..7029687a 100644
--- a/net/quic/quic_protocol.h
+++ b/net/quic/quic_protocol.h
@@ -123,15 +123,16 @@
 // Signifies that the QuicPacket will contain path id.
 const bool kIncludePathId = true;
 
-// Index of the first byte in a QUIC packet which is used in hash calculation.
-const size_t kStartOfHashData = 0;
-
 // Reserved ID for the crypto stream.
 const QuicStreamId kCryptoStreamId = 1;
 
 // Reserved ID for the headers stream.
 const QuicStreamId kHeadersStreamId = 3;
 
+// Header key used to identify final offset on data stream when sending HTTP/2
+// trailing headers over QUIC.
+NET_EXPORT_PRIVATE extern const char* const kFinalOffsetHeaderKey;
+
 // Maximum delayed ack time, in ms.
 const int64 kMaxDelayedAckTimeMs = 25;
 
@@ -191,6 +192,9 @@
     ((UINT64_C(1) << kUFloat16MantissaEffectiveBits) - 1) <<
     kUFloat16MaxExponent;
 
+// Default path ID.
+const QuicPathId kDefaultPathId = 0;
+
 enum TransmissionType {
   NOT_RETRANSMISSION,
   FIRST_TRANSMISSION_TYPE = NOT_RETRANSMISSION,
@@ -772,6 +776,8 @@
 
   NET_EXPORT_PRIVATE friend std::ostream& operator<<(
       std::ostream& os, const QuicStopWaitingFrame& s);
+  // Path which this stop waiting frame belongs to.
+  QuicPathId path_id;
   // Entropy hash of all packets up to, but not including, the least unacked
   // packet.
   QuicPacketEntropyHash entropy_hash;
@@ -879,6 +885,9 @@
   NET_EXPORT_PRIVATE friend std::ostream& operator<<(
       std::ostream& os, const QuicAckFrame& s);
 
+  // Path which this ack belongs to.
+  QuicPathId path_id;
+
   // Entropy hash of all packets up to largest observed not including missing
   // packets.
   QuicPacketEntropyHash entropy_hash;
@@ -1118,7 +1127,6 @@
 
   base::StringPiece FecProtectedData() const;
   base::StringPiece AssociatedData() const;
-  base::StringPiece BeforePlaintext() const;
   base::StringPiece Plaintext() const;
 
   char* mutable_data() { return buffer_; }