Macros

Library version macros

NGTCP2_VERSION

Version number of the ngtcp2 library release.

NGTCP2_VERSION_NUM

Numerical representation of the version number of the ngtcp2 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.

QUIC protocol version macros

NGTCP2_PROTO_VER_V1

NGTCP2_PROTO_VER_V1 is the QUIC version 1.

NGTCP2_PROTO_VER_V2

NGTCP2_PROTO_VER_V2 is the QUIC version 2. See RFC 9369.

NGTCP2_PROTO_VER_MAX

NGTCP2_PROTO_VER_MAX is the highest QUIC version that this library supports. Deprecated since v1.1.0.

NGTCP2_PROTO_VER_MIN

NGTCP2_PROTO_VER_MIN is the lowest QUIC version that this library supports. Deprecated since v1.1.0.

NGTCP2_RESERVED_VERSION_MASK

NGTCP2_RESERVED_VERSION_MASK is the bit mask of reserved version.

QUIC specific macros

NGTCP2_MAX_VARINT

NGTCP2_MAX_VARINT is the maximum value which can be encoded in variable-length integer encoding.

NGTCP2_STATELESS_RESET_TOKENLEN

NGTCP2_STATELESS_RESET_TOKENLEN is the length of Stateless Reset Token.

NGTCP2_MIN_STATELESS_RESET_RANDLEN

NGTCP2_MIN_STATELESS_RESET_RANDLEN is the minimum length of random bytes (Unpredictable Bits) in Stateless Reset packet.

NGTCP2_PATH_CHALLENGE_DATALEN

NGTCP2_PATH_CHALLENGE_DATALEN is the length of PATH_CHALLENGE data.

NGTCP2_RETRY_KEY_V1

NGTCP2_RETRY_KEY_V1 is an encryption key to create integrity tag of Retry packet. It is used for QUIC v1.

NGTCP2_RETRY_NONCE_V1

NGTCP2_RETRY_NONCE_V1 is nonce used when generating integrity tag of Retry packet. It is used for QUIC v1.

NGTCP2_RETRY_KEY_V2

NGTCP2_RETRY_KEY_V2 is an encryption key to create integrity tag of Retry packet. It is used for QUIC v2. See RFC 9369.

NGTCP2_RETRY_NONCE_V2

NGTCP2_RETRY_NONCE_V2 is nonce used when generating integrity tag of Retry packet. It is used for QUIC v2. See RFC 9369.

NGTCP2_HP_MASKLEN

NGTCP2_HP_MASKLEN is the length of header protection mask.

NGTCP2_HP_SAMPLELEN

NGTCP2_HP_SAMPLELEN is the number bytes sampled when encrypting a packet header.

NGTCP2_DEFAULT_INITIAL_RTT

NGTCP2_DEFAULT_INITIAL_RTT is a default initial RTT.

NGTCP2_MAX_CIDLEN

NGTCP2_MAX_CIDLEN is the maximum length of Connection ID.

NGTCP2_MIN_CIDLEN

NGTCP2_MIN_CIDLEN is the minimum length of Connection ID.

NGTCP2_MIN_INITIAL_DCIDLEN

NGTCP2_MIN_INITIAL_DCIDLEN is the minimum length of Destination Connection ID in Client Initial packet if it does not bear token from Retry packet.

ngtcp2 library error codes

NGTCP2_ERR_INVALID_ARGUMENT

NGTCP2_ERR_INVALID_ARGUMENT indicates that a passed argument is invalid.

NGTCP2_ERR_NOBUF

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

NGTCP2_ERR_PROTO

NGTCP2_ERR_PROTO indicates a general protocol error.

NGTCP2_ERR_INVALID_STATE

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

NGTCP2_ERR_ACK_FRAME

NGTCP2_ERR_ACK_FRAME indicates that an invalid ACK frame is received.

NGTCP2_ERR_STREAM_ID_BLOCKED

NGTCP2_ERR_STREAM_ID_BLOCKED indicates that there is no spare stream ID available.

NGTCP2_ERR_STREAM_IN_USE

NGTCP2_ERR_STREAM_IN_USE indicates that a stream ID is already in use.

NGTCP2_ERR_STREAM_DATA_BLOCKED

NGTCP2_ERR_STREAM_DATA_BLOCKED indicates that stream data cannot be sent because of flow control.

NGTCP2_ERR_FLOW_CONTROL

NGTCP2_ERR_FLOW_CONTROL indicates flow control error.

NGTCP2_ERR_CONNECTION_ID_LIMIT

NGTCP2_ERR_CONNECTION_ID_LIMIT indicates that the number of received Connection ID exceeds acceptable limit.

NGTCP2_ERR_STREAM_LIMIT

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

NGTCP2_ERR_FINAL_SIZE

NGTCP2_ERR_FINAL_SIZE indicates that inconsistent final size of a stream.

NGTCP2_ERR_CRYPTO

NGTCP2_ERR_CRYPTO indicates crypto (TLS) related error.

NGTCP2_ERR_PKT_NUM_EXHAUSTED

NGTCP2_ERR_PKT_NUM_EXHAUSTED indicates that packet number is exhausted.

NGTCP2_ERR_REQUIRED_TRANSPORT_PARAM

NGTCP2_ERR_REQUIRED_TRANSPORT_PARAM indicates that a required transport parameter is missing.

NGTCP2_ERR_MALFORMED_TRANSPORT_PARAM

NGTCP2_ERR_MALFORMED_TRANSPORT_PARAM indicates that a transport parameter is malformed.

NGTCP2_ERR_FRAME_ENCODING

NGTCP2_ERR_FRAME_ENCODING indicates there is an error in frame encoding.

NGTCP2_ERR_DECRYPT

NGTCP2_ERR_DECRYPT indicates a decryption failure.

NGTCP2_ERR_STREAM_SHUT_WR

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

NGTCP2_ERR_STREAM_NOT_FOUND

NGTCP2_ERR_STREAM_NOT_FOUND indicates that a stream was not found.

NGTCP2_ERR_STREAM_STATE

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

NGTCP2_ERR_RECV_VERSION_NEGOTIATION

NGTCP2_ERR_RECV_VERSION_NEGOTIATION indicates that Version Negotiation packet was received.

NGTCP2_ERR_CLOSING

NGTCP2_ERR_CLOSING indicates that connection is in closing state.

NGTCP2_ERR_DRAINING

NGTCP2_ERR_DRAINING indicates that connection is in draining state.

NGTCP2_ERR_TRANSPORT_PARAM

NGTCP2_ERR_TRANSPORT_PARAM indicates a general transport parameter error.

NGTCP2_ERR_DISCARD_PKT

NGTCP2_ERR_DISCARD_PKT indicates a packet was discarded.

NGTCP2_ERR_CONN_ID_BLOCKED

NGTCP2_ERR_CONN_ID_BLOCKED indicates that there is no spare Connection ID available.

NGTCP2_ERR_INTERNAL

NGTCP2_ERR_INTERNAL indicates an internal error.

NGTCP2_ERR_CRYPTO_BUFFER_EXCEEDED

NGTCP2_ERR_CRYPTO_BUFFER_EXCEEDED indicates that a crypto buffer exceeded.

NGTCP2_ERR_WRITE_MORE

NGTCP2_ERR_WRITE_MORE indicates NGTCP2_WRITE_STREAM_FLAG_MORE is used and a function call succeeded.

NGTCP2_ERR_RETRY

NGTCP2_ERR_RETRY indicates that server should send Retry packet.

NGTCP2_ERR_DROP_CONN

NGTCP2_ERR_DROP_CONN indicates that an endpoint should drop connection immediately.

NGTCP2_ERR_AEAD_LIMIT_REACHED

NGTCP2_ERR_AEAD_LIMIT_REACHED indicates AEAD encryption limit is reached and key update is not available. An endpoint should drop connection immediately.

NGTCP2_ERR_NO_VIABLE_PATH

NGTCP2_ERR_NO_VIABLE_PATH indicates that path validation could not probe that a path is capable of sending UDP datagram payload of size at least 1200 bytes.

NGTCP2_ERR_VERSION_NEGOTIATION

NGTCP2_ERR_VERSION_NEGOTIATION indicates that server should send Version Negotiation packet.

NGTCP2_ERR_HANDSHAKE_TIMEOUT

NGTCP2_ERR_HANDSHAKE_TIMEOUT indicates that QUIC connection is not established before the specified deadline.

NGTCP2_ERR_VERSION_NEGOTIATION_FAILURE

NGTCP2_ERR_VERSION_NEGOTIATION_FAILURE indicates the version negotiation failed.

NGTCP2_ERR_IDLE_CLOSE

NGTCP2_ERR_IDLE_CLOSE indicates the connection should be closed silently because of idle timeout.

NGTCP2_ERR_FATAL

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

NGTCP2_ERR_NOMEM

NGTCP2_ERR_NOMEM indicates out of memory.

NGTCP2_ERR_CALLBACK_FAILURE

NGTCP2_ERR_CALLBACK_FAILURE indicates that user defined callback function failed.

QUIC packet header flags

NGTCP2_PKT_FLAG_NONE

NGTCP2_PKT_FLAG_NONE indicates no flag set.

NGTCP2_PKT_FLAG_LONG_FORM

NGTCP2_PKT_FLAG_LONG_FORM indicates the Long header packet header.

NGTCP2_PKT_FLAG_FIXED_BIT_CLEAR

NGTCP2_PKT_FLAG_FIXED_BIT_CLEAR indicates that Fixed Bit (aka QUIC bit) is not set.

NGTCP2_PKT_FLAG_KEY_PHASE

NGTCP2_PKT_FLAG_KEY_PHASE indicates Key Phase bit set.

QUIC transport error code

NGTCP2_NO_ERROR

NGTCP2_NO_ERROR is QUIC transport error code NO_ERROR.

NGTCP2_INTERNAL_ERROR

NGTCP2_INTERNAL_ERROR is QUIC transport error code INTERNAL_ERROR.

NGTCP2_CONNECTION_REFUSED

NGTCP2_CONNECTION_REFUSED is QUIC transport error code CONNECTION_REFUSED.

NGTCP2_FLOW_CONTROL_ERROR

NGTCP2_FLOW_CONTROL_ERROR is QUIC transport error code FLOW_CONTROL_ERROR.

NGTCP2_STREAM_LIMIT_ERROR

NGTCP2_STREAM_LIMIT_ERROR is QUIC transport error code STREAM_LIMIT_ERROR.

NGTCP2_STREAM_STATE_ERROR

NGTCP2_STREAM_STATE_ERROR is QUIC transport error code STREAM_STATE_ERROR.

NGTCP2_FINAL_SIZE_ERROR

NGTCP2_FINAL_SIZE_ERROR is QUIC transport error code FINAL_SIZE_ERROR.

NGTCP2_FRAME_ENCODING_ERROR

NGTCP2_FRAME_ENCODING_ERROR is QUIC transport error code FRAME_ENCODING_ERROR.

NGTCP2_TRANSPORT_PARAMETER_ERROR

NGTCP2_TRANSPORT_PARAMETER_ERROR is QUIC transport error code TRANSPORT_PARAMETER_ERROR.

NGTCP2_CONNECTION_ID_LIMIT_ERROR

NGTCP2_CONNECTION_ID_LIMIT_ERROR is QUIC transport error code CONNECTION_ID_LIMIT_ERROR.

NGTCP2_PROTOCOL_VIOLATION

NGTCP2_PROTOCOL_VIOLATION is QUIC transport error code PROTOCOL_VIOLATION.

NGTCP2_INVALID_TOKEN

NGTCP2_INVALID_TOKEN is QUIC transport error code INVALID_TOKEN.

NGTCP2_APPLICATION_ERROR

NGTCP2_APPLICATION_ERROR is QUIC transport error code APPLICATION_ERROR.

NGTCP2_CRYPTO_BUFFER_EXCEEDED

NGTCP2_CRYPTO_BUFFER_EXCEEDED is QUIC transport error code CRYPTO_BUFFER_EXCEEDED.

NGTCP2_KEY_UPDATE_ERROR

NGTCP2_KEY_UPDATE_ERROR is QUIC transport error code KEY_UPDATE_ERROR.

NGTCP2_AEAD_LIMIT_REACHED

NGTCP2_AEAD_LIMIT_REACHED is QUIC transport error code AEAD_LIMIT_REACHED.

NGTCP2_NO_VIABLE_PATH

NGTCP2_NO_VIABLE_PATH is QUIC transport error code NO_VIABLE_PATH.

NGTCP2_CRYPTO_ERROR

NGTCP2_CRYPTO_ERROR is QUIC transport error code CRYPTO_ERROR.

NGTCP2_VERSION_NEGOTIATION_ERROR

NGTCP2_VERSION_NEGOTIATION_ERROR is QUIC transport error code VERSION_NEGOTIATION_ERROR. See RFC 9368.

STREAM frame data flags

NGTCP2_STREAM_DATA_FLAG_NONE

NGTCP2_STREAM_DATA_FLAG_NONE indicates no flag set.

NGTCP2_STREAM_DATA_FLAG_FIN

NGTCP2_STREAM_DATA_FLAG_FIN indicates that this chunk of data is final piece of an incoming stream.

NGTCP2_STREAM_DATA_FLAG_0RTT

NGTCP2_STREAM_DATA_FLAG_0RTT indicates that this chunk of data contains data received in 0-RTT packet, and the handshake has not completed yet, which means that the data might be replayed.

Stream close flags

NGTCP2_STREAM_CLOSE_FLAG_NONE

NGTCP2_STREAM_CLOSE_FLAG_NONE indicates no flag set.

NGTCP2_STREAM_CLOSE_FLAG_APP_ERROR_CODE_SET

NGTCP2_STREAM_CLOSE_FLAG_APP_ERROR_CODE_SET indicates that app_error_code parameter is set.

DATAGRAM frame flags

NGTCP2_DATAGRAM_FLAG_NONE

NGTCP2_DATAGRAM_FLAG_NONE indicates no flag set.

NGTCP2_DATAGRAM_FLAG_0RTT

NGTCP2_DATAGRAM_FLAG_0RTT indicates that DATAGRAM frame is received in 0-RTT packet, and the handshake has not completed yet, which means that the data might be replayed.

Write stream data flags

NGTCP2_WRITE_STREAM_FLAG_NONE

NGTCP2_WRITE_STREAM_FLAG_NONE indicates no flag set.

NGTCP2_WRITE_STREAM_FLAG_MORE

NGTCP2_WRITE_STREAM_FLAG_MORE indicates that more data may come, and should be coalesced into the same packet if possible.

NGTCP2_WRITE_STREAM_FLAG_FIN

NGTCP2_WRITE_STREAM_FLAG_FIN indicates that a passed data is the final part of a stream.

Write datagram flags

NGTCP2_WRITE_DATAGRAM_FLAG_NONE

NGTCP2_WRITE_DATAGRAM_FLAG_NONE indicates no flag set.

NGTCP2_WRITE_DATAGRAM_FLAG_MORE

NGTCP2_WRITE_DATAGRAM_FLAG_MORE indicates that more data may come, and should be coalesced into the same packet if possible.

ngtcp2_info macros

NGTCP2_VERSION_AGE

NGTCP2_VERSION_AGE is the age of ngtcp2_info