nghttp2/apiref.html

3942 lines
319 KiB
HTML

<!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.7.8-DEV documentation</title>
<link href='https://fonts.googleapis.com/css?family=Lato:400,700,400italic,700italic|Roboto+Slab:400,700|Inconsolata:400,700&subset=latin,cyrillic' rel='stylesheet' type='text/css'>
<link rel="stylesheet" href="_static/css/theme.css" type="text/css" />
<link rel="top" title="nghttp2 0.7.8-DEV documentation" href="index.html"/>
<link rel="next" title="libnghttp2_asio: High level HTTP/2 C++ library" href="libnghttp2_asio.html"/>
<link rel="prev" title="h2load - HTTP/2 benchmarking tool - HOW-TO" href="h2load-howto.html"/>
<script src="https://cdnjs.cloudflare.com/ajax/libs/modernizr/2.6.2/modernizr.min.js"></script>
</head>
<body class="wy-body-for-nav" role="document">
<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="fa fa-home"> nghttp2</a>
<div role="search">
<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>
<div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
<ul class="current">
<li class="toctree-l1"><a class="reference internal" href="package_README.html">nghttp2 - HTTP/2 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#unit-tests">Unit tests</a></li>
<li class="toctree-l2"><a class="reference internal" href="package_README.html#integration-tests">Integration tests</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>
<li class="toctree-l2"><a class="reference internal" href="package_README.html#benchmarking-tool">Benchmarking tool</a></li>
<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#libnghttp2-asio-high-level-http-2-c-library">libnghttp2_asio: High level HTTP/2 C++ library</a></li>
<li class="toctree-l2"><a class="reference internal" href="package_README.html#python-bindings">Python bindings</a></li>
<li class="toctree-l2"><a class="reference internal" href="package_README.html#contribution">Contribution</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="contribute.html">Contribution Guidelines</a><ul>
<li class="toctree-l2"><a class="reference internal" href="contribute.html#coding-style">Coding style</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="building-android-binary.html">Building Android binary</a></li>
<li class="toctree-l1"><a class="reference internal" href="tutorial-client.html">Tutorial: HTTP/2 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 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"><a class="reference internal" href="tutorial-hpack.html">Tutorial: HPACK API</a><ul>
<li class="toctree-l2"><a class="reference internal" href="tutorial-hpack.html#deflating-encoding-headers">Deflating (encoding) headers</a></li>
<li class="toctree-l2"><a class="reference internal" href="tutorial-hpack.html#inflating-decoding-headers">Inflating (decoding) headers</a></li>
<li class="toctree-l2"><a class="reference internal" href="tutorial-hpack.html#deflate-c">deflate.c</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="nghttp.1.html">nghttp(1)</a><ul>
<li class="toctree-l2"><a class="reference internal" href="nghttp.1.html#synopsis">SYNOPSIS</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttp.1.html#description">DESCRIPTION</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttp.1.html#options">OPTIONS</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttp.1.html#see-also">SEE ALSO</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="nghttpd.1.html">nghttpd(1)</a><ul>
<li class="toctree-l2"><a class="reference internal" href="nghttpd.1.html#synopsis">SYNOPSIS</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpd.1.html#description">DESCRIPTION</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpd.1.html#options">OPTIONS</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpd.1.html#see-also">SEE ALSO</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="nghttpx.1.html">nghttpx(1)</a><ul>
<li class="toctree-l2"><a class="reference internal" href="nghttpx.1.html#synopsis">SYNOPSIS</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx.1.html#description">DESCRIPTION</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx.1.html#options">OPTIONS</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx.1.html#files">FILES</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx.1.html#signals">SIGNALS</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx.1.html#server-push">SERVER PUSH</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx.1.html#unix-domain-socket">UNIX DOMAIN SOCKET</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx.1.html#see-also">SEE ALSO</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="h2load.1.html">h2load(1)</a><ul>
<li class="toctree-l2"><a class="reference internal" href="h2load.1.html#synopsis">SYNOPSIS</a></li>
<li class="toctree-l2"><a class="reference internal" href="h2load.1.html#description">DESCRIPTION</a></li>
<li class="toctree-l2"><a class="reference internal" href="h2load.1.html#options">OPTIONS</a></li>
<li class="toctree-l2"><a class="reference internal" href="h2load.1.html#output">OUTPUT</a></li>
<li class="toctree-l2"><a class="reference internal" href="h2load.1.html#see-also">SEE ALSO</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="nghttpx-howto.html">nghttpx - HTTP/2 proxy - HOW-TO</a><ul>
<li class="toctree-l2"><a class="reference internal" href="nghttpx-howto.html#default-mode">Default mode</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx-howto.html#http-2-proxy-mode">HTTP/2 proxy mode</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx-howto.html#client-mode">Client mode</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx-howto.html#client-proxy-mode">Client proxy mode</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx-howto.html#http-2-bridge-mode">HTTP/2 bridge mode</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx-howto.html#disable-ssl-tls">Disable SSL/TLS</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx-howto.html#specifying-additional-ca-certificate">Specifying additional CA certificate</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx-howto.html#read-write-rate-limit">Read/write rate limit</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx-howto.html#rewriting-location-header-field">Rewriting location header field</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx-howto.html#hot-swapping">Hot swapping</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx-howto.html#re-opening-log-files">Re-opening log files</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx-howto.html#multiple-backend-addresses">Multiple backend addresses</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="h2load-howto.html">h2load - HTTP/2 benchmarking tool - HOW-TO</a><ul>
<li class="toctree-l2"><a class="reference internal" href="h2load-howto.html#basic-usage">Basic Usage</a></li>
<li class="toctree-l2"><a class="reference internal" href="h2load-howto.html#flow-control">Flow Control</a></li>
<li class="toctree-l2"><a class="reference internal" href="h2load-howto.html#multi-threading">Multi-Threading</a></li>
<li class="toctree-l2"><a class="reference internal" href="h2load-howto.html#selecting-protocol-for-clear-text">Selecting protocol for clear text</a></li>
<li class="toctree-l2"><a class="reference internal" href="h2load-howto.html#multiple-uris">Multiple URIs</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="#http-messaging">HTTP Messaging</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="libnghttp2_asio.html">libnghttp2_asio: High level HTTP/2 C++ library</a><ul>
<li class="toctree-l2"><a class="reference internal" href="libnghttp2_asio.html#server-api">Server API</a></li>
<li class="toctree-l2"><a class="reference internal" href="libnghttp2_asio.html#client-api">Client API</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="python-apiref.html">Python API Reference</a><ul>
<li class="toctree-l2"><a class="reference internal" href="python-apiref.html#hpack-api">HPACK API</a></li>
<li class="toctree-l2"><a class="reference internal" href="python-apiref.html#http-2-servers">HTTP/2 servers</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>
<li class="toctree-l1"><a class="reference internal" href="asio_http2_server.h.html">asio_http2_server.h</a></li>
<li class="toctree-l1"><a class="reference internal" href="asio_http2_client.h.html">asio_http2_client.h</a></li>
<li class="toctree-l1"><a class="reference internal" href="asio_http2.h.html">asio_http2.h</a></li>
<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>
<li class="toctree-l1"><a class="reference external" href="https://nghttp2.org/">nghttp2.org</a></li>
</ul>
</div>
&nbsp;
</nav>
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">
<nav class="wy-nav-top" role="navigation" aria-label="top navigation">
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
<a href="index.html">nghttp2</a>
</nav>
<div class="wy-nav-content">
<div class="rst-content">
<div role="navigation" aria-label="breadcrumbs navigation">
<ul class="wy-breadcrumbs">
<li><a href="index.html">Docs</a> &raquo;</li>
<li>API Reference</li>
<li class="wy-breadcrumbs-aside">
</li>
</ul>
<hr/>
</div>
<div role="main" class="document">
<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>
<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>
</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="#c.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="#c.nghttp2_session_mem_send" title="nghttp2_session_mem_send"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_mem_send()</span></tt></a>,
<a class="reference internal" href="#c.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="#c.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
these functions outside the callbacks.</p>
<p>Currently, <a class="reference internal" href="#c.nghttp2_session_send" title="nghttp2_session_send"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_send()</span></tt></a> and <a class="reference internal" href="#c.nghttp2_session_mem_send" title="nghttp2_session_mem_send"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_mem_send()</span></tt></a>
do not send client connection preface
(<a class="reference internal" href="#c.NGHTTP2_CLIENT_CONNECTION_PREFACE" title="NGHTTP2_CLIENT_CONNECTION_PREFACE"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_CLIENT_CONNECTION_PREFACE</span></tt></a>). The applications are
responsible to send it before sending any HTTP/2 frames using these
functions if <a class="reference internal" href="#c.nghttp2_session" title="nghttp2_session"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_session</span></tt></a> is configured as client.
Similarly, <a class="reference internal" href="#c.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="#c.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>
do not consume client connection preface unless
<a class="reference internal" href="#c.nghttp2_option_set_recv_client_preface" title="nghttp2_option_set_recv_client_preface"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_option_set_recv_client_preface()</span></tt></a> is used with nonzero option
value. The applications are responsible to receive it before calling
these functions if <a class="reference internal" href="#c.nghttp2_session" title="nghttp2_session"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_session</span></tt></a> is configured as server and
<a class="reference internal" href="#c.nghttp2_option_set_recv_client_preface" title="nghttp2_option_set_recv_client_preface"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_option_set_recv_client_preface()</span></tt></a> is not used.</p>
</div>
<div class="section" id="http-messaging">
<h2>HTTP Messaging<a class="headerlink" href="#http-messaging" title="Permalink to this headline"></a></h2>
<p>By default, nghttp2 library checks HTTP messaging rules described in
<a class="reference external" href="https://tools.ietf.org/html/draft-ietf-httpbis-http2-17#section-8">HTTP/2 specification, section 8</a>.
Everything described in that section is not validated however. We
briefly describe what the library does in this area. In the following
description, without loss of generality we omit CONTINUATION frame
since they must follow HEADERS frame and are processed atomically. In
other words, they are just one big HEADERS frame. To disable these
validations, use <a class="reference internal" href="#c.nghttp2_option_set_no_http_messaging" title="nghttp2_option_set_no_http_messaging"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_option_set_no_http_messaging()</span></tt></a>.</p>
<p>For HTTP request, including those carried by PUSH_PROMISE, HTTP
message starts with one HEADERS frame containing request headers. It
is followed by zero or more DATA frames containing request body, which
is followed by zero or one HEADERS containing trailer headers. The
request headers must include &quot;:scheme&quot;, &quot;:method&quot; and &quot;:path&quot; pseudo
header fields unless &quot;:method&quot; is not &quot;CONNECT&quot;. &quot;:authority&quot; is
optional, but nghttp2 requires either &quot;:authority&quot; or &quot;Host&quot; header
field must be present. If &quot;:method&quot; is &quot;CONNECT&quot;, the request headers
must include &quot;:method&quot; and &quot;:authority&quot; and must omit &quot;:scheme&quot; and
&quot;:path&quot;.</p>
<p>For HTTP response, HTTP message starts with zero or more HEADERS
frames containing non-final response (status code 1xx). They are
followed by one HEADERS frame containing final response headers
(non-1xx). It is followed by zero or more DATA frames containing
response body, which is followed by zero or one HEADERS containing
trailer headers. The non-final and final response headers must
contain &quot;:status&quot; pseudo header field containing 3 digits only.</p>
<p>All request and response headers must include exactly one valid value
for each pseudo header field. Additionally nghttp2 requires all
request headers must not include more than one &quot;Host&quot; header field.</p>
<p>HTTP/2 prohibits connection-specific header fields. The following
header fields must not appear: &quot;Connection&quot;, &quot;Keep-Alive&quot;,
&quot;Proxy-Connection&quot;, &quot;Transfer-Encoding&quot; and &quot;Upgrade&quot;. Additionally,
&quot;TE&quot; header field must not include any value other than &quot;trailers&quot;.</p>
<p>Each header field name and value must obey the field-name and
field-value production rules described in <a class="reference external" href="https://tools.ietf.org/html/rfc7230#section-3.2">RFC 7230, section
3.2.</a>.
Additionally, all field name must be lower cased. While the pseudo
header fields must satisfy these rules, we just ignore illegal regular
headers (this means that these header fields are not passed to
application callback). This is because these illegal header fields
are floating around in existing internet and resetting stream just
because of this may break many web sites. This is especially true if
we forward to or translate from HTTP/1 traffic.</p>
<p>With the above validations, nghttp2 library guarantees that header
field name passed to <a class="reference internal" href="#c.nghttp2_on_header_callback" title="nghttp2_on_header_callback"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_on_header_callback()</span></tt></a> is not empty.
Also required pseudo headers are all present and not empty.</p>
<p>nghttp2 enforces &quot;Content-Length&quot; validation as well. All request or
response headers must not contain more than one &quot;Content-Length&quot;
header field. If &quot;Content-Length&quot; header field is present, it must be
parsed as 64 bit signed integer. The sum of data length in the
following DATA frames must match with the number in &quot;Content-Length&quot;
header field if it is present (this does not include padding bytes).</p>
<p>Any deviation results in stream error of type PROTOCOL_ERROR. If
error is found in PUSH_PROMISE frame, stream error is raised against
promised stream.</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="c.NGHTTP2_VERSION">
<tt class="descname">NGHTTP2_VERSION</tt><a class="headerlink" href="#c.NGHTTP2_VERSION" title="Permalink to this definition"></a></dt>
<dd><p>Version number of the nghttp2 library release</p>
</dd></dl>
<dl class="macro">
<dt id="c.NGHTTP2_VERSION_NUM">
<tt class="descname">NGHTTP2_VERSION_NUM</tt><a class="headerlink" href="#c.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>
<dl class="macro">
<dt id="c.NGHTTP2_PROTO_VERSION_ID">
<tt class="descname">NGHTTP2_PROTO_VERSION_ID</tt><a class="headerlink" href="#c.NGHTTP2_PROTO_VERSION_ID" title="Permalink to this definition"></a></dt>
<dd><p>The protocol version identification string of this library
supports. This identifier is used if HTTP/2 is used over TLS.</p>
</dd></dl>
<dl class="macro">
<dt id="c.NGHTTP2_PROTO_VERSION_ID_LEN">
<tt class="descname">NGHTTP2_PROTO_VERSION_ID_LEN</tt><a class="headerlink" href="#c.NGHTTP2_PROTO_VERSION_ID_LEN" title="Permalink to this definition"></a></dt>
<dd><p>The length of <a class="reference internal" href="#c.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="c.NGHTTP2_PROTO_ALPN">
<tt class="descname">NGHTTP2_PROTO_ALPN</tt><a class="headerlink" href="#c.NGHTTP2_PROTO_ALPN" title="Permalink to this definition"></a></dt>
<dd><p>The seriazlied form of ALPN protocol identifier this library
supports. Notice that first byte is the length of following
protocol identifier. This is the same wire format of <a class="reference external" href="https://tools.ietf.org/html/rfc7301">TLS ALPN
extension</a>. This is useful
to process incoming ALPN tokens in wire format.</p>
</dd></dl>
<dl class="macro">
<dt id="c.NGHTTP2_PROTO_ALPN_LEN">
<tt class="descname">NGHTTP2_PROTO_ALPN_LEN</tt><a class="headerlink" href="#c.NGHTTP2_PROTO_ALPN_LEN" title="Permalink to this definition"></a></dt>
<dd><p>The length of <a class="reference internal" href="#c.NGHTTP2_PROTO_ALPN" title="NGHTTP2_PROTO_ALPN"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_PROTO_ALPN</span></tt></a>.</p>
</dd></dl>
<dl class="macro">
<dt id="c.NGHTTP2_CLEARTEXT_PROTO_VERSION_ID">
<tt class="descname">NGHTTP2_CLEARTEXT_PROTO_VERSION_ID</tt><a class="headerlink" href="#c.NGHTTP2_CLEARTEXT_PROTO_VERSION_ID" title="Permalink to this definition"></a></dt>
<dd><p>The protocol version identification string of this library
supports. This identifier is used if HTTP/2 is used over cleartext
TCP.</p>
</dd></dl>
<dl class="macro">
<dt id="c.NGHTTP2_CLEARTEXT_PROTO_VERSION_ID_LEN">
<tt class="descname">NGHTTP2_CLEARTEXT_PROTO_VERSION_ID_LEN</tt><a class="headerlink" href="#c.NGHTTP2_CLEARTEXT_PROTO_VERSION_ID_LEN" title="Permalink to this definition"></a></dt>
<dd><p>The length of <a class="reference internal" href="#c.NGHTTP2_CLEARTEXT_PROTO_VERSION_ID" title="NGHTTP2_CLEARTEXT_PROTO_VERSION_ID"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_CLEARTEXT_PROTO_VERSION_ID</span></tt></a>.</p>
</dd></dl>
<dl class="macro">
<dt id="c.NGHTTP2_VERSION_AGE">
<tt class="descname">NGHTTP2_VERSION_AGE</tt><a class="headerlink" href="#c.NGHTTP2_VERSION_AGE" title="Permalink to this definition"></a></dt>
<dd><p>The age of <a class="reference internal" href="#c.nghttp2_info" title="nghttp2_info"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_info</span></tt></a></p>
</dd></dl>
<dl class="macro">
<dt id="c.NGHTTP2_DEFAULT_WEIGHT">
<tt class="descname">NGHTTP2_DEFAULT_WEIGHT</tt><a class="headerlink" href="#c.NGHTTP2_DEFAULT_WEIGHT" title="Permalink to this definition"></a></dt>
<dd><p>The default weight of stream dependency.</p>
</dd></dl>
<dl class="macro">
<dt id="c.NGHTTP2_MAX_WEIGHT">
<tt class="descname">NGHTTP2_MAX_WEIGHT</tt><a class="headerlink" href="#c.NGHTTP2_MAX_WEIGHT" title="Permalink to this definition"></a></dt>
<dd><p>The maximum weight of stream dependency.</p>
</dd></dl>
<dl class="macro">
<dt id="c.NGHTTP2_MIN_WEIGHT">
<tt class="descname">NGHTTP2_MIN_WEIGHT</tt><a class="headerlink" href="#c.NGHTTP2_MIN_WEIGHT" title="Permalink to this definition"></a></dt>
<dd><p>The minimum weight of stream dependency.</p>
</dd></dl>
<dl class="macro">
<dt id="c.NGHTTP2_MAX_WINDOW_SIZE">
<tt class="descname">NGHTTP2_MAX_WINDOW_SIZE</tt><a class="headerlink" href="#c.NGHTTP2_MAX_WINDOW_SIZE" title="Permalink to this definition"></a></dt>
<dd><p>The maximum window size</p>
</dd></dl>
<dl class="macro">
<dt id="c.NGHTTP2_INITIAL_WINDOW_SIZE">
<tt class="descname">NGHTTP2_INITIAL_WINDOW_SIZE</tt><a class="headerlink" href="#c.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="c.NGHTTP2_INITIAL_CONNECTION_WINDOW_SIZE">
<tt class="descname">NGHTTP2_INITIAL_CONNECTION_WINDOW_SIZE</tt><a class="headerlink" href="#c.NGHTTP2_INITIAL_CONNECTION_WINDOW_SIZE" title="Permalink to this definition"></a></dt>
<dd><p>The initial window size for connection level flow control.</p>
</dd></dl>
<dl class="macro">
<dt id="c.NGHTTP2_DEFAULT_HEADER_TABLE_SIZE">
<tt class="descname">NGHTTP2_DEFAULT_HEADER_TABLE_SIZE</tt><a class="headerlink" href="#c.NGHTTP2_DEFAULT_HEADER_TABLE_SIZE" title="Permalink to this definition"></a></dt>
<dd><p>The default header table size.</p>
</dd></dl>
<dl class="macro">
<dt id="c.NGHTTP2_CLIENT_CONNECTION_PREFACE">
<tt class="descname">NGHTTP2_CLIENT_CONNECTION_PREFACE</tt><a class="headerlink" href="#c.NGHTTP2_CLIENT_CONNECTION_PREFACE" title="Permalink to this definition"></a></dt>
<dd><p>The client connection preface.</p>
</dd></dl>
<dl class="macro">
<dt id="c.NGHTTP2_CLIENT_CONNECTION_PREFACE_LEN">
<tt class="descname">NGHTTP2_CLIENT_CONNECTION_PREFACE_LEN</tt><a class="headerlink" href="#c.NGHTTP2_CLIENT_CONNECTION_PREFACE_LEN" title="Permalink to this definition"></a></dt>
<dd><p>The length of <a class="reference internal" href="#c.NGHTTP2_CLIENT_CONNECTION_PREFACE" title="NGHTTP2_CLIENT_CONNECTION_PREFACE"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_CLIENT_CONNECTION_PREFACE</span></tt></a>.</p>
</dd></dl>
<dl class="macro">
<dt id="c.NGHTTP2_CLIENT_CONNECTION_HEADER">
<tt class="descname">NGHTTP2_CLIENT_CONNECTION_HEADER</tt><a class="headerlink" href="#c.NGHTTP2_CLIENT_CONNECTION_HEADER" title="Permalink to this definition"></a></dt>
<dd><p>The client connection header. This macro is obsoleted by
NGHTTP2_CLIENT_CONNECTION_PREFACE.</p>
</dd></dl>
<dl class="macro">
<dt id="c.NGHTTP2_CLIENT_CONNECTION_HEADER_LEN">
<tt class="descname">NGHTTP2_CLIENT_CONNECTION_HEADER_LEN</tt><a class="headerlink" href="#c.NGHTTP2_CLIENT_CONNECTION_HEADER_LEN" title="Permalink to this definition"></a></dt>
<dd><p>The length of <a class="reference internal" href="#c.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>
</dd></dl>
<dl class="macro">
<dt id="c.NGHTTP2_INITIAL_MAX_CONCURRENT_STREAMS">
<tt class="descname">NGHTTP2_INITIAL_MAX_CONCURRENT_STREAMS</tt><a class="headerlink" href="#c.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="c.nghttp2_error">
<tt class="descname">nghttp2_error</tt><a class="headerlink" href="#c.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="c.NGHTTP2_ERR_INVALID_ARGUMENT">
<tt class="descname">NGHTTP2_ERR_INVALID_ARGUMENT</tt><a class="headerlink" href="#c.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="c.NGHTTP2_ERR_BUFFER_ERROR">
<tt class="descname">NGHTTP2_ERR_BUFFER_ERROR</tt><a class="headerlink" href="#c.NGHTTP2_ERR_BUFFER_ERROR" title="Permalink to this definition"></a></dt>
<dd><p>(<tt class="docutils literal"><span class="pre">-502</span></tt>)
Out of buffer space.</p>
</dd></dl>
<dl class="macro">
<dt id="c.NGHTTP2_ERR_UNSUPPORTED_VERSION">
<tt class="descname">NGHTTP2_ERR_UNSUPPORTED_VERSION</tt><a class="headerlink" href="#c.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="c.NGHTTP2_ERR_WOULDBLOCK">
<tt class="descname">NGHTTP2_ERR_WOULDBLOCK</tt><a class="headerlink" href="#c.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="#c.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="#c.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="c.NGHTTP2_ERR_PROTO">
<tt class="descname">NGHTTP2_ERR_PROTO</tt><a class="headerlink" href="#c.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="c.NGHTTP2_ERR_INVALID_FRAME">
<tt class="descname">NGHTTP2_ERR_INVALID_FRAME</tt><a class="headerlink" href="#c.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="c.NGHTTP2_ERR_EOF">
<tt class="descname">NGHTTP2_ERR_EOF</tt><a class="headerlink" href="#c.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="c.NGHTTP2_ERR_DEFERRED">
<tt class="descname">NGHTTP2_ERR_DEFERRED</tt><a class="headerlink" href="#c.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="#c.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="#c.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="c.NGHTTP2_ERR_STREAM_ID_NOT_AVAILABLE">
<tt class="descname">NGHTTP2_ERR_STREAM_ID_NOT_AVAILABLE</tt><a class="headerlink" href="#c.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="c.NGHTTP2_ERR_STREAM_CLOSED">
<tt class="descname">NGHTTP2_ERR_STREAM_CLOSED</tt><a class="headerlink" href="#c.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="c.NGHTTP2_ERR_STREAM_CLOSING">
<tt class="descname">NGHTTP2_ERR_STREAM_CLOSING</tt><a class="headerlink" href="#c.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="c.NGHTTP2_ERR_STREAM_SHUT_WR">
<tt class="descname">NGHTTP2_ERR_STREAM_SHUT_WR</tt><a class="headerlink" href="#c.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="c.NGHTTP2_ERR_INVALID_STREAM_ID">
<tt class="descname">NGHTTP2_ERR_INVALID_STREAM_ID</tt><a class="headerlink" href="#c.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="c.NGHTTP2_ERR_INVALID_STREAM_STATE">
<tt class="descname">NGHTTP2_ERR_INVALID_STREAM_STATE</tt><a class="headerlink" href="#c.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="c.NGHTTP2_ERR_DEFERRED_DATA_EXIST">
<tt class="descname">NGHTTP2_ERR_DEFERRED_DATA_EXIST</tt><a class="headerlink" href="#c.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="c.NGHTTP2_ERR_START_STREAM_NOT_ALLOWED">
<tt class="descname">NGHTTP2_ERR_START_STREAM_NOT_ALLOWED</tt><a class="headerlink" href="#c.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="c.NGHTTP2_ERR_GOAWAY_ALREADY_SENT">
<tt class="descname">NGHTTP2_ERR_GOAWAY_ALREADY_SENT</tt><a class="headerlink" href="#c.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="c.NGHTTP2_ERR_INVALID_HEADER_BLOCK">
<tt class="descname">NGHTTP2_ERR_INVALID_HEADER_BLOCK</tt><a class="headerlink" href="#c.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="c.NGHTTP2_ERR_INVALID_STATE">
<tt class="descname">NGHTTP2_ERR_INVALID_STATE</tt><a class="headerlink" href="#c.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="c.NGHTTP2_ERR_TEMPORAL_CALLBACK_FAILURE">
<tt class="descname">NGHTTP2_ERR_TEMPORAL_CALLBACK_FAILURE</tt><a class="headerlink" href="#c.NGHTTP2_ERR_TEMPORAL_CALLBACK_FAILURE" title="Permalink to this definition"></a></dt>
<dd><p>(<tt class="docutils literal"><span class="pre">-521</span></tt>)
The user callback function failed due to the temporal error.</p>
</dd></dl>
<dl class="macro">
<dt id="c.NGHTTP2_ERR_FRAME_SIZE_ERROR">
<tt class="descname">NGHTTP2_ERR_FRAME_SIZE_ERROR</tt><a class="headerlink" href="#c.NGHTTP2_ERR_FRAME_SIZE_ERROR" title="Permalink to this definition"></a></dt>
<dd><p>(<tt class="docutils literal"><span class="pre">-522</span></tt>)
The length of the frame is invalid, either too large or too small.</p>
</dd></dl>
<dl class="macro">
<dt id="c.NGHTTP2_ERR_HEADER_COMP">
<tt class="descname">NGHTTP2_ERR_HEADER_COMP</tt><a class="headerlink" href="#c.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>
<dl class="macro">
<dt id="c.NGHTTP2_ERR_FLOW_CONTROL">
<tt class="descname">NGHTTP2_ERR_FLOW_CONTROL</tt><a class="headerlink" href="#c.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>
<dl class="macro">
<dt id="c.NGHTTP2_ERR_INSUFF_BUFSIZE">
<tt class="descname">NGHTTP2_ERR_INSUFF_BUFSIZE</tt><a class="headerlink" href="#c.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>
<dl class="macro">
<dt id="c.NGHTTP2_ERR_PAUSE">
<tt class="descname">NGHTTP2_ERR_PAUSE</tt><a class="headerlink" href="#c.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>
<dl class="macro">
<dt id="c.NGHTTP2_ERR_TOO_MANY_INFLIGHT_SETTINGS">
<tt class="descname">NGHTTP2_ERR_TOO_MANY_INFLIGHT_SETTINGS</tt><a class="headerlink" href="#c.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>
<dl class="macro">
<dt id="c.NGHTTP2_ERR_PUSH_DISABLED">
<tt class="descname">NGHTTP2_ERR_PUSH_DISABLED</tt><a class="headerlink" href="#c.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>
<dl class="macro">
<dt id="c.NGHTTP2_ERR_DATA_EXIST">
<tt class="descname">NGHTTP2_ERR_DATA_EXIST</tt><a class="headerlink" href="#c.NGHTTP2_ERR_DATA_EXIST" title="Permalink to this definition"></a></dt>
<dd><p>(<tt class="docutils literal"><span class="pre">-529</span></tt>)
DATA frame for a given stream has been already submitted and has
not been fully processed yet.</p>
</dd></dl>
<dl class="macro">
<dt id="c.NGHTTP2_ERR_SESSION_CLOSING">
<tt class="descname">NGHTTP2_ERR_SESSION_CLOSING</tt><a class="headerlink" href="#c.NGHTTP2_ERR_SESSION_CLOSING" title="Permalink to this definition"></a></dt>
<dd><p>(<tt class="docutils literal"><span class="pre">-530</span></tt>)
The current session is closing due to a connection error or
<a class="reference internal" href="#c.nghttp2_session_terminate_session" title="nghttp2_session_terminate_session"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_terminate_session()</span></tt></a> is called.</p>
</dd></dl>
<dl class="macro">
<dt id="c.NGHTTP2_ERR_HTTP_HEADER">
<tt class="descname">NGHTTP2_ERR_HTTP_HEADER</tt><a class="headerlink" href="#c.NGHTTP2_ERR_HTTP_HEADER" title="Permalink to this definition"></a></dt>
<dd><p>(<tt class="docutils literal"><span class="pre">-531</span></tt>)
Invalid HTTP header field was received and stream is going to be
closed.</p>
</dd></dl>
<dl class="macro">
<dt id="c.NGHTTP2_ERR_FATAL">
<tt class="descname">NGHTTP2_ERR_FATAL</tt><a class="headerlink" href="#c.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="#c.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 processing was terminated (e.g.,
out of memory). If application receives this error code, it must
stop using that <a class="reference internal" href="#c.nghttp2_session" title="nghttp2_session"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_session</span></tt></a> object and only allowed
operation for that object is deallocate it using
<a class="reference internal" href="#c.nghttp2_session_del" title="nghttp2_session_del"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_del()</span></tt></a>.</p>
</dd></dl>
<dl class="macro">
<dt id="c.NGHTTP2_ERR_NOMEM">
<tt class="descname">NGHTTP2_ERR_NOMEM</tt><a class="headerlink" href="#c.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="c.NGHTTP2_ERR_CALLBACK_FAILURE">
<tt class="descname">NGHTTP2_ERR_CALLBACK_FAILURE</tt><a class="headerlink" href="#c.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>
<dl class="macro">
<dt id="c.NGHTTP2_ERR_BAD_PREFACE">
<tt class="descname">NGHTTP2_ERR_BAD_PREFACE</tt><a class="headerlink" href="#c.NGHTTP2_ERR_BAD_PREFACE" title="Permalink to this definition"></a></dt>
<dd><p>(<tt class="docutils literal"><span class="pre">-903</span></tt>)
Invalid connection preface was received and further processing is
not possible.</p>
</dd></dl>
</dd></dl>
<dl class="type">
<dt id="c.nghttp2_nv_flag">
<tt class="descname">nghttp2_nv_flag</tt><a class="headerlink" href="#c.nghttp2_nv_flag" title="Permalink to this definition"></a></dt>
<dd><p>The flags for header field name/value pair.</p>
<dl class="macro">
<dt id="c.NGHTTP2_NV_FLAG_NONE">
<tt class="descname">NGHTTP2_NV_FLAG_NONE</tt><a class="headerlink" href="#c.NGHTTP2_NV_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="c.NGHTTP2_NV_FLAG_NO_INDEX">
<tt class="descname">NGHTTP2_NV_FLAG_NO_INDEX</tt><a class="headerlink" href="#c.NGHTTP2_NV_FLAG_NO_INDEX" title="Permalink to this definition"></a></dt>
<dd><p>(<tt class="docutils literal"><span class="pre">0x01</span></tt>)
Indicates that this name/value pair must not be indexed (&quot;Literal
Header Field never Indexed&quot; representation must be used in HPACK
encoding). Other implementation calls this bit as &quot;sensitive&quot;.</p>
</dd></dl>
</dd></dl>
<dl class="type">
<dt id="c.nghttp2_frame_type">
<tt class="descname">nghttp2_frame_type</tt><a class="headerlink" href="#c.nghttp2_frame_type" title="Permalink to this definition"></a></dt>
<dd><p>The frame types in HTTP/2 specification.</p>
<dl class="macro">
<dt id="c.NGHTTP2_DATA">
<tt class="descname">NGHTTP2_DATA</tt><a class="headerlink" href="#c.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="c.NGHTTP2_HEADERS">
<tt class="descname">NGHTTP2_HEADERS</tt><a class="headerlink" href="#c.NGHTTP2_HEADERS" title="Permalink to this definition"></a></dt>
<dd><p>(<tt class="docutils literal"><span class="pre">0x01</span></tt>)
The HEADERS frame.</p>
</dd></dl>
<dl class="macro">
<dt id="c.NGHTTP2_PRIORITY">
<tt class="descname">NGHTTP2_PRIORITY</tt><a class="headerlink" href="#c.NGHTTP2_PRIORITY" title="Permalink to this definition"></a></dt>
<dd><p>(<tt class="docutils literal"><span class="pre">0x02</span></tt>)
The PRIORITY frame.</p>
</dd></dl>
<dl class="macro">
<dt id="c.NGHTTP2_RST_STREAM">
<tt class="descname">NGHTTP2_RST_STREAM</tt><a class="headerlink" href="#c.NGHTTP2_RST_STREAM" title="Permalink to this definition"></a></dt>
<dd><p>(<tt class="docutils literal"><span class="pre">0x03</span></tt>)
The RST_STREAM frame.</p>
</dd></dl>
<dl class="macro">
<dt id="c.NGHTTP2_SETTINGS">
<tt class="descname">NGHTTP2_SETTINGS</tt><a class="headerlink" href="#c.NGHTTP2_SETTINGS" title="Permalink to this definition"></a></dt>
<dd><p>(<tt class="docutils literal"><span class="pre">0x04</span></tt>)
The SETTINGS frame.</p>
</dd></dl>
<dl class="macro">
<dt id="c.NGHTTP2_PUSH_PROMISE">
<tt class="descname">NGHTTP2_PUSH_PROMISE</tt><a class="headerlink" href="#c.NGHTTP2_PUSH_PROMISE" title="Permalink to this definition"></a></dt>
<dd><p>(<tt class="docutils literal"><span class="pre">0x05</span></tt>)
The PUSH_PROMISE frame.</p>
</dd></dl>
<dl class="macro">
<dt id="c.NGHTTP2_PING">
<tt class="descname">NGHTTP2_PING</tt><a class="headerlink" href="#c.NGHTTP2_PING" title="Permalink to this definition"></a></dt>
<dd><p>(<tt class="docutils literal"><span class="pre">0x06</span></tt>)
The PING frame.</p>
</dd></dl>
<dl class="macro">
<dt id="c.NGHTTP2_GOAWAY">
<tt class="descname">NGHTTP2_GOAWAY</tt><a class="headerlink" href="#c.NGHTTP2_GOAWAY" title="Permalink to this definition"></a></dt>
<dd><p>(<tt class="docutils literal"><span class="pre">0x07</span></tt>)
The GOAWAY frame.</p>
</dd></dl>
<dl class="macro">
<dt id="c.NGHTTP2_WINDOW_UPDATE">
<tt class="descname">NGHTTP2_WINDOW_UPDATE</tt><a class="headerlink" href="#c.NGHTTP2_WINDOW_UPDATE" title="Permalink to this definition"></a></dt>
<dd><p>(<tt class="docutils literal"><span class="pre">0x08</span></tt>)
The WINDOW_UPDATE frame.</p>
</dd></dl>
<dl class="macro">
<dt id="c.NGHTTP2_CONTINUATION">
<tt class="descname">NGHTTP2_CONTINUATION</tt><a class="headerlink" href="#c.NGHTTP2_CONTINUATION" title="Permalink to this definition"></a></dt>
<dd><p>(<tt class="docutils literal"><span class="pre">0x09</span></tt>)
The CONTINUATION frame. This frame type won't be passed to any
callbacks because the library processes this frame type and its
preceding HEADERS/PUSH_PROMISE as a single frame.</p>
</dd></dl>
</dd></dl>
<dl class="type">
<dt id="c.nghttp2_ext_frame_type">
<tt class="descname">nghttp2_ext_frame_type</tt><a class="headerlink" href="#c.nghttp2_ext_frame_type" title="Permalink to this definition"></a></dt>
<dd><p>The extension frame types.</p>
<p>TODO: The assigned frame types were carried from draft-12, and now
actually TBD.</p>
<dl class="macro">
<dt id="c.NGHTTP2_EXT_ALTSVC">
<tt class="descname">NGHTTP2_EXT_ALTSVC</tt><a class="headerlink" href="#c.NGHTTP2_EXT_ALTSVC" title="Permalink to this definition"></a></dt>
<dd><p>(<tt class="docutils literal"><span class="pre">0x0a</span></tt>)
The ALTSVC extension frame.</p>
</dd></dl>
</dd></dl>
<dl class="type">
<dt id="c.nghttp2_flag">
<tt class="descname">nghttp2_flag</tt><a class="headerlink" href="#c.nghttp2_flag" title="Permalink to this definition"></a></dt>
<dd><p>The flags for HTTP/2 frames. This enum defines all flags for all
frames.</p>
<dl class="macro">
<dt id="c.NGHTTP2_FLAG_NONE">
<tt class="descname">NGHTTP2_FLAG_NONE</tt><a class="headerlink" href="#c.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="c.NGHTTP2_FLAG_END_STREAM">
<tt class="descname">NGHTTP2_FLAG_END_STREAM</tt><a class="headerlink" href="#c.NGHTTP2_FLAG_END_STREAM" title="Permalink to this definition"></a></dt>
<dd><p>(<tt class="docutils literal"><span class="pre">0x01</span></tt>)
The END_STREAM flag.</p>
</dd></dl>
<dl class="macro">
<dt id="c.NGHTTP2_FLAG_END_HEADERS">
<tt class="descname">NGHTTP2_FLAG_END_HEADERS</tt><a class="headerlink" href="#c.NGHTTP2_FLAG_END_HEADERS" title="Permalink to this definition"></a></dt>
<dd><p>(<tt class="docutils literal"><span class="pre">0x04</span></tt>)
The END_HEADERS flag.</p>
</dd></dl>
<dl class="macro">
<dt id="c.NGHTTP2_FLAG_ACK">
<tt class="descname">NGHTTP2_FLAG_ACK</tt><a class="headerlink" href="#c.NGHTTP2_FLAG_ACK" title="Permalink to this definition"></a></dt>
<dd><p>(<tt class="docutils literal"><span class="pre">0x01</span></tt>)
The ACK flag.</p>
</dd></dl>
<dl class="macro">
<dt id="c.NGHTTP2_FLAG_PADDED">
<tt class="descname">NGHTTP2_FLAG_PADDED</tt><a class="headerlink" href="#c.NGHTTP2_FLAG_PADDED" title="Permalink to this definition"></a></dt>
<dd><p>(<tt class="docutils literal"><span class="pre">0x08</span></tt>)
The PADDED flag.</p>
</dd></dl>
<dl class="macro">
<dt id="c.NGHTTP2_FLAG_PRIORITY">
<tt class="descname">NGHTTP2_FLAG_PRIORITY</tt><a class="headerlink" href="#c.NGHTTP2_FLAG_PRIORITY" title="Permalink to this definition"></a></dt>
<dd><p>(<tt class="docutils literal"><span class="pre">0x20</span></tt>)
The PRIORITY flag.</p>
</dd></dl>
</dd></dl>
<dl class="type">
<dt id="c.nghttp2_settings_id">
<tt class="descname">nghttp2_settings_id</tt><a class="headerlink" href="#c.nghttp2_settings_id" title="Permalink to this definition"></a></dt>
<dd><p>The SETTINGS ID.</p>
<dl class="macro">
<dt id="c.NGHTTP2_SETTINGS_HEADER_TABLE_SIZE">
<tt class="descname">NGHTTP2_SETTINGS_HEADER_TABLE_SIZE</tt><a class="headerlink" href="#c.NGHTTP2_SETTINGS_HEADER_TABLE_SIZE" title="Permalink to this definition"></a></dt>
<dd><p>(<tt class="docutils literal"><span class="pre">0x01</span></tt>)
SETTINGS_HEADER_TABLE_SIZE</p>
</dd></dl>
<dl class="macro">
<dt id="c.NGHTTP2_SETTINGS_ENABLE_PUSH">
<tt class="descname">NGHTTP2_SETTINGS_ENABLE_PUSH</tt><a class="headerlink" href="#c.NGHTTP2_SETTINGS_ENABLE_PUSH" title="Permalink to this definition"></a></dt>
<dd><p>(<tt class="docutils literal"><span class="pre">0x02</span></tt>)
SETTINGS_ENABLE_PUSH</p>
</dd></dl>
<dl class="macro">
<dt id="c.NGHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS">
<tt class="descname">NGHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS</tt><a class="headerlink" href="#c.NGHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS" title="Permalink to this definition"></a></dt>
<dd><p>(<tt class="docutils literal"><span class="pre">0x03</span></tt>)
SETTINGS_MAX_CONCURRENT_STREAMS</p>
</dd></dl>
<dl class="macro">
<dt id="c.NGHTTP2_SETTINGS_INITIAL_WINDOW_SIZE">
<tt class="descname">NGHTTP2_SETTINGS_INITIAL_WINDOW_SIZE</tt><a class="headerlink" href="#c.NGHTTP2_SETTINGS_INITIAL_WINDOW_SIZE" title="Permalink to this definition"></a></dt>
<dd><p>(<tt class="docutils literal"><span class="pre">0x04</span></tt>)
SETTINGS_INITIAL_WINDOW_SIZE</p>
</dd></dl>
<dl class="macro">
<dt id="c.NGHTTP2_SETTINGS_MAX_FRAME_SIZE">
<tt class="descname">NGHTTP2_SETTINGS_MAX_FRAME_SIZE</tt><a class="headerlink" href="#c.NGHTTP2_SETTINGS_MAX_FRAME_SIZE" title="Permalink to this definition"></a></dt>
<dd><p>(<tt class="docutils literal"><span class="pre">0x05</span></tt>)
SETTINGS_MAX_FRAME_SIZE</p>
</dd></dl>
<dl class="macro">
<dt id="c.NGHTTP2_SETTINGS_MAX_HEADER_LIST_SIZE">
<tt class="descname">NGHTTP2_SETTINGS_MAX_HEADER_LIST_SIZE</tt><a class="headerlink" href="#c.NGHTTP2_SETTINGS_MAX_HEADER_LIST_SIZE" title="Permalink to this definition"></a></dt>
<dd><p>(<tt class="docutils literal"><span class="pre">0x06</span></tt>)
SETTINGS_MAX_HEADER_LIST_SIZE</p>
</dd></dl>
</dd></dl>
<dl class="type">
<dt id="c.nghttp2_error_code">
<tt class="descname">nghttp2_error_code</tt><a class="headerlink" href="#c.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="c.NGHTTP2_NO_ERROR">
<tt class="descname">NGHTTP2_NO_ERROR</tt><a class="headerlink" href="#c.NGHTTP2_NO_ERROR" title="Permalink to this definition"></a></dt>
<dd><p>(<tt class="docutils literal"><span class="pre">0x00</span></tt>)
No errors.</p>
</dd></dl>
<dl class="macro">
<dt id="c.NGHTTP2_PROTOCOL_ERROR">
<tt class="descname">NGHTTP2_PROTOCOL_ERROR</tt><a class="headerlink" href="#c.NGHTTP2_PROTOCOL_ERROR" title="Permalink to this definition"></a></dt>
<dd><p>(<tt class="docutils literal"><span class="pre">0x01</span></tt>)
PROTOCOL_ERROR</p>
</dd></dl>
<dl class="macro">
<dt id="c.NGHTTP2_INTERNAL_ERROR">
<tt class="descname">NGHTTP2_INTERNAL_ERROR</tt><a class="headerlink" href="#c.NGHTTP2_INTERNAL_ERROR" title="Permalink to this definition"></a></dt>
<dd><p>(<tt class="docutils literal"><span class="pre">0x02</span></tt>)
INTERNAL_ERROR</p>
</dd></dl>
<dl class="macro">
<dt id="c.NGHTTP2_FLOW_CONTROL_ERROR">
<tt class="descname">NGHTTP2_FLOW_CONTROL_ERROR</tt><a class="headerlink" href="#c.NGHTTP2_FLOW_CONTROL_ERROR" title="Permalink to this definition"></a></dt>
<dd><p>(<tt class="docutils literal"><span class="pre">0x03</span></tt>)
FLOW_CONTROL_ERROR</p>
</dd></dl>
<dl class="macro">
<dt id="c.NGHTTP2_SETTINGS_TIMEOUT">
<tt class="descname">NGHTTP2_SETTINGS_TIMEOUT</tt><a class="headerlink" href="#c.NGHTTP2_SETTINGS_TIMEOUT" title="Permalink to this definition"></a></dt>
<dd><p>(<tt class="docutils literal"><span class="pre">0x04</span></tt>)
SETTINGS_TIMEOUT</p>
</dd></dl>
<dl class="macro">
<dt id="c.NGHTTP2_STREAM_CLOSED">
<tt class="descname">NGHTTP2_STREAM_CLOSED</tt><a class="headerlink" href="#c.NGHTTP2_STREAM_CLOSED" title="Permalink to this definition"></a></dt>
<dd><p>(<tt class="docutils literal"><span class="pre">0x05</span></tt>)
STREAM_CLOSED</p>
</dd></dl>
<dl class="macro">
<dt id="c.NGHTTP2_FRAME_SIZE_ERROR">
<tt class="descname">NGHTTP2_FRAME_SIZE_ERROR</tt><a class="headerlink" href="#c.NGHTTP2_FRAME_SIZE_ERROR" title="Permalink to this definition"></a></dt>
<dd><p>(<tt class="docutils literal"><span class="pre">0x06</span></tt>)
FRAME_SIZE_ERROR</p>
</dd></dl>
<dl class="macro">
<dt id="c.NGHTTP2_REFUSED_STREAM">
<tt class="descname">NGHTTP2_REFUSED_STREAM</tt><a class="headerlink" href="#c.NGHTTP2_REFUSED_STREAM" title="Permalink to this definition"></a></dt>
<dd><p>(<tt class="docutils literal"><span class="pre">0x07</span></tt>)
REFUSED_STREAM</p>
</dd></dl>
<dl class="macro">
<dt id="c.NGHTTP2_CANCEL">
<tt class="descname">NGHTTP2_CANCEL</tt><a class="headerlink" href="#c.NGHTTP2_CANCEL" title="Permalink to this definition"></a></dt>
<dd><p>(<tt class="docutils literal"><span class="pre">0x08</span></tt>)
CANCEL</p>
</dd></dl>
<dl class="macro">
<dt id="c.NGHTTP2_COMPRESSION_ERROR">
<tt class="descname">NGHTTP2_COMPRESSION_ERROR</tt><a class="headerlink" href="#c.NGHTTP2_COMPRESSION_ERROR" title="Permalink to this definition"></a></dt>
<dd><p>(<tt class="docutils literal"><span class="pre">0x09</span></tt>)
COMPRESSION_ERROR</p>
</dd></dl>
<dl class="macro">
<dt id="c.NGHTTP2_CONNECT_ERROR">
<tt class="descname">NGHTTP2_CONNECT_ERROR</tt><a class="headerlink" href="#c.NGHTTP2_CONNECT_ERROR" title="Permalink to this definition"></a></dt>
<dd><p>(<tt class="docutils literal"><span class="pre">0x0a</span></tt>)
CONNECT_ERROR</p>
</dd></dl>
<dl class="macro">
<dt id="c.NGHTTP2_ENHANCE_YOUR_CALM">
<tt class="descname">NGHTTP2_ENHANCE_YOUR_CALM</tt><a class="headerlink" href="#c.NGHTTP2_ENHANCE_YOUR_CALM" title="Permalink to this definition"></a></dt>
<dd><p>(<tt class="docutils literal"><span class="pre">0x0b</span></tt>)
ENHANCE_YOUR_CALM</p>
</dd></dl>
<dl class="macro">
<dt id="c.NGHTTP2_INADEQUATE_SECURITY">
<tt class="descname">NGHTTP2_INADEQUATE_SECURITY</tt><a class="headerlink" href="#c.NGHTTP2_INADEQUATE_SECURITY" title="Permalink to this definition"></a></dt>
<dd><p>(<tt class="docutils literal"><span class="pre">0x0c</span></tt>)
INADEQUATE_SECURITY</p>
</dd></dl>
<dl class="macro">
<dt id="c.NGHTTP2_HTTP_1_1_REQUIRED">
<tt class="descname">NGHTTP2_HTTP_1_1_REQUIRED</tt><a class="headerlink" href="#c.NGHTTP2_HTTP_1_1_REQUIRED" title="Permalink to this definition"></a></dt>
<dd><p>(<tt class="docutils literal"><span class="pre">0x0d</span></tt>)
HTTP_1_1_REQUIRED</p>
</dd></dl>
</dd></dl>
<dl class="type">
<dt id="c.nghttp2_data_flag">
<tt class="descname">nghttp2_data_flag</tt><a class="headerlink" href="#c.nghttp2_data_flag" title="Permalink to this definition"></a></dt>
<dd><p>The flags used to set in <em>data_flags</em> output parameter in
<a class="reference internal" href="#c.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="macro">
<dt id="c.NGHTTP2_DATA_FLAG_NONE">
<tt class="descname">NGHTTP2_DATA_FLAG_NONE</tt><a class="headerlink" href="#c.NGHTTP2_DATA_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="c.NGHTTP2_DATA_FLAG_EOF">
<tt class="descname">NGHTTP2_DATA_FLAG_EOF</tt><a class="headerlink" href="#c.NGHTTP2_DATA_FLAG_EOF" title="Permalink to this definition"></a></dt>
<dd><p>(<tt class="docutils literal"><span class="pre">0x01</span></tt>)
Indicates EOF was sensed.</p>
</dd></dl>
<dl class="macro">
<dt id="c.NGHTTP2_DATA_FLAG_NO_END_STREAM">
<tt class="descname">NGHTTP2_DATA_FLAG_NO_END_STREAM</tt><a class="headerlink" href="#c.NGHTTP2_DATA_FLAG_NO_END_STREAM" title="Permalink to this definition"></a></dt>
<dd><p>(<tt class="docutils literal"><span class="pre">0x02</span></tt>)
Indicates that END_STREAM flag must not be set even if
NGHTTP2_DATA_FLAG_EOF is set. Usually this flag is used to send
trailer header fields with <a class="reference internal" href="#c.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="#c.nghttp2_submit_response" title="nghttp2_submit_response"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_submit_response()</span></tt></a>.</p>
</dd></dl>
</dd></dl>
<dl class="type">
<dt id="c.nghttp2_headers_category">
<tt class="descname">nghttp2_headers_category</tt><a class="headerlink" href="#c.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 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="c.NGHTTP2_HCAT_REQUEST">
<tt class="descname">NGHTTP2_HCAT_REQUEST</tt><a class="headerlink" href="#c.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="c.NGHTTP2_HCAT_RESPONSE">
<tt class="descname">NGHTTP2_HCAT_RESPONSE</tt><a class="headerlink" href="#c.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="c.NGHTTP2_HCAT_PUSH_RESPONSE">
<tt class="descname">NGHTTP2_HCAT_PUSH_RESPONSE</tt><a class="headerlink" href="#c.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="c.NGHTTP2_HCAT_HEADERS">
<tt class="descname">NGHTTP2_HCAT_HEADERS</tt><a class="headerlink" href="#c.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. If non-final response
(e.g., status 1xx) is used, final response HEADERS frame will be
categorized here.</p>
</dd></dl>
</dd></dl>
<dl class="type">
<dt id="c.nghttp2_hd_inflate_flag">
<tt class="descname">nghttp2_hd_inflate_flag</tt><a class="headerlink" href="#c.nghttp2_hd_inflate_flag" title="Permalink to this definition"></a></dt>
<dd><p>The flags for header inflation.</p>
<dl class="macro">
<dt id="c.NGHTTP2_HD_INFLATE_NONE">
<tt class="descname">NGHTTP2_HD_INFLATE_NONE</tt><a class="headerlink" href="#c.NGHTTP2_HD_INFLATE_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="c.NGHTTP2_HD_INFLATE_FINAL">
<tt class="descname">NGHTTP2_HD_INFLATE_FINAL</tt><a class="headerlink" href="#c.NGHTTP2_HD_INFLATE_FINAL" title="Permalink to this definition"></a></dt>
<dd><p>(<tt class="docutils literal"><span class="pre">0x01</span></tt>)
Indicates all headers were inflated.</p>
</dd></dl>
<dl class="macro">
<dt id="c.NGHTTP2_HD_INFLATE_EMIT">
<tt class="descname">NGHTTP2_HD_INFLATE_EMIT</tt><a class="headerlink" href="#c.NGHTTP2_HD_INFLATE_EMIT" title="Permalink to this definition"></a></dt>
<dd><p>(<tt class="docutils literal"><span class="pre">0x02</span></tt>)
Indicates a header was emitted.</p>
</dd></dl>
</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="c.nghttp2_session">
<tt class="descname">nghttp2_session</tt><a class="headerlink" href="#c.nghttp2_session" title="Permalink to this definition"></a></dt>
<dd><p>The primary structure to hold the resources needed for a HTTP/2
session. The details of this structure are intentionally hidden
from the public API.</p>
</dd></dl>
<dl class="type">
<dt id="c.nghttp2_info">
<tt class="descname">nghttp2_info</tt><a class="headerlink" href="#c.nghttp2_info" title="Permalink to this definition"></a></dt>
<dd><p>This struct is what <a class="reference internal" href="#c.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="c.nghttp2_info.age">
int <tt class="descname">age</tt><a class="headerlink" href="#c.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="#c.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="c.nghttp2_info.version_num">
int <tt class="descname">version_num</tt><a class="headerlink" href="#c.nghttp2_info.version_num" title="Permalink to this definition"></a></dt>
<dd><p>the <a class="reference internal" href="#c.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="c.nghttp2_info.version_str">
const char *<tt class="descname">version_str</tt><a class="headerlink" href="#c.nghttp2_info.version_str" title="Permalink to this definition"></a></dt>
<dd><p>points to the <a class="reference internal" href="#c.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="c.nghttp2_info.proto_str">
const char *<tt class="descname">proto_str</tt><a class="headerlink" href="#c.nghttp2_info.proto_str" title="Permalink to this definition"></a></dt>
<dd><p>points to the <a class="reference internal" href="#c.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>
<dl class="type">
<dt id="c.nghttp2_nv">
<tt class="descname">nghttp2_nv</tt><a class="headerlink" href="#c.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="c.nghttp2_nv.name">
uint8_t *<tt class="descname">name</tt><a class="headerlink" href="#c.nghttp2_nv.name" title="Permalink to this definition"></a></dt>
<dd><p>The <em>name</em> byte string, which is not necessarily <tt class="docutils literal"><span class="pre">NULL</span></tt>
terminated.</p>
</dd></dl>
<dl class="member">
<dt id="c.nghttp2_nv.value">
uint8_t *<tt class="descname">value</tt><a class="headerlink" href="#c.nghttp2_nv.value" title="Permalink to this definition"></a></dt>
<dd><p>The <em>value</em> byte string, which is not necessarily <tt class="docutils literal"><span class="pre">NULL</span></tt>
terminated.</p>
</dd></dl>
<dl class="member">
<dt id="c.nghttp2_nv.namelen">
size_t <tt class="descname">namelen</tt><a class="headerlink" href="#c.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="c.nghttp2_nv.valuelen">
size_t <tt class="descname">valuelen</tt><a class="headerlink" href="#c.nghttp2_nv.valuelen" title="Permalink to this definition"></a></dt>
<dd><p>The length of the <em>value</em>.</p>
</dd></dl>
<dl class="member">
<dt id="c.nghttp2_nv.flags">
uint8_t <tt class="descname">flags</tt><a class="headerlink" href="#c.nghttp2_nv.flags" title="Permalink to this definition"></a></dt>
<dd><p>Bitwise OR of one or more of <a class="reference internal" href="#c.nghttp2_nv_flag" title="nghttp2_nv_flag"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_nv_flag</span></tt></a>.</p>
</dd></dl>
</dd></dl>
<dl class="type">
<dt id="c.nghttp2_frame_hd">
<tt class="descname">nghttp2_frame_hd</tt><a class="headerlink" href="#c.nghttp2_frame_hd" title="Permalink to this definition"></a></dt>
<dd><p>The frame header.</p>
<dl class="member">
<dt id="c.nghttp2_frame_hd.length">
size_t <tt class="descname">length</tt><a class="headerlink" href="#c.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="c.nghttp2_frame_hd.stream_id">
int32_t <tt class="descname">stream_id</tt><a class="headerlink" href="#c.nghttp2_frame_hd.stream_id" title="Permalink to this definition"></a></dt>
<dd><p>The stream identifier (aka, stream ID)</p>
</dd></dl>
<dl class="member">
<dt id="c.nghttp2_frame_hd.type">
uint8_t <tt class="descname">type</tt><a class="headerlink" href="#c.nghttp2_frame_hd.type" title="Permalink to this definition"></a></dt>
<dd><p>The type of this frame. See <a class="reference internal" href="#c.nghttp2_frame_type" title="nghttp2_frame_type"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_frame_type()</span></tt></a>.</p>
</dd></dl>
<dl class="member">
<dt id="c.nghttp2_frame_hd.flags">
uint8_t <tt class="descname">flags</tt><a class="headerlink" href="#c.nghttp2_frame_hd.flags" title="Permalink to this definition"></a></dt>
<dd><p>The flags.</p>
</dd></dl>
<dl class="member">
<dt id="c.nghttp2_frame_hd.reserved">
uint8_t <tt class="descname">reserved</tt><a class="headerlink" href="#c.nghttp2_frame_hd.reserved" title="Permalink to this definition"></a></dt>
<dd><p>Reserved bit in frame header. Currently, this is always set to 0
and application should not expect something useful in here.</p>
</dd></dl>
</dd></dl>
<dl class="type">
<dt id="c.nghttp2_data_source">
<tt class="descname">nghttp2_data_source</tt><a class="headerlink" href="#c.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="#c.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="c.nghttp2_data_source.fd">
int <tt class="descname">fd</tt><a class="headerlink" href="#c.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="c.nghttp2_data_source.ptr">
void *<tt class="descname">ptr</tt><a class="headerlink" href="#c.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="c.nghttp2_data_source_read_callback">
typedef ssize_t <tt class="descname">(*nghttp2_data_source_read_callback)</tt><big>(</big><a class="reference internal" href="#c.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>, uint32_t<em>&nbsp;*data_flags</em>, <a class="reference internal" href="#c.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="#c.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 <a class="reference internal" href="#c.NGHTTP2_DATA_FLAG_EOF" title="NGHTTP2_DATA_FLAG_EOF"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_DATA_FLAG_EOF</span></tt></a> flag in <em>*data_flags</em>.</p>
<p>If this callback is set by <a class="reference internal" href="#c.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="#c.nghttp2_submit_response" title="nghttp2_submit_response"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_submit_response()</span></tt></a> or <a class="reference internal" href="#c.nghttp2_submit_headers" title="nghttp2_submit_headers"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_submit_headers()</span></tt></a> and
<a class="reference internal" href="#c.nghttp2_submit_data" title="nghttp2_submit_data"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_submit_data()</span></tt></a> with flag parameter
<a class="reference internal" href="#c.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> set, and
<a class="reference internal" href="#c.NGHTTP2_DATA_FLAG_EOF" title="NGHTTP2_DATA_FLAG_EOF"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_DATA_FLAG_EOF</span></tt></a> flag is set to <em>*data_flags</em>, DATA
frame will have END_STREAM flag set. Usually, this is expected
behaviour and all are fine. One exception is send trailer header
fields. You cannot send trailers after sending frame with
END_STREAM set. To avoid this problem, one can set
<a class="reference internal" href="#c.NGHTTP2_DATA_FLAG_NO_END_STREAM" title="NGHTTP2_DATA_FLAG_NO_END_STREAM"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_DATA_FLAG_NO_END_STREAM</span></tt></a> along with
<a class="reference internal" href="#c.NGHTTP2_DATA_FLAG_EOF" title="NGHTTP2_DATA_FLAG_EOF"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_DATA_FLAG_EOF</span></tt></a> to signal the library not to set
END_STREAM in DATA frame. Then application can use
<a class="reference internal" href="#c.nghttp2_submit_trailer" title="nghttp2_submit_trailer"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_submit_trailer()</span></tt></a> to send trailers.
<a class="reference internal" href="#c.nghttp2_submit_trailer" title="nghttp2_submit_trailer"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_submit_trailer()</span></tt></a> can be called inside this callback.</p>
<p>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="#c.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="#c.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="#c.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="#c.NGHTTP2_INTERNAL_ERROR" title="NGHTTP2_INTERNAL_ERROR"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_INTERNAL_ERROR</span></tt></a>. If a
different error code is desirable, use
<a class="reference internal" href="#c.nghttp2_submit_rst_stream" title="nghttp2_submit_rst_stream"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_submit_rst_stream()</span></tt></a> with a desired error code and then
return <a class="reference internal" href="#c.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>. Returning
<a class="reference internal" href="#c.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="c.nghttp2_data_provider">
<tt class="descname">nghttp2_data_provider</tt><a class="headerlink" href="#c.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="c.nghttp2_data_provider.source">
<a class="reference internal" href="#c.nghttp2_data_source" title="nghttp2_data_source">nghttp2_data_source</a> <tt class="descname">source</tt><a class="headerlink" href="#c.nghttp2_data_provider.source" title="Permalink to this definition"></a></dt>
<dd><p>The data source.</p>
</dd></dl>
<dl class="member">
<dt id="c.nghttp2_data_provider.read_callback">
<a class="reference internal" href="#c.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="#c.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="c.nghttp2_data">
<tt class="descname">nghttp2_data</tt><a class="headerlink" href="#c.nghttp2_data" title="Permalink to this definition"></a></dt>
<dd><p>The DATA frame. The received data is delivered via
<a class="reference internal" href="#c.nghttp2_on_data_chunk_recv_callback" title="nghttp2_on_data_chunk_recv_callback"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_on_data_chunk_recv_callback</span></tt></a>.</p>
<dl class="member">
<dt id="c.nghttp2_data.padlen">
size_t <tt class="descname">padlen</tt><a class="headerlink" href="#c.nghttp2_data.padlen" title="Permalink to this definition"></a></dt>
<dd><p>The length of the padding in this frame. This includes PAD_HIGH
and PAD_LOW.</p>
</dd></dl>
</dd></dl>
<dl class="type">
<dt id="c.nghttp2_priority_spec">
<tt class="descname">nghttp2_priority_spec</tt><a class="headerlink" href="#c.nghttp2_priority_spec" title="Permalink to this definition"></a></dt>
<dd><p>The structure to specify stream dependency.</p>
<dl class="member">
<dt id="c.nghttp2_priority_spec.stream_id">
int32_t <tt class="descname">stream_id</tt><a class="headerlink" href="#c.nghttp2_priority_spec.stream_id" title="Permalink to this definition"></a></dt>
<dd><p>The stream ID of the stream to depend on. Specifying 0 makes
stream not depend any other stream.</p>
</dd></dl>
<dl class="member">
<dt id="c.nghttp2_priority_spec.weight">
int32_t <tt class="descname">weight</tt><a class="headerlink" href="#c.nghttp2_priority_spec.weight" title="Permalink to this definition"></a></dt>
<dd><p>The weight of this dependency.</p>
</dd></dl>
<dl class="member">
<dt id="c.nghttp2_priority_spec.exclusive">
uint8_t <tt class="descname">exclusive</tt><a class="headerlink" href="#c.nghttp2_priority_spec.exclusive" title="Permalink to this definition"></a></dt>
<dd><p>nonzero means exclusive dependency</p>
</dd></dl>
</dd></dl>
<dl class="type">
<dt id="c.nghttp2_headers">
<tt class="descname">nghttp2_headers</tt><a class="headerlink" href="#c.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="c.nghttp2_headers.hd">
<a class="reference internal" href="#c.nghttp2_frame_hd" title="nghttp2_frame_hd">nghttp2_frame_hd</a> <tt class="descname">hd</tt><a class="headerlink" href="#c.nghttp2_headers.hd" title="Permalink to this definition"></a></dt>
<dd><p>The frame header.</p>
</dd></dl>
<dl class="member">
<dt id="c.nghttp2_headers.padlen">
size_t <tt class="descname">padlen</tt><a class="headerlink" href="#c.nghttp2_headers.padlen" title="Permalink to this definition"></a></dt>
<dd><p>The length of the padding in this frame. This includes PAD_HIGH
and PAD_LOW.</p>
</dd></dl>
<dl class="member">
<dt id="c.nghttp2_headers.pri_spec">
<a class="reference internal" href="#c.nghttp2_priority_spec" title="nghttp2_priority_spec">nghttp2_priority_spec</a> <tt class="descname">pri_spec</tt><a class="headerlink" href="#c.nghttp2_headers.pri_spec" title="Permalink to this definition"></a></dt>
<dd><p>The priority specification</p>
</dd></dl>
<dl class="member">
<dt id="c.nghttp2_headers.nva">
<a class="reference internal" href="#c.nghttp2_nv" title="nghttp2_nv">nghttp2_nv</a> *<tt class="descname">nva</tt><a class="headerlink" href="#c.nghttp2_headers.nva" title="Permalink to this definition"></a></dt>
<dd><p>The name/value pairs.</p>
</dd></dl>
<dl class="member">
<dt id="c.nghttp2_headers.nvlen">
size_t <tt class="descname">nvlen</tt><a class="headerlink" href="#c.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>
<dl class="member">
<dt id="c.nghttp2_headers.cat">
<a class="reference internal" href="#c.nghttp2_headers_category" title="nghttp2_headers_category">nghttp2_headers_category</a> <tt class="descname">cat</tt><a class="headerlink" href="#c.nghttp2_headers.cat" title="Permalink to this definition"></a></dt>
<dd><p>The category of this HEADERS frame.</p>
</dd></dl>
</dd></dl>
<dl class="type">
<dt id="c.nghttp2_priority">
<tt class="descname">nghttp2_priority</tt><a class="headerlink" href="#c.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="c.nghttp2_priority.hd">
<a class="reference internal" href="#c.nghttp2_frame_hd" title="nghttp2_frame_hd">nghttp2_frame_hd</a> <tt class="descname">hd</tt><a class="headerlink" href="#c.nghttp2_priority.hd" title="Permalink to this definition"></a></dt>
<dd><p>The frame header.</p>
</dd></dl>
<dl class="member">
<dt id="c.nghttp2_priority.pri_spec">
<a class="reference internal" href="#c.nghttp2_priority_spec" title="nghttp2_priority_spec">nghttp2_priority_spec</a> <tt class="descname">pri_spec</tt><a class="headerlink" href="#c.nghttp2_priority.pri_spec" title="Permalink to this definition"></a></dt>
<dd><p>The priority specification.</p>
</dd></dl>
</dd></dl>
<dl class="type">
<dt id="c.nghttp2_rst_stream">
<tt class="descname">nghttp2_rst_stream</tt><a class="headerlink" href="#c.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="c.nghttp2_rst_stream.hd">
<a class="reference internal" href="#c.nghttp2_frame_hd" title="nghttp2_frame_hd">nghttp2_frame_hd</a> <tt class="descname">hd</tt><a class="headerlink" href="#c.nghttp2_rst_stream.hd" title="Permalink to this definition"></a></dt>
<dd><p>The frame header.</p>
</dd></dl>
<dl class="member">
<dt id="c.nghttp2_rst_stream.error_code">
uint32_t <tt class="descname">error_code</tt><a class="headerlink" href="#c.nghttp2_rst_stream.error_code" title="Permalink to this definition"></a></dt>
<dd><p>The error code. See <a class="reference internal" href="#c.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="c.nghttp2_settings_entry">
<tt class="descname">nghttp2_settings_entry</tt><a class="headerlink" href="#c.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="c.nghttp2_settings_entry.settings_id">
int32_t <tt class="descname">settings_id</tt><a class="headerlink" href="#c.nghttp2_settings_entry.settings_id" title="Permalink to this definition"></a></dt>
<dd><p>The SETTINGS ID. See <a class="reference internal" href="#c.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="c.nghttp2_settings_entry.value">
uint32_t <tt class="descname">value</tt><a class="headerlink" href="#c.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="c.nghttp2_settings">
<tt class="descname">nghttp2_settings</tt><a class="headerlink" href="#c.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="c.nghttp2_settings.hd">
<a class="reference internal" href="#c.nghttp2_frame_hd" title="nghttp2_frame_hd">nghttp2_frame_hd</a> <tt class="descname">hd</tt><a class="headerlink" href="#c.nghttp2_settings.hd" title="Permalink to this definition"></a></dt>
<dd><p>The frame header.</p>
</dd></dl>
<dl class="member">
<dt id="c.nghttp2_settings.niv">
size_t <tt class="descname">niv</tt><a class="headerlink" href="#c.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="c.nghttp2_settings.iv">
<a class="reference internal" href="#c.nghttp2_settings_entry" title="nghttp2_settings_entry">nghttp2_settings_entry</a> *<tt class="descname">iv</tt><a class="headerlink" href="#c.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="c.nghttp2_push_promise">
<tt class="descname">nghttp2_push_promise</tt><a class="headerlink" href="#c.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="c.nghttp2_push_promise.hd">
<a class="reference internal" href="#c.nghttp2_frame_hd" title="nghttp2_frame_hd">nghttp2_frame_hd</a> <tt class="descname">hd</tt><a class="headerlink" href="#c.nghttp2_push_promise.hd" title="Permalink to this definition"></a></dt>
<dd><p>The frame header.</p>
</dd></dl>
<dl class="member">
<dt id="c.nghttp2_push_promise.padlen">
size_t <tt class="descname">padlen</tt><a class="headerlink" href="#c.nghttp2_push_promise.padlen" title="Permalink to this definition"></a></dt>
<dd><p>The length of the padding in this frame. This includes PAD_HIGH
and PAD_LOW.</p>
</dd></dl>
<dl class="member">
<dt id="c.nghttp2_push_promise.nva">
<a class="reference internal" href="#c.nghttp2_nv" title="nghttp2_nv">nghttp2_nv</a> *<tt class="descname">nva</tt><a class="headerlink" href="#c.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="c.nghttp2_push_promise.nvlen">
size_t <tt class="descname">nvlen</tt><a class="headerlink" href="#c.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="c.nghttp2_push_promise.promised_stream_id">
int32_t <tt class="descname">promised_stream_id</tt><a class="headerlink" href="#c.nghttp2_push_promise.promised_stream_id" title="Permalink to this definition"></a></dt>
<dd><p>The promised stream ID</p>
</dd></dl>
<dl class="member">
<dt id="c.nghttp2_push_promise.reserved">
uint8_t <tt class="descname">reserved</tt><a class="headerlink" href="#c.nghttp2_push_promise.reserved" title="Permalink to this definition"></a></dt>
<dd><p>Reserved bit. Currently this is always set to 0 and application
should not expect something useful in here.</p>
</dd></dl>
</dd></dl>
<dl class="type">
<dt id="c.nghttp2_ping">
<tt class="descname">nghttp2_ping</tt><a class="headerlink" href="#c.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="c.nghttp2_ping.hd">
<a class="reference internal" href="#c.nghttp2_frame_hd" title="nghttp2_frame_hd">nghttp2_frame_hd</a> <tt class="descname">hd</tt><a class="headerlink" href="#c.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="c.nghttp2_goaway">
<tt class="descname">nghttp2_goaway</tt><a class="headerlink" href="#c.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="c.nghttp2_goaway.hd">
<a class="reference internal" href="#c.nghttp2_frame_hd" title="nghttp2_frame_hd">nghttp2_frame_hd</a> <tt class="descname">hd</tt><a class="headerlink" href="#c.nghttp2_goaway.hd" title="Permalink to this definition"></a></dt>
<dd><p>The frame header.</p>
</dd></dl>
<dl class="member">
<dt id="c.nghttp2_goaway.last_stream_id">
int32_t <tt class="descname">last_stream_id</tt><a class="headerlink" href="#c.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="c.nghttp2_goaway.error_code">
uint32_t <tt class="descname">error_code</tt><a class="headerlink" href="#c.nghttp2_goaway.error_code" title="Permalink to this definition"></a></dt>
<dd><p>The error code. See <a class="reference internal" href="#c.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="c.nghttp2_goaway.opaque_data">
uint8_t *<tt class="descname">opaque_data</tt><a class="headerlink" href="#c.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="c.nghttp2_goaway.opaque_data_len">
size_t <tt class="descname">opaque_data_len</tt><a class="headerlink" href="#c.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>
<dl class="member">
<dt id="c.nghttp2_goaway.reserved">
uint8_t <tt class="descname">reserved</tt><a class="headerlink" href="#c.nghttp2_goaway.reserved" title="Permalink to this definition"></a></dt>
<dd><p>Reserved bit. Currently this is always set to 0 and application
should not expect something useful in here.</p>
</dd></dl>
</dd></dl>
<dl class="type">
<dt id="c.nghttp2_window_update">
<tt class="descname">nghttp2_window_update</tt><a class="headerlink" href="#c.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="c.nghttp2_window_update.hd">
<a class="reference internal" href="#c.nghttp2_frame_hd" title="nghttp2_frame_hd">nghttp2_frame_hd</a> <tt class="descname">hd</tt><a class="headerlink" href="#c.nghttp2_window_update.hd" title="Permalink to this definition"></a></dt>
<dd><p>The frame header.</p>
</dd></dl>
<dl class="member">
<dt id="c.nghttp2_window_update.window_size_increment">
int32_t <tt class="descname">window_size_increment</tt><a class="headerlink" href="#c.nghttp2_window_update.window_size_increment" title="Permalink to this definition"></a></dt>
<dd><p>The window size increment.</p>
</dd></dl>
<dl class="member">
<dt id="c.nghttp2_window_update.reserved">
uint8_t <tt class="descname">reserved</tt><a class="headerlink" href="#c.nghttp2_window_update.reserved" title="Permalink to this definition"></a></dt>
<dd><p>Reserved bit. Currently this is always set to 0 and application
should not expect something useful in here.</p>
</dd></dl>
</dd></dl>
<dl class="type">
<dt id="c.nghttp2_extension">
<tt class="descname">nghttp2_extension</tt><a class="headerlink" href="#c.nghttp2_extension" title="Permalink to this definition"></a></dt>
<dd><p>The extension frame. It has following members:</p>
<dl class="member">
<dt id="c.nghttp2_extension.hd">
<a class="reference internal" href="#c.nghttp2_frame_hd" title="nghttp2_frame_hd">nghttp2_frame_hd</a> <tt class="descname">hd</tt><a class="headerlink" href="#c.nghttp2_extension.hd" title="Permalink to this definition"></a></dt>
<dd><p>The frame header.</p>
</dd></dl>
<dl class="member">
<dt id="c.nghttp2_extension.payload">
void *<tt class="descname">payload</tt><a class="headerlink" href="#c.nghttp2_extension.payload" title="Permalink to this definition"></a></dt>
<dd><p>The pointer to extension payload. The exact pointer type is
determined by hd.type.</p>
<p>If hd.type == <a class="reference internal" href="#c.NGHTTP2_EXT_ALTSVC" title="NGHTTP2_EXT_ALTSVC"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_EXT_ALTSVC</span></tt></a>, it is a pointer to
<a class="reference internal" href="#c.nghttp2_ext_altsvc" title="nghttp2_ext_altsvc"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_ext_altsvc</span></tt></a>.</p>
</dd></dl>
</dd></dl>
<dl class="type">
<dt id="c.nghttp2_ext_altsvc">
<tt class="descname">nghttp2_ext_altsvc</tt><a class="headerlink" href="#c.nghttp2_ext_altsvc" title="Permalink to this definition"></a></dt>
<dd><p>The ALTSVC extension frame payload. It has following members:</p>
<dl class="member">
<dt id="c.nghttp2_ext_altsvc.protocol_id">
uint8_t *<tt class="descname">protocol_id</tt><a class="headerlink" href="#c.nghttp2_ext_altsvc.protocol_id" title="Permalink to this definition"></a></dt>
<dd><p>Protocol ID</p>
</dd></dl>
<dl class="member">
<dt id="c.nghttp2_ext_altsvc.host">
uint8_t *<tt class="descname">host</tt><a class="headerlink" href="#c.nghttp2_ext_altsvc.host" title="Permalink to this definition"></a></dt>
<dd><p>Host</p>
</dd></dl>
<dl class="member">
<dt id="c.nghttp2_ext_altsvc.origin">
uint8_t *<tt class="descname">origin</tt><a class="headerlink" href="#c.nghttp2_ext_altsvc.origin" title="Permalink to this definition"></a></dt>
<dd><p>Origin</p>
</dd></dl>
<dl class="member">
<dt id="c.nghttp2_ext_altsvc.protocol_id_len">
size_t <tt class="descname">protocol_id_len</tt><a class="headerlink" href="#c.nghttp2_ext_altsvc.protocol_id_len" title="Permalink to this definition"></a></dt>
<dd><p>The length of <em>protocol_id</em></p>
</dd></dl>
<dl class="member">
<dt id="c.nghttp2_ext_altsvc.host_len">
size_t <tt class="descname">host_len</tt><a class="headerlink" href="#c.nghttp2_ext_altsvc.host_len" title="Permalink to this definition"></a></dt>
<dd><p>The length of <em>host</em></p>
</dd></dl>
<dl class="member">
<dt id="c.nghttp2_ext_altsvc.origin_len">
size_t <tt class="descname">origin_len</tt><a class="headerlink" href="#c.nghttp2_ext_altsvc.origin_len" title="Permalink to this definition"></a></dt>
<dd><p>The length of <em>origin</em></p>
</dd></dl>
<dl class="member">
<dt id="c.nghttp2_ext_altsvc.max_age">
uint32_t <tt class="descname">max_age</tt><a class="headerlink" href="#c.nghttp2_ext_altsvc.max_age" title="Permalink to this definition"></a></dt>
<dd><p>Max-Age</p>
</dd></dl>
<dl class="member">
<dt id="c.nghttp2_ext_altsvc.port">
uint16_t <tt class="descname">port</tt><a class="headerlink" href="#c.nghttp2_ext_altsvc.port" title="Permalink to this definition"></a></dt>
<dd><p>Port</p>
</dd></dl>
</dd></dl>
<dl class="type">
<dt id="c.nghttp2_frame">
<tt class="descname">nghttp2_frame</tt><a class="headerlink" href="#c.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 CONTINUATION frame is omitted
from here because the library deals with it internally.</p>
<dl class="member">
<dt id="c.nghttp2_frame.hd">
<a class="reference internal" href="#c.nghttp2_frame_hd" title="nghttp2_frame_hd">nghttp2_frame_hd</a> <tt class="descname">hd</tt><a class="headerlink" href="#c.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="c.nghttp2_frame.data">
<a class="reference internal" href="#c.nghttp2_data" title="nghttp2_data">nghttp2_data</a> <tt class="descname">data</tt><a class="headerlink" href="#c.nghttp2_frame.data" title="Permalink to this definition"></a></dt>
<dd><p>The DATA frame.</p>
</dd></dl>
<dl class="member">
<dt id="c.nghttp2_frame.headers">
<a class="reference internal" href="#c.nghttp2_headers" title="nghttp2_headers">nghttp2_headers</a> <tt class="descname">headers</tt><a class="headerlink" href="#c.nghttp2_frame.headers" title="Permalink to this definition"></a></dt>
<dd><p>The HEADERS frame.</p>
</dd></dl>
<dl class="member">
<dt id="c.nghttp2_frame.priority">
<a class="reference internal" href="#c.nghttp2_priority" title="nghttp2_priority">nghttp2_priority</a> <tt class="descname">priority</tt><a class="headerlink" href="#c.nghttp2_frame.priority" title="Permalink to this definition"></a></dt>
<dd><p>The PRIORITY frame.</p>
</dd></dl>
<dl class="member">
<dt id="c.nghttp2_frame.rst_stream">
<a class="reference internal" href="#c.nghttp2_rst_stream" title="nghttp2_rst_stream">nghttp2_rst_stream</a> <tt class="descname">rst_stream</tt><a class="headerlink" href="#c.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="c.nghttp2_frame.settings">
<a class="reference internal" href="#c.nghttp2_settings" title="nghttp2_settings">nghttp2_settings</a> <tt class="descname">settings</tt><a class="headerlink" href="#c.nghttp2_frame.settings" title="Permalink to this definition"></a></dt>
<dd><p>The SETTINGS frame.</p>
</dd></dl>
<dl class="member">
<dt id="c.nghttp2_frame.push_promise">
<a class="reference internal" href="#c.nghttp2_push_promise" title="nghttp2_push_promise">nghttp2_push_promise</a> <tt class="descname">push_promise</tt><a class="headerlink" href="#c.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="c.nghttp2_frame.ping">
<a class="reference internal" href="#c.nghttp2_ping" title="nghttp2_ping">nghttp2_ping</a> <tt class="descname">ping</tt><a class="headerlink" href="#c.nghttp2_frame.ping" title="Permalink to this definition"></a></dt>
<dd><p>The PING frame.</p>
</dd></dl>
<dl class="member">
<dt id="c.nghttp2_frame.goaway">
<a class="reference internal" href="#c.nghttp2_goaway" title="nghttp2_goaway">nghttp2_goaway</a> <tt class="descname">goaway</tt><a class="headerlink" href="#c.nghttp2_frame.goaway" title="Permalink to this definition"></a></dt>
<dd><p>The GOAWAY frame.</p>
</dd></dl>
<dl class="member">
<dt id="c.nghttp2_frame.window_update">
<a class="reference internal" href="#c.nghttp2_window_update" title="nghttp2_window_update">nghttp2_window_update</a> <tt class="descname">window_update</tt><a class="headerlink" href="#c.nghttp2_frame.window_update" title="Permalink to this definition"></a></dt>
<dd><p>The WINDOW_UPDATE frame.</p>
</dd></dl>
<dl class="member">
<dt id="c.nghttp2_frame.ext">
<a class="reference internal" href="#c.nghttp2_extension" title="nghttp2_extension">nghttp2_extension</a> <tt class="descname">ext</tt><a class="headerlink" href="#c.nghttp2_frame.ext" title="Permalink to this definition"></a></dt>
<dd><p>The extension frame.</p>
</dd></dl>
</dd></dl>
<dl class="type">
<dt id="c.nghttp2_send_callback">
typedef ssize_t <tt class="descname">(*nghttp2_send_callback)</tt><big>(</big><a class="reference internal" href="#c.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="#c.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="#c.NGHTTP2_ERR_WOULDBLOCK" title="NGHTTP2_ERR_WOULDBLOCK"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_ERR_WOULDBLOCK</span></tt></a>. For other errors,
it must return <a class="reference internal" href="#c.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="#c.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="#c.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>
<p>This callback is required if the application uses
<a class="reference internal" href="#c.nghttp2_session_send" title="nghttp2_session_send"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_send()</span></tt></a> to send data to the remote endpoint. If
the application uses solely <a class="reference internal" href="#c.nghttp2_session_mem_send" title="nghttp2_session_mem_send"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_mem_send()</span></tt></a> instead,
this callback function is unnecessary.</p>
<p>To set this callback to <a class="reference internal" href="#c.nghttp2_session_callbacks" title="nghttp2_session_callbacks"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_session_callbacks</span></tt></a>, use
<a class="reference internal" href="#c.nghttp2_session_callbacks_set_send_callback" title="nghttp2_session_callbacks_set_send_callback"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_callbacks_set_send_callback()</span></tt></a>.</p>
</dd></dl>
<dl class="type">
<dt id="c.nghttp2_recv_callback">
typedef ssize_t <tt class="descname">(*nghttp2_recv_callback)</tt><big>(</big><a class="reference internal" href="#c.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="#c.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="#c.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="#c.NGHTTP2_ERR_EOF" title="NGHTTP2_ERR_EOF"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_ERR_EOF</span></tt></a>. For other
errors, it must return <a class="reference internal" href="#c.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 <a class="reference internal" href="#c.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="#c.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="#c.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>
<p>This callback is required if the application uses
<a class="reference internal" href="#c.nghttp2_session_recv" title="nghttp2_session_recv"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_recv()</span></tt></a> to receive data from the remote endpoint.
If the application uses solely <a class="reference internal" href="#c.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>
instead, this callback function is unnecessary.</p>
<p>To set this callback to <a class="reference internal" href="#c.nghttp2_session_callbacks" title="nghttp2_session_callbacks"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_session_callbacks</span></tt></a>, use
<a class="reference internal" href="#c.nghttp2_session_callbacks_set_recv_callback" title="nghttp2_session_callbacks_set_recv_callback"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_callbacks_set_recv_callback()</span></tt></a>.</p>
</dd></dl>
<dl class="type">
<dt id="c.nghttp2_on_frame_recv_callback">
typedef int <tt class="descname">(*nghttp2_on_frame_recv_callback)</tt><big>(</big><a class="reference internal" href="#c.nghttp2_session" title="nghttp2_session">nghttp2_session</a><em>&nbsp;*session</em>, const <a class="reference internal" href="#c.nghttp2_frame" title="nghttp2_frame">nghttp2_frame</a><em>&nbsp;*frame</em>, void<em>&nbsp;*user_data</em><big>)</big><a class="headerlink" href="#c.nghttp2_on_frame_recv_callback" title="Permalink to this definition"></a></dt>
<dd><p>Callback function invoked by <a class="reference internal" href="#c.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 frame
is received. The <em>user_data</em> pointer is the third argument passed
in to the call to <a class="reference internal" href="#c.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="#c.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>
<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="#c.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>
<p>For HEADERS, PUSH_PROMISE and DATA frames, this callback may be
called after stream is closed (see
<a class="reference internal" href="#c.nghttp2_on_stream_close_callback" title="nghttp2_on_stream_close_callback"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_on_stream_close_callback</span></tt></a>). The application should
check that stream is still alive using its own stream management or
<a class="reference internal" href="#c.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>Only HEADERS and DATA frame can signal the end of incoming data.
If <tt class="docutils literal"><span class="pre">frame-&gt;hd.flags</span> <span class="pre">&amp;</span> <span class="pre">NGHTTP2_FLAG_END_STREAM</span></tt> is nonzero, the
<em>frame</em> is the last frame from the remote peer in this stream.</p>
<p>This callback won't be called for CONTINUATION frames.
HEADERS/PUSH_PROMISE + CONTINUATIONs are treated as single frame.</p>
<p>The implementation of this function must return 0 if it succeeds.
If nonzero value is returned, it is treated as fatal error and
<a class="reference internal" href="#c.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="#c.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="#c.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>
<p>To set this callback to <a class="reference internal" href="#c.nghttp2_session_callbacks" title="nghttp2_session_callbacks"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_session_callbacks</span></tt></a>, use
<a class="reference internal" href="#c.nghttp2_session_callbacks_set_on_frame_recv_callback" title="nghttp2_session_callbacks_set_on_frame_recv_callback"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_callbacks_set_on_frame_recv_callback()</span></tt></a>.</p>
</dd></dl>
<dl class="type">
<dt id="c.nghttp2_on_invalid_frame_recv_callback">
typedef int <tt class="descname">(*nghttp2_on_invalid_frame_recv_callback)</tt><big>(</big><a class="reference internal" href="#c.nghttp2_session" title="nghttp2_session">nghttp2_session</a><em>&nbsp;*session</em>, const <a class="reference internal" href="#c.nghttp2_frame" title="nghttp2_frame">nghttp2_frame</a><em>&nbsp;*frame</em>, uint32_t<em>&nbsp;error_code</em>, void<em>&nbsp;*user_data</em><big>)</big><a class="headerlink" href="#c.nghttp2_on_invalid_frame_recv_callback" title="Permalink to this definition"></a></dt>
<dd><p>Callback function invoked by <a class="reference internal" href="#c.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> indicates the
error. It is usually one of the <a class="reference internal" href="#c.nghttp2_error_code" title="nghttp2_error_code"><tt class="xref c c-macro docutils literal"><span class="pre">nghttp2_error_code</span></tt></a> but
that is not guaranteed. When this callback function is invoked,
the library automatically submits either RST_STREAM or GOAWAY
frame. The <em>user_data</em> pointer is the third argument passed in to
the call to <a class="reference internal" href="#c.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="#c.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>
<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>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="#c.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="#c.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="#c.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>
<p>To set this callback to <a class="reference internal" href="#c.nghttp2_session_callbacks" title="nghttp2_session_callbacks"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_session_callbacks</span></tt></a>, use
<a class="reference internal" href="#c.nghttp2_session_callbacks_set_on_invalid_frame_recv_callback" title="nghttp2_session_callbacks_set_on_invalid_frame_recv_callback"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_callbacks_set_on_invalid_frame_recv_callback()</span></tt></a>.</p>
</dd></dl>
<dl class="type">
<dt id="c.nghttp2_on_data_chunk_recv_callback">
typedef int <tt class="descname">(*nghttp2_on_data_chunk_recv_callback)</tt><big>(</big><a class="reference internal" href="#c.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="#c.nghttp2_on_data_chunk_recv_callback" title="Permalink to this definition"></a></dt>
<dd><p>Callback function invoked when a chunk of data in DATA frame is
received. The <em>stream_id</em> is the stream ID this DATA frame belongs
to. The <em>flags</em> is the flags of DATA frame which this data chunk
is contained. <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="#c.nghttp2_on_frame_recv_callback" title="nghttp2_on_frame_recv_callback"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_on_frame_recv_callback</span></tt></a> to know all
data frames are received. The <em>user_data</em> pointer is the third
argument passed in to the call to <a class="reference internal" href="#c.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="#c.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>
<p>If the application uses <a class="reference internal" href="#c.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="#c.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="#c.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>
return without processing further input bytes. The memory by
pointed by the <em>data</em> is retained until
<a class="reference internal" href="#c.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="#c.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 the <em>data</em> parameter, because it may refer to the memory
region included in the input bytes.</p>
<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="#c.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="#c.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="#c.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>
<p>To set this callback to <a class="reference internal" href="#c.nghttp2_session_callbacks" title="nghttp2_session_callbacks"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_session_callbacks</span></tt></a>, use
<a class="reference internal" href="#c.nghttp2_session_callbacks_set_on_data_chunk_recv_callback" title="nghttp2_session_callbacks_set_on_data_chunk_recv_callback"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_callbacks_set_on_data_chunk_recv_callback()</span></tt></a>.</p>
</dd></dl>
<dl class="type">
<dt id="c.nghttp2_before_frame_send_callback">
typedef int <tt class="descname">(*nghttp2_before_frame_send_callback)</tt><big>(</big><a class="reference internal" href="#c.nghttp2_session" title="nghttp2_session">nghttp2_session</a><em>&nbsp;*session</em>, const <a class="reference internal" href="#c.nghttp2_frame" title="nghttp2_frame">nghttp2_frame</a><em>&nbsp;*frame</em>, void<em>&nbsp;*user_data</em><big>)</big><a class="headerlink" href="#c.nghttp2_before_frame_send_callback" title="Permalink to this definition"></a></dt>
<dd><p>Callback function invoked just before the non-DATA frame <em>frame</em> is
sent. The <em>user_data</em> pointer is the third argument passed in to
the call to <a class="reference internal" href="#c.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="#c.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>
<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="#c.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="#c.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="#c.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>
<p>To set this callback to <a class="reference internal" href="#c.nghttp2_session_callbacks" title="nghttp2_session_callbacks"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_session_callbacks</span></tt></a>, use
<a class="reference internal" href="#c.nghttp2_session_callbacks_set_before_frame_send_callback" title="nghttp2_session_callbacks_set_before_frame_send_callback"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_callbacks_set_before_frame_send_callback()</span></tt></a>.</p>
</dd></dl>
<dl class="type">
<dt id="c.nghttp2_on_frame_send_callback">
typedef int <tt class="descname">(*nghttp2_on_frame_send_callback)</tt><big>(</big><a class="reference internal" href="#c.nghttp2_session" title="nghttp2_session">nghttp2_session</a><em>&nbsp;*session</em>, const <a class="reference internal" href="#c.nghttp2_frame" title="nghttp2_frame">nghttp2_frame</a><em>&nbsp;*frame</em>, void<em>&nbsp;*user_data</em><big>)</big><a class="headerlink" href="#c.nghttp2_on_frame_send_callback" title="Permalink to this definition"></a></dt>
<dd><p>Callback function invoked after the 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="#c.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="#c.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>
<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="#c.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="#c.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="#c.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>
<p>To set this callback to <a class="reference internal" href="#c.nghttp2_session_callbacks" title="nghttp2_session_callbacks"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_session_callbacks</span></tt></a>, use
<a class="reference internal" href="#c.nghttp2_session_callbacks_set_on_frame_send_callback" title="nghttp2_session_callbacks_set_on_frame_send_callback"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_callbacks_set_on_frame_send_callback()</span></tt></a>.</p>
</dd></dl>
<dl class="type">
<dt id="c.nghttp2_on_frame_not_send_callback">
typedef int <tt class="descname">(*nghttp2_on_frame_not_send_callback)</tt><big>(</big><a class="reference internal" href="#c.nghttp2_session" title="nghttp2_session">nghttp2_session</a><em>&nbsp;*session</em>, const <a class="reference internal" href="#c.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="#c.nghttp2_on_frame_not_send_callback" title="Permalink to this definition"></a></dt>
<dd><p>Callback function invoked after the non-DATA frame <em>frame</em> is not
sent because of the error. The error is indicated by the
<em>lib_error_code</em>, which is one of the values defined in
<a class="reference internal" href="#c.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="#c.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="#c.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>
<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="#c.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="#c.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="#c.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>
<p><a class="reference internal" href="#c.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
associated data.</p>
<p>To set this callback to <a class="reference internal" href="#c.nghttp2_session_callbacks" title="nghttp2_session_callbacks"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_session_callbacks</span></tt></a>, use
<a class="reference internal" href="#c.nghttp2_session_callbacks_set_on_frame_not_send_callback" title="nghttp2_session_callbacks_set_on_frame_not_send_callback"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_callbacks_set_on_frame_not_send_callback()</span></tt></a>.</p>
</dd></dl>
<dl class="type">
<dt id="c.nghttp2_on_stream_close_callback">
typedef int <tt class="descname">(*nghttp2_on_stream_close_callback)</tt><big>(</big><a class="reference internal" href="#c.nghttp2_session" title="nghttp2_session">nghttp2_session</a><em>&nbsp;*session</em>, int32_t<em>&nbsp;stream_id</em>, uint32_t<em>&nbsp;error_code</em>, void<em>&nbsp;*user_data</em><big>)</big><a class="headerlink" href="#c.nghttp2_on_stream_close_callback" title="Permalink to this definition"></a></dt>
<dd><p>Callback function invoked when the stream <em>stream_id</em> is closed.
The reason of closure is indicated by the <em>error_code</em>. The
<em>error_code</em> is usually one of <a class="reference internal" href="#c.nghttp2_error_code" title="nghttp2_error_code"><tt class="xref c c-macro docutils literal"><span class="pre">nghttp2_error_code</span></tt></a>, but that
is not guaranteed. The stream_user_data, which was specified in
<a class="reference internal" href="#c.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="#c.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="#c.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="#c.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>
<p>This function is also called for a stream in reserved state.</p>
<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="#c.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="#c.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="#c.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>
<p>To set this callback to <a class="reference internal" href="#c.nghttp2_session_callbacks" title="nghttp2_session_callbacks"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_session_callbacks</span></tt></a>, use
<a class="reference internal" href="#c.nghttp2_session_callbacks_set_on_stream_close_callback" title="nghttp2_session_callbacks_set_on_stream_close_callback"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_callbacks_set_on_stream_close_callback()</span></tt></a>.</p>
</dd></dl>
<dl class="type">
<dt id="c.nghttp2_on_begin_headers_callback">
typedef int <tt class="descname">(*nghttp2_on_begin_headers_callback)</tt><big>(</big><a class="reference internal" href="#c.nghttp2_session" title="nghttp2_session">nghttp2_session</a><em>&nbsp;*session</em>, const <a class="reference internal" href="#c.nghttp2_frame" title="nghttp2_frame">nghttp2_frame</a><em>&nbsp;*frame</em>, void<em>&nbsp;*user_data</em><big>)</big><a class="headerlink" href="#c.nghttp2_on_begin_headers_callback" title="Permalink to this definition"></a></dt>
<dd><p>Callback function invoked when the reception of header block in
HEADERS or PUSH_PROMISE is started. Each header name/value pair
will be emitted by <a class="reference internal" href="#c.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>
<p>The <tt class="docutils literal"><span class="pre">frame-&gt;hd.flags</span></tt> may not have
<a class="reference internal" href="#c.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, which indicates that one
or more CONTINUATION frames are involved. But the application does
not need to care about that because the header name/value pairs are
emitted transparently regardless of CONTINUATION frames.</p>
<p>The server applications probably create an object to store
information about new stream if <tt class="docutils literal"><span class="pre">frame-&gt;hd.type</span> <span class="pre">==</span>
<span class="pre">NGHTTP2_HEADERS</span></tt> and <tt class="docutils literal"><span class="pre">frame-&gt;headers.cat</span> <span class="pre">==</span>
<span class="pre">NGHTTP2_HCAT_REQUEST</span></tt>. If <em>session</em> is configured as server side,
<tt class="docutils literal"><span class="pre">frame-&gt;headers.cat</span></tt> is either <tt class="docutils literal"><span class="pre">NGHTTP2_HCAT_REQUEST</span></tt>
containing request headers or <tt class="docutils literal"><span class="pre">NGHTTP2_HCAT_HEADERS</span></tt> containing
trailer headers and never get PUSH_PROMISE in this callback.</p>
<p>For the client applications, <tt class="docutils literal"><span class="pre">frame-&gt;hd.type</span></tt> is either
<tt class="docutils literal"><span class="pre">NGHTTP2_HEADERS</span></tt> or <tt class="docutils literal"><span class="pre">NGHTTP2_PUSH_PROMISE</span></tt>. In case of
<tt class="docutils literal"><span class="pre">NGHTTP2_HEADERS</span></tt>, <tt class="docutils literal"><span class="pre">frame-&gt;headers.cat</span> <span class="pre">==</span>
<span class="pre">NGHTTP2_HCAT_RESPONSE</span></tt> means that it is the first response
headers, but it may be non-final response which is indicated by 1xx
status code. In this case, there may be zero or more HEADERS frame
with <tt class="docutils literal"><span class="pre">frame-&gt;headers.cat</span> <span class="pre">==</span> <span class="pre">NGHTTP2_HCAT_HEADERS</span></tt> which has
non-final response code and finally client gets exactly one HEADERS
frame with <tt class="docutils literal"><span class="pre">frame-&gt;headers.cat</span> <span class="pre">==</span> <span class="pre">NGHTTP2_HCAT_HEADERS</span></tt>
containing final response headers (non-1xx status code). The
trailer headers also has <tt class="docutils literal"><span class="pre">frame-&gt;headers.cat</span> <span class="pre">==</span>
<span class="pre">NGHTTP2_HCAT_HEADERS</span></tt> which does not containg any status code.</p>
<p>The implementation of this function must return 0 if it succeeds or
<a class="reference internal" href="#c.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>. If nonzero value other than
<a class="reference internal" href="#c.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> is returned, it is treated as
if <a class="reference internal" href="#c.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> is returned. If
<a class="reference internal" href="#c.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> is returned,
<a class="reference internal" href="#c.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> function will immediately return
<a class="reference internal" href="#c.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>
<p>To set this callback to <a class="reference internal" href="#c.nghttp2_session_callbacks" title="nghttp2_session_callbacks"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_session_callbacks</span></tt></a>, use
<a class="reference internal" href="#c.nghttp2_session_callbacks_set_on_begin_headers_callback" title="nghttp2_session_callbacks_set_on_begin_headers_callback"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_callbacks_set_on_begin_headers_callback()</span></tt></a>.</p>
</dd></dl>
<dl class="type">
<dt id="c.nghttp2_on_header_callback">
typedef int <tt class="descname">(*nghttp2_on_header_callback)</tt><big>(</big><a class="reference internal" href="#c.nghttp2_session" title="nghttp2_session">nghttp2_session</a><em>&nbsp;*session</em>, const <a class="reference internal" href="#c.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>, uint8_t<em>&nbsp;flags</em>, void<em>&nbsp;*user_data</em><big>)</big><a class="headerlink" href="#c.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>. The <em>name</em> of length <em>namelen</em> is header name.
The <em>value</em> of length <em>valuelen</em> is header value. The <em>flags</em> is
bitwise OR of one or more of <a class="reference internal" href="#c.nghttp2_nv_flag" title="nghttp2_nv_flag"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_nv_flag</span></tt></a>.</p>
<p>If <a class="reference internal" href="#c.NGHTTP2_NV_FLAG_NO_INDEX" title="NGHTTP2_NV_FLAG_NO_INDEX"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_NV_FLAG_NO_INDEX</span></tt></a> is set in <em>flags</em>, the receiver
must not index this name/value pair when forwarding it to the next
hop. More specifically, &quot;Literal Header Field never Indexed&quot;
representation must be used in HPACK encoding.</p>
<p>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="#c.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="#c.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, and no
error has been detected, <a class="reference internal" href="#c.nghttp2_on_frame_recv_callback" title="nghttp2_on_frame_recv_callback"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_on_frame_recv_callback</span></tt></a>
will be invoked. If there is an error in decompression,
<a class="reference internal" href="#c.nghttp2_on_frame_recv_callback" title="nghttp2_on_frame_recv_callback"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_on_frame_recv_callback</span></tt></a> for the <em>frame</em> will not be
invoked.</p>
<p>The <em>value</em> may be <tt class="docutils literal"><span class="pre">NULL</span></tt> if the <em>valuelen</em> is 0.</p>
<p>Please note that unless <a class="reference internal" href="#c.nghttp2_option_set_no_http_messaging" title="nghttp2_option_set_no_http_messaging"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_option_set_no_http_messaging()</span></tt></a> is
used, nghttp2 library does perform validation against the <em>name</em>
and the <em>value</em> using <a class="reference internal" href="#c.nghttp2_check_header_name" title="nghttp2_check_header_name"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_check_header_name()</span></tt></a> and
<a class="reference internal" href="#c.nghttp2_check_header_value" title="nghttp2_check_header_value"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_check_header_value()</span></tt></a>. In addition to this, nghttp2
performs vaidation based on HTTP Messaging rule, which is briefly
explained in <a class="reference internal" href="#http-messaging">HTTP Messaging</a> section.</p>
<p>If the application uses <a class="reference internal" href="#c.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="#c.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="#c.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>
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="#c.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="#c.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>
<p>Returning <a class="reference internal" href="#c.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="#c.NGHTTP2_INTERNAL_ERROR" title="NGHTTP2_INTERNAL_ERROR"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_INTERNAL_ERROR</span></tt></a>. In this case,
<a class="reference internal" href="#c.nghttp2_on_frame_recv_callback" title="nghttp2_on_frame_recv_callback"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_on_frame_recv_callback</span></tt></a> will not be invoked. If a
different error code is desirable, use
<a class="reference internal" href="#c.nghttp2_submit_rst_stream" title="nghttp2_submit_rst_stream"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_submit_rst_stream()</span></tt></a> with a desired error code and then
return <a class="reference internal" href="#c.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>.</p>
<p>The implementation of this function must return 0 if it succeeds.
It may return <a class="reference internal" href="#c.NGHTTP2_ERR_PAUSE" title="NGHTTP2_ERR_PAUSE"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_ERR_PAUSE</span></tt></a> or
<a class="reference internal" href="#c.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>. For other critical
failures, it must return <a class="reference internal" href="#c.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>. If
the other nonzero value is returned, it is treated as
<a class="reference internal" href="#c.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>. If
<a class="reference internal" href="#c.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> is returned,
<a class="reference internal" href="#c.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="#c.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="#c.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>
<p>To set this callback to <a class="reference internal" href="#c.nghttp2_session_callbacks" title="nghttp2_session_callbacks"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_session_callbacks</span></tt></a>, use
<a class="reference internal" href="#c.nghttp2_session_callbacks_set_on_header_callback" title="nghttp2_session_callbacks_set_on_header_callback"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_callbacks_set_on_header_callback()</span></tt></a>.</p>
</dd></dl>
<dl class="type">
<dt id="c.nghttp2_select_padding_callback">
typedef ssize_t <tt class="descname">(*nghttp2_select_padding_callback)</tt><big>(</big><a class="reference internal" href="#c.nghttp2_session" title="nghttp2_session">nghttp2_session</a><em>&nbsp;*session</em>, const <a class="reference internal" href="#c.nghttp2_frame" title="nghttp2_frame">nghttp2_frame</a><em>&nbsp;*frame</em>, size_t<em>&nbsp;max_payloadlen</em>, void<em>&nbsp;*user_data</em><big>)</big><a class="headerlink" href="#c.nghttp2_select_padding_callback" title="Permalink to this definition"></a></dt>
<dd><p>Callback function invoked when the library asks application how
many padding bytes are required for the transmission of the
<em>frame</em>. The application must choose the total length of payload
including padded bytes in range [frame-&gt;hd.length, max_payloadlen],
inclusive. Choosing number not in this range will be treated as
<a class="reference internal" href="#c.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
<tt class="docutils literal"><span class="pre">frame-&gt;hd.length</span></tt> means no padding is added. Returning
<a class="reference internal" href="#c.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 make
<a class="reference internal" href="#c.nghttp2_session_send" title="nghttp2_session_send"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_send()</span></tt></a> function immediately return
<a class="reference internal" href="#c.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>
<p>To set this callback to <a class="reference internal" href="#c.nghttp2_session_callbacks" title="nghttp2_session_callbacks"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_session_callbacks</span></tt></a>, use
<a class="reference internal" href="#c.nghttp2_session_callbacks_set_select_padding_callback" title="nghttp2_session_callbacks_set_select_padding_callback"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_callbacks_set_select_padding_callback()</span></tt></a>.</p>
</dd></dl>
<dl class="type">
<dt id="c.nghttp2_data_source_read_length_callback">
typedef ssize_t <tt class="descname">(*nghttp2_data_source_read_length_callback)</tt><big>(</big><a class="reference internal" href="#c.nghttp2_session" title="nghttp2_session">nghttp2_session</a><em>&nbsp;*session</em>, uint8_t<em>&nbsp;frame_type</em>, int32_t<em>&nbsp;stream_id</em>, int32_t<em>&nbsp;session_remote_window_size</em>, int32_t<em>&nbsp;stream_remote_window_size</em>, uint32_t<em>&nbsp;remote_max_frame_size</em>, void<em>&nbsp;*user_data</em><big>)</big><a class="headerlink" href="#c.nghttp2_data_source_read_length_callback" title="Permalink to this definition"></a></dt>
<dd><p>Callback function invoked when library wants to get max length of
data to send data to the remote peer. The implementation of this
function should return a value in the following range. [1,
min(<em>session_remote_window_size</em>, <em>stream_remote_window_size</em>,
<em>remote_max_frame_size</em>)]. If a value greater than this range is
returned than the max allow value will be used. Returning a value
smaller than this range is treated as
<a class="reference internal" href="#c.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>frame_type</em> is provided
for future extensibility and identifies the type of frame (see
<a class="reference internal" href="#c.nghttp2_frame_type" title="nghttp2_frame_type"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_frame_type</span></tt></a>) for which to get the length for.
Currently supported frame types are: <a class="reference internal" href="#c.NGHTTP2_DATA" title="NGHTTP2_DATA"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_DATA</span></tt></a>.</p>
<p>This callback can be used to control the length in bytes for which
<a class="reference internal" href="#c.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> is allowed to send to the
remote endpoint. This callback is optional. Returning
<a class="reference internal" href="#c.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>
<p>To set this callback to <a class="reference internal" href="#c.nghttp2_session_callbacks" title="nghttp2_session_callbacks"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_session_callbacks</span></tt></a>, use
<a class="reference internal" href="#c.nghttp2_session_callbacks_set_data_source_read_length_callback" title="nghttp2_session_callbacks_set_data_source_read_length_callback"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_callbacks_set_data_source_read_length_callback()</span></tt></a>.</p>
</dd></dl>
<dl class="type">
<dt id="c.nghttp2_on_begin_frame_callback">
typedef int <tt class="descname">(*nghttp2_on_begin_frame_callback)</tt><big>(</big><a class="reference internal" href="#c.nghttp2_session" title="nghttp2_session">nghttp2_session</a><em>&nbsp;*session</em>, const <a class="reference internal" href="#c.nghttp2_frame_hd" title="nghttp2_frame_hd">nghttp2_frame_hd</a><em>&nbsp;*hd</em>, void<em>&nbsp;*user_data</em><big>)</big><a class="headerlink" href="#c.nghttp2_on_begin_frame_callback" title="Permalink to this definition"></a></dt>
<dd><p>Callback function invoked when a frame header is received. The
<em>hd</em> points to received frame header.</p>
<p>Unlike <a class="reference internal" href="#c.nghttp2_on_frame_recv_callback" title="nghttp2_on_frame_recv_callback"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_on_frame_recv_callback</span></tt></a>, this callback will
also be called when frame header of CONTINUATION frame is received.</p>
<p>If both <a class="reference internal" href="#c.nghttp2_on_begin_frame_callback" title="nghttp2_on_begin_frame_callback"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_on_begin_frame_callback</span></tt></a> and
<a class="reference internal" href="#c.nghttp2_on_begin_headers_callback" title="nghttp2_on_begin_headers_callback"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_on_begin_headers_callback</span></tt></a> are set and HEADERS or
PUSH_PROMISE is received, <a class="reference internal" href="#c.nghttp2_on_begin_frame_callback" title="nghttp2_on_begin_frame_callback"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_on_begin_frame_callback</span></tt></a>
will be called first.</p>
<p>The implementation of this function must return 0 if it succeeds.
If nonzero value is returned, it is treated as fatal error and
<a class="reference internal" href="#c.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="#c.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="#c.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>
<p>To set this callback to <a class="reference internal" href="#c.nghttp2_session_callbacks" title="nghttp2_session_callbacks"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_session_callbacks</span></tt></a>, use
<a class="reference internal" href="#c.nghttp2_session_callbacks_set_on_begin_frame_callback" title="nghttp2_session_callbacks_set_on_begin_frame_callback"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_callbacks_set_on_begin_frame_callback()</span></tt></a>.</p>
</dd></dl>
<dl class="type">
<dt id="c.nghttp2_session_callbacks">
<tt class="descname">nghttp2_session_callbacks</tt><a class="headerlink" href="#c.nghttp2_session_callbacks" title="Permalink to this definition"></a></dt>
<dd><p>Callback functions for <a class="reference internal" href="#c.nghttp2_session" title="nghttp2_session"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_session</span></tt></a>. The details of
this structure are intentionally hidden from the public API.</p>
</dd></dl>
<dl class="type">
<dt id="c.nghttp2_malloc">
typedef void *<tt class="descname">(*nghttp2_malloc)</tt><big>(</big>size_t<em>&nbsp;size</em>, void<em>&nbsp;*mem_user_data</em><big>)</big><a class="headerlink" href="#c.nghttp2_malloc" title="Permalink to this definition"></a></dt>
<dd><p>Custom memory allocator to replace malloc(). The <em>mem_user_data</em>
is the mem_user_data member of <a class="reference internal" href="#c.nghttp2_mem" title="nghttp2_mem"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_mem</span></tt></a> structure.</p>
</dd></dl>
<dl class="type">
<dt id="c.nghttp2_free">
typedef void <tt class="descname">(*nghttp2_free)</tt><big>(</big>void<em>&nbsp;*ptr</em>, void<em>&nbsp;*mem_user_data</em><big>)</big><a class="headerlink" href="#c.nghttp2_free" title="Permalink to this definition"></a></dt>
<dd><p>Custom memory allocator to replace free(). The <em>mem_user_data</em> is
the mem_user_data member of <a class="reference internal" href="#c.nghttp2_mem" title="nghttp2_mem"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_mem</span></tt></a> structure.</p>
</dd></dl>
<dl class="type">
<dt id="c.nghttp2_calloc">
typedef void *<tt class="descname">(*nghttp2_calloc)</tt><big>(</big>size_t<em>&nbsp;nmemb</em>, size_t<em>&nbsp;size</em>, void<em>&nbsp;*mem_user_data</em><big>)</big><a class="headerlink" href="#c.nghttp2_calloc" title="Permalink to this definition"></a></dt>
<dd><p>Custom memory allocator to replace calloc(). The <em>mem_user_data</em>
is the mem_user_data member of <a class="reference internal" href="#c.nghttp2_mem" title="nghttp2_mem"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_mem</span></tt></a> structure.</p>
</dd></dl>
<dl class="type">
<dt id="c.nghttp2_realloc">
typedef void *<tt class="descname">(*nghttp2_realloc)</tt><big>(</big>void<em>&nbsp;*ptr</em>, size_t<em>&nbsp;size</em>, void<em>&nbsp;*mem_user_data</em><big>)</big><a class="headerlink" href="#c.nghttp2_realloc" title="Permalink to this definition"></a></dt>
<dd><p>Custom memory allocator to replace realloc(). The <em>mem_user_data</em>
is the mem_user_data member of <a class="reference internal" href="#c.nghttp2_mem" title="nghttp2_mem"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_mem</span></tt></a> structure.</p>
</dd></dl>
<dl class="type">
<dt id="c.nghttp2_mem">
<tt class="descname">nghttp2_mem</tt><a class="headerlink" href="#c.nghttp2_mem" title="Permalink to this definition"></a></dt>
<dd><p>Custom memory allocator functions and user defined pointer. The
<em>mem_user_data</em> member is passed to each allocator function. This
can be used, for example, to achieve per-session memory pool.</p>
<p>In the following example code, <tt class="docutils literal"><span class="pre">my_malloc</span></tt>, <tt class="docutils literal"><span class="pre">my_free</span></tt>,
<tt class="docutils literal"><span class="pre">my_calloc</span></tt> and <tt class="docutils literal"><span class="pre">my_realloc</span></tt> are the replacement of the
standard allocators <tt class="docutils literal"><span class="pre">malloc</span></tt>, <tt class="docutils literal"><span class="pre">free</span></tt>, <tt class="docutils literal"><span class="pre">calloc</span></tt> and
<tt class="docutils literal"><span class="pre">realloc</span></tt> respectively:</p>
<div class="highlight-c"><div class="highlight"><pre><span class="kt">void</span> <span class="o">*</span><span class="nf">my_malloc_cb</span><span class="p">(</span><span class="kt">size_t</span> <span class="n">size</span><span class="p">,</span> <span class="kt">void</span> <span class="o">*</span><span class="n">mem_user_data</span><span class="p">)</span> <span class="p">{</span>
<span class="k">return</span> <span class="n">my_malloc</span><span class="p">(</span><span class="n">size</span><span class="p">);</span>
<span class="p">}</span>
<span class="kt">void</span> <span class="nf">my_free_cb</span><span class="p">(</span><span class="kt">void</span> <span class="o">*</span><span class="n">ptr</span><span class="p">,</span> <span class="kt">void</span> <span class="o">*</span><span class="n">mem_user_data</span><span class="p">)</span> <span class="p">{</span> <span class="n">my_free</span><span class="p">(</span><span class="n">ptr</span><span class="p">);</span> <span class="p">}</span>
<span class="kt">void</span> <span class="o">*</span><span class="nf">my_calloc_cb</span><span class="p">(</span><span class="kt">size_t</span> <span class="n">nmemb</span><span class="p">,</span> <span class="kt">size_t</span> <span class="n">size</span><span class="p">,</span> <span class="kt">void</span> <span class="o">*</span><span class="n">mem_user_data</span><span class="p">)</span> <span class="p">{</span>
<span class="k">return</span> <span class="n">my_calloc</span><span class="p">(</span><span class="n">nmemb</span><span class="p">,</span> <span class="n">size</span><span class="p">);</span>
<span class="p">}</span>
<span class="kt">void</span> <span class="o">*</span><span class="nf">my_realloc_cb</span><span class="p">(</span><span class="kt">void</span> <span class="o">*</span><span class="n">ptr</span><span class="p">,</span> <span class="kt">size_t</span> <span class="n">size</span><span class="p">,</span> <span class="kt">void</span> <span class="o">*</span><span class="n">mem_user_data</span><span class="p">)</span> <span class="p">{</span>
<span class="k">return</span> <span class="n">my_realloc</span><span class="p">(</span><span class="n">ptr</span><span class="p">,</span> <span class="n">size</span><span class="p">);</span>
<span class="p">}</span>
<span class="kt">void</span> <span class="nf">session_new</span><span class="p">()</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="n">nghttp2_session_callbacks</span> <span class="o">*</span><span class="n">callbacks</span><span class="p">;</span>
<span class="n">nghttp2_mem</span> <span class="n">mem</span> <span class="o">=</span> <span class="p">{</span><span class="nb">NULL</span><span class="p">,</span> <span class="n">my_malloc_cb</span><span class="p">,</span> <span class="n">my_free_cb</span><span class="p">,</span> <span class="n">my_calloc_cb</span><span class="p">,</span>
<span class="n">my_realloc_cb</span><span class="p">};</span>
<span class="p">...</span>
<span class="n">nghttp2_session_client_new3</span><span class="p">(</span><span class="o">&amp;</span><span class="n">session</span><span class="p">,</span> <span class="n">callbacks</span><span class="p">,</span> <span class="nb">NULL</span><span class="p">,</span> <span class="nb">NULL</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">mem</span><span class="p">);</span>
<span class="p">...</span>
<span class="p">}</span>
</pre></div>
</div>
<dl class="member">
<dt id="c.nghttp2_mem.mem_user_data">
void *<tt class="descname">mem_user_data</tt><a class="headerlink" href="#c.nghttp2_mem.mem_user_data" title="Permalink to this definition"></a></dt>
<dd><p>An arbitrary user supplied data. This is passed to each
allocator function.</p>
</dd></dl>
<dl class="member">
<dt id="c.nghttp2_mem.malloc">
<a class="reference internal" href="#c.nghttp2_malloc" title="nghttp2_malloc">nghttp2_malloc</a> <tt class="descname">malloc</tt><a class="headerlink" href="#c.nghttp2_mem.malloc" title="Permalink to this definition"></a></dt>
<dd><p>Custom allocator function to replace malloc().</p>
</dd></dl>
<dl class="member">
<dt id="c.nghttp2_mem.free">
<a class="reference internal" href="#c.nghttp2_free" title="nghttp2_free">nghttp2_free</a> <tt class="descname">free</tt><a class="headerlink" href="#c.nghttp2_mem.free" title="Permalink to this definition"></a></dt>
<dd><p>Custom allocator function to replace free().</p>
</dd></dl>
<dl class="member">
<dt id="c.nghttp2_mem.calloc">
<a class="reference internal" href="#c.nghttp2_calloc" title="nghttp2_calloc">nghttp2_calloc</a> <tt class="descname">calloc</tt><a class="headerlink" href="#c.nghttp2_mem.calloc" title="Permalink to this definition"></a></dt>
<dd><p>Custom allocator function to replace calloc().</p>
</dd></dl>
<dl class="member">
<dt id="c.nghttp2_mem.realloc">
<a class="reference internal" href="#c.nghttp2_realloc" title="nghttp2_realloc">nghttp2_realloc</a> <tt class="descname">realloc</tt><a class="headerlink" href="#c.nghttp2_mem.realloc" title="Permalink to this definition"></a></dt>
<dd><p>Custom allocator function to replace realloc().</p>
</dd></dl>
</dd></dl>
<dl class="type">
<dt id="c.nghttp2_option">
<tt class="descname">nghttp2_option</tt><a class="headerlink" href="#c.nghttp2_option" title="Permalink to this definition"></a></dt>
<dd><p>Configuration options for <a class="reference internal" href="#c.nghttp2_session" title="nghttp2_session"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_session</span></tt></a>. The details of
this structure are intentionally hidden from the public API.</p>
</dd></dl>
<dl class="type">
<dt id="c.nghttp2_hd_deflater">
<tt class="descname">nghttp2_hd_deflater</tt><a class="headerlink" href="#c.nghttp2_hd_deflater" title="Permalink to this definition"></a></dt>
<dd><p>HPACK deflater object.</p>
</dd></dl>
<dl class="type">
<dt id="c.nghttp2_hd_inflater">
<tt class="descname">nghttp2_hd_inflater</tt><a class="headerlink" href="#c.nghttp2_hd_inflater" title="Permalink to this definition"></a></dt>
<dd><p>HPACK inflater object.</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="c.nghttp2_session_callbacks_new">
int <tt class="descname">nghttp2_session_callbacks_new</tt><big>(</big><a class="reference internal" href="#c.nghttp2_session_callbacks" title="nghttp2_session_callbacks">nghttp2_session_callbacks</a><em>&nbsp;**callbacks_ptr</em><big>)</big><a class="headerlink" href="#c.nghttp2_session_callbacks_new" title="Permalink to this definition"></a></dt>
<dd><p>Initializes <em>*callbacks_ptr</em> with NULL values.</p>
<p>The initialized object can be used when initializing multiple
<a class="reference internal" href="#c.nghttp2_session" title="nghttp2_session"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_session</span></tt></a> objects.</p>
<p>When the application finished using this object, it can use
<a class="reference internal" href="#c.nghttp2_session_callbacks_del" title="nghttp2_session_callbacks_del"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_callbacks_del()</span></tt></a> to free its memory.</p>
<p>This function returns 0 if it succeeds, or one of the following
negative error codes:</p>
<dl class="docutils">
<dt><a class="reference internal" href="#c.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="c.nghttp2_session_callbacks_del">
void <tt class="descname">nghttp2_session_callbacks_del</tt><big>(</big><a class="reference internal" href="#c.nghttp2_session_callbacks" title="nghttp2_session_callbacks">nghttp2_session_callbacks</a><em>&nbsp;*callbacks</em><big>)</big><a class="headerlink" href="#c.nghttp2_session_callbacks_del" title="Permalink to this definition"></a></dt>
<dd><p>Frees any resources allocated for <em>callbacks</em>. If <em>callbacks</em> is
<tt class="docutils literal"><span class="pre">NULL</span></tt>, this function does nothing.</p>
</dd></dl>
<dl class="function">
<dt id="c.nghttp2_session_callbacks_set_send_callback">
void <tt class="descname">nghttp2_session_callbacks_set_send_callback</tt><big>(</big><a class="reference internal" href="#c.nghttp2_session_callbacks" title="nghttp2_session_callbacks">nghttp2_session_callbacks</a><em>&nbsp;*cbs</em>, <a class="reference internal" href="#c.nghttp2_send_callback" title="nghttp2_send_callback">nghttp2_send_callback</a><em>&nbsp;send_callback</em><big>)</big><a class="headerlink" href="#c.nghttp2_session_callbacks_set_send_callback" title="Permalink to this definition"></a></dt>
<dd><p>Sets callback function invoked when a session wants to send data to
the remote peer. This callback is not necessary if the application
uses solely <a class="reference internal" href="#c.nghttp2_session_mem_send" title="nghttp2_session_mem_send"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_mem_send()</span></tt></a> to serialize data to
transmit.</p>
</dd></dl>
<dl class="function">
<dt id="c.nghttp2_session_callbacks_set_recv_callback">
void <tt class="descname">nghttp2_session_callbacks_set_recv_callback</tt><big>(</big><a class="reference internal" href="#c.nghttp2_session_callbacks" title="nghttp2_session_callbacks">nghttp2_session_callbacks</a><em>&nbsp;*cbs</em>, <a class="reference internal" href="#c.nghttp2_recv_callback" title="nghttp2_recv_callback">nghttp2_recv_callback</a><em>&nbsp;recv_callback</em><big>)</big><a class="headerlink" href="#c.nghttp2_session_callbacks_set_recv_callback" title="Permalink to this definition"></a></dt>
<dd><p>Sets callback function invoked when the a session wants to receive
data from the remote peer. This callback is not necessary if the
application uses solely <a class="reference internal" href="#c.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> to process
received data.</p>
</dd></dl>
<dl class="function">
<dt id="c.nghttp2_session_callbacks_set_on_frame_recv_callback">
void <tt class="descname">nghttp2_session_callbacks_set_on_frame_recv_callback</tt><big>(</big><a class="reference internal" href="#c.nghttp2_session_callbacks" title="nghttp2_session_callbacks">nghttp2_session_callbacks</a><em>&nbsp;*cbs</em>, <a class="reference internal" href="#c.nghttp2_on_frame_recv_callback" title="nghttp2_on_frame_recv_callback">nghttp2_on_frame_recv_callback</a><em>&nbsp;on_frame_recv_callback</em><big>)</big><a class="headerlink" href="#c.nghttp2_session_callbacks_set_on_frame_recv_callback" title="Permalink to this definition"></a></dt>
<dd><p>Sets callback function invoked by <a class="reference internal" href="#c.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
frame is received.</p>
</dd></dl>
<dl class="function">
<dt id="c.nghttp2_session_callbacks_set_on_invalid_frame_recv_callback">
void <tt class="descname">nghttp2_session_callbacks_set_on_invalid_frame_recv_callback</tt><big>(</big><a class="reference internal" href="#c.nghttp2_session_callbacks" title="nghttp2_session_callbacks">nghttp2_session_callbacks</a><em>&nbsp;*cbs</em>, <a class="reference internal" href="#c.nghttp2_on_invalid_frame_recv_callback" title="nghttp2_on_invalid_frame_recv_callback">nghttp2_on_invalid_frame_recv_callback</a><em>&nbsp;on_invalid_frame_recv_callback</em><big>)</big><a class="headerlink" href="#c.nghttp2_session_callbacks_set_on_invalid_frame_recv_callback" title="Permalink to this definition"></a></dt>
<dd><p>Sets callback function invoked by <a class="reference internal" href="#c.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="function">
<dt id="c.nghttp2_session_callbacks_set_on_data_chunk_recv_callback">
void <tt class="descname">nghttp2_session_callbacks_set_on_data_chunk_recv_callback</tt><big>(</big><a class="reference internal" href="#c.nghttp2_session_callbacks" title="nghttp2_session_callbacks">nghttp2_session_callbacks</a><em>&nbsp;*cbs</em>, <a class="reference internal" href="#c.nghttp2_on_data_chunk_recv_callback" title="nghttp2_on_data_chunk_recv_callback">nghttp2_on_data_chunk_recv_callback</a><em>&nbsp;on_data_chunk_recv_callback</em><big>)</big><a class="headerlink" href="#c.nghttp2_session_callbacks_set_on_data_chunk_recv_callback" title="Permalink to this definition"></a></dt>
<dd><p>Sets callback function invoked when a chunk of data in DATA frame
is received.</p>
</dd></dl>
<dl class="function">
<dt id="c.nghttp2_session_callbacks_set_before_frame_send_callback">
void <tt class="descname">nghttp2_session_callbacks_set_before_frame_send_callback</tt><big>(</big><a class="reference internal" href="#c.nghttp2_session_callbacks" title="nghttp2_session_callbacks">nghttp2_session_callbacks</a><em>&nbsp;*cbs</em>, <a class="reference internal" href="#c.nghttp2_before_frame_send_callback" title="nghttp2_before_frame_send_callback">nghttp2_before_frame_send_callback</a><em>&nbsp;before_frame_send_callback</em><big>)</big><a class="headerlink" href="#c.nghttp2_session_callbacks_set_before_frame_send_callback" title="Permalink to this definition"></a></dt>
<dd><p>Sets callback function invoked before a non-DATA frame is sent.</p>
</dd></dl>
<dl class="function">
<dt id="c.nghttp2_session_callbacks_set_on_frame_send_callback">
void <tt class="descname">nghttp2_session_callbacks_set_on_frame_send_callback</tt><big>(</big><a class="reference internal" href="#c.nghttp2_session_callbacks" title="nghttp2_session_callbacks">nghttp2_session_callbacks</a><em>&nbsp;*cbs</em>, <a class="reference internal" href="#c.nghttp2_on_frame_send_callback" title="nghttp2_on_frame_send_callback">nghttp2_on_frame_send_callback</a><em>&nbsp;on_frame_send_callback</em><big>)</big><a class="headerlink" href="#c.nghttp2_session_callbacks_set_on_frame_send_callback" title="Permalink to this definition"></a></dt>
<dd><p>Sets callback function invoked after a frame is sent.</p>
</dd></dl>
<dl class="function">
<dt id="c.nghttp2_session_callbacks_set_on_frame_not_send_callback">
void <tt class="descname">nghttp2_session_callbacks_set_on_frame_not_send_callback</tt><big>(</big><a class="reference internal" href="#c.nghttp2_session_callbacks" title="nghttp2_session_callbacks">nghttp2_session_callbacks</a><em>&nbsp;*cbs</em>, <a class="reference internal" href="#c.nghttp2_on_frame_not_send_callback" title="nghttp2_on_frame_not_send_callback">nghttp2_on_frame_not_send_callback</a><em>&nbsp;on_frame_not_send_callback</em><big>)</big><a class="headerlink" href="#c.nghttp2_session_callbacks_set_on_frame_not_send_callback" title="Permalink to this definition"></a></dt>
<dd><p>Sets callback function invoked when a non-DATA frame is not sent
because of an error.</p>
</dd></dl>
<dl class="function">
<dt id="c.nghttp2_session_callbacks_set_on_stream_close_callback">
void <tt class="descname">nghttp2_session_callbacks_set_on_stream_close_callback</tt><big>(</big><a class="reference internal" href="#c.nghttp2_session_callbacks" title="nghttp2_session_callbacks">nghttp2_session_callbacks</a><em>&nbsp;*cbs</em>, <a class="reference internal" href="#c.nghttp2_on_stream_close_callback" title="nghttp2_on_stream_close_callback">nghttp2_on_stream_close_callback</a><em>&nbsp;on_stream_close_callback</em><big>)</big><a class="headerlink" href="#c.nghttp2_session_callbacks_set_on_stream_close_callback" title="Permalink to this definition"></a></dt>
<dd><p>Sets callback function invoked when the stream is closed.</p>
</dd></dl>
<dl class="function">
<dt id="c.nghttp2_session_callbacks_set_on_begin_headers_callback">
void <tt class="descname">nghttp2_session_callbacks_set_on_begin_headers_callback</tt><big>(</big><a class="reference internal" href="#c.nghttp2_session_callbacks" title="nghttp2_session_callbacks">nghttp2_session_callbacks</a><em>&nbsp;*cbs</em>, <a class="reference internal" href="#c.nghttp2_on_begin_headers_callback" title="nghttp2_on_begin_headers_callback">nghttp2_on_begin_headers_callback</a><em>&nbsp;on_begin_headers_callback</em><big>)</big><a class="headerlink" href="#c.nghttp2_session_callbacks_set_on_begin_headers_callback" title="Permalink to this definition"></a></dt>
<dd><p>Sets callback function invoked when the reception of header block
in HEADERS or PUSH_PROMISE is started.</p>
</dd></dl>
<dl class="function">
<dt id="c.nghttp2_session_callbacks_set_on_header_callback">
void <tt class="descname">nghttp2_session_callbacks_set_on_header_callback</tt><big>(</big><a class="reference internal" href="#c.nghttp2_session_callbacks" title="nghttp2_session_callbacks">nghttp2_session_callbacks</a><em>&nbsp;*cbs</em>, <a class="reference internal" href="#c.nghttp2_on_header_callback" title="nghttp2_on_header_callback">nghttp2_on_header_callback</a><em>&nbsp;on_header_callback</em><big>)</big><a class="headerlink" href="#c.nghttp2_session_callbacks_set_on_header_callback" title="Permalink to this definition"></a></dt>
<dd><p>Sets callback function invoked when a header name/value pair is
received.</p>
</dd></dl>
<dl class="function">
<dt id="c.nghttp2_session_callbacks_set_select_padding_callback">
void <tt class="descname">nghttp2_session_callbacks_set_select_padding_callback</tt><big>(</big><a class="reference internal" href="#c.nghttp2_session_callbacks" title="nghttp2_session_callbacks">nghttp2_session_callbacks</a><em>&nbsp;*cbs</em>, <a class="reference internal" href="#c.nghttp2_select_padding_callback" title="nghttp2_select_padding_callback">nghttp2_select_padding_callback</a><em>&nbsp;select_padding_callback</em><big>)</big><a class="headerlink" href="#c.nghttp2_session_callbacks_set_select_padding_callback" title="Permalink to this definition"></a></dt>
<dd><p>Sets callback function invoked when the library asks application
how many padding bytes are required for the transmission of the
given frame.</p>
</dd></dl>
<dl class="function">
<dt id="c.nghttp2_session_callbacks_set_data_source_read_length_callback">
void <tt class="descname">nghttp2_session_callbacks_set_data_source_read_length_callback</tt><big>(</big><a class="reference internal" href="#c.nghttp2_session_callbacks" title="nghttp2_session_callbacks">nghttp2_session_callbacks</a><em>&nbsp;*cbs</em>, <a class="reference internal" href="#c.nghttp2_data_source_read_length_callback" title="nghttp2_data_source_read_length_callback">nghttp2_data_source_read_length_callback</a><em>&nbsp;data_source_read_length_callback</em><big>)</big><a class="headerlink" href="#c.nghttp2_session_callbacks_set_data_source_read_length_callback" title="Permalink to this definition"></a></dt>
<dd><p>Sets callback function determine the length allowed in
<a class="reference internal" href="#c.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>
</dd></dl>
<dl class="function">
<dt id="c.nghttp2_session_callbacks_set_on_begin_frame_callback">
void <tt class="descname">nghttp2_session_callbacks_set_on_begin_frame_callback</tt><big>(</big><a class="reference internal" href="#c.nghttp2_session_callbacks" title="nghttp2_session_callbacks">nghttp2_session_callbacks</a><em>&nbsp;*cbs</em>, <a class="reference internal" href="#c.nghttp2_on_begin_frame_callback" title="nghttp2_on_begin_frame_callback">nghttp2_on_begin_frame_callback</a><em>&nbsp;on_begin_frame_callback</em><big>)</big><a class="headerlink" href="#c.nghttp2_session_callbacks_set_on_begin_frame_callback" title="Permalink to this definition"></a></dt>
<dd><p>Sets callback function invoked when a frame header is received.</p>
</dd></dl>
<dl class="function">
<dt id="c.nghttp2_option_new">
int <tt class="descname">nghttp2_option_new</tt><big>(</big><a class="reference internal" href="#c.nghttp2_option" title="nghttp2_option">nghttp2_option</a><em>&nbsp;**option_ptr</em><big>)</big><a class="headerlink" href="#c.nghttp2_option_new" title="Permalink to this definition"></a></dt>
<dd><p>Initializes <em>*option_ptr</em> with default values.</p>
<p>When the application finished using this object, it can use
<a class="reference internal" href="#c.nghttp2_option_del" title="nghttp2_option_del"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_option_del()</span></tt></a> to free its memory.</p>
<p>This function returns 0 if it succeeds, or one of the following
negative error codes:</p>
<dl class="docutils">
<dt><a class="reference internal" href="#c.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="c.nghttp2_option_del">
void <tt class="descname">nghttp2_option_del</tt><big>(</big><a class="reference internal" href="#c.nghttp2_option" title="nghttp2_option">nghttp2_option</a><em>&nbsp;*option</em><big>)</big><a class="headerlink" href="#c.nghttp2_option_del" title="Permalink to this definition"></a></dt>
<dd><p>Frees any resources allocated for <em>option</em>. If <em>option</em> is
<tt class="docutils literal"><span class="pre">NULL</span></tt>, this function does nothing.</p>
</dd></dl>
<dl class="function">
<dt id="c.nghttp2_option_set_no_auto_window_update">
void <tt class="descname">nghttp2_option_set_no_auto_window_update</tt><big>(</big><a class="reference internal" href="#c.nghttp2_option" title="nghttp2_option">nghttp2_option</a><em>&nbsp;*option</em>, int<em>&nbsp;val</em><big>)</big><a class="headerlink" href="#c.nghttp2_option_set_no_auto_window_update" title="Permalink to this definition"></a></dt>
<dd><p>This option prevents the library from sending WINDOW_UPDATE for a
connection automatically. If this option is set to nonzero, the
library won't send WINDOW_UPDATE for DATA until application calls
<a class="reference internal" href="#c.nghttp2_session_consume" title="nghttp2_session_consume"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_consume()</span></tt></a> to indicate the consumed amount of
data. Don't use <a class="reference internal" href="#c.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> for this purpose.
By default, this option is set to zero.</p>
</dd></dl>
<dl class="function">
<dt id="c.nghttp2_option_set_peer_max_concurrent_streams">
void <tt class="descname">nghttp2_option_set_peer_max_concurrent_streams</tt><big>(</big><a class="reference internal" href="#c.nghttp2_option" title="nghttp2_option">nghttp2_option</a><em>&nbsp;*option</em>, uint32_t<em>&nbsp;val</em><big>)</big><a class="headerlink" href="#c.nghttp2_option_set_peer_max_concurrent_streams" title="Permalink to this definition"></a></dt>
<dd><p>This option sets the SETTINGS_MAX_CONCURRENT_STREAMS value of
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>
<dl class="function">
<dt id="c.nghttp2_option_set_recv_client_preface">
void <tt class="descname">nghttp2_option_set_recv_client_preface</tt><big>(</big><a class="reference internal" href="#c.nghttp2_option" title="nghttp2_option">nghttp2_option</a><em>&nbsp;*option</em>, int<em>&nbsp;val</em><big>)</big><a class="headerlink" href="#c.nghttp2_option_set_recv_client_preface" title="Permalink to this definition"></a></dt>
<dd><p>By default, nghttp2 library only handles HTTP/2 frames and does not
recognize first 24 bytes of client connection preface. This design
choice is done due to the fact that server may want to detect the
application protocol based on first few bytes on clear text
communication. But for simple servers which only speak HTTP/2, it
is easier for developers if nghttp2 library takes care of client
connection preface.</p>
<p>If this option is used with nonzero <em>val</em>, nghttp2 library checks
first 24 bytes client connection preface. If it is not a valid
one, <a class="reference internal" href="#c.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="#c.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> will
return error <a class="reference internal" href="#c.NGHTTP2_ERR_BAD_PREFACE" title="NGHTTP2_ERR_BAD_PREFACE"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_ERR_BAD_PREFACE</span></tt></a>, which is fatal error.</p>
</dd></dl>
<dl class="function">
<dt id="c.nghttp2_option_set_no_http_messaging">
void <tt class="descname">nghttp2_option_set_no_http_messaging</tt><big>(</big><a class="reference internal" href="#c.nghttp2_option" title="nghttp2_option">nghttp2_option</a><em>&nbsp;*option</em>, int<em>&nbsp;val</em><big>)</big><a class="headerlink" href="#c.nghttp2_option_set_no_http_messaging" title="Permalink to this definition"></a></dt>
<dd><p>By default, nghttp2 library enforces subset of HTTP Messaging rules
described in <a class="reference external" href="https://tools.ietf.org/html/draft-ietf-httpbis-http2-17#section-8">HTTP/2 specification, section 8</a>.
See <a class="reference internal" href="#http-messaging">HTTP Messaging</a> section for details. For those applications
who use nghttp2 library as non-HTTP use, give nonzero to <em>val</em> to
disable this enforcement.</p>
</dd></dl>
<dl class="function">
<dt id="c.nghttp2_session_client_new">
int <tt class="descname">nghttp2_session_client_new</tt><big>(</big><a class="reference internal" href="#c.nghttp2_session" title="nghttp2_session">nghttp2_session</a><em>&nbsp;**session_ptr</em>, const <a class="reference internal" href="#c.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="#c.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>. The <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="#c.nghttp2_send_callback" title="nghttp2_send_callback"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_send_callback</span></tt></a> must be specified. If the
application code uses <a class="reference internal" href="#c.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="#c.nghttp2_recv_callback" title="nghttp2_recv_callback"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_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>If this function fails, <em>*session_ptr</em> is left untouched.</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="#c.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="c.nghttp2_session_server_new">
int <tt class="descname">nghttp2_session_server_new</tt><big>(</big><a class="reference internal" href="#c.nghttp2_session" title="nghttp2_session">nghttp2_session</a><em>&nbsp;**session_ptr</em>, const <a class="reference internal" href="#c.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="#c.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>. The <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="#c.nghttp2_send_callback" title="nghttp2_send_callback"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_send_callback</span></tt></a> must be specified. If the
application code uses <a class="reference internal" href="#c.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="#c.nghttp2_recv_callback" title="nghttp2_recv_callback"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_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>If this function fails, <em>*session_ptr</em> is left untouched.</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="#c.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="c.nghttp2_session_client_new2">
int <tt class="descname">nghttp2_session_client_new2</tt><big>(</big><a class="reference internal" href="#c.nghttp2_session" title="nghttp2_session">nghttp2_session</a><em>&nbsp;**session_ptr</em>, const <a class="reference internal" href="#c.nghttp2_session_callbacks" title="nghttp2_session_callbacks">nghttp2_session_callbacks</a><em>&nbsp;*callbacks</em>, void<em>&nbsp;*user_data</em>, const <a class="reference internal" href="#c.nghttp2_option" title="nghttp2_option">nghttp2_option</a><em>&nbsp;*option</em><big>)</big><a class="headerlink" href="#c.nghttp2_session_client_new2" title="Permalink to this definition"></a></dt>
<dd><p>Like <a class="reference internal" href="#c.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>option</em>.</p>
<p>The <em>option</em> can be <tt class="docutils literal"><span class="pre">NULL</span></tt> and the call is equivalent to
<a class="reference internal" href="#c.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 does not take ownership <em>option</em>. The application is
responsible for freeing <em>option</em> if it finishes using the object.</p>
<p>The library code does not refer to <em>option</em> after this function
returns.</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="#c.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="c.nghttp2_session_server_new2">
int <tt class="descname">nghttp2_session_server_new2</tt><big>(</big><a class="reference internal" href="#c.nghttp2_session" title="nghttp2_session">nghttp2_session</a><em>&nbsp;**session_ptr</em>, const <a class="reference internal" href="#c.nghttp2_session_callbacks" title="nghttp2_session_callbacks">nghttp2_session_callbacks</a><em>&nbsp;*callbacks</em>, void<em>&nbsp;*user_data</em>, const <a class="reference internal" href="#c.nghttp2_option" title="nghttp2_option">nghttp2_option</a><em>&nbsp;*option</em><big>)</big><a class="headerlink" href="#c.nghttp2_session_server_new2" title="Permalink to this definition"></a></dt>
<dd><p>Like <a class="reference internal" href="#c.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>option</em>.</p>
<p>The <em>option</em> can be <tt class="docutils literal"><span class="pre">NULL</span></tt> and the call is equivalent to
<a class="reference internal" href="#c.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>
<p>This function does not take ownership <em>option</em>. The application is
responsible for freeing <em>option</em> if it finishes using the object.</p>
<p>The library code does not refer to <em>option</em> after this function
returns.</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="#c.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="c.nghttp2_session_client_new3">
int <tt class="descname">nghttp2_session_client_new3</tt><big>(</big><a class="reference internal" href="#c.nghttp2_session" title="nghttp2_session">nghttp2_session</a><em>&nbsp;**session_ptr</em>, const <a class="reference internal" href="#c.nghttp2_session_callbacks" title="nghttp2_session_callbacks">nghttp2_session_callbacks</a><em>&nbsp;*callbacks</em>, void<em>&nbsp;*user_data</em>, const <a class="reference internal" href="#c.nghttp2_option" title="nghttp2_option">nghttp2_option</a><em>&nbsp;*option</em>, <a class="reference internal" href="#c.nghttp2_mem" title="nghttp2_mem">nghttp2_mem</a><em>&nbsp;*mem</em><big>)</big><a class="headerlink" href="#c.nghttp2_session_client_new3" title="Permalink to this definition"></a></dt>
<dd><p>Like <a class="reference internal" href="#c.nghttp2_session_client_new2" title="nghttp2_session_client_new2"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_client_new2()</span></tt></a>, but with additional custom
memory allocator specified in the <em>mem</em>.</p>
<p>The <em>mem</em> can be <tt class="docutils literal"><span class="pre">NULL</span></tt> and the call is equivalent to
<a class="reference internal" href="#c.nghttp2_session_client_new2" title="nghttp2_session_client_new2"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_client_new2()</span></tt></a>.</p>
<p>This function does not take ownership <em>mem</em>. The application is
responsible for freeing <em>mem</em>.</p>
<p>The library code does not refer to <em>mem</em> pointer after this
function returns, so the application can safely free it.</p>
<p>This function returns 0 if it succeeds, or one of the following
negative error codes:</p>
<dl class="docutils">
<dt><a class="reference internal" href="#c.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="c.nghttp2_session_server_new3">
int <tt class="descname">nghttp2_session_server_new3</tt><big>(</big><a class="reference internal" href="#c.nghttp2_session" title="nghttp2_session">nghttp2_session</a><em>&nbsp;**session_ptr</em>, const <a class="reference internal" href="#c.nghttp2_session_callbacks" title="nghttp2_session_callbacks">nghttp2_session_callbacks</a><em>&nbsp;*callbacks</em>, void<em>&nbsp;*user_data</em>, const <a class="reference internal" href="#c.nghttp2_option" title="nghttp2_option">nghttp2_option</a><em>&nbsp;*option</em>, <a class="reference internal" href="#c.nghttp2_mem" title="nghttp2_mem">nghttp2_mem</a><em>&nbsp;*mem</em><big>)</big><a class="headerlink" href="#c.nghttp2_session_server_new3" title="Permalink to this definition"></a></dt>
<dd><p>Like <a class="reference internal" href="#c.nghttp2_session_server_new2" title="nghttp2_session_server_new2"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_server_new2()</span></tt></a>, but with additional custom
memory allocator specified in the <em>mem</em>.</p>
<p>The <em>mem</em> can be <tt class="docutils literal"><span class="pre">NULL</span></tt> and the call is equivalent to
<a class="reference internal" href="#c.nghttp2_session_server_new2" title="nghttp2_session_server_new2"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_server_new2()</span></tt></a>.</p>
<p>This function does not take ownership <em>mem</em>. The application is
responsible for freeing <em>mem</em>.</p>
<p>The library code does not refer to <em>mem</em> pointer after this
function returns, so the application can safely free it.</p>
<p>This function returns 0 if it succeeds, or one of the following
negative error codes:</p>
<dl class="docutils">
<dt><a class="reference internal" href="#c.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="c.nghttp2_session_del">
void <tt class="descname">nghttp2_session_del</tt><big>(</big><a class="reference internal" href="#c.nghttp2_session" title="nghttp2_session">nghttp2_session</a><em>&nbsp;*session</em><big>)</big><a class="headerlink" href="#c.nghttp2_session_del" title="Permalink to this definition"></a></dt>
<dd><p>Frees any resources allocated for <em>session</em>. If <em>session</em> is
<tt class="docutils literal"><span class="pre">NULL</span></tt>, this function does nothing.</p>
</dd></dl>
<dl class="function">
<dt id="c.nghttp2_session_send">
int <tt class="descname">nghttp2_session_send</tt><big>(</big><a class="reference internal" href="#c.nghttp2_session" title="nghttp2_session">nghttp2_session</a><em>&nbsp;*session</em><big>)</big><a class="headerlink" href="#c.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="#c.nghttp2_send_callback" title="nghttp2_send_callback"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_send_callback</span></tt></a> returns
<a class="reference internal" href="#c.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),
<a class="reference internal" href="#c.nghttp2_on_frame_not_send_callback" title="nghttp2_on_frame_not_send_callback"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_on_frame_not_send_callback</span></tt></a> is invoked. Abort
the following steps.</li>
<li>If the frame is HEADERS, PUSH_PROMISE or DATA,
<a class="reference internal" href="#c.nghttp2_select_padding_callback" title="nghttp2_select_padding_callback"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_select_padding_callback</span></tt></a> is invoked.</li>
<li>If the frame is request HEADERS, the stream is opened here.</li>
<li><a class="reference internal" href="#c.nghttp2_before_frame_send_callback" title="nghttp2_before_frame_send_callback"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_before_frame_send_callback</span></tt></a> is invoked.</li>
<li><a class="reference internal" href="#c.nghttp2_send_callback" title="nghttp2_send_callback"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_send_callback</span></tt></a> is invoked one or more times to
send the frame.</li>
<li><a class="reference internal" href="#c.nghttp2_on_frame_send_callback" title="nghttp2_on_frame_send_callback"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_on_frame_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="#c.nghttp2_on_stream_close_callback" title="nghttp2_on_stream_close_callback"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_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="#c.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="#c.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="c.nghttp2_session_mem_send">
ssize_t <tt class="descname">nghttp2_session_mem_send</tt><big>(</big><a class="reference internal" href="#c.nghttp2_session" title="nghttp2_session">nghttp2_session</a><em>&nbsp;*session</em>, const uint8_t<em>&nbsp;**data_ptr</em><big>)</big><a class="headerlink" href="#c.nghttp2_session_mem_send" title="Permalink to this definition"></a></dt>
<dd><p>Returns the serialized data to send.</p>
<p>This function behaves like <a class="reference internal" href="#c.nghttp2_session_send" title="nghttp2_session_send"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_send()</span></tt></a> except that it
does not use <a class="reference internal" href="#c.nghttp2_send_callback" title="nghttp2_send_callback"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_send_callback</span></tt></a> to transmit data.
Instead, it assigns the pointer to the serialized data to the
<em>*data_ptr</em> and returns its length. The other callbacks are called
in the same way as they are in <a class="reference internal" href="#c.nghttp2_session_send" title="nghttp2_session_send"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_send()</span></tt></a>.</p>
<p>If no data is available to send, this function returns 0.</p>
<p>This function may not return all serialized data in one invocation.
To get all data, call this function repeatedly until it returns 0
or one of negative error codes.</p>
<p>The assigned <em>*data_ptr</em> is valid until the next call of
<a class="reference internal" href="#c.nghttp2_session_mem_send" title="nghttp2_session_mem_send"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_mem_send()</span></tt></a> or <a class="reference internal" href="#c.nghttp2_session_send" title="nghttp2_session_send"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_send()</span></tt></a>.</p>
<p>The caller must send all data before sending the next chunk of
data.</p>
<p>This function returns the length of the data pointed by the
<em>*data_ptr</em> if it succeeds, or one of the following negative error
codes:</p>
<dl class="docutils">
<dt><a class="reference internal" href="#c.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="c.nghttp2_session_recv">
int <tt class="descname">nghttp2_session_recv</tt><big>(</big><a class="reference internal" href="#c.nghttp2_session" title="nghttp2_session">nghttp2_session</a><em>&nbsp;*session</em><big>)</big><a class="headerlink" href="#c.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="#c.nghttp2_recv_callback" title="nghttp2_recv_callback"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_recv_callback</span></tt></a> returns
<a class="reference internal" href="#c.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="#c.nghttp2_recv_callback" title="nghttp2_recv_callback"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_recv_callback</span></tt></a> is invoked one or more times to
receive frame header.</li>
<li>When frame header is received,
<a class="reference internal" href="#c.nghttp2_on_begin_frame_callback" title="nghttp2_on_begin_frame_callback"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_on_begin_frame_callback</span></tt></a> is invoked.</li>
<li>If the frame is DATA frame:<ol class="arabic">
<li><a class="reference internal" href="#c.nghttp2_recv_callback" title="nghttp2_recv_callback"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_recv_callback</span></tt></a> is invoked to receive DATA
payload. For each chunk of data,
<a class="reference internal" href="#c.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> is invoked.</li>
<li>If one DATA frame is completely received,
<a class="reference internal" href="#c.nghttp2_on_frame_recv_callback" title="nghttp2_on_frame_recv_callback"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_on_frame_recv_callback</span></tt></a> is invoked. If the
reception of the frame triggers the closure of the stream,
<a class="reference internal" href="#c.nghttp2_on_stream_close_callback" title="nghttp2_on_stream_close_callback"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_on_stream_close_callback</span></tt></a> is invoked.</li>
</ol>
</li>
<li>If the frame is the control frame:<ol class="arabic">
<li><a class="reference internal" href="#c.nghttp2_recv_callback" title="nghttp2_recv_callback"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_recv_callback</span></tt></a> is invoked one or more times to
receive whole frame.</li>
<li>If the received frame is valid, then following actions are
taken. If the frame is either HEADERS or PUSH_PROMISE,
<a class="reference internal" href="#c.nghttp2_on_begin_headers_callback" title="nghttp2_on_begin_headers_callback"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_on_begin_headers_callback</span></tt></a> is invoked. Then
<a class="reference internal" href="#c.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> is invoked for each header
name/value pair. After all name/value pairs are emitted
successfully, <a class="reference internal" href="#c.nghttp2_on_frame_recv_callback" title="nghttp2_on_frame_recv_callback"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_on_frame_recv_callback</span></tt></a> is
invoked. For other frames,
<a class="reference internal" href="#c.nghttp2_on_frame_recv_callback" title="nghttp2_on_frame_recv_callback"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_on_frame_recv_callback</span></tt></a> is invoked. If the
reception of the frame triggers the closure of the stream,
<a class="reference internal" href="#c.nghttp2_on_stream_close_callback" title="nghttp2_on_stream_close_callback"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_on_stream_close_callback</span></tt></a> is invoked.</li>
<li>If the received frame is unpacked but is interpreted as
invalid, <a class="reference internal" href="#c.nghttp2_on_invalid_frame_recv_callback" title="nghttp2_on_invalid_frame_recv_callback"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_on_invalid_frame_recv_callback</span></tt></a> is
invoked.</li>
</ol>
</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="#c.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="#c.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="#c.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>
<dt><a class="reference internal" href="#c.NGHTTP2_ERR_BAD_PREFACE" title="NGHTTP2_ERR_BAD_PREFACE"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_ERR_BAD_PREFACE</span></tt></a></dt>
<dd>Invalid client preface was detected. This error only returns
when <em>session</em> was configured as server and
<a class="reference internal" href="#c.nghttp2_option_set_recv_client_preface" title="nghttp2_option_set_recv_client_preface"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_option_set_recv_client_preface()</span></tt></a> is used.</dd>
</dl>
</dd></dl>
<dl class="function">
<dt id="c.nghttp2_session_mem_recv">
ssize_t <tt class="descname">nghttp2_session_mem_recv</tt><big>(</big><a class="reference internal" href="#c.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="#c.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="#c.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="#c.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 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="#c.nghttp2_session_recv" title="nghttp2_session_recv"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_recv()</span></tt></a>.</p>
<p>In the current implementation, this function always tries to
processes all input data unless either an error occurs or
<a class="reference internal" href="#c.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
<a class="reference internal" href="#c.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> or
<a class="reference internal" href="#c.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>. If
<a class="reference internal" href="#c.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>
<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="#c.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="#c.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>
<dt><a class="reference internal" href="#c.NGHTTP2_ERR_BAD_PREFACE" title="NGHTTP2_ERR_BAD_PREFACE"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_ERR_BAD_PREFACE</span></tt></a></dt>
<dd>Invalid client preface was detected. This error only returns
when <em>session</em> was configured as server and
<a class="reference internal" href="#c.nghttp2_option_set_recv_client_preface" title="nghttp2_option_set_recv_client_preface"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_option_set_recv_client_preface()</span></tt></a> is used.</dd>
</dl>
</dd></dl>
<dl class="function">
<dt id="c.nghttp2_session_resume_data">
int <tt class="descname">nghttp2_session_resume_data</tt><big>(</big><a class="reference internal" href="#c.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="#c.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="#c.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="#c.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="c.nghttp2_session_want_read">
int <tt class="descname">nghttp2_session_want_read</tt><big>(</big><a class="reference internal" href="#c.nghttp2_session" title="nghttp2_session">nghttp2_session</a><em>&nbsp;*session</em><big>)</big><a class="headerlink" href="#c.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="#c.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="#c.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="c.nghttp2_session_want_write">
int <tt class="descname">nghttp2_session_want_write</tt><big>(</big><a class="reference internal" href="#c.nghttp2_session" title="nghttp2_session">nghttp2_session</a><em>&nbsp;*session</em><big>)</big><a class="headerlink" href="#c.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="#c.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="#c.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="c.nghttp2_session_get_stream_user_data">
void *<tt class="descname">nghttp2_session_get_stream_user_data</tt><big>(</big><a class="reference internal" href="#c.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="#c.nghttp2_session_get_stream_user_data" title="Permalink to this definition"></a></dt>
<dd><p>Returns stream_user_data for the stream <em>stream_id</em>. The
stream_user_data is provided by <a class="reference internal" href="#c.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="#c.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="#c.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="#c.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="c.nghttp2_session_set_stream_user_data">
int <tt class="descname">nghttp2_session_set_stream_user_data</tt><big>(</big><a class="reference internal" href="#c.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="#c.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>
<p>It is valid to set the <em>stream_user_data</em> to the stream reserved by
PUSH_PROMISE frame.</p>
<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="#c.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>
</dd></dl>
<dl class="function">
<dt id="c.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="#c.nghttp2_session" title="nghttp2_session">nghttp2_session</a><em>&nbsp;*session</em><big>)</big><a class="headerlink" href="#c.nghttp2_session_get_outbound_queue_size" title="Permalink to this definition"></a></dt>
<dd><p>Returns the number of frames in the outbound queue. This does not
include the deferred DATA frames.</p>
</dd></dl>
<dl class="function">
<dt id="c.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="#c.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="#c.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="#c.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="#c.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>This function returns -1 if it fails.</p>
</dd></dl>
<dl class="function">
<dt id="c.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="#c.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="#c.nghttp2_session_get_stream_effective_local_window_size" title="Permalink to this definition"></a></dt>
<dd><p>Returns the local (receive) window size for the stream <em>stream_id</em>.
The local window size can be adjusted by
<a class="reference internal" href="#c.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="c.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="#c.nghttp2_session" title="nghttp2_session">nghttp2_session</a><em>&nbsp;*session</em><big>)</big><a class="headerlink" href="#c.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="#c.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="#c.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>This function returns -1 if it fails.</p>
</dd></dl>
<dl class="function">
<dt id="c.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="#c.nghttp2_session" title="nghttp2_session">nghttp2_session</a><em>&nbsp;*session</em><big>)</big><a class="headerlink" href="#c.nghttp2_session_get_effective_local_window_size" title="Permalink to this definition"></a></dt>
<dd><p>Returns the local (receive) window size for a connection. The
local window size can be adjusted by
<a class="reference internal" href="#c.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="c.nghttp2_session_get_stream_remote_window_size">
int32_t <tt class="descname">nghttp2_session_get_stream_remote_window_size</tt><big>(</big><a class="reference internal" href="#c.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="#c.nghttp2_session_get_stream_remote_window_size" title="Permalink to this definition"></a></dt>
<dd><p>Returns the remote window size for a given stream <em>stream_id</em>.</p>
<p>This is the amount of flow-controlled payload (e.g., DATA) that the
local endpoint can send without stream level WINDOW_UPDATE. There
is also connection level flow control, so the effective size of
payload that the local endpoint can actually send is
min(<a class="reference internal" href="#c.nghttp2_session_get_stream_remote_window_size" title="nghttp2_session_get_stream_remote_window_size"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_get_stream_remote_window_size()</span></tt></a>,
<a class="reference internal" href="#c.nghttp2_session_get_remote_window_size" title="nghttp2_session_get_remote_window_size"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_get_remote_window_size()</span></tt></a>).</p>
<p>This function returns -1 if it fails.</p>
</dd></dl>
<dl class="function">
<dt id="c.nghttp2_session_get_remote_window_size">
int32_t <tt class="descname">nghttp2_session_get_remote_window_size</tt><big>(</big><a class="reference internal" href="#c.nghttp2_session" title="nghttp2_session">nghttp2_session</a><em>&nbsp;*session</em><big>)</big><a class="headerlink" href="#c.nghttp2_session_get_remote_window_size" title="Permalink to this definition"></a></dt>
<dd><p>Returns the remote window size for a connection.</p>
<p>This function always succeeds.</p>
</dd></dl>
<dl class="function">
<dt id="c.nghttp2_session_get_stream_local_close">
int <tt class="descname">nghttp2_session_get_stream_local_close</tt><big>(</big><a class="reference internal" href="#c.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="#c.nghttp2_session_get_stream_local_close" title="Permalink to this definition"></a></dt>
<dd><p>Returns 1 if local peer half closed the given stream <em>stream_id</em>.
Returns 0 if it did not. Returns -1 if no such stream exists.</p>
</dd></dl>
<dl class="function">
<dt id="c.nghttp2_session_get_stream_remote_close">
int <tt class="descname">nghttp2_session_get_stream_remote_close</tt><big>(</big><a class="reference internal" href="#c.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="#c.nghttp2_session_get_stream_remote_close" title="Permalink to this definition"></a></dt>
<dd><p>Returns 1 if remote peer half closed the given stream <em>stream_id</em>.
Returns 0 if it did not. Returns -1 if no such stream exists.</p>
</dd></dl>
<dl class="function">
<dt id="c.nghttp2_session_terminate_session">
int <tt class="descname">nghttp2_session_terminate_session</tt><big>(</big><a class="reference internal" href="#c.nghttp2_session" title="nghttp2_session">nghttp2_session</a><em>&nbsp;*session</em>, uint32_t<em>&nbsp;error_code</em><big>)</big><a class="headerlink" href="#c.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>The last stream ID is the minimum value between the stream ID of a
stream for which <a class="reference internal" href="#c.nghttp2_on_frame_recv_callback" title="nghttp2_on_frame_recv_callback"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_on_frame_recv_callback</span></tt></a> was called
most recently and the last stream ID we have sent to the peer
previously.</p>
<p>The <em>error_code</em> is the error code of this GOAWAY frame. The
pre-defined error code is one of <a class="reference internal" href="#c.nghttp2_error_code" title="nghttp2_error_code"><tt class="xref c c-macro docutils literal"><span class="pre">nghttp2_error_code</span></tt></a>.</p>
<p>After the transmission, both <a class="reference internal" href="#c.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="#c.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.</p>
<p>This function should be called when the connection should be
terminated after sending GOAWAY. If the remaining streams should
be processed after GOAWAY, use <a class="reference internal" href="#c.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="#c.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="c.nghttp2_session_terminate_session2">
int <tt class="descname">nghttp2_session_terminate_session2</tt><big>(</big><a class="reference internal" href="#c.nghttp2_session" title="nghttp2_session">nghttp2_session</a><em>&nbsp;*session</em>, int32_t<em>&nbsp;last_stream_id</em>, uint32_t<em>&nbsp;error_code</em><big>)</big><a class="headerlink" href="#c.nghttp2_session_terminate_session2" title="Permalink to this definition"></a></dt>
<dd><p>Signals the session so that the connection should be terminated.</p>
<p>This function behaves like <a class="reference internal" href="#c.nghttp2_session_terminate_session" title="nghttp2_session_terminate_session"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_terminate_session()</span></tt></a>,
but the last stream ID can be specified by the application for fine
grained control of stream. The HTTP/2 specification does not allow
last_stream_id to be increased. So the actual value sent as
last_stream_id is the minimum value between the given
<em>last_stream_id</em> and the last_stream_id we have previously sent to
the peer.</p>
<p>The <em>last_stream_id</em> is peer's stream ID or 0. So if <em>session</em> is
initialized as client, <em>last_stream_id</em> must be even or 0. If
<em>session</em> is initialized as server, <em>last_stream_id</em> must be odd or
0.</p>
<p>This function returns 0 if it succeeds, or one of the following
negative error codes:</p>
<dl class="docutils">
<dt><a class="reference internal" href="#c.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="#c.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>last_stream_id</em> is invalid.</dd>
</dl>
</dd></dl>
<dl class="function">
<dt id="c.nghttp2_submit_shutdown_notice">
int <tt class="descname">nghttp2_submit_shutdown_notice</tt><big>(</big><a class="reference internal" href="#c.nghttp2_session" title="nghttp2_session">nghttp2_session</a><em>&nbsp;*session</em><big>)</big><a class="headerlink" href="#c.nghttp2_submit_shutdown_notice" title="Permalink to this definition"></a></dt>
<dd><p>Signals to the client that the server started graceful shutdown
procedure.</p>
<p>This function is only usable for server. If this function is
called with client side session, this function returns
<a class="reference internal" href="#c.NGHTTP2_ERR_INVALID_STATE" title="NGHTTP2_ERR_INVALID_STATE"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_ERR_INVALID_STATE</span></tt></a>.</p>
<p>To gracefully shutdown HTTP/2 session, server should call this
function to send GOAWAY with last_stream_id (1u &lt;&lt; 31) - 1. And
after some delay (e.g., 1 RTT), send another GOAWAY with the stream
ID that the server has some processing using
<a class="reference internal" href="#c.nghttp2_submit_goaway" title="nghttp2_submit_goaway"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_submit_goaway()</span></tt></a>. See also
<a class="reference internal" href="#c.nghttp2_session_get_last_proc_stream_id" title="nghttp2_session_get_last_proc_stream_id"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_get_last_proc_stream_id()</span></tt></a>.</p>
<p>Unlike <a class="reference internal" href="#c.nghttp2_submit_goaway" title="nghttp2_submit_goaway"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_submit_goaway()</span></tt></a>, this function just sends GOAWAY
and does nothing more. This is a mere indication to the client
that session shutdown is imminent. The application should call
<a class="reference internal" href="#c.nghttp2_submit_goaway" title="nghttp2_submit_goaway"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_submit_goaway()</span></tt></a> with appropriate last_stream_id after
this call.</p>
<p>If one or more GOAWAY frame have been already sent by either
<a class="reference internal" href="#c.nghttp2_submit_goaway" title="nghttp2_submit_goaway"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_submit_goaway()</span></tt></a> or <a class="reference internal" href="#c.nghttp2_session_terminate_session" title="nghttp2_session_terminate_session"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_terminate_session()</span></tt></a>,
this function has no effect.</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="#c.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="#c.NGHTTP2_ERR_INVALID_STATE" title="NGHTTP2_ERR_INVALID_STATE"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_ERR_INVALID_STATE</span></tt></a></dt>
<dd>The <em>session</em> is initialized as client.</dd>
</dl>
</dd></dl>
<dl class="function">
<dt id="c.nghttp2_session_get_remote_settings">
uint32_t <tt class="descname">nghttp2_session_get_remote_settings</tt><big>(</big><a class="reference internal" href="#c.nghttp2_session" title="nghttp2_session">nghttp2_session</a><em>&nbsp;*session</em>, <a class="reference internal" href="#c.nghttp2_settings_id" title="nghttp2_settings_id">nghttp2_settings_id</a><em>&nbsp;id</em><big>)</big><a class="headerlink" href="#c.nghttp2_session_get_remote_settings" title="Permalink to this definition"></a></dt>
<dd><p>Returns the value of SETTINGS <em>id</em> notified by a remote endpoint.
The <em>id</em> must be one of values defined in
<a class="reference internal" href="#c.nghttp2_settings_id" title="nghttp2_settings_id"><tt class="xref c c-macro docutils literal"><span class="pre">nghttp2_settings_id</span></tt></a>.</p>
</dd></dl>
<dl class="function">
<dt id="c.nghttp2_session_set_next_stream_id">
int <tt class="descname">nghttp2_session_set_next_stream_id</tt><big>(</big><a class="reference internal" href="#c.nghttp2_session" title="nghttp2_session">nghttp2_session</a><em>&nbsp;*session</em>, int32_t<em>&nbsp;next_stream_id</em><big>)</big><a class="headerlink" href="#c.nghttp2_session_set_next_stream_id" title="Permalink to this definition"></a></dt>
<dd><p>Tells the <em>session</em> that next stream ID is <em>next_stream_id</em>. The
<em>next_stream_id</em> must be equal or greater than the value returned
by <a class="reference internal" href="#c.nghttp2_session_get_next_stream_id" title="nghttp2_session_get_next_stream_id"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_get_next_stream_id()</span></tt></a>.</p>
<p>This function returns 0 if it succeeds, or one of the following
negative error codes:</p>
<dl class="docutils">
<dt><a class="reference internal" href="#c.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>next_stream_id</em> is strictly less than the value
<a class="reference internal" href="#c.nghttp2_session_get_next_stream_id" title="nghttp2_session_get_next_stream_id"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_get_next_stream_id()</span></tt></a> returns.</dd>
</dl>
</dd></dl>
<dl class="function">
<dt id="c.nghttp2_session_get_next_stream_id">
uint32_t <tt class="descname">nghttp2_session_get_next_stream_id</tt><big>(</big><a class="reference internal" href="#c.nghttp2_session" title="nghttp2_session">nghttp2_session</a><em>&nbsp;*session</em><big>)</big><a class="headerlink" href="#c.nghttp2_session_get_next_stream_id" title="Permalink to this definition"></a></dt>
<dd><p>Returns the next outgoing stream ID. Notice that return type is
uint32_t. If we run out of stream ID for this session, this
function returns 1 &lt;&lt; 31.</p>
</dd></dl>
<dl class="function">
<dt id="c.nghttp2_session_consume">
int <tt class="descname">nghttp2_session_consume</tt><big>(</big><a class="reference internal" href="#c.nghttp2_session" title="nghttp2_session">nghttp2_session</a><em>&nbsp;*session</em>, int32_t<em>&nbsp;stream_id</em>, size_t<em>&nbsp;size</em><big>)</big><a class="headerlink" href="#c.nghttp2_session_consume" title="Permalink to this definition"></a></dt>
<dd><p>Tells the <em>session</em> that <em>size</em> bytes for a stream denoted by
<em>stream_id</em> were consumed by application and are ready to
WINDOW_UPDATE. This function is intended to be used without
automatic window update (see
<a class="reference internal" href="#c.nghttp2_option_set_no_auto_window_update" title="nghttp2_option_set_no_auto_window_update"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_option_set_no_auto_window_update()</span></tt></a>).</p>
<p>This function returns 0 if it succeeds, or one of the following
negative error codes:</p>
<dl class="docutils">
<dt><a class="reference internal" href="#c.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="#c.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>stream_id</em> is 0.</dd>
<dt><a class="reference internal" href="#c.NGHTTP2_ERR_INVALID_STATE" title="NGHTTP2_ERR_INVALID_STATE"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_ERR_INVALID_STATE</span></tt></a></dt>
<dd>Automatic WINDOW_UPDATE is not disabled.</dd>
</dl>
</dd></dl>
<dl class="function">
<dt id="c.nghttp2_session_upgrade">
int <tt class="descname">nghttp2_session_upgrade</tt><big>(</big><a class="reference internal" href="#c.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="#c.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
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
<em>settings_payload</em>. The <em>settings_payload</em> is unpacked and its
setting values will be submitted using <a class="reference internal" href="#c.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 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
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>
<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="#c.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="#c.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="#c.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.</dd>
</dl>
</dd></dl>
<dl class="function">
<dt id="c.nghttp2_pack_settings_payload">
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="#c.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="#c.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
base64url encoded and the application is responsible for encoding.</p>
<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="#c.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>
<dt><a class="reference internal" href="#c.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>
</dl>
</dd></dl>
<dl class="function">
<dt id="c.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="#c.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="#c.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="c.nghttp2_priority_spec_init">
void <tt class="descname">nghttp2_priority_spec_init</tt><big>(</big><a class="reference internal" href="#c.nghttp2_priority_spec" title="nghttp2_priority_spec">nghttp2_priority_spec</a><em>&nbsp;*pri_spec</em>, int32_t<em>&nbsp;stream_id</em>, int32_t<em>&nbsp;weight</em>, int<em>&nbsp;exclusive</em><big>)</big><a class="headerlink" href="#c.nghttp2_priority_spec_init" title="Permalink to this definition"></a></dt>
<dd><p>Initializes <em>pri_spec</em> with the <em>stream_id</em> of the stream to depend
on with <em>weight</em> and its exclusive flag. If <em>exclusive</em> is
nonzero, exclusive flag is set.</p>
<p>The <em>weight</em> must be in [<a class="reference internal" href="#c.NGHTTP2_MIN_WEIGHT" title="NGHTTP2_MIN_WEIGHT"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_MIN_WEIGHT</span></tt></a>,
<a class="reference internal" href="#c.NGHTTP2_MAX_WEIGHT" title="NGHTTP2_MAX_WEIGHT"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_MAX_WEIGHT</span></tt></a>], inclusive.</p>
</dd></dl>
<dl class="function">
<dt id="c.nghttp2_priority_spec_default_init">
void <tt class="descname">nghttp2_priority_spec_default_init</tt><big>(</big><a class="reference internal" href="#c.nghttp2_priority_spec" title="nghttp2_priority_spec">nghttp2_priority_spec</a><em>&nbsp;*pri_spec</em><big>)</big><a class="headerlink" href="#c.nghttp2_priority_spec_default_init" title="Permalink to this definition"></a></dt>
<dd><p>Initializes <em>pri_spec</em> with the default values. The default values
are: stream_id = 0, weight = <a class="reference internal" href="#c.NGHTTP2_DEFAULT_WEIGHT" title="NGHTTP2_DEFAULT_WEIGHT"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_DEFAULT_WEIGHT</span></tt></a> and
exclusive = 0.</p>
</dd></dl>
<dl class="function">
<dt id="c.nghttp2_priority_spec_check_default">
int <tt class="descname">nghttp2_priority_spec_check_default</tt><big>(</big>const <a class="reference internal" href="#c.nghttp2_priority_spec" title="nghttp2_priority_spec">nghttp2_priority_spec</a><em>&nbsp;*pri_spec</em><big>)</big><a class="headerlink" href="#c.nghttp2_priority_spec_check_default" title="Permalink to this definition"></a></dt>
<dd><p>Returns nonzero if the <em>pri_spec</em> is filled with default values.</p>
</dd></dl>
<dl class="function">
<dt id="c.nghttp2_submit_request">
int32_t <tt class="descname">nghttp2_submit_request</tt><big>(</big><a class="reference internal" href="#c.nghttp2_session" title="nghttp2_session">nghttp2_session</a><em>&nbsp;*session</em>, const <a class="reference internal" href="#c.nghttp2_priority_spec" title="nghttp2_priority_spec">nghttp2_priority_spec</a><em>&nbsp;*pri_spec</em>, const <a class="reference internal" href="#c.nghttp2_nv" title="nghttp2_nv">nghttp2_nv</a><em>&nbsp;*nva</em>, size_t<em>&nbsp;nvlen</em>, const <a class="reference internal" href="#c.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="#c.nghttp2_submit_request" title="Permalink to this definition"></a></dt>
<dd><p>Submits HEADERS frame and optionally one or more DATA frames.</p>
<p>The <em>pri_spec</em> is priority specification of this request. <tt class="docutils literal"><span class="pre">NULL</span></tt>
means the default priority (see
<a class="reference internal" href="#c.nghttp2_priority_spec_default_init" title="nghttp2_priority_spec_default_init"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_priority_spec_default_init()</span></tt></a>). To specify the priority,
use <a class="reference internal" href="#c.nghttp2_priority_spec_init" title="nghttp2_priority_spec_init"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_priority_spec_init()</span></tt></a>. If <em>pri_spec</em> is not <tt class="docutils literal"><span class="pre">NULL</span></tt>,
this function will copy its data members.</p>
<p>The <tt class="xref c c-func docutils literal"><span class="pre">pri_spec-&gt;weight()</span></tt> must be in [<a class="reference internal" href="#c.NGHTTP2_MIN_WEIGHT" title="NGHTTP2_MIN_WEIGHT"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_MIN_WEIGHT</span></tt></a>,
<a class="reference internal" href="#c.NGHTTP2_MAX_WEIGHT" title="NGHTTP2_MAX_WEIGHT"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_MAX_WEIGHT</span></tt></a>], inclusive. If <tt class="xref c c-func docutils literal"><span class="pre">pri_spec-&gt;weight()</span></tt> is
strictly less than <a class="reference internal" href="#c.NGHTTP2_MIN_WEIGHT" title="NGHTTP2_MIN_WEIGHT"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_MIN_WEIGHT</span></tt></a>, it becomes
<a class="reference internal" href="#c.NGHTTP2_MIN_WEIGHT" title="NGHTTP2_MIN_WEIGHT"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_MIN_WEIGHT</span></tt></a>. If it is strictly greater than
<a class="reference internal" href="#c.NGHTTP2_MAX_WEIGHT" title="NGHTTP2_MAX_WEIGHT"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_MAX_WEIGHT</span></tt></a>, it becomes <a class="reference internal" href="#c.NGHTTP2_MAX_WEIGHT" title="NGHTTP2_MAX_WEIGHT"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_MAX_WEIGHT</span></tt></a>.</p>
<p>The <em>nva</em> is an array of name/value pair <a class="reference internal" href="#c.nghttp2_nv" title="nghttp2_nv"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_nv</span></tt></a> with
<em>nvlen</em> elements. The application is responsible to include
required pseudo-header fields (header field whose name starts with
&quot;:&quot;) in <em>nva</em> and must place pseudo-headers before regular header
fields.</p>
<p>This function creates copies of all name/value pairs in <em>nva</em>. It
also lower-cases all names in <em>nva</em>. The order of elements in
<em>nva</em> is preserved.</p>
<p>HTTP/2 specification has requirement about header fields in the
request HEADERS. See the specification for more details.</p>
<p>If <em>data_prd</em> is not <tt class="docutils literal"><span class="pre">NULL</span></tt>, it provides data which will be sent
in subsequent DATA frames. In this case, a method that allows
request message bodies
(<a class="reference external" href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html#sec9">http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html#sec9</a>) must
be specified with <tt class="docutils literal"><span class="pre">:method</span></tt> key in <em>nva</em> (e.g. <tt class="docutils literal"><span class="pre">POST</span></tt>). This
function does not take ownership of the <em>data_prd</em>. The function
copies the members of the <em>data_prd</em>. If <em>data_prd</em> is <tt class="docutils literal"><span class="pre">NULL</span></tt>,
HEADERS have END_STREAM set. The <em>stream_user_data</em> is data
associated to the stream opened by this request and can be an
arbitrary pointer, which can be retrieved later by
<a class="reference internal" href="#c.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>This function returns assigned stream ID if it succeeds, or one of
the following negative error codes:</p>
<dl class="docutils">
<dt><a class="reference internal" href="#c.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="#c.NGHTTP2_ERR_STREAM_ID_NOT_AVAILABLE" title="NGHTTP2_ERR_STREAM_ID_NOT_AVAILABLE"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_ERR_STREAM_ID_NOT_AVAILABLE</span></tt></a></dt>
<dd>No stream ID is available because maximum stream ID was
reached.</dd>
</dl>
<div class="admonition warning">
<p class="first admonition-title">Warning</p>
<p class="last">This function returns assigned stream ID if it succeeds. But
that stream is not opened yet. The application must not submit
frame to that stream ID before
<a class="reference internal" href="#c.nghttp2_before_frame_send_callback" title="nghttp2_before_frame_send_callback"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_before_frame_send_callback</span></tt></a> is called for this
frame.</p>
</div>
</dd></dl>
<dl class="function">
<dt id="c.nghttp2_submit_response">
int <tt class="descname">nghttp2_submit_response</tt><big>(</big><a class="reference internal" href="#c.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="#c.nghttp2_nv" title="nghttp2_nv">nghttp2_nv</a><em>&nbsp;*nva</em>, size_t<em>&nbsp;nvlen</em>, const <a class="reference internal" href="#c.nghttp2_data_provider" title="nghttp2_data_provider">nghttp2_data_provider</a><em>&nbsp;*data_prd</em><big>)</big><a class="headerlink" href="#c.nghttp2_submit_response" title="Permalink to this definition"></a></dt>
<dd><p>Submits response HEADERS frame and optionally one or more DATA
frames against the stream <em>stream_id</em>.</p>
<p>The <em>nva</em> is an array of name/value pair <a class="reference internal" href="#c.nghttp2_nv" title="nghttp2_nv"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_nv</span></tt></a> with
<em>nvlen</em> elements. The application is responsible to include
required pseudo-header fields (header field whose name starts with
&quot;:&quot;) in <em>nva</em> and must place pseudo-headers before regular header
fields.</p>
<p>This function creates copies of all name/value pairs in <em>nva</em>. It
also lower-cases all names in <em>nva</em>. The order of elements in
<em>nva</em> is preserved.</p>
<p>HTTP/2 specification has requirement about header fields in the
response HEADERS. See the specification for more details.</p>
<p>If <em>data_prd</em> is not <tt class="docutils literal"><span class="pre">NULL</span></tt>, it provides data which will be sent
in subsequent DATA frames. This function does not take ownership
of the <em>data_prd</em>. The function copies the members of the
<em>data_prd</em>. If <em>data_prd</em> is <tt class="docutils literal"><span class="pre">NULL</span></tt>, HEADERS will have
END_STREAM flag set.</p>
<p>This method can be used as normal HTTP response and push response.
When pushing a resource using this function, the <em>session</em> must be
configured using <a class="reference internal" href="#c.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="#c.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>
<p>To send non-final response headers (e.g., HTTP status 101), don't
use this function because this function half-closes the outbound
stream. Instead, use <a class="reference internal" href="#c.nghttp2_submit_headers" title="nghttp2_submit_headers"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_submit_headers()</span></tt></a> for this purpose.</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="#c.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="#c.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>stream_id</em> is 0.</dd>
</dl>
<div class="admonition warning">
<p class="first admonition-title">Warning</p>
<p class="last">Calling this function twice for the same stream ID may lead to
program crash. It is generally considered to a programming error
to commit response twice.</p>
</div>
</dd></dl>
<dl class="function">
<dt id="c.nghttp2_submit_trailer">
int <tt class="descname">nghttp2_submit_trailer</tt><big>(</big><a class="reference internal" href="#c.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="#c.nghttp2_nv" title="nghttp2_nv">nghttp2_nv</a><em>&nbsp;*nva</em>, size_t<em>&nbsp;nvlen</em><big>)</big><a class="headerlink" href="#c.nghttp2_submit_trailer" title="Permalink to this definition"></a></dt>
<dd><p>Submits trailer HEADERS against the stream <em>stream_id</em>.</p>
<p>The <em>nva</em> is an array of name/value pair <a class="reference internal" href="#c.nghttp2_nv" title="nghttp2_nv"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_nv</span></tt></a> with
<em>nvlen</em> elements. The application is responsible not to include
required pseudo-header fields (header field whose name starts with
&quot;:&quot;) in <em>nva</em>.</p>
<p>This function creates copies of all name/value pairs in <em>nva</em>. It
also lower-cases all names in <em>nva</em>. The order of elements in
<em>nva</em> is preserved.</p>
<p>For server, trailer must be followed by response HEADERS or
response DATA. The library does not check that response HEADERS
has already sent and if <a class="reference internal" href="#c.nghttp2_submit_trailer" title="nghttp2_submit_trailer"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_submit_trailer()</span></tt></a> is called before
any response HEADERS submission (usually by
<a class="reference internal" href="#c.nghttp2_submit_response" title="nghttp2_submit_response"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_submit_response()</span></tt></a>), the content of <em>nva</em> will be sent as
reponse headers, which will result in error.</p>
<p>This function has the same effect with <a class="reference internal" href="#c.nghttp2_submit_headers" title="nghttp2_submit_headers"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_submit_headers()</span></tt></a>,
with flags = <a class="reference internal" href="#c.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> and both pri_spec and
stream_user_data to NULL.</p>
<p>To submit trailer after <a class="reference internal" href="#c.nghttp2_submit_response" title="nghttp2_submit_response"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_submit_response()</span></tt></a> is called, the
application has to specify <a class="reference internal" href="#c.nghttp2_data_provider" title="nghttp2_data_provider"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_data_provider</span></tt></a> to
<a class="reference internal" href="#c.nghttp2_submit_response" title="nghttp2_submit_response"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_submit_response()</span></tt></a>. In side
<a class="reference internal" href="#c.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>, when setting
<a class="reference internal" href="#c.NGHTTP2_DATA_FLAG_EOF" title="NGHTTP2_DATA_FLAG_EOF"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_DATA_FLAG_EOF</span></tt></a>, also set
<a class="reference internal" href="#c.NGHTTP2_DATA_FLAG_NO_END_STREAM" title="NGHTTP2_DATA_FLAG_NO_END_STREAM"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_DATA_FLAG_NO_END_STREAM</span></tt></a>. After that, the
application can send trailer using <a class="reference internal" href="#c.nghttp2_submit_trailer" title="nghttp2_submit_trailer"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_submit_trailer()</span></tt></a>.
<a class="reference internal" href="#c.nghttp2_submit_trailer" title="nghttp2_submit_trailer"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_submit_trailer()</span></tt></a> can be used inside
<a class="reference internal" href="#c.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>
<p>This function returns 0 if it succeeds and <em>stream_id</em> is -1.
Otherwise, this function returns 0 if it succeeds, or one of the
following negative error codes:</p>
<dl class="docutils">
<dt><a class="reference internal" href="#c.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="#c.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>stream_id</em> is 0.</dd>
</dl>
</dd></dl>
<dl class="function">
<dt id="c.nghttp2_submit_headers">
int32_t <tt class="descname">nghttp2_submit_headers</tt><big>(</big><a class="reference internal" href="#c.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="#c.nghttp2_priority_spec" title="nghttp2_priority_spec">nghttp2_priority_spec</a><em>&nbsp;*pri_spec</em>, const <a class="reference internal" href="#c.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="#c.nghttp2_submit_headers" title="Permalink to this definition"></a></dt>
<dd><p>Submits HEADERS frame. The <em>flags</em> is bitwise OR of the
following values:</p>
<ul class="simple">
<li><a class="reference internal" href="#c.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>
</ul>
<p>If <em>flags</em> includes <a class="reference internal" href="#c.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
END_STREAM flag set.</p>
<p>The library handles the CONTINUATION frame internally and it
correctly sets END_HEADERS to the last sequence of the PUSH_PROMISE
or CONTINUATION frame.</p>
<p>If the <em>stream_id</em> is -1, this frame is assumed as request (i.e.,
request HEADERS frame which opens new stream). In this case, the
assigned stream ID will be returned. Otherwise, specify stream ID
in <em>stream_id</em>.</p>
<p>The <em>pri_spec</em> is priority specification of this request. <tt class="docutils literal"><span class="pre">NULL</span></tt>
means the default priority (see
<a class="reference internal" href="#c.nghttp2_priority_spec_default_init" title="nghttp2_priority_spec_default_init"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_priority_spec_default_init()</span></tt></a>). To specify the priority,
use <a class="reference internal" href="#c.nghttp2_priority_spec_init" title="nghttp2_priority_spec_init"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_priority_spec_init()</span></tt></a>. If <em>pri_spec</em> is not <tt class="docutils literal"><span class="pre">NULL</span></tt>,
this function will copy its data members.</p>
<p>The <tt class="xref c c-func docutils literal"><span class="pre">pri_spec-&gt;weight()</span></tt> must be in [<a class="reference internal" href="#c.NGHTTP2_MIN_WEIGHT" title="NGHTTP2_MIN_WEIGHT"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_MIN_WEIGHT</span></tt></a>,
<a class="reference internal" href="#c.NGHTTP2_MAX_WEIGHT" title="NGHTTP2_MAX_WEIGHT"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_MAX_WEIGHT</span></tt></a>], inclusive. If <tt class="xref c c-func docutils literal"><span class="pre">pri_spec-&gt;weight()</span></tt> is
strictly less than <a class="reference internal" href="#c.NGHTTP2_MIN_WEIGHT" title="NGHTTP2_MIN_WEIGHT"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_MIN_WEIGHT</span></tt></a>, it becomes
<a class="reference internal" href="#c.NGHTTP2_MIN_WEIGHT" title="NGHTTP2_MIN_WEIGHT"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_MIN_WEIGHT</span></tt></a>. If it is strictly greater than
<a class="reference internal" href="#c.NGHTTP2_MAX_WEIGHT" title="NGHTTP2_MAX_WEIGHT"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_MAX_WEIGHT</span></tt></a>, it becomes <a class="reference internal" href="#c.NGHTTP2_MAX_WEIGHT" title="NGHTTP2_MAX_WEIGHT"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_MAX_WEIGHT</span></tt></a>.</p>
<p>The <em>nva</em> is an array of name/value pair <a class="reference internal" href="#c.nghttp2_nv" title="nghttp2_nv"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_nv</span></tt></a> with
<em>nvlen</em> elements. The application is responsible to include
required pseudo-header fields (header field whose name starts with
&quot;:&quot;) in <em>nva</em> and must place pseudo-headers before regular header
fields.</p>
<p>This function creates copies of all name/value pairs in <em>nva</em>. It
also lower-cases all names in <em>nva</em>. The order of elements in
<em>nva</em> is preserved.</p>
<p>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
specify flags directly. For usual HTTP request,
<a class="reference internal" href="#c.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>
<p>This function returns newly assigned stream ID if it succeeds and
<em>stream_id</em> is -1. Otherwise, this function returns 0 if it
succeeds, or one of the following negative error codes:</p>
<dl class="docutils">
<dt><a class="reference internal" href="#c.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="#c.NGHTTP2_ERR_STREAM_ID_NOT_AVAILABLE" title="NGHTTP2_ERR_STREAM_ID_NOT_AVAILABLE"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_ERR_STREAM_ID_NOT_AVAILABLE</span></tt></a></dt>
<dd>No stream ID is available because maximum stream ID was
reached.</dd>
<dt><a class="reference internal" href="#c.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>stream_id</em> is 0.</dd>
</dl>
<div class="admonition warning">
<p class="first admonition-title">Warning</p>
<p class="last">This function returns assigned stream ID if it succeeds and
<em>stream_id</em> is -1. But that stream is not opened yet. The
application must not submit frame to that stream ID before
<a class="reference internal" href="#c.nghttp2_before_frame_send_callback" title="nghttp2_before_frame_send_callback"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_before_frame_send_callback</span></tt></a> is called for this
frame.</p>
</div>
</dd></dl>
<dl class="function">
<dt id="c.nghttp2_submit_data">
int <tt class="descname">nghttp2_submit_data</tt><big>(</big><a class="reference internal" href="#c.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="#c.nghttp2_data_provider" title="nghttp2_data_provider">nghttp2_data_provider</a><em>&nbsp;*data_prd</em><big>)</big><a class="headerlink" href="#c.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="#c.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="#c.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="#c.NGHTTP2_ERR_DATA_EXIST" title="NGHTTP2_ERR_DATA_EXIST"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_ERR_DATA_EXIST</span></tt></a></dt>
<dd>DATA has been already submitted and not fully processed yet.</dd>
<dt><a class="reference internal" href="#c.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>stream_id</em> is 0.</dd>
<dt><a class="reference internal" href="#c.NGHTTP2_ERR_STREAM_CLOSED" title="NGHTTP2_ERR_STREAM_CLOSED"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_ERR_STREAM_CLOSED</span></tt></a></dt>
<dd>The stream was alreay closed; or the <em>stream_id</em> is invalid.</dd>
</dl>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">Currently, only one data is allowed for a stream at a time.
Submitting data more than once before first data is finished
results in <a class="reference internal" href="#c.NGHTTP2_ERR_DATA_EXIST" title="NGHTTP2_ERR_DATA_EXIST"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_ERR_DATA_EXIST</span></tt></a> error code. The
earliest callback which tells that previous data is done is
<a class="reference internal" href="#c.nghttp2_on_frame_send_callback" title="nghttp2_on_frame_send_callback"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_on_frame_send_callback</span></tt></a>. In side that callback,
new data can be submitted using <a class="reference internal" href="#c.nghttp2_submit_data" title="nghttp2_submit_data"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_submit_data()</span></tt></a>. Of
course, all data except for last one must not have
<a class="reference internal" href="#c.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> flag set in <em>flags</em>.</p>
</div>
</dd></dl>
<dl class="function">
<dt id="c.nghttp2_submit_priority">
int <tt class="descname">nghttp2_submit_priority</tt><big>(</big><a class="reference internal" href="#c.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="#c.nghttp2_priority_spec" title="nghttp2_priority_spec">nghttp2_priority_spec</a><em>&nbsp;*pri_spec</em><big>)</big><a class="headerlink" href="#c.nghttp2_submit_priority" title="Permalink to this definition"></a></dt>
<dd><p>Submits PRIORITY frame to change the priority of stream <em>stream_id</em>
to the priority specification <em>pri_spec</em>.</p>
<p>The <em>flags</em> is currently ignored and should be
<a class="reference internal" href="#c.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>
<p>The <em>pri_spec</em> is priority specification of this request. <tt class="docutils literal"><span class="pre">NULL</span></tt>
is not allowed for this function. To specify the priority, use
<a class="reference internal" href="#c.nghttp2_priority_spec_init" title="nghttp2_priority_spec_init"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_priority_spec_init()</span></tt></a>. This function will copy its data
members.</p>
<p>The <tt class="xref c c-func docutils literal"><span class="pre">pri_spec-&gt;weight()</span></tt> must be in [<a class="reference internal" href="#c.NGHTTP2_MIN_WEIGHT" title="NGHTTP2_MIN_WEIGHT"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_MIN_WEIGHT</span></tt></a>,
<a class="reference internal" href="#c.NGHTTP2_MAX_WEIGHT" title="NGHTTP2_MAX_WEIGHT"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_MAX_WEIGHT</span></tt></a>], inclusive. If <tt class="xref c c-func docutils literal"><span class="pre">pri_spec-&gt;weight()</span></tt> is
strictly less than <a class="reference internal" href="#c.NGHTTP2_MIN_WEIGHT" title="NGHTTP2_MIN_WEIGHT"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_MIN_WEIGHT</span></tt></a>, it becomes
<a class="reference internal" href="#c.NGHTTP2_MIN_WEIGHT" title="NGHTTP2_MIN_WEIGHT"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_MIN_WEIGHT</span></tt></a>. If it is strictly greater than
<a class="reference internal" href="#c.NGHTTP2_MAX_WEIGHT" title="NGHTTP2_MAX_WEIGHT"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_MAX_WEIGHT</span></tt></a>, it becomes <a class="reference internal" href="#c.NGHTTP2_MAX_WEIGHT" title="NGHTTP2_MAX_WEIGHT"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_MAX_WEIGHT</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="#c.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="#c.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>stream_id</em> is 0; or the <em>pri_spec</em> is NULL; or trying to
depend on itself.</dd>
</dl>
</dd></dl>
<dl class="function">
<dt id="c.nghttp2_submit_rst_stream">
int <tt class="descname">nghttp2_submit_rst_stream</tt><big>(</big><a class="reference internal" href="#c.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>, uint32_t<em>&nbsp;error_code</em><big>)</big><a class="headerlink" href="#c.nghttp2_submit_rst_stream" title="Permalink to this definition"></a></dt>
<dd><p>Submits RST_STREAM frame to cancel/reject the stream <em>stream_id</em>
with the error code <em>error_code</em>.</p>
<p>The pre-defined error code is one of <a class="reference internal" href="#c.nghttp2_error_code" title="nghttp2_error_code"><tt class="xref c c-macro docutils literal"><span class="pre">nghttp2_error_code</span></tt></a>.</p>
<p>The <em>flags</em> is currently ignored and should be
<a class="reference internal" href="#c.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>
<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="#c.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="#c.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>stream_id</em> is 0.</dd>
</dl>
</dd></dl>
<dl class="function">
<dt id="c.nghttp2_submit_settings">
int <tt class="descname">nghttp2_submit_settings</tt><big>(</big><a class="reference internal" href="#c.nghttp2_session" title="nghttp2_session">nghttp2_session</a><em>&nbsp;*session</em>, uint8_t<em>&nbsp;flags</em>, const <a class="reference internal" href="#c.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="#c.nghttp2_submit_settings" title="Permalink to this definition"></a></dt>
<dd><p>Stores local settings and submits SETTINGS frame. The <em>iv</em> is the
pointer to the array of <a class="reference internal" href="#c.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>
indicates the number of <a class="reference internal" href="#c.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>
<p>The <em>flags</em> is currently ignored and should be
<a class="reference internal" href="#c.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>
<p>This function does not take ownership of the <em>iv</em>. This function
copies all the elements in the <em>iv</em>.</p>
<p>While updating individual stream'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>
<p>SETTINGS with <a class="reference internal" href="#c.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>
<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="#c.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 invalid value (e.g., initial window size
strictly greater than (1 &lt;&lt; 31) - 1.</dd>
<dt><a class="reference internal" href="#c.NGHTTP2_ERR_TOO_MANY_INFLIGHT_SETTINGS" title="NGHTTP2_ERR_TOO_MANY_INFLIGHT_SETTINGS"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_ERR_TOO_MANY_INFLIGHT_SETTINGS</span></tt></a></dt>
<dd>There is already another in-flight SETTINGS. Note that the
current implementation only allows 1 in-flight SETTINGS frame
without ACK flag set.</dd>
<dt><a class="reference internal" href="#c.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="c.nghttp2_submit_push_promise">
int32_t <tt class="descname">nghttp2_submit_push_promise</tt><big>(</big><a class="reference internal" href="#c.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="#c.nghttp2_nv" title="nghttp2_nv">nghttp2_nv</a><em>&nbsp;*nva</em>, size_t<em>&nbsp;nvlen</em>, void<em>&nbsp;*promised_stream_user_data</em><big>)</big><a class="headerlink" href="#c.nghttp2_submit_push_promise" title="Permalink to this definition"></a></dt>
<dd><p>Submits PUSH_PROMISE frame.</p>
<p>The <em>flags</em> is currently ignored. The library handles the
CONTINUATION frame internally and it correctly sets END_HEADERS to
the last sequence of the PUSH_PROMISE or CONTINUATION frame.</p>
<p>The <em>stream_id</em> must be client initiated stream ID.</p>
<p>The <em>nva</em> is an array of name/value pair <a class="reference internal" href="#c.nghttp2_nv" title="nghttp2_nv"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_nv</span></tt></a> with
<em>nvlen</em> elements. The application is responsible to include
required pseudo-header fields (header field whose name starts with
&quot;:&quot;) in <em>nva</em> and must place pseudo-headers before regular header
fields.</p>
<p>This function creates copies of all name/value pairs in <em>nva</em>. It
also lower-cases all names in <em>nva</em>. The order of elements in
<em>nva</em> is preserved.</p>
<p>The <em>promised_stream_user_data</em> is a pointer to an arbitrary data
which is associated to the promised stream this frame will open and
make it in reserved state. It is available using
<a class="reference internal" href="#c.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>. The application can
access it in <a class="reference internal" href="#c.nghttp2_before_frame_send_callback" title="nghttp2_before_frame_send_callback"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_before_frame_send_callback</span></tt></a> and
<a class="reference internal" href="#c.nghttp2_on_frame_send_callback" title="nghttp2_on_frame_send_callback"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_on_frame_send_callback</span></tt></a> of this frame.</p>
<p>The client side is not allowed to use this function.</p>
<p>To submit response headers and data, use
<a class="reference internal" href="#c.nghttp2_submit_response" title="nghttp2_submit_response"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_submit_response()</span></tt></a>.</p>
<p>This function returns assigned promised stream ID if it succeeds,
or one of the following negative error codes:</p>
<dl class="docutils">
<dt><a class="reference internal" href="#c.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="#c.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>This function was invoked when <em>session</em> is initialized as
client.</dd>
<dt><a class="reference internal" href="#c.NGHTTP2_ERR_STREAM_ID_NOT_AVAILABLE" title="NGHTTP2_ERR_STREAM_ID_NOT_AVAILABLE"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_ERR_STREAM_ID_NOT_AVAILABLE</span></tt></a></dt>
<dd>No stream ID is available because maximum stream ID was
reached.</dd>
<dt><a class="reference internal" href="#c.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>stream_id</em> is 0; The <em>stream_id</em> does not designate stream
that peer initiated.</dd>
</dl>
<div class="admonition warning">
<p class="first admonition-title">Warning</p>
<p class="last">This function returns assigned promised stream ID if it succeeds.
But that stream is not opened yet. The application must not
submit frame to that stream ID before
<a class="reference internal" href="#c.nghttp2_before_frame_send_callback" title="nghttp2_before_frame_send_callback"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_before_frame_send_callback</span></tt></a> is called for this
frame.</p>
</div>
</dd></dl>
<dl class="function">
<dt id="c.nghttp2_submit_ping">
int <tt class="descname">nghttp2_submit_ping</tt><big>(</big><a class="reference internal" href="#c.nghttp2_session" title="nghttp2_session">nghttp2_session</a><em>&nbsp;*session</em>, uint8_t<em>&nbsp;flags</em>, const uint8_t<em>&nbsp;*opaque_data</em><big>)</big><a class="headerlink" href="#c.nghttp2_submit_ping" title="Permalink to this definition"></a></dt>
<dd><p>Submits PING frame. You don't have to send PING back when you
received PING frame. The library automatically submits PING frame
in this case.</p>
<p>The <em>flags</em> is currently ignored and should be
<a class="reference internal" href="#c.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>
<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
bytes array of memory to specify opaque data to send with PING
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>
<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="#c.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="c.nghttp2_submit_goaway">
int <tt class="descname">nghttp2_submit_goaway</tt><big>(</big><a class="reference internal" href="#c.nghttp2_session" title="nghttp2_session">nghttp2_session</a><em>&nbsp;*session</em>, uint8_t<em>&nbsp;flags</em>, int32_t<em>&nbsp;last_stream_id</em>, uint32_t<em>&nbsp;error_code</em>, const uint8_t<em>&nbsp;*opaque_data</em>, size_t<em>&nbsp;opaque_data_len</em><big>)</big><a class="headerlink" href="#c.nghttp2_submit_goaway" title="Permalink to this definition"></a></dt>
<dd><p>Submits GOAWAY frame with the last stream ID <em>last_stream_id</em> and
the error code <em>error_code</em>.</p>
<p>The pre-defined error code is one of <a class="reference internal" href="#c.nghttp2_error_code" title="nghttp2_error_code"><tt class="xref c c-macro docutils literal"><span class="pre">nghttp2_error_code</span></tt></a>.</p>
<p>The <em>flags</em> is currently ignored and should be
<a class="reference internal" href="#c.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>
<p>The <em>last_stream_id</em> is peer's stream ID or 0. So if <em>session</em> is
initialized as client, <em>last_stream_id</em> must be even or 0. If
<em>session</em> is initialized as server, <em>last_stream_id</em> must be odd or
0.</p>
<p>The HTTP/2 specification says last_stream_id must not be increased
from the value previously sent. So the actual value sent as
last_stream_id is the minimum value between the given
<em>last_stream_id</em> and the last_stream_id previously sent to the
peer.</p>
<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>
<p>After successful transmission of GOAWAY, following things happen.
All incoming streams having strictly more than <em>last_stream_id</em> are
closed. All incoming HEADERS which starts new stream are simply
ignored. After all active streams are handled, both
<a class="reference internal" href="#c.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="#c.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 and the application can close session.</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="#c.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="#c.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>opaque_data_len</em> is too large; the <em>last_stream_id</em> is
invalid.</dd>
</dl>
</dd></dl>
<dl class="function">
<dt id="c.nghttp2_session_get_last_proc_stream_id">
int32_t <tt class="descname">nghttp2_session_get_last_proc_stream_id</tt><big>(</big><a class="reference internal" href="#c.nghttp2_session" title="nghttp2_session">nghttp2_session</a><em>&nbsp;*session</em><big>)</big><a class="headerlink" href="#c.nghttp2_session_get_last_proc_stream_id" title="Permalink to this definition"></a></dt>
<dd><p>Returns the last stream ID of a stream for which
<a class="reference internal" href="#c.nghttp2_on_frame_recv_callback" title="nghttp2_on_frame_recv_callback"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_on_frame_recv_callback</span></tt></a> was invoked most recently.
The returned value can be used as last_stream_id parameter for
<a class="reference internal" href="#c.nghttp2_submit_goaway" title="nghttp2_submit_goaway"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_submit_goaway()</span></tt></a> and
<a class="reference internal" href="#c.nghttp2_session_terminate_session2" title="nghttp2_session_terminate_session2"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_terminate_session2()</span></tt></a>.</p>
<p>This function always succeeds.</p>
</dd></dl>
<dl class="function">
<dt id="c.nghttp2_submit_window_update">
int <tt class="descname">nghttp2_submit_window_update</tt><big>(</big><a class="reference internal" href="#c.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="#c.nghttp2_submit_window_update" title="Permalink to this definition"></a></dt>
<dd><p>Submits WINDOW_UPDATE frame.</p>
<p>The <em>flags</em> is currently ignored and should be
<a class="reference internal" href="#c.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>
<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 automatic
WINDOW_UPDATE is enabled
(<a class="reference internal" href="#c.nghttp2_option_set_no_auto_window_update" title="nghttp2_option_set_no_auto_window_update"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_option_set_no_auto_window_update()</span></tt></a>), and the library
decided that the WINDOW_UPDATE should be submitted, then
WINDOW_UPDATE is queued with the current received bytes count.</p>
<p>If the <em>window_size_increment</em> is 0, the function does nothing and
returns 0.</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="#c.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>
<dt><a class="reference internal" href="#c.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="c.nghttp2_submit_altsvc">
int <tt class="descname">nghttp2_submit_altsvc</tt><big>(</big><a class="reference internal" href="#c.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>, uint32_t<em>&nbsp;max_age</em>, uint16_t<em>&nbsp;port</em>, const uint8_t<em>&nbsp;*protocol_id</em>, size_t<em>&nbsp;protocol_id_len</em>, const uint8_t<em>&nbsp;*host</em>, size_t<em>&nbsp;host_len</em>, const uint8_t<em>&nbsp;*origin</em>, size_t<em>&nbsp;origin_len</em><big>)</big><a class="headerlink" href="#c.nghttp2_submit_altsvc" title="Permalink to this definition"></a></dt>
<dd><p>This function previously submits ALTSVC frame with given
parameters, but is deprecated and will be removed in a future
release. This function does nothing and just return 0.</p>
</dd></dl>
<dl class="function">
<dt id="c.nghttp2_nv_compare_name">
int <tt class="descname">nghttp2_nv_compare_name</tt><big>(</big>const <a class="reference internal" href="#c.nghttp2_nv" title="nghttp2_nv">nghttp2_nv</a><em>&nbsp;*lhs</em>, const <a class="reference internal" href="#c.nghttp2_nv" title="nghttp2_nv">nghttp2_nv</a><em>&nbsp;*rhs</em><big>)</big><a class="headerlink" href="#c.nghttp2_nv_compare_name" title="Permalink to this definition"></a></dt>
<dd><p>Compares <tt class="docutils literal"><span class="pre">lhs-&gt;name</span></tt> of length <tt class="docutils literal"><span class="pre">lhs-&gt;namelen</span></tt> bytes and
<tt class="docutils literal"><span class="pre">rhs-&gt;name</span></tt> of length <tt class="docutils literal"><span class="pre">rhs-&gt;namelen</span></tt> bytes. Returns negative
integer if <tt class="docutils literal"><span class="pre">lhs-&gt;name</span></tt> is found to be less than <tt class="docutils literal"><span class="pre">rhs-&gt;name</span></tt>; or
returns positive integer if <tt class="docutils literal"><span class="pre">lhs-&gt;name</span></tt> is found to be greater
than <tt class="docutils literal"><span class="pre">rhs-&gt;name</span></tt>; or returns 0 otherwise.</p>
</dd></dl>
<dl class="function">
<dt id="c.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="#c.nghttp2_select_next_protocol" title="Permalink to this definition"></a></dt>
<dd><p>A helper function for dealing with NPN in client side or ALPN in
server side. The <em>in</em> contains peer'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>
<div class="highlight-c"><div class="highlight"><pre><span class="n">in</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">=</span> <span class="mi">17</span>
<span class="n">in</span><span class="p">[</span><span class="mf">1..17</span><span class="p">]</span> <span class="o">=</span> <span class="s">&quot;HTTP-draft-04/2.0&quot;</span>
<span class="n">in</span><span class="p">[</span><span class="mi">18</span><span class="p">]</span> <span class="o">=</span> <span class="mi">8</span>
<span class="n">in</span><span class="p">[</span><span class="mf">19..26</span><span class="p">]</span> <span class="o">=</span> <span class="s">&quot;http/1.1&quot;</span>
<span class="n">inlen</span> <span class="o">=</span> <span class="mi">27</span>
</pre></div>
</div>
<p>The selection algorithm is as follows:</p>
<ol class="arabic simple">
<li>If peer's list contains HTTP/2 protocol the library supports,
it is selected and returns 1. The following step is not taken.</li>
<li>If peer's list contains <tt class="docutils literal"><span class="pre">http/1.1</span></tt>, this function selects
<tt class="docutils literal"><span class="pre">http/1.1</span></tt> and returns 0. The following step is not taken.</li>
<li>This function selects nothing and returns -1 (So called
non-overlap case). In this case, <em>out</em> and <em>outlen</em> are left
untouched.</li>
</ol>
<p>Selecting <tt class="docutils literal"><span class="pre">HTTP-draft-04/2.0</span></tt> means that <tt class="docutils literal"><span class="pre">HTTP-draft-04/2.0</span></tt> is
written into <em>*out</em> and its length (which is 17) is assigned to
<em>*outlen</em>.</p>
<p>For ALPN, refer to
<a class="reference external" href="https://tools.ietf.org/html/draft-ietf-tls-applayerprotoneg-05">https://tools.ietf.org/html/draft-ietf-tls-applayerprotoneg-05</a></p>
<p>See <a class="reference external" href="http://technotes.googlecode.com/git/nextprotoneg.html">http://technotes.googlecode.com/git/nextprotoneg.html</a> for more
details about NPN.</p>
<p>For NPN, to use this method you should do something like:</p>
<div class="highlight-c"><div class="highlight"><pre><span class="k">static</span> <span class="kt">int</span> <span class="nf">select_next_proto_cb</span><span class="p">(</span><span class="n">SSL</span><span class="o">*</span> <span class="n">ssl</span><span class="p">,</span>
<span class="kt">unsigned</span> <span class="kt">char</span> <span class="o">**</span><span class="n">out</span><span class="p">,</span>
<span class="kt">unsigned</span> <span class="kt">char</span> <span class="o">*</span><span class="n">outlen</span><span class="p">,</span>
<span class="k">const</span> <span class="kt">unsigned</span> <span class="kt">char</span> <span class="o">*</span><span class="n">in</span><span class="p">,</span>
<span class="kt">unsigned</span> <span class="kt">int</span> <span class="n">inlen</span><span class="p">,</span>
<span class="kt">void</span> <span class="o">*</span><span class="n">arg</span><span class="p">)</span>
<span class="p">{</span>
<span class="kt">int</span> <span class="n">rv</span><span class="p">;</span>
<span class="n">rv</span> <span class="o">=</span> <span class="n">nghttp2_select_next_protocol</span><span class="p">(</span><span class="n">out</span><span class="p">,</span> <span class="n">outlen</span><span class="p">,</span> <span class="n">in</span><span class="p">,</span> <span class="n">inlen</span><span class="p">);</span>
<span class="k">if</span><span class="p">(</span><span class="n">rv</span> <span class="o">==</span> <span class="mi">1</span><span class="p">)</span> <span class="p">{</span>
<span class="p">((</span><span class="n">MyType</span><span class="o">*</span><span class="p">)</span><span class="n">arg</span><span class="p">)</span><span class="o">-&gt;</span><span class="n">http2_selected</span> <span class="o">=</span> <span class="mi">1</span><span class="p">;</span>
<span class="p">}</span>
<span class="k">return</span> <span class="n">SSL_TLSEXT_ERR_OK</span><span class="p">;</span>
<span class="p">}</span>
<span class="p">...</span>
<span class="n">SSL_CTX_set_next_proto_select_cb</span><span class="p">(</span><span class="n">ssl_ctx</span><span class="p">,</span> <span class="n">select_next_proto_cb</span><span class="p">,</span> <span class="n">my_obj</span><span class="p">);</span>
</pre></div>
</div>
</dd></dl>
<dl class="function">
<dt id="c.nghttp2_version">
<a class="reference internal" href="#c.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="#c.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 <tt class="docutils literal"><span class="pre">NULL</span></tt>. Pass in 0 to skip the version checking.</p>
</dd></dl>
<dl class="function">
<dt id="c.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="#c.nghttp2_is_fatal" title="Permalink to this definition"></a></dt>
<dd><p>Returns nonzero if the <a class="reference internal" href="#c.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>
<dl class="function">
<dt id="c.nghttp2_check_header_name">
int <tt class="descname">nghttp2_check_header_name</tt><big>(</big>const uint8_t<em>&nbsp;*name</em>, size_t<em>&nbsp;len</em><big>)</big><a class="headerlink" href="#c.nghttp2_check_header_name" title="Permalink to this definition"></a></dt>
<dd><p>Returns nonzero if HTTP header field name <em>name</em> of length <em>len</em> is
valid according to <a class="reference external" href="http://tools.ietf.org/html/rfc7230#section-3.2">http://tools.ietf.org/html/rfc7230#section-3.2</a></p>
<p>Because this is a header field name in HTTP2, the upper cased alphabet
is treated as error.</p>
</dd></dl>
<dl class="function">
<dt id="c.nghttp2_check_header_value">
int <tt class="descname">nghttp2_check_header_value</tt><big>(</big>const uint8_t<em>&nbsp;*value</em>, size_t<em>&nbsp;len</em><big>)</big><a class="headerlink" href="#c.nghttp2_check_header_value" title="Permalink to this definition"></a></dt>
<dd><p>Returns nonzero if HTTP header field value <em>value</em> of length <em>len</em>
is valid according to
<a class="reference external" href="http://tools.ietf.org/html/rfc7230#section-3.2">http://tools.ietf.org/html/rfc7230#section-3.2</a></p>
</dd></dl>
<dl class="function">
<dt id="c.nghttp2_hd_deflate_new">
int <tt class="descname">nghttp2_hd_deflate_new</tt><big>(</big><a class="reference internal" href="#c.nghttp2_hd_deflater" title="nghttp2_hd_deflater">nghttp2_hd_deflater</a><em>&nbsp;**deflater_ptr</em>, size_t<em>&nbsp;deflate_hd_table_bufsize_max</em><big>)</big><a class="headerlink" href="#c.nghttp2_hd_deflate_new" title="Permalink to this definition"></a></dt>
<dd><p>Initializes <em>*deflater_ptr</em> for deflating name/values pairs.</p>
<p>The <em>deflate_hd_table_bufsize_max</em> is the upper bound of header
table size the deflater will use.</p>
<p>If this function fails, <em>*deflater_ptr</em> is left untouched.</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="#c.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="c.nghttp2_hd_deflate_new2">
int <tt class="descname">nghttp2_hd_deflate_new2</tt><big>(</big><a class="reference internal" href="#c.nghttp2_hd_deflater" title="nghttp2_hd_deflater">nghttp2_hd_deflater</a><em>&nbsp;**deflater_ptr</em>, size_t<em>&nbsp;deflate_hd_table_bufsize_max</em>, <a class="reference internal" href="#c.nghttp2_mem" title="nghttp2_mem">nghttp2_mem</a><em>&nbsp;*mem</em><big>)</big><a class="headerlink" href="#c.nghttp2_hd_deflate_new2" title="Permalink to this definition"></a></dt>
<dd><p>Like <a class="reference internal" href="#c.nghttp2_hd_deflate_new" title="nghttp2_hd_deflate_new"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_hd_deflate_new()</span></tt></a>, but with additional custom memory
allocator specified in the <em>mem</em>.</p>
<p>The <em>mem</em> can be <tt class="docutils literal"><span class="pre">NULL</span></tt> and the call is equivalent to
<a class="reference internal" href="#c.nghttp2_hd_deflate_new" title="nghttp2_hd_deflate_new"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_hd_deflate_new()</span></tt></a>.</p>
<p>This function does not take ownership <em>mem</em>. The application is
responsible for freeing <em>mem</em>.</p>
<p>The library code does not refer to <em>mem</em> pointer after this
function returns, so the application can safely free it.</p>
</dd></dl>
<dl class="function">
<dt id="c.nghttp2_hd_deflate_del">
void <tt class="descname">nghttp2_hd_deflate_del</tt><big>(</big><a class="reference internal" href="#c.nghttp2_hd_deflater" title="nghttp2_hd_deflater">nghttp2_hd_deflater</a><em>&nbsp;*deflater</em><big>)</big><a class="headerlink" href="#c.nghttp2_hd_deflate_del" title="Permalink to this definition"></a></dt>
<dd><p>Deallocates any resources allocated for <em>deflater</em>.</p>
</dd></dl>
<dl class="function">
<dt id="c.nghttp2_hd_deflate_change_table_size">
int <tt class="descname">nghttp2_hd_deflate_change_table_size</tt><big>(</big><a class="reference internal" href="#c.nghttp2_hd_deflater" title="nghttp2_hd_deflater">nghttp2_hd_deflater</a><em>&nbsp;*deflater</em>, size_t<em>&nbsp;settings_hd_table_bufsize_max</em><big>)</big><a class="headerlink" href="#c.nghttp2_hd_deflate_change_table_size" title="Permalink to this definition"></a></dt>
<dd><p>Changes header table size of the <em>deflater</em> to
<em>settings_hd_table_bufsize_max</em> bytes. This may trigger eviction
in the dynamic table.</p>
<p>The <em>settings_hd_table_bufsize_max</em> should be the value received in
SETTINGS_HEADER_TABLE_SIZE.</p>
<p>The deflater never uses more memory than
<tt class="docutils literal"><span class="pre">deflate_hd_table_bufsize_max</span></tt> bytes specified in
<a class="reference internal" href="#c.nghttp2_hd_deflate_new" title="nghttp2_hd_deflate_new"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_hd_deflate_new()</span></tt></a>. Therefore, if
<em>settings_hd_table_bufsize_max</em> &gt; <tt class="docutils literal"><span class="pre">deflate_hd_table_bufsize_max</span></tt>,
resulting maximum table size becomes
<tt class="docutils literal"><span class="pre">deflate_hd_table_bufsize_max</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="#c.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="c.nghttp2_hd_deflate_hd">
ssize_t <tt class="descname">nghttp2_hd_deflate_hd</tt><big>(</big><a class="reference internal" href="#c.nghttp2_hd_deflater" title="nghttp2_hd_deflater">nghttp2_hd_deflater</a><em>&nbsp;*deflater</em>, uint8_t<em>&nbsp;*buf</em>, size_t<em>&nbsp;buflen</em>, const <a class="reference internal" href="#c.nghttp2_nv" title="nghttp2_nv">nghttp2_nv</a><em>&nbsp;*nva</em>, size_t<em>&nbsp;nvlen</em><big>)</big><a class="headerlink" href="#c.nghttp2_hd_deflate_hd" title="Permalink to this definition"></a></dt>
<dd><p>Deflates the <em>nva</em>, which has the <em>nvlen</em> name/value pairs, into
the <em>buf</em> of length <em>buflen</em>.</p>
<p>If <em>buf</em> is not large enough to store the deflated header block,
this function fails with <a class="reference internal" href="#c.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>. The
caller should use <a class="reference internal" href="#c.nghttp2_hd_deflate_bound" title="nghttp2_hd_deflate_bound"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_hd_deflate_bound()</span></tt></a> to know the upper
bound of buffer size required to deflate given header name/value
pairs.</p>
<p>Once this function fails, subsequent call of this function always
returns <a class="reference internal" href="#c.NGHTTP2_ERR_HEADER_COMP" title="NGHTTP2_ERR_HEADER_COMP"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_ERR_HEADER_COMP</span></tt></a>.</p>
<p>After this function returns, it is safe to delete the <em>nva</em>.</p>
<p>This function returns 0 if it succeeds, or one of the following
negative error codes:</p>
<dl class="docutils">
<dt><a class="reference internal" href="#c.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="#c.NGHTTP2_ERR_HEADER_COMP" title="NGHTTP2_ERR_HEADER_COMP"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_ERR_HEADER_COMP</span></tt></a></dt>
<dd>Deflation process has failed.</dd>
<dt><a class="reference internal" href="#c.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>
</dl>
</dd></dl>
<dl class="function">
<dt id="c.nghttp2_hd_deflate_bound">
size_t <tt class="descname">nghttp2_hd_deflate_bound</tt><big>(</big><a class="reference internal" href="#c.nghttp2_hd_deflater" title="nghttp2_hd_deflater">nghttp2_hd_deflater</a><em>&nbsp;*deflater</em>, const <a class="reference internal" href="#c.nghttp2_nv" title="nghttp2_nv">nghttp2_nv</a><em>&nbsp;*nva</em>, size_t<em>&nbsp;nvlen</em><big>)</big><a class="headerlink" href="#c.nghttp2_hd_deflate_bound" title="Permalink to this definition"></a></dt>
<dd><p>Returns an upper bound on the compressed size after deflation of
<em>nva</em> of length <em>nvlen</em>.</p>
</dd></dl>
<dl class="function">
<dt id="c.nghttp2_hd_inflate_new">
int <tt class="descname">nghttp2_hd_inflate_new</tt><big>(</big><a class="reference internal" href="#c.nghttp2_hd_inflater" title="nghttp2_hd_inflater">nghttp2_hd_inflater</a><em>&nbsp;**inflater_ptr</em><big>)</big><a class="headerlink" href="#c.nghttp2_hd_inflate_new" title="Permalink to this definition"></a></dt>
<dd><p>Initializes <em>*inflater_ptr</em> for inflating name/values pairs.</p>
<p>If this function fails, <em>*inflater_ptr</em> is left untouched.</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="#c.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="c.nghttp2_hd_inflate_new2">
int <tt class="descname">nghttp2_hd_inflate_new2</tt><big>(</big><a class="reference internal" href="#c.nghttp2_hd_inflater" title="nghttp2_hd_inflater">nghttp2_hd_inflater</a><em>&nbsp;**inflater_ptr</em>, <a class="reference internal" href="#c.nghttp2_mem" title="nghttp2_mem">nghttp2_mem</a><em>&nbsp;*mem</em><big>)</big><a class="headerlink" href="#c.nghttp2_hd_inflate_new2" title="Permalink to this definition"></a></dt>
<dd><p>Like <a class="reference internal" href="#c.nghttp2_hd_inflate_new" title="nghttp2_hd_inflate_new"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_hd_inflate_new()</span></tt></a>, but with additional custom memory
allocator specified in the <em>mem</em>.</p>
<p>The <em>mem</em> can be <tt class="docutils literal"><span class="pre">NULL</span></tt> and the call is equivalent to
<a class="reference internal" href="#c.nghttp2_hd_inflate_new" title="nghttp2_hd_inflate_new"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_hd_inflate_new()</span></tt></a>.</p>
<p>This function does not take ownership <em>mem</em>. The application is
responsible for freeing <em>mem</em>.</p>
<p>The library code does not refer to <em>mem</em> pointer after this
function returns, so the application can safely free it.</p>
</dd></dl>
<dl class="function">
<dt id="c.nghttp2_hd_inflate_del">
void <tt class="descname">nghttp2_hd_inflate_del</tt><big>(</big><a class="reference internal" href="#c.nghttp2_hd_inflater" title="nghttp2_hd_inflater">nghttp2_hd_inflater</a><em>&nbsp;*inflater</em><big>)</big><a class="headerlink" href="#c.nghttp2_hd_inflate_del" title="Permalink to this definition"></a></dt>
<dd><p>Deallocates any resources allocated for <em>inflater</em>.</p>
</dd></dl>
<dl class="function">
<dt id="c.nghttp2_hd_inflate_change_table_size">
int <tt class="descname">nghttp2_hd_inflate_change_table_size</tt><big>(</big><a class="reference internal" href="#c.nghttp2_hd_inflater" title="nghttp2_hd_inflater">nghttp2_hd_inflater</a><em>&nbsp;*inflater</em>, size_t<em>&nbsp;settings_hd_table_bufsize_max</em><big>)</big><a class="headerlink" href="#c.nghttp2_hd_inflate_change_table_size" title="Permalink to this definition"></a></dt>
<dd><p>Changes header table size in the <em>inflater</em>. This may trigger
eviction in the dynamic table.</p>
<p>The <em>settings_hd_table_bufsize_max</em> should be the value transmitted
in SETTINGS_HEADER_TABLE_SIZE.</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="#c.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="c.nghttp2_hd_inflate_hd">
ssize_t <tt class="descname">nghttp2_hd_inflate_hd</tt><big>(</big><a class="reference internal" href="#c.nghttp2_hd_inflater" title="nghttp2_hd_inflater">nghttp2_hd_inflater</a><em>&nbsp;*inflater</em>, <a class="reference internal" href="#c.nghttp2_nv" title="nghttp2_nv">nghttp2_nv</a><em>&nbsp;*nv_out</em>, int<em>&nbsp;*inflate_flags</em>, uint8_t<em>&nbsp;*in</em>, size_t<em>&nbsp;inlen</em>, int<em>&nbsp;in_final</em><big>)</big><a class="headerlink" href="#c.nghttp2_hd_inflate_hd" title="Permalink to this definition"></a></dt>
<dd><p>Inflates name/value block stored in <em>in</em> with length <em>inlen</em>. This
function performs decompression. For each successful emission of
header name/value pair, <a class="reference internal" href="#c.NGHTTP2_HD_INFLATE_EMIT" title="NGHTTP2_HD_INFLATE_EMIT"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_HD_INFLATE_EMIT</span></tt></a> is set in
<em>*inflate_flags</em> and name/value pair is assigned to the <em>nv_out</em>
and the function returns. The caller must not free the members of
<em>nv_out</em>.</p>
<p>The <em>nv_out</em> may include pointers to the memory region in the <em>in</em>.
The caller must retain the <em>in</em> while the <em>nv_out</em> is used.</p>
<p>The application should call this function repeatedly until the
<tt class="docutils literal"><span class="pre">(*inflate_flags)</span> <span class="pre">&amp;</span> <span class="pre">NGHTTP2_HD_INFLATE_FINAL</span></tt> is nonzero and
return value is non-negative. This means the all input values are
processed successfully. Then the application must call
<a class="reference internal" href="#c.nghttp2_hd_inflate_end_headers" title="nghttp2_hd_inflate_end_headers"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_hd_inflate_end_headers()</span></tt></a> to prepare for the next header
block input.</p>
<p>The caller can feed complete compressed header block. It also can
feed it in several chunks. The caller must set <em>in_final</em> to
nonzero if the given input is the last block of the compressed
header.</p>
<p>This function returns the number of bytes processed if it succeeds,
or one of the following negative error codes:</p>
<dl class="docutils">
<dt><a class="reference internal" href="#c.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="#c.NGHTTP2_ERR_HEADER_COMP" title="NGHTTP2_ERR_HEADER_COMP"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_ERR_HEADER_COMP</span></tt></a></dt>
<dd>Inflation process has failed.</dd>
<dt><a class="reference internal" href="#c.NGHTTP2_ERR_BUFFER_ERROR" title="NGHTTP2_ERR_BUFFER_ERROR"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_ERR_BUFFER_ERROR</span></tt></a></dt>
<dd>The heder field name or value is too large.</dd>
</dl>
<p>Example follows:</p>
<div class="highlight-c"><div class="highlight"><pre><span class="kt">int</span> <span class="nf">inflate_header_block</span><span class="p">(</span><span class="n">nghttp2_hd_inflater</span> <span class="o">*</span><span class="n">hd_inflater</span><span class="p">,</span>
<span class="kt">uint8_t</span> <span class="o">*</span><span class="n">in</span><span class="p">,</span> <span class="kt">size_t</span> <span class="n">inlen</span><span class="p">,</span> <span class="kt">int</span> <span class="n">final</span><span class="p">)</span>
<span class="p">{</span>
<span class="kt">ssize_t</span> <span class="n">rv</span><span class="p">;</span>
<span class="k">for</span><span class="p">(;;)</span> <span class="p">{</span>
<span class="n">nghttp2_nv</span> <span class="n">nv</span><span class="p">;</span>
<span class="kt">int</span> <span class="n">inflate_flags</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span>
<span class="n">rv</span> <span class="o">=</span> <span class="n">nghttp2_hd_inflate_hd</span><span class="p">(</span><span class="n">hd_inflater</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">nv</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">inflate_flags</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="n">final</span><span class="p">);</span>
<span class="k">if</span><span class="p">(</span><span class="n">rv</span> <span class="o">&lt;</span> <span class="mi">0</span><span class="p">)</span> <span class="p">{</span>
<span class="n">fprintf</span><span class="p">(</span><span class="n">stderr</span><span class="p">,</span> <span class="s">&quot;inflate failed with error code %zd&quot;</span><span class="p">,</span> <span class="n">rv</span><span class="p">);</span>
<span class="k">return</span> <span class="o">-</span><span class="mi">1</span><span class="p">;</span>
<span class="p">}</span>
<span class="n">in</span> <span class="o">+=</span> <span class="n">rv</span><span class="p">;</span>
<span class="n">inlen</span> <span class="o">-=</span> <span class="n">rv</span><span class="p">;</span>
<span class="k">if</span><span class="p">(</span><span class="n">inflate_flags</span> <span class="o">&amp;</span> <span class="n">NGHTTP2_HD_INFLATE_EMIT</span><span class="p">)</span> <span class="p">{</span>
<span class="n">fwrite</span><span class="p">(</span><span class="n">nv</span><span class="p">.</span><span class="n">name</span><span class="p">,</span> <span class="n">nv</span><span class="p">.</span><span class="n">namelen</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="n">stderr</span><span class="p">);</span>
<span class="n">fprintf</span><span class="p">(</span><span class="n">stderr</span><span class="p">,</span> <span class="s">&quot;: &quot;</span><span class="p">);</span>
<span class="n">fwrite</span><span class="p">(</span><span class="n">nv</span><span class="p">.</span><span class="n">value</span><span class="p">,</span> <span class="n">nv</span><span class="p">.</span><span class="n">valuelen</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="n">stderr</span><span class="p">);</span>
<span class="n">fprintf</span><span class="p">(</span><span class="n">stderr</span><span class="p">,</span> <span class="s">&quot;</span><span class="se">\n</span><span class="s">&quot;</span><span class="p">);</span>
<span class="p">}</span>
<span class="k">if</span><span class="p">(</span><span class="n">inflate_flags</span> <span class="o">&amp;</span> <span class="n">NGHTTP2_HD_INFLATE_FINAL</span><span class="p">)</span> <span class="p">{</span>
<span class="n">nghttp2_hd_inflate_end_headers</span><span class="p">(</span><span class="n">hd_inflater</span><span class="p">);</span>
<span class="k">break</span><span class="p">;</span>
<span class="p">}</span>
<span class="k">if</span><span class="p">((</span><span class="n">inflate_flags</span> <span class="o">&amp;</span> <span class="n">NGHTTP2_HD_INFLATE_EMIT</span><span class="p">)</span> <span class="o">==</span> <span class="mi">0</span> <span class="o">&amp;&amp;</span>
<span class="n">inlen</span> <span class="o">==</span> <span class="mi">0</span><span class="p">)</span> <span class="p">{</span>
<span class="k">break</span><span class="p">;</span>
<span class="p">}</span>
<span class="p">}</span>
<span class="k">return</span> <span class="mi">0</span><span class="p">;</span>
<span class="p">}</span>
</pre></div>
</div>
</dd></dl>
<dl class="function">
<dt id="c.nghttp2_hd_inflate_end_headers">
int <tt class="descname">nghttp2_hd_inflate_end_headers</tt><big>(</big><a class="reference internal" href="#c.nghttp2_hd_inflater" title="nghttp2_hd_inflater">nghttp2_hd_inflater</a><em>&nbsp;*inflater</em><big>)</big><a class="headerlink" href="#c.nghttp2_hd_inflate_end_headers" title="Permalink to this definition"></a></dt>
<dd><p>Signals the end of decompression for one header block.</p>
<p>This function returns 0 if it succeeds. Currently this function
always succeeds.</p>
</dd></dl>
</div>
</div>
</div>
<footer>
<div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
<a href="libnghttp2_asio.html" class="btn btn-neutral float-right" title="libnghttp2_asio: High level HTTP/2 C++ library">Next <span class="fa fa-arrow-circle-right"></span></a>
<a href="h2load-howto.html" class="btn btn-neutral" title="h2load - HTTP/2 benchmarking tool - HOW-TO"><span class="fa fa-arrow-circle-left"></span> Previous</a>
</div>
<hr/>
<div role="contentinfo">
<p>
&copy; Copyright 2012, 2015, Tatsuhiro Tsujikawa.
</p>
</div>
Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/snide/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>.
</footer>
</div>
</div>
</section>
</div>
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT:'./',
VERSION:'0.7.8-DEV',
COLLAPSE_INDEX:false,
FILE_SUFFIX:'.html',
HAS_SOURCE: false
};
</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>
<script type="text/javascript" src="_static/js/theme.js"></script>
<script type="text/javascript">
jQuery(function () {
SphinxRtdTheme.StickyNav.enable();
});
</script>
</body>
</html>