
ngtcp2_pkt_write_retry
======================

Synopsis
--------

*#include <ngtcp2/ngtcp2.h>*

.. function:: 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
    :macro:`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:
    
    :macro:`NGTCP2_ERR_NOBUF`
        Buffer is too small.
    :macro:`NGTCP2_ERR_CALLBACK_FAILURE`
        Callback function failed.
    :macro:`NGTCP2_ERR_INVALID_ARGUMENT`
        :member:`odcid->datalen <ngtcp2_cid.datalen>` is less than
        :macro:`NGTCP2_MIN_INITIAL_DCIDLEN`.
