Update doc

This commit is contained in:
Tatsuhiro Tsujikawa 2014-01-17 02:42:44 +09:00
parent 4a6c86f67e
commit 16bc89e743
8 changed files with 218 additions and 53 deletions

View File

@ -800,21 +800,10 @@ Types (structs, unions and typedefs)
argument passed in to the call to `nghttp2_session_client_new()` or
`nghttp2_session_server_new()`.
If the application uses `nghttp2_session_mem_recv()`, it can return
:macro:`NGHTTP2_ERR_PAUSE` to make `nghttp2_session_mem_recv()`
return without processing further input bytes. The *frame*
parameter is retained until `nghttp2_session_continue()` is
called. The application must retain the input bytes which was used
to produce the *frame* parameter, because it may refer to the
memory region included in the input bytes. The application which
returns :macro:`NGHTTP2_ERR_PAUSE` must call
`nghttp2_session_continue()` before `nghttp2_session_mem_recv()`.
The implementation of this function must return 0 if it
succeeds. It may return :macro:`NGHTTP2_ERR_PAUSE`. If the other
nonzero value is returned, it is treated as fatal error and
`nghttp2_session_recv()` and `nghttp2_session_send()` functions
immediately return :macro:`NGHTTP2_ERR_CALLBACK_FAILURE`.
succeeds. If nonzero value is returned, it is treated as fatal
error and `nghttp2_session_recv()` and `nghttp2_session_mem_recv()`
functions immediately return :macro:`NGHTTP2_ERR_CALLBACK_FAILURE`.
.. type:: typedef int (*nghttp2_on_invalid_frame_recv_callback) (nghttp2_session *session, const nghttp2_frame *frame, nghttp2_error_code error_code, void *user_data)
@ -857,7 +846,7 @@ Types (structs, unions and typedefs)
The implementation of this function must return 0 if it
succeeds. If nonzero is returned, it is treated as fatal error and
`nghttp2_session_recv()` and `nghttp2_session_send()` functions
`nghttp2_session_recv()` and `nghttp2_session_mem_recv()` functions
immediately return :macro:`NGHTTP2_ERR_CALLBACK_FAILURE`.
.. type:: typedef int (*nghttp2_on_data_recv_callback) (nghttp2_session *session, uint16_t length, uint8_t flags, int32_t stream_id, void *user_data)
@ -1001,6 +990,53 @@ Types (structs, unions and typedefs)
`nghttp2_session_recv()` and `nghttp2_session_send()` functions
immediately return :macro:`NGHTTP2_ERR_CALLBACK_FAILURE`.
.. type:: typedef int (*nghttp2_on_header_callback) (nghttp2_session *session, const nghttp2_frame *frame, const uint8_t *name, size_t namelen, const uint8_t *value, size_t valuelen, void *user_data)
Callback function invoked when a header name/value pair is received
for the *frame*. When this callback is invoked, ``frame->hd.type``
is either :macro:`NGHTTP2_HEADERS` or :macro:`NGHTTP2_PUSH_PROMISE`.
After all header name/value pairs are processed with this callback,
or header decompression error occurred, then
:type:`nghttp2_on_end_headers_callback` will be invoked unless
application returns nonzero value from this callback.
The *name* may be ``NULL`` if the *namelen* is 0. The same thing
can be said about the *value*.
If the application uses `nghttp2_session_mem_recv()`, it can return
:macro:`NGHTTP2_ERR_PAUSE` to make `nghttp2_session_mem_recv()`
return without processing further input bytes. The *frame*,
*name*, *namelen*, *value* and *valuelen* parameters are retained
until `nghttp2_session_continue()` is called. The application must
retain the input bytes which was used to produce the *frame*
parameter, because it may refer to the memory region included in
the input bytes. The application which returns
:macro:`NGHTTP2_ERR_PAUSE` must call `nghttp2_session_continue()`
before `nghttp2_session_mem_recv()`.
The implementation of this function must return 0 if it
succeeds. It may return :macro:`NGHTTP2_ERR_PAUSE`. If the other
nonzero value is returned, it is treated as fatal error and
`nghttp2_session_recv()` and `nghttp2_session_mem_recv()` functions
immediately return :macro:`NGHTTP2_ERR_CALLBACK_FAILURE`.
.. type:: typedef int (*nghttp2_on_end_headers_callback) (nghttp2_session *session, const nghttp2_frame *frame, nghttp2_error_code error_code, void *user_data)
Callback function invoked when all header name/value pairs are
processed or after the header decompression error is detected. If
the *error_code* is :macro:`NGHTTP2_NO_ERROR`, it indicates the
header decompression succeeded. Otherwise, error prevented the
completion of the header decompression. In this case, the library
will handle the error by either transmitting RST_STREAM or GOAWAY
and terminate session.
The implementation of this function must return 0 if it
succeeds. If nonzero value is returned, it is treated as fatal
error and `nghttp2_session_recv()` and `nghttp2_session_mem_recv()`
functions immediately return :macro:`NGHTTP2_ERR_CALLBACK_FAILURE`.
.. type:: nghttp2_session_callbacks
@ -1057,6 +1093,14 @@ Types (structs, unions and typedefs)
Callback function invoked when the received frame type is
unknown.
.. member:: nghttp2_on_header_callback on_header_callback
Callback function invoked when a header name/value pair is
received.
.. member:: nghttp2_on_end_headers_callback on_end_headers_callback
Callback function invoked when all header name/value pairs are
processed.
.. type:: nghttp2_opt_set
@ -1814,8 +1858,6 @@ Functions
:macro:`NGHTTP2_ERR_INVALID_ARGUMENT`
The *nva* includes empty name, or name which contains invalid
characters.
:macro:`NGHTTP2_ERR_STREAM_CLOSED`
The stream is already closed or does not exist.
:macro:`NGHTTP2_ERR_NOMEM`
Out of memory.

View File

@ -1307,20 +1307,10 @@ typedef int <tt class="descname">(*nghttp2_on_frame_recv_callback)</tt><big>(</b
non-DATA frame is received. The <em>user_data</em> pointer is the third
argument passed in to the call to <a class="reference internal" href="#nghttp2_session_client_new" title="nghttp2_session_client_new"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_client_new()</span></tt></a> or
<a class="reference internal" href="#nghttp2_session_server_new" title="nghttp2_session_server_new"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_server_new()</span></tt></a>.</p>
<p>If the application uses <a class="reference internal" href="#nghttp2_session_mem_recv" title="nghttp2_session_mem_recv"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_mem_recv()</span></tt></a>, it can return
<a class="reference internal" href="#NGHTTP2_ERR_PAUSE" title="NGHTTP2_ERR_PAUSE"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_ERR_PAUSE</span></tt></a> to make <a class="reference internal" href="#nghttp2_session_mem_recv" title="nghttp2_session_mem_recv"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_mem_recv()</span></tt></a>
return without processing further input bytes. The <em>frame</em>
parameter is retained until <a class="reference internal" href="#nghttp2_session_continue" title="nghttp2_session_continue"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_continue()</span></tt></a> is
called. The application must retain the input bytes which was used
to produce the <em>frame</em> parameter, because it may refer to the
memory region included in the input bytes. The application which
returns <a class="reference internal" href="#NGHTTP2_ERR_PAUSE" title="NGHTTP2_ERR_PAUSE"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_ERR_PAUSE</span></tt></a> must call
<a class="reference internal" href="#nghttp2_session_continue" title="nghttp2_session_continue"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_continue()</span></tt></a> before <a class="reference internal" href="#nghttp2_session_mem_recv" title="nghttp2_session_mem_recv"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_mem_recv()</span></tt></a>.</p>
<p>The implementation of this function must return 0 if it
succeeds. It may return <a class="reference internal" href="#NGHTTP2_ERR_PAUSE" title="NGHTTP2_ERR_PAUSE"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_ERR_PAUSE</span></tt></a>. If the other
nonzero value is returned, it is treated as fatal error and
<a class="reference internal" href="#nghttp2_session_recv" title="nghttp2_session_recv"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_recv()</span></tt></a> and <a class="reference internal" href="#nghttp2_session_send" title="nghttp2_session_send"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_send()</span></tt></a> functions
immediately return <a class="reference internal" href="#NGHTTP2_ERR_CALLBACK_FAILURE" title="NGHTTP2_ERR_CALLBACK_FAILURE"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_ERR_CALLBACK_FAILURE</span></tt></a>.</p>
succeeds. If nonzero value is returned, it is treated as fatal
error and <a class="reference internal" href="#nghttp2_session_recv" title="nghttp2_session_recv"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_recv()</span></tt></a> and <a class="reference internal" href="#nghttp2_session_mem_recv" title="nghttp2_session_mem_recv"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_mem_recv()</span></tt></a>
functions immediately return <a class="reference internal" href="#NGHTTP2_ERR_CALLBACK_FAILURE" title="NGHTTP2_ERR_CALLBACK_FAILURE"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_ERR_CALLBACK_FAILURE</span></tt></a>.</p>
</dd></dl>
<dl class="type">
@ -1362,7 +1352,7 @@ returns <a class="reference internal" href="#NGHTTP2_ERR_PAUSE" title="NGHTTP2_E
<a class="reference internal" href="#nghttp2_session_continue" title="nghttp2_session_continue"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_continue()</span></tt></a> before <a class="reference internal" href="#nghttp2_session_mem_recv" title="nghttp2_session_mem_recv"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_mem_recv()</span></tt></a>.</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="#nghttp2_session_recv" title="nghttp2_session_recv"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_recv()</span></tt></a> and <a class="reference internal" href="#nghttp2_session_send" title="nghttp2_session_send"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_send()</span></tt></a> functions
<a class="reference internal" href="#nghttp2_session_recv" title="nghttp2_session_recv"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_recv()</span></tt></a> and <a class="reference internal" href="#nghttp2_session_mem_recv" title="nghttp2_session_mem_recv"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_mem_recv()</span></tt></a> functions
immediately return <a class="reference internal" href="#NGHTTP2_ERR_CALLBACK_FAILURE" title="NGHTTP2_ERR_CALLBACK_FAILURE"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_ERR_CALLBACK_FAILURE</span></tt></a>.</p>
</dd></dl>
@ -1507,6 +1497,51 @@ succeeds. If nonzero is returned, it is treated as fatal error and
immediately return <a class="reference internal" href="#NGHTTP2_ERR_CALLBACK_FAILURE" title="NGHTTP2_ERR_CALLBACK_FAILURE"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_ERR_CALLBACK_FAILURE</span></tt></a>.</p>
</dd></dl>
<dl class="type">
<dt id="nghttp2_on_header_callback">
typedef int <tt class="descname">(*nghttp2_on_header_callback)</tt><big>(</big><a class="reference internal" href="#nghttp2_session" title="nghttp2_session">nghttp2_session</a><em>&nbsp;*session</em>, const <a class="reference internal" href="#nghttp2_frame" title="nghttp2_frame">nghttp2_frame</a><em>&nbsp;*frame</em>, const uint8_t<em>&nbsp;*name</em>, size_t<em>&nbsp;namelen</em>, const uint8_t<em>&nbsp;*value</em>, size_t<em>&nbsp;valuelen</em>, void<em>&nbsp;*user_data</em><big>)</big><a class="headerlink" href="#nghttp2_on_header_callback" title="Permalink to this definition"></a></dt>
<dd><p>Callback function invoked when a header name/value pair is received
for the <em>frame</em>. When this callback is invoked, <tt class="docutils literal"><span class="pre">frame-&gt;hd.type</span></tt>
is either <a class="reference internal" href="#NGHTTP2_HEADERS" title="NGHTTP2_HEADERS"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_HEADERS</span></tt></a> or <a class="reference internal" href="#NGHTTP2_PUSH_PROMISE" title="NGHTTP2_PUSH_PROMISE"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_PUSH_PROMISE</span></tt></a>.
After all header name/value pairs are processed with this callback,
or header decompression error occurred, then
<a class="reference internal" href="#nghttp2_on_end_headers_callback" title="nghttp2_on_end_headers_callback"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_on_end_headers_callback</span></tt></a> will be invoked unless
application returns nonzero value from this callback.</p>
<p>The <em>name</em> may be <tt class="docutils literal"><span class="pre">NULL</span></tt> if the <em>namelen</em> is 0. The same thing
can be said about the <em>value</em>.</p>
<p>If the application uses <a class="reference internal" href="#nghttp2_session_mem_recv" title="nghttp2_session_mem_recv"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_mem_recv()</span></tt></a>, it can return
<a class="reference internal" href="#NGHTTP2_ERR_PAUSE" title="NGHTTP2_ERR_PAUSE"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_ERR_PAUSE</span></tt></a> to make <a class="reference internal" href="#nghttp2_session_mem_recv" title="nghttp2_session_mem_recv"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_mem_recv()</span></tt></a>
return without processing further input bytes. The <em>frame</em>,
<em>name</em>, <em>namelen</em>, <em>value</em> and <em>valuelen</em> parameters are retained
until <a class="reference internal" href="#nghttp2_session_continue" title="nghttp2_session_continue"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_continue()</span></tt></a> is called. The application must
retain the input bytes which was used to produce the <em>frame</em>
parameter, because it may refer to the memory region included in
the input bytes. The application which returns
<a class="reference internal" href="#NGHTTP2_ERR_PAUSE" title="NGHTTP2_ERR_PAUSE"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_ERR_PAUSE</span></tt></a> must call <a class="reference internal" href="#nghttp2_session_continue" title="nghttp2_session_continue"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_continue()</span></tt></a>
before <a class="reference internal" href="#nghttp2_session_mem_recv" title="nghttp2_session_mem_recv"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_mem_recv()</span></tt></a>.</p>
<p>The implementation of this function must return 0 if it
succeeds. It may return <a class="reference internal" href="#NGHTTP2_ERR_PAUSE" title="NGHTTP2_ERR_PAUSE"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_ERR_PAUSE</span></tt></a>. If the other
nonzero value is returned, it is treated as fatal error and
<a class="reference internal" href="#nghttp2_session_recv" title="nghttp2_session_recv"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_recv()</span></tt></a> and <a class="reference internal" href="#nghttp2_session_mem_recv" title="nghttp2_session_mem_recv"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_mem_recv()</span></tt></a> functions
immediately return <a class="reference internal" href="#NGHTTP2_ERR_CALLBACK_FAILURE" title="NGHTTP2_ERR_CALLBACK_FAILURE"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_ERR_CALLBACK_FAILURE</span></tt></a>.</p>
</dd></dl>
<dl class="type">
<dt id="nghttp2_on_end_headers_callback">
typedef int <tt class="descname">(*nghttp2_on_end_headers_callback)</tt><big>(</big><a class="reference internal" href="#nghttp2_session" title="nghttp2_session">nghttp2_session</a><em>&nbsp;*session</em>, const <a class="reference internal" href="#nghttp2_frame" title="nghttp2_frame">nghttp2_frame</a><em>&nbsp;*frame</em>, <a class="reference internal" href="#nghttp2_error_code" title="nghttp2_error_code">nghttp2_error_code</a><em>&nbsp;error_code</em>, void<em>&nbsp;*user_data</em><big>)</big><a class="headerlink" href="#nghttp2_on_end_headers_callback" title="Permalink to this definition"></a></dt>
<dd><p>Callback function invoked when all header name/value pairs are
processed or after the header decompression error is detected. If
the <em>error_code</em> is <a class="reference internal" href="#NGHTTP2_NO_ERROR" title="NGHTTP2_NO_ERROR"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_NO_ERROR</span></tt></a>, it indicates the
header decompression succeeded. Otherwise, error prevented the
completion of the header decompression. In this case, the library
will handle the error by either transmitting RST_STREAM or GOAWAY
and terminate session.</p>
<p>The implementation of this function must return 0 if it
succeeds. If nonzero value is returned, it is treated as fatal
error and <a class="reference internal" href="#nghttp2_session_recv" title="nghttp2_session_recv"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_recv()</span></tt></a> and <a class="reference internal" href="#nghttp2_session_mem_recv" title="nghttp2_session_mem_recv"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_mem_recv()</span></tt></a>
functions immediately return <a class="reference internal" href="#NGHTTP2_ERR_CALLBACK_FAILURE" title="NGHTTP2_ERR_CALLBACK_FAILURE"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_ERR_CALLBACK_FAILURE</span></tt></a>.</p>
</dd></dl>
<dl class="type">
<dt id="nghttp2_session_callbacks">
<tt class="descname">nghttp2_session_callbacks</tt><a class="headerlink" href="#nghttp2_session_callbacks" title="Permalink to this definition"></a></dt>
@ -1604,6 +1639,20 @@ could not be parsed correctly.</p>
unknown.</p>
</dd></dl>
<dl class="member">
<dt id="nghttp2_session_callbacks.on_header_callback">
<a class="reference internal" href="#nghttp2_on_header_callback" title="nghttp2_on_header_callback">nghttp2_on_header_callback</a> <tt class="descname">on_header_callback</tt><a class="headerlink" href="#nghttp2_session_callbacks.on_header_callback" title="Permalink to this definition"></a></dt>
<dd><p>Callback function invoked when a header name/value pair is
received.</p>
</dd></dl>
<dl class="member">
<dt id="nghttp2_session_callbacks.on_end_headers_callback">
<a class="reference internal" href="#nghttp2_on_end_headers_callback" title="nghttp2_on_end_headers_callback">nghttp2_on_end_headers_callback</a> <tt class="descname">on_end_headers_callback</tt><a class="headerlink" href="#nghttp2_session_callbacks.on_end_headers_callback" title="Permalink to this definition"></a></dt>
<dd><p>Callback function invoked when all header name/value pairs are
processed.</p>
</dd></dl>
</dd></dl>
<dl class="type">
@ -2345,8 +2394,6 @@ negative error codes:</p>
<dt><a class="reference internal" href="#NGHTTP2_ERR_INVALID_ARGUMENT" title="NGHTTP2_ERR_INVALID_ARGUMENT"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_ERR_INVALID_ARGUMENT</span></tt></a></dt>
<dd>The <em>nva</em> includes empty name, or name which contains invalid
characters.</dd>
<dt><a class="reference internal" href="#NGHTTP2_ERR_STREAM_CLOSED" title="NGHTTP2_ERR_STREAM_CLOSED"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_ERR_STREAM_CLOSED</span></tt></a></dt>
<dd>The stream is already closed or does not exist.</dd>
<dt><a class="reference internal" href="#NGHTTP2_ERR_NOMEM" title="NGHTTP2_ERR_NOMEM"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_ERR_NOMEM</span></tt></a></dt>
<dd>Out of memory.</dd>
</dl>

View File

@ -607,15 +607,19 @@
</dt>
<dt><a href="apiref.html#nghttp2_on_end_headers_callback">nghttp2_on_end_headers_callback (C type)</a>
</dt>
<dt><a href="apiref.html#nghttp2_on_frame_not_send_callback">nghttp2_on_frame_not_send_callback (C type)</a>
</dt>
</dl></td>
<td style="width: 33%" valign="top"><dl>
<dt><a href="apiref.html#nghttp2_on_frame_recv_callback">nghttp2_on_frame_recv_callback (C type)</a>
</dt>
</dl></td>
<td style="width: 33%" valign="top"><dl>
<dt><a href="apiref.html#nghttp2_on_frame_recv_parse_error_callback">nghttp2_on_frame_recv_parse_error_callback (C type)</a>
</dt>
@ -625,6 +629,10 @@
</dt>
<dt><a href="apiref.html#nghttp2_on_header_callback">nghttp2_on_header_callback (C type)</a>
</dt>
<dt><a href="apiref.html#nghttp2_on_invalid_frame_recv_callback">nghttp2_on_invalid_frame_recv_callback (C type)</a>
</dt>
@ -809,6 +817,10 @@
</dt>
<dt><a href="apiref.html#nghttp2_session_callbacks.on_end_headers_callback">nghttp2_session_callbacks.on_end_headers_callback (C member)</a>
</dt>
<dt><a href="apiref.html#nghttp2_session_callbacks.on_frame_not_send_callback">nghttp2_session_callbacks.on_frame_not_send_callback (C member)</a>
</dt>
@ -821,6 +833,10 @@
</dt>
<dt><a href="apiref.html#nghttp2_session_callbacks.on_header_callback">nghttp2_session_callbacks.on_header_callback (C member)</a>
</dt>
<dt><a href="apiref.html#nghttp2_session_callbacks.on_invalid_frame_recv_callback">nghttp2_session_callbacks.on_invalid_frame_recv_callback (C member)</a>
</dt>

View File

@ -1008,21 +1008,10 @@
<span class="cm"> * argument passed in to the call to `nghttp2_session_client_new()` or</span>
<span class="cm"> * `nghttp2_session_server_new()`.</span>
<span class="cm"> *</span>
<span class="cm"> * If the application uses `nghttp2_session_mem_recv()`, it can return</span>
<span class="cm"> * :enum:`NGHTTP2_ERR_PAUSE` to make `nghttp2_session_mem_recv()`</span>
<span class="cm"> * return without processing further input bytes. The |frame|</span>
<span class="cm"> * parameter is retained until `nghttp2_session_continue()` is</span>
<span class="cm"> * called. The application must retain the input bytes which was used</span>
<span class="cm"> * to produce the |frame| parameter, because it may refer to the</span>
<span class="cm"> * memory region included in the input bytes. The application which</span>
<span class="cm"> * returns :enum:`NGHTTP2_ERR_PAUSE` must call</span>
<span class="cm"> * `nghttp2_session_continue()` before `nghttp2_session_mem_recv()`.</span>
<span class="cm"> *</span>
<span class="cm"> * The implementation of this function must return 0 if it</span>
<span class="cm"> * succeeds. It may return :enum:`NGHTTP2_ERR_PAUSE`. If the other</span>
<span class="cm"> * nonzero value 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"> * succeeds. If nonzero value is returned, it is treated as fatal</span>
<span class="cm"> * error and `nghttp2_session_recv()` and `nghttp2_session_mem_recv()`</span>
<span class="cm"> * functions 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_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>
@ -1072,7 +1061,7 @@
<span class="cm"> *</span>
<span class="cm"> * The implementation of this function must return 0 if it</span>
<span class="cm"> * succeeds. If nonzero is returned, it is treated as fatal error and</span>
<span class="cm"> * `nghttp2_session_recv()` and `nghttp2_session_send()` functions</span>
<span class="cm"> * `nghttp2_session_recv()` and `nghttp2_session_mem_recv()` 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_data_chunk_recv_callback</span><span class="p">)</span>
@ -1257,6 +1246,66 @@
<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>
<span class="cm"> * @functypedef</span>
<span class="cm"> *</span>
<span class="cm"> * Callback function invoked when a header name/value pair is received</span>
<span class="cm"> * for the |frame|. When this callback is invoked, ``frame-&gt;hd.type``</span>
<span class="cm"> * is either :enum:`NGHTTP2_HEADERS` or :enum:`NGHTTP2_PUSH_PROMISE`.</span>
<span class="cm"> * After all header name/value pairs are processed with this callback,</span>
<span class="cm"> * or header decompression error occurred, then</span>
<span class="cm"> * :type:`nghttp2_on_end_headers_callback` will be invoked unless</span>
<span class="cm"> * application returns nonzero value from this callback.</span>
<span class="cm"> *</span>
<span class="cm"> * The |name| may be ``NULL`` if the |namelen| is 0. The same thing</span>
<span class="cm"> * can be said about the |value|.</span>
<span class="cm"> *</span>
<span class="cm"> * If the application uses `nghttp2_session_mem_recv()`, it can return</span>
<span class="cm"> * :enum:`NGHTTP2_ERR_PAUSE` to make `nghttp2_session_mem_recv()`</span>
<span class="cm"> * return without processing further input bytes. The |frame|,</span>
<span class="cm"> * |name|, |namelen|, |value| and |valuelen| parameters are retained</span>
<span class="cm"> * until `nghttp2_session_continue()` is called. The application must</span>
<span class="cm"> * retain the input bytes which was used to produce the |frame|</span>
<span class="cm"> * parameter, because it may refer to the memory region included in</span>
<span class="cm"> * the input bytes. The application which returns</span>
<span class="cm"> * :enum:`NGHTTP2_ERR_PAUSE` must call `nghttp2_session_continue()`</span>
<span class="cm"> * before `nghttp2_session_mem_recv()`.</span>
<span class="cm"> *</span>
<span class="cm"> * The implementation of this function must return 0 if it</span>
<span class="cm"> * succeeds. It may return :enum:`NGHTTP2_ERR_PAUSE`. If the other</span>
<span class="cm"> * 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="k">typedef</span> <span class="nf">int</span> <span class="p">(</span><span class="o">*</span><span class="n">nghttp2_on_header_callback</span><span class="p">)</span>
<span class="p">(</span><span class="n">nghttp2_session</span> <span class="o">*</span><span class="n">session</span><span class="p">,</span>
<span class="k">const</span> <span class="n">nghttp2_frame</span> <span class="o">*</span><span class="n">frame</span><span class="p">,</span>
<span class="k">const</span> <span class="kt">uint8_t</span> <span class="o">*</span><span class="n">name</span><span class="p">,</span> <span class="kt">size_t</span> <span class="n">namelen</span><span class="p">,</span>
<span class="k">const</span> <span class="kt">uint8_t</span> <span class="o">*</span><span class="n">value</span><span class="p">,</span> <span class="kt">size_t</span> <span class="n">valuelen</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 all header name/value pairs are</span>
<span class="cm"> * processed or after the header decompression error is detected. If</span>
<span class="cm"> * the |error_code| is :enum:`NGHTTP2_NO_ERROR`, it indicates the</span>
<span class="cm"> * header decompression succeeded. Otherwise, error prevented the</span>
<span class="cm"> * completion of the header decompression. In this case, the library</span>
<span class="cm"> * will handle the error by either transmitting RST_STREAM or GOAWAY</span>
<span class="cm"> * and terminate session.</span>
<span class="cm"> *</span>
<span class="cm"> * The implementation of this function must return 0 if it</span>
<span class="cm"> * succeeds. If nonzero value is returned, it is treated as fatal</span>
<span class="cm"> * error and `nghttp2_session_recv()` and `nghttp2_session_mem_recv()`</span>
<span class="cm"> * functions 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_end_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="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"> * @struct</span>
<span class="cm"> *</span>
@ -1329,6 +1378,16 @@
<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 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 all header name/value pairs are</span>
<span class="cm"> * processed.</span>
<span class="cm"> */</span>
<span class="n">nghttp2_on_end_headers_callback</span> <span class="n">on_end_headers_callback</span><span class="p">;</span>
<span class="p">}</span> <span class="n">nghttp2_session_callbacks</span><span class="p">;</span>
<span class="cm">/**</span>
@ -2222,8 +2281,6 @@
<span class="cm"> * :enum:`NGHTTP2_ERR_INVALID_ARGUMENT`</span>
<span class="cm"> * The |nva| includes empty name, or name which contains invalid</span>
<span class="cm"> * characters.</span>
<span class="cm"> * :enum:`NGHTTP2_ERR_STREAM_CLOSED`</span>
<span class="cm"> * The stream is already closed or does not exist.</span>
<span class="cm"> * :enum:`NGHTTP2_ERR_NOMEM`</span>
<span class="cm"> * Out of memory.</span>
<span class="cm"> */</span>

Binary file not shown.

File diff suppressed because one or more lines are too long

View File

@ -606,6 +606,8 @@ here.</p>
<span class="cm"> */</span>
<span class="cp">#include &lt;sys/types.h&gt;</span>
<span class="cp">#include &lt;unistd.h&gt;</span>
<span class="cp">#include &lt;sys/socket.h&gt;</span>
<span class="cp">#include &lt;netinet/in.h&gt;</span>
<span class="cp">#include &lt;netinet/tcp.h&gt;</span>
<span class="cp">#include &lt;err.h&gt;</span>
<span class="cp">#include &lt;signal.h&gt;</span>

View File

@ -738,6 +738,7 @@ stream is about to close and we no longer use that object.</p>
<span class="cp">#include &lt;sys/stat.h&gt;</span>
<span class="cp">#include &lt;fcntl.h&gt;</span>
<span class="cp">#include &lt;ctype.h&gt;</span>
<span class="cp">#include &lt;netinet/in.h&gt;</span>
<span class="cp">#include &lt;netinet/tcp.h&gt;</span>
<span class="cp">#include &lt;err.h&gt;</span>