ngtcp2_pkt_write_stateless_reset

Synopsis

#include <ngtcp2/ngtcp2.h>

ngtcp2_ssize ngtcp2_pkt_write_stateless_reset(uint8_t *dest, size_t destlen, const uint8_t *stateless_reset_token, const uint8_t *rand, size_t randlen)

ngtcp2_pkt_write_stateless_reset() writes Stateless Reset packet in the buffer pointed by dest whose length is destlen. stateless_reset_token is a pointer to the Stateless Reset Token, and its length must be NGTCP2_STATELESS_RESET_TOKENLEN bytes long. rand specifies the random octets preceding Stateless Reset Token. The length of rand is specified by randlen which must be at least NGTCP2_MIN_STATELESS_RESET_RANDLEN bytes long.

If randlen is too long to write them all in the buffer, rand is written to the buffer as much as possible, and is truncated.

This function returns the number of bytes written to the buffer, or one of the following negative error codes:

NGTCP2_ERR_NOBUF

Buffer is too small.

NGTCP2_ERR_INVALID_ARGUMENT

randlen is strictly less than NGTCP2_MIN_STATELESS_RESET_RANDLEN.