<h2>Remarks<aclass="headerlink"href="#remarks"title="Permalink to this headline">¶</a></h2>
<p>Do not call <aclass="reference internal"href="#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="#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="#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 <aclass="reference internal"href="#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="#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="#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> outside of the
callbacks.</p>
</div>
<divclass="section"id="macros">
<h2>Macros<aclass="headerlink"href="#macros"title="Permalink to this headline">¶</a></h2>
<dlclass="macro">
<dtid="NGHTTP2_VERSION">
<ttclass="descname">NGHTTP2_VERSION</tt><aclass="headerlink"href="#NGHTTP2_VERSION"title="Permalink to this definition">¶</a></dt>
<dd><p>Version number of the nghttp2 library release</p>
<ttclass="descname">NGHTTP2_PROTO_VERSION_ID</tt><aclass="headerlink"href="#NGHTTP2_PROTO_VERSION_ID"title="Permalink to this definition">¶</a></dt>
<dd><p>The protocol version identification of this library supports.</p>
</dd></dl>
<dlclass="macro">
<dtid="NGHTTP2_PROTO_VERSION_ID_LEN">
<ttclass="descname">NGHTTP2_PROTO_VERSION_ID_LEN</tt><aclass="headerlink"href="#NGHTTP2_PROTO_VERSION_ID_LEN"title="Permalink to this definition">¶</a></dt>
<dd><p>The length of <aclass="reference internal"href="#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>
</dd></dl>
<dlclass="macro">
<dtid="NGHTTP2_VERSION_AGE">
<ttclass="descname">NGHTTP2_VERSION_AGE</tt><aclass="headerlink"href="#NGHTTP2_VERSION_AGE"title="Permalink to this definition">¶</a></dt>
<dd><p>The age of <aclass="reference internal"href="#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="#NGHTTP2_INITIAL_WINDOW_SIZE"title="Permalink to this definition">¶</a></dt>
<dd><p>The initial window size for stream level flow control.</p>
</dd></dl>
<dlclass="macro">
<dtid="NGHTTP2_INITIAL_CONNECTION_WINDOW_SIZE">
<ttclass="descname">NGHTTP2_INITIAL_CONNECTION_WINDOW_SIZE</tt><aclass="headerlink"href="#NGHTTP2_INITIAL_CONNECTION_WINDOW_SIZE"title="Permalink to this definition">¶</a></dt>
<dd><p>The initial window size for connection level flow control.</p>
</dd></dl>
<dlclass="macro">
<dtid="NGHTTP2_CLIENT_CONNECTION_HEADER">
<ttclass="descname">NGHTTP2_CLIENT_CONNECTION_HEADER</tt><aclass="headerlink"href="#NGHTTP2_CLIENT_CONNECTION_HEADER"title="Permalink to this definition">¶</a></dt>
<dd><p>The client connection header.</p>
</dd></dl>
<dlclass="macro">
<dtid="NGHTTP2_CLIENT_CONNECTION_HEADER_LEN">
<ttclass="descname">NGHTTP2_CLIENT_CONNECTION_HEADER_LEN</tt><aclass="headerlink"href="#NGHTTP2_CLIENT_CONNECTION_HEADER_LEN"title="Permalink to this definition">¶</a></dt>
<dd><p>The length of <aclass="reference internal"href="#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="#NGHTTP2_INITIAL_MAX_CONCURRENT_STREAMS"title="Permalink to this definition">¶</a></dt>
<dd><p>Default maximum concurrent streams.</p>
</dd></dl>
</div>
<divclass="section"id="enums">
<h2>Enums<aclass="headerlink"href="#enums"title="Permalink to this headline">¶</a></h2>
<dlclass="type">
<dtid="nghttp2_error">
<ttclass="descname">nghttp2_error</tt><aclass="headerlink"href="#nghttp2_error"title="Permalink to this definition">¶</a></dt>
<dd><p>Error codes used in this library. The code range is [-999, -500],
inclusive. The following values are defined:</p>
<dlclass="macro">
<dtid="NGHTTP2_ERR_INVALID_ARGUMENT">
<ttclass="descname">NGHTTP2_ERR_INVALID_ARGUMENT</tt><aclass="headerlink"href="#NGHTTP2_ERR_INVALID_ARGUMENT"title="Permalink to this definition">¶</a></dt>
<ttclass="descname">NGHTTP2_ERR_UNSUPPORTED_VERSION</tt><aclass="headerlink"href="#NGHTTP2_ERR_UNSUPPORTED_VERSION"title="Permalink to this definition">¶</a></dt>
Used as a return value from <aclass="reference internal"href="#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="#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
would block.</p>
</dd></dl>
<dlclass="macro">
<dtid="NGHTTP2_ERR_PROTO">
<ttclass="descname">NGHTTP2_ERR_PROTO</tt><aclass="headerlink"href="#NGHTTP2_ERR_PROTO"title="Permalink to this definition">¶</a></dt>
<aclass="reference internal"href="#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
transfer is postponed. See
<aclass="reference internal"href="#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>
</dd></dl>
<dlclass="macro">
<dtid="NGHTTP2_ERR_STREAM_ID_NOT_AVAILABLE">
<ttclass="descname">NGHTTP2_ERR_STREAM_ID_NOT_AVAILABLE</tt><aclass="headerlink"href="#NGHTTP2_ERR_STREAM_ID_NOT_AVAILABLE"title="Permalink to this definition">¶</a></dt>
The stream is already closed; or the stream ID is invalid.</p>
</dd></dl>
<dlclass="macro">
<dtid="NGHTTP2_ERR_STREAM_CLOSING">
<ttclass="descname">NGHTTP2_ERR_STREAM_CLOSING</tt><aclass="headerlink"href="#NGHTTP2_ERR_STREAM_CLOSING"title="Permalink to this definition">¶</a></dt>
RST_STREAM has been added to the outbound queue. The stream is in
closing state.</p>
</dd></dl>
<dlclass="macro">
<dtid="NGHTTP2_ERR_STREAM_SHUT_WR">
<ttclass="descname">NGHTTP2_ERR_STREAM_SHUT_WR</tt><aclass="headerlink"href="#NGHTTP2_ERR_STREAM_SHUT_WR"title="Permalink to this definition">¶</a></dt>
The transmission is not allowed for this stream (e.g., a frame
with END_STREAM flag set has already sent).</p>
</dd></dl>
<dlclass="macro">
<dtid="NGHTTP2_ERR_INVALID_STREAM_ID">
<ttclass="descname">NGHTTP2_ERR_INVALID_STREAM_ID</tt><aclass="headerlink"href="#NGHTTP2_ERR_INVALID_STREAM_ID"title="Permalink to this definition">¶</a></dt>
<ttclass="descname">NGHTTP2_ERR_INVALID_STREAM_STATE</tt><aclass="headerlink"href="#NGHTTP2_ERR_INVALID_STREAM_STATE"title="Permalink to this definition">¶</a></dt>
The state of the stream is not valid (e.g., DATA cannot be sent
to the stream if response HEADERS has not been sent).</p>
</dd></dl>
<dlclass="macro">
<dtid="NGHTTP2_ERR_DEFERRED_DATA_EXIST">
<ttclass="descname">NGHTTP2_ERR_DEFERRED_DATA_EXIST</tt><aclass="headerlink"href="#NGHTTP2_ERR_DEFERRED_DATA_EXIST"title="Permalink to this definition">¶</a></dt>
<ttclass="descname">NGHTTP2_ERR_START_STREAM_NOT_ALLOWED</tt><aclass="headerlink"href="#NGHTTP2_ERR_START_STREAM_NOT_ALLOWED"title="Permalink to this definition">¶</a></dt>
Starting new stream is not allowed. (e.g., GOAWAY has been sent
and/or received.</p>
</dd></dl>
<dlclass="macro">
<dtid="NGHTTP2_ERR_GOAWAY_ALREADY_SENT">
<ttclass="descname">NGHTTP2_ERR_GOAWAY_ALREADY_SENT</tt><aclass="headerlink"href="#NGHTTP2_ERR_GOAWAY_ALREADY_SENT"title="Permalink to this definition">¶</a></dt>
<ttclass="descname">NGHTTP2_ERR_INVALID_HEADER_BLOCK</tt><aclass="headerlink"href="#NGHTTP2_ERR_INVALID_HEADER_BLOCK"title="Permalink to this definition">¶</a></dt>
<ttclass="descname">NGHTTP2_ERR_TEMPORAL_CALLBACK_FAILURE</tt><aclass="headerlink"href="#NGHTTP2_ERR_TEMPORAL_CALLBACK_FAILURE"title="Permalink to this definition">¶</a></dt>
The user callback function failed due to the temporal error.</p>
</dd></dl>
<dlclass="macro">
<dtid="NGHTTP2_ERR_FRAME_TOO_LARGE">
<ttclass="descname">NGHTTP2_ERR_FRAME_TOO_LARGE</tt><aclass="headerlink"href="#NGHTTP2_ERR_FRAME_TOO_LARGE"title="Permalink to this definition">¶</a></dt>
The errors <<aclass="reference internal"href="#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 cannot process any further data
reliably (e.g., out of memory).</p>
</dd></dl>
<dlclass="macro">
<dtid="NGHTTP2_ERR_NOMEM">
<ttclass="descname">NGHTTP2_ERR_NOMEM</tt><aclass="headerlink"href="#NGHTTP2_ERR_NOMEM"title="Permalink to this definition">¶</a></dt>
<ttclass="descname">NGHTTP2_ERR_CALLBACK_FAILURE</tt><aclass="headerlink"href="#NGHTTP2_ERR_CALLBACK_FAILURE"title="Permalink to this definition">¶</a></dt>
<ttclass="descname">NGHTTP2_FLAG_END_PUSH_PROMISE</tt><aclass="headerlink"href="#NGHTTP2_FLAG_END_PUSH_PROMISE"title="Permalink to this definition">¶</a></dt>
<ttclass="descname">nghttp2_settings_id</tt><aclass="headerlink"href="#nghttp2_settings_id"title="Permalink to this definition">¶</a></dt>
<dd><p>The SETTINGS ID.</p>
<dlclass="macro">
<dtid="NGHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS">
<ttclass="descname">NGHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS</tt><aclass="headerlink"href="#NGHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS"title="Permalink to this definition">¶</a></dt>
<ttclass="descname">NGHTTP2_SETTINGS_INITIAL_WINDOW_SIZE</tt><aclass="headerlink"href="#NGHTTP2_SETTINGS_INITIAL_WINDOW_SIZE"title="Permalink to this definition">¶</a></dt>
<ttclass="descname">NGHTTP2_SETTINGS_FLOW_CONTROL_OPTIONS</tt><aclass="headerlink"href="#NGHTTP2_SETTINGS_FLOW_CONTROL_OPTIONS"title="Permalink to this definition">¶</a></dt>
Maximum ID of <aclass="reference internal"href="#nghttp2_settings_id"title="nghttp2_settings_id"><ttclass="xref c c-type docutils literal"><spanclass="pre">nghttp2_settings_id</span></tt></a>.</p>
</dd></dl>
</dd></dl>
<dlclass="type">
<dtid="nghttp2_error_code">
<ttclass="descname">nghttp2_error_code</tt><aclass="headerlink"href="#nghttp2_error_code"title="Permalink to this definition">¶</a></dt>
<dd><p>The status codes for the RST_STREAM and GOAWAY frames.</p>
<dlclass="macro">
<dtid="NGHTTP2_NO_ERROR">
<ttclass="descname">NGHTTP2_NO_ERROR</tt><aclass="headerlink"href="#NGHTTP2_NO_ERROR"title="Permalink to this definition">¶</a></dt>
<ttclass="descname">NGHTTP2_FLOW_CONTROL_ERROR</tt><aclass="headerlink"href="#NGHTTP2_FLOW_CONTROL_ERROR"title="Permalink to this definition">¶</a></dt>
The HEADERS frame is the first response headers, which is
analogous to SYN_REPLY in SPDY.</p>
</dd></dl>
<dlclass="macro">
<dtid="NGHTTP2_HCAT_PUSH_RESPONSE">
<ttclass="descname">NGHTTP2_HCAT_PUSH_RESPONSE</tt><aclass="headerlink"href="#NGHTTP2_HCAT_PUSH_RESPONSE"title="Permalink to this definition">¶</a></dt>
The HEADERS frame which does not apply for the above categories,
which is analogous to HEADERS in SPDY.</p>
</dd></dl>
</dd></dl>
<dlclass="type">
<dtid="nghttp2_opt">
<ttclass="descname">nghttp2_opt</tt><aclass="headerlink"href="#nghttp2_opt"title="Permalink to this definition">¶</a></dt>
<dd><p>Configuration options for <aclass="reference internal"href="#nghttp2_session"title="nghttp2_session"><ttclass="xref c c-type docutils literal"><spanclass="pre">nghttp2_session</span></tt></a>.</p>
<ttclass="descname">NGHTTP2_OPT_NO_AUTO_STREAM_WINDOW_UPDATE</tt><aclass="headerlink"href="#NGHTTP2_OPT_NO_AUTO_STREAM_WINDOW_UPDATE"title="Permalink to this definition">¶</a></dt>
<ttclass="descname">NGHTTP2_OPT_NO_AUTO_CONNECTION_WINDOW_UPDATE</tt><aclass="headerlink"href="#NGHTTP2_OPT_NO_AUTO_CONNECTION_WINDOW_UPDATE"title="Permalink to this definition">¶</a></dt>
<ttclass="descname">nghttp2_info</tt><aclass="headerlink"href="#nghttp2_info"title="Permalink to this definition">¶</a></dt>
<dd><p>This struct is what <aclass="reference internal"href="#nghttp2_version"title="nghttp2_version"><ttclass="xref c c-func docutils literal"><spanclass="pre">nghttp2_version()</span></tt></a> returns. It holds
information about the particular nghttp2 version.</p>
<dlclass="member">
<dtid="nghttp2_info.age">
int <ttclass="descname">age</tt><aclass="headerlink"href="#nghttp2_info.age"title="Permalink to this definition">¶</a></dt>
<dd><p>Age of this struct. This instance of nghttp2 sets it to
<aclass="reference internal"href="#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
add more struct fields at the bottom</p>
</dd></dl>
<dlclass="member">
<dtid="nghttp2_info.version_num">
int <ttclass="descname">version_num</tt><aclass="headerlink"href="#nghttp2_info.version_num"title="Permalink to this definition">¶</a></dt>
<dd><p>the <aclass="reference internal"href="#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>
</dd></dl>
<dlclass="member">
<dtid="nghttp2_info.version_str">
const char *<ttclass="descname">version_str</tt><aclass="headerlink"href="#nghttp2_info.version_str"title="Permalink to this definition">¶</a></dt>
<dd><p>points to the <aclass="reference internal"href="#NGHTTP2_VERSION"title="NGHTTP2_VERSION"><ttclass="xref c c-macro docutils literal"><spanclass="pre">NGHTTP2_VERSION</span></tt></a> string (since age ==1)</p>
</dd></dl>
<dlclass="member">
<dtid="nghttp2_info.proto_str">
const char *<ttclass="descname">proto_str</tt><aclass="headerlink"href="#nghttp2_info.proto_str"title="Permalink to this definition">¶</a></dt>
<dd><p>points to the <aclass="reference internal"href="#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
uint16_t <ttclass="descname">namelen</tt><aclass="headerlink"href="#nghttp2_nv.namelen"title="Permalink to this definition">¶</a></dt>
<dd><p>The length of the <em>name</em>.</p>
</dd></dl>
<dlclass="member">
<dtid="nghttp2_nv.valuelen">
uint16_t <ttclass="descname">valuelen</tt><aclass="headerlink"href="#nghttp2_nv.valuelen"title="Permalink to this definition">¶</a></dt>
<dd><p>The length of the <em>value</em>.</p>
</dd></dl>
</dd></dl>
<dlclass="type">
<dtid="nghttp2_frame_hd">
<ttclass="descname">nghttp2_frame_hd</tt><aclass="headerlink"href="#nghttp2_frame_hd"title="Permalink to this definition">¶</a></dt>
<dd><p>The frame header.</p>
<dlclass="member">
<dtid="nghttp2_frame_hd.length">
uint16_t <ttclass="descname">length</tt><aclass="headerlink"href="#nghttp2_frame_hd.length"title="Permalink to this definition">¶</a></dt>
<dd><p>The length field of this frame, excluding frame header.</p>
</dd></dl>
<dlclass="member">
<dtid="nghttp2_frame_hd.type">
uint8_t <ttclass="descname">type</tt><aclass="headerlink"href="#nghttp2_frame_hd.type"title="Permalink to this definition">¶</a></dt>
<dd><p>The type of this frame. See <aclass="reference internal"href="#nghttp2_frame"title="nghttp2_frame"><ttclass="xref c c-func docutils literal"><spanclass="pre">nghttp2_frame()</span></tt></a>.</p>
</dd></dl>
<dlclass="member">
<dtid="nghttp2_frame_hd.flags">
uint8_t <ttclass="descname">flags</tt><aclass="headerlink"href="#nghttp2_frame_hd.flags"title="Permalink to this definition">¶</a></dt>
<dd><p>The flags.</p>
</dd></dl>
<dlclass="member">
<dtid="nghttp2_frame_hd.stream_id">
int32_t <ttclass="descname">stream_id</tt><aclass="headerlink"href="#nghttp2_frame_hd.stream_id"title="Permalink to this definition">¶</a></dt>
<dd><p>The stream identifier (aka, stream ID)</p>
</dd></dl>
</dd></dl>
<dlclass="type">
<dtid="nghttp2_data_source">
<ttclass="descname">nghttp2_data_source</tt><aclass="headerlink"href="#nghttp2_data_source"title="Permalink to this definition">¶</a></dt>
<dd><p>This union represents the some kind of data source passed to
<aclass="reference internal"href="#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>
<dlclass="member">
<dtid="nghttp2_data_source.fd">
int <ttclass="descname">fd</tt><aclass="headerlink"href="#nghttp2_data_source.fd"title="Permalink to this definition">¶</a></dt>
<dd><p>The integer field, suitable for a file descriptor.</p>
</dd></dl>
<dlclass="member">
<dtid="nghttp2_data_source.ptr">
void *<ttclass="descname">ptr</tt><aclass="headerlink"href="#nghttp2_data_source.ptr"title="Permalink to this definition">¶</a></dt>
<dd><p>The pointer to an arbitrary object.</p>
</dd></dl>
</dd></dl>
<dlclass="type">
<dtid="nghttp2_data_source_read_callback">
typedef ssize_t <ttclass="descname">(*nghttp2_data_source_read_callback)</tt><big>(</big><aclass="reference internal"href="#nghttp2_session"title="nghttp2_session">nghttp2_session</a><em> *session</em>, int32_t<em> stream_id</em>, uint8_t<em> *buf</em>, size_t<em> length</em>, int<em> *eof</em>, <aclass="reference internal"href="#nghttp2_data_source"title="nghttp2_data_source">nghttp2_data_source</a><em> *source</em>, void<em> *user_data</em><big>)</big><aclass="headerlink"href="#nghttp2_data_source_read_callback"title="Permalink to this definition">¶</a></dt>
<dd><p>Callback function invoked when the library wants to read data from
the <em>source</em>. The read data is sent in the stream <em>stream_id</em>. The
implementation of this function must read at most <em>length</em> bytes of
data from <em>source</em> (or possibly other places) and store them in
<em>buf</em> and return number of data stored in <em>buf</em>. If EOF is reached,
set <em>*eof</em> to 1. If the application wants to postpone DATA frames,
(e.g., asynchronous I/O, or reading data blocks for long time), it
is achieved by returning <aclass="reference internal"href="#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="#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="#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="#NGHTTP2_INTERNAL_ERROR"title="NGHTTP2_INTERNAL_ERROR"><ttclass="xref c c-macro docutils literal"><spanclass="pre">NGHTTP2_INTERNAL_ERROR</span></tt></a>.
Returning <aclass="reference internal"href="#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>
</dd></dl>
<dlclass="type">
<dtid="nghttp2_data_provider">
<ttclass="descname">nghttp2_data_provider</tt><aclass="headerlink"href="#nghttp2_data_provider"title="Permalink to this definition">¶</a></dt>
<dd><p>This struct represents the data source and the way to read a chunk
of data from it.</p>
<dlclass="member">
<dtid="nghttp2_data_provider.source">
<aclass="reference internal"href="#nghttp2_data_source"title="nghttp2_data_source">nghttp2_data_source</a><ttclass="descname">source</tt><aclass="headerlink"href="#nghttp2_data_provider.source"title="Permalink to this definition">¶</a></dt>
<dd><p>The data source.</p>
</dd></dl>
<dlclass="member">
<dtid="nghttp2_data_provider.read_callback">
<aclass="reference internal"href="#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="#nghttp2_data_provider.read_callback"title="Permalink to this definition">¶</a></dt>
<dd><p>The callback function to read a chunk of data from the <em>source</em>.</p>
</dd></dl>
</dd></dl>
<dlclass="type">
<dtid="nghttp2_headers">
<ttclass="descname">nghttp2_headers</tt><aclass="headerlink"href="#nghttp2_headers"title="Permalink to this definition">¶</a></dt>
<dd><p>The HEADERS frame. It has the following members:</p>
<dlclass="member">
<dtid="nghttp2_headers.hd">
<aclass="reference internal"href="#nghttp2_frame_hd"title="nghttp2_frame_hd">nghttp2_frame_hd</a><ttclass="descname">hd</tt><aclass="headerlink"href="#nghttp2_headers.hd"title="Permalink to this definition">¶</a></dt>
<dd><p>The frame header.</p>
</dd></dl>
<dlclass="member">
<dtid="nghttp2_headers.pri">
int32_t <ttclass="descname">pri</tt><aclass="headerlink"href="#nghttp2_headers.pri"title="Permalink to this definition">¶</a></dt>
<dd><p>The priority.</p>
</dd></dl>
<dlclass="member">
<dtid="nghttp2_headers.nva">
<aclass="reference internal"href="#nghttp2_nv"title="nghttp2_nv">nghttp2_nv</a> *<ttclass="descname">nva</tt><aclass="headerlink"href="#nghttp2_headers.nva"title="Permalink to this definition">¶</a></dt>
<dd><p>The name/value pairs.</p>
</dd></dl>
<dlclass="member">
<dtid="nghttp2_headers.nvlen">
size_t <ttclass="descname">nvlen</tt><aclass="headerlink"href="#nghttp2_headers.nvlen"title="Permalink to this definition">¶</a></dt>
<dd><p>The number of name/value pairs in <em>nva</em>.</p>
</dd></dl>
</dd></dl>
<dlclass="type">
<dtid="nghttp2_priority">
<ttclass="descname">nghttp2_priority</tt><aclass="headerlink"href="#nghttp2_priority"title="Permalink to this definition">¶</a></dt>
<dd><p>The PRIORITY frame. It has the following members:</p>
<dlclass="member">
<dtid="nghttp2_priority.hd">
<aclass="reference internal"href="#nghttp2_frame_hd"title="nghttp2_frame_hd">nghttp2_frame_hd</a><ttclass="descname">hd</tt><aclass="headerlink"href="#nghttp2_priority.hd"title="Permalink to this definition">¶</a></dt>
<dd><p>The frame header.</p>
</dd></dl>
<dlclass="member">
<dtid="nghttp2_priority.pri">
int32_t <ttclass="descname">pri</tt><aclass="headerlink"href="#nghttp2_priority.pri"title="Permalink to this definition">¶</a></dt>
<dd><p>The priority.</p>
</dd></dl>
</dd></dl>
<dlclass="type">
<dtid="nghttp2_rst_stream">
<ttclass="descname">nghttp2_rst_stream</tt><aclass="headerlink"href="#nghttp2_rst_stream"title="Permalink to this definition">¶</a></dt>
<dd><p>The RST_STREAM frame. It has the following members:</p>
<dlclass="member">
<dtid="nghttp2_rst_stream.hd">
<aclass="reference internal"href="#nghttp2_frame_hd"title="nghttp2_frame_hd">nghttp2_frame_hd</a><ttclass="descname">hd</tt><aclass="headerlink"href="#nghttp2_rst_stream.hd"title="Permalink to this definition">¶</a></dt>
<dd><p>The frame header.</p>
</dd></dl>
<dlclass="member">
<dtid="nghttp2_rst_stream.error_code">
<aclass="reference internal"href="#nghttp2_error_code"title="nghttp2_error_code">nghttp2_error_code</a><ttclass="descname">error_code</tt><aclass="headerlink"href="#nghttp2_rst_stream.error_code"title="Permalink to this definition">¶</a></dt>
<dd><p>The error code. See <aclass="reference internal"href="#nghttp2_error_code"title="nghttp2_error_code"><ttclass="xref c c-type docutils literal"><spanclass="pre">nghttp2_error_code</span></tt></a>.</p>
</dd></dl>
</dd></dl>
<dlclass="type">
<dtid="nghttp2_settings_entry">
<ttclass="descname">nghttp2_settings_entry</tt><aclass="headerlink"href="#nghttp2_settings_entry"title="Permalink to this definition">¶</a></dt>
<dd><p>The SETTINGS ID/Value pair. It has the following members:</p>
<dlclass="member">
<dtid="nghttp2_settings_entry.settings_id">
int32_t <ttclass="descname">settings_id</tt><aclass="headerlink"href="#nghttp2_settings_entry.settings_id"title="Permalink to this definition">¶</a></dt>
<dd><p>The SETTINGS ID. See <aclass="reference internal"href="#nghttp2_settings_id"title="nghttp2_settings_id"><ttclass="xref c c-type docutils literal"><spanclass="pre">nghttp2_settings_id</span></tt></a>.</p>
</dd></dl>
<dlclass="member">
<dtid="nghttp2_settings_entry.value">
uint32_t <ttclass="descname">value</tt><aclass="headerlink"href="#nghttp2_settings_entry.value"title="Permalink to this definition">¶</a></dt>
<dd><p>The value of this entry.</p>
</dd></dl>
</dd></dl>
<dlclass="type">
<dtid="nghttp2_settings">
<ttclass="descname">nghttp2_settings</tt><aclass="headerlink"href="#nghttp2_settings"title="Permalink to this definition">¶</a></dt>
<dd><p>The SETTINGS frame. It has the following members:</p>
<dlclass="member">
<dtid="nghttp2_settings.hd">
<aclass="reference internal"href="#nghttp2_frame_hd"title="nghttp2_frame_hd">nghttp2_frame_hd</a><ttclass="descname">hd</tt><aclass="headerlink"href="#nghttp2_settings.hd"title="Permalink to this definition">¶</a></dt>
<dd><p>The frame header.</p>
</dd></dl>
<dlclass="member">
<dtid="nghttp2_settings.niv">
size_t <ttclass="descname">niv</tt><aclass="headerlink"href="#nghttp2_settings.niv"title="Permalink to this definition">¶</a></dt>
<dd><p>The number of SETTINGS ID/Value pairs in <em>iv</em>.</p>
</dd></dl>
<dlclass="member">
<dtid="nghttp2_settings.iv">
<aclass="reference internal"href="#nghttp2_settings_entry"title="nghttp2_settings_entry">nghttp2_settings_entry</a> *<ttclass="descname">iv</tt><aclass="headerlink"href="#nghttp2_settings.iv"title="Permalink to this definition">¶</a></dt>
<dd><p>The pointer to the array of SETTINGS ID/Value pair.</p>
</dd></dl>
</dd></dl>
<dlclass="type">
<dtid="nghttp2_push_promise">
<ttclass="descname">nghttp2_push_promise</tt><aclass="headerlink"href="#nghttp2_push_promise"title="Permalink to this definition">¶</a></dt>
<dd><p>The PUSH_PROMISE frame. It has the following members:</p>
<dlclass="member">
<dtid="nghttp2_push_promise.hd">
<aclass="reference internal"href="#nghttp2_frame_hd"title="nghttp2_frame_hd">nghttp2_frame_hd</a><ttclass="descname">hd</tt><aclass="headerlink"href="#nghttp2_push_promise.hd"title="Permalink to this definition">¶</a></dt>
<dd><p>The frame header.</p>
</dd></dl>
<dlclass="member">
<dtid="nghttp2_push_promise.promised_stream_id">
int32_t <ttclass="descname">promised_stream_id</tt><aclass="headerlink"href="#nghttp2_push_promise.promised_stream_id"title="Permalink to this definition">¶</a></dt>
<dd><p>The promised stream ID</p>
</dd></dl>
<dlclass="member">
<dtid="nghttp2_push_promise.nva">
<aclass="reference internal"href="#nghttp2_nv"title="nghttp2_nv">nghttp2_nv</a> *<ttclass="descname">nva</tt><aclass="headerlink"href="#nghttp2_push_promise.nva"title="Permalink to this definition">¶</a></dt>
<dd><p>The name/value pairs.</p>
</dd></dl>
<dlclass="member">
<dtid="nghttp2_push_promise.nvlen">
size_t <ttclass="descname">nvlen</tt><aclass="headerlink"href="#nghttp2_push_promise.nvlen"title="Permalink to this definition">¶</a></dt>
<dd><p>The number of name/value pairs in <em>nva</em>.</p>
</dd></dl>
</dd></dl>
<dlclass="type">
<dtid="nghttp2_ping">
<ttclass="descname">nghttp2_ping</tt><aclass="headerlink"href="#nghttp2_ping"title="Permalink to this definition">¶</a></dt>
<dd><p>The PING frame. It has the following members:</p>
<dlclass="member">
<dtid="nghttp2_ping.hd">
<aclass="reference internal"href="#nghttp2_frame_hd"title="nghttp2_frame_hd">nghttp2_frame_hd</a><ttclass="descname">hd</tt><aclass="headerlink"href="#nghttp2_ping.hd"title="Permalink to this definition">¶</a></dt>
<ttclass="descname">nghttp2_goaway</tt><aclass="headerlink"href="#nghttp2_goaway"title="Permalink to this definition">¶</a></dt>
<dd><p>The GOAWAY frame. It has the following members:</p>
<dlclass="member">
<dtid="nghttp2_goaway.hd">
<aclass="reference internal"href="#nghttp2_frame_hd"title="nghttp2_frame_hd">nghttp2_frame_hd</a><ttclass="descname">hd</tt><aclass="headerlink"href="#nghttp2_goaway.hd"title="Permalink to this definition">¶</a></dt>
<dd><p>The frame header.</p>
</dd></dl>
<dlclass="member">
<dtid="nghttp2_goaway.last_stream_id">
int32_t <ttclass="descname">last_stream_id</tt><aclass="headerlink"href="#nghttp2_goaway.last_stream_id"title="Permalink to this definition">¶</a></dt>
<dd><p>The last stream stream ID.</p>
</dd></dl>
<dlclass="member">
<dtid="nghttp2_goaway.error_code">
<aclass="reference internal"href="#nghttp2_error_code"title="nghttp2_error_code">nghttp2_error_code</a><ttclass="descname">error_code</tt><aclass="headerlink"href="#nghttp2_goaway.error_code"title="Permalink to this definition">¶</a></dt>
<dd><p>The error code. See <aclass="reference internal"href="#nghttp2_error_code"title="nghttp2_error_code"><ttclass="xref c c-type docutils literal"><spanclass="pre">nghttp2_error_code</span></tt></a>.</p>
</dd></dl>
<dlclass="member">
<dtid="nghttp2_goaway.opaque_data">
uint8_t *<ttclass="descname">opaque_data</tt><aclass="headerlink"href="#nghttp2_goaway.opaque_data"title="Permalink to this definition">¶</a></dt>
<dd><p>The additional debug data</p>
</dd></dl>
<dlclass="member">
<dtid="nghttp2_goaway.opaque_data_len">
size_t <ttclass="descname">opaque_data_len</tt><aclass="headerlink"href="#nghttp2_goaway.opaque_data_len"title="Permalink to this definition">¶</a></dt>
<dd><p>The length of <em>opaque_data</em> member.</p>
</dd></dl>
</dd></dl>
<dlclass="type">
<dtid="nghttp2_window_update">
<ttclass="descname">nghttp2_window_update</tt><aclass="headerlink"href="#nghttp2_window_update"title="Permalink to this definition">¶</a></dt>
<dd><p>The WINDOW_UPDATE frame. It has the following members:</p>
<dlclass="member">
<dtid="nghttp2_window_update.hd">
<aclass="reference internal"href="#nghttp2_frame_hd"title="nghttp2_frame_hd">nghttp2_frame_hd</a><ttclass="descname">hd</tt><aclass="headerlink"href="#nghttp2_window_update.hd"title="Permalink to this definition">¶</a></dt>
int32_t <ttclass="descname">window_size_increment</tt><aclass="headerlink"href="#nghttp2_window_update.window_size_increment"title="Permalink to this definition">¶</a></dt>
<dd><p>The window size increment.</p>
</dd></dl>
</dd></dl>
<dlclass="type">
<dtid="nghttp2_frame">
<ttclass="descname">nghttp2_frame</tt><aclass="headerlink"href="#nghttp2_frame"title="Permalink to this definition">¶</a></dt>
<dd><p>This union includes all frames to pass them to various function
calls as nghttp2_frame type. The DATA frame is intentionally
omitted from here.</p>
<dlclass="member">
<dtid="nghttp2_frame.hd">
<aclass="reference internal"href="#nghttp2_frame_hd"title="nghttp2_frame_hd">nghttp2_frame_hd</a><ttclass="descname">hd</tt><aclass="headerlink"href="#nghttp2_frame.hd"title="Permalink to this definition">¶</a></dt>
<dd><p>The frame header, which is convenient to inspect frame header.</p>
</dd></dl>
<dlclass="member">
<dtid="nghttp2_frame.headers">
<aclass="reference internal"href="#nghttp2_headers"title="nghttp2_headers">nghttp2_headers</a><ttclass="descname">headers</tt><aclass="headerlink"href="#nghttp2_frame.headers"title="Permalink to this definition">¶</a></dt>
<dd><p>The HEADERS frame.</p>
</dd></dl>
<dlclass="member">
<dtid="nghttp2_frame.priority">
<aclass="reference internal"href="#nghttp2_priority"title="nghttp2_priority">nghttp2_priority</a><ttclass="descname">priority</tt><aclass="headerlink"href="#nghttp2_frame.priority"title="Permalink to this definition">¶</a></dt>
<dd><p>The PRIORITY frame.</p>
</dd></dl>
<dlclass="member">
<dtid="nghttp2_frame.rst_stream">
<aclass="reference internal"href="#nghttp2_rst_stream"title="nghttp2_rst_stream">nghttp2_rst_stream</a><ttclass="descname">rst_stream</tt><aclass="headerlink"href="#nghttp2_frame.rst_stream"title="Permalink to this definition">¶</a></dt>
<dd><p>The RST_STREAM frame.</p>
</dd></dl>
<dlclass="member">
<dtid="nghttp2_frame.settings">
<aclass="reference internal"href="#nghttp2_settings"title="nghttp2_settings">nghttp2_settings</a><ttclass="descname">settings</tt><aclass="headerlink"href="#nghttp2_frame.settings"title="Permalink to this definition">¶</a></dt>
<dd><p>The SETTINGS frame.</p>
</dd></dl>
<dlclass="member">
<dtid="nghttp2_frame.push_promise">
<aclass="reference internal"href="#nghttp2_push_promise"title="nghttp2_push_promise">nghttp2_push_promise</a><ttclass="descname">push_promise</tt><aclass="headerlink"href="#nghttp2_frame.push_promise"title="Permalink to this definition">¶</a></dt>
<dd><p>The PUSH_PROMISE frame.</p>
</dd></dl>
<dlclass="member">
<dtid="nghttp2_frame.ping">
<aclass="reference internal"href="#nghttp2_ping"title="nghttp2_ping">nghttp2_ping</a><ttclass="descname">ping</tt><aclass="headerlink"href="#nghttp2_frame.ping"title="Permalink to this definition">¶</a></dt>
<dd><p>The PING frame.</p>
</dd></dl>
<dlclass="member">
<dtid="nghttp2_frame.goaway">
<aclass="reference internal"href="#nghttp2_goaway"title="nghttp2_goaway">nghttp2_goaway</a><ttclass="descname">goaway</tt><aclass="headerlink"href="#nghttp2_frame.goaway"title="Permalink to this definition">¶</a></dt>
<dd><p>The GOAWAY frame.</p>
</dd></dl>
<dlclass="member">
<dtid="nghttp2_frame.window_update">
<aclass="reference internal"href="#nghttp2_window_update"title="nghttp2_window_update">nghttp2_window_update</a><ttclass="descname">window_update</tt><aclass="headerlink"href="#nghttp2_frame.window_update"title="Permalink to this definition">¶</a></dt>
<dd><p>The WINDOW_UPDATE frame.</p>
</dd></dl>
</dd></dl>
<dlclass="type">
<dtid="nghttp2_send_callback">
typedef ssize_t <ttclass="descname">(*nghttp2_send_callback)</tt><big>(</big><aclass="reference internal"href="#nghttp2_session"title="nghttp2_session">nghttp2_session</a><em> *session</em>, const uint8_t<em> *data</em>, size_t<em> length</em>, int<em> flags</em>, void<em> *user_data</em><big>)</big><aclass="headerlink"href="#nghttp2_send_callback"title="Permalink to this definition">¶</a></dt>
<dd><p>Callback function invoked when <em>session</em> wants to send data to the
remote peer. The implementation of this function must send at most
<em>length</em> bytes of data stored in <em>data</em>. The <em>flags</em> is currently
not used and always 0. It must return the number of bytes sent if
it succeeds. If it cannot send any single byte without blocking,
it must return <aclass="reference internal"href="#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="#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="#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="#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>
typedef ssize_t <ttclass="descname">(*nghttp2_recv_callback)</tt><big>(</big><aclass="reference internal"href="#nghttp2_session"title="nghttp2_session">nghttp2_session</a><em> *session</em>, uint8_t<em> *buf</em>, size_t<em> length</em>, int<em> flags</em>, void<em> *user_data</em><big>)</big><aclass="headerlink"href="#nghttp2_recv_callback"title="Permalink to this definition">¶</a></dt>
<dd><p>Callback function invoked when <em>session</em> wants to receive data from
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="#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="#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="#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="#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="#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="#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>
typedef int <ttclass="descname">(*nghttp2_on_frame_recv_callback)</tt><big>(</big><aclass="reference internal"href="#nghttp2_session"title="nghttp2_session">nghttp2_session</a><em> *session</em>, const <aclass="reference internal"href="#nghttp2_frame"title="nghttp2_frame">nghttp2_frame</a><em> *frame</em>, void<em> *user_data</em><big>)</big><aclass="headerlink"href="#nghttp2_on_frame_recv_callback"title="Permalink to this definition">¶</a></dt>
<dd><p>Callback function invoked by <aclass="reference internal"href="#nghttp2_session_recv"title="nghttp2_session_recv"><ttclass="xref c c-func docutils literal"><spanclass="pre">nghttp2_session_recv()</span></tt></a> when a
non-DATA frame is received. The <em>user_data</em> pointer is the third
argument passed in to the call to <aclass="reference internal"href="#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="#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>The implementation of this function must return 0 if it
succeeds. If nonzero is returned, it is treated as fatal error and
<aclass="reference internal"href="#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="#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="#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>
typedef int <ttclass="descname">(*nghttp2_on_invalid_frame_recv_callback)</tt><big>(</big><aclass="reference internal"href="#nghttp2_session"title="nghttp2_session">nghttp2_session</a><em> *session</em>, const <aclass="reference internal"href="#nghttp2_frame"title="nghttp2_frame">nghttp2_frame</a><em> *frame</em>, <aclass="reference internal"href="#nghttp2_error_code"title="nghttp2_error_code">nghttp2_error_code</a><em> error_code</em>, void<em> *user_data</em><big>)</big><aclass="headerlink"href="#nghttp2_on_invalid_frame_recv_callback"title="Permalink to this definition">¶</a></dt>
<dd><p>Callback function invoked by <aclass="reference internal"href="#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> is one of the
<aclass="reference internal"href="#nghttp2_error_code"title="nghttp2_error_code"><ttclass="xref c c-macro docutils literal"><spanclass="pre">nghttp2_error_code</span></tt></a> and indicates the error. 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="#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="#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>The implementation of this function must return 0 if it
succeeds. If nonzero is returned, it is treated as fatal error and
<aclass="reference internal"href="#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="#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="#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>
typedef int <ttclass="descname">(*nghttp2_on_data_chunk_recv_callback)</tt><big>(</big><aclass="reference internal"href="#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="#nghttp2_on_data_chunk_recv_callback"title="Permalink to this definition">¶</a></dt>
<dd><p>Callback function invoked when a chunk of data in DATA frame is
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="#nghttp2_on_data_recv_callback"title="nghttp2_on_data_recv_callback"><ttclass="xref c c-type docutils literal"><spanclass="pre">nghttp2_on_data_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="#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="#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>The implementation of this function must return 0 if it
succeeds. If nonzero is returned, it is treated as fatal error and
<aclass="reference internal"href="#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="#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="#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>
typedef int <ttclass="descname">(*nghttp2_on_data_recv_callback)</tt><big>(</big><aclass="reference internal"href="#nghttp2_session"title="nghttp2_session">nghttp2_session</a><em> *session</em>, uint16_t<em> length</em>, uint8_t<em> flags</em>, int32_t<em> stream_id</em>, void<em> *user_data</em><big>)</big><aclass="headerlink"href="#nghttp2_on_data_recv_callback"title="Permalink to this definition">¶</a></dt>
<aclass="reference internal"href="#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>. The <em>user_data</em>
pointer is the third argument passed in to the call to
<aclass="reference internal"href="#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="#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>The implementation of this function must return 0 if it
succeeds. If nonzero is returned, it is treated as fatal error and
<aclass="reference internal"href="#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="#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="#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>
typedef int <ttclass="descname">(*nghttp2_before_frame_send_callback)</tt><big>(</big><aclass="reference internal"href="#nghttp2_session"title="nghttp2_session">nghttp2_session</a><em> *session</em>, const <aclass="reference internal"href="#nghttp2_frame"title="nghttp2_frame">nghttp2_frame</a><em> *frame</em>, void<em> *user_data</em><big>)</big><aclass="headerlink"href="#nghttp2_before_frame_send_callback"title="Permalink to this definition">¶</a></dt>
<dd><p>Callback function invoked before the non-DATA frame <em>frame</em> is
sent. This may be useful, for example, to know the stream ID of
HEADERS and PUSH_PROMISE frame (see also
<aclass="reference internal"href="#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>), which is not assigned
when it was queued. The <em>user_data</em> pointer is the third argument
passed in to the call to <aclass="reference internal"href="#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="#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>The implementation of this function must return 0 if it
succeeds. If nonzero is returned, it is treated as fatal error and
<aclass="reference internal"href="#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="#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="#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>
typedef int <ttclass="descname">(*nghttp2_on_frame_send_callback)</tt><big>(</big><aclass="reference internal"href="#nghttp2_session"title="nghttp2_session">nghttp2_session</a><em> *session</em>, const <aclass="reference internal"href="#nghttp2_frame"title="nghttp2_frame">nghttp2_frame</a><em> *frame</em>, void<em> *user_data</em><big>)</big><aclass="headerlink"href="#nghttp2_on_frame_send_callback"title="Permalink to this definition">¶</a></dt>
<dd><p>Callback function invoked after 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="#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="#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>The implementation of this function must return 0 if it
succeeds. If nonzero is returned, it is treated as fatal error and
<aclass="reference internal"href="#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="#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="#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>
typedef int <ttclass="descname">(*nghttp2_on_frame_not_send_callback)</tt><big>(</big><aclass="reference internal"href="#nghttp2_session"title="nghttp2_session">nghttp2_session</a><em> *session</em>, const <aclass="reference internal"href="#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="#nghttp2_on_frame_not_send_callback"title="Permalink to this definition">¶</a></dt>
<aclass="reference internal"href="#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="#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="#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>The implementation of this function must return 0 if it
succeeds. If nonzero is returned, it is treated as fatal error and
<aclass="reference internal"href="#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="#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="#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>
typedef int <ttclass="descname">(*nghttp2_on_data_send_callback)</tt><big>(</big><aclass="reference internal"href="#nghttp2_session"title="nghttp2_session">nghttp2_session</a><em> *session</em>, uint16_t<em> length</em>, uint8_t<em> flags</em>, int32_t<em> stream_id</em>, void<em> *user_data</em><big>)</big><aclass="headerlink"href="#nghttp2_on_data_send_callback"title="Permalink to this definition">¶</a></dt>
<dd><p>Callback function invoked after DATA frame is sent. The <em>user_data</em>
pointer is the third argument passed in to the call to
<aclass="reference internal"href="#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="#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>The implementation of this function must return 0 if it
succeeds. If nonzero is returned, it is treated as fatal error and
<aclass="reference internal"href="#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="#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="#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>
typedef int <ttclass="descname">(*nghttp2_on_stream_close_callback)</tt><big>(</big><aclass="reference internal"href="#nghttp2_session"title="nghttp2_session">nghttp2_session</a><em> *session</em>, int32_t<em> stream_id</em>, <aclass="reference internal"href="#nghttp2_error_code"title="nghttp2_error_code">nghttp2_error_code</a><em> error_code</em>, void<em> *user_data</em><big>)</big><aclass="headerlink"href="#nghttp2_on_stream_close_callback"title="Permalink to this definition">¶</a></dt>
closed. The reason of closure is indicated by the <em>error_code</em>. The
stream_user_data, which was specified in <aclass="reference internal"href="#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="#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="#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="#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>The implementation of this function must return 0 if it
succeeds. If nonzero is returned, it is treated as fatal error and
<aclass="reference internal"href="#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="#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="#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>
typedef int <ttclass="descname">(*nghttp2_on_request_recv_callback)</tt><big>(</big><aclass="reference internal"href="#nghttp2_session"title="nghttp2_session">nghttp2_session</a><em> *session</em>, int32_t<em> stream_id</em>, void<em> *user_data</em><big>)</big><aclass="headerlink"href="#nghttp2_on_request_recv_callback"title="Permalink to this definition">¶</a></dt>
body, is fully received. The <em>user_data</em> pointer is the third
argument passed in to the call to <aclass="reference internal"href="#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="#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>The implementation of this function must return 0 if it
succeeds. If nonzero is returned, it is treated as fatal error and
<aclass="reference internal"href="#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="#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="#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>
after the length field. The <em>lib_error_code</em> is one of the error
code defined in <aclass="reference internal"href="#nghttp2_error"title="nghttp2_error"><ttclass="xref c c-macro docutils literal"><spanclass="pre">nghttp2_error</span></tt></a> and indicates the error. The
<em>user_data</em> pointer is the third argument passed in to the call to
<aclass="reference internal"href="#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="#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>The implementation of this function must return 0 if it
succeeds. If nonzero is returned, it is treated as fatal error and
<aclass="reference internal"href="#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="#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="#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>
typedef int <ttclass="descname">(*nghttp2_on_unknown_frame_recv_callback)</tt><big>(</big><aclass="reference internal"href="#nghttp2_session"title="nghttp2_session">nghttp2_session</a><em> *session</em>, const uint8_t<em> *head</em>, size_t<em> headlen</em>, const uint8_t<em> *payload</em>, size_t<em> payloadlen</em>, void<em> *user_data</em><big>)</big><aclass="headerlink"href="#nghttp2_on_unknown_frame_recv_callback"title="Permalink to this definition">¶</a></dt>
length of the <em>payload</em>. This is the data after the length
field. The <em>user_data</em> pointer is the third argument passed in to
the call to <aclass="reference internal"href="#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="#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>The implementation of this function must return 0 if it
succeeds. If nonzero is returned, it is treated as fatal error and
<aclass="reference internal"href="#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="#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="#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>
<ttclass="descname">nghttp2_session_callbacks</tt><aclass="headerlink"href="#nghttp2_session_callbacks"title="Permalink to this definition">¶</a></dt>
<dd><p>Callback functions.</p>
<dlclass="member">
<dtid="nghttp2_session_callbacks.send_callback">
<aclass="reference internal"href="#nghttp2_send_callback"title="nghttp2_send_callback">nghttp2_send_callback</a><ttclass="descname">send_callback</tt><aclass="headerlink"href="#nghttp2_session_callbacks.send_callback"title="Permalink to this definition">¶</a></dt>
<dd><p>Callback function invoked when the <em>session</em> wants to send data
to the remote peer.</p>
</dd></dl>
<dlclass="member">
<dtid="nghttp2_session_callbacks.recv_callback">
<aclass="reference internal"href="#nghttp2_recv_callback"title="nghttp2_recv_callback">nghttp2_recv_callback</a><ttclass="descname">recv_callback</tt><aclass="headerlink"href="#nghttp2_session_callbacks.recv_callback"title="Permalink to this definition">¶</a></dt>
<dd><p>Callback function invoked when the <em>session</em> wants to receive
<aclass="reference internal"href="#nghttp2_on_frame_recv_callback"title="nghttp2_on_frame_recv_callback">nghttp2_on_frame_recv_callback</a><ttclass="descname">on_frame_recv_callback</tt><aclass="headerlink"href="#nghttp2_session_callbacks.on_frame_recv_callback"title="Permalink to this definition">¶</a></dt>
<dd><p>Callback function invoked by <aclass="reference internal"href="#nghttp2_session_recv"title="nghttp2_session_recv"><ttclass="xref c c-func docutils literal"><spanclass="pre">nghttp2_session_recv()</span></tt></a> when a
<aclass="reference internal"href="#nghttp2_on_invalid_frame_recv_callback"title="nghttp2_on_invalid_frame_recv_callback">nghttp2_on_invalid_frame_recv_callback</a><ttclass="descname">on_invalid_frame_recv_callback</tt><aclass="headerlink"href="#nghttp2_session_callbacks.on_invalid_frame_recv_callback"title="Permalink to this definition">¶</a></dt>
<dd><p>Callback function invoked by <aclass="reference internal"href="#nghttp2_session_recv"title="nghttp2_session_recv"><ttclass="xref c c-func docutils literal"><spanclass="pre">nghttp2_session_recv()</span></tt></a> when an
<aclass="reference internal"href="#nghttp2_on_data_chunk_recv_callback"title="nghttp2_on_data_chunk_recv_callback">nghttp2_on_data_chunk_recv_callback</a><ttclass="descname">on_data_chunk_recv_callback</tt><aclass="headerlink"href="#nghttp2_session_callbacks.on_data_chunk_recv_callback"title="Permalink to this definition">¶</a></dt>
<dd><p>Callback function invoked when a chunk of data in DATA frame is
<aclass="reference internal"href="#nghttp2_on_data_recv_callback"title="nghttp2_on_data_recv_callback">nghttp2_on_data_recv_callback</a><ttclass="descname">on_data_recv_callback</tt><aclass="headerlink"href="#nghttp2_session_callbacks.on_data_recv_callback"title="Permalink to this definition">¶</a></dt>
<dd><p>Callback function invoked when DATA frame is received.</p>
<aclass="reference internal"href="#nghttp2_before_frame_send_callback"title="nghttp2_before_frame_send_callback">nghttp2_before_frame_send_callback</a><ttclass="descname">before_frame_send_callback</tt><aclass="headerlink"href="#nghttp2_session_callbacks.before_frame_send_callback"title="Permalink to this definition">¶</a></dt>
<dd><p>Callback function invoked before the non-DATA frame is sent.</p>
<aclass="reference internal"href="#nghttp2_on_frame_send_callback"title="nghttp2_on_frame_send_callback">nghttp2_on_frame_send_callback</a><ttclass="descname">on_frame_send_callback</tt><aclass="headerlink"href="#nghttp2_session_callbacks.on_frame_send_callback"title="Permalink to this definition">¶</a></dt>
<dd><p>Callback function invoked after the non-DATA frame is sent.</p>
<aclass="reference internal"href="#nghttp2_on_frame_not_send_callback"title="nghttp2_on_frame_not_send_callback">nghttp2_on_frame_not_send_callback</a><ttclass="descname">on_frame_not_send_callback</tt><aclass="headerlink"href="#nghttp2_session_callbacks.on_frame_not_send_callback"title="Permalink to this definition">¶</a></dt>
<dd><p>The callback function invoked when a non-DATA frame is not sent
<aclass="reference internal"href="#nghttp2_on_data_send_callback"title="nghttp2_on_data_send_callback">nghttp2_on_data_send_callback</a><ttclass="descname">on_data_send_callback</tt><aclass="headerlink"href="#nghttp2_session_callbacks.on_data_send_callback"title="Permalink to this definition">¶</a></dt>
<dd><p>Callback function invoked after DATA frame is sent.</p>
<aclass="reference internal"href="#nghttp2_on_stream_close_callback"title="nghttp2_on_stream_close_callback">nghttp2_on_stream_close_callback</a><ttclass="descname">on_stream_close_callback</tt><aclass="headerlink"href="#nghttp2_session_callbacks.on_stream_close_callback"title="Permalink to this definition">¶</a></dt>
<dd><p>Callback function invoked when the stream is closed.</p>
<aclass="reference internal"href="#nghttp2_on_request_recv_callback"title="nghttp2_on_request_recv_callback">nghttp2_on_request_recv_callback</a><ttclass="descname">on_request_recv_callback</tt><aclass="headerlink"href="#nghttp2_session_callbacks.on_request_recv_callback"title="Permalink to this definition">¶</a></dt>
<dd><p>Callback function invoked when request from the remote peer is
<ttclass="descname">nghttp2_on_frame_recv_parse_error_callback</tt><aclass="headerlink"href="#nghttp2_session_callbacks.nghttp2_on_frame_recv_parse_error_callback"title="Permalink to this definition">¶</a></dt>
<dd><p>Callback function invoked when the received non-DATA frame octets
<aclass="reference internal"href="#nghttp2_on_unknown_frame_recv_callback"title="nghttp2_on_unknown_frame_recv_callback">nghttp2_on_unknown_frame_recv_callback</a><ttclass="descname">on_unknown_frame_recv_callback</tt><aclass="headerlink"href="#nghttp2_session_callbacks.on_unknown_frame_recv_callback"title="Permalink to this definition">¶</a></dt>
<dd><p>Callback function invoked when the received frame type is
unknown.</p>
</dd></dl>
</dd></dl>
<dlclass="type">
<dtid="nghttp2_gzip">
<ttclass="descname">nghttp2_gzip</tt><aclass="headerlink"href="#nghttp2_gzip"title="Permalink to this definition">¶</a></dt>
<dd><p>The gzip stream to inflate data. The details of this structure are
intentionally hidden from the public API.</p>
</dd></dl>
</div>
<divclass="section"id="functions">
<h2>Functions<aclass="headerlink"href="#functions"title="Permalink to this headline">¶</a></h2>
<dlclass="function">
<dtid="nghttp2_session_client_new">
int <ttclass="descname">nghttp2_session_client_new</tt><big>(</big><aclass="reference internal"href="#nghttp2_session"title="nghttp2_session">nghttp2_session</a><em> **session_ptr</em>, const <aclass="reference internal"href="#nghttp2_session_callbacks"title="nghttp2_session_callbacks">nghttp2_session_callbacks</a><em> *callbacks</em>, void<em> *user_data</em><big>)</big><aclass="headerlink"href="#nghttp2_session_client_new"title="Permalink to this definition">¶</a></dt>
<dd><p>Initializes <em>*session_ptr</em> for client use. The all members of
<em>callbacks</em> are copied to <em>*session_ptr</em>. Therefore <em>*session_ptr</em>
does not store <em>callbacks</em>. <em>user_data</em> is an arbitrary user
supplied data, which will be passed to the callback functions.</p>
<p>The <aclass="reference internal"href="#nghttp2_session_callbacks.send_callback"title="nghttp2_session_callbacks.send_callback"><ttclass="xref c c-member docutils literal"><spanclass="pre">nghttp2_session_callbacks.send_callback</span></tt></a> must be
specified. If the application code uses <aclass="reference internal"href="#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="#nghttp2_session_callbacks.recv_callback"title="nghttp2_session_callbacks.recv_callback"><ttclass="xref c c-member docutils literal"><spanclass="pre">nghttp2_session_callbacks.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>
<p>This function returns 0 if it succeeds, or one of the following
negative error codes:</p>
<dlclass="docutils">
<dt><aclass="reference internal"href="#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="nghttp2_session_server_new">
int <ttclass="descname">nghttp2_session_server_new</tt><big>(</big><aclass="reference internal"href="#nghttp2_session"title="nghttp2_session">nghttp2_session</a><em> **session_ptr</em>, const <aclass="reference internal"href="#nghttp2_session_callbacks"title="nghttp2_session_callbacks">nghttp2_session_callbacks</a><em> *callbacks</em>, void<em> *user_data</em><big>)</big><aclass="headerlink"href="#nghttp2_session_server_new"title="Permalink to this definition">¶</a></dt>
<dd><p>Initializes <em>*session_ptr</em> for server use. The all members of
<em>callbacks</em> are copied to <em>*session_ptr</em>. Therefore <em>*session_ptr</em>
does not store <em>callbacks</em>. <em>user_data</em> is an arbitrary user
supplied data, which will be passed to the callback functions.</p>
<p>The <aclass="reference internal"href="#nghttp2_session_callbacks.send_callback"title="nghttp2_session_callbacks.send_callback"><ttclass="xref c c-member docutils literal"><spanclass="pre">nghttp2_session_callbacks.send_callback</span></tt></a> must be
specified. If the application code uses <aclass="reference internal"href="#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="#nghttp2_session_callbacks.recv_callback"title="nghttp2_session_callbacks.recv_callback"><ttclass="xref c c-member docutils literal"><spanclass="pre">nghttp2_session_callbacks.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>
<p>This function returns 0 if it succeeds, or one of the following
negative error codes:</p>
<dlclass="docutils">
<dt><aclass="reference internal"href="#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="nghttp2_session_del">
void <ttclass="descname">nghttp2_session_del</tt><big>(</big><aclass="reference internal"href="#nghttp2_session"title="nghttp2_session">nghttp2_session</a><em> *session</em><big>)</big><aclass="headerlink"href="#nghttp2_session_del"title="Permalink to this definition">¶</a></dt>
<dd><p>Frees any resources allocated for <em>session</em>. If <em>session</em> is
<ttclass="docutils literal"><spanclass="pre">NULL</span></tt>, this function does nothing.</p>
</dd></dl>
<dlclass="function">
<dtid="nghttp2_session_set_option">
int <ttclass="descname">nghttp2_session_set_option</tt><big>(</big><aclass="reference internal"href="#nghttp2_session"title="nghttp2_session">nghttp2_session</a><em> *session</em>, int<em> optname</em>, void<em> *optval</em>, size_t<em> optlen</em><big>)</big><aclass="headerlink"href="#nghttp2_session_set_option"title="Permalink to this definition">¶</a></dt>
<dd><p>Sets the configuration option for the <em>session</em>. The <em>optname</em> is
one of <aclass="reference internal"href="#nghttp2_opt"title="nghttp2_opt"><ttclass="xref c c-type docutils literal"><spanclass="pre">nghttp2_opt</span></tt></a>. The <em>optval</em> is the pointer to the
option value and the <em>optlen</em> is the size of <em>*optval</em>. The
required type of <em>optval</em> varies depending on the <em>optname</em>. See
below.</p>
<p>The following <em>optname</em> are supported:</p>
<dt><aclass="reference internal"href="#NGHTTP2_OPT_NO_AUTO_STREAM_WINDOW_UPDATE"title="NGHTTP2_OPT_NO_AUTO_STREAM_WINDOW_UPDATE"><ttclass="xref c c-macro docutils literal"><spanclass="pre">NGHTTP2_OPT_NO_AUTO_STREAM_WINDOW_UPDATE</span></tt></a></dt>
<dd>The <em>optval</em> must be a pointer to <ttclass="docutils literal"><spanclass="pre">int</span></tt>. If the <em>*optval</em> is
nonzero, the library will not send WINDOW_UPDATE for a stream
automatically. Therefore, the application is responsible for
sending WINDOW_UPDATE using
<aclass="reference internal"href="#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 option defaults to 0.</dd>
<dt><aclass="reference internal"href="#NGHTTP2_OPT_NO_AUTO_CONNECTION_WINDOW_UPDATE"title="NGHTTP2_OPT_NO_AUTO_CONNECTION_WINDOW_UPDATE"><ttclass="xref c c-macro docutils literal"><spanclass="pre">NGHTTP2_OPT_NO_AUTO_CONNECTION_WINDOW_UPDATE</span></tt></a></dt>
nonzero, the library will not send WINDOW_UPDATE for connection
automatically. Therefore, the application is responsible for
sending WINDOW_UPDATE using
<aclass="reference internal"href="#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 option defaults to 0.</dd>
<p>This function returns 0 if it succeeds, or one of the following
negative error codes:</p>
<dlclass="docutils">
<dt><aclass="reference internal"href="#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>optname</em> is not supported; or the <em>optval</em> and/or the
<em>optlen</em> are invalid.</dd>
</dl>
</dd></dl>
<dlclass="function">
<dtid="nghttp2_session_send">
int <ttclass="descname">nghttp2_session_send</tt><big>(</big><aclass="reference internal"href="#nghttp2_session"title="nghttp2_session">nghttp2_session</a><em> *session</em><big>)</big><aclass="headerlink"href="#nghttp2_session_send"title="Permalink to this definition">¶</a></dt>
<dd><p>Sends pending frames to the remote peer.</p>
<p>This function retrieves the highest prioritized frame from the
outbound queue and sends it to the remote peer. It does this as
many as possible until the user callback
<aclass="reference internal"href="#nghttp2_session_callbacks.send_callback"title="nghttp2_session_callbacks.send_callback"><ttclass="xref c c-member docutils literal"><spanclass="pre">nghttp2_session_callbacks.send_callback</span></tt></a> returns
<aclass="reference internal"href="#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.
This function calls several callback functions which are passed
when initializing the <em>session</em>. Here is the simple time chart
which tells when each callback is invoked:</p>
<olclass="arabic simple">
<li>Get the next frame to send from outbound queue.</li>
<li>Prepare transmission of the frame.</li>
<li>If the control frame cannot be sent because some preconditions
are not met (e.g., request HEADERS cannot be sent after
GOAWAY),
<ttclass="xref c c-member docutils literal"><spanclass="pre">nghttp2_session_callbacks.on_ctrl_not_send_callback</span></tt> is
invoked. Abort the following steps.</li>
<li>If the frame is request HEADERS, the stream is opened
here.</li>
<li><ttclass="xref c c-member docutils literal"><spanclass="pre">nghttp2_session_callbacks.before_ctrl_send_callback</span></tt> is
invoked.</li>
<li><aclass="reference internal"href="#nghttp2_session_callbacks.send_callback"title="nghttp2_session_callbacks.send_callback"><ttclass="xref c c-member docutils literal"><spanclass="pre">nghttp2_session_callbacks.send_callback</span></tt></a> is invoked one
or more times to send the frame.</li>
<li>If the frame is a control frame,
<ttclass="xref c c-member docutils literal"><spanclass="pre">nghttp2_session_callbacks.on_ctrl_send_callback</span></tt> is
invoked.</li>
<li>If the frame is a DATA frame,
<aclass="reference internal"href="#nghttp2_session_callbacks.on_data_send_callback"title="nghttp2_session_callbacks.on_data_send_callback"><ttclass="xref c c-member docutils literal"><spanclass="pre">nghttp2_session_callbacks.on_data_send_callback</span></tt></a> is
invoked.</li>
<li>If the transmission of the frame triggers closure of the stream,
the stream is closed and
<aclass="reference internal"href="#nghttp2_session_callbacks.on_stream_close_callback"title="nghttp2_session_callbacks.on_stream_close_callback"><ttclass="xref c c-member docutils literal"><spanclass="pre">nghttp2_session_callbacks.on_stream_close_callback</span></tt></a> is
invoked.</li>
</ol>
<p>This function returns 0 if it succeeds, or one of the following
negative error codes:</p>
<dlclass="docutils">
<dt><aclass="reference internal"href="#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="#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></dt>
<dd>The callback function failed.</dd>
</dl>
</dd></dl>
<dlclass="function">
<dtid="nghttp2_session_recv">
int <ttclass="descname">nghttp2_session_recv</tt><big>(</big><aclass="reference internal"href="#nghttp2_session"title="nghttp2_session">nghttp2_session</a><em> *session</em><big>)</big><aclass="headerlink"href="#nghttp2_session_recv"title="Permalink to this definition">¶</a></dt>
<dd><p>Receives frames from the remote peer.</p>
<p>This function receives as many frames as possible until the user
callback <aclass="reference internal"href="#nghttp2_session_callbacks.recv_callback"title="nghttp2_session_callbacks.recv_callback"><ttclass="xref c c-member docutils literal"><spanclass="pre">nghttp2_session_callbacks.recv_callback</span></tt></a> returns
<aclass="reference internal"href="#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
callback functions which are passed when initializing the
<em>session</em>. Here is the simple time chart which tells when each
callback is invoked:</p>
<olclass="arabic simple">
<li><aclass="reference internal"href="#nghttp2_session_callbacks.recv_callback"title="nghttp2_session_callbacks.recv_callback"><ttclass="xref c c-member docutils literal"><spanclass="pre">nghttp2_session_callbacks.recv_callback</span></tt></a> is invoked one
or more times to receive frame header.</li>
<li>If the frame is DATA frame:</li>
</ol>
<blockquote>
<div><dlclass="docutils">
<dt>2.1. <aclass="reference internal"href="#nghttp2_session_callbacks.recv_callback"title="nghttp2_session_callbacks.recv_callback"><ttclass="xref c c-member docutils literal"><spanclass="pre">nghttp2_session_callbacks.recv_callback</span></tt></a> is invoked</dt>
<dd>to receive DATA payload. For each chunk of data,
<aclass="reference internal"href="#nghttp2_session_callbacks.on_data_chunk_recv_callback"title="nghttp2_session_callbacks.on_data_chunk_recv_callback"><ttclass="xref c c-member docutils literal"><spanclass="pre">nghttp2_session_callbacks.on_data_chunk_recv_callback</span></tt></a>
is invoked.</dd>
<dt>2.2. If one DATA frame is completely received,</dt>
<dd><aclass="reference internal"href="#nghttp2_session_callbacks.on_data_recv_callback"title="nghttp2_session_callbacks.on_data_recv_callback"><ttclass="xref c c-member docutils literal"><spanclass="pre">nghttp2_session_callbacks.on_data_recv_callback</span></tt></a> is
invoked. If the frame is the final frame of the request,
<aclass="reference internal"href="#nghttp2_session_callbacks.on_request_recv_callback"title="nghttp2_session_callbacks.on_request_recv_callback"><ttclass="xref c c-member docutils literal"><spanclass="pre">nghttp2_session_callbacks.on_request_recv_callback</span></tt></a>
is invoked. If the reception of the frame triggers the
closure of the stream,
<aclass="reference internal"href="#nghttp2_session_callbacks.on_stream_close_callback"title="nghttp2_session_callbacks.on_stream_close_callback"><ttclass="xref c c-member docutils literal"><spanclass="pre">nghttp2_session_callbacks.on_stream_close_callback</span></tt></a>
is invoked.</dd>
</dl>
</div></blockquote>
<olclass="arabic simple"start="3">
<li>If the frame is the control frame:</li>
</ol>
<blockquote>
<div><dlclass="docutils">
<dt>3.1. <aclass="reference internal"href="#nghttp2_session_callbacks.recv_callback"title="nghttp2_session_callbacks.recv_callback"><ttclass="xref c c-member docutils literal"><spanclass="pre">nghttp2_session_callbacks.recv_callback</span></tt></a> is invoked</dt>
<dd>one or more times to receive whole frame.</dd>
<dt>3.2. If the received frame is valid,</dt>
<dd><ttclass="xref c c-member docutils literal"><spanclass="pre">nghttp2_session_callbacks.on_ctrl_recv_callback</span></tt> is
invoked. If the frame is the final frame of the request,
<aclass="reference internal"href="#nghttp2_session_callbacks.on_request_recv_callback"title="nghttp2_session_callbacks.on_request_recv_callback"><ttclass="xref c c-member docutils literal"><spanclass="pre">nghttp2_session_callbacks.on_request_recv_callback</span></tt></a>
is invoked. If the reception of the frame triggers the
closure of the stream,
<aclass="reference internal"href="#nghttp2_session_callbacks.on_stream_close_callback"title="nghttp2_session_callbacks.on_stream_close_callback"><ttclass="xref c c-member docutils literal"><spanclass="pre">nghttp2_session_callbacks.on_stream_close_callback</span></tt></a>
is invoked.</dd>
<dt>3.3. If the received frame is unpacked but is interpreted as</dt>
<dd>invalid,
<ttclass="xref c c-member docutils literal"><spanclass="pre">nghttp2_session_callbacks.on_invalid_ctrl_recv_callback</span></tt>
is invoked.</dd>
<dt>3.4. If the received frame could not be unpacked correctly,</dt>
<dd><ttclass="xref c c-member docutils literal"><spanclass="pre">nghttp2_session_callbacks.on_ctrl_recv_parse_error_callback</span></tt>
is invoked.</dd>
<dt>3.5. If the received frame type is unknown,</dt>
<dd><ttclass="xref c c-member docutils literal"><spanclass="pre">nghttp2_session_callbacks.on_unknown_ctrl_recv_callback</span></tt>
is invoked.</dd>
</dl>
</div></blockquote>
<p>This function returns 0 if it succeeds, or one of the following
negative error codes:</p>
<dlclass="docutils">
<dt><aclass="reference internal"href="#NGHTTP2_ERR_EOF"title="NGHTTP2_ERR_EOF"><ttclass="xref c c-macro docutils literal"><spanclass="pre">NGHTTP2_ERR_EOF</span></tt></a></dt>
<dd>The remote peer did shutdown on the connection.</dd>
<dt><aclass="reference internal"href="#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="#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></dt>
<dd>The callback function failed.</dd>
</dl>
</dd></dl>
<dlclass="function">
<dtid="nghttp2_session_mem_recv">
ssize_t <ttclass="descname">nghttp2_session_mem_recv</tt><big>(</big><aclass="reference internal"href="#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="#nghttp2_session_mem_recv"title="Permalink to this definition">¶</a></dt>
<dd><p>Processes data <em>in</em> as an input from the remote endpoint. The
<em>inlen</em> indicates the number of bytes in the <em>in</em>.</p>
<p>This function behaves like <aclass="reference internal"href="#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="#nghttp2_session_callbacks.recv_callback"title="nghttp2_session_callbacks.recv_callback"><ttclass="xref c c-member docutils literal"><spanclass="pre">nghttp2_session_callbacks.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="#nghttp2_session_recv"title="nghttp2_session_recv"><ttclass="xref c c-func docutils literal"><spanclass="pre">nghttp2_session_recv()</span></tt></a>.</p>
<p>In the current implementation, this function always tries to
processes all input data unless an error occurs.</p>
<p>This function returns the number of processed bytes, or one of the
following negative error codes:</p>
<dlclass="docutils">
<dt><aclass="reference internal"href="#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="nghttp2_session_resume_data">
int <ttclass="descname">nghttp2_session_resume_data</tt><big>(</big><aclass="reference internal"href="#nghttp2_session"title="nghttp2_session">nghttp2_session</a><em> *session</em>, int32_t<em> stream_id</em><big>)</big><aclass="headerlink"href="#nghttp2_session_resume_data"title="Permalink to this definition">¶</a></dt>
<dd><p>Puts back previously deferred DATA frame in the stream <em>stream_id</em>
to the outbound queue.</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="#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 stream does not exist or no deferred data exist.</dd>
<dt><aclass="reference internal"href="#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="nghttp2_session_want_read">
int <ttclass="descname">nghttp2_session_want_read</tt><big>(</big><aclass="reference internal"href="#nghttp2_session"title="nghttp2_session">nghttp2_session</a><em> *session</em><big>)</big><aclass="headerlink"href="#nghttp2_session_want_read"title="Permalink to this definition">¶</a></dt>
<dd><p>Returns nonzero value if <em>session</em> wants to receive data from the
remote peer.</p>
<p>If both <aclass="reference internal"href="#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="#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
drop the connection.</p>
</dd></dl>
<dlclass="function">
<dtid="nghttp2_session_want_write">
int <ttclass="descname">nghttp2_session_want_write</tt><big>(</big><aclass="reference internal"href="#nghttp2_session"title="nghttp2_session">nghttp2_session</a><em> *session</em><big>)</big><aclass="headerlink"href="#nghttp2_session_want_write"title="Permalink to this definition">¶</a></dt>
<dd><p>Returns nonzero value if <em>session</em> wants to send data to the remote
peer.</p>
<p>If both <aclass="reference internal"href="#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="#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
drop the connection.</p>
</dd></dl>
<dlclass="function">
<dtid="nghttp2_session_get_stream_user_data">
void* <ttclass="descname">nghttp2_session_get_stream_user_data</tt><big>(</big><aclass="reference internal"href="#nghttp2_session"title="nghttp2_session">nghttp2_session</a><em> *session</em>, int32_t<em> stream_id</em><big>)</big><aclass="headerlink"href="#nghttp2_session_get_stream_user_data"title="Permalink to this definition">¶</a></dt>
<dd><p>Returns stream_user_data for the stream <em>stream_id</em>. The
stream_user_data is provided by <aclass="reference internal"href="#nghttp2_submit_request"title="nghttp2_submit_request"><ttclass="xref c c-func docutils literal"><spanclass="pre">nghttp2_submit_request()</span></tt></a> or
<ttclass="xref c c-func docutils literal"><spanclass="pre">nghttp2_submit_syn_stream()</span></tt>. If the stream is initiated by the
remote endpoint, stream_user_data is always <ttclass="docutils literal"><spanclass="pre">NULL</span></tt>. If the stream
is initiated by the local endpoint and <ttclass="docutils literal"><spanclass="pre">NULL</span></tt> is given in
<aclass="reference internal"href="#nghttp2_submit_request"title="nghttp2_submit_request"><ttclass="xref c c-func docutils literal"><spanclass="pre">nghttp2_submit_request()</span></tt></a> or <ttclass="xref c c-func docutils literal"><spanclass="pre">nghttp2_submit_syn_stream()</span></tt>, then
this function returns <ttclass="docutils literal"><spanclass="pre">NULL</span></tt>. If the stream does not exist, this
function returns <ttclass="docutils literal"><spanclass="pre">NULL</span></tt>.</p>
</dd></dl>
<dlclass="function">
<dtid="nghttp2_session_get_outbound_queue_size">
size_t <ttclass="descname">nghttp2_session_get_outbound_queue_size</tt><big>(</big><aclass="reference internal"href="#nghttp2_session"title="nghttp2_session">nghttp2_session</a><em> *session</em><big>)</big><aclass="headerlink"href="#nghttp2_session_get_outbound_queue_size"title="Permalink to this definition">¶</a></dt>
<dd><p>Returns the number of frames in the outbound queue. This does not
include the deferred DATA frames.</p>
</dd></dl>
<dlclass="function">
<dtid="nghttp2_session_fail_session">
int <ttclass="descname">nghttp2_session_fail_session</tt><big>(</big><aclass="reference internal"href="#nghttp2_session"title="nghttp2_session">nghttp2_session</a><em> *session</em>, <aclass="reference internal"href="#nghttp2_error_code"title="nghttp2_error_code">nghttp2_error_code</a><em> error_code</em><big>)</big><aclass="headerlink"href="#nghttp2_session_fail_session"title="Permalink to this definition">¶</a></dt>
<dd><p>Submits GOAWAY frame with the given <em>error_code</em>.</p>
<p>This function should be called when the connection should be
terminated after sending GOAWAY. If the remaining streams should be
processed after GOAWAY, use <aclass="reference internal"href="#nghttp2_submit_goaway"title="nghttp2_submit_goaway"><ttclass="xref c c-func docutils literal"><spanclass="pre">nghttp2_submit_goaway()</span></tt></a> instead.</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="#NGHTTP2_ERR_NOMEM"title="NGHTTP2_ERR_NOMEM"><ttclass="xref c c-macro docutils literal"><spanclass="pre">NGHTTP2_ERR_NOMEM</span></tt></a></dt>
int <ttclass="descname">nghttp2_session_upgrade</tt><big>(</big><aclass="reference internal"href="#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="#nghttp2_session_upgrade"title="Permalink to this definition">¶</a></dt>
<dd><p>Performs post-process of HTTP Upgrade request. This function can be
called from both client and server, but the behavior is very
different in each other.</p>
<p>If called from client side, the <em>settings_payload</em> must be the
<aclass="reference internal"href="#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
<aclass="reference internal"href="#NGHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS"title="NGHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS"><ttclass="xref c c-macro docutils literal"><spanclass="pre">NGHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS</span></tt></a> and
<aclass="reference internal"href="#NGHTTP2_SETTINGS_INITIAL_WINDOW_SIZE"title="NGHTTP2_SETTINGS_INITIAL_WINDOW_SIZE"><ttclass="xref c c-macro docutils literal"><spanclass="pre">NGHTTP2_SETTINGS_INITIAL_WINDOW_SIZE</span></tt></a>.</dd>
ssize_t <ttclass="descname">nghttp2_pack_settings_payload</tt><big>(</big>uint8_t<em> *buf</em>, <aclass="reference internal"href="#nghttp2_settings_entry"title="nghttp2_settings_entry">nghttp2_settings_entry</a><em> *iv</em>, size_t<em> niv</em><big>)</big><aclass="headerlink"href="#nghttp2_pack_settings_payload"title="Permalink to this definition">¶</a></dt>
<dd><p>Serializes the SETTINGS values <em>iv</em> in the <em>buf</em>. The number of
entry pointed by <em>iv</em> array is given by the <em>niv</em>. This function
may reorder the pointers in <em>iv</em>. The <em>buf</em> must have enough region
to hold serialized data. The required space for the <em>niv</em> entries
const char* <ttclass="descname">nghttp2_strerror</tt><big>(</big>int<em> lib_error_code</em><big>)</big><aclass="headerlink"href="#nghttp2_strerror"title="Permalink to this definition">¶</a></dt>
<dd><p>Returns string describing the <em>lib_error_code</em>. The
<em>lib_error_code</em> must be one of the <aclass="reference internal"href="#nghttp2_error"title="nghttp2_error"><ttclass="xref c c-macro docutils literal"><spanclass="pre">nghttp2_error</span></tt></a>.</p>
</dd></dl>
<dlclass="function">
<dtid="nghttp2_submit_request">
int <ttclass="descname">nghttp2_submit_request</tt><big>(</big><aclass="reference internal"href="#nghttp2_session"title="nghttp2_session">nghttp2_session</a><em> *session</em>, int32_t<em> pri</em>, const char<em> **nv</em>, const <aclass="reference internal"href="#nghttp2_data_provider"title="nghttp2_data_provider">nghttp2_data_provider</a><em> *data_prd</em>, void<em> *stream_user_data</em><big>)</big><aclass="headerlink"href="#nghttp2_submit_request"title="Permalink to this definition">¶</a></dt>
<dd><p>Submits HEADERS frame and optionally one or more DATA frames.</p>
<p>The <em>pri</em> is priority of this request. 0 is the highest priority
value and <aclass="reference internal"href="#NGHTTP2_PRI_LOWEST"title="NGHTTP2_PRI_LOWEST"><ttclass="xref c c-macro docutils literal"><spanclass="pre">NGHTTP2_PRI_LOWEST</span></tt></a> is the lowest value.</p>
<dd>The hostport portion of the URI for this request (e.g.,
<ttclass="docutils literal"><spanclass="pre">example.org:443</span></tt>). This is the same as the HTTP “Host” header
field.</dd>
</dl>
<p>This function creates copies of all name/value pairs in <em>nv</em>. It
also lower-cases all names in <em>nv</em>.</p>
<p>If <em>data_prd</em> is not <ttclass="docutils literal"><spanclass="pre">NULL</span></tt>, it provides data which will be sent
in subsequent DATA frames. In this case, a method that allows
request message bodies
(<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>nv</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
associated to the stream opened by this request and can be an
arbitrary pointer, which can be retrieved later by
<aclass="reference internal"href="#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>.</p>
<p>Since the library reorders the frames and tries to send the highest
prioritized one first and the HTTP/2.0 specification requires the
stream ID must be strictly increasing, the stream ID of this
request cannot be known until it is about to sent. To know the
stream ID of the request, the application can use
<ttclass="xref c c-member docutils literal"><spanclass="pre">nghttp2_session_callbacks.before_ctrl_send_callback</span></tt>. This
callback is called just before the frame is sent. For HEADERS
frame, the argument frame has the stream ID assigned. Also since
the stream is already opened,
<aclass="reference internal"href="#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
<em>stream_user_data</em> to identify which HEADERS we are processing.</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="#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>
<dt><aclass="reference internal"href="#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="nghttp2_submit_response">
int <ttclass="descname">nghttp2_submit_response</tt><big>(</big><aclass="reference internal"href="#nghttp2_session"title="nghttp2_session">nghttp2_session</a><em> *session</em>, int32_t<em> stream_id</em>, const char<em> **nv</em>, const <aclass="reference internal"href="#nghttp2_data_provider"title="nghttp2_data_provider">nghttp2_data_provider</a><em> *data_prd</em><big>)</big><aclass="headerlink"href="#nghttp2_submit_response"title="Permalink to this definition">¶</a></dt>
<dd><p>Submits response HEADERS frame and optionally one or more DATA
frames against the stream <em>stream_id</em>.</p>
<p>The <em>nv</em> contains the name/value pairs. For i >= 0, <ttclass="docutils literal"><spanclass="pre">nv[2*i]</span></tt>
contains a pointer to the name string and <ttclass="docutils literal"><spanclass="pre">nv[2*i+1]</span></tt> contains a
pointer to the value string. The one beyond last value must be
<ttclass="docutils literal"><spanclass="pre">NULL</span></tt>. That is, if the <em>nv</em> contains N name/value pairs,
<ttclass="docutils literal"><spanclass="pre">nv[2*N]</span></tt> must be <ttclass="docutils literal"><spanclass="pre">NULL</span></tt>.</p>
<p>The <em>nv</em> must include following name/value pairs:</p>
<dd>HTTP status code (e.g., <ttclass="docutils literal"><spanclass="pre">200</span></tt> or <ttclass="docutils literal"><spanclass="pre">200</span><spanclass="pre">OK</span></tt>)</dd>
</dl>
<p>This function creates copies of all name/value pairs in <em>nv</em>. It
also lower-cases all names in <em>nv</em>.</p>
<p>If <em>data_prd</em> is not <ttclass="docutils literal"><spanclass="pre">NULL</span></tt>, it provides data which will be sent
in subsequent DATA frames. 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 will have
END_STREAM flag set.</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="#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>
<dt><aclass="reference internal"href="#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="nghttp2_submit_headers">
int <ttclass="descname">nghttp2_submit_headers</tt><big>(</big><aclass="reference internal"href="#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> pri</em>, const char<em> **nv</em>, void<em> *stream_user_data</em><big>)</big><aclass="headerlink"href="#nghttp2_submit_headers"title="Permalink to this definition">¶</a></dt>
<dd><p>Submits HEADERS frame. The <em>flags</em> is bitwise OR of the
following values:</p>
<ulclass="simple">
<li><aclass="reference internal"href="#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></li>
<li><aclass="reference internal"href="#NGHTTP2_FLAG_PRIORITY"title="NGHTTP2_FLAG_PRIORITY"><ttclass="xref c c-macro docutils literal"><spanclass="pre">NGHTTP2_FLAG_PRIORITY</span></tt></a></li>
</ul>
<p>If <em>flags</em> includes <aclass="reference internal"href="#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
END_STREAM flag set. The library does not support header
continuation and the HEADERS frame always has
<aclass="reference internal"href="#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 regardless of the <em>flags</em>
<aclass="reference internal"href="#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>
<dt><aclass="reference internal"href="#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="nghttp2_submit_data">
int <ttclass="descname">nghttp2_submit_data</tt><big>(</big><aclass="reference internal"href="#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="#nghttp2_data_provider"title="nghttp2_data_provider">nghttp2_data_provider</a><em> *data_prd</em><big>)</big><aclass="headerlink"href="#nghttp2_submit_data"title="Permalink to this definition">¶</a></dt>
<dd><p>Submits one or more DATA frames to the stream <em>stream_id</em>. The
data to be sent are provided by <em>data_prd</em>. If <em>flags</em> contains
<aclass="reference internal"href="#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
flag set.</p>
<p>This function does not take ownership of the <em>data_prd</em>. The
function copies the members of the <em>data_prd</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="#NGHTTP2_ERR_NOMEM"title="NGHTTP2_ERR_NOMEM"><ttclass="xref c c-macro docutils literal"><spanclass="pre">NGHTTP2_ERR_NOMEM</span></tt></a></dt>
int <ttclass="descname">nghttp2_submit_priority</tt><big>(</big><aclass="reference internal"href="#nghttp2_session"title="nghttp2_session">nghttp2_session</a><em> *session</em>, int32_t<em> stream_id</em>, int32_t<em> pri</em><big>)</big><aclass="headerlink"href="#nghttp2_submit_priority"title="Permalink to this definition">¶</a></dt>
<dd><p>Submits PRIORITY frame to change the priority of stream <em>stream_id</em>
to the priority value <em>pri</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="#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="#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>
int <ttclass="descname">nghttp2_submit_rst_stream</tt><big>(</big><aclass="reference internal"href="#nghttp2_session"title="nghttp2_session">nghttp2_session</a><em> *session</em>, int32_t<em> stream_id</em>, <aclass="reference internal"href="#nghttp2_error_code"title="nghttp2_error_code">nghttp2_error_code</a><em> error_code</em><big>)</big><aclass="headerlink"href="#nghttp2_submit_rst_stream"title="Permalink to this definition">¶</a></dt>
<dd><p>Submits RST_STREAM frame to cancel/reject the stream <em>stream_id</em>
with the error code <em>error_code</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="#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="nghttp2_submit_settings">
int <ttclass="descname">nghttp2_submit_settings</tt><big>(</big><aclass="reference internal"href="#nghttp2_session"title="nghttp2_session">nghttp2_session</a><em> *session</em>, const <aclass="reference internal"href="#nghttp2_settings_entry"title="nghttp2_settings_entry">nghttp2_settings_entry</a><em> *iv</em>, size_t<em> niv</em><big>)</big><aclass="headerlink"href="#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="#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="#nghttp2_settings_entry"title="nghttp2_settings_entry"><ttclass="xref c c-type docutils literal"><spanclass="pre">nghttp2_settings_entry</span></tt></a>.</p>
<dt><aclass="reference internal"href="#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="nghttp2_submit_push_promise">
int <ttclass="descname">nghttp2_submit_push_promise</tt><big>(</big><aclass="reference internal"href="#nghttp2_session"title="nghttp2_session">nghttp2_session</a><em> *session</em>, uint8_t<em> flags</em>, int32_t<em> stream_id</em>, const char<em> **nv</em><big>)</big><aclass="headerlink"href="#nghttp2_submit_push_promise"title="Permalink to this definition">¶</a></dt>
<dd><p>Submits PUSH_PROMISE frame. The <em>flags</em> is currently ignored and
the resulting PUSH_PROMISE frame always has
<aclass="reference internal"href="#NGHTTP2_FLAG_END_PUSH_PROMISE"title="NGHTTP2_FLAG_END_PUSH_PROMISE"><ttclass="xref c c-macro docutils literal"><spanclass="pre">NGHTTP2_FLAG_END_PUSH_PROMISE</span></tt></a> flag set due to the lack of
<aclass="reference internal"href="#nghttp2_session_callbacks.before_frame_send_callback"title="nghttp2_session_callbacks.before_frame_send_callback"><ttclass="xref c c-member docutils literal"><spanclass="pre">nghttp2_session_callbacks.before_frame_send_callback</span></tt></a>. This
<dt><aclass="reference internal"href="#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="nghttp2_submit_ping">
int <ttclass="descname">nghttp2_submit_ping</tt><big>(</big><aclass="reference internal"href="#nghttp2_session"title="nghttp2_session">nghttp2_session</a><em> *session</em>, uint8_t<em> *opaque_data</em><big>)</big><aclass="headerlink"href="#nghttp2_submit_ping"title="Permalink to this definition">¶</a></dt>
<dd><p>Submits PING frame. You don’t have to send PING back when you
received PING frame. The library automatically submits PING frame
<p>This function returns 0 if it succeeds, or one of the following
negative error codes:</p>
<dlclass="docutils">
<dt><aclass="reference internal"href="#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="nghttp2_submit_goaway">
int <ttclass="descname">nghttp2_submit_goaway</tt><big>(</big><aclass="reference internal"href="#nghttp2_session"title="nghttp2_session">nghttp2_session</a><em> *session</em>, <aclass="reference internal"href="#nghttp2_error_code"title="nghttp2_error_code">nghttp2_error_code</a><em> error_code</em>, uint8_t<em> *opaque_data</em>, size_t<em> opaque_data_len</em><big>)</big><aclass="headerlink"href="#nghttp2_submit_goaway"title="Permalink to this definition">¶</a></dt>
<dd><p>Submits GOAWAY frame with the error code <em>error_code</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="#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="nghttp2_submit_window_update">
int <ttclass="descname">nghttp2_submit_window_update</tt><big>(</big><aclass="reference internal"href="#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="#nghttp2_submit_window_update"title="Permalink to this definition">¶</a></dt>
<p>If the <em>window_size_increment</em> is positive, the WINDOW_UPDATE with
that value as window_size_increment is queued. If the
<em>window_size_increment</em> is larger than the received bytes from the
remote endpoint, the local window size is increased by that
difference.</p>
<p>If the <em>window_size_increment</em> is negative, the local window size
is decreased by -<em>window_size_increment</em>. If
<aclass="reference internal"href="#NGHTTP2_OPT_NO_AUTO_STREAM_WINDOW_UPDATE"title="NGHTTP2_OPT_NO_AUTO_STREAM_WINDOW_UPDATE"><ttclass="xref c c-macro docutils literal"><spanclass="pre">NGHTTP2_OPT_NO_AUTO_STREAM_WINDOW_UPDATE</span></tt></a> (or
<aclass="reference internal"href="#NGHTTP2_OPT_NO_AUTO_CONNECTION_WINDOW_UPDATE"title="NGHTTP2_OPT_NO_AUTO_CONNECTION_WINDOW_UPDATE"><ttclass="xref c c-macro docutils literal"><spanclass="pre">NGHTTP2_OPT_NO_AUTO_CONNECTION_WINDOW_UPDATE</span></tt></a> if <em>stream_id</em>
is 0) is not set and the library decided that the WINDOW_UPDATE
should be submitted, then WINDOW_UPDATE is queued with the current
int <ttclass="descname">nghttp2_nv_compare_name</tt><big>(</big>const <aclass="reference internal"href="#nghttp2_nv"title="nghttp2_nv">nghttp2_nv</a><em> *lhs</em>, const <aclass="reference internal"href="#nghttp2_nv"title="nghttp2_nv">nghttp2_nv</a><em> *rhs</em><big>)</big><aclass="headerlink"href="#nghttp2_nv_compare_name"title="Permalink to this definition">¶</a></dt>
<dd><p>Compares lhs->name with lhs->namelen bytes and rhs->name with
rhs->namelen bytes. Returns negative integer if lhs->name is found
to be less than rhs->name; or returns positive integer if lhs->name
is found to be greater than rhs->name; 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="#nghttp2_select_next_protocol"title="Permalink to this definition">¶</a></dt>
<dd><p>A helper function for dealing with NPN in client side. The <em>in</em>
contains server’s protocol in preferable order. The format of <em>in</em>
is length-prefixed and not null-terminated. For example,
<ttclass="docutils literal"><spanclass="pre">HTTP-draft-04/2.0</span></tt> and <ttclass="docutils literal"><spanclass="pre">http/1.1</span></tt> stored in <em>in</em> like this:</p>
<li>If server’s list contains <ttclass="docutils literal"><spanclass="pre">HTTP-draft-04/2.0</span></tt>, it is selected
and returns 1. The following step is not taken.</li>
<li>If server’s list contains <ttclass="docutils literal"><spanclass="pre">http/1.1</span></tt>, this function selects
<ttclass="docutils literal"><spanclass="pre">http/1.1</span></tt> and returns 0. The following step is not taken.</li>
<li>This function selects nothing and returns -1. (So called
non-overlap case). In this case, <em>out</em> and <em>outlen</em> are left
untouched.</li>
</ol>
<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
written into <em>*out</em> and its length (which is 17) is
assigned to <em>*outlen</em>.</p>
<p>See <aclass="reference external"href="http://technotes.googlecode.com/git/nextprotoneg.html">http://technotes.googlecode.com/git/nextprotoneg.html</a> for more
details about NPN.</p>
<p>To use this method you should do something like:</p>
<p>Note that the HTTP/2.0 spec does use ALPN instead of NPN. This
function is provided for transitional period before ALPN is got
implemented in major SSL/TLS libraries.</p>
</dd></dl>
<dlclass="function">
<dtid="nghttp2_gzip_inflate_new">
int <ttclass="descname">nghttp2_gzip_inflate_new</tt><big>(</big><aclass="reference internal"href="#nghttp2_gzip"title="nghttp2_gzip">nghttp2_gzip</a><em> **inflater_ptr</em><big>)</big><aclass="headerlink"href="#nghttp2_gzip_inflate_new"title="Permalink to this definition">¶</a></dt>
<dd><p>A helper function to set up a per request gzip stream to inflate data.</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="#NGHTTP2_ERR_GZIP"title="NGHTTP2_ERR_GZIP"><ttclass="xref c c-macro docutils literal"><spanclass="pre">NGHTTP2_ERR_GZIP</span></tt></a></dt>
<dd>The initialization of gzip stream failed.</dd>
<dt><aclass="reference internal"href="#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="nghttp2_gzip_inflate_del">
void <ttclass="descname">nghttp2_gzip_inflate_del</tt><big>(</big><aclass="reference internal"href="#nghttp2_gzip"title="nghttp2_gzip">nghttp2_gzip</a><em> *inflater</em><big>)</big><aclass="headerlink"href="#nghttp2_gzip_inflate_del"title="Permalink to this definition">¶</a></dt>
<dd><p>Frees the inflate stream. The <em>inflater</em> may be <ttclass="docutils literal"><spanclass="pre">NULL</span></tt>.</p>
</dd></dl>
<dlclass="function">
<dtid="nghttp2_gzip_inflate">
int <ttclass="descname">nghttp2_gzip_inflate</tt><big>(</big><aclass="reference internal"href="#nghttp2_gzip"title="nghttp2_gzip">nghttp2_gzip</a><em> *inflater</em>, uint8_t<em> *out</em>, size_t<em> *outlen_ptr</em>, const uint8_t<em> *in</em>, size_t<em> *inlen_ptr</em><big>)</big><aclass="headerlink"href="#nghttp2_gzip_inflate"title="Permalink to this definition">¶</a></dt>
<dd><p>Inflates data in <em>in</em> with the length <em>*inlen_ptr</em> and stores the
inflated data to <em>out</em> which has allocated size at least
<em>*outlen_ptr</em>. On return, <em>*outlen_ptr</em> is updated to represent
the number of data written in <em>out</em>. Similarly, <em>*inlen_ptr</em> is
updated to represent the number of input bytes processed.</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="#NGHTTP2_ERR_GZIP"title="NGHTTP2_ERR_GZIP"><ttclass="xref c c-macro docutils literal"><spanclass="pre">NGHTTP2_ERR_GZIP</span></tt></a></dt>
<aclass="reference internal"href="#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="#nghttp2_version"title="Permalink to this definition">¶</a></dt>
<dd><p>Returns a pointer to a nghttp2_info struct with version information about
the run-time library in use. The <em>least_version</em> argument can be set to a
24 bit numerical value for the least accepted version number and if the
condition is not met, this function will return a NULL. Pass in 0 to skip