Skip to content

Commit b36c1ef

Browse files
authored
Dev/doc (#463)
* [+] add mini testfile * [+] add mini c/s * [+] server reply if receives a req * [=] fix mini format * [=] format code * [=] fix comment format * [=] fix comment format * [=] fix diff * [=] fix mini_server * [=] delete global param * [=] fix global param err
1 parent 7ba7e92 commit b36c1ef

23 files changed

+3400
-480
lines changed

CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,7 @@ endif()
169169
if(XQC_ENABLE_TESTING)
170170
add_subdirectory(tests)
171171
add_subdirectory(demo)
172+
add_subdirectory(mini)
172173
endif(XQC_ENABLE_TESTING)
173174

174175

demo/CMakeLists.txt

+6
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,22 @@ set(
55
"xqc_hq_conn.c"
66
"xqc_hq_request.c"
77
)
8+
set(
9+
TEST_PLATFORM_SOURCES
10+
"../tests/platform.c"
11+
)
812

913
set(
1014
DEMO_CLIENT_SOURCES
1115
${HQ_SOURCES}
16+
${TEST_PLATFORM_SOURCES}
1217
"demo_client.c"
1318
)
1419

1520
set(
1621
DEMO_SERVER_SOURCES
1722
${HQ_SOURCES}
23+
${TEST_PLATFORM_SOURCES}
1824
"demo_server.c"
1925
)
2026

demo/demo_client.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -892,7 +892,7 @@ xqc_demo_cli_conn_create_path(const xqc_cid_t *cid, void *conn_user_data)
892892
printf("set No.%d path (id = %"PRIu64") to STANDBY state\n", 1, path_id);
893893
xqc_conn_mark_path_standby(ctx->engine, &(user_conn->cid), path_id);
894894
}
895-
895+
896896
}
897897
}
898898

@@ -2225,7 +2225,7 @@ xqc_demo_cli_send_h3_req(xqc_demo_cli_user_conn_t *user_conn,
22252225
if (req_create_cnt == user_conn->ctx->args->req_cfg.throttled_req) {
22262226
settings.recv_rate_bytes_per_sec = user_conn->ctx->args->quic_cfg.recv_rate;
22272227
}
2228-
2228+
22292229
if (req_create_cnt != 0
22302230
&& user_conn->ctx->args->req_cfg.throttled_req != 0
22312231
&& (req_create_cnt % user_conn->ctx->args->req_cfg.throttled_req) == 0)

include/xquic/xqc_errno.h

+135-129
Large diffs are not rendered by default.

include/xquic/xqc_http3.h

+73-56
Original file line numberDiff line numberDiff line change
@@ -17,20 +17,22 @@ extern "C" {
1717
* @brief read flag of xqc_h3_request_read_notify_pt
1818
*/
1919
typedef enum {
20-
/* nothing readable */
20+
/** nothing readable */
2121
XQC_REQ_NOTIFY_READ_NULL = 0,
2222

23-
/* read header section flag, this will be set when the first HEADERS is processed */
23+
/** read header section flag, this will be set when the first HEADERS is processed */
2424
XQC_REQ_NOTIFY_READ_HEADER = 1 << 0,
2525

26-
/* read body flag, this will be set when a DATA frame is processed */
26+
/** read body flag, this will be set when a DATA frame is processed */
2727
XQC_REQ_NOTIFY_READ_BODY = 1 << 1,
2828

29-
/* read trailer section flag, this will be set when trailer HEADERS frame is processed */
29+
/** read trailer section flag, this will be set when trailer HEADERS frame is processed */
3030
XQC_REQ_NOTIFY_READ_TRAILER = 1 << 2,
3131

32-
/* read empty fin flag, notify callback will be triggered when a single fin frame is received
33-
while HEADERS and DATA were notified. This flag will NEVER be set with other flags */
32+
/**
33+
* read empty fin flag, notify callback will be triggered when a single fin frame is received
34+
while HEADERS and DATA were notified. This flag will NEVER be set with other flags
35+
*/
3436
XQC_REQ_NOTIFY_READ_EMPTY_FIN = 1 << 3,
3537
} xqc_request_notify_flag_t;
3638

@@ -88,28 +90,28 @@ typedef enum xqc_http3_nv_flag_s {
8890

8991

9092
typedef struct xqc_http_header_s {
91-
/* name of http header */
93+
/** name of http header */
9294
struct iovec name;
9395

94-
/* value of http header */
96+
/** value of http header */
9597
struct iovec value;
9698

97-
/* flags of xqc_http3_nv_flag_t with OR operator */
99+
/** flags of xqc_http3_nv_flag_t with OR operator */
98100
uint8_t flags;
99101
} xqc_http_header_t;
100102

101103

102104
typedef struct xqc_http_headers_s {
103-
/* array of http headers */
105+
/** array of http headers */
104106
xqc_http_header_t *headers;
105107

106-
/* count of headers */
108+
/** count of headers */
107109
size_t count;
108110

109-
/* capacity of headers */
111+
/** capacity of headers */
110112
size_t capacity;
111113

112-
/* total byte count of headers */
114+
/** total byte count of headers */
113115
size_t total_len;
114116
} xqc_http_headers_t;
115117

@@ -122,19 +124,32 @@ typedef struct xqc_http_headers_s {
122124
typedef struct xqc_request_stats_s {
123125
size_t send_body_size;
124126
size_t recv_body_size;
125-
size_t send_header_size; /* plaintext header size */
126-
size_t recv_header_size; /* plaintext header size */
127-
size_t send_hdr_compressed; /* compressed header size */
128-
size_t recv_hdr_compressed; /* compressed header size */
129-
int stream_err; /* QUIC layer error code, 0 for no error */
130-
xqc_usec_t blocked_time; /* time of h3 stream being blocked */
131-
xqc_usec_t unblocked_time; /* time of h3 stream being unblocked */
132-
xqc_usec_t stream_fin_time; /* time of receiving transport fin */
133-
xqc_usec_t h3r_begin_time; /* time of creating request */
134-
xqc_usec_t h3r_end_time; /* time of request fin */
135-
xqc_usec_t h3r_header_begin_time; /* time of receiving HEADERS frame */
136-
xqc_usec_t h3r_header_end_time; /* time of finishing processing HEADERS frame */
137-
xqc_usec_t h3r_body_begin_time; /* time of receiving DATA frame */
127+
/** plaintext header size */
128+
size_t send_header_size;
129+
/** plaintext header size */
130+
size_t recv_header_size;
131+
/** compressed header size */
132+
size_t send_hdr_compressed;
133+
/** compressed header size */
134+
size_t recv_hdr_compressed;
135+
/** QUIC layer error code, 0 for no error */
136+
int stream_err;
137+
/** time of h3 stream being blocked */
138+
xqc_usec_t blocked_time;
139+
/** time of h3 stream being unblocked */
140+
xqc_usec_t unblocked_time;
141+
/** time of receiving transport fin */
142+
xqc_usec_t stream_fin_time;
143+
/** time of creating request */
144+
xqc_usec_t h3r_begin_time;
145+
/** time of request fin */
146+
xqc_usec_t h3r_end_time;
147+
/** time of receiving HEADERS frame */
148+
xqc_usec_t h3r_header_begin_time;
149+
/** time of finishing processing HEADERS frame */
150+
xqc_usec_t h3r_header_end_time;
151+
/** time of receiving DATA frame */
152+
xqc_usec_t h3r_body_begin_time;
138153
xqc_usec_t h3r_header_send_time;
139154
xqc_usec_t h3r_body_send_time;
140155
xqc_usec_t stream_fin_send_time;
@@ -171,7 +186,7 @@ typedef struct xqc_request_stats_s {
171186
/**
172187
* @brief how long the request was blocked by congestion control (ms)
173188
*/
174-
xqc_msec_t cwnd_blocked_ms;
189+
xqc_msec_t cwnd_blocked_ms;
175190
/**
176191
* @brief the number of packet has been retransmitted
177192
*/
@@ -209,25 +224,27 @@ typedef struct xqc_h3_ext_bytestream_stats_s {
209224
xqc_usec_t first_byte_rcvd_time;
210225
} xqc_h3_ext_bytestream_stats_t;
211226

212-
/* connection settings for http3 */
227+
/**
228+
* @brief connection settings for http3
229+
*/
213230
typedef struct xqc_h3_conn_settings_s {
214-
/* MAX_FIELD_SECTION_SIZE of http3 */
231+
/** MAX_FIELD_SECTION_SIZE of http3 */
215232
uint64_t max_field_section_size;
216233

217-
/* MAX_PUSH_STREAMS */
234+
/** MAX_PUSH_STREAMS */
218235
uint64_t max_pushes;
219236

220-
/* ENC_MAX_DYNAMIC_TABLE_CAPACITY */
237+
/** ENC_MAX_DYNAMIC_TABLE_CAPACITY */
221238
uint64_t qpack_enc_max_table_capacity;
222239

223-
/* DEC_MAX_DYNAMIC_TABLE_CAPACITY */
240+
/** DEC_MAX_DYNAMIC_TABLE_CAPACITY */
224241
uint64_t qpack_dec_max_table_capacity;
225242

226-
/* MAX_BLOCKED_STREAMS */
243+
/** MAX_BLOCKED_STREAMS */
227244
uint64_t qpack_blocked_streams;
228245

229246
#ifdef XQC_COMPAT_DUPLICATE
230-
/* compat with the original qpack encoder's duplicate strategy */
247+
/** compat with the original qpack encoder's duplicate strategy */
231248
xqc_bool_t qpack_compat_duplicate;
232249
#endif
233250

@@ -316,16 +333,16 @@ typedef void (*xqc_h3_ext_datagram_mss_updated_notify_pt)(xqc_h3_conn_t *conn,
316333

317334
typedef struct xqc_h3_ext_dgram_callbacks_s {
318335

319-
/* the return value is ignored by XQUIC stack */
336+
/** the return value is ignored by XQUIC stack */
320337
xqc_h3_ext_datagram_read_notify_pt dgram_read_notify;
321338

322-
/* the return value is ignored by XQUIC stack */
339+
/** the return value is ignored by XQUIC stack */
323340
xqc_h3_ext_datagram_write_notify_pt dgram_write_notify;
324341

325-
/* the return value is ignored by XQUIC stack */
342+
/** the return value is ignored by XQUIC stack */
326343
xqc_h3_ext_datagram_acked_notify_pt dgram_acked_notify;
327344

328-
/* the return value is ignored by XQUIC stack */
345+
/** the return value is ignored by XQUIC stack */
329346
xqc_h3_ext_datagram_lost_notify_pt dgram_lost_notify;
330347
xqc_h3_ext_datagram_mss_updated_notify_pt dgram_mss_updated_notify;
331348

@@ -335,16 +352,16 @@ typedef struct xqc_h3_ext_dgram_callbacks_s {
335352
* @brief http3 connection callbacks for application layer
336353
*/
337354
typedef struct xqc_h3_conn_callbacks_s {
338-
/* http3 connection creation callback, REQUIRED for server, OPTIONAL for client */
355+
/** http3 connection creation callback, REQUIRED for server, OPTIONAL for client */
339356
xqc_h3_conn_notify_pt h3_conn_create_notify;
340357

341-
/* http3 connection close callback */
358+
/** http3 connection close callback */
342359
xqc_h3_conn_notify_pt h3_conn_close_notify;
343360

344-
/* handshake finished callback. which will be triggered when HANDSHAKE_DONE is received */
361+
/** handshake finished callback. which will be triggered when HANDSHAKE_DONE is received */
345362
xqc_h3_handshake_finished_pt h3_conn_handshake_finished;
346363

347-
/* ping callback. which will be triggered when ping is acked */
364+
/** ping callback. which will be triggered when ping is acked */
348365
xqc_h3_conn_ping_ack_notify_pt h3_conn_ping_acked; /* optional */
349366

350367
} xqc_h3_conn_callbacks_t;
@@ -354,53 +371,53 @@ typedef struct xqc_h3_conn_callbacks_s {
354371
* @brief http3 request callbacks for application layer
355372
*/
356373
typedef struct xqc_h3_request_callbacks_s {
357-
/* request creation notify. it will be triggered after a request was created, and is required
374+
/** request creation notify. it will be triggered after a request was created, and is required
358375
for server, optional for client */
359376
xqc_h3_request_notify_pt h3_request_create_notify;
360377

361-
/* request close notify. which will be triggered after a request was closed */
378+
/** request close notify. which will be triggered after a request was closed */
362379
xqc_h3_request_notify_pt h3_request_close_notify;
363380

364-
/* request read notify callback. which will be triggered after received http headers or body */
381+
/** request read notify callback. which will be triggered after received http headers or body */
365382
xqc_h3_request_read_notify_pt h3_request_read_notify;
366383

367-
/* request write notify callback. when triggered, users can continue to send headers or body */
384+
/** request write notify callback. when triggered, users can continue to send headers or body */
368385
xqc_h3_request_notify_pt h3_request_write_notify;
369386

370-
/* request closing notify callback, will be triggered when request is closing */
387+
/** request closing notify callback, will be triggered when request is closing */
371388
xqc_h3_request_closing_notify_pt h3_request_closing_notify;
372389

373390
} xqc_h3_request_callbacks_t;
374391

375392
typedef struct xqc_h3_ext_bytestream_callbacks_s {
376393

377-
/* the return value is ignored by XQUIC stack */
394+
/** the return value is ignored by XQUIC stack */
378395
xqc_h3_ext_bytestream_notify_pt bs_create_notify;
379396

380-
/* the return value is ignored by XQUIC stack */
397+
/** the return value is ignored by XQUIC stack */
381398
xqc_h3_ext_bytestream_notify_pt bs_close_notify;
382399

383-
/* negative return values will cause the connection to be closed */
400+
/** negative return values will cause the connection to be closed */
384401
xqc_h3_ext_bytestream_read_notify_pt bs_read_notify;
385402

386-
/* negative return values will cause the connection to be closed */
403+
/** negative return values will cause the connection to be closed */
387404
xqc_h3_ext_bytestream_notify_pt bs_write_notify;
388405

389406
} xqc_h3_ext_bytestream_callbacks_t;
390407

391408

392409
typedef struct xqc_h3_callbacks_s {
393410

394-
/* http3 connection callbacks */
411+
/** http3 connection callbacks */
395412
xqc_h3_conn_callbacks_t h3c_cbs;
396413

397-
/* http3 request callbacks */
414+
/** http3 request callbacks */
398415
xqc_h3_request_callbacks_t h3r_cbs;
399416

400-
/* datagram callbacks */
417+
/** datagram callbacks */
401418
xqc_h3_ext_dgram_callbacks_t h3_ext_dgram_cbs;
402419

403-
/* bytestream callbacks */
420+
/** bytestream callbacks */
404421
xqc_h3_ext_bytestream_callbacks_t h3_ext_bs_cbs;
405422

406423
} xqc_h3_callbacks_t;
@@ -496,7 +513,7 @@ void xqc_h3_engine_set_local_settings(xqc_engine_t *engine,
496513
* @brief create and http3 connection
497514
*
498515
* @param engine return from xqc_engine_create
499-
* @param conn_settings connection settings
516+
* @param conn_settings Include all the connection settings, which should be customized according to the actual needs, and will be defaultly set to internal_default_conn_settings if not specified.
500517
* @param token token receive from server, xqc_save_token_pt callback
501518
* @param token_len length of token
502519
* @param server_host server domain

0 commit comments

Comments
 (0)