nghttp2/apiref.html

2191 lines
156 KiB
HTML
Raw Normal View History

2013-07-28 14:26:41 +02:00
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>API Reference &mdash; nghttp2 0.1.0-DEV documentation</title>
<link rel="stylesheet" href="_static/default.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<link rel="stylesheet" href="_static/default2.css" type="text/css" />
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '',
VERSION: '0.1.0-DEV',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
};
</script>
<script type="text/javascript" src="_static/jquery.js"></script>
<script type="text/javascript" src="_static/underscore.js"></script>
<script type="text/javascript" src="_static/doctools.js"></script>
<link rel="top" title="nghttp2 0.1.0-DEV documentation" href="index.html" />
<link rel="prev" title="nghttp2 - HTTP/2.0 C Library" href="package_README.html" />
</head>
<body>
<div class="related">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="genindex.html" title="General Index"
accesskey="I">index</a></li>
<li class="right" >
<a href="package_README.html" title="nghttp2 - HTTP/2.0 C Library"
accesskey="P">previous</a> |</li>
<li><a href="index.html">nghttp2 0.1.0-DEV documentation</a> &raquo;</li>
</ul>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body">
<div class="section" id="api-reference">
<h1>API Reference<a class="headerlink" href="#api-reference" title="Permalink to this headline"></a></h1>
<div class="section" id="includes">
<h2>Includes<a class="headerlink" href="#includes" title="Permalink to this headline"></a></h2>
<p>To use the public APIs, include <tt class="docutils literal"><span class="pre">nghttp2/nghttp2.h</span></tt>:</p>
<div class="highlight-c"><div class="highlight"><pre><span class="cp">#include &lt;nghttp2/nghttp2.h&gt;</span>
</pre></div>
</div>
</div>
<div class="section" id="remarks">
<h2>Remarks<a class="headerlink" href="#remarks" title="Permalink to this headline"></a></h2>
<p>Do not call <a class="reference internal" href="#nghttp2_session_send" title="nghttp2_session_send"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_send()</span></tt></a>, <a class="reference internal" href="#nghttp2_session_recv" title="nghttp2_session_recv"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_recv()</span></tt></a> or
<a class="reference internal" href="#nghttp2_session_mem_recv" title="nghttp2_session_mem_recv"><tt class="xref c c-func docutils literal"><span class="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 <a class="reference internal" href="#nghttp2_session_send" title="nghttp2_session_send"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_send()</span></tt></a>,
<a class="reference internal" href="#nghttp2_session_recv" title="nghttp2_session_recv"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_recv()</span></tt></a> or <a class="reference internal" href="#nghttp2_session_mem_recv" title="nghttp2_session_mem_recv"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_mem_recv()</span></tt></a> outside of the
callbacks.</p>
</div>
<div class="section" id="macros">
<h2>Macros<a class="headerlink" href="#macros" title="Permalink to this headline"></a></h2>
<dl class="macro">
<dt id="NGHTTP2_VERSION">
<tt class="descname">NGHTTP2_VERSION</tt><a class="headerlink" href="#NGHTTP2_VERSION" title="Permalink to this definition"></a></dt>
<dd><p>Version number of the nghttp2 library release</p>
</dd></dl>
<dl class="macro">
<dt id="NGHTTP2_PROTO_VERSION_ID">
<tt class="descname">NGHTTP2_PROTO_VERSION_ID</tt><a class="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>
<dl class="macro">
<dt id="NGHTTP2_PROTO_VERSION_ID_LEN">
<tt class="descname">NGHTTP2_PROTO_VERSION_ID_LEN</tt><a class="headerlink" href="#NGHTTP2_PROTO_VERSION_ID_LEN" title="Permalink to this definition"></a></dt>
<dd><p>The length of NGHTTP2_PROTO_VERSION_ID.</p>
</dd></dl>
<dl class="macro">
<dt id="NGHTTP2_PRI_DEFAULT">
<tt class="descname">NGHTTP2_PRI_DEFAULT</tt><a class="headerlink" href="#NGHTTP2_PRI_DEFAULT" title="Permalink to this definition"></a></dt>
<dd><p>The default priority value</p>
</dd></dl>
<dl class="macro">
<dt id="NGHTTP2_PRI_LOWEST">
<tt class="descname">NGHTTP2_PRI_LOWEST</tt><a class="headerlink" href="#NGHTTP2_PRI_LOWEST" title="Permalink to this definition"></a></dt>
<dd><p>The lowest priority value</p>
</dd></dl>
2013-08-08 18:52:42 +02:00
<dl class="macro">
<dt id="NGHTTP2_MAX_WINDOW_SIZE">
<tt class="descname">NGHTTP2_MAX_WINDOW_SIZE</tt><a class="headerlink" href="#NGHTTP2_MAX_WINDOW_SIZE" title="Permalink to this definition"></a></dt>
<dd><p>The maximum window size</p>
</dd></dl>
2013-07-28 14:26:41 +02:00
<dl class="macro">
<dt id="NGHTTP2_INITIAL_WINDOW_SIZE">
<tt class="descname">NGHTTP2_INITIAL_WINDOW_SIZE</tt><a class="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>
<dl class="macro">
<dt id="NGHTTP2_INITIAL_CONNECTION_WINDOW_SIZE">
<tt class="descname">NGHTTP2_INITIAL_CONNECTION_WINDOW_SIZE</tt><a class="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>
<dl class="macro">
<dt id="NGHTTP2_CLIENT_CONNECTION_HEADER">
<tt class="descname">NGHTTP2_CLIENT_CONNECTION_HEADER</tt><a class="headerlink" href="#NGHTTP2_CLIENT_CONNECTION_HEADER" title="Permalink to this definition"></a></dt>
<dd><p>The client connection header.</p>
</dd></dl>
<dl class="macro">
<dt id="NGHTTP2_CLIENT_CONNECTION_HEADER_LEN">
<tt class="descname">NGHTTP2_CLIENT_CONNECTION_HEADER_LEN</tt><a class="headerlink" href="#NGHTTP2_CLIENT_CONNECTION_HEADER_LEN" title="Permalink to this definition"></a></dt>
<dd><p>The length of NGHTTP2_CLIENT_CONNECTION_HEADER.</p>
</dd></dl>
<dl class="macro">
<dt id="NGHTTP2_INITIAL_MAX_CONCURRENT_STREAMS">
<tt class="descname">NGHTTP2_INITIAL_MAX_CONCURRENT_STREAMS</tt><a class="headerlink" href="#NGHTTP2_INITIAL_MAX_CONCURRENT_STREAMS" title="Permalink to this definition"></a></dt>
<dd><p>Default maximum concurrent streams.</p>
</dd></dl>
</div>
<div class="section" id="enums">
<h2>Enums<a class="headerlink" href="#enums" title="Permalink to this headline"></a></h2>
<dl class="type">
<dt id="nghttp2_error">
<tt class="descname">nghttp2_error</tt><a class="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>
<dl class="macro">
<dt id="NGHTTP2_ERR_INVALID_ARGUMENT">
<tt class="descname">NGHTTP2_ERR_INVALID_ARGUMENT</tt><a class="headerlink" href="#NGHTTP2_ERR_INVALID_ARGUMENT" title="Permalink to this definition"></a></dt>
<dd><p>(<tt class="docutils literal"><span class="pre">-501</span></tt>)
Invalid argument passed.</p>
</dd></dl>
<dl class="macro">
<dt id="NGHTTP2_ERR_UNSUPPORTED_VERSION">
<tt class="descname">NGHTTP2_ERR_UNSUPPORTED_VERSION</tt><a class="headerlink" href="#NGHTTP2_ERR_UNSUPPORTED_VERSION" title="Permalink to this definition"></a></dt>
<dd><p>(<tt class="docutils literal"><span class="pre">-503</span></tt>)
The specified protocol version is not supported.</p>
</dd></dl>
<dl class="macro">
<dt id="NGHTTP2_ERR_WOULDBLOCK">
<tt class="descname">NGHTTP2_ERR_WOULDBLOCK</tt><a class="headerlink" href="#NGHTTP2_ERR_WOULDBLOCK" title="Permalink to this definition"></a></dt>
<dd><p>(<tt class="docutils literal"><span class="pre">-504</span></tt>)
Used as a return value from <a class="reference internal" href="#nghttp2_send_callback" title="nghttp2_send_callback"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_send_callback</span></tt></a> and
<a class="reference internal" href="#nghttp2_recv_callback" title="nghttp2_recv_callback"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_recv_callback</span></tt></a> to indicate that the operation
would block.</p>
</dd></dl>
<dl class="macro">
<dt id="NGHTTP2_ERR_PROTO">
<tt class="descname">NGHTTP2_ERR_PROTO</tt><a class="headerlink" href="#NGHTTP2_ERR_PROTO" title="Permalink to this definition"></a></dt>
<dd><p>(<tt class="docutils literal"><span class="pre">-505</span></tt>)
General protocol error</p>
</dd></dl>
<dl class="macro">
<dt id="NGHTTP2_ERR_INVALID_FRAME">
<tt class="descname">NGHTTP2_ERR_INVALID_FRAME</tt><a class="headerlink" href="#NGHTTP2_ERR_INVALID_FRAME" title="Permalink to this definition"></a></dt>
<dd><p>(<tt class="docutils literal"><span class="pre">-506</span></tt>)
The frame is invalid.</p>
</dd></dl>
<dl class="macro">
<dt id="NGHTTP2_ERR_EOF">
<tt class="descname">NGHTTP2_ERR_EOF</tt><a class="headerlink" href="#NGHTTP2_ERR_EOF" title="Permalink to this definition"></a></dt>
<dd><p>(<tt class="docutils literal"><span class="pre">-507</span></tt>)
The peer performed a shutdown on the connection.</p>
</dd></dl>
<dl class="macro">
<dt id="NGHTTP2_ERR_DEFERRED">
<tt class="descname">NGHTTP2_ERR_DEFERRED</tt><a class="headerlink" href="#NGHTTP2_ERR_DEFERRED" title="Permalink to this definition"></a></dt>
<dd><p>(<tt class="docutils literal"><span class="pre">-508</span></tt>)
Used as a return value from
<a class="reference internal" href="#nghttp2_data_source_read_callback" title="nghttp2_data_source_read_callback"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_data_source_read_callback()</span></tt></a> to indicate that data
transfer is postponed. See
<a class="reference internal" href="#nghttp2_data_source_read_callback" title="nghttp2_data_source_read_callback"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_data_source_read_callback()</span></tt></a> for details.</p>
</dd></dl>
<dl class="macro">
<dt id="NGHTTP2_ERR_STREAM_ID_NOT_AVAILABLE">
<tt class="descname">NGHTTP2_ERR_STREAM_ID_NOT_AVAILABLE</tt><a class="headerlink" href="#NGHTTP2_ERR_STREAM_ID_NOT_AVAILABLE" title="Permalink to this definition"></a></dt>
<dd><p>(<tt class="docutils literal"><span class="pre">-509</span></tt>)
Stream ID has reached the maximum value. Therefore no stream ID
is available.</p>
</dd></dl>
<dl class="macro">
<dt id="NGHTTP2_ERR_STREAM_CLOSED">
<tt class="descname">NGHTTP2_ERR_STREAM_CLOSED</tt><a class="headerlink" href="#NGHTTP2_ERR_STREAM_CLOSED" title="Permalink to this definition"></a></dt>
<dd><p>(<tt class="docutils literal"><span class="pre">-510</span></tt>)
The stream is already closed; or the stream ID is invalid.</p>
</dd></dl>
<dl class="macro">
<dt id="NGHTTP2_ERR_STREAM_CLOSING">
<tt class="descname">NGHTTP2_ERR_STREAM_CLOSING</tt><a class="headerlink" href="#NGHTTP2_ERR_STREAM_CLOSING" title="Permalink to this definition"></a></dt>
<dd><p>(<tt class="docutils literal"><span class="pre">-511</span></tt>)
RST_STREAM has been added to the outbound queue. The stream is in
closing state.</p>
</dd></dl>
<dl class="macro">
<dt id="NGHTTP2_ERR_STREAM_SHUT_WR">
<tt class="descname">NGHTTP2_ERR_STREAM_SHUT_WR</tt><a class="headerlink" href="#NGHTTP2_ERR_STREAM_SHUT_WR" title="Permalink to this definition"></a></dt>
<dd><p>(<tt class="docutils literal"><span class="pre">-512</span></tt>)
The transmission is not allowed for this stream (e.g., a frame
with END_STREAM flag set has already sent).</p>
</dd></dl>
<dl class="macro">
<dt id="NGHTTP2_ERR_INVALID_STREAM_ID">
<tt class="descname">NGHTTP2_ERR_INVALID_STREAM_ID</tt><a class="headerlink" href="#NGHTTP2_ERR_INVALID_STREAM_ID" title="Permalink to this definition"></a></dt>
<dd><p>(<tt class="docutils literal"><span class="pre">-513</span></tt>)
The stream ID is invalid.</p>
</dd></dl>
<dl class="macro">
<dt id="NGHTTP2_ERR_INVALID_STREAM_STATE">
<tt class="descname">NGHTTP2_ERR_INVALID_STREAM_STATE</tt><a class="headerlink" href="#NGHTTP2_ERR_INVALID_STREAM_STATE" title="Permalink to this definition"></a></dt>
<dd><p>(<tt class="docutils literal"><span class="pre">-514</span></tt>)
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>
<dl class="macro">
<dt id="NGHTTP2_ERR_DEFERRED_DATA_EXIST">
<tt class="descname">NGHTTP2_ERR_DEFERRED_DATA_EXIST</tt><a class="headerlink" href="#NGHTTP2_ERR_DEFERRED_DATA_EXIST" title="Permalink to this definition"></a></dt>
<dd><p>(<tt class="docutils literal"><span class="pre">-515</span></tt>)
Another DATA frame has already been deferred.</p>
</dd></dl>
<dl class="macro">
<dt id="NGHTTP2_ERR_START_STREAM_NOT_ALLOWED">
<tt class="descname">NGHTTP2_ERR_START_STREAM_NOT_ALLOWED</tt><a class="headerlink" href="#NGHTTP2_ERR_START_STREAM_NOT_ALLOWED" title="Permalink to this definition"></a></dt>
<dd><p>(<tt class="docutils literal"><span class="pre">-516</span></tt>)
Starting new stream is not allowed. (e.g., GOAWAY has been sent
and/or received.</p>
</dd></dl>
<dl class="macro">
<dt id="NGHTTP2_ERR_GOAWAY_ALREADY_SENT">
<tt class="descname">NGHTTP2_ERR_GOAWAY_ALREADY_SENT</tt><a class="headerlink" href="#NGHTTP2_ERR_GOAWAY_ALREADY_SENT" title="Permalink to this definition"></a></dt>
<dd><p>(<tt class="docutils literal"><span class="pre">-517</span></tt>)
GOAWAY has already been sent.</p>
</dd></dl>
<dl class="macro">
<dt id="NGHTTP2_ERR_INVALID_HEADER_BLOCK">
<tt class="descname">NGHTTP2_ERR_INVALID_HEADER_BLOCK</tt><a class="headerlink" href="#NGHTTP2_ERR_INVALID_HEADER_BLOCK" title="Permalink to this definition"></a></dt>
<dd><p>(<tt class="docutils literal"><span class="pre">-518</span></tt>)
The received frame contains the invalid header block. (e.g.,
There are duplicate header names; or the header names are not
encoded in US-ASCII character set and not lower cased; or the
header name is zero-length string; or the header value contains
multiple in-sequence NUL bytes).</p>
</dd></dl>
<dl class="macro">
<dt id="NGHTTP2_ERR_INVALID_STATE">
<tt class="descname">NGHTTP2_ERR_INVALID_STATE</tt><a class="headerlink" href="#NGHTTP2_ERR_INVALID_STATE" title="Permalink to this definition"></a></dt>
<dd><p>(<tt class="docutils literal"><span class="pre">-519</span></tt>)
Indicates that the context is not suitable to perform the
requested operation.</p>
</dd></dl>
<dl class="macro">
<dt id="NGHTTP2_ERR_GZIP">
<tt class="descname">NGHTTP2_ERR_GZIP</tt><a class="headerlink" href="#NGHTTP2_ERR_GZIP" title="Permalink to this definition"></a></dt>
<dd><p>(<tt class="docutils literal"><span class="pre">-520</span></tt>)
The gzip error.</p>
</dd></dl>
<dl class="macro">
<dt id="NGHTTP2_ERR_TEMPORAL_CALLBACK_FAILURE">
<tt class="descname">NGHTTP2_ERR_TEMPORAL_CALLBACK_FAILURE</tt><a class="headerlink" href="#NGHTTP2_ERR_TEMPORAL_CALLBACK_FAILURE" title="Permalink to this definition"></a></dt>
<dd><p>(<tt class="docutils literal"><span class="pre">-521</span></tt>)
The user callback function failed due to the temporal error.</p>
</dd></dl>
<dl class="macro">
<dt id="NGHTTP2_ERR_FRAME_TOO_LARGE">
<tt class="descname">NGHTTP2_ERR_FRAME_TOO_LARGE</tt><a class="headerlink" href="#NGHTTP2_ERR_FRAME_TOO_LARGE" title="Permalink to this definition"></a></dt>
<dd><p>(<tt class="docutils literal"><span class="pre">-522</span></tt>)
The length of the frame is too large.</p>
</dd></dl>
<dl class="macro">
<dt id="NGHTTP2_ERR_HEADER_COMP">
<tt class="descname">NGHTTP2_ERR_HEADER_COMP</tt><a class="headerlink" href="#NGHTTP2_ERR_HEADER_COMP" title="Permalink to this definition"></a></dt>
<dd><p>(<tt class="docutils literal"><span class="pre">-523</span></tt>)
Header block inflate/deflate error.</p>
</dd></dl>
2013-08-08 18:52:42 +02:00
<dl class="macro">
<dt id="NGHTTP2_ERR_FLOW_CONTROL">
<tt class="descname">NGHTTP2_ERR_FLOW_CONTROL</tt><a class="headerlink" href="#NGHTTP2_ERR_FLOW_CONTROL" title="Permalink to this definition"></a></dt>
<dd><p>(<tt class="docutils literal"><span class="pre">-524</span></tt>)
Flow control error</p>
</dd></dl>
2013-07-28 14:26:41 +02:00
<dl class="macro">
<dt id="NGHTTP2_ERR_FATAL">
<tt class="descname">NGHTTP2_ERR_FATAL</tt><a class="headerlink" href="#NGHTTP2_ERR_FATAL" title="Permalink to this definition"></a></dt>
<dd><p>(<tt class="docutils literal"><span class="pre">-900</span></tt>)
The errors &lt; <a class="reference internal" href="#NGHTTP2_ERR_FATAL" title="NGHTTP2_ERR_FATAL"><tt class="xref c c-macro docutils literal"><span class="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>
<dl class="macro">
<dt id="NGHTTP2_ERR_NOMEM">
<tt class="descname">NGHTTP2_ERR_NOMEM</tt><a class="headerlink" href="#NGHTTP2_ERR_NOMEM" title="Permalink to this definition"></a></dt>
<dd><p>(<tt class="docutils literal"><span class="pre">-901</span></tt>)
Out of memory. This is a fatal error.</p>
</dd></dl>
<dl class="macro">
<dt id="NGHTTP2_ERR_CALLBACK_FAILURE">
<tt class="descname">NGHTTP2_ERR_CALLBACK_FAILURE</tt><a class="headerlink" href="#NGHTTP2_ERR_CALLBACK_FAILURE" title="Permalink to this definition"></a></dt>
<dd><p>(<tt class="docutils literal"><span class="pre">-902</span></tt>)
The user callback function failed. This is a fatal error.</p>
</dd></dl>
</dd></dl>
<dl class="type">
<dt id="nghttp2_frame_type">
<tt class="descname">nghttp2_frame_type</tt><a class="headerlink" href="#nghttp2_frame_type" title="Permalink to this definition"></a></dt>
<dd><p>The control frame types in HTTP/2.0.</p>
<dl class="macro">
<dt id="NGHTTP2_DATA">
<tt class="descname">NGHTTP2_DATA</tt><a class="headerlink" href="#NGHTTP2_DATA" title="Permalink to this definition"></a></dt>
<dd><p>(<tt class="docutils literal"><span class="pre">0</span></tt>)
The DATA frame.</p>
</dd></dl>
<dl class="macro">
<dt id="NGHTTP2_HEADERS">
<tt class="descname">NGHTTP2_HEADERS</tt><a class="headerlink" href="#NGHTTP2_HEADERS" title="Permalink to this definition"></a></dt>
<dd><p>(<tt class="docutils literal"><span class="pre">1</span></tt>)
The HEADERS frame.</p>
</dd></dl>
<dl class="macro">
<dt id="NGHTTP2_PRIORITY">
<tt class="descname">NGHTTP2_PRIORITY</tt><a class="headerlink" href="#NGHTTP2_PRIORITY" title="Permalink to this definition"></a></dt>
<dd><p>(<tt class="docutils literal"><span class="pre">2</span></tt>)
The PRIORITY frame.</p>
</dd></dl>
<dl class="macro">
<dt id="NGHTTP2_RST_STREAM">
<tt class="descname">NGHTTP2_RST_STREAM</tt><a class="headerlink" href="#NGHTTP2_RST_STREAM" title="Permalink to this definition"></a></dt>
<dd><p>(<tt class="docutils literal"><span class="pre">3</span></tt>)
The RST_STREAM frame.</p>
</dd></dl>
<dl class="macro">
<dt id="NGHTTP2_SETTINGS">
<tt class="descname">NGHTTP2_SETTINGS</tt><a class="headerlink" href="#NGHTTP2_SETTINGS" title="Permalink to this definition"></a></dt>
<dd><p>(<tt class="docutils literal"><span class="pre">4</span></tt>)
The SETTINGS frame.</p>
</dd></dl>
<dl class="macro">
<dt id="NGHTTP2_PUSH_PROMISE">
<tt class="descname">NGHTTP2_PUSH_PROMISE</tt><a class="headerlink" href="#NGHTTP2_PUSH_PROMISE" title="Permalink to this definition"></a></dt>
<dd><p>(<tt class="docutils literal"><span class="pre">5</span></tt>)
The PUSH_PROMISE frame.</p>
</dd></dl>
<dl class="macro">
<dt id="NGHTTP2_PING">
<tt class="descname">NGHTTP2_PING</tt><a class="headerlink" href="#NGHTTP2_PING" title="Permalink to this definition"></a></dt>
<dd><p>(<tt class="docutils literal"><span class="pre">6</span></tt>)
The PING frame.</p>
</dd></dl>
<dl class="macro">
<dt id="NGHTTP2_GOAWAY">
<tt class="descname">NGHTTP2_GOAWAY</tt><a class="headerlink" href="#NGHTTP2_GOAWAY" title="Permalink to this definition"></a></dt>
<dd><p>(<tt class="docutils literal"><span class="pre">7</span></tt>)
The GOAWAY frame.</p>
</dd></dl>
<dl class="macro">
<dt id="NGHTTP2_WINDOW_UPDATE">
<tt class="descname">NGHTTP2_WINDOW_UPDATE</tt><a class="headerlink" href="#NGHTTP2_WINDOW_UPDATE" title="Permalink to this definition"></a></dt>
<dd><p>(<tt class="docutils literal"><span class="pre">9</span></tt>)
The WINDOW_UPDATE frame.</p>
</dd></dl>
</dd></dl>
<dl class="type">
<dt id="nghttp2_flag">
<tt class="descname">nghttp2_flag</tt><a class="headerlink" href="#nghttp2_flag" title="Permalink to this definition"></a></dt>
<dd><p>The flags for HTTP/2.0 frames. This enum defines all flags for
frames, assuming that the same flag name has the same mask.</p>
<dl class="macro">
<dt id="NGHTTP2_FLAG_NONE">
<tt class="descname">NGHTTP2_FLAG_NONE</tt><a class="headerlink" href="#NGHTTP2_FLAG_NONE" title="Permalink to this definition"></a></dt>
<dd><p>(<tt class="docutils literal"><span class="pre">0</span></tt>)
No flag set.</p>
</dd></dl>
<dl class="macro">
<dt id="NGHTTP2_FLAG_END_STREAM">
<tt class="descname">NGHTTP2_FLAG_END_STREAM</tt><a class="headerlink" href="#NGHTTP2_FLAG_END_STREAM" title="Permalink to this definition"></a></dt>
<dd><p>(<tt class="docutils literal"><span class="pre">0x1</span></tt>)
The END_STREAM flag.</p>
</dd></dl>
<dl class="macro">
<dt id="NGHTTP2_FLAG_END_HEADERS">
<tt class="descname">NGHTTP2_FLAG_END_HEADERS</tt><a class="headerlink" href="#NGHTTP2_FLAG_END_HEADERS" title="Permalink to this definition"></a></dt>
<dd><p>(<tt class="docutils literal"><span class="pre">0x4</span></tt>)
The END_HEADERS flag.</p>
</dd></dl>
<dl class="macro">
<dt id="NGHTTP2_FLAG_PRIORITY">
<tt class="descname">NGHTTP2_FLAG_PRIORITY</tt><a class="headerlink" href="#NGHTTP2_FLAG_PRIORITY" title="Permalink to this definition"></a></dt>
<dd><p>(<tt class="docutils literal"><span class="pre">0x8</span></tt>)
The PRIORITY flag.</p>
</dd></dl>
<dl class="macro">
<dt id="NGHTTP2_FLAG_END_PUSH_PROMISE">
<tt class="descname">NGHTTP2_FLAG_END_PUSH_PROMISE</tt><a class="headerlink" href="#NGHTTP2_FLAG_END_PUSH_PROMISE" title="Permalink to this definition"></a></dt>
2013-08-25 15:59:06 +02:00
<dd><p>(<tt class="docutils literal"><span class="pre">0x4</span></tt>)
2013-07-28 14:26:41 +02:00
The END_PUSH_PROMISE flag.</p>
</dd></dl>
<dl class="macro">
<dt id="NGHTTP2_FLAG_PONG">
<tt class="descname">NGHTTP2_FLAG_PONG</tt><a class="headerlink" href="#NGHTTP2_FLAG_PONG" title="Permalink to this definition"></a></dt>
<dd><p>(<tt class="docutils literal"><span class="pre">0x1</span></tt>)
The PONG flag.</p>
</dd></dl>
</dd></dl>
<dl class="type">
<dt id="nghttp2_settings_id">
<tt class="descname">nghttp2_settings_id</tt><a class="headerlink" href="#nghttp2_settings_id" title="Permalink to this definition"></a></dt>
<dd><p>The SETTINGS ID.</p>
<dl class="macro">
<dt id="NGHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS">
<tt class="descname">NGHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS</tt><a class="headerlink" href="#NGHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS" title="Permalink to this definition"></a></dt>
<dd><p>(<tt class="docutils literal"><span class="pre">4</span></tt>)
SETTINGS_MAX_CONCURRENT_STREAMS</p>
</dd></dl>
<dl class="macro">
<dt id="NGHTTP2_SETTINGS_INITIAL_WINDOW_SIZE">
<tt class="descname">NGHTTP2_SETTINGS_INITIAL_WINDOW_SIZE</tt><a class="headerlink" href="#NGHTTP2_SETTINGS_INITIAL_WINDOW_SIZE" title="Permalink to this definition"></a></dt>
<dd><p>(<tt class="docutils literal"><span class="pre">7</span></tt>)
SETTINGS_INITIAL_WINDOW_SIZE</p>
</dd></dl>
<dl class="macro">
<dt id="NGHTTP2_SETTINGS_FLOW_CONTROL_OPTIONS">
<tt class="descname">NGHTTP2_SETTINGS_FLOW_CONTROL_OPTIONS</tt><a class="headerlink" href="#NGHTTP2_SETTINGS_FLOW_CONTROL_OPTIONS" title="Permalink to this definition"></a></dt>
<dd><p>(<tt class="docutils literal"><span class="pre">10</span></tt>)
SETTINGS_FLOW_CONTROL_OPTIONS</p>
</dd></dl>
<dl class="macro">
<dt id="NGHTTP2_SETTINGS_MAX">
<tt class="descname">NGHTTP2_SETTINGS_MAX</tt><a class="headerlink" href="#NGHTTP2_SETTINGS_MAX" title="Permalink to this definition"></a></dt>
<dd><p>(<tt class="docutils literal"><span class="pre">10</span></tt>)
Maximum ID of <a class="reference internal" href="#nghttp2_settings_id" title="nghttp2_settings_id"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_settings_id</span></tt></a>.</p>
</dd></dl>
</dd></dl>
<dl class="type">
<dt id="nghttp2_error_code">
<tt class="descname">nghttp2_error_code</tt><a class="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>
<dl class="macro">
<dt id="NGHTTP2_NO_ERROR">
<tt class="descname">NGHTTP2_NO_ERROR</tt><a class="headerlink" href="#NGHTTP2_NO_ERROR" title="Permalink to this definition"></a></dt>
<dd><p>(<tt class="docutils literal"><span class="pre">0</span></tt>)
No errors.</p>
</dd></dl>
<dl class="macro">
<dt id="NGHTTP2_PROTOCOL_ERROR">
<tt class="descname">NGHTTP2_PROTOCOL_ERROR</tt><a class="headerlink" href="#NGHTTP2_PROTOCOL_ERROR" title="Permalink to this definition"></a></dt>
<dd><p>(<tt class="docutils literal"><span class="pre">1</span></tt>)
PROTOCOL_ERROR</p>
</dd></dl>
<dl class="macro">
<dt id="NGHTTP2_INTERNAL_ERROR">
<tt class="descname">NGHTTP2_INTERNAL_ERROR</tt><a class="headerlink" href="#NGHTTP2_INTERNAL_ERROR" title="Permalink to this definition"></a></dt>
<dd><p>(<tt class="docutils literal"><span class="pre">2</span></tt>)
INTERNAL_ERROR</p>
</dd></dl>
<dl class="macro">
<dt id="NGHTTP2_FLOW_CONTROL_ERROR">
<tt class="descname">NGHTTP2_FLOW_CONTROL_ERROR</tt><a class="headerlink" href="#NGHTTP2_FLOW_CONTROL_ERROR" title="Permalink to this definition"></a></dt>
<dd><p>(<tt class="docutils literal"><span class="pre">3</span></tt>)
FLOW_CONTROL_ERROR</p>
</dd></dl>
<dl class="macro">
<dt id="NGHTTP2_STREAM_CLOSED">
<tt class="descname">NGHTTP2_STREAM_CLOSED</tt><a class="headerlink" href="#NGHTTP2_STREAM_CLOSED" title="Permalink to this definition"></a></dt>
<dd><p>(<tt class="docutils literal"><span class="pre">5</span></tt>)
STREAM_CLOSED</p>
</dd></dl>
<dl class="macro">
<dt id="NGHTTP2_FRAME_TOO_LARGE">
<tt class="descname">NGHTTP2_FRAME_TOO_LARGE</tt><a class="headerlink" href="#NGHTTP2_FRAME_TOO_LARGE" title="Permalink to this definition"></a></dt>
<dd><p>(<tt class="docutils literal"><span class="pre">6</span></tt>)
FRAME_TOO_LARGE</p>
</dd></dl>
<dl class="macro">
<dt id="NGHTTP2_REFUSED_STREAM">
<tt class="descname">NGHTTP2_REFUSED_STREAM</tt><a class="headerlink" href="#NGHTTP2_REFUSED_STREAM" title="Permalink to this definition"></a></dt>
<dd><p>(<tt class="docutils literal"><span class="pre">7</span></tt>)
REFUSED_STREAM</p>
</dd></dl>
<dl class="macro">
<dt id="NGHTTP2_CANCEL">
<tt class="descname">NGHTTP2_CANCEL</tt><a class="headerlink" href="#NGHTTP2_CANCEL" title="Permalink to this definition"></a></dt>
<dd><p>(<tt class="docutils literal"><span class="pre">8</span></tt>)
CANCEL</p>
</dd></dl>
<dl class="macro">
<dt id="NGHTTP2_COMPRESSION_ERROR">
<tt class="descname">NGHTTP2_COMPRESSION_ERROR</tt><a class="headerlink" href="#NGHTTP2_COMPRESSION_ERROR" title="Permalink to this definition"></a></dt>
<dd><p>(<tt class="docutils literal"><span class="pre">9</span></tt>)
COMPRESSION_ERROR</p>
</dd></dl>
</dd></dl>
<dl class="type">
<dt id="nghttp2_headers_category">
<tt class="descname">nghttp2_headers_category</tt><a class="headerlink" href="#nghttp2_headers_category" title="Permalink to this definition"></a></dt>
<dd><p>The category of HEADERS, which indicates the role of the frame. In
HTTP/2.0 spec, request, response, push response and other arbitrary
headers (e.g., trailers) are all called just HEADERS. To give the
application the role of incoming HEADERS frame, we define several
categories.</p>
<dl class="macro">
<dt id="NGHTTP2_HCAT_REQUEST">
<tt class="descname">NGHTTP2_HCAT_REQUEST</tt><a class="headerlink" href="#NGHTTP2_HCAT_REQUEST" title="Permalink to this definition"></a></dt>
<dd><p>(<tt class="docutils literal"><span class="pre">0</span></tt>)
The HEADERS frame is opening new stream, which is analogous to
SYN_STREAM in SPDY.</p>
</dd></dl>
<dl class="macro">
<dt id="NGHTTP2_HCAT_RESPONSE">
<tt class="descname">NGHTTP2_HCAT_RESPONSE</tt><a class="headerlink" href="#NGHTTP2_HCAT_RESPONSE" title="Permalink to this definition"></a></dt>
<dd><p>(<tt class="docutils literal"><span class="pre">1</span></tt>)
The HEADERS frame is the first response headers, which is
analogous to SYN_REPLY in SPDY.</p>
</dd></dl>
<dl class="macro">
<dt id="NGHTTP2_HCAT_PUSH_RESPONSE">
<tt class="descname">NGHTTP2_HCAT_PUSH_RESPONSE</tt><a class="headerlink" href="#NGHTTP2_HCAT_PUSH_RESPONSE" title="Permalink to this definition"></a></dt>
<dd><p>(<tt class="docutils literal"><span class="pre">2</span></tt>)
The HEADERS frame is the first headers sent against reserved
stream.</p>
</dd></dl>
<dl class="macro">
<dt id="NGHTTP2_HCAT_HEADERS">
<tt class="descname">NGHTTP2_HCAT_HEADERS</tt><a class="headerlink" href="#NGHTTP2_HCAT_HEADERS" title="Permalink to this definition"></a></dt>
<dd><p>(<tt class="docutils literal"><span class="pre">3</span></tt>)
The HEADERS frame which does not apply for the above categories,
which is analogous to HEADERS in SPDY.</p>
</dd></dl>
</dd></dl>
<dl class="type">
<dt id="nghttp2_opt">
<tt class="descname">nghttp2_opt</tt><a class="headerlink" href="#nghttp2_opt" title="Permalink to this definition"></a></dt>
<dd><p>Configuration options for <a class="reference internal" href="#nghttp2_session" title="nghttp2_session"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_session</span></tt></a>.</p>
<dl class="macro">
2013-08-08 18:52:42 +02:00
<dt id="NGHTTP2_OPT_NO_AUTO_STREAM_WINDOW_UPDATE">
<tt class="descname">NGHTTP2_OPT_NO_AUTO_STREAM_WINDOW_UPDATE</tt><a class="headerlink" href="#NGHTTP2_OPT_NO_AUTO_STREAM_WINDOW_UPDATE" title="Permalink to this definition"></a></dt>
2013-07-28 14:26:41 +02:00
<dd><p>(<tt class="docutils literal"><span class="pre">1</span></tt>)
2013-08-08 18:52:42 +02:00
This option prevents the library from sending WINDOW_UPDATE for a
stream automatically. If this option is set, the application is
2013-07-28 14:26:41 +02:00
responsible for sending WINDOW_UPDATE using
<a class="reference internal" href="#nghttp2_submit_window_update" title="nghttp2_submit_window_update"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_submit_window_update()</span></tt></a>.</p>
</dd></dl>
2013-08-08 18:52:42 +02:00
<dl class="macro">
<dt id="NGHTTP2_OPT_NO_AUTO_CONNECTION_WINDOW_UPDATE">
<tt class="descname">NGHTTP2_OPT_NO_AUTO_CONNECTION_WINDOW_UPDATE</tt><a class="headerlink" href="#NGHTTP2_OPT_NO_AUTO_CONNECTION_WINDOW_UPDATE" title="Permalink to this definition"></a></dt>
<dd><p>(<tt class="docutils literal"><span class="pre">2</span></tt>)
This option prevents the library from sending WINDOW_UPDATE for a
connection automatically. If this option is set, the application
is responsible for sending WINDOW_UPDATE with stream ID 0 using
<a class="reference internal" href="#nghttp2_submit_window_update" title="nghttp2_submit_window_update"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_submit_window_update()</span></tt></a>.</p>
</dd></dl>
2013-07-28 14:26:41 +02:00
</dd></dl>
</div>
<div class="section" id="types-structs-unions-and-typedefs">
<h2>Types (structs, unions and typedefs)<a class="headerlink" href="#types-structs-unions-and-typedefs" title="Permalink to this headline"></a></h2>
<dl class="type">
<dt id="nghttp2_session">
<tt class="descname">nghttp2_session</tt><a class="headerlink" href="#nghttp2_session" title="Permalink to this definition"></a></dt>
<dd><p>The primary structure to hold the resources needed for a HTTP/2.0
session. The details of this structure are intentionally hidden
from the public API.</p>
</dd></dl>
<dl class="type">
<dt id="nghttp2_nv">
<tt class="descname">nghttp2_nv</tt><a class="headerlink" href="#nghttp2_nv" title="Permalink to this definition"></a></dt>
<dd><p>The name/value pair, which mainly used to represent header fields.</p>
<dl class="member">
<dt id="nghttp2_nv.name">
uint8_t *<tt class="descname">name</tt><a class="headerlink" href="#nghttp2_nv.name" title="Permalink to this definition"></a></dt>
2013-08-04 11:30:37 +02:00
<dd><p>The <em>name</em> byte string, which is not necessarily <tt class="docutils literal"><span class="pre">NULL</span></tt>
terminated.</p>
2013-07-28 14:26:41 +02:00
</dd></dl>
<dl class="member">
<dt id="nghttp2_nv.value">
uint8_t *<tt class="descname">value</tt><a class="headerlink" href="#nghttp2_nv.value" title="Permalink to this definition"></a></dt>
2013-08-04 11:30:37 +02:00
<dd><p>The <em>value</em> byte string, which is not necessarily <tt class="docutils literal"><span class="pre">NULL</span></tt>
2013-07-28 14:26:41 +02:00
terminated.</p>
</dd></dl>
<dl class="member">
<dt id="nghttp2_nv.namelen">
uint16_t <tt class="descname">namelen</tt><a class="headerlink" href="#nghttp2_nv.namelen" title="Permalink to this definition"></a></dt>
<dd><p>The length of the <em>name</em>.</p>
</dd></dl>
<dl class="member">
<dt id="nghttp2_nv.valuelen">
uint16_t <tt class="descname">valuelen</tt><a class="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>
<dl class="type">
<dt id="nghttp2_frame_hd">
<tt class="descname">nghttp2_frame_hd</tt><a class="headerlink" href="#nghttp2_frame_hd" title="Permalink to this definition"></a></dt>
<dd><p>The frame header.</p>
<dl class="member">
<dt id="nghttp2_frame_hd.length">
uint16_t <tt class="descname">length</tt><a class="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>
<dl class="member">
<dt id="nghttp2_frame_hd.type">
uint8_t <tt class="descname">type</tt><a class="headerlink" href="#nghttp2_frame_hd.type" title="Permalink to this definition"></a></dt>
<dd><p>The type of this frame. See <a class="reference internal" href="#nghttp2_frame" title="nghttp2_frame"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_frame()</span></tt></a>.</p>
</dd></dl>
<dl class="member">
<dt id="nghttp2_frame_hd.flags">
uint8_t <tt class="descname">flags</tt><a class="headerlink" href="#nghttp2_frame_hd.flags" title="Permalink to this definition"></a></dt>
<dd><p>The flags.</p>
</dd></dl>
<dl class="member">
<dt id="nghttp2_frame_hd.stream_id">
int32_t <tt class="descname">stream_id</tt><a class="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>
<dl class="type">
<dt id="nghttp2_data_source">
<tt class="descname">nghttp2_data_source</tt><a class="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
<a class="reference internal" href="#nghttp2_data_source_read_callback" title="nghttp2_data_source_read_callback"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_data_source_read_callback</span></tt></a>.</p>
<dl class="member">
<dt id="nghttp2_data_source.fd">
int <tt class="descname">fd</tt><a class="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>
<dl class="member">
<dt id="nghttp2_data_source.ptr">
void *<tt class="descname">ptr</tt><a class="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>
<dl class="type">
<dt id="nghttp2_data_source_read_callback">
typedef ssize_t <tt class="descname">(*nghttp2_data_source_read_callback)</tt><big>(</big><a class="reference internal" href="#nghttp2_session" title="nghttp2_session">nghttp2_session</a><em>&nbsp;*session</em>, int32_t<em>&nbsp;stream_id</em>, uint8_t<em>&nbsp;*buf</em>, size_t<em>&nbsp;length</em>, int<em>&nbsp;*eof</em>, <a class="reference internal" href="#nghttp2_data_source" title="nghttp2_data_source">nghttp2_data_source</a><em>&nbsp;*source</em>, void<em>&nbsp;*user_data</em><big>)</big><a class="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 <a class="reference internal" href="#NGHTTP2_ERR_DEFERRED" title="NGHTTP2_ERR_DEFERRED"><tt class="xref c c-macro docutils literal"><span class="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 <a class="reference internal" href="#nghttp2_session_resume_data" title="nghttp2_session_resume_data"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_resume_data()</span></tt></a>.
In case of error, there are 2 choices. Returning
<a class="reference internal" href="#NGHTTP2_ERR_TEMPORAL_CALLBACK_FAILURE" title="NGHTTP2_ERR_TEMPORAL_CALLBACK_FAILURE"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_ERR_TEMPORAL_CALLBACK_FAILURE</span></tt></a> will close the stream
by issuing RST_STREAM with <a class="reference internal" href="#NGHTTP2_INTERNAL_ERROR" title="NGHTTP2_INTERNAL_ERROR"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_INTERNAL_ERROR</span></tt></a>.
Returning <a class="reference internal" href="#NGHTTP2_ERR_CALLBACK_FAILURE" title="NGHTTP2_ERR_CALLBACK_FAILURE"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_ERR_CALLBACK_FAILURE</span></tt></a> will signal the
entire session failure.</p>
</dd></dl>
<dl class="type">
<dt id="nghttp2_data_provider">
<tt class="descname">nghttp2_data_provider</tt><a class="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>
<dl class="member">
<dt id="nghttp2_data_provider.source">
<a class="reference internal" href="#nghttp2_data_source" title="nghttp2_data_source">nghttp2_data_source</a> <tt class="descname">source</tt><a class="headerlink" href="#nghttp2_data_provider.source" title="Permalink to this definition"></a></dt>
<dd><p>The data source.</p>
</dd></dl>
<dl class="member">
<dt id="nghttp2_data_provider.read_callback">
<a class="reference internal" href="#nghttp2_data_source_read_callback" title="nghttp2_data_source_read_callback">nghttp2_data_source_read_callback</a> <tt class="descname">read_callback</tt><a class="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>
<dl class="type">
<dt id="nghttp2_headers">
<tt class="descname">nghttp2_headers</tt><a class="headerlink" href="#nghttp2_headers" title="Permalink to this definition"></a></dt>
<dd><p>The HEADERS frame. It has the following members:</p>
<dl class="member">
<dt id="nghttp2_headers.hd">
<a class="reference internal" href="#nghttp2_frame_hd" title="nghttp2_frame_hd">nghttp2_frame_hd</a> <tt class="descname">hd</tt><a class="headerlink" href="#nghttp2_headers.hd" title="Permalink to this definition"></a></dt>
<dd><p>The frame header.</p>
</dd></dl>
<dl class="member">
<dt id="nghttp2_headers.pri">
int32_t <tt class="descname">pri</tt><a class="headerlink" href="#nghttp2_headers.pri" title="Permalink to this definition"></a></dt>
<dd><p>The priority.</p>
</dd></dl>
<dl class="member">
<dt id="nghttp2_headers.nva">
<a class="reference internal" href="#nghttp2_nv" title="nghttp2_nv">nghttp2_nv</a> *<tt class="descname">nva</tt><a class="headerlink" href="#nghttp2_headers.nva" title="Permalink to this definition"></a></dt>
<dd><p>The name/value pairs.</p>
</dd></dl>
<dl class="member">
<dt id="nghttp2_headers.nvlen">
size_t <tt class="descname">nvlen</tt><a class="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>
<dl class="type">
<dt id="nghttp2_priority">
<tt class="descname">nghttp2_priority</tt><a class="headerlink" href="#nghttp2_priority" title="Permalink to this definition"></a></dt>
<dd><p>The PRIORITY frame. It has the following members:</p>
<dl class="member">
<dt id="nghttp2_priority.hd">
<a class="reference internal" href="#nghttp2_frame_hd" title="nghttp2_frame_hd">nghttp2_frame_hd</a> <tt class="descname">hd</tt><a class="headerlink" href="#nghttp2_priority.hd" title="Permalink to this definition"></a></dt>
<dd><p>The frame header.</p>
</dd></dl>
<dl class="member">
<dt id="nghttp2_priority.pri">
int32_t <tt class="descname">pri</tt><a class="headerlink" href="#nghttp2_priority.pri" title="Permalink to this definition"></a></dt>
<dd><p>The priority.</p>
</dd></dl>
</dd></dl>
<dl class="type">
<dt id="nghttp2_rst_stream">
<tt class="descname">nghttp2_rst_stream</tt><a class="headerlink" href="#nghttp2_rst_stream" title="Permalink to this definition"></a></dt>
<dd><p>The RST_STREAM frame. It has the following members:</p>
<dl class="member">
<dt id="nghttp2_rst_stream.hd">
<a class="reference internal" href="#nghttp2_frame_hd" title="nghttp2_frame_hd">nghttp2_frame_hd</a> <tt class="descname">hd</tt><a class="headerlink" href="#nghttp2_rst_stream.hd" title="Permalink to this definition"></a></dt>
<dd><p>The frame header.</p>
</dd></dl>
<dl class="member">
<dt id="nghttp2_rst_stream.error_code">
<a class="reference internal" href="#nghttp2_error_code" title="nghttp2_error_code">nghttp2_error_code</a> <tt class="descname">error_code</tt><a class="headerlink" href="#nghttp2_rst_stream.error_code" title="Permalink to this definition"></a></dt>
<dd><p>The error code. See <a class="reference internal" href="#nghttp2_error_code" title="nghttp2_error_code"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_error_code</span></tt></a>.</p>
</dd></dl>
</dd></dl>
<dl class="type">
<dt id="nghttp2_settings_entry">
<tt class="descname">nghttp2_settings_entry</tt><a class="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>
<dl class="member">
<dt id="nghttp2_settings_entry.settings_id">
int32_t <tt class="descname">settings_id</tt><a class="headerlink" href="#nghttp2_settings_entry.settings_id" title="Permalink to this definition"></a></dt>
<dd><p>The SETTINGS ID. See <a class="reference internal" href="#nghttp2_settings_id" title="nghttp2_settings_id"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_settings_id</span></tt></a>.</p>
</dd></dl>
<dl class="member">
<dt id="nghttp2_settings_entry.value">
uint32_t <tt class="descname">value</tt><a class="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>
<dl class="type">
<dt id="nghttp2_settings">
<tt class="descname">nghttp2_settings</tt><a class="headerlink" href="#nghttp2_settings" title="Permalink to this definition"></a></dt>
<dd><p>The SETTINGS frame. It has the following members:</p>
<dl class="member">
<dt id="nghttp2_settings.hd">
<a class="reference internal" href="#nghttp2_frame_hd" title="nghttp2_frame_hd">nghttp2_frame_hd</a> <tt class="descname">hd</tt><a class="headerlink" href="#nghttp2_settings.hd" title="Permalink to this definition"></a></dt>
<dd><p>The frame header.</p>
</dd></dl>
<dl class="member">
<dt id="nghttp2_settings.niv">
size_t <tt class="descname">niv</tt><a class="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>
<dl class="member">
<dt id="nghttp2_settings.iv">
<a class="reference internal" href="#nghttp2_settings_entry" title="nghttp2_settings_entry">nghttp2_settings_entry</a> *<tt class="descname">iv</tt><a class="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>
<dl class="type">
<dt id="nghttp2_push_promise">
<tt class="descname">nghttp2_push_promise</tt><a class="headerlink" href="#nghttp2_push_promise" title="Permalink to this definition"></a></dt>
<dd><p>The PUSH_PROMISE frame. It has the following members:</p>
<dl class="member">
<dt id="nghttp2_push_promise.hd">
<a class="reference internal" href="#nghttp2_frame_hd" title="nghttp2_frame_hd">nghttp2_frame_hd</a> <tt class="descname">hd</tt><a class="headerlink" href="#nghttp2_push_promise.hd" title="Permalink to this definition"></a></dt>
<dd><p>The frame header.</p>
</dd></dl>
<dl class="member">
<dt id="nghttp2_push_promise.promised_stream_id">
int32_t <tt class="descname">promised_stream_id</tt><a class="headerlink" href="#nghttp2_push_promise.promised_stream_id" title="Permalink to this definition"></a></dt>
<dd><p>The promised stream ID</p>
</dd></dl>
<dl class="member">
<dt id="nghttp2_push_promise.nva">
<a class="reference internal" href="#nghttp2_nv" title="nghttp2_nv">nghttp2_nv</a> *<tt class="descname">nva</tt><a class="headerlink" href="#nghttp2_push_promise.nva" title="Permalink to this definition"></a></dt>
<dd><p>The name/value pairs.</p>
</dd></dl>
<dl class="member">
<dt id="nghttp2_push_promise.nvlen">
size_t <tt class="descname">nvlen</tt><a class="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>
<dl class="type">
<dt id="nghttp2_ping">
<tt class="descname">nghttp2_ping</tt><a class="headerlink" href="#nghttp2_ping" title="Permalink to this definition"></a></dt>
<dd><p>The PING frame. It has the following members:</p>
<dl class="member">
<dt id="nghttp2_ping.hd">
<a class="reference internal" href="#nghttp2_frame_hd" title="nghttp2_frame_hd">nghttp2_frame_hd</a> <tt class="descname">hd</tt><a class="headerlink" href="#nghttp2_ping.hd" title="Permalink to this definition"></a></dt>
<dd><p>The frame header.</p>
</dd></dl>
<dl class="member">
<dt>
<tt class="descname">uint8_t opaque_data[8]</tt></dt>
<dd><p>The opaque data</p>
</dd></dl>
</dd></dl>
<dl class="type">
<dt id="nghttp2_goaway">
<tt class="descname">nghttp2_goaway</tt><a class="headerlink" href="#nghttp2_goaway" title="Permalink to this definition"></a></dt>
<dd><p>The GOAWAY frame. It has the following members:</p>
<dl class="member">
<dt id="nghttp2_goaway.hd">
<a class="reference internal" href="#nghttp2_frame_hd" title="nghttp2_frame_hd">nghttp2_frame_hd</a> <tt class="descname">hd</tt><a class="headerlink" href="#nghttp2_goaway.hd" title="Permalink to this definition"></a></dt>
<dd><p>The frame header.</p>
</dd></dl>
<dl class="member">
<dt id="nghttp2_goaway.last_stream_id">
int32_t <tt class="descname">last_stream_id</tt><a class="headerlink" href="#nghttp2_goaway.last_stream_id" title="Permalink to this definition"></a></dt>
<dd><p>The last stream stream ID.</p>
</dd></dl>
<dl class="member">
<dt id="nghttp2_goaway.error_code">
<a class="reference internal" href="#nghttp2_error_code" title="nghttp2_error_code">nghttp2_error_code</a> <tt class="descname">error_code</tt><a class="headerlink" href="#nghttp2_goaway.error_code" title="Permalink to this definition"></a></dt>
<dd><p>The error code. See <a class="reference internal" href="#nghttp2_error_code" title="nghttp2_error_code"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_error_code</span></tt></a>.</p>
</dd></dl>
<dl class="member">
<dt id="nghttp2_goaway.opaque_data">
uint8_t *<tt class="descname">opaque_data</tt><a class="headerlink" href="#nghttp2_goaway.opaque_data" title="Permalink to this definition"></a></dt>
<dd><p>The additional debug data</p>
</dd></dl>
<dl class="member">
<dt id="nghttp2_goaway.opaque_data_len">
size_t <tt class="descname">opaque_data_len</tt><a class="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>
<dl class="type">
<dt id="nghttp2_window_update">
<tt class="descname">nghttp2_window_update</tt><a class="headerlink" href="#nghttp2_window_update" title="Permalink to this definition"></a></dt>
<dd><p>The WINDOW_UPDATE frame. It has the following members:</p>
<dl class="member">
<dt id="nghttp2_window_update.hd">
<a class="reference internal" href="#nghttp2_frame_hd" title="nghttp2_frame_hd">nghttp2_frame_hd</a> <tt class="descname">hd</tt><a class="headerlink" href="#nghttp2_window_update.hd" title="Permalink to this definition"></a></dt>
<dd><p>The frame header.</p>
</dd></dl>
<dl class="member">
<dt id="nghttp2_window_update.window_size_increment">
int32_t <tt class="descname">window_size_increment</tt><a class="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>
<dl class="type">
<dt id="nghttp2_frame">
<tt class="descname">nghttp2_frame</tt><a class="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>
<dl class="member">
<dt id="nghttp2_frame.hd">
<a class="reference internal" href="#nghttp2_frame_hd" title="nghttp2_frame_hd">nghttp2_frame_hd</a> <tt class="descname">hd</tt><a class="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>
<dl class="member">
<dt id="nghttp2_frame.headers">
<a class="reference internal" href="#nghttp2_headers" title="nghttp2_headers">nghttp2_headers</a> <tt class="descname">headers</tt><a class="headerlink" href="#nghttp2_frame.headers" title="Permalink to this definition"></a></dt>
<dd><p>The HEADERS frame.</p>
</dd></dl>
<dl class="member">
<dt id="nghttp2_frame.priority">
<a class="reference internal" href="#nghttp2_priority" title="nghttp2_priority">nghttp2_priority</a> <tt class="descname">priority</tt><a class="headerlink" href="#nghttp2_frame.priority" title="Permalink to this definition"></a></dt>
<dd><p>The PRIORITY frame.</p>
</dd></dl>
<dl class="member">
<dt id="nghttp2_frame.rst_stream">
<a class="reference internal" href="#nghttp2_rst_stream" title="nghttp2_rst_stream">nghttp2_rst_stream</a> <tt class="descname">rst_stream</tt><a class="headerlink" href="#nghttp2_frame.rst_stream" title="Permalink to this definition"></a></dt>
<dd><p>The RST_STREAM frame.</p>
</dd></dl>
<dl class="member">
<dt id="nghttp2_frame.settings">
<a class="reference internal" href="#nghttp2_settings" title="nghttp2_settings">nghttp2_settings</a> <tt class="descname">settings</tt><a class="headerlink" href="#nghttp2_frame.settings" title="Permalink to this definition"></a></dt>
<dd><p>The SETTINGS frame.</p>
</dd></dl>
<dl class="member">
<dt id="nghttp2_frame.push_promise">
<a class="reference internal" href="#nghttp2_push_promise" title="nghttp2_push_promise">nghttp2_push_promise</a> <tt class="descname">push_promise</tt><a class="headerlink" href="#nghttp2_frame.push_promise" title="Permalink to this definition"></a></dt>
<dd><p>The PUSH_PROMISE frame.</p>
</dd></dl>
<dl class="member">
<dt id="nghttp2_frame.ping">
<a class="reference internal" href="#nghttp2_ping" title="nghttp2_ping">nghttp2_ping</a> <tt class="descname">ping</tt><a class="headerlink" href="#nghttp2_frame.ping" title="Permalink to this definition"></a></dt>
<dd><p>The PING frame.</p>
</dd></dl>
<dl class="member">
<dt id="nghttp2_frame.goaway">
<a class="reference internal" href="#nghttp2_goaway" title="nghttp2_goaway">nghttp2_goaway</a> <tt class="descname">goaway</tt><a class="headerlink" href="#nghttp2_frame.goaway" title="Permalink to this definition"></a></dt>
<dd><p>The GOAWAY frame.</p>
</dd></dl>
<dl class="member">
<dt id="nghttp2_frame.window_update">
<a class="reference internal" href="#nghttp2_window_update" title="nghttp2_window_update">nghttp2_window_update</a> <tt class="descname">window_update</tt><a class="headerlink" href="#nghttp2_frame.window_update" title="Permalink to this definition"></a></dt>
<dd><p>The WINDOW_UPDATE frame.</p>
</dd></dl>
</dd></dl>
<dl class="type">
<dt id="nghttp2_send_callback">
typedef ssize_t <tt class="descname">(*nghttp2_send_callback)</tt><big>(</big><a class="reference internal" href="#nghttp2_session" title="nghttp2_session">nghttp2_session</a><em>&nbsp;*session</em>, const uint8_t<em>&nbsp;*data</em>, size_t<em>&nbsp;length</em>, int<em>&nbsp;flags</em>, void<em>&nbsp;*user_data</em><big>)</big><a class="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 <a class="reference internal" href="#NGHTTP2_ERR_WOULDBLOCK" title="NGHTTP2_ERR_WOULDBLOCK"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_ERR_WOULDBLOCK</span></tt></a>. For other errors, it
must return <a class="reference internal" href="#NGHTTP2_ERR_CALLBACK_FAILURE" title="NGHTTP2_ERR_CALLBACK_FAILURE"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_ERR_CALLBACK_FAILURE</span></tt></a>.</p>
</dd></dl>
<dl class="type">
<dt id="nghttp2_recv_callback">
typedef ssize_t <tt class="descname">(*nghttp2_recv_callback)</tt><big>(</big><a class="reference internal" href="#nghttp2_session" title="nghttp2_session">nghttp2_session</a><em>&nbsp;*session</em>, uint8_t<em>&nbsp;*buf</em>, size_t<em>&nbsp;length</em>, int<em>&nbsp;flags</em>, void<em>&nbsp;*user_data</em><big>)</big><a class="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 <a class="reference internal" href="#NGHTTP2_ERR_WOULDBLOCK" title="NGHTTP2_ERR_WOULDBLOCK"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_ERR_WOULDBLOCK</span></tt></a>. If
it gets EOF before it reads any single byte, it must return
<a class="reference internal" href="#NGHTTP2_ERR_EOF" title="NGHTTP2_ERR_EOF"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_ERR_EOF</span></tt></a>. For other errors, it must return
<a class="reference internal" href="#NGHTTP2_ERR_CALLBACK_FAILURE" title="NGHTTP2_ERR_CALLBACK_FAILURE"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_ERR_CALLBACK_FAILURE</span></tt></a>.</p>
</dd></dl>
<dl class="type">
<dt id="nghttp2_on_frame_recv_callback">
2013-08-30 17:52:54 +02:00
typedef int <tt class="descname">(*nghttp2_on_frame_recv_callback)</tt><big>(</big><a class="reference internal" href="#nghttp2_session" title="nghttp2_session">nghttp2_session</a><em>&nbsp;*session</em>, <a class="reference internal" href="#nghttp2_frame" title="nghttp2_frame">nghttp2_frame</a><em>&nbsp;*frame</em>, void<em>&nbsp;*user_data</em><big>)</big><a class="headerlink" href="#nghttp2_on_frame_recv_callback" title="Permalink to this definition"></a></dt>
2013-07-28 14:26:41 +02:00
<dd><p>Callback function invoked by <a class="reference internal" href="#nghttp2_session_recv" title="nghttp2_session_recv"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_recv()</span></tt></a> when a
non-DATA frame is received.</p>
2013-08-30 17:52:54 +02:00
<p>The implementation of this function must return 0 if it
succeeds. If nonzero is returned, it is treated as fatal error and
<a class="reference internal" href="#nghttp2_session_recv" title="nghttp2_session_recv"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_recv()</span></tt></a> and <a class="reference internal" href="#nghttp2_session_send" title="nghttp2_session_send"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_send()</span></tt></a> functions
immediately return <a class="reference internal" href="#NGHTTP2_ERR_CALLBACK_FAILURE" title="NGHTTP2_ERR_CALLBACK_FAILURE"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_ERR_CALLBACK_FAILURE</span></tt></a>.</p>
2013-07-28 14:26:41 +02:00
</dd></dl>
<dl class="type">
<dt id="nghttp2_on_invalid_frame_recv_callback">
2013-08-30 17:52:54 +02:00
typedef int <tt class="descname">(*nghttp2_on_invalid_frame_recv_callback)</tt><big>(</big><a class="reference internal" href="#nghttp2_session" title="nghttp2_session">nghttp2_session</a><em>&nbsp;*session</em>, <a class="reference internal" href="#nghttp2_frame" title="nghttp2_frame">nghttp2_frame</a><em>&nbsp;*frame</em>, <a class="reference internal" href="#nghttp2_error_code" title="nghttp2_error_code">nghttp2_error_code</a><em>&nbsp;error_code</em>, void<em>&nbsp;*user_data</em><big>)</big><a class="headerlink" href="#nghttp2_on_invalid_frame_recv_callback" title="Permalink to this definition"></a></dt>
2013-07-28 14:26:41 +02:00
<dd><p>Callback function invoked by <a class="reference internal" href="#nghttp2_session_recv" title="nghttp2_session_recv"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_recv()</span></tt></a> when an
invalid non-DATA frame is received. The <em>error_code</em> is one of the
<a class="reference internal" href="#nghttp2_error_code" title="nghttp2_error_code"><tt class="xref c c-macro docutils literal"><span class="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.</p>
2013-08-30 17:52:54 +02:00
<p>The implementation of this function must return 0 if it
succeeds. If nonzero is returned, it is treated as fatal error and
<a class="reference internal" href="#nghttp2_session_recv" title="nghttp2_session_recv"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_recv()</span></tt></a> and <a class="reference internal" href="#nghttp2_session_send" title="nghttp2_session_send"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_send()</span></tt></a> functions
immediately return <a class="reference internal" href="#NGHTTP2_ERR_CALLBACK_FAILURE" title="NGHTTP2_ERR_CALLBACK_FAILURE"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_ERR_CALLBACK_FAILURE</span></tt></a>.</p>
2013-07-28 14:26:41 +02:00
</dd></dl>
<dl class="type">
<dt id="nghttp2_on_data_chunk_recv_callback">
2013-08-30 17:52:54 +02:00
typedef int <tt class="descname">(*nghttp2_on_data_chunk_recv_callback)</tt><big>(</big><a class="reference internal" href="#nghttp2_session" title="nghttp2_session">nghttp2_session</a><em>&nbsp;*session</em>, uint8_t<em>&nbsp;flags</em>, int32_t<em>&nbsp;stream_id</em>, const uint8_t<em>&nbsp;*data</em>, size_t<em>&nbsp;len</em>, void<em>&nbsp;*user_data</em><big>)</big><a class="headerlink" href="#nghttp2_on_data_chunk_recv_callback" title="Permalink to this definition"></a></dt>
2013-07-28 14:26:41 +02:00
<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. <tt class="docutils literal"><span class="pre">(flags</span> <span class="pre">&amp;</span> <span class="pre">NGHTTP2_FLAG_END_STREAM)</span> <span class="pre">!=</span> <span class="pre">0</span></tt> does not
necessarily mean this chunk of data is the last one in the
stream. You should use <a class="reference internal" href="#nghttp2_on_data_recv_callback" title="nghttp2_on_data_recv_callback"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_on_data_recv_callback</span></tt></a> to
know all data frames are received.</p>
2013-08-30 17:52:54 +02:00
<p>The implementation of this function must return 0 if it
succeeds. If nonzero is returned, it is treated as fatal error and
<a class="reference internal" href="#nghttp2_session_recv" title="nghttp2_session_recv"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_recv()</span></tt></a> and <a class="reference internal" href="#nghttp2_session_send" title="nghttp2_session_send"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_send()</span></tt></a> functions
immediately return <a class="reference internal" href="#NGHTTP2_ERR_CALLBACK_FAILURE" title="NGHTTP2_ERR_CALLBACK_FAILURE"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_ERR_CALLBACK_FAILURE</span></tt></a>.</p>
2013-07-28 14:26:41 +02:00
</dd></dl>
<dl class="type">
<dt id="nghttp2_on_data_recv_callback">
2013-08-30 17:52:54 +02:00
typedef int <tt class="descname">(*nghttp2_on_data_recv_callback)</tt><big>(</big><a class="reference internal" href="#nghttp2_session" title="nghttp2_session">nghttp2_session</a><em>&nbsp;*session</em>, uint16_t<em>&nbsp;length</em>, uint8_t<em>&nbsp;flags</em>, int32_t<em>&nbsp;stream_id</em>, void<em>&nbsp;*user_data</em><big>)</big><a class="headerlink" href="#nghttp2_on_data_recv_callback" title="Permalink to this definition"></a></dt>
2013-07-28 14:26:41 +02:00
<dd><p>Callback function invoked when DATA frame is received. The actual
data it contains are received by
<a class="reference internal" href="#nghttp2_on_data_chunk_recv_callback" title="nghttp2_on_data_chunk_recv_callback"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_on_data_chunk_recv_callback</span></tt></a>.</p>
2013-08-30 17:52:54 +02:00
<p>The implementation of this function must return 0 if it
succeeds. If nonzero is returned, it is treated as fatal error and
<a class="reference internal" href="#nghttp2_session_recv" title="nghttp2_session_recv"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_recv()</span></tt></a> and <a class="reference internal" href="#nghttp2_session_send" title="nghttp2_session_send"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_send()</span></tt></a> functions
immediately return <a class="reference internal" href="#NGHTTP2_ERR_CALLBACK_FAILURE" title="NGHTTP2_ERR_CALLBACK_FAILURE"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_ERR_CALLBACK_FAILURE</span></tt></a>.</p>
2013-07-28 14:26:41 +02:00
</dd></dl>
<dl class="type">
<dt id="nghttp2_before_frame_send_callback">
2013-08-30 17:52:54 +02:00
typedef int <tt class="descname">(*nghttp2_before_frame_send_callback)</tt><big>(</big><a class="reference internal" href="#nghttp2_session" title="nghttp2_session">nghttp2_session</a><em>&nbsp;*session</em>, <a class="reference internal" href="#nghttp2_frame" title="nghttp2_frame">nghttp2_frame</a><em>&nbsp;*frame</em>, void<em>&nbsp;*user_data</em><big>)</big><a class="headerlink" href="#nghttp2_before_frame_send_callback" title="Permalink to this definition"></a></dt>
2013-07-28 14:26:41 +02:00
<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
<a class="reference internal" href="#nghttp2_session_get_stream_user_data" title="nghttp2_session_get_stream_user_data"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_get_stream_user_data()</span></tt></a>), which is not assigned
when it was queued.</p>
2013-08-30 17:52:54 +02:00
<p>The implementation of this function must return 0 if it
succeeds. If nonzero is returned, it is treated as fatal error and
<a class="reference internal" href="#nghttp2_session_recv" title="nghttp2_session_recv"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_recv()</span></tt></a> and <a class="reference internal" href="#nghttp2_session_send" title="nghttp2_session_send"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_send()</span></tt></a> functions
immediately return <a class="reference internal" href="#NGHTTP2_ERR_CALLBACK_FAILURE" title="NGHTTP2_ERR_CALLBACK_FAILURE"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_ERR_CALLBACK_FAILURE</span></tt></a>.</p>
2013-07-28 14:26:41 +02:00
</dd></dl>
<dl class="type">
<dt id="nghttp2_on_frame_send_callback">
2013-08-30 17:52:54 +02:00
typedef int <tt class="descname">(*nghttp2_on_frame_send_callback)</tt><big>(</big><a class="reference internal" href="#nghttp2_session" title="nghttp2_session">nghttp2_session</a><em>&nbsp;*session</em>, <a class="reference internal" href="#nghttp2_frame" title="nghttp2_frame">nghttp2_frame</a><em>&nbsp;*frame</em>, void<em>&nbsp;*user_data</em><big>)</big><a class="headerlink" href="#nghttp2_on_frame_send_callback" title="Permalink to this definition"></a></dt>
2013-07-28 14:26:41 +02:00
<dd><p>Callback function invoked after the non-DATA frame <em>frame</em> is sent.</p>
2013-08-30 17:52:54 +02:00
<p>The implementation of this function must return 0 if it
succeeds. If nonzero is returned, it is treated as fatal error and
<a class="reference internal" href="#nghttp2_session_recv" title="nghttp2_session_recv"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_recv()</span></tt></a> and <a class="reference internal" href="#nghttp2_session_send" title="nghttp2_session_send"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_send()</span></tt></a> functions
immediately return <a class="reference internal" href="#NGHTTP2_ERR_CALLBACK_FAILURE" title="NGHTTP2_ERR_CALLBACK_FAILURE"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_ERR_CALLBACK_FAILURE</span></tt></a>.</p>
2013-07-28 14:26:41 +02:00
</dd></dl>
<dl class="type">
<dt id="nghttp2_on_frame_not_send_callback">
2013-08-30 17:52:54 +02:00
typedef int <tt class="descname">(*nghttp2_on_frame_not_send_callback)</tt><big>(</big><a class="reference internal" href="#nghttp2_session" title="nghttp2_session">nghttp2_session</a><em>&nbsp;*session</em>, <a class="reference internal" href="#nghttp2_frame" title="nghttp2_frame">nghttp2_frame</a><em>&nbsp;*frame</em>, int<em>&nbsp;lib_error_code</em>, void<em>&nbsp;*user_data</em><big>)</big><a class="headerlink" href="#nghttp2_on_frame_not_send_callback" title="Permalink to this definition"></a></dt>
2013-07-28 14:26:41 +02:00
<dd><p>Callback function invoked after the non-DATA frame <em>frame</em> is not
sent because of the error. The error is indicated by the
<em>lib_error_code</em>, which is one of the values defined in
<a class="reference internal" href="#nghttp2_error" title="nghttp2_error"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_error</span></tt></a>.</p>
2013-08-30 17:52:54 +02:00
<p>The implementation of this function must return 0 if it
succeeds. If nonzero is returned, it is treated as fatal error and
<a class="reference internal" href="#nghttp2_session_recv" title="nghttp2_session_recv"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_recv()</span></tt></a> and <a class="reference internal" href="#nghttp2_session_send" title="nghttp2_session_send"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_send()</span></tt></a> functions
immediately return <a class="reference internal" href="#NGHTTP2_ERR_CALLBACK_FAILURE" title="NGHTTP2_ERR_CALLBACK_FAILURE"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_ERR_CALLBACK_FAILURE</span></tt></a>.</p>
2013-07-28 14:26:41 +02:00
</dd></dl>
<dl class="type">
<dt id="nghttp2_on_data_send_callback">
2013-08-30 17:52:54 +02:00
typedef int <tt class="descname">(*nghttp2_on_data_send_callback)</tt><big>(</big><a class="reference internal" href="#nghttp2_session" title="nghttp2_session">nghttp2_session</a><em>&nbsp;*session</em>, uint16_t<em>&nbsp;length</em>, uint8_t<em>&nbsp;flags</em>, int32_t<em>&nbsp;stream_id</em>, void<em>&nbsp;*user_data</em><big>)</big><a class="headerlink" href="#nghttp2_on_data_send_callback" title="Permalink to this definition"></a></dt>
2013-07-28 14:26:41 +02:00
<dd><p>Callback function invoked after DATA frame is sent.</p>
2013-08-30 17:52:54 +02:00
<p>The implementation of this function must return 0 if it
succeeds. If nonzero is returned, it is treated as fatal error and
<a class="reference internal" href="#nghttp2_session_recv" title="nghttp2_session_recv"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_recv()</span></tt></a> and <a class="reference internal" href="#nghttp2_session_send" title="nghttp2_session_send"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_send()</span></tt></a> functions
immediately return <a class="reference internal" href="#NGHTTP2_ERR_CALLBACK_FAILURE" title="NGHTTP2_ERR_CALLBACK_FAILURE"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_ERR_CALLBACK_FAILURE</span></tt></a>.</p>
2013-07-28 14:26:41 +02:00
</dd></dl>
<dl class="type">
<dt id="nghttp2_on_stream_close_callback">
2013-08-30 17:52:54 +02:00
typedef int <tt class="descname">(*nghttp2_on_stream_close_callback)</tt><big>(</big><a class="reference internal" href="#nghttp2_session" title="nghttp2_session">nghttp2_session</a><em>&nbsp;*session</em>, int32_t<em>&nbsp;stream_id</em>, <a class="reference internal" href="#nghttp2_error_code" title="nghttp2_error_code">nghttp2_error_code</a><em>&nbsp;error_code</em>, void<em>&nbsp;*user_data</em><big>)</big><a class="headerlink" href="#nghttp2_on_stream_close_callback" title="Permalink to this definition"></a></dt>
2013-07-28 14:26:41 +02:00
<dd><p>Callback function invoked when the stream <em>stream_id</em> is
closed. The reason of closure is indicated by the
<em>error_code</em>. The stream_user_data, which was specified in
<a class="reference internal" href="#nghttp2_submit_request" title="nghttp2_submit_request"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_submit_request()</span></tt></a> or <a class="reference internal" href="#nghttp2_submit_headers" title="nghttp2_submit_headers"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_submit_headers()</span></tt></a>, is
still available in this function.</p>
2013-08-30 17:52:54 +02:00
<p>The implementation of this function must return 0 if it
succeeds. If nonzero is returned, it is treated as fatal error and
<a class="reference internal" href="#nghttp2_session_recv" title="nghttp2_session_recv"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_recv()</span></tt></a> and <a class="reference internal" href="#nghttp2_session_send" title="nghttp2_session_send"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_send()</span></tt></a> functions
immediately return <a class="reference internal" href="#NGHTTP2_ERR_CALLBACK_FAILURE" title="NGHTTP2_ERR_CALLBACK_FAILURE"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_ERR_CALLBACK_FAILURE</span></tt></a>.</p>
2013-07-28 14:26:41 +02:00
</dd></dl>
<dl class="type">
<dt id="nghttp2_on_request_recv_callback">
2013-08-30 17:52:54 +02:00
typedef int <tt class="descname">(*nghttp2_on_request_recv_callback)</tt><big>(</big><a class="reference internal" href="#nghttp2_session" title="nghttp2_session">nghttp2_session</a><em>&nbsp;*session</em>, int32_t<em>&nbsp;stream_id</em>, void<em>&nbsp;*user_data</em><big>)</big><a class="headerlink" href="#nghttp2_on_request_recv_callback" title="Permalink to this definition"></a></dt>
2013-07-28 14:26:41 +02:00
<dd><p>Callback function invoked when the request from the remote peer is
received. In other words, the frame with END_STREAM flag set is
received. In HTTP, this means HTTP request, including request
body, is fully received.</p>
2013-08-30 17:52:54 +02:00
<p>The implementation of this function must return 0 if it
succeeds. If nonzero is returned, it is treated as fatal error and
<a class="reference internal" href="#nghttp2_session_recv" title="nghttp2_session_recv"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_recv()</span></tt></a> and <a class="reference internal" href="#nghttp2_session_send" title="nghttp2_session_send"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_send()</span></tt></a> functions
immediately return <a class="reference internal" href="#NGHTTP2_ERR_CALLBACK_FAILURE" title="NGHTTP2_ERR_CALLBACK_FAILURE"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_ERR_CALLBACK_FAILURE</span></tt></a>.</p>
2013-07-28 14:26:41 +02:00
</dd></dl>
<dl class="type">
<dt id="nghttp2_on_frame_recv_parse_error_callback">
2013-08-30 17:52:54 +02:00
typedef int <tt class="descname">(*nghttp2_on_frame_recv_parse_error_callback)</tt><big>(</big><a class="reference internal" href="#nghttp2_session" title="nghttp2_session">nghttp2_session</a><em>&nbsp;*session</em>, <a class="reference internal" href="#nghttp2_frame_type" title="nghttp2_frame_type">nghttp2_frame_type</a><em>&nbsp;type</em>, const uint8_t<em>&nbsp;*head</em>, size_t<em>&nbsp;headlen</em>, const uint8_t<em>&nbsp;*payload</em>, size_t<em>&nbsp;payloadlen</em>, int<em>&nbsp;lib_error_code</em>, void<em>&nbsp;*user_data</em><big>)</big><a class="headerlink" href="#nghttp2_on_frame_recv_parse_error_callback" title="Permalink to this definition"></a></dt>
2013-07-28 14:26:41 +02:00
<dd><p>Callback function invoked when the received control frame octets
could not be parsed correctly. The <em>type</em> indicates the type of
received non-DATA frame. The <em>head</em> is the pointer to the header of
the received frame. The <em>headlen</em> is the length of the
<em>head</em>. According to the spec, the <em>headlen</em> is always 8. In other
words, the <em>head</em> is the first 8 bytes of the received frame. The
<em>payload</em> is the pointer to the data portion of the received frame.
The <em>payloadlen</em> is the length of the <em>payload</em>. This is the data
after the length field. The <em>lib_error_code</em> is one of the error code
defined in <a class="reference internal" href="#nghttp2_error" title="nghttp2_error"><tt class="xref c c-macro docutils literal"><span class="pre">nghttp2_error</span></tt></a> and indicates the error.</p>
2013-08-30 17:52:54 +02:00
<p>The implementation of this function must return 0 if it
succeeds. If nonzero is returned, it is treated as fatal error and
<a class="reference internal" href="#nghttp2_session_recv" title="nghttp2_session_recv"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_recv()</span></tt></a> and <a class="reference internal" href="#nghttp2_session_send" title="nghttp2_session_send"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_send()</span></tt></a> functions
immediately return <a class="reference internal" href="#NGHTTP2_ERR_CALLBACK_FAILURE" title="NGHTTP2_ERR_CALLBACK_FAILURE"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_ERR_CALLBACK_FAILURE</span></tt></a>.</p>
2013-07-28 14:26:41 +02:00
</dd></dl>
<dl class="type">
<dt id="nghttp2_on_unknown_frame_recv_callback">
2013-08-30 17:52:54 +02:00
typedef int <tt class="descname">(*nghttp2_on_unknown_frame_recv_callback)</tt><big>(</big><a class="reference internal" href="#nghttp2_session" title="nghttp2_session">nghttp2_session</a><em>&nbsp;*session</em>, const uint8_t<em>&nbsp;*head</em>, size_t<em>&nbsp;headlen</em>, const uint8_t<em>&nbsp;*payload</em>, size_t<em>&nbsp;payloadlen</em>, void<em>&nbsp;*user_data</em><big>)</big><a class="headerlink" href="#nghttp2_on_unknown_frame_recv_callback" title="Permalink to this definition"></a></dt>
2013-07-28 14:26:41 +02:00
<dd><p>Callback function invoked when the received frame type is
unknown. The <em>head</em> is the pointer to the header of the received
frame. The <em>headlen</em> is the length of the <em>head</em>. According to the
spec, the <em>headlen</em> is always 8. In other words, the <em>head</em> is the
first 8 bytes of the received frame. The <em>payload</em> is the pointer
to the data portion of the received frame. The <em>payloadlen</em> is the
length of the <em>payload</em>. This is the data after the length field.</p>
2013-08-30 17:52:54 +02:00
<p>The implementation of this function must return 0 if it
succeeds. If nonzero is returned, it is treated as fatal error and
<a class="reference internal" href="#nghttp2_session_recv" title="nghttp2_session_recv"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_recv()</span></tt></a> and <a class="reference internal" href="#nghttp2_session_send" title="nghttp2_session_send"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_send()</span></tt></a> functions
immediately return <a class="reference internal" href="#NGHTTP2_ERR_CALLBACK_FAILURE" title="NGHTTP2_ERR_CALLBACK_FAILURE"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_ERR_CALLBACK_FAILURE</span></tt></a>.</p>
2013-07-28 14:26:41 +02:00
</dd></dl>
<dl class="type">
<dt id="nghttp2_session_callbacks">
<tt class="descname">nghttp2_session_callbacks</tt><a class="headerlink" href="#nghttp2_session_callbacks" title="Permalink to this definition"></a></dt>
<dd><p>Callback functions.</p>
<dl class="member">
<dt id="nghttp2_session_callbacks.send_callback">
<a class="reference internal" href="#nghttp2_send_callback" title="nghttp2_send_callback">nghttp2_send_callback</a> <tt class="descname">send_callback</tt><a class="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>
<dl class="member">
<dt id="nghttp2_session_callbacks.recv_callback">
<a class="reference internal" href="#nghttp2_recv_callback" title="nghttp2_recv_callback">nghttp2_recv_callback</a> <tt class="descname">recv_callback</tt><a class="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
data from the remote peer.</p>
</dd></dl>
<dl class="member">
<dt id="nghttp2_session_callbacks.on_frame_recv_callback">
<a class="reference internal" href="#nghttp2_on_frame_recv_callback" title="nghttp2_on_frame_recv_callback">nghttp2_on_frame_recv_callback</a> <tt class="descname">on_frame_recv_callback</tt><a class="headerlink" href="#nghttp2_session_callbacks.on_frame_recv_callback" title="Permalink to this definition"></a></dt>
<dd><p>Callback function invoked by <a class="reference internal" href="#nghttp2_session_recv" title="nghttp2_session_recv"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_recv()</span></tt></a> when a
non-DATA frame is received.</p>
</dd></dl>
<dl class="member">
<dt id="nghttp2_session_callbacks.on_invalid_frame_recv_callback">
<a class="reference internal" href="#nghttp2_on_invalid_frame_recv_callback" title="nghttp2_on_invalid_frame_recv_callback">nghttp2_on_invalid_frame_recv_callback</a> <tt class="descname">on_invalid_frame_recv_callback</tt><a class="headerlink" href="#nghttp2_session_callbacks.on_invalid_frame_recv_callback" title="Permalink to this definition"></a></dt>
<dd><p>Callback function invoked by <a class="reference internal" href="#nghttp2_session_recv" title="nghttp2_session_recv"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_recv()</span></tt></a> when an
invalid non-DATA frame is received.</p>
</dd></dl>
<dl class="member">
<dt id="nghttp2_session_callbacks.on_data_chunk_recv_callback">
<a class="reference internal" href="#nghttp2_on_data_chunk_recv_callback" title="nghttp2_on_data_chunk_recv_callback">nghttp2_on_data_chunk_recv_callback</a> <tt class="descname">on_data_chunk_recv_callback</tt><a class="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
received.</p>
</dd></dl>
<dl class="member">
<dt id="nghttp2_session_callbacks.on_data_recv_callback">
<a class="reference internal" href="#nghttp2_on_data_recv_callback" title="nghttp2_on_data_recv_callback">nghttp2_on_data_recv_callback</a> <tt class="descname">on_data_recv_callback</tt><a class="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>
</dd></dl>
<dl class="member">
<dt id="nghttp2_session_callbacks.before_frame_send_callback">
<a class="reference internal" href="#nghttp2_before_frame_send_callback" title="nghttp2_before_frame_send_callback">nghttp2_before_frame_send_callback</a> <tt class="descname">before_frame_send_callback</tt><a class="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>
</dd></dl>
<dl class="member">
<dt id="nghttp2_session_callbacks.on_frame_send_callback">
<a class="reference internal" href="#nghttp2_on_frame_send_callback" title="nghttp2_on_frame_send_callback">nghttp2_on_frame_send_callback</a> <tt class="descname">on_frame_send_callback</tt><a class="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>
</dd></dl>
<dl class="member">
<dt id="nghttp2_session_callbacks.on_frame_not_send_callback">
<a class="reference internal" href="#nghttp2_on_frame_not_send_callback" title="nghttp2_on_frame_not_send_callback">nghttp2_on_frame_not_send_callback</a> <tt class="descname">on_frame_not_send_callback</tt><a class="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
because of an error.</p>
</dd></dl>
<dl class="member">
<dt id="nghttp2_session_callbacks.on_data_send_callback">
<a class="reference internal" href="#nghttp2_on_data_send_callback" title="nghttp2_on_data_send_callback">nghttp2_on_data_send_callback</a> <tt class="descname">on_data_send_callback</tt><a class="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>
</dd></dl>
<dl class="member">
<dt id="nghttp2_session_callbacks.on_stream_close_callback">
<a class="reference internal" href="#nghttp2_on_stream_close_callback" title="nghttp2_on_stream_close_callback">nghttp2_on_stream_close_callback</a> <tt class="descname">on_stream_close_callback</tt><a class="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>
</dd></dl>
<dl class="member">
<dt id="nghttp2_session_callbacks.on_request_recv_callback">
<a class="reference internal" href="#nghttp2_on_request_recv_callback" title="nghttp2_on_request_recv_callback">nghttp2_on_request_recv_callback</a> <tt class="descname">on_request_recv_callback</tt><a class="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
received.</p>
</dd></dl>
<dl class="member">
<dt id="nghttp2_session_callbacks.nghttp2_on_frame_recv_parse_error_callback">
<tt class="descname">nghttp2_on_frame_recv_parse_error_callback</tt><a class="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
could not be parsed correctly.</p>
</dd></dl>
<dl class="member">
<dt id="nghttp2_session_callbacks.on_unknown_frame_recv_callback">
<a class="reference internal" href="#nghttp2_on_unknown_frame_recv_callback" title="nghttp2_on_unknown_frame_recv_callback">nghttp2_on_unknown_frame_recv_callback</a> <tt class="descname">on_unknown_frame_recv_callback</tt><a class="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>
<dl class="type">
<dt id="nghttp2_gzip">
<tt class="descname">nghttp2_gzip</tt><a class="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>
<div class="section" id="functions">
<h2>Functions<a class="headerlink" href="#functions" title="Permalink to this headline"></a></h2>
<dl class="function">
<dt id="nghttp2_session_client_new">
int <tt class="descname">nghttp2_session_client_new</tt><big>(</big><a class="reference internal" href="#nghttp2_session" title="nghttp2_session">nghttp2_session</a><em>&nbsp;**session_ptr</em>, const <a class="reference internal" href="#nghttp2_session_callbacks" title="nghttp2_session_callbacks">nghttp2_session_callbacks</a><em>&nbsp;*callbacks</em>, void<em>&nbsp;*user_data</em><big>)</big><a class="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 <a class="reference internal" href="#nghttp2_session_callbacks.send_callback" title="nghttp2_session_callbacks.send_callback"><tt class="xref c c-member docutils literal"><span class="pre">nghttp2_session_callbacks.send_callback</span></tt></a> must be
specified. If the application code uses <a class="reference internal" href="#nghttp2_session_recv" title="nghttp2_session_recv"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_recv()</span></tt></a>,
the <a class="reference internal" href="#nghttp2_session_callbacks.recv_callback" title="nghttp2_session_callbacks.recv_callback"><tt class="xref c c-member docutils literal"><span class="pre">nghttp2_session_callbacks.recv_callback</span></tt></a> must be
specified. The other members of <em>callbacks</em> can be <tt class="docutils literal"><span class="pre">NULL</span></tt>.</p>
<p>This function returns 0 if it succeeds, or one of the following
negative error codes:</p>
<dl class="docutils">
<dt><a class="reference internal" href="#NGHTTP2_ERR_NOMEM" title="NGHTTP2_ERR_NOMEM"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_ERR_NOMEM</span></tt></a></dt>
<dd>Out of memory.</dd>
</dl>
</dd></dl>
<dl class="function">
<dt id="nghttp2_session_server_new">
int <tt class="descname">nghttp2_session_server_new</tt><big>(</big><a class="reference internal" href="#nghttp2_session" title="nghttp2_session">nghttp2_session</a><em>&nbsp;**session_ptr</em>, const <a class="reference internal" href="#nghttp2_session_callbacks" title="nghttp2_session_callbacks">nghttp2_session_callbacks</a><em>&nbsp;*callbacks</em>, void<em>&nbsp;*user_data</em><big>)</big><a class="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 <a class="reference internal" href="#nghttp2_session_callbacks.send_callback" title="nghttp2_session_callbacks.send_callback"><tt class="xref c c-member docutils literal"><span class="pre">nghttp2_session_callbacks.send_callback</span></tt></a> must be
specified. If the application code uses <a class="reference internal" href="#nghttp2_session_recv" title="nghttp2_session_recv"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_recv()</span></tt></a>,
the <a class="reference internal" href="#nghttp2_session_callbacks.recv_callback" title="nghttp2_session_callbacks.recv_callback"><tt class="xref c c-member docutils literal"><span class="pre">nghttp2_session_callbacks.recv_callback</span></tt></a> must be
specified. The other members of <em>callbacks</em> can be <tt class="docutils literal"><span class="pre">NULL</span></tt>.</p>
<p>This function returns 0 if it succeeds, or one of the following
negative error codes:</p>
<dl class="docutils">
<dt><a class="reference internal" href="#NGHTTP2_ERR_NOMEM" title="NGHTTP2_ERR_NOMEM"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_ERR_NOMEM</span></tt></a></dt>
<dd>Out of memory.</dd>
</dl>
</dd></dl>
<dl class="function">
<dt id="nghttp2_session_del">
void <tt class="descname">nghttp2_session_del</tt><big>(</big><a class="reference internal" href="#nghttp2_session" title="nghttp2_session">nghttp2_session</a><em>&nbsp;*session</em><big>)</big><a class="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
<tt class="docutils literal"><span class="pre">NULL</span></tt>, this function does nothing.</p>
</dd></dl>
<dl class="function">
<dt id="nghttp2_session_set_option">
int <tt class="descname">nghttp2_session_set_option</tt><big>(</big><a class="reference internal" href="#nghttp2_session" title="nghttp2_session">nghttp2_session</a><em>&nbsp;*session</em>, int<em>&nbsp;optname</em>, void<em>&nbsp;*optval</em>, size_t<em>&nbsp;optlen</em><big>)</big><a class="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 <a class="reference internal" href="#nghttp2_opt" title="nghttp2_opt"><tt class="xref c c-type docutils literal"><span class="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>
<dl class="docutils">
2013-08-08 18:52:42 +02:00
<dt><a class="reference internal" href="#NGHTTP2_OPT_NO_AUTO_STREAM_WINDOW_UPDATE" title="NGHTTP2_OPT_NO_AUTO_STREAM_WINDOW_UPDATE"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_OPT_NO_AUTO_STREAM_WINDOW_UPDATE</span></tt></a></dt>
<dd>The <em>optval</em> must be a pointer to <tt class="docutils literal"><span class="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
<a class="reference internal" href="#nghttp2_submit_window_update" title="nghttp2_submit_window_update"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_submit_window_update()</span></tt></a>. This option defaults to 0.</dd>
<dt><a class="reference internal" href="#NGHTTP2_OPT_NO_AUTO_CONNECTION_WINDOW_UPDATE" title="NGHTTP2_OPT_NO_AUTO_CONNECTION_WINDOW_UPDATE"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_OPT_NO_AUTO_CONNECTION_WINDOW_UPDATE</span></tt></a></dt>
2013-07-28 14:26:41 +02:00
<dd>The <em>optval</em> must be a pointer to <tt class="docutils literal"><span class="pre">int</span></tt>. If the <em>*optval</em> is
2013-08-08 18:52:42 +02:00
nonzero, the library will not send WINDOW_UPDATE for connection
automatically. Therefore, the application is responsible for
sending WINDOW_UPDATE using
<a class="reference internal" href="#nghttp2_submit_window_update" title="nghttp2_submit_window_update"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_submit_window_update()</span></tt></a>. This option defaults to 0.</dd>
2013-07-28 14:26:41 +02:00
</dl>
<p>This function returns 0 if it succeeds, or one of the following
negative error codes:</p>
<dl class="docutils">
<dt><a class="reference internal" href="#NGHTTP2_ERR_INVALID_ARGUMENT" title="NGHTTP2_ERR_INVALID_ARGUMENT"><tt class="xref c c-macro docutils literal"><span class="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>
<dl class="function">
<dt id="nghttp2_session_send">
int <tt class="descname">nghttp2_session_send</tt><big>(</big><a class="reference internal" href="#nghttp2_session" title="nghttp2_session">nghttp2_session</a><em>&nbsp;*session</em><big>)</big><a class="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
<a class="reference internal" href="#nghttp2_session_callbacks.send_callback" title="nghttp2_session_callbacks.send_callback"><tt class="xref c c-member docutils literal"><span class="pre">nghttp2_session_callbacks.send_callback</span></tt></a> returns
<a class="reference internal" href="#NGHTTP2_ERR_WOULDBLOCK" title="NGHTTP2_ERR_WOULDBLOCK"><tt class="xref c c-macro docutils literal"><span class="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>
<ol class="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),
<tt class="xref c c-member docutils literal"><span class="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><tt class="xref c c-member docutils literal"><span class="pre">nghttp2_session_callbacks.before_ctrl_send_callback</span></tt> is
invoked.</li>
<li><a class="reference internal" href="#nghttp2_session_callbacks.send_callback" title="nghttp2_session_callbacks.send_callback"><tt class="xref c c-member docutils literal"><span class="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,
<tt class="xref c c-member docutils literal"><span class="pre">nghttp2_session_callbacks.on_ctrl_send_callback</span></tt> is
invoked.</li>
<li>If the frame is a DATA frame,
<a class="reference internal" href="#nghttp2_session_callbacks.on_data_send_callback" title="nghttp2_session_callbacks.on_data_send_callback"><tt class="xref c c-member docutils literal"><span class="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
<a class="reference internal" href="#nghttp2_session_callbacks.on_stream_close_callback" title="nghttp2_session_callbacks.on_stream_close_callback"><tt class="xref c c-member docutils literal"><span class="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>
<dl class="docutils">
<dt><a class="reference internal" href="#NGHTTP2_ERR_NOMEM" title="NGHTTP2_ERR_NOMEM"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_ERR_NOMEM</span></tt></a></dt>
<dd>Out of memory.</dd>
<dt><a class="reference internal" href="#NGHTTP2_ERR_CALLBACK_FAILURE" title="NGHTTP2_ERR_CALLBACK_FAILURE"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_ERR_CALLBACK_FAILURE</span></tt></a></dt>
<dd>The callback function failed.</dd>
</dl>
</dd></dl>
<dl class="function">
<dt id="nghttp2_session_recv">
int <tt class="descname">nghttp2_session_recv</tt><big>(</big><a class="reference internal" href="#nghttp2_session" title="nghttp2_session">nghttp2_session</a><em>&nbsp;*session</em><big>)</big><a class="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 <a class="reference internal" href="#nghttp2_session_callbacks.recv_callback" title="nghttp2_session_callbacks.recv_callback"><tt class="xref c c-member docutils literal"><span class="pre">nghttp2_session_callbacks.recv_callback</span></tt></a> returns
<a class="reference internal" href="#NGHTTP2_ERR_WOULDBLOCK" title="NGHTTP2_ERR_WOULDBLOCK"><tt class="xref c c-macro docutils literal"><span class="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>
<ol class="arabic simple">
<li><a class="reference internal" href="#nghttp2_session_callbacks.recv_callback" title="nghttp2_session_callbacks.recv_callback"><tt class="xref c c-member docutils literal"><span class="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><dl class="docutils">
<dt>2.1. <a class="reference internal" href="#nghttp2_session_callbacks.recv_callback" title="nghttp2_session_callbacks.recv_callback"><tt class="xref c c-member docutils literal"><span class="pre">nghttp2_session_callbacks.recv_callback</span></tt></a> is invoked</dt>
<dd>to receive DATA payload. For each chunk of data,
<a class="reference internal" href="#nghttp2_session_callbacks.on_data_chunk_recv_callback" title="nghttp2_session_callbacks.on_data_chunk_recv_callback"><tt class="xref c c-member docutils literal"><span class="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><a class="reference internal" href="#nghttp2_session_callbacks.on_data_recv_callback" title="nghttp2_session_callbacks.on_data_recv_callback"><tt class="xref c c-member docutils literal"><span class="pre">nghttp2_session_callbacks.on_data_recv_callback</span></tt></a> is
invoked. If the frame is the final frame of the request,
<a class="reference internal" href="#nghttp2_session_callbacks.on_request_recv_callback" title="nghttp2_session_callbacks.on_request_recv_callback"><tt class="xref c c-member docutils literal"><span class="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,
<a class="reference internal" href="#nghttp2_session_callbacks.on_stream_close_callback" title="nghttp2_session_callbacks.on_stream_close_callback"><tt class="xref c c-member docutils literal"><span class="pre">nghttp2_session_callbacks.on_stream_close_callback</span></tt></a>
is invoked.</dd>
</dl>
</div></blockquote>
<ol class="arabic simple" start="3">
<li>If the frame is the control frame:</li>
</ol>
<blockquote>
<div><dl class="docutils">
<dt>3.1. <a class="reference internal" href="#nghttp2_session_callbacks.recv_callback" title="nghttp2_session_callbacks.recv_callback"><tt class="xref c c-member docutils literal"><span class="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><tt class="xref c c-member docutils literal"><span class="pre">nghttp2_session_callbacks.on_ctrl_recv_callback</span></tt> is
invoked. If the frame is the final frame of the request,
<a class="reference internal" href="#nghttp2_session_callbacks.on_request_recv_callback" title="nghttp2_session_callbacks.on_request_recv_callback"><tt class="xref c c-member docutils literal"><span class="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,
<a class="reference internal" href="#nghttp2_session_callbacks.on_stream_close_callback" title="nghttp2_session_callbacks.on_stream_close_callback"><tt class="xref c c-member docutils literal"><span class="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,
<tt class="xref c c-member docutils literal"><span class="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><tt class="xref c c-member docutils literal"><span class="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><tt class="xref c c-member docutils literal"><span class="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>
<dl class="docutils">
<dt><a class="reference internal" href="#NGHTTP2_ERR_EOF" title="NGHTTP2_ERR_EOF"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_ERR_EOF</span></tt></a></dt>
<dd>The remote peer did shutdown on the connection.</dd>
<dt><a class="reference internal" href="#NGHTTP2_ERR_NOMEM" title="NGHTTP2_ERR_NOMEM"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_ERR_NOMEM</span></tt></a></dt>
<dd>Out of memory.</dd>
<dt><a class="reference internal" href="#NGHTTP2_ERR_CALLBACK_FAILURE" title="NGHTTP2_ERR_CALLBACK_FAILURE"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_ERR_CALLBACK_FAILURE</span></tt></a></dt>
<dd>The callback function failed.</dd>
</dl>
</dd></dl>
<dl class="function">
<dt id="nghttp2_session_mem_recv">
ssize_t <tt class="descname">nghttp2_session_mem_recv</tt><big>(</big><a class="reference internal" href="#nghttp2_session" title="nghttp2_session">nghttp2_session</a><em>&nbsp;*session</em>, const uint8_t<em>&nbsp;*in</em>, size_t<em>&nbsp;inlen</em><big>)</big><a class="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 <a class="reference internal" href="#nghttp2_session_recv" title="nghttp2_session_recv"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_recv()</span></tt></a> except that it
does not use <a class="reference internal" href="#nghttp2_session_callbacks.recv_callback" title="nghttp2_session_callbacks.recv_callback"><tt class="xref c c-member docutils literal"><span class="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
<a class="reference internal" href="#nghttp2_session_recv" title="nghttp2_session_recv"><tt class="xref c c-func docutils literal"><span class="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>
<dl class="docutils">
<dt><a class="reference internal" href="#NGHTTP2_ERR_NOMEM" title="NGHTTP2_ERR_NOMEM"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_ERR_NOMEM</span></tt></a></dt>
<dd>Out of memory.</dd>
</dl>
</dd></dl>
<dl class="function">
<dt id="nghttp2_session_resume_data">
int <tt class="descname">nghttp2_session_resume_data</tt><big>(</big><a class="reference internal" href="#nghttp2_session" title="nghttp2_session">nghttp2_session</a><em>&nbsp;*session</em>, int32_t<em>&nbsp;stream_id</em><big>)</big><a class="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>
<dl class="docutils">
<dt><a class="reference internal" href="#NGHTTP2_ERR_INVALID_ARGUMENT" title="NGHTTP2_ERR_INVALID_ARGUMENT"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_ERR_INVALID_ARGUMENT</span></tt></a></dt>
<dd>The stream does not exist or no deferred data exist.</dd>
<dt><a class="reference internal" href="#NGHTTP2_ERR_NOMEM" title="NGHTTP2_ERR_NOMEM"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_ERR_NOMEM</span></tt></a></dt>
<dd>Out of memory.</dd>
</dl>
</dd></dl>
<dl class="function">
<dt id="nghttp2_session_want_read">
int <tt class="descname">nghttp2_session_want_read</tt><big>(</big><a class="reference internal" href="#nghttp2_session" title="nghttp2_session">nghttp2_session</a><em>&nbsp;*session</em><big>)</big><a class="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 <a class="reference internal" href="#nghttp2_session_want_read" title="nghttp2_session_want_read"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_want_read()</span></tt></a> and
<a class="reference internal" href="#nghttp2_session_want_write" title="nghttp2_session_want_write"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_want_write()</span></tt></a> return 0, the application should
drop the connection.</p>
</dd></dl>
<dl class="function">
<dt id="nghttp2_session_want_write">
int <tt class="descname">nghttp2_session_want_write</tt><big>(</big><a class="reference internal" href="#nghttp2_session" title="nghttp2_session">nghttp2_session</a><em>&nbsp;*session</em><big>)</big><a class="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 <a class="reference internal" href="#nghttp2_session_want_read" title="nghttp2_session_want_read"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_want_read()</span></tt></a> and
<a class="reference internal" href="#nghttp2_session_want_write" title="nghttp2_session_want_write"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_want_write()</span></tt></a> return 0, the application should
drop the connection.</p>
</dd></dl>
<dl class="function">
<dt id="nghttp2_session_get_stream_user_data">
void* <tt class="descname">nghttp2_session_get_stream_user_data</tt><big>(</big><a class="reference internal" href="#nghttp2_session" title="nghttp2_session">nghttp2_session</a><em>&nbsp;*session</em>, int32_t<em>&nbsp;stream_id</em><big>)</big><a class="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 <a class="reference internal" href="#nghttp2_submit_request" title="nghttp2_submit_request"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_submit_request()</span></tt></a> or
<tt class="xref c c-func docutils literal"><span class="pre">nghttp2_submit_syn_stream()</span></tt>. If the stream is initiated by the
remote endpoint, stream_user_data is always <tt class="docutils literal"><span class="pre">NULL</span></tt>. If the stream
is initiated by the local endpoint and <tt class="docutils literal"><span class="pre">NULL</span></tt> is given in
<a class="reference internal" href="#nghttp2_submit_request" title="nghttp2_submit_request"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_submit_request()</span></tt></a> or <tt class="xref c c-func docutils literal"><span class="pre">nghttp2_submit_syn_stream()</span></tt>, then
this function returns <tt class="docutils literal"><span class="pre">NULL</span></tt>. If the stream does not exist, this
function returns <tt class="docutils literal"><span class="pre">NULL</span></tt>.</p>
</dd></dl>
<dl class="function">
<dt id="nghttp2_session_get_outbound_queue_size">
size_t <tt class="descname">nghttp2_session_get_outbound_queue_size</tt><big>(</big><a class="reference internal" href="#nghttp2_session" title="nghttp2_session">nghttp2_session</a><em>&nbsp;*session</em><big>)</big><a class="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>
<dl class="function">
<dt id="nghttp2_session_fail_session">
int <tt class="descname">nghttp2_session_fail_session</tt><big>(</big><a class="reference internal" href="#nghttp2_session" title="nghttp2_session">nghttp2_session</a><em>&nbsp;*session</em>, <a class="reference internal" href="#nghttp2_error_code" title="nghttp2_error_code">nghttp2_error_code</a><em>&nbsp;error_code</em><big>)</big><a class="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 <a class="reference internal" href="#nghttp2_submit_goaway" title="nghttp2_submit_goaway"><tt class="xref c c-func docutils literal"><span class="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>
<dl class="docutils">
<dt><a class="reference internal" href="#NGHTTP2_ERR_NOMEM" title="NGHTTP2_ERR_NOMEM"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_ERR_NOMEM</span></tt></a></dt>
<dd>Out of memory.</dd>
</dl>
</dd></dl>
2013-08-03 13:03:39 +02:00
<dl class="function">
<dt id="nghttp2_session_upgrade">
int <tt class="descname">nghttp2_session_upgrade</tt><big>(</big><a class="reference internal" href="#nghttp2_session" title="nghttp2_session">nghttp2_session</a><em>&nbsp;*session</em>, const uint8_t<em>&nbsp;*settings_payload</em>, size_t<em>&nbsp;settings_payloadlen</em>, void<em>&nbsp;*stream_user_data</em><big>)</big><a class="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
2013-08-04 11:30:37 +02:00
value sent in <tt class="docutils literal"><span class="pre">HTTP2-Settings</span></tt> header field and must be decoded
by base64url decoder. The <em>settings_payloadlen</em> is the length of
2013-08-03 13:03:39 +02:00
<em>settings_payload</em>. The <em>settings_payload</em> is unpacked and its
setting values will be submitted using
2013-08-04 11:30:37 +02:00
<a class="reference internal" href="#nghttp2_submit_settings" title="nghttp2_submit_settings"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_submit_settings()</span></tt></a>. This means that the client application
2013-08-03 13:03:39 +02:00
code does not need to submit SETTINGS by itself. The stream with
stream ID=1 is opened and the <em>stream_user_data</em> is used for its
stream_user_data. The opened stream becomes half-closed (local)
state.</p>
<p>If called from server side, the <em>settings_payload</em> must be the
2013-08-04 11:30:37 +02:00
value received in <tt class="docutils literal"><span class="pre">HTTP2-Settings</span></tt> header field and must be
decoded by base64url decoder. The <em>settings_payloadlen</em> is the
length of <em>settings_payload</em>. It is treated as if the SETTINGS
frame with that payload is received. Thus, callback functions for
the reception of SETTINGS frame will be invoked. The stream with
stream ID=1 is opened. The <em>stream_user_data</em> is ignored. The
opened stream becomes half-closed (remote).</p>
2013-08-03 13:03:39 +02:00
<p>This function returns 0 if it succeeds, or one of the following
negative error codes:</p>
<dl class="docutils">
<dt><a class="reference internal" href="#NGHTTP2_ERR_NOMEM" title="NGHTTP2_ERR_NOMEM"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_ERR_NOMEM</span></tt></a></dt>
<dd>Out of memory.</dd>
<dt><a class="reference internal" href="#NGHTTP2_ERR_INVALID_ARGUMENT" title="NGHTTP2_ERR_INVALID_ARGUMENT"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_ERR_INVALID_ARGUMENT</span></tt></a></dt>
<dd>The <em>settings_payload</em> is badly formed.</dd>
<dt><a class="reference internal" href="#NGHTTP2_ERR_PROTO" title="NGHTTP2_ERR_PROTO"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_ERR_PROTO</span></tt></a></dt>
<dd>The stream ID 1 is already used or closed; or is not available;
or the <em>settings_payload</em> does not include both
2013-08-04 11:30:37 +02:00
<a class="reference internal" href="#NGHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS" title="NGHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS</span></tt></a> and
<a class="reference internal" href="#NGHTTP2_SETTINGS_INITIAL_WINDOW_SIZE" title="NGHTTP2_SETTINGS_INITIAL_WINDOW_SIZE"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_SETTINGS_INITIAL_WINDOW_SIZE</span></tt></a>.</dd>
2013-08-03 13:03:39 +02:00
</dl>
</dd></dl>
<dl class="function">
<dt id="nghttp2_pack_settings_payload">
ssize_t <tt class="descname">nghttp2_pack_settings_payload</tt><big>(</big>uint8_t<em>&nbsp;*buf</em>, <a class="reference internal" href="#nghttp2_settings_entry" title="nghttp2_settings_entry">nghttp2_settings_entry</a><em>&nbsp;*iv</em>, size_t<em>&nbsp;niv</em><big>)</big><a class="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
2013-08-04 11:30:37 +02:00
are <tt class="docutils literal"><span class="pre">8*niv</span></tt> bytes. This function is used mainly for creating
SETTINGS payload to be sent with <tt class="docutils literal"><span class="pre">HTTP2-Settings</span></tt> header field in
2013-08-03 13:03:39 +02:00
HTTP Upgrade request. The data written in <em>buf</em> is not still
2013-08-04 11:30:37 +02:00
base64url encoded and the application is responsible for encoding.</p>
2013-08-03 13:03:39 +02:00
<p>This function returns the number of bytes written in <em>buf</em>, or one
of the following negative error codes:</p>
<dl class="docutils">
<dt><a class="reference internal" href="#NGHTTP2_ERR_INVALID_ARGUMENT" title="NGHTTP2_ERR_INVALID_ARGUMENT"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_ERR_INVALID_ARGUMENT</span></tt></a></dt>
<dd>The <em>iv</em> contains duplicate settings ID or invalid value.</dd>
</dl>
</dd></dl>
2013-07-28 14:26:41 +02:00
<dl class="function">
<dt id="nghttp2_strerror">
const char* <tt class="descname">nghttp2_strerror</tt><big>(</big>int<em>&nbsp;lib_error_code</em><big>)</big><a class="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 <a class="reference internal" href="#nghttp2_error" title="nghttp2_error"><tt class="xref c c-macro docutils literal"><span class="pre">nghttp2_error</span></tt></a>.</p>
</dd></dl>
<dl class="function">
<dt id="nghttp2_submit_request">
int <tt class="descname">nghttp2_submit_request</tt><big>(</big><a class="reference internal" href="#nghttp2_session" title="nghttp2_session">nghttp2_session</a><em>&nbsp;*session</em>, int32_t<em>&nbsp;pri</em>, const char<em>&nbsp;**nv</em>, const <a class="reference internal" href="#nghttp2_data_provider" title="nghttp2_data_provider">nghttp2_data_provider</a><em>&nbsp;*data_prd</em>, void<em>&nbsp;*stream_user_data</em><big>)</big><a class="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
2013-08-04 11:30:37 +02:00
value and <a class="reference internal" href="#NGHTTP2_PRI_LOWEST" title="NGHTTP2_PRI_LOWEST"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_PRI_LOWEST</span></tt></a> is the lowest value.</p>
2013-07-28 14:26:41 +02:00
<p>The <em>nv</em> contains the name/value pairs. For i &gt;= 0, <tt class="docutils literal"><span class="pre">nv[2*i]</span></tt>
contains a pointer to the name string and <tt class="docutils literal"><span class="pre">nv[2*i+1]</span></tt> contains a
pointer to the value string. The one beyond last value must be
<tt class="docutils literal"><span class="pre">NULL</span></tt>. That is, if the <em>nv</em> contains N name/value pairs,
<tt class="docutils literal"><span class="pre">nv[2*N]</span></tt> must be <tt class="docutils literal"><span class="pre">NULL</span></tt>.</p>
<p>The <em>nv</em> must include following name/value pairs:</p>
<dl class="docutils">
<dt><tt class="docutils literal"><span class="pre">:method</span></tt></dt>
<dd>HTTP method (e.g., <tt class="docutils literal"><span class="pre">GET</span></tt>, <tt class="docutils literal"><span class="pre">POST</span></tt>, <tt class="docutils literal"><span class="pre">HEAD</span></tt>, etc)</dd>
<dt><tt class="docutils literal"><span class="pre">:scheme</span></tt></dt>
<dd>URI scheme (e.g., <tt class="docutils literal"><span class="pre">https</span></tt>)</dd>
<dt><tt class="docutils literal"><span class="pre">:path</span></tt></dt>
<dd>Absolute path and parameters of this request (e.g., <tt class="docutils literal"><span class="pre">/foo</span></tt>,
<tt class="docutils literal"><span class="pre">/foo;bar;haz?h=j&amp;y=123</span></tt>)</dd>
<dt><tt class="docutils literal"><span class="pre">:host</span></tt></dt>
<dd>The hostport portion of the URI for this request (e.g.,
<tt class="docutils literal"><span class="pre">example.org:443</span></tt>). This is the same as the HTTP &#8220;Host&#8221; 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 <tt class="docutils literal"><span class="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
(<a class="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 <tt class="docutils literal"><span class="pre">:method</span></tt> key in <em>nv</em> (e.g. <tt class="docutils literal"><span class="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 <tt class="docutils literal"><span class="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
<a class="reference internal" href="#nghttp2_session_get_stream_user_data" title="nghttp2_session_get_stream_user_data"><tt class="xref c c-func docutils literal"><span class="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
<tt class="xref c c-member docutils literal"><span class="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,
<a class="reference internal" href="#nghttp2_session_get_stream_user_data" title="nghttp2_session_get_stream_user_data"><tt class="xref c c-func docutils literal"><span class="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>
<dl class="docutils">
<dt><a class="reference internal" href="#NGHTTP2_ERR_INVALID_ARGUMENT" title="NGHTTP2_ERR_INVALID_ARGUMENT"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_ERR_INVALID_ARGUMENT</span></tt></a></dt>
2013-08-04 11:30:37 +02:00
<dd>The <em>pri</em> is invalid; or the <em>nv</em> includes empty name or
<tt class="docutils literal"><span class="pre">NULL</span></tt> value.</dd>
2013-07-28 14:26:41 +02:00
<dt><a class="reference internal" href="#NGHTTP2_ERR_NOMEM" title="NGHTTP2_ERR_NOMEM"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_ERR_NOMEM</span></tt></a></dt>
<dd>Out of memory.</dd>
</dl>
</dd></dl>
<dl class="function">
<dt id="nghttp2_submit_response">
int <tt class="descname">nghttp2_submit_response</tt><big>(</big><a class="reference internal" href="#nghttp2_session" title="nghttp2_session">nghttp2_session</a><em>&nbsp;*session</em>, int32_t<em>&nbsp;stream_id</em>, const char<em>&nbsp;**nv</em>, const <a class="reference internal" href="#nghttp2_data_provider" title="nghttp2_data_provider">nghttp2_data_provider</a><em>&nbsp;*data_prd</em><big>)</big><a class="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 &gt;= 0, <tt class="docutils literal"><span class="pre">nv[2*i]</span></tt>
contains a pointer to the name string and <tt class="docutils literal"><span class="pre">nv[2*i+1]</span></tt> contains a
pointer to the value string. The one beyond last value must be
<tt class="docutils literal"><span class="pre">NULL</span></tt>. That is, if the <em>nv</em> contains N name/value pairs,
<tt class="docutils literal"><span class="pre">nv[2*N]</span></tt> must be <tt class="docutils literal"><span class="pre">NULL</span></tt>.</p>
<p>The <em>nv</em> must include following name/value pairs:</p>
<dl class="docutils">
<dt><tt class="docutils literal"><span class="pre">:status</span></tt></dt>
<dd>HTTP status code (e.g., <tt class="docutils literal"><span class="pre">200</span></tt> or <tt class="docutils literal"><span class="pre">200</span> <span class="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 <tt class="docutils literal"><span class="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 <tt class="docutils literal"><span class="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>
<dl class="docutils">
<dt><a class="reference internal" href="#NGHTTP2_ERR_INVALID_ARGUMENT" title="NGHTTP2_ERR_INVALID_ARGUMENT"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_ERR_INVALID_ARGUMENT</span></tt></a></dt>
2013-08-04 11:30:37 +02:00
<dd>The <em>nv</em> includes empty name or <tt class="docutils literal"><span class="pre">NULL</span></tt> value.</dd>
2013-07-28 14:26:41 +02:00
<dt><a class="reference internal" href="#NGHTTP2_ERR_NOMEM" title="NGHTTP2_ERR_NOMEM"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_ERR_NOMEM</span></tt></a></dt>
<dd>Out of memory.</dd>
</dl>
</dd></dl>
<dl class="function">
<dt id="nghttp2_submit_headers">
int <tt class="descname">nghttp2_submit_headers</tt><big>(</big><a class="reference internal" href="#nghttp2_session" title="nghttp2_session">nghttp2_session</a><em>&nbsp;*session</em>, uint8_t<em>&nbsp;flags</em>, int32_t<em>&nbsp;stream_id</em>, int32_t<em>&nbsp;pri</em>, const char<em>&nbsp;**nv</em>, void<em>&nbsp;*stream_user_data</em><big>)</big><a class="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>
<ul class="simple">
<li><a class="reference internal" href="#NGHTTP2_FLAG_END_STREAM" title="NGHTTP2_FLAG_END_STREAM"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_FLAG_END_STREAM</span></tt></a></li>
2013-08-04 11:30:37 +02:00
<li><a class="reference internal" href="#NGHTTP2_FLAG_END_HEADERS" title="NGHTTP2_FLAG_END_HEADERS"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_FLAG_END_HEADERS</span></tt></a></li>
2013-07-28 14:26:41 +02:00
<li><a class="reference internal" href="#NGHTTP2_FLAG_PRIORITY" title="NGHTTP2_FLAG_PRIORITY"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_FLAG_PRIORITY</span></tt></a></li>
</ul>
<p>If <em>flags</em> includes <a class="reference internal" href="#NGHTTP2_FLAG_END_STREAM" title="NGHTTP2_FLAG_END_STREAM"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_FLAG_END_STREAM</span></tt></a>, this frame has
2013-08-04 11:30:37 +02:00
END_STREAM flag set. The library does not support header
continuation and the HEADERS frame always has
<a class="reference internal" href="#NGHTTP2_FLAG_END_HEADERS" title="NGHTTP2_FLAG_END_HEADERS"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_FLAG_END_HEADERS</span></tt></a> flag set regardless of the <em>flags</em>
value.</p>
2013-07-28 14:26:41 +02:00
<p>If the <em>stream_id</em> is -1, this frame is assumed as request (i.e.,
2013-08-04 11:30:37 +02:00
request HEADERS frame which opens new stream). In this case, the
2013-07-28 14:26:41 +02:00
actual stream ID is assigned just before the frame is sent. For
response, specify stream ID in <em>stream_id</em>.</p>
<p>The <em>pri</em> is priority of this request.</p>
<p>The <em>nv</em> contains the name/value pairs. For i &gt;= 0, <tt class="docutils literal"><span class="pre">nv[2*i]</span></tt>
contains a pointer to the name string and <tt class="docutils literal"><span class="pre">nv[2*i+1]</span></tt> contains a
pointer to the value string. The one beyond last value must be
<tt class="docutils literal"><span class="pre">NULL</span></tt>. That is, if the <em>nv</em> contains N name/value pairs,
<tt class="docutils literal"><span class="pre">nv[2*N]</span></tt> must be <tt class="docutils literal"><span class="pre">NULL</span></tt>.</p>
<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>The <em>stream_user_data</em> is a pointer to an arbitrary data which is
associated to the stream this frame will open. Therefore it is only
used if this frame opens streams, in other words, it changes stream
state from idle or reserved to open.</p>
<p>This function is low-level in a sense that the application code can
2013-08-04 11:30:37 +02:00
specify flags directly. For usual HTTP request,
<a class="reference internal" href="#nghttp2_submit_request" title="nghttp2_submit_request"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_submit_request()</span></tt></a> is useful.</p>
2013-07-28 14:26:41 +02:00
<p>This function returns 0 if it succeeds, or one of the following
negative error codes:</p>
<dl class="docutils">
<dt><a class="reference internal" href="#NGHTTP2_ERR_INVALID_ARGUMENT" title="NGHTTP2_ERR_INVALID_ARGUMENT"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_ERR_INVALID_ARGUMENT</span></tt></a></dt>
2013-08-04 11:30:37 +02:00
<dd>The <em>pri</em> is invalid; or the <em>nv</em> includes empty name or
<tt class="docutils literal"><span class="pre">NULL</span></tt> value.</dd>
2013-07-28 14:26:41 +02:00
<dt><a class="reference internal" href="#NGHTTP2_ERR_NOMEM" title="NGHTTP2_ERR_NOMEM"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_ERR_NOMEM</span></tt></a></dt>
<dd>Out of memory.</dd>
</dl>
</dd></dl>
<dl class="function">
<dt id="nghttp2_submit_data">
int <tt class="descname">nghttp2_submit_data</tt><big>(</big><a class="reference internal" href="#nghttp2_session" title="nghttp2_session">nghttp2_session</a><em>&nbsp;*session</em>, uint8_t<em>&nbsp;flags</em>, int32_t<em>&nbsp;stream_id</em>, const <a class="reference internal" href="#nghttp2_data_provider" title="nghttp2_data_provider">nghttp2_data_provider</a><em>&nbsp;*data_prd</em><big>)</big><a class="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
<a class="reference internal" href="#NGHTTP2_FLAG_END_STREAM" title="NGHTTP2_FLAG_END_STREAM"><tt class="xref c c-macro docutils literal"><span class="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>
<dl class="docutils">
<dt><a class="reference internal" href="#NGHTTP2_ERR_NOMEM" title="NGHTTP2_ERR_NOMEM"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_ERR_NOMEM</span></tt></a></dt>
<dd>Out of memory.</dd>
2013-08-25 15:59:06 +02:00
<dt><a class="reference internal" href="#NGHTTP2_ERR_STREAM_CLOSED" title="NGHTTP2_ERR_STREAM_CLOSED"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_ERR_STREAM_CLOSED</span></tt></a></dt>
<dd>The stream is already closed or does not exist.</dd>
2013-07-28 14:26:41 +02:00
</dl>
</dd></dl>
<dl class="function">
<dt id="nghttp2_submit_priority">
int <tt class="descname">nghttp2_submit_priority</tt><big>(</big><a class="reference internal" href="#nghttp2_session" title="nghttp2_session">nghttp2_session</a><em>&nbsp;*session</em>, int32_t<em>&nbsp;stream_id</em>, int32_t<em>&nbsp;pri</em><big>)</big><a class="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>
<dl class="docutils">
<dt><a class="reference internal" href="#NGHTTP2_ERR_NOMEM" title="NGHTTP2_ERR_NOMEM"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_ERR_NOMEM</span></tt></a></dt>
<dd>Out of memory.</dd>
<dt><a class="reference internal" href="#NGHTTP2_ERR_INVALID_ARGUMENT" title="NGHTTP2_ERR_INVALID_ARGUMENT"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_ERR_INVALID_ARGUMENT</span></tt></a></dt>
<dd>The <em>pri</em> is negative.</dd>
2013-08-25 15:59:06 +02:00
<dt><a class="reference internal" href="#NGHTTP2_ERR_STREAM_CLOSED" title="NGHTTP2_ERR_STREAM_CLOSED"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_ERR_STREAM_CLOSED</span></tt></a></dt>
<dd>The stream is already closed or does not exist.</dd>
2013-07-28 14:26:41 +02:00
</dl>
</dd></dl>
<dl class="function">
<dt id="nghttp2_submit_rst_stream">
int <tt class="descname">nghttp2_submit_rst_stream</tt><big>(</big><a class="reference internal" href="#nghttp2_session" title="nghttp2_session">nghttp2_session</a><em>&nbsp;*session</em>, int32_t<em>&nbsp;stream_id</em>, <a class="reference internal" href="#nghttp2_error_code" title="nghttp2_error_code">nghttp2_error_code</a><em>&nbsp;error_code</em><big>)</big><a class="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>
<dl class="docutils">
<dt><a class="reference internal" href="#NGHTTP2_ERR_NOMEM" title="NGHTTP2_ERR_NOMEM"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_ERR_NOMEM</span></tt></a></dt>
<dd>Out of memory.</dd>
</dl>
</dd></dl>
<dl class="function">
<dt id="nghttp2_submit_settings">
int <tt class="descname">nghttp2_submit_settings</tt><big>(</big><a class="reference internal" href="#nghttp2_session" title="nghttp2_session">nghttp2_session</a><em>&nbsp;*session</em>, const <a class="reference internal" href="#nghttp2_settings_entry" title="nghttp2_settings_entry">nghttp2_settings_entry</a><em>&nbsp;*iv</em>, size_t<em>&nbsp;niv</em><big>)</big><a class="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 <a class="reference internal" href="#nghttp2_settings_entry" title="nghttp2_settings_entry"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_settings_entry</span></tt></a>. The <em>niv</em>
2013-08-04 11:30:37 +02:00
indicates the number of <a class="reference internal" href="#nghttp2_settings_entry" title="nghttp2_settings_entry"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_settings_entry</span></tt></a>.</p>
2013-07-28 14:26:41 +02:00
<p>This function does not take ownership of the <em>iv</em>. This function
copies all the elements in the <em>iv</em>.</p>
2013-08-08 18:52:42 +02:00
<p>While updating individual stream&#8217;s local window size, if the window
size becomes strictly larger than NGHTTP2_MAX_WINDOW_SIZE,
RST_STREAM is issued against such a stream.</p>
2013-07-28 14:26:41 +02:00
<p>This function returns 0 if it succeeds, or one of the following
negative error codes:</p>
<dl class="docutils">
<dt><a class="reference internal" href="#NGHTTP2_ERR_INVALID_ARGUMENT" title="NGHTTP2_ERR_INVALID_ARGUMENT"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_ERR_INVALID_ARGUMENT</span></tt></a></dt>
2013-08-25 15:59:06 +02:00
<dd>The <em>iv</em> contains invalid value (e.g., attempting to re-enable
flow control).</dd>
2013-07-28 14:26:41 +02:00
<dt><a class="reference internal" href="#NGHTTP2_ERR_NOMEM" title="NGHTTP2_ERR_NOMEM"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_ERR_NOMEM</span></tt></a></dt>
<dd>Out of memory.</dd>
</dl>
</dd></dl>
<dl class="function">
<dt id="nghttp2_submit_push_promise">
int <tt class="descname">nghttp2_submit_push_promise</tt><big>(</big><a class="reference internal" href="#nghttp2_session" title="nghttp2_session">nghttp2_session</a><em>&nbsp;*session</em>, uint8_t<em>&nbsp;flags</em>, int32_t<em>&nbsp;stream_id</em>, const char<em>&nbsp;**nv</em><big>)</big><a class="headerlink" href="#nghttp2_submit_push_promise" title="Permalink to this definition"></a></dt>
2013-08-04 11:30:37 +02:00
<dd><p>Submits PUSH_PROMISE frame. The <em>flags</em> is currently ignored and
the resulting PUSH_PROMISE frame always has
<a class="reference internal" href="#NGHTTP2_FLAG_END_PUSH_PROMISE" title="NGHTTP2_FLAG_END_PUSH_PROMISE"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_FLAG_END_PUSH_PROMISE</span></tt></a> flag set due to the lack of
header continuation support in the library.</p>
2013-07-28 14:26:41 +02:00
<p>The <em>stream_id</em> must be client initiated stream ID.</p>
<p>The <em>nv</em> contains the name/value pairs. For i &gt;= 0, <tt class="docutils literal"><span class="pre">nv[2*i]</span></tt>
contains a pointer to the name string and <tt class="docutils literal"><span class="pre">nv[2*i+1]</span></tt> contains a
pointer to the value string. The one beyond last value must be
<tt class="docutils literal"><span class="pre">NULL</span></tt>. That is, if the <em>nv</em> contains N name/value pairs,
<tt class="docutils literal"><span class="pre">nv[2*N]</span></tt> must be <tt class="docutils literal"><span class="pre">NULL</span></tt>.</p>
<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>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 promised stream ID
cannot be known until it is about to sent. To know the promised
stream ID, the application can use
2013-08-04 11:30:37 +02:00
<a class="reference internal" href="#nghttp2_session_callbacks.before_frame_send_callback" title="nghttp2_session_callbacks.before_frame_send_callback"><tt class="xref c c-member docutils literal"><span class="pre">nghttp2_session_callbacks.before_frame_send_callback</span></tt></a>. This
2013-07-28 14:26:41 +02:00
callback is called just before the frame is sent. For PUSH_PROMISE
frame, the argument frame has the promised stream ID assigned.</p>
<p>This function returns 0 if it succeeds, or one of the following
negative error codes:</p>
<dl class="docutils">
<dt><a class="reference internal" href="#NGHTTP2_ERR_INVALID_ARGUMENT" title="NGHTTP2_ERR_INVALID_ARGUMENT"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_ERR_INVALID_ARGUMENT</span></tt></a></dt>
2013-08-04 11:30:37 +02:00
<dd>The <em>nv</em> includes empty name or <tt class="docutils literal"><span class="pre">NULL</span></tt> value.</dd>
2013-08-25 15:59:06 +02:00
<dt><a class="reference internal" href="#NGHTTP2_ERR_STREAM_CLOSED" title="NGHTTP2_ERR_STREAM_CLOSED"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_ERR_STREAM_CLOSED</span></tt></a></dt>
<dd>The stream is already closed or does not exist.</dd>
2013-07-28 14:26:41 +02:00
<dt><a class="reference internal" href="#NGHTTP2_ERR_NOMEM" title="NGHTTP2_ERR_NOMEM"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_ERR_NOMEM</span></tt></a></dt>
<dd>Out of memory.</dd>
</dl>
</dd></dl>
<dl class="function">
<dt id="nghttp2_submit_ping">
int <tt class="descname">nghttp2_submit_ping</tt><big>(</big><a class="reference internal" href="#nghttp2_session" title="nghttp2_session">nghttp2_session</a><em>&nbsp;*session</em>, uint8_t<em>&nbsp;*opaque_data</em><big>)</big><a class="headerlink" href="#nghttp2_submit_ping" title="Permalink to this definition"></a></dt>
<dd><p>Submits PING frame. You don&#8217;t have to send PING back when you
received PING frame. The library automatically submits PING frame
in this case.</p>
2013-08-04 11:30:37 +02:00
<p>If the <em>opaque_data</em> is non <tt class="docutils literal"><span class="pre">NULL</span></tt>, then it should point to the 8
2013-07-28 14:26:41 +02:00
bytes array of memory to specify opaque data to send with PING
2013-08-04 11:30:37 +02:00
frame. If the <em>opaque_data</em> is <tt class="docutils literal"><span class="pre">NULL</span></tt>, zero-cleared 8 bytes will
be sent as opaque data.</p>
2013-07-28 14:26:41 +02:00
<p>This function returns 0 if it succeeds, or one of the following
negative error codes:</p>
<dl class="docutils">
<dt><a class="reference internal" href="#NGHTTP2_ERR_NOMEM" title="NGHTTP2_ERR_NOMEM"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_ERR_NOMEM</span></tt></a></dt>
<dd>Out of memory.</dd>
</dl>
</dd></dl>
<dl class="function">
<dt id="nghttp2_submit_goaway">
int <tt class="descname">nghttp2_submit_goaway</tt><big>(</big><a class="reference internal" href="#nghttp2_session" title="nghttp2_session">nghttp2_session</a><em>&nbsp;*session</em>, <a class="reference internal" href="#nghttp2_error_code" title="nghttp2_error_code">nghttp2_error_code</a><em>&nbsp;error_code</em>, uint8_t<em>&nbsp;*opaque_data</em>, size_t<em>&nbsp;opaque_data_len</em><big>)</big><a class="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>
2013-08-04 11:30:37 +02:00
<p>If the <em>opaque_data</em> is not <tt class="docutils literal"><span class="pre">NULL</span></tt> and <em>opaque_data_len</em> is not
zero, those data will be sent as additional debug data. The
library makes a copy of the memory region pointed by <em>opaque_data</em>
with the length <em>opaque_data_len</em>, so the caller does not need to
keep this memory after the return of this function. If the
<em>opaque_data_len</em> is 0, the <em>opaque_data</em> could be <tt class="docutils literal"><span class="pre">NULL</span></tt>.</p>
2013-07-28 14:26:41 +02:00
<p>This function returns 0 if it succeeds, or one of the following
negative error codes:</p>
<dl class="docutils">
<dt><a class="reference internal" href="#NGHTTP2_ERR_NOMEM" title="NGHTTP2_ERR_NOMEM"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_ERR_NOMEM</span></tt></a></dt>
<dd>Out of memory.</dd>
</dl>
</dd></dl>
<dl class="function">
<dt id="nghttp2_submit_window_update">
int <tt class="descname">nghttp2_submit_window_update</tt><big>(</big><a class="reference internal" href="#nghttp2_session" title="nghttp2_session">nghttp2_session</a><em>&nbsp;*session</em>, uint8_t<em>&nbsp;flags</em>, int32_t<em>&nbsp;stream_id</em>, int32_t<em>&nbsp;window_size_increment</em><big>)</big><a class="headerlink" href="#nghttp2_submit_window_update" title="Permalink to this definition"></a></dt>
2013-08-08 18:52:42 +02:00
<dd><p>Submits WINDOW_UPDATE frame.</p>
2013-08-25 15:59:06 +02:00
<p>The <em>flags</em> is currently ignored.</p>
2013-08-08 18:52:42 +02:00
<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
<a class="reference internal" href="#NGHTTP2_OPT_NO_AUTO_STREAM_WINDOW_UPDATE" title="NGHTTP2_OPT_NO_AUTO_STREAM_WINDOW_UPDATE"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_OPT_NO_AUTO_STREAM_WINDOW_UPDATE</span></tt></a> (or
<a class="reference internal" href="#NGHTTP2_OPT_NO_AUTO_CONNECTION_WINDOW_UPDATE" title="NGHTTP2_OPT_NO_AUTO_CONNECTION_WINDOW_UPDATE"><tt class="xref c c-macro docutils literal"><span class="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
received bytes count.</p>
2013-07-28 14:26:41 +02:00
<p>This function returns 0 if it succeeds, or one of the following
negative error codes:</p>
<dl class="docutils">
<dt><a class="reference internal" href="#NGHTTP2_ERR_INVALID_ARGUMENT" title="NGHTTP2_ERR_INVALID_ARGUMENT"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_ERR_INVALID_ARGUMENT</span></tt></a></dt>
2013-08-25 15:59:06 +02:00
<dd>The <em>delta_window_size</em> is 0.</dd>
2013-08-08 18:52:42 +02:00
<dt><a class="reference internal" href="#NGHTTP2_ERR_FLOW_CONTROL" title="NGHTTP2_ERR_FLOW_CONTROL"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_ERR_FLOW_CONTROL</span></tt></a></dt>
<dd>The local window size overflow or gets negative.</dd>
2013-07-28 14:26:41 +02:00
<dt><a class="reference internal" href="#NGHTTP2_ERR_STREAM_CLOSED" title="NGHTTP2_ERR_STREAM_CLOSED"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_ERR_STREAM_CLOSED</span></tt></a></dt>
<dd>The stream is already closed or does not exist.</dd>
<dt><a class="reference internal" href="#NGHTTP2_ERR_NOMEM" title="NGHTTP2_ERR_NOMEM"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_ERR_NOMEM</span></tt></a></dt>
<dd>Out of memory.</dd>
</dl>
</dd></dl>
2013-08-28 17:32:28 +02:00
<dl class="function">
<dt id="nghttp2_nv_compare_name">
int <tt class="descname">nghttp2_nv_compare_name</tt><big>(</big>const <a class="reference internal" href="#nghttp2_nv" title="nghttp2_nv">nghttp2_nv</a><em>&nbsp;*lhs</em>, const <a class="reference internal" href="#nghttp2_nv" title="nghttp2_nv">nghttp2_nv</a><em>&nbsp;*rhs</em><big>)</big><a class="headerlink" href="#nghttp2_nv_compare_name" title="Permalink to this definition"></a></dt>
<dd><p>Compares lhs-&gt;name with lhs-&gt;namelen bytes and rhs-&gt;name with
rhs-&gt;namelen bytes. Returns negative integer if lhs-&gt;name is found
to be less than rhs-&gt;name; or returns positive integer if lhs-&gt;name
is found to be greater than rhs-&gt;name; or returns 0 otherwise.</p>
</dd></dl>
2013-07-28 14:26:41 +02:00
<dl class="function">
<dt id="nghttp2_select_next_protocol">
int <tt class="descname">nghttp2_select_next_protocol</tt><big>(</big>unsigned char<em>&nbsp;**out</em>, unsigned char<em>&nbsp;*outlen</em>, const unsigned char<em>&nbsp;*in</em>, unsigned int<em>&nbsp;inlen</em><big>)</big><a class="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&#8217;s protocol in preferable order. The format of <em>in</em>
is length-prefixed and not null-terminated. For example,
<tt class="docutils literal"><span class="pre">HTTP-draft-04/2.0</span></tt> and <tt class="docutils literal"><span class="pre">http/1.1</span></tt> stored in <em>in</em> like this:</p>
<div class="highlight-c"><div class="highlight"><pre><span class="n">in</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">=</span> <span class="mi">17</span>
<span class="n">in</span><span class="p">[</span><span class="mf">1..17</span><span class="p">]</span> <span class="o">=</span> <span class="s">&quot;HTTP-draft-04/2.0&quot;</span>
<span class="n">in</span><span class="p">[</span><span class="mi">18</span><span class="p">]</span> <span class="o">=</span> <span class="mi">8</span>
<span class="n">in</span><span class="p">[</span><span class="mf">19..26</span><span class="p">]</span> <span class="o">=</span> <span class="s">&quot;http/1.1&quot;</span>
<span class="n">inlen</span> <span class="o">=</span> <span class="mi">27</span>
</pre></div>
</div>
<p>The selection algorithm is as follows:</p>
<ol class="arabic simple">
<li>If server&#8217;s list contains <tt class="docutils literal"><span class="pre">HTTP-draft-04/2.0</span></tt>, it is selected
and returns 1. The following step is not taken.</li>
<li>If server&#8217;s list contains <tt class="docutils literal"><span class="pre">http/1.1</span></tt>, this function selects
<tt class="docutils literal"><span class="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 <tt class="docutils literal"><span class="pre">HTTP-draft-04/2.0</span></tt> means that <tt class="docutils literal"><span class="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 <a class="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>
<div class="highlight-c"><div class="highlight"><pre><span class="k">static</span> <span class="kt">int</span> <span class="nf">select_next_proto_cb</span><span class="p">(</span><span class="n">SSL</span><span class="o">*</span> <span class="n">ssl</span><span class="p">,</span>
<span class="kt">unsigned</span> <span class="kt">char</span> <span class="o">**</span><span class="n">out</span><span class="p">,</span>
<span class="kt">unsigned</span> <span class="kt">char</span> <span class="o">*</span><span class="n">outlen</span><span class="p">,</span>
<span class="k">const</span> <span class="kt">unsigned</span> <span class="kt">char</span> <span class="o">*</span><span class="n">in</span><span class="p">,</span>
<span class="kt">unsigned</span> <span class="kt">int</span> <span class="n">inlen</span><span class="p">,</span>
<span class="kt">void</span> <span class="o">*</span><span class="n">arg</span><span class="p">)</span>
<span class="p">{</span>
<span class="kt">int</span> <span class="n">rv</span><span class="p">;</span>
<span class="n">rv</span> <span class="o">=</span> <span class="n">nghttp2_select_next_protocol</span><span class="p">(</span><span class="n">out</span><span class="p">,</span> <span class="n">outlen</span><span class="p">,</span> <span class="n">in</span><span class="p">,</span> <span class="n">inlen</span><span class="p">);</span>
<span class="k">if</span><span class="p">(</span><span class="n">rv</span> <span class="o">==</span> <span class="mi">1</span><span class="p">)</span> <span class="p">{</span>
<span class="p">((</span><span class="n">MyType</span><span class="o">*</span><span class="p">)</span><span class="n">arg</span><span class="p">)</span><span class="o">-&gt;</span><span class="n">http2_selected</span> <span class="o">=</span> <span class="mi">1</span><span class="p">;</span>
<span class="p">}</span>
<span class="k">return</span> <span class="n">SSL_TLSEXT_ERR_OK</span><span class="p">;</span>
<span class="p">}</span>
<span class="p">...</span>
<span class="n">SSL_CTX_set_next_proto_select_cb</span><span class="p">(</span><span class="n">ssl_ctx</span><span class="p">,</span> <span class="n">select_next_proto_cb</span><span class="p">,</span> <span class="n">my_obj</span><span class="p">);</span>
</pre></div>
</div>
<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>
<dl class="function">
<dt id="nghttp2_gzip_inflate_new">
int <tt class="descname">nghttp2_gzip_inflate_new</tt><big>(</big><a class="reference internal" href="#nghttp2_gzip" title="nghttp2_gzip">nghttp2_gzip</a><em>&nbsp;**inflater_ptr</em><big>)</big><a class="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>
<dl class="docutils">
<dt><a class="reference internal" href="#NGHTTP2_ERR_GZIP" title="NGHTTP2_ERR_GZIP"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_ERR_GZIP</span></tt></a></dt>
<dd>The initialization of gzip stream failed.</dd>
<dt><a class="reference internal" href="#NGHTTP2_ERR_NOMEM" title="NGHTTP2_ERR_NOMEM"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_ERR_NOMEM</span></tt></a></dt>
<dd>Out of memory.</dd>
</dl>
</dd></dl>
<dl class="function">
<dt id="nghttp2_gzip_inflate_del">
void <tt class="descname">nghttp2_gzip_inflate_del</tt><big>(</big><a class="reference internal" href="#nghttp2_gzip" title="nghttp2_gzip">nghttp2_gzip</a><em>&nbsp;*inflater</em><big>)</big><a class="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 <tt class="docutils literal"><span class="pre">NULL</span></tt>.</p>
</dd></dl>
<dl class="function">
<dt id="nghttp2_gzip_inflate">
int <tt class="descname">nghttp2_gzip_inflate</tt><big>(</big><a class="reference internal" href="#nghttp2_gzip" title="nghttp2_gzip">nghttp2_gzip</a><em>&nbsp;*inflater</em>, uint8_t<em>&nbsp;*out</em>, size_t<em>&nbsp;*outlen_ptr</em>, const uint8_t<em>&nbsp;*in</em>, size_t<em>&nbsp;*inlen_ptr</em><big>)</big><a class="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>
<dl class="docutils">
<dt><a class="reference internal" href="#NGHTTP2_ERR_GZIP" title="NGHTTP2_ERR_GZIP"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_ERR_GZIP</span></tt></a></dt>
<dd>The inflation of gzip stream failed.</dd>
</dl>
<p>The example follows:</p>
<div class="highlight-c"><div class="highlight"><pre><span class="kt">void</span> <span class="nf">on_data_chunk_recv_callback</span><span class="p">(</span><span class="n">nghttp2_session</span> <span class="o">*</span><span class="n">session</span><span class="p">,</span>
<span class="kt">uint8_t</span> <span class="n">flags</span><span class="p">,</span>
<span class="kt">int32_t</span> <span class="n">stream_id</span><span class="p">,</span>
<span class="k">const</span> <span class="kt">uint8_t</span> <span class="o">*</span><span class="n">data</span><span class="p">,</span> <span class="kt">size_t</span> <span class="n">len</span><span class="p">,</span>
<span class="kt">void</span> <span class="o">*</span><span class="n">user_data</span><span class="p">)</span>
<span class="p">{</span>
<span class="p">...</span>
<span class="n">req</span> <span class="o">=</span> <span class="n">nghttp2_session_get_stream_user_data</span><span class="p">(</span><span class="n">session</span><span class="p">,</span> <span class="n">stream_id</span><span class="p">);</span>
<span class="n">nghttp2_gzip</span> <span class="o">*</span><span class="n">inflater</span> <span class="o">=</span> <span class="n">req</span><span class="o">-&gt;</span><span class="n">inflater</span><span class="p">;</span>
<span class="k">while</span><span class="p">(</span><span class="n">len</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">)</span> <span class="p">{</span>
<span class="kt">uint8_t</span> <span class="n">out</span><span class="p">[</span><span class="n">MAX_OUTLEN</span><span class="p">];</span>
<span class="kt">size_t</span> <span class="n">outlen</span> <span class="o">=</span> <span class="n">MAX_OUTLEN</span><span class="p">;</span>
<span class="kt">size_t</span> <span class="n">tlen</span> <span class="o">=</span> <span class="n">len</span><span class="p">;</span>
<span class="kt">int</span> <span class="n">rv</span><span class="p">;</span>
<span class="n">rv</span> <span class="o">=</span> <span class="n">nghttp2_gzip_inflate</span><span class="p">(</span><span class="n">inflater</span><span class="p">,</span> <span class="n">out</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">outlen</span><span class="p">,</span> <span class="n">data</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">tlen</span><span class="p">);</span>
<span class="k">if</span><span class="p">(</span><span class="n">rv</span> <span class="o">!=</span> <span class="mi">0</span><span class="p">)</span> <span class="p">{</span>
<span class="n">nghttp2_submit_rst_stream</span><span class="p">(</span><span class="n">session</span><span class="p">,</span> <span class="n">stream_id</span><span class="p">,</span>
<span class="n">NGHTTP2_INTERNAL_ERROR</span><span class="p">);</span>
<span class="k">break</span><span class="p">;</span>
<span class="p">}</span>
<span class="p">...</span> <span class="n">Do</span> <span class="n">stuff</span> <span class="p">...</span>
<span class="n">data</span> <span class="o">+=</span> <span class="n">tlen</span><span class="p">;</span>
<span class="n">len</span> <span class="o">-=</span> <span class="n">tlen</span><span class="p">;</span>
<span class="p">}</span>
<span class="p">....</span>
<span class="p">}</span>
</pre></div>
</div>
</dd></dl>
</div>
</div>
</div>
</div>
</div>
<div class="sphinxsidebar">
<div class="sphinxsidebarwrapper"><h3>Menu</h3>
<ul>
<li><a href="https://github.com/tatsuhiro-t/nghttp2/issues">Issues</a></li>
<li><a href="https://github.com/tatsuhiro-t/nghttp2">Source</a></li>
</ul>
<h3><a href="index.html">Table Of Contents</a></h3>
<ul>
<li><a class="reference internal" href="#">API Reference</a><ul>
<li><a class="reference internal" href="#includes">Includes</a></li>
<li><a class="reference internal" href="#remarks">Remarks</a></li>
<li><a class="reference internal" href="#macros">Macros</a></li>
<li><a class="reference internal" href="#enums">Enums</a></li>
<li><a class="reference internal" href="#types-structs-unions-and-typedefs">Types (structs, unions and typedefs)</a></li>
<li><a class="reference internal" href="#functions">Functions</a></li>
</ul>
</li>
</ul>
<h4>Previous topic</h4>
<p class="topless"><a href="package_README.html"
title="previous chapter">nghttp2 - HTTP/2.0 C Library</a></p>
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="_sources/apiref.txt"
rel="nofollow">Show Source</a></li>
</ul>
<div id="searchbox" style="display: none">
<h3>Quick search</h3>
<form class="search" action="search.html" method="get">
<input type="text" name="q" />
<input type="submit" value="Go" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
<p class="searchtip" style="font-size: 90%">
Enter search terms or a module, class or function name.
</p>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
</div>
</div>
<div class="clearer"></div>
</div>
<div class="related">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="genindex.html" title="General Index"
>index</a></li>
<li class="right" >
<a href="package_README.html" title="nghttp2 - HTTP/2.0 C Library"
>previous</a> |</li>
<li><a href="index.html">nghttp2 0.1.0-DEV documentation</a> &raquo;</li>
</ul>
</div>
<div class="footer">
&copy; Copyright 2012, 2013, Tatsuhiro Tsujikawa.
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.1.3.
</div>
</body>
</html>