@@ -1891,7 +1891,7 @@ typedef struct ngtcp2_settings {
18911891 * given buffer size, :member:`max_tx_udp_payload_size`, and the
18921892 * received max_udp_payload QUIC transport parameter.
18931893 */
1894- int no_tx_udp_payload_size_shaping ;
1894+ uint8_t no_tx_udp_payload_size_shaping ;
18951895 /**
18961896 * :member:`handshake_timeout` is the period of time before giving
18971897 * up QUIC connection establishment. If QUIC handshake is not
@@ -1969,7 +1969,7 @@ typedef struct ngtcp2_settings {
19691969 * :member:`no_pmtud`, if set to nonzero, disables Path MTU
19701970 * Discovery.
19711971 */
1972- int no_pmtud ;
1972+ uint8_t no_pmtud ;
19731973} ngtcp2_settings ;
19741974
19751975/**
@@ -3010,6 +3010,15 @@ typedef int (*ngtcp2_update_key)(
30103010 */
30113011#define NGTCP2_PATH_VALIDATION_FLAG_PREFERRED_ADDR 0x01u
30123012
3013+ /**
3014+ * @macro
3015+ *
3016+ * :macro:`NGTCP2_PATH_VALIDATION_FLAG_NEW_TOKEN` indicates that
3017+ * server should send NEW_TOKEN for the new remote address. This flag
3018+ * is only set for server.
3019+ */
3020+ #define NGTCP2_PATH_VALIDATION_FLAG_NEW_TOKEN 0x02u
3021+
30133022/**
30143023 * @functypedef
30153024 *
@@ -3103,10 +3112,9 @@ typedef enum ngtcp2_connection_id_status_type {
31033112 * :macro:`NGTCP2_ERR_CALLBACK_FAILURE` makes the library call return
31043113 * immediately.
31053114 */
3106- typedef int (* ngtcp2_connection_id_status )(ngtcp2_conn * conn , int type ,
3107- uint64_t seq , const ngtcp2_cid * cid ,
3108- const uint8_t * token ,
3109- void * user_data );
3115+ typedef int (* ngtcp2_connection_id_status )(
3116+ ngtcp2_conn * conn , ngtcp2_connection_id_status_type type , uint64_t seq ,
3117+ const ngtcp2_cid * cid , const uint8_t * token , void * user_data );
31103118
31113119/**
31123120 * @functypedef
@@ -3758,12 +3766,12 @@ NGTCP2_EXTERN ngtcp2_ssize ngtcp2_conn_write_pkt_versioned(
37583766/**
37593767 * @function
37603768 *
3761- * `ngtcp2_conn_handshake_completed ` tells |conn| that the TLS stack
3762- * declares TLS handshake completion. This does not mean QUIC
3769+ * `ngtcp2_conn_tls_handshake_completed ` tells |conn| that the TLS
3770+ * stack declares TLS handshake completion. This does not mean QUIC
37633771 * handshake has completed. The library needs extra conditions to be
37643772 * met.
37653773 */
3766- NGTCP2_EXTERN void ngtcp2_conn_handshake_completed (ngtcp2_conn * conn );
3774+ NGTCP2_EXTERN void ngtcp2_conn_tls_handshake_completed (ngtcp2_conn * conn );
37673775
37683776/**
37693777 * @function
@@ -5028,14 +5036,6 @@ NGTCP2_EXTERN int ngtcp2_conn_initiate_migration(ngtcp2_conn *conn,
50285036 const ngtcp2_path * path ,
50295037 ngtcp2_tstamp ts );
50305038
5031- /**
5032- * @function
5033- *
5034- * `ngtcp2_conn_get_max_local_streams_uni` returns the cumulative
5035- * number of streams which local endpoint can open.
5036- */
5037- NGTCP2_EXTERN uint64_t ngtcp2_conn_get_max_local_streams_uni (ngtcp2_conn * conn );
5038-
50395039/**
50405040 * @function
50415041 *
@@ -5183,47 +5183,47 @@ ngtcp2_conn_get_early_crypto_ctx(ngtcp2_conn *conn);
51835183/**
51845184 * @enum
51855185 *
5186- * :type:`ngtcp2_connection_close_error_code_type` defines connection
5187- * error code type.
5186+ * :type:`ngtcp2_ccerr_type` defines connection error type.
51885187 */
5189- typedef enum ngtcp2_connection_close_error_code_type {
5188+ typedef enum ngtcp2_ccerr_type {
51905189 /**
5191- * :enum:`NGTCP2_CONNECTION_CLOSE_ERROR_CODE_TYPE_TRANSPORT`
5192- * indicates the error code is QUIC transport error code.
5190+ * :enum:`NGTCP2_CCERR_TYPE_TRANSPORT` indicates the QUIC transport
5191+ * error, and the error code is QUIC transport error code.
51935192 */
5194- NGTCP2_CONNECTION_CLOSE_ERROR_CODE_TYPE_TRANSPORT ,
5193+ NGTCP2_CCERR_TYPE_TRANSPORT ,
51955194 /**
5196- * :enum:`NGTCP2_CONNECTION_CLOSE_ERROR_CODE_TYPE_APPLICATION`
5197- * indicates the error code is application error code.
5195+ * :enum:`NGTCP2_CCERR_TYPE_APPLICATION` indicates an application
5196+ * error, and the error code is application error code.
51985197 */
5199- NGTCP2_CONNECTION_CLOSE_ERROR_CODE_TYPE_APPLICATION ,
5198+ NGTCP2_CCERR_TYPE_APPLICATION ,
52005199 /**
5201- * :enum:`NGTCP2_CONNECTION_CLOSE_ERROR_CODE_TYPE_TRANSPORT_VERSION_NEGOTIATION`
5202- * is a special case of QUIC transport error, and it indicates that
5203- * client receives Version Negotiation packet.
5200+ * :enum:`NGTCP2_CCERR_TYPE_VERSION_NEGOTIATION` is a special case
5201+ * of QUIC transport error, and it indicates that client receives
5202+ * Version Negotiation packet.
52045203 */
5205- NGTCP2_CONNECTION_CLOSE_ERROR_CODE_TYPE_TRANSPORT_VERSION_NEGOTIATION ,
5204+ NGTCP2_CCERR_TYPE_VERSION_NEGOTIATION ,
52065205 /**
5207- * :enum:`NGTCP2_CONNECTION_CLOSE_ERROR_CODE_TYPE_TRANSPORT_IDLE_CLOSE`
5208- * is a special case of QUIC transport error, and it indicates that
5209- * connection is closed because of idle timeout.
5206+ * :enum:`NGTCP2_CCERR_TYPE_IDLE_CLOSE` is a special case of QUIC
5207+ * transport error, and it indicates that connection is closed
5208+ * because of idle timeout.
52105209 */
5211- NGTCP2_CONNECTION_CLOSE_ERROR_CODE_TYPE_TRANSPORT_IDLE_CLOSE
5212- } ngtcp2_connection_close_error_code_type ;
5210+ NGTCP2_CCERR_TYPE_IDLE_CLOSE
5211+ } ngtcp2_ccerr_type ;
52135212
52145213/**
52155214 * @struct
52165215 *
5217- * :type:`ngtcp2_connection_close_error ` contains connection
5218- * error code, its type, and the optional reason phrase.
5216+ * :type:`ngtcp2_ccerr ` contains connection error code, its type, and
5217+ * the optional reason phrase.
52195218 */
5220- typedef struct ngtcp2_connection_close_error {
5219+ typedef struct ngtcp2_ccerr {
52215220 /**
5222- * :member:`type` is the type of :member:`error_code` .
5221+ * :member:`type` is the type of this error .
52235222 */
5224- ngtcp2_connection_close_error_code_type type ;
5223+ ngtcp2_ccerr_type type ;
52255224 /**
52265225 * :member:`error_code` is the error code for connection closure.
5226+ * Its interpretation depends on :member:`type`.
52275227 */
52285228 uint64_t error_code ;
52295229 /**
@@ -5244,103 +5244,97 @@ typedef struct ngtcp2_connection_close_error {
52445244 * :member:`reason`.
52455245 */
52465246 size_t reasonlen ;
5247- } ngtcp2_connection_close_error ;
5247+ } ngtcp2_ccerr ;
52485248
52495249/**
52505250 * @function
52515251 *
5252- * `ngtcp2_connection_close_error_default ` initializes |ccerr| with
5253- * the default values. It sets the following fields:
5252+ * `ngtcp2_ccerr_default ` initializes |ccerr| with the default values.
5253+ * It sets the following fields:
52545254 *
5255- * - :member:`type <ngtcp2_connection_close_error .type>` =
5256- * :enum:`ngtcp2_connection_close_error_code_type.NGTCP2_CONNECTION_CLOSE_ERROR_CODE_TYPE_TRANSPORT `
5257- * - :member:`error_code <ngtcp2_connection_close_error .error_code>` =
5255+ * - :member:`type <ngtcp2_ccerr .type>` =
5256+ * :enum:`ngtcp2_ccerr_type.NGTCP2_CCERR_TYPE_TRANSPORT `
5257+ * - :member:`error_code <ngtcp2_ccerr .error_code>` =
52585258 * :macro:`NGTCP2_NO_ERROR`.
5259- * - :member:`frame_type <ngtcp2_connection_close_error.frame_type>` =
5260- * 0
5261- * - :member:`reason <ngtcp2_connection_close_error.reason>` = NULL
5262- * - :member:`reasonlen <ngtcp2_connection_close_error.reasonlen>` = 0
5259+ * - :member:`frame_type <ngtcp2_ccerr.frame_type>` = 0
5260+ * - :member:`reason <ngtcp2_ccerr.reason>` = NULL
5261+ * - :member:`reasonlen <ngtcp2_ccerr.reasonlen>` = 0
52635262 */
5264- NGTCP2_EXTERN void
5265- ngtcp2_connection_close_error_default (ngtcp2_connection_close_error * ccerr );
5263+ NGTCP2_EXTERN void ngtcp2_ccerr_default (ngtcp2_ccerr * ccerr );
52665264
52675265/**
52685266 * @function
52695267 *
5270- * `ngtcp2_connection_close_error_set_transport_error` sets
5271- * :member:`ccerr->type <ngtcp2_connection_close_error.type>` to
5272- * :enum:`ngtcp2_connection_close_error_code_type.NGTCP2_CONNECTION_CLOSE_ERROR_CODE_TYPE_TRANSPORT`,
5273- * and :member:`ccerr->error_code
5274- * <ngtcp2_connection_close_error.error_code>` to |error_code|.
5275- * |reason| is the reason phrase of length |reasonlen|. This function
5276- * does not make a copy of the reason phrase.
5268+ * `ngtcp2_ccerr_set_transport_error` sets :member:`ccerr->type
5269+ * <ngtcp2_ccerr.type>` to
5270+ * :enum:`ngtcp2_ccerr_type.NGTCP2_CCERR_TYPE_TRANSPORT`, and
5271+ * :member:`ccerr->error_code <ngtcp2_ccerr.error_code>` to
5272+ * |error_code|. |reason| is the reason phrase of length |reasonlen|.
5273+ * This function does not make a copy of the reason phrase.
52775274 */
5278- NGTCP2_EXTERN void ngtcp2_connection_close_error_set_transport_error (
5279- ngtcp2_connection_close_error * ccerr , uint64_t error_code ,
5280- const uint8_t * reason , size_t reasonlen );
5275+ NGTCP2_EXTERN void ngtcp2_ccerr_set_transport_error (ngtcp2_ccerr * ccerr ,
5276+ uint64_t error_code ,
5277+ const uint8_t * reason ,
5278+ size_t reasonlen );
52815279
52825280/**
52835281 * @function
52845282 *
5285- * `ngtcp2_connection_close_error_set_transport_error_liberr ` sets
5286- * type and error_code based on |liberr|.
5283+ * `ngtcp2_ccerr_set_liberr ` sets type and error_code based on
5284+ * |liberr|.
52875285 *
52885286 * If |liberr| is :macro:`NGTCP2_ERR_RECV_VERSION_NEGOTIATION`,
5289- * :member:`ccerr->type <ngtcp2_connection_close_error.type>` is set
5290- * to
5291- * :enum:`ngtcp2_connection_close_error_code_type.NGTCP2_CONNECTION_CLOSE_ERROR_CODE_TYPE_TRANSPORT_VERSION_NEGOTIATION`,
5292- * and :member:`ccerr->error_code
5293- * <ngtcp2_connection_close_error.error_code>` to
5287+ * :member:`ccerr->type <ngtcp2_ccerr.type>` is set to
5288+ * :enum:`ngtcp2_ccerr_type.NGTCP2_CCERR_TYPE_VERSION_NEGOTIATION`,
5289+ * and :member:`ccerr->error_code <ngtcp2_ccerr.error_code>` to
52945290 * :macro:`NGTCP2_NO_ERROR`. If |liberr| is
52955291 * :macro:`NGTCP2_ERR_IDLE_CLOSE`, :member:`ccerr->type
5296- * <ngtcp2_connection_close_error.type>` is set to
5297- * :enum:`ngtcp2_connection_close_error_code_type.NGTCP2_CONNECTION_CLOSE_ERROR_CODE_TYPE_TRANSPORT_IDLE_CLOSE`,
5298- * and :member:`ccerr->error_code
5299- * <ngtcp2_connection_close_error.error_code>` to
5292+ * <ngtcp2_ccerr.type>` is set to
5293+ * :enum:`ngtcp2_ccerr_type.NGTCP2_CCERR_TYPE_IDLE_CLOSE`, and
5294+ * :member:`ccerr->error_code <ngtcp2_ccerr.error_code>` to
53005295 * :macro:`NGTCP2_NO_ERROR`. Otherwise, :member:`ccerr->type
5301- * <ngtcp2_connection_close_error.type>` is set to
5302- * :enum:`ngtcp2_connection_close_error_code_type.NGTCP2_CONNECTION_CLOSE_ERROR_CODE_TYPE_TRANSPORT`,
5303- * and :member:`ccerr->error_code
5304- * <ngtcp2_connection_close_error.error_code>` is set to an error code
5305- * inferred by |liberr| (see
5296+ * <ngtcp2_ccerr.type>` is set to
5297+ * :enum:`ngtcp2_ccerr_type.NGTCP2_CCERR_TYPE_TRANSPORT`, and
5298+ * :member:`ccerr->error_code <ngtcp2_ccerr.error_code>` is set to an
5299+ * error code inferred by |liberr| (see
53065300 * `ngtcp2_err_infer_quic_transport_error_code`). |reason| is the
53075301 * reason phrase of length |reasonlen|. This function does not make a
53085302 * copy of the reason phrase.
53095303 */
5310- NGTCP2_EXTERN void ngtcp2_connection_close_error_set_transport_error_liberr (
5311- ngtcp2_connection_close_error * ccerr , int liberr , const uint8_t * reason ,
5312- size_t reasonlen );
5304+ NGTCP2_EXTERN void ngtcp2_ccerr_set_liberr ( ngtcp2_ccerr * ccerr , int liberr ,
5305+ const uint8_t * reason ,
5306+ size_t reasonlen );
53135307
53145308/**
53155309 * @function
53165310 *
5317- * `ngtcp2_connection_close_error_set_transport_error_tls_alert` sets
5318- * :member:`ccerr->type <ngtcp2_connection_close_error.type>` to
5319- * :enum:`ngtcp2_connection_close_error_code_type.NGTCP2_CONNECTION_CLOSE_ERROR_CODE_TYPE_TRANSPORT`,
5320- * and :member:`ccerr->error_code
5321- * <ngtcp2_connection_close_error.error_code>` to bitwise-OR of
5322- * :macro:`NGTCP2_CRYPTO_ERROR` and |tls_alert|. |reason| is the
5311+ * `ngtcp2_ccerr_set_tls_alert` sets :member:`ccerr->type
5312+ * <ngtcp2_ccerr.type>` to
5313+ * :enum:`ngtcp2_ccerr_type.NGTCP2_CCERR_TYPE_TRANSPORT`, and
5314+ * :member:`ccerr->error_code <ngtcp2_ccerr.error_code>` to bitwise-OR
5315+ * of :macro:`NGTCP2_CRYPTO_ERROR` and |tls_alert|. |reason| is the
53235316 * reason phrase of length |reasonlen|. This function does not make a
53245317 * copy of the reason phrase.
53255318 */
5326- NGTCP2_EXTERN void ngtcp2_connection_close_error_set_transport_error_tls_alert (
5327- ngtcp2_connection_close_error * ccerr , uint8_t tls_alert ,
5328- const uint8_t * reason , size_t reasonlen );
5319+ NGTCP2_EXTERN void ngtcp2_ccerr_set_tls_alert (ngtcp2_ccerr * ccerr ,
5320+ uint8_t tls_alert ,
5321+ const uint8_t * reason ,
5322+ size_t reasonlen );
53295323
53305324/**
53315325 * @function
53325326 *
5333- * `ngtcp2_connection_close_error_set_application_error` sets
5334- * :member:`ccerr->type <ngtcp2_connection_close_error.type>` to
5335- * :enum:`ngtcp2_connection_close_error_code_type.NGTCP2_CONNECTION_CLOSE_ERROR_CODE_TYPE_APPLICATION`,
5336- * and :member:`ccerr->error_code
5337- * <ngtcp2_connection_close_error.error_code>` to |error_code|.
5338- * |reason| is the reason phrase of length |reasonlen|. This function
5339- * does not make a copy of the reason phrase.
5327+ * `ngtcp2_ccerr_set_application_error` sets :member:`ccerr->type
5328+ * <ngtcp2_ccerr.type>` to
5329+ * :enum:`ngtcp2_ccerr_type.NGTCP2_CCERR_TYPE_APPLICATION`, and
5330+ * :member:`ccerr->error_code <ngtcp2_ccerr.error_code>` to
5331+ * |error_code|. |reason| is the reason phrase of length |reasonlen|.
5332+ * This function does not make a copy of the reason phrase.
53405333 */
5341- NGTCP2_EXTERN void ngtcp2_connection_close_error_set_application_error (
5342- ngtcp2_connection_close_error * ccerr , uint64_t error_code ,
5343- const uint8_t * reason , size_t reasonlen );
5334+ NGTCP2_EXTERN void ngtcp2_ccerr_set_application_error (ngtcp2_ccerr * ccerr ,
5335+ uint64_t error_code ,
5336+ const uint8_t * reason ,
5337+ size_t reasonlen );
53445338
53455339/**
53465340 * @function
@@ -5361,13 +5355,13 @@ NGTCP2_EXTERN void ngtcp2_connection_close_error_set_application_error(
53615355 * If |pi| is not ``NULL``, this function stores packet metadata in it
53625356 * if it succeeds. The metadata includes ECN markings.
53635357 *
5364- * If :member:`ccerr->type <ngtcp2_connection_close_error .type>` ==
5365- * :enum:`ngtcp2_connection_close_error_code_type.NGTCP2_CONNECTION_CLOSE_ERROR_CODE_TYPE_TRANSPORT`,
5366- * this function sends CONNECTION_CLOSE (type 0x1c) frame. If
5367- * :member:`ccerr->type <ngtcp2_connection_close_error .type>` ==
5368- * :enum:`ngtcp2_connection_close_error_code_type.NGTCP2_CONNECTION_CLOSE_ERROR_CODE_TYPE_APPLICATION`,
5369- * it sends CONNECTION_CLOSE (type 0x1d) frame. Otherwise, it does
5370- * not produce any data, and returns 0.
5358+ * If :member:`ccerr->type <ngtcp2_ccerr .type>` ==
5359+ * :enum:`ngtcp2_ccerr_type.NGTCP2_CCERR_TYPE_TRANSPORT`, this
5360+ * function sends CONNECTION_CLOSE (type 0x1c) frame. If
5361+ * :member:`ccerr->type <ngtcp2_ccerr .type>` ==
5362+ * :enum:`ngtcp2_ccerr_type.NGTCP2_CCERR_TYPE_APPLICATION`, it sends
5363+ * CONNECTION_CLOSE (type 0x1d) frame. Otherwise, it does not produce
5364+ * any data, and returns 0.
53715365 *
53725366 * This function must not be called from inside the callback
53735367 * functions.
@@ -5393,17 +5387,15 @@ NGTCP2_EXTERN void ngtcp2_connection_close_error_set_application_error(
53935387NGTCP2_EXTERN ngtcp2_ssize ngtcp2_conn_write_connection_close_versioned (
53945388 ngtcp2_conn * conn , ngtcp2_path * path , int pkt_info_version ,
53955389 ngtcp2_pkt_info * pi , uint8_t * dest , size_t destlen ,
5396- const ngtcp2_connection_close_error * ccerr , ngtcp2_tstamp ts );
5390+ const ngtcp2_ccerr * ccerr , ngtcp2_tstamp ts );
53975391
53985392/**
53995393 * @function
54005394 *
5401- * `ngtcp2_conn_get_connection_close_error` stores the received
5402- * connection close error in |ccerr| .
5395+ * `ngtcp2_conn_get_ccerr` returns the received connection close
5396+ * error.
54035397 */
5404- NGTCP2_EXTERN void
5405- ngtcp2_conn_get_connection_close_error (ngtcp2_conn * conn ,
5406- ngtcp2_connection_close_error * ccerr );
5398+ NGTCP2_EXTERN const ngtcp2_ccerr * ngtcp2_conn_get_ccerr (ngtcp2_conn * conn );
54075399
54085400/**
54095401 * @function
0 commit comments