parent
df29078129
commit
4368c03d80
440
apiref.html
440
apiref.html
|
@ -1274,7 +1274,7 @@ size_t <tt class="descname">nvlen</tt><a class="headerlink" href="#c.nghttp2_hea
|
|||
|
||||
<dl class="member">
|
||||
<dt id="c.nghttp2_rst_stream.error_code">
|
||||
uint32_t <tt class="descname">error_code</tt><a class="headerlink" href="#c.nghttp2_rst_stream.error_code" title="Permalink to this definition">¶</a></dt>
|
||||
<a class="reference internal" href="#c.nghttp2_error_code" title="nghttp2_error_code">nghttp2_error_code</a> <tt class="descname">error_code</tt><a class="headerlink" href="#c.nghttp2_rst_stream.error_code" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>The error code. See <a class="reference internal" href="#c.nghttp2_error_code" title="nghttp2_error_code"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_error_code</span></tt></a>.</p>
|
||||
</dd></dl>
|
||||
|
||||
|
@ -1395,7 +1395,7 @@ int32_t <tt class="descname">last_stream_id</tt><a class="headerlink" href="#c.n
|
|||
|
||||
<dl class="member">
|
||||
<dt id="c.nghttp2_goaway.error_code">
|
||||
uint32_t <tt class="descname">error_code</tt><a class="headerlink" href="#c.nghttp2_goaway.error_code" title="Permalink to this definition">¶</a></dt>
|
||||
<a class="reference internal" href="#c.nghttp2_error_code" title="nghttp2_error_code">nghttp2_error_code</a> <tt class="descname">error_code</tt><a class="headerlink" href="#c.nghttp2_goaway.error_code" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>The error code. See <a class="reference internal" href="#c.nghttp2_error_code" title="nghttp2_error_code"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_error_code</span></tt></a>.</p>
|
||||
</dd></dl>
|
||||
|
||||
|
@ -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
|
||||
the application uses solely <a class="reference internal" href="#c.nghttp2_session_mem_send" title="nghttp2_session_mem_send"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_mem_send()</span></tt></a> instead,
|
||||
this callback function is unnecessary.</p>
|
||||
<p>To set this callback to <a class="reference internal" href="#c.nghttp2_session_callbacks" title="nghttp2_session_callbacks"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_session_callbacks</span></tt></a>, use
|
||||
<a class="reference internal" href="#c.nghttp2_session_callbacks_set_send_callback" title="nghttp2_session_callbacks_set_send_callback"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_callbacks_set_send_callback()</span></tt></a>.</p>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="type">
|
||||
|
@ -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.
|
||||
If the application uses solely <a class="reference internal" href="#c.nghttp2_session_mem_recv" title="nghttp2_session_mem_recv"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_mem_recv()</span></tt></a>
|
||||
instead, this callback function is unnecessary.</p>
|
||||
<p>To set this callback to <a class="reference internal" href="#c.nghttp2_session_callbacks" title="nghttp2_session_callbacks"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_session_callbacks</span></tt></a>, use
|
||||
<a class="reference internal" href="#c.nghttp2_session_callbacks_set_recv_callback" title="nghttp2_session_callbacks_set_recv_callback"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_callbacks_set_recv_callback()</span></tt></a>.</p>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="type">
|
||||
|
@ -1646,21 +1642,18 @@ If <tt class="docutils literal"><span class="pre">frame->hd.flags</span> <spa
|
|||
If nonzero value is returned, it is treated as fatal error and
|
||||
<a class="reference internal" href="#c.nghttp2_session_recv" title="nghttp2_session_recv"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_recv()</span></tt></a> and <a class="reference internal" href="#c.nghttp2_session_mem_recv" title="nghttp2_session_mem_recv"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_mem_recv()</span></tt></a> functions
|
||||
immediately return <a class="reference internal" href="#c.NGHTTP2_ERR_CALLBACK_FAILURE" title="NGHTTP2_ERR_CALLBACK_FAILURE"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_ERR_CALLBACK_FAILURE</span></tt></a>.</p>
|
||||
<p>To set this callback to <a class="reference internal" href="#c.nghttp2_session_callbacks" title="nghttp2_session_callbacks"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_session_callbacks</span></tt></a>, use
|
||||
<a class="reference internal" href="#c.nghttp2_session_callbacks_set_on_frame_recv_callback" title="nghttp2_session_callbacks_set_on_frame_recv_callback"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_callbacks_set_on_frame_recv_callback()</span></tt></a>.</p>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="type">
|
||||
<dt id="c.nghttp2_on_invalid_frame_recv_callback">
|
||||
typedef int <tt class="descname">(*nghttp2_on_invalid_frame_recv_callback)</tt><big>(</big><a class="reference internal" href="#c.nghttp2_session" title="nghttp2_session">nghttp2_session</a><em> *session</em>, const <a class="reference internal" href="#c.nghttp2_frame" title="nghttp2_frame">nghttp2_frame</a><em> *frame</em>, uint32_t<em> error_code</em>, void<em> *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> *session</em>, const <a class="reference internal" href="#c.nghttp2_frame" title="nghttp2_frame">nghttp2_frame</a><em> *frame</em>, <a class="reference internal" href="#c.nghttp2_error_code" title="nghttp2_error_code">nghttp2_error_code</a><em> error_code</em>, void<em> *user_data</em><big>)</big><a class="headerlink" href="#c.nghttp2_on_invalid_frame_recv_callback" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Callback function invoked by <a class="reference internal" href="#c.nghttp2_session_recv" title="nghttp2_session_recv"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_recv()</span></tt></a> when an
|
||||
invalid non-DATA frame is received. The <em>error_code</em> indicates the
|
||||
error. It is usually one of the <a class="reference internal" href="#c.nghttp2_error_code" title="nghttp2_error_code"><tt class="xref c c-macro docutils literal"><span class="pre">nghttp2_error_code</span></tt></a> but
|
||||
that is not guaranteed. When this callback function is invoked,
|
||||
the library automatically submits either RST_STREAM or GOAWAY
|
||||
frame. The <em>user_data</em> pointer is the third argument passed in to
|
||||
the call to <a class="reference internal" href="#c.nghttp2_session_client_new" title="nghttp2_session_client_new"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_client_new()</span></tt></a> or
|
||||
<a class="reference internal" href="#c.nghttp2_session_server_new" title="nghttp2_session_server_new"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_server_new()</span></tt></a>.</p>
|
||||
invalid non-DATA frame is received. The <em>error_code</em> is one of the
|
||||
<a class="reference internal" href="#c.nghttp2_error_code" title="nghttp2_error_code"><tt class="xref c c-macro docutils literal"><span class="pre">nghttp2_error_code</span></tt></a> and indicates the error. When this
|
||||
callback function is invoked, the library automatically submits
|
||||
either RST_STREAM or GOAWAY frame. The <em>user_data</em> pointer is the
|
||||
third argument passed in to the call to
|
||||
<a class="reference internal" href="#c.nghttp2_session_client_new" title="nghttp2_session_client_new"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_client_new()</span></tt></a> or <a class="reference internal" href="#c.nghttp2_session_server_new" title="nghttp2_session_server_new"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_server_new()</span></tt></a>.</p>
|
||||
<p>If frame is HEADERS or PUSH_PROMISE, the <tt class="docutils literal"><span class="pre">nva</span></tt> and <tt class="docutils literal"><span class="pre">nvlen</span></tt>
|
||||
member of their data structure are always <tt class="docutils literal"><span class="pre">NULL</span></tt> and 0
|
||||
respectively.</p>
|
||||
|
@ -1668,8 +1661,6 @@ respectively.</p>
|
|||
If nonzero is returned, it is treated as fatal error and
|
||||
<a class="reference internal" href="#c.nghttp2_session_recv" title="nghttp2_session_recv"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_recv()</span></tt></a> and <a class="reference internal" href="#c.nghttp2_session_send" title="nghttp2_session_send"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_send()</span></tt></a> functions
|
||||
immediately return <a class="reference internal" href="#c.NGHTTP2_ERR_CALLBACK_FAILURE" title="NGHTTP2_ERR_CALLBACK_FAILURE"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_ERR_CALLBACK_FAILURE</span></tt></a>.</p>
|
||||
<p>To set this callback to <a class="reference internal" href="#c.nghttp2_session_callbacks" title="nghttp2_session_callbacks"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_session_callbacks</span></tt></a>, use
|
||||
<a class="reference internal" href="#c.nghttp2_session_callbacks_set_on_invalid_frame_recv_callback" title="nghttp2_session_callbacks_set_on_invalid_frame_recv_callback"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_callbacks_set_on_invalid_frame_recv_callback()</span></tt></a>.</p>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="type">
|
||||
|
@ -1696,8 +1687,6 @@ region included in the input bytes.</p>
|
|||
If nonzero is returned, it is treated as fatal error and
|
||||
<a class="reference internal" href="#c.nghttp2_session_recv" title="nghttp2_session_recv"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_recv()</span></tt></a> and <a class="reference internal" href="#c.nghttp2_session_mem_recv" title="nghttp2_session_mem_recv"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_mem_recv()</span></tt></a> functions
|
||||
immediately return <a class="reference internal" href="#c.NGHTTP2_ERR_CALLBACK_FAILURE" title="NGHTTP2_ERR_CALLBACK_FAILURE"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_ERR_CALLBACK_FAILURE</span></tt></a>.</p>
|
||||
<p>To set this callback to <a class="reference internal" href="#c.nghttp2_session_callbacks" title="nghttp2_session_callbacks"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_session_callbacks</span></tt></a>, use
|
||||
<a class="reference internal" href="#c.nghttp2_session_callbacks_set_on_data_chunk_recv_callback" title="nghttp2_session_callbacks_set_on_data_chunk_recv_callback"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_callbacks_set_on_data_chunk_recv_callback()</span></tt></a>.</p>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="type">
|
||||
|
@ -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
|
||||
<a class="reference internal" href="#c.nghttp2_session_recv" title="nghttp2_session_recv"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_recv()</span></tt></a> and <a class="reference internal" href="#c.nghttp2_session_send" title="nghttp2_session_send"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_send()</span></tt></a> functions
|
||||
immediately return <a class="reference internal" href="#c.NGHTTP2_ERR_CALLBACK_FAILURE" title="NGHTTP2_ERR_CALLBACK_FAILURE"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_ERR_CALLBACK_FAILURE</span></tt></a>.</p>
|
||||
<p>To set this callback to <a class="reference internal" href="#c.nghttp2_session_callbacks" title="nghttp2_session_callbacks"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_session_callbacks</span></tt></a>, use
|
||||
<a class="reference internal" href="#c.nghttp2_session_callbacks_set_before_frame_send_callback" title="nghttp2_session_callbacks_set_before_frame_send_callback"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_callbacks_set_before_frame_send_callback()</span></tt></a>.</p>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="type">
|
||||
|
@ -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
|
||||
<a class="reference internal" href="#c.nghttp2_session_recv" title="nghttp2_session_recv"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_recv()</span></tt></a> and <a class="reference internal" href="#c.nghttp2_session_send" title="nghttp2_session_send"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_send()</span></tt></a> functions
|
||||
immediately return <a class="reference internal" href="#c.NGHTTP2_ERR_CALLBACK_FAILURE" title="NGHTTP2_ERR_CALLBACK_FAILURE"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_ERR_CALLBACK_FAILURE</span></tt></a>.</p>
|
||||
<p>To set this callback to <a class="reference internal" href="#c.nghttp2_session_callbacks" title="nghttp2_session_callbacks"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_session_callbacks</span></tt></a>, use
|
||||
<a class="reference internal" href="#c.nghttp2_session_callbacks_set_on_frame_send_callback" title="nghttp2_session_callbacks_set_on_frame_send_callback"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_callbacks_set_on_frame_send_callback()</span></tt></a>.</p>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="type">
|
||||
|
@ -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
|
||||
<a class="reference internal" href="#c.nghttp2_session_recv" title="nghttp2_session_recv"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_recv()</span></tt></a> and <a class="reference internal" href="#c.nghttp2_session_send" title="nghttp2_session_send"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_send()</span></tt></a> functions
|
||||
immediately return <a class="reference internal" href="#c.NGHTTP2_ERR_CALLBACK_FAILURE" title="NGHTTP2_ERR_CALLBACK_FAILURE"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_ERR_CALLBACK_FAILURE</span></tt></a>.</p>
|
||||
<p>To set this callback to <a class="reference internal" href="#c.nghttp2_session_callbacks" title="nghttp2_session_callbacks"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_session_callbacks</span></tt></a>, use
|
||||
<a class="reference internal" href="#c.nghttp2_session_callbacks_set_on_frame_not_send_callback" title="nghttp2_session_callbacks_set_on_frame_not_send_callback"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_callbacks_set_on_frame_not_send_callback()</span></tt></a>.</p>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="type">
|
||||
<dt id="c.nghttp2_on_stream_close_callback">
|
||||
typedef int <tt class="descname">(*nghttp2_on_stream_close_callback)</tt><big>(</big><a class="reference internal" href="#c.nghttp2_session" title="nghttp2_session">nghttp2_session</a><em> *session</em>, int32_t<em> stream_id</em>, uint32_t<em> error_code</em>, void<em> *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> *session</em>, int32_t<em> stream_id</em>, <a class="reference internal" href="#c.nghttp2_error_code" title="nghttp2_error_code">nghttp2_error_code</a><em> error_code</em>, void<em> *user_data</em><big>)</big><a class="headerlink" href="#c.nghttp2_on_stream_close_callback" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Callback function invoked when the stream <em>stream_id</em> is closed.
|
||||
The reason of closure is indicated by the <em>error_code</em>. The
|
||||
<em>error_code</em> is usually one of <a class="reference internal" href="#c.nghttp2_error_code" title="nghttp2_error_code"><tt class="xref c c-macro docutils literal"><span class="pre">nghttp2_error_code</span></tt></a>, but that
|
||||
is not guaranteed. The stream_user_data, which was specified in
|
||||
<a class="reference internal" href="#c.nghttp2_submit_request" title="nghttp2_submit_request"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_submit_request()</span></tt></a> or <a class="reference internal" href="#c.nghttp2_submit_headers" title="nghttp2_submit_headers"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_submit_headers()</span></tt></a>, is still
|
||||
available in this function. The <em>user_data</em> pointer is the third
|
||||
argument passed in to the call to <a class="reference internal" href="#c.nghttp2_session_client_new" title="nghttp2_session_client_new"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_client_new()</span></tt></a> or
|
||||
stream_user_data, which was specified in <a class="reference internal" href="#c.nghttp2_submit_request" title="nghttp2_submit_request"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_submit_request()</span></tt></a>
|
||||
or <a class="reference internal" href="#c.nghttp2_submit_headers" title="nghttp2_submit_headers"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_submit_headers()</span></tt></a>, is still available in this function.
|
||||
The <em>user_data</em> pointer is the third argument passed in to the call
|
||||
to <a class="reference internal" href="#c.nghttp2_session_client_new" title="nghttp2_session_client_new"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_client_new()</span></tt></a> or
|
||||
<a class="reference internal" href="#c.nghttp2_session_server_new" title="nghttp2_session_server_new"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_server_new()</span></tt></a>.</p>
|
||||
<p>This function is also called for a stream in reserved state.</p>
|
||||
<p>The implementation of this function must return 0 if it succeeds.
|
||||
If nonzero is returned, it is treated as fatal error and
|
||||
<a class="reference internal" href="#c.nghttp2_session_recv" title="nghttp2_session_recv"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_recv()</span></tt></a> and <a class="reference internal" href="#c.nghttp2_session_send" title="nghttp2_session_send"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_send()</span></tt></a> functions
|
||||
immediately return <a class="reference internal" href="#c.NGHTTP2_ERR_CALLBACK_FAILURE" title="NGHTTP2_ERR_CALLBACK_FAILURE"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_ERR_CALLBACK_FAILURE</span></tt></a>.</p>
|
||||
<p>To set this callback to <a class="reference internal" href="#c.nghttp2_session_callbacks" title="nghttp2_session_callbacks"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_session_callbacks</span></tt></a>, use
|
||||
<a class="reference internal" href="#c.nghttp2_session_callbacks_set_on_stream_close_callback" title="nghttp2_session_callbacks_set_on_stream_close_callback"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_callbacks_set_on_stream_close_callback()</span></tt></a>.</p>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="type">
|
||||
<dt id="c.nghttp2_on_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> *session</em>, const uint8_t<em> *head</em>, size_t<em> headlen</em>, const uint8_t<em> *payload</em>, size_t<em> payloadlen</em>, void<em> *user_data</em><big>)</big><a class="headerlink" href="#c.nghttp2_on_unknown_frame_recv_callback" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Callback function invoked when the received frame type is unknown.
|
||||
The <em>head</em> is the pointer to the header of the received frame. The
|
||||
<em>headlen</em> is the length of the <em>head</em>. According to the spec, the
|
||||
<em>headlen</em> is always 8. In other words, the <em>head</em> is the first 8
|
||||
bytes of the received frame. The <em>payload</em> is the pointer to the
|
||||
data portion of the received frame. The <em>payloadlen</em> is the length
|
||||
of the <em>payload</em>. This is the data after the length field. The
|
||||
<em>user_data</em> pointer is the third argument passed in to the call to
|
||||
<a class="reference internal" href="#c.nghttp2_session_client_new" title="nghttp2_session_client_new"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_client_new()</span></tt></a> or <a class="reference internal" href="#c.nghttp2_session_server_new" title="nghttp2_session_server_new"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_server_new()</span></tt></a>.</p>
|
||||
<p>The implementation of this function must return 0 if it succeeds.
|
||||
If nonzero is returned, it is treated as fatal error and
|
||||
<a class="reference internal" href="#c.nghttp2_session_recv" title="nghttp2_session_recv"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_recv()</span></tt></a> and <a class="reference internal" href="#c.nghttp2_session_send" title="nghttp2_session_send"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_send()</span></tt></a> functions
|
||||
immediately return <a class="reference internal" href="#c.NGHTTP2_ERR_CALLBACK_FAILURE" title="NGHTTP2_ERR_CALLBACK_FAILURE"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_ERR_CALLBACK_FAILURE</span></tt></a>.</p>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="type">
|
||||
|
@ -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_session_mem_recv" title="nghttp2_session_mem_recv"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_mem_recv()</span></tt></a> function will immediately return
|
||||
<a class="reference internal" href="#c.NGHTTP2_ERR_CALLBACK_FAILURE" title="NGHTTP2_ERR_CALLBACK_FAILURE"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_ERR_CALLBACK_FAILURE</span></tt></a>.</p>
|
||||
<p>To set this callback to <a class="reference internal" href="#c.nghttp2_session_callbacks" title="nghttp2_session_callbacks"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_session_callbacks</span></tt></a>, use
|
||||
<a class="reference internal" href="#c.nghttp2_session_callbacks_set_on_begin_headers_callback" title="nghttp2_session_callbacks_set_on_begin_headers_callback"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_callbacks_set_on_begin_headers_callback()</span></tt></a>.</p>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="type">
|
||||
|
@ -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_session_recv" title="nghttp2_session_recv"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_recv()</span></tt></a> and <a class="reference internal" href="#c.nghttp2_session_mem_recv" title="nghttp2_session_mem_recv"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_mem_recv()</span></tt></a> functions
|
||||
immediately return <a class="reference internal" href="#c.NGHTTP2_ERR_CALLBACK_FAILURE" title="NGHTTP2_ERR_CALLBACK_FAILURE"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_ERR_CALLBACK_FAILURE</span></tt></a>.</p>
|
||||
<p>To set this callback to <a class="reference internal" href="#c.nghttp2_session_callbacks" title="nghttp2_session_callbacks"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_session_callbacks</span></tt></a>, use
|
||||
<a class="reference internal" href="#c.nghttp2_session_callbacks_set_on_header_callback" title="nghttp2_session_callbacks_set_on_header_callback"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_callbacks_set_on_header_callback()</span></tt></a>.</p>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="type">
|
||||
|
@ -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_session_send" title="nghttp2_session_send"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_send()</span></tt></a> function immediately return
|
||||
<a class="reference internal" href="#c.NGHTTP2_ERR_CALLBACK_FAILURE" title="NGHTTP2_ERR_CALLBACK_FAILURE"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_ERR_CALLBACK_FAILURE</span></tt></a>.</p>
|
||||
<p>To set this callback to <a class="reference internal" href="#c.nghttp2_session_callbacks" title="nghttp2_session_callbacks"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_session_callbacks</span></tt></a>, use
|
||||
<a class="reference internal" href="#c.nghttp2_session_callbacks_set_select_padding_callback" title="nghttp2_session_callbacks_set_select_padding_callback"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_callbacks_set_select_padding_callback()</span></tt></a>.</p>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="type">
|
||||
<dt id="c.nghttp2_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> *session</em>, const <a class="reference internal" href="#c.nghttp2_frame_hd" title="nghttp2_frame_hd">nghttp2_frame_hd</a><em> *hd</em>, void<em> *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’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>
|
||||
|
||||
<dl class="type">
|
||||
<dt id="c.nghttp2_session_callbacks">
|
||||
<tt class="descname">nghttp2_session_callbacks</tt><a class="headerlink" href="#c.nghttp2_session_callbacks" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Callback functions for <a class="reference internal" href="#c.nghttp2_session" title="nghttp2_session"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_session</span></tt></a>. The details of
|
||||
this structure are intentionally hidden from the public API.</p>
|
||||
<dd><p>Callback functions.</p>
|
||||
<dl class="member">
|
||||
<dt id="c.nghttp2_session_callbacks.send_callback">
|
||||
<a class="reference internal" href="#c.nghttp2_send_callback" title="nghttp2_send_callback">nghttp2_send_callback</a> <tt class="descname">send_callback</tt><a class="headerlink" href="#c.nghttp2_session_callbacks.send_callback" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Callback function invoked when the <em>session</em> wants to send data
|
||||
to the remote peer. This callback is not necessary if the
|
||||
application uses solely <a class="reference internal" href="#c.nghttp2_session_mem_send" title="nghttp2_session_mem_send"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_mem_send()</span></tt></a> to serialize
|
||||
data to transmit.</p>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="member">
|
||||
<dt id="c.nghttp2_session_callbacks.recv_callback">
|
||||
<a class="reference internal" href="#c.nghttp2_recv_callback" title="nghttp2_recv_callback">nghttp2_recv_callback</a> <tt class="descname">recv_callback</tt><a class="headerlink" href="#c.nghttp2_session_callbacks.recv_callback" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Callback function invoked when the <em>session</em> wants to receive
|
||||
data from the remote peer. This callback is not necessary if the
|
||||
application uses solely <a class="reference internal" href="#c.nghttp2_session_mem_recv" title="nghttp2_session_mem_recv"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_mem_recv()</span></tt></a> to process
|
||||
received data.</p>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="member">
|
||||
<dt id="c.nghttp2_session_callbacks.on_frame_recv_callback">
|
||||
<a class="reference internal" href="#c.nghttp2_on_frame_recv_callback" title="nghttp2_on_frame_recv_callback">nghttp2_on_frame_recv_callback</a> <tt class="descname">on_frame_recv_callback</tt><a class="headerlink" href="#c.nghttp2_session_callbacks.on_frame_recv_callback" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Callback function invoked by <a class="reference internal" href="#c.nghttp2_session_recv" title="nghttp2_session_recv"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_recv()</span></tt></a> when a
|
||||
frame is received.</p>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="member">
|
||||
<dt id="c.nghttp2_session_callbacks.on_invalid_frame_recv_callback">
|
||||
<a class="reference internal" href="#c.nghttp2_on_invalid_frame_recv_callback" title="nghttp2_on_invalid_frame_recv_callback">nghttp2_on_invalid_frame_recv_callback</a> <tt class="descname">on_invalid_frame_recv_callback</tt><a class="headerlink" href="#c.nghttp2_session_callbacks.on_invalid_frame_recv_callback" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Callback function invoked by <a class="reference internal" href="#c.nghttp2_session_recv" title="nghttp2_session_recv"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_recv()</span></tt></a> when an
|
||||
invalid non-DATA frame is received.</p>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="member">
|
||||
<dt id="c.nghttp2_session_callbacks.on_data_chunk_recv_callback">
|
||||
<a class="reference internal" href="#c.nghttp2_on_data_chunk_recv_callback" title="nghttp2_on_data_chunk_recv_callback">nghttp2_on_data_chunk_recv_callback</a> <tt class="descname">on_data_chunk_recv_callback</tt><a class="headerlink" href="#c.nghttp2_session_callbacks.on_data_chunk_recv_callback" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Callback function invoked when a chunk of data in DATA frame is
|
||||
received.</p>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="member">
|
||||
<dt id="c.nghttp2_session_callbacks.before_frame_send_callback">
|
||||
<a class="reference internal" href="#c.nghttp2_before_frame_send_callback" title="nghttp2_before_frame_send_callback">nghttp2_before_frame_send_callback</a> <tt class="descname">before_frame_send_callback</tt><a class="headerlink" href="#c.nghttp2_session_callbacks.before_frame_send_callback" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Callback function invoked before a non-DATA frame is sent.</p>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="member">
|
||||
<dt id="c.nghttp2_session_callbacks.on_frame_send_callback">
|
||||
<a class="reference internal" href="#c.nghttp2_on_frame_send_callback" title="nghttp2_on_frame_send_callback">nghttp2_on_frame_send_callback</a> <tt class="descname">on_frame_send_callback</tt><a class="headerlink" href="#c.nghttp2_session_callbacks.on_frame_send_callback" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Callback function invoked after a frame is sent.</p>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="member">
|
||||
<dt id="c.nghttp2_session_callbacks.on_frame_not_send_callback">
|
||||
<a class="reference internal" href="#c.nghttp2_on_frame_not_send_callback" title="nghttp2_on_frame_not_send_callback">nghttp2_on_frame_not_send_callback</a> <tt class="descname">on_frame_not_send_callback</tt><a class="headerlink" href="#c.nghttp2_session_callbacks.on_frame_not_send_callback" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>The callback function invoked when a non-DATA frame is not sent
|
||||
because of an error.</p>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="member">
|
||||
<dt id="c.nghttp2_session_callbacks.on_stream_close_callback">
|
||||
<a class="reference internal" href="#c.nghttp2_on_stream_close_callback" title="nghttp2_on_stream_close_callback">nghttp2_on_stream_close_callback</a> <tt class="descname">on_stream_close_callback</tt><a class="headerlink" href="#c.nghttp2_session_callbacks.on_stream_close_callback" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Callback function invoked when the stream is closed.</p>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="member">
|
||||
<dt id="c.nghttp2_session_callbacks.on_unknown_frame_recv_callback">
|
||||
<a class="reference internal" href="#c.nghttp2_on_unknown_frame_recv_callback" title="nghttp2_on_unknown_frame_recv_callback">nghttp2_on_unknown_frame_recv_callback</a> <tt class="descname">on_unknown_frame_recv_callback</tt><a class="headerlink" href="#c.nghttp2_session_callbacks.on_unknown_frame_recv_callback" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Callback function invoked when the received frame type is
|
||||
unknown.</p>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="member">
|
||||
<dt id="c.nghttp2_session_callbacks.on_begin_headers_callback">
|
||||
<a class="reference internal" href="#c.nghttp2_on_begin_headers_callback" title="nghttp2_on_begin_headers_callback">nghttp2_on_begin_headers_callback</a> <tt class="descname">on_begin_headers_callback</tt><a class="headerlink" href="#c.nghttp2_session_callbacks.on_begin_headers_callback" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Callback function invoked when the reception of header block in
|
||||
HEADERS or PUSH_PROMISE is started.</p>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="member">
|
||||
<dt id="c.nghttp2_session_callbacks.on_header_callback">
|
||||
<a class="reference internal" href="#c.nghttp2_on_header_callback" title="nghttp2_on_header_callback">nghttp2_on_header_callback</a> <tt class="descname">on_header_callback</tt><a class="headerlink" href="#c.nghttp2_session_callbacks.on_header_callback" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Callback function invoked when a header name/value pair is
|
||||
received.</p>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="member">
|
||||
<dt id="c.nghttp2_session_callbacks.select_padding_callback">
|
||||
<a class="reference internal" href="#c.nghttp2_select_padding_callback" title="nghttp2_select_padding_callback">nghttp2_select_padding_callback</a> <tt class="descname">select_padding_callback</tt><a class="headerlink" href="#c.nghttp2_session_callbacks.select_padding_callback" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Callback function invoked when the library asks application how
|
||||
many padding bytes are required for the transmission of the given
|
||||
frame.</p>
|
||||
</dd></dl>
|
||||
|
||||
</dd></dl>
|
||||
|
||||
<dl class="type">
|
||||
|
@ -1907,121 +1972,6 @@ this structure are intentionally hidden from the public API.</p>
|
|||
</div>
|
||||
<div class="section" id="functions">
|
||||
<h2>Functions<a class="headerlink" href="#functions" title="Permalink to this headline">¶</a></h2>
|
||||
<dl class="function">
|
||||
<dt id="c.nghttp2_session_callbacks_new">
|
||||
int <tt class="descname">nghttp2_session_callbacks_new</tt><big>(</big><a class="reference internal" href="#c.nghttp2_session_callbacks" title="nghttp2_session_callbacks">nghttp2_session_callbacks</a><em> **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> *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> *cbs</em>, <a class="reference internal" href="#c.nghttp2_send_callback" title="nghttp2_send_callback">nghttp2_send_callback</a><em> 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> *cbs</em>, <a class="reference internal" href="#c.nghttp2_recv_callback" title="nghttp2_recv_callback">nghttp2_recv_callback</a><em> 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> *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> 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> *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> 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> *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> 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> *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> 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> *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> 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> *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> 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> *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> 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> *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> 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> *cbs</em>, <a class="reference internal" href="#c.nghttp2_on_header_callback" title="nghttp2_on_header_callback">nghttp2_on_header_callback</a><em> 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> *cbs</em>, <a class="reference internal" href="#c.nghttp2_select_padding_callback" title="nghttp2_select_padding_callback">nghttp2_select_padding_callback</a><em> 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> *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> on_begin_frame_callback</em><big>)</big><a class="headerlink" href="#c.nghttp2_session_callbacks_set_on_begin_frame_callback" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Sets callback function invoked when a frame header is received.</p>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="function">
|
||||
<dt id="c.nghttp2_option_new">
|
||||
int <tt class="descname">nghttp2_option_new</tt><big>(</big><a class="reference internal" href="#c.nghttp2_option" title="nghttp2_option">nghttp2_option</a><em> **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>
|
||||
does not store <em>callbacks</em>. The <em>user_data</em> is an arbitrary user
|
||||
supplied data, which will be passed to the callback functions.</p>
|
||||
<p>The <a class="reference internal" href="#c.nghttp2_send_callback" title="nghttp2_send_callback"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_send_callback</span></tt></a> must be specified. If the
|
||||
application code uses <a class="reference internal" href="#c.nghttp2_session_recv" title="nghttp2_session_recv"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_recv()</span></tt></a>, the
|
||||
<a class="reference internal" href="#c.nghttp2_recv_callback" title="nghttp2_recv_callback"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_recv_callback</span></tt></a> must be specified. The other members
|
||||
of <em>callbacks</em> can be <tt class="docutils literal"><span class="pre">NULL</span></tt>.</p>
|
||||
<p>The <a class="reference internal" href="#c.nghttp2_session_callbacks.send_callback" title="nghttp2_session_callbacks.send_callback"><tt class="xref c c-member docutils literal"><span class="pre">nghttp2_session_callbacks.send_callback</span></tt></a> must be
|
||||
specified. If the application code uses <a class="reference internal" href="#c.nghttp2_session_recv" title="nghttp2_session_recv"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_recv()</span></tt></a>,
|
||||
the <a class="reference internal" href="#c.nghttp2_session_callbacks.recv_callback" title="nghttp2_session_callbacks.recv_callback"><tt class="xref c c-member docutils literal"><span class="pre">nghttp2_session_callbacks.recv_callback</span></tt></a> must be
|
||||
specified. The other members of <em>callbacks</em> can be <tt class="docutils literal"><span class="pre">NULL</span></tt>.</p>
|
||||
<p>If this function fails, <em>*session_ptr</em> is left untouched.</p>
|
||||
<p>This function returns 0 if it succeeds, or one of the following
|
||||
negative error codes:</p>
|
||||
|
@ -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>
|
||||
does not store <em>callbacks</em>. The <em>user_data</em> is an arbitrary user
|
||||
supplied data, which will be passed to the callback functions.</p>
|
||||
<p>The <a class="reference internal" href="#c.nghttp2_send_callback" title="nghttp2_send_callback"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_send_callback</span></tt></a> must be specified. If the
|
||||
application code uses <a class="reference internal" href="#c.nghttp2_session_recv" title="nghttp2_session_recv"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_recv()</span></tt></a>, the
|
||||
<a class="reference internal" href="#c.nghttp2_recv_callback" title="nghttp2_recv_callback"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_recv_callback</span></tt></a> must be specified. The other members
|
||||
of <em>callbacks</em> can be <tt class="docutils literal"><span class="pre">NULL</span></tt>.</p>
|
||||
<p>The <a class="reference internal" href="#c.nghttp2_session_callbacks.send_callback" title="nghttp2_session_callbacks.send_callback"><tt class="xref c c-member docutils literal"><span class="pre">nghttp2_session_callbacks.send_callback</span></tt></a> must be
|
||||
specified. If the application code uses <a class="reference internal" href="#c.nghttp2_session_recv" title="nghttp2_session_recv"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_recv()</span></tt></a>,
|
||||
the <a class="reference internal" href="#c.nghttp2_session_callbacks.recv_callback" title="nghttp2_session_callbacks.recv_callback"><tt class="xref c c-member docutils literal"><span class="pre">nghttp2_session_callbacks.recv_callback</span></tt></a> must be
|
||||
specified. The other members of <em>callbacks</em> can be <tt class="docutils literal"><span class="pre">NULL</span></tt>.</p>
|
||||
<p>If this function fails, <em>*session_ptr</em> is left untouched.</p>
|
||||
<p>This function returns 0 if it succeeds, or one of the following
|
||||
negative error codes:</p>
|
||||
|
@ -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
|
||||
outbound queue and sends it to the remote peer. It does this as
|
||||
many as possible until the user callback
|
||||
<a class="reference internal" href="#c.nghttp2_send_callback" title="nghttp2_send_callback"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_send_callback</span></tt></a> returns
|
||||
<a class="reference internal" href="#c.nghttp2_session_callbacks.send_callback" title="nghttp2_session_callbacks.send_callback"><tt class="xref c c-member docutils literal"><span class="pre">nghttp2_session_callbacks.send_callback</span></tt></a> returns
|
||||
<a class="reference internal" href="#c.NGHTTP2_ERR_WOULDBLOCK" title="NGHTTP2_ERR_WOULDBLOCK"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_ERR_WOULDBLOCK</span></tt></a> or the outbound queue becomes empty.
|
||||
This function calls several callback functions which are passed
|
||||
when initializing the <em>session</em>. Here is the simple time chart
|
||||
|
@ -2172,18 +2122,22 @@ which tells when each callback is invoked:</p>
|
|||
<li>Prepare transmission of the frame.</li>
|
||||
<li>If the control frame cannot be sent because some preconditions
|
||||
are not met (e.g., request HEADERS cannot be sent after GOAWAY),
|
||||
<a class="reference internal" href="#c.nghttp2_on_frame_not_send_callback" title="nghttp2_on_frame_not_send_callback"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_on_frame_not_send_callback</span></tt></a> is invoked. Abort
|
||||
the following steps.</li>
|
||||
<a class="reference internal" href="#c.nghttp2_session_callbacks.on_frame_not_send_callback" title="nghttp2_session_callbacks.on_frame_not_send_callback"><tt class="xref c c-member docutils literal"><span class="pre">nghttp2_session_callbacks.on_frame_not_send_callback</span></tt></a>
|
||||
is invoked. Abort the following steps.</li>
|
||||
<li>If the frame is HEADERS, PUSH_PROMISE or DATA,
|
||||
<a class="reference internal" href="#c.nghttp2_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><a class="reference internal" href="#c.nghttp2_before_frame_send_callback" title="nghttp2_before_frame_send_callback"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_before_frame_send_callback</span></tt></a> is invoked.</li>
|
||||
<li><a class="reference internal" href="#c.nghttp2_send_callback" title="nghttp2_send_callback"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_send_callback</span></tt></a> is invoked one or more times to
|
||||
send the frame.</li>
|
||||
<li><a class="reference internal" href="#c.nghttp2_on_frame_send_callback" title="nghttp2_on_frame_send_callback"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_on_frame_send_callback</span></tt></a> is invoked.</li>
|
||||
<li><a class="reference internal" href="#c.nghttp2_session_callbacks.before_frame_send_callback" title="nghttp2_session_callbacks.before_frame_send_callback"><tt class="xref c c-member docutils literal"><span class="pre">nghttp2_session_callbacks.before_frame_send_callback</span></tt></a> is
|
||||
invoked.</li>
|
||||
<li><a class="reference internal" href="#c.nghttp2_session_callbacks.send_callback" title="nghttp2_session_callbacks.send_callback"><tt class="xref c c-member docutils literal"><span class="pre">nghttp2_session_callbacks.send_callback</span></tt></a> is invoked one
|
||||
or more times to send the frame.</li>
|
||||
<li><a class="reference internal" href="#c.nghttp2_session_callbacks.on_frame_send_callback" title="nghttp2_session_callbacks.on_frame_send_callback"><tt class="xref c c-member docutils literal"><span class="pre">nghttp2_session_callbacks.on_frame_send_callback</span></tt></a> is
|
||||
invoked.</li>
|
||||
<li>If the transmission of the frame triggers closure of the stream,
|
||||
the stream is closed and
|
||||
<a class="reference internal" href="#c.nghttp2_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>
|
||||
<p>This function returns 0 if it succeeds, or one of the following
|
||||
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> *session</em>, const uint8_t<em> **data_ptr</em><big>)</big><a class="headerlink" href="#c.nghttp2_session_mem_send" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Returns the serialized data to send.</p>
|
||||
<p>This function behaves like <a class="reference internal" href="#c.nghttp2_session_send" title="nghttp2_session_send"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_send()</span></tt></a> except that it
|
||||
does not use <a class="reference internal" href="#c.nghttp2_send_callback" title="nghttp2_send_callback"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_send_callback</span></tt></a> to transmit data.
|
||||
Instead, it assigns the pointer to the serialized data to the
|
||||
<em>*data_ptr</em> and returns its length. The other callbacks are called
|
||||
in the same way as they are in <a class="reference internal" href="#c.nghttp2_session_send" title="nghttp2_session_send"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_send()</span></tt></a>.</p>
|
||||
does not use <a class="reference internal" href="#c.nghttp2_session_callbacks.send_callback" title="nghttp2_session_callbacks.send_callback"><tt class="xref c c-member docutils literal"><span class="pre">nghttp2_session_callbacks.send_callback</span></tt></a> to
|
||||
transmit data. Instead, it assigns the pointer to the serialized
|
||||
data to the <em>*data_ptr</em> and returns its length. The other
|
||||
callbacks are called in the same way as they are in
|
||||
<a class="reference internal" href="#c.nghttp2_session_send" title="nghttp2_session_send"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_send()</span></tt></a>.</p>
|
||||
<p>If no data is available to send, this function returns 0.</p>
|
||||
<p>This function may not return all serialized data in one invocation.
|
||||
To get all data, call this function repeatedly until it returns 0
|
||||
|
@ -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> *session</em><big>)</big><a class="headerlink" href="#c.nghttp2_session_recv" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Receives frames from the remote peer.</p>
|
||||
<p>This function receives as many frames as possible until the user
|
||||
callback <a class="reference internal" href="#c.nghttp2_recv_callback" title="nghttp2_recv_callback"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_recv_callback</span></tt></a> returns
|
||||
callback <a class="reference internal" href="#c.nghttp2_session_callbacks.recv_callback" title="nghttp2_session_callbacks.recv_callback"><tt class="xref c c-member docutils literal"><span class="pre">nghttp2_session_callbacks.recv_callback</span></tt></a> returns
|
||||
<a class="reference internal" href="#c.NGHTTP2_ERR_WOULDBLOCK" title="NGHTTP2_ERR_WOULDBLOCK"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_ERR_WOULDBLOCK</span></tt></a>. This function calls several
|
||||
callback functions which are passed when initializing the
|
||||
<em>session</em>. Here is the simple time chart which tells when each
|
||||
callback is invoked:</p>
|
||||
<ol class="arabic simple">
|
||||
<li><a class="reference internal" href="#c.nghttp2_recv_callback" title="nghttp2_recv_callback"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_recv_callback</span></tt></a> is invoked one or more times to
|
||||
receive frame header.</li>
|
||||
<li>When frame header is received,
|
||||
<a class="reference internal" href="#c.nghttp2_on_begin_frame_callback" title="nghttp2_on_begin_frame_callback"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_on_begin_frame_callback</span></tt></a> is invoked.</li>
|
||||
<li><a class="reference internal" href="#c.nghttp2_session_callbacks.recv_callback" title="nghttp2_session_callbacks.recv_callback"><tt class="xref c c-member docutils literal"><span class="pre">nghttp2_session_callbacks.recv_callback</span></tt></a> is invoked one
|
||||
or more times to receive frame header.</li>
|
||||
<li>If the frame is DATA frame:<ol class="arabic">
|
||||
<li><a class="reference internal" href="#c.nghttp2_recv_callback" title="nghttp2_recv_callback"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_recv_callback</span></tt></a> is invoked to receive DATA
|
||||
payload. For each chunk of data,
|
||||
<a class="reference internal" href="#c.nghttp2_on_data_chunk_recv_callback" title="nghttp2_on_data_chunk_recv_callback"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_on_data_chunk_recv_callback</span></tt></a> is invoked.</li>
|
||||
<li><a class="reference internal" href="#c.nghttp2_session_callbacks.recv_callback" title="nghttp2_session_callbacks.recv_callback"><tt class="xref c c-member docutils literal"><span class="pre">nghttp2_session_callbacks.recv_callback</span></tt></a> is invoked
|
||||
to receive DATA payload. For each chunk of data,
|
||||
<a class="reference internal" href="#c.nghttp2_session_callbacks.on_data_chunk_recv_callback" title="nghttp2_session_callbacks.on_data_chunk_recv_callback"><tt class="xref c c-member docutils literal"><span class="pre">nghttp2_session_callbacks.on_data_chunk_recv_callback</span></tt></a>
|
||||
is invoked.</li>
|
||||
<li>If one DATA frame is completely received,
|
||||
<a class="reference internal" href="#c.nghttp2_on_frame_recv_callback" title="nghttp2_on_frame_recv_callback"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_on_frame_recv_callback</span></tt></a> is invoked. If the
|
||||
reception of the frame triggers the closure of the stream,
|
||||
<a class="reference internal" href="#c.nghttp2_on_stream_close_callback" title="nghttp2_on_stream_close_callback"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_on_stream_close_callback</span></tt></a> is invoked.</li>
|
||||
<a class="reference internal" href="#c.nghttp2_session_callbacks.on_frame_recv_callback" title="nghttp2_session_callbacks.on_frame_recv_callback"><tt class="xref c c-member docutils literal"><span class="pre">nghttp2_session_callbacks.on_frame_recv_callback</span></tt></a> is
|
||||
invoked. If the reception of the frame triggers the
|
||||
closure of the stream,
|
||||
<a class="reference internal" href="#c.nghttp2_session_callbacks.on_stream_close_callback" title="nghttp2_session_callbacks.on_stream_close_callback"><tt class="xref c c-member docutils literal"><span class="pre">nghttp2_session_callbacks.on_stream_close_callback</span></tt></a>
|
||||
is invoked.</li>
|
||||
</ol>
|
||||
</li>
|
||||
<li>If the frame is the control frame:<ol class="arabic">
|
||||
<li><a class="reference internal" href="#c.nghttp2_recv_callback" title="nghttp2_recv_callback"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_recv_callback</span></tt></a> is invoked one or more times to
|
||||
receive whole frame.</li>
|
||||
<li><a class="reference internal" href="#c.nghttp2_session_callbacks.recv_callback" title="nghttp2_session_callbacks.recv_callback"><tt class="xref c c-member docutils literal"><span class="pre">nghttp2_session_callbacks.recv_callback</span></tt></a> is invoked
|
||||
one or more times to receive whole frame.</li>
|
||||
<li>If the received frame is valid, then following actions are
|
||||
taken. If the frame is either HEADERS or PUSH_PROMISE,
|
||||
<a class="reference internal" href="#c.nghttp2_on_begin_headers_callback" title="nghttp2_on_begin_headers_callback"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_on_begin_headers_callback</span></tt></a> is invoked. Then
|
||||
<a class="reference internal" href="#c.nghttp2_on_header_callback" title="nghttp2_on_header_callback"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_on_header_callback</span></tt></a> is invoked for each header
|
||||
name/value pair. After all name/value pairs are emitted
|
||||
successfully, <a class="reference internal" href="#c.nghttp2_on_frame_recv_callback" title="nghttp2_on_frame_recv_callback"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_on_frame_recv_callback</span></tt></a> is
|
||||
<a class="reference internal" href="#c.nghttp2_session_callbacks.on_begin_headers_callback" title="nghttp2_session_callbacks.on_begin_headers_callback"><tt class="xref c c-member docutils literal"><span class="pre">nghttp2_session_callbacks.on_begin_headers_callback</span></tt></a>
|
||||
is invoked. Then
|
||||
<a class="reference internal" href="#c.nghttp2_session_callbacks.on_header_callback" title="nghttp2_session_callbacks.on_header_callback"><tt class="xref c c-member docutils literal"><span class="pre">nghttp2_session_callbacks.on_header_callback</span></tt></a> is
|
||||
invoked for each header name/value pair. After all name/value
|
||||
pairs are emitted successfully,
|
||||
<a class="reference internal" href="#c.nghttp2_session_callbacks.on_frame_recv_callback" title="nghttp2_session_callbacks.on_frame_recv_callback"><tt class="xref c c-member docutils literal"><span class="pre">nghttp2_session_callbacks.on_frame_recv_callback</span></tt></a> is
|
||||
invoked. For other frames,
|
||||
<a class="reference internal" href="#c.nghttp2_on_frame_recv_callback" title="nghttp2_on_frame_recv_callback"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_on_frame_recv_callback</span></tt></a> is invoked. If the
|
||||
reception of the frame triggers the closure of the stream,
|
||||
<a class="reference internal" href="#c.nghttp2_on_stream_close_callback" title="nghttp2_on_stream_close_callback"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_on_stream_close_callback</span></tt></a> is invoked.</li>
|
||||
<a class="reference internal" href="#c.nghttp2_session_callbacks.on_frame_recv_callback" title="nghttp2_session_callbacks.on_frame_recv_callback"><tt class="xref c c-member docutils literal"><span class="pre">nghttp2_session_callbacks.on_frame_recv_callback</span></tt></a> is
|
||||
invoked.
|
||||
If the reception of the frame triggers the closure of the
|
||||
stream,
|
||||
<a class="reference internal" href="#c.nghttp2_session_callbacks.on_stream_close_callback" title="nghttp2_session_callbacks.on_stream_close_callback"><tt class="xref c c-member docutils literal"><span class="pre">nghttp2_session_callbacks.on_stream_close_callback</span></tt></a>
|
||||
is invoked.</li>
|
||||
<li>If the received frame is unpacked but is interpreted as
|
||||
invalid, <a class="reference internal" href="#c.nghttp2_on_invalid_frame_recv_callback" title="nghttp2_on_invalid_frame_recv_callback"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_on_invalid_frame_recv_callback</span></tt></a> is
|
||||
invoked.</li>
|
||||
invalid,
|
||||
<a class="reference internal" href="#c.nghttp2_session_callbacks.on_invalid_frame_recv_callback" title="nghttp2_session_callbacks.on_invalid_frame_recv_callback"><tt class="xref c c-member docutils literal"><span class="pre">nghttp2_session_callbacks.on_invalid_frame_recv_callback</span></tt></a>
|
||||
is invoked.</li>
|
||||
</ol>
|
||||
</li>
|
||||
</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
|
||||
<em>inlen</em> indicates the number of bytes in the <em>in</em>.</p>
|
||||
<p>This function behaves like <a class="reference internal" href="#c.nghttp2_session_recv" title="nghttp2_session_recv"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_recv()</span></tt></a> except that it
|
||||
does not use <a class="reference internal" href="#c.nghttp2_recv_callback" title="nghttp2_recv_callback"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_recv_callback</span></tt></a> to receive data; the
|
||||
<em>in</em> is the only data for the invocation of this function. If all
|
||||
bytes are processed, this function returns. The other callbacks
|
||||
are called in the same way as they are in <a class="reference internal" href="#c.nghttp2_session_recv" title="nghttp2_session_recv"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_recv()</span></tt></a>.</p>
|
||||
does not use <a class="reference internal" href="#c.nghttp2_session_callbacks.recv_callback" title="nghttp2_session_callbacks.recv_callback"><tt class="xref c c-member docutils literal"><span class="pre">nghttp2_session_callbacks.recv_callback</span></tt></a> to
|
||||
receive data; the <em>in</em> is the only data for the invocation of this
|
||||
function. If all bytes are processed, this function returns. The
|
||||
other callbacks are called in the same way as they are in
|
||||
<a class="reference internal" href="#c.nghttp2_session_recv" title="nghttp2_session_recv"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_recv()</span></tt></a>.</p>
|
||||
<p>In the current implementation, this function always tries to
|
||||
processes all input data unless either an error occurs or
|
||||
<a class="reference internal" href="#c.NGHTTP2_ERR_PAUSE" title="NGHTTP2_ERR_PAUSE"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_ERR_PAUSE</span></tt></a> is returned from
|
||||
<a class="reference internal" href="#c.nghttp2_on_header_callback" title="nghttp2_on_header_callback"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_on_header_callback</span></tt></a> or
|
||||
<a class="reference internal" href="#c.nghttp2_on_data_chunk_recv_callback" title="nghttp2_on_data_chunk_recv_callback"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_on_data_chunk_recv_callback</span></tt></a>. If
|
||||
<a class="reference internal" href="#c.NGHTTP2_ERR_PAUSE" title="NGHTTP2_ERR_PAUSE"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_ERR_PAUSE</span></tt></a> is used, the return value includes the
|
||||
<a class="reference internal" href="#c.nghttp2_session_callbacks.on_header_callback" title="nghttp2_session_callbacks.on_header_callback"><tt class="xref c c-member docutils literal"><span class="pre">nghttp2_session_callbacks.on_header_callback</span></tt></a> or
|
||||
<a class="reference internal" href="#c.nghttp2_session_callbacks.on_data_chunk_recv_callback" title="nghttp2_session_callbacks.on_data_chunk_recv_callback"><tt class="xref c c-member docutils literal"><span class="pre">nghttp2_session_callbacks.on_data_chunk_recv_callback</span></tt></a>.
|
||||
If <a class="reference internal" href="#c.NGHTTP2_ERR_PAUSE" title="NGHTTP2_ERR_PAUSE"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_ERR_PAUSE</span></tt></a> is used, the return value includes the
|
||||
number of bytes which was used to produce the data or frame for the
|
||||
callback.</p>
|
||||
<p>This function returns the number of processed bytes, or one of the
|
||||
|
@ -2452,12 +2415,11 @@ Returns 0 if it did not. Returns -1 if no such stream exists.</p>
|
|||
|
||||
<dl class="function">
|
||||
<dt id="c.nghttp2_session_terminate_session">
|
||||
int <tt class="descname">nghttp2_session_terminate_session</tt><big>(</big><a class="reference internal" href="#c.nghttp2_session" title="nghttp2_session">nghttp2_session</a><em> *session</em>, uint32_t<em> 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> *session</em>, <a class="reference internal" href="#c.nghttp2_error_code" title="nghttp2_error_code">nghttp2_error_code</a><em> error_code</em><big>)</big><a class="headerlink" href="#c.nghttp2_session_terminate_session" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Signals the session so that the connection should be terminated.</p>
|
||||
<p>The last stream ID is the 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>
|
||||
<p>The <em>error_code</em> is the error code of this GOAWAY frame. The
|
||||
pre-defined error code is one of <a class="reference internal" href="#c.nghttp2_error_code" title="nghttp2_error_code"><tt class="xref c c-macro docutils literal"><span class="pre">nghttp2_error_code</span></tt></a>.</p>
|
||||
<p>The <em>error_code</em> is the error code of this GOAWAY frame.</p>
|
||||
<p>After the transmission, both <a class="reference internal" href="#c.nghttp2_session_want_read" title="nghttp2_session_want_read"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_want_read()</span></tt></a> and
|
||||
<a class="reference internal" href="#c.nghttp2_session_want_write" title="nghttp2_session_want_write"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_want_write()</span></tt></a> return 0.</p>
|
||||
<p>This function should be called when the connection should be
|
||||
|
@ -2473,7 +2435,7 @@ negative error codes:</p>
|
|||
|
||||
<dl class="function">
|
||||
<dt id="c.nghttp2_session_terminate_session2">
|
||||
int <tt class="descname">nghttp2_session_terminate_session2</tt><big>(</big><a class="reference internal" href="#c.nghttp2_session" title="nghttp2_session">nghttp2_session</a><em> *session</em>, int32_t<em> last_stream_id</em>, uint32_t<em> 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> *session</em>, int32_t<em> last_stream_id</em>, <a class="reference internal" href="#c.nghttp2_error_code" title="nghttp2_error_code">nghttp2_error_code</a><em> error_code</em><big>)</big><a class="headerlink" href="#c.nghttp2_session_terminate_session2" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Signals the session so that the connection should be terminated.</p>
|
||||
<p>This function behaves like <a class="reference internal" href="#c.nghttp2_session_terminate_session" title="nghttp2_session_terminate_session"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_terminate_session()</span></tt></a>,
|
||||
but the last stream ID can be specified by the application for fine
|
||||
|
@ -2650,8 +2612,8 @@ reached.</dd>
|
|||
<p class="last">This function returns assigned stream ID if it succeeds. But
|
||||
that stream is not opened yet. The application must not submit
|
||||
frame to that stream ID before
|
||||
<a class="reference internal" href="#c.nghttp2_before_frame_send_callback" title="nghttp2_before_frame_send_callback"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_before_frame_send_callback</span></tt></a> is called for this
|
||||
frame.</p>
|
||||
<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
|
||||
called for this frame.</p>
|
||||
</div>
|
||||
</dd></dl>
|
||||
|
||||
|
@ -2752,8 +2714,8 @@ reached.</dd>
|
|||
<p class="last">This function returns assigned stream ID if it succeeds and
|
||||
<em>stream_id</em> is -1. But that stream is not opened yet. The
|
||||
application must not submit frame to that stream ID before
|
||||
<a class="reference internal" href="#c.nghttp2_before_frame_send_callback" title="nghttp2_before_frame_send_callback"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_before_frame_send_callback</span></tt></a> is called for this
|
||||
frame.</p>
|
||||
<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
|
||||
called for this frame.</p>
|
||||
</div>
|
||||
</dd></dl>
|
||||
|
||||
|
@ -2807,10 +2769,9 @@ depend on itself.</dd>
|
|||
|
||||
<dl class="function">
|
||||
<dt id="c.nghttp2_submit_rst_stream">
|
||||
int <tt class="descname">nghttp2_submit_rst_stream</tt><big>(</big><a class="reference internal" href="#c.nghttp2_session" title="nghttp2_session">nghttp2_session</a><em> *session</em>, uint8_t<em> flags</em>, int32_t<em> stream_id</em>, uint32_t<em> 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> *session</em>, uint8_t<em> flags</em>, int32_t<em> stream_id</em>, <a class="reference internal" href="#c.nghttp2_error_code" title="nghttp2_error_code">nghttp2_error_code</a><em> error_code</em><big>)</big><a class="headerlink" href="#c.nghttp2_submit_rst_stream" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Submits RST_STREAM frame to cancel/reject the stream <em>stream_id</em>
|
||||
with the error code <em>error_code</em>.</p>
|
||||
<p>The pre-defined error code is one of <a class="reference internal" href="#c.nghttp2_error_code" title="nghttp2_error_code"><tt class="xref c c-macro docutils literal"><span class="pre">nghttp2_error_code</span></tt></a>.</p>
|
||||
<p>The <em>flags</em> is currently ignored and should be
|
||||
<a class="reference internal" href="#c.NGHTTP2_FLAG_NONE" title="NGHTTP2_FLAG_NONE"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_FLAG_NONE</span></tt></a>.</p>
|
||||
<p>This function returns 0 if it succeeds, or one of the following
|
||||
|
@ -2895,8 +2856,8 @@ reached.</dd>
|
|||
<p class="last">This function returns assigned promised stream ID if it succeeds.
|
||||
But that stream is not opened yet. The application must not
|
||||
submit frame to that stream ID before
|
||||
<a class="reference internal" href="#c.nghttp2_before_frame_send_callback" title="nghttp2_before_frame_send_callback"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_before_frame_send_callback</span></tt></a> is called for this
|
||||
frame.</p>
|
||||
<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
|
||||
called for this frame.</p>
|
||||
</div>
|
||||
</dd></dl>
|
||||
|
||||
|
@ -2922,10 +2883,9 @@ negative error codes:</p>
|
|||
|
||||
<dl class="function">
|
||||
<dt id="c.nghttp2_submit_goaway">
|
||||
int <tt class="descname">nghttp2_submit_goaway</tt><big>(</big><a class="reference internal" href="#c.nghttp2_session" title="nghttp2_session">nghttp2_session</a><em> *session</em>, uint8_t<em> flags</em>, int32_t<em> last_stream_id</em>, uint32_t<em> error_code</em>, const uint8_t<em> *opaque_data</em>, size_t<em> 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> *session</em>, uint8_t<em> flags</em>, int32_t<em> last_stream_id</em>, <a class="reference internal" href="#c.nghttp2_error_code" title="nghttp2_error_code">nghttp2_error_code</a><em> error_code</em>, const uint8_t<em> *opaque_data</em>, size_t<em> opaque_data_len</em><big>)</big><a class="headerlink" href="#c.nghttp2_submit_goaway" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Submits GOAWAY frame with the last stream ID <em>last_stream_id</em> and
|
||||
the error code <em>error_code</em>.</p>
|
||||
<p>The pre-defined error code is one of <a class="reference internal" href="#c.nghttp2_error_code" title="nghttp2_error_code"><tt class="xref c c-macro docutils literal"><span class="pre">nghttp2_error_code</span></tt></a>.</p>
|
||||
<p>The <em>flags</em> is currently ignored and should be
|
||||
<a class="reference internal" href="#c.NGHTTP2_FLAG_NONE" title="NGHTTP2_FLAG_NONE"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_FLAG_NONE</span></tt></a>.</p>
|
||||
<p>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
|
||||
|
|
|
@ -2255,12 +2255,12 @@
|
|||
<dt><a href="apiref.html#c.NGHTTP2_INITIAL_CONNECTION_WINDOW_SIZE">NGHTTP2_INITIAL_CONNECTION_WINDOW_SIZE (C macro)</a>
|
||||
</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>
|
||||
|
||||
</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>
|
||||
|
@ -2330,10 +2330,6 @@
|
|||
</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>
|
||||
|
||||
|
@ -2366,6 +2362,10 @@
|
|||
</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>
|
||||
|
||||
|
@ -2530,63 +2530,55 @@
|
|||
</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><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><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><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><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><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><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><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><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><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><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><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><a href="apiref.html#c.nghttp2_session_callbacks_set_recv_callback">nghttp2_session_callbacks_set_recv_callback (C function)</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><a href="apiref.html#c.nghttp2_session_callbacks.send_callback">nghttp2_session_callbacks.send_callback (C member)</a>
|
||||
</dt>
|
||||
|
||||
|
||||
|
|
477
nghttp2.h.html
477
nghttp2.h.html
|
@ -1015,7 +1015,7 @@
|
|||
<span class="cm">/**</span>
|
||||
<span class="cm"> * The error code. See :type:`nghttp2_error_code`.</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="cm">/**</span>
|
||||
|
@ -1116,7 +1116,7 @@
|
|||
<span class="cm">/**</span>
|
||||
<span class="cm"> * The error code. See :type:`nghttp2_error_code`.</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"> * The additional debug data</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"> * the application uses solely `nghttp2_session_mem_send()` instead,</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="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>
|
||||
|
@ -1302,9 +1299,6 @@
|
|||
<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"> * 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="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>
|
||||
|
@ -1337,9 +1331,6 @@
|
|||
<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_frame_recv_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_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>
|
||||
|
@ -1348,13 +1339,12 @@
|
|||
<span class="cm"> * @functypedef</span>
|
||||
<span class="cm"> *</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"> * error. It is usually one of the :enum:`nghttp2_error_code` but</span>
|
||||
<span class="cm"> * that is not guaranteed. When this callback function is invoked,</span>
|
||||
<span class="cm"> * the library automatically submits either RST_STREAM or GOAWAY</span>
|
||||
<span class="cm"> * frame. The |user_data| pointer is the third argument passed in to</span>
|
||||
<span class="cm"> * the call to `nghttp2_session_client_new()` or</span>
|
||||
<span class="cm"> * `nghttp2_session_server_new()`.</span>
|
||||
<span class="cm"> * invalid non-DATA frame is received. The |error_code| is one of the</span>
|
||||
<span class="cm"> * :enum:`nghttp2_error_code` and indicates the error. When this</span>
|
||||
<span class="cm"> * callback function is invoked, the library automatically submits</span>
|
||||
<span class="cm"> * either RST_STREAM or GOAWAY frame. The |user_data| pointer is the</span>
|
||||
<span class="cm"> * 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"> * 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>
|
||||
|
@ -1364,13 +1354,10 @@
|
|||
<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="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="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="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"> * @functypedef</span>
|
||||
|
@ -1398,9 +1385,6 @@
|
|||
<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"> * 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="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>
|
||||
|
@ -1418,9 +1402,6 @@
|
|||
<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="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="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>
|
||||
|
@ -1436,9 +1417,6 @@
|
|||
<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="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="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>
|
||||
|
@ -1457,9 +1435,6 @@
|
|||
<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="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="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>
|
||||
|
@ -1470,11 +1445,10 @@
|
|||
<span class="cm"> *</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"> * |error_code| is usually one of :enum:`nghttp2_error_code`, but that</span>
|
||||
<span class="cm"> * is not guaranteed. The stream_user_data, which was specified in</span>
|
||||
<span class="cm"> * `nghttp2_submit_request()` or `nghttp2_submit_headers()`, is still</span>
|
||||
<span class="cm"> * available in this function. The |user_data| pointer is the third</span>
|
||||
<span class="cm"> * argument passed in to the call to `nghttp2_session_client_new()` or</span>
|
||||
<span class="cm"> * stream_user_data, which was specified in `nghttp2_submit_request()`</span>
|
||||
<span class="cm"> * or `nghttp2_submit_headers()`, is still available in this function.</span>
|
||||
<span class="cm"> * The |user_data| pointer is the third argument passed in to the call</span>
|
||||
<span class="cm"> * to `nghttp2_session_client_new()` or</span>
|
||||
<span class="cm"> * `nghttp2_session_server_new()`.</span>
|
||||
<span class="cm"> *</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"> * `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="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="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="cm">/**</span>
|
||||
|
@ -1511,9 +1506,6 @@
|
|||
<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"> * :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="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>
|
||||
|
@ -1575,9 +1567,6 @@
|
|||
<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"> * 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="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>
|
||||
|
@ -1600,9 +1589,6 @@
|
|||
<span class="cm"> * :enum:`NGHTTP2_ERR_CALLBACK_FAILURE` will make</span>
|
||||
<span class="cm"> * `nghttp2_session_send()` function immediately return</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="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>
|
||||
|
@ -1610,197 +1596,80 @@
|
|||
<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="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'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"> * @struct</span>
|
||||
<span class="cm"> *</span>
|
||||
<span class="cm"> * Callback functions for :type:`nghttp2_session`. The details of</span>
|
||||
<span class="cm"> * this structure are intentionally hidden from the public API.</span>
|
||||
<span class="cm"> * Callback functions.</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="cm">/**</span>
|
||||
<span class="cm"> * @function</span>
|
||||
<span class="cm"> *</span>
|
||||
<span class="cm"> * Initializes |*callbacks_ptr| with NULL values.</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="k">typedef</span> <span class="k">struct</span> <span class="p">{</span>
|
||||
<span class="cm">/**</span>
|
||||
<span class="cm"> * Callback function invoked when the |session| wants to send data</span>
|
||||
<span class="cm"> * to the remote peer. This callback is not necessary if the</span>
|
||||
<span class="cm"> * application uses solely `nghttp2_session_mem_send()` to serialize</span>
|
||||
<span class="cm"> * data to transmit.</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="cm">/**</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="n">nghttp2_send_callback</span> <span class="n">send_callback</span><span class="p">;</span>
|
||||
<span class="cm">/**</span>
|
||||
<span class="cm"> * Callback function invoked when the |session| wants to receive</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"> * received data.</span>
|
||||
<span class="cm"> */</span>
|
||||
<span class="kt">void</span> <span class="nf">nghttp2_session_callbacks_set_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_recv_callback</span> <span class="n">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 by `nghttp2_session_recv()` when a</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"> * frame is received.</span>
|
||||
<span class="cm"> */</span>
|
||||
<span class="kt">void</span> <span class="nf">nghttp2_session_callbacks_set_on_frame_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_frame_recv_callback</span> <span class="n">on_frame_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 by `nghttp2_session_recv()` when an</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">/**</span>
|
||||
<span class="cm"> * Callback function invoked by `nghttp2_session_recv()` when an</span>
|
||||
<span class="cm"> * invalid non-DATA frame is received.</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="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_invalid_frame_recv_callback</span> <span class="n">on_invalid_frame_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 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="n">nghttp2_on_invalid_frame_recv_callback</span> <span class="n">on_invalid_frame_recv_callback</span><span class="p">;</span>
|
||||
<span class="cm">/**</span>
|
||||
<span class="cm"> * Callback function invoked when a chunk of data in DATA frame is</span>
|
||||
<span class="cm"> * received.</span>
|
||||
<span class="cm"> */</span>
|
||||
<span class="kt">void</span> <span class="nf">nghttp2_session_callbacks_set_on_header_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_header_callback</span> <span class="n">on_header_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 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="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"> * 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_select_padding_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_select_padding_callback</span> <span class="n">select_padding_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 frame header is received.</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"> * 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_begin_frame_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_frame_callback</span> <span class="n">on_begin_frame_callback</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"> * 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>
|
||||
|
||||
|
@ -1874,10 +1743,10 @@
|
|||
<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"> *</span>
|
||||
<span class="cm"> * The :type:`nghttp2_send_callback` must be specified. If the</span>
|
||||
<span class="cm"> * application code uses `nghttp2_session_recv()`, the</span>
|
||||
<span class="cm"> * :type:`nghttp2_recv_callback` must be specified. The other members</span>
|
||||
<span class="cm"> * of |callbacks| can be ``NULL``.</span>
|
||||
<span class="cm"> * The :member:`nghttp2_session_callbacks.send_callback` must be</span>
|
||||
<span class="cm"> * specified. If the application code uses `nghttp2_session_recv()`,</span>
|
||||
<span class="cm"> * the :member:`nghttp2_session_callbacks.recv_callback` must be</span>
|
||||
<span class="cm"> * specified. The other members of |callbacks| can be ``NULL``.</span>
|
||||
<span class="cm"> *</span>
|
||||
<span class="cm"> * If this function fails, |*session_ptr| is left untouched.</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"> * supplied data, which will be passed to the callback functions.</span>
|
||||
<span class="cm"> *</span>
|
||||
<span class="cm"> * The :type:`nghttp2_send_callback` must be specified. If the</span>
|
||||
<span class="cm"> * application code uses `nghttp2_session_recv()`, the</span>
|
||||
<span class="cm"> * :type:`nghttp2_recv_callback` must be specified. The other members</span>
|
||||
<span class="cm"> * of |callbacks| can be ``NULL``.</span>
|
||||
<span class="cm"> * The :member:`nghttp2_session_callbacks.send_callback` must be</span>
|
||||
<span class="cm"> * specified. If the application code uses `nghttp2_session_recv()`,</span>
|
||||
<span class="cm"> * the :member:`nghttp2_session_callbacks.recv_callback` must be</span>
|
||||
<span class="cm"> * specified. The other members of |callbacks| can be ``NULL``.</span>
|
||||
<span class="cm"> *</span>
|
||||
<span class="cm"> * If this function fails, |*session_ptr| is left untouched.</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"> * 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"> * :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"> * 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"> * which tells when each callback is invoked:</span>
|
||||
<span class="cm"> *</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"> *</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"> * :type:`nghttp2_on_frame_not_send_callback` is invoked. Abort</span>
|
||||
<span class="cm"> * the following steps.</span>
|
||||
<span class="cm"> *</span>
|
||||
<span class="cm"> * :member:`nghttp2_session_callbacks.on_frame_not_send_callback`</span>
|
||||
<span class="cm"> * is invoked. Abort the following steps.</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"> *</span>
|
||||
<span class="cm"> * :member:`nghttp2_session_callbacks.select_padding_callback` is</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"> *</span>
|
||||
<span class="cm"> * 6. :type:`nghttp2_before_frame_send_callback` is invoked.</span>
|
||||
<span class="cm"> *</span>
|
||||
<span class="cm"> * 7. :type:`nghttp2_send_callback` is invoked one or more times to</span>
|
||||
<span class="cm"> * send the frame.</span>
|
||||
<span class="cm"> *</span>
|
||||
<span class="cm"> * 8. :type:`nghttp2_on_frame_send_callback` is invoked.</span>
|
||||
<span class="cm"> *</span>
|
||||
<span class="cm"> * 6. :member:`nghttp2_session_callbacks.before_frame_send_callback` is</span>
|
||||
<span class="cm"> * invoked.</span>
|
||||
<span class="cm"> * 7. :member:`nghttp2_session_callbacks.send_callback` is invoked one</span>
|
||||
<span class="cm"> * or more times to send the frame.</span>
|
||||
<span class="cm"> * 8. :member:`nghttp2_session_callbacks.on_frame_send_callback` is</span>
|
||||
<span class="cm"> * invoked.</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"> * :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"> * This function returns 0 if it succeeds, or one of the following</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"> *</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"> * Instead, it assigns the pointer to the serialized data to the</span>
|
||||
<span class="cm"> * |*data_ptr| and returns its length. The other callbacks are called</span>
|
||||
<span class="cm"> * in the same way as they are in `nghttp2_session_send()`.</span>
|
||||
<span class="cm"> * does not use :member:`nghttp2_session_callbacks.send_callback` to</span>
|
||||
<span class="cm"> * transmit data. Instead, it assigns the pointer to the serialized</span>
|
||||
<span class="cm"> * data to the |*data_ptr| and returns its length. The other</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"> * If no data is available to send, this function returns 0.</span>
|
||||
<span class="cm"> *</span>
|
||||
|
@ -2064,48 +1930,51 @@
|
|||
<span class="cm"> * Receives frames from the remote peer.</span>
|
||||
<span class="cm"> *</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"> * 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"> * callback is invoked:</span>
|
||||
<span class="cm"> *</span>
|
||||
<span class="cm"> * 1. :type:`nghttp2_recv_callback` is invoked one or more times to</span>
|
||||
<span class="cm"> * receive frame header.</span>
|
||||
<span class="cm"> *</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"> * 1. :member:`nghttp2_session_callbacks.recv_callback` is invoked one</span>
|
||||
<span class="cm"> * or more times to receive frame header.</span>
|
||||
<span class="cm"> * 2. If the frame is DATA frame:</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"> * :type:`nghttp2_on_frame_recv_callback` is invoked. If the</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"> * :member:`nghttp2_session_callbacks.on_frame_recv_callback` is</span>
|
||||
<span class="cm"> * invoked. If the reception of the frame triggers the</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"> * 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"> * 1. :type:`nghttp2_recv_callback` is invoked one or more times to</span>
|
||||
<span class="cm"> * receive whole frame.</span>
|
||||
<span class="cm"> * 1. :member:`nghttp2_session_callbacks.recv_callback` is invoked</span>
|
||||
<span class="cm"> * one or more times to receive whole frame.</span>
|
||||
<span class="cm"> *</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"> * :type:`nghttp2_on_begin_headers_callback` is invoked. Then</span>
|
||||
<span class="cm"> * :type:`nghttp2_on_header_callback` is invoked for each header</span>
|
||||
<span class="cm"> * name/value pair. After all name/value pairs are emitted</span>
|
||||
<span class="cm"> * successfully, :type:`nghttp2_on_frame_recv_callback` is</span>
|
||||
<span class="cm"> * :member:`nghttp2_session_callbacks.on_begin_headers_callback`</span>
|
||||
<span class="cm"> * is invoked. Then</span>
|
||||
<span class="cm"> * :member:`nghttp2_session_callbacks.on_header_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"> * :type:`nghttp2_on_frame_recv_callback` is invoked. If the</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"> * :member:`nghttp2_session_callbacks.on_frame_recv_callback` is</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"> * This function returns 0 if it succeeds, or one of the following</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"> *</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"> * |in| is the only data for the invocation of this function. If all</span>
|
||||
<span class="cm"> * bytes are processed, this function returns. The other callbacks</span>
|
||||
<span class="cm"> * are called in the same way as they are in `nghttp2_session_recv()`.</span>
|
||||
<span class="cm"> * does not use :member:`nghttp2_session_callbacks.recv_callback` to</span>
|
||||
<span class="cm"> * receive data; the |in| is the only data for the invocation of this</span>
|
||||
<span class="cm"> * function. If all bytes are processed, this function returns. The</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"> * 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"> * :enum:`NGHTTP2_ERR_PAUSE` is returned from</span>
|
||||
<span class="cm"> * :type:`nghttp2_on_header_callback` or</span>
|
||||
<span class="cm"> * :type:`nghttp2_on_data_chunk_recv_callback`. If</span>
|
||||
<span class="cm"> * :enum:`NGHTTP2_ERR_PAUSE` is used, the return value includes the</span>
|
||||
<span class="cm"> * :member:`nghttp2_session_callbacks.on_header_callback` or</span>
|
||||
<span class="cm"> * :member:`nghttp2_session_callbacks.on_data_chunk_recv_callback`.</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"> * callback.</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"> * :type:`nghttp2_on_frame_recv_callback` was called most recently.</span>
|
||||
<span class="cm"> *</span>
|
||||
<span class="cm"> * The |error_code| is the error code of this GOAWAY frame. The</span>
|
||||
<span class="cm"> * pre-defined error code is one of :enum:`nghttp2_error_code`.</span>
|
||||
<span class="cm"> * The |error_code| is the error code of this GOAWAY frame.</span>
|
||||
<span class="cm"> *</span>
|
||||
<span class="cm"> * After the transmission, both `nghttp2_session_want_read()` and</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"> */</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"> * @function</span>
|
||||
|
@ -2372,7 +2241,7 @@
|
|||
<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">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"> * @function</span>
|
||||
|
@ -2567,8 +2436,8 @@
|
|||
<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"> * frame to that stream ID before</span>
|
||||
<span class="cm"> * :type:`nghttp2_before_frame_send_callback` is called for this</span>
|
||||
<span class="cm"> * frame.</span>
|
||||
<span class="cm"> * :member:`nghttp2_session_callbacks.before_frame_send_callback` is</span>
|
||||
<span class="cm"> * called for this frame.</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>
|
||||
|
@ -2693,8 +2562,8 @@
|
|||
<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"> * 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"> * frame.</span>
|
||||
<span class="cm"> * :member:`nghttp2_session_callbacks.before_frame_send_callback` is</span>
|
||||
<span class="cm"> * called for this frame.</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>
|
||||
|
@ -2767,8 +2636,6 @@
|
|||
<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"> *</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"> * :enum:`NGHTTP2_FLAG_NONE`.</span>
|
||||
<span class="cm"> *</span>
|
||||
|
@ -2782,7 +2649,7 @@
|
|||
<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">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"> * @function</span>
|
||||
|
@ -2870,8 +2737,8 @@
|
|||
<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"> * 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"> * frame.</span>
|
||||
<span class="cm"> * :member:`nghttp2_session_callbacks.before_frame_send_callback` is</span>
|
||||
<span class="cm"> * called for this frame.</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>
|
||||
|
@ -2909,8 +2776,6 @@
|
|||
<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"> *</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"> * :enum:`NGHTTP2_FLAG_NONE`.</span>
|
||||
<span class="cm"> *</span>
|
||||
|
@ -2937,7 +2802,7 @@
|
|||
<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">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="cm">/**</span>
|
||||
|
|
BIN
objects.inv
BIN
objects.inv
Binary file not shown.
|
@ -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
|
||||
<tt class="docutils literal"><span class="pre">h2load</span></tt>, the following package is required:</p>
|
||||
<ul class="simple">
|
||||
<li>spdylay >= 1.3.0</li>
|
||||
<li>spdylay >= 1.2.3</li>
|
||||
</ul>
|
||||
<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>
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -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>
|
||||
<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="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">&</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">nghttp2_session_callbacks_set_on_frame_recv_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="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">&</span><span class="n">session_data</span><span class="o">-></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="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">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">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_client_new</span><span class="p">(</span><span class="o">&</span><span class="n">session_data</span><span class="o">-></span><span class="n">session</span><span class="p">,</span> <span class="o">&</span><span class="n">callbacks</span><span class="p">,</span> <span class="n">session_data</span><span class="p">);</span>
|
||||
<span class="p">}</span>
|
||||
</pre></div>
|
||||
</div>
|
||||
|
@ -489,9 +474,11 @@ frames. The <tt class="docutils literal"><span class="pre">session_send()</span>
|
|||
</pre></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
|
||||
format and call <tt class="docutils literal"><span class="pre">send_callback()</span></tt> function of type
|
||||
<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
|
||||
follows:</p>
|
||||
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
|
||||
it. We set <tt class="docutils literal"><span class="pre">send_callback()</span></tt> function to
|
||||
<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>
|
||||
<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>
|
||||
|
@ -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>
|
||||
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
|
||||
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
|
||||
<tt class="docutils literal"><span class="pre">EWOULDBLOCK</span></tt> since the socket has limited send 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 signal the
|
||||
nghttp2 library to stop sending further data. But writing to the
|
||||
bufferevent, we have to regulate the amount data to be buffered by
|
||||
ourselves to avoid possible huge memory consumption. In this example
|
||||
client, we do not limit 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>
|
||||
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
|
||||
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
|
||||
send 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 signal the nghttp2 library to stop
|
||||
sending further data. But writing to the bufferevent, we have to
|
||||
regulate the amount data to be buffered by ourselves to avoid possible
|
||||
huge memory consumption. In this example client, we do not limit
|
||||
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
|
||||
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>
|
||||
|
@ -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="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">&</span><span class="n">callbacks</span><span class="p">);</span>
|
||||
<span class="n">memset</span><span class="p">(</span><span class="o">&</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">nghttp2_session_callbacks_set_on_frame_recv_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="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">&</span><span class="n">session_data</span><span class="o">-></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="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">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">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_client_new</span><span class="p">(</span><span class="o">&</span><span class="n">session_data</span><span class="o">-></span><span class="n">session</span><span class="p">,</span> <span class="o">&</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="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>
|
||||
|
|
|
@ -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>
|
||||
<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="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">&</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">nghttp2_session_callbacks_set_on_frame_recv_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="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">&</span><span class="n">session_data</span><span class="o">-></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="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">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">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_server_new</span><span class="p">(</span><span class="o">&</span><span class="n">session_data</span><span class="o">-></span><span class="n">session</span><span class="p">,</span> <span class="o">&</span><span class="n">callbacks</span><span class="p">,</span> <span class="n">session_data</span><span class="p">);</span>
|
||||
<span class="p">}</span>
|
||||
</pre></div>
|
||||
</div>
|
||||
|
@ -512,9 +499,11 @@ frames. The <tt class="docutils literal"><span class="pre">session_send()</span>
|
|||
</pre></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
|
||||
format and calls <tt class="docutils literal"><span class="pre">send_callback()</span></tt> of type
|
||||
<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
|
||||
follows:</p>
|
||||
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
|
||||
it. We set the <tt class="docutils literal"><span class="pre">send_callback()</span></tt> function to
|
||||
<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>
|
||||
<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>
|
||||
|
@ -531,20 +520,20 @@ follows:</p>
|
|||
<span class="p">}</span>
|
||||
</pre></div>
|
||||
</div>
|
||||
<p>Since we use bufferevent to abstract network I/O, we just write the
|
||||
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
|
||||
data to a 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 would surely get <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 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 signal the
|
||||
nghttp2 library to stop sending further data. But when writing to the
|
||||
bufferevent, we have to regulate the amount data to get buffered
|
||||
ourselves to avoid using huge amounts of memory. To achieve this, we
|
||||
check the size of the output buffer and if it reaches more than or
|
||||
equal to <tt class="docutils literal"><span class="pre">OUTPUT_WOULDBLOCK_THRESHOLD</span></tt> bytes, we stop writing data
|
||||
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
|
||||
calling send_callback.</p>
|
||||
<p>Since we use bufferevent to abstract network I/O, we just write the 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 data to a non-blocking socket
|
||||
directly using <tt class="docutils literal"><span class="pre">write()</span></tt> system call 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 would surely get
|
||||
<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
|
||||
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
|
||||
signal the nghttp2 library to stop sending further data. But when writing to
|
||||
the bufferevent, we have to regulate the amount data to get buffered ourselves
|
||||
to avoid using huge amounts of memory. To achieve this, we check the size of
|
||||
the output buffer and if it reaches more than or equal to
|
||||
<tt class="docutils literal"><span class="pre">OUTPUT_WOULDBLOCK_THRESHOLD</span></tt> bytes, we stop writing data 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 calling
|
||||
send_callback.</p>
|
||||
<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>
|
||||
<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="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">&</span><span class="n">callbacks</span><span class="p">);</span>
|
||||
<span class="n">memset</span><span class="p">(</span><span class="o">&</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">nghttp2_session_callbacks_set_on_frame_recv_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="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">&</span><span class="n">session_data</span><span class="o">-></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="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">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">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_server_new</span><span class="p">(</span><span class="o">&</span><span class="n">session_data</span><span class="o">-></span><span class="n">session</span><span class="p">,</span> <span class="o">&</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="cm">/* Send HTTP/2 client connection header, which includes 24 bytes</span>
|
||||
|
|
Loading…
Reference in New Issue