curl_ngtcp2: extend and update callbacks for 1.22.0+
No binary (build failed)
—
(log yok)
| @@ -54,7 +54,7 @@ env: | |
| # renovate: datasource=github-tags depName=ngtcp2/nghttp3 versioning=semver registryUrl=https://github.com | |
| NGHTTP3_VERSION: 1.15.0 | |
| # renovate: datasource=github-tags depName=ngtcp2/ngtcp2 versioning=semver registryUrl=https://github.com | |
| - | NGTCP2_VERSION: 1.21.0 |
| + | NGTCP2_VERSION: 1.22.0 |
| # renovate: datasource=github-tags depName=nghttp2/nghttp2 versioning=semver registryUrl=https://github.com | |
| NGHTTP2_VERSION: 1.68.1 | |
| # renovate: datasource=github-tags depName=cloudflare/quiche versioning=semver registryUrl=https://github.com | |
| @@ -788,6 +788,7 @@ static void cb_rand(uint8_t *dest, size_t destlen, | |
| } | |
| } | |
| + | /* for ngtcp2 <v1.22.0 */ |
| static int cb_get_new_connection_id(ngtcp2_conn *tconn, ngtcp2_cid *cid, | |
| uint8_t *token, size_t cidlen, | |
| void *user_data) | |
| @@ -808,6 +809,27 @@ static int cb_get_new_connection_id(ngtcp2_conn *tconn, ngtcp2_cid *cid, | |
| return 0; | |
| } | |
| + | #ifdef NGTCP2_CALLBACKS_V3 /* ngtcp2 v1.22.0+ */ |
| + | static int cb_get_new_connection_id2(ngtcp2_conn *tconn, ngtcp2_cid *cid, |
| + | struct ngtcp2_stateless_reset_token *token, size_t cidlen, void *user_data) |
| + | { |
| + | CURLcode result; |
| + | (void)tconn; |
| + | (void)user_data; |
| + | |
| + | result = Curl_rand(NULL, cid->data, cidlen); |
| + | if(result) |
| + | return NGTCP2_ERR_CALLBACK_FAILURE; |
| + | cid->datalen = cidlen; |
| + | |
| + | result = Curl_rand(NULL, token->data, sizeof(token->data)); |
| + | if(result) |
| + | return NGTCP2_ERR_CALLBACK_FAILURE; |
| + | |
| + | return 0; |
| + | } |
| + | #endif |
| + | |
| static int cb_recv_rx_key(ngtcp2_conn *tconn, ngtcp2_encryption_level level, | |
| void *user_data) | |
| { | |
| @@ -851,7 +873,7 @@ static ngtcp2_callbacks ng_callbacks = { | |
| cb_extend_max_local_streams_bidi, | |
| NULL, /* extend_max_local_streams_uni */ | |
| cb_rand, | |
| - | cb_get_new_connection_id, |
| + | cb_get_new_connection_id, /* for ngtcp2 <v1.22.0 */ |
| NULL, /* remove_connection_id */ | |
| ngtcp2_crypto_update_key_cb, /* update_key */ | |
| NULL, /* path_validation */ | |
| @@ -877,6 +899,12 @@ static ngtcp2_callbacks ng_callbacks = { | |
| #ifdef NGTCP2_CALLBACKS_V2 /* ngtcp2 v1.14.0+ */ | |
| NULL, /* begin_path_validation */ | |
| #endif | |
| + | #ifdef NGTCP2_CALLBACKS_V3 /* ngtcp2 v1.22.0+ */ |
| + | NULL, /* recv_stateless_reset2 */ |
| + | cb_get_new_connection_id2, /* get_new_connection_id2 */ |
| + | NULL, /* dcid_status2 */ |
| + | ngtcp2_crypto_get_path_challenge_data2_cb, /* get_path_challenge_data2 */ |
| + | #endif |
| }; | |
| #if defined(_MSC_VER) && defined(_DLL) | |