Revert "Update doc"

This reverts commit df29078129.
This commit is contained in:
Tatsuhiro Tsujikawa 2014-08-23 22:39:16 +09:00
parent df29078129
commit 4368c03d80
8 changed files with 470 additions and 700 deletions

View File

@ -1274,7 +1274,7 @@ size_t <tt class="descname">nvlen</tt><a class="headerlink" href="#c.nghttp2_hea
<dl class="member"> <dl class="member">
<dt id="c.nghttp2_rst_stream.error_code"> <dt id="c.nghttp2_rst_stream.error_code">
uint32_t <tt class="descname">error_code</tt><a class="headerlink" href="#c.nghttp2_rst_stream.error_code" title="Permalink to this definition"></a></dt> <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><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>
@ -1395,7 +1395,7 @@ int32_t <tt class="descname">last_stream_id</tt><a class="headerlink" href="#c.n
<dl class="member"> <dl class="member">
<dt id="c.nghttp2_goaway.error_code"> <dt id="c.nghttp2_goaway.error_code">
uint32_t <tt class="descname">error_code</tt><a class="headerlink" href="#c.nghttp2_goaway.error_code" title="Permalink to this definition"></a></dt> <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><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>
@ -1596,8 +1596,6 @@ it must return <a class="reference internal" href="#c.NGHTTP2_ERR_CALLBACK_FAILU
<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 <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, 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> this callback function is unnecessary.</p>
<p>To set this callback to <a class="reference internal" href="#c.nghttp2_session_callbacks" title="nghttp2_session_callbacks"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_session_callbacks</span></tt></a>, use
<a class="reference internal" href="#c.nghttp2_session_callbacks_set_send_callback" title="nghttp2_session_callbacks_set_send_callback"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_callbacks_set_send_callback()</span></tt></a>.</p>
</dd></dl> </dd></dl>
<dl class="type"> <dl class="type">
@ -1619,8 +1617,6 @@ Returning 0 is treated as <a class="reference internal" href="#c.NGHTTP2_ERR_WOU
<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. <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> 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> instead, this callback function is unnecessary.</p>
<p>To set this callback to <a class="reference internal" href="#c.nghttp2_session_callbacks" title="nghttp2_session_callbacks"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_session_callbacks</span></tt></a>, use
<a class="reference internal" href="#c.nghttp2_session_callbacks_set_recv_callback" title="nghttp2_session_callbacks_set_recv_callback"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_callbacks_set_recv_callback()</span></tt></a>.</p>
</dd></dl> </dd></dl>
<dl class="type"> <dl class="type">
@ -1646,21 +1642,18 @@ If <tt class="docutils literal"><span class="pre">frame-&gt;hd.flags</span> <spa
If nonzero value is returned, it is treated as fatal error and 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 <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> immediately return <a class="reference internal" href="#c.NGHTTP2_ERR_CALLBACK_FAILURE" title="NGHTTP2_ERR_CALLBACK_FAILURE"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_ERR_CALLBACK_FAILURE</span></tt></a>.</p>
<p>To set this callback to <a class="reference internal" href="#c.nghttp2_session_callbacks" title="nghttp2_session_callbacks"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_session_callbacks</span></tt></a>, use
<a class="reference internal" href="#c.nghttp2_session_callbacks_set_on_frame_recv_callback" title="nghttp2_session_callbacks_set_on_frame_recv_callback"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_callbacks_set_on_frame_recv_callback()</span></tt></a>.</p>
</dd></dl> </dd></dl>
<dl class="type"> <dl class="type">
<dt id="c.nghttp2_on_invalid_frame_recv_callback"> <dt id="c.nghttp2_on_invalid_frame_recv_callback">
typedef int <tt class="descname">(*nghttp2_on_invalid_frame_recv_callback)</tt><big>(</big><a class="reference internal" href="#c.nghttp2_session" title="nghttp2_session">nghttp2_session</a><em>&nbsp;*session</em>, const <a class="reference internal" href="#c.nghttp2_frame" title="nghttp2_frame">nghttp2_frame</a><em>&nbsp;*frame</em>, uint32_t<em>&nbsp;error_code</em>, void<em>&nbsp;*user_data</em><big>)</big><a class="headerlink" href="#c.nghttp2_on_invalid_frame_recv_callback" title="Permalink to this definition"></a></dt> 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 <dd><p>Callback function invoked by <a class="reference internal" href="#c.nghttp2_session_recv" title="nghttp2_session_recv"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_recv()</span></tt></a> when an
invalid non-DATA frame is received. The <em>error_code</em> indicates the invalid non-DATA frame is received. The <em>error_code</em> is one of the
error. It is usually one of the <a class="reference internal" href="#c.nghttp2_error_code" title="nghttp2_error_code"><tt class="xref c c-macro docutils literal"><span class="pre">nghttp2_error_code</span></tt></a> but <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
that is not guaranteed. When this callback function is invoked, callback function is invoked, the library automatically submits
the library automatically submits either RST_STREAM or GOAWAY either RST_STREAM or GOAWAY frame. The <em>user_data</em> pointer is the
frame. The <em>user_data</em> pointer is the third argument passed in to third argument passed in to the call 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_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>
<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> <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 member of their data structure are always <tt class="docutils literal"><span class="pre">NULL</span></tt> and 0
respectively.</p> respectively.</p>
@ -1668,8 +1661,6 @@ respectively.</p>
If nonzero is returned, it is treated as fatal error and 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 <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> immediately return <a class="reference internal" href="#c.NGHTTP2_ERR_CALLBACK_FAILURE" title="NGHTTP2_ERR_CALLBACK_FAILURE"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_ERR_CALLBACK_FAILURE</span></tt></a>.</p>
<p>To set this callback to <a class="reference internal" href="#c.nghttp2_session_callbacks" title="nghttp2_session_callbacks"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_session_callbacks</span></tt></a>, use
<a class="reference internal" href="#c.nghttp2_session_callbacks_set_on_invalid_frame_recv_callback" title="nghttp2_session_callbacks_set_on_invalid_frame_recv_callback"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_callbacks_set_on_invalid_frame_recv_callback()</span></tt></a>.</p>
</dd></dl> </dd></dl>
<dl class="type"> <dl class="type">
@ -1696,8 +1687,6 @@ region included in the input bytes.</p>
If nonzero is returned, it is treated as fatal error and 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 <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> immediately return <a class="reference internal" href="#c.NGHTTP2_ERR_CALLBACK_FAILURE" title="NGHTTP2_ERR_CALLBACK_FAILURE"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_ERR_CALLBACK_FAILURE</span></tt></a>.</p>
<p>To set this callback to <a class="reference internal" href="#c.nghttp2_session_callbacks" title="nghttp2_session_callbacks"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_session_callbacks</span></tt></a>, use
<a class="reference internal" href="#c.nghttp2_session_callbacks_set_on_data_chunk_recv_callback" title="nghttp2_session_callbacks_set_on_data_chunk_recv_callback"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_callbacks_set_on_data_chunk_recv_callback()</span></tt></a>.</p>
</dd></dl> </dd></dl>
<dl class="type"> <dl class="type">
@ -1711,8 +1700,6 @@ the call to <a class="reference internal" href="#c.nghttp2_session_client_new" t
If nonzero is returned, it is treated as fatal error and 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 <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> immediately return <a class="reference internal" href="#c.NGHTTP2_ERR_CALLBACK_FAILURE" title="NGHTTP2_ERR_CALLBACK_FAILURE"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_ERR_CALLBACK_FAILURE</span></tt></a>.</p>
<p>To set this callback to <a class="reference internal" href="#c.nghttp2_session_callbacks" title="nghttp2_session_callbacks"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_session_callbacks</span></tt></a>, use
<a class="reference internal" href="#c.nghttp2_session_callbacks_set_before_frame_send_callback" title="nghttp2_session_callbacks_set_before_frame_send_callback"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_callbacks_set_before_frame_send_callback()</span></tt></a>.</p>
</dd></dl> </dd></dl>
<dl class="type"> <dl class="type">
@ -1725,8 +1712,6 @@ typedef int <tt class="descname">(*nghttp2_on_frame_send_callback)</tt><big>(</b
If nonzero is returned, it is treated as fatal error and 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 <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> immediately return <a class="reference internal" href="#c.NGHTTP2_ERR_CALLBACK_FAILURE" title="NGHTTP2_ERR_CALLBACK_FAILURE"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_ERR_CALLBACK_FAILURE</span></tt></a>.</p>
<p>To set this callback to <a class="reference internal" href="#c.nghttp2_session_callbacks" title="nghttp2_session_callbacks"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_session_callbacks</span></tt></a>, use
<a class="reference internal" href="#c.nghttp2_session_callbacks_set_on_frame_send_callback" title="nghttp2_session_callbacks_set_on_frame_send_callback"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_callbacks_set_on_frame_send_callback()</span></tt></a>.</p>
</dd></dl> </dd></dl>
<dl class="type"> <dl class="type">
@ -1742,28 +1727,41 @@ argument passed in to the call to <a class="reference internal" href="#c.nghttp2
If nonzero is returned, it is treated as fatal error and 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 <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> immediately return <a class="reference internal" href="#c.NGHTTP2_ERR_CALLBACK_FAILURE" title="NGHTTP2_ERR_CALLBACK_FAILURE"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_ERR_CALLBACK_FAILURE</span></tt></a>.</p>
<p>To set this callback to <a class="reference internal" href="#c.nghttp2_session_callbacks" title="nghttp2_session_callbacks"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_session_callbacks</span></tt></a>, use
<a class="reference internal" href="#c.nghttp2_session_callbacks_set_on_frame_not_send_callback" title="nghttp2_session_callbacks_set_on_frame_not_send_callback"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_callbacks_set_on_frame_not_send_callback()</span></tt></a>.</p>
</dd></dl> </dd></dl>
<dl class="type"> <dl class="type">
<dt id="c.nghttp2_on_stream_close_callback"> <dt id="c.nghttp2_on_stream_close_callback">
typedef int <tt class="descname">(*nghttp2_on_stream_close_callback)</tt><big>(</big><a class="reference internal" href="#c.nghttp2_session" title="nghttp2_session">nghttp2_session</a><em>&nbsp;*session</em>, int32_t<em>&nbsp;stream_id</em>, uint32_t<em>&nbsp;error_code</em>, void<em>&nbsp;*user_data</em><big>)</big><a class="headerlink" href="#c.nghttp2_on_stream_close_callback" title="Permalink to this definition"></a></dt> 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. <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 The reason of closure is indicated by the <em>error_code</em>. The
<em>error_code</em> is usually one of <a class="reference internal" href="#c.nghttp2_error_code" title="nghttp2_error_code"><tt class="xref c c-macro docutils literal"><span class="pre">nghttp2_error_code</span></tt></a>, but that 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>
is not guaranteed. The stream_user_data, which was specified in 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.
<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 The <em>user_data</em> pointer is the third argument passed in to the call
available in this function. The <em>user_data</em> pointer is the third 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
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> <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>This function is also called for a stream in reserved state.</p>
<p>The implementation of this function must return 0 if it succeeds. <p>The implementation of this function must return 0 if it succeeds.
If nonzero is returned, it is treated as fatal error and 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 <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> immediately return <a class="reference internal" href="#c.NGHTTP2_ERR_CALLBACK_FAILURE" title="NGHTTP2_ERR_CALLBACK_FAILURE"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_ERR_CALLBACK_FAILURE</span></tt></a>.</p>
<p>To set this callback to <a class="reference internal" href="#c.nghttp2_session_callbacks" title="nghttp2_session_callbacks"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_session_callbacks</span></tt></a>, use </dd></dl>
<a class="reference internal" href="#c.nghttp2_session_callbacks_set_on_stream_close_callback" title="nghttp2_session_callbacks_set_on_stream_close_callback"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_callbacks_set_on_stream_close_callback()</span></tt></a>.</p>
<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> </dd></dl>
<dl class="type"> <dl class="type">
@ -1784,8 +1782,6 @@ if <a class="reference internal" href="#c.NGHTTP2_ERR_CALLBACK_FAILURE" title="N
<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_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_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> <a class="reference internal" href="#c.NGHTTP2_ERR_CALLBACK_FAILURE" title="NGHTTP2_ERR_CALLBACK_FAILURE"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_ERR_CALLBACK_FAILURE</span></tt></a>.</p>
<p>To set this callback to <a class="reference internal" href="#c.nghttp2_session_callbacks" title="nghttp2_session_callbacks"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_session_callbacks</span></tt></a>, use
<a class="reference internal" href="#c.nghttp2_session_callbacks_set_on_begin_headers_callback" title="nghttp2_session_callbacks_set_on_begin_headers_callback"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_callbacks_set_on_begin_headers_callback()</span></tt></a>.</p>
</dd></dl> </dd></dl>
<dl class="type"> <dl class="type">
@ -1838,8 +1834,6 @@ 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> is returned, <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 <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> immediately return <a class="reference internal" href="#c.NGHTTP2_ERR_CALLBACK_FAILURE" title="NGHTTP2_ERR_CALLBACK_FAILURE"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_ERR_CALLBACK_FAILURE</span></tt></a>.</p>
<p>To set this callback to <a class="reference internal" href="#c.nghttp2_session_callbacks" title="nghttp2_session_callbacks"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_session_callbacks</span></tt></a>, use
<a class="reference internal" href="#c.nghttp2_session_callbacks_set_on_header_callback" title="nghttp2_session_callbacks_set_on_header_callback"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_callbacks_set_on_header_callback()</span></tt></a>.</p>
</dd></dl> </dd></dl>
<dl class="type"> <dl class="type">
@ -1855,34 +1849,105 @@ 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> will make <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_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> <a class="reference internal" href="#c.NGHTTP2_ERR_CALLBACK_FAILURE" title="NGHTTP2_ERR_CALLBACK_FAILURE"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_ERR_CALLBACK_FAILURE</span></tt></a>.</p>
<p>To set this callback to <a class="reference internal" href="#c.nghttp2_session_callbacks" title="nghttp2_session_callbacks"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_session_callbacks</span></tt></a>, use
<a class="reference internal" href="#c.nghttp2_session_callbacks_set_select_padding_callback" title="nghttp2_session_callbacks_set_select_padding_callback"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_callbacks_set_select_padding_callback()</span></tt></a>.</p>
</dd></dl>
<dl class="type">
<dt id="c.nghttp2_on_begin_frame_callback">
typedef int <tt class="descname">(*nghttp2_on_begin_frame_callback)</tt><big>(</big><a class="reference internal" href="#c.nghttp2_session" title="nghttp2_session">nghttp2_session</a><em>&nbsp;*session</em>, const <a class="reference internal" href="#c.nghttp2_frame_hd" title="nghttp2_frame_hd">nghttp2_frame_hd</a><em>&nbsp;*hd</em>, void<em>&nbsp;*user_data</em><big>)</big><a class="headerlink" href="#c.nghttp2_on_begin_frame_callback" title="Permalink to this definition"></a></dt>
<dd><p>Callback function invoked when a frame header is received. The
<em>hd</em> points to received frame header.</p>
<p>This callback won&#8217;t be called for CONTINUATION frame because
library treats HEADERS/PUSH_PROMISE + CONTINUATION as single frame.</p>
<p>If both <a class="reference internal" href="#c.nghttp2_on_begin_frame_callback" title="nghttp2_on_begin_frame_callback"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_on_begin_frame_callback</span></tt></a> and
<a class="reference internal" href="#c.nghttp2_on_begin_headers_callback" title="nghttp2_on_begin_headers_callback"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_on_begin_headers_callback</span></tt></a> are set and HEADERS or
PUSH_PROMISE is received, <a class="reference internal" href="#c.nghttp2_on_begin_frame_callback" title="nghttp2_on_begin_frame_callback"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_on_begin_frame_callback</span></tt></a>
will be called first.</p>
<p>The implementation of this function must return 0 if it succeeds.
If nonzero value is returned, it is treated as fatal error and
<a class="reference internal" href="#c.nghttp2_session_recv" title="nghttp2_session_recv"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_recv()</span></tt></a> and <a class="reference internal" href="#c.nghttp2_session_mem_recv" title="nghttp2_session_mem_recv"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_mem_recv()</span></tt></a> functions
immediately return <a class="reference internal" href="#c.NGHTTP2_ERR_CALLBACK_FAILURE" title="NGHTTP2_ERR_CALLBACK_FAILURE"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_ERR_CALLBACK_FAILURE</span></tt></a>.</p>
<p>To set this callback to <a class="reference internal" href="#c.nghttp2_session_callbacks" title="nghttp2_session_callbacks"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_session_callbacks</span></tt></a>, use
<a class="reference internal" href="#c.nghttp2_session_callbacks_set_on_begin_frame_callback" title="nghttp2_session_callbacks_set_on_begin_frame_callback"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_callbacks_set_on_begin_frame_callback()</span></tt></a>.</p>
</dd></dl> </dd></dl>
<dl class="type"> <dl class="type">
<dt id="c.nghttp2_session_callbacks"> <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> <tt class="descname">nghttp2_session_callbacks</tt><a class="headerlink" href="#c.nghttp2_session_callbacks" title="Permalink to this definition"></a></dt>
<dd><p>Callback functions for <a class="reference internal" href="#c.nghttp2_session" title="nghttp2_session"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_session</span></tt></a>. The details of <dd><p>Callback functions.</p>
this structure are intentionally hidden from the public API.</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> </dd></dl>
<dl class="type"> <dl class="type">
@ -1907,121 +1972,6 @@ this structure are intentionally hidden from the public API.</p>
</div> </div>
<div class="section" id="functions"> <div class="section" id="functions">
<h2>Functions<a class="headerlink" href="#functions" title="Permalink to this headline"></a></h2> <h2>Functions<a class="headerlink" href="#functions" title="Permalink to this headline"></a></h2>
<dl class="function">
<dt id="c.nghttp2_session_callbacks_new">
int <tt class="descname">nghttp2_session_callbacks_new</tt><big>(</big><a class="reference internal" href="#c.nghttp2_session_callbacks" title="nghttp2_session_callbacks">nghttp2_session_callbacks</a><em>&nbsp;**callbacks_ptr</em><big>)</big><a class="headerlink" href="#c.nghttp2_session_callbacks_new" title="Permalink to this definition"></a></dt>
<dd><p>Initializes <em>*callbacks_ptr</em> with NULL values.</p>
<p>The initialized object can be used when initializing multiple
<a class="reference internal" href="#c.nghttp2_session" title="nghttp2_session"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_session</span></tt></a> objects.</p>
<p>When the application finished using this object, it can use
<a class="reference internal" href="#c.nghttp2_session_callbacks_del" title="nghttp2_session_callbacks_del"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_callbacks_del()</span></tt></a> to free its memory.</p>
<p>This function returns 0 if it succeeds, or one of the following
negative error codes:</p>
<dl class="docutils">
<dt><a class="reference internal" href="#c.NGHTTP2_ERR_NOMEM" title="NGHTTP2_ERR_NOMEM"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_ERR_NOMEM</span></tt></a></dt>
<dd>Out of memory.</dd>
</dl>
</dd></dl>
<dl class="function">
<dt id="c.nghttp2_session_callbacks_del">
void <tt class="descname">nghttp2_session_callbacks_del</tt><big>(</big><a class="reference internal" href="#c.nghttp2_session_callbacks" title="nghttp2_session_callbacks">nghttp2_session_callbacks</a><em>&nbsp;*callbacks</em><big>)</big><a class="headerlink" href="#c.nghttp2_session_callbacks_del" title="Permalink to this definition"></a></dt>
<dd><p>Frees any resources allocated for <em>callbacks</em>. If <em>callbacks</em> is
<tt class="docutils literal"><span class="pre">NULL</span></tt>, this function does nothing.</p>
</dd></dl>
<dl class="function">
<dt id="c.nghttp2_session_callbacks_set_send_callback">
void <tt class="descname">nghttp2_session_callbacks_set_send_callback</tt><big>(</big><a class="reference internal" href="#c.nghttp2_session_callbacks" title="nghttp2_session_callbacks">nghttp2_session_callbacks</a><em>&nbsp;*cbs</em>, <a class="reference internal" href="#c.nghttp2_send_callback" title="nghttp2_send_callback">nghttp2_send_callback</a><em>&nbsp;send_callback</em><big>)</big><a class="headerlink" href="#c.nghttp2_session_callbacks_set_send_callback" title="Permalink to this definition"></a></dt>
<dd><p>Sets callback function invoked when a session wants to send data to
the remote peer. This callback is not necessary if the application
uses solely <a class="reference internal" href="#c.nghttp2_session_mem_send" title="nghttp2_session_mem_send"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_mem_send()</span></tt></a> to serialize data to
transmit.</p>
</dd></dl>
<dl class="function">
<dt id="c.nghttp2_session_callbacks_set_recv_callback">
void <tt class="descname">nghttp2_session_callbacks_set_recv_callback</tt><big>(</big><a class="reference internal" href="#c.nghttp2_session_callbacks" title="nghttp2_session_callbacks">nghttp2_session_callbacks</a><em>&nbsp;*cbs</em>, <a class="reference internal" href="#c.nghttp2_recv_callback" title="nghttp2_recv_callback">nghttp2_recv_callback</a><em>&nbsp;recv_callback</em><big>)</big><a class="headerlink" href="#c.nghttp2_session_callbacks_set_recv_callback" title="Permalink to this definition"></a></dt>
<dd><p>Sets callback function invoked when the a session wants to receive
data from the remote peer. This callback is not necessary if the
application uses solely <a class="reference internal" href="#c.nghttp2_session_mem_recv" title="nghttp2_session_mem_recv"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_mem_recv()</span></tt></a> to process
received data.</p>
</dd></dl>
<dl class="function">
<dt id="c.nghttp2_session_callbacks_set_on_frame_recv_callback">
void <tt class="descname">nghttp2_session_callbacks_set_on_frame_recv_callback</tt><big>(</big><a class="reference internal" href="#c.nghttp2_session_callbacks" title="nghttp2_session_callbacks">nghttp2_session_callbacks</a><em>&nbsp;*cbs</em>, <a class="reference internal" href="#c.nghttp2_on_frame_recv_callback" title="nghttp2_on_frame_recv_callback">nghttp2_on_frame_recv_callback</a><em>&nbsp;on_frame_recv_callback</em><big>)</big><a class="headerlink" href="#c.nghttp2_session_callbacks_set_on_frame_recv_callback" title="Permalink to this definition"></a></dt>
<dd><p>Sets callback function invoked by <a class="reference internal" href="#c.nghttp2_session_recv" title="nghttp2_session_recv"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_recv()</span></tt></a> when a
frame is received.</p>
</dd></dl>
<dl class="function">
<dt id="c.nghttp2_session_callbacks_set_on_invalid_frame_recv_callback">
void <tt class="descname">nghttp2_session_callbacks_set_on_invalid_frame_recv_callback</tt><big>(</big><a class="reference internal" href="#c.nghttp2_session_callbacks" title="nghttp2_session_callbacks">nghttp2_session_callbacks</a><em>&nbsp;*cbs</em>, <a class="reference internal" href="#c.nghttp2_on_invalid_frame_recv_callback" title="nghttp2_on_invalid_frame_recv_callback">nghttp2_on_invalid_frame_recv_callback</a><em>&nbsp;on_invalid_frame_recv_callback</em><big>)</big><a class="headerlink" href="#c.nghttp2_session_callbacks_set_on_invalid_frame_recv_callback" title="Permalink to this definition"></a></dt>
<dd><p>Sets callback function invoked by <a class="reference internal" href="#c.nghttp2_session_recv" title="nghttp2_session_recv"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_recv()</span></tt></a> when an
invalid non-DATA frame is received.</p>
</dd></dl>
<dl class="function">
<dt id="c.nghttp2_session_callbacks_set_on_data_chunk_recv_callback">
void <tt class="descname">nghttp2_session_callbacks_set_on_data_chunk_recv_callback</tt><big>(</big><a class="reference internal" href="#c.nghttp2_session_callbacks" title="nghttp2_session_callbacks">nghttp2_session_callbacks</a><em>&nbsp;*cbs</em>, <a class="reference internal" href="#c.nghttp2_on_data_chunk_recv_callback" title="nghttp2_on_data_chunk_recv_callback">nghttp2_on_data_chunk_recv_callback</a><em>&nbsp;on_data_chunk_recv_callback</em><big>)</big><a class="headerlink" href="#c.nghttp2_session_callbacks_set_on_data_chunk_recv_callback" title="Permalink to this definition"></a></dt>
<dd><p>Sets callback function invoked when a chunk of data in DATA frame
is received.</p>
</dd></dl>
<dl class="function">
<dt id="c.nghttp2_session_callbacks_set_before_frame_send_callback">
void <tt class="descname">nghttp2_session_callbacks_set_before_frame_send_callback</tt><big>(</big><a class="reference internal" href="#c.nghttp2_session_callbacks" title="nghttp2_session_callbacks">nghttp2_session_callbacks</a><em>&nbsp;*cbs</em>, <a class="reference internal" href="#c.nghttp2_before_frame_send_callback" title="nghttp2_before_frame_send_callback">nghttp2_before_frame_send_callback</a><em>&nbsp;before_frame_send_callback</em><big>)</big><a class="headerlink" href="#c.nghttp2_session_callbacks_set_before_frame_send_callback" title="Permalink to this definition"></a></dt>
<dd><p>Sets callback function invoked before a non-DATA frame is sent.</p>
</dd></dl>
<dl class="function">
<dt id="c.nghttp2_session_callbacks_set_on_frame_send_callback">
void <tt class="descname">nghttp2_session_callbacks_set_on_frame_send_callback</tt><big>(</big><a class="reference internal" href="#c.nghttp2_session_callbacks" title="nghttp2_session_callbacks">nghttp2_session_callbacks</a><em>&nbsp;*cbs</em>, <a class="reference internal" href="#c.nghttp2_on_frame_send_callback" title="nghttp2_on_frame_send_callback">nghttp2_on_frame_send_callback</a><em>&nbsp;on_frame_send_callback</em><big>)</big><a class="headerlink" href="#c.nghttp2_session_callbacks_set_on_frame_send_callback" title="Permalink to this definition"></a></dt>
<dd><p>Sets callback function invoked after a frame is sent.</p>
</dd></dl>
<dl class="function">
<dt id="c.nghttp2_session_callbacks_set_on_frame_not_send_callback">
void <tt class="descname">nghttp2_session_callbacks_set_on_frame_not_send_callback</tt><big>(</big><a class="reference internal" href="#c.nghttp2_session_callbacks" title="nghttp2_session_callbacks">nghttp2_session_callbacks</a><em>&nbsp;*cbs</em>, <a class="reference internal" href="#c.nghttp2_on_frame_not_send_callback" title="nghttp2_on_frame_not_send_callback">nghttp2_on_frame_not_send_callback</a><em>&nbsp;on_frame_not_send_callback</em><big>)</big><a class="headerlink" href="#c.nghttp2_session_callbacks_set_on_frame_not_send_callback" title="Permalink to this definition"></a></dt>
<dd><p>Sets callback function invoked when a non-DATA frame is not sent
because of an error.</p>
</dd></dl>
<dl class="function">
<dt id="c.nghttp2_session_callbacks_set_on_stream_close_callback">
void <tt class="descname">nghttp2_session_callbacks_set_on_stream_close_callback</tt><big>(</big><a class="reference internal" href="#c.nghttp2_session_callbacks" title="nghttp2_session_callbacks">nghttp2_session_callbacks</a><em>&nbsp;*cbs</em>, <a class="reference internal" href="#c.nghttp2_on_stream_close_callback" title="nghttp2_on_stream_close_callback">nghttp2_on_stream_close_callback</a><em>&nbsp;on_stream_close_callback</em><big>)</big><a class="headerlink" href="#c.nghttp2_session_callbacks_set_on_stream_close_callback" title="Permalink to this definition"></a></dt>
<dd><p>Sets callback function invoked when the stream is closed.</p>
</dd></dl>
<dl class="function">
<dt id="c.nghttp2_session_callbacks_set_on_begin_headers_callback">
void <tt class="descname">nghttp2_session_callbacks_set_on_begin_headers_callback</tt><big>(</big><a class="reference internal" href="#c.nghttp2_session_callbacks" title="nghttp2_session_callbacks">nghttp2_session_callbacks</a><em>&nbsp;*cbs</em>, <a class="reference internal" href="#c.nghttp2_on_begin_headers_callback" title="nghttp2_on_begin_headers_callback">nghttp2_on_begin_headers_callback</a><em>&nbsp;on_begin_headers_callback</em><big>)</big><a class="headerlink" href="#c.nghttp2_session_callbacks_set_on_begin_headers_callback" title="Permalink to this definition"></a></dt>
<dd><p>Sets callback function invoked when the reception of header block
in HEADERS or PUSH_PROMISE is started.</p>
</dd></dl>
<dl class="function">
<dt id="c.nghttp2_session_callbacks_set_on_header_callback">
void <tt class="descname">nghttp2_session_callbacks_set_on_header_callback</tt><big>(</big><a class="reference internal" href="#c.nghttp2_session_callbacks" title="nghttp2_session_callbacks">nghttp2_session_callbacks</a><em>&nbsp;*cbs</em>, <a class="reference internal" href="#c.nghttp2_on_header_callback" title="nghttp2_on_header_callback">nghttp2_on_header_callback</a><em>&nbsp;on_header_callback</em><big>)</big><a class="headerlink" href="#c.nghttp2_session_callbacks_set_on_header_callback" title="Permalink to this definition"></a></dt>
<dd><p>Sets callback function invoked when a header name/value pair is
received.</p>
</dd></dl>
<dl class="function">
<dt id="c.nghttp2_session_callbacks_set_select_padding_callback">
void <tt class="descname">nghttp2_session_callbacks_set_select_padding_callback</tt><big>(</big><a class="reference internal" href="#c.nghttp2_session_callbacks" title="nghttp2_session_callbacks">nghttp2_session_callbacks</a><em>&nbsp;*cbs</em>, <a class="reference internal" href="#c.nghttp2_select_padding_callback" title="nghttp2_select_padding_callback">nghttp2_select_padding_callback</a><em>&nbsp;select_padding_callback</em><big>)</big><a class="headerlink" href="#c.nghttp2_session_callbacks_set_select_padding_callback" title="Permalink to this definition"></a></dt>
<dd><p>Sets callback function invoked when the library asks application
how many padding bytes are required for the transmission of the
given frame.</p>
</dd></dl>
<dl class="function">
<dt id="c.nghttp2_session_callbacks_set_on_begin_frame_callback">
void <tt class="descname">nghttp2_session_callbacks_set_on_begin_frame_callback</tt><big>(</big><a class="reference internal" href="#c.nghttp2_session_callbacks" title="nghttp2_session_callbacks">nghttp2_session_callbacks</a><em>&nbsp;*cbs</em>, <a class="reference internal" href="#c.nghttp2_on_begin_frame_callback" title="nghttp2_on_begin_frame_callback">nghttp2_on_begin_frame_callback</a><em>&nbsp;on_begin_frame_callback</em><big>)</big><a class="headerlink" href="#c.nghttp2_session_callbacks_set_on_begin_frame_callback" title="Permalink to this definition"></a></dt>
<dd><p>Sets callback function invoked when a frame header is received.</p>
</dd></dl>
<dl class="function"> <dl class="function">
<dt id="c.nghttp2_option_new"> <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> 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>
@ -2077,10 +2027,10 @@ int <tt class="descname">nghttp2_session_client_new</tt><big>(</big><a class="re
<em>callbacks</em> are copied to <em>*session_ptr</em>. Therefore <em>*session_ptr</em> <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 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> supplied data, which will be passed to the callback functions.</p>
<p>The <a class="reference internal" href="#c.nghttp2_send_callback" title="nghttp2_send_callback"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_send_callback</span></tt></a> must be specified. If the <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
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 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>,
<a class="reference internal" href="#c.nghttp2_recv_callback" title="nghttp2_recv_callback"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_recv_callback</span></tt></a> must be specified. The other members 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
of <em>callbacks</em> can be <tt class="docutils literal"><span class="pre">NULL</span></tt>.</p> specified. The other members of <em>callbacks</em> can be <tt class="docutils literal"><span class="pre">NULL</span></tt>.</p>
<p>If this function fails, <em>*session_ptr</em> is left untouched.</p> <p>If this function fails, <em>*session_ptr</em> is left untouched.</p>
<p>This function returns 0 if it succeeds, or one of the following <p>This function returns 0 if it succeeds, or one of the following
negative error codes:</p> negative error codes:</p>
@ -2097,10 +2047,10 @@ int <tt class="descname">nghttp2_session_server_new</tt><big>(</big><a class="re
<em>callbacks</em> are copied to <em>*session_ptr</em>. Therefore <em>*session_ptr</em> <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 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> supplied data, which will be passed to the callback functions.</p>
<p>The <a class="reference internal" href="#c.nghttp2_send_callback" title="nghttp2_send_callback"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_send_callback</span></tt></a> must be specified. If the <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
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 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>,
<a class="reference internal" href="#c.nghttp2_recv_callback" title="nghttp2_recv_callback"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_recv_callback</span></tt></a> must be specified. The other members 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
of <em>callbacks</em> can be <tt class="docutils literal"><span class="pre">NULL</span></tt>.</p> specified. The other members of <em>callbacks</em> can be <tt class="docutils literal"><span class="pre">NULL</span></tt>.</p>
<p>If this function fails, <em>*session_ptr</em> is left untouched.</p> <p>If this function fails, <em>*session_ptr</em> is left untouched.</p>
<p>This function returns 0 if it succeeds, or one of the following <p>This function returns 0 if it succeeds, or one of the following
negative error codes:</p> negative error codes:</p>
@ -2162,7 +2112,7 @@ int <tt class="descname">nghttp2_session_send</tt><big>(</big><a class="referenc
<p>This function retrieves the highest prioritized frame from the <p>This function retrieves the highest prioritized frame from the
outbound queue and sends it to the remote peer. It does this as outbound queue and sends it to the remote peer. It does this as
many as possible until the user callback many as possible until the user callback
<a class="reference internal" href="#c.nghttp2_send_callback" title="nghttp2_send_callback"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_send_callback</span></tt></a> returns <a class="reference internal" href="#c.nghttp2_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. <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 This function calls several callback functions which are passed
when initializing the <em>session</em>. Here is the simple time chart when initializing the <em>session</em>. Here is the simple time chart
@ -2172,18 +2122,22 @@ which tells when each callback is invoked:</p>
<li>Prepare transmission of the frame.</li> <li>Prepare transmission of the frame.</li>
<li>If the control frame cannot be sent because some preconditions <li>If the control frame cannot be sent because some preconditions
are not met (e.g., request HEADERS cannot be sent after GOAWAY), are not met (e.g., request HEADERS cannot be sent after GOAWAY),
<a class="reference internal" href="#c.nghttp2_on_frame_not_send_callback" title="nghttp2_on_frame_not_send_callback"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_on_frame_not_send_callback</span></tt></a> is invoked. Abort <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>
the following steps.</li> is invoked. Abort the following steps.</li>
<li>If the frame is HEADERS, PUSH_PROMISE or DATA, <li>If the frame is HEADERS, PUSH_PROMISE or DATA,
<a class="reference internal" href="#c.nghttp2_select_padding_callback" title="nghttp2_select_padding_callback"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_select_padding_callback</span></tt></a> is invoked.</li> <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>If the frame is request HEADERS, the stream is opened here.</li>
<li><a class="reference internal" href="#c.nghttp2_before_frame_send_callback" title="nghttp2_before_frame_send_callback"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_before_frame_send_callback</span></tt></a> is invoked.</li> <li><a class="reference internal" href="#c.nghttp2_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
<li><a class="reference internal" href="#c.nghttp2_send_callback" title="nghttp2_send_callback"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_send_callback</span></tt></a> is invoked one or more times to invoked.</li>
send the frame.</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
<li><a class="reference internal" href="#c.nghttp2_on_frame_send_callback" title="nghttp2_on_frame_send_callback"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_on_frame_send_callback</span></tt></a> is invoked.</li> 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, <li>If the transmission of the frame triggers closure of the stream,
the stream is closed and the stream is closed and
<a class="reference internal" href="#c.nghttp2_on_stream_close_callback" title="nghttp2_on_stream_close_callback"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_on_stream_close_callback</span></tt></a> is invoked.</li> <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> </ol>
<p>This function returns 0 if it succeeds, or one of the following <p>This function returns 0 if it succeeds, or one of the following
negative error codes:</p> negative error codes:</p>
@ -2200,10 +2154,11 @@ negative error codes:</p>
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> 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> <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 <p>This function behaves like <a class="reference internal" href="#c.nghttp2_session_send" title="nghttp2_session_send"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_send()</span></tt></a> except that it
does not use <a class="reference internal" href="#c.nghttp2_send_callback" title="nghttp2_send_callback"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_send_callback</span></tt></a> to transmit data. 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
Instead, it assigns the pointer to the serialized data to the transmit data. Instead, it assigns the pointer to the serialized
<em>*data_ptr</em> and returns its length. The other callbacks are called data to the <em>*data_ptr</em> and returns its length. The other
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> 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>If no data is available to send, this function returns 0.</p>
<p>This function may not return all serialized data in one invocation. <p>This function may not return all serialized data in one invocation.
To get all data, call this function repeatedly until it returns 0 To get all data, call this function repeatedly until it returns 0
@ -2226,42 +2181,49 @@ codes:</p>
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> 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> <dd><p>Receives frames from the remote peer.</p>
<p>This function receives as many frames as possible until the user <p>This function receives as many frames as possible until the user
callback <a class="reference internal" href="#c.nghttp2_recv_callback" title="nghttp2_recv_callback"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_recv_callback</span></tt></a> returns 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 <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 callback functions which are passed when initializing the
<em>session</em>. Here is the simple time chart which tells when each <em>session</em>. Here is the simple time chart which tells when each
callback is invoked:</p> callback is invoked:</p>
<ol class="arabic simple"> <ol class="arabic simple">
<li><a class="reference internal" href="#c.nghttp2_recv_callback" title="nghttp2_recv_callback"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_recv_callback</span></tt></a> is invoked one or more times to <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
receive frame header.</li> or more times to receive frame header.</li>
<li>When frame header is received,
<a class="reference internal" href="#c.nghttp2_on_begin_frame_callback" title="nghttp2_on_begin_frame_callback"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_on_begin_frame_callback</span></tt></a> is invoked.</li>
<li>If the frame is DATA frame:<ol class="arabic"> <li>If the frame is DATA frame:<ol class="arabic">
<li><a class="reference internal" href="#c.nghttp2_recv_callback" title="nghttp2_recv_callback"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_recv_callback</span></tt></a> is invoked to receive DATA <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
payload. For each chunk of data, to receive DATA payload. For each chunk of data,
<a class="reference internal" href="#c.nghttp2_on_data_chunk_recv_callback" title="nghttp2_on_data_chunk_recv_callback"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_on_data_chunk_recv_callback</span></tt></a> is invoked.</li> <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, <li>If one DATA frame is completely received,
<a class="reference internal" href="#c.nghttp2_on_frame_recv_callback" title="nghttp2_on_frame_recv_callback"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_on_frame_recv_callback</span></tt></a> is invoked. If the <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
reception of the frame triggers the closure of the stream, invoked. If the reception of the frame triggers the
<a class="reference internal" href="#c.nghttp2_on_stream_close_callback" title="nghttp2_on_stream_close_callback"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_on_stream_close_callback</span></tt></a> is invoked.</li> 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> </ol>
</li> </li>
<li>If the frame is the control frame:<ol class="arabic"> <li>If the frame is the control frame:<ol class="arabic">
<li><a class="reference internal" href="#c.nghttp2_recv_callback" title="nghttp2_recv_callback"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_recv_callback</span></tt></a> is invoked one or more times to <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
receive whole frame.</li> one or more times to receive whole frame.</li>
<li>If the received frame is valid, then following actions are <li>If the received frame is valid, then following actions are
taken. If the frame is either HEADERS or PUSH_PROMISE, taken. If the frame is either HEADERS or PUSH_PROMISE,
<a class="reference internal" href="#c.nghttp2_on_begin_headers_callback" title="nghttp2_on_begin_headers_callback"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_on_begin_headers_callback</span></tt></a> is invoked. Then <a class="reference internal" href="#c.nghttp2_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>
<a class="reference internal" href="#c.nghttp2_on_header_callback" title="nghttp2_on_header_callback"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_on_header_callback</span></tt></a> is invoked for each header is invoked. Then
name/value pair. After all name/value pairs are emitted <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
successfully, <a class="reference internal" href="#c.nghttp2_on_frame_recv_callback" title="nghttp2_on_frame_recv_callback"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_on_frame_recv_callback</span></tt></a> is invoked for 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, invoked. For other frames,
<a class="reference internal" href="#c.nghttp2_on_frame_recv_callback" title="nghttp2_on_frame_recv_callback"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_on_frame_recv_callback</span></tt></a> is invoked. If the <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
reception of the frame triggers the closure of the stream, invoked.
<a class="reference internal" href="#c.nghttp2_on_stream_close_callback" title="nghttp2_on_stream_close_callback"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_on_stream_close_callback</span></tt></a> is invoked.</li> 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 <li>If the received frame is unpacked but is interpreted as
invalid, <a class="reference internal" href="#c.nghttp2_on_invalid_frame_recv_callback" title="nghttp2_on_invalid_frame_recv_callback"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_on_invalid_frame_recv_callback</span></tt></a> is invalid,
invoked.</li> <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>
</ol> </ol>
</li> </li>
</ol> </ol>
@ -2283,16 +2245,17 @@ ssize_t <tt class="descname">nghttp2_session_mem_recv</tt><big>(</big><a class="
<dd><p>Processes data <em>in</em> as an input from the remote endpoint. The <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> <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 <p>This function behaves like <a class="reference internal" href="#c.nghttp2_session_recv" title="nghttp2_session_recv"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_recv()</span></tt></a> except that it
does not use <a class="reference internal" href="#c.nghttp2_recv_callback" title="nghttp2_recv_callback"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_recv_callback</span></tt></a> to receive data; the 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
<em>in</em> is the only data for the invocation of this function. If all receive data; the <em>in</em> is the only data for the invocation of this
bytes are processed, this function returns. The other callbacks function. If all bytes are processed, this function returns. The
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> 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 <p>In the current implementation, this function always tries to
processes all input data unless either an error occurs or 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_ERR_PAUSE" title="NGHTTP2_ERR_PAUSE"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_ERR_PAUSE</span></tt></a> is returned from
<a class="reference internal" href="#c.nghttp2_on_header_callback" title="nghttp2_on_header_callback"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_on_header_callback</span></tt></a> or <a class="reference internal" href="#c.nghttp2_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_on_data_chunk_recv_callback" title="nghttp2_on_data_chunk_recv_callback"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_on_data_chunk_recv_callback</span></tt></a>. If <a class="reference internal" href="#c.nghttp2_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>.
<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 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 number of bytes which was used to produce the data or frame for the
callback.</p> callback.</p>
<p>This function returns the number of processed bytes, or one of the <p>This function returns the number of processed bytes, or one of the
@ -2452,12 +2415,11 @@ Returns 0 if it did not. Returns -1 if no such stream exists.</p>
<dl class="function"> <dl class="function">
<dt id="c.nghttp2_session_terminate_session"> <dt id="c.nghttp2_session_terminate_session">
int <tt class="descname">nghttp2_session_terminate_session</tt><big>(</big><a class="reference internal" href="#c.nghttp2_session" title="nghttp2_session">nghttp2_session</a><em>&nbsp;*session</em>, uint32_t<em>&nbsp;error_code</em><big>)</big><a class="headerlink" href="#c.nghttp2_session_terminate_session" title="Permalink to this definition"></a></dt> 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> <dd><p>Signals the session so that the connection should be terminated.</p>
<p>The last stream ID is the ID of a stream for which <p>The last stream ID is the ID of a stream for which
<a class="reference internal" href="#c.nghttp2_on_frame_recv_callback" title="nghttp2_on_frame_recv_callback"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_on_frame_recv_callback</span></tt></a> was called most recently.</p> <a class="reference internal" href="#c.nghttp2_on_frame_recv_callback" title="nghttp2_on_frame_recv_callback"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_on_frame_recv_callback</span></tt></a> was called most recently.</p>
<p>The <em>error_code</em> is the error code of this GOAWAY frame. The <p>The <em>error_code</em> is the error code of this GOAWAY frame.</p>
pre-defined error code is one of <a class="reference internal" href="#c.nghttp2_error_code" title="nghttp2_error_code"><tt class="xref c c-macro docutils literal"><span class="pre">nghttp2_error_code</span></tt></a>.</p>
<p>After the transmission, both <a class="reference internal" href="#c.nghttp2_session_want_read" title="nghttp2_session_want_read"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_want_read()</span></tt></a> and <p>After the transmission, both <a class="reference internal" href="#c.nghttp2_session_want_read" title="nghttp2_session_want_read"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_want_read()</span></tt></a> and
<a class="reference internal" href="#c.nghttp2_session_want_write" title="nghttp2_session_want_write"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_want_write()</span></tt></a> return 0.</p> <a class="reference internal" href="#c.nghttp2_session_want_write" title="nghttp2_session_want_write"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_want_write()</span></tt></a> return 0.</p>
<p>This function should be called when the connection should be <p>This function should be called when the connection should be
@ -2473,7 +2435,7 @@ negative error codes:</p>
<dl class="function"> <dl class="function">
<dt id="c.nghttp2_session_terminate_session2"> <dt id="c.nghttp2_session_terminate_session2">
int <tt class="descname">nghttp2_session_terminate_session2</tt><big>(</big><a class="reference internal" href="#c.nghttp2_session" title="nghttp2_session">nghttp2_session</a><em>&nbsp;*session</em>, int32_t<em>&nbsp;last_stream_id</em>, uint32_t<em>&nbsp;error_code</em><big>)</big><a class="headerlink" href="#c.nghttp2_session_terminate_session2" title="Permalink to this definition"></a></dt> int <tt class="descname">nghttp2_session_terminate_session2</tt><big>(</big><a class="reference internal" href="#c.nghttp2_session" title="nghttp2_session">nghttp2_session</a><em>&nbsp;*session</em>, int32_t<em>&nbsp;last_stream_id</em>, <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_session2" title="Permalink to this definition"></a></dt>
<dd><p>Signals the session so that the connection should be terminated.</p> <dd><p>Signals the session so that the connection should be terminated.</p>
<p>This function behaves like <a class="reference internal" href="#c.nghttp2_session_terminate_session" title="nghttp2_session_terminate_session"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_terminate_session()</span></tt></a>, <p>This function behaves like <a class="reference internal" href="#c.nghttp2_session_terminate_session" title="nghttp2_session_terminate_session"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_terminate_session()</span></tt></a>,
but the last stream ID can be specified by the application for fine but the last stream ID can be specified by the application for fine
@ -2650,8 +2612,8 @@ reached.</dd>
<p class="last">This function returns assigned stream ID if it succeeds. But <p class="last">This function returns assigned stream ID if it succeeds. But
that stream is not opened yet. The application must not submit that stream is not opened yet. The application must not submit
frame to that stream ID before frame to that stream ID before
<a class="reference internal" href="#c.nghttp2_before_frame_send_callback" title="nghttp2_before_frame_send_callback"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_before_frame_send_callback</span></tt></a> is called for this <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
frame.</p> called for this frame.</p>
</div> </div>
</dd></dl> </dd></dl>
@ -2752,8 +2714,8 @@ reached.</dd>
<p class="last">This function returns assigned stream ID if it succeeds and <p class="last">This function returns assigned stream ID if it succeeds and
<em>stream_id</em> is -1. But that stream is not opened yet. The <em>stream_id</em> is -1. But that stream is not opened yet. The
application must not submit frame to that stream ID before application must not submit frame to that stream ID before
<a class="reference internal" href="#c.nghttp2_before_frame_send_callback" title="nghttp2_before_frame_send_callback"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_before_frame_send_callback</span></tt></a> is called for this <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
frame.</p> called for this frame.</p>
</div> </div>
</dd></dl> </dd></dl>
@ -2807,10 +2769,9 @@ depend on itself.</dd>
<dl class="function"> <dl class="function">
<dt id="c.nghttp2_submit_rst_stream"> <dt id="c.nghttp2_submit_rst_stream">
int <tt class="descname">nghttp2_submit_rst_stream</tt><big>(</big><a class="reference internal" href="#c.nghttp2_session" title="nghttp2_session">nghttp2_session</a><em>&nbsp;*session</em>, uint8_t<em>&nbsp;flags</em>, int32_t<em>&nbsp;stream_id</em>, uint32_t<em>&nbsp;error_code</em><big>)</big><a class="headerlink" href="#c.nghttp2_submit_rst_stream" title="Permalink to this definition"></a></dt> 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> <dd><p>Submits RST_STREAM frame to cancel/reject the stream <em>stream_id</em>
with the error code <em>error_code</em>.</p> with the error code <em>error_code</em>.</p>
<p>The pre-defined error code is one of <a class="reference internal" href="#c.nghttp2_error_code" title="nghttp2_error_code"><tt class="xref c c-macro docutils literal"><span class="pre">nghttp2_error_code</span></tt></a>.</p>
<p>The <em>flags</em> is currently ignored and should be <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> <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 <p>This function returns 0 if it succeeds, or one of the following
@ -2895,8 +2856,8 @@ reached.</dd>
<p class="last">This function returns assigned promised stream ID if it succeeds. <p class="last">This function returns assigned promised stream ID if it succeeds.
But that stream is not opened yet. The application must not But that stream is not opened yet. The application must not
submit frame to that stream ID before submit frame to that stream ID before
<a class="reference internal" href="#c.nghttp2_before_frame_send_callback" title="nghttp2_before_frame_send_callback"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_before_frame_send_callback</span></tt></a> is called for this <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
frame.</p> called for this frame.</p>
</div> </div>
</dd></dl> </dd></dl>
@ -2922,10 +2883,9 @@ negative error codes:</p>
<dl class="function"> <dl class="function">
<dt id="c.nghttp2_submit_goaway"> <dt id="c.nghttp2_submit_goaway">
int <tt class="descname">nghttp2_submit_goaway</tt><big>(</big><a class="reference internal" href="#c.nghttp2_session" title="nghttp2_session">nghttp2_session</a><em>&nbsp;*session</em>, uint8_t<em>&nbsp;flags</em>, int32_t<em>&nbsp;last_stream_id</em>, uint32_t<em>&nbsp;error_code</em>, const uint8_t<em>&nbsp;*opaque_data</em>, size_t<em>&nbsp;opaque_data_len</em><big>)</big><a class="headerlink" href="#c.nghttp2_submit_goaway" title="Permalink to this definition"></a></dt> int <tt class="descname">nghttp2_submit_goaway</tt><big>(</big><a class="reference internal" href="#c.nghttp2_session" title="nghttp2_session">nghttp2_session</a><em>&nbsp;*session</em>, uint8_t<em>&nbsp;flags</em>, int32_t<em>&nbsp;last_stream_id</em>, <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 last stream ID <em>last_stream_id</em> and <dd><p>Submits GOAWAY frame with the last stream ID <em>last_stream_id</em> and
the error code <em>error_code</em>.</p> the error code <em>error_code</em>.</p>
<p>The pre-defined error code is one of <a class="reference internal" href="#c.nghttp2_error_code" title="nghttp2_error_code"><tt class="xref c c-macro docutils literal"><span class="pre">nghttp2_error_code</span></tt></a>.</p>
<p>The <em>flags</em> is currently ignored and should be <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> <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 <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

View File

@ -2255,12 +2255,12 @@
<dt><a href="apiref.html#c.NGHTTP2_INITIAL_CONNECTION_WINDOW_SIZE">NGHTTP2_INITIAL_CONNECTION_WINDOW_SIZE (C macro)</a> <dt><a href="apiref.html#c.NGHTTP2_INITIAL_CONNECTION_WINDOW_SIZE">NGHTTP2_INITIAL_CONNECTION_WINDOW_SIZE (C macro)</a>
</dt> </dt>
</dl></td>
<td style="width: 33%" valign="top"><dl>
<dt><a href="apiref.html#c.NGHTTP2_INITIAL_MAX_CONCURRENT_STREAMS">NGHTTP2_INITIAL_MAX_CONCURRENT_STREAMS (C macro)</a> <dt><a href="apiref.html#c.NGHTTP2_INITIAL_MAX_CONCURRENT_STREAMS">NGHTTP2_INITIAL_MAX_CONCURRENT_STREAMS (C macro)</a>
</dt> </dt>
</dl></td>
<td style="width: 33%" valign="top"><dl>
<dt><a href="apiref.html#c.NGHTTP2_INITIAL_WINDOW_SIZE">NGHTTP2_INITIAL_WINDOW_SIZE (C macro)</a> <dt><a href="apiref.html#c.NGHTTP2_INITIAL_WINDOW_SIZE">NGHTTP2_INITIAL_WINDOW_SIZE (C macro)</a>
</dt> </dt>
@ -2330,10 +2330,6 @@
</dt> </dt>
<dt><a href="apiref.html#c.nghttp2_on_begin_frame_callback">nghttp2_on_begin_frame_callback (C type)</a>
</dt>
<dt><a href="apiref.html#c.nghttp2_on_begin_headers_callback">nghttp2_on_begin_headers_callback (C type)</a> <dt><a href="apiref.html#c.nghttp2_on_begin_headers_callback">nghttp2_on_begin_headers_callback (C type)</a>
</dt> </dt>
@ -2366,6 +2362,10 @@
</dt> </dt>
<dt><a href="apiref.html#c.nghttp2_on_unknown_frame_recv_callback">nghttp2_on_unknown_frame_recv_callback (C type)</a>
</dt>
<dt><a href="apiref.html#c.nghttp2_option">nghttp2_option (C type)</a> <dt><a href="apiref.html#c.nghttp2_option">nghttp2_option (C type)</a>
</dt> </dt>
@ -2530,63 +2530,55 @@
</dt> </dt>
<dt><a href="apiref.html#c.nghttp2_session_callbacks_del">nghttp2_session_callbacks_del (C function)</a> <dt><a href="apiref.html#c.nghttp2_session_callbacks.before_frame_send_callback">nghttp2_session_callbacks.before_frame_send_callback (C member)</a>
</dt> </dt>
<dt><a href="apiref.html#c.nghttp2_session_callbacks_new">nghttp2_session_callbacks_new (C function)</a> <dt><a href="apiref.html#c.nghttp2_session_callbacks.on_begin_headers_callback">nghttp2_session_callbacks.on_begin_headers_callback (C member)</a>
</dt> </dt>
<dt><a href="apiref.html#c.nghttp2_session_callbacks_set_before_frame_send_callback">nghttp2_session_callbacks_set_before_frame_send_callback (C function)</a> <dt><a href="apiref.html#c.nghttp2_session_callbacks.on_data_chunk_recv_callback">nghttp2_session_callbacks.on_data_chunk_recv_callback (C member)</a>
</dt> </dt>
<dt><a href="apiref.html#c.nghttp2_session_callbacks_set_on_begin_frame_callback">nghttp2_session_callbacks_set_on_begin_frame_callback (C function)</a> <dt><a href="apiref.html#c.nghttp2_session_callbacks.on_frame_not_send_callback">nghttp2_session_callbacks.on_frame_not_send_callback (C member)</a>
</dt> </dt>
<dt><a href="apiref.html#c.nghttp2_session_callbacks_set_on_begin_headers_callback">nghttp2_session_callbacks_set_on_begin_headers_callback (C function)</a> <dt><a href="apiref.html#c.nghttp2_session_callbacks.on_frame_recv_callback">nghttp2_session_callbacks.on_frame_recv_callback (C member)</a>
</dt> </dt>
<dt><a href="apiref.html#c.nghttp2_session_callbacks_set_on_data_chunk_recv_callback">nghttp2_session_callbacks_set_on_data_chunk_recv_callback (C function)</a> <dt><a href="apiref.html#c.nghttp2_session_callbacks.on_frame_send_callback">nghttp2_session_callbacks.on_frame_send_callback (C member)</a>
</dt> </dt>
<dt><a href="apiref.html#c.nghttp2_session_callbacks_set_on_frame_not_send_callback">nghttp2_session_callbacks_set_on_frame_not_send_callback (C function)</a> <dt><a href="apiref.html#c.nghttp2_session_callbacks.on_header_callback">nghttp2_session_callbacks.on_header_callback (C member)</a>
</dt> </dt>
<dt><a href="apiref.html#c.nghttp2_session_callbacks_set_on_frame_recv_callback">nghttp2_session_callbacks_set_on_frame_recv_callback (C function)</a> <dt><a href="apiref.html#c.nghttp2_session_callbacks.on_invalid_frame_recv_callback">nghttp2_session_callbacks.on_invalid_frame_recv_callback (C member)</a>
</dt> </dt>
<dt><a href="apiref.html#c.nghttp2_session_callbacks_set_on_frame_send_callback">nghttp2_session_callbacks_set_on_frame_send_callback (C function)</a> <dt><a href="apiref.html#c.nghttp2_session_callbacks.on_stream_close_callback">nghttp2_session_callbacks.on_stream_close_callback (C member)</a>
</dt> </dt>
<dt><a href="apiref.html#c.nghttp2_session_callbacks_set_on_header_callback">nghttp2_session_callbacks_set_on_header_callback (C function)</a> <dt><a href="apiref.html#c.nghttp2_session_callbacks.on_unknown_frame_recv_callback">nghttp2_session_callbacks.on_unknown_frame_recv_callback (C member)</a>
</dt> </dt>
<dt><a href="apiref.html#c.nghttp2_session_callbacks_set_on_invalid_frame_recv_callback">nghttp2_session_callbacks_set_on_invalid_frame_recv_callback (C function)</a> <dt><a href="apiref.html#c.nghttp2_session_callbacks.recv_callback">nghttp2_session_callbacks.recv_callback (C member)</a>
</dt> </dt>
<dt><a href="apiref.html#c.nghttp2_session_callbacks_set_on_stream_close_callback">nghttp2_session_callbacks_set_on_stream_close_callback (C function)</a> <dt><a href="apiref.html#c.nghttp2_session_callbacks.select_padding_callback">nghttp2_session_callbacks.select_padding_callback (C member)</a>
</dt> </dt>
<dt><a href="apiref.html#c.nghttp2_session_callbacks_set_recv_callback">nghttp2_session_callbacks_set_recv_callback (C function)</a> <dt><a href="apiref.html#c.nghttp2_session_callbacks.send_callback">nghttp2_session_callbacks.send_callback (C member)</a>
</dt>
<dt><a href="apiref.html#c.nghttp2_session_callbacks_set_select_padding_callback">nghttp2_session_callbacks_set_select_padding_callback (C function)</a>
</dt>
<dt><a href="apiref.html#c.nghttp2_session_callbacks_set_send_callback">nghttp2_session_callbacks_set_send_callback (C function)</a>
</dt> </dt>

View File

@ -1015,7 +1015,7 @@
<span class="cm">/**</span> <span class="cm">/**</span>
<span class="cm"> * The error code. See :type:`nghttp2_error_code`.</span> <span class="cm"> * The error code. See :type:`nghttp2_error_code`.</span>
<span class="cm"> */</span> <span class="cm"> */</span>
<span class="kt">uint32_t</span> <span class="n">error_code</span><span class="p">;</span> <span class="n">nghttp2_error_code</span> <span class="n">error_code</span><span class="p">;</span>
<span class="p">}</span> <span class="n">nghttp2_rst_stream</span><span class="p">;</span> <span class="p">}</span> <span class="n">nghttp2_rst_stream</span><span class="p">;</span>
<span class="cm">/**</span> <span class="cm">/**</span>
@ -1116,7 +1116,7 @@
<span class="cm">/**</span> <span class="cm">/**</span>
<span class="cm"> * The error code. See :type:`nghttp2_error_code`.</span> <span class="cm"> * The error code. See :type:`nghttp2_error_code`.</span>
<span class="cm"> */</span> <span class="cm"> */</span>
<span class="kt">uint32_t</span> <span class="n">error_code</span><span class="p">;</span> <span class="n">nghttp2_error_code</span> <span class="n">error_code</span><span class="p">;</span>
<span class="cm">/**</span> <span class="cm">/**</span>
<span class="cm"> * The additional debug data</span> <span class="cm"> * The additional debug data</span>
<span class="cm"> */</span> <span class="cm"> */</span>
@ -1274,9 +1274,6 @@
<span class="cm"> * `nghttp2_session_send()` to send data to the remote endpoint. If</span> <span class="cm"> * `nghttp2_session_send()` to send data to the remote endpoint. If</span>
<span class="cm"> * the application uses solely `nghttp2_session_mem_send()` instead,</span> <span class="cm"> * the application uses solely `nghttp2_session_mem_send()` instead,</span>
<span class="cm"> * this callback function is unnecessary.</span> <span class="cm"> * this callback function is unnecessary.</span>
<span class="cm"> *</span>
<span class="cm"> * To set this callback to :type:`nghttp2_session_callbacks`, use</span>
<span class="cm"> * `nghttp2_session_callbacks_set_send_callback()`.</span>
<span class="cm"> */</span> <span class="cm"> */</span>
<span class="k">typedef</span> <span class="nf">ssize_t</span> <span class="p">(</span><span class="o">*</span><span class="n">nghttp2_send_callback</span><span class="p">)</span> <span class="k">typedef</span> <span class="nf">ssize_t</span> <span class="p">(</span><span class="o">*</span><span class="n">nghttp2_send_callback</span><span class="p">)</span>
<span class="p">(</span><span class="n">nghttp2_session</span> <span class="o">*</span><span class="n">session</span><span class="p">,</span> <span class="p">(</span><span class="n">nghttp2_session</span> <span class="o">*</span><span class="n">session</span><span class="p">,</span>
@ -1302,9 +1299,6 @@
<span class="cm"> * `nghttp2_session_recv()` to receive data from the remote endpoint.</span> <span class="cm"> * `nghttp2_session_recv()` to receive data from the remote endpoint.</span>
<span class="cm"> * If the application uses solely `nghttp2_session_mem_recv()`</span> <span class="cm"> * If the application uses solely `nghttp2_session_mem_recv()`</span>
<span class="cm"> * instead, this callback function is unnecessary.</span> <span class="cm"> * instead, this callback function is unnecessary.</span>
<span class="cm"> *</span>
<span class="cm"> * To set this callback to :type:`nghttp2_session_callbacks`, use</span>
<span class="cm"> * `nghttp2_session_callbacks_set_recv_callback()`.</span>
<span class="cm"> */</span> <span class="cm"> */</span>
<span class="k">typedef</span> <span class="nf">ssize_t</span> <span class="p">(</span><span class="o">*</span><span class="n">nghttp2_recv_callback</span><span class="p">)</span> <span class="k">typedef</span> <span class="nf">ssize_t</span> <span class="p">(</span><span class="o">*</span><span class="n">nghttp2_recv_callback</span><span class="p">)</span>
<span class="p">(</span><span class="n">nghttp2_session</span> <span class="o">*</span><span class="n">session</span><span class="p">,</span> <span class="p">(</span><span class="n">nghttp2_session</span> <span class="o">*</span><span class="n">session</span><span class="p">,</span>
@ -1337,9 +1331,6 @@
<span class="cm"> * If nonzero value is returned, it is treated as fatal error and</span> <span class="cm"> * If nonzero value is returned, it is treated as fatal error and</span>
<span class="cm"> * `nghttp2_session_recv()` and `nghttp2_session_mem_recv()` functions</span> <span class="cm"> * `nghttp2_session_recv()` and `nghttp2_session_mem_recv()` functions</span>
<span class="cm"> * immediately return :enum:`NGHTTP2_ERR_CALLBACK_FAILURE`.</span> <span class="cm"> * immediately return :enum:`NGHTTP2_ERR_CALLBACK_FAILURE`.</span>
<span class="cm"> *</span>
<span class="cm"> * To set this callback to :type:`nghttp2_session_callbacks`, use</span>
<span class="cm"> * `nghttp2_session_callbacks_set_on_frame_recv_callback()`.</span>
<span class="cm"> */</span> <span class="cm"> */</span>
<span class="k">typedef</span> <span class="nf">int</span> <span class="p">(</span><span class="o">*</span><span class="n">nghttp2_on_frame_recv_callback</span><span class="p">)</span> <span class="k">typedef</span> <span class="nf">int</span> <span class="p">(</span><span class="o">*</span><span class="n">nghttp2_on_frame_recv_callback</span><span class="p">)</span>
<span class="p">(</span><span class="n">nghttp2_session</span> <span class="o">*</span><span class="n">session</span><span class="p">,</span> <span class="k">const</span> <span class="n">nghttp2_frame</span> <span class="o">*</span><span class="n">frame</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="n">nghttp2_session</span> <span class="o">*</span><span class="n">session</span><span class="p">,</span> <span class="k">const</span> <span class="n">nghttp2_frame</span> <span class="o">*</span><span class="n">frame</span><span class="p">,</span> <span class="kt">void</span> <span class="o">*</span><span class="n">user_data</span><span class="p">);</span>
@ -1348,13 +1339,12 @@
<span class="cm"> * @functypedef</span> <span class="cm"> * @functypedef</span>
<span class="cm"> *</span> <span class="cm"> *</span>
<span class="cm"> * Callback function invoked by `nghttp2_session_recv()` when an</span> <span class="cm"> * Callback function invoked by `nghttp2_session_recv()` when an</span>
<span class="cm"> * invalid non-DATA frame is received. The |error_code| indicates the</span> <span class="cm"> * invalid non-DATA frame is received. The |error_code| is one of the</span>
<span class="cm"> * error. It is usually one of the :enum:`nghttp2_error_code` but</span> <span class="cm"> * :enum:`nghttp2_error_code` and indicates the error. When this</span>
<span class="cm"> * that is not guaranteed. When this callback function is invoked,</span> <span class="cm"> * callback function is invoked, the library automatically submits</span>
<span class="cm"> * the library automatically submits either RST_STREAM or GOAWAY</span> <span class="cm"> * either RST_STREAM or GOAWAY frame. The |user_data| pointer is the</span>
<span class="cm"> * frame. The |user_data| pointer is the third argument passed in to</span> <span class="cm"> * third argument passed in to the call to</span>
<span class="cm"> * the call to `nghttp2_session_client_new()` or</span> <span class="cm"> * `nghttp2_session_client_new()` or `nghttp2_session_server_new()`.</span>
<span class="cm"> * `nghttp2_session_server_new()`.</span>
<span class="cm"> *</span> <span class="cm"> *</span>
<span class="cm"> * If frame is HEADERS or PUSH_PROMISE, the ``nva`` and ``nvlen``</span> <span class="cm"> * If frame is HEADERS or PUSH_PROMISE, the ``nva`` and ``nvlen``</span>
<span class="cm"> * member of their data structure are always ``NULL`` and 0</span> <span class="cm"> * member of their data structure are always ``NULL`` and 0</span>
@ -1364,13 +1354,10 @@
<span class="cm"> * If nonzero is returned, it is treated as fatal error and</span> <span class="cm"> * If nonzero is returned, it is treated as fatal error and</span>
<span class="cm"> * `nghttp2_session_recv()` and `nghttp2_session_send()` functions</span> <span class="cm"> * `nghttp2_session_recv()` and `nghttp2_session_send()` functions</span>
<span class="cm"> * immediately return :enum:`NGHTTP2_ERR_CALLBACK_FAILURE`.</span> <span class="cm"> * immediately return :enum:`NGHTTP2_ERR_CALLBACK_FAILURE`.</span>
<span class="cm"> *</span>
<span class="cm"> * To set this callback to :type:`nghttp2_session_callbacks`, use</span>
<span class="cm"> * `nghttp2_session_callbacks_set_on_invalid_frame_recv_callback()`.</span>
<span class="cm"> */</span> <span class="cm"> */</span>
<span class="k">typedef</span> <span class="nf">int</span> <span class="p">(</span><span class="o">*</span><span class="n">nghttp2_on_invalid_frame_recv_callback</span><span class="p">)</span> <span class="k">typedef</span> <span class="nf">int</span> <span class="p">(</span><span class="o">*</span><span class="n">nghttp2_on_invalid_frame_recv_callback</span><span class="p">)</span>
<span class="p">(</span><span class="n">nghttp2_session</span> <span class="o">*</span><span class="n">session</span><span class="p">,</span> <span class="k">const</span> <span class="n">nghttp2_frame</span> <span class="o">*</span><span class="n">frame</span><span class="p">,</span> <span class="p">(</span><span class="n">nghttp2_session</span> <span class="o">*</span><span class="n">session</span><span class="p">,</span> <span class="k">const</span> <span class="n">nghttp2_frame</span> <span class="o">*</span><span class="n">frame</span><span class="p">,</span>
<span class="kt">uint32_t</span> <span class="n">error_code</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="n">nghttp2_error_code</span> <span class="n">error_code</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="cm">/**</span> <span class="cm">/**</span>
<span class="cm"> * @functypedef</span> <span class="cm"> * @functypedef</span>
@ -1398,9 +1385,6 @@
<span class="cm"> * If nonzero is returned, it is treated as fatal error and</span> <span class="cm"> * If nonzero is returned, it is treated as fatal error and</span>
<span class="cm"> * `nghttp2_session_recv()` and `nghttp2_session_mem_recv()` functions</span> <span class="cm"> * `nghttp2_session_recv()` and `nghttp2_session_mem_recv()` functions</span>
<span class="cm"> * immediately return :enum:`NGHTTP2_ERR_CALLBACK_FAILURE`.</span> <span class="cm"> * immediately return :enum:`NGHTTP2_ERR_CALLBACK_FAILURE`.</span>
<span class="cm"> *</span>
<span class="cm"> * To set this callback to :type:`nghttp2_session_callbacks`, use</span>
<span class="cm"> * `nghttp2_session_callbacks_set_on_data_chunk_recv_callback()`.</span>
<span class="cm"> */</span> <span class="cm"> */</span>
<span class="k">typedef</span> <span class="nf">int</span> <span class="p">(</span><span class="o">*</span><span class="n">nghttp2_on_data_chunk_recv_callback</span><span class="p">)</span> <span class="k">typedef</span> <span class="nf">int</span> <span class="p">(</span><span class="o">*</span><span class="n">nghttp2_on_data_chunk_recv_callback</span><span class="p">)</span>
<span class="p">(</span><span class="n">nghttp2_session</span> <span class="o">*</span><span class="n">session</span><span class="p">,</span> <span class="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="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>
@ -1418,9 +1402,6 @@
<span class="cm"> * If nonzero is returned, it is treated as fatal error and</span> <span class="cm"> * If nonzero is returned, it is treated as fatal error and</span>
<span class="cm"> * `nghttp2_session_recv()` and `nghttp2_session_send()` functions</span> <span class="cm"> * `nghttp2_session_recv()` and `nghttp2_session_send()` functions</span>
<span class="cm"> * immediately return :enum:`NGHTTP2_ERR_CALLBACK_FAILURE`.</span> <span class="cm"> * immediately return :enum:`NGHTTP2_ERR_CALLBACK_FAILURE`.</span>
<span class="cm"> *</span>
<span class="cm"> * To set this callback to :type:`nghttp2_session_callbacks`, use</span>
<span class="cm"> * `nghttp2_session_callbacks_set_before_frame_send_callback()`.</span>
<span class="cm"> */</span> <span class="cm"> */</span>
<span class="k">typedef</span> <span class="nf">int</span> <span class="p">(</span><span class="o">*</span><span class="n">nghttp2_before_frame_send_callback</span><span class="p">)</span> <span class="k">typedef</span> <span class="nf">int</span> <span class="p">(</span><span class="o">*</span><span class="n">nghttp2_before_frame_send_callback</span><span class="p">)</span>
<span class="p">(</span><span class="n">nghttp2_session</span> <span class="o">*</span><span class="n">session</span><span class="p">,</span> <span class="k">const</span> <span class="n">nghttp2_frame</span> <span class="o">*</span><span class="n">frame</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="n">nghttp2_session</span> <span class="o">*</span><span class="n">session</span><span class="p">,</span> <span class="k">const</span> <span class="n">nghttp2_frame</span> <span class="o">*</span><span class="n">frame</span><span class="p">,</span> <span class="kt">void</span> <span class="o">*</span><span class="n">user_data</span><span class="p">);</span>
@ -1436,9 +1417,6 @@
<span class="cm"> * If nonzero is returned, it is treated as fatal error and</span> <span class="cm"> * If nonzero is returned, it is treated as fatal error and</span>
<span class="cm"> * `nghttp2_session_recv()` and `nghttp2_session_send()` functions</span> <span class="cm"> * `nghttp2_session_recv()` and `nghttp2_session_send()` functions</span>
<span class="cm"> * immediately return :enum:`NGHTTP2_ERR_CALLBACK_FAILURE`.</span> <span class="cm"> * immediately return :enum:`NGHTTP2_ERR_CALLBACK_FAILURE`.</span>
<span class="cm"> *</span>
<span class="cm"> * To set this callback to :type:`nghttp2_session_callbacks`, use</span>
<span class="cm"> * `nghttp2_session_callbacks_set_on_frame_send_callback()`.</span>
<span class="cm"> */</span> <span class="cm"> */</span>
<span class="k">typedef</span> <span class="nf">int</span> <span class="p">(</span><span class="o">*</span><span class="n">nghttp2_on_frame_send_callback</span><span class="p">)</span> <span class="k">typedef</span> <span class="nf">int</span> <span class="p">(</span><span class="o">*</span><span class="n">nghttp2_on_frame_send_callback</span><span class="p">)</span>
<span class="p">(</span><span class="n">nghttp2_session</span> <span class="o">*</span><span class="n">session</span><span class="p">,</span> <span class="k">const</span> <span class="n">nghttp2_frame</span> <span class="o">*</span><span class="n">frame</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="n">nghttp2_session</span> <span class="o">*</span><span class="n">session</span><span class="p">,</span> <span class="k">const</span> <span class="n">nghttp2_frame</span> <span class="o">*</span><span class="n">frame</span><span class="p">,</span> <span class="kt">void</span> <span class="o">*</span><span class="n">user_data</span><span class="p">);</span>
@ -1457,9 +1435,6 @@
<span class="cm"> * If nonzero is returned, it is treated as fatal error and</span> <span class="cm"> * If nonzero is returned, it is treated as fatal error and</span>
<span class="cm"> * `nghttp2_session_recv()` and `nghttp2_session_send()` functions</span> <span class="cm"> * `nghttp2_session_recv()` and `nghttp2_session_send()` functions</span>
<span class="cm"> * immediately return :enum:`NGHTTP2_ERR_CALLBACK_FAILURE`.</span> <span class="cm"> * immediately return :enum:`NGHTTP2_ERR_CALLBACK_FAILURE`.</span>
<span class="cm"> *</span>
<span class="cm"> * To set this callback to :type:`nghttp2_session_callbacks`, use</span>
<span class="cm"> * `nghttp2_session_callbacks_set_on_frame_not_send_callback()`.</span>
<span class="cm"> */</span> <span class="cm"> */</span>
<span class="k">typedef</span> <span class="nf">int</span> <span class="p">(</span><span class="o">*</span><span class="n">nghttp2_on_frame_not_send_callback</span><span class="p">)</span> <span class="k">typedef</span> <span class="nf">int</span> <span class="p">(</span><span class="o">*</span><span class="n">nghttp2_on_frame_not_send_callback</span><span class="p">)</span>
<span class="p">(</span><span class="n">nghttp2_session</span> <span class="o">*</span><span class="n">session</span><span class="p">,</span> <span class="k">const</span> <span class="n">nghttp2_frame</span> <span class="o">*</span><span class="n">frame</span><span class="p">,</span> <span class="kt">int</span> <span class="n">lib_error_code</span><span class="p">,</span> <span class="p">(</span><span class="n">nghttp2_session</span> <span class="o">*</span><span class="n">session</span><span class="p">,</span> <span class="k">const</span> <span class="n">nghttp2_frame</span> <span class="o">*</span><span class="n">frame</span><span class="p">,</span> <span class="kt">int</span> <span class="n">lib_error_code</span><span class="p">,</span>
@ -1470,11 +1445,10 @@
<span class="cm"> *</span> <span class="cm"> *</span>
<span class="cm"> * Callback function invoked when the stream |stream_id| is closed.</span> <span class="cm"> * Callback function invoked when the stream |stream_id| is closed.</span>
<span class="cm"> * The reason of closure is indicated by the |error_code|. The</span> <span class="cm"> * The reason of closure is indicated by the |error_code|. The</span>
<span class="cm"> * |error_code| is usually one of :enum:`nghttp2_error_code`, but that</span> <span class="cm"> * stream_user_data, which was specified in `nghttp2_submit_request()`</span>
<span class="cm"> * is not guaranteed. The stream_user_data, which was specified in</span> <span class="cm"> * or `nghttp2_submit_headers()`, is still available in this function.</span>
<span class="cm"> * `nghttp2_submit_request()` or `nghttp2_submit_headers()`, is still</span> <span class="cm"> * The |user_data| pointer is the third argument passed in to the call</span>
<span class="cm"> * available in this function. The |user_data| pointer is the third</span> <span class="cm"> * to `nghttp2_session_client_new()` or</span>
<span class="cm"> * argument passed in to the call to `nghttp2_session_client_new()` or</span>
<span class="cm"> * `nghttp2_session_server_new()`.</span> <span class="cm"> * `nghttp2_session_server_new()`.</span>
<span class="cm"> *</span> <span class="cm"> *</span>
<span class="cm"> * This function is also called for a stream in reserved state.</span> <span class="cm"> * This function is also called for a stream in reserved state.</span>
@ -1483,12 +1457,33 @@
<span class="cm"> * If nonzero is returned, it is treated as fatal error and</span> <span class="cm"> * If nonzero is returned, it is treated as fatal error and</span>
<span class="cm"> * `nghttp2_session_recv()` and `nghttp2_session_send()` functions</span> <span class="cm"> * `nghttp2_session_recv()` and `nghttp2_session_send()` functions</span>
<span class="cm"> * immediately return :enum:`NGHTTP2_ERR_CALLBACK_FAILURE`.</span> <span class="cm"> * immediately return :enum:`NGHTTP2_ERR_CALLBACK_FAILURE`.</span>
<span class="cm"> *</span>
<span class="cm"> * To set this callback to :type:`nghttp2_session_callbacks`, use</span>
<span class="cm"> * `nghttp2_session_callbacks_set_on_stream_close_callback()`.</span>
<span class="cm"> */</span> <span class="cm"> */</span>
<span class="k">typedef</span> <span class="nf">int</span> <span class="p">(</span><span class="o">*</span><span class="n">nghttp2_on_stream_close_callback</span><span class="p">)</span> <span class="k">typedef</span> <span class="nf">int</span> <span class="p">(</span><span class="o">*</span><span class="n">nghttp2_on_stream_close_callback</span><span class="p">)</span>
<span class="p">(</span><span class="n">nghttp2_session</span> <span class="o">*</span><span class="n">session</span><span class="p">,</span> <span class="kt">int32_t</span> <span class="n">stream_id</span><span class="p">,</span> <span class="kt">uint32_t</span> <span class="n">error_code</span><span class="p">,</span> <span class="p">(</span><span class="n">nghttp2_session</span> <span class="o">*</span><span class="n">session</span><span class="p">,</span> <span class="kt">int32_t</span> <span class="n">stream_id</span><span class="p">,</span> <span class="n">nghttp2_error_code</span> <span class="n">error_code</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="cm">/**</span>
<span class="cm"> * @functypedef</span>
<span class="cm"> *</span>
<span class="cm"> * Callback function invoked when the received frame type is unknown.</span>
<span class="cm"> * The |head| is the pointer to the header of the received frame. The</span>
<span class="cm"> * |headlen| is the length of the |head|. According to the spec, the</span>
<span class="cm"> * |headlen| is always 8. In other words, the |head| is the first 8</span>
<span class="cm"> * bytes of the received frame. The |payload| is the pointer to the</span>
<span class="cm"> * data portion of the received frame. The |payloadlen| is the length</span>
<span class="cm"> * of the |payload|. This is the data after the length field. The</span>
<span class="cm"> * |user_data| pointer is the third argument passed in to the call to</span>
<span class="cm"> * `nghttp2_session_client_new()` or `nghttp2_session_server_new()`.</span>
<span class="cm"> *</span>
<span class="cm"> * The implementation of this function must return 0 if it succeeds.</span>
<span class="cm"> * If nonzero is returned, it is treated as fatal error and</span>
<span class="cm"> * `nghttp2_session_recv()` and `nghttp2_session_send()` functions</span>
<span class="cm"> * immediately return :enum:`NGHTTP2_ERR_CALLBACK_FAILURE`.</span>
<span class="cm"> */</span>
<span class="k">typedef</span> <span class="nf">int</span> <span class="p">(</span><span class="o">*</span><span class="n">nghttp2_on_unknown_frame_recv_callback</span><span class="p">)</span>
<span class="p">(</span><span class="n">nghttp2_session</span> <span class="o">*</span><span class="n">session</span><span class="p">,</span>
<span class="k">const</span> <span class="kt">uint8_t</span> <span class="o">*</span><span class="n">head</span><span class="p">,</span> <span class="kt">size_t</span> <span class="n">headlen</span><span class="p">,</span>
<span class="k">const</span> <span class="kt">uint8_t</span> <span class="o">*</span><span class="n">payload</span><span class="p">,</span> <span class="kt">size_t</span> <span class="n">payloadlen</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="kt">void</span> <span class="o">*</span><span class="n">user_data</span><span class="p">);</span>
<span class="cm">/**</span> <span class="cm">/**</span>
@ -1511,9 +1506,6 @@
<span class="cm"> * :enum:`NGHTTP2_ERR_CALLBACK_FAILURE` is returned,</span> <span class="cm"> * :enum:`NGHTTP2_ERR_CALLBACK_FAILURE` is returned,</span>
<span class="cm"> * `nghttp2_session_mem_recv()` function will immediately return</span> <span class="cm"> * `nghttp2_session_mem_recv()` function will immediately return</span>
<span class="cm"> * :enum:`NGHTTP2_ERR_CALLBACK_FAILURE`.</span> <span class="cm"> * :enum:`NGHTTP2_ERR_CALLBACK_FAILURE`.</span>
<span class="cm"> *</span>
<span class="cm"> * To set this callback to :type:`nghttp2_session_callbacks`, use</span>
<span class="cm"> * `nghttp2_session_callbacks_set_on_begin_headers_callback()`.</span>
<span class="cm"> */</span> <span class="cm"> */</span>
<span class="k">typedef</span> <span class="nf">int</span> <span class="p">(</span><span class="o">*</span><span class="n">nghttp2_on_begin_headers_callback</span><span class="p">)</span> <span class="k">typedef</span> <span class="nf">int</span> <span class="p">(</span><span class="o">*</span><span class="n">nghttp2_on_begin_headers_callback</span><span class="p">)</span>
<span class="p">(</span><span class="n">nghttp2_session</span> <span class="o">*</span><span class="n">session</span><span class="p">,</span> <span class="k">const</span> <span class="n">nghttp2_frame</span> <span class="o">*</span><span class="n">frame</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="n">nghttp2_session</span> <span class="o">*</span><span class="n">session</span><span class="p">,</span> <span class="k">const</span> <span class="n">nghttp2_frame</span> <span class="o">*</span><span class="n">frame</span><span class="p">,</span> <span class="kt">void</span> <span class="o">*</span><span class="n">user_data</span><span class="p">);</span>
@ -1575,9 +1567,6 @@
<span class="cm"> * :enum:`NGHTTP2_ERR_CALLBACK_FAILURE` is returned,</span> <span class="cm"> * :enum:`NGHTTP2_ERR_CALLBACK_FAILURE` is returned,</span>
<span class="cm"> * `nghttp2_session_recv()` and `nghttp2_session_mem_recv()` functions</span> <span class="cm"> * `nghttp2_session_recv()` and `nghttp2_session_mem_recv()` functions</span>
<span class="cm"> * immediately return :enum:`NGHTTP2_ERR_CALLBACK_FAILURE`.</span> <span class="cm"> * immediately return :enum:`NGHTTP2_ERR_CALLBACK_FAILURE`.</span>
<span class="cm"> *</span>
<span class="cm"> * To set this callback to :type:`nghttp2_session_callbacks`, use</span>
<span class="cm"> * `nghttp2_session_callbacks_set_on_header_callback()`.</span>
<span class="cm"> */</span> <span class="cm"> */</span>
<span class="k">typedef</span> <span class="nf">int</span> <span class="p">(</span><span class="o">*</span><span class="n">nghttp2_on_header_callback</span><span class="p">)</span> <span class="k">typedef</span> <span class="nf">int</span> <span class="p">(</span><span class="o">*</span><span class="n">nghttp2_on_header_callback</span><span class="p">)</span>
<span class="p">(</span><span class="n">nghttp2_session</span> <span class="o">*</span><span class="n">session</span><span class="p">,</span> <span class="p">(</span><span class="n">nghttp2_session</span> <span class="o">*</span><span class="n">session</span><span class="p">,</span>
@ -1600,9 +1589,6 @@
<span class="cm"> * :enum:`NGHTTP2_ERR_CALLBACK_FAILURE` will make</span> <span class="cm"> * :enum:`NGHTTP2_ERR_CALLBACK_FAILURE` will make</span>
<span class="cm"> * `nghttp2_session_send()` function immediately return</span> <span class="cm"> * `nghttp2_session_send()` function immediately return</span>
<span class="cm"> * :enum:`NGHTTP2_ERR_CALLBACK_FAILURE`.</span> <span class="cm"> * :enum:`NGHTTP2_ERR_CALLBACK_FAILURE`.</span>
<span class="cm"> *</span>
<span class="cm"> * To set this callback to :type:`nghttp2_session_callbacks`, use</span>
<span class="cm"> * `nghttp2_session_callbacks_set_select_padding_callback()`.</span>
<span class="cm"> */</span> <span class="cm"> */</span>
<span class="k">typedef</span> <span class="nf">ssize_t</span> <span class="p">(</span><span class="o">*</span><span class="n">nghttp2_select_padding_callback</span><span class="p">)</span> <span class="k">typedef</span> <span class="nf">ssize_t</span> <span class="p">(</span><span class="o">*</span><span class="n">nghttp2_select_padding_callback</span><span class="p">)</span>
<span class="p">(</span><span class="n">nghttp2_session</span> <span class="o">*</span><span class="n">session</span><span class="p">,</span> <span class="p">(</span><span class="n">nghttp2_session</span> <span class="o">*</span><span class="n">session</span><span class="p">,</span>
@ -1610,197 +1596,80 @@
<span class="kt">size_t</span> <span class="n">max_payloadlen</span><span class="p">,</span> <span class="kt">size_t</span> <span class="n">max_payloadlen</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="kt">void</span> <span class="o">*</span><span class="n">user_data</span><span class="p">);</span>
<span class="cm">/**</span>
<span class="cm"> * @functypedef</span>
<span class="cm"> *</span>
<span class="cm"> * Callback function invoked when a frame header is received. The</span>
<span class="cm"> * |hd| points to received frame header.</span>
<span class="cm"> *</span>
<span class="cm"> * This callback won&#39;t be called for CONTINUATION frame because</span>
<span class="cm"> * library treats HEADERS/PUSH_PROMISE + CONTINUATION as single frame.</span>
<span class="cm"> *</span>
<span class="cm"> * If both :type:`nghttp2_on_begin_frame_callback` and</span>
<span class="cm"> * :type:`nghttp2_on_begin_headers_callback` are set and HEADERS or</span>
<span class="cm"> * PUSH_PROMISE is received, :type:`nghttp2_on_begin_frame_callback`</span>
<span class="cm"> * will be called first.</span>
<span class="cm"> *</span>
<span class="cm"> * The implementation of this function must return 0 if it succeeds.</span>
<span class="cm"> * If nonzero value is returned, it is treated as fatal error and</span>
<span class="cm"> * `nghttp2_session_recv()` and `nghttp2_session_mem_recv()` functions</span>
<span class="cm"> * immediately return :enum:`NGHTTP2_ERR_CALLBACK_FAILURE`.</span>
<span class="cm"> *</span>
<span class="cm"> * To set this callback to :type:`nghttp2_session_callbacks`, use</span>
<span class="cm"> * `nghttp2_session_callbacks_set_on_begin_frame_callback()`.</span>
<span class="cm"> */</span>
<span class="k">typedef</span> <span class="nf">int</span> <span class="p">(</span><span class="o">*</span><span class="n">nghttp2_on_begin_frame_callback</span><span class="p">)</span>
<span class="p">(</span><span class="n">nghttp2_session</span> <span class="o">*</span><span class="n">session</span><span class="p">,</span> <span class="k">const</span> <span class="n">nghttp2_frame_hd</span> <span class="o">*</span><span class="n">hd</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="k">struct</span> <span class="n">nghttp2_session_callbacks</span><span class="p">;</span>
<span class="cm">/**</span> <span class="cm">/**</span>
<span class="cm"> * @struct</span> <span class="cm"> * @struct</span>
<span class="cm"> *</span> <span class="cm"> *</span>
<span class="cm"> * Callback functions for :type:`nghttp2_session`. The details of</span> <span class="cm"> * Callback functions.</span>
<span class="cm"> * this structure are intentionally hidden from the public API.</span>
<span class="cm"> */</span> <span class="cm"> */</span>
<span class="k">typedef</span> <span class="k">struct</span> <span class="n">nghttp2_session_callbacks</span> <span class="n">nghttp2_session_callbacks</span><span class="p">;</span> <span class="k">typedef</span> <span class="k">struct</span> <span class="p">{</span>
<span class="cm">/**</span>
<span class="cm">/**</span> <span class="cm"> * Callback function invoked when the |session| wants to send data</span>
<span class="cm"> * @function</span> <span class="cm"> * to the remote peer. This callback is not necessary if the</span>
<span class="cm"> *</span> <span class="cm"> * application uses solely `nghttp2_session_mem_send()` to serialize</span>
<span class="cm"> * Initializes |*callbacks_ptr| with NULL values.</span> <span class="cm"> * data to transmit.</span>
<span class="cm"> *</span>
<span class="cm"> * The initialized object can be used when initializing multiple</span>
<span class="cm"> * :type:`nghttp2_session` objects.</span>
<span class="cm"> *</span>
<span class="cm"> * When the application finished using this object, it can use</span>
<span class="cm"> * `nghttp2_session_callbacks_del()` to free its memory.</span>
<span class="cm"> *</span>
<span class="cm"> * This function returns 0 if it succeeds, or one of the following</span>
<span class="cm"> * negative error codes:</span>
<span class="cm"> *</span>
<span class="cm"> * :enum:`NGHTTP2_ERR_NOMEM`</span>
<span class="cm"> * Out of memory.</span>
<span class="cm"> */</span> <span class="cm"> */</span>
<span class="kt">int</span> <span class="nf">nghttp2_session_callbacks_new</span><span class="p">(</span><span class="n">nghttp2_session_callbacks</span> <span class="o">**</span><span class="n">callbacks_ptr</span><span class="p">);</span> <span class="n">nghttp2_send_callback</span> <span class="n">send_callback</span><span class="p">;</span>
<span class="cm">/**</span>
<span class="cm">/**</span> <span class="cm"> * Callback function invoked when the |session| wants to receive</span>
<span class="cm"> * @function</span>
<span class="cm"> *</span>
<span class="cm"> * Frees any resources allocated for |callbacks|. If |callbacks| is</span>
<span class="cm"> * ``NULL``, this function does nothing.</span>
<span class="cm"> */</span>
<span class="kt">void</span> <span class="nf">nghttp2_session_callbacks_del</span><span class="p">(</span><span class="n">nghttp2_session_callbacks</span> <span class="o">*</span><span class="n">callbacks</span><span class="p">);</span>
<span class="cm">/**</span>
<span class="cm"> * @function</span>
<span class="cm"> *</span>
<span class="cm"> * Sets callback function invoked when a session wants to send data to</span>
<span class="cm"> * the remote peer. This callback is not necessary if the application</span>
<span class="cm"> * uses solely `nghttp2_session_mem_send()` to serialize data to</span>
<span class="cm"> * transmit.</span>
<span class="cm"> */</span>
<span class="kt">void</span> <span class="nf">nghttp2_session_callbacks_set_send_callback</span>
<span class="p">(</span><span class="n">nghttp2_session_callbacks</span> <span class="o">*</span><span class="n">cbs</span><span class="p">,</span> <span class="n">nghttp2_send_callback</span> <span class="n">send_callback</span><span class="p">);</span>
<span class="cm">/**</span>
<span class="cm"> * @function</span>
<span class="cm"> *</span>
<span class="cm"> * Sets callback function invoked when the a session wants to receive</span>
<span class="cm"> * data from the remote peer. This callback is not necessary if the</span> <span class="cm"> * data from the remote peer. This callback is not necessary if the</span>
<span class="cm"> * application uses solely `nghttp2_session_mem_recv()` to process</span> <span class="cm"> * application uses solely `nghttp2_session_mem_recv()` to process</span>
<span class="cm"> * received data.</span> <span class="cm"> * received data.</span>
<span class="cm"> */</span> <span class="cm"> */</span>
<span class="kt">void</span> <span class="nf">nghttp2_session_callbacks_set_recv_callback</span> <span class="n">nghttp2_recv_callback</span> <span class="n">recv_callback</span><span class="p">;</span>
<span class="p">(</span><span class="n">nghttp2_session_callbacks</span> <span class="o">*</span><span class="n">cbs</span><span class="p">,</span> <span class="n">nghttp2_recv_callback</span> <span class="n">recv_callback</span><span class="p">);</span> <span class="cm">/**</span>
<span class="cm"> * Callback function invoked by `nghttp2_session_recv()` when a</span>
<span class="cm">/**</span>
<span class="cm"> * @function</span>
<span class="cm"> *</span>
<span class="cm"> * Sets callback function invoked by `nghttp2_session_recv()` when a</span>
<span class="cm"> * frame is received.</span> <span class="cm"> * frame is received.</span>
<span class="cm"> */</span> <span class="cm"> */</span>
<span class="kt">void</span> <span class="nf">nghttp2_session_callbacks_set_on_frame_recv_callback</span> <span class="n">nghttp2_on_frame_recv_callback</span> <span class="n">on_frame_recv_callback</span><span class="p">;</span>
<span class="p">(</span><span class="n">nghttp2_session_callbacks</span> <span class="o">*</span><span class="n">cbs</span><span class="p">,</span> <span class="cm">/**</span>
<span class="n">nghttp2_on_frame_recv_callback</span> <span class="n">on_frame_recv_callback</span><span class="p">);</span> <span class="cm"> * Callback function invoked by `nghttp2_session_recv()` when an</span>
<span class="cm">/**</span>
<span class="cm"> * @function</span>
<span class="cm"> *</span>
<span class="cm"> * Sets callback function invoked by `nghttp2_session_recv()` when an</span>
<span class="cm"> * invalid non-DATA frame is received.</span> <span class="cm"> * invalid non-DATA frame is received.</span>
<span class="cm"> */</span> <span class="cm"> */</span>
<span class="kt">void</span> <span class="nf">nghttp2_session_callbacks_set_on_invalid_frame_recv_callback</span> <span class="n">nghttp2_on_invalid_frame_recv_callback</span> <span class="n">on_invalid_frame_recv_callback</span><span class="p">;</span>
<span class="p">(</span><span class="n">nghttp2_session_callbacks</span> <span class="o">*</span><span class="n">cbs</span><span class="p">,</span> <span class="cm">/**</span>
<span class="n">nghttp2_on_invalid_frame_recv_callback</span> <span class="n">on_invalid_frame_recv_callback</span><span class="p">);</span> <span class="cm"> * Callback function invoked when a chunk of data in DATA frame is</span>
<span class="cm">/**</span>
<span class="cm"> * @function</span>
<span class="cm"> *</span>
<span class="cm"> * Sets callback function invoked when a chunk of data in DATA frame</span>
<span class="cm"> * is received.</span>
<span class="cm"> */</span>
<span class="kt">void</span> <span class="nf">nghttp2_session_callbacks_set_on_data_chunk_recv_callback</span>
<span class="p">(</span><span class="n">nghttp2_session_callbacks</span> <span class="o">*</span><span class="n">cbs</span><span class="p">,</span>
<span class="n">nghttp2_on_data_chunk_recv_callback</span> <span class="n">on_data_chunk_recv_callback</span><span class="p">);</span>
<span class="cm">/**</span>
<span class="cm"> * @function</span>
<span class="cm"> *</span>
<span class="cm"> * Sets callback function invoked before a non-DATA frame is sent.</span>
<span class="cm"> */</span>
<span class="kt">void</span> <span class="nf">nghttp2_session_callbacks_set_before_frame_send_callback</span>
<span class="p">(</span><span class="n">nghttp2_session_callbacks</span> <span class="o">*</span><span class="n">cbs</span><span class="p">,</span>
<span class="n">nghttp2_before_frame_send_callback</span> <span class="n">before_frame_send_callback</span><span class="p">);</span>
<span class="cm">/**</span>
<span class="cm"> * @function</span>
<span class="cm"> *</span>
<span class="cm"> * Sets callback function invoked after a frame is sent.</span>
<span class="cm"> */</span>
<span class="kt">void</span> <span class="nf">nghttp2_session_callbacks_set_on_frame_send_callback</span>
<span class="p">(</span><span class="n">nghttp2_session_callbacks</span> <span class="o">*</span><span class="n">cbs</span><span class="p">,</span>
<span class="n">nghttp2_on_frame_send_callback</span> <span class="n">on_frame_send_callback</span><span class="p">);</span>
<span class="cm">/**</span>
<span class="cm"> * @function</span>
<span class="cm"> *</span>
<span class="cm"> * Sets callback function invoked when a non-DATA frame is not sent</span>
<span class="cm"> * because of an error.</span>
<span class="cm"> */</span>
<span class="kt">void</span> <span class="nf">nghttp2_session_callbacks_set_on_frame_not_send_callback</span>
<span class="p">(</span><span class="n">nghttp2_session_callbacks</span> <span class="o">*</span><span class="n">cbs</span><span class="p">,</span>
<span class="n">nghttp2_on_frame_not_send_callback</span> <span class="n">on_frame_not_send_callback</span><span class="p">);</span>
<span class="cm">/**</span>
<span class="cm"> * @function</span>
<span class="cm"> *</span>
<span class="cm"> * Sets callback function invoked when the stream is closed.</span>
<span class="cm"> */</span>
<span class="kt">void</span> <span class="nf">nghttp2_session_callbacks_set_on_stream_close_callback</span>
<span class="p">(</span><span class="n">nghttp2_session_callbacks</span> <span class="o">*</span><span class="n">cbs</span><span class="p">,</span>
<span class="n">nghttp2_on_stream_close_callback</span> <span class="n">on_stream_close_callback</span><span class="p">);</span>
<span class="cm">/**</span>
<span class="cm"> * @function</span>
<span class="cm"> *</span>
<span class="cm"> * Sets callback function invoked when the reception of header block</span>
<span class="cm"> * in HEADERS or PUSH_PROMISE is started.</span>
<span class="cm"> */</span>
<span class="kt">void</span> <span class="nf">nghttp2_session_callbacks_set_on_begin_headers_callback</span>
<span class="p">(</span><span class="n">nghttp2_session_callbacks</span> <span class="o">*</span><span class="n">cbs</span><span class="p">,</span>
<span class="n">nghttp2_on_begin_headers_callback</span> <span class="n">on_begin_headers_callback</span><span class="p">);</span>
<span class="cm">/**</span>
<span class="cm"> * @function</span>
<span class="cm"> *</span>
<span class="cm"> * Sets callback function invoked when a header name/value pair is</span>
<span class="cm"> * received.</span> <span class="cm"> * received.</span>
<span class="cm"> */</span> <span class="cm"> */</span>
<span class="kt">void</span> <span class="nf">nghttp2_session_callbacks_set_on_header_callback</span> <span class="n">nghttp2_on_data_chunk_recv_callback</span> <span class="n">on_data_chunk_recv_callback</span><span class="p">;</span>
<span class="p">(</span><span class="n">nghttp2_session_callbacks</span> <span class="o">*</span><span class="n">cbs</span><span class="p">,</span> <span class="cm">/**</span>
<span class="n">nghttp2_on_header_callback</span> <span class="n">on_header_callback</span><span class="p">);</span> <span class="cm"> * Callback function invoked before a non-DATA frame is sent.</span>
<span class="cm">/**</span>
<span class="cm"> * @function</span>
<span class="cm"> *</span>
<span class="cm"> * Sets callback function invoked when the library asks application</span>
<span class="cm"> * how many padding bytes are required for the transmission of the</span>
<span class="cm"> * given frame.</span>
<span class="cm"> */</span> <span class="cm"> */</span>
<span class="kt">void</span> <span class="nf">nghttp2_session_callbacks_set_select_padding_callback</span> <span class="n">nghttp2_before_frame_send_callback</span> <span class="n">before_frame_send_callback</span><span class="p">;</span>
<span class="p">(</span><span class="n">nghttp2_session_callbacks</span> <span class="o">*</span><span class="n">cbs</span><span class="p">,</span> <span class="cm">/**</span>
<span class="n">nghttp2_select_padding_callback</span> <span class="n">select_padding_callback</span><span class="p">);</span> <span class="cm"> * Callback function invoked after a frame is sent.</span>
<span class="cm">/**</span>
<span class="cm"> * @function</span>
<span class="cm"> *</span>
<span class="cm"> * Sets callback function invoked when a frame header is received.</span>
<span class="cm"> */</span> <span class="cm"> */</span>
<span class="kt">void</span> <span class="nf">nghttp2_session_callbacks_set_on_begin_frame_callback</span> <span class="n">nghttp2_on_frame_send_callback</span> <span class="n">on_frame_send_callback</span><span class="p">;</span>
<span class="p">(</span><span class="n">nghttp2_session_callbacks</span> <span class="o">*</span><span class="n">cbs</span><span class="p">,</span> <span class="cm">/**</span>
<span class="n">nghttp2_on_begin_frame_callback</span> <span class="n">on_begin_frame_callback</span><span class="p">);</span> <span class="cm"> * The callback function invoked when a non-DATA frame is not sent</span>
<span class="cm"> * because of an error.</span>
<span class="cm"> */</span>
<span class="n">nghttp2_on_frame_not_send_callback</span> <span class="n">on_frame_not_send_callback</span><span class="p">;</span>
<span class="cm">/**</span>
<span class="cm"> * Callback function invoked when the stream is closed.</span>
<span class="cm"> */</span>
<span class="n">nghttp2_on_stream_close_callback</span> <span class="n">on_stream_close_callback</span><span class="p">;</span>
<span class="cm">/**</span>
<span class="cm"> * Callback function invoked when the received frame type is</span>
<span class="cm"> * unknown.</span>
<span class="cm"> */</span>
<span class="n">nghttp2_on_unknown_frame_recv_callback</span> <span class="n">on_unknown_frame_recv_callback</span><span class="p">;</span>
<span class="cm">/**</span>
<span class="cm"> * Callback function invoked when the reception of header block in</span>
<span class="cm"> * HEADERS or PUSH_PROMISE is started.</span>
<span class="cm"> */</span>
<span class="n">nghttp2_on_begin_headers_callback</span> <span class="n">on_begin_headers_callback</span><span class="p">;</span>
<span class="cm">/**</span>
<span class="cm"> * Callback function invoked when a header name/value pair is</span>
<span class="cm"> * received.</span>
<span class="cm"> */</span>
<span class="n">nghttp2_on_header_callback</span> <span class="n">on_header_callback</span><span class="p">;</span>
<span class="cm">/**</span>
<span class="cm"> * Callback function invoked when the library asks application how</span>
<span class="cm"> * many padding bytes are required for the transmission of the given</span>
<span class="cm"> * frame.</span>
<span class="cm"> */</span>
<span class="n">nghttp2_select_padding_callback</span> <span class="n">select_padding_callback</span><span class="p">;</span>
<span class="p">}</span> <span class="n">nghttp2_session_callbacks</span><span class="p">;</span>
<span class="k">struct</span> <span class="n">nghttp2_option</span><span class="p">;</span> <span class="k">struct</span> <span class="n">nghttp2_option</span><span class="p">;</span>
@ -1874,10 +1743,10 @@
<span class="cm"> * does not store |callbacks|. The |user_data| is an arbitrary user</span> <span class="cm"> * does not store |callbacks|. The |user_data| is an arbitrary user</span>
<span class="cm"> * supplied data, which will be passed to the callback functions.</span> <span class="cm"> * supplied data, which will be passed to the callback functions.</span>
<span class="cm"> *</span> <span class="cm"> *</span>
<span class="cm"> * The :type:`nghttp2_send_callback` must be specified. If the</span> <span class="cm"> * The :member:`nghttp2_session_callbacks.send_callback` must be</span>
<span class="cm"> * application code uses `nghttp2_session_recv()`, the</span> <span class="cm"> * specified. If the application code uses `nghttp2_session_recv()`,</span>
<span class="cm"> * :type:`nghttp2_recv_callback` must be specified. The other members</span> <span class="cm"> * the :member:`nghttp2_session_callbacks.recv_callback` must be</span>
<span class="cm"> * of |callbacks| can be ``NULL``.</span> <span class="cm"> * specified. The other members of |callbacks| can be ``NULL``.</span>
<span class="cm"> *</span> <span class="cm"> *</span>
<span class="cm"> * If this function fails, |*session_ptr| is left untouched.</span> <span class="cm"> * If this function fails, |*session_ptr| is left untouched.</span>
<span class="cm"> *</span> <span class="cm"> *</span>
@ -1899,10 +1768,10 @@
<span class="cm"> * does not store |callbacks|. The |user_data| is an arbitrary user</span> <span class="cm"> * does not store |callbacks|. The |user_data| is an arbitrary user</span>
<span class="cm"> * supplied data, which will be passed to the callback functions.</span> <span class="cm"> * supplied data, which will be passed to the callback functions.</span>
<span class="cm"> *</span> <span class="cm"> *</span>
<span class="cm"> * The :type:`nghttp2_send_callback` must be specified. If the</span> <span class="cm"> * The :member:`nghttp2_session_callbacks.send_callback` must be</span>
<span class="cm"> * application code uses `nghttp2_session_recv()`, the</span> <span class="cm"> * specified. If the application code uses `nghttp2_session_recv()`,</span>
<span class="cm"> * :type:`nghttp2_recv_callback` must be specified. The other members</span> <span class="cm"> * the :member:`nghttp2_session_callbacks.recv_callback` must be</span>
<span class="cm"> * of |callbacks| can be ``NULL``.</span> <span class="cm"> * specified. The other members of |callbacks| can be ``NULL``.</span>
<span class="cm"> *</span> <span class="cm"> *</span>
<span class="cm"> * If this function fails, |*session_ptr| is left untouched.</span> <span class="cm"> * If this function fails, |*session_ptr| is left untouched.</span>
<span class="cm"> *</span> <span class="cm"> *</span>
@ -1984,36 +1853,32 @@
<span class="cm"> * This function retrieves the highest prioritized frame from the</span> <span class="cm"> * This function retrieves the highest prioritized frame from the</span>
<span class="cm"> * outbound queue and sends it to the remote peer. It does this as</span> <span class="cm"> * outbound queue and sends it to the remote peer. It does this as</span>
<span class="cm"> * many as possible until the user callback</span> <span class="cm"> * many as possible until the user callback</span>
<span class="cm"> * :type:`nghttp2_send_callback` returns</span> <span class="cm"> * :member:`nghttp2_session_callbacks.send_callback` returns</span>
<span class="cm"> * :enum:`NGHTTP2_ERR_WOULDBLOCK` or the outbound queue becomes empty.</span> <span class="cm"> * :enum:`NGHTTP2_ERR_WOULDBLOCK` or the outbound queue becomes empty.</span>
<span class="cm"> * This function calls several callback functions which are passed</span> <span class="cm"> * This function calls several callback functions which are passed</span>
<span class="cm"> * when initializing the |session|. Here is the simple time chart</span> <span class="cm"> * when initializing the |session|. Here is the simple time chart</span>
<span class="cm"> * which tells when each callback is invoked:</span> <span class="cm"> * which tells when each callback is invoked:</span>
<span class="cm"> *</span> <span class="cm"> *</span>
<span class="cm"> * 1. Get the next frame to send from outbound queue.</span> <span class="cm"> * 1. Get the next frame to send from outbound queue.</span>
<span class="cm"> *</span>
<span class="cm"> * 2. Prepare transmission of the frame.</span> <span class="cm"> * 2. Prepare transmission of the frame.</span>
<span class="cm"> *</span>
<span class="cm"> * 3. If the control frame cannot be sent because some preconditions</span> <span class="cm"> * 3. If the control frame cannot be sent because some preconditions</span>
<span class="cm"> * are not met (e.g., request HEADERS cannot be sent after GOAWAY),</span> <span class="cm"> * are not met (e.g., request HEADERS cannot be sent after GOAWAY),</span>
<span class="cm"> * :type:`nghttp2_on_frame_not_send_callback` is invoked. Abort</span> <span class="cm"> * :member:`nghttp2_session_callbacks.on_frame_not_send_callback`</span>
<span class="cm"> * the following steps.</span> <span class="cm"> * is invoked. Abort the following steps.</span>
<span class="cm"> *</span>
<span class="cm"> * 4. If the frame is HEADERS, PUSH_PROMISE or DATA,</span> <span class="cm"> * 4. If the frame is HEADERS, PUSH_PROMISE or DATA,</span>
<span class="cm"> * :type:`nghttp2_select_padding_callback` is invoked.</span> <span class="cm"> * :member:`nghttp2_session_callbacks.select_padding_callback` is</span>
<span class="cm"> *</span> <span class="cm"> * invoked.</span>
<span class="cm"> * 5. If the frame is request HEADERS, the stream is opened here.</span> <span class="cm"> * 5. If the frame is request HEADERS, the stream is opened here.</span>
<span class="cm"> *</span> <span class="cm"> * 6. :member:`nghttp2_session_callbacks.before_frame_send_callback` is</span>
<span class="cm"> * 6. :type:`nghttp2_before_frame_send_callback` is invoked.</span> <span class="cm"> * invoked.</span>
<span class="cm"> *</span> <span class="cm"> * 7. :member:`nghttp2_session_callbacks.send_callback` is invoked one</span>
<span class="cm"> * 7. :type:`nghttp2_send_callback` is invoked one or more times to</span> <span class="cm"> * or more times to send the frame.</span>
<span class="cm"> * send the frame.</span> <span class="cm"> * 8. :member:`nghttp2_session_callbacks.on_frame_send_callback` is</span>
<span class="cm"> *</span> <span class="cm"> * invoked.</span>
<span class="cm"> * 8. :type:`nghttp2_on_frame_send_callback` is invoked.</span>
<span class="cm"> *</span>
<span class="cm"> * 9. If the transmission of the frame triggers closure of the stream,</span> <span class="cm"> * 9. If the transmission of the frame triggers closure of the stream,</span>
<span class="cm"> * the stream is closed and</span> <span class="cm"> * the stream is closed and</span>
<span class="cm"> * :type:`nghttp2_on_stream_close_callback` is invoked.</span> <span class="cm"> * :member:`nghttp2_session_callbacks.on_stream_close_callback` is</span>
<span class="cm"> * invoked.</span>
<span class="cm"> *</span> <span class="cm"> *</span>
<span class="cm"> * This function returns 0 if it succeeds, or one of the following</span> <span class="cm"> * This function returns 0 if it succeeds, or one of the following</span>
<span class="cm"> * negative error codes:</span> <span class="cm"> * negative error codes:</span>
@ -2031,10 +1896,11 @@
<span class="cm"> * Returns the serialized data to send.</span> <span class="cm"> * Returns the serialized data to send.</span>
<span class="cm"> *</span> <span class="cm"> *</span>
<span class="cm"> * This function behaves like `nghttp2_session_send()` except that it</span> <span class="cm"> * This function behaves like `nghttp2_session_send()` except that it</span>
<span class="cm"> * does not use :type:`nghttp2_send_callback` to transmit data.</span> <span class="cm"> * does not use :member:`nghttp2_session_callbacks.send_callback` to</span>
<span class="cm"> * Instead, it assigns the pointer to the serialized data to the</span> <span class="cm"> * transmit data. Instead, it assigns the pointer to the serialized</span>
<span class="cm"> * |*data_ptr| and returns its length. The other callbacks are called</span> <span class="cm"> * data to the |*data_ptr| and returns its length. The other</span>
<span class="cm"> * in the same way as they are in `nghttp2_session_send()`.</span> <span class="cm"> * callbacks are called in the same way as they are in</span>
<span class="cm"> * `nghttp2_session_send()`.</span>
<span class="cm"> *</span> <span class="cm"> *</span>
<span class="cm"> * If no data is available to send, this function returns 0.</span> <span class="cm"> * If no data is available to send, this function returns 0.</span>
<span class="cm"> *</span> <span class="cm"> *</span>
@ -2064,48 +1930,51 @@
<span class="cm"> * Receives frames from the remote peer.</span> <span class="cm"> * Receives frames from the remote peer.</span>
<span class="cm"> *</span> <span class="cm"> *</span>
<span class="cm"> * This function receives as many frames as possible until the user</span> <span class="cm"> * This function receives as many frames as possible until the user</span>
<span class="cm"> * callback :type:`nghttp2_recv_callback` returns</span> <span class="cm"> * callback :member:`nghttp2_session_callbacks.recv_callback` returns</span>
<span class="cm"> * :enum:`NGHTTP2_ERR_WOULDBLOCK`. This function calls several</span> <span class="cm"> * :enum:`NGHTTP2_ERR_WOULDBLOCK`. This function calls several</span>
<span class="cm"> * callback functions which are passed when initializing the</span> <span class="cm"> * callback functions which are passed when initializing the</span>
<span class="cm"> * |session|. Here is the simple time chart which tells when each</span> <span class="cm"> * |session|. Here is the simple time chart which tells when each</span>
<span class="cm"> * callback is invoked:</span> <span class="cm"> * callback is invoked:</span>
<span class="cm"> *</span> <span class="cm"> *</span>
<span class="cm"> * 1. :type:`nghttp2_recv_callback` is invoked one or more times to</span> <span class="cm"> * 1. :member:`nghttp2_session_callbacks.recv_callback` is invoked one</span>
<span class="cm"> * receive frame header.</span> <span class="cm"> * or more times to receive frame header.</span>
<span class="cm"> *</span> <span class="cm"> * 2. If the frame is DATA frame:</span>
<span class="cm"> * 2. When frame header is received,</span>
<span class="cm"> * :type:`nghttp2_on_begin_frame_callback` is invoked.</span>
<span class="cm"> *</span>
<span class="cm"> * 3. If the frame is DATA frame:</span>
<span class="cm"> *</span>
<span class="cm"> * 1. :type:`nghttp2_recv_callback` is invoked to receive DATA</span>
<span class="cm"> * payload. For each chunk of data,</span>
<span class="cm"> * :type:`nghttp2_on_data_chunk_recv_callback` is invoked.</span>
<span class="cm"> *</span> <span class="cm"> *</span>
<span class="cm"> * 1. :member:`nghttp2_session_callbacks.recv_callback` is invoked</span>
<span class="cm"> * to receive DATA payload. For each chunk of data,</span>
<span class="cm"> * :member:`nghttp2_session_callbacks.on_data_chunk_recv_callback`</span>
<span class="cm"> * is invoked.</span>
<span class="cm"> * 2. If one DATA frame is completely received,</span> <span class="cm"> * 2. If one DATA frame is completely received,</span>
<span class="cm"> * :type:`nghttp2_on_frame_recv_callback` is invoked. If the</span> <span class="cm"> * :member:`nghttp2_session_callbacks.on_frame_recv_callback` is</span>
<span class="cm"> * reception of the frame triggers the closure of the stream,</span> <span class="cm"> * invoked. If the reception of the frame triggers the</span>
<span class="cm"> * :type:`nghttp2_on_stream_close_callback` is invoked.</span> <span class="cm"> * closure of the stream,</span>
<span class="cm"> * :member:`nghttp2_session_callbacks.on_stream_close_callback`</span>
<span class="cm"> * is invoked.</span>
<span class="cm"> *</span> <span class="cm"> *</span>
<span class="cm"> * 4. If the frame is the control frame:</span> <span class="cm"> * 3. If the frame is the control frame:</span>
<span class="cm"> *</span> <span class="cm"> *</span>
<span class="cm"> * 1. :type:`nghttp2_recv_callback` is invoked one or more times to</span> <span class="cm"> * 1. :member:`nghttp2_session_callbacks.recv_callback` is invoked</span>
<span class="cm"> * receive whole frame.</span> <span class="cm"> * one or more times to receive whole frame.</span>
<span class="cm"> *</span> <span class="cm"> *</span>
<span class="cm"> * 2. If the received frame is valid, then following actions are</span> <span class="cm"> * 2. If the received frame is valid, then following actions are</span>
<span class="cm"> * taken. If the frame is either HEADERS or PUSH_PROMISE,</span> <span class="cm"> * taken. If the frame is either HEADERS or PUSH_PROMISE,</span>
<span class="cm"> * :type:`nghttp2_on_begin_headers_callback` is invoked. Then</span> <span class="cm"> * :member:`nghttp2_session_callbacks.on_begin_headers_callback`</span>
<span class="cm"> * :type:`nghttp2_on_header_callback` is invoked for each header</span> <span class="cm"> * is invoked. Then</span>
<span class="cm"> * name/value pair. After all name/value pairs are emitted</span> <span class="cm"> * :member:`nghttp2_session_callbacks.on_header_callback` is</span>
<span class="cm"> * successfully, :type:`nghttp2_on_frame_recv_callback` is</span> <span class="cm"> * invoked for each header name/value pair. After all name/value</span>
<span class="cm"> * pairs are emitted successfully,</span>
<span class="cm"> * :member:`nghttp2_session_callbacks.on_frame_recv_callback` is</span>
<span class="cm"> * invoked. For other frames,</span> <span class="cm"> * invoked. For other frames,</span>
<span class="cm"> * :type:`nghttp2_on_frame_recv_callback` is invoked. If the</span> <span class="cm"> * :member:`nghttp2_session_callbacks.on_frame_recv_callback` is</span>
<span class="cm"> * reception of the frame triggers the closure of the stream,</span>
<span class="cm"> * :type:`nghttp2_on_stream_close_callback` is invoked.</span>
<span class="cm"> *</span>
<span class="cm"> * 3. If the received frame is unpacked but is interpreted as</span>
<span class="cm"> * invalid, :type:`nghttp2_on_invalid_frame_recv_callback` is</span>
<span class="cm"> * invoked.</span> <span class="cm"> * invoked.</span>
<span class="cm"> * If the reception of the frame triggers the closure of the</span>
<span class="cm"> * stream,</span>
<span class="cm"> * :member:`nghttp2_session_callbacks.on_stream_close_callback`</span>
<span class="cm"> * is invoked.</span>
<span class="cm"> * 3. If the received frame is unpacked but is interpreted as</span>
<span class="cm"> * invalid,</span>
<span class="cm"> * :member:`nghttp2_session_callbacks.on_invalid_frame_recv_callback`</span>
<span class="cm"> * is invoked.</span>
<span class="cm"> *</span> <span class="cm"> *</span>
<span class="cm"> * This function returns 0 if it succeeds, or one of the following</span> <span class="cm"> * This function returns 0 if it succeeds, or one of the following</span>
<span class="cm"> * negative error codes:</span> <span class="cm"> * negative error codes:</span>
@ -2126,17 +1995,18 @@
<span class="cm"> * |inlen| indicates the number of bytes in the |in|.</span> <span class="cm"> * |inlen| indicates the number of bytes in the |in|.</span>
<span class="cm"> *</span> <span class="cm"> *</span>
<span class="cm"> * This function behaves like `nghttp2_session_recv()` except that it</span> <span class="cm"> * This function behaves like `nghttp2_session_recv()` except that it</span>
<span class="cm"> * does not use :type:`nghttp2_recv_callback` to receive data; the</span> <span class="cm"> * does not use :member:`nghttp2_session_callbacks.recv_callback` to</span>
<span class="cm"> * |in| is the only data for the invocation of this function. If all</span> <span class="cm"> * receive data; the |in| is the only data for the invocation of this</span>
<span class="cm"> * bytes are processed, this function returns. The other callbacks</span> <span class="cm"> * function. If all bytes are processed, this function returns. The</span>
<span class="cm"> * are called in the same way as they are in `nghttp2_session_recv()`.</span> <span class="cm"> * other callbacks are called in the same way as they are in</span>
<span class="cm"> * `nghttp2_session_recv()`.</span>
<span class="cm"> *</span> <span class="cm"> *</span>
<span class="cm"> * In the current implementation, this function always tries to</span> <span class="cm"> * In the current implementation, this function always tries to</span>
<span class="cm"> * processes all input data unless either an error occurs or</span> <span class="cm"> * processes all input data unless either an error occurs or</span>
<span class="cm"> * :enum:`NGHTTP2_ERR_PAUSE` is returned from</span> <span class="cm"> * :enum:`NGHTTP2_ERR_PAUSE` is returned from</span>
<span class="cm"> * :type:`nghttp2_on_header_callback` or</span> <span class="cm"> * :member:`nghttp2_session_callbacks.on_header_callback` or</span>
<span class="cm"> * :type:`nghttp2_on_data_chunk_recv_callback`. If</span> <span class="cm"> * :member:`nghttp2_session_callbacks.on_data_chunk_recv_callback`.</span>
<span class="cm"> * :enum:`NGHTTP2_ERR_PAUSE` is used, the return value includes the</span> <span class="cm"> * If :enum:`NGHTTP2_ERR_PAUSE` is used, the return value includes the</span>
<span class="cm"> * number of bytes which was used to produce the data or frame for the</span> <span class="cm"> * number of bytes which was used to produce the data or frame for the</span>
<span class="cm"> * callback.</span> <span class="cm"> * callback.</span>
<span class="cm"> *</span> <span class="cm"> *</span>
@ -2336,8 +2206,7 @@
<span class="cm"> * The last stream ID is the ID of a stream for which</span> <span class="cm"> * The last stream ID is the ID of a stream for which</span>
<span class="cm"> * :type:`nghttp2_on_frame_recv_callback` was called most recently.</span> <span class="cm"> * :type:`nghttp2_on_frame_recv_callback` was called most recently.</span>
<span class="cm"> *</span> <span class="cm"> *</span>
<span class="cm"> * The |error_code| is the error code of this GOAWAY frame. The</span> <span class="cm"> * The |error_code| is the error code of this GOAWAY frame.</span>
<span class="cm"> * pre-defined error code is one of :enum:`nghttp2_error_code`.</span>
<span class="cm"> *</span> <span class="cm"> *</span>
<span class="cm"> * After the transmission, both `nghttp2_session_want_read()` and</span> <span class="cm"> * After the transmission, both `nghttp2_session_want_read()` and</span>
<span class="cm"> * `nghttp2_session_want_write()` return 0.</span> <span class="cm"> * `nghttp2_session_want_write()` return 0.</span>
@ -2353,7 +2222,7 @@
<span class="cm"> * Out of memory.</span> <span class="cm"> * Out of memory.</span>
<span class="cm"> */</span> <span class="cm"> */</span>
<span class="kt">int</span> <span class="nf">nghttp2_session_terminate_session</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">int</span> <span class="nf">nghttp2_session_terminate_session</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">uint32_t</span> <span class="n">error_code</span><span class="p">);</span> <span class="n">nghttp2_error_code</span> <span class="n">error_code</span><span class="p">);</span>
<span class="cm">/**</span> <span class="cm">/**</span>
<span class="cm"> * @function</span> <span class="cm"> * @function</span>
@ -2372,7 +2241,7 @@
<span class="cm"> */</span> <span class="cm"> */</span>
<span class="kt">int</span> <span class="nf">nghttp2_session_terminate_session2</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">int</span> <span class="nf">nghttp2_session_terminate_session2</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">int32_t</span> <span class="n">last_stream_id</span><span class="p">,</span> <span class="kt">int32_t</span> <span class="n">last_stream_id</span><span class="p">,</span>
<span class="kt">uint32_t</span> <span class="n">error_code</span><span class="p">);</span> <span class="n">nghttp2_error_code</span> <span class="n">error_code</span><span class="p">);</span>
<span class="cm">/**</span> <span class="cm">/**</span>
<span class="cm"> * @function</span> <span class="cm"> * @function</span>
@ -2567,8 +2436,8 @@
<span class="cm"> * This function returns assigned stream ID if it succeeds. But</span> <span class="cm"> * This function returns assigned stream ID if it succeeds. But</span>
<span class="cm"> * that stream is not opened yet. The application must not submit</span> <span class="cm"> * that stream is not opened yet. The application must not submit</span>
<span class="cm"> * frame to that stream ID before</span> <span class="cm"> * frame to that stream ID before</span>
<span class="cm"> * :type:`nghttp2_before_frame_send_callback` is called for this</span> <span class="cm"> * :member:`nghttp2_session_callbacks.before_frame_send_callback` is</span>
<span class="cm"> * frame.</span> <span class="cm"> * called for this frame.</span>
<span class="cm"> *</span> <span class="cm"> *</span>
<span class="cm"> */</span> <span class="cm"> */</span>
<span class="kt">int32_t</span> <span class="nf">nghttp2_submit_request</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">int32_t</span> <span class="nf">nghttp2_submit_request</span><span class="p">(</span><span class="n">nghttp2_session</span> <span class="o">*</span><span class="n">session</span><span class="p">,</span>
@ -2693,8 +2562,8 @@
<span class="cm"> * This function returns assigned stream ID if it succeeds and</span> <span class="cm"> * This function returns assigned stream ID if it succeeds and</span>
<span class="cm"> * |stream_id| is -1. But that stream is not opened yet. The</span> <span class="cm"> * |stream_id| is -1. But that stream is not opened yet. The</span>
<span class="cm"> * application must not submit frame to that stream ID before</span> <span class="cm"> * application must not submit frame to that stream ID before</span>
<span class="cm"> * :type:`nghttp2_before_frame_send_callback` is called for this</span> <span class="cm"> * :member:`nghttp2_session_callbacks.before_frame_send_callback` is</span>
<span class="cm"> * frame.</span> <span class="cm"> * called for this frame.</span>
<span class="cm"> *</span> <span class="cm"> *</span>
<span class="cm"> */</span> <span class="cm"> */</span>
<span class="kt">int32_t</span> <span class="nf">nghttp2_submit_headers</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="nf">nghttp2_submit_headers</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>
@ -2767,8 +2636,6 @@
<span class="cm"> * Submits RST_STREAM frame to cancel/reject the stream |stream_id|</span> <span class="cm"> * Submits RST_STREAM frame to cancel/reject the stream |stream_id|</span>
<span class="cm"> * with the error code |error_code|.</span> <span class="cm"> * with the error code |error_code|.</span>
<span class="cm"> *</span> <span class="cm"> *</span>
<span class="cm"> * The pre-defined error code is one of :enum:`nghttp2_error_code`.</span>
<span class="cm"> *</span>
<span class="cm"> * The |flags| is currently ignored and should be</span> <span class="cm"> * The |flags| is currently ignored and should be</span>
<span class="cm"> * :enum:`NGHTTP2_FLAG_NONE`.</span> <span class="cm"> * :enum:`NGHTTP2_FLAG_NONE`.</span>
<span class="cm"> *</span> <span class="cm"> *</span>
@ -2782,7 +2649,7 @@
<span class="cm"> */</span> <span class="cm"> */</span>
<span class="kt">int</span> <span class="nf">nghttp2_submit_rst_stream</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">int</span> <span class="nf">nghttp2_submit_rst_stream</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="kt">int32_t</span> <span class="n">stream_id</span><span class="p">,</span>
<span class="kt">uint32_t</span> <span class="n">error_code</span><span class="p">);</span> <span class="n">nghttp2_error_code</span> <span class="n">error_code</span><span class="p">);</span>
<span class="cm">/**</span> <span class="cm">/**</span>
<span class="cm"> * @function</span> <span class="cm"> * @function</span>
@ -2870,8 +2737,8 @@
<span class="cm"> * This function returns assigned promised stream ID if it succeeds.</span> <span class="cm"> * This function returns assigned promised stream ID if it succeeds.</span>
<span class="cm"> * But that stream is not opened yet. The application must not</span> <span class="cm"> * But that stream is not opened yet. The application must not</span>
<span class="cm"> * submit frame to that stream ID before</span> <span class="cm"> * submit frame to that stream ID before</span>
<span class="cm"> * :type:`nghttp2_before_frame_send_callback` is called for this</span> <span class="cm"> * :member:`nghttp2_session_callbacks.before_frame_send_callback` is</span>
<span class="cm"> * frame.</span> <span class="cm"> * called for this frame.</span>
<span class="cm"> *</span> <span class="cm"> *</span>
<span class="cm"> */</span> <span class="cm"> */</span>
<span class="kt">int32_t</span> <span class="nf">nghttp2_submit_push_promise</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="nf">nghttp2_submit_push_promise</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>
@ -2909,8 +2776,6 @@
<span class="cm"> * Submits GOAWAY frame with the last stream ID |last_stream_id| and</span> <span class="cm"> * Submits GOAWAY frame with the last stream ID |last_stream_id| and</span>
<span class="cm"> * the error code |error_code|.</span> <span class="cm"> * the error code |error_code|.</span>
<span class="cm"> *</span> <span class="cm"> *</span>
<span class="cm"> * The pre-defined error code is one of :enum:`nghttp2_error_code`.</span>
<span class="cm"> *</span>
<span class="cm"> * The |flags| is currently ignored and should be</span> <span class="cm"> * The |flags| is currently ignored and should be</span>
<span class="cm"> * :enum:`NGHTTP2_FLAG_NONE`.</span> <span class="cm"> * :enum:`NGHTTP2_FLAG_NONE`.</span>
<span class="cm"> *</span> <span class="cm"> *</span>
@ -2937,7 +2802,7 @@
<span class="cm"> */</span> <span class="cm"> */</span>
<span class="kt">int</span> <span class="nf">nghttp2_submit_goaway</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">int</span> <span class="nf">nghttp2_submit_goaway</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">last_stream_id</span><span class="p">,</span> <span class="kt">int32_t</span> <span class="n">last_stream_id</span><span class="p">,</span>
<span class="kt">uint32_t</span> <span class="n">error_code</span><span class="p">,</span> <span class="n">nghttp2_error_code</span> <span class="n">error_code</span><span class="p">,</span>
<span class="k">const</span> <span class="kt">uint8_t</span> <span class="o">*</span><span class="n">opaque_data</span><span class="p">,</span> <span class="kt">size_t</span> <span class="n">opaque_data_len</span><span class="p">);</span> <span class="k">const</span> <span class="kt">uint8_t</span> <span class="o">*</span><span class="n">opaque_data</span><span class="p">,</span> <span class="kt">size_t</span> <span class="n">opaque_data_len</span><span class="p">);</span>
<span class="cm">/**</span> <span class="cm">/**</span>

Binary file not shown.

View File

@ -280,7 +280,7 @@ required:</p>
<p>To enable SPDY protocol in the application program <tt class="docutils literal"><span class="pre">nghttpx</span></tt> and <p>To enable SPDY protocol in the application program <tt class="docutils literal"><span class="pre">nghttpx</span></tt> and
<tt class="docutils literal"><span class="pre">h2load</span></tt>, the following package is required:</p> <tt class="docutils literal"><span class="pre">h2load</span></tt>, the following package is required:</p>
<ul class="simple"> <ul class="simple">
<li>spdylay &gt;= 1.3.0</li> <li>spdylay &gt;= 1.2.3</li>
</ul> </ul>
<p>To enable <tt class="docutils literal"><span class="pre">-a</span></tt> option (getting linked assets from the downloaded <p>To enable <tt class="docutils literal"><span class="pre">-a</span></tt> option (getting linked assets from the downloaded
resource) in <tt class="docutils literal"><span class="pre">nghttp</span></tt>, the following package is required:</p> resource) in <tt class="docutils literal"><span class="pre">nghttp</span></tt>, the following package is required:</p>

File diff suppressed because one or more lines are too long

View File

@ -342,30 +342,15 @@ finished successfully. We first initialize nghttp2 session object in
<tt class="docutils literal"><span class="pre">initialize_nghttp2_session()</span></tt> function:</p> <tt class="docutils literal"><span class="pre">initialize_nghttp2_session()</span></tt> function:</p>
<div class="highlight-c"><div class="highlight"><pre><span class="k">static</span> <span class="kt">void</span> <span class="nf">initialize_nghttp2_session</span><span class="p">(</span><span class="n">http2_session_data</span> <span class="o">*</span><span class="n">session_data</span><span class="p">)</span> <div class="highlight-c"><div class="highlight"><pre><span class="k">static</span> <span class="kt">void</span> <span class="nf">initialize_nghttp2_session</span><span class="p">(</span><span class="n">http2_session_data</span> <span class="o">*</span><span class="n">session_data</span><span class="p">)</span>
<span class="p">{</span> <span class="p">{</span>
<span class="n">nghttp2_session_callbacks</span> <span class="o">*</span><span class="n">callbacks</span><span class="p">;</span> <span class="n">nghttp2_session_callbacks</span> <span class="n">callbacks</span> <span class="o">=</span> <span class="p">{</span><span class="mi">0</span><span class="p">};</span>
<span class="n">nghttp2_session_callbacks_new</span><span class="p">(</span><span class="o">&amp;</span><span class="n">callbacks</span><span class="p">);</span> <span class="n">callbacks</span><span class="p">.</span><span class="n">send_callback</span> <span class="o">=</span> <span class="n">send_callback</span><span class="p">;</span>
<span class="n">callbacks</span><span class="p">.</span><span class="n">on_frame_recv_callback</span> <span class="o">=</span> <span class="n">on_frame_recv_callback</span><span class="p">;</span>
<span class="n">nghttp2_session_callbacks_set_send_callback</span><span class="p">(</span><span class="n">callbacks</span><span class="p">,</span> <span class="n">send_callback</span><span class="p">);</span> <span class="n">callbacks</span><span class="p">.</span><span class="n">on_data_chunk_recv_callback</span> <span class="o">=</span> <span class="n">on_data_chunk_recv_callback</span><span class="p">;</span>
<span class="n">callbacks</span><span class="p">.</span><span class="n">on_stream_close_callback</span> <span class="o">=</span> <span class="n">on_stream_close_callback</span><span class="p">;</span>
<span class="n">nghttp2_session_callbacks_set_on_frame_recv_callback</span> <span class="n">callbacks</span><span class="p">.</span><span class="n">on_header_callback</span> <span class="o">=</span> <span class="n">on_header_callback</span><span class="p">;</span>
<span class="p">(</span><span class="n">callbacks</span><span class="p">,</span> <span class="n">on_frame_recv_callback</span><span class="p">);</span> <span class="n">callbacks</span><span class="p">.</span><span class="n">on_begin_headers_callback</span> <span class="o">=</span> <span class="n">on_begin_headers_callback</span><span class="p">;</span>
<span class="n">nghttp2_session_client_new</span><span class="p">(</span><span class="o">&amp;</span><span class="n">session_data</span><span class="o">-&gt;</span><span class="n">session</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">callbacks</span><span class="p">,</span> <span class="n">session_data</span><span class="p">);</span>
<span class="n">nghttp2_session_callbacks_set_on_data_chunk_recv_callback</span>
<span class="p">(</span><span class="n">callbacks</span><span class="p">,</span> <span class="n">on_data_chunk_recv_callback</span><span class="p">);</span>
<span class="n">nghttp2_session_callbacks_set_on_stream_close_callback</span>
<span class="p">(</span><span class="n">callbacks</span><span class="p">,</span> <span class="n">on_stream_close_callback</span><span class="p">);</span>
<span class="n">nghttp2_session_callbacks_set_on_header_callback</span>
<span class="p">(</span><span class="n">callbacks</span><span class="p">,</span> <span class="n">on_header_callback</span><span class="p">);</span>
<span class="n">nghttp2_session_callbacks_set_on_begin_headers_callback</span>
<span class="p">(</span><span class="n">callbacks</span><span class="p">,</span> <span class="n">on_begin_headers_callback</span><span class="p">);</span>
<span class="n">nghttp2_session_client_new</span><span class="p">(</span><span class="o">&amp;</span><span class="n">session_data</span><span class="o">-&gt;</span><span class="n">session</span><span class="p">,</span> <span class="n">callbacks</span><span class="p">,</span> <span class="n">session_data</span><span class="p">);</span>
<span class="n">nghttp2_session_callbacks_del</span><span class="p">(</span><span class="n">callbacks</span><span class="p">);</span>
<span class="p">}</span> <span class="p">}</span>
</pre></div> </pre></div>
</div> </div>
@ -489,9 +474,11 @@ frames. The <tt class="docutils literal"><span class="pre">session_send()</span>
</pre></div> </pre></div>
</div> </div>
<p>The <a class="reference internal" href="apiref.html#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 serializes the frame into wire <p>The <a class="reference internal" href="apiref.html#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 serializes the frame into wire
format and call <tt class="docutils literal"><span class="pre">send_callback()</span></tt> function of type format and call <a class="reference internal" href="apiref.html#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> with
<a class="reference internal" href="apiref.html#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>. The <tt class="docutils literal"><span class="pre">send_callback()</span></tt> is defined as it. We set <tt class="docutils literal"><span class="pre">send_callback()</span></tt> function to
follows:</p> <a class="reference internal" href="apiref.html#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> in
<tt class="docutils literal"><span class="pre">initialize_nghttp2_session()</span></tt> function described earlier. It is
defined as follows:</p>
<div class="highlight-c"><div class="highlight"><pre><span class="k">static</span> <span class="kt">ssize_t</span> <span class="nf">send_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> <div class="highlight-c"><div class="highlight"><pre><span class="k">static</span> <span class="kt">ssize_t</span> <span class="nf">send_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="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">length</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">length</span><span class="p">,</span>
<span class="kt">int</span> <span class="n">flags</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="kt">int</span> <span class="n">flags</span><span class="p">,</span> <span class="kt">void</span> <span class="o">*</span><span class="n">user_data</span><span class="p">)</span>
@ -507,14 +494,15 @@ follows:</p>
data to the bufferevent object. Note that <a class="reference internal" href="apiref.html#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> data to the bufferevent object. Note that <a class="reference internal" href="apiref.html#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>
continues to write all frames queued so far. If we were writing the continues to write all frames queued so far. If we were writing the
data to the non-blocking socket directly using <tt class="docutils literal"><span class="pre">write()</span></tt> system call data to the non-blocking socket directly using <tt class="docutils literal"><span class="pre">write()</span></tt> system call
in the <tt class="docutils literal"><span class="pre">send_callback()</span></tt>, we will surely get <tt class="docutils literal"><span class="pre">EAGAIN</span></tt> or in the <a class="reference internal" href="apiref.html#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>, we will
<tt class="docutils literal"><span class="pre">EWOULDBLOCK</span></tt> since the socket has limited send buffer. If that surely get <tt class="docutils literal"><span class="pre">EAGAIN</span></tt> or <tt class="docutils literal"><span class="pre">EWOULDBLOCK</span></tt> since the socket has limited
happens, we can return <a class="reference internal" href="apiref.html#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> to signal the send buffer. If that happens, we can return
nghttp2 library to stop sending further data. But writing to the <a class="reference internal" href="apiref.html#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> to signal the nghttp2 library to stop
bufferevent, we have to regulate the amount data to be buffered by sending further data. But writing to the bufferevent, we have to
ourselves to avoid possible huge memory consumption. In this example regulate the amount data to be buffered by ourselves to avoid possible
client, we do not limit anything. To see how to regulate the amount of huge memory consumption. In this example client, we do not limit
buffered data, see the <tt class="docutils literal"><span class="pre">send_callback()</span></tt> in the server tutorial.</p> anything. To see how to regulate the amount of buffered data, see the
<tt class="docutils literal"><span class="pre">send_callback()</span></tt> in the server tutorial.</p>
<p>The third bufferevent callback is <tt class="docutils literal"><span class="pre">writecb()</span></tt>, which is invoked when <p>The third bufferevent callback is <tt class="docutils literal"><span class="pre">writecb()</span></tt>, which is invoked when
all data written in the bufferevent output buffer have been sent:</p> all data written in the bufferevent output buffer have been sent:</p>
<div class="highlight-c"><div class="highlight"><pre><span class="k">static</span> <span class="kt">void</span> <span class="nf">writecb</span><span class="p">(</span><span class="k">struct</span> <span class="n">bufferevent</span> <span class="o">*</span><span class="n">bev</span><span class="p">,</span> <span class="kt">void</span> <span class="o">*</span><span class="n">ptr</span><span class="p">)</span> <div class="highlight-c"><div class="highlight"><pre><span class="k">static</span> <span class="kt">void</span> <span class="nf">writecb</span><span class="p">(</span><span class="k">struct</span> <span class="n">bufferevent</span> <span class="o">*</span><span class="n">bev</span><span class="p">,</span> <span class="kt">void</span> <span class="o">*</span><span class="n">ptr</span><span class="p">)</span>
@ -973,30 +961,17 @@ here.</p>
<span class="k">static</span> <span class="kt">void</span> <span class="nf">initialize_nghttp2_session</span><span class="p">(</span><span class="n">http2_session_data</span> <span class="o">*</span><span class="n">session_data</span><span class="p">)</span> <span class="k">static</span> <span class="kt">void</span> <span class="nf">initialize_nghttp2_session</span><span class="p">(</span><span class="n">http2_session_data</span> <span class="o">*</span><span class="n">session_data</span><span class="p">)</span>
<span class="p">{</span> <span class="p">{</span>
<span class="n">nghttp2_session_callbacks</span> <span class="o">*</span><span class="n">callbacks</span><span class="p">;</span> <span class="n">nghttp2_session_callbacks</span> <span class="n">callbacks</span><span class="p">;</span>
<span class="n">nghttp2_session_callbacks_new</span><span class="p">(</span><span class="o">&amp;</span><span class="n">callbacks</span><span class="p">);</span> <span class="n">memset</span><span class="p">(</span><span class="o">&amp;</span><span class="n">callbacks</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="k">sizeof</span><span class="p">(</span><span class="n">callbacks</span><span class="p">));</span>
<span class="n">nghttp2_session_callbacks_set_send_callback</span><span class="p">(</span><span class="n">callbacks</span><span class="p">,</span> <span class="n">send_callback</span><span class="p">);</span> <span class="n">callbacks</span><span class="p">.</span><span class="n">send_callback</span> <span class="o">=</span> <span class="n">send_callback</span><span class="p">;</span>
<span class="n">callbacks</span><span class="p">.</span><span class="n">on_frame_recv_callback</span> <span class="o">=</span> <span class="n">on_frame_recv_callback</span><span class="p">;</span>
<span class="n">nghttp2_session_callbacks_set_on_frame_recv_callback</span> <span class="n">callbacks</span><span class="p">.</span><span class="n">on_data_chunk_recv_callback</span> <span class="o">=</span> <span class="n">on_data_chunk_recv_callback</span><span class="p">;</span>
<span class="p">(</span><span class="n">callbacks</span><span class="p">,</span> <span class="n">on_frame_recv_callback</span><span class="p">);</span> <span class="n">callbacks</span><span class="p">.</span><span class="n">on_stream_close_callback</span> <span class="o">=</span> <span class="n">on_stream_close_callback</span><span class="p">;</span>
<span class="n">callbacks</span><span class="p">.</span><span class="n">on_header_callback</span> <span class="o">=</span> <span class="n">on_header_callback</span><span class="p">;</span>
<span class="n">nghttp2_session_callbacks_set_on_data_chunk_recv_callback</span> <span class="n">callbacks</span><span class="p">.</span><span class="n">on_begin_headers_callback</span> <span class="o">=</span> <span class="n">on_begin_headers_callback</span><span class="p">;</span>
<span class="p">(</span><span class="n">callbacks</span><span class="p">,</span> <span class="n">on_data_chunk_recv_callback</span><span class="p">);</span> <span class="n">nghttp2_session_client_new</span><span class="p">(</span><span class="o">&amp;</span><span class="n">session_data</span><span class="o">-&gt;</span><span class="n">session</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">callbacks</span><span class="p">,</span> <span class="n">session_data</span><span class="p">);</span>
<span class="n">nghttp2_session_callbacks_set_on_stream_close_callback</span>
<span class="p">(</span><span class="n">callbacks</span><span class="p">,</span> <span class="n">on_stream_close_callback</span><span class="p">);</span>
<span class="n">nghttp2_session_callbacks_set_on_header_callback</span>
<span class="p">(</span><span class="n">callbacks</span><span class="p">,</span> <span class="n">on_header_callback</span><span class="p">);</span>
<span class="n">nghttp2_session_callbacks_set_on_begin_headers_callback</span>
<span class="p">(</span><span class="n">callbacks</span><span class="p">,</span> <span class="n">on_begin_headers_callback</span><span class="p">);</span>
<span class="n">nghttp2_session_client_new</span><span class="p">(</span><span class="o">&amp;</span><span class="n">session_data</span><span class="o">-&gt;</span><span class="n">session</span><span class="p">,</span> <span class="n">callbacks</span><span class="p">,</span> <span class="n">session_data</span><span class="p">);</span>
<span class="n">nghttp2_session_callbacks_del</span><span class="p">(</span><span class="n">callbacks</span><span class="p">);</span>
<span class="p">}</span> <span class="p">}</span>
<span class="k">static</span> <span class="kt">void</span> <span class="nf">send_client_connection_header</span><span class="p">(</span><span class="n">http2_session_data</span> <span class="o">*</span><span class="n">session_data</span><span class="p">)</span> <span class="k">static</span> <span class="kt">void</span> <span class="nf">send_client_connection_header</span><span class="p">(</span><span class="n">http2_session_data</span> <span class="o">*</span><span class="n">session_data</span><span class="p">)</span>

View File

@ -412,27 +412,14 @@ HTTP/2 communication. These two functions are described later.</p>
<tt class="docutils literal"><span class="pre">initialize_nghttp2_session()</span></tt>:</p> <tt class="docutils literal"><span class="pre">initialize_nghttp2_session()</span></tt>:</p>
<div class="highlight-c"><div class="highlight"><pre><span class="k">static</span> <span class="kt">void</span> <span class="nf">initialize_nghttp2_session</span><span class="p">(</span><span class="n">http2_session_data</span> <span class="o">*</span><span class="n">session_data</span><span class="p">)</span> <div class="highlight-c"><div class="highlight"><pre><span class="k">static</span> <span class="kt">void</span> <span class="nf">initialize_nghttp2_session</span><span class="p">(</span><span class="n">http2_session_data</span> <span class="o">*</span><span class="n">session_data</span><span class="p">)</span>
<span class="p">{</span> <span class="p">{</span>
<span class="n">nghttp2_session_callbacks</span> <span class="o">*</span><span class="n">callbacks</span><span class="p">;</span> <span class="n">nghttp2_session_callbacks</span> <span class="n">callbacks</span> <span class="o">=</span> <span class="p">{</span><span class="mi">0</span><span class="p">};</span>
<span class="n">nghttp2_session_callbacks_new</span><span class="p">(</span><span class="o">&amp;</span><span class="n">callbacks</span><span class="p">);</span> <span class="n">callbacks</span><span class="p">.</span><span class="n">send_callback</span> <span class="o">=</span> <span class="n">send_callback</span><span class="p">;</span>
<span class="n">callbacks</span><span class="p">.</span><span class="n">on_frame_recv_callback</span> <span class="o">=</span> <span class="n">on_frame_recv_callback</span><span class="p">;</span>
<span class="n">nghttp2_session_callbacks_set_send_callback</span><span class="p">(</span><span class="n">callbacks</span><span class="p">,</span> <span class="n">send_callback</span><span class="p">);</span> <span class="n">callbacks</span><span class="p">.</span><span class="n">on_stream_close_callback</span> <span class="o">=</span> <span class="n">on_stream_close_callback</span><span class="p">;</span>
<span class="n">callbacks</span><span class="p">.</span><span class="n">on_header_callback</span> <span class="o">=</span> <span class="n">on_header_callback</span><span class="p">;</span>
<span class="n">nghttp2_session_callbacks_set_on_frame_recv_callback</span> <span class="n">callbacks</span><span class="p">.</span><span class="n">on_begin_headers_callback</span> <span class="o">=</span> <span class="n">on_begin_headers_callback</span><span class="p">;</span>
<span class="p">(</span><span class="n">callbacks</span><span class="p">,</span> <span class="n">on_frame_recv_callback</span><span class="p">);</span> <span class="n">nghttp2_session_server_new</span><span class="p">(</span><span class="o">&amp;</span><span class="n">session_data</span><span class="o">-&gt;</span><span class="n">session</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">callbacks</span><span class="p">,</span> <span class="n">session_data</span><span class="p">);</span>
<span class="n">nghttp2_session_callbacks_set_on_stream_close_callback</span>
<span class="p">(</span><span class="n">callbacks</span><span class="p">,</span> <span class="n">on_stream_close_callback</span><span class="p">);</span>
<span class="n">nghttp2_session_callbacks_set_on_header_callback</span>
<span class="p">(</span><span class="n">callbacks</span><span class="p">,</span> <span class="n">on_header_callback</span><span class="p">);</span>
<span class="n">nghttp2_session_callbacks_set_on_begin_headers_callback</span>
<span class="p">(</span><span class="n">callbacks</span><span class="p">,</span> <span class="n">on_begin_headers_callback</span><span class="p">);</span>
<span class="n">nghttp2_session_server_new</span><span class="p">(</span><span class="o">&amp;</span><span class="n">session_data</span><span class="o">-&gt;</span><span class="n">session</span><span class="p">,</span> <span class="n">callbacks</span><span class="p">,</span> <span class="n">session_data</span><span class="p">);</span>
<span class="n">nghttp2_session_callbacks_del</span><span class="p">(</span><span class="n">callbacks</span><span class="p">);</span>
<span class="p">}</span> <span class="p">}</span>
</pre></div> </pre></div>
</div> </div>
@ -512,9 +499,11 @@ frames. The <tt class="docutils literal"><span class="pre">session_send()</span>
</pre></div> </pre></div>
</div> </div>
<p>The <a class="reference internal" href="apiref.html#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 serializes the frame into wire <p>The <a class="reference internal" href="apiref.html#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 serializes the frame into wire
format and calls <tt class="docutils literal"><span class="pre">send_callback()</span></tt> of type format and calls <a class="reference internal" href="apiref.html#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> with
<a class="reference internal" href="apiref.html#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>. The <tt class="docutils literal"><span class="pre">send_callback()</span></tt> is defined as it. We set the <tt class="docutils literal"><span class="pre">send_callback()</span></tt> function to
follows:</p> <a class="reference internal" href="apiref.html#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> in
<tt class="docutils literal"><span class="pre">initialize_nghttp2_session()</span></tt> function described earlier. It is
defined as follows:</p>
<div class="highlight-c"><div class="highlight"><pre><span class="k">static</span> <span class="kt">ssize_t</span> <span class="nf">send_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> <div class="highlight-c"><div class="highlight"><pre><span class="k">static</span> <span class="kt">ssize_t</span> <span class="nf">send_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="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">length</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">length</span><span class="p">,</span>
<span class="kt">int</span> <span class="n">flags</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="kt">int</span> <span class="n">flags</span><span class="p">,</span> <span class="kt">void</span> <span class="o">*</span><span class="n">user_data</span><span class="p">)</span>
@ -531,20 +520,20 @@ follows:</p>
<span class="p">}</span> <span class="p">}</span>
</pre></div> </pre></div>
</div> </div>
<p>Since we use bufferevent to abstract network I/O, we just write the <p>Since we use bufferevent to abstract network I/O, we just write the data to
data to the bufferevent object. Note that <a class="reference internal" href="apiref.html#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> the bufferevent object. Note that <a class="reference internal" href="apiref.html#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> continues to write
continues to write all frames queued so far. If we were writing the all frames queued so far. If we were writing the data to a non-blocking socket
data to a non-blocking socket directly using <tt class="docutils literal"><span class="pre">write()</span></tt> system call directly using <tt class="docutils literal"><span class="pre">write()</span></tt> system call in the
in the <tt class="docutils literal"><span class="pre">send_callback()</span></tt>, we would surely get <tt class="docutils literal"><span class="pre">EAGAIN</span></tt> or <a class="reference internal" href="apiref.html#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>, we would surely get
<tt class="docutils literal"><span class="pre">EWOULDBLOCK</span></tt> back since the socket has limited send buffer. If that <tt class="docutils literal"><span class="pre">EAGAIN</span></tt> or <tt class="docutils literal"><span class="pre">EWOULDBLOCK</span></tt> back since the socket has limited send
happens, we can return <a class="reference internal" href="apiref.html#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> to signal the buffer. If that happens, we can return <a class="reference internal" href="apiref.html#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> to
nghttp2 library to stop sending further data. But when writing to the signal the nghttp2 library to stop sending further data. But when writing to
bufferevent, we have to regulate the amount data to get buffered the bufferevent, we have to regulate the amount data to get buffered ourselves
ourselves to avoid using huge amounts of memory. To achieve this, we to avoid using huge amounts of memory. To achieve this, we check the size of
check the size of the output buffer and if it reaches more than or the output buffer and if it reaches more than or equal to
equal to <tt class="docutils literal"><span class="pre">OUTPUT_WOULDBLOCK_THRESHOLD</span></tt> bytes, we stop writing data <tt class="docutils literal"><span class="pre">OUTPUT_WOULDBLOCK_THRESHOLD</span></tt> bytes, we stop writing data and return
and return <a class="reference internal" href="apiref.html#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> to tell the library to stop <a class="reference internal" href="apiref.html#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> to tell the library to stop calling
calling send_callback.</p> send_callback.</p>
<p>The next bufferevent callback is <tt class="docutils literal"><span class="pre">readcb()</span></tt>, which is invoked when <p>The next bufferevent callback is <tt class="docutils literal"><span class="pre">readcb()</span></tt>, which is invoked when
data is available to read in the bufferevent input buffer:</p> data is available to read in the bufferevent input buffer:</p>
<div class="highlight-c"><div class="highlight"><pre><span class="k">static</span> <span class="kt">void</span> <span class="nf">readcb</span><span class="p">(</span><span class="k">struct</span> <span class="n">bufferevent</span> <span class="o">*</span><span class="n">bev</span><span class="p">,</span> <span class="kt">void</span> <span class="o">*</span><span class="n">ptr</span><span class="p">)</span> <div class="highlight-c"><div class="highlight"><pre><span class="k">static</span> <span class="kt">void</span> <span class="nf">readcb</span><span class="p">(</span><span class="k">struct</span> <span class="n">bufferevent</span> <span class="o">*</span><span class="n">bev</span><span class="p">,</span> <span class="kt">void</span> <span class="o">*</span><span class="n">ptr</span><span class="p">)</span>
@ -1326,27 +1315,16 @@ is about to close and we no longer use that object.</p>
<span class="k">static</span> <span class="kt">void</span> <span class="nf">initialize_nghttp2_session</span><span class="p">(</span><span class="n">http2_session_data</span> <span class="o">*</span><span class="n">session_data</span><span class="p">)</span> <span class="k">static</span> <span class="kt">void</span> <span class="nf">initialize_nghttp2_session</span><span class="p">(</span><span class="n">http2_session_data</span> <span class="o">*</span><span class="n">session_data</span><span class="p">)</span>
<span class="p">{</span> <span class="p">{</span>
<span class="n">nghttp2_session_callbacks</span> <span class="o">*</span><span class="n">callbacks</span><span class="p">;</span> <span class="n">nghttp2_session_callbacks</span> <span class="n">callbacks</span><span class="p">;</span>
<span class="n">nghttp2_session_callbacks_new</span><span class="p">(</span><span class="o">&amp;</span><span class="n">callbacks</span><span class="p">);</span> <span class="n">memset</span><span class="p">(</span><span class="o">&amp;</span><span class="n">callbacks</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="k">sizeof</span><span class="p">(</span><span class="n">callbacks</span><span class="p">));</span>
<span class="n">nghttp2_session_callbacks_set_send_callback</span><span class="p">(</span><span class="n">callbacks</span><span class="p">,</span> <span class="n">send_callback</span><span class="p">);</span> <span class="n">callbacks</span><span class="p">.</span><span class="n">send_callback</span> <span class="o">=</span> <span class="n">send_callback</span><span class="p">;</span>
<span class="n">callbacks</span><span class="p">.</span><span class="n">on_frame_recv_callback</span> <span class="o">=</span> <span class="n">on_frame_recv_callback</span><span class="p">;</span>
<span class="n">nghttp2_session_callbacks_set_on_frame_recv_callback</span> <span class="n">callbacks</span><span class="p">.</span><span class="n">on_stream_close_callback</span> <span class="o">=</span> <span class="n">on_stream_close_callback</span><span class="p">;</span>
<span class="p">(</span><span class="n">callbacks</span><span class="p">,</span> <span class="n">on_frame_recv_callback</span><span class="p">);</span> <span class="n">callbacks</span><span class="p">.</span><span class="n">on_header_callback</span> <span class="o">=</span> <span class="n">on_header_callback</span><span class="p">;</span>
<span class="n">callbacks</span><span class="p">.</span><span class="n">on_begin_headers_callback</span> <span class="o">=</span> <span class="n">on_begin_headers_callback</span><span class="p">;</span>
<span class="n">nghttp2_session_callbacks_set_on_stream_close_callback</span> <span class="n">nghttp2_session_server_new</span><span class="p">(</span><span class="o">&amp;</span><span class="n">session_data</span><span class="o">-&gt;</span><span class="n">session</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">callbacks</span><span class="p">,</span> <span class="n">session_data</span><span class="p">);</span>
<span class="p">(</span><span class="n">callbacks</span><span class="p">,</span> <span class="n">on_stream_close_callback</span><span class="p">);</span>
<span class="n">nghttp2_session_callbacks_set_on_header_callback</span>
<span class="p">(</span><span class="n">callbacks</span><span class="p">,</span> <span class="n">on_header_callback</span><span class="p">);</span>
<span class="n">nghttp2_session_callbacks_set_on_begin_headers_callback</span>
<span class="p">(</span><span class="n">callbacks</span><span class="p">,</span> <span class="n">on_begin_headers_callback</span><span class="p">);</span>
<span class="n">nghttp2_session_server_new</span><span class="p">(</span><span class="o">&amp;</span><span class="n">session_data</span><span class="o">-&gt;</span><span class="n">session</span><span class="p">,</span> <span class="n">callbacks</span><span class="p">,</span> <span class="n">session_data</span><span class="p">);</span>
<span class="n">nghttp2_session_callbacks_del</span><span class="p">(</span><span class="n">callbacks</span><span class="p">);</span>
<span class="p">}</span> <span class="p">}</span>
<span class="cm">/* Send HTTP/2 client connection header, which includes 24 bytes</span> <span class="cm">/* Send HTTP/2 client connection header, which includes 24 bytes</span>