Skip to content

Commit 6803065

Browse files
authored
[+] release version 1.8.0 (#435)
* [+] release version 1.8.0 * [=] add CMake param * [=] update workflow cmake command * [=] fix variable types
1 parent 68366f6 commit 6803065

File tree

94 files changed

+5929
-900
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

94 files changed

+5929
-900
lines changed

.github/workflows/build.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ jobs:
6161
SSL_LIB_PATH_STR="${PWD}/third_party/boringssl/build/ssl/libssl.a;${PWD}/third_party/boringssl/build/crypto/libcrypto.a"
6262
mkdir -p build
6363
cd build
64-
cmake -DGCOV=on -DCMAKE_BUILD_TYPE=Debug -DXQC_ENABLE_TESTING=1 -DXQC_SUPPORT_SENDMMSG_BUILD=1 -DXQC_ENABLE_EVENT_LOG=1 -DXQC_ENABLE_BBR2=1 -DXQC_ENABLE_RENO=1 -DSSL_TYPE=${SSL_TYPE_STR} -DSSL_PATH=${SSL_PATH_STR} -DSSL_INC_PATH=${SSL_INC_PATH_STR} -DSSL_LIB_PATH=${SSL_LIB_PATH_STR} ..
64+
cmake -DGCOV=on -DCMAKE_BUILD_TYPE=Debug -DXQC_ENABLE_TESTING=1 -DXQC_PRINT_SECRET=1 -DXQC_SUPPORT_SENDMMSG_BUILD=1 -DXQC_ENABLE_EVENT_LOG=1 -DXQC_ENABLE_BBR2=1 -DXQC_ENABLE_RENO=1 -DSSL_TYPE=${SSL_TYPE_STR} -DSSL_PATH=${SSL_PATH_STR} -DXQC_ENABLE_UNLIMITED=1 -DXQC_ENABLE_COPA=1 -DXQC_COMPAT_DUPLICATE=1 -DXQC_ENABLE_FEC=1 -DXQC_ENABLE_XOR=1 -DXQC_ENABLE_RSC=1 ..
6565
make -j
6666
6767
- name: Test

.github/workflows/codeql-analysis.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ jobs:
6060
SSL_LIB_PATH_STR="${PWD}/third_party/boringssl/build/ssl/libssl.a;${PWD}/third_party/boringssl/build/crypto/libcrypto.a"
6161
mkdir -p build
6262
cd build
63-
cmake -DGCOV=on -DCMAKE_BUILD_TYPE=Debug -DXQC_ENABLE_TESTING=1 -DXQC_SUPPORT_SENDMMSG_BUILD=1 -DXQC_ENABLE_EVENT_LOG=1 -DXQC_ENABLE_BBR2=1 -DXQC_ENABLE_RENO=1 -DSSL_TYPE=${SSL_TYPE_STR} -DSSL_PATH=${SSL_PATH_STR} -DSSL_INC_PATH=${SSL_INC_PATH_STR} -DSSL_LIB_PATH=${SSL_LIB_PATH_STR} ..
63+
cmake -DGCOV=on -DCMAKE_BUILD_TYPE=Debug -DXQC_ENABLE_TESTING=1 -DXQC_PRINT_SECRET=1 -DXQC_SUPPORT_SENDMMSG_BUILD=1 -DXQC_ENABLE_EVENT_LOG=1 -DXQC_ENABLE_BBR2=1 -DXQC_ENABLE_RENO=1 -DSSL_TYPE=${SSL_TYPE_STR} -DSSL_PATH=${SSL_PATH_STR} -DXQC_ENABLE_UNLIMITED=1 -DXQC_ENABLE_COPA=1 -DXQC_COMPAT_DUPLICATE=1 -DXQC_ENABLE_FEC=1 -DXQC_ENABLE_XOR=1 -DXQC_ENABLE_RSC=1 ..
6464
make -j
6565
6666
- name: Perform CodeQL Analysis

CMakeLists.txt

+36-4
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ option (XQC_ENABLE_UNLIMITED "enable unlimited cc" OFF)
1414
option (XQC_ENABLE_MP_INTEROP "enable MPQUIC interop" OFF)
1515
option (XQC_NO_PID_PACKET_PROCESS "do not expose path_id in xqc_engine_packet_process" OFF)
1616
option (XQC_PROTECT_POOL_MEM "enable write protection for pool memory (for debug)" OFF)
17+
option (XQC_COMPAT_DUPLICATE "qpack compat dup" OFF)
18+
option (XQC_ENABLE_FEC "enable fec" OFF)
19+
option (XQC_ENABLE_XOR "enable fec scheme xor" OFF)
20+
option (XQC_ENABLE_RSC "enable fec scheme reed-solomon code" OFF)
1721

1822
if(NOT CMAKE_BUILD_TYPE)
1923
set(CMAKE_BUILD_TYPE Release)
@@ -133,10 +137,6 @@ if(XQC_PRINT_SECRET)
133137
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DXQC_PRINT_SECRET")
134138
endif()
135139

136-
# compat with the duplicate instruction of HTTP/3 module before version v1.1.0
137-
if(XQC_COMPAT_DUPLICATE)
138-
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DXQC_COMPAT_DUPLICATE")
139-
endif()
140140

141141
# compat with the stateless reset before version v1.6.0
142142
if(XQC_COMPAT_GENERATE_SR_PKT)
@@ -238,6 +238,38 @@ if(XQC_ENABLE_MP_INTEROP)
238238
)
239239
endif()
240240

241+
# fec framework
242+
set(
243+
FEC_FRAMEWORK_SOURCE
244+
"src/transport/xqc_fec.c"
245+
"src/transport/xqc_fec_scheme.c"
246+
"src/transport/fec_schemes/xqc_galois_calculation.c"
247+
)
248+
249+
if(XQC_ENABLE_XOR)
250+
set(
251+
FEC_FRAMEWORK_SOURCE
252+
${FEC_FRAMEWORK_SOURCE}
253+
"src/transport/fec_schemes/xqc_xor.c"
254+
)
255+
endif()
256+
257+
if(XQC_ENABLE_RSC)
258+
set(
259+
FEC_FRAMEWORK_SOURCE
260+
${FEC_FRAMEWORK_SOURCE}
261+
"src/transport/fec_schemes/xqc_reed_solomon.c"
262+
)
263+
endif()
264+
265+
if(XQC_ENABLE_FEC)
266+
set(
267+
TRANSPORT_SOURCES
268+
${TRANSPORT_SOURCES}
269+
${FEC_FRAMEWORK_SOURCE}
270+
)
271+
endif()
272+
241273
# TLS source
242274
set (
243275
TLS_SOURCE

cmake/CMakeLists.txt

+33
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,39 @@ if(XQC_ENABLE_MP_INTEROP)
208208
)
209209
endif()
210210

211+
212+
# fec framework
213+
set(
214+
FEC_FRAMEWORK_SOURCE
215+
"src/transport/xqc_fec.c"
216+
"src/transport/xqc_fec_scheme.c"
217+
"src/transport/fec_schemes/xqc_galois_calculation.c"
218+
)
219+
220+
if(XQC_ENABLE_XOR)
221+
set(
222+
FEC_FRAMEWORK_SOURCE
223+
${FEC_FRAMEWORK_SOURCE}
224+
"src/transport/fec_schemes/xqc_xor.c"
225+
)
226+
endif()
227+
228+
if(XQC_ENABLE_RSC)
229+
set(
230+
FEC_FRAMEWORK_SOURCE
231+
${FEC_FRAMEWORK_SOURCE}
232+
"src/transport/fec_schemes/xqc_reed_solomon.c"
233+
)
234+
endif()
235+
236+
if(XQC_ENABLE_FEC)
237+
set(
238+
TRANSPORT_SOURCES
239+
${TRANSPORT_SOURCES}
240+
${FEC_FRAMEWORK_SOURCE}
241+
)
242+
endif()
243+
211244
# TLS source
212245
set (
213246
TLS_SOURCE

demo/demo_client.c

+25-3
Original file line numberDiff line numberDiff line change
@@ -610,6 +610,24 @@ xqc_demo_cli_write_log_file(xqc_log_level_t lvl, const void *buf, size_t size, v
610610
}
611611
}
612612

613+
void
614+
xqc_demo_cli_write_qlog_file(qlog_event_importance_t imp, const void *buf, size_t size, void *engine_user_data)
615+
{
616+
xqc_demo_cli_ctx_t *ctx = (xqc_demo_cli_ctx_t*)engine_user_data;
617+
if (ctx->log_fd <= 0) {
618+
return;
619+
}
620+
int write_len = write(ctx->log_fd, buf, size);
621+
if (write_len < 0) {
622+
printf("write qlog failed, errno: %d\n", get_sys_errno());
623+
return;
624+
}
625+
write_len = write(ctx->log_fd, line_break, 1);
626+
if (write_len < 0) {
627+
printf("write qlog failed, errno: %d\n", get_sys_errno());
628+
}
629+
}
630+
613631

614632
int
615633
xqc_demo_cli_open_keylog_file(xqc_demo_cli_ctx_t *ctx)
@@ -2314,7 +2332,8 @@ xqc_demo_cli_init_callback(xqc_engine_callback_t *cb, xqc_transport_callbacks_t
23142332
static xqc_engine_callback_t callback = {
23152333
.log_callbacks = {
23162334
.xqc_log_write_err = xqc_demo_cli_write_log_file,
2317-
.xqc_log_write_stat = xqc_demo_cli_write_log_file
2335+
.xqc_log_write_stat = xqc_demo_cli_write_log_file,
2336+
.xqc_qlog_event_write = xqc_demo_cli_write_qlog_file,
23182337
},
23192338
.keylog_cb = xqc_demo_cli_keylog_cb,
23202339
.set_event_timer = xqc_demo_cli_set_event_timer,
@@ -2461,12 +2480,15 @@ xqc_demo_cli_init_xquic_connection(xqc_demo_cli_user_conn_t *user_conn,
24612480
memcpy(&user_conn->cid, cid, sizeof(xqc_cid_t));
24622481

24632482
} else {
2464-
user_conn->hqc_handle = xqc_hq_connect(user_conn->ctx->engine, &conn_settings,
2483+
const xqc_cid_t *cid = xqc_hq_connect(user_conn->ctx->engine, &conn_settings,
24652484
args->quic_cfg.token, args->quic_cfg.token_len, args->net_cfg.host, args->quic_cfg.no_encryption, &conn_ssl_config,
24662485
(struct sockaddr*)&args->net_cfg.addr, args->net_cfg.addr_len, user_conn);
2467-
if (user_conn->hqc_handle == NULL) {
2486+
2487+
if (cid == NULL) {
24682488
return -1;
24692489
}
2490+
2491+
memcpy(&user_conn->cid, cid, sizeof(xqc_cid_t));
24702492
}
24712493

24722494
if (conn_settings.enable_multipath

demo/demo_server.c

+25-6
Original file line numberDiff line numberDiff line change
@@ -304,6 +304,24 @@ xqc_demo_svr_write_log_file(xqc_log_level_t lvl, const void *buf, size_t size, v
304304
}
305305
}
306306

307+
void
308+
xqc_demo_svr_write_qlog_file(qlog_event_importance_t imp, const void *buf, size_t size, void *eng_user_data)
309+
{
310+
xqc_demo_svr_ctx_t *ctx = (xqc_demo_svr_ctx_t*)eng_user_data;
311+
if (ctx->log_fd <= 0) {
312+
return;
313+
}
314+
315+
int write_len = write(ctx->log_fd, buf, size);
316+
if (write_len < 0) {
317+
printf("write qlog failed, errno: %d\n", get_sys_errno());
318+
return;
319+
}
320+
write_len = write(ctx->log_fd, line_break, 1);
321+
if (write_len < 0) {
322+
printf("write qlog failed, errno: %d\n", get_sys_errno());
323+
}
324+
}
307325

308326
/**
309327
* start of server keylog functions
@@ -1398,7 +1416,8 @@ xqc_demo_svr_init_callback(xqc_engine_callback_t *cb, xqc_transport_callbacks_t
13981416
.set_event_timer = xqc_demo_svr_set_event_timer,
13991417
.log_callbacks = {
14001418
.xqc_log_write_err = xqc_demo_svr_write_log_file,
1401-
.xqc_log_write_stat = xqc_demo_svr_write_log_file
1419+
.xqc_log_write_stat = xqc_demo_svr_write_log_file,
1420+
.xqc_qlog_event_write = xqc_demo_svr_write_qlog_file
14021421
},
14031422
.keylog_cb = xqc_demo_svr_keylog_cb,
14041423
};
@@ -1446,7 +1465,7 @@ xqc_demo_svr_init_ssl_config(xqc_engine_ssl_config_t *cfg, xqc_demo_svr_args_t *
14461465
}
14471466

14481467
void
1449-
xqc_demo_svr_init_conn_settings(xqc_demo_svr_args_t *args)
1468+
xqc_demo_svr_init_conn_settings(xqc_engine_t *engine, xqc_demo_svr_args_t *args)
14501469
{
14511470
xqc_cong_ctrl_callback_t ccc = {0};
14521471
switch (args->net_cfg.cc) {
@@ -1509,7 +1528,7 @@ xqc_demo_svr_init_conn_settings(xqc_demo_svr_args_t *args)
15091528
.anti_amplification_limit = 3,
15101529
};
15111530

1512-
xqc_server_set_conn_settings(&conn_settings);
1531+
xqc_server_set_conn_settings(engine, &conn_settings);
15131532
}
15141533

15151534

@@ -1576,9 +1595,6 @@ xqc_demo_svr_init_xquic_engine(xqc_demo_svr_ctx_t *ctx, xqc_demo_svr_args_t *arg
15761595
xqc_transport_callbacks_t transport_cbs;
15771596
xqc_demo_svr_init_callback(&callback, &transport_cbs, args);
15781597

1579-
/* init server connection settings */
1580-
xqc_demo_svr_init_conn_settings(args);
1581-
15821598
/* init engine config */
15831599
xqc_config_t config;
15841600
if (xqc_engine_get_default_config(&config, XQC_ENGINE_CLIENT) < 0) {
@@ -1613,6 +1629,9 @@ xqc_demo_svr_init_xquic_engine(xqc_demo_svr_ctx_t *ctx, xqc_demo_svr_args_t *arg
16131629
return -1;
16141630
}
16151631

1632+
/* init server connection settings */
1633+
xqc_demo_svr_init_conn_settings(ctx->engine, args);
1634+
16161635
if (xqc_demo_svr_init_alpn_ctx(ctx) < 0) {
16171636
printf("init alpn ctx error!");
16181637
return -1;

demo/xqc_hq.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ xqc_hq_ctx_destroy(xqc_engine_t *engine);
9999
* @brief hq connection functions
100100
*/
101101

102-
xqc_hq_conn_t *
102+
const xqc_cid_t *
103103
xqc_hq_connect(xqc_engine_t *engine, const xqc_conn_settings_t *conn_settings,
104104
const unsigned char *token, unsigned token_len, const char *server_host, int no_crypto_flag,
105105
const xqc_conn_ssl_config_t *conn_ssl_config, const struct sockaddr *peer_addr,

demo/xqc_hq_conn.c

+16-47
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,6 @@
1111
#include "src/transport/xqc_conn.h"
1212

1313

14-
typedef struct xqc_hq_conn_s {
15-
xqc_hq_conn_callbacks_t *hqc_cbs;
16-
17-
xqc_connection_t *conn;
18-
19-
xqc_log_t *log;
20-
21-
void *user_data;
22-
23-
} xqc_hq_conn_s;
24-
25-
2614
xqc_hq_conn_t *
2715
xqc_hq_conn_create(xqc_connection_t *conn, const xqc_cid_t *cid, void *user_data)
2816
{
@@ -31,7 +19,12 @@ xqc_hq_conn_create(xqc_connection_t *conn, const xqc_cid_t *cid, void *user_data
3119
return NULL;
3220
}
3321

34-
if (xqc_hq_ctx_get_conn_callbacks(&hqc->hqc_cbs) != XQC_OK) {
22+
xqc_hq_callbacks_t *hq_cbs = NULL;
23+
xqc_int_t ret;
24+
25+
ret = xqc_hq_ctx_get_callbacks(conn->engine, conn->alpn, conn->alpn_len, &hq_cbs);
26+
27+
if (ret != XQC_OK || hq_cbs == NULL) {
3528
PRINT_LOG("|create hq conn failed");
3629
xqc_free(hqc);
3730
return NULL;
@@ -40,6 +33,10 @@ xqc_hq_conn_create(xqc_connection_t *conn, const xqc_cid_t *cid, void *user_data
4033
hqc->user_data = user_data;
4134
hqc->log = conn->log;
4235
hqc->conn = conn;
36+
hqc->hqc_cbs = hq_cbs->hqc_cbs;
37+
hqc->hqr_cbs = hq_cbs->hqr_cbs;
38+
39+
xqc_conn_set_alp_user_data(conn, hqc);
4340

4441
return hqc;
4542
}
@@ -53,22 +50,7 @@ xqc_hq_conn_destroy(xqc_hq_conn_t *hqc)
5350
}
5451
}
5552

56-
57-
xqc_hq_conn_t *
58-
xqc_hq_conn_create_passive(xqc_connection_t *conn, const xqc_cid_t *cid)
59-
{
60-
xqc_hq_conn_t *hqc = xqc_hq_conn_create(conn, cid, NULL);
61-
if (NULL == hqc) {
62-
PRINT_LOG("|create hq conn failed");
63-
return NULL;
64-
}
65-
66-
xqc_conn_set_alp_user_data(conn, hqc);
67-
return hqc;
68-
}
69-
70-
71-
xqc_hq_conn_t *
53+
const xqc_cid_t*
7254
xqc_hq_connect(xqc_engine_t *engine, const xqc_conn_settings_t *conn_settings,
7355
const unsigned char *token, unsigned token_len, const char *server_host, int no_crypto_flag,
7456
const xqc_conn_ssl_config_t *conn_ssl_config, const struct sockaddr *peer_addr,
@@ -78,18 +60,8 @@ xqc_hq_connect(xqc_engine_t *engine, const xqc_conn_settings_t *conn_settings,
7860
const xqc_cid_t *cid = xqc_connect(engine, conn_settings, token, token_len, server_host,
7961
no_crypto_flag, conn_ssl_config, peer_addr, peer_addrlen,
8062
xqc_hq_alpn[conn_settings->proto_version], user_data);
81-
if (cid == NULL) {
82-
return NULL;
83-
}
84-
85-
xqc_hq_conn_t *hqc = xqc_hq_conn_create(xqc_engine_conns_hash_find(engine, cid, 's'),
86-
cid, user_data);
87-
if (NULL == hqc) {
88-
xqc_conn_close(engine, cid);
89-
return NULL;
90-
}
9163

92-
return hqc;
64+
return cid;
9365
}
9466

9567

@@ -125,12 +97,9 @@ xqc_hq_conn_create_notify(xqc_connection_t *conn, const xqc_cid_t *cid,
12597
return -XQC_EMALLOC;
12698
}
12799

128-
/* set hqc as conn's application-layer-protocol user_data */
129-
xqc_conn_set_alp_user_data(conn, hqc);
130-
131-
if (hqc->hqc_cbs->conn_create_notify) {
100+
if (hqc->hqc_cbs.conn_create_notify) {
132101
/* NOTICE: if hqc is created passively, hqc->user_data is NULL */
133-
return hqc->hqc_cbs->conn_create_notify(hqc, cid, hqc->user_data);
102+
return hqc->hqc_cbs.conn_create_notify(hqc, cid, hqc->user_data);
134103
}
135104

136105
return XQC_OK;
@@ -143,8 +112,8 @@ xqc_hq_conn_close_notify(xqc_connection_t *conn, const xqc_cid_t *cid,
143112
xqc_int_t ret = XQC_OK;
144113

145114
xqc_hq_conn_t *hqc = (xqc_hq_conn_t *)conn_proto_data;
146-
if (hqc->hqc_cbs->conn_close_notify) {
147-
ret = hqc->hqc_cbs->conn_close_notify(hqc, cid, hqc->user_data);
115+
if (hqc->hqc_cbs.conn_close_notify) {
116+
ret = hqc->hqc_cbs.conn_close_notify(hqc, cid, hqc->user_data);
148117
if (ret != XQC_OK) {
149118
return ret;
150119
}

demo/xqc_hq_conn.h

+13
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,19 @@
77

88
#include "xqc_hq.h"
99

10+
typedef struct xqc_hq_conn_s {
11+
12+
xqc_hq_conn_callbacks_t hqc_cbs;
13+
xqc_hq_request_callbacks_t hqr_cbs;
14+
15+
xqc_connection_t *conn;
16+
17+
xqc_log_t *log;
18+
19+
void *user_data;
20+
21+
} xqc_hq_conn_s;
22+
1023
extern const xqc_conn_callbacks_t hq_conn_callbacks;
1124

1225
#endif

0 commit comments

Comments
 (0)