ngtcp2_pkt_decode_hd_short

Synopsis

#include <ngtcp2/ngtcp2.h>

ngtcp2_ssize ngtcp2_pkt_decode_hd_short(ngtcp2_pkt_hd *dest, const uint8_t *pkt, size_t pktlen, size_t dcidlen)

ngtcp2_pkt_decode_hd_short() decodes QUIC short header in pkt of length pktlen. Short header packet does not encode the length of Connection ID, thus we need the input from the outside. dcidlen is the length of Destination Connection ID in packet header. This function only parses the input just before packet number field. This function can handle Connection ID up to NGTCP2_MAX_CIDLEN. Consider to use ngtcp2_pkt_decode_version_cid() to get longer Connection ID. It stores the result in the object pointed by dest, and returns the number of bytes decoded to read the packet header if it succeeds, or one of the following error codes:

NGTCP2_ERR_INVALID_ARGUMENT

Packet is too short; or it is not a short header