Macros

NGHTTP2_VERSION

Version number of the nghttp2 library release.

NGHTTP2_VERSION_NUM

Numerical representation of the version number of the nghttp2 library release. This is a 24 bit number with 8 bits for major number, 8 bits for minor and 8 bits for patch. Version 1.2.3 becomes 0x010203.

HTTP/2 specific macros

NGHTTP2_CLIENT_HTTP2_PREFACE

NGHTTP2_CLIENT_HTTP2_PREFACE is the client HTTP/2 preface.

NGHTTP2_HPACK_DEFAULT_DTABLE_CAPACITY

NGHTTP2_HPACK_DEFAULT_DTABLE_CAPACITY is the default maximum HPACK dynamic header table capacity.

NGHTTP2_INITIAL_WINDOW_SIZE

NGHTTP2_INITIAL_WINDOW_SIZE is the default initial window size for both connection and stream-level flow control.

NGHTTP2_MAX_EXTRA_SETTINGS

NGHTTP2_MAX_EXTRA_SETTINGS is the maximum number of extra SETTINGS entries that can be specified in nghttp2_settings.extra_settings and nghttp2_settings.extra_settingslen.

nghttp2 library error codes

NGHTTP2_ERR_INVALID_ARGUMENT

NGHTTP2_ERR_INVALID_ARGUMENT indicates that a passed argument is invalid.

NGHTTP2_ERR_NOBUF

NGHTTP2_ERR_NOBUF indicates that a provided buffer does not have enough space to store data.

NGHTTP2_ERR_PROTO

NGHTTP2_ERR_PROTO indicates a general protocol error.

NGHTTP2_ERR_INVALID_STATE

NGHTTP2_ERR_INVALID_STATE indicates that a requested operation is not allowed at the current connection state.

NGHTTP2_ERR_HPACK_FATAL

NGHTTP2_ERR_HPACK_FATAL indicates that HPACK encoder or decoder encounters an error.

NGHTTP2_ERR_STREAM_ID_BLOCKED

NGHTTP2_ERR_STREAM_ID_BLOCKED indicates that there is no spare stream ID available.

NGHTTP2_ERR_REFUSED_STREAM

NGHTTP2_ERR_REFUSED_STREAM indicates that stream creation is refused.

NGHTTP2_ERR_WOULDBLOCK

NGHTTP2_ERR_WOULDBLOCK indicates that an operation might block.

NGHTTP2_ERR_FLOW_CONTROL

NGHTTP2_ERR_FLOW_CONTROL indicates flow control error.

NGHTTP2_ERR_FRAME_SIZE

NGHTTP2_ERR_FRAME_SIZE indicates that the incoming frame is too large.

NGHTTP2_ERR_STREAM_LIMIT

NGHTTP2_ERR_STREAM_LIMIT indicates that a remote endpoint opens more streams that is permitted.

NGHTTP2_ERR_MALFORMED_HTTP_HEADER

NGHTTP2_ERR_MALFORMED_HTTP_HEADER indicates that an HTTP header field is malformed.

NGHTTP2_ERR_REMOVE_HTTP_HEADER

NGHTTP2_ERR_REMOVE_HTTP_HEADER indicates that an HTTP header field is discarded.

NGHTTP2_ERR_MALFORMED_HTTP_MESSAGING

NGHTTP2_ERR_MALFORMED_HTTP_MESSAGING indicates that HTTP messaging is malformed.

NGHTTP2_ERR_STREAM_DATA_OVERFLOW

NGHTTP2_ERR_STREAM_DATA_OVERFLOW indicates that stream data is too large.

NGHTTP2_ERR_SETTINGS_TIMEOUT

NGHTTP2_ERR_SETTINGS_TIMEOUT indicates that SETTINGS ACK has not been received within the configured period of time.

NGHTTP2_ERR_FRAME_ENCODING

NGHTTP2_ERR_FRAME_ENCODING indicates there is an error in frame encoding.

NGHTTP2_ERR_STREAM_SHUT_WR

NGHTTP2_ERR_STREAM_SHUT_WR indicates no more data can be sent to a stream.

NGHTTP2_ERR_STREAM_NOT_FOUND

NGHTTP2_ERR_STREAM_NOT_FOUND indicates that a stream was not found.

NGHTTP2_ERR_STREAM_STATE

NGHTTP2_ERR_STREAM_STATE indicates that a requested operation is not allowed at the current stream state.

NGHTTP2_ERR_STOP_READING

NGHTTP2_ERR_STOP_READING indicates that the local endpoint stops reading any input.

NGHTTP2_ERR_CLOSING

NGHTTP2_ERR_CLOSING indicates that connection is in closing state.

NGHTTP2_ERR_DRAINING

NGHTTP2_ERR_DRAINING indicates that connection is in draining state.

NGHTTP2_ERR_INTERNAL

NGHTTP2_ERR_INTERNAL indicates an internal error.

NGHTTP2_ERR_FATAL

NGHTTP2_ERR_FATAL indicates that error codes less than this value is fatal error. When this error is returned, an endpoint should close connection immediately.

NGHTTP2_ERR_NOMEM

NGHTTP2_ERR_NOMEM indicates out of memory.

NGHTTP2_ERR_CALLBACK_FAILURE

NGHTTP2_ERR_CALLBACK_FAILURE indicates that user defined callback function failed.

NGHTTP2_ERR_EXCESSIVE_LOAD

NGHTTP2_ERR_EXCESSIVE_LOAD indicates that the remote endpoint exhibits the behavior that causes the excessive load to the local endpoint.

HTTP/2 error codes

NGHTTP2_NO_ERROR

NGHTTP2_NO_ERROR is HTTP/2 error code NO_ERROR.

NGHTTP2_PROTOCOL_ERROR

NGHTTP2_PROTOCOL_ERROR is HTTP/2 error code PROTOCOL_ERROR.

NGHTTP2_INTERNAL_ERROR

NGHTTP2_INTERNAL_ERROR is HTTP/2 error code INTERNAL_ERROR.

NGHTTP2_FLOW_CONTROL_ERROR

NGHTTP2_FLOW_CONTROL_ERROR is HTTP/2 error code FLOW_CONTROL_ERROR.

NGHTTP2_SETTINGS_TIMEOUT

NGHTTP2_SETTINGS_TIMEOUT is HTTP/2 error code SETTINGS_TIMEOUT.

NGHTTP2_STREAM_CLOSED

NGHTTP2_STREAM_CLOSED is HTTP/2 error code STREAM_CLOSED.

NGHTTP2_FRAME_SIZE_ERROR

NGHTTP2_FRAME_SIZE_ERROR is HTTP/2 error code FRAME_SIZE_ERROR.

NGHTTP2_REFUSED_STREAM

NGHTTP2_REFUSED_STREAM is HTTP/2 error code REFUSED_STREAM.

NGHTTP2_CANCEL

NGHTTP2_CANCEL is HTTP/2 error code CANCEL.

NGHTTP2_COMPRESSION_ERROR

NGHTTP2_COMPRESSION_ERROR is HTTP/2 error code COMPRESSION_ERROR.

NGHTTP2_CONNECT_ERROR

NGHTTP2_CONNECT_ERROR is HTTP/2 error code CONNECT_ERROR.

NGHTTP2_ENHANCE_YOUR_CALM

NGHTTP2_ENHANCE_YOUR_CALM is HTTP/2 error code ENHANCE_YOUR_CALM.

NGHTTP2_INADEQUATE_SECURITY

NGHTTP2_INADEQUATE_SECURITY is HTTP/2 error code INADEQUATE_SECURITY.

NGHTTP2_HTTP_1_1_REQUIRED

NGHTTP2_HTTP_1_1_REQUIRED is HTTP/2 error code HTTP_1_1_REQUIRED.

nghttp2_buf helper macros

nghttp2_buf_left(BUF)

nghttp2_buf_left() returns the number of additional bytes which can be written to the underlying buffer. In other words, it returns buf->end - buf->last.

nghttp2_buf_len(BUF)

nghttp2_buf_len() returns the number of bytes left to read. In other words, it returns buf->last - buf->pos.

Flags for HTTP field name/value pair

NGHTTP2_NV_FLAG_NONE

NGHTTP2_NV_FLAG_NONE indicates no flag set.

NGHTTP2_NV_FLAG_NEVER_INDEX

NGHTTP2_NV_FLAG_NEVER_INDEX indicates that this name/value pair must not be indexed. Other implementation calls this bit as “sensitive”.

NGHTTP2_NV_FLAG_NO_COPY_NAME

NGHTTP2_NV_FLAG_NO_COPY_NAME is set solely by application. If this flag is set, the library does not make a copy of field name. This could improve performance.

NGHTTP2_NV_FLAG_NO_COPY_VALUE

NGHTTP2_NV_FLAG_NO_COPY_VALUE is set solely by application. If this flag is set, the library does not make a copy of field value. This could improve performance.

Stream close flags for nghttp2_stream_close callback.

NGHTTP2_STREAM_CLOSE_FLAG_NONE

NGHTTP2_STREAM_CLOSE_FLAG_NONE indicates no flag set.

NGHTTP2_STREAM_CLOSE_FLAG_ERROR_CODE_SET

NGHTTP2_STREAM_CLOSE_FLAG_ERROR_CODE_SET indicates that error_code parameter is set.

Data flags

NGHTTP2_READ_DATA_FLAG_NONE

NGHTTP2_READ_DATA_FLAG_NONE indicates no flag set.

NGHTTP2_READ_DATA_FLAG_EOF

NGHTTP2_READ_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 NGHTTP2_READ_DATA_FLAG_NO_END_STREAM is given at the same time.

NGHTTP2_READ_DATA_FLAG_NO_END_STREAM

NGHTTP2_READ_DATA_FLAG_NO_END_STREAM indicates that sending side of stream is not closed even if NGHTTP2_READ_DATA_FLAG_EOF is set. Usually this flag is used to send trailer fields with nghttp2_conn_submit_trailers(). If nghttp2_conn_submit_trailers() has been called, regardless of this flag, the submitted trailer fields are sent.

HTTP stream priority flags

NGHTTP2_DEFAULT_URGENCY

NGHTTP2_DEFAULT_URGENCY is the default urgency level.

NGHTTP2_URGENCY_HIGH

NGHTTP2_URGENCY_HIGH is the highest urgency level.

NGHTTP2_URGENCY_LOW

NGHTTP2_URGENCY_LOW is the lowest urgency level.

NGHTTP2_URGENCY_LEVELS

NGHTTP2_URGENCY_LEVELS is the number of urgency levels.

Flags for HPACK decoder

NGHTTP2_HPACK_DECODE_FLAG_NONE

NGHTTP2_HPACK_DECODE_FLAG_NONE indicates that no flag set.

NGHTTP2_HPACK_DECODE_FLAG_EMIT

NGHTTP2_HPACK_DECODE_FLAG_EMIT indicates that an HTTP field is successfully decoded.

NGHTTP2_HPACK_DECODE_FLAG_FINAL

NGHTTP2_HPACK_DECODE_FLAG_FINAL indicates that an entire HTTP field section has been decoded.