
ngtcp2_ccerr_set_liberr
=======================

Synopsis
--------

*#include <ngtcp2/ngtcp2.h>*

.. function:: void ngtcp2_ccerr_set_liberr(ngtcp2_ccerr *ccerr, int liberr, const uint8_t *reason, size_t reasonlen)

    
    `ngtcp2_ccerr_set_liberr` sets type and error_code based on
    *liberr*.
    
    *reason* is the reason phrase of length *reasonlen*.  This function
    does not make a copy of the reason phrase.
    
    If *liberr* is :macro:`NGTCP2_ERR_RECV_VERSION_NEGOTIATION`,
    :member:`ccerr->type <ngtcp2_ccerr.type>` is set to
    :enum:`ngtcp2_ccerr_type.NGTCP2_CCERR_TYPE_VERSION_NEGOTIATION`,
    and :member:`ccerr->error_code <ngtcp2_ccerr.error_code>` to
    :macro:`NGTCP2_NO_ERROR`.
    
    If *liberr* is :macro:`NGTCP2_ERR_IDLE_CLOSE`, :member:`ccerr->type
    <ngtcp2_ccerr.type>` is set to
    :enum:`ngtcp2_ccerr_type.NGTCP2_CCERR_TYPE_IDLE_CLOSE`, and
    :member:`ccerr->error_code <ngtcp2_ccerr.error_code>` to
    :macro:`NGTCP2_NO_ERROR`.
    
    If *liberr* is :macro:`NGTCP2_ERR_DROP_CONN`, :member:`ccerr->type
    <ngtcp2_ccerr.type>` is set to
    :enum:`ngtcp2_ccerr_type.NGTCP2_CCERR_TYPE_DROP_CONN`, and
    :member:`ccerr->error_code <ngtcp2_ccerr.error_code>` to
    :macro:`NGTCP2_NO_ERROR`.
    
    If *liberr* is :macro:`NGTCP2_ERR_RETRY`, :member:`ccerr->type
    <ngtcp2_ccerr.type>` is set to
    :enum:`ngtcp2_ccerr_type.NGTCP2_CCERR_TYPE_RETRY`, and
    :member:`ccerr->error_type <ngtcp2_ccerr.error_code>` to
    :macro:`NGTCP2_NO_ERROR`.
    
    Otherwise, :member:`ccerr->type <ngtcp2_ccerr.type>` is set to
    :enum:`ngtcp2_ccerr_type.NGTCP2_CCERR_TYPE_TRANSPORT`, and
    :member:`ccerr->error_code <ngtcp2_ccerr.error_code>` is set to an
    error code inferred by *liberr* (see
    `ngtcp2_err_infer_quic_transport_error_code`).
