Skip to content

Commit 72f31ab

Browse files
authored
Merge pull request #319 from Tencent/release/v0.14.0
Release/v0.14.0
2 parents 7c1793c + 52d8e9e commit 72f31ab

File tree

18 files changed

+460
-205
lines changed

18 files changed

+460
-205
lines changed

CHANGELOG.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,22 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
1111
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
1212

1313

14+
## [v0.14.0] - 2024-07-11
15+
16+
### Added
17+
- Update config API for congestion control
18+
- Update cbindgen.toml and the generated header file
19+
- Tweak comments for application protos in FFI
20+
21+
### Changed
22+
- Rename enum members of `quic_multipath_algorithm` in `tquic.h`
23+
24+
### Fixed
25+
- Fix stream operations that should mark conn as tickable
26+
- Fix the issue with sending MAX_DATA frames
27+
- Fix the issue with pacer timer that occasionally leads to a connection timeout error
28+
29+
1430
## [v0.13.0] - 2024-06-25
1531

1632
### Added
@@ -246,6 +262,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
246262
- Provide example clients and servers.
247263

248264

265+
[v0.14.0]: https://github.com/tencent/tquic/compare/v0.13.0...v0.14.0
249266
[v0.13.0]: https://github.com/tencent/tquic/compare/v0.12.0...v0.13.0
250267
[v0.12.0]: https://github.com/tencent/tquic/compare/v0.11.0...v0.12.0
251268
[v0.11.0]: https://github.com/tencent/tquic/compare/v0.10.0...v0.11.0

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "tquic"
3-
version = "0.13.0"
3+
version = "0.14.0"
44
edition = "2021"
55
rust-version = "1.70.0"
66
license = "Apache-2.0"

cbindgen.toml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ documentation = true
1616

1717
# A list of headers to #include (with quotes)
1818
sys_includes = ["sys/socket.h", "sys/types.h"]
19-
includes = ["openssl/ssl.h"]
19+
includes = ["openssl/ssl.h", "tquic_def.h"]
2020

2121
[export]
22-
exclude = ["MAX_CID_LEN", "MIN_CLIENT_INITIAL_LEN"]
22+
exclude = ["MAX_CID_LEN", "MIN_CLIENT_INITIAL_LEN", "VINT_MAX"]
2323

2424
[export.rename]
2525
"Config" = "quic_config_t"
@@ -42,6 +42,7 @@ exclude = ["MAX_CID_LEN", "MIN_CLIENT_INITIAL_LEN"]
4242
"TlsConfigSelectMethods" = "quic_tls_config_select_methods_t"
4343
"TlsConfigSelectorContext" = "quic_tls_config_select_context_t"
4444
"CongestionControlAlgorithm" = "quic_congestion_control_algorithm"
45+
"MultipathAlgorithm" = "quic_multipath_algorithm"
4546
"LevelFilter" = "quic_log_level"
4647
"Http3Connection" = "http3_conn_t"
4748
"Http3Config" = "http3_config_t"

include/tquic.h

Lines changed: 60 additions & 125 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#include <sys/socket.h>
1111
#include <sys/types.h>
1212
#include "openssl/ssl.h"
13+
#include "tquic_def.h"
1314

1415
/**
1516
* The current QUIC wire version.
@@ -22,13 +23,13 @@
2223
#define QUIC_VERSION_V1 1
2324

2425
/**
25-
* Available congestion control algorithm
26+
* Available congestion control algorithms.
2627
*/
2728
typedef enum quic_congestion_control_algorithm {
2829
/**
2930
* CUBIC uses a cubic function instead of a linear window increase function
3031
* of the current TCP standards to improve scalability and stability under
31-
* fast and long-distance networks..
32+
* fast and long-distance networks.
3233
*/
3334
QUIC_CONGESTION_CONTROL_ALGORITHM_CUBIC,
3435
/**
@@ -52,6 +53,11 @@ typedef enum quic_congestion_control_algorithm {
5253
* (Experimental)
5354
*/
5455
QUIC_CONGESTION_CONTROL_ALGORITHM_COPA,
56+
/**
57+
* Dummy is a simple congestion controller with a static congestion window.
58+
* It is intended to be used for testing and experiments.
59+
*/
60+
QUIC_CONGESTION_CONTROL_ALGORITHM_DUMMY,
5561
} quic_congestion_control_algorithm;
5662

5763
/**
@@ -64,7 +70,7 @@ typedef enum quic_multipath_algorithm {
6470
* load balancing, making it particularly advantageous for bulk transfer
6571
* applications in heterogeneous networks.
6672
*/
67-
MULTIPATH_ALGORITHM_MIN_RTT,
73+
QUIC_MULTIPATH_ALGORITHM_MIN_RTT,
6874
/**
6975
* The scheduler sends all packets redundantly on all available paths. It
7076
* utilizes additional bandwidth to minimize latency, thereby reducing the
@@ -74,14 +80,14 @@ typedef enum quic_multipath_algorithm {
7480
* present, it ensures a goodput at least equivalent to the best single
7581
* path.
7682
*/
77-
MULTIPATH_ALGORITHM_REDUNDANT,
83+
QUIC_MULTIPATH_ALGORITHM_REDUNDANT,
7884
/**
7985
* The scheduler sends packets over available paths in a round robin
8086
* manner. It aims to fully utilize the capacity of each path as the
8187
* distribution across all path is equal. It is only used for testing
8288
* purposes.
8389
*/
84-
MULTIPATH_ALGORITHM_ROUND_ROBIN,
90+
QUIC_MULTIPATH_ALGORITHM_ROUND_ROBIN,
8591
} quic_multipath_algorithm;
8692

8793
/**
@@ -358,7 +364,6 @@ void enable_dplpmtud(struct quic_config_t *config, bool v);
358364
/**
359365
* Set the maximum outgoing UDP payload size in bytes.
360366
* It corresponds to the maximum datagram size that DPLPMTUD tries to discovery.
361-
*
362367
* The default value is `1200` which means let DPLPMTUD choose a value.
363368
*/
364369
void quic_config_set_send_udp_payload_size(struct quic_config_t *config, uintptr_t v);
@@ -430,6 +435,42 @@ void quic_config_set_initial_congestion_window(struct quic_config_t *config, uin
430435
*/
431436
void quic_config_set_min_congestion_window(struct quic_config_t *config, uint64_t v);
432437

438+
/**
439+
* Set the threshold for slow start in packets.
440+
* The default value is the maximum value of u64.
441+
*/
442+
void quic_config_set_slow_start_thresh(struct quic_config_t *config, uint64_t v);
443+
444+
/**
445+
* Set the minimum duration for BBR ProbeRTT state in milliseconds.
446+
* The default value is 200 milliseconds.
447+
*/
448+
void quic_config_set_bbr_probe_rtt_duration(struct quic_config_t *config, uint64_t v);
449+
450+
/**
451+
* Enable using a cwnd based on bdp during ProbeRTT state.
452+
* The default value is false.
453+
*/
454+
void quic_config_enable_bbr_probe_rtt_based_on_bdp(struct quic_config_t *config, bool v);
455+
456+
/**
457+
* Set the cwnd gain for BBR ProbeRTT state.
458+
* The default value is 0.75
459+
*/
460+
void quic_config_set_bbr_probe_rtt_cwnd_gain(struct quic_config_t *config, double v);
461+
462+
/**
463+
* Set the length of the BBR RTProp min filter window in milliseconds.
464+
* The default value is 10000 milliseconds.
465+
*/
466+
void quic_config_set_bbr_rtprop_filter_len(struct quic_config_t *config, uint64_t v);
467+
468+
/**
469+
* Set the cwnd gain for BBR ProbeBW state.
470+
* The default value is 2.0
471+
*/
472+
void quic_config_set_bbr_probe_bw_cwnd_gain(struct quic_config_t *config, double v);
473+
433474
/**
434475
* Set the initial RTT in milliseconds. The default value is 333ms.
435476
* The configuration should be changed with caution. Setting a value less than the default
@@ -562,6 +603,7 @@ struct quic_tls_config_t *quic_tls_config_new_with_ssl_ctx(SSL_CTX *ssl_ctx);
562603
* Create a new client side TlsConfig.
563604
* The caller is responsible for the memory of the TlsConfig and should properly
564605
* destroy it by calling `quic_tls_config_free`.
606+
* For more information about `protos`, please see `quic_tls_config_set_application_protos`.
565607
*/
566608
struct quic_tls_config_t *quic_tls_config_new_client_config(const char *const *protos,
567609
intptr_t proto_num,
@@ -571,6 +613,7 @@ struct quic_tls_config_t *quic_tls_config_new_client_config(const char *const *p
571613
* Create a new server side TlsConfig.
572614
* The caller is responsible for the memory of the TlsConfig and should properly
573615
* destroy it by calling `quic_tls_config_free`.
616+
* For more information about `protos`, please see `quic_tls_config_set_application_protos`.
574617
*/
575618
struct quic_tls_config_t *quic_tls_config_new_server_config(const char *cert_file,
576619
const char *key_file,
@@ -590,6 +633,9 @@ void quic_tls_config_set_early_data_enabled(struct quic_tls_config_t *tls_config
590633

591634
/**
592635
* Set the list of supported application protocols.
636+
* The `protos` is a pointer that points to an array, where each element of the array is a string
637+
* pointer representing an application protocol identifier. For example, you can define it as
638+
* follows: const char* const protos[2] = {"h3", "http/0.9"}.
593639
*/
594640
int quic_tls_config_set_application_protos(struct quic_tls_config_t *tls_config,
595641
const char *const *protos,
@@ -1115,6 +1161,13 @@ int64_t http3_stream_new_with_priority(struct http3_conn_t *conn,
11151161
struct quic_conn_t *quic_conn,
11161162
const struct http3_priority_t *priority);
11171163

1164+
/**
1165+
* Close the given HTTP/3 stream.
1166+
*/
1167+
int http3_stream_close(struct http3_conn_t *conn,
1168+
struct quic_conn_t *quic_conn,
1169+
uint64_t stream_id);
1170+
11181171
/**
11191172
* Set priority for an HTTP/3 stream.
11201173
*/
@@ -1123,13 +1176,6 @@ int http3_stream_set_priority(struct http3_conn_t *conn,
11231176
uint64_t stream_id,
11241177
const struct http3_priority_t *priority);
11251178

1126-
/**
1127-
* Close the given HTTP/3 stream.
1128-
*/
1129-
int http3_stream_close(struct http3_conn_t *conn,
1130-
struct quic_conn_t *quic_conn,
1131-
uint64_t stream_id);
1132-
11331179
/**
11341180
* Send HTTP/3 request or response headers on the given stream.
11351181
*/
@@ -1185,128 +1231,17 @@ int http3_take_priority_update(struct http3_conn_t *conn,
11851231
void *argp),
11861232
void *argp);
11871233

1188-
/**
1189-
* An enum representing the available verbosity level filters of the logger.
1190-
*/
1191-
typedef enum quic_log_level {
1192-
/**
1193-
* A level lower than all log levels.
1194-
*/
1195-
QUIC_LOG_LEVEL_OFF,
1196-
/**
1197-
* Corresponds to the `Error` log level.
1198-
*/
1199-
QUIC_LOG_LEVEL_ERROR,
1200-
/**
1201-
* Corresponds to the `Warn` log level.
1202-
*/
1203-
QUIC_LOG_LEVEL_WARN,
1204-
/**
1205-
* Corresponds to the `Info` log level.
1206-
*/
1207-
QUIC_LOG_LEVEL_INFO,
1208-
/**
1209-
* Corresponds to the `Debug` log level.
1210-
*/
1211-
QUIC_LOG_LEVEL_DEBUG,
1212-
/**
1213-
* Corresponds to the `Trace` log level.
1214-
*/
1215-
QUIC_LOG_LEVEL_TRACE,
1216-
} quic_log_level;
1217-
12181234
/**
12191235
* Set logger.
12201236
* `cb` is a callback function that will be called for each log message.
1221-
* `line` is a null-terminated log message and `argp` is user-defined data that will be passed to
1237+
* `data` is a '\n' terminated log message and `argp` is user-defined data that will be passed to
12221238
* the callback.
12231239
* `level` represents the log level.
12241240
*/
12251241
void quic_set_logger(void (*cb)(const uint8_t *data, size_t data_len, void *argp),
12261242
void *argp,
12271243
quic_log_level level);
12281244

1229-
typedef enum http3_error {
1230-
HTTP3_NO_ERROR = 0,
1231-
1232-
// There is no error or no work to do
1233-
HTTP3_ERR_DONE = -1,
1234-
1235-
// The endpoint detected an error in the protocol
1236-
HTTP3_ERR_GENERAL_PROTOCOL_ERROR = -2,
1237-
1238-
// The endpoint encountered an internal error and cannot continue with the
1239-
// connection
1240-
HTTP3_ERR_INTERNAL_ERROR = -3,
1241-
1242-
// The endpoint detected that its peer created a stream that it will not
1243-
// accept
1244-
HTTP3_ERR_STREAM_CREATION_ERROR = -4,
1245-
1246-
// A stream required by the connection was closed or reset
1247-
HTTP3_ERR_CLOSED_CRITICAL_STREAM = -5,
1248-
1249-
// A frame was received which is not permitted in the current state or on
1250-
// the current stream
1251-
HTTP3_ERR_FRAME_UNEXPECTED = -6,
1252-
1253-
// A frame that fails to satisfy layout requirements or with an invalid
1254-
// size was received
1255-
HTTP3_ERR_FRAME_ERROR = -7,
1256-
1257-
// The endpoint detected that its peer is exhibiting a behavior that might
1258-
// be generating excessive load
1259-
HTTP3_ERR_EXCESSIVE_LOAD = -8,
1260-
1261-
// A stream ID or push ID was used incorrectly, such as exceeding a limit,
1262-
// reducing a limit, or being reused
1263-
HTTP3_ERR_ID_ERROR = -9,
1264-
1265-
// An endpoint detected an error in the payload of a SETTINGS frame
1266-
HTTP3_ERR_SETTINGS_ERROR = -10,
1267-
1268-
// No SETTINGS frame was received at the beginning of the control stream
1269-
HTTP3_ERR_MISSING_SETTINGS = -11,
1270-
1271-
// -12 reserved
1272-
1273-
// The stream is blocked
1274-
HTTP3_ERR_STREAM_BLOCKED = -13,
1275-
1276-
// The server rejected the request without performing any application
1277-
// processing
1278-
HTTP3_ERR_REQUEST_REJECTED = -14,
1279-
1280-
// The request or its response (including pushed response) is cancelled
1281-
HTTP3_ERR_REQUEST_CANCELLED = -15,
1282-
1283-
// The client's stream terminated without containing a fully-formed request
1284-
HTTP3_ERR_REQUEST_INCOMPLETE = -16,
1285-
1286-
// An HTTP message was malformed and cannot be processed
1287-
HTTP3_ERR_MESSAGE_ERROR = -17,
1288-
1289-
// The TCP connection established in response to a CONNECT request was
1290-
// reset or abnormally closed
1291-
HTTP3_ERR_CONNECT_ERROR = -18,
1292-
1293-
// The requested operation cannot be served over HTTP/3. The peer should
1294-
// retry over HTTP/1.1
1295-
HTTP3_ERR_VERSION_FALLBACK = -19,
1296-
1297-
// The decoder failed to interpret an encoded field section and is not
1298-
// able to continue decoding that field section
1299-
HTTP3_ERR_QPACK_DECOMPRESSION_FAILED = -20,
1300-
1301-
// The decoder failed to interpret an encoder instruction received on the
1302-
// encoder stream
1303-
HTTP3_ERR_QPACK_ENCODER_STREAM_ERROR = -21,
1304-
1305-
// The encoder failed to interpret a decoder instruction received on the
1306-
// decoder stream
1307-
HTTP3_ERR_QPACK_DECODER_STREAM_ERROR = -22,
1308-
} http3_error;
1309-
13101245
#ifdef __cplusplus
13111246
} // extern "C"
13121247
#endif // __cplusplus

0 commit comments

Comments
 (0)