Commit 132cd21c authored by Tatsuhiro Tsujikawa's avatar Tatsuhiro Tsujikawa

Compile with the latest ngtcp2 and nghttp3

parent 863434fa
...@@ -289,7 +289,7 @@ int Http3Session::init_conn() { ...@@ -289,7 +289,7 @@ int Http3Session::init_conn() {
return -1; return -1;
} }
nghttp3_conn_callbacks callbacks{ nghttp3_callbacks callbacks{
nullptr, // acked_stream_data nullptr, // acked_stream_data
h2load::stream_close, h2load::stream_close,
h2load::recv_data, h2load::recv_data,
...@@ -310,8 +310,8 @@ int Http3Session::init_conn() { ...@@ -310,8 +310,8 @@ int Http3Session::init_conn() {
auto config = client_->worker->config; auto config = client_->worker->config;
nghttp3_conn_settings settings; nghttp3_settings settings;
nghttp3_conn_settings_default(&settings); nghttp3_settings_default(&settings);
settings.qpack_max_table_capacity = config->header_table_size; settings.qpack_max_table_capacity = config->header_table_size;
settings.qpack_blocked_streams = 100; settings.qpack_blocked_streams = 100;
......
...@@ -26,6 +26,8 @@ ...@@ -26,6 +26,8 @@
#include <iostream> #include <iostream>
#include <ngtcp2/ngtcp2_crypto_openssl.h>
#include <openssl/err.h> #include <openssl/err.h>
#include "h2load_http3_session.h" #include "h2load_http3_session.h"
...@@ -233,31 +235,14 @@ ngtcp2_tstamp timestamp(struct ev_loop *loop) { ...@@ -233,31 +235,14 @@ ngtcp2_tstamp timestamp(struct ev_loop *loop) {
} }
} // namespace } // namespace
namespace {
ngtcp2_crypto_level from_ossl_level(OSSL_ENCRYPTION_LEVEL ossl_level) {
switch (ossl_level) {
case ssl_encryption_initial:
return NGTCP2_CRYPTO_LEVEL_INITIAL;
case ssl_encryption_early_data:
return NGTCP2_CRYPTO_LEVEL_EARLY;
case ssl_encryption_handshake:
return NGTCP2_CRYPTO_LEVEL_HANDSHAKE;
case ssl_encryption_application:
return NGTCP2_CRYPTO_LEVEL_APPLICATION;
default:
assert(0);
}
}
} // namespace
namespace { namespace {
int set_encryption_secrets(SSL *ssl, OSSL_ENCRYPTION_LEVEL ossl_level, int set_encryption_secrets(SSL *ssl, OSSL_ENCRYPTION_LEVEL ossl_level,
const uint8_t *rx_secret, const uint8_t *tx_secret, const uint8_t *rx_secret, const uint8_t *tx_secret,
size_t secret_len) { size_t secret_len) {
auto c = static_cast<Client *>(SSL_get_app_data(ssl)); auto c = static_cast<Client *>(SSL_get_app_data(ssl));
if (c->quic_on_key(from_ossl_level(ossl_level), rx_secret, tx_secret, if (c->quic_on_key(ngtcp2_crypto_from_ossl_encryption_level(ossl_level),
secret_len) != 0) { rx_secret, tx_secret, secret_len) != 0) {
return 0; return 0;
} }
...@@ -269,7 +254,8 @@ namespace { ...@@ -269,7 +254,8 @@ namespace {
int add_handshake_data(SSL *ssl, OSSL_ENCRYPTION_LEVEL ossl_level, int add_handshake_data(SSL *ssl, OSSL_ENCRYPTION_LEVEL ossl_level,
const uint8_t *data, size_t len) { const uint8_t *data, size_t len) {
auto c = static_cast<Client *>(SSL_get_app_data(ssl)); auto c = static_cast<Client *>(SSL_get_app_data(ssl));
c->quic_write_client_handshake(from_ossl_level(ossl_level), data, len); c->quic_write_client_handshake(
ngtcp2_crypto_from_ossl_encryption_level(ossl_level), data, len);
return 1; return 1;
} }
} // namespace } // namespace
...@@ -318,7 +304,7 @@ int Client::quic_init(const sockaddr *local_addr, socklen_t local_addrlen, ...@@ -318,7 +304,7 @@ int Client::quic_init(const sockaddr *local_addr, socklen_t local_addrlen,
return -1; return -1;
} }
auto callbacks = ngtcp2_conn_callbacks{ auto callbacks = ngtcp2_callbacks{
ngtcp2_crypto_client_initial_cb, ngtcp2_crypto_client_initial_cb,
nullptr, // recv_client_initial nullptr, // recv_client_initial
h2load::recv_crypto_data, h2load::recv_crypto_data,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment