ngtcp2_pkt_write_retry

Synopsis

#include <ngtcp2/ngtcp2.h>

ngtcp2_ssize ngtcp2_pkt_write_retry(uint8_t *dest, size_t destlen, uint32_t version, const ngtcp2_cid *dcid, const ngtcp2_cid *scid, const ngtcp2_cid *odcid, const uint8_t *token, size_t tokenlen, ngtcp2_encrypt encrypt, const ngtcp2_crypto_aead *aead, const ngtcp2_crypto_aead_ctx *aead_ctx)

ngtcp2_pkt_write_retry() writes Retry packet in the buffer pointed by dest whose length is destlen. dcid is the Connection ID which appeared in a packet as a Source Connection ID sent by client. scid is a server chosen Source Connection ID. odcid specifies Original Destination Connection ID which appeared in a packet as a Destination Connection ID sent by client. token specifies Retry Token, and tokenlen specifies its length. aead must be AEAD_AES_128_GCM. aead_ctx must be initialized with NGTCP2_RETRY_KEY as an encryption key.

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_CALLBACK_FAILURE

Callback function failed.

NGTCP2_ERR_INVALID_ARGUMENT

odcid->datalen is less than NGTCP2_MIN_INITIAL_DCIDLEN.