| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -81,6 +81,59 @@ extern "C" { | |||
| 81 | 81 | */ | |
| 82 | 82 | typedef ptrdiff_t nghttp3_ssize; | |
| 83 | 83 | ||
| 84 | + /** | ||
| 85 | + * @typedef | ||
| 86 | + * | ||
| 87 | + * :type:`nghttp3_tstamp` is a timestamp with nanosecond resolution. | ||
| 88 | + * ``UINT64_MAX`` is an invalid value, and it is often used to | ||
| 89 | + * indicate that no value is set. This type is available since | ||
| 90 | + * v1.12.0. | ||
| 91 | + */ | ||
| 92 | + typedef uint64_t nghttp3_tstamp; | ||
| 93 | + | ||
| 94 | + /** | ||
| 95 | + * @typedef | ||
| 96 | + * | ||
| 97 | + * :type:`nghttp3_duration` is a period of time in nanosecond | ||
| 98 | + * resolution. ``UINT64_MAX`` is an invalid value, and it is often | ||
| 99 | + * used to indicate that no value is set. This type is available | ||
| 100 | + * since v1.12.0. | ||
| 101 | + */ | ||
| 102 | + typedef uint64_t nghttp3_duration; | ||
| 103 | + | ||
| 104 | + /** | ||
| 105 | + * @macro | ||
| 106 | + * | ||
| 107 | + * :macro:`NGHTTP3_NANOSECONDS` is a count of tick which corresponds | ||
| 108 | + * to 1 nanosecond. This macro is available since v1.12.0. | ||
| 109 | + */ | ||
| 110 | + #define NGHTTP3_NANOSECONDS ((nghttp3_duration)1ULL) | ||
| 111 | + | ||
| 112 | + /** | ||
| 113 | + * @macro | ||
| 114 | + * | ||
| 115 | + * :macro:`NGHTTP3_MICROSECONDS` is a count of tick which corresponds | ||
| 116 | + * to 1 microsecond. This macro is available since v1.12.0. | ||
| 117 | + */ | ||
| 118 | + #define NGHTTP3_MICROSECONDS ((nghttp3_duration)(1000ULL * NGHTTP3_NANOSECONDS)) | ||
| 119 | + | ||
| 120 | + /** | ||
| 121 | + * @macro | ||
| 122 | + * | ||
| 123 | + * :macro:`NGHTTP3_MILLISECONDS` is a count of tick which corresponds | ||
| 124 | + * to 1 millisecond. This macro is available since v1.12.0. | ||
| 125 | + */ | ||
| 126 | + #define NGHTTP3_MILLISECONDS \ | ||
| 127 | + ((nghttp3_duration)(1000ULL * NGHTTP3_MICROSECONDS)) | ||
| 128 | + | ||
| 129 | + /** | ||
| 130 | + * @macro | ||
| 131 | + * | ||
| 132 | + * :macro:`NGHTTP3_SECONDS` is a count of tick which corresponds to 1 | ||
| 133 | + * second. This macro is available since v1.12.0. | ||
| 134 | + */ | ||
| 135 | + #define NGHTTP3_SECONDS ((nghttp3_duration)(1000ULL * NGHTTP3_MILLISECONDS)) | ||
| 136 | + | ||
| 84 | 137 | /** | |
| 85 | 138 | * @macro | |
| 86 | 139 | * | |
@@ -264,6 +317,14 @@ typedef ptrdiff_t nghttp3_ssize; | |||
| 264 | 317 | * allowed. | |
| 265 | 318 | */ | |
| 266 | 319 | #define NGHTTP3_ERR_H3_STREAM_CREATION_ERROR -609 | |
| 320 | + /** | ||
| 321 | + * @macro | ||
| 322 | + * | ||
| 323 | + * :macro:`NGHTTP3_ERR_H3_EXCESSIVE_LOAD` indicates that a local | ||
| 324 | + * endpoint detected that its remote endpoint is exhibiting a behavior | ||
| 325 | + * that might generating excessive load. | ||
| 326 | + */ | ||
| 327 | + #define NGHTTP3_ERR_H3_EXCESSIVE_LOAD -610 | ||
| 267 | 328 | /** | |
| 268 | 329 | * @macro | |
| 269 | 330 | * | |
@@ -1090,6 +1151,32 @@ typedef struct nghttp3_qpack_nv { | |||
| 1090 | 1151 | uint8_t flags; | |
| 1091 | 1152 | } nghttp3_qpack_nv; | |
| 1092 | 1153 | ||
| 1154 | + /** | ||
| 1155 | + * @enum | ||
| 1156 | + * | ||
| 1157 | + * :type:`nghttp3_qpack_indexing_strat` defines the QPACK dynamic | ||
| 1158 | + * table indexing strategies for fields not defined in | ||
| 1159 | + * :type:`nghttp3_qpack_token`. This type is available since v1.13.0. | ||
| 1160 | + | ||
| 1161 | + */ | ||
| 1162 | + typedef enum nghttp3_qpack_indexing_strat { | ||
| 1163 | + /** | ||
| 1164 | + * :enum:`NGHTTP3_QPACK_INDEXING_STRAT_NONE` does not index any | ||
| 1165 | + * fields not defined in :type:`nghttp3_qpack_token`. This is the | ||
| 1166 | + * default strategy. You can still use | ||
| 1167 | + * :macro:`NGHTTP3_NV_FLAG_TRY_INDEX` to index a particular field. | ||
| 1168 | + * This enum is available since v1.13.0. | ||
| 1169 | + */ | ||
| 1170 | + NGHTTP3_QPACK_INDEXING_STRAT_NONE, | ||
| 1171 | + /** | ||
| 1172 | + * :enum:`NGHTTP3_QPACK_INDEXING_STRAT_EAGER` indexes all fields not | ||
| 1173 | + * defined in :type:`nghttp3_qpack_token`. Please note that QPACK | ||
| 1174 | + * encoder might not index the field in various reasons. This enum | ||
| 1175 | + * is available since v1.13.0. | ||
| 1176 | + */ | ||
| 1177 | + NGHTTP3_QPACK_INDEXING_STRAT_EAGER | ||
| 1178 | + } nghttp3_qpack_indexing_strat; | ||
| 1179 | + | ||
| 1093 | 1180 | /** | |
| 1094 | 1181 | * @struct | |
| 1095 | 1182 | * | |
@@ -1238,6 +1325,18 @@ NGHTTP3_EXTERN void | |||
| 1238 | 1325 | nghttp3_qpack_encoder_set_max_blocked_streams(nghttp3_qpack_encoder *encoder, | |
| 1239 | 1326 | size_t max_blocked_streams); | |
| 1240 | 1327 | ||
| 1328 | + /** | ||
| 1329 | + * @function | ||
| 1330 | + * | ||
| 1331 | + * `nghttp3_qpack_encoder_set_indexing_strat` sets the dynamic table | ||
| 1332 | + * indexing strategy |strat| to |encoder|. This function is available | ||
| 1333 | + * since v1.13.0. | ||
| 1334 | + | ||
| 1335 | + */ | ||
| 1336 | + NGHTTP3_EXTERN void | ||
| 1337 | + nghttp3_qpack_encoder_set_indexing_strat(nghttp3_qpack_encoder *encoder, | ||
| 1338 | + nghttp3_qpack_indexing_strat strat); | ||
| 1339 | + | ||
| 1241 | 1340 | /** | |
| 1242 | 1341 | * @function | |
| 1243 | 1342 | * | |
@@ -1638,7 +1737,9 @@ typedef struct nghttp3_conn nghttp3_conn; | |||
| 1638 | 1737 | ||
| 1639 | 1738 | #define NGHTTP3_SETTINGS_V1 1 | |
| 1640 | 1739 | #define NGHTTP3_SETTINGS_V2 2 | |
| 1641 | - #define NGHTTP3_SETTINGS_VERSION NGHTTP3_SETTINGS_V2 | ||
| 1740 | + #define NGHTTP3_SETTINGS_V3 3 | ||
| 1741 | + #define NGHTTP3_SETTINGS_V4 4 | ||
| 1742 | + #define NGHTTP3_SETTINGS_VERSION NGHTTP3_SETTINGS_V4 | ||
| 1642 | 1743 | ||
| 1643 | 1744 | /** | |
| 1644 | 1745 | * @struct | |
@@ -1700,6 +1801,31 @@ typedef struct nghttp3_settings { | |||
| 1700 | 1801 | * server uses this field. This field is available since v1.11.0. | |
| 1701 | 1802 | */ | |
| 1702 | 1803 | const nghttp3_vec *origin_list; | |
| 1804 | + /* The following fields have been added since NGHTTP3_SETTINGS_V3. */ | ||
| 1805 | + /** | ||
| 1806 | + * :member:`glitch_ratelim_burst` is the maximum number of tokens | ||
| 1807 | + * available to "glitch" rate limiter. "glitch" is a suspicious | ||
| 1808 | + * activity from a remote endpoint. If detected, certain amount of | ||
| 1809 | + * tokens are consumed. If no tokens are available to consume, the | ||
| 1810 | + * connection is closed. The rate of token generation is specified | ||
| 1811 | + * by :member:`glitch_ratelim_rate`. This feature is enabled only | ||
| 1812 | + * when `nghttp3_conn_read_stream2` is used. This field has been | ||
| 1813 | + * available since v1.12.0. | ||
| 1814 | + */ | ||
| 1815 | + uint64_t glitch_ratelim_burst; | ||
| 1816 | + /** | ||
| 1817 | + * :member:`glitch_ratelim_rate` is the number of tokens generated | ||
| 1818 | + * per second. See :member:`glitch_ratelim_burst` for "glitch" rate | ||
| 1819 | + * limiter. This field has been available since v1.12.0. | ||
| 1820 | + */ | ||
| 1821 | + uint64_t glitch_ratelim_rate; | ||
| 1822 | + /** | ||
| 1823 | + * :member:`qpack_indexing_strat` defines the QPACK dynamic table | ||
| 1824 | + * indexing strategy for those fields that are not defined in | ||
| 1825 | + * :type:`nghttp3_qpack_token`. This field has been available since | ||
| 1826 | + * v1.13.0. | ||
| 1827 | + */ | ||
| 1828 | + nghttp3_qpack_indexing_strat qpack_indexing_strat; | ||
| 1703 | 1829 | } nghttp3_settings; | |
| 1704 | 1830 | ||
| 1705 | 1831 | /** | |
@@ -2113,6 +2239,10 @@ typedef struct nghttp3_callbacks { | |||
| 2113 | 2239 | * <nghttp3_settings.qpack_blocked_streams>` = 0 | |
| 2114 | 2240 | * - :member:`enable_connect_protocol | |
| 2115 | 2241 | * <nghttp3_settings.enable_connect_protocol>` = 0 | |
| 2242 | + * - :member:`glitch_ratelim_burst | ||
| 2243 | + * <nghttp3_settings.glitch_ratelim_burst>` = 1000 | ||
| 2244 | + * - :member:`glitch_ratelim_rate | ||
| 2245 | + * <nghttp3_settings.glitch_ratelim_rate>` = 33 | ||
| 2116 | 2246 | */ | |
| 2117 | 2247 | NGHTTP3_EXTERN void | |
| 2118 | 2248 | nghttp3_settings_default_versioned(int settings_version, | |
@@ -2209,6 +2339,11 @@ NGHTTP3_EXTERN int nghttp3_conn_bind_qpack_streams(nghttp3_conn *conn, | |||
| 2209 | 2339 | /** | |
| 2210 | 2340 | * @function | |
| 2211 | 2341 | * | |
| 2342 | + * .. warning:: | ||
| 2343 | + * | ||
| 2344 | + * Deprecated since v1.12.0. Use `nghttp3_conn_read_stream2` | ||
| 2345 | + * instead. | ||
| 2346 | + * | ||
| 2212 | 2347 | * `nghttp3_conn_read_stream` reads data |src| of length |srclen| on | |
| 2213 | 2348 | * stream identified by |stream_id|. It returns the number of bytes | |
| 2214 | 2349 | * consumed. The "consumed" means that application can increase flow | |
@@ -2237,6 +2372,42 @@ NGHTTP3_EXTERN nghttp3_ssize nghttp3_conn_read_stream(nghttp3_conn *conn, | |||
| 2237 | 2372 | const uint8_t *src, | |
| 2238 | 2373 | size_t srclen, int fin); | |
| 2239 | 2374 | ||
| 2375 | + /** | ||
| 2376 | + * @function | ||
| 2377 | + * | ||
| 2378 | + * `nghttp3_conn_read_stream2` reads data |src| of length |srclen| on | ||
| 2379 | + * stream identified by |stream_id|. It returns the number of bytes | ||
| 2380 | + * consumed. The "consumed" means that application can increase flow | ||
| 2381 | + * control credit (both stream and connection) of underlying QUIC | ||
| 2382 | + * connection by that amount. It does not include the amount of data | ||
| 2383 | + * carried by DATA frame which contains application data (excluding | ||
| 2384 | + * any control or QPACK unidirectional streams). See | ||
| 2385 | + * :type:`nghttp3_recv_data` to handle those bytes. If |fin| is | ||
| 2386 | + * nonzero, this is the last data from remote endpoint in this stream. | ||
| 2387 | + * |ts| is the current timestamp, and must be non-decreasing. It | ||
| 2388 | + * should be obtained from the clock that is steadily increasing. | ||
| 2389 | + * | ||
| 2390 | + * This function returns the number of bytes consumed, or one of the | ||
| 2391 | + * following negative error codes: | ||
| 2392 | + * | ||
| 2393 | + * :macro:`NGHTTP3_ERR_NOMEM` | ||
| 2394 | + * Out of memory. | ||
| 2395 | + * :macro:`NGHTTP3_ERR_CALLBACK_FAILURE` | ||
| 2396 | + * User callback failed. | ||
| 2397 | + * | ||
| 2398 | + * It may return the other error codes. The negative error code means | ||
| 2399 | + * that |conn| encountered a connection error, and the connection must | ||
| 2400 | + * be closed. Calling nghttp3 API other than `nghttp3_conn_del` | ||
| 2401 | + * causes undefined behavior. | ||
| 2402 | + * | ||
| 2403 | + * This function is available since v1.12.0. | ||
| 2404 | + */ | ||
| 2405 | + NGHTTP3_EXTERN nghttp3_ssize nghttp3_conn_read_stream2(nghttp3_conn *conn, | ||
| 2406 | + int64_t stream_id, | ||
| 2407 | + const uint8_t *src, | ||
| 2408 | + size_t srclen, int fin, | ||
| 2409 | + nghttp3_tstamp ts); | ||
| 2410 | + | ||
| 2240 | 2411 | /** | |
| 2241 | 2412 | * @function | |
| 2242 | 2413 | * | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -31,7 +31,7 @@ | |||
| 31 | 31 | * | |
| 32 | 32 | * Version number of the nghttp3 library release. | |
| 33 | 33 | */ | |
| 34 | - #define NGHTTP3_VERSION "1.11.0" | ||
| 34 | + #define NGHTTP3_VERSION "1.13.1" | ||
| 35 | 35 | ||
| 36 | 36 | /** | |
| 37 | 37 | * @macro | |
@@ -41,6 +41,6 @@ | |||
| 41 | 41 | * number, 8 bits for minor and 8 bits for patch. Version 1.2.3 | |
| 42 | 42 | * becomes 0x010203. | |
| 43 | 43 | */ | |
| 44 | - #define NGHTTP3_VERSION_NUM 0x010b00 | ||
| 44 | + #define NGHTTP3_VERSION_NUM 0x010d01 | ||
| 45 | 45 | ||
| 46 | 46 | #endif /* !defined(NGHTTP3_VERSION_H) */ | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -72,7 +72,7 @@ int nghttp3_balloc_get(nghttp3_balloc *balloc, void **pbuf, size_t n) { | |||
| 72 | 72 | return NGHTTP3_ERR_NOMEM; | |
| 73 | 73 | } | |
| 74 | 74 | ||
| 75 | - hd = (nghttp3_memblock_hd *)(void *)p; | ||
| 75 | + hd = (void *)p; | ||
| 76 | 76 | hd->next = balloc->head; | |
| 77 | 77 | balloc->head = hd; | |
| 78 | 78 | nghttp3_buf_wrap_init( | |
| Back | FazBrowse Home | New Git URL |
0 commit comments