Add QuicFramer Probe methods
These will allow the Youtube probe to rely on QUIC code to write and parse version negotiation packets instead of writing their own QUIC packets.
gfe-relnote: n/a, adds new unused API.
PiperOrigin-RevId: 248425256
Change-Id: Ibf204b1488897d7d81dc33f08ffd10147524b823
diff --git a/quic/core/quic_framer.h b/quic/core/quic_framer.h
index bded585..ab0e8d7 100644
--- a/quic/core/quic_framer.h
+++ b/quic/core/quic_framer.h
@@ -588,6 +588,38 @@
void EnableMultiplePacketNumberSpacesSupport();
+ // Writes an array of bytes that, if sent as a UDP datagram, will trigger
+ // IETF QUIC Version Negotiation on servers. The bytes will be written to
+ // |packet_bytes|, which must point to |packet_length| bytes of memory.
+ // |packet_length| must be in the range [1200, 65535].
+ // |destination_connection_id_bytes| will be sent as the destination
+ // connection ID, and must point to |destination_connection_id_length| bytes
+ // of memory. |destination_connection_id_length| must be either 0 or in the
+ // range [4,18]. When targeting Google servers, it is recommended to use a
+ // |destination_connection_id_length| of 8.
+ static bool WriteClientVersionNegotiationProbePacket(
+ char* packet_bytes,
+ QuicByteCount packet_length,
+ const char* destination_connection_id_bytes,
+ uint8_t destination_connection_id_length);
+
+ // Parses a packet which a QUIC server sent in response to a packet sent by
+ // WriteClientVersionNegotiationProbePacket. |packet_bytes| must point to
+ // |packet_length| bytes in memory which represent the response.
+ // |packet_length| must be greater or equal to 6. This method will fill in
+ // |source_connection_id_bytes| which must point to at least 18 bytes in
+ // memory. |source_connection_id_length_out| will contain the length of the
+ // received source connection ID, which on success will match the contents of
+ // the destination connection ID passed in to
+ // WriteClientVersionNegotiationProbePacket. In the case of a failure,
+ // |detailed_error| will be filled in with an explanation of what failed.
+ static bool ParseServerVersionNegotiationProbeResponse(
+ const char* packet_bytes,
+ QuicByteCount packet_length,
+ char* source_connection_id_bytes,
+ uint8_t* source_connection_id_length_out,
+ std::string* detailed_error);
+
private:
friend class test::QuicFramerPeer;