<liclass="toctree-l2"><aclass="reference internal"href="package_README.html#client-server-and-proxy-programs">Client, Server and Proxy programs</a></li>
<liclass="toctree-l2"><aclass="reference internal"href="package_README.html#libnghttp2-asio-high-level-http-2-c-library">libnghttp2_asio: High level HTTP/2 C++ library</a></li>
<liclass="toctree-l2"><aclass="reference internal"href="nghttpx-howto.html#specifying-additional-ca-certificate">Specifying additional CA certificate</a></li>
<p>Do not call <aclass="reference internal"href="#c.nghttp2_session_send"title="nghttp2_session_send"><ttclass="xref c c-func docutils literal"><spanclass="pre">nghttp2_session_send()</span></tt></a>, <aclass="reference internal"href="#c.nghttp2_session_mem_send"title="nghttp2_session_mem_send"><ttclass="xref c c-func docutils literal"><spanclass="pre">nghttp2_session_mem_send()</span></tt></a>,
<aclass="reference internal"href="#c.nghttp2_session_recv"title="nghttp2_session_recv"><ttclass="xref c c-func docutils literal"><spanclass="pre">nghttp2_session_recv()</span></tt></a> or <aclass="reference internal"href="#c.nghttp2_session_mem_recv"title="nghttp2_session_mem_recv"><ttclass="xref c c-func docutils literal"><spanclass="pre">nghttp2_session_mem_recv()</span></tt></a> from the
nghttp2 callback functions directly or indirectly. It will lead to the
crash. You can submit requests or frames in the callbacks then call
<p>Currently, <aclass="reference internal"href="#c.nghttp2_session_send"title="nghttp2_session_send"><ttclass="xref c c-func docutils literal"><spanclass="pre">nghttp2_session_send()</span></tt></a> and <aclass="reference internal"href="#c.nghttp2_session_mem_send"title="nghttp2_session_mem_send"><ttclass="xref c c-func docutils literal"><spanclass="pre">nghttp2_session_mem_send()</span></tt></a>
do not send client connection preface
(<aclass="reference internal"href="#c.NGHTTP2_CLIENT_CONNECTION_PREFACE"title="NGHTTP2_CLIENT_CONNECTION_PREFACE"><ttclass="xref c c-macro docutils literal"><spanclass="pre">NGHTTP2_CLIENT_CONNECTION_PREFACE</span></tt></a>). The applications are
responsible to send it before sending any HTTP/2 frames using these
functions if <aclass="reference internal"href="#c.nghttp2_session"title="nghttp2_session"><ttclass="xref c c-type docutils literal"><spanclass="pre">nghttp2_session</span></tt></a> is configured as client.
Similarly, <aclass="reference internal"href="#c.nghttp2_session_recv"title="nghttp2_session_recv"><ttclass="xref c c-func docutils literal"><spanclass="pre">nghttp2_session_recv()</span></tt></a> and <aclass="reference internal"href="#c.nghttp2_session_mem_recv"title="nghttp2_session_mem_recv"><ttclass="xref c c-func docutils literal"><spanclass="pre">nghttp2_session_mem_recv()</span></tt></a>
<aclass="reference internal"href="#c.nghttp2_option_set_recv_client_preface"title="nghttp2_option_set_recv_client_preface"><ttclass="xref c c-func docutils literal"><spanclass="pre">nghttp2_option_set_recv_client_preface()</span></tt></a> is used with nonzero option
value. The applications are responsible to receive it before calling
these functions if <aclass="reference internal"href="#c.nghttp2_session"title="nghttp2_session"><ttclass="xref c c-type docutils literal"><spanclass="pre">nghttp2_session</span></tt></a> is configured as server and
<aclass="reference internal"href="#c.nghttp2_option_set_recv_client_preface"title="nghttp2_option_set_recv_client_preface"><ttclass="xref c c-func docutils literal"><spanclass="pre">nghttp2_option_set_recv_client_preface()</span></tt></a> is not used.</p>
Everything described in that section is not validated however. We
briefly describe what the library does in this area. In the following
description, without loss of generality we omit CONTINUATION frame
since they must follow HEADERS frame and are processed atomically. In
other words, they are just one big HEADERS frame. To disable these
validations, use <aclass="reference internal"href="#c.nghttp2_option_set_no_http_messaging"title="nghttp2_option_set_no_http_messaging"><ttclass="xref c c-func docutils literal"><spanclass="pre">nghttp2_option_set_no_http_messaging()</span></tt></a>.</p>
<p>For HTTP request, including those carried by PUSH_PROMISE, HTTP
message starts with one HEADERS frame containing request headers. It
is followed by zero or more DATA frames containing request body, which
is followed by zero or one HEADERS containing trailer headers. The
request headers must include ":scheme", ":method" and ":path" pseudo
header fields unless ":method" is not "CONNECT". ":authority" is
optional, but nghttp2 requires either ":authority" or "Host" header
field must be present. If ":method" is "CONNECT", the request headers
must include ":method" and ":authority" and must omit ":scheme" and
":path".</p>
<p>For HTTP response, HTTP message starts with zero or more HEADERS
frames containing non-final response (status code 1xx). They are
followed by one HEADERS frame containing final response headers
(non-1xx). It is followed by zero or more DATA frames containing
response body, which is followed by zero or one HEADERS containing
trailer headers. The non-final and final response headers must
contain ":status" pseudo header field containing 3 digits only.</p>
<p>All request and response headers must include exactly one valid value
for each pseudo header field. Additionally nghttp2 requires all
request headers must not include more than one "Host" header field.</p>
<p>HTTP/2 prohibits connection-specific header fields. The following
header fields must not appear: "Connection", "Keep-Alive",
"Proxy-Connection", "Transfer-Encoding" and "Upgrade". Additionally,
"TE" header field must not include any value other than "trailers".</p>
<p>Each header field name and value must obey the field-name and
field-value production rules described in <aclass="reference external"href="https://tools.ietf.org/html/rfc7230#section-3.2">RFC 7230, section
3.2.</a>.
Additionally, all field name must be lower cased. While the pseudo
header fields must satisfy these rules, we just ignore illegal regular
headers (this means that these header fields are not passed to
application callback). This is because these illegal header fields
are floating around in existing internet and resetting stream just
because of this may break many web sites. This is especially true if
we forward to or translate from HTTP/1 traffic.</p>
<p>With the above validations, nghttp2 library guarantees that header
field name passed to <aclass="reference internal"href="#c.nghttp2_on_header_callback"title="nghttp2_on_header_callback"><ttclass="xref c c-func docutils literal"><spanclass="pre">nghttp2_on_header_callback()</span></tt></a> is not empty.
Also required pseudo headers are all present and not empty.</p>
<p>nghttp2 enforces "Content-Length" validation as well. All request or
response headers must not contain more than one "Content-Length"
header field. If "Content-Length" header field is present, it must be
parsed as 64 bit signed integer. The sum of data length in the
following DATA frames must match with the number in "Content-Length"
header field if it is present (this does not include padding bytes).</p>
<p>Any deviation results in stream error of type PROTOCOL_ERROR. If
error is found in PUSH_PROMISE frame, stream error is raised against
<ttclass="descname">NGHTTP2_PROTO_VERSION_ID_LEN</tt><aclass="headerlink"href="#c.NGHTTP2_PROTO_VERSION_ID_LEN"title="Permalink to this definition">¶</a></dt>
<dd><p>The length of <aclass="reference internal"href="#c.NGHTTP2_PROTO_VERSION_ID"title="NGHTTP2_PROTO_VERSION_ID"><ttclass="xref c c-macro docutils literal"><spanclass="pre">NGHTTP2_PROTO_VERSION_ID</span></tt></a>.</p>
<ttclass="descname">NGHTTP2_PROTO_ALPN</tt><aclass="headerlink"href="#c.NGHTTP2_PROTO_ALPN"title="Permalink to this definition">¶</a></dt>
<dd><p>The seriazlied form of ALPN protocol identifier this library
supports. Notice that first byte is the length of following
protocol identifier. This is the same wire format of <aclass="reference external"href="https://tools.ietf.org/html/rfc7301">TLS ALPN
extension</a>. This is useful
to process incoming ALPN tokens in wire format.</p>
</dd></dl>
<dlclass="macro">
<dtid="c.NGHTTP2_PROTO_ALPN_LEN">
<ttclass="descname">NGHTTP2_PROTO_ALPN_LEN</tt><aclass="headerlink"href="#c.NGHTTP2_PROTO_ALPN_LEN"title="Permalink to this definition">¶</a></dt>
<dd><p>The length of <aclass="reference internal"href="#c.NGHTTP2_PROTO_ALPN"title="NGHTTP2_PROTO_ALPN"><ttclass="xref c c-macro docutils literal"><spanclass="pre">NGHTTP2_PROTO_ALPN</span></tt></a>.</p>
<ttclass="descname">NGHTTP2_CLEARTEXT_PROTO_VERSION_ID</tt><aclass="headerlink"href="#c.NGHTTP2_CLEARTEXT_PROTO_VERSION_ID"title="Permalink to this definition">¶</a></dt>
<dd><p>The protocol version identification string of this library
supports. This identifier is used if HTTP/2 is used over cleartext
TCP.</p>
</dd></dl>
<dlclass="macro">
<dtid="c.NGHTTP2_CLEARTEXT_PROTO_VERSION_ID_LEN">
<ttclass="descname">NGHTTP2_CLEARTEXT_PROTO_VERSION_ID_LEN</tt><aclass="headerlink"href="#c.NGHTTP2_CLEARTEXT_PROTO_VERSION_ID_LEN"title="Permalink to this definition">¶</a></dt>
<dd><p>The length of <aclass="reference internal"href="#c.NGHTTP2_CLEARTEXT_PROTO_VERSION_ID"title="NGHTTP2_CLEARTEXT_PROTO_VERSION_ID"><ttclass="xref c c-macro docutils literal"><spanclass="pre">NGHTTP2_CLEARTEXT_PROTO_VERSION_ID</span></tt></a>.</p>
<ttclass="descname">NGHTTP2_VERSION_AGE</tt><aclass="headerlink"href="#c.NGHTTP2_VERSION_AGE"title="Permalink to this definition">¶</a></dt>
<dd><p>The age of <aclass="reference internal"href="#c.nghttp2_info"title="nghttp2_info"><ttclass="xref c c-type docutils literal"><spanclass="pre">nghttp2_info</span></tt></a></p>
<ttclass="descname">NGHTTP2_INITIAL_WINDOW_SIZE</tt><aclass="headerlink"href="#c.NGHTTP2_INITIAL_WINDOW_SIZE"title="Permalink to this definition">¶</a></dt>
<ttclass="descname">NGHTTP2_INITIAL_CONNECTION_WINDOW_SIZE</tt><aclass="headerlink"href="#c.NGHTTP2_INITIAL_CONNECTION_WINDOW_SIZE"title="Permalink to this definition">¶</a></dt>
<ttclass="descname">NGHTTP2_DEFAULT_HEADER_TABLE_SIZE</tt><aclass="headerlink"href="#c.NGHTTP2_DEFAULT_HEADER_TABLE_SIZE"title="Permalink to this definition">¶</a></dt>
<ttclass="descname">NGHTTP2_CLIENT_CONNECTION_PREFACE</tt><aclass="headerlink"href="#c.NGHTTP2_CLIENT_CONNECTION_PREFACE"title="Permalink to this definition">¶</a></dt>
<dd><p>The client connection preface.</p>
</dd></dl>
<dlclass="macro">
<dtid="c.NGHTTP2_CLIENT_CONNECTION_PREFACE_LEN">
<ttclass="descname">NGHTTP2_CLIENT_CONNECTION_PREFACE_LEN</tt><aclass="headerlink"href="#c.NGHTTP2_CLIENT_CONNECTION_PREFACE_LEN"title="Permalink to this definition">¶</a></dt>
<dd><p>The length of <aclass="reference internal"href="#c.NGHTTP2_CLIENT_CONNECTION_PREFACE"title="NGHTTP2_CLIENT_CONNECTION_PREFACE"><ttclass="xref c c-macro docutils literal"><spanclass="pre">NGHTTP2_CLIENT_CONNECTION_PREFACE</span></tt></a>.</p>
<ttclass="descname">NGHTTP2_CLIENT_CONNECTION_HEADER</tt><aclass="headerlink"href="#c.NGHTTP2_CLIENT_CONNECTION_HEADER"title="Permalink to this definition">¶</a></dt>
<ttclass="descname">NGHTTP2_CLIENT_CONNECTION_HEADER_LEN</tt><aclass="headerlink"href="#c.NGHTTP2_CLIENT_CONNECTION_HEADER_LEN"title="Permalink to this definition">¶</a></dt>
<dd><p>The length of <aclass="reference internal"href="#c.NGHTTP2_CLIENT_CONNECTION_HEADER"title="NGHTTP2_CLIENT_CONNECTION_HEADER"><ttclass="xref c c-macro docutils literal"><spanclass="pre">NGHTTP2_CLIENT_CONNECTION_HEADER</span></tt></a>.</p>
<ttclass="descname">NGHTTP2_INITIAL_MAX_CONCURRENT_STREAMS</tt><aclass="headerlink"href="#c.NGHTTP2_INITIAL_MAX_CONCURRENT_STREAMS"title="Permalink to this definition">¶</a></dt>
<ttclass="descname">NGHTTP2_ERR_INVALID_ARGUMENT</tt><aclass="headerlink"href="#c.NGHTTP2_ERR_INVALID_ARGUMENT"title="Permalink to this definition">¶</a></dt>
<ttclass="descname">NGHTTP2_ERR_UNSUPPORTED_VERSION</tt><aclass="headerlink"href="#c.NGHTTP2_ERR_UNSUPPORTED_VERSION"title="Permalink to this definition">¶</a></dt>
Used as a return value from <aclass="reference internal"href="#c.nghttp2_send_callback"title="nghttp2_send_callback"><ttclass="xref c c-type docutils literal"><spanclass="pre">nghttp2_send_callback</span></tt></a> and
<aclass="reference internal"href="#c.nghttp2_recv_callback"title="nghttp2_recv_callback"><ttclass="xref c c-type docutils literal"><spanclass="pre">nghttp2_recv_callback</span></tt></a> to indicate that the operation
<ttclass="descname">NGHTTP2_ERR_INVALID_FRAME</tt><aclass="headerlink"href="#c.NGHTTP2_ERR_INVALID_FRAME"title="Permalink to this definition">¶</a></dt>
<aclass="reference internal"href="#c.nghttp2_data_source_read_callback"title="nghttp2_data_source_read_callback"><ttclass="xref c c-func docutils literal"><spanclass="pre">nghttp2_data_source_read_callback()</span></tt></a> to indicate that data
<aclass="reference internal"href="#c.nghttp2_data_source_read_callback"title="nghttp2_data_source_read_callback"><ttclass="xref c c-func docutils literal"><spanclass="pre">nghttp2_data_source_read_callback()</span></tt></a> for details.</p>
<ttclass="descname">NGHTTP2_ERR_STREAM_ID_NOT_AVAILABLE</tt><aclass="headerlink"href="#c.NGHTTP2_ERR_STREAM_ID_NOT_AVAILABLE"title="Permalink to this definition">¶</a></dt>
<ttclass="descname">NGHTTP2_ERR_STREAM_CLOSED</tt><aclass="headerlink"href="#c.NGHTTP2_ERR_STREAM_CLOSED"title="Permalink to this definition">¶</a></dt>
<ttclass="descname">NGHTTP2_ERR_STREAM_CLOSING</tt><aclass="headerlink"href="#c.NGHTTP2_ERR_STREAM_CLOSING"title="Permalink to this definition">¶</a></dt>
<ttclass="descname">NGHTTP2_ERR_STREAM_SHUT_WR</tt><aclass="headerlink"href="#c.NGHTTP2_ERR_STREAM_SHUT_WR"title="Permalink to this definition">¶</a></dt>
<ttclass="descname">NGHTTP2_ERR_INVALID_STREAM_ID</tt><aclass="headerlink"href="#c.NGHTTP2_ERR_INVALID_STREAM_ID"title="Permalink to this definition">¶</a></dt>
<ttclass="descname">NGHTTP2_ERR_INVALID_STREAM_STATE</tt><aclass="headerlink"href="#c.NGHTTP2_ERR_INVALID_STREAM_STATE"title="Permalink to this definition">¶</a></dt>
<ttclass="descname">NGHTTP2_ERR_DEFERRED_DATA_EXIST</tt><aclass="headerlink"href="#c.NGHTTP2_ERR_DEFERRED_DATA_EXIST"title="Permalink to this definition">¶</a></dt>
<ttclass="descname">NGHTTP2_ERR_START_STREAM_NOT_ALLOWED</tt><aclass="headerlink"href="#c.NGHTTP2_ERR_START_STREAM_NOT_ALLOWED"title="Permalink to this definition">¶</a></dt>
<ttclass="descname">NGHTTP2_ERR_GOAWAY_ALREADY_SENT</tt><aclass="headerlink"href="#c.NGHTTP2_ERR_GOAWAY_ALREADY_SENT"title="Permalink to this definition">¶</a></dt>
<ttclass="descname">NGHTTP2_ERR_INVALID_HEADER_BLOCK</tt><aclass="headerlink"href="#c.NGHTTP2_ERR_INVALID_HEADER_BLOCK"title="Permalink to this definition">¶</a></dt>
<ttclass="descname">NGHTTP2_ERR_INVALID_STATE</tt><aclass="headerlink"href="#c.NGHTTP2_ERR_INVALID_STATE"title="Permalink to this definition">¶</a></dt>
<ttclass="descname">NGHTTP2_ERR_TEMPORAL_CALLBACK_FAILURE</tt><aclass="headerlink"href="#c.NGHTTP2_ERR_TEMPORAL_CALLBACK_FAILURE"title="Permalink to this definition">¶</a></dt>
<ttclass="descname">NGHTTP2_ERR_FRAME_SIZE_ERROR</tt><aclass="headerlink"href="#c.NGHTTP2_ERR_FRAME_SIZE_ERROR"title="Permalink to this definition">¶</a></dt>
<ttclass="descname">NGHTTP2_ERR_INSUFF_BUFSIZE</tt><aclass="headerlink"href="#c.NGHTTP2_ERR_INSUFF_BUFSIZE"title="Permalink to this definition">¶</a></dt>
<ttclass="descname">NGHTTP2_ERR_TOO_MANY_INFLIGHT_SETTINGS</tt><aclass="headerlink"href="#c.NGHTTP2_ERR_TOO_MANY_INFLIGHT_SETTINGS"title="Permalink to this definition">¶</a></dt>
<ttclass="descname">NGHTTP2_ERR_PUSH_DISABLED</tt><aclass="headerlink"href="#c.NGHTTP2_ERR_PUSH_DISABLED"title="Permalink to this definition">¶</a></dt>
<ttclass="descname">NGHTTP2_ERR_SESSION_CLOSING</tt><aclass="headerlink"href="#c.NGHTTP2_ERR_SESSION_CLOSING"title="Permalink to this definition">¶</a></dt>
The current session is closing due to a connection error or
<aclass="reference internal"href="#c.nghttp2_session_terminate_session"title="nghttp2_session_terminate_session"><ttclass="xref c c-func docutils literal"><spanclass="pre">nghttp2_session_terminate_session()</span></tt></a> is called.</p>
The errors <<aclass="reference internal"href="#c.NGHTTP2_ERR_FATAL"title="NGHTTP2_ERR_FATAL"><ttclass="xref c c-macro docutils literal"><spanclass="pre">NGHTTP2_ERR_FATAL</span></tt></a> mean that the library is
under unexpected condition and processing was terminated (e.g.,
out of memory). If application receives this error code, it must
stop using that <aclass="reference internal"href="#c.nghttp2_session"title="nghttp2_session"><ttclass="xref c c-type docutils literal"><spanclass="pre">nghttp2_session</span></tt></a> object and only allowed
operation for that object is deallocate it using
<aclass="reference internal"href="#c.nghttp2_session_del"title="nghttp2_session_del"><ttclass="xref c c-func docutils literal"><spanclass="pre">nghttp2_session_del()</span></tt></a>.</p>
<ttclass="descname">NGHTTP2_ERR_CALLBACK_FAILURE</tt><aclass="headerlink"href="#c.NGHTTP2_ERR_CALLBACK_FAILURE"title="Permalink to this definition">¶</a></dt>
<ttclass="descname">NGHTTP2_SETTINGS_HEADER_TABLE_SIZE</tt><aclass="headerlink"href="#c.NGHTTP2_SETTINGS_HEADER_TABLE_SIZE"title="Permalink to this definition">¶</a></dt>
<ttclass="descname">NGHTTP2_SETTINGS_ENABLE_PUSH</tt><aclass="headerlink"href="#c.NGHTTP2_SETTINGS_ENABLE_PUSH"title="Permalink to this definition">¶</a></dt>
<ttclass="descname">NGHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS</tt><aclass="headerlink"href="#c.NGHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS"title="Permalink to this definition">¶</a></dt>
<ttclass="descname">NGHTTP2_SETTINGS_INITIAL_WINDOW_SIZE</tt><aclass="headerlink"href="#c.NGHTTP2_SETTINGS_INITIAL_WINDOW_SIZE"title="Permalink to this definition">¶</a></dt>
<ttclass="descname">NGHTTP2_SETTINGS_MAX_FRAME_SIZE</tt><aclass="headerlink"href="#c.NGHTTP2_SETTINGS_MAX_FRAME_SIZE"title="Permalink to this definition">¶</a></dt>
<ttclass="descname">NGHTTP2_SETTINGS_MAX_HEADER_LIST_SIZE</tt><aclass="headerlink"href="#c.NGHTTP2_SETTINGS_MAX_HEADER_LIST_SIZE"title="Permalink to this definition">¶</a></dt>
<ttclass="descname">NGHTTP2_FLOW_CONTROL_ERROR</tt><aclass="headerlink"href="#c.NGHTTP2_FLOW_CONTROL_ERROR"title="Permalink to this definition">¶</a></dt>
<ttclass="descname">NGHTTP2_COMPRESSION_ERROR</tt><aclass="headerlink"href="#c.NGHTTP2_COMPRESSION_ERROR"title="Permalink to this definition">¶</a></dt>
<ttclass="descname">NGHTTP2_ENHANCE_YOUR_CALM</tt><aclass="headerlink"href="#c.NGHTTP2_ENHANCE_YOUR_CALM"title="Permalink to this definition">¶</a></dt>
<ttclass="descname">NGHTTP2_INADEQUATE_SECURITY</tt><aclass="headerlink"href="#c.NGHTTP2_INADEQUATE_SECURITY"title="Permalink to this definition">¶</a></dt>
<ttclass="descname">NGHTTP2_HTTP_1_1_REQUIRED</tt><aclass="headerlink"href="#c.NGHTTP2_HTTP_1_1_REQUIRED"title="Permalink to this definition">¶</a></dt>
<ttclass="descname">NGHTTP2_DATA_FLAG_NO_END_STREAM</tt><aclass="headerlink"href="#c.NGHTTP2_DATA_FLAG_NO_END_STREAM"title="Permalink to this definition">¶</a></dt>
Indicates that END_STREAM flag must not be set even if
NGHTTP2_DATA_FLAG_EOF is set. Usually this flag is used to send
trailer header fields with <aclass="reference internal"href="#c.nghttp2_submit_request"title="nghttp2_submit_request"><ttclass="xref c c-func docutils literal"><spanclass="pre">nghttp2_submit_request()</span></tt></a> or
<aclass="reference internal"href="#c.nghttp2_submit_response"title="nghttp2_submit_response"><ttclass="xref c c-func docutils literal"><spanclass="pre">nghttp2_submit_response()</span></tt></a>.</p>
<ttclass="descname">NGHTTP2_HCAT_PUSH_RESPONSE</tt><aclass="headerlink"href="#c.NGHTTP2_HCAT_PUSH_RESPONSE"title="Permalink to this definition">¶</a></dt>
<dd><p>This struct is what <aclass="reference internal"href="#c.nghttp2_version"title="nghttp2_version"><ttclass="xref c c-func docutils literal"><spanclass="pre">nghttp2_version()</span></tt></a> returns. It holds
<aclass="reference internal"href="#c.NGHTTP2_VERSION_AGE"title="NGHTTP2_VERSION_AGE"><ttclass="xref c c-macro docutils literal"><spanclass="pre">NGHTTP2_VERSION_AGE</span></tt></a> but a future version may bump it and
int <ttclass="descname">version_num</tt><aclass="headerlink"href="#c.nghttp2_info.version_num"title="Permalink to this definition">¶</a></dt>
<dd><p>the <aclass="reference internal"href="#c.NGHTTP2_VERSION_NUM"title="NGHTTP2_VERSION_NUM"><ttclass="xref c c-macro docutils literal"><spanclass="pre">NGHTTP2_VERSION_NUM</span></tt></a> number (since age ==1)</p>
const char *<ttclass="descname">version_str</tt><aclass="headerlink"href="#c.nghttp2_info.version_str"title="Permalink to this definition">¶</a></dt>
<dd><p>points to the <aclass="reference internal"href="#c.NGHTTP2_VERSION"title="NGHTTP2_VERSION"><ttclass="xref c c-macro docutils literal"><spanclass="pre">NGHTTP2_VERSION</span></tt></a> string (since age ==1)</p>
const char *<ttclass="descname">proto_str</tt><aclass="headerlink"href="#c.nghttp2_info.proto_str"title="Permalink to this definition">¶</a></dt>
<dd><p>points to the <aclass="reference internal"href="#c.NGHTTP2_PROTO_VERSION_ID"title="NGHTTP2_PROTO_VERSION_ID"><ttclass="xref c c-macro docutils literal"><spanclass="pre">NGHTTP2_PROTO_VERSION_ID</span></tt></a> string this
uint8_t <ttclass="descname">flags</tt><aclass="headerlink"href="#c.nghttp2_nv.flags"title="Permalink to this definition">¶</a></dt>
<dd><p>Bitwise OR of one or more of <aclass="reference internal"href="#c.nghttp2_nv_flag"title="nghttp2_nv_flag"><ttclass="xref c c-type docutils literal"><spanclass="pre">nghttp2_nv_flag</span></tt></a>.</p>
<dd><p>The type of this frame. See <aclass="reference internal"href="#c.nghttp2_frame_type"title="nghttp2_frame_type"><ttclass="xref c c-func docutils literal"><spanclass="pre">nghttp2_frame_type()</span></tt></a>.</p>
reached, set <aclass="reference internal"href="#c.NGHTTP2_DATA_FLAG_EOF"title="NGHTTP2_DATA_FLAG_EOF"><ttclass="xref c c-macro docutils literal"><spanclass="pre">NGHTTP2_DATA_FLAG_EOF</span></tt></a> flag in <em>*data_flags</em>.</p>
<p>If this callback is set by <aclass="reference internal"href="#c.nghttp2_submit_request"title="nghttp2_submit_request"><ttclass="xref c c-func docutils literal"><spanclass="pre">nghttp2_submit_request()</span></tt></a>,
<aclass="reference internal"href="#c.nghttp2_submit_response"title="nghttp2_submit_response"><ttclass="xref c c-func docutils literal"><spanclass="pre">nghttp2_submit_response()</span></tt></a> or <aclass="reference internal"href="#c.nghttp2_submit_headers"title="nghttp2_submit_headers"><ttclass="xref c c-func docutils literal"><spanclass="pre">nghttp2_submit_headers()</span></tt></a> and
<aclass="reference internal"href="#c.nghttp2_submit_data"title="nghttp2_submit_data"><ttclass="xref c c-func docutils literal"><spanclass="pre">nghttp2_submit_data()</span></tt></a> with flag parameter
<aclass="reference internal"href="#c.NGHTTP2_FLAG_END_STREAM"title="NGHTTP2_FLAG_END_STREAM"><ttclass="xref c c-macro docutils literal"><spanclass="pre">NGHTTP2_FLAG_END_STREAM</span></tt></a> set, and
<aclass="reference internal"href="#c.NGHTTP2_DATA_FLAG_EOF"title="NGHTTP2_DATA_FLAG_EOF"><ttclass="xref c c-macro docutils literal"><spanclass="pre">NGHTTP2_DATA_FLAG_EOF</span></tt></a> flag is set to <em>*data_flags</em>, DATA
frame will have END_STREAM flag set. Usually, this is expected
behaviour and all are fine. One exception is send trailer header
fields. You cannot send trailers after sending frame with
END_STREAM set. To avoid this problem, one can set
<aclass="reference internal"href="#c.NGHTTP2_DATA_FLAG_NO_END_STREAM"title="NGHTTP2_DATA_FLAG_NO_END_STREAM"><ttclass="xref c c-macro docutils literal"><spanclass="pre">NGHTTP2_DATA_FLAG_NO_END_STREAM</span></tt></a> along with
<aclass="reference internal"href="#c.NGHTTP2_DATA_FLAG_EOF"title="NGHTTP2_DATA_FLAG_EOF"><ttclass="xref c c-macro docutils literal"><spanclass="pre">NGHTTP2_DATA_FLAG_EOF</span></tt></a> to signal the library not to set
END_STREAM in DATA frame. Then application can use
<aclass="reference internal"href="#c.nghttp2_submit_trailer"title="nghttp2_submit_trailer"><ttclass="xref c c-func docutils literal"><spanclass="pre">nghttp2_submit_trailer()</span></tt></a> to send trailers.
<aclass="reference internal"href="#c.nghttp2_submit_trailer"title="nghttp2_submit_trailer"><ttclass="xref c c-func docutils literal"><spanclass="pre">nghttp2_submit_trailer()</span></tt></a> can be called inside this callback.</p>
asynchronous I/O, or reading data blocks for long time), it is
achieved by returning <aclass="reference internal"href="#c.NGHTTP2_ERR_DEFERRED"title="NGHTTP2_ERR_DEFERRED"><ttclass="xref c c-macro docutils literal"><spanclass="pre">NGHTTP2_ERR_DEFERRED</span></tt></a> without reading
any data in this invocation. The library removes DATA frame from
the outgoing queue temporarily. To move back deferred DATA frame
to outgoing queue, call <aclass="reference internal"href="#c.nghttp2_session_resume_data"title="nghttp2_session_resume_data"><ttclass="xref c c-func docutils literal"><spanclass="pre">nghttp2_session_resume_data()</span></tt></a>. In case
of error, there are 2 choices. Returning
<aclass="reference internal"href="#c.NGHTTP2_ERR_TEMPORAL_CALLBACK_FAILURE"title="NGHTTP2_ERR_TEMPORAL_CALLBACK_FAILURE"><ttclass="xref c c-macro docutils literal"><spanclass="pre">NGHTTP2_ERR_TEMPORAL_CALLBACK_FAILURE</span></tt></a> will close the stream
by issuing RST_STREAM with <aclass="reference internal"href="#c.NGHTTP2_INTERNAL_ERROR"title="NGHTTP2_INTERNAL_ERROR"><ttclass="xref c c-macro docutils literal"><spanclass="pre">NGHTTP2_INTERNAL_ERROR</span></tt></a>. If a
different error code is desirable, use
<aclass="reference internal"href="#c.nghttp2_submit_rst_stream"title="nghttp2_submit_rst_stream"><ttclass="xref c c-func docutils literal"><spanclass="pre">nghttp2_submit_rst_stream()</span></tt></a> with a desired error code and then
return <aclass="reference internal"href="#c.NGHTTP2_ERR_TEMPORAL_CALLBACK_FAILURE"title="NGHTTP2_ERR_TEMPORAL_CALLBACK_FAILURE"><ttclass="xref c c-macro docutils literal"><spanclass="pre">NGHTTP2_ERR_TEMPORAL_CALLBACK_FAILURE</span></tt></a>. Returning
<aclass="reference internal"href="#c.NGHTTP2_ERR_CALLBACK_FAILURE"title="NGHTTP2_ERR_CALLBACK_FAILURE"><ttclass="xref c c-macro docutils literal"><spanclass="pre">NGHTTP2_ERR_CALLBACK_FAILURE</span></tt></a> will signal the entire session
<aclass="reference internal"href="#c.nghttp2_data_source"title="nghttp2_data_source">nghttp2_data_source</a><ttclass="descname">source</tt><aclass="headerlink"href="#c.nghttp2_data_provider.source"title="Permalink to this definition">¶</a></dt>
<aclass="reference internal"href="#c.nghttp2_data_source_read_callback"title="nghttp2_data_source_read_callback">nghttp2_data_source_read_callback</a><ttclass="descname">read_callback</tt><aclass="headerlink"href="#c.nghttp2_data_provider.read_callback"title="Permalink to this definition">¶</a></dt>
<aclass="reference internal"href="#c.nghttp2_frame_hd"title="nghttp2_frame_hd">nghttp2_frame_hd</a><ttclass="descname">hd</tt><aclass="headerlink"href="#c.nghttp2_headers.hd"title="Permalink to this definition">¶</a></dt>
<aclass="reference internal"href="#c.nghttp2_priority_spec"title="nghttp2_priority_spec">nghttp2_priority_spec</a><ttclass="descname">pri_spec</tt><aclass="headerlink"href="#c.nghttp2_headers.pri_spec"title="Permalink to this definition">¶</a></dt>
<aclass="reference internal"href="#c.nghttp2_nv"title="nghttp2_nv">nghttp2_nv</a> *<ttclass="descname">nva</tt><aclass="headerlink"href="#c.nghttp2_headers.nva"title="Permalink to this definition">¶</a></dt>
<aclass="reference internal"href="#c.nghttp2_headers_category"title="nghttp2_headers_category">nghttp2_headers_category</a><ttclass="descname">cat</tt><aclass="headerlink"href="#c.nghttp2_headers.cat"title="Permalink to this definition">¶</a></dt>
<aclass="reference internal"href="#c.nghttp2_frame_hd"title="nghttp2_frame_hd">nghttp2_frame_hd</a><ttclass="descname">hd</tt><aclass="headerlink"href="#c.nghttp2_priority.hd"title="Permalink to this definition">¶</a></dt>
<aclass="reference internal"href="#c.nghttp2_priority_spec"title="nghttp2_priority_spec">nghttp2_priority_spec</a><ttclass="descname">pri_spec</tt><aclass="headerlink"href="#c.nghttp2_priority.pri_spec"title="Permalink to this definition">¶</a></dt>
<aclass="reference internal"href="#c.nghttp2_frame_hd"title="nghttp2_frame_hd">nghttp2_frame_hd</a><ttclass="descname">hd</tt><aclass="headerlink"href="#c.nghttp2_rst_stream.hd"title="Permalink to this definition">¶</a></dt>
<dd><p>The error code. See <aclass="reference internal"href="#c.nghttp2_error_code"title="nghttp2_error_code"><ttclass="xref c c-type docutils literal"><spanclass="pre">nghttp2_error_code</span></tt></a>.</p>
int32_t <ttclass="descname">settings_id</tt><aclass="headerlink"href="#c.nghttp2_settings_entry.settings_id"title="Permalink to this definition">¶</a></dt>
<dd><p>The SETTINGS ID. See <aclass="reference internal"href="#c.nghttp2_settings_id"title="nghttp2_settings_id"><ttclass="xref c c-type docutils literal"><spanclass="pre">nghttp2_settings_id</span></tt></a>.</p>
<aclass="reference internal"href="#c.nghttp2_frame_hd"title="nghttp2_frame_hd">nghttp2_frame_hd</a><ttclass="descname">hd</tt><aclass="headerlink"href="#c.nghttp2_settings.hd"title="Permalink to this definition">¶</a></dt>
<aclass="reference internal"href="#c.nghttp2_settings_entry"title="nghttp2_settings_entry">nghttp2_settings_entry</a> *<ttclass="descname">iv</tt><aclass="headerlink"href="#c.nghttp2_settings.iv"title="Permalink to this definition">¶</a></dt>
<aclass="reference internal"href="#c.nghttp2_frame_hd"title="nghttp2_frame_hd">nghttp2_frame_hd</a><ttclass="descname">hd</tt><aclass="headerlink"href="#c.nghttp2_push_promise.hd"title="Permalink to this definition">¶</a></dt>
<aclass="reference internal"href="#c.nghttp2_nv"title="nghttp2_nv">nghttp2_nv</a> *<ttclass="descname">nva</tt><aclass="headerlink"href="#c.nghttp2_push_promise.nva"title="Permalink to this definition">¶</a></dt>
int32_t <ttclass="descname">promised_stream_id</tt><aclass="headerlink"href="#c.nghttp2_push_promise.promised_stream_id"title="Permalink to this definition">¶</a></dt>
<aclass="reference internal"href="#c.nghttp2_frame_hd"title="nghttp2_frame_hd">nghttp2_frame_hd</a><ttclass="descname">hd</tt><aclass="headerlink"href="#c.nghttp2_ping.hd"title="Permalink to this definition">¶</a></dt>
<aclass="reference internal"href="#c.nghttp2_frame_hd"title="nghttp2_frame_hd">nghttp2_frame_hd</a><ttclass="descname">hd</tt><aclass="headerlink"href="#c.nghttp2_goaway.hd"title="Permalink to this definition">¶</a></dt>
int32_t <ttclass="descname">last_stream_id</tt><aclass="headerlink"href="#c.nghttp2_goaway.last_stream_id"title="Permalink to this definition">¶</a></dt>
<dd><p>The error code. See <aclass="reference internal"href="#c.nghttp2_error_code"title="nghttp2_error_code"><ttclass="xref c c-type docutils literal"><spanclass="pre">nghttp2_error_code</span></tt></a>.</p>
size_t <ttclass="descname">opaque_data_len</tt><aclass="headerlink"href="#c.nghttp2_goaway.opaque_data_len"title="Permalink to this definition">¶</a></dt>
<aclass="reference internal"href="#c.nghttp2_frame_hd"title="nghttp2_frame_hd">nghttp2_frame_hd</a><ttclass="descname">hd</tt><aclass="headerlink"href="#c.nghttp2_window_update.hd"title="Permalink to this definition">¶</a></dt>
int32_t <ttclass="descname">window_size_increment</tt><aclass="headerlink"href="#c.nghttp2_window_update.window_size_increment"title="Permalink to this definition">¶</a></dt>
<aclass="reference internal"href="#c.nghttp2_frame_hd"title="nghttp2_frame_hd">nghttp2_frame_hd</a><ttclass="descname">hd</tt><aclass="headerlink"href="#c.nghttp2_extension.hd"title="Permalink to this definition">¶</a></dt>
void *<ttclass="descname">payload</tt><aclass="headerlink"href="#c.nghttp2_extension.payload"title="Permalink to this definition">¶</a></dt>
<dd><p>The pointer to extension payload. The exact pointer type is
determined by hd.type.</p>
<p>If hd.type == <aclass="reference internal"href="#c.NGHTTP2_EXT_ALTSVC"title="NGHTTP2_EXT_ALTSVC"><ttclass="xref c c-macro docutils literal"><spanclass="pre">NGHTTP2_EXT_ALTSVC</span></tt></a>, it is a pointer to
<aclass="reference internal"href="#c.nghttp2_ext_altsvc"title="nghttp2_ext_altsvc"><ttclass="xref c c-type docutils literal"><spanclass="pre">nghttp2_ext_altsvc</span></tt></a>.</p>
</dd></dl>
</dd></dl>
<dlclass="type">
<dtid="c.nghttp2_ext_altsvc">
<ttclass="descname">nghttp2_ext_altsvc</tt><aclass="headerlink"href="#c.nghttp2_ext_altsvc"title="Permalink to this definition">¶</a></dt>
<dd><p>The ALTSVC extension frame payload. It has following members:</p>
<dlclass="member">
<dtid="c.nghttp2_ext_altsvc.protocol_id">
uint8_t *<ttclass="descname">protocol_id</tt><aclass="headerlink"href="#c.nghttp2_ext_altsvc.protocol_id"title="Permalink to this definition">¶</a></dt>
size_t <ttclass="descname">protocol_id_len</tt><aclass="headerlink"href="#c.nghttp2_ext_altsvc.protocol_id_len"title="Permalink to this definition">¶</a></dt>
<aclass="reference internal"href="#c.nghttp2_frame_hd"title="nghttp2_frame_hd">nghttp2_frame_hd</a><ttclass="descname">hd</tt><aclass="headerlink"href="#c.nghttp2_frame.hd"title="Permalink to this definition">¶</a></dt>
<aclass="reference internal"href="#c.nghttp2_data"title="nghttp2_data">nghttp2_data</a><ttclass="descname">data</tt><aclass="headerlink"href="#c.nghttp2_frame.data"title="Permalink to this definition">¶</a></dt>
<aclass="reference internal"href="#c.nghttp2_headers"title="nghttp2_headers">nghttp2_headers</a><ttclass="descname">headers</tt><aclass="headerlink"href="#c.nghttp2_frame.headers"title="Permalink to this definition">¶</a></dt>
<aclass="reference internal"href="#c.nghttp2_priority"title="nghttp2_priority">nghttp2_priority</a><ttclass="descname">priority</tt><aclass="headerlink"href="#c.nghttp2_frame.priority"title="Permalink to this definition">¶</a></dt>
<aclass="reference internal"href="#c.nghttp2_rst_stream"title="nghttp2_rst_stream">nghttp2_rst_stream</a><ttclass="descname">rst_stream</tt><aclass="headerlink"href="#c.nghttp2_frame.rst_stream"title="Permalink to this definition">¶</a></dt>
<aclass="reference internal"href="#c.nghttp2_settings"title="nghttp2_settings">nghttp2_settings</a><ttclass="descname">settings</tt><aclass="headerlink"href="#c.nghttp2_frame.settings"title="Permalink to this definition">¶</a></dt>
<aclass="reference internal"href="#c.nghttp2_push_promise"title="nghttp2_push_promise">nghttp2_push_promise</a><ttclass="descname">push_promise</tt><aclass="headerlink"href="#c.nghttp2_frame.push_promise"title="Permalink to this definition">¶</a></dt>
<aclass="reference internal"href="#c.nghttp2_ping"title="nghttp2_ping">nghttp2_ping</a><ttclass="descname">ping</tt><aclass="headerlink"href="#c.nghttp2_frame.ping"title="Permalink to this definition">¶</a></dt>
<aclass="reference internal"href="#c.nghttp2_goaway"title="nghttp2_goaway">nghttp2_goaway</a><ttclass="descname">goaway</tt><aclass="headerlink"href="#c.nghttp2_frame.goaway"title="Permalink to this definition">¶</a></dt>
<aclass="reference internal"href="#c.nghttp2_window_update"title="nghttp2_window_update">nghttp2_window_update</a><ttclass="descname">window_update</tt><aclass="headerlink"href="#c.nghttp2_frame.window_update"title="Permalink to this definition">¶</a></dt>
<aclass="reference internal"href="#c.nghttp2_extension"title="nghttp2_extension">nghttp2_extension</a><ttclass="descname">ext</tt><aclass="headerlink"href="#c.nghttp2_frame.ext"title="Permalink to this definition">¶</a></dt>
it must return <aclass="reference internal"href="#c.NGHTTP2_ERR_WOULDBLOCK"title="NGHTTP2_ERR_WOULDBLOCK"><ttclass="xref c c-macro docutils literal"><spanclass="pre">NGHTTP2_ERR_WOULDBLOCK</span></tt></a>. For other errors,
it must return <aclass="reference internal"href="#c.NGHTTP2_ERR_CALLBACK_FAILURE"title="NGHTTP2_ERR_CALLBACK_FAILURE"><ttclass="xref c c-macro docutils literal"><spanclass="pre">NGHTTP2_ERR_CALLBACK_FAILURE</span></tt></a>. The
<em>user_data</em> pointer is the third argument passed in to the call to
<aclass="reference internal"href="#c.nghttp2_session_client_new"title="nghttp2_session_client_new"><ttclass="xref c c-func docutils literal"><spanclass="pre">nghttp2_session_client_new()</span></tt></a> or <aclass="reference internal"href="#c.nghttp2_session_server_new"title="nghttp2_session_server_new"><ttclass="xref c c-func docutils literal"><spanclass="pre">nghttp2_session_server_new()</span></tt></a>.</p>
<aclass="reference internal"href="#c.nghttp2_session_send"title="nghttp2_session_send"><ttclass="xref c c-func docutils literal"><spanclass="pre">nghttp2_session_send()</span></tt></a> to send data to the remote endpoint. If
the application uses solely <aclass="reference internal"href="#c.nghttp2_session_mem_send"title="nghttp2_session_mem_send"><ttclass="xref c c-func docutils literal"><spanclass="pre">nghttp2_session_mem_send()</span></tt></a> instead,
<p>To set this callback to <aclass="reference internal"href="#c.nghttp2_session_callbacks"title="nghttp2_session_callbacks"><ttclass="xref c c-type docutils literal"><spanclass="pre">nghttp2_session_callbacks</span></tt></a>, use
<aclass="reference internal"href="#c.nghttp2_session_callbacks_set_send_callback"title="nghttp2_session_callbacks_set_send_callback"><ttclass="xref c c-func docutils literal"><spanclass="pre">nghttp2_session_callbacks_set_send_callback()</span></tt></a>.</p>
the remote peer. The implementation of this function must read at
most <em>length</em> bytes of data and store it in <em>buf</em>. The <em>flags</em> is
currently not used and always 0. It must return the number of
bytes written in <em>buf</em> if it succeeds. If it cannot read any
single byte without blocking, it must return
<aclass="reference internal"href="#c.NGHTTP2_ERR_WOULDBLOCK"title="NGHTTP2_ERR_WOULDBLOCK"><ttclass="xref c c-macro docutils literal"><spanclass="pre">NGHTTP2_ERR_WOULDBLOCK</span></tt></a>. If it gets EOF before it reads any
single byte, it must return <aclass="reference internal"href="#c.NGHTTP2_ERR_EOF"title="NGHTTP2_ERR_EOF"><ttclass="xref c c-macro docutils literal"><spanclass="pre">NGHTTP2_ERR_EOF</span></tt></a>. For other
errors, it must return <aclass="reference internal"href="#c.NGHTTP2_ERR_CALLBACK_FAILURE"title="NGHTTP2_ERR_CALLBACK_FAILURE"><ttclass="xref c c-macro docutils literal"><spanclass="pre">NGHTTP2_ERR_CALLBACK_FAILURE</span></tt></a>.
Returning 0 is treated as <aclass="reference internal"href="#c.NGHTTP2_ERR_WOULDBLOCK"title="NGHTTP2_ERR_WOULDBLOCK"><ttclass="xref c c-macro docutils literal"><spanclass="pre">NGHTTP2_ERR_WOULDBLOCK</span></tt></a>. The
<em>user_data</em> pointer is the third argument passed in to the call to
<aclass="reference internal"href="#c.nghttp2_session_client_new"title="nghttp2_session_client_new"><ttclass="xref c c-func docutils literal"><spanclass="pre">nghttp2_session_client_new()</span></tt></a> or <aclass="reference internal"href="#c.nghttp2_session_server_new"title="nghttp2_session_server_new"><ttclass="xref c c-func docutils literal"><spanclass="pre">nghttp2_session_server_new()</span></tt></a>.</p>
<aclass="reference internal"href="#c.nghttp2_session_recv"title="nghttp2_session_recv"><ttclass="xref c c-func docutils literal"><spanclass="pre">nghttp2_session_recv()</span></tt></a> to receive data from the remote endpoint.
If the application uses solely <aclass="reference internal"href="#c.nghttp2_session_mem_recv"title="nghttp2_session_mem_recv"><ttclass="xref c c-func docutils literal"><spanclass="pre">nghttp2_session_mem_recv()</span></tt></a>
<p>To set this callback to <aclass="reference internal"href="#c.nghttp2_session_callbacks"title="nghttp2_session_callbacks"><ttclass="xref c c-type docutils literal"><spanclass="pre">nghttp2_session_callbacks</span></tt></a>, use
<aclass="reference internal"href="#c.nghttp2_session_callbacks_set_recv_callback"title="nghttp2_session_callbacks_set_recv_callback"><ttclass="xref c c-func docutils literal"><spanclass="pre">nghttp2_session_callbacks_set_recv_callback()</span></tt></a>.</p>
typedef int <ttclass="descname">(*nghttp2_on_frame_recv_callback)</tt><big>(</big><aclass="reference internal"href="#c.nghttp2_session"title="nghttp2_session">nghttp2_session</a><em> *session</em>, const <aclass="reference internal"href="#c.nghttp2_frame"title="nghttp2_frame">nghttp2_frame</a><em> *frame</em>, void<em> *user_data</em><big>)</big><aclass="headerlink"href="#c.nghttp2_on_frame_recv_callback"title="Permalink to this definition">¶</a></dt>
<dd><p>Callback function invoked by <aclass="reference internal"href="#c.nghttp2_session_recv"title="nghttp2_session_recv"><ttclass="xref c c-func docutils literal"><spanclass="pre">nghttp2_session_recv()</span></tt></a> when a frame
is received. The <em>user_data</em> pointer is the third argument passed
in to the call to <aclass="reference internal"href="#c.nghttp2_session_client_new"title="nghttp2_session_client_new"><ttclass="xref c c-func docutils literal"><spanclass="pre">nghttp2_session_client_new()</span></tt></a> or
<aclass="reference internal"href="#c.nghttp2_session_server_new"title="nghttp2_session_server_new"><ttclass="xref c c-func docutils literal"><spanclass="pre">nghttp2_session_server_new()</span></tt></a>.</p>
<p>If frame is HEADERS or PUSH_PROMISE, the <ttclass="docutils literal"><spanclass="pre">nva</span></tt> and <ttclass="docutils literal"><spanclass="pre">nvlen</span></tt>
member of their data structure are always <ttclass="docutils literal"><spanclass="pre">NULL</span></tt> and 0
<aclass="reference internal"href="#c.nghttp2_on_stream_close_callback"title="nghttp2_on_stream_close_callback"><ttclass="xref c c-type docutils literal"><spanclass="pre">nghttp2_on_stream_close_callback</span></tt></a>). The application should
<p>Only HEADERS and DATA frame can signal the end of incoming data.
If <ttclass="docutils literal"><spanclass="pre">frame->hd.flags</span><spanclass="pre">&</span><spanclass="pre">NGHTTP2_FLAG_END_STREAM</span></tt> is nonzero, the
<p>The implementation of this function must return 0 if it succeeds.
If nonzero value is returned, it is treated as fatal error and
<aclass="reference internal"href="#c.nghttp2_session_recv"title="nghttp2_session_recv"><ttclass="xref c c-func docutils literal"><spanclass="pre">nghttp2_session_recv()</span></tt></a> and <aclass="reference internal"href="#c.nghttp2_session_mem_recv"title="nghttp2_session_mem_recv"><ttclass="xref c c-func docutils literal"><spanclass="pre">nghttp2_session_mem_recv()</span></tt></a> functions
immediately return <aclass="reference internal"href="#c.NGHTTP2_ERR_CALLBACK_FAILURE"title="NGHTTP2_ERR_CALLBACK_FAILURE"><ttclass="xref c c-macro docutils literal"><spanclass="pre">NGHTTP2_ERR_CALLBACK_FAILURE</span></tt></a>.</p>
<p>To set this callback to <aclass="reference internal"href="#c.nghttp2_session_callbacks"title="nghttp2_session_callbacks"><ttclass="xref c c-type docutils literal"><spanclass="pre">nghttp2_session_callbacks</span></tt></a>, use
<aclass="reference internal"href="#c.nghttp2_session_callbacks_set_on_frame_recv_callback"title="nghttp2_session_callbacks_set_on_frame_recv_callback"><ttclass="xref c c-func docutils literal"><spanclass="pre">nghttp2_session_callbacks_set_on_frame_recv_callback()</span></tt></a>.</p>
typedef int <ttclass="descname">(*nghttp2_on_invalid_frame_recv_callback)</tt><big>(</big><aclass="reference internal"href="#c.nghttp2_session"title="nghttp2_session">nghttp2_session</a><em> *session</em>, const <aclass="reference internal"href="#c.nghttp2_frame"title="nghttp2_frame">nghttp2_frame</a><em> *frame</em>, uint32_t<em> error_code</em>, void<em> *user_data</em><big>)</big><aclass="headerlink"href="#c.nghttp2_on_invalid_frame_recv_callback"title="Permalink to this definition">¶</a></dt>
<dd><p>Callback function invoked by <aclass="reference internal"href="#c.nghttp2_session_recv"title="nghttp2_session_recv"><ttclass="xref c c-func docutils literal"><spanclass="pre">nghttp2_session_recv()</span></tt></a> when an
invalid non-DATA frame is received. The <em>error_code</em> indicates the
error. It is usually one of the <aclass="reference internal"href="#c.nghttp2_error_code"title="nghttp2_error_code"><ttclass="xref c c-macro docutils literal"><spanclass="pre">nghttp2_error_code</span></tt></a> but
that is not guaranteed. When this callback function is invoked,
the library automatically submits either RST_STREAM or GOAWAY
frame. The <em>user_data</em> pointer is the third argument passed in to
the call to <aclass="reference internal"href="#c.nghttp2_session_client_new"title="nghttp2_session_client_new"><ttclass="xref c c-func docutils literal"><spanclass="pre">nghttp2_session_client_new()</span></tt></a> or
<aclass="reference internal"href="#c.nghttp2_session_server_new"title="nghttp2_session_server_new"><ttclass="xref c c-func docutils literal"><spanclass="pre">nghttp2_session_server_new()</span></tt></a>.</p>
<p>If frame is HEADERS or PUSH_PROMISE, the <ttclass="docutils literal"><spanclass="pre">nva</span></tt> and <ttclass="docutils literal"><spanclass="pre">nvlen</span></tt>
member of their data structure are always <ttclass="docutils literal"><spanclass="pre">NULL</span></tt> and 0
<aclass="reference internal"href="#c.nghttp2_session_recv"title="nghttp2_session_recv"><ttclass="xref c c-func docutils literal"><spanclass="pre">nghttp2_session_recv()</span></tt></a> and <aclass="reference internal"href="#c.nghttp2_session_send"title="nghttp2_session_send"><ttclass="xref c c-func docutils literal"><spanclass="pre">nghttp2_session_send()</span></tt></a> functions
immediately return <aclass="reference internal"href="#c.NGHTTP2_ERR_CALLBACK_FAILURE"title="NGHTTP2_ERR_CALLBACK_FAILURE"><ttclass="xref c c-macro docutils literal"><spanclass="pre">NGHTTP2_ERR_CALLBACK_FAILURE</span></tt></a>.</p>
<p>To set this callback to <aclass="reference internal"href="#c.nghttp2_session_callbacks"title="nghttp2_session_callbacks"><ttclass="xref c c-type docutils literal"><spanclass="pre">nghttp2_session_callbacks</span></tt></a>, use
<aclass="reference internal"href="#c.nghttp2_session_callbacks_set_on_invalid_frame_recv_callback"title="nghttp2_session_callbacks_set_on_invalid_frame_recv_callback"><ttclass="xref c c-func docutils literal"><spanclass="pre">nghttp2_session_callbacks_set_on_invalid_frame_recv_callback()</span></tt></a>.</p>
typedef int <ttclass="descname">(*nghttp2_on_data_chunk_recv_callback)</tt><big>(</big><aclass="reference internal"href="#c.nghttp2_session"title="nghttp2_session">nghttp2_session</a><em> *session</em>, uint8_t<em> flags</em>, int32_t<em> stream_id</em>, const uint8_t<em> *data</em>, size_t<em> len</em>, void<em> *user_data</em><big>)</big><aclass="headerlink"href="#c.nghttp2_on_data_chunk_recv_callback"title="Permalink to this definition">¶</a></dt>
received. The <em>stream_id</em> is the stream ID this DATA frame belongs
to. The <em>flags</em> is the flags of DATA frame which this data chunk
is contained. <ttclass="docutils literal"><spanclass="pre">(flags</span><spanclass="pre">&</span><spanclass="pre">NGHTTP2_FLAG_END_STREAM)</span><spanclass="pre">!=</span><spanclass="pre">0</span></tt> does not
necessarily mean this chunk of data is the last one in the stream.
You should use <aclass="reference internal"href="#c.nghttp2_on_frame_recv_callback"title="nghttp2_on_frame_recv_callback"><ttclass="xref c c-type docutils literal"><spanclass="pre">nghttp2_on_frame_recv_callback</span></tt></a> to know all
data frames are received. The <em>user_data</em> pointer is the third
argument passed in to the call to <aclass="reference internal"href="#c.nghttp2_session_client_new"title="nghttp2_session_client_new"><ttclass="xref c c-func docutils literal"><spanclass="pre">nghttp2_session_client_new()</span></tt></a> or
<aclass="reference internal"href="#c.nghttp2_session_server_new"title="nghttp2_session_server_new"><ttclass="xref c c-func docutils literal"><spanclass="pre">nghttp2_session_server_new()</span></tt></a>.</p>
<p>If the application uses <aclass="reference internal"href="#c.nghttp2_session_mem_recv"title="nghttp2_session_mem_recv"><ttclass="xref c c-func docutils literal"><spanclass="pre">nghttp2_session_mem_recv()</span></tt></a>, it can return
<aclass="reference internal"href="#c.NGHTTP2_ERR_PAUSE"title="NGHTTP2_ERR_PAUSE"><ttclass="xref c c-macro docutils literal"><spanclass="pre">NGHTTP2_ERR_PAUSE</span></tt></a> to make <aclass="reference internal"href="#c.nghttp2_session_mem_recv"title="nghttp2_session_mem_recv"><ttclass="xref c c-func docutils literal"><spanclass="pre">nghttp2_session_mem_recv()</span></tt></a>
<aclass="reference internal"href="#c.nghttp2_session_mem_recv"title="nghttp2_session_mem_recv"><ttclass="xref c c-func docutils literal"><spanclass="pre">nghttp2_session_mem_recv()</span></tt></a> or <aclass="reference internal"href="#c.nghttp2_session_recv"title="nghttp2_session_recv"><ttclass="xref c c-func docutils literal"><spanclass="pre">nghttp2_session_recv()</span></tt></a> is called.
The application must retain the input bytes which was used to
produce the <em>data</em> parameter, because it may refer to the memory
<aclass="reference internal"href="#c.nghttp2_session_recv"title="nghttp2_session_recv"><ttclass="xref c c-func docutils literal"><spanclass="pre">nghttp2_session_recv()</span></tt></a> and <aclass="reference internal"href="#c.nghttp2_session_mem_recv"title="nghttp2_session_mem_recv"><ttclass="xref c c-func docutils literal"><spanclass="pre">nghttp2_session_mem_recv()</span></tt></a> functions
immediately return <aclass="reference internal"href="#c.NGHTTP2_ERR_CALLBACK_FAILURE"title="NGHTTP2_ERR_CALLBACK_FAILURE"><ttclass="xref c c-macro docutils literal"><spanclass="pre">NGHTTP2_ERR_CALLBACK_FAILURE</span></tt></a>.</p>
<p>To set this callback to <aclass="reference internal"href="#c.nghttp2_session_callbacks"title="nghttp2_session_callbacks"><ttclass="xref c c-type docutils literal"><spanclass="pre">nghttp2_session_callbacks</span></tt></a>, use
<aclass="reference internal"href="#c.nghttp2_session_callbacks_set_on_data_chunk_recv_callback"title="nghttp2_session_callbacks_set_on_data_chunk_recv_callback"><ttclass="xref c c-func docutils literal"><spanclass="pre">nghttp2_session_callbacks_set_on_data_chunk_recv_callback()</span></tt></a>.</p>
typedef int <ttclass="descname">(*nghttp2_before_frame_send_callback)</tt><big>(</big><aclass="reference internal"href="#c.nghttp2_session"title="nghttp2_session">nghttp2_session</a><em> *session</em>, const <aclass="reference internal"href="#c.nghttp2_frame"title="nghttp2_frame">nghttp2_frame</a><em> *frame</em>, void<em> *user_data</em><big>)</big><aclass="headerlink"href="#c.nghttp2_before_frame_send_callback"title="Permalink to this definition">¶</a></dt>
<dd><p>Callback function invoked just before the non-DATA frame <em>frame</em> is
sent. The <em>user_data</em> pointer is the third argument passed in to
the call to <aclass="reference internal"href="#c.nghttp2_session_client_new"title="nghttp2_session_client_new"><ttclass="xref c c-func docutils literal"><spanclass="pre">nghttp2_session_client_new()</span></tt></a> or
<aclass="reference internal"href="#c.nghttp2_session_recv"title="nghttp2_session_recv"><ttclass="xref c c-func docutils literal"><spanclass="pre">nghttp2_session_recv()</span></tt></a> and <aclass="reference internal"href="#c.nghttp2_session_send"title="nghttp2_session_send"><ttclass="xref c c-func docutils literal"><spanclass="pre">nghttp2_session_send()</span></tt></a> functions
immediately return <aclass="reference internal"href="#c.NGHTTP2_ERR_CALLBACK_FAILURE"title="NGHTTP2_ERR_CALLBACK_FAILURE"><ttclass="xref c c-macro docutils literal"><spanclass="pre">NGHTTP2_ERR_CALLBACK_FAILURE</span></tt></a>.</p>
<p>To set this callback to <aclass="reference internal"href="#c.nghttp2_session_callbacks"title="nghttp2_session_callbacks"><ttclass="xref c c-type docutils literal"><spanclass="pre">nghttp2_session_callbacks</span></tt></a>, use
<aclass="reference internal"href="#c.nghttp2_session_callbacks_set_before_frame_send_callback"title="nghttp2_session_callbacks_set_before_frame_send_callback"><ttclass="xref c c-func docutils literal"><spanclass="pre">nghttp2_session_callbacks_set_before_frame_send_callback()</span></tt></a>.</p>
typedef int <ttclass="descname">(*nghttp2_on_frame_send_callback)</tt><big>(</big><aclass="reference internal"href="#c.nghttp2_session"title="nghttp2_session">nghttp2_session</a><em> *session</em>, const <aclass="reference internal"href="#c.nghttp2_frame"title="nghttp2_frame">nghttp2_frame</a><em> *frame</em>, void<em> *user_data</em><big>)</big><aclass="headerlink"href="#c.nghttp2_on_frame_send_callback"title="Permalink to this definition">¶</a></dt>
<aclass="reference internal"href="#c.nghttp2_session_client_new"title="nghttp2_session_client_new"><ttclass="xref c c-func docutils literal"><spanclass="pre">nghttp2_session_client_new()</span></tt></a> or <aclass="reference internal"href="#c.nghttp2_session_server_new"title="nghttp2_session_server_new"><ttclass="xref c c-func docutils literal"><spanclass="pre">nghttp2_session_server_new()</span></tt></a>.</p>
<aclass="reference internal"href="#c.nghttp2_session_recv"title="nghttp2_session_recv"><ttclass="xref c c-func docutils literal"><spanclass="pre">nghttp2_session_recv()</span></tt></a> and <aclass="reference internal"href="#c.nghttp2_session_send"title="nghttp2_session_send"><ttclass="xref c c-func docutils literal"><spanclass="pre">nghttp2_session_send()</span></tt></a> functions
immediately return <aclass="reference internal"href="#c.NGHTTP2_ERR_CALLBACK_FAILURE"title="NGHTTP2_ERR_CALLBACK_FAILURE"><ttclass="xref c c-macro docutils literal"><spanclass="pre">NGHTTP2_ERR_CALLBACK_FAILURE</span></tt></a>.</p>
<p>To set this callback to <aclass="reference internal"href="#c.nghttp2_session_callbacks"title="nghttp2_session_callbacks"><ttclass="xref c c-type docutils literal"><spanclass="pre">nghttp2_session_callbacks</span></tt></a>, use
<aclass="reference internal"href="#c.nghttp2_session_callbacks_set_on_frame_send_callback"title="nghttp2_session_callbacks_set_on_frame_send_callback"><ttclass="xref c c-func docutils literal"><spanclass="pre">nghttp2_session_callbacks_set_on_frame_send_callback()</span></tt></a>.</p>
typedef int <ttclass="descname">(*nghttp2_on_frame_not_send_callback)</tt><big>(</big><aclass="reference internal"href="#c.nghttp2_session"title="nghttp2_session">nghttp2_session</a><em> *session</em>, const <aclass="reference internal"href="#c.nghttp2_frame"title="nghttp2_frame">nghttp2_frame</a><em> *frame</em>, int<em> lib_error_code</em>, void<em> *user_data</em><big>)</big><aclass="headerlink"href="#c.nghttp2_on_frame_not_send_callback"title="Permalink to this definition">¶</a></dt>
<aclass="reference internal"href="#c.nghttp2_error"title="nghttp2_error"><ttclass="xref c c-type docutils literal"><spanclass="pre">nghttp2_error</span></tt></a>. The <em>user_data</em> pointer is the third
argument passed in to the call to <aclass="reference internal"href="#c.nghttp2_session_client_new"title="nghttp2_session_client_new"><ttclass="xref c c-func docutils literal"><spanclass="pre">nghttp2_session_client_new()</span></tt></a> or
<aclass="reference internal"href="#c.nghttp2_session_server_new"title="nghttp2_session_server_new"><ttclass="xref c c-func docutils literal"><spanclass="pre">nghttp2_session_server_new()</span></tt></a>.</p>
<aclass="reference internal"href="#c.nghttp2_session_recv"title="nghttp2_session_recv"><ttclass="xref c c-func docutils literal"><spanclass="pre">nghttp2_session_recv()</span></tt></a> and <aclass="reference internal"href="#c.nghttp2_session_send"title="nghttp2_session_send"><ttclass="xref c c-func docutils literal"><spanclass="pre">nghttp2_session_send()</span></tt></a> functions
immediately return <aclass="reference internal"href="#c.NGHTTP2_ERR_CALLBACK_FAILURE"title="NGHTTP2_ERR_CALLBACK_FAILURE"><ttclass="xref c c-macro docutils literal"><spanclass="pre">NGHTTP2_ERR_CALLBACK_FAILURE</span></tt></a>.</p>
<p><aclass="reference internal"href="#c.nghttp2_session_get_stream_user_data"title="nghttp2_session_get_stream_user_data"><ttclass="xref c c-func docutils literal"><spanclass="pre">nghttp2_session_get_stream_user_data()</span></tt></a> can be used to get
<p>To set this callback to <aclass="reference internal"href="#c.nghttp2_session_callbacks"title="nghttp2_session_callbacks"><ttclass="xref c c-type docutils literal"><spanclass="pre">nghttp2_session_callbacks</span></tt></a>, use
<aclass="reference internal"href="#c.nghttp2_session_callbacks_set_on_frame_not_send_callback"title="nghttp2_session_callbacks_set_on_frame_not_send_callback"><ttclass="xref c c-func docutils literal"><spanclass="pre">nghttp2_session_callbacks_set_on_frame_not_send_callback()</span></tt></a>.</p>
typedef int <ttclass="descname">(*nghttp2_on_stream_close_callback)</tt><big>(</big><aclass="reference internal"href="#c.nghttp2_session"title="nghttp2_session">nghttp2_session</a><em> *session</em>, int32_t<em> stream_id</em>, uint32_t<em> error_code</em>, void<em> *user_data</em><big>)</big><aclass="headerlink"href="#c.nghttp2_on_stream_close_callback"title="Permalink to this definition">¶</a></dt>
<em>error_code</em> is usually one of <aclass="reference internal"href="#c.nghttp2_error_code"title="nghttp2_error_code"><ttclass="xref c c-macro docutils literal"><spanclass="pre">nghttp2_error_code</span></tt></a>, but that
is not guaranteed. The stream_user_data, which was specified in
<aclass="reference internal"href="#c.nghttp2_submit_request"title="nghttp2_submit_request"><ttclass="xref c c-func docutils literal"><spanclass="pre">nghttp2_submit_request()</span></tt></a> or <aclass="reference internal"href="#c.nghttp2_submit_headers"title="nghttp2_submit_headers"><ttclass="xref c c-func docutils literal"><spanclass="pre">nghttp2_submit_headers()</span></tt></a>, is still
available in this function. The <em>user_data</em> pointer is the third
argument passed in to the call to <aclass="reference internal"href="#c.nghttp2_session_client_new"title="nghttp2_session_client_new"><ttclass="xref c c-func docutils literal"><spanclass="pre">nghttp2_session_client_new()</span></tt></a> or
<aclass="reference internal"href="#c.nghttp2_session_recv"title="nghttp2_session_recv"><ttclass="xref c c-func docutils literal"><spanclass="pre">nghttp2_session_recv()</span></tt></a> and <aclass="reference internal"href="#c.nghttp2_session_send"title="nghttp2_session_send"><ttclass="xref c c-func docutils literal"><spanclass="pre">nghttp2_session_send()</span></tt></a> functions
immediately return <aclass="reference internal"href="#c.NGHTTP2_ERR_CALLBACK_FAILURE"title="NGHTTP2_ERR_CALLBACK_FAILURE"><ttclass="xref c c-macro docutils literal"><spanclass="pre">NGHTTP2_ERR_CALLBACK_FAILURE</span></tt></a>.</p>
<p>To set this callback to <aclass="reference internal"href="#c.nghttp2_session_callbacks"title="nghttp2_session_callbacks"><ttclass="xref c c-type docutils literal"><spanclass="pre">nghttp2_session_callbacks</span></tt></a>, use
<aclass="reference internal"href="#c.nghttp2_session_callbacks_set_on_stream_close_callback"title="nghttp2_session_callbacks_set_on_stream_close_callback"><ttclass="xref c c-func docutils literal"><spanclass="pre">nghttp2_session_callbacks_set_on_stream_close_callback()</span></tt></a>.</p>
typedef int <ttclass="descname">(*nghttp2_on_begin_headers_callback)</tt><big>(</big><aclass="reference internal"href="#c.nghttp2_session"title="nghttp2_session">nghttp2_session</a><em> *session</em>, const <aclass="reference internal"href="#c.nghttp2_frame"title="nghttp2_frame">nghttp2_frame</a><em> *frame</em>, void<em> *user_data</em><big>)</big><aclass="headerlink"href="#c.nghttp2_on_begin_headers_callback"title="Permalink to this definition">¶</a></dt>
will be emitted by <aclass="reference internal"href="#c.nghttp2_on_header_callback"title="nghttp2_on_header_callback"><ttclass="xref c c-type docutils literal"><spanclass="pre">nghttp2_on_header_callback</span></tt></a>.</p>
<aclass="reference internal"href="#c.NGHTTP2_FLAG_END_HEADERS"title="NGHTTP2_FLAG_END_HEADERS"><ttclass="xref c c-macro docutils literal"><spanclass="pre">NGHTTP2_FLAG_END_HEADERS</span></tt></a> flag set, which indicates that one
<p>The server applications probably create an object to store
information about new stream if <ttclass="docutils literal"><spanclass="pre">frame->hd.type</span><spanclass="pre">==</span>
<spanclass="pre">NGHTTP2_HEADERS</span></tt> and <ttclass="docutils literal"><spanclass="pre">frame->headers.cat</span><spanclass="pre">==</span>
<spanclass="pre">NGHTTP2_HCAT_REQUEST</span></tt>. If <em>session</em> is configured as server side,
<ttclass="docutils literal"><spanclass="pre">frame->headers.cat</span></tt> is either <ttclass="docutils literal"><spanclass="pre">NGHTTP2_HCAT_REQUEST</span></tt>
containing request headers or <ttclass="docutils literal"><spanclass="pre">NGHTTP2_HCAT_HEADERS</span></tt> containing
trailer headers and never get PUSH_PROMISE in this callback.</p>
<p>For the client applications, <ttclass="docutils literal"><spanclass="pre">frame->hd.type</span></tt> is either
<ttclass="docutils literal"><spanclass="pre">NGHTTP2_HEADERS</span></tt> or <ttclass="docutils literal"><spanclass="pre">NGHTTP2_PUSH_PROMISE</span></tt>. In case of
<spanclass="pre">NGHTTP2_HCAT_RESPONSE</span></tt> means that it is the first response
headers, but it may be non-final response which is indicated by 1xx
status code. In this case, there may be zero or more HEADERS frame
with <ttclass="docutils literal"><spanclass="pre">frame->headers.cat</span><spanclass="pre">==</span><spanclass="pre">NGHTTP2_HCAT_HEADERS</span></tt> which has
non-final response code and finally client gets exactly one HEADERS
frame with <ttclass="docutils literal"><spanclass="pre">frame->headers.cat</span><spanclass="pre">==</span><spanclass="pre">NGHTTP2_HCAT_HEADERS</span></tt>
containing final response headers (non-1xx status code). The
trailer headers also has <ttclass="docutils literal"><spanclass="pre">frame->headers.cat</span><spanclass="pre">==</span>
<spanclass="pre">NGHTTP2_HCAT_HEADERS</span></tt> which does not containg any status code.</p>
<aclass="reference internal"href="#c.NGHTTP2_ERR_CALLBACK_FAILURE"title="NGHTTP2_ERR_CALLBACK_FAILURE"><ttclass="xref c c-macro docutils literal"><spanclass="pre">NGHTTP2_ERR_CALLBACK_FAILURE</span></tt></a>. If nonzero value other than
<aclass="reference internal"href="#c.NGHTTP2_ERR_CALLBACK_FAILURE"title="NGHTTP2_ERR_CALLBACK_FAILURE"><ttclass="xref c c-macro docutils literal"><spanclass="pre">NGHTTP2_ERR_CALLBACK_FAILURE</span></tt></a> is returned, it is treated as
if <aclass="reference internal"href="#c.NGHTTP2_ERR_CALLBACK_FAILURE"title="NGHTTP2_ERR_CALLBACK_FAILURE"><ttclass="xref c c-macro docutils literal"><spanclass="pre">NGHTTP2_ERR_CALLBACK_FAILURE</span></tt></a> is returned. If
<aclass="reference internal"href="#c.NGHTTP2_ERR_CALLBACK_FAILURE"title="NGHTTP2_ERR_CALLBACK_FAILURE"><ttclass="xref c c-macro docutils literal"><spanclass="pre">NGHTTP2_ERR_CALLBACK_FAILURE</span></tt></a> is returned,
<aclass="reference internal"href="#c.nghttp2_session_mem_recv"title="nghttp2_session_mem_recv"><ttclass="xref c c-func docutils literal"><spanclass="pre">nghttp2_session_mem_recv()</span></tt></a> function will immediately return
<aclass="reference internal"href="#c.NGHTTP2_ERR_CALLBACK_FAILURE"title="NGHTTP2_ERR_CALLBACK_FAILURE"><ttclass="xref c c-macro docutils literal"><spanclass="pre">NGHTTP2_ERR_CALLBACK_FAILURE</span></tt></a>.</p>
<p>To set this callback to <aclass="reference internal"href="#c.nghttp2_session_callbacks"title="nghttp2_session_callbacks"><ttclass="xref c c-type docutils literal"><spanclass="pre">nghttp2_session_callbacks</span></tt></a>, use
<aclass="reference internal"href="#c.nghttp2_session_callbacks_set_on_begin_headers_callback"title="nghttp2_session_callbacks_set_on_begin_headers_callback"><ttclass="xref c c-func docutils literal"><spanclass="pre">nghttp2_session_callbacks_set_on_begin_headers_callback()</span></tt></a>.</p>
for the <em>frame</em>. The <em>name</em> of length <em>namelen</em> is header name.
The <em>value</em> of length <em>valuelen</em> is header value. The <em>flags</em> is
bitwise OR of one or more of <aclass="reference internal"href="#c.nghttp2_nv_flag"title="nghttp2_nv_flag"><ttclass="xref c c-type docutils literal"><spanclass="pre">nghttp2_nv_flag</span></tt></a>.</p>
<p>If <aclass="reference internal"href="#c.NGHTTP2_NV_FLAG_NO_INDEX"title="NGHTTP2_NV_FLAG_NO_INDEX"><ttclass="xref c c-macro docutils literal"><spanclass="pre">NGHTTP2_NV_FLAG_NO_INDEX</span></tt></a> is set in <em>flags</em>, the receiver
must not index this name/value pair when forwarding it to the next
<p>When this callback is invoked, <ttclass="docutils literal"><spanclass="pre">frame->hd.type</span></tt> is either
<aclass="reference internal"href="#c.NGHTTP2_HEADERS"title="NGHTTP2_HEADERS"><ttclass="xref c c-macro docutils literal"><spanclass="pre">NGHTTP2_HEADERS</span></tt></a> or <aclass="reference internal"href="#c.NGHTTP2_PUSH_PROMISE"title="NGHTTP2_PUSH_PROMISE"><ttclass="xref c c-macro docutils literal"><spanclass="pre">NGHTTP2_PUSH_PROMISE</span></tt></a>. After all
header name/value pairs are processed with this callback, and no
error has been detected, <aclass="reference internal"href="#c.nghttp2_on_frame_recv_callback"title="nghttp2_on_frame_recv_callback"><ttclass="xref c c-type docutils literal"><spanclass="pre">nghttp2_on_frame_recv_callback</span></tt></a>
will be invoked. If there is an error in decompression,
<aclass="reference internal"href="#c.nghttp2_on_frame_recv_callback"title="nghttp2_on_frame_recv_callback"><ttclass="xref c c-type docutils literal"><spanclass="pre">nghttp2_on_frame_recv_callback</span></tt></a> for the <em>frame</em> will not be
<p>The <em>value</em> may be <ttclass="docutils literal"><spanclass="pre">NULL</span></tt> if the <em>valuelen</em> is 0.</p>
<p>Please note that unless <aclass="reference internal"href="#c.nghttp2_option_set_no_http_messaging"title="nghttp2_option_set_no_http_messaging"><ttclass="xref c c-func docutils literal"><spanclass="pre">nghttp2_option_set_no_http_messaging()</span></tt></a> is
used, nghttp2 library does perform validation against the <em>name</em>
and the <em>value</em> using <aclass="reference internal"href="#c.nghttp2_check_header_name"title="nghttp2_check_header_name"><ttclass="xref c c-func docutils literal"><spanclass="pre">nghttp2_check_header_name()</span></tt></a> and
<aclass="reference internal"href="#c.nghttp2_check_header_value"title="nghttp2_check_header_value"><ttclass="xref c c-func docutils literal"><spanclass="pre">nghttp2_check_header_value()</span></tt></a>. In addition to this, nghttp2
performs vaidation based on HTTP Messaging rule, which is briefly
explained in <aclass="reference internal"href="#http-messaging">HTTP Messaging</a> section.</p>
<p>If the application uses <aclass="reference internal"href="#c.nghttp2_session_mem_recv"title="nghttp2_session_mem_recv"><ttclass="xref c c-func docutils literal"><spanclass="pre">nghttp2_session_mem_recv()</span></tt></a>, it can return
<aclass="reference internal"href="#c.NGHTTP2_ERR_PAUSE"title="NGHTTP2_ERR_PAUSE"><ttclass="xref c c-macro docutils literal"><spanclass="pre">NGHTTP2_ERR_PAUSE</span></tt></a> to make <aclass="reference internal"href="#c.nghttp2_session_mem_recv"title="nghttp2_session_mem_recv"><ttclass="xref c c-func docutils literal"><spanclass="pre">nghttp2_session_mem_recv()</span></tt></a>
<aclass="reference internal"href="#c.nghttp2_session_mem_recv"title="nghttp2_session_mem_recv"><ttclass="xref c c-func docutils literal"><spanclass="pre">nghttp2_session_mem_recv()</span></tt></a> or <aclass="reference internal"href="#c.nghttp2_session_recv"title="nghttp2_session_recv"><ttclass="xref c c-func docutils literal"><spanclass="pre">nghttp2_session_recv()</span></tt></a> is called.
The application must retain the input bytes which was used to
produce these parameters, because it may refer to the memory region
<p>Returning <aclass="reference internal"href="#c.NGHTTP2_ERR_TEMPORAL_CALLBACK_FAILURE"title="NGHTTP2_ERR_TEMPORAL_CALLBACK_FAILURE"><ttclass="xref c c-macro docutils literal"><spanclass="pre">NGHTTP2_ERR_TEMPORAL_CALLBACK_FAILURE</span></tt></a> will close
<aclass="reference internal"href="#c.NGHTTP2_INTERNAL_ERROR"title="NGHTTP2_INTERNAL_ERROR"><ttclass="xref c c-macro docutils literal"><spanclass="pre">NGHTTP2_INTERNAL_ERROR</span></tt></a>. In this case,
<aclass="reference internal"href="#c.nghttp2_on_frame_recv_callback"title="nghttp2_on_frame_recv_callback"><ttclass="xref c c-type docutils literal"><spanclass="pre">nghttp2_on_frame_recv_callback</span></tt></a> will not be invoked. If a
different error code is desirable, use
<aclass="reference internal"href="#c.nghttp2_submit_rst_stream"title="nghttp2_submit_rst_stream"><ttclass="xref c c-func docutils literal"><spanclass="pre">nghttp2_submit_rst_stream()</span></tt></a> with a desired error code and then
return <aclass="reference internal"href="#c.NGHTTP2_ERR_TEMPORAL_CALLBACK_FAILURE"title="NGHTTP2_ERR_TEMPORAL_CALLBACK_FAILURE"><ttclass="xref c c-macro docutils literal"><spanclass="pre">NGHTTP2_ERR_TEMPORAL_CALLBACK_FAILURE</span></tt></a>.</p>
<p>The implementation of this function must return 0 if it succeeds.
It may return <aclass="reference internal"href="#c.NGHTTP2_ERR_PAUSE"title="NGHTTP2_ERR_PAUSE"><ttclass="xref c c-macro docutils literal"><spanclass="pre">NGHTTP2_ERR_PAUSE</span></tt></a> or
<aclass="reference internal"href="#c.NGHTTP2_ERR_TEMPORAL_CALLBACK_FAILURE"title="NGHTTP2_ERR_TEMPORAL_CALLBACK_FAILURE"><ttclass="xref c c-macro docutils literal"><spanclass="pre">NGHTTP2_ERR_TEMPORAL_CALLBACK_FAILURE</span></tt></a>. For other critical
failures, it must return <aclass="reference internal"href="#c.NGHTTP2_ERR_CALLBACK_FAILURE"title="NGHTTP2_ERR_CALLBACK_FAILURE"><ttclass="xref c c-macro docutils literal"><spanclass="pre">NGHTTP2_ERR_CALLBACK_FAILURE</span></tt></a>. If
<aclass="reference internal"href="#c.NGHTTP2_ERR_CALLBACK_FAILURE"title="NGHTTP2_ERR_CALLBACK_FAILURE"><ttclass="xref c c-macro docutils literal"><spanclass="pre">NGHTTP2_ERR_CALLBACK_FAILURE</span></tt></a>. If
<aclass="reference internal"href="#c.NGHTTP2_ERR_CALLBACK_FAILURE"title="NGHTTP2_ERR_CALLBACK_FAILURE"><ttclass="xref c c-macro docutils literal"><spanclass="pre">NGHTTP2_ERR_CALLBACK_FAILURE</span></tt></a> is returned,
<aclass="reference internal"href="#c.nghttp2_session_recv"title="nghttp2_session_recv"><ttclass="xref c c-func docutils literal"><spanclass="pre">nghttp2_session_recv()</span></tt></a> and <aclass="reference internal"href="#c.nghttp2_session_mem_recv"title="nghttp2_session_mem_recv"><ttclass="xref c c-func docutils literal"><spanclass="pre">nghttp2_session_mem_recv()</span></tt></a> functions
immediately return <aclass="reference internal"href="#c.NGHTTP2_ERR_CALLBACK_FAILURE"title="NGHTTP2_ERR_CALLBACK_FAILURE"><ttclass="xref c c-macro docutils literal"><spanclass="pre">NGHTTP2_ERR_CALLBACK_FAILURE</span></tt></a>.</p>
<p>To set this callback to <aclass="reference internal"href="#c.nghttp2_session_callbacks"title="nghttp2_session_callbacks"><ttclass="xref c c-type docutils literal"><spanclass="pre">nghttp2_session_callbacks</span></tt></a>, use
<aclass="reference internal"href="#c.nghttp2_session_callbacks_set_on_header_callback"title="nghttp2_session_callbacks_set_on_header_callback"><ttclass="xref c c-func docutils literal"><spanclass="pre">nghttp2_session_callbacks_set_on_header_callback()</span></tt></a>.</p>
<aclass="reference internal"href="#c.NGHTTP2_ERR_CALLBACK_FAILURE"title="NGHTTP2_ERR_CALLBACK_FAILURE"><ttclass="xref c c-macro docutils literal"><spanclass="pre">NGHTTP2_ERR_CALLBACK_FAILURE</span></tt></a> will make
<aclass="reference internal"href="#c.nghttp2_session_send"title="nghttp2_session_send"><ttclass="xref c c-func docutils literal"><spanclass="pre">nghttp2_session_send()</span></tt></a> function immediately return
<aclass="reference internal"href="#c.NGHTTP2_ERR_CALLBACK_FAILURE"title="NGHTTP2_ERR_CALLBACK_FAILURE"><ttclass="xref c c-macro docutils literal"><spanclass="pre">NGHTTP2_ERR_CALLBACK_FAILURE</span></tt></a>.</p>
<p>To set this callback to <aclass="reference internal"href="#c.nghttp2_session_callbacks"title="nghttp2_session_callbacks"><ttclass="xref c c-type docutils literal"><spanclass="pre">nghttp2_session_callbacks</span></tt></a>, use
<aclass="reference internal"href="#c.nghttp2_session_callbacks_set_select_padding_callback"title="nghttp2_session_callbacks_set_select_padding_callback"><ttclass="xref c c-func docutils literal"><spanclass="pre">nghttp2_session_callbacks_set_select_padding_callback()</span></tt></a>.</p>
<em>remote_max_frame_size</em>)]. If a value greater than this range is
returned than the max allow value will be used. Returning a value
smaller than this range is treated as
<aclass="reference internal"href="#c.NGHTTP2_ERR_CALLBACK_FAILURE"title="NGHTTP2_ERR_CALLBACK_FAILURE"><ttclass="xref c c-macro docutils literal"><spanclass="pre">NGHTTP2_ERR_CALLBACK_FAILURE</span></tt></a>. The <em>frame_type</em> is provided
for future extensibility and identifies the type of frame (see
<aclass="reference internal"href="#c.nghttp2_frame_type"title="nghttp2_frame_type"><ttclass="xref c c-type docutils literal"><spanclass="pre">nghttp2_frame_type</span></tt></a>) for which to get the length for.
Currently supported frame types are: <aclass="reference internal"href="#c.NGHTTP2_DATA"title="NGHTTP2_DATA"><ttclass="xref c c-macro docutils literal"><spanclass="pre">NGHTTP2_DATA</span></tt></a>.</p>
<p>This callback can be used to control the length in bytes for which
<aclass="reference internal"href="#c.nghttp2_data_source_read_callback"title="nghttp2_data_source_read_callback"><ttclass="xref c c-type docutils literal"><spanclass="pre">nghttp2_data_source_read_callback</span></tt></a> is allowed to send to the
remote endpoint. This callback is optional. Returning
<aclass="reference internal"href="#c.NGHTTP2_ERR_CALLBACK_FAILURE"title="NGHTTP2_ERR_CALLBACK_FAILURE"><ttclass="xref c c-macro docutils literal"><spanclass="pre">NGHTTP2_ERR_CALLBACK_FAILURE</span></tt></a> will signal the entire session
failure.</p>
<p>To set this callback to <aclass="reference internal"href="#c.nghttp2_session_callbacks"title="nghttp2_session_callbacks"><ttclass="xref c c-type docutils literal"><spanclass="pre">nghttp2_session_callbacks</span></tt></a>, use
<aclass="reference internal"href="#c.nghttp2_session_callbacks_set_data_source_read_length_callback"title="nghttp2_session_callbacks_set_data_source_read_length_callback"><ttclass="xref c c-func docutils literal"><spanclass="pre">nghttp2_session_callbacks_set_data_source_read_length_callback()</span></tt></a>.</p>
</dd></dl>
<dlclass="type">
<dtid="c.nghttp2_on_begin_frame_callback">
typedef int <ttclass="descname">(*nghttp2_on_begin_frame_callback)</tt><big>(</big><aclass="reference internal"href="#c.nghttp2_session"title="nghttp2_session">nghttp2_session</a><em> *session</em>, const <aclass="reference internal"href="#c.nghttp2_frame_hd"title="nghttp2_frame_hd">nghttp2_frame_hd</a><em> *hd</em>, void<em> *user_data</em><big>)</big><aclass="headerlink"href="#c.nghttp2_on_begin_frame_callback"title="Permalink to this definition">¶</a></dt>
<dd><p>Callback function invoked when a frame header is received. The
<em>hd</em> points to received frame header.</p>
<p>Unlike <aclass="reference internal"href="#c.nghttp2_on_frame_recv_callback"title="nghttp2_on_frame_recv_callback"><ttclass="xref c c-type docutils literal"><spanclass="pre">nghttp2_on_frame_recv_callback</span></tt></a>, this callback will
also be called when frame header of CONTINUATION frame is received.</p>
<p>If both <aclass="reference internal"href="#c.nghttp2_on_begin_frame_callback"title="nghttp2_on_begin_frame_callback"><ttclass="xref c c-type docutils literal"><spanclass="pre">nghttp2_on_begin_frame_callback</span></tt></a> and
<aclass="reference internal"href="#c.nghttp2_on_begin_headers_callback"title="nghttp2_on_begin_headers_callback"><ttclass="xref c c-type docutils literal"><spanclass="pre">nghttp2_on_begin_headers_callback</span></tt></a> are set and HEADERS or
PUSH_PROMISE is received, <aclass="reference internal"href="#c.nghttp2_on_begin_frame_callback"title="nghttp2_on_begin_frame_callback"><ttclass="xref c c-type docutils literal"><spanclass="pre">nghttp2_on_begin_frame_callback</span></tt></a>
will be called first.</p>
<p>The implementation of this function must return 0 if it succeeds.
If nonzero value is returned, it is treated as fatal error and
<aclass="reference internal"href="#c.nghttp2_session_recv"title="nghttp2_session_recv"><ttclass="xref c c-func docutils literal"><spanclass="pre">nghttp2_session_recv()</span></tt></a> and <aclass="reference internal"href="#c.nghttp2_session_mem_recv"title="nghttp2_session_mem_recv"><ttclass="xref c c-func docutils literal"><spanclass="pre">nghttp2_session_mem_recv()</span></tt></a> functions
immediately return <aclass="reference internal"href="#c.NGHTTP2_ERR_CALLBACK_FAILURE"title="NGHTTP2_ERR_CALLBACK_FAILURE"><ttclass="xref c c-macro docutils literal"><spanclass="pre">NGHTTP2_ERR_CALLBACK_FAILURE</span></tt></a>.</p>
<p>To set this callback to <aclass="reference internal"href="#c.nghttp2_session_callbacks"title="nghttp2_session_callbacks"><ttclass="xref c c-type docutils literal"><spanclass="pre">nghttp2_session_callbacks</span></tt></a>, use
<aclass="reference internal"href="#c.nghttp2_session_callbacks_set_on_begin_frame_callback"title="nghttp2_session_callbacks_set_on_begin_frame_callback"><ttclass="xref c c-func docutils literal"><spanclass="pre">nghttp2_session_callbacks_set_on_begin_frame_callback()</span></tt></a>.</p>
<ttclass="descname">nghttp2_session_callbacks</tt><aclass="headerlink"href="#c.nghttp2_session_callbacks"title="Permalink to this definition">¶</a></dt>
<dd><p>Callback functions for <aclass="reference internal"href="#c.nghttp2_session"title="nghttp2_session"><ttclass="xref c c-type docutils literal"><spanclass="pre">nghttp2_session</span></tt></a>. The details of
this structure are intentionally hidden from the public API.</p>
typedef void *<ttclass="descname">(*nghttp2_malloc)</tt><big>(</big>size_t<em> size</em>, void<em> *mem_user_data</em><big>)</big><aclass="headerlink"href="#c.nghttp2_malloc"title="Permalink to this definition">¶</a></dt>
<dd><p>Custom memory allocator to replace malloc(). The <em>mem_user_data</em>
is the mem_user_data member of <aclass="reference internal"href="#c.nghttp2_mem"title="nghttp2_mem"><ttclass="xref c c-type docutils literal"><spanclass="pre">nghttp2_mem</span></tt></a> structure.</p>
</dd></dl>
<dlclass="type">
<dtid="c.nghttp2_free">
typedef void <ttclass="descname">(*nghttp2_free)</tt><big>(</big>void<em> *ptr</em>, void<em> *mem_user_data</em><big>)</big><aclass="headerlink"href="#c.nghttp2_free"title="Permalink to this definition">¶</a></dt>
<dd><p>Custom memory allocator to replace free(). The <em>mem_user_data</em> is
the mem_user_data member of <aclass="reference internal"href="#c.nghttp2_mem"title="nghttp2_mem"><ttclass="xref c c-type docutils literal"><spanclass="pre">nghttp2_mem</span></tt></a> structure.</p>
</dd></dl>
<dlclass="type">
<dtid="c.nghttp2_calloc">
typedef void *<ttclass="descname">(*nghttp2_calloc)</tt><big>(</big>size_t<em> nmemb</em>, size_t<em> size</em>, void<em> *mem_user_data</em><big>)</big><aclass="headerlink"href="#c.nghttp2_calloc"title="Permalink to this definition">¶</a></dt>
<dd><p>Custom memory allocator to replace calloc(). The <em>mem_user_data</em>
is the mem_user_data member of <aclass="reference internal"href="#c.nghttp2_mem"title="nghttp2_mem"><ttclass="xref c c-type docutils literal"><spanclass="pre">nghttp2_mem</span></tt></a> structure.</p>
</dd></dl>
<dlclass="type">
<dtid="c.nghttp2_realloc">
typedef void *<ttclass="descname">(*nghttp2_realloc)</tt><big>(</big>void<em> *ptr</em>, size_t<em> size</em>, void<em> *mem_user_data</em><big>)</big><aclass="headerlink"href="#c.nghttp2_realloc"title="Permalink to this definition">¶</a></dt>
<dd><p>Custom memory allocator to replace realloc(). The <em>mem_user_data</em>
is the mem_user_data member of <aclass="reference internal"href="#c.nghttp2_mem"title="nghttp2_mem"><ttclass="xref c c-type docutils literal"><spanclass="pre">nghttp2_mem</span></tt></a> structure.</p>
</dd></dl>
<dlclass="type">
<dtid="c.nghttp2_mem">
<ttclass="descname">nghttp2_mem</tt><aclass="headerlink"href="#c.nghttp2_mem"title="Permalink to this definition">¶</a></dt>
<dd><p>Custom memory allocator functions and user defined pointer. The
<em>mem_user_data</em> member is passed to each allocator function. This
can be used, for example, to achieve per-session memory pool.</p>
<p>In the following example code, <ttclass="docutils literal"><spanclass="pre">my_malloc</span></tt>, <ttclass="docutils literal"><spanclass="pre">my_free</span></tt>,
<ttclass="docutils literal"><spanclass="pre">my_calloc</span></tt> and <ttclass="docutils literal"><spanclass="pre">my_realloc</span></tt> are the replacement of the
standard allocators <ttclass="docutils literal"><spanclass="pre">malloc</span></tt>, <ttclass="docutils literal"><spanclass="pre">free</span></tt>, <ttclass="docutils literal"><spanclass="pre">calloc</span></tt> and
void *<ttclass="descname">mem_user_data</tt><aclass="headerlink"href="#c.nghttp2_mem.mem_user_data"title="Permalink to this definition">¶</a></dt>
<dd><p>An arbitrary user supplied data. This is passed to each
allocator function.</p>
</dd></dl>
<dlclass="member">
<dtid="c.nghttp2_mem.malloc">
<aclass="reference internal"href="#c.nghttp2_malloc"title="nghttp2_malloc">nghttp2_malloc</a><ttclass="descname">malloc</tt><aclass="headerlink"href="#c.nghttp2_mem.malloc"title="Permalink to this definition">¶</a></dt>
<dd><p>Custom allocator function to replace malloc().</p>
</dd></dl>
<dlclass="member">
<dtid="c.nghttp2_mem.free">
<aclass="reference internal"href="#c.nghttp2_free"title="nghttp2_free">nghttp2_free</a><ttclass="descname">free</tt><aclass="headerlink"href="#c.nghttp2_mem.free"title="Permalink to this definition">¶</a></dt>
<dd><p>Custom allocator function to replace free().</p>
</dd></dl>
<dlclass="member">
<dtid="c.nghttp2_mem.calloc">
<aclass="reference internal"href="#c.nghttp2_calloc"title="nghttp2_calloc">nghttp2_calloc</a><ttclass="descname">calloc</tt><aclass="headerlink"href="#c.nghttp2_mem.calloc"title="Permalink to this definition">¶</a></dt>
<dd><p>Custom allocator function to replace calloc().</p>
</dd></dl>
<dlclass="member">
<dtid="c.nghttp2_mem.realloc">
<aclass="reference internal"href="#c.nghttp2_realloc"title="nghttp2_realloc">nghttp2_realloc</a><ttclass="descname">realloc</tt><aclass="headerlink"href="#c.nghttp2_mem.realloc"title="Permalink to this definition">¶</a></dt>
<dd><p>Custom allocator function to replace realloc().</p>
<ttclass="descname">nghttp2_option</tt><aclass="headerlink"href="#c.nghttp2_option"title="Permalink to this definition">¶</a></dt>
<dd><p>Configuration options for <aclass="reference internal"href="#c.nghttp2_session"title="nghttp2_session"><ttclass="xref c c-type docutils literal"><spanclass="pre">nghttp2_session</span></tt></a>. The details of
this structure are intentionally hidden from the public API.</p>
</dd></dl>
<dlclass="type">
<dtid="c.nghttp2_hd_deflater">
<ttclass="descname">nghttp2_hd_deflater</tt><aclass="headerlink"href="#c.nghttp2_hd_deflater"title="Permalink to this definition">¶</a></dt>
<dd><p>HPACK deflater object.</p>
</dd></dl>
<dlclass="type">
<dtid="c.nghttp2_hd_inflater">
<ttclass="descname">nghttp2_hd_inflater</tt><aclass="headerlink"href="#c.nghttp2_hd_inflater"title="Permalink to this definition">¶</a></dt>
<dd><p>HPACK inflater object.</p>
</dd></dl>
</div>
<divclass="section"id="functions">
<h2>Functions<aclass="headerlink"href="#functions"title="Permalink to this headline">¶</a></h2>
<dlclass="function">
<dtid="c.nghttp2_session_callbacks_new">
int <ttclass="descname">nghttp2_session_callbacks_new</tt><big>(</big><aclass="reference internal"href="#c.nghttp2_session_callbacks"title="nghttp2_session_callbacks">nghttp2_session_callbacks</a><em> **callbacks_ptr</em><big>)</big><aclass="headerlink"href="#c.nghttp2_session_callbacks_new"title="Permalink to this definition">¶</a></dt>
<dd><p>Initializes <em>*callbacks_ptr</em> with NULL values.</p>
<p>The initialized object can be used when initializing multiple
<aclass="reference internal"href="#c.nghttp2_session"title="nghttp2_session"><ttclass="xref c c-type docutils literal"><spanclass="pre">nghttp2_session</span></tt></a> objects.</p>
<p>When the application finished using this object, it can use
<aclass="reference internal"href="#c.nghttp2_session_callbacks_del"title="nghttp2_session_callbacks_del"><ttclass="xref c c-func docutils literal"><spanclass="pre">nghttp2_session_callbacks_del()</span></tt></a> to free its memory.</p>
<p>This function returns 0 if it succeeds, or one of the following
negative error codes:</p>
<dlclass="docutils">
<dt><aclass="reference internal"href="#c.NGHTTP2_ERR_NOMEM"title="NGHTTP2_ERR_NOMEM"><ttclass="xref c c-macro docutils literal"><spanclass="pre">NGHTTP2_ERR_NOMEM</span></tt></a></dt>
<dd>Out of memory.</dd>
</dl>
</dd></dl>
<dlclass="function">
<dtid="c.nghttp2_session_callbacks_del">
void <ttclass="descname">nghttp2_session_callbacks_del</tt><big>(</big><aclass="reference internal"href="#c.nghttp2_session_callbacks"title="nghttp2_session_callbacks">nghttp2_session_callbacks</a><em> *callbacks</em><big>)</big><aclass="headerlink"href="#c.nghttp2_session_callbacks_del"title="Permalink to this definition">¶</a></dt>
<dd><p>Frees any resources allocated for <em>callbacks</em>. If <em>callbacks</em> is
<ttclass="docutils literal"><spanclass="pre">NULL</span></tt>, this function does nothing.</p>
void <ttclass="descname">nghttp2_session_callbacks_set_send_callback</tt><big>(</big><aclass="reference internal"href="#c.nghttp2_session_callbacks"title="nghttp2_session_callbacks">nghttp2_session_callbacks</a><em> *cbs</em>, <aclass="reference internal"href="#c.nghttp2_send_callback"title="nghttp2_send_callback">nghttp2_send_callback</a><em> send_callback</em><big>)</big><aclass="headerlink"href="#c.nghttp2_session_callbacks_set_send_callback"title="Permalink to this definition">¶</a></dt>
<dd><p>Sets callback function invoked when a session wants to send data to
the remote peer. This callback is not necessary if the application
uses solely <aclass="reference internal"href="#c.nghttp2_session_mem_send"title="nghttp2_session_mem_send"><ttclass="xref c c-func docutils literal"><spanclass="pre">nghttp2_session_mem_send()</span></tt></a> to serialize data to
void <ttclass="descname">nghttp2_session_callbacks_set_recv_callback</tt><big>(</big><aclass="reference internal"href="#c.nghttp2_session_callbacks"title="nghttp2_session_callbacks">nghttp2_session_callbacks</a><em> *cbs</em>, <aclass="reference internal"href="#c.nghttp2_recv_callback"title="nghttp2_recv_callback">nghttp2_recv_callback</a><em> recv_callback</em><big>)</big><aclass="headerlink"href="#c.nghttp2_session_callbacks_set_recv_callback"title="Permalink to this definition">¶</a></dt>
<dd><p>Sets callback function invoked when the a session wants to receive
data from the remote peer. This callback is not necessary if the
application uses solely <aclass="reference internal"href="#c.nghttp2_session_mem_recv"title="nghttp2_session_mem_recv"><ttclass="xref c c-func docutils literal"><spanclass="pre">nghttp2_session_mem_recv()</span></tt></a> to process
void <ttclass="descname">nghttp2_session_callbacks_set_on_frame_recv_callback</tt><big>(</big><aclass="reference internal"href="#c.nghttp2_session_callbacks"title="nghttp2_session_callbacks">nghttp2_session_callbacks</a><em> *cbs</em>, <aclass="reference internal"href="#c.nghttp2_on_frame_recv_callback"title="nghttp2_on_frame_recv_callback">nghttp2_on_frame_recv_callback</a><em> on_frame_recv_callback</em><big>)</big><aclass="headerlink"href="#c.nghttp2_session_callbacks_set_on_frame_recv_callback"title="Permalink to this definition">¶</a></dt>
<dd><p>Sets callback function invoked by <aclass="reference internal"href="#c.nghttp2_session_recv"title="nghttp2_session_recv"><ttclass="xref c c-func docutils literal"><spanclass="pre">nghttp2_session_recv()</span></tt></a> when a
void <ttclass="descname">nghttp2_session_callbacks_set_on_invalid_frame_recv_callback</tt><big>(</big><aclass="reference internal"href="#c.nghttp2_session_callbacks"title="nghttp2_session_callbacks">nghttp2_session_callbacks</a><em> *cbs</em>, <aclass="reference internal"href="#c.nghttp2_on_invalid_frame_recv_callback"title="nghttp2_on_invalid_frame_recv_callback">nghttp2_on_invalid_frame_recv_callback</a><em> on_invalid_frame_recv_callback</em><big>)</big><aclass="headerlink"href="#c.nghttp2_session_callbacks_set_on_invalid_frame_recv_callback"title="Permalink to this definition">¶</a></dt>
<dd><p>Sets callback function invoked by <aclass="reference internal"href="#c.nghttp2_session_recv"title="nghttp2_session_recv"><ttclass="xref c c-func docutils literal"><spanclass="pre">nghttp2_session_recv()</span></tt></a> when an
void <ttclass="descname">nghttp2_session_callbacks_set_on_data_chunk_recv_callback</tt><big>(</big><aclass="reference internal"href="#c.nghttp2_session_callbacks"title="nghttp2_session_callbacks">nghttp2_session_callbacks</a><em> *cbs</em>, <aclass="reference internal"href="#c.nghttp2_on_data_chunk_recv_callback"title="nghttp2_on_data_chunk_recv_callback">nghttp2_on_data_chunk_recv_callback</a><em> on_data_chunk_recv_callback</em><big>)</big><aclass="headerlink"href="#c.nghttp2_session_callbacks_set_on_data_chunk_recv_callback"title="Permalink to this definition">¶</a></dt>
<dd><p>Sets callback function invoked when a chunk of data in DATA frame
void <ttclass="descname">nghttp2_session_callbacks_set_before_frame_send_callback</tt><big>(</big><aclass="reference internal"href="#c.nghttp2_session_callbacks"title="nghttp2_session_callbacks">nghttp2_session_callbacks</a><em> *cbs</em>, <aclass="reference internal"href="#c.nghttp2_before_frame_send_callback"title="nghttp2_before_frame_send_callback">nghttp2_before_frame_send_callback</a><em> before_frame_send_callback</em><big>)</big><aclass="headerlink"href="#c.nghttp2_session_callbacks_set_before_frame_send_callback"title="Permalink to this definition">¶</a></dt>
<dd><p>Sets callback function invoked before a non-DATA frame is sent.</p>
void <ttclass="descname">nghttp2_session_callbacks_set_on_frame_send_callback</tt><big>(</big><aclass="reference internal"href="#c.nghttp2_session_callbacks"title="nghttp2_session_callbacks">nghttp2_session_callbacks</a><em> *cbs</em>, <aclass="reference internal"href="#c.nghttp2_on_frame_send_callback"title="nghttp2_on_frame_send_callback">nghttp2_on_frame_send_callback</a><em> on_frame_send_callback</em><big>)</big><aclass="headerlink"href="#c.nghttp2_session_callbacks_set_on_frame_send_callback"title="Permalink to this definition">¶</a></dt>
<dd><p>Sets callback function invoked after a frame is sent.</p>
void <ttclass="descname">nghttp2_session_callbacks_set_on_frame_not_send_callback</tt><big>(</big><aclass="reference internal"href="#c.nghttp2_session_callbacks"title="nghttp2_session_callbacks">nghttp2_session_callbacks</a><em> *cbs</em>, <aclass="reference internal"href="#c.nghttp2_on_frame_not_send_callback"title="nghttp2_on_frame_not_send_callback">nghttp2_on_frame_not_send_callback</a><em> on_frame_not_send_callback</em><big>)</big><aclass="headerlink"href="#c.nghttp2_session_callbacks_set_on_frame_not_send_callback"title="Permalink to this definition">¶</a></dt>
<dd><p>Sets callback function invoked when a non-DATA frame is not sent
void <ttclass="descname">nghttp2_session_callbacks_set_on_stream_close_callback</tt><big>(</big><aclass="reference internal"href="#c.nghttp2_session_callbacks"title="nghttp2_session_callbacks">nghttp2_session_callbacks</a><em> *cbs</em>, <aclass="reference internal"href="#c.nghttp2_on_stream_close_callback"title="nghttp2_on_stream_close_callback">nghttp2_on_stream_close_callback</a><em> on_stream_close_callback</em><big>)</big><aclass="headerlink"href="#c.nghttp2_session_callbacks_set_on_stream_close_callback"title="Permalink to this definition">¶</a></dt>
<dd><p>Sets callback function invoked when the stream is closed.</p>
void <ttclass="descname">nghttp2_session_callbacks_set_on_begin_headers_callback</tt><big>(</big><aclass="reference internal"href="#c.nghttp2_session_callbacks"title="nghttp2_session_callbacks">nghttp2_session_callbacks</a><em> *cbs</em>, <aclass="reference internal"href="#c.nghttp2_on_begin_headers_callback"title="nghttp2_on_begin_headers_callback">nghttp2_on_begin_headers_callback</a><em> on_begin_headers_callback</em><big>)</big><aclass="headerlink"href="#c.nghttp2_session_callbacks_set_on_begin_headers_callback"title="Permalink to this definition">¶</a></dt>
<dd><p>Sets callback function invoked when the reception of header block
void <ttclass="descname">nghttp2_session_callbacks_set_on_header_callback</tt><big>(</big><aclass="reference internal"href="#c.nghttp2_session_callbacks"title="nghttp2_session_callbacks">nghttp2_session_callbacks</a><em> *cbs</em>, <aclass="reference internal"href="#c.nghttp2_on_header_callback"title="nghttp2_on_header_callback">nghttp2_on_header_callback</a><em> on_header_callback</em><big>)</big><aclass="headerlink"href="#c.nghttp2_session_callbacks_set_on_header_callback"title="Permalink to this definition">¶</a></dt>
<dd><p>Sets callback function invoked when a header name/value pair is
void <ttclass="descname">nghttp2_session_callbacks_set_select_padding_callback</tt><big>(</big><aclass="reference internal"href="#c.nghttp2_session_callbacks"title="nghttp2_session_callbacks">nghttp2_session_callbacks</a><em> *cbs</em>, <aclass="reference internal"href="#c.nghttp2_select_padding_callback"title="nghttp2_select_padding_callback">nghttp2_select_padding_callback</a><em> select_padding_callback</em><big>)</big><aclass="headerlink"href="#c.nghttp2_session_callbacks_set_select_padding_callback"title="Permalink to this definition">¶</a></dt>
<dd><p>Sets callback function invoked when the library asks application
how many padding bytes are required for the transmission of the
void <ttclass="descname">nghttp2_session_callbacks_set_data_source_read_length_callback</tt><big>(</big><aclass="reference internal"href="#c.nghttp2_session_callbacks"title="nghttp2_session_callbacks">nghttp2_session_callbacks</a><em> *cbs</em>, <aclass="reference internal"href="#c.nghttp2_data_source_read_length_callback"title="nghttp2_data_source_read_length_callback">nghttp2_data_source_read_length_callback</a><em> data_source_read_length_callback</em><big>)</big><aclass="headerlink"href="#c.nghttp2_session_callbacks_set_data_source_read_length_callback"title="Permalink to this definition">¶</a></dt>
<dd><p>Sets callback function determine the length allowed in
<aclass="reference internal"href="#c.nghttp2_data_source_read_callback"title="nghttp2_data_source_read_callback"><ttclass="xref c c-type docutils literal"><spanclass="pre">nghttp2_data_source_read_callback</span></tt></a>.</p>
void <ttclass="descname">nghttp2_session_callbacks_set_on_begin_frame_callback</tt><big>(</big><aclass="reference internal"href="#c.nghttp2_session_callbacks"title="nghttp2_session_callbacks">nghttp2_session_callbacks</a><em> *cbs</em>, <aclass="reference internal"href="#c.nghttp2_on_begin_frame_callback"title="nghttp2_on_begin_frame_callback">nghttp2_on_begin_frame_callback</a><em> on_begin_frame_callback</em><big>)</big><aclass="headerlink"href="#c.nghttp2_session_callbacks_set_on_begin_frame_callback"title="Permalink to this definition">¶</a></dt>
<dd><p>Sets callback function invoked when a frame header is received.</p>
int <ttclass="descname">nghttp2_option_new</tt><big>(</big><aclass="reference internal"href="#c.nghttp2_option"title="nghttp2_option">nghttp2_option</a><em> **option_ptr</em><big>)</big><aclass="headerlink"href="#c.nghttp2_option_new"title="Permalink to this definition">¶</a></dt>
<dd><p>Initializes <em>*option_ptr</em> with default values.</p>
<p>When the application finished using this object, it can use
<aclass="reference internal"href="#c.nghttp2_option_del"title="nghttp2_option_del"><ttclass="xref c c-func docutils literal"><spanclass="pre">nghttp2_option_del()</span></tt></a> to free its memory.</p>
<p>This function returns 0 if it succeeds, or one of the following
negative error codes:</p>
<dlclass="docutils">
<dt><aclass="reference internal"href="#c.NGHTTP2_ERR_NOMEM"title="NGHTTP2_ERR_NOMEM"><ttclass="xref c c-macro docutils literal"><spanclass="pre">NGHTTP2_ERR_NOMEM</span></tt></a></dt>
<dd>Out of memory.</dd>
</dl>
</dd></dl>
<dlclass="function">
<dtid="c.nghttp2_option_del">
void <ttclass="descname">nghttp2_option_del</tt><big>(</big><aclass="reference internal"href="#c.nghttp2_option"title="nghttp2_option">nghttp2_option</a><em> *option</em><big>)</big><aclass="headerlink"href="#c.nghttp2_option_del"title="Permalink to this definition">¶</a></dt>
<dd><p>Frees any resources allocated for <em>option</em>. If <em>option</em> is
<ttclass="docutils literal"><spanclass="pre">NULL</span></tt>, this function does nothing.</p>
void <ttclass="descname">nghttp2_option_set_no_auto_window_update</tt><big>(</big><aclass="reference internal"href="#c.nghttp2_option"title="nghttp2_option">nghttp2_option</a><em> *option</em>, int<em> val</em><big>)</big><aclass="headerlink"href="#c.nghttp2_option_set_no_auto_window_update"title="Permalink to this definition">¶</a></dt>
<aclass="reference internal"href="#c.nghttp2_session_consume"title="nghttp2_session_consume"><ttclass="xref c c-func docutils literal"><spanclass="pre">nghttp2_session_consume()</span></tt></a> to indicate the consumed amount of
data. Don't use <aclass="reference internal"href="#c.nghttp2_submit_window_update"title="nghttp2_submit_window_update"><ttclass="xref c c-func docutils literal"><spanclass="pre">nghttp2_submit_window_update()</span></tt></a> for this purpose.
void <ttclass="descname">nghttp2_option_set_peer_max_concurrent_streams</tt><big>(</big><aclass="reference internal"href="#c.nghttp2_option"title="nghttp2_option">nghttp2_option</a><em> *option</em>, uint32_t<em> val</em><big>)</big><aclass="headerlink"href="#c.nghttp2_option_set_peer_max_concurrent_streams"title="Permalink to this definition">¶</a></dt>
<dd><p>This option sets the SETTINGS_MAX_CONCURRENT_STREAMS value of
void <ttclass="descname">nghttp2_option_set_recv_client_preface</tt><big>(</big><aclass="reference internal"href="#c.nghttp2_option"title="nghttp2_option">nghttp2_option</a><em> *option</em>, int<em> val</em><big>)</big><aclass="headerlink"href="#c.nghttp2_option_set_recv_client_preface"title="Permalink to this definition">¶</a></dt>
<dd><p>By default, nghttp2 library only handles HTTP/2 frames and does not
recognize first 24 bytes of client connection preface. This design
choice is done due to the fact that server may want to detect the
application protocol based on first few bytes on clear text
communication. But for simple servers which only speak HTTP/2, it
is easier for developers if nghttp2 library takes care of client
connection preface.</p>
<p>If this option is used with nonzero <em>val</em>, nghttp2 library checks
first 24 bytes client connection preface. If it is not a valid
one, <aclass="reference internal"href="#c.nghttp2_session_recv"title="nghttp2_session_recv"><ttclass="xref c c-func docutils literal"><spanclass="pre">nghttp2_session_recv()</span></tt></a> and <aclass="reference internal"href="#c.nghttp2_session_mem_recv"title="nghttp2_session_mem_recv"><ttclass="xref c c-func docutils literal"><spanclass="pre">nghttp2_session_mem_recv()</span></tt></a> will
return error <aclass="reference internal"href="#c.NGHTTP2_ERR_BAD_PREFACE"title="NGHTTP2_ERR_BAD_PREFACE"><ttclass="xref c c-macro docutils literal"><spanclass="pre">NGHTTP2_ERR_BAD_PREFACE</span></tt></a>, which is fatal error.</p>
void <ttclass="descname">nghttp2_option_set_no_http_messaging</tt><big>(</big><aclass="reference internal"href="#c.nghttp2_option"title="nghttp2_option">nghttp2_option</a><em> *option</em>, int<em> val</em><big>)</big><aclass="headerlink"href="#c.nghttp2_option_set_no_http_messaging"title="Permalink to this definition">¶</a></dt>
<dd><p>By default, nghttp2 library enforces subset of HTTP Messaging rules
described in <aclass="reference external"href="https://tools.ietf.org/html/draft-ietf-httpbis-http2-17#section-8">HTTP/2 specification, section 8</a>.
See <aclass="reference internal"href="#http-messaging">HTTP Messaging</a> section for details. For those applications
who use nghttp2 library as non-HTTP use, give nonzero to <em>val</em> to
int <ttclass="descname">nghttp2_session_client_new</tt><big>(</big><aclass="reference internal"href="#c.nghttp2_session"title="nghttp2_session">nghttp2_session</a><em> **session_ptr</em>, const <aclass="reference internal"href="#c.nghttp2_session_callbacks"title="nghttp2_session_callbacks">nghttp2_session_callbacks</a><em> *callbacks</em>, void<em> *user_data</em><big>)</big><aclass="headerlink"href="#c.nghttp2_session_client_new"title="Permalink to this definition">¶</a></dt>
<p>The <aclass="reference internal"href="#c.nghttp2_send_callback"title="nghttp2_send_callback"><ttclass="xref c c-type docutils literal"><spanclass="pre">nghttp2_send_callback</span></tt></a> must be specified. If the
application code uses <aclass="reference internal"href="#c.nghttp2_session_recv"title="nghttp2_session_recv"><ttclass="xref c c-func docutils literal"><spanclass="pre">nghttp2_session_recv()</span></tt></a>, the
<aclass="reference internal"href="#c.nghttp2_recv_callback"title="nghttp2_recv_callback"><ttclass="xref c c-type docutils literal"><spanclass="pre">nghttp2_recv_callback</span></tt></a> must be specified. The other members
of <em>callbacks</em> can be <ttclass="docutils literal"><spanclass="pre">NULL</span></tt>.</p>
int <ttclass="descname">nghttp2_session_server_new</tt><big>(</big><aclass="reference internal"href="#c.nghttp2_session"title="nghttp2_session">nghttp2_session</a><em> **session_ptr</em>, const <aclass="reference internal"href="#c.nghttp2_session_callbacks"title="nghttp2_session_callbacks">nghttp2_session_callbacks</a><em> *callbacks</em>, void<em> *user_data</em><big>)</big><aclass="headerlink"href="#c.nghttp2_session_server_new"title="Permalink to this definition">¶</a></dt>
<p>The <aclass="reference internal"href="#c.nghttp2_send_callback"title="nghttp2_send_callback"><ttclass="xref c c-type docutils literal"><spanclass="pre">nghttp2_send_callback</span></tt></a> must be specified. If the
application code uses <aclass="reference internal"href="#c.nghttp2_session_recv"title="nghttp2_session_recv"><ttclass="xref c c-func docutils literal"><spanclass="pre">nghttp2_session_recv()</span></tt></a>, the
<aclass="reference internal"href="#c.nghttp2_recv_callback"title="nghttp2_recv_callback"><ttclass="xref c c-type docutils literal"><spanclass="pre">nghttp2_recv_callback</span></tt></a> must be specified. The other members
of <em>callbacks</em> can be <ttclass="docutils literal"><spanclass="pre">NULL</span></tt>.</p>
int <ttclass="descname">nghttp2_session_client_new2</tt><big>(</big><aclass="reference internal"href="#c.nghttp2_session"title="nghttp2_session">nghttp2_session</a><em> **session_ptr</em>, const <aclass="reference internal"href="#c.nghttp2_session_callbacks"title="nghttp2_session_callbacks">nghttp2_session_callbacks</a><em> *callbacks</em>, void<em> *user_data</em>, const <aclass="reference internal"href="#c.nghttp2_option"title="nghttp2_option">nghttp2_option</a><em> *option</em><big>)</big><aclass="headerlink"href="#c.nghttp2_session_client_new2"title="Permalink to this definition">¶</a></dt>
<dd><p>Like <aclass="reference internal"href="#c.nghttp2_session_client_new"title="nghttp2_session_client_new"><ttclass="xref c c-func docutils literal"><spanclass="pre">nghttp2_session_client_new()</span></tt></a>, but with additional options
int <ttclass="descname">nghttp2_session_server_new2</tt><big>(</big><aclass="reference internal"href="#c.nghttp2_session"title="nghttp2_session">nghttp2_session</a><em> **session_ptr</em>, const <aclass="reference internal"href="#c.nghttp2_session_callbacks"title="nghttp2_session_callbacks">nghttp2_session_callbacks</a><em> *callbacks</em>, void<em> *user_data</em>, const <aclass="reference internal"href="#c.nghttp2_option"title="nghttp2_option">nghttp2_option</a><em> *option</em><big>)</big><aclass="headerlink"href="#c.nghttp2_session_server_new2"title="Permalink to this definition">¶</a></dt>
<dd><p>Like <aclass="reference internal"href="#c.nghttp2_session_server_new"title="nghttp2_session_server_new"><ttclass="xref c c-func docutils literal"><spanclass="pre">nghttp2_session_server_new()</span></tt></a>, but with additional options
int <ttclass="descname">nghttp2_session_client_new3</tt><big>(</big><aclass="reference internal"href="#c.nghttp2_session"title="nghttp2_session">nghttp2_session</a><em> **session_ptr</em>, const <aclass="reference internal"href="#c.nghttp2_session_callbacks"title="nghttp2_session_callbacks">nghttp2_session_callbacks</a><em> *callbacks</em>, void<em> *user_data</em>, const <aclass="reference internal"href="#c.nghttp2_option"title="nghttp2_option">nghttp2_option</a><em> *option</em>, <aclass="reference internal"href="#c.nghttp2_mem"title="nghttp2_mem">nghttp2_mem</a><em> *mem</em><big>)</big><aclass="headerlink"href="#c.nghttp2_session_client_new3"title="Permalink to this definition">¶</a></dt>
<dd><p>Like <aclass="reference internal"href="#c.nghttp2_session_client_new2"title="nghttp2_session_client_new2"><ttclass="xref c c-func docutils literal"><spanclass="pre">nghttp2_session_client_new2()</span></tt></a>, but with additional custom
memory allocator specified in the <em>mem</em>.</p>
<p>The <em>mem</em> can be <ttclass="docutils literal"><spanclass="pre">NULL</span></tt> and the call is equivalent to
<aclass="reference internal"href="#c.nghttp2_session_client_new2"title="nghttp2_session_client_new2"><ttclass="xref c c-func docutils literal"><spanclass="pre">nghttp2_session_client_new2()</span></tt></a>.</p>
<p>This function does not take ownership <em>mem</em>. The application is
responsible for freeing <em>mem</em>.</p>
<p>The library code does not refer to <em>mem</em> pointer after this
function returns, so the application can safely free it.</p>
<p>This function returns 0 if it succeeds, or one of the following
negative error codes:</p>
<dlclass="docutils">
<dt><aclass="reference internal"href="#c.NGHTTP2_ERR_NOMEM"title="NGHTTP2_ERR_NOMEM"><ttclass="xref c c-macro docutils literal"><spanclass="pre">NGHTTP2_ERR_NOMEM</span></tt></a></dt>
<dd>Out of memory.</dd>
</dl>
</dd></dl>
<dlclass="function">
<dtid="c.nghttp2_session_server_new3">
int <ttclass="descname">nghttp2_session_server_new3</tt><big>(</big><aclass="reference internal"href="#c.nghttp2_session"title="nghttp2_session">nghttp2_session</a><em> **session_ptr</em>, const <aclass="reference internal"href="#c.nghttp2_session_callbacks"title="nghttp2_session_callbacks">nghttp2_session_callbacks</a><em> *callbacks</em>, void<em> *user_data</em>, const <aclass="reference internal"href="#c.nghttp2_option"title="nghttp2_option">nghttp2_option</a><em> *option</em>, <aclass="reference internal"href="#c.nghttp2_mem"title="nghttp2_mem">nghttp2_mem</a><em> *mem</em><big>)</big><aclass="headerlink"href="#c.nghttp2_session_server_new3"title="Permalink to this definition">¶</a></dt>
<dd><p>Like <aclass="reference internal"href="#c.nghttp2_session_server_new2"title="nghttp2_session_server_new2"><ttclass="xref c c-func docutils literal"><spanclass="pre">nghttp2_session_server_new2()</span></tt></a>, but with additional custom
memory allocator specified in the <em>mem</em>.</p>
<p>The <em>mem</em> can be <ttclass="docutils literal"><spanclass="pre">NULL</span></tt> and the call is equivalent to
<aclass="reference internal"href="#c.nghttp2_session_server_new2"title="nghttp2_session_server_new2"><ttclass="xref c c-func docutils literal"><spanclass="pre">nghttp2_session_server_new2()</span></tt></a>.</p>
<p>This function does not take ownership <em>mem</em>. The application is
responsible for freeing <em>mem</em>.</p>
<p>The library code does not refer to <em>mem</em> pointer after this
function returns, so the application can safely free it.</p>
<p>This function returns 0 if it succeeds, or one of the following
negative error codes:</p>
<dlclass="docutils">
<dt><aclass="reference internal"href="#c.NGHTTP2_ERR_NOMEM"title="NGHTTP2_ERR_NOMEM"><ttclass="xref c c-macro docutils literal"><spanclass="pre">NGHTTP2_ERR_NOMEM</span></tt></a></dt>
void <ttclass="descname">nghttp2_session_del</tt><big>(</big><aclass="reference internal"href="#c.nghttp2_session"title="nghttp2_session">nghttp2_session</a><em> *session</em><big>)</big><aclass="headerlink"href="#c.nghttp2_session_del"title="Permalink to this definition">¶</a></dt>
int <ttclass="descname">nghttp2_session_send</tt><big>(</big><aclass="reference internal"href="#c.nghttp2_session"title="nghttp2_session">nghttp2_session</a><em> *session</em><big>)</big><aclass="headerlink"href="#c.nghttp2_session_send"title="Permalink to this definition">¶</a></dt>
<aclass="reference internal"href="#c.NGHTTP2_ERR_WOULDBLOCK"title="NGHTTP2_ERR_WOULDBLOCK"><ttclass="xref c c-macro docutils literal"><spanclass="pre">NGHTTP2_ERR_WOULDBLOCK</span></tt></a> or the outbound queue becomes empty.
<aclass="reference internal"href="#c.nghttp2_on_frame_not_send_callback"title="nghttp2_on_frame_not_send_callback"><ttclass="xref c c-type docutils literal"><spanclass="pre">nghttp2_on_frame_not_send_callback</span></tt></a> is invoked. Abort
<aclass="reference internal"href="#c.nghttp2_select_padding_callback"title="nghttp2_select_padding_callback"><ttclass="xref c c-type docutils literal"><spanclass="pre">nghttp2_select_padding_callback</span></tt></a> is invoked.</li>
<li><aclass="reference internal"href="#c.nghttp2_before_frame_send_callback"title="nghttp2_before_frame_send_callback"><ttclass="xref c c-type docutils literal"><spanclass="pre">nghttp2_before_frame_send_callback</span></tt></a> is invoked.</li>
<li><aclass="reference internal"href="#c.nghttp2_send_callback"title="nghttp2_send_callback"><ttclass="xref c c-type docutils literal"><spanclass="pre">nghttp2_send_callback</span></tt></a> is invoked one or more times to
send the frame.</li>
<li><aclass="reference internal"href="#c.nghttp2_on_frame_send_callback"title="nghttp2_on_frame_send_callback"><ttclass="xref c c-type docutils literal"><spanclass="pre">nghttp2_on_frame_send_callback</span></tt></a> is invoked.</li>
<aclass="reference internal"href="#c.nghttp2_on_stream_close_callback"title="nghttp2_on_stream_close_callback"><ttclass="xref c c-type docutils literal"><spanclass="pre">nghttp2_on_stream_close_callback</span></tt></a> is invoked.</li>
ssize_t <ttclass="descname">nghttp2_session_mem_send</tt><big>(</big><aclass="reference internal"href="#c.nghttp2_session"title="nghttp2_session">nghttp2_session</a><em> *session</em>, const uint8_t<em> **data_ptr</em><big>)</big><aclass="headerlink"href="#c.nghttp2_session_mem_send"title="Permalink to this definition">¶</a></dt>
<p>This function behaves like <aclass="reference internal"href="#c.nghttp2_session_send"title="nghttp2_session_send"><ttclass="xref c c-func docutils literal"><spanclass="pre">nghttp2_session_send()</span></tt></a> except that it
does not use <aclass="reference internal"href="#c.nghttp2_send_callback"title="nghttp2_send_callback"><ttclass="xref c c-type docutils literal"><spanclass="pre">nghttp2_send_callback</span></tt></a> to transmit data.
Instead, it assigns the pointer to the serialized data to the
<em>*data_ptr</em> and returns its length. The other callbacks are called
in the same way as they are in <aclass="reference internal"href="#c.nghttp2_session_send"title="nghttp2_session_send"><ttclass="xref c c-func docutils literal"><spanclass="pre">nghttp2_session_send()</span></tt></a>.</p>
<aclass="reference internal"href="#c.nghttp2_session_mem_send"title="nghttp2_session_mem_send"><ttclass="xref c c-func docutils literal"><spanclass="pre">nghttp2_session_mem_send()</span></tt></a> or <aclass="reference internal"href="#c.nghttp2_session_send"title="nghttp2_session_send"><ttclass="xref c c-func docutils literal"><spanclass="pre">nghttp2_session_send()</span></tt></a>.</p>
int <ttclass="descname">nghttp2_session_recv</tt><big>(</big><aclass="reference internal"href="#c.nghttp2_session"title="nghttp2_session">nghttp2_session</a><em> *session</em><big>)</big><aclass="headerlink"href="#c.nghttp2_session_recv"title="Permalink to this definition">¶</a></dt>
<aclass="reference internal"href="#c.NGHTTP2_ERR_WOULDBLOCK"title="NGHTTP2_ERR_WOULDBLOCK"><ttclass="xref c c-macro docutils literal"><spanclass="pre">NGHTTP2_ERR_WOULDBLOCK</span></tt></a>. This function calls several
<li><aclass="reference internal"href="#c.nghttp2_recv_callback"title="nghttp2_recv_callback"><ttclass="xref c c-type docutils literal"><spanclass="pre">nghttp2_recv_callback</span></tt></a> is invoked one or more times to
receive frame header.</li>
<li>When frame header is received,
<aclass="reference internal"href="#c.nghttp2_on_begin_frame_callback"title="nghttp2_on_begin_frame_callback"><ttclass="xref c c-type docutils literal"><spanclass="pre">nghttp2_on_begin_frame_callback</span></tt></a> is invoked.</li>
<li><aclass="reference internal"href="#c.nghttp2_recv_callback"title="nghttp2_recv_callback"><ttclass="xref c c-type docutils literal"><spanclass="pre">nghttp2_recv_callback</span></tt></a> is invoked to receive DATA
payload. For each chunk of data,
<aclass="reference internal"href="#c.nghttp2_on_data_chunk_recv_callback"title="nghttp2_on_data_chunk_recv_callback"><ttclass="xref c c-type docutils literal"><spanclass="pre">nghttp2_on_data_chunk_recv_callback</span></tt></a> is invoked.</li>
<aclass="reference internal"href="#c.nghttp2_on_frame_recv_callback"title="nghttp2_on_frame_recv_callback"><ttclass="xref c c-type docutils literal"><spanclass="pre">nghttp2_on_frame_recv_callback</span></tt></a> is invoked. If the
reception of the frame triggers the closure of the stream,
<aclass="reference internal"href="#c.nghttp2_on_stream_close_callback"title="nghttp2_on_stream_close_callback"><ttclass="xref c c-type docutils literal"><spanclass="pre">nghttp2_on_stream_close_callback</span></tt></a> is invoked.</li>
<li><aclass="reference internal"href="#c.nghttp2_recv_callback"title="nghttp2_recv_callback"><ttclass="xref c c-type docutils literal"><spanclass="pre">nghttp2_recv_callback</span></tt></a> is invoked one or more times to
<aclass="reference internal"href="#c.nghttp2_on_begin_headers_callback"title="nghttp2_on_begin_headers_callback"><ttclass="xref c c-type docutils literal"><spanclass="pre">nghttp2_on_begin_headers_callback</span></tt></a> is invoked. Then
<aclass="reference internal"href="#c.nghttp2_on_header_callback"title="nghttp2_on_header_callback"><ttclass="xref c c-type docutils literal"><spanclass="pre">nghttp2_on_header_callback</span></tt></a> is invoked for each header
name/value pair. After all name/value pairs are emitted
successfully, <aclass="reference internal"href="#c.nghttp2_on_frame_recv_callback"title="nghttp2_on_frame_recv_callback"><ttclass="xref c c-type docutils literal"><spanclass="pre">nghttp2_on_frame_recv_callback</span></tt></a> is
<aclass="reference internal"href="#c.nghttp2_on_frame_recv_callback"title="nghttp2_on_frame_recv_callback"><ttclass="xref c c-type docutils literal"><spanclass="pre">nghttp2_on_frame_recv_callback</span></tt></a> is invoked. If the
reception of the frame triggers the closure of the stream,
<aclass="reference internal"href="#c.nghttp2_on_stream_close_callback"title="nghttp2_on_stream_close_callback"><ttclass="xref c c-type docutils literal"><spanclass="pre">nghttp2_on_stream_close_callback</span></tt></a> is invoked.</li>
invalid, <aclass="reference internal"href="#c.nghttp2_on_invalid_frame_recv_callback"title="nghttp2_on_invalid_frame_recv_callback"><ttclass="xref c c-type docutils literal"><spanclass="pre">nghttp2_on_invalid_frame_recv_callback</span></tt></a> is
<dt><aclass="reference internal"href="#c.NGHTTP2_ERR_BAD_PREFACE"title="NGHTTP2_ERR_BAD_PREFACE"><ttclass="xref c c-macro docutils literal"><spanclass="pre">NGHTTP2_ERR_BAD_PREFACE</span></tt></a></dt>
<dd>Invalid client preface was detected. This error only returns
when <em>session</em> was configured as server and
<aclass="reference internal"href="#c.nghttp2_option_set_recv_client_preface"title="nghttp2_option_set_recv_client_preface"><ttclass="xref c c-func docutils literal"><spanclass="pre">nghttp2_option_set_recv_client_preface()</span></tt></a> is used.</dd>
ssize_t <ttclass="descname">nghttp2_session_mem_recv</tt><big>(</big><aclass="reference internal"href="#c.nghttp2_session"title="nghttp2_session">nghttp2_session</a><em> *session</em>, const uint8_t<em> *in</em>, size_t<em> inlen</em><big>)</big><aclass="headerlink"href="#c.nghttp2_session_mem_recv"title="Permalink to this definition">¶</a></dt>
<p>This function behaves like <aclass="reference internal"href="#c.nghttp2_session_recv"title="nghttp2_session_recv"><ttclass="xref c c-func docutils literal"><spanclass="pre">nghttp2_session_recv()</span></tt></a> except that it
does not use <aclass="reference internal"href="#c.nghttp2_recv_callback"title="nghttp2_recv_callback"><ttclass="xref c c-type docutils literal"><spanclass="pre">nghttp2_recv_callback</span></tt></a> to receive data; the
<em>in</em> is the only data for the invocation of this function. If all
bytes are processed, this function returns. The other callbacks
are called in the same way as they are in <aclass="reference internal"href="#c.nghttp2_session_recv"title="nghttp2_session_recv"><ttclass="xref c c-func docutils literal"><spanclass="pre">nghttp2_session_recv()</span></tt></a>.</p>
<aclass="reference internal"href="#c.NGHTTP2_ERR_PAUSE"title="NGHTTP2_ERR_PAUSE"><ttclass="xref c c-macro docutils literal"><spanclass="pre">NGHTTP2_ERR_PAUSE</span></tt></a> is returned from
<aclass="reference internal"href="#c.nghttp2_on_header_callback"title="nghttp2_on_header_callback"><ttclass="xref c c-type docutils literal"><spanclass="pre">nghttp2_on_header_callback</span></tt></a> or
<aclass="reference internal"href="#c.nghttp2_on_data_chunk_recv_callback"title="nghttp2_on_data_chunk_recv_callback"><ttclass="xref c c-type docutils literal"><spanclass="pre">nghttp2_on_data_chunk_recv_callback</span></tt></a>. If
<aclass="reference internal"href="#c.NGHTTP2_ERR_PAUSE"title="NGHTTP2_ERR_PAUSE"><ttclass="xref c c-macro docutils literal"><spanclass="pre">NGHTTP2_ERR_PAUSE</span></tt></a> is used, the return value includes the
<dt><aclass="reference internal"href="#c.NGHTTP2_ERR_BAD_PREFACE"title="NGHTTP2_ERR_BAD_PREFACE"><ttclass="xref c c-macro docutils literal"><spanclass="pre">NGHTTP2_ERR_BAD_PREFACE</span></tt></a></dt>
<dd>Invalid client preface was detected. This error only returns
when <em>session</em> was configured as server and
<aclass="reference internal"href="#c.nghttp2_option_set_recv_client_preface"title="nghttp2_option_set_recv_client_preface"><ttclass="xref c c-func docutils literal"><spanclass="pre">nghttp2_option_set_recv_client_preface()</span></tt></a> is used.</dd>
int <ttclass="descname">nghttp2_session_resume_data</tt><big>(</big><aclass="reference internal"href="#c.nghttp2_session"title="nghttp2_session">nghttp2_session</a><em> *session</em>, int32_t<em> stream_id</em><big>)</big><aclass="headerlink"href="#c.nghttp2_session_resume_data"title="Permalink to this definition">¶</a></dt>
int <ttclass="descname">nghttp2_session_want_read</tt><big>(</big><aclass="reference internal"href="#c.nghttp2_session"title="nghttp2_session">nghttp2_session</a><em> *session</em><big>)</big><aclass="headerlink"href="#c.nghttp2_session_want_read"title="Permalink to this definition">¶</a></dt>
<p>If both <aclass="reference internal"href="#c.nghttp2_session_want_read"title="nghttp2_session_want_read"><ttclass="xref c c-func docutils literal"><spanclass="pre">nghttp2_session_want_read()</span></tt></a> and
<aclass="reference internal"href="#c.nghttp2_session_want_write"title="nghttp2_session_want_write"><ttclass="xref c c-func docutils literal"><spanclass="pre">nghttp2_session_want_write()</span></tt></a> return 0, the application should
int <ttclass="descname">nghttp2_session_want_write</tt><big>(</big><aclass="reference internal"href="#c.nghttp2_session"title="nghttp2_session">nghttp2_session</a><em> *session</em><big>)</big><aclass="headerlink"href="#c.nghttp2_session_want_write"title="Permalink to this definition">¶</a></dt>
<p>If both <aclass="reference internal"href="#c.nghttp2_session_want_read"title="nghttp2_session_want_read"><ttclass="xref c c-func docutils literal"><spanclass="pre">nghttp2_session_want_read()</span></tt></a> and
<aclass="reference internal"href="#c.nghttp2_session_want_write"title="nghttp2_session_want_write"><ttclass="xref c c-func docutils literal"><spanclass="pre">nghttp2_session_want_write()</span></tt></a> return 0, the application should
void *<ttclass="descname">nghttp2_session_get_stream_user_data</tt><big>(</big><aclass="reference internal"href="#c.nghttp2_session"title="nghttp2_session">nghttp2_session</a><em> *session</em>, int32_t<em> stream_id</em><big>)</big><aclass="headerlink"href="#c.nghttp2_session_get_stream_user_data"title="Permalink to this definition">¶</a></dt>
stream_user_data is provided by <aclass="reference internal"href="#c.nghttp2_submit_request"title="nghttp2_submit_request"><ttclass="xref c c-func docutils literal"><spanclass="pre">nghttp2_submit_request()</span></tt></a>,
<aclass="reference internal"href="#c.nghttp2_submit_headers"title="nghttp2_submit_headers"><ttclass="xref c c-func docutils literal"><spanclass="pre">nghttp2_submit_headers()</span></tt></a> or
<aclass="reference internal"href="#c.nghttp2_session_set_stream_user_data"title="nghttp2_session_set_stream_user_data"><ttclass="xref c c-func docutils literal"><spanclass="pre">nghttp2_session_set_stream_user_data()</span></tt></a>. Unless it is set using
<aclass="reference internal"href="#c.nghttp2_session_set_stream_user_data"title="nghttp2_session_set_stream_user_data"><ttclass="xref c c-func docutils literal"><spanclass="pre">nghttp2_session_set_stream_user_data()</span></tt></a>, if the stream is
int <ttclass="descname">nghttp2_session_set_stream_user_data</tt><big>(</big><aclass="reference internal"href="#c.nghttp2_session"title="nghttp2_session">nghttp2_session</a><em> *session</em>, int32_t<em> stream_id</em>, void<em> *stream_user_data</em><big>)</big><aclass="headerlink"href="#c.nghttp2_session_set_stream_user_data"title="Permalink to this definition">¶</a></dt>
size_t <ttclass="descname">nghttp2_session_get_outbound_queue_size</tt><big>(</big><aclass="reference internal"href="#c.nghttp2_session"title="nghttp2_session">nghttp2_session</a><em> *session</em><big>)</big><aclass="headerlink"href="#c.nghttp2_session_get_outbound_queue_size"title="Permalink to this definition">¶</a></dt>
int32_t <ttclass="descname">nghttp2_session_get_stream_effective_recv_data_length</tt><big>(</big><aclass="reference internal"href="#c.nghttp2_session"title="nghttp2_session">nghttp2_session</a><em> *session</em>, int32_t<em> stream_id</em><big>)</big><aclass="headerlink"href="#c.nghttp2_session_get_stream_effective_recv_data_length"title="Permalink to this definition">¶</a></dt>
<aclass="reference internal"href="#c.nghttp2_submit_window_update"title="nghttp2_submit_window_update"><ttclass="xref c c-func docutils literal"><spanclass="pre">nghttp2_submit_window_update()</span></tt></a>. This function takes into account
that and returns effective data length. In particular, if the
window_size_increment with <aclass="reference internal"href="#c.nghttp2_submit_window_update"title="nghttp2_submit_window_update"><ttclass="xref c c-func docutils literal"><spanclass="pre">nghttp2_submit_window_update()</span></tt></a>, this
int32_t <ttclass="descname">nghttp2_session_get_stream_effective_local_window_size</tt><big>(</big><aclass="reference internal"href="#c.nghttp2_session"title="nghttp2_session">nghttp2_session</a><em> *session</em>, int32_t<em> stream_id</em><big>)</big><aclass="headerlink"href="#c.nghttp2_session_get_stream_effective_local_window_size"title="Permalink to this definition">¶</a></dt>
<dd><p>Returns the local (receive) window size for the stream <em>stream_id</em>.
The local window size can be adjusted by
<aclass="reference internal"href="#c.nghttp2_submit_window_update"title="nghttp2_submit_window_update"><ttclass="xref c c-func docutils literal"><spanclass="pre">nghttp2_submit_window_update()</span></tt></a>. This function takes into account
int32_t <ttclass="descname">nghttp2_session_get_effective_recv_data_length</tt><big>(</big><aclass="reference internal"href="#c.nghttp2_session"title="nghttp2_session">nghttp2_session</a><em> *session</em><big>)</big><aclass="headerlink"href="#c.nghttp2_session_get_effective_recv_data_length"title="Permalink to this definition">¶</a></dt>
WINDOW_UPDATE transmission for a connection. The local (receive)
window size can be adjusted by <aclass="reference internal"href="#c.nghttp2_submit_window_update"title="nghttp2_submit_window_update"><ttclass="xref c c-func docutils literal"><spanclass="pre">nghttp2_submit_window_update()</span></tt></a>.
This function takes into account that and returns effective data
length. In particular, if the local window size is reduced by
submitting negative window_size_increment with
<aclass="reference internal"href="#c.nghttp2_submit_window_update"title="nghttp2_submit_window_update"><ttclass="xref c c-func docutils literal"><spanclass="pre">nghttp2_submit_window_update()</span></tt></a>, this function returns the number
int32_t <ttclass="descname">nghttp2_session_get_effective_local_window_size</tt><big>(</big><aclass="reference internal"href="#c.nghttp2_session"title="nghttp2_session">nghttp2_session</a><em> *session</em><big>)</big><aclass="headerlink"href="#c.nghttp2_session_get_effective_local_window_size"title="Permalink to this definition">¶</a></dt>
<dd><p>Returns the local (receive) window size for a connection. The
local window size can be adjusted by
<aclass="reference internal"href="#c.nghttp2_submit_window_update"title="nghttp2_submit_window_update"><ttclass="xref c c-func docutils literal"><spanclass="pre">nghttp2_submit_window_update()</span></tt></a>. This function takes into account
int32_t <ttclass="descname">nghttp2_session_get_stream_remote_window_size</tt><big>(</big><aclass="reference internal"href="#c.nghttp2_session"title="nghttp2_session">nghttp2_session</a><em> *session</em>, int32_t<em> stream_id</em><big>)</big><aclass="headerlink"href="#c.nghttp2_session_get_stream_remote_window_size"title="Permalink to this definition">¶</a></dt>
int32_t <ttclass="descname">nghttp2_session_get_remote_window_size</tt><big>(</big><aclass="reference internal"href="#c.nghttp2_session"title="nghttp2_session">nghttp2_session</a><em> *session</em><big>)</big><aclass="headerlink"href="#c.nghttp2_session_get_remote_window_size"title="Permalink to this definition">¶</a></dt>
int <ttclass="descname">nghttp2_session_get_stream_local_close</tt><big>(</big><aclass="reference internal"href="#c.nghttp2_session"title="nghttp2_session">nghttp2_session</a><em> *session</em>, int32_t<em> stream_id</em><big>)</big><aclass="headerlink"href="#c.nghttp2_session_get_stream_local_close"title="Permalink to this definition">¶</a></dt>
int <ttclass="descname">nghttp2_session_get_stream_remote_close</tt><big>(</big><aclass="reference internal"href="#c.nghttp2_session"title="nghttp2_session">nghttp2_session</a><em> *session</em>, int32_t<em> stream_id</em><big>)</big><aclass="headerlink"href="#c.nghttp2_session_get_stream_remote_close"title="Permalink to this definition">¶</a></dt>
int <ttclass="descname">nghttp2_session_terminate_session</tt><big>(</big><aclass="reference internal"href="#c.nghttp2_session"title="nghttp2_session">nghttp2_session</a><em> *session</em>, uint32_t<em> error_code</em><big>)</big><aclass="headerlink"href="#c.nghttp2_session_terminate_session"title="Permalink to this definition">¶</a></dt>
<p>The last stream ID is the minimum value between the stream ID of a
stream for which <aclass="reference internal"href="#c.nghttp2_on_frame_recv_callback"title="nghttp2_on_frame_recv_callback"><ttclass="xref c c-type docutils literal"><spanclass="pre">nghttp2_on_frame_recv_callback</span></tt></a> was called
most recently and the last stream ID we have sent to the peer
<p>The <em>error_code</em> is the error code of this GOAWAY frame. The
pre-defined error code is one of <aclass="reference internal"href="#c.nghttp2_error_code"title="nghttp2_error_code"><ttclass="xref c c-macro docutils literal"><spanclass="pre">nghttp2_error_code</span></tt></a>.</p>
<p>After the transmission, both <aclass="reference internal"href="#c.nghttp2_session_want_read"title="nghttp2_session_want_read"><ttclass="xref c c-func docutils literal"><spanclass="pre">nghttp2_session_want_read()</span></tt></a> and
<aclass="reference internal"href="#c.nghttp2_session_want_write"title="nghttp2_session_want_write"><ttclass="xref c c-func docutils literal"><spanclass="pre">nghttp2_session_want_write()</span></tt></a> return 0.</p>
terminated after sending GOAWAY. If the remaining streams should
be processed after GOAWAY, use <aclass="reference internal"href="#c.nghttp2_submit_goaway"title="nghttp2_submit_goaway"><ttclass="xref c c-func docutils literal"><spanclass="pre">nghttp2_submit_goaway()</span></tt></a> instead.</p>
int <ttclass="descname">nghttp2_session_terminate_session2</tt><big>(</big><aclass="reference internal"href="#c.nghttp2_session"title="nghttp2_session">nghttp2_session</a><em> *session</em>, int32_t<em> last_stream_id</em>, uint32_t<em> error_code</em><big>)</big><aclass="headerlink"href="#c.nghttp2_session_terminate_session2"title="Permalink to this definition">¶</a></dt>
<dd><p>Signals the session so that the connection should be terminated.</p>
<p>This function behaves like <aclass="reference internal"href="#c.nghttp2_session_terminate_session"title="nghttp2_session_terminate_session"><ttclass="xref c c-func docutils literal"><spanclass="pre">nghttp2_session_terminate_session()</span></tt></a>,
but the last stream ID can be specified by the application for fine
grained control of stream. The HTTP/2 specification does not allow
last_stream_id to be increased. So the actual value sent as
last_stream_id is the minimum value between the given
<em>last_stream_id</em> and the last_stream_id we have previously sent to
the peer.</p>
<p>The <em>last_stream_id</em> is peer's stream ID or 0. So if <em>session</em> is
initialized as client, <em>last_stream_id</em> must be even or 0. If
<em>session</em> is initialized as server, <em>last_stream_id</em> must be odd or
0.</p>
<p>This function returns 0 if it succeeds, or one of the following
negative error codes:</p>
<dlclass="docutils">
<dt><aclass="reference internal"href="#c.NGHTTP2_ERR_NOMEM"title="NGHTTP2_ERR_NOMEM"><ttclass="xref c c-macro docutils literal"><spanclass="pre">NGHTTP2_ERR_NOMEM</span></tt></a></dt>
<dd>Out of memory.</dd>
<dt><aclass="reference internal"href="#c.NGHTTP2_ERR_INVALID_ARGUMENT"title="NGHTTP2_ERR_INVALID_ARGUMENT"><ttclass="xref c c-macro docutils literal"><spanclass="pre">NGHTTP2_ERR_INVALID_ARGUMENT</span></tt></a></dt>
<dd>The <em>last_stream_id</em> is invalid.</dd>
</dl>
</dd></dl>
<dlclass="function">
<dtid="c.nghttp2_submit_shutdown_notice">
int <ttclass="descname">nghttp2_submit_shutdown_notice</tt><big>(</big><aclass="reference internal"href="#c.nghttp2_session"title="nghttp2_session">nghttp2_session</a><em> *session</em><big>)</big><aclass="headerlink"href="#c.nghttp2_submit_shutdown_notice"title="Permalink to this definition">¶</a></dt>
<dd><p>Signals to the client that the server started graceful shutdown
procedure.</p>
<p>This function is only usable for server. If this function is
called with client side session, this function returns
<aclass="reference internal"href="#c.NGHTTP2_ERR_INVALID_STATE"title="NGHTTP2_ERR_INVALID_STATE"><ttclass="xref c c-macro docutils literal"><spanclass="pre">NGHTTP2_ERR_INVALID_STATE</span></tt></a>.</p>
<p>To gracefully shutdown HTTP/2 session, server should call this
function to send GOAWAY with last_stream_id (1u << 31) - 1. And
after some delay (e.g., 1 RTT), send another GOAWAY with the stream
ID that the server has some processing using
<aclass="reference internal"href="#c.nghttp2_submit_goaway"title="nghttp2_submit_goaway"><ttclass="xref c c-func docutils literal"><spanclass="pre">nghttp2_submit_goaway()</span></tt></a>. See also
<aclass="reference internal"href="#c.nghttp2_session_get_last_proc_stream_id"title="nghttp2_session_get_last_proc_stream_id"><ttclass="xref c c-func docutils literal"><spanclass="pre">nghttp2_session_get_last_proc_stream_id()</span></tt></a>.</p>
<p>Unlike <aclass="reference internal"href="#c.nghttp2_submit_goaway"title="nghttp2_submit_goaway"><ttclass="xref c c-func docutils literal"><spanclass="pre">nghttp2_submit_goaway()</span></tt></a>, this function just sends GOAWAY
and does nothing more. This is a mere indication to the client
that session shutdown is imminent. The application should call
<aclass="reference internal"href="#c.nghttp2_submit_goaway"title="nghttp2_submit_goaway"><ttclass="xref c c-func docutils literal"><spanclass="pre">nghttp2_submit_goaway()</span></tt></a> with appropriate last_stream_id after
this call.</p>
<p>If one or more GOAWAY frame have been already sent by either
<aclass="reference internal"href="#c.nghttp2_submit_goaway"title="nghttp2_submit_goaway"><ttclass="xref c c-func docutils literal"><spanclass="pre">nghttp2_submit_goaway()</span></tt></a> or <aclass="reference internal"href="#c.nghttp2_session_terminate_session"title="nghttp2_session_terminate_session"><ttclass="xref c c-func docutils literal"><spanclass="pre">nghttp2_session_terminate_session()</span></tt></a>,
uint32_t <ttclass="descname">nghttp2_session_get_remote_settings</tt><big>(</big><aclass="reference internal"href="#c.nghttp2_session"title="nghttp2_session">nghttp2_session</a><em> *session</em>, <aclass="reference internal"href="#c.nghttp2_settings_id"title="nghttp2_settings_id">nghttp2_settings_id</a><em> id</em><big>)</big><aclass="headerlink"href="#c.nghttp2_session_get_remote_settings"title="Permalink to this definition">¶</a></dt>
int <ttclass="descname">nghttp2_session_set_next_stream_id</tt><big>(</big><aclass="reference internal"href="#c.nghttp2_session"title="nghttp2_session">nghttp2_session</a><em> *session</em>, int32_t<em> next_stream_id</em><big>)</big><aclass="headerlink"href="#c.nghttp2_session_set_next_stream_id"title="Permalink to this definition">¶</a></dt>
<dd><p>Tells the <em>session</em> that next stream ID is <em>next_stream_id</em>. The
<em>next_stream_id</em> must be equal or greater than the value returned
by <aclass="reference internal"href="#c.nghttp2_session_get_next_stream_id"title="nghttp2_session_get_next_stream_id"><ttclass="xref c c-func docutils literal"><spanclass="pre">nghttp2_session_get_next_stream_id()</span></tt></a>.</p>
<p>This function returns 0 if it succeeds, or one of the following
negative error codes:</p>
<dlclass="docutils">
<dt><aclass="reference internal"href="#c.NGHTTP2_ERR_INVALID_ARGUMENT"title="NGHTTP2_ERR_INVALID_ARGUMENT"><ttclass="xref c c-macro docutils literal"><spanclass="pre">NGHTTP2_ERR_INVALID_ARGUMENT</span></tt></a></dt>
<dd>The <em>next_stream_id</em> is strictly less than the value
<aclass="reference internal"href="#c.nghttp2_session_get_next_stream_id"title="nghttp2_session_get_next_stream_id"><ttclass="xref c c-func docutils literal"><spanclass="pre">nghttp2_session_get_next_stream_id()</span></tt></a> returns.</dd>
</dl>
</dd></dl>
<dlclass="function">
<dtid="c.nghttp2_session_get_next_stream_id">
uint32_t <ttclass="descname">nghttp2_session_get_next_stream_id</tt><big>(</big><aclass="reference internal"href="#c.nghttp2_session"title="nghttp2_session">nghttp2_session</a><em> *session</em><big>)</big><aclass="headerlink"href="#c.nghttp2_session_get_next_stream_id"title="Permalink to this definition">¶</a></dt>
<dd><p>Returns the next outgoing stream ID. Notice that return type is
uint32_t. If we run out of stream ID for this session, this
int <ttclass="descname">nghttp2_session_consume</tt><big>(</big><aclass="reference internal"href="#c.nghttp2_session"title="nghttp2_session">nghttp2_session</a><em> *session</em>, int32_t<em> stream_id</em>, size_t<em> size</em><big>)</big><aclass="headerlink"href="#c.nghttp2_session_consume"title="Permalink to this definition">¶</a></dt>
<dd><p>Tells the <em>session</em> that <em>size</em> bytes for a stream denoted by
<em>stream_id</em> were consumed by application and are ready to
WINDOW_UPDATE. This function is intended to be used without
automatic window update (see
<aclass="reference internal"href="#c.nghttp2_option_set_no_auto_window_update"title="nghttp2_option_set_no_auto_window_update"><ttclass="xref c c-func docutils literal"><spanclass="pre">nghttp2_option_set_no_auto_window_update()</span></tt></a>).</p>
<p>This function returns 0 if it succeeds, or one of the following
negative error codes:</p>
<dlclass="docutils">
<dt><aclass="reference internal"href="#c.NGHTTP2_ERR_NOMEM"title="NGHTTP2_ERR_NOMEM"><ttclass="xref c c-macro docutils literal"><spanclass="pre">NGHTTP2_ERR_NOMEM</span></tt></a></dt>
<dd>Out of memory.</dd>
<dt><aclass="reference internal"href="#c.NGHTTP2_ERR_INVALID_ARGUMENT"title="NGHTTP2_ERR_INVALID_ARGUMENT"><ttclass="xref c c-macro docutils literal"><spanclass="pre">NGHTTP2_ERR_INVALID_ARGUMENT</span></tt></a></dt>
<dd>The <em>stream_id</em> is 0.</dd>
<dt><aclass="reference internal"href="#c.NGHTTP2_ERR_INVALID_STATE"title="NGHTTP2_ERR_INVALID_STATE"><ttclass="xref c c-macro docutils literal"><spanclass="pre">NGHTTP2_ERR_INVALID_STATE</span></tt></a></dt>
int <ttclass="descname">nghttp2_session_upgrade</tt><big>(</big><aclass="reference internal"href="#c.nghttp2_session"title="nghttp2_session">nghttp2_session</a><em> *session</em>, const uint8_t<em> *settings_payload</em>, size_t<em> settings_payloadlen</em>, void<em> *stream_user_data</em><big>)</big><aclass="headerlink"href="#c.nghttp2_session_upgrade"title="Permalink to this definition">¶</a></dt>
by base64url decoder. The <em>settings_payloadlen</em> is the length of
<em>settings_payload</em>. The <em>settings_payload</em> is unpacked and its
setting values will be submitted using <aclass="reference internal"href="#c.nghttp2_submit_settings"title="nghttp2_submit_settings"><ttclass="xref c c-func docutils literal"><spanclass="pre">nghttp2_submit_settings()</span></tt></a>.
This means that the client application code does not need to submit
SETTINGS by itself. The stream with stream ID=1 is opened and the
<em>stream_user_data</em> is used for its stream_user_data. The opened
ssize_t <ttclass="descname">nghttp2_pack_settings_payload</tt><big>(</big>uint8_t<em> *buf</em>, size_t<em> buflen</em>, const <aclass="reference internal"href="#c.nghttp2_settings_entry"title="nghttp2_settings_entry">nghttp2_settings_entry</a><em> *iv</em>, size_t<em> niv</em><big>)</big><aclass="headerlink"href="#c.nghttp2_pack_settings_payload"title="Permalink to this definition">¶</a></dt>
const char *<ttclass="descname">nghttp2_strerror</tt><big>(</big>int<em> lib_error_code</em><big>)</big><aclass="headerlink"href="#c.nghttp2_strerror"title="Permalink to this definition">¶</a></dt>
<em>lib_error_code</em> must be one of the <aclass="reference internal"href="#c.nghttp2_error"title="nghttp2_error"><ttclass="xref c c-macro docutils literal"><spanclass="pre">nghttp2_error</span></tt></a>.</p>
void <ttclass="descname">nghttp2_priority_spec_init</tt><big>(</big><aclass="reference internal"href="#c.nghttp2_priority_spec"title="nghttp2_priority_spec">nghttp2_priority_spec</a><em> *pri_spec</em>, int32_t<em> stream_id</em>, int32_t<em> weight</em>, int<em> exclusive</em><big>)</big><aclass="headerlink"href="#c.nghttp2_priority_spec_init"title="Permalink to this definition">¶</a></dt>
<dd><p>Initializes <em>pri_spec</em> with the <em>stream_id</em> of the stream to depend
on with <em>weight</em> and its exclusive flag. If <em>exclusive</em> is
<p>The <em>weight</em> must be in [<aclass="reference internal"href="#c.NGHTTP2_MIN_WEIGHT"title="NGHTTP2_MIN_WEIGHT"><ttclass="xref c c-macro docutils literal"><spanclass="pre">NGHTTP2_MIN_WEIGHT</span></tt></a>,
void <ttclass="descname">nghttp2_priority_spec_default_init</tt><big>(</big><aclass="reference internal"href="#c.nghttp2_priority_spec"title="nghttp2_priority_spec">nghttp2_priority_spec</a><em> *pri_spec</em><big>)</big><aclass="headerlink"href="#c.nghttp2_priority_spec_default_init"title="Permalink to this definition">¶</a></dt>
<dd><p>Initializes <em>pri_spec</em> with the default values. The default values
are: stream_id = 0, weight = <aclass="reference internal"href="#c.NGHTTP2_DEFAULT_WEIGHT"title="NGHTTP2_DEFAULT_WEIGHT"><ttclass="xref c c-macro docutils literal"><spanclass="pre">NGHTTP2_DEFAULT_WEIGHT</span></tt></a> and
exclusive = 0.</p>
</dd></dl>
<dlclass="function">
<dtid="c.nghttp2_priority_spec_check_default">
int <ttclass="descname">nghttp2_priority_spec_check_default</tt><big>(</big>const <aclass="reference internal"href="#c.nghttp2_priority_spec"title="nghttp2_priority_spec">nghttp2_priority_spec</a><em> *pri_spec</em><big>)</big><aclass="headerlink"href="#c.nghttp2_priority_spec_check_default"title="Permalink to this definition">¶</a></dt>
<dd><p>Returns nonzero if the <em>pri_spec</em> is filled with default values.</p>
<aclass="reference internal"href="#c.nghttp2_priority_spec_default_init"title="nghttp2_priority_spec_default_init"><ttclass="xref c c-func docutils literal"><spanclass="pre">nghttp2_priority_spec_default_init()</span></tt></a>). To specify the priority,
use <aclass="reference internal"href="#c.nghttp2_priority_spec_init"title="nghttp2_priority_spec_init"><ttclass="xref c c-func docutils literal"><spanclass="pre">nghttp2_priority_spec_init()</span></tt></a>. If <em>pri_spec</em> is not <ttclass="docutils literal"><spanclass="pre">NULL</span></tt>,
<p>The <ttclass="xref c c-func docutils literal"><spanclass="pre">pri_spec->weight()</span></tt> must be in [<aclass="reference internal"href="#c.NGHTTP2_MIN_WEIGHT"title="NGHTTP2_MIN_WEIGHT"><ttclass="xref c c-macro docutils literal"><spanclass="pre">NGHTTP2_MIN_WEIGHT</span></tt></a>,
<aclass="reference internal"href="#c.NGHTTP2_MAX_WEIGHT"title="NGHTTP2_MAX_WEIGHT"><ttclass="xref c c-macro docutils literal"><spanclass="pre">NGHTTP2_MAX_WEIGHT</span></tt></a>], inclusive. If <ttclass="xref c c-func docutils literal"><spanclass="pre">pri_spec->weight()</span></tt> is
strictly less than <aclass="reference internal"href="#c.NGHTTP2_MIN_WEIGHT"title="NGHTTP2_MIN_WEIGHT"><ttclass="xref c c-macro docutils literal"><spanclass="pre">NGHTTP2_MIN_WEIGHT</span></tt></a>, it becomes
<aclass="reference internal"href="#c.NGHTTP2_MIN_WEIGHT"title="NGHTTP2_MIN_WEIGHT"><ttclass="xref c c-macro docutils literal"><spanclass="pre">NGHTTP2_MIN_WEIGHT</span></tt></a>. If it is strictly greater than
<aclass="reference internal"href="#c.NGHTTP2_MAX_WEIGHT"title="NGHTTP2_MAX_WEIGHT"><ttclass="xref c c-macro docutils literal"><spanclass="pre">NGHTTP2_MAX_WEIGHT</span></tt></a>, it becomes <aclass="reference internal"href="#c.NGHTTP2_MAX_WEIGHT"title="NGHTTP2_MAX_WEIGHT"><ttclass="xref c c-macro docutils literal"><spanclass="pre">NGHTTP2_MAX_WEIGHT</span></tt></a>.</p>
<p>The <em>nva</em> is an array of name/value pair <aclass="reference internal"href="#c.nghttp2_nv"title="nghttp2_nv"><ttclass="xref c c-type docutils literal"><spanclass="pre">nghttp2_nv</span></tt></a> with
(<aclass="reference external"href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html#sec9">http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html#sec9</a>) must
be specified with <ttclass="docutils literal"><spanclass="pre">:method</span></tt> key in <em>nva</em> (e.g. <ttclass="docutils literal"><spanclass="pre">POST</span></tt>). This
function does not take ownership of the <em>data_prd</em>. The function
copies the members of the <em>data_prd</em>. If <em>data_prd</em> is <ttclass="docutils literal"><spanclass="pre">NULL</span></tt>,
HEADERS have END_STREAM set. The <em>stream_user_data</em> is data
<aclass="reference internal"href="#c.nghttp2_before_frame_send_callback"title="nghttp2_before_frame_send_callback"><ttclass="xref c c-type docutils literal"><spanclass="pre">nghttp2_before_frame_send_callback</span></tt></a> is called for this
int <ttclass="descname">nghttp2_submit_response</tt><big>(</big><aclass="reference internal"href="#c.nghttp2_session"title="nghttp2_session">nghttp2_session</a><em> *session</em>, int32_t<em> stream_id</em>, const <aclass="reference internal"href="#c.nghttp2_nv"title="nghttp2_nv">nghttp2_nv</a><em> *nva</em>, size_t<em> nvlen</em>, const <aclass="reference internal"href="#c.nghttp2_data_provider"title="nghttp2_data_provider">nghttp2_data_provider</a><em> *data_prd</em><big>)</big><aclass="headerlink"href="#c.nghttp2_submit_response"title="Permalink to this definition">¶</a></dt>
<p>The <em>nva</em> is an array of name/value pair <aclass="reference internal"href="#c.nghttp2_nv"title="nghttp2_nv"><ttclass="xref c c-type docutils literal"><spanclass="pre">nghttp2_nv</span></tt></a> with
<p>This method can be used as normal HTTP response and push response.
When pushing a resource using this function, the <em>session</em> must be
configured using <aclass="reference internal"href="#c.nghttp2_session_server_new"title="nghttp2_session_server_new"><ttclass="xref c c-func docutils literal"><spanclass="pre">nghttp2_session_server_new()</span></tt></a> or its variants and
the target stream denoted by the <em>stream_id</em> must be reserved using
<aclass="reference internal"href="#c.nghttp2_submit_push_promise"title="nghttp2_submit_push_promise"><ttclass="xref c c-func docutils literal"><spanclass="pre">nghttp2_submit_push_promise()</span></tt></a>.</p>
use this function because this function half-closes the outbound
stream. Instead, use <aclass="reference internal"href="#c.nghttp2_submit_headers"title="nghttp2_submit_headers"><ttclass="xref c c-func docutils literal"><spanclass="pre">nghttp2_submit_headers()</span></tt></a> for this purpose.</p>
int <ttclass="descname">nghttp2_submit_trailer</tt><big>(</big><aclass="reference internal"href="#c.nghttp2_session"title="nghttp2_session">nghttp2_session</a><em> *session</em>, int32_t<em> stream_id</em>, const <aclass="reference internal"href="#c.nghttp2_nv"title="nghttp2_nv">nghttp2_nv</a><em> *nva</em>, size_t<em> nvlen</em><big>)</big><aclass="headerlink"href="#c.nghttp2_submit_trailer"title="Permalink to this definition">¶</a></dt>
<dd><p>Submits trailer HEADERS against the stream <em>stream_id</em>.</p>
<p>The <em>nva</em> is an array of name/value pair <aclass="reference internal"href="#c.nghttp2_nv"title="nghttp2_nv"><ttclass="xref c c-type docutils literal"><spanclass="pre">nghttp2_nv</span></tt></a> with
<em>nvlen</em> elements. The application is responsible not to include
required pseudo-header fields (header field whose name starts with
":") in <em>nva</em>.</p>
<p>This function creates copies of all name/value pairs in <em>nva</em>. It
also lower-cases all names in <em>nva</em>. The order of elements in
<em>nva</em> is preserved.</p>
<p>For server, trailer must be followed by response HEADERS or
response DATA. The library does not check that response HEADERS
has already sent and if <aclass="reference internal"href="#c.nghttp2_submit_trailer"title="nghttp2_submit_trailer"><ttclass="xref c c-func docutils literal"><spanclass="pre">nghttp2_submit_trailer()</span></tt></a> is called before
any response HEADERS submission (usually by
<aclass="reference internal"href="#c.nghttp2_submit_response"title="nghttp2_submit_response"><ttclass="xref c c-func docutils literal"><spanclass="pre">nghttp2_submit_response()</span></tt></a>), the content of <em>nva</em> will be sent as
reponse headers, which will result in error.</p>
<p>This function has the same effect with <aclass="reference internal"href="#c.nghttp2_submit_headers"title="nghttp2_submit_headers"><ttclass="xref c c-func docutils literal"><spanclass="pre">nghttp2_submit_headers()</span></tt></a>,
with flags = <aclass="reference internal"href="#c.NGHTTP2_FLAG_END_HEADERS"title="NGHTTP2_FLAG_END_HEADERS"><ttclass="xref c c-macro docutils literal"><spanclass="pre">NGHTTP2_FLAG_END_HEADERS</span></tt></a> and both pri_spec and
stream_user_data to NULL.</p>
<p>To submit trailer after <aclass="reference internal"href="#c.nghttp2_submit_response"title="nghttp2_submit_response"><ttclass="xref c c-func docutils literal"><spanclass="pre">nghttp2_submit_response()</span></tt></a> is called, the
application has to specify <aclass="reference internal"href="#c.nghttp2_data_provider"title="nghttp2_data_provider"><ttclass="xref c c-type docutils literal"><spanclass="pre">nghttp2_data_provider</span></tt></a> to
<aclass="reference internal"href="#c.nghttp2_submit_response"title="nghttp2_submit_response"><ttclass="xref c c-func docutils literal"><spanclass="pre">nghttp2_submit_response()</span></tt></a>. In side
<aclass="reference internal"href="#c.nghttp2_data_source_read_callback"title="nghttp2_data_source_read_callback"><ttclass="xref c c-type docutils literal"><spanclass="pre">nghttp2_data_source_read_callback</span></tt></a>, when setting
<aclass="reference internal"href="#c.NGHTTP2_DATA_FLAG_EOF"title="NGHTTP2_DATA_FLAG_EOF"><ttclass="xref c c-macro docutils literal"><spanclass="pre">NGHTTP2_DATA_FLAG_EOF</span></tt></a>, also set
<aclass="reference internal"href="#c.NGHTTP2_DATA_FLAG_NO_END_STREAM"title="NGHTTP2_DATA_FLAG_NO_END_STREAM"><ttclass="xref c c-macro docutils literal"><spanclass="pre">NGHTTP2_DATA_FLAG_NO_END_STREAM</span></tt></a>. After that, the
application can send trailer using <aclass="reference internal"href="#c.nghttp2_submit_trailer"title="nghttp2_submit_trailer"><ttclass="xref c c-func docutils literal"><spanclass="pre">nghttp2_submit_trailer()</span></tt></a>.
<aclass="reference internal"href="#c.nghttp2_submit_trailer"title="nghttp2_submit_trailer"><ttclass="xref c c-func docutils literal"><spanclass="pre">nghttp2_submit_trailer()</span></tt></a> can be used inside
<aclass="reference internal"href="#c.nghttp2_data_source_read_callback"title="nghttp2_data_source_read_callback"><ttclass="xref c c-type docutils literal"><spanclass="pre">nghttp2_data_source_read_callback</span></tt></a>.</p>
<p>This function returns 0 if it succeeds and <em>stream_id</em> is -1.
Otherwise, this function returns 0 if it succeeds, or one of the
following negative error codes:</p>
<dlclass="docutils">
<dt><aclass="reference internal"href="#c.NGHTTP2_ERR_NOMEM"title="NGHTTP2_ERR_NOMEM"><ttclass="xref c c-macro docutils literal"><spanclass="pre">NGHTTP2_ERR_NOMEM</span></tt></a></dt>
<dd>Out of memory.</dd>
<dt><aclass="reference internal"href="#c.NGHTTP2_ERR_INVALID_ARGUMENT"title="NGHTTP2_ERR_INVALID_ARGUMENT"><ttclass="xref c c-macro docutils literal"><spanclass="pre">NGHTTP2_ERR_INVALID_ARGUMENT</span></tt></a></dt>
<p>If <em>flags</em> includes <aclass="reference internal"href="#c.NGHTTP2_FLAG_END_STREAM"title="NGHTTP2_FLAG_END_STREAM"><ttclass="xref c c-macro docutils literal"><spanclass="pre">NGHTTP2_FLAG_END_STREAM</span></tt></a>, this frame has
<aclass="reference internal"href="#c.nghttp2_priority_spec_default_init"title="nghttp2_priority_spec_default_init"><ttclass="xref c c-func docutils literal"><spanclass="pre">nghttp2_priority_spec_default_init()</span></tt></a>). To specify the priority,
use <aclass="reference internal"href="#c.nghttp2_priority_spec_init"title="nghttp2_priority_spec_init"><ttclass="xref c c-func docutils literal"><spanclass="pre">nghttp2_priority_spec_init()</span></tt></a>. If <em>pri_spec</em> is not <ttclass="docutils literal"><spanclass="pre">NULL</span></tt>,
<p>The <ttclass="xref c c-func docutils literal"><spanclass="pre">pri_spec->weight()</span></tt> must be in [<aclass="reference internal"href="#c.NGHTTP2_MIN_WEIGHT"title="NGHTTP2_MIN_WEIGHT"><ttclass="xref c c-macro docutils literal"><spanclass="pre">NGHTTP2_MIN_WEIGHT</span></tt></a>,
<aclass="reference internal"href="#c.NGHTTP2_MAX_WEIGHT"title="NGHTTP2_MAX_WEIGHT"><ttclass="xref c c-macro docutils literal"><spanclass="pre">NGHTTP2_MAX_WEIGHT</span></tt></a>], inclusive. If <ttclass="xref c c-func docutils literal"><spanclass="pre">pri_spec->weight()</span></tt> is
strictly less than <aclass="reference internal"href="#c.NGHTTP2_MIN_WEIGHT"title="NGHTTP2_MIN_WEIGHT"><ttclass="xref c c-macro docutils literal"><spanclass="pre">NGHTTP2_MIN_WEIGHT</span></tt></a>, it becomes
<aclass="reference internal"href="#c.NGHTTP2_MIN_WEIGHT"title="NGHTTP2_MIN_WEIGHT"><ttclass="xref c c-macro docutils literal"><spanclass="pre">NGHTTP2_MIN_WEIGHT</span></tt></a>. If it is strictly greater than
<aclass="reference internal"href="#c.NGHTTP2_MAX_WEIGHT"title="NGHTTP2_MAX_WEIGHT"><ttclass="xref c c-macro docutils literal"><spanclass="pre">NGHTTP2_MAX_WEIGHT</span></tt></a>, it becomes <aclass="reference internal"href="#c.NGHTTP2_MAX_WEIGHT"title="NGHTTP2_MAX_WEIGHT"><ttclass="xref c c-macro docutils literal"><spanclass="pre">NGHTTP2_MAX_WEIGHT</span></tt></a>.</p>
<p>The <em>nva</em> is an array of name/value pair <aclass="reference internal"href="#c.nghttp2_nv"title="nghttp2_nv"><ttclass="xref c c-type docutils literal"><spanclass="pre">nghttp2_nv</span></tt></a> with
<aclass="reference internal"href="#c.nghttp2_submit_request"title="nghttp2_submit_request"><ttclass="xref c c-func docutils literal"><spanclass="pre">nghttp2_submit_request()</span></tt></a> is useful.</p>
<aclass="reference internal"href="#c.nghttp2_before_frame_send_callback"title="nghttp2_before_frame_send_callback"><ttclass="xref c c-type docutils literal"><spanclass="pre">nghttp2_before_frame_send_callback</span></tt></a> is called for this
int <ttclass="descname">nghttp2_submit_data</tt><big>(</big><aclass="reference internal"href="#c.nghttp2_session"title="nghttp2_session">nghttp2_session</a><em> *session</em>, uint8_t<em> flags</em>, int32_t<em> stream_id</em>, const <aclass="reference internal"href="#c.nghttp2_data_provider"title="nghttp2_data_provider">nghttp2_data_provider</a><em> *data_prd</em><big>)</big><aclass="headerlink"href="#c.nghttp2_submit_data"title="Permalink to this definition">¶</a></dt>
<aclass="reference internal"href="#c.NGHTTP2_FLAG_END_STREAM"title="NGHTTP2_FLAG_END_STREAM"><ttclass="xref c c-macro docutils literal"><spanclass="pre">NGHTTP2_FLAG_END_STREAM</span></tt></a>, the last DATA frame has END_STREAM
<pclass="last">Currently, only one data is allowed for a stream at a time.
Submitting data more than once before first data is finished
results in <aclass="reference internal"href="#c.NGHTTP2_ERR_DATA_EXIST"title="NGHTTP2_ERR_DATA_EXIST"><ttclass="xref c c-macro docutils literal"><spanclass="pre">NGHTTP2_ERR_DATA_EXIST</span></tt></a> error code. The
earliest callback which tells that previous data is done is
<aclass="reference internal"href="#c.nghttp2_on_frame_send_callback"title="nghttp2_on_frame_send_callback"><ttclass="xref c c-type docutils literal"><spanclass="pre">nghttp2_on_frame_send_callback</span></tt></a>. In side that callback,
new data can be submitted using <aclass="reference internal"href="#c.nghttp2_submit_data"title="nghttp2_submit_data"><ttclass="xref c c-func docutils literal"><spanclass="pre">nghttp2_submit_data()</span></tt></a>. Of
course, all data except for last one must not have
<aclass="reference internal"href="#c.NGHTTP2_FLAG_END_STREAM"title="NGHTTP2_FLAG_END_STREAM"><ttclass="xref c c-macro docutils literal"><spanclass="pre">NGHTTP2_FLAG_END_STREAM</span></tt></a> flag set in <em>flags</em>.</p>
int <ttclass="descname">nghttp2_submit_priority</tt><big>(</big><aclass="reference internal"href="#c.nghttp2_session"title="nghttp2_session">nghttp2_session</a><em> *session</em>, uint8_t<em> flags</em>, int32_t<em> stream_id</em>, const <aclass="reference internal"href="#c.nghttp2_priority_spec"title="nghttp2_priority_spec">nghttp2_priority_spec</a><em> *pri_spec</em><big>)</big><aclass="headerlink"href="#c.nghttp2_submit_priority"title="Permalink to this definition">¶</a></dt>
is not allowed for this function. To specify the priority, use
<aclass="reference internal"href="#c.nghttp2_priority_spec_init"title="nghttp2_priority_spec_init"><ttclass="xref c c-func docutils literal"><spanclass="pre">nghttp2_priority_spec_init()</span></tt></a>. This function will copy its data
members.</p>
<p>The <ttclass="xref c c-func docutils literal"><spanclass="pre">pri_spec->weight()</span></tt> must be in [<aclass="reference internal"href="#c.NGHTTP2_MIN_WEIGHT"title="NGHTTP2_MIN_WEIGHT"><ttclass="xref c c-macro docutils literal"><spanclass="pre">NGHTTP2_MIN_WEIGHT</span></tt></a>,
<aclass="reference internal"href="#c.NGHTTP2_MAX_WEIGHT"title="NGHTTP2_MAX_WEIGHT"><ttclass="xref c c-macro docutils literal"><spanclass="pre">NGHTTP2_MAX_WEIGHT</span></tt></a>], inclusive. If <ttclass="xref c c-func docutils literal"><spanclass="pre">pri_spec->weight()</span></tt> is
strictly less than <aclass="reference internal"href="#c.NGHTTP2_MIN_WEIGHT"title="NGHTTP2_MIN_WEIGHT"><ttclass="xref c c-macro docutils literal"><spanclass="pre">NGHTTP2_MIN_WEIGHT</span></tt></a>, it becomes
<aclass="reference internal"href="#c.NGHTTP2_MIN_WEIGHT"title="NGHTTP2_MIN_WEIGHT"><ttclass="xref c c-macro docutils literal"><spanclass="pre">NGHTTP2_MIN_WEIGHT</span></tt></a>. If it is strictly greater than
<aclass="reference internal"href="#c.NGHTTP2_MAX_WEIGHT"title="NGHTTP2_MAX_WEIGHT"><ttclass="xref c c-macro docutils literal"><spanclass="pre">NGHTTP2_MAX_WEIGHT</span></tt></a>, it becomes <aclass="reference internal"href="#c.NGHTTP2_MAX_WEIGHT"title="NGHTTP2_MAX_WEIGHT"><ttclass="xref c c-macro docutils literal"><spanclass="pre">NGHTTP2_MAX_WEIGHT</span></tt></a>.</p>
int <ttclass="descname">nghttp2_submit_rst_stream</tt><big>(</big><aclass="reference internal"href="#c.nghttp2_session"title="nghttp2_session">nghttp2_session</a><em> *session</em>, uint8_t<em> flags</em>, int32_t<em> stream_id</em>, uint32_t<em> error_code</em><big>)</big><aclass="headerlink"href="#c.nghttp2_submit_rst_stream"title="Permalink to this definition">¶</a></dt>
<p>The pre-defined error code is one of <aclass="reference internal"href="#c.nghttp2_error_code"title="nghttp2_error_code"><ttclass="xref c c-macro docutils literal"><spanclass="pre">nghttp2_error_code</span></tt></a>.</p>
int <ttclass="descname">nghttp2_submit_settings</tt><big>(</big><aclass="reference internal"href="#c.nghttp2_session"title="nghttp2_session">nghttp2_session</a><em> *session</em>, uint8_t<em> flags</em>, const <aclass="reference internal"href="#c.nghttp2_settings_entry"title="nghttp2_settings_entry">nghttp2_settings_entry</a><em> *iv</em>, size_t<em> niv</em><big>)</big><aclass="headerlink"href="#c.nghttp2_submit_settings"title="Permalink to this definition">¶</a></dt>
<dd><p>Stores local settings and submits SETTINGS frame. The <em>iv</em> is the
pointer to the array of <aclass="reference internal"href="#c.nghttp2_settings_entry"title="nghttp2_settings_entry"><ttclass="xref c c-type docutils literal"><spanclass="pre">nghttp2_settings_entry</span></tt></a>. The <em>niv</em>
indicates the number of <aclass="reference internal"href="#c.nghttp2_settings_entry"title="nghttp2_settings_entry"><ttclass="xref c c-type docutils literal"><spanclass="pre">nghttp2_settings_entry</span></tt></a>.</p>
<p>SETTINGS with <aclass="reference internal"href="#c.NGHTTP2_FLAG_ACK"title="NGHTTP2_FLAG_ACK"><ttclass="xref c c-macro docutils literal"><spanclass="pre">NGHTTP2_FLAG_ACK</span></tt></a> is automatically submitted
<p>The <em>nva</em> is an array of name/value pair <aclass="reference internal"href="#c.nghttp2_nv"title="nghttp2_nv"><ttclass="xref c c-type docutils literal"><spanclass="pre">nghttp2_nv</span></tt></a> with
<aclass="reference internal"href="#c.nghttp2_session_get_stream_user_data"title="nghttp2_session_get_stream_user_data"><ttclass="xref c c-func docutils literal"><spanclass="pre">nghttp2_session_get_stream_user_data()</span></tt></a>. The application can
access it in <aclass="reference internal"href="#c.nghttp2_before_frame_send_callback"title="nghttp2_before_frame_send_callback"><ttclass="xref c c-type docutils literal"><spanclass="pre">nghttp2_before_frame_send_callback</span></tt></a> and
<aclass="reference internal"href="#c.nghttp2_on_frame_send_callback"title="nghttp2_on_frame_send_callback"><ttclass="xref c c-type docutils literal"><spanclass="pre">nghttp2_on_frame_send_callback</span></tt></a> of this frame.</p>
<aclass="reference internal"href="#c.nghttp2_before_frame_send_callback"title="nghttp2_before_frame_send_callback"><ttclass="xref c c-type docutils literal"><spanclass="pre">nghttp2_before_frame_send_callback</span></tt></a> is called for this
int <ttclass="descname">nghttp2_submit_ping</tt><big>(</big><aclass="reference internal"href="#c.nghttp2_session"title="nghttp2_session">nghttp2_session</a><em> *session</em>, uint8_t<em> flags</em>, const uint8_t<em> *opaque_data</em><big>)</big><aclass="headerlink"href="#c.nghttp2_submit_ping"title="Permalink to this definition">¶</a></dt>
int <ttclass="descname">nghttp2_submit_goaway</tt><big>(</big><aclass="reference internal"href="#c.nghttp2_session"title="nghttp2_session">nghttp2_session</a><em> *session</em>, uint8_t<em> flags</em>, int32_t<em> last_stream_id</em>, uint32_t<em> error_code</em>, const uint8_t<em> *opaque_data</em>, size_t<em> opaque_data_len</em><big>)</big><aclass="headerlink"href="#c.nghttp2_submit_goaway"title="Permalink to this definition">¶</a></dt>
<p>The pre-defined error code is one of <aclass="reference internal"href="#c.nghttp2_error_code"title="nghttp2_error_code"><ttclass="xref c c-macro docutils literal"><spanclass="pre">nghttp2_error_code</span></tt></a>.</p>
<p>After successful transmission of GOAWAY, following things happen.
All incoming streams having strictly more than <em>last_stream_id</em> are
closed. All incoming HEADERS which starts new stream are simply
ignored. After all active streams are handled, both
<aclass="reference internal"href="#c.nghttp2_session_want_read"title="nghttp2_session_want_read"><ttclass="xref c c-func docutils literal"><spanclass="pre">nghttp2_session_want_read()</span></tt></a> and <aclass="reference internal"href="#c.nghttp2_session_want_write"title="nghttp2_session_want_write"><ttclass="xref c c-func docutils literal"><spanclass="pre">nghttp2_session_want_write()</span></tt></a>
return 0 and the application can close session.</p>
int32_t <ttclass="descname">nghttp2_session_get_last_proc_stream_id</tt><big>(</big><aclass="reference internal"href="#c.nghttp2_session"title="nghttp2_session">nghttp2_session</a><em> *session</em><big>)</big><aclass="headerlink"href="#c.nghttp2_session_get_last_proc_stream_id"title="Permalink to this definition">¶</a></dt>
<dd><p>Returns the last stream ID of a stream for which
<aclass="reference internal"href="#c.nghttp2_on_frame_recv_callback"title="nghttp2_on_frame_recv_callback"><ttclass="xref c c-type docutils literal"><spanclass="pre">nghttp2_on_frame_recv_callback</span></tt></a> was invoked most recently.
The returned value can be used as last_stream_id parameter for
<aclass="reference internal"href="#c.nghttp2_submit_goaway"title="nghttp2_submit_goaway"><ttclass="xref c c-func docutils literal"><spanclass="pre">nghttp2_submit_goaway()</span></tt></a> and
<aclass="reference internal"href="#c.nghttp2_session_terminate_session2"title="nghttp2_session_terminate_session2"><ttclass="xref c c-func docutils literal"><spanclass="pre">nghttp2_session_terminate_session2()</span></tt></a>.</p>
int <ttclass="descname">nghttp2_submit_window_update</tt><big>(</big><aclass="reference internal"href="#c.nghttp2_session"title="nghttp2_session">nghttp2_session</a><em> *session</em>, uint8_t<em> flags</em>, int32_t<em> stream_id</em>, int32_t<em> window_size_increment</em><big>)</big><aclass="headerlink"href="#c.nghttp2_submit_window_update"title="Permalink to this definition">¶</a></dt>
is decreased by -<em>window_size_increment</em>. If automatic
WINDOW_UPDATE is enabled
(<aclass="reference internal"href="#c.nghttp2_option_set_no_auto_window_update"title="nghttp2_option_set_no_auto_window_update"><ttclass="xref c c-func docutils literal"><spanclass="pre">nghttp2_option_set_no_auto_window_update()</span></tt></a>), and the library
decided that the WINDOW_UPDATE should be submitted, then
WINDOW_UPDATE is queued with the current received bytes count.</p>
int <ttclass="descname">nghttp2_nv_compare_name</tt><big>(</big>const <aclass="reference internal"href="#c.nghttp2_nv"title="nghttp2_nv">nghttp2_nv</a><em> *lhs</em>, const <aclass="reference internal"href="#c.nghttp2_nv"title="nghttp2_nv">nghttp2_nv</a><em> *rhs</em><big>)</big><aclass="headerlink"href="#c.nghttp2_nv_compare_name"title="Permalink to this definition">¶</a></dt>
<dd><p>Compares <ttclass="docutils literal"><spanclass="pre">lhs->name</span></tt> of length <ttclass="docutils literal"><spanclass="pre">lhs->namelen</span></tt> bytes and
<ttclass="docutils literal"><spanclass="pre">rhs->name</span></tt> of length <ttclass="docutils literal"><spanclass="pre">rhs->namelen</span></tt> bytes. Returns negative
integer if <ttclass="docutils literal"><spanclass="pre">lhs->name</span></tt> is found to be less than <ttclass="docutils literal"><spanclass="pre">rhs->name</span></tt>; or
returns positive integer if <ttclass="docutils literal"><spanclass="pre">lhs->name</span></tt> is found to be greater
than <ttclass="docutils literal"><spanclass="pre">rhs->name</span></tt>; or returns 0 otherwise.</p>
int <ttclass="descname">nghttp2_select_next_protocol</tt><big>(</big>unsigned char<em> **out</em>, unsigned char<em> *outlen</em>, const unsigned char<em> *in</em>, unsigned int<em> inlen</em><big>)</big><aclass="headerlink"href="#c.nghttp2_select_next_protocol"title="Permalink to this definition">¶</a></dt>
<p>Selecting <ttclass="docutils literal"><spanclass="pre">HTTP-draft-04/2.0</span></tt> means that <ttclass="docutils literal"><spanclass="pre">HTTP-draft-04/2.0</span></tt> is
<p>See <aclass="reference external"href="http://technotes.googlecode.com/git/nextprotoneg.html">http://technotes.googlecode.com/git/nextprotoneg.html</a> for more
<aclass="reference internal"href="#c.nghttp2_info"title="nghttp2_info">nghttp2_info</a> *<ttclass="descname">nghttp2_version</tt><big>(</big>int<em> least_version</em><big>)</big><aclass="headerlink"href="#c.nghttp2_version"title="Permalink to this definition">¶</a></dt>
int <ttclass="descname">nghttp2_is_fatal</tt><big>(</big>int<em> lib_error</em><big>)</big><aclass="headerlink"href="#c.nghttp2_is_fatal"title="Permalink to this definition">¶</a></dt>
<dd><p>Returns nonzero if the <aclass="reference internal"href="#c.nghttp2_error"title="nghttp2_error"><ttclass="xref c c-type docutils literal"><spanclass="pre">nghttp2_error</span></tt></a> library error code
int <ttclass="descname">nghttp2_check_header_name</tt><big>(</big>const uint8_t<em> *name</em>, size_t<em> len</em><big>)</big><aclass="headerlink"href="#c.nghttp2_check_header_name"title="Permalink to this definition">¶</a></dt>
valid according to <aclass="reference external"href="http://tools.ietf.org/html/rfc7230#section-3.2">http://tools.ietf.org/html/rfc7230#section-3.2</a></p>
int <ttclass="descname">nghttp2_check_header_value</tt><big>(</big>const uint8_t<em> *value</em>, size_t<em> len</em><big>)</big><aclass="headerlink"href="#c.nghttp2_check_header_value"title="Permalink to this definition">¶</a></dt>
int <ttclass="descname">nghttp2_hd_deflate_new</tt><big>(</big><aclass="reference internal"href="#c.nghttp2_hd_deflater"title="nghttp2_hd_deflater">nghttp2_hd_deflater</a><em> **deflater_ptr</em>, size_t<em> deflate_hd_table_bufsize_max</em><big>)</big><aclass="headerlink"href="#c.nghttp2_hd_deflate_new"title="Permalink to this definition">¶</a></dt>
<dd><p>Initializes <em>*deflater_ptr</em> for deflating name/values pairs.</p>
<p>The <em>deflate_hd_table_bufsize_max</em> is the upper bound of header
int <ttclass="descname">nghttp2_hd_deflate_new2</tt><big>(</big><aclass="reference internal"href="#c.nghttp2_hd_deflater"title="nghttp2_hd_deflater">nghttp2_hd_deflater</a><em> **deflater_ptr</em>, size_t<em> deflate_hd_table_bufsize_max</em>, <aclass="reference internal"href="#c.nghttp2_mem"title="nghttp2_mem">nghttp2_mem</a><em> *mem</em><big>)</big><aclass="headerlink"href="#c.nghttp2_hd_deflate_new2"title="Permalink to this definition">¶</a></dt>
<dd><p>Like <aclass="reference internal"href="#c.nghttp2_hd_deflate_new"title="nghttp2_hd_deflate_new"><ttclass="xref c c-func docutils literal"><spanclass="pre">nghttp2_hd_deflate_new()</span></tt></a>, but with additional custom memory
allocator specified in the <em>mem</em>.</p>
<p>The <em>mem</em> can be <ttclass="docutils literal"><spanclass="pre">NULL</span></tt> and the call is equivalent to
<aclass="reference internal"href="#c.nghttp2_hd_deflate_new"title="nghttp2_hd_deflate_new"><ttclass="xref c c-func docutils literal"><spanclass="pre">nghttp2_hd_deflate_new()</span></tt></a>.</p>
<p>This function does not take ownership <em>mem</em>. The application is
responsible for freeing <em>mem</em>.</p>
<p>The library code does not refer to <em>mem</em> pointer after this
function returns, so the application can safely free it.</p>
void <ttclass="descname">nghttp2_hd_deflate_del</tt><big>(</big><aclass="reference internal"href="#c.nghttp2_hd_deflater"title="nghttp2_hd_deflater">nghttp2_hd_deflater</a><em> *deflater</em><big>)</big><aclass="headerlink"href="#c.nghttp2_hd_deflate_del"title="Permalink to this definition">¶</a></dt>
<dd><p>Deallocates any resources allocated for <em>deflater</em>.</p>
</dd></dl>
<dlclass="function">
<dtid="c.nghttp2_hd_deflate_change_table_size">
int <ttclass="descname">nghttp2_hd_deflate_change_table_size</tt><big>(</big><aclass="reference internal"href="#c.nghttp2_hd_deflater"title="nghttp2_hd_deflater">nghttp2_hd_deflater</a><em> *deflater</em>, size_t<em> settings_hd_table_bufsize_max</em><big>)</big><aclass="headerlink"href="#c.nghttp2_hd_deflate_change_table_size"title="Permalink to this definition">¶</a></dt>
<dd><p>Changes header table size of the <em>deflater</em> to
<em>settings_hd_table_bufsize_max</em> bytes. This may trigger eviction
in the dynamic table.</p>
<p>The <em>settings_hd_table_bufsize_max</em> should be the value received in
SETTINGS_HEADER_TABLE_SIZE.</p>
<p>The deflater never uses more memory than
<ttclass="docutils literal"><spanclass="pre">deflate_hd_table_bufsize_max</span></tt> bytes specified in
<aclass="reference internal"href="#c.nghttp2_hd_deflate_new"title="nghttp2_hd_deflate_new"><ttclass="xref c c-func docutils literal"><spanclass="pre">nghttp2_hd_deflate_new()</span></tt></a>. Therefore, if
<dd><p>Deflates the <em>nva</em>, which has the <em>nvlen</em> name/value pairs, into
the <em>buf</em> of length <em>buflen</em>.</p>
<p>If <em>buf</em> is not large enough to store the deflated header block,
this function fails with <aclass="reference internal"href="#c.NGHTTP2_ERR_INSUFF_BUFSIZE"title="NGHTTP2_ERR_INSUFF_BUFSIZE"><ttclass="xref c c-macro docutils literal"><spanclass="pre">NGHTTP2_ERR_INSUFF_BUFSIZE</span></tt></a>. The
caller should use <aclass="reference internal"href="#c.nghttp2_hd_deflate_bound"title="nghttp2_hd_deflate_bound"><ttclass="xref c c-func docutils literal"><spanclass="pre">nghttp2_hd_deflate_bound()</span></tt></a> to know the upper
bound of buffer size required to deflate given header name/value
pairs.</p>
<p>Once this function fails, subsequent call of this function always
returns <aclass="reference internal"href="#c.NGHTTP2_ERR_HEADER_COMP"title="NGHTTP2_ERR_HEADER_COMP"><ttclass="xref c c-macro docutils literal"><spanclass="pre">NGHTTP2_ERR_HEADER_COMP</span></tt></a>.</p>
<p>After this function returns, it is safe to delete the <em>nva</em>.</p>
<p>This function returns 0 if it succeeds, or one of the following
negative error codes:</p>
<dlclass="docutils">
<dt><aclass="reference internal"href="#c.NGHTTP2_ERR_NOMEM"title="NGHTTP2_ERR_NOMEM"><ttclass="xref c c-macro docutils literal"><spanclass="pre">NGHTTP2_ERR_NOMEM</span></tt></a></dt>
<dd>Out of memory.</dd>
<dt><aclass="reference internal"href="#c.NGHTTP2_ERR_HEADER_COMP"title="NGHTTP2_ERR_HEADER_COMP"><ttclass="xref c c-macro docutils literal"><spanclass="pre">NGHTTP2_ERR_HEADER_COMP</span></tt></a></dt>
<dd>Deflation process has failed.</dd>
<dt><aclass="reference internal"href="#c.NGHTTP2_ERR_INSUFF_BUFSIZE"title="NGHTTP2_ERR_INSUFF_BUFSIZE"><ttclass="xref c c-macro docutils literal"><spanclass="pre">NGHTTP2_ERR_INSUFF_BUFSIZE</span></tt></a></dt>
<dd>The provided <em>buflen</em> size is too small to hold the output.</dd>
</dl>
</dd></dl>
<dlclass="function">
<dtid="c.nghttp2_hd_deflate_bound">
size_t <ttclass="descname">nghttp2_hd_deflate_bound</tt><big>(</big><aclass="reference internal"href="#c.nghttp2_hd_deflater"title="nghttp2_hd_deflater">nghttp2_hd_deflater</a><em> *deflater</em>, const <aclass="reference internal"href="#c.nghttp2_nv"title="nghttp2_nv">nghttp2_nv</a><em> *nva</em>, size_t<em> nvlen</em><big>)</big><aclass="headerlink"href="#c.nghttp2_hd_deflate_bound"title="Permalink to this definition">¶</a></dt>
<dd><p>Returns an upper bound on the compressed size after deflation of
int <ttclass="descname">nghttp2_hd_inflate_new</tt><big>(</big><aclass="reference internal"href="#c.nghttp2_hd_inflater"title="nghttp2_hd_inflater">nghttp2_hd_inflater</a><em> **inflater_ptr</em><big>)</big><aclass="headerlink"href="#c.nghttp2_hd_inflate_new"title="Permalink to this definition">¶</a></dt>
<dd><p>Initializes <em>*inflater_ptr</em> for inflating name/values pairs.</p>
int <ttclass="descname">nghttp2_hd_inflate_new2</tt><big>(</big><aclass="reference internal"href="#c.nghttp2_hd_inflater"title="nghttp2_hd_inflater">nghttp2_hd_inflater</a><em> **inflater_ptr</em>, <aclass="reference internal"href="#c.nghttp2_mem"title="nghttp2_mem">nghttp2_mem</a><em> *mem</em><big>)</big><aclass="headerlink"href="#c.nghttp2_hd_inflate_new2"title="Permalink to this definition">¶</a></dt>
<dd><p>Like <aclass="reference internal"href="#c.nghttp2_hd_inflate_new"title="nghttp2_hd_inflate_new"><ttclass="xref c c-func docutils literal"><spanclass="pre">nghttp2_hd_inflate_new()</span></tt></a>, but with additional custom memory
allocator specified in the <em>mem</em>.</p>
<p>The <em>mem</em> can be <ttclass="docutils literal"><spanclass="pre">NULL</span></tt> and the call is equivalent to
<aclass="reference internal"href="#c.nghttp2_hd_inflate_new"title="nghttp2_hd_inflate_new"><ttclass="xref c c-func docutils literal"><spanclass="pre">nghttp2_hd_inflate_new()</span></tt></a>.</p>
<p>This function does not take ownership <em>mem</em>. The application is
responsible for freeing <em>mem</em>.</p>
<p>The library code does not refer to <em>mem</em> pointer after this
function returns, so the application can safely free it.</p>
void <ttclass="descname">nghttp2_hd_inflate_del</tt><big>(</big><aclass="reference internal"href="#c.nghttp2_hd_inflater"title="nghttp2_hd_inflater">nghttp2_hd_inflater</a><em> *inflater</em><big>)</big><aclass="headerlink"href="#c.nghttp2_hd_inflate_del"title="Permalink to this definition">¶</a></dt>
<dd><p>Deallocates any resources allocated for <em>inflater</em>.</p>
</dd></dl>
<dlclass="function">
<dtid="c.nghttp2_hd_inflate_change_table_size">
int <ttclass="descname">nghttp2_hd_inflate_change_table_size</tt><big>(</big><aclass="reference internal"href="#c.nghttp2_hd_inflater"title="nghttp2_hd_inflater">nghttp2_hd_inflater</a><em> *inflater</em>, size_t<em> settings_hd_table_bufsize_max</em><big>)</big><aclass="headerlink"href="#c.nghttp2_hd_inflate_change_table_size"title="Permalink to this definition">¶</a></dt>
header name/value pair, <aclass="reference internal"href="#c.NGHTTP2_HD_INFLATE_EMIT"title="NGHTTP2_HD_INFLATE_EMIT"><ttclass="xref c c-macro docutils literal"><spanclass="pre">NGHTTP2_HD_INFLATE_EMIT</span></tt></a> is set in
<em>*inflate_flags</em> and name/value pair is assigned to the <em>nv_out</em>
<ttclass="docutils literal"><spanclass="pre">(*inflate_flags)</span><spanclass="pre">&</span><spanclass="pre">NGHTTP2_HD_INFLATE_FINAL</span></tt> is nonzero and
<aclass="reference internal"href="#c.nghttp2_hd_inflate_end_headers"title="nghttp2_hd_inflate_end_headers"><ttclass="xref c c-func docutils literal"><spanclass="pre">nghttp2_hd_inflate_end_headers()</span></tt></a> to prepare for the next header
int <ttclass="descname">nghttp2_hd_inflate_end_headers</tt><big>(</big><aclass="reference internal"href="#c.nghttp2_hd_inflater"title="nghttp2_hd_inflater">nghttp2_hd_inflater</a><em> *inflater</em><big>)</big><aclass="headerlink"href="#c.nghttp2_hd_inflate_end_headers"title="Permalink to this definition">¶</a></dt>
<dd><p>Signals the end of decompression for one header block.</p>
<p>This function returns 0 if it succeeds. Currently this function
<ahref="libnghttp2_asio.html"class="btn btn-neutral float-right"title="libnghttp2_asio: High level HTTP/2 C++ library">Next <spanclass="fa fa-arrow-circle-right"></span></a>
Built with <ahref="http://sphinx-doc.org/">Sphinx</a> using a <ahref="https://github.com/snide/sphinx_rtd_theme">theme</a> provided by <ahref="https://readthedocs.org">Read the Docs</a>.