@@ -1891,7 +1891,7 @@ typedef struct ngtcp2_settings {
1891
1891
* given buffer size, :member:`max_tx_udp_payload_size`, and the
1892
1892
* received max_udp_payload QUIC transport parameter.
1893
1893
*/
1894
- int no_tx_udp_payload_size_shaping ;
1894
+ uint8_t no_tx_udp_payload_size_shaping ;
1895
1895
/**
1896
1896
* :member:`handshake_timeout` is the period of time before giving
1897
1897
* up QUIC connection establishment. If QUIC handshake is not
@@ -1969,7 +1969,7 @@ typedef struct ngtcp2_settings {
1969
1969
* :member:`no_pmtud`, if set to nonzero, disables Path MTU
1970
1970
* Discovery.
1971
1971
*/
1972
- int no_pmtud ;
1972
+ uint8_t no_pmtud ;
1973
1973
} ngtcp2_settings ;
1974
1974
1975
1975
/**
@@ -3010,6 +3010,15 @@ typedef int (*ngtcp2_update_key)(
3010
3010
*/
3011
3011
#define NGTCP2_PATH_VALIDATION_FLAG_PREFERRED_ADDR 0x01u
3012
3012
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
+
3013
3022
/**
3014
3023
* @functypedef
3015
3024
*
@@ -3103,10 +3112,9 @@ typedef enum ngtcp2_connection_id_status_type {
3103
3112
* :macro:`NGTCP2_ERR_CALLBACK_FAILURE` makes the library call return
3104
3113
* immediately.
3105
3114
*/
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 );
3110
3118
3111
3119
/**
3112
3120
* @functypedef
@@ -3758,12 +3766,12 @@ NGTCP2_EXTERN ngtcp2_ssize ngtcp2_conn_write_pkt_versioned(
3758
3766
/**
3759
3767
* @function
3760
3768
*
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
3763
3771
* handshake has completed. The library needs extra conditions to be
3764
3772
* met.
3765
3773
*/
3766
- NGTCP2_EXTERN void ngtcp2_conn_handshake_completed (ngtcp2_conn * conn );
3774
+ NGTCP2_EXTERN void ngtcp2_conn_tls_handshake_completed (ngtcp2_conn * conn );
3767
3775
3768
3776
/**
3769
3777
* @function
@@ -5028,14 +5036,6 @@ NGTCP2_EXTERN int ngtcp2_conn_initiate_migration(ngtcp2_conn *conn,
5028
5036
const ngtcp2_path * path ,
5029
5037
ngtcp2_tstamp ts );
5030
5038
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
-
5039
5039
/**
5040
5040
* @function
5041
5041
*
@@ -5183,47 +5183,47 @@ ngtcp2_conn_get_early_crypto_ctx(ngtcp2_conn *conn);
5183
5183
/**
5184
5184
* @enum
5185
5185
*
5186
- * :type:`ngtcp2_connection_close_error_code_type` defines connection
5187
- * error code type.
5186
+ * :type:`ngtcp2_ccerr_type` defines connection error type.
5188
5187
*/
5189
- typedef enum ngtcp2_connection_close_error_code_type {
5188
+ typedef enum ngtcp2_ccerr_type {
5190
5189
/**
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.
5193
5192
*/
5194
- NGTCP2_CONNECTION_CLOSE_ERROR_CODE_TYPE_TRANSPORT ,
5193
+ NGTCP2_CCERR_TYPE_TRANSPORT ,
5195
5194
/**
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.
5198
5197
*/
5199
- NGTCP2_CONNECTION_CLOSE_ERROR_CODE_TYPE_APPLICATION ,
5198
+ NGTCP2_CCERR_TYPE_APPLICATION ,
5200
5199
/**
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.
5204
5203
*/
5205
- NGTCP2_CONNECTION_CLOSE_ERROR_CODE_TYPE_TRANSPORT_VERSION_NEGOTIATION ,
5204
+ NGTCP2_CCERR_TYPE_VERSION_NEGOTIATION ,
5206
5205
/**
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.
5210
5209
*/
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 ;
5213
5212
5214
5213
/**
5215
5214
* @struct
5216
5215
*
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.
5219
5218
*/
5220
- typedef struct ngtcp2_connection_close_error {
5219
+ typedef struct ngtcp2_ccerr {
5221
5220
/**
5222
- * :member:`type` is the type of :member:`error_code` .
5221
+ * :member:`type` is the type of this error .
5223
5222
*/
5224
- ngtcp2_connection_close_error_code_type type ;
5223
+ ngtcp2_ccerr_type type ;
5225
5224
/**
5226
5225
* :member:`error_code` is the error code for connection closure.
5226
+ * Its interpretation depends on :member:`type`.
5227
5227
*/
5228
5228
uint64_t error_code ;
5229
5229
/**
@@ -5244,103 +5244,97 @@ typedef struct ngtcp2_connection_close_error {
5244
5244
* :member:`reason`.
5245
5245
*/
5246
5246
size_t reasonlen ;
5247
- } ngtcp2_connection_close_error ;
5247
+ } ngtcp2_ccerr ;
5248
5248
5249
5249
/**
5250
5250
* @function
5251
5251
*
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:
5254
5254
*
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>` =
5258
5258
* :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
5263
5262
*/
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 );
5266
5264
5267
5265
/**
5268
5266
* @function
5269
5267
*
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.
5277
5274
*/
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 );
5281
5279
5282
5280
/**
5283
5281
* @function
5284
5282
*
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|.
5287
5285
*
5288
5286
* 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
5294
5290
* :macro:`NGTCP2_NO_ERROR`. If |liberr| is
5295
5291
* :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
5300
5295
* :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
5306
5300
* `ngtcp2_err_infer_quic_transport_error_code`). |reason| is the
5307
5301
* reason phrase of length |reasonlen|. This function does not make a
5308
5302
* copy of the reason phrase.
5309
5303
*/
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 );
5313
5307
5314
5308
/**
5315
5309
* @function
5316
5310
*
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
5323
5316
* reason phrase of length |reasonlen|. This function does not make a
5324
5317
* copy of the reason phrase.
5325
5318
*/
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 );
5329
5323
5330
5324
/**
5331
5325
* @function
5332
5326
*
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.
5340
5333
*/
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 );
5344
5338
5345
5339
/**
5346
5340
* @function
@@ -5361,13 +5355,13 @@ NGTCP2_EXTERN void ngtcp2_connection_close_error_set_application_error(
5361
5355
* If |pi| is not ``NULL``, this function stores packet metadata in it
5362
5356
* if it succeeds. The metadata includes ECN markings.
5363
5357
*
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.
5371
5365
*
5372
5366
* This function must not be called from inside the callback
5373
5367
* functions.
@@ -5393,17 +5387,15 @@ NGTCP2_EXTERN void ngtcp2_connection_close_error_set_application_error(
5393
5387
NGTCP2_EXTERN ngtcp2_ssize ngtcp2_conn_write_connection_close_versioned (
5394
5388
ngtcp2_conn * conn , ngtcp2_path * path , int pkt_info_version ,
5395
5389
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 );
5397
5391
5398
5392
/**
5399
5393
* @function
5400
5394
*
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.
5403
5397
*/
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 );
5407
5399
5408
5400
/**
5409
5401
* @function
0 commit comments