nghttp2/apiref.html

3069 lines
230 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.4.0-DEV documentation</title>
<link href='https://fonts.googleapis.com/css?family=Lato:400,700|Roboto+Slab:400,700|Inconsolata:400,700' rel='stylesheet' type='text/css'>
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT:'./',
VERSION:'0.4.0-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>
<link rel="stylesheet" href="_static/css/theme.css" type="text/css" />
<script type="text/javascript" src="_static/js/theme.js"></script>
<script type="text/javascript">
jQuery(function () {
SphinxRtdTheme.StickyNav.enable();
});
</script>
<link rel="top" title="nghttp2 0.4.0-DEV documentation" href="index.html"/>
<link rel="next" title="nghttp2.h" href="nghttp2.h.html"/>
<link rel="prev" title="Tutorial: HTTP/2 server" href="tutorial-server.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#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#python-bindings">Python bindings</a></li>
</ul>
</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 current"><a class="current reference internal" href="">API Reference</a><ul>
<li class="toctree-l2"><a class="reference internal" href="#includes">Includes</a></li>
<li class="toctree-l2"><a class="reference internal" href="#remarks">Remarks</a></li>
<li class="toctree-l2"><a class="reference internal" href="#macros">Macros</a></li>
<li class="toctree-l2"><a class="reference internal" href="#enums">Enums</a></li>
<li class="toctree-l2"><a class="reference internal" href="#types-structs-unions-and-typedefs">Types (structs, unions and typedefs)</a></li>
<li class="toctree-l2"><a class="reference internal" href="#functions">Functions</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="nghttp2.h.html">nghttp2.h</a></li>
<li class="toctree-l1"><a class="reference internal" href="nghttp2ver.h.html">nghttp2ver.h</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/tatsuhiro-t/nghttp2">Source</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/tatsuhiro-t/nghttp2/issues">Issues</a></li>
</ul>
</div>
&nbsp;
</nav>
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">
<nav class="wy-nav-top" 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">
<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>
</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_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 priority group.</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 priority group.</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 priority group.</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_MAX_HEADER_TABLE_SIZE">
<tt class="descname">NGHTTP2_MAX_HEADER_TABLE_SIZE</tt><a class="headerlink" href="#c.NGHTTP2_MAX_HEADER_TABLE_SIZE" title="Permalink to this definition"></a></dt>
<dd><p>The maximum 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_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_GZIP">
<tt class="descname">NGHTTP2_ERR_GZIP</tt><a class="headerlink" href="#c.NGHTTP2_ERR_GZIP" title="Permalink to this definition"></a></dt>
<dd><p>(<tt class="docutils literal"><span class="pre">-520</span></tt>)
The gzip error.</p>
</dd></dl>
<dl class="macro">
<dt id="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_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>
</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">0x1</span></tt>)
Indicates that this name/value pair must not be indexed.</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 control frame types in HTTP/2.</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.</p>
</dd></dl>
<dl class="macro">
<dt id="c.NGHTTP2_ALTSVC">
<tt class="descname">NGHTTP2_ALTSVC</tt><a class="headerlink" href="#c.NGHTTP2_ALTSVC" title="Permalink to this definition"></a></dt>
<dd><p>(<tt class="docutils literal"><span class="pre">0x0a</span></tt>)
The ALTSVC 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_END_SEGMENT">
<tt class="descname">NGHTTP2_FLAG_END_SEGMENT</tt><a class="headerlink" href="#c.NGHTTP2_FLAG_END_SEGMENT" title="Permalink to this definition"></a></dt>
<dd><p>(<tt class="docutils literal"><span class="pre">0x02</span></tt>)
The END_SEGMENT flag.</p>
</dd></dl>
<dl class="macro">
<dt id="c.NGHTTP2_FLAG_PAD_LOW">
<tt class="descname">NGHTTP2_FLAG_PAD_LOW</tt><a class="headerlink" href="#c.NGHTTP2_FLAG_PAD_LOW" title="Permalink to this definition"></a></dt>
<dd><p>(<tt class="docutils literal"><span class="pre">0x08</span></tt>)
The PAD_LOW flag.</p>
</dd></dl>
<dl class="macro">
<dt id="c.NGHTTP2_FLAG_PAD_HIGH">
<tt class="descname">NGHTTP2_FLAG_PAD_HIGH</tt><a class="headerlink" href="#c.NGHTTP2_FLAG_PAD_HIGH" title="Permalink to this definition"></a></dt>
<dd><p>(<tt class="docutils literal"><span class="pre">0x10</span></tt>)
The PAD_HIGH flag.</p>
</dd></dl>
<dl class="macro">
<dt id="c.NGHTTP2_FLAG_PRIORITY_GROUP">
<tt class="descname">NGHTTP2_FLAG_PRIORITY_GROUP</tt><a class="headerlink" href="#c.NGHTTP2_FLAG_PRIORITY_GROUP" title="Permalink to this definition"></a></dt>
<dd><p>(<tt class="docutils literal"><span class="pre">0x20</span></tt>)
The PRIORITY_GROUP flag.</p>
</dd></dl>
<dl class="macro">
<dt id="c.NGHTTP2_FLAG_PRIORITY_DEPENDENCY">
<tt class="descname">NGHTTP2_FLAG_PRIORITY_DEPENDENCY</tt><a class="headerlink" href="#c.NGHTTP2_FLAG_PRIORITY_DEPENDENCY" title="Permalink to this definition"></a></dt>
<dd><p>(<tt class="docutils literal"><span class="pre">0x40</span></tt>)
The PRIORITY_DEPENDENCY 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">1</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">2</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">3</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">4</span></tt>)
SETTINGS_INITIAL_WINDOW_SIZE</p>
</dd></dl>
<dl class="macro">
<dt id="c.NGHTTP2_SETTINGS_MAX">
<tt class="descname">NGHTTP2_SETTINGS_MAX</tt><a class="headerlink" href="#c.NGHTTP2_SETTINGS_MAX" title="Permalink to this definition"></a></dt>
<dd><p>(<tt class="docutils literal"><span class="pre">4</span></tt>)
Maximum ID of <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>
</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">0</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">1</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">2</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">3</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">4</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">5</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">6</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">7</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">8</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">9</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">10</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">11</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">12</span></tt>)
INADEQUATE_SECURITY</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>
</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.</p>
</dd></dl>
</dd></dl>
<dl class="type">
<dt id="c.nghttp2_priority_type">
<tt class="descname">nghttp2_priority_type</tt><a class="headerlink" href="#c.nghttp2_priority_type" title="Permalink to this definition"></a></dt>
<dd><p>The type of priority specified in <a class="reference internal" href="#c.nghttp2_priority_spec" title="nghttp2_priority_spec"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_priority_spec</span></tt></a>.</p>
<dl class="macro">
<dt id="c.NGHTTP2_PRIORITY_TYPE_NONE">
<tt class="descname">NGHTTP2_PRIORITY_TYPE_NONE</tt><a class="headerlink" href="#c.NGHTTP2_PRIORITY_TYPE_NONE" title="Permalink to this definition"></a></dt>
<dd><p>(<tt class="docutils literal"><span class="pre">0</span></tt>)
No priority is given. The default priority will be used.</p>
</dd></dl>
<dl class="macro">
<dt id="c.NGHTTP2_PRIORITY_TYPE_GROUP">
<tt class="descname">NGHTTP2_PRIORITY_TYPE_GROUP</tt><a class="headerlink" href="#c.NGHTTP2_PRIORITY_TYPE_GROUP" title="Permalink to this definition"></a></dt>
<dd><p>(<tt class="docutils literal"><span class="pre">1</span></tt>)
Priority group ID and its weight are specified.</p>
</dd></dl>
<dl class="macro">
<dt id="c.NGHTTP2_PRIORITY_TYPE_DEP">
<tt class="descname">NGHTTP2_PRIORITY_TYPE_DEP</tt><a class="headerlink" href="#c.NGHTTP2_PRIORITY_TYPE_DEP" title="Permalink to this definition"></a></dt>
<dd><p>(<tt class="docutils literal"><span class="pre">2</span></tt>)
The stream ID of a stream to depend on and its exclusive flag is
specified.</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">
uint16_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">
uint16_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" title="nghttp2_frame"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_frame()</span></tt></a>.</p>
</dd></dl>
<dl class="member">
<dt id="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>
</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_falgs</em>.
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>.
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_group">
<tt class="descname">nghttp2_priority_group</tt><a class="headerlink" href="#c.nghttp2_priority_group" title="Permalink to this definition"></a></dt>
<dd><p>This structure stores priority group ID and its weight.</p>
<dl class="member">
<dt id="c.nghttp2_priority_group.pri_group_id">
int32_t <tt class="descname">pri_group_id</tt><a class="headerlink" href="#c.nghttp2_priority_group.pri_group_id" title="Permalink to this definition"></a></dt>
<dd><p>The priority group ID</p>
</dd></dl>
<dl class="member">
<dt id="c.nghttp2_priority_group.weight">
int32_t <tt class="descname">weight</tt><a class="headerlink" href="#c.nghttp2_priority_group.weight" title="Permalink to this definition"></a></dt>
<dd><p>The weight of the priority group</p>
</dd></dl>
</dd></dl>
<dl class="type">
<dt id="c.nghttp2_priority_dep">
<tt class="descname">nghttp2_priority_dep</tt><a class="headerlink" href="#c.nghttp2_priority_dep" title="Permalink to this definition"></a></dt>
<dd><p>This structure stores stream ID of the stream to depend on and its
dependency is exclusive or not.</p>
<dl class="member">
<dt id="c.nghttp2_priority_dep.stream_id">
int32_t <tt class="descname">stream_id</tt><a class="headerlink" href="#c.nghttp2_priority_dep.stream_id" title="Permalink to this definition"></a></dt>
<dd><p>The stream ID of the stream to depend on.</p>
</dd></dl>
<dl class="member">
<dt id="c.nghttp2_priority_dep.exclusive">
uint8_t <tt class="descname">exclusive</tt><a class="headerlink" href="#c.nghttp2_priority_dep.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_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. To specify stream
dependency, specify <em>pri_type</em> and fill the <em>group</em> or <em>dep</em> member
according to <em>pri_type</em>.</p>
<dl class="member">
<dt id="c.nghttp2_priority_spec.pri_type">
<a class="reference internal" href="#c.nghttp2_priority_type" title="nghttp2_priority_type">nghttp2_priority_type</a> <tt class="descname">pri_type</tt><a class="headerlink" href="#c.nghttp2_priority_spec.pri_type" title="Permalink to this definition"></a></dt>
<dd><p>Type of priority specification. If <em>pri_type</em> is
<a class="reference internal" href="#c.NGHTTP2_PRIORITY_TYPE_GROUP" title="NGHTTP2_PRIORITY_TYPE_GROUP"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_PRIORITY_TYPE_GROUP</span></tt></a>, fill <em>group</em>. If <em>pri_type</em>
is <a class="reference internal" href="#c.NGHTTP2_PRIORITY_TYPE_DEP" title="NGHTTP2_PRIORITY_TYPE_DEP"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_PRIORITY_TYPE_DEP</span></tt></a>, fill <em>dep</em>. If <em>pri_type</em>
is <a class="reference internal" href="#c.NGHTTP2_PRIORITY_TYPE_NONE" title="NGHTTP2_PRIORITY_TYPE_NONE"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_PRIORITY_TYPE_NONE</span></tt></a>, the other data members are
ignored and it means that default priority group ID (which is
same as the stream ID) and default 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> are specified.</p>
</dd></dl>
<dl class="member">
<dt id="c.nghttp2_priority_spec.group">
<a class="reference internal" href="#c.nghttp2_priority_group" title="nghttp2_priority_group">nghttp2_priority_group</a> <tt class="descname">group</tt><a class="headerlink" href="#c.nghttp2_priority_spec.group" title="Permalink to this definition"></a></dt>
<dd><p>Specify priority group ID and its weight. This field is
interpreted only when <em>pri_type</em> member is
<a class="reference internal" href="#c.NGHTTP2_PRIORITY_TYPE_GROUP" title="NGHTTP2_PRIORITY_TYPE_GROUP"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_PRIORITY_TYPE_GROUP</span></tt></a>.</p>
</dd></dl>
<dl class="member">
<dt id="c.nghttp2_priority_spec.dep">
<a class="reference internal" href="#c.nghttp2_priority_dep" title="nghttp2_priority_dep">nghttp2_priority_dep</a> <tt class="descname">dep</tt><a class="headerlink" href="#c.nghttp2_priority_spec.dep" title="Permalink to this definition"></a></dt>
<dd><p>Specify stream ID of a stream to depend on and exclusive flag.
This field is interpreted only when <em>pri_type</em> member is
<a class="reference internal" href="#c.NGHTTP2_PRIORITY_TYPE_DEP" title="NGHTTP2_PRIORITY_TYPE_DEP"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_PRIORITY_TYPE_DEP</span></tt></a>.</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">
<a class="reference internal" href="#c.nghttp2_error_code" title="nghttp2_error_code">nghttp2_error_code</a> <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>
</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">
<a class="reference internal" href="#c.nghttp2_error_code" title="nghttp2_error_code">nghttp2_error_code</a> <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>
</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>
</dd></dl>
<dl class="type">
<dt id="c.nghttp2_altsvc">
<tt class="descname">nghttp2_altsvc</tt><a class="headerlink" href="#c.nghttp2_altsvc" title="Permalink to this definition"></a></dt>
<dd><p>The ALTSVC frame. It has following members:</p>
<dl class="member">
<dt id="c.nghttp2_altsvc.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_altsvc.hd" title="Permalink to this definition"></a></dt>
<dd><p>The frame header.</p>
</dd></dl>
<dl class="member">
<dt id="c.nghttp2_altsvc.protocol_id">
uint8_t *<tt class="descname">protocol_id</tt><a class="headerlink" href="#c.nghttp2_altsvc.protocol_id" title="Permalink to this definition"></a></dt>
<dd><p>Protocol ID</p>
</dd></dl>
<dl class="member">
<dt id="c.nghttp2_altsvc.host">
uint8_t *<tt class="descname">host</tt><a class="headerlink" href="#c.nghttp2_altsvc.host" title="Permalink to this definition"></a></dt>
<dd><p>Host</p>
</dd></dl>
<dl class="member">
<dt id="c.nghttp2_altsvc.origin">
uint8_t *<tt class="descname">origin</tt><a class="headerlink" href="#c.nghttp2_altsvc.origin" title="Permalink to this definition"></a></dt>
<dd><p>Origin</p>
</dd></dl>
<dl class="member">
<dt id="c.nghttp2_altsvc.protocol_id_len">
size_t <tt class="descname">protocol_id_len</tt><a class="headerlink" href="#c.nghttp2_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_altsvc.host_len">
size_t <tt class="descname">host_len</tt><a class="headerlink" href="#c.nghttp2_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_altsvc.origin_len">
size_t <tt class="descname">origin_len</tt><a class="headerlink" href="#c.nghttp2_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_altsvc.max_age">
uint32_t <tt class="descname">max_age</tt><a class="headerlink" href="#c.nghttp2_altsvc.max_age" title="Permalink to this definition"></a></dt>
<dd><p>Max-Age</p>
</dd></dl>
<dl class="member">
<dt id="c.nghttp2_altsvc.port">
uint16_t <tt class="descname">port</tt><a class="headerlink" href="#c.nghttp2_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.altsvc">
<a class="reference internal" href="#c.nghttp2_altsvc" title="nghttp2_altsvc">nghttp2_altsvc</a> <tt class="descname">altsvc</tt><a class="headerlink" href="#c.nghttp2_frame.altsvc" title="Permalink to this definition"></a></dt>
<dd><p>The ALTSVC 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>
</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>
</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>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>
</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>, <a class="reference internal" href="#c.nghttp2_error_code" title="nghttp2_error_code">nghttp2_error_code</a><em>&nbsp;error_code</em>, void<em>&nbsp;*user_data</em><big>)</big><a class="headerlink" href="#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> is 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> and indicates the error. When this
callback function is invoked, the library automatically submits
either RST_STREAM or GOAWAY frame. The <em>user_data</em> pointer is the
third argument passed in to the call to
<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>
</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>
</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 before the non-DATA frame <em>frame</em> is
sent. This may be useful, for example, to know the stream ID of
HEADERS and PUSH_PROMISE frame (see also
<a class="reference internal" href="#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>), which is not assigned
when it was queued. The <em>user_data</em> pointer is the third argument
passed in to the call to <a class="reference internal" href="#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>
</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>
</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>
</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>, <a class="reference internal" href="#c.nghttp2_error_code" title="nghttp2_error_code">nghttp2_error_code</a><em>&nbsp;error_code</em>, void<em>&nbsp;*user_data</em><big>)</big><a class="headerlink" href="#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
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>
</dd></dl>
<dl class="type">
<dt id="c.nghttp2_on_unknown_frame_recv_callback">
typedef int <tt class="descname">(*nghttp2_on_unknown_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 uint8_t<em>&nbsp;*head</em>, size_t<em>&nbsp;headlen</em>, const uint8_t<em>&nbsp;*payload</em>, size_t<em>&nbsp;payloadlen</em>, void<em>&nbsp;*user_data</em><big>)</big><a class="headerlink" href="#c.nghttp2_on_unknown_frame_recv_callback" title="Permalink to this definition"></a></dt>
<dd><p>Callback function invoked when the received frame type is unknown.
The <em>head</em> is the pointer to the header of the received frame. The
<em>headlen</em> is the length of the <em>head</em>. According to the spec, the
<em>headlen</em> is always 8. In other words, the <em>head</em> is the first 8
bytes of the received frame. The <em>payload</em> is the pointer to the
data portion of the received frame. The <em>payloadlen</em> is the length
of the <em>payload</em>. This is the data after the length field. 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>
</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 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>
</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.</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>name</em> may be <tt class="docutils literal"><span class="pre">NULL</span></tt> if the <em>namelen</em> is 0. The same thing
can be said about the <em>value</em>.</p>
<p>Please note that nghttp2 library does not perform any validity
check against the <em>name</em> and the <em>value</em>. For example, the
<em>namelen</em> could be 0, and/or the <em>value</em> contains <tt class="docutils literal"><span class="pre">0x0a</span></tt> or
<tt class="docutils literal"><span class="pre">0x0d</span></tt>. The application must check them if it matters. The
helper function <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> provide simple validation against
HTTP2 header field construction rule.</p>
<p>One more thing to note is that the <em>value</em> may contain <tt class="docutils literal"><span class="pre">NULL</span></tt>
(<tt class="docutils literal"><span class="pre">0x00</span></tt>) characters. It is used to concatenate header values
which share the same header field name. The application should
split these values if it wants to get individual value. This
concatenation is used in order to keep the ordering of headers.</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.</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>
</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>
</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.</p>
<dl class="member">
<dt id="c.nghttp2_session_callbacks.send_callback">
<a class="reference internal" href="#c.nghttp2_send_callback" title="nghttp2_send_callback">nghttp2_send_callback</a> <tt class="descname">send_callback</tt><a class="headerlink" href="#c.nghttp2_session_callbacks.send_callback" title="Permalink to this definition"></a></dt>
<dd><p>Callback function invoked when the <em>session</em> wants to send data
to the remote peer. 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="member">
<dt id="c.nghttp2_session_callbacks.recv_callback">
<a class="reference internal" href="#c.nghttp2_recv_callback" title="nghttp2_recv_callback">nghttp2_recv_callback</a> <tt class="descname">recv_callback</tt><a class="headerlink" href="#c.nghttp2_session_callbacks.recv_callback" title="Permalink to this definition"></a></dt>
<dd><p>Callback function invoked when the <em>session</em> wants to receive
data from the remote peer. 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="member">
<dt id="c.nghttp2_session_callbacks.on_frame_recv_callback">
<a class="reference internal" href="#c.nghttp2_on_frame_recv_callback" title="nghttp2_on_frame_recv_callback">nghttp2_on_frame_recv_callback</a> <tt class="descname">on_frame_recv_callback</tt><a class="headerlink" href="#c.nghttp2_session_callbacks.on_frame_recv_callback" title="Permalink to this definition"></a></dt>
<dd><p>Callback function invoked by <a class="reference internal" href="#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="member">
<dt id="c.nghttp2_session_callbacks.on_invalid_frame_recv_callback">
<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> <tt class="descname">on_invalid_frame_recv_callback</tt><a class="headerlink" href="#c.nghttp2_session_callbacks.on_invalid_frame_recv_callback" title="Permalink to this definition"></a></dt>
<dd><p>Callback function invoked by <a class="reference internal" href="#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="member">
<dt id="c.nghttp2_session_callbacks.on_data_chunk_recv_callback">
<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> <tt class="descname">on_data_chunk_recv_callback</tt><a class="headerlink" href="#c.nghttp2_session_callbacks.on_data_chunk_recv_callback" title="Permalink to this definition"></a></dt>
<dd><p>Callback function invoked when a chunk of data in DATA frame is
received.</p>
</dd></dl>
<dl class="member">
<dt id="c.nghttp2_session_callbacks.before_frame_send_callback">
<a class="reference internal" href="#c.nghttp2_before_frame_send_callback" title="nghttp2_before_frame_send_callback">nghttp2_before_frame_send_callback</a> <tt class="descname">before_frame_send_callback</tt><a class="headerlink" href="#c.nghttp2_session_callbacks.before_frame_send_callback" title="Permalink to this definition"></a></dt>
<dd><p>Callback function invoked before a non-DATA frame is sent.</p>
</dd></dl>
<dl class="member">
<dt id="c.nghttp2_session_callbacks.on_frame_send_callback">
<a class="reference internal" href="#c.nghttp2_on_frame_send_callback" title="nghttp2_on_frame_send_callback">nghttp2_on_frame_send_callback</a> <tt class="descname">on_frame_send_callback</tt><a class="headerlink" href="#c.nghttp2_session_callbacks.on_frame_send_callback" title="Permalink to this definition"></a></dt>
<dd><p>Callback function invoked after a frame is sent.</p>
</dd></dl>
<dl class="member">
<dt id="c.nghttp2_session_callbacks.on_frame_not_send_callback">
<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> <tt class="descname">on_frame_not_send_callback</tt><a class="headerlink" href="#c.nghttp2_session_callbacks.on_frame_not_send_callback" title="Permalink to this definition"></a></dt>
<dd><p>The callback function invoked when a non-DATA frame is not sent
because of an error.</p>
</dd></dl>
<dl class="member">
<dt id="c.nghttp2_session_callbacks.on_stream_close_callback">
<a class="reference internal" href="#c.nghttp2_on_stream_close_callback" title="nghttp2_on_stream_close_callback">nghttp2_on_stream_close_callback</a> <tt class="descname">on_stream_close_callback</tt><a class="headerlink" href="#c.nghttp2_session_callbacks.on_stream_close_callback" title="Permalink to this definition"></a></dt>
<dd><p>Callback function invoked when the stream is closed.</p>
</dd></dl>
<dl class="member">
<dt id="c.nghttp2_session_callbacks.on_unknown_frame_recv_callback">
<a class="reference internal" href="#c.nghttp2_on_unknown_frame_recv_callback" title="nghttp2_on_unknown_frame_recv_callback">nghttp2_on_unknown_frame_recv_callback</a> <tt class="descname">on_unknown_frame_recv_callback</tt><a class="headerlink" href="#c.nghttp2_session_callbacks.on_unknown_frame_recv_callback" title="Permalink to this definition"></a></dt>
<dd><p>Callback function invoked when the received frame type is
unknown.</p>
</dd></dl>
<dl class="member">
<dt id="c.nghttp2_session_callbacks.on_begin_headers_callback">
<a class="reference internal" href="#c.nghttp2_on_begin_headers_callback" title="nghttp2_on_begin_headers_callback">nghttp2_on_begin_headers_callback</a> <tt class="descname">on_begin_headers_callback</tt><a class="headerlink" href="#c.nghttp2_session_callbacks.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.</p>
</dd></dl>
<dl class="member">
<dt id="c.nghttp2_session_callbacks.on_header_callback">
<a class="reference internal" href="#c.nghttp2_on_header_callback" title="nghttp2_on_header_callback">nghttp2_on_header_callback</a> <tt class="descname">on_header_callback</tt><a class="headerlink" href="#c.nghttp2_session_callbacks.on_header_callback" title="Permalink to this definition"></a></dt>
<dd><p>Callback function invoked when a header name/value pair is
received.</p>
</dd></dl>
<dl class="member">
<dt id="c.nghttp2_session_callbacks.select_padding_callback">
<a class="reference internal" href="#c.nghttp2_select_padding_callback" title="nghttp2_select_padding_callback">nghttp2_select_padding_callback</a> <tt class="descname">select_padding_callback</tt><a class="headerlink" href="#c.nghttp2_session_callbacks.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 given
frame.</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_gzip">
<tt class="descname">nghttp2_gzip</tt><a class="headerlink" href="#c.nghttp2_gzip" title="Permalink to this definition"></a></dt>
<dd><p>The gzip stream to inflate data. The details of this structure are
intentionally hidden from the public API.</p>
</dd></dl>
</div>
<div class="section" id="functions">
<h2>Functions<a class="headerlink" href="#functions" title="Permalink to this headline"></a></h2>
<dl class="function">
<dt id="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_stream_window_update">
void <tt class="descname">nghttp2_option_set_no_auto_stream_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_stream_window_update" title="Permalink to this definition"></a></dt>
<dd><p>This option prevents the library from sending WINDOW_UPDATE for a
stream automatically. If this option is set to nonzero, the
library won&#8217;t send WINDOW_UPDATE for a stream and the application
is responsible for sending WINDOW_UPDATE using
<a class="reference internal" href="#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>. By default, this option is set to
zero.</p>
</dd></dl>
<dl class="function">
<dt id="c.nghttp2_option_set_no_auto_connection_window_update">
void <tt class="descname">nghttp2_option_set_no_auto_connection_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_connection_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&#8217;t send WINDOW_UPDATE for a connection and the
application is responsible for sending WINDOW_UPDATE with stream ID
0 using <a class="reference internal" href="#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>. 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_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_session_callbacks.send_callback" title="nghttp2_session_callbacks.send_callback"><tt class="xref c c-member docutils literal"><span class="pre">nghttp2_session_callbacks.send_callback</span></tt></a> must be
specified. If the application code uses <a class="reference internal" href="#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_session_callbacks.recv_callback" title="nghttp2_session_callbacks.recv_callback"><tt class="xref c c-member docutils literal"><span class="pre">nghttp2_session_callbacks.recv_callback</span></tt></a> must be
specified. The other members of <em>callbacks</em> can be <tt class="docutils literal"><span class="pre">NULL</span></tt>.</p>
<p>This function returns 0 if it succeeds, or one of the following
negative error codes:</p>
<dl class="docutils">
<dt><a class="reference internal" href="#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_session_callbacks.send_callback" title="nghttp2_session_callbacks.send_callback"><tt class="xref c c-member docutils literal"><span class="pre">nghttp2_session_callbacks.send_callback</span></tt></a> must be
specified. If the application code uses <a class="reference internal" href="#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_session_callbacks.recv_callback" title="nghttp2_session_callbacks.recv_callback"><tt class="xref c c-member docutils literal"><span class="pre">nghttp2_session_callbacks.recv_callback</span></tt></a> must be
specified. The other members of <em>callbacks</em> can be <tt class="docutils literal"><span class="pre">NULL</span></tt>.</p>
<p>This function returns 0 if it succeeds, or one of the following
negative error codes:</p>
<dl class="docutils">
<dt><a class="reference internal" href="#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_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_session_callbacks.send_callback" title="nghttp2_session_callbacks.send_callback"><tt class="xref c c-member docutils literal"><span class="pre">nghttp2_session_callbacks.send_callback</span></tt></a> returns
<a class="reference internal" href="#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_session_callbacks.on_frame_not_send_callback" title="nghttp2_session_callbacks.on_frame_not_send_callback"><tt class="xref c c-member docutils literal"><span class="pre">nghttp2_session_callbacks.on_frame_not_send_callback</span></tt></a>
is invoked. Abort the following steps.</li>
<li>If the frame is HEADERS, PUSH_PROMISE or DATA,
<a class="reference internal" href="#c.nghttp2_session_callbacks.select_padding_callback" title="nghttp2_session_callbacks.select_padding_callback"><tt class="xref c c-member docutils literal"><span class="pre">nghttp2_session_callbacks.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_session_callbacks.before_frame_send_callback" title="nghttp2_session_callbacks.before_frame_send_callback"><tt class="xref c c-member docutils literal"><span class="pre">nghttp2_session_callbacks.before_frame_send_callback</span></tt></a> is
invoked.</li>
<li><a class="reference internal" href="#c.nghttp2_session_callbacks.send_callback" title="nghttp2_session_callbacks.send_callback"><tt class="xref c c-member docutils literal"><span class="pre">nghttp2_session_callbacks.send_callback</span></tt></a> is invoked one
or more times to send the frame.</li>
<li><a class="reference internal" href="#c.nghttp2_session_callbacks.on_frame_send_callback" title="nghttp2_session_callbacks.on_frame_send_callback"><tt class="xref c c-member docutils literal"><span class="pre">nghttp2_session_callbacks.on_frame_send_callback</span></tt></a> is
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_session_callbacks.on_stream_close_callback" title="nghttp2_session_callbacks.on_stream_close_callback"><tt class="xref c c-member docutils literal"><span class="pre">nghttp2_session_callbacks.on_stream_close_callback</span></tt></a> is
invoked.</li>
</ol>
<p>This function returns 0 if it succeeds, or one of the following
negative error codes:</p>
<dl class="docutils">
<dt><a class="reference internal" href="#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_session_callbacks.send_callback" title="nghttp2_session_callbacks.send_callback"><tt class="xref c c-member docutils literal"><span class="pre">nghttp2_session_callbacks.send_callback</span></tt></a> 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_session_callbacks.recv_callback" title="nghttp2_session_callbacks.recv_callback"><tt class="xref c c-member docutils literal"><span class="pre">nghttp2_session_callbacks.recv_callback</span></tt></a> returns
<a class="reference internal" href="#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_session_callbacks.recv_callback" title="nghttp2_session_callbacks.recv_callback"><tt class="xref c c-member docutils literal"><span class="pre">nghttp2_session_callbacks.recv_callback</span></tt></a> is invoked one
or more times to receive frame header.</li>
<li>If the frame is DATA frame:<ol class="arabic">
<li><a class="reference internal" href="#c.nghttp2_session_callbacks.recv_callback" title="nghttp2_session_callbacks.recv_callback"><tt class="xref c c-member docutils literal"><span class="pre">nghttp2_session_callbacks.recv_callback</span></tt></a> is invoked
to receive DATA payload. For each chunk of data,
<a class="reference internal" href="#c.nghttp2_session_callbacks.on_data_chunk_recv_callback" title="nghttp2_session_callbacks.on_data_chunk_recv_callback"><tt class="xref c c-member docutils literal"><span class="pre">nghttp2_session_callbacks.on_data_chunk_recv_callback</span></tt></a>
is invoked.</li>
<li>If one DATA frame is completely received,
<a class="reference internal" href="#c.nghttp2_session_callbacks.on_frame_recv_callback" title="nghttp2_session_callbacks.on_frame_recv_callback"><tt class="xref c c-member docutils literal"><span class="pre">nghttp2_session_callbacks.on_frame_recv_callback</span></tt></a> is
invoked. If the reception of the frame triggers the
closure of the stream,
<a class="reference internal" href="#c.nghttp2_session_callbacks.on_stream_close_callback" title="nghttp2_session_callbacks.on_stream_close_callback"><tt class="xref c c-member docutils literal"><span class="pre">nghttp2_session_callbacks.on_stream_close_callback</span></tt></a>
is invoked.</li>
</ol>
</li>
<li>If the frame is the control frame:<ol class="arabic">
<li><a class="reference internal" href="#c.nghttp2_session_callbacks.recv_callback" title="nghttp2_session_callbacks.recv_callback"><tt class="xref c c-member docutils literal"><span class="pre">nghttp2_session_callbacks.recv_callback</span></tt></a> is invoked
one or more times to receive whole frame.</li>
<li>If the received frame is valid, then following actions are
taken. If the frame is either HEADERS or PUSH_PROMISE,
<a class="reference internal" href="#c.nghttp2_session_callbacks.on_begin_headers_callback" title="nghttp2_session_callbacks.on_begin_headers_callback"><tt class="xref c c-member docutils literal"><span class="pre">nghttp2_session_callbacks.on_begin_headers_callback</span></tt></a>
is invoked. Then
<a class="reference internal" href="#c.nghttp2_session_callbacks.on_header_callback" title="nghttp2_session_callbacks.on_header_callback"><tt class="xref c c-member docutils literal"><span class="pre">nghttp2_session_callbacks.on_header_callback</span></tt></a> is
invoked for each header name/value pair. After all name/value
pairs are emitted successfully,
<a class="reference internal" href="#c.nghttp2_session_callbacks.on_frame_recv_callback" title="nghttp2_session_callbacks.on_frame_recv_callback"><tt class="xref c c-member docutils literal"><span class="pre">nghttp2_session_callbacks.on_frame_recv_callback</span></tt></a> is
invoked. For other frames,
<a class="reference internal" href="#c.nghttp2_session_callbacks.on_frame_recv_callback" title="nghttp2_session_callbacks.on_frame_recv_callback"><tt class="xref c c-member docutils literal"><span class="pre">nghttp2_session_callbacks.on_frame_recv_callback</span></tt></a> is
invoked.
If the reception of the frame triggers the closure of the
stream,
<a class="reference internal" href="#c.nghttp2_session_callbacks.on_stream_close_callback" title="nghttp2_session_callbacks.on_stream_close_callback"><tt class="xref c c-member docutils literal"><span class="pre">nghttp2_session_callbacks.on_stream_close_callback</span></tt></a>
is invoked.</li>
<li>If the received frame is unpacked but is interpreted as
invalid,
<a class="reference internal" href="#c.nghttp2_session_callbacks.on_invalid_frame_recv_callback" title="nghttp2_session_callbacks.on_invalid_frame_recv_callback"><tt class="xref c c-member docutils literal"><span class="pre">nghttp2_session_callbacks.on_invalid_frame_recv_callback</span></tt></a>
is invoked.</li>
<li>If the received frame type is unknown,
<a class="reference internal" href="#c.nghttp2_session_callbacks.on_unknown_frame_recv_callback" title="nghttp2_session_callbacks.on_unknown_frame_recv_callback"><tt class="xref c c-member docutils literal"><span class="pre">nghttp2_session_callbacks.on_unknown_frame_recv_callback</span></tt></a>
is invoked.</li>
</ol>
</li>
</ol>
<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>
</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_session_callbacks.recv_callback" title="nghttp2_session_callbacks.recv_callback"><tt class="xref c c-member docutils literal"><span class="pre">nghttp2_session_callbacks.recv_callback</span></tt></a> to
receive data; the <em>in</em> is the only data for the invocation of this
function. If all bytes are processed, this function returns. The
other callbacks are called in the same way as they are in
<a class="reference internal" href="#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_session_callbacks.on_header_callback" title="nghttp2_session_callbacks.on_header_callback"><tt class="xref c c-member docutils literal"><span class="pre">nghttp2_session_callbacks.on_header_callback</span></tt></a> or
<a class="reference internal" href="#c.nghttp2_session_callbacks.on_data_chunk_recv_callback" title="nghttp2_session_callbacks.on_data_chunk_recv_callback"><tt class="xref c c-member docutils literal"><span class="pre">nghttp2_session_callbacks.on_data_chunk_recv_callback</span></tt></a>.
If <a class="reference internal" href="#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>
</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; or data
was deferred by flow control.</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>.
This is the amount of flow-controlled payload (e.g., DATA) that the
local endpoint can send without WINDOW_UPDATE.</p>
<p>This function returns -1 if it fails.</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>, <a class="reference internal" href="#c.nghttp2_error_code" title="nghttp2_error_code">nghttp2_error_code</a><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>GOAWAY frame with the given <em>error_code</em> will be submitted if it
has not been transmitted. After the transmission, both
<a class="reference internal" href="#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. If GOAWAY frame has already transmitted at the time when
this function is invoked, <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> returns 0 immediately after this
function succeeds.</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_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_group_init">
void <tt class="descname">nghttp2_priority_spec_group_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;pri_group_id</em>, int32_t<em>&nbsp;weight</em><big>)</big><a class="headerlink" href="#c.nghttp2_priority_spec_group_init" title="Permalink to this definition"></a></dt>
<dd><p>Initializes <em>pri_spec</em> with priority group ID <em>pri_group_id</em> and
its weight <em>weight</em>.</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. If <em>weight</em> 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>To specify weight for the default priority group (which is the same
as the stream ID of the stream) 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> and
<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 its stream ID is not known in
advance, specify -1 to <em>pri_group_id</em>.</p>
</dd></dl>
<dl class="function">
<dt id="c.nghttp2_priority_spec_dep_init">
void <tt class="descname">nghttp2_priority_spec_dep_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>, int<em>&nbsp;exclusive</em><big>)</big><a class="headerlink" href="#c.nghttp2_priority_spec_dep_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 and its exclusive flag. If <em>exclusive</em> is nonzero, exclusive
flag is set.</p>
</dd></dl>
<dl class="function">
<dt id="c.nghttp2_submit_request">
int <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 (priority group ID becomes its stream ID
and weight is <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>). To specify the
priority, use either <a class="reference internal" href="#c.nghttp2_priority_spec_group_init" title="nghttp2_priority_spec_group_init"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_priority_spec_group_init()</span></tt></a> or
<a class="reference internal" href="#c.nghttp2_priority_spec_dep_init" title="nghttp2_priority_spec_dep_init"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_priority_spec_dep_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 <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 value is opaque sequence of bytes and
therefore can contain NULL byte (0x0). If the application requires
that the ordering of values for a single header field name
appearing in different header fields, it has to concatenate them
using NULL byte (0x0) before passing them to this function.</p>
<p>HTTP/2 specification has requirement about header fields in the
request HEADERS. See the specification for more details.</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>.</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>Since the library reorders the frames and tries to send the highest
prioritized one first and the HTTP/2 specification requires the
stream ID must be strictly increasing, the stream ID of this
request cannot be known until it is about to sent. To know the
stream ID of the request, the application can use
<a class="reference internal" href="#c.nghttp2_session_callbacks.before_frame_send_callback" title="nghttp2_session_callbacks.before_frame_send_callback"><tt class="xref c c-member docutils literal"><span class="pre">nghttp2_session_callbacks.before_frame_send_callback</span></tt></a>.
This callback is called just before the frame is sent. For HEADERS
frame, the argument frame has the stream ID assigned. Also since
the stream is already opened,
<a class="reference internal" href="#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
<em>stream_user_data</em> to identify which HEADERS we are processing.</p>
<p>This function returns 0 if it succeeds, or one of the following
negative error codes:</p>
<dl class="docutils">
<dt><a class="reference internal" href="#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>pri_spec-&gt;pri_type</em> is invalid.</dd>
</dl>
</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 value is opaque sequence of bytes and
therefore can contain NULL byte (0x0). If the application requires
that the ordering of values for a single header field name
appearing in different header fields, it has to concatenate them
using NULL byte (0x0) before passing them to this function.</p>
<p>HTTP/2 specification has requirement about header fields in the
response HEADERS. See the specification for more details.</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>.</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>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_headers">
int <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
actual stream ID is assigned just before the frame is sent. For
response, specify stream ID in <em>stream_id</em>.</p>
<p>The <em>pri_spec</em> is priority specification of this request. <tt class="docutils literal"><span class="pre">NULL</span></tt>
means the default priority (priority group ID becomes its stream ID
and weight is <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>). To specify the
priority, use either <a class="reference internal" href="#c.nghttp2_priority_spec_group_init" title="nghttp2_priority_spec_group_init"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_priority_spec_group_init()</span></tt></a> or
<a class="reference internal" href="#c.nghttp2_priority_spec_dep_init" title="nghttp2_priority_spec_dep_init"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_priority_spec_dep_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 <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 value is opaque sequence of bytes and
therefore can contain NULL byte (0x0). If the application requires
that the ordering of values for a single header field name
appearing in different header fields, it has to concatenate them
using NULL byte (0x0) before passing them to this function.</p>
<p>This function creates copies of all name/value pairs in <em>nva</em>. It
also lower-cases all names in <em>nva</em>.</p>
<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 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>pri_spec-&gt;pri_type</em> is invalid.</dd>
</dl>
</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. If <em>flags</em> contains <a class="reference internal" href="#c.NGHTTP2_FLAG_END_SEGMENT" title="NGHTTP2_FLAG_END_SEGMENT"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_FLAG_END_SEGMENT</span></tt></a>,
the last DATA frame has END_SEGMENT 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>
</dl>
</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
either <a class="reference internal" href="#c.nghttp2_priority_spec_group_init" title="nghttp2_priority_spec_group_init"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_priority_spec_group_init()</span></tt></a> or
<a class="reference internal" href="#c.nghttp2_priority_spec_dep_init" title="nghttp2_priority_spec_dep_init"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_priority_spec_dep_init()</span></tt></a>. This function will copy its
data members.</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>pri_spec</em> is NULL; or the <em>pri_spec-&gt;pri_type</em> is invalid;
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>, <a class="reference internal" href="#c.nghttp2_error_code" title="nghttp2_error_code">nghttp2_error_code</a><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 <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>
</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&#8217;s local window size, if the window
size becomes strictly larger than NGHTTP2_MAX_WINDOW_SIZE,
RST_STREAM is issued against such a stream.</p>
<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">
int <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 value is opaque sequence of bytes and
therefore can contain NULL byte (0x0). If the application requires
that the ordering of values for a single header field name
appearing in different header fields, it has to concatenate them
using NULL byte (0x0) before passing them to this function.</p>
<p>This function creates copies of all name/value pairs in <em>nva</em>. It
also lower-cases all names in <em>nva</em>.</p>
<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>Since the library reorders the frames and tries to send the highest
prioritized one first and the HTTP/2 specification requires the
stream ID must be strictly increasing, the promised stream ID
cannot be known until it is about to sent. To know the promised
stream ID, the application can use
<a class="reference internal" href="#c.nghttp2_session_callbacks.before_frame_send_callback" title="nghttp2_session_callbacks.before_frame_send_callback"><tt class="xref c c-member docutils literal"><span class="pre">nghttp2_session_callbacks.before_frame_send_callback</span></tt></a>.
This callback is called just before the frame is sent. For
PUSH_PROMISE frame, the argument frame has the promised stream ID
assigned.</p>
<p>The client side is not allowed to use this function.</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_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>
</dl>
</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>, 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&#8217;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>, <a class="reference internal" href="#c.nghttp2_error_code" title="nghttp2_error_code">nghttp2_error_code</a><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 error code <em>error_code</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>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>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>NGHTTP2_ERR_INVALID_ARGUMENT</dt>
<dd>The <em>opaque_data_len</em> is too large.</dd>
</dl>
</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
<tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_OPT_NO_AUTO_STREAM_WINDOW_UPDATE</span></tt> (or
<tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_OPT_NO_AUTO_CONNECTION_WINDOW_UPDATE</span></tt> if <em>stream_id</em>
is 0) is not set and the library decided that the WINDOW_UPDATE
should be submitted, then WINDOW_UPDATE is queued with the current
received bytes count.</p>
<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>Submits ALTSVC frame with given parameters.</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>Only the server can send the ALTSVC frame. If <em>session</em> is
initialized as client, this function fails and 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>If the <em>protocol_id_len</em> is 0, the <em>protocol_id</em> could be <tt class="docutils literal"><span class="pre">NULL</span></tt>.</p>
<p>If the <em>host_len</em> is 0, the <em>host</em> could be <tt class="docutils literal"><span class="pre">NULL</span></tt>.</p>
<p>If the <em>origin_len</em> is 0, the <em>origin</em> could be <tt class="docutils literal"><span class="pre">NULL</span></tt>.</p>
<p>This function returns 0 if it succeeds, or one of the following
negative error codes:</p>
<dl class="docutils">
<dt><a class="reference internal" href="#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>The function is invoked with <em>session</em> which was initialized as
client.</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 combined length of <em>protocol_id_len</em>, <em>host_len</em> and
<em>origin_len</em> is is too large.</dd>
</dl>
</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&#8217;s protocol list in preferable
order. The format of <em>in</em> is length-prefixed and not
null-terminated. For example, <tt class="docutils literal"><span class="pre">HTTP-draft-04/2.0</span></tt> and
<tt class="docutils literal"><span class="pre">http/1.1</span></tt> stored in <em>in</em> like this:</p>
<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&#8217;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&#8217;s list contains <tt class="docutils literal"><span class="pre">http/1.1</span></tt>, this function selects
<tt class="docutils literal"><span class="pre">http/1.1</span></tt> and returns 0. The following step is not taken.</li>
<li>This function selects nothing and returns -1 (So called
non-overlap case). In this case, <em>out</em> and <em>outlen</em> are left
untouched.</li>
</ol>
<p>Selecting <tt class="docutils literal"><span class="pre">HTTP-draft-04/2.0</span></tt> means that <tt class="docutils literal"><span class="pre">HTTP-draft-04/2.0</span></tt> is
written into <em>*out</em> and its length (which is 17) is assigned to
<em>*outlen</em>.</p>
<p>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_gzip_inflate_new">
int <tt class="descname">nghttp2_gzip_inflate_new</tt><big>(</big><a class="reference internal" href="#c.nghttp2_gzip" title="nghttp2_gzip">nghttp2_gzip</a><em>&nbsp;**inflater_ptr</em><big>)</big><a class="headerlink" href="#c.nghttp2_gzip_inflate_new" title="Permalink to this definition"></a></dt>
<dd><p>A helper function to set up a per request gzip stream to inflate
data.</p>
<p>This function returns 0 if it succeeds, or one of the following
negative error codes:</p>
<dl class="docutils">
<dt><a class="reference internal" href="#c.NGHTTP2_ERR_GZIP" title="NGHTTP2_ERR_GZIP"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_ERR_GZIP</span></tt></a></dt>
<dd>The initialization of gzip stream failed.</dd>
<dt><a class="reference internal" href="#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_gzip_inflate_del">
void <tt class="descname">nghttp2_gzip_inflate_del</tt><big>(</big><a class="reference internal" href="#c.nghttp2_gzip" title="nghttp2_gzip">nghttp2_gzip</a><em>&nbsp;*inflater</em><big>)</big><a class="headerlink" href="#c.nghttp2_gzip_inflate_del" title="Permalink to this definition"></a></dt>
<dd><p>Frees the inflate stream. The <em>inflater</em> may be <tt class="docutils literal"><span class="pre">NULL</span></tt>.</p>
</dd></dl>
<dl class="function">
<dt id="c.nghttp2_gzip_inflate">
int <tt class="descname">nghttp2_gzip_inflate</tt><big>(</big><a class="reference internal" href="#c.nghttp2_gzip" title="nghttp2_gzip">nghttp2_gzip</a><em>&nbsp;*inflater</em>, uint8_t<em>&nbsp;*out</em>, size_t<em>&nbsp;*outlen_ptr</em>, const uint8_t<em>&nbsp;*in</em>, size_t<em>&nbsp;*inlen_ptr</em><big>)</big><a class="headerlink" href="#c.nghttp2_gzip_inflate" title="Permalink to this definition"></a></dt>
<dd><p>Inflates data in <em>in</em> with the length <em>*inlen_ptr</em> and stores the
inflated data to <em>out</em> which has allocated size at least
<em>*outlen_ptr</em>. On return, <em>*outlen_ptr</em> is updated to represent
the number of data written in <em>out</em>. Similarly, <em>*inlen_ptr</em> is
updated to represent the number of input bytes processed.</p>
<p>This function returns 0 if it succeeds, or one of the following
negative error codes:</p>
<dl class="docutils">
<dt><a class="reference internal" href="#c.NGHTTP2_ERR_GZIP" title="NGHTTP2_ERR_GZIP"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_ERR_GZIP</span></tt></a></dt>
<dd>The inflation of gzip stream failed.</dd>
</dl>
<p>The example follows:</p>
<div class="highlight-c"><div class="highlight"><pre><span class="kt">void</span> <span class="nf">on_data_chunk_recv_callback</span><span class="p">(</span><span class="n">nghttp2_session</span> <span class="o">*</span><span class="n">session</span><span class="p">,</span>
<span class="kt">uint8_t</span> <span class="n">flags</span><span class="p">,</span>
<span class="kt">int32_t</span> <span class="n">stream_id</span><span class="p">,</span>
<span class="k">const</span> <span class="kt">uint8_t</span> <span class="o">*</span><span class="n">data</span><span class="p">,</span> <span class="kt">size_t</span> <span class="n">len</span><span class="p">,</span>
<span class="kt">void</span> <span class="o">*</span><span class="n">user_data</span><span class="p">)</span>
<span class="p">{</span>
<span class="p">...</span>
<span class="n">req</span> <span class="o">=</span> <span class="n">nghttp2_session_get_stream_user_data</span><span class="p">(</span><span class="n">session</span><span class="p">,</span> <span class="n">stream_id</span><span class="p">);</span>
<span class="n">nghttp2_gzip</span> <span class="o">*</span><span class="n">inflater</span> <span class="o">=</span> <span class="n">req</span><span class="o">-&gt;</span><span class="n">inflater</span><span class="p">;</span>
<span class="k">while</span><span class="p">(</span><span class="n">len</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">)</span> <span class="p">{</span>
<span class="kt">uint8_t</span> <span class="n">out</span><span class="p">[</span><span class="n">MAX_OUTLEN</span><span class="p">];</span>
<span class="kt">size_t</span> <span class="n">outlen</span> <span class="o">=</span> <span class="n">MAX_OUTLEN</span><span class="p">;</span>
<span class="kt">size_t</span> <span class="n">tlen</span> <span class="o">=</span> <span class="n">len</span><span class="p">;</span>
<span class="kt">int</span> <span class="n">rv</span><span class="p">;</span>
<span class="n">rv</span> <span class="o">=</span> <span class="n">nghttp2_gzip_inflate</span><span class="p">(</span><span class="n">inflater</span><span class="p">,</span> <span class="n">out</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">outlen</span><span class="p">,</span> <span class="n">data</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">tlen</span><span class="p">);</span>
<span class="k">if</span><span class="p">(</span><span class="n">rv</span> <span class="o">!=</span> <span class="mi">0</span><span class="p">)</span> <span class="p">{</span>
<span class="n">nghttp2_submit_rst_stream</span><span class="p">(</span><span class="n">session</span><span class="p">,</span> <span class="n">stream_id</span><span class="p">,</span>
<span class="n">NGHTTP2_INTERNAL_ERROR</span><span class="p">);</span>
<span class="k">break</span><span class="p">;</span>
<span class="p">}</span>
<span class="p">...</span> <span class="n">Do</span> <span class="n">stuff</span> <span class="p">...</span>
<span class="n">data</span> <span class="o">+=</span> <span class="n">tlen</span><span class="p">;</span>
<span class="n">len</span> <span class="o">-=</span> <span class="n">tlen</span><span class="p">;</span>
<span class="p">}</span>
<span class="p">....</span>
<span class="p">}</span>
</pre></div>
</div>
</dd></dl>
<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/draft-ietf-httpbis-p1-messaging-25#section-3.2">http://tools.ietf.org/html/draft-ietf-httpbis-p1-messaging-25#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/draft-ietf-httpbis-p1-messaging-25#section-3.2">http://tools.ietf.org/html/draft-ietf-httpbis-p1-messaging-25#section-3.2</a></p>
<p>Because this is HTTP2 header field value, it can contain NULL
character (0x00).</p>
</dd></dl>
</div>
</div>
</div>
<footer>
<div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
<a href="nghttp2.h.html" class="btn btn-neutral float-right" title="nghttp2.h"/>Next <span class="fa fa-arrow-circle-right"></span></a>
<a href="tutorial-server.html" class="btn btn-neutral" title="Tutorial: HTTP/2 server"><span class="fa fa-arrow-circle-left"></span> Previous</a>
</div>
<hr/>
<div role="contentinfo">
<p>
&copy; Copyright 2012, 2014, Tatsuhiro Tsujikawa.
</p>
</div>
<a href="https://github.com/snide/sphinx_rtd_theme">Sphinx theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>
</footer>
</div>
</div>
</section>
</div>
</body>
</html>