3131 libcurl) */
3232#if (defined(_WIN32 ) || defined(__WIN32__ )) && !defined(WIN32 )
3333# define WIN32
34- #endif
34+ #endif /* (defined(_WIN32) || defined(__WIN32__)) && !defined(WIN32) */
3535
3636#ifdef __cplusplus
3737extern "C" {
38- #endif
38+ #endif /* defined(__cplusplus) */
3939
4040#include <stdlib.h>
4141#if defined(_MSC_VER ) && (_MSC_VER < 1800 )
4242/* MSVC < 2013 does not have inttypes.h because it is not C99
4343 compliant. See compiler macros and version number in
4444 https://sourceforge.net/p/predef/wiki/Compilers/ */
4545# include <stdint.h>
46- #else /* !defined(_MSC_VER) || (_MSC_VER >= 1800) */
46+ #else /* !( defined(_MSC_VER) && (_MSC_VER < 1800) ) */
4747# include <inttypes.h>
48- #endif /* !defined(_MSC_VER) || (_MSC_VER >= 1800) */
48+ #endif /* !( defined(_MSC_VER) && (_MSC_VER < 1800) ) */
4949#include <sys/types.h>
5050#include <stdarg.h>
5151#include <stddef.h>
@@ -57,22 +57,22 @@ extern "C" {
5757#elif defined(WIN32 )
5858# ifdef BUILDING_NGHTTP3
5959# define NGHTTP3_EXTERN __declspec(dllexport)
60- # else /* !BUILDING_NGHTTP3 */
60+ # else /* !defined( BUILDING_NGHTTP3) */
6161# define NGHTTP3_EXTERN __declspec(dllimport)
62- # endif /* !BUILDING_NGHTTP3 */
63- #else /* !defined(WIN32) */
62+ # endif /* !defined( BUILDING_NGHTTP3) */
63+ #else /* !( defined(NGHTTP3_STATICLIB) || defined( WIN32) ) */
6464# ifdef BUILDING_NGHTTP3
6565# define NGHTTP3_EXTERN __attribute__((visibility("default")))
66- # else /* !BUILDING_NGHTTP3 */
66+ # else /* !defined( BUILDING_NGHTTP3) */
6767# define NGHTTP3_EXTERN
68- # endif /* !BUILDING_NGHTTP3 */
69- #endif /* !defined(WIN32) */
68+ # endif /* !defined( BUILDING_NGHTTP3) */
69+ #endif /* !( defined(NGHTTP3_STATICLIB) || defined( WIN32) ) */
7070
7171#ifdef _MSC_VER
7272# define NGHTTP3_ALIGN (N ) __declspec(align(N))
73- #else /* !_MSC_VER */
73+ #else /* !defined( _MSC_VER) */
7474# define NGHTTP3_ALIGN (N ) __attribute__((aligned(N)))
75- #endif /* !_MSC_VER */
75+ #endif /* !defined( _MSC_VER) */
7676
7777/**
7878 * @typedef
@@ -624,7 +624,7 @@ typedef struct nghttp3_buf {
624624 */
625625 uint8_t * end ;
626626 /**
627- * :member:`pos` pointers to the start of data. Typically, this
627+ * :member:`pos` points to the start of data. Typically, this
628628 * points to the address that next data should be read. Initially,
629629 * it points to :member:`begin`.
630630 */
@@ -1161,8 +1161,8 @@ NGHTTP3_EXTERN void nghttp3_qpack_encoder_del(nghttp3_qpack_encoder *encoder);
11611161 * anymore.
11621162 */
11631163NGHTTP3_EXTERN int nghttp3_qpack_encoder_encode (
1164- nghttp3_qpack_encoder * encoder , nghttp3_buf * pbuf , nghttp3_buf * rbuf ,
1165- nghttp3_buf * ebuf , int64_t stream_id , const nghttp3_nv * nva , size_t nvlen );
1164+ nghttp3_qpack_encoder * encoder , nghttp3_buf * pbuf , nghttp3_buf * rbuf ,
1165+ nghttp3_buf * ebuf , int64_t stream_id , const nghttp3_nv * nva , size_t nvlen );
11661166
11671167/**
11681168 * @function
@@ -1182,7 +1182,7 @@ NGHTTP3_EXTERN int nghttp3_qpack_encoder_encode(
11821182 * |encoder| is unable to process input because it is malformed.
11831183 */
11841184NGHTTP3_EXTERN nghttp3_ssize nghttp3_qpack_encoder_read_decoder (
1185- nghttp3_qpack_encoder * encoder , const uint8_t * src , size_t srclen );
1185+ nghttp3_qpack_encoder * encoder , const uint8_t * src , size_t srclen );
11861186
11871187/**
11881188 * @function
@@ -1343,7 +1343,7 @@ NGHTTP3_EXTERN void nghttp3_qpack_decoder_del(nghttp3_qpack_decoder *decoder);
13431343 * Could not interpret encoder stream instruction.
13441344 */
13451345NGHTTP3_EXTERN nghttp3_ssize nghttp3_qpack_decoder_read_encoder (
1346- nghttp3_qpack_decoder * decoder , const uint8_t * src , size_t srclen );
1346+ nghttp3_qpack_decoder * decoder , const uint8_t * src , size_t srclen );
13471347
13481348/**
13491349 * @function
@@ -1436,9 +1436,9 @@ nghttp3_qpack_decoder_get_icnt(const nghttp3_qpack_decoder *decoder);
14361436 * HTTP field is too large.
14371437 */
14381438NGHTTP3_EXTERN nghttp3_ssize nghttp3_qpack_decoder_read_request (
1439- nghttp3_qpack_decoder * decoder , nghttp3_qpack_stream_context * sctx ,
1440- nghttp3_qpack_nv * nv , uint8_t * pflags , const uint8_t * src , size_t srclen ,
1441- int fin );
1439+ nghttp3_qpack_decoder * decoder , nghttp3_qpack_stream_context * sctx ,
1440+ nghttp3_qpack_nv * nv , uint8_t * pflags , const uint8_t * src , size_t srclen ,
1441+ int fin );
14421442
14431443/**
14441444 * @function
@@ -1568,7 +1568,7 @@ typedef void (*nghttp3_debug_vprintf_callback)(const char *format,
15681568 * times because this is important.
15691569 */
15701570NGHTTP3_EXTERN void nghttp3_set_debug_vprintf_callback (
1571- nghttp3_debug_vprintf_callback debug_vprintf_callback );
1571+ nghttp3_debug_vprintf_callback debug_vprintf_callback );
15721572
15731573/**
15741574 * @macrosection
@@ -2118,9 +2118,10 @@ NGHTTP3_EXTERN int nghttp3_conn_bind_qpack_streams(nghttp3_conn *conn,
21182118 * :macro:`NGHTTP3_ERR_CALLBACK_FAILURE`
21192119 * User callback failed.
21202120 *
2121- * It may return the other error codes. In general, the negative
2122- * error code means that |conn| encountered a connection error, and
2123- * the connection should be closed.
2121+ * It may return the other error codes. The negative error code means
2122+ * that |conn| encountered a connection error, and the connection must
2123+ * be closed. Calling nghttp3 API other than `nghttp3_conn_del`
2124+ * causes undefined behavior.
21242125 */
21252126NGHTTP3_EXTERN nghttp3_ssize nghttp3_conn_read_stream (nghttp3_conn * conn ,
21262127 int64_t stream_id ,
@@ -2152,9 +2153,10 @@ NGHTTP3_EXTERN nghttp3_ssize nghttp3_conn_read_stream(nghttp3_conn *conn,
21522153 * :macro:`NGHTTP3_ERR_CALLBACK_FAILURE`
21532154 * User callback failed.
21542155 *
2155- * It may return the other error codes. In general, the negative
2156- * error code means that |conn| encountered a connection error, and
2157- * the connection should be closed.
2156+ * It may return the other error codes. The negative error code means
2157+ * that |conn| encountered a connection error, and the connection must
2158+ * be closed. Calling nghttp3 API other than `nghttp3_conn_del`
2159+ * causes undefined behavior.
21582160 */
21592161NGHTTP3_EXTERN nghttp3_ssize nghttp3_conn_writev_stream (nghttp3_conn * conn ,
21602162 int64_t * pstream_id ,
@@ -2198,6 +2200,9 @@ NGHTTP3_EXTERN int nghttp3_conn_add_write_offset(nghttp3_conn *conn,
21982200 * If a stream denoted by |stream_id| is not found, this function
21992201 * returns 0.
22002202 *
2203+ * Alternatively, `nghttp3_conn_update_ack_offset` can be used to
2204+ * accomplish the same thing.
2205+ *
22012206 * This function returns 0 if it succeeds, or one of the following
22022207 * negative error codes:
22032208 *
@@ -2207,6 +2212,31 @@ NGHTTP3_EXTERN int nghttp3_conn_add_write_offset(nghttp3_conn *conn,
22072212NGHTTP3_EXTERN int nghttp3_conn_add_ack_offset (nghttp3_conn * conn ,
22082213 int64_t stream_id , uint64_t n );
22092214
2215+ /**
2216+ * @function
2217+ *
2218+ * `nghttp3_conn_update_ack_offset` tells |conn| that QUIC stack has
2219+ * acknowledged the stream data up to |offset| for a stream denoted by
2220+ * |stream_id|.
2221+ *
2222+ * If a stream denoted by |stream_id| is not found, this function
2223+ * returns 0.
2224+ *
2225+ * Alternatively, `nghttp3_conn_add_ack_offset` can be used to
2226+ * accomplish the same thing.
2227+ *
2228+ * This function returns 0 if it succeeds, or one of the following
2229+ * negative error codes:
2230+ *
2231+ * :macro:`NGHTTP3_ERR_INVALID_ARGUMENT`
2232+ * |offset| is less than the number of bytes acknowledged so far.
2233+ * :macro:`NGHTTP3_ERR_CALLBACK_FAILURE`
2234+ * User callback failed.
2235+ */
2236+ NGHTTP3_EXTERN int nghttp3_conn_update_ack_offset (nghttp3_conn * conn ,
2237+ int64_t stream_id ,
2238+ uint64_t offset );
2239+
22102240/**
22112241 * @function
22122242 *
@@ -2314,9 +2344,9 @@ NGHTTP3_EXTERN int nghttp3_conn_resume_stream(nghttp3_conn *conn,
23142344/**
23152345 * @function
23162346 *
2317- * `nghttp3_conn_close_stream` closes stream identified by
2318- * |stream_id|. QUIC application error code |app_error_code| is the
2319- * reason of the closure.
2347+ * `nghttp3_conn_close_stream` tells the library that a stream
2348+ * identified by |stream_id| has been closed . QUIC application error
2349+ * code |app_error_code| is the reason of the closure.
23202350 *
23212351 * This function returns 0 if it succeeds, or one of the following
23222352 * negative error codes:
@@ -2419,8 +2449,8 @@ nghttp3_conn_set_max_concurrent_streams(nghttp3_conn *conn,
24192449 * stream.
24202450 */
24212451typedef nghttp3_ssize (* nghttp3_read_data_callback )(
2422- nghttp3_conn * conn , int64_t stream_id , nghttp3_vec * vec , size_t veccnt ,
2423- uint32_t * pflags , void * conn_user_data , void * stream_user_data );
2452+ nghttp3_conn * conn , int64_t stream_id , nghttp3_vec * vec , size_t veccnt ,
2453+ uint32_t * pflags , void * conn_user_data , void * stream_user_data );
24242454
24252455/**
24262456 * @struct
@@ -2460,8 +2490,8 @@ typedef struct nghttp3_data_reader {
24602490 * Out of memory.
24612491 */
24622492NGHTTP3_EXTERN int nghttp3_conn_submit_request (
2463- nghttp3_conn * conn , int64_t stream_id , const nghttp3_nv * nva , size_t nvlen ,
2464- const nghttp3_data_reader * dr , void * stream_user_data );
2493+ nghttp3_conn * conn , int64_t stream_id , const nghttp3_nv * nva , size_t nvlen ,
2494+ const nghttp3_data_reader * dr , void * stream_user_data );
24652495
24662496/**
24672497 * @function
@@ -2667,7 +2697,7 @@ typedef struct NGHTTP3_ALIGN(8) nghttp3_pri {
26672697 * Stream not found.
26682698 */
26692699NGHTTP3_EXTERN int nghttp3_conn_get_stream_priority_versioned (
2670- nghttp3_conn * conn , int pri_version , nghttp3_pri * dest , int64_t stream_id );
2700+ nghttp3_conn * conn , int pri_version , nghttp3_pri * dest , int64_t stream_id );
26712701
26722702/**
26732703 * @function
@@ -2720,8 +2750,8 @@ NGHTTP3_EXTERN int nghttp3_conn_set_client_stream_priority(nghttp3_conn *conn,
27202750 * Out of memory.
27212751 */
27222752NGHTTP3_EXTERN int nghttp3_conn_set_server_stream_priority_versioned (
2723- nghttp3_conn * conn , int64_t stream_id , int pri_version ,
2724- const nghttp3_pri * pri );
2753+ nghttp3_conn * conn , int64_t stream_id , int pri_version ,
2754+ const nghttp3_pri * pri );
27252755
27262756/**
27272757 * @function
@@ -2884,7 +2914,7 @@ NGHTTP3_EXTERN int nghttp3_err_is_fatal(int liberr);
28842914 */
28852915#define nghttp3_conn_set_server_stream_priority (CONN , STREAM_ID , PRI ) \
28862916 nghttp3_conn_set_server_stream_priority_versioned( \
2887- (CONN), (STREAM_ID), NGHTTP3_PRI_VERSION, (PRI))
2917+ (CONN), (STREAM_ID), NGHTTP3_PRI_VERSION, (PRI))
28882918
28892919/*
28902920 * `nghttp3_conn_get_stream_priority` is a wrapper around
@@ -2906,6 +2936,6 @@ NGHTTP3_EXTERN int nghttp3_err_is_fatal(int liberr);
29062936
29072937#ifdef __cplusplus
29082938}
2909- #endif
2939+ #endif /* defined(__cplusplus) */
29102940
2911- #endif /* NGHTTP3_H */
2941+ #endif /* !defined( NGHTTP3_H) */
0 commit comments