
ngtcp2_pkt_write_version_negotiation
====================================

Synopsis
--------

*#include <ngtcp2/ngtcp2.h>*

.. function:: ngtcp2_ssize ngtcp2_pkt_write_version_negotiation( uint8_t *dest, size_t destlen, uint8_t unused_random, const uint8_t *dcid, size_t dcidlen, const uint8_t *scid, size_t scidlen, const uint32_t *sv, size_t nsv)

    
    `ngtcp2_pkt_write_version_negotiation` writes Version Negotiation
    packet in the buffer pointed by *dest* whose length is *destlen*.
    *unused_random* should be generated randomly.  *dcid* is a
    Connection ID which appeared in a packet as a Source Connection ID
    sent by client which caused version negotiation.  Similarly, *scid*
    is a Connection ID which appeared in a packet as a Destination
    Connection ID sent by client.  *sv* is a list of supported
    versions, and *nsv* specifies the number of supported versions
    included in *sv*.
    
    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.
