nghttp2/apiref.html

2628 lines
199 KiB
HTML
Raw Normal View History

2013-07-28 14:26:41 +02:00
<!DOCTYPE html>
<!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]-->
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>API Reference &mdash; nghttp2 0.3.0-DEV documentation</title>
<link href='https://fonts.googleapis.com/css?family=Lato:400,700|Roboto+Slab:400,700|Inconsolata:400,700' rel='stylesheet' type='text/css'>
2013-07-28 14:26:41 +02:00
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT:'',
VERSION:'0.3.0-DEV',
COLLAPSE_INDEX:false,
FILE_SUFFIX:'.html',
2013-07-28 14:26:41 +02:00
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="stylesheet" href="_static/css/theme.css" type="text/css" />
<script type="text/javascript" src="_static/js/theme.js"></script>
<link rel="top" title="nghttp2 0.3.0-DEV documentation" href="index.html"/>
<link rel="next" title="nghttp2.h" href="nghttp2.h.html"/>
2013-12-26 15:39:18 +01:00
<link rel="prev" title="Tutorial: HTTP/2.0 server" href="tutorial-server.html"/>
<script src="//cdnjs.cloudflare.com/ajax/libs/modernizr/2.6.2/modernizr.min.js"></script>
</head>
<body class="wy-body-for-nav">
<div class="wy-grid-for-nav">
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
<div class="wy-side-nav-search">
<a href="index.html" class="icon icon-home"> nghttp2</a>
<form id ="rtd-search-form" class="wy-form" action="search.html" method="get">
<input type="text" name="q" placeholder="Search docs" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
<div class="wy-menu wy-menu-vertical" data-spy="affix">
<ul class="current">
<li class="toctree-l1"><a class="reference internal" href="package_README.html">nghttp2 - HTTP/2.0 C Library</a><ul>
<li class="toctree-l2"><a class="reference internal" href="package_README.html#development-status">Development Status</a></li>
<li class="toctree-l2"><a class="reference internal" href="package_README.html#public-test-server">Public Test Server</a></li>
<li class="toctree-l2"><a class="reference internal" href="package_README.html#requirements">Requirements</a></li>
<li class="toctree-l2"><a class="reference internal" href="package_README.html#build-from-git">Build from git</a></li>
<li class="toctree-l2"><a class="reference internal" href="package_README.html#building-documentation">Building documentation</a></li>
<li class="toctree-l2"><a class="reference internal" href="package_README.html#client-server-and-proxy-programs">Client, Server and Proxy programs</a></li>
2014-01-10 17:07:30 +01:00
<li class="toctree-l2"><a class="reference internal" href="package_README.html#hpack-tools">HPACK tools</a></li>
<li class="toctree-l2"><a class="reference internal" href="package_README.html#python-bindings">Python bindings</a></li>
</ul>
</li>
2013-12-26 15:39:18 +01:00
<li class="toctree-l1"><a class="reference internal" href="tutorial-client.html">Tutorial: HTTP/2.0 client</a><ul>
<li class="toctree-l2"><a class="reference internal" href="tutorial-client.html#libevent-client-c">libevent-client.c</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="tutorial-server.html">Tutorial: HTTP/2.0 server</a><ul>
<li class="toctree-l2"><a class="reference internal" href="tutorial-server.html#libevent-server-c">libevent-server.c</a></li>
</ul>
</li>
<li class="toctree-l1 current"><a class="current reference internal" href="">API Reference</a><ul>
<li class="toctree-l2"><a class="reference internal" href="#includes">Includes</a></li>
<li class="toctree-l2"><a class="reference internal" href="#remarks">Remarks</a></li>
<li class="toctree-l2"><a class="reference internal" href="#macros">Macros</a></li>
<li class="toctree-l2"><a class="reference internal" href="#enums">Enums</a></li>
<li class="toctree-l2"><a class="reference internal" href="#types-structs-unions-and-typedefs">Types (structs, unions and typedefs)</a></li>
<li class="toctree-l2"><a class="reference internal" href="#functions">Functions</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="nghttp2.h.html">nghttp2.h</a></li>
<li class="toctree-l1"><a class="reference internal" href="nghttp2ver.h.html">nghttp2ver.h</a></li>
2013-12-07 06:58:21 +01:00
<li class="toctree-l1"><a class="reference external" href="https://github.com/tatsuhiro-t/nghttp2">Source</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/tatsuhiro-t/nghttp2/issues">Issues</a></li>
</ul>
</div>
&nbsp;
</nav>
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">
<nav class="wy-nav-top">
<i data-toggle="wy-nav-top" class="icon icon-reorder"></i>
<a href="index.html">nghttp2</a>
</nav>
<div class="wy-nav-content">
<div class="rst-content">
<ul class="wy-breadcrumbs">
<li><a href="index.html">Docs</a> &raquo;</li>
<li><a href="">API Reference</a></li>
<li class="wy-breadcrumbs-aside">
<a href="_sources/apiref.txt" rel="nofollow"> View page source</a>
</li>
</ul>
<hr/>
2013-07-28 14:26:41 +02:00
<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>
2013-09-04 15:59:13 +02:00
<p>The header files are also available online: <a class="reference internal" href="nghttp2.h.html"><em>nghttp2.h</em></a> and
<a class="reference internal" href="nghttp2ver.h.html"><em>nghttp2ver.h</em></a>.</p>
2013-07-28 14:26:41 +02:00
</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>
2013-09-04 15:59:13 +02:00
<dl class="macro">
<dt id="NGHTTP2_VERSION_NUM">
<tt class="descname">NGHTTP2_VERSION_NUM</tt><a class="headerlink" href="#NGHTTP2_VERSION_NUM" title="Permalink to this definition"></a></dt>
<dd><p>Numerical representation of the version number of the nghttp2 library
release. This is a 24 bit number with 8 bits for major number, 8 bits
for minor and 8 bits for patch. Version 1.2.3 becomes 0x010203.</p>
</dd></dl>
2013-07-28 14:26:41 +02:00
<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>
2013-09-04 15:59:13 +02:00
<dd><p>The length of <a class="reference internal" href="#NGHTTP2_PROTO_VERSION_ID" title="NGHTTP2_PROTO_VERSION_ID"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_PROTO_VERSION_ID</span></tt></a>.</p>
</dd></dl>
<dl class="macro">
<dt id="NGHTTP2_VERSION_AGE">
<tt class="descname">NGHTTP2_VERSION_AGE</tt><a class="headerlink" href="#NGHTTP2_VERSION_AGE" title="Permalink to this definition"></a></dt>
<dd><p>The age of <a class="reference internal" href="#nghttp2_info" title="nghttp2_info"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_info</span></tt></a></p>
2013-07-28 14:26:41 +02:00
</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>
2013-10-28 15:32:57 +01:00
<dl class="macro">
<dt id="NGHTTP2_MAX_HEADER_TABLE_SIZE">
<tt class="descname">NGHTTP2_MAX_HEADER_TABLE_SIZE</tt><a class="headerlink" href="#NGHTTP2_MAX_HEADER_TABLE_SIZE" title="Permalink to this definition"></a></dt>
<dd><p>The maximum header table size.</p>
</dd></dl>
2013-07-28 14:26:41 +02:00
<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>
2013-09-04 15:59:13 +02:00
<dd><p>The length of <a class="reference internal" href="#NGHTTP2_CLIENT_CONNECTION_HEADER" title="NGHTTP2_CLIENT_CONNECTION_HEADER"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_CLIENT_CONNECTION_HEADER</span></tt></a>.</p>
2013-07-28 14:26:41 +02:00
</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">
2013-10-28 15:32:57 +01:00
<dt id="NGHTTP2_ERR_FRAME_SIZE_ERROR">
<tt class="descname">NGHTTP2_ERR_FRAME_SIZE_ERROR</tt><a class="headerlink" href="#NGHTTP2_ERR_FRAME_SIZE_ERROR" title="Permalink to this definition"></a></dt>
2013-07-28 14:26:41 +02:00
<dd><p>(<tt class="docutils literal"><span class="pre">-522</span></tt>)
2013-10-28 15:32:57 +01:00
The length of the frame is invalid, either too large or too small.</p>
2013-07-28 14:26:41 +02:00
</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-09-10 17:59:12 +02:00
<dl class="macro">
<dt id="NGHTTP2_ERR_INSUFF_BUFSIZE">
<tt class="descname">NGHTTP2_ERR_INSUFF_BUFSIZE</tt><a class="headerlink" href="#NGHTTP2_ERR_INSUFF_BUFSIZE" title="Permalink to this definition"></a></dt>
<dd><p>(<tt class="docutils literal"><span class="pre">-525</span></tt>)
Insufficient buffer size given to function.</p>
</dd></dl>
2013-10-03 18:33:21 +02:00
<dl class="macro">
<dt id="NGHTTP2_ERR_PAUSE">
<tt class="descname">NGHTTP2_ERR_PAUSE</tt><a class="headerlink" href="#NGHTTP2_ERR_PAUSE" title="Permalink to this definition"></a></dt>
<dd><p>(<tt class="docutils literal"><span class="pre">-526</span></tt>)
Callback was paused by the application</p>
</dd></dl>
2013-10-28 15:32:57 +01:00
<dl class="macro">
<dt id="NGHTTP2_ERR_TOO_MANY_INFLIGHT_SETTINGS">
<tt class="descname">NGHTTP2_ERR_TOO_MANY_INFLIGHT_SETTINGS</tt><a class="headerlink" href="#NGHTTP2_ERR_TOO_MANY_INFLIGHT_SETTINGS" title="Permalink to this definition"></a></dt>
<dd><p>(<tt class="docutils literal"><span class="pre">-527</span></tt>)
There are too many in-flight SETTING frame and no more
transmission of SETTINGS is allowed.</p>
</dd></dl>
2013-11-02 09:01:32 +01:00
<dl class="macro">
<dt id="NGHTTP2_ERR_PUSH_DISABLED">
<tt class="descname">NGHTTP2_ERR_PUSH_DISABLED</tt><a class="headerlink" href="#NGHTTP2_ERR_PUSH_DISABLED" title="Permalink to this definition"></a></dt>
<dd><p>(<tt class="docutils literal"><span class="pre">-528</span></tt>)
The server push is disabled.</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">
2013-10-28 15:32:57 +01:00
<dt id="NGHTTP2_FLAG_ACK">
<tt class="descname">NGHTTP2_FLAG_ACK</tt><a class="headerlink" href="#NGHTTP2_FLAG_ACK" title="Permalink to this definition"></a></dt>
2013-07-28 14:26:41 +02:00
<dd><p>(<tt class="docutils literal"><span class="pre">0x1</span></tt>)
2013-10-28 15:32:57 +01:00
The ACK flag.</p>
2013-07-28 14:26:41 +02:00
</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>
2013-10-28 15:32:57 +01:00
<dl class="macro">
<dt id="NGHTTP2_SETTINGS_HEADER_TABLE_SIZE">
<tt class="descname">NGHTTP2_SETTINGS_HEADER_TABLE_SIZE</tt><a class="headerlink" href="#NGHTTP2_SETTINGS_HEADER_TABLE_SIZE" title="Permalink to this definition"></a></dt>
<dd><p>(<tt class="docutils literal"><span class="pre">1</span></tt>)
SETTINGS_HEADER_TABLE_SIZE</p>
</dd></dl>
<dl class="macro">
<dt id="NGHTTP2_SETTINGS_ENABLE_PUSH">
<tt class="descname">NGHTTP2_SETTINGS_ENABLE_PUSH</tt><a class="headerlink" href="#NGHTTP2_SETTINGS_ENABLE_PUSH" title="Permalink to this definition"></a></dt>
<dd><p>(<tt class="docutils literal"><span class="pre">2</span></tt>)
SETTINGS_ENABLE_PUSH</p>
</dd></dl>
2013-07-28 14:26:41 +02:00
<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>
2013-10-28 15:32:57 +01:00
<dl class="macro">
<dt id="NGHTTP2_SETTINGS_TIMEOUT">
<tt class="descname">NGHTTP2_SETTINGS_TIMEOUT</tt><a class="headerlink" href="#NGHTTP2_SETTINGS_TIMEOUT" title="Permalink to this definition"></a></dt>
<dd><p>(<tt class="docutils literal"><span class="pre">4</span></tt>)
SETTINGS_TIMEOUT</p>
</dd></dl>
2013-07-28 14:26:41 +02:00
<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">
2013-10-28 15:32:57 +01:00
<dt id="NGHTTP2_FRAME_SIZE_ERROR">
<tt class="descname">NGHTTP2_FRAME_SIZE_ERROR</tt><a class="headerlink" href="#NGHTTP2_FRAME_SIZE_ERROR" title="Permalink to this definition"></a></dt>
2013-07-28 14:26:41 +02:00
<dd><p>(<tt class="docutils literal"><span class="pre">6</span></tt>)
2013-10-28 15:32:57 +01:00
FRAME_SIZE_ERROR</p>
2013-07-28 14:26:41 +02:00
</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>
2013-10-28 15:32:57 +01:00
<dl class="macro">
<dt id="NGHTTP2_CONNECT_ERROR">
<tt class="descname">NGHTTP2_CONNECT_ERROR</tt><a class="headerlink" href="#NGHTTP2_CONNECT_ERROR" title="Permalink to this definition"></a></dt>
<dd><p>(<tt class="docutils literal"><span class="pre">10</span></tt>)
CONNECT_ERROR</p>
</dd></dl>
<dl class="macro">
<dt id="NGHTTP2_ENHANCE_YOUR_CALM">
<tt class="descname">NGHTTP2_ENHANCE_YOUR_CALM</tt><a class="headerlink" href="#NGHTTP2_ENHANCE_YOUR_CALM" title="Permalink to this definition"></a></dt>
<dd><p>(<tt class="docutils literal"><span class="pre">420</span></tt>)
ENHANCE_YOUR_CALM</p>
</dd></dl>
2013-07-28 14:26:41 +02:00
</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
2013-11-07 16:22:38 +01:00
stream automatically. If this option is set to nonzero, the
library won&#8217;t send WINDOW_UPDATE for a stream and 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>. By default, this option is set to
zero.</p>
2013-07-28 14:26:41 +02:00
</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>
2013-11-07 16:22:38 +01:00
<dd><p>(<tt class="docutils literal"><span class="pre">1</span> <span class="pre">&lt;&lt;</span> <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
2013-11-07 16:22:38 +01:00
connection automatically. If this option is set to nonzero, the
library won&#8217;t send WINDOW_UPDATE for a connection and 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>. By default, this
option is set to zero.</p>
2013-08-08 18:52:42 +02:00
</dd></dl>
2013-09-14 12:44:21 +02:00
<dl class="macro">
<dt id="NGHTTP2_OPT_PEER_MAX_CONCURRENT_STREAMS">
<tt class="descname">NGHTTP2_OPT_PEER_MAX_CONCURRENT_STREAMS</tt><a class="headerlink" href="#NGHTTP2_OPT_PEER_MAX_CONCURRENT_STREAMS" title="Permalink to this definition"></a></dt>
2013-11-07 16:22:38 +01:00
<dd><p>(<tt class="docutils literal"><span class="pre">1</span> <span class="pre">&lt;&lt;</span> <span class="pre">2</span></tt>)
2013-09-14 12:44:21 +02:00
This option sets the SETTINGS_MAX_CONCURRENT_STREAMS value of
remote endpoint as if it is received in SETTINGS frame. Without
specifying this option, before the local endpoint receives
SETTINGS_MAX_CONCURRENT_STREAMS in SETTINGS frame from remote
endpoint, SETTINGS_MAX_CONCURRENT_STREAMS is unlimited. This may
cause problem if local endpoint submits lots of requests
initially and sending them at once to the remote peer may lead to
the rejection of some requests. Specifying this option to the
sensible value, say 100, may avoid this kind of issue. This value
will be overwritten if the local endpoint receives
SETTINGS_MAX_CONCURRENT_STREAMS from the remote endpoint.</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>
2013-09-04 15:59:13 +02:00
<dl class="type">
<dt id="nghttp2_info">
<tt class="descname">nghttp2_info</tt><a class="headerlink" href="#nghttp2_info" title="Permalink to this definition"></a></dt>
<dd><p>This struct is what <a class="reference internal" href="#nghttp2_version" title="nghttp2_version"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_version()</span></tt></a> returns. It holds
information about the particular nghttp2 version.</p>
<dl class="member">
<dt id="nghttp2_info.age">
int <tt class="descname">age</tt><a class="headerlink" href="#nghttp2_info.age" title="Permalink to this definition"></a></dt>
<dd><p>Age of this struct. This instance of nghttp2 sets it to
<a class="reference internal" href="#NGHTTP2_VERSION_AGE" title="NGHTTP2_VERSION_AGE"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_VERSION_AGE</span></tt></a> but a future version may bump it and
add more struct fields at the bottom</p>
</dd></dl>
<dl class="member">
<dt id="nghttp2_info.version_num">
int <tt class="descname">version_num</tt><a class="headerlink" href="#nghttp2_info.version_num" title="Permalink to this definition"></a></dt>
<dd><p>the <a class="reference internal" href="#NGHTTP2_VERSION_NUM" title="NGHTTP2_VERSION_NUM"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_VERSION_NUM</span></tt></a> number (since age ==1)</p>
</dd></dl>
<dl class="member">
<dt id="nghttp2_info.version_str">
const char *<tt class="descname">version_str</tt><a class="headerlink" href="#nghttp2_info.version_str" title="Permalink to this definition"></a></dt>
<dd><p>points to the <a class="reference internal" href="#NGHTTP2_VERSION" title="NGHTTP2_VERSION"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_VERSION</span></tt></a> string (since age ==1)</p>
</dd></dl>
<dl class="member">
<dt id="nghttp2_info.proto_str">
const char *<tt class="descname">proto_str</tt><a class="headerlink" href="#nghttp2_info.proto_str" title="Permalink to this definition"></a></dt>
<dd><p>points to the <a class="reference internal" href="#NGHTTP2_PROTO_VERSION_ID" title="NGHTTP2_PROTO_VERSION_ID"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_PROTO_VERSION_ID</span></tt></a> string this
instance implements (since age ==1)</p>
</dd></dl>
</dd></dl>
2013-07-28 14:26:41 +02:00
<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.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>
2013-12-23 15:51:07 +01:00
<dl class="member">
<dt id="nghttp2_headers.cat">
<a class="reference internal" href="#nghttp2_headers_category" title="nghttp2_headers_category">nghttp2_headers_category</a> <tt class="descname">cat</tt><a class="headerlink" href="#nghttp2_headers.cat" title="Permalink to this definition"></a></dt>
<dd><p>The category of this HEADERS frame.</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>
2013-07-28 14:26:41 +02:00
</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.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>
<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>
2013-07-28 14:26:41 +02:00
</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
2013-09-07 16:46:28 +02:00
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>. The <em>user_data</em>
pointer is the third argument passed in to the call to
<a class="reference internal" href="#nghttp2_session_client_new" title="nghttp2_session_client_new"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_client_new()</span></tt></a> or <a class="reference internal" href="#nghttp2_session_server_new" title="nghttp2_session_server_new"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_server_new()</span></tt></a>.</p>
2013-07-28 14:26:41 +02:00
</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
2013-09-05 17:21:22 +02:00
<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>. Returning 0 is treated as
2013-09-07 16:46:28 +02:00
<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>. The <em>user_data</em> pointer is the
third argument passed in to the call to
<a class="reference internal" href="#nghttp2_session_client_new" title="nghttp2_session_client_new"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_client_new()</span></tt></a> or <a class="reference internal" href="#nghttp2_session_server_new" title="nghttp2_session_server_new"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_server_new()</span></tt></a>.</p>
2013-07-28 14:26:41 +02:00
</dd></dl>
<dl class="type">
<dt id="nghttp2_on_frame_recv_callback">
2013-09-03 14:29:08 +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>, const <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
2013-09-07 16:46:28 +02:00
non-DATA frame is received. The <em>user_data</em> pointer is the third
argument passed in to the call to <a class="reference internal" href="#nghttp2_session_client_new" title="nghttp2_session_client_new"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_client_new()</span></tt></a> or
<a class="reference internal" href="#nghttp2_session_server_new" title="nghttp2_session_server_new"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_server_new()</span></tt></a>.</p>
2014-01-17 16:36:03 +01:00
<p>If frame is HEADERS or PUSH_PROMISE, the <tt class="docutils literal"><span class="pre">nva</span></tt> and <tt class="docutils literal"><span class="pre">nvlen</span></tt>
member of their data structure are always <tt class="docutils literal"><span class="pre">NULL</span></tt> and 0
respectively. The header name/value pairs are emitted via
<a class="reference internal" href="#nghttp2_on_header_callback" title="nghttp2_on_header_callback"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_on_header_callback</span></tt></a>.</p>
2013-08-30 17:52:54 +02:00
<p>The implementation of this function must return 0 if it
2014-01-16 18:42:44 +01:00
succeeds. If nonzero value 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_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>
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-09-03 14:29:08 +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>, const <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
2013-09-07 16:46:28 +02:00
either RST_STREAM or GOAWAY frame. The <em>user_data</em> pointer is the
third argument passed in to the call to
<a class="reference internal" href="#nghttp2_session_client_new" title="nghttp2_session_client_new"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_client_new()</span></tt></a> or <a class="reference internal" href="#nghttp2_session_server_new" title="nghttp2_session_server_new"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_server_new()</span></tt></a>.</p>
2014-01-17 16:36:03 +01:00
<p>If frame is HEADERS or PUSH_PROMISE, the <tt class="docutils literal"><span class="pre">nva</span></tt> and <tt class="docutils literal"><span class="pre">nvlen</span></tt>
member of their data structure are always <tt class="docutils literal"><span class="pre">NULL</span></tt> and 0
respectively.</p>
<p>If this callback is called, <a class="reference internal" href="#nghttp2_on_header_callback" title="nghttp2_on_header_callback"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_on_header_callback</span></tt></a> and
<a class="reference internal" href="#nghttp2_on_end_headers_callback" title="nghttp2_on_end_headers_callback"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_on_end_headers_callback</span></tt></a> will not be called for this
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
2013-09-07 16:46:28 +02:00
know all data frames are received. The <em>user_data</em> pointer is the
third argument passed in to the call to
<a class="reference internal" href="#nghttp2_session_client_new" title="nghttp2_session_client_new"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_client_new()</span></tt></a> or <a class="reference internal" href="#nghttp2_session_server_new" title="nghttp2_session_server_new"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_server_new()</span></tt></a>.</p>
2013-10-03 18:33:21 +02:00
<p>If the application uses <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>, it can return
<a class="reference internal" href="#NGHTTP2_ERR_PAUSE" title="NGHTTP2_ERR_PAUSE"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_ERR_PAUSE</span></tt></a> to make <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>
2014-01-17 16:17:15 +01:00
return without processing further input bytes. The memory by
pointed by the <em>data</em> is retained until
<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> or <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> is
2013-10-03 18:33:21 +02:00
called. The application must retain the input bytes which was used
2014-01-17 16:17:15 +01:00
to produce the <em>data</em> parameter, because it may refer to the memory
region included in the input bytes.</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
2014-01-16 18:42:44 +01:00
<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_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> functions
2013-08-30 17:52:54 +02:00
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
2013-09-07 16:46:28 +02:00
<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>. The <em>user_data</em>
pointer is the third argument passed in to the call to
<a class="reference internal" href="#nghttp2_session_client_new" title="nghttp2_session_client_new"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_client_new()</span></tt></a> or <a class="reference internal" href="#nghttp2_session_server_new" title="nghttp2_session_server_new"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_server_new()</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-09-03 14:29:08 +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>, const <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
2013-09-07 16:46:28 +02:00
when it was queued. The <em>user_data</em> pointer is the third argument
passed in to the call to <a class="reference internal" href="#nghttp2_session_client_new" title="nghttp2_session_client_new"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_client_new()</span></tt></a> or
<a class="reference internal" href="#nghttp2_session_server_new" title="nghttp2_session_server_new"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_server_new()</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_frame_send_callback">
2013-09-03 14:29:08 +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>, const <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-09-07 16:46:28 +02:00
<dd><p>Callback function invoked after the non-DATA frame <em>frame</em> is sent.
The <em>user_data</em> pointer is the third argument passed in to the call
to <a class="reference internal" href="#nghttp2_session_client_new" title="nghttp2_session_client_new"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_client_new()</span></tt></a> or
<a class="reference internal" href="#nghttp2_session_server_new" title="nghttp2_session_server_new"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_server_new()</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_frame_not_send_callback">
2013-09-03 14:29:08 +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>, const <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
2013-09-07 16:46:28 +02:00
<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>. The <em>user_data</em> pointer is the third
argument passed in to the call to <a class="reference internal" href="#nghttp2_session_client_new" title="nghttp2_session_client_new"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_client_new()</span></tt></a> or
<a class="reference internal" href="#nghttp2_session_server_new" title="nghttp2_session_server_new"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_server_new()</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-09-07 16:46:28 +02:00
<dd><p>Callback function invoked after DATA frame is sent. The <em>user_data</em>
pointer is the third argument passed in to the call to
<a class="reference internal" href="#nghttp2_session_client_new" title="nghttp2_session_client_new"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_client_new()</span></tt></a> or <a class="reference internal" href="#nghttp2_session_server_new" title="nghttp2_session_server_new"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_server_new()</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_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
2013-09-07 16:46:28 +02:00
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. The <em>user_data</em> pointer is the third argument passed in
to the call to <a class="reference internal" href="#nghttp2_session_client_new" title="nghttp2_session_client_new"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_client_new()</span></tt></a> or
<a class="reference internal" href="#nghttp2_session_server_new" title="nghttp2_session_server_new"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_server_new()</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_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
2013-09-07 16:46:28 +02:00
body, is fully received. The <em>user_data</em> pointer is the third
argument passed in to the call to <a class="reference internal" href="#nghttp2_session_client_new" title="nghttp2_session_client_new"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_client_new()</span></tt></a> or
<a class="reference internal" href="#nghttp2_session_server_new" title="nghttp2_session_server_new"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_server_new()</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_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
2013-09-07 16:46:28 +02:00
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. The
<em>user_data</em> pointer is the third argument passed in to the call to
<a class="reference internal" href="#nghttp2_session_client_new" title="nghttp2_session_client_new"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_client_new()</span></tt></a> or <a class="reference internal" href="#nghttp2_session_server_new" title="nghttp2_session_server_new"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_server_new()</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_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
2013-09-07 16:46:28 +02:00
length of the <em>payload</em>. This is the data after the length
field. The <em>user_data</em> pointer is the third argument passed in to
the call to <a class="reference internal" href="#nghttp2_session_client_new" title="nghttp2_session_client_new"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_client_new()</span></tt></a> or
<a class="reference internal" href="#nghttp2_session_server_new" title="nghttp2_session_server_new"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_server_new()</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>
2014-01-16 18:42:44 +01:00
<dl class="type">
<dt id="nghttp2_on_header_callback">
typedef int <tt class="descname">(*nghttp2_on_header_callback)</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_frame" title="nghttp2_frame">nghttp2_frame</a><em>&nbsp;*frame</em>, const uint8_t<em>&nbsp;*name</em>, size_t<em>&nbsp;namelen</em>, const uint8_t<em>&nbsp;*value</em>, size_t<em>&nbsp;valuelen</em>, void<em>&nbsp;*user_data</em><big>)</big><a class="headerlink" href="#nghttp2_on_header_callback" title="Permalink to this definition"></a></dt>
<dd><p>Callback function invoked when a header name/value pair is received
for the <em>frame</em>. When this callback is invoked, <tt class="docutils literal"><span class="pre">frame-&gt;hd.type</span></tt>
is either <a class="reference internal" href="#NGHTTP2_HEADERS" title="NGHTTP2_HEADERS"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_HEADERS</span></tt></a> or <a class="reference internal" href="#NGHTTP2_PUSH_PROMISE" title="NGHTTP2_PUSH_PROMISE"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_PUSH_PROMISE</span></tt></a>.
After all header name/value pairs are processed with this callback,
or header decompression error occurred, then
<a class="reference internal" href="#nghttp2_on_end_headers_callback" title="nghttp2_on_end_headers_callback"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_on_end_headers_callback</span></tt></a> will be invoked unless
application returns nonzero value from this callback.</p>
<p>The <em>name</em> may be <tt class="docutils literal"><span class="pre">NULL</span></tt> if the <em>namelen</em> is 0. The same thing
can be said about the <em>value</em>.</p>
<p>If the application uses <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>, it can return
<a class="reference internal" href="#NGHTTP2_ERR_PAUSE" title="NGHTTP2_ERR_PAUSE"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_ERR_PAUSE</span></tt></a> to make <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>
2014-01-17 16:17:15 +01:00
return without processing further input bytes. The memory pointed
by <em>frame</em>, <em>name</em> and <em>value</em> parameters are retained until
<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> or <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> is
called. The application must retain the input bytes which was used
to produce these parameters, because it may refer to the memory
region included in the input bytes.</p>
2014-01-16 18:42:44 +01:00
<p>The implementation of this function must return 0 if it
succeeds. It may return <a class="reference internal" href="#NGHTTP2_ERR_PAUSE" title="NGHTTP2_ERR_PAUSE"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_ERR_PAUSE</span></tt></a>. If the other
nonzero value 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_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> 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>
</dd></dl>
<dl class="type">
<dt id="nghttp2_on_end_headers_callback">
typedef int <tt class="descname">(*nghttp2_on_end_headers_callback)</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_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_end_headers_callback" title="Permalink to this definition"></a></dt>
<dd><p>Callback function invoked when all header name/value pairs are
processed or after the header decompression error is detected. If
the <em>error_code</em> is <a class="reference internal" href="#NGHTTP2_NO_ERROR" title="NGHTTP2_NO_ERROR"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_NO_ERROR</span></tt></a>, it indicates the
header decompression succeeded. Otherwise, error prevented the
completion of the header decompression. In this case, the library
will handle the error by either transmitting RST_STREAM or GOAWAY
and terminate session.</p>
2014-01-17 16:36:03 +01:00
<p>If the <em>error_code</em> is not <a class="reference internal" href="#NGHTTP2_NO_ERROR" title="NGHTTP2_NO_ERROR"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_NO_ERROR</span></tt></a>, then
<a class="reference internal" href="#nghttp2_on_request_recv_callback" title="nghttp2_on_request_recv_callback"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_on_request_recv_callback</span></tt></a> will not called for this
frame if the <em>frame</em> is HEADERS.</p>
2014-01-16 18:42:44 +01:00
<p>The implementation of this function must return 0 if it
succeeds. If nonzero value 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_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>
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>
</dd></dl>
2013-07-28 14:26:41 +02:00
<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>
2014-01-16 18:42:44 +01:00
<dl class="member">
<dt id="nghttp2_session_callbacks.on_header_callback">
<a class="reference internal" href="#nghttp2_on_header_callback" title="nghttp2_on_header_callback">nghttp2_on_header_callback</a> <tt class="descname">on_header_callback</tt><a class="headerlink" href="#nghttp2_session_callbacks.on_header_callback" title="Permalink to this definition"></a></dt>
<dd><p>Callback function invoked when a header name/value pair is
received.</p>
</dd></dl>
<dl class="member">
<dt id="nghttp2_session_callbacks.on_end_headers_callback">
<a class="reference internal" href="#nghttp2_on_end_headers_callback" title="nghttp2_on_end_headers_callback">nghttp2_on_end_headers_callback</a> <tt class="descname">on_end_headers_callback</tt><a class="headerlink" href="#nghttp2_session_callbacks.on_end_headers_callback" title="Permalink to this definition"></a></dt>
<dd><p>Callback function invoked when all header name/value pairs are
processed.</p>
</dd></dl>
2013-07-28 14:26:41 +02:00
</dd></dl>
2013-11-07 16:22:38 +01:00
<dl class="type">
<dt id="nghttp2_opt_set">
<tt class="descname">nghttp2_opt_set</tt><a class="headerlink" href="#nghttp2_opt_set" title="Permalink to this definition"></a></dt>
<dd><p>Struct to store option values for nghttp2_session.</p>
<dl class="member">
<dt id="nghttp2_opt_set.peer_max_concurrent_streams">
uint32_t <tt class="descname">peer_max_concurrent_streams</tt><a class="headerlink" href="#nghttp2_opt_set.peer_max_concurrent_streams" title="Permalink to this definition"></a></dt>
<dd><p><a class="reference internal" href="#NGHTTP2_OPT_PEER_MAX_CONCURRENT_STREAMS" title="NGHTTP2_OPT_PEER_MAX_CONCURRENT_STREAMS"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_OPT_PEER_MAX_CONCURRENT_STREAMS</span></tt></a></p>
</dd></dl>
2013-11-07 16:22:38 +01:00
<dl class="member">
<dt id="nghttp2_opt_set.no_auto_stream_window_update">
uint8_t <tt class="descname">no_auto_stream_window_update</tt><a class="headerlink" href="#nghttp2_opt_set.no_auto_stream_window_update" title="Permalink to this definition"></a></dt>
<dd><p><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></p>
</dd></dl>
<dl class="member">
<dt id="nghttp2_opt_set.no_auto_connection_window_update">
uint8_t <tt class="descname">no_auto_connection_window_update</tt><a class="headerlink" href="#nghttp2_opt_set.no_auto_connection_window_update" title="Permalink to this definition"></a></dt>
<dd><p><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></p>
</dd></dl>
</dd></dl>
2013-07-28 14:26:41 +02:00
<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">
2013-11-07 16:22:38 +01:00
<dt id="nghttp2_session_client_new2">
int <tt class="descname">nghttp2_session_client_new2</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>, uint32_t<em>&nbsp;opt_set_mask</em>, const <a class="reference internal" href="#nghttp2_opt_set" title="nghttp2_opt_set">nghttp2_opt_set</a><em>&nbsp;*opt_set</em><big>)</big><a class="headerlink" href="#nghttp2_session_client_new2" title="Permalink to this definition"></a></dt>
<dd><p>Like <a class="reference internal" href="#nghttp2_session_client_new" title="nghttp2_session_client_new"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_client_new()</span></tt></a>, but with additional options
specified in the <em>opt_set</em>. The caller must set bitwise-OR of
<a class="reference internal" href="#nghttp2_opt" title="nghttp2_opt"><tt class="xref c c-macro docutils literal"><span class="pre">nghttp2_opt</span></tt></a> for given options. For example, if it
specifies <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> and
<a class="reference internal" href="#NGHTTP2_OPT_PEER_MAX_CONCURRENT_STREAMS" title="NGHTTP2_OPT_PEER_MAX_CONCURRENT_STREAMS"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_OPT_PEER_MAX_CONCURRENT_STREAMS</span></tt></a> in the <em>opt_set</em>,
the <em>opt_set_mask</em> should be
<tt class="docutils literal"><span class="pre">NGHTTP2_OPT_NO_AUTO_CONNECTION_WINDOW_UPDATE</span> <span class="pre">|</span>
<span class="pre">NGHTTP2_OPT_PEER_MAX_CONCURRENT_STREAMS</span></tt>.</p>
<p>If the <em>opt_set_mask</em> is 0, the <em>opt_set</em> could be <tt class="docutils literal"><span class="pre">NULL</span></tt> safely
and the call is equivalent to <a class="reference internal" href="#nghttp2_session_client_new" title="nghttp2_session_client_new"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_client_new()</span></tt></a>.</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>
2013-07-28 14:26:41 +02:00
</dd></dl>
<dl class="function">
2013-11-07 16:22:38 +01:00
<dt id="nghttp2_session_server_new2">
int <tt class="descname">nghttp2_session_server_new2</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>, uint32_t<em>&nbsp;opt_set_mask</em>, const <a class="reference internal" href="#nghttp2_opt_set" title="nghttp2_opt_set">nghttp2_opt_set</a><em>&nbsp;*opt_set</em><big>)</big><a class="headerlink" href="#nghttp2_session_server_new2" title="Permalink to this definition"></a></dt>
<dd><p>Like <a class="reference internal" href="#nghttp2_session_server_new" title="nghttp2_session_server_new"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_server_new()</span></tt></a>, but with additional options
specified in the <em>opt_set</em>. The caller must set bitwise-OR of
<a class="reference internal" href="#nghttp2_opt" title="nghttp2_opt"><tt class="xref c c-macro docutils literal"><span class="pre">nghttp2_opt</span></tt></a> for given options. For example, if it
specifies <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> and
<a class="reference internal" href="#NGHTTP2_OPT_PEER_MAX_CONCURRENT_STREAMS" title="NGHTTP2_OPT_PEER_MAX_CONCURRENT_STREAMS"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_OPT_PEER_MAX_CONCURRENT_STREAMS</span></tt></a> in the <em>opt_set</em>,
the <em>opt_set_mask</em> should be
<tt class="docutils literal"><span class="pre">NGHTTP2_OPT_NO_AUTO_CONNECTION_WINDOW_UPDATE</span> <span class="pre">|</span>
<span class="pre">NGHTTP2_OPT_PEER_MAX_CONCURRENT_STREAMS</span></tt>.</p>
<p>If the <em>opt_set_mask</em> is 0, the <em>opt_set</em> could be <tt class="docutils literal"><span class="pre">NULL</span></tt> safely
and the call is equivalent to <a class="reference internal" href="#nghttp2_session_server_new" title="nghttp2_session_server_new"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_server_new()</span></tt></a>.</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">
2013-11-07 16:22:38 +01: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>
2013-07-28 14:26:41 +02:00
</dl>
</dd></dl>
2013-11-07 16:22:38 +01:00
<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>
2013-07-28 14:26:41 +02:00
<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),
2013-11-14 16:58:14 +01:00
<a class="reference internal" href="#nghttp2_session_callbacks.on_frame_not_send_callback" title="nghttp2_session_callbacks.on_frame_not_send_callback"><tt class="xref c c-member docutils literal"><span class="pre">nghttp2_session_callbacks.on_frame_not_send_callback</span></tt></a> is
2013-07-28 14:26:41 +02:00
invoked. Abort the following steps.</li>
<li>If the frame is request HEADERS, the stream is opened
here.</li>
2013-11-14 16:58:14 +01:00
<li><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> is
2013-07-28 14:26:41 +02:00
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,
2013-11-14 16:58:14 +01:00
<a class="reference internal" href="#nghttp2_session_callbacks.on_frame_send_callback" title="nghttp2_session_callbacks.on_frame_send_callback"><tt class="xref c c-member docutils literal"><span class="pre">nghttp2_session_callbacks.on_frame_send_callback</span></tt></a> is
2013-07-28 14:26:41 +02:00
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>
2013-12-08 16:07:37 +01:00
<li>If the frame is DATA frame:<ol class="arabic">
<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
to receive DATA payload. For each chunk of data,
2013-07-28 14:26:41 +02:00
<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>
2013-12-08 16:07:37 +01:00
is invoked.</li>
<li>If one DATA frame is completely received,
<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
2013-07-28 14:26:41 +02:00
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>
2013-12-08 16:07:37 +01:00
is invoked.</li>
2013-07-28 14:26:41 +02:00
</ol>
2013-12-08 16:07:37 +01:00
</li>
<li>If the frame is the control frame:<ol class="arabic">
<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 whole frame.</li>
<li>If the received frame is valid,
<a class="reference internal" href="#nghttp2_session_callbacks.on_frame_recv_callback" title="nghttp2_session_callbacks.on_frame_recv_callback"><tt class="xref c c-member docutils literal"><span class="pre">nghttp2_session_callbacks.on_frame_recv_callback</span></tt></a> is
2014-01-17 16:36:03 +01:00
invoked. If frame is either HEADERS or PUSH_PROMISE,
<a class="reference internal" href="#nghttp2_session_callbacks.on_header_callback" title="nghttp2_session_callbacks.on_header_callback"><tt class="xref c c-member docutils literal"><span class="pre">nghttp2_session_callbacks.on_header_callback</span></tt></a> is
invoked for each header name/value pair. After all name/value
pairs are emitted (or decompression failed),
<a class="reference internal" href="#nghttp2_session_callbacks.on_end_headers_callback" title="nghttp2_session_callbacks.on_end_headers_callback"><tt class="xref c c-member docutils literal"><span class="pre">nghttp2_session_callbacks.on_end_headers_callback</span></tt></a>
is invoked. If the frame is the final frame of the request,
2013-07-28 14:26:41 +02:00
<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>
2013-12-08 16:07:37 +01:00
is invoked.</li>
<li>If the received frame is unpacked but is interpreted as
invalid,
2013-11-14 16:58:14 +01:00
<a class="reference internal" href="#nghttp2_session_callbacks.on_invalid_frame_recv_callback" title="nghttp2_session_callbacks.on_invalid_frame_recv_callback"><tt class="xref c c-member docutils literal"><span class="pre">nghttp2_session_callbacks.on_invalid_frame_recv_callback</span></tt></a>
2013-12-08 16:07:37 +01:00
is invoked.</li>
<li>If the received frame could not be unpacked correctly,
<tt class="xref c c-member docutils literal"><span class="pre">nghttp2_session_callbacks.on_frame_recv_parse_error_callback</span></tt>
is invoked.</li>
<li>If the received frame type is unknown,
<a class="reference internal" href="#nghttp2_session_callbacks.on_unknown_frame_recv_callback" title="nghttp2_session_callbacks.on_unknown_frame_recv_callback"><tt class="xref c c-member docutils literal"><span class="pre">nghttp2_session_callbacks.on_unknown_frame_recv_callback</span></tt></a>
is invoked.</li>
</ol>
</li>
</ol>
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_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
2013-10-03 18:33:21 +02:00
processes all input data unless either an error occurs or
<a class="reference internal" href="#NGHTTP2_ERR_PAUSE" title="NGHTTP2_ERR_PAUSE"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_ERR_PAUSE</span></tt></a> is returned from
2014-01-17 16:17:15 +01:00
<a class="reference internal" href="#nghttp2_session_callbacks.on_header_callback" title="nghttp2_session_callbacks.on_header_callback"><tt class="xref c c-member docutils literal"><span class="pre">nghttp2_session_callbacks.on_header_callback</span></tt></a> or
2013-10-03 18:33:21 +02:00
<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>.
If <a class="reference internal" href="#NGHTTP2_ERR_PAUSE" title="NGHTTP2_ERR_PAUSE"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_ERR_PAUSE</span></tt></a> is used, the return value includes the
number of bytes which was used to produce the data or frame for the
callback.</p>
2013-07-28 14:26:41 +02:00
<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>
2013-10-03 18:33:21 +02:00
<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>
2013-07-28 14:26:41 +02:00
<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
2013-12-23 15:51:07 +01:00
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>,
<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> or
<a class="reference internal" href="#nghttp2_session_set_stream_user_data" title="nghttp2_session_set_stream_user_data"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_set_stream_user_data()</span></tt></a>. Unless it is set using
<a class="reference internal" href="#nghttp2_session_set_stream_user_data" title="nghttp2_session_set_stream_user_data"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_set_stream_user_data()</span></tt></a>, 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 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_set_stream_user_data">
int <tt class="descname">nghttp2_session_set_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>, void<em>&nbsp;*stream_user_data</em><big>)</big><a class="headerlink" href="#nghttp2_session_set_stream_user_data" title="Permalink to this definition"></a></dt>
<dd><p>Sets the <em>stream_user_data</em> to the stream denoted by the
<em>stream_id</em>. If a stream user data is already set to the stream, it
is replaced with the <em>stream_user_data</em>. It is valid to specify
<tt class="docutils literal"><span class="pre">NULL</span></tt> in the <em>stream_user_data</em>, which nullifies the associated
data pointer.</p>
2013-12-24 16:31:37 +01:00
<p>It is valid to set the <em>stream_user_data</em> to the stream reserved by
PUSH_PROMISE frame.</p>
2013-12-23 15:51:07 +01:00
<p>This function returns 0 if it succeeds, or one of 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</dd>
</dl>
2013-07-28 14:26:41 +02:00
</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>
2013-10-29 17:04:28 +01:00
<dl class="function">
<dt id="nghttp2_session_get_stream_effective_recv_data_length">
int32_t <tt class="descname">nghttp2_session_get_stream_effective_recv_data_length</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_effective_recv_data_length" title="Permalink to this definition"></a></dt>
<dd><p>Returns the number of DATA payload in bytes received without
WINDOW_UPDATE transmission for the stream <em>stream_id</em>. The local
(receive) window size can be adjusted by
<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 function takes into account
that and returns effective data length. In particular, if the
local window size is reduced by submitting negative
window_size_increment with <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
function returns the number of bytes less than actually received.</p>
<p>If flow control is disabled for that stream, this function returns
0.</p>
<p>This function returns -1 if it fails.</p>
</dd></dl>
<dl class="function">
<dt id="nghttp2_session_get_stream_effective_local_window_size">
int32_t <tt class="descname">nghttp2_session_get_stream_effective_local_window_size</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_effective_local_window_size" title="Permalink to this definition"></a></dt>
<dd><p>Returns the local (receive) window size for the stream
<em>stream_id</em>. The local window size can be adjusted by
<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 function takes into account
that and returns effective window size.</p>
<p>This function returns -1 if it fails.</p>
</dd></dl>
<dl class="function">
<dt id="nghttp2_session_get_effective_recv_data_length">
int32_t <tt class="descname">nghttp2_session_get_effective_recv_data_length</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_effective_recv_data_length" title="Permalink to this definition"></a></dt>
<dd><p>Returns the number of DATA payload in bytes received without
WINDOW_UPDATE transmission for a connection. The local (receive)
window size can be adjusted by
<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 function takes into account
that and returns effective data length. In particular, if the local
window size is reduced by submitting negative window_size_increment
with <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 function returns the
number of bytes less than actually received.</p>
<p>If flow control is disabled for a connection, this function returns
0.</p>
<p>This function returns -1 if it fails.</p>
</dd></dl>
<dl class="function">
<dt id="nghttp2_session_get_effective_local_window_size">
int32_t <tt class="descname">nghttp2_session_get_effective_local_window_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_effective_local_window_size" title="Permalink to this definition"></a></dt>
<dd><p>Returns the local (receive) window size for a connection. The local
window size can be adjusted by
<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 function takes into account
that and returns effective window size.</p>
<p>This function returns -1 if it fails.</p>
</dd></dl>
2013-07-28 14:26:41 +02:00
<dl class="function">
2013-12-26 15:39:18 +01:00
<dt id="nghttp2_session_terminate_session">
int <tt class="descname">nghttp2_session_terminate_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_terminate_session" title="Permalink to this definition"></a></dt>
<dd><p>Signals the session so that the connection should be terminated.</p>
<p>GOAWAY frame with the given <em>error_code</em> will be submitted if it
has not been transmitted. After the transmission, 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. If GOAWAY frame has already transmitted at the time when
this function is invoked, <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> returns 0 immediately after this
function succeeds.</p>
2013-07-28 14:26:41 +02:00
<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">
2013-09-10 17:59:12 +02:00
ssize_t <tt class="descname">nghttp2_pack_settings_payload</tt><big>(</big>uint8_t<em>&nbsp;*buf</em>, size_t<em>&nbsp;buflen</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_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 size of the
<em>buf</em> is specified by <em>buflen</em>. The number of entries in the <em>iv</em>
array is given by <em>niv</em>. The required space in <em>buf</em> for the <em>niv</em>
entries is <tt class="docutils literal"><span class="pre">8*niv</span></tt> bytes and if the given buffer is too small, an
error is returned. This function is used mainly for creating a
SETTINGS payload to be sent with the <tt class="docutils literal"><span class="pre">HTTP2-Settings</span></tt> header
field in an HTTP Upgrade request. The data written in <em>buf</em> is NOT
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>
2013-09-10 17:59:12 +02:00
<dt><a class="reference internal" href="#NGHTTP2_ERR_INSUFF_BUFSIZE" title="NGHTTP2_ERR_INSUFF_BUFSIZE"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_ERR_INSUFF_BUFSIZE</span></tt></a></dt>
<dd>The provided <em>buflen</em> size is too small to hold the output.</dd>
2013-08-03 13:03:39 +02:00
</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">
2013-12-08 16:07:37 +01:00
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 <a class="reference internal" href="#nghttp2_nv" title="nghttp2_nv">nghttp2_nv</a><em>&nbsp;*nva</em>, size_t<em>&nbsp;nvlen</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>
2013-07-28 14:26:41 +02:00
<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-12-08 16:07:37 +01:00
<p>The <em>nva</em> is an array of name/value pair <a class="reference internal" href="#nghttp2_nv" title="nghttp2_nv"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_nv</span></tt></a> with
2013-12-18 16:06:52 +01:00
<em>nvlen</em> elements. The value is opaque sequence of bytes and
therefore can contain NULL byte (0x0). If the application requires
that the ordering of values for a single header field name
appearing in different header fields, it has to concatenate them
using NULL byte (0x0) before passing them to this function.</p>
2013-10-30 18:13:51 +01:00
<p>HTTP/2.0 specification has requirement about header fields in the
request HEADERS. See the specification for more details.</p>
2013-12-08 16:07:37 +01:00
<p>This function creates copies of all name/value pairs in <em>nva</em>. It
also lower-cases all names in <em>nva</em>.</p>
2013-07-28 14:26:41 +02:00
<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
2013-12-08 16:07:37 +01:00
be specified with <tt class="docutils literal"><span class="pre">:method</span></tt> key in <em>nva</em> (e.g. <tt class="docutils literal"><span class="pre">POST</span></tt>). This
2013-07-28 14:26:41 +02:00
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
2013-11-14 16:58:14 +01: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 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>
2014-01-17 16:17:15 +01:00
<dd>The <em>pri</em> is invalid</dd>
2013-09-10 17:59:12 +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>
2013-07-28 14:26:41 +02:00
<dl class="function">
<dt id="nghttp2_submit_response">
2013-12-08 16:07:37 +01:00
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 <a class="reference internal" href="#nghttp2_nv" title="nghttp2_nv">nghttp2_nv</a><em>&nbsp;*nva</em>, size_t<em>&nbsp;nvlen</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>
2013-07-28 14:26:41 +02:00
<dd><p>Submits response HEADERS frame and optionally one or more DATA
frames against the stream <em>stream_id</em>.</p>
2013-12-08 16:07:37 +01:00
<p>The <em>nva</em> is an array of name/value pair <a class="reference internal" href="#nghttp2_nv" title="nghttp2_nv"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_nv</span></tt></a> with
2013-12-18 16:06:52 +01:00
<em>nvlen</em> elements. The value is opaque sequence of bytes and
therefore can contain NULL byte (0x0). If the application requires
that the ordering of values for a single header field name
appearing in different header fields, it has to concatenate them
using NULL byte (0x0) before passing them to this function.</p>
2013-10-30 18:13:51 +01:00
<p>HTTP/2.0 specification has requirement about header fields in the
response HEADERS. See the specification for more details.</p>
2013-12-08 16:07:37 +01:00
<p>This function creates copies of all name/value pairs in <em>nva</em>. It
also lower-cases all names in <em>nva</em>.</p>
2013-07-28 14:26:41 +02:00
<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>
2014-01-10 17:07:30 +01:00
<p>This method can be used as normal HTTP response and push
2013-12-11 16:30:48 +01:00
response. When pushing a resource using this function, the
<em>session</em> must be configured using <a class="reference internal" href="#nghttp2_session_server_new" title="nghttp2_session_server_new"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_server_new()</span></tt></a>
or its variants and the target stream denoted by the <em>stream_id</em>
must be reserved using <a class="reference internal" href="#nghttp2_submit_push_promise" title="nghttp2_submit_push_promise"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_submit_push_promise()</span></tt></a>.</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">
2013-11-28 15:42:58 +01: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>
2013-07-28 14:26:41 +02:00
<dd>Out of memory.</dd>
</dl>
</dd></dl>
<dl class="function">
<dt id="nghttp2_submit_headers">
2013-12-08 16:07:37 +01:00
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 <a class="reference internal" href="#nghttp2_nv" title="nghttp2_nv">nghttp2_nv</a><em>&nbsp;*nva</em>, size_t<em>&nbsp;nvlen</em>, void<em>&nbsp;*stream_user_data</em><big>)</big><a class="headerlink" href="#nghttp2_submit_headers" title="Permalink to this definition"></a></dt>
2013-07-28 14:26:41 +02:00
<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>
2013-12-08 16:07:37 +01:00
<p>The <em>nva</em> is an array of name/value pair <a class="reference internal" href="#nghttp2_nv" title="nghttp2_nv"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_nv</span></tt></a> with
2013-12-18 16:06:52 +01:00
<em>nvlen</em> elements. The value is opaque sequence of bytes and
therefore can contain NULL byte (0x0). If the application requires
that the ordering of values for a single header field name
appearing in different header fields, it has to concatenate them
using NULL byte (0x0) before passing them to this function.</p>
2013-12-08 16:07:37 +01:00
<p>This function creates copies of all name/value pairs in <em>nva</em>. It
also lower-cases all names in <em>nva</em>.</p>
2013-07-28 14:26:41 +02:00
<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>
2014-01-17 16:17:15 +01:00
<dd>The <em>pri</em> is invalid</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>
</dl>
</dd></dl>
<dl class="function">
<dt id="nghttp2_submit_priority">
2013-10-25 18:17:09 +02:00
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>, uint8_t<em>&nbsp;flags</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>
2013-07-28 14:26:41 +02:00
<dd><p>Submits PRIORITY frame to change the priority of stream <em>stream_id</em>
to the priority value <em>pri</em>.</p>
2013-10-25 18:17:09 +02:00
<p>The <em>flags</em> is currently ignored and should be
<a class="reference internal" href="#NGHTTP2_FLAG_NONE" title="NGHTTP2_FLAG_NONE"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_FLAG_NONE</span></tt></a>.</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>
<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>
</dl>
</dd></dl>
<dl class="function">
<dt id="nghttp2_submit_rst_stream">
2013-10-25 18:17:09 +02:00
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>, uint8_t<em>&nbsp;flags</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>
2013-07-28 14:26:41 +02:00
<dd><p>Submits RST_STREAM frame to cancel/reject the stream <em>stream_id</em>
with the error code <em>error_code</em>.</p>
2013-10-25 18:17:09 +02:00
<p>The <em>flags</em> is currently ignored and should be
<a class="reference internal" href="#NGHTTP2_FLAG_NONE" title="NGHTTP2_FLAG_NONE"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_FLAG_NONE</span></tt></a>.</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_settings">
2013-10-25 18:17:09 +02:00
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>, uint8_t<em>&nbsp;flags</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>
2013-07-28 14:26:41 +02:00
<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-10-25 18:17:09 +02:00
<p>The <em>flags</em> is currently ignored and should be
<a class="reference internal" href="#NGHTTP2_FLAG_NONE" title="NGHTTP2_FLAG_NONE"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_FLAG_NONE</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-10-28 15:32:57 +01:00
<p>SETTINGS with <a class="reference internal" href="#NGHTTP2_FLAG_ACK" title="NGHTTP2_FLAG_ACK"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_FLAG_ACK</span></tt></a> is automatically submitted
by the library and application could not send it at its will.</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">
2013-12-08 16:07:37 +01:00
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 <a class="reference internal" href="#nghttp2_nv" title="nghttp2_nv">nghttp2_nv</a><em>&nbsp;*nva</em>, size_t<em>&nbsp;nvlen</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>
2013-12-08 16:07:37 +01:00
<p>The <em>nva</em> is an array of name/value pair <a class="reference internal" href="#nghttp2_nv" title="nghttp2_nv"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_nv</span></tt></a> with
2013-12-18 16:06:52 +01:00
<em>nvlen</em> elements. The value is opaque sequence of bytes and
therefore can contain NULL byte (0x0). If the application requires
that the ordering of values for a single header field name
appearing in different header fields, it has to concatenate them
using NULL byte (0x0) before passing them to this function.</p>
2013-12-08 16:07:37 +01:00
<p>This function creates copies of all name/value pairs in <em>nva</em>. It
also lower-cases all names in <em>nva</em>.</p>
2013-07-28 14:26:41 +02:00
<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>
2014-01-10 17:07:30 +01:00
<p>The client side can use this function to send PUSH_PROMISE to the
server. But in normal HTTP usage, the server may treat it error.</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_ping">
2013-10-25 18:17:09 +02:00
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;flags</em>, uint8_t<em>&nbsp;*opaque_data</em><big>)</big><a class="headerlink" href="#nghttp2_submit_ping" title="Permalink to this definition"></a></dt>
2013-07-28 14:26:41 +02:00
<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-10-25 18:17:09 +02:00
<p>The <em>flags</em> is currently ignored and should be
<a class="reference internal" href="#NGHTTP2_FLAG_NONE" title="NGHTTP2_FLAG_NONE"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_FLAG_NONE</span></tt></a>.</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">
2013-10-25 18:17:09 +02:00
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>, uint8_t<em>&nbsp;flags</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>
2013-07-28 14:26:41 +02:00
<dd><p>Submits GOAWAY frame with the error code <em>error_code</em>.</p>
2013-10-25 18:17:09 +02:00
<p>The <em>flags</em> is currently ignored and should be
<a class="reference internal" href="#NGHTTP2_FLAG_NONE" title="NGHTTP2_FLAG_NONE"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_FLAG_NONE</span></tt></a>.</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-10-25 18:17:09 +02:00
<p>The <em>flags</em> is currently ignored and should be
<a class="reference internal" href="#NGHTTP2_FLAG_NONE" title="NGHTTP2_FLAG_NONE"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_FLAG_NONE</span></tt></a>.</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-10-25 18:17:09 +02:00
<p>If the <em>window_size_increment</em> is 0, the function does nothing and
returns 0.</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">
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_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>
2014-01-01 17:03:29 +01:00
<dd><p>A helper function for dealing with NPN in client side or ALPN in
server side. The <em>in</em> contains peer&#8217;s protocol list 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>
2013-07-28 14:26:41 +02:00
<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">
2014-01-01 17:03:29 +01:00
<li>If peer&#8217;s list contains HTTP/2.0 protocol the library supports,
it is selected and returns 1. The following step is not taken.</li>
<li>If peer&#8217;s list contains <tt class="docutils literal"><span class="pre">http/1.1</span></tt>, this function selects
2013-07-28 14:26:41 +02:00
<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>
2014-01-01 17:03:29 +01:00
<p>For NPN, to use this method you should do something like:</p>
2013-07-28 14:26:41 +02:00
<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>
</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>
2013-09-04 15:59:13 +02:00
<dl class="function">
<dt id="nghttp2_version">
<a class="reference internal" href="#nghttp2_info" title="nghttp2_info">nghttp2_info</a> *<tt class="descname">nghttp2_version</tt><big>(</big>int<em>&nbsp;least_version</em><big>)</big><a class="headerlink" href="#nghttp2_version" title="Permalink to this definition"></a></dt>
<dd><p>Returns a pointer to a nghttp2_info struct with version information about
the run-time library in use. The <em>least_version</em> argument can be set to a
24 bit numerical value for the least accepted version number and if the
condition is not met, this function will return a NULL. Pass in 0 to skip
the version checking.</p>
</dd></dl>
2014-01-18 17:17:41 +01:00
<dl class="function">
<dt id="nghttp2_is_fatal">
int <tt class="descname">nghttp2_is_fatal</tt><big>(</big>int<em>&nbsp;lib_error</em><big>)</big><a class="headerlink" href="#nghttp2_is_fatal" title="Permalink to this definition"></a></dt>
<dd><p>Returns nonzero if the <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> library error code
<em>lib_error</em> is fatal.</p>
</dd></dl>
2013-07-28 14:26:41 +02:00
</div>
</div>
<footer>
<div class="rst-footer-buttons">
<a href="nghttp2.h.html" class="btn btn-neutral float-right" title="nghttp2.h"/>Next <span class="icon icon-circle-arrow-right"></span></a>
2013-12-26 15:39:18 +01:00
<a href="tutorial-server.html" class="btn btn-neutral" title="Tutorial: HTTP/2.0 server"><span class="icon icon-circle-arrow-left"></span> Previous</a>
</div>
2013-07-28 14:26:41 +02:00
<hr/>
<p>
2014-01-05 14:19:24 +01:00
&copy; Copyright 2012, 2014, Tatsuhiro Tsujikawa.
</p>
<a href="https://www.github.com/snide/sphinx_rtd_theme">Sphinx theme</a> provided by <a href="http://readthedocs.org">Read the Docs</a>
</footer>
2013-07-28 14:26:41 +02:00
</div>
</div>
</section>
</div>
</body>
2013-07-28 14:26:41 +02:00
</html>