view release on metacpan or search on metacpan
vendor/nghttp3-1.18.0/lib/includes/nghttp3/nghttp3.h view on Meta::CPAN
#define NGHTTP3_ERR_QPACK_DECODER_STREAM_ERROR -403
/**
* @macro
*
* :macro:`NGHTTP3_ERR_H3_FRAME_UNEXPECTED` indicates that an
* unexpected HTTP/3 frame is received.
*/
#define NGHTTP3_ERR_H3_FRAME_UNEXPECTED -601
/**
* @macro
*
* :macro:`NGHTTP3_ERR_H3_FRAME_ERROR` indicates that an HTTP/3 frame
* is malformed.
*/
#define NGHTTP3_ERR_H3_FRAME_ERROR -602
/**
* @macro
*
* :macro:`NGHTTP3_ERR_H3_MISSING_SETTINGS` indicates that an HTTP/3
* SETTINGS frame is missing.
*/
#define NGHTTP3_ERR_H3_MISSING_SETTINGS -603
/**
* @macro
*
* :macro:`NGHTTP3_ERR_H3_INTERNAL_ERROR` indicates an internal error.
*/
#define NGHTTP3_ERR_H3_INTERNAL_ERROR -604
/**
* @macro
*
* :macro:`NGHTTP3_ERR_H3_CLOSED_CRITICAL_STREAM` indicates that a
* critical stream is closed.
*/
#define NGHTTP3_ERR_H3_CLOSED_CRITICAL_STREAM -605
/**
* @macro
*
* :macro:`NGHTTP3_ERR_H3_GENERAL_PROTOCOL_ERROR` indicates a general
* protocol error. This is typically a catch-all error.
*/
#define NGHTTP3_ERR_H3_GENERAL_PROTOCOL_ERROR -606
/**
* @macro
*
* :macro:`NGHTTP3_ERR_H3_ID_ERROR` indicates that an ID related error
* occurred.
*/
#define NGHTTP3_ERR_H3_ID_ERROR -607
/**
* @macro
*
* :macro:`NGHTTP3_ERR_H3_SETTINGS_ERROR` indicates that an HTTP/3
* SETTINGS frame is malformed.
*/
#define NGHTTP3_ERR_H3_SETTINGS_ERROR -608
/**
* @macro
*
* :macro:`NGHTTP3_ERR_H3_STREAM_CREATION_ERROR` indicates that a
* remote endpoint attempts to create a new stream which is not
* allowed.
*/
#define NGHTTP3_ERR_H3_STREAM_CREATION_ERROR -609
/**
* @macro
*
* :macro:`NGHTTP3_ERR_H3_EXCESSIVE_LOAD` indicates that a local
* endpoint detected that its remote endpoint is exhibiting a behavior
* that might generating excessive load.
*/
#define NGHTTP3_ERR_H3_EXCESSIVE_LOAD -610
/**
* @macro
*
* :macro:`NGHTTP3_ERR_FATAL` indicates that error codes less than
* this value is fatal error. When this error is returned, an
* endpoint should drop connection immediately.
*/
#define NGHTTP3_ERR_FATAL -900
/**
* @macro
*
* :macro:`NGHTTP3_ERR_NOMEM` indicates out of memory.
*/
#define NGHTTP3_ERR_NOMEM -901
/**
* @macro
*
* :macro:`NGHTTP3_ERR_CALLBACK_FAILURE` indicates that user defined
* callback function failed.
*/
#define NGHTTP3_ERR_CALLBACK_FAILURE -902
/**
* @macrosection
*
* HTTP/3 application error code
*/
/**
* @macro
*
* :macro:`NGHTTP3_H3_NO_ERROR` is HTTP/3 application error code
* ``H3_NO_ERROR``.
*/
#define NGHTTP3_H3_NO_ERROR 0x0100
/**
* @macro
*
* :macro:`NGHTTP3_H3_GENERAL_PROTOCOL_ERROR` is HTTP/3 application
* error code ``H3_GENERAL_PROTOCOL_ERROR``.
*/
#define NGHTTP3_H3_GENERAL_PROTOCOL_ERROR 0x0101
/**
* @macro
*
* :macro:`NGHTTP3_H3_INTERNAL_ERROR` is HTTP/3 application error code
* ``H3_INTERNAL_ERROR``.
*/
#define NGHTTP3_H3_INTERNAL_ERROR 0x0102
/**
* @macro
*
* :macro:`NGHTTP3_H3_STREAM_CREATION_ERROR` is HTTP/3 application
* error code ``H3_STREAM_CREATION_ERROR``.
*/
#define NGHTTP3_H3_STREAM_CREATION_ERROR 0x0103
/**
* @macro
*
* :macro:`NGHTTP3_H3_CLOSED_CRITICAL_STREAM` is HTTP/3 application
* error code ``H3_CLOSED_CRITICAL_STREAM``.
*/
#define NGHTTP3_H3_CLOSED_CRITICAL_STREAM 0x0104
/**
* @macro
*
vendor/nghttp3-1.18.0/lib/includes/nghttp3/nghttp3.h view on Meta::CPAN
* decoder stream that is currently pending.
*/
NGHTTP3_EXTERN size_t
nghttp3_qpack_decoder_get_decoder_streamlen(nghttp3_qpack_decoder *decoder);
/**
* @function
*
* `nghttp3_qpack_decoder_get_decoder_streamlen2` returns the length
* of decoder stream that is currently pending.
*
* .. version-added:: 1.16.0
*/
NGHTTP3_EXTERN size_t nghttp3_qpack_decoder_get_decoder_streamlen2(
const nghttp3_qpack_decoder *decoder);
/**
* @function
*
* `nghttp3_qpack_decoder_cancel_stream` cancels HTTP field section
* decoding for stream denoted by |stream_id|.
*
* This function returns 0 if it succeeds, or one of the following
* negative error codes:
*
* :macro:`NGHTTP3_ERR_NOMEM`
* Out of memory.
* :macro:`NGHTTP3_ERR_QPACK_FATAL`
* Decoder stream overflow.
*/
NGHTTP3_EXTERN int
nghttp3_qpack_decoder_cancel_stream(nghttp3_qpack_decoder *decoder,
int64_t stream_id);
/**
* @function
*
* `nghttp3_qpack_decoder_set_max_dtable_capacity` sets
* |max_dtable_capacity| as maximum dynamic table size.
* |max_dtable_capacity| must be equal to, or smaller than
* ``hard_max_dtable_capacity`` parameter of
* `nghttp3_qpack_decoder_new`. Normally, the maximum capacity is
* communicated in encoder stream. This function is provided for
* debugging and testing purpose.
*
* This function returns 0 if it succeeds, or one of the following
* negative error codes:
*
* :macro:`NGHTTP3_ERR_INVALID_ARGUMENT`
* |max_dtable_capacity| exceeds the upper bound of the dynamic
* table capacity.
*/
NGHTTP3_EXTERN int
nghttp3_qpack_decoder_set_max_dtable_capacity(nghttp3_qpack_decoder *decoder,
size_t max_dtable_capacity);
/**
* @function
*
* `nghttp3_qpack_decoder_set_max_concurrent_streams` tells |decoder|
* the maximum number of concurrent streams that a remote endpoint can
* open, including both bidirectional and unidirectional streams which
* potentially receive QPACK encoded HEADERS frame. This value is
* used as a hint to limit the length of decoder stream.
*/
NGHTTP3_EXTERN void
nghttp3_qpack_decoder_set_max_concurrent_streams(nghttp3_qpack_decoder *decoder,
size_t max_concurrent_streams);
/**
* @function
*
* `nghttp3_strerror` returns textual representation of |liberr|.
*/
NGHTTP3_EXTERN const char *nghttp3_strerror(int liberr);
/**
* @function
*
* `nghttp3_err_infer_quic_app_error_code` returns a QUIC application
* error code which corresponds to |liberr|.
*/
NGHTTP3_EXTERN uint64_t nghttp3_err_infer_quic_app_error_code(int liberr);
/**
* @functypedef
*
* :type:`nghttp3_debug_vprintf_callback` is a callback function
* invoked when the library outputs debug logging. The function is
* called with arguments suitable for :manpage:`vfprintf(3)`.
*
* The debug output is only enabled if the library is built with
* :macro:`DEBUGBUILD` macro defined.
*/
typedef void (*nghttp3_debug_vprintf_callback)(const char *format,
va_list args);
/**
* @function
*
* `nghttp3_set_debug_vprintf_callback` sets a debug output callback
* called by the library when built with :macro:`DEBUGBUILD` macro
* defined. If a callback function is not set by this function, debug
* log is written into standard error output.
*
* For builds without :macro:`DEBUGBUILD` macro defined, this function
* is noop.
*
* Note that building with :macro:`DEBUGBUILD` may cause significant
* performance penalty to libnghttp3 because of extra processing. It
* should be used for debugging purpose only.
*
* .. Warning::
*
* Building with :macro:`DEBUGBUILD` may cause significant
* performance penalty to libnghttp3 because of extra processing.
* It should be used for debugging purpose only. We write this two
* times because this is important.
*/
NGHTTP3_EXTERN void nghttp3_set_debug_vprintf_callback(
nghttp3_debug_vprintf_callback debug_vprintf_callback);
vendor/nghttp3-1.18.0/lib/includes/nghttp3/nghttp3.h view on Meta::CPAN
* details.
*/
uint64_t max_field_section_size;
/**
* :member:`qpack_max_dtable_capacity` is the maximum size of QPACK
* dynamic table.
*/
size_t qpack_max_dtable_capacity;
/**
* :member:`qpack_encoder_max_dtable_capacity` is the upper bound of
* QPACK dynamic table capacity that the QPACK encoder is willing to
* use. The effective maximum dynamic table capacity is the minimum
* of this field and the value of the received
* SETTINGS_QPACK_MAX_TABLE_CAPACITY. If this field is set to 0,
* the encoder does not use the dynamic table.
*
* When :type:`nghttp3_settings` is passed to
* :member:`nghttp3_callbacks.recv_settings` callback, this field
* should be ignored.
*/
size_t qpack_encoder_max_dtable_capacity;
/**
* :member:`qpack_blocked_streams` is the maximum number of streams
* which can be blocked while they are being decoded.
*/
size_t qpack_blocked_streams;
/**
* :member:`enable_connect_protocol`, if set to nonzero, enables
* Extended CONNECT Method (see :rfc:`9220`). Client ignores this
* field.
*/
uint8_t enable_connect_protocol;
/**
* :member:`h3_datagram`, if set to nonzero, enables HTTP/3
* Datagrams (see :rfc:`9297`).
*/
uint8_t h3_datagram;
/* The following fields have been added since
NGHTTP3_SETTINGS_V2. */
/**
* :member:`origin_list`, if set, must contain a serialized HTTP/3
* ORIGIN frame (see :rfc:`9412`) payload. The ORIGIN frame payload
* is a sequence of zero or more of a length prefixed byte string.
* The length is encoded in 2 bytes in network byte order. If
* :member:`origin_list->len <nghttp3_vec.len>` is zero, an empty
* ORIGIN frame is sent. An application must keep the buffer
* pointed by :member:`origin_list->base <nghttp3_vec.base>` alive
* until the :type:`nghttp3_conn` to which this field was passed is
* freed by `nghttp3_conn_del`. The object pointed to by this field
* is copied internally, and does not need to be kept alive. Only
* server uses this field.
*
* .. version-added:: 1.11.0
*/
const nghttp3_vec *origin_list;
/* The following fields have been added since
NGHTTP3_SETTINGS_V3. */
/**
* :member:`glitch_ratelim_burst` is the maximum number of tokens
* available to "glitch" rate limiter. "glitch" is a suspicious
* activity from a remote endpoint. If detected, certain amount of
* tokens are consumed. If no tokens are available to consume, the
* connection is closed. The rate of token generation is specified
* by :member:`glitch_ratelim_rate`. This feature is enabled only
* when `nghttp3_conn_read_stream2` is used.
*
* .. version-added:: 1.12.0
*/
uint64_t glitch_ratelim_burst;
/**
* :member:`glitch_ratelim_rate` is the number of tokens generated
* per second. See :member:`glitch_ratelim_burst` for "glitch" rate
* limiter.
*
* .. version-added:: 1.12.0
*/
uint64_t glitch_ratelim_rate;
/* The following fields have been added since
NGHTTP3_SETTINGS_V4. */
/**
* :member:`qpack_indexing_strat` defines the QPACK dynamic table
* indexing strategy for those fields that are not defined in
* :type:`nghttp3_qpack_token`.
*
* .. version-added:: 1.13.0
*/
nghttp3_qpack_indexing_strat qpack_indexing_strat;
} nghttp3_settings;
#define NGHTTP3_PROTO_SETTINGS_V1 1
#define NGHTTP3_PROTO_SETTINGS_VERSION NGHTTP3_PROTO_SETTINGS_V1
/**
* @struct
*
* :type:`nghttp3_proto_settings` contains HTTP/3 settings that this
* library can recognize.
*
* .. version-added:: 1.14.0
*/
typedef struct nghttp3_proto_settings {
/**
* :member:`max_field_section_size` specifies the maximum header
* section (block) size.
*/
uint64_t max_field_section_size;
/**
* :member:`qpack_max_dtable_capacity` is the maximum size of QPACK
* dynamic table.
*/
size_t qpack_max_dtable_capacity;
/**
* :member:`qpack_blocked_streams` is the maximum number of streams
* which can be blocked while they are being decoded.
*/
size_t qpack_blocked_streams;
/**
* :member:`enable_connect_protocol`, if set to nonzero, enables
* Extended CONNECT Method (see :rfc:`9220`). Client ignores this
* field.
*/
uint8_t enable_connect_protocol;
/**
* :member:`h3_datagram`, if set to nonzero, enables HTTP/3
* Datagrams (see :rfc:`9297`).
*/
uint8_t h3_datagram;
} nghttp3_proto_settings;
/**
* @functypedef
*
* :type:`nghttp3_acked_stream_data` is a callback function which is
* invoked when data sent on stream denoted by |stream_id| supplied
* from application is acknowledged by remote endpoint. The number of
* bytes acknowledged is given in |datalen|.
*
* The implementation of this callback must return 0 if it succeeds.
* Returning :macro:`NGHTTP3_ERR_CALLBACK_FAILURE` will return to the
* caller immediately. Any values other than 0 is treated as
* :macro:`NGHTTP3_ERR_CALLBACK_FAILURE`.
*/
typedef int (*nghttp3_acked_stream_data)(nghttp3_conn *conn, int64_t stream_id,
uint64_t datalen, void *conn_user_data,
void *stream_user_data);
/**
* @functypedef
*
* :type:`nghttp3_stream_close` is a callback function which is
* invoked when a stream identified by |stream_id| is closed. QUIC
* application error code |app_error_code| indicates the reason of
* this closure.
*
* The implementation of this callback must return 0 if it succeeds.
* Returning :macro:`NGHTTP3_ERR_CALLBACK_FAILURE` will return to the
* caller immediately. Any values other than 0 is treated as
* :macro:`NGHTTP3_ERR_CALLBACK_FAILURE`.
*
* .. seealso::
* :type:`nghttp3_stream_close2`
*/
typedef int (*nghttp3_stream_close)(nghttp3_conn *conn, int64_t stream_id,
uint64_t app_error_code,
void *conn_user_data,
void *stream_user_data);
/**
* @functypedef
*
* :type:`nghttp3_recv_data` is a callback function which is invoked
* when a part of request or response body on stream identified by
* |stream_id| is received. |data| points to the received data, and
* its length is |datalen|.
*
* The application is responsible for increasing flow control credit
* (say, increasing by |datalen| bytes).
*
* The implementation of this callback must return 0 if it succeeds.
* Returning :macro:`NGHTTP3_ERR_CALLBACK_FAILURE` will return to the
* caller immediately. Any values other than 0 is treated as
* :macro:`NGHTTP3_ERR_CALLBACK_FAILURE`.
*/
typedef int (*nghttp3_recv_data)(nghttp3_conn *conn, int64_t stream_id,
const uint8_t *data, size_t datalen,
void *conn_user_data, void *stream_user_data);
/**
* @functypedef
*
* :type:`nghttp3_deferred_consume` is a callback function which is
* invoked when the library consumed |consumed| bytes for a stream
* identified by |stream_id|. This callback is used to notify the
* consumed bytes for stream blocked due to synchronization between
* streams. The application is responsible for increasing flow
vendor/nghttp3-1.18.0/lib/includes/nghttp3/nghttp3.h view on Meta::CPAN
int fin, void *conn_user_data,
void *stream_user_data);
/**
* @functypedef
*
* :type:`nghttp3_end_stream` is a callback function which is invoked
* when the receiving side of stream is closed. For server, this
* callback function is invoked when HTTP request is received
* completely. For client, this callback function is invoked when
* HTTP response is received completely.
*
* The implementation of this callback must return 0 if it succeeds.
* Returning :macro:`NGHTTP3_ERR_CALLBACK_FAILURE` will return to the
* caller immediately. Any values other than 0 is treated as
* :macro:`NGHTTP3_ERR_CALLBACK_FAILURE`.
*/
typedef int (*nghttp3_end_stream)(nghttp3_conn *conn, int64_t stream_id,
void *conn_user_data, void *stream_user_data);
/**
* @functypedef
*
* :type:`nghttp3_stop_sending` is a callback function which is
* invoked when the library asks application to send STOP_SENDING to
* the stream identified by |stream_id|. QUIC application error code
* |app_error_code| indicates the reason for this action.
*
* The implementation of this callback must return 0 if it succeeds.
* Returning :macro:`NGHTTP3_ERR_CALLBACK_FAILURE` will return to the
* caller immediately. Any values other than 0 is treated as
* :macro:`NGHTTP3_ERR_CALLBACK_FAILURE`.
*/
typedef int (*nghttp3_stop_sending)(nghttp3_conn *conn, int64_t stream_id,
uint64_t app_error_code,
void *conn_user_data,
void *stream_user_data);
/**
* @functypedef
*
* :type:`nghttp3_reset_stream` is a callback function which is
* invoked when the library asks application to reset stream
* identified by |stream_id|. QUIC application error code
* |app_error_code| indicates the reason for this action.
*
* The implementation of this callback must return 0 if it succeeds.
* Returning :macro:`NGHTTP3_ERR_CALLBACK_FAILURE` will return to the
* caller immediately. Any values other than 0 is treated as
* :macro:`NGHTTP3_ERR_CALLBACK_FAILURE`.
*/
typedef int (*nghttp3_reset_stream)(nghttp3_conn *conn, int64_t stream_id,
uint64_t app_error_code,
void *conn_user_data,
void *stream_user_data);
/**
* @functypedef
*
* :type:`nghttp3_shutdown` is a callback function which is invoked
* when a shutdown is initiated by the remote endpoint. For client,
* |id| contains a stream ID of a client initiated stream, for server,
* it contains a push ID. All client streams with stream ID, or pushes
* with push ID equal to, or larger than |ID| are guaranteed to not be
* processed by the remote endpoint. Note that libnghttp3 does not
* implement Server Push.
*
* Parameter |id| for client can contain a special value
* :macro:`NGHTTP3_SHUTDOWN_NOTICE_STREAM_ID`, and for server it can
* contain special value
* :macro:`NGHTTP3_SHUTDOWN_NOTICE_PUSH_ID`. These values signal
* request for graceful shutdown of the connection, triggered by
* remote endpoint's invocation of
* `nghttp3_conn_submit_shutdown_notice`.
*
* It is possible that this callback is invoked multiple times on a
* single connection, however the |id| can only stay the same or
* decrease, never increase.
*
* The implementation of this callback must return 0 if it succeeds.
* Returning :macro:`NGHTTP3_ERR_CALLBACK_FAILURE` will return to the
* caller immediately. Any values other than 0 is treated as
* :macro:`NGHTTP3_ERR_CALLBACK_FAILURE`.
*/
typedef int (*nghttp3_shutdown)(nghttp3_conn *conn, int64_t id,
void *conn_user_data);
/**
* @functypedef
*
* .. warning::
*
* .. version-deprecated:: 1.14.0
* Use :type:`nghttp3_recv_settings2` instead. New settings will
* not be notified with this callback.
*
* :type:`nghttp3_recv_settings` is a callback function which is
* invoked when SETTINGS frame is received. |settings| is a received
* remote HTTP/3 settings.
*
* The implementation of this callback must return 0 if it succeeds.
* Returning :macro:`NGHTTP3_ERR_CALLBACK_FAILURE` will return to the
* caller immediately. Any values other than 0 is treated as
* :macro:`NGHTTP3_ERR_CALLBACK_FAILURE`.
*/
typedef int (*nghttp3_recv_settings)(nghttp3_conn *conn,
const nghttp3_settings *settings,
void *conn_user_data);
/**
* @functypedef
*
* :type:`nghttp3_recv_origin` is a callback function which is invoked
* when a single origin in ORIGIN frame is received. |origin| is a
* received origin of length |originlen|. |originlen| never be 0.
*
* The implementation of this callback must return 0 if it succeeds.
* Returning :macro:`NGHTTP3_ERR_CALLBACK_FAILURE` will return to the
* caller immediately. Any values other than 0 is treated as
* :macro:`NGHTTP3_ERR_CALLBACK_FAILURE`.
*/
typedef int (*nghttp3_recv_origin)(nghttp3_conn *conn, const uint8_t *origin,
size_t originlen, void *conn_user_data);
/**
* @functypedef
*
* :type:`nghttp3_end_origin` is a callback function which is invoked
* when an ORIGIN frame has been completely processed.
*
* The implementation of this callback must return 0 if it succeeds.
* Returning :macro:`NGHTTP3_ERR_CALLBACK_FAILURE` will return to the
* caller immediately. Any values other than 0 is treated as
vendor/nghttp3-1.18.0/lib/includes/nghttp3/nghttp3.h view on Meta::CPAN
/**
* @macro
*
* :macro:`NGHTTP3_STREAM_CLOSE_FLAG_TX_APP_ERROR_CODE_SET` indicates
* that tx_app_error_code parameter is set.
*
* .. version-added:: 1.18.0
*/
#define NGHTTP3_STREAM_CLOSE_FLAG_TX_APP_ERROR_CODE_SET 0x02U
/**
* @functypedef
*
* :type:`nghttp3_stream_close2` is a callback function which is
* invoked when a stream identified by |stream_id| is closed. If
* :macro:`NGHTTP3_STREAM_CLOSE_FLAG_RX_APP_ERROR_CODE_SET` is set in
* |flags|, |rx_app_error_code| is the QUIC application error code
* that shut down the receiving side of the stream. If
* :macro:`NGHTTP3_STREAM_CLOSE_FLAG_TX_APP_ERROR_CODE_SET` is set in
* |flags|, |tx_app_error_code| is the QUIC application error code
* that shut down the sending side of the stream. No application code
* means that direction of stream is closed without any error.
*
* This callback should be used with `nghttp3_conn_close_stream2`. If
* `nghttp3_conn_close_stream` is used, the app_error_code is set to
* both |rx_app_error_code| and |tx_app_error_code|, and
* :macro:`NGHTTP3_STREAM_CLOSE_FLAG_RX_APP_ERROR_CODE_SET` and
* :macro:`NGHTTP3_STREAM_CLOSE_FLAG_TX_APP_ERROR_CODE_SET` are set in
* |flags|.
*
* The implementation of this callback must return 0 if it succeeds.
* Returning :macro:`NGHTTP3_ERR_CALLBACK_FAILURE` will return to the
* caller immediately. Any values other than 0 is treated as
* :macro:`NGHTTP3_ERR_CALLBACK_FAILURE`.
*
* .. version-added:: 1.18.0
*/
typedef int (*nghttp3_stream_close2)(nghttp3_conn *conn, uint32_t flags,
int64_t stream_id,
uint64_t rx_app_error_code,
uint64_t tx_app_error_code,
void *conn_user_data,
void *stream_user_data);
#define NGHTTP3_CALLBACKS_V1 1
#define NGHTTP3_CALLBACKS_V2 2
#define NGHTTP3_CALLBACKS_V3 3
#define NGHTTP3_CALLBACKS_V4 4
#define NGHTTP3_CALLBACKS_VERSION NGHTTP3_CALLBACKS_V4
/**
* @struct
*
* :type:`nghttp3_callbacks` holds a set of callback functions.
*/
typedef struct nghttp3_callbacks {
/**
* :member:`acked_stream_data` is a callback function which is
* invoked when data sent on a particular stream have been
* acknowledged by a remote endpoint.
*/
nghttp3_acked_stream_data acked_stream_data;
/**
* :member:`stream_close` is a callback function which is invoked
* when a particular stream has closed.
*
* .. seealso::
* :member:`stream_close2`
*/
nghttp3_stream_close stream_close;
/**
* :member:`recv_data` is a callback function which is invoked when
* stream data is received.
*/
nghttp3_recv_data recv_data;
/**
* :member:`deferred_consume` is a callback function which is
* invoked when the library consumed data for a particular stream
* which had been blocked for synchronization between streams.
*/
nghttp3_deferred_consume deferred_consume;
/**
* :member:`begin_headers` is a callback function which is invoked
* when an HTTP header field section has started on a particular
* stream.
*/
nghttp3_begin_headers begin_headers;
/**
* :member:`recv_header` is a callback function which is invoked
* when a single HTTP header field is received on a particular
* stream.
*/
nghttp3_recv_header recv_header;
/**
* :member:`end_headers` is a callback function which is invoked
* when an HTTP header field section has ended on a particular
* stream.
*/
nghttp3_end_headers end_headers;
/**
* :member:`begin_trailers` is a callback function which is invoked
* when an HTTP trailer field section has started on a particular
* stream.
*/
nghttp3_begin_headers begin_trailers;
/**
* :member:`recv_trailer` is a callback function which is invoked
* when a single HTTP trailer field is received on a particular
* stream.
*/
nghttp3_recv_header recv_trailer;
/**
* :member:`end_trailers` is a callback function which is invoked
* when an HTTP trailer field section has ended on a particular
* stream.
*/
nghttp3_end_headers end_trailers;
/**
* :member:`stop_sending` is a callback function which is invoked
* when the library asks application to send STOP_SENDING to a
* particular stream.
*/
nghttp3_stop_sending stop_sending;
/**
* :member:`end_stream` is a callback function which is invoked when
* a receiving side of stream has been closed.
*/
nghttp3_end_stream end_stream;
/**
* :member:`reset_stream` is a callback function which is invoked
* when the library asks application to reset stream (by sending
* RESET_STREAM).
*/
nghttp3_reset_stream reset_stream;
/**
* :member:`shutdown` is a callback function which is invoked when
* the remote endpoint has signalled initiation of connection
* shutdown.
*/
nghttp3_shutdown shutdown;
/**
* .. warning::
*
* .. version-deprecated:: 1.14.0
* Use :member:`recv_settings2` instead.
*
* :member:`recv_settings` is a callback function which is invoked
* when SETTINGS frame is received.
*/
nghttp3_recv_settings recv_settings;
/* The following fields have been added since
NGHTTP3_CALLBACKS_V2. */
/**
* :member:`recv_origin` is a callback function which is invoked
* when a single origin in an ORIGIN frame is received.
*
* .. version-added:: 1.11.0
*/
nghttp3_recv_origin recv_origin;
/**
* :member:`end_origin` is a callback function which is invoked when
* an ORIGIN frame has been completely processed.
*
* .. version-added:: 1.11.0
*/
nghttp3_end_origin end_origin;
/**
* :member:`rand` is a callback function which is invoked when
* unpredictable data are needed. Although this field is optional
* due to the backward compatibility, it is recommended to specify
* this field to harden the runtime behavior against suspicious
* activities of a remote endpoint.
*
* .. version-added:: 1.11.0
*/
nghttp3_rand rand;
/* The following fields have been added since
NGHTTP3_CALLBACKS_V3. */
/**
* :member:`recv_settings2` is a callback function which is invoked
* when SETTINGS frame is received.
*
* .. version-added:: 1.14.0
*/
nghttp3_recv_settings2 recv_settings2;
/* The following fields have been added since
NGHTTP3_CALLBACKS_V4. */
/**
* :member:`stream_close2` is a callback function which is invoked
* when a particular stream has closed.
*
* .. version-added:: 1.18.0
*/
nghttp3_stream_close2 stream_close2;
} nghttp3_callbacks;
/**
* @function
*
* `nghttp3_settings_default` fills |settings| with the default
* values.
*
* - :member:`max_field_section_size
* <nghttp3_settings.max_field_section_size>` = :expr:`((1ULL << 62) - 1)`
* - :member:`qpack_max_dtable_capacity
* <nghttp3_settings.qpack_max_dtable_capacity>` = 0
* - :member:`qpack_encoder_max_dtable_capacity
* <nghttp3_settings.qpack_encoder_max_dtable_capacity>` = 4096
* - :member:`qpack_blocked_streams
* <nghttp3_settings.qpack_blocked_streams>` = 0
* - :member:`enable_connect_protocol
* <nghttp3_settings.enable_connect_protocol>` = 0
* - :member:`glitch_ratelim_burst
* <nghttp3_settings.glitch_ratelim_burst>` = 1000
* - :member:`glitch_ratelim_rate
* <nghttp3_settings.glitch_ratelim_rate>` = 33
*/
NGHTTP3_EXTERN void
nghttp3_settings_default_versioned(int settings_version,
nghttp3_settings *settings);
/**
* @function
*
* `nghttp3_conn_client_new` creates :type:`nghttp3_conn`, and
* initializes it for client use. The pointer to the object is stored
* in |*pconn|. If |mem| is ``NULL``, the memory allocator returned
* by `nghttp3_mem_default` is used.
*
* This function returns 0 if it succeeds, or one of the following
* negative error codes:
*
vendor/nghttp3-1.18.0/lib/includes/nghttp3/nghttp3.h view on Meta::CPAN
*
* `nghttp3_conn_del` frees resources allocated for |conn|. This
* function also frees memory pointed by |conn| itself. This function
* does nothing if |conn| is NULL.
*/
NGHTTP3_EXTERN void nghttp3_conn_del(nghttp3_conn *conn);
/**
* @function
*
* `nghttp3_conn_bind_control_stream` binds stream denoted by
* |stream_id| to outgoing unidirectional control stream.
*
* This function returns 0 if it succeeds, or one of the following
* negative error codes:
*
* :macro:`NGHTTP3_ERR_INVALID_STATE`
* Control stream has already corresponding stream ID.
* :macro:`NGHTTP3_ERR_NOMEM`
* Out of memory.
*/
NGHTTP3_EXTERN int nghttp3_conn_bind_control_stream(nghttp3_conn *conn,
int64_t stream_id);
/**
* @function
*
* `nghttp3_conn_bind_qpack_streams` binds stream denoted by
* |qenc_stream_id| to outgoing QPACK encoder stream, and stream
* denoted by |qdec_stream_id| to outgoing QPACK encoder stream.
*
* This function returns 0 if it succeeds, or one of the following
* negative error codes:
*
* :macro:`NGHTTP3_ERR_INVALID_STATE`
* QPACK encoder/decoder stream have already corresponding stream
* IDs.
* :macro:`NGHTTP3_ERR_NOMEM`
* Out of memory.
*/
NGHTTP3_EXTERN int nghttp3_conn_bind_qpack_streams(nghttp3_conn *conn,
int64_t qenc_stream_id,
int64_t qdec_stream_id);
/**
* @function
*
* .. warning::
*
* .. version-deprecated:: 1.12.0
* Use `nghttp3_conn_read_stream2` instead.
*
* `nghttp3_conn_read_stream` reads data |src| of length |srclen| on
* stream identified by |stream_id|. It returns the number of bytes
* consumed. The "consumed" means that application can increase flow
* control credit (both stream and connection) of underlying QUIC
* connection by that amount. It does not include the amount of data
* carried by DATA frame which contains application data (excluding
* any control or QPACK unidirectional streams). See
* :type:`nghttp3_recv_data` to handle those bytes. If |fin| is
* nonzero, this is the last data from remote endpoint in this stream.
*
* This function returns the number of bytes consumed, or one of the
* following negative error codes:
*
* :macro:`NGHTTP3_ERR_NOMEM`
* Out of memory.
* :macro:`NGHTTP3_ERR_CALLBACK_FAILURE`
* User callback failed.
*
* It may return the other error codes. The negative error code means
* that |conn| encountered a connection error, and the connection must
* be closed. Calling nghttp3 API other than `nghttp3_conn_del`
* causes undefined behavior.
*/
NGHTTP3_EXTERN nghttp3_ssize nghttp3_conn_read_stream(nghttp3_conn *conn,
int64_t stream_id,
const uint8_t *src,
size_t srclen, int fin);
/**
* @function
*
* `nghttp3_conn_read_stream2` reads data |src| of length |srclen| on
* stream identified by |stream_id|. It returns the number of bytes
* consumed. The "consumed" means that application can increase flow
* control credit (both stream and connection) of underlying QUIC
* connection by that amount. It does not include the amount of data
* carried by DATA frame which contains application data (excluding
* any control or QPACK unidirectional streams). See
* :type:`nghttp3_recv_data` to handle those bytes. If |fin| is
* nonzero, this is the last data from remote endpoint in this stream.
* |ts| is the current timestamp, and must be non-decreasing. It
* should be obtained from the clock that is steadily increasing.
*
* This function returns the number of bytes consumed, or one of the
* following negative error codes:
*
* :macro:`NGHTTP3_ERR_NOMEM`
* Out of memory.
* :macro:`NGHTTP3_ERR_CALLBACK_FAILURE`
* User callback failed.
*
* It may return the other error codes. The negative error code means
* that |conn| encountered a connection error, and the connection must
* be closed. Calling nghttp3 API other than `nghttp3_conn_del`
* causes undefined behavior.
*
* .. version-added:: 1.12.0
*/
NGHTTP3_EXTERN nghttp3_ssize nghttp3_conn_read_stream2(nghttp3_conn *conn,
int64_t stream_id,
const uint8_t *src,
size_t srclen, int fin,
nghttp3_tstamp ts);
/**
* @function
*
* `nghttp3_conn_writev_stream` stores stream data to send to |vec| of
* length |veccnt|, and returns the number of nghttp3_vec object in
* which it stored data. It stores stream ID to |*pstream_id|. An
* application has to call `nghttp3_conn_add_write_offset` to inform
* |conn| of the actual number of bytes that underlying QUIC stack
* accepted. |*pfin| will be nonzero if this is the last data to
* send. If there is no stream to write data or send fin, this
* function returns 0, and -1 is assigned to |*pstream_id|. This
* function may return 0, and |*pstream_id| is not -1, and |*pfin| is
* nonzero. It means 0 length data to |*pstream_id|, and it is the
* last data to the stream. They must be passed to QUIC stack, and
* they are accepted, the application has to call
* `nghttp3_conn_add_write_offset` with 0 byte.
*
* This function returns the number of bytes consumed, or one of the
* following negative error codes:
*
* :macro:`NGHTTP3_ERR_NOMEM`
* Out of memory.
* :macro:`NGHTTP3_ERR_CALLBACK_FAILURE`
* User callback failed.
*
* It may return the other error codes. The negative error code means
* that |conn| encountered a connection error, and the connection must
* be closed. Calling nghttp3 API other than `nghttp3_conn_del`
* causes undefined behavior.
*/
NGHTTP3_EXTERN nghttp3_ssize nghttp3_conn_writev_stream(nghttp3_conn *conn,
int64_t *pstream_id,
int *pfin,
nghttp3_vec *vec,
size_t veccnt);
vendor/nghttp3-1.18.0/lib/includes/nghttp3/nghttp3.h view on Meta::CPAN
* A critical stream is closed.
* :macro:`NGHTTP3_ERR_CALLBACK_FAILURE`
* User callback failed
*
* .. version-added:: 1.18.0
*/
NGHTTP3_EXTERN int nghttp3_conn_close_stream2(nghttp3_conn *conn,
uint32_t flags, int64_t stream_id,
uint64_t rx_app_error_code,
uint64_t tx_app_error_code);
/**
* @macrosection
*
* Data flags
*/
/**
* @macro
*
* :macro:`NGHTTP3_DATA_FLAG_NONE` indicates no flag set.
*/
#define NGHTTP3_DATA_FLAG_NONE 0x00U
/**
* @macro
*
* :macro:`NGHTTP3_DATA_FLAG_EOF` indicates that all request or
* response body has been provided to the library. It also indicates
* that sending side of stream is closed unless
* :macro:`NGHTTP3_DATA_FLAG_NO_END_STREAM` is given at the same time.
*/
#define NGHTTP3_DATA_FLAG_EOF 0x01U
/**
* @macro
*
* :macro:`NGHTTP3_DATA_FLAG_NO_END_STREAM` indicates that sending
* side of stream is not closed even if :macro:`NGHTTP3_DATA_FLAG_EOF`
* is set. Usually this flag is used to send trailer fields with
* `nghttp3_conn_submit_trailers`. If `nghttp3_conn_submit_trailers`
* has been called, regardless of this flag, the submitted trailer
* fields are sent.
*/
#define NGHTTP3_DATA_FLAG_NO_END_STREAM 0x02U
/**
* @function
*
* `nghttp3_conn_set_max_client_streams_bidi` tells |conn| the
* cumulative number of bidirectional streams that client can open.
*/
NGHTTP3_EXTERN void
nghttp3_conn_set_max_client_streams_bidi(nghttp3_conn *conn,
uint64_t max_streams);
/**
* @function
*
* `nghttp3_conn_set_max_concurrent_streams` tells |conn| the maximum
* number of concurrent streams that a remote endpoint can open,
* including both bidirectional and unidirectional streams which
* potentially receive QPACK encoded HEADERS frame. This value is
* used as a hint to limit the internal resource consumption.
*/
NGHTTP3_EXTERN void
nghttp3_conn_set_max_concurrent_streams(nghttp3_conn *conn,
size_t max_concurrent_streams);
/**
* @functypedef
*
* :type:`nghttp3_read_data_callback` is a callback function invoked
* when the library asks an application to provide stream data for a
* stream denoted by |stream_id|.
*
* The library provides |vec| of length |veccnt| to the application.
* The application should fill data and its length to |vec|. It has
* to return the number of the filled objects. The application must
* retain data until they are safe to free. It is notified by
* :type:`nghttp3_acked_stream_data` callback.
*
* If this is the last data to send (or there is no data to send
* because all data have been sent already), set
* :macro:`NGHTTP3_DATA_FLAG_EOF` to |*pflags|.
*
* If the application is unable to provide data temporarily, return
* :macro:`NGHTTP3_ERR_WOULDBLOCK`. When it is ready to provide data,
* call `nghttp3_conn_resume_stream`.
*
* The callback should return the number of objects in |vec| that the
* application filled if it succeeds, or
* :macro:`NGHTTP3_ERR_CALLBACK_FAILURE`.
*
* TODO Add NGHTTP3_ERR_TEMPORAL_CALLBACK_FAILURE to reset just this
* stream.
*/
typedef nghttp3_ssize (*nghttp3_read_data_callback)(
nghttp3_conn *conn, int64_t stream_id, nghttp3_vec *vec, size_t veccnt,
uint32_t *pflags, void *conn_user_data, void *stream_user_data);
/**
* @struct
*
* :type:`nghttp3_data_reader` specifies the way how to generate
* request or response body.
*/
typedef struct nghttp3_data_reader {
/**
* :member:`read_data` is a callback function to generate body.
*/
nghttp3_read_data_callback read_data;
} nghttp3_data_reader;
/**
* @function
*
* `nghttp3_conn_submit_request` submits HTTP request header fields
* and body on the stream identified by |stream_id|. |stream_id| must
* be a client initiated bidirectional stream. Only client can submit
* HTTP request. |nva| of length |nvlen| specifies HTTP request
vendor/nghttp3-1.18.0/lib/includes/nghttp3/nghttp3.h view on Meta::CPAN
*
* :macro:`NGHTTP3_ERR_STREAM_NOT_FOUND`
* Stream not found
* :macro:`NGHTTP3_ERR_NOMEM`
* Out of memory.
*/
NGHTTP3_EXTERN int nghttp3_conn_submit_info(nghttp3_conn *conn,
int64_t stream_id,
const nghttp3_nv *nva,
size_t nvlen);
/**
* @function
*
* `nghttp3_conn_submit_response` submits HTTP response header fields
* and body on the stream identified by |stream_id|. |nva| of length
* |nvlen| specifies HTTP response header fields. |dr| specifies a
* response body. If there is no response body, specify NULL. If
* |dr| is NULL, it implies the end of stream.
*
* This function returns 0 if it succeeds, or one of the following
* negative error codes:
*
* :macro:`NGHTTP3_ERR_STREAM_NOT_FOUND`
* Stream not found
* :macro:`NGHTTP3_ERR_NOMEM`
* Out of memory.
*/
NGHTTP3_EXTERN int nghttp3_conn_submit_response(nghttp3_conn *conn,
int64_t stream_id,
const nghttp3_nv *nva,
size_t nvlen,
const nghttp3_data_reader *dr);
/**
* @function
*
* `nghttp3_conn_submit_trailers` submits HTTP trailer fields on the
* stream identified by |stream_id|. |nva| of length |nvlen|
* specifies HTTP trailer fields. Calling this function implies the
* end of stream.
*
* This function returns 0 if it succeeds, or one of the following
* negative error codes:
*
* :macro:`NGHTTP3_ERR_STREAM_NOT_FOUND`
* Stream not found
* :macro:`NGHTTP3_ERR_INVALID_STATE`
* Application has already submitted fin to stream.
* :macro:`NGHTTP3_ERR_NOMEM`
* Out of memory.
*/
NGHTTP3_EXTERN int nghttp3_conn_submit_trailers(nghttp3_conn *conn,
int64_t stream_id,
const nghttp3_nv *nva,
size_t nvlen);
/**
* @function
*
* `nghttp3_conn_submit_shutdown_notice` notifies the other endpoint
* to stop creating new stream. After a couple of RTTs later, call
* `nghttp3_conn_shutdown` to start graceful shutdown.
*
* This function returns 0 if it succeeds, or one of the following
* negative error codes:
*
* :macro:`NGHTTP3_ERR_NOMEM`
* Out of memory.
*/
NGHTTP3_EXTERN int nghttp3_conn_submit_shutdown_notice(nghttp3_conn *conn);
/**
* @function
*
* `nghttp3_conn_shutdown` starts graceful shutdown. It should be
* called after `nghttp3_conn_submit_shutdown_notice` and a couple of
* RTTs. After calling this function, the local endpoint starts
* rejecting new incoming streams. The existing streams are processed
* normally. See also `nghttp3_conn_is_drained`.
*
* This function returns 0 if it succeeds, or one of the following
* negative error codes:
*
* :macro:`NGHTTP3_ERR_NOMEM`
* Out of memory.
*/
NGHTTP3_EXTERN int nghttp3_conn_shutdown(nghttp3_conn *conn);
/**
* @function
*
* `nghttp3_conn_set_stream_user_data` sets |stream_user_data| to the
* stream identified by |stream_id|.
*
* This function returns 0 if it succeeds, or one of the following
* negative error codes:
*
* :macro:`NGHTTP3_ERR_STREAM_NOT_FOUND`
* Stream not found.
*/
NGHTTP3_EXTERN int nghttp3_conn_set_stream_user_data(nghttp3_conn *conn,
int64_t stream_id,
void *stream_user_data);
/**
* @function
*
* `nghttp3_conn_get_stream_user_data` returns the user data
* associated to the stream identified by |stream_id|. If no data is
* associated or the stream is not found, this function returns NULL.
*
* The user data can be associated to the stream by the following
* functions:
*
* - `nghttp3_conn_set_stream_user_data`
* - `nghttp3_conn_submit_request`
*
* .. version-added:: 1.16.0
*/
NGHTTP3_EXTERN void *nghttp3_conn_get_stream_user_data(const nghttp3_conn *conn,
int64_t stream_id);
/**
* @function
*
* .. warning::
*
* .. version-deprecated:: 1.16.0
* Use `nghttp3_conn_get_frame_payload_left2` instead.
*
* `nghttp3_conn_get_frame_payload_left` returns the number of bytes
* left to read current frame payload for a stream denoted by
* |stream_id|. If no such stream is found, or |stream_id| identifies
* neither client bidirectional stream nor remote control stream, it
* returns 0.
*/
NGHTTP3_EXTERN uint64_t nghttp3_conn_get_frame_payload_left(nghttp3_conn *conn,