Update doc

This commit is contained in:
Tatsuhiro Tsujikawa 2014-04-27 16:33:36 +09:00
parent c47e764f59
commit 56175a5544
5 changed files with 91 additions and 10 deletions

View File

@ -1816,6 +1816,30 @@ 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>.</p>
</dd></dl>
<dl class="type">
<dt id="c.nghttp2_adjust_priority_callback">
typedef int <tt class="descname">(*nghttp2_adjust_priority_callback)</tt><big>(</big><a class="reference internal" href="#c.nghttp2_session" title="nghttp2_session">nghttp2_session</a><em>&nbsp;*session</em>, const <a class="reference internal" href="#c.nghttp2_frame" title="nghttp2_frame">nghttp2_frame</a><em>&nbsp;*frame</em>, <a class="reference internal" href="#c.nghttp2_priority_spec" title="nghttp2_priority_spec">nghttp2_priority_spec</a><em>&nbsp;*pri_spec</em>, void<em>&nbsp;*user_data</em><big>)</big><a class="headerlink" href="#c.nghttp2_adjust_priority_callback" title="Permalink to this definition"></a></dt>
<dd><p>Callback function invoked to adjust priority value for request
HEADERS. This callback is called only for request HEADERS (which
means, <tt class="xref c c-func docutils literal"><span class="pre">frame-&gt;hd.type</span> <span class="pre">==</span> <span class="pre">NGHTTP2_HEADERS</span> <span class="pre">&amp;&amp;</span> <span class="pre">frame-&gt;headers.cat</span> <span class="pre">==</span>
<span class="pre">NGHTTP2_HCAT_REQUEST()</span></tt> hold) and before
<tt class="xref c c-type docutils literal"><span class="pre">nghttp2_before_frame_send_callback()</span></tt>. The application can
adjust priority value <em>pri_spec</em>. Initially, <em>pri_spec</em> is filled
with the current priority value, which is equal to
<tt class="xref c c-func docutils literal"><span class="pre">frame-&gt;headers.pri_spec()</span></tt>. If the application doesn&#8217;t alter
priority value, just return 0 without updating <em>pri_spec</em>.</p>
<p>Since the application doesn&#8217;t know stream ID when it submits
requests, it may not be able to add correct priority value to
HEADERS frame and forced to use follwing PRIORITY frame. The
purpose of this callback is give the chance to the application to
adjust priority value with the latest information it has just
before transmission so that correct priority is included in HEADERS
frame and it doesn&#8217;t have to send additional PRIORITY frame.</p>
<p>Returning <a class="reference internal" href="#c.NGHTTP2_ERR_CALLBACK_FAILURE" title="NGHTTP2_ERR_CALLBACK_FAILURE"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_ERR_CALLBACK_FAILURE</span></tt></a> will make
<a class="reference internal" href="#c.nghttp2_session_send" title="nghttp2_session_send"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_send()</span></tt></a> function immediately return
<a class="reference internal" href="#c.NGHTTP2_ERR_CALLBACK_FAILURE" title="NGHTTP2_ERR_CALLBACK_FAILURE"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_ERR_CALLBACK_FAILURE</span></tt></a>.</p>
</dd></dl>
<dl class="type">
<dt id="c.nghttp2_session_callbacks">
<tt class="descname">nghttp2_session_callbacks</tt><a class="headerlink" href="#c.nghttp2_session_callbacks" title="Permalink to this definition"></a></dt>
@ -1913,6 +1937,13 @@ many padding bytes are required for the transmission of the given
frame.</p>
</dd></dl>
<dl class="member">
<dt id="c.nghttp2_session_callbacks.adjust_priority_callback">
<a class="reference internal" href="#c.nghttp2_adjust_priority_callback" title="nghttp2_adjust_priority_callback">nghttp2_adjust_priority_callback</a> <tt class="descname">adjust_priority_callback</tt><a class="headerlink" href="#c.nghttp2_session_callbacks.adjust_priority_callback" title="Permalink to this definition"></a></dt>
<dd><p>Callback function invoked to adjust priority value just before
request HEADERS is serialized to the wire format.</p>
</dd></dl>
</dd></dl>
<dl class="type">
@ -2093,6 +2124,9 @@ which tells when each callback is invoked:</p>
are not met (e.g., request HEADERS cannot be sent after GOAWAY),
<a class="reference internal" href="#c.nghttp2_session_callbacks.on_frame_not_send_callback" title="nghttp2_session_callbacks.on_frame_not_send_callback"><tt class="xref c c-member docutils literal"><span class="pre">nghttp2_session_callbacks.on_frame_not_send_callback</span></tt></a>
is invoked. Abort the following steps.</li>
<li>If the frame is request HEADERS,
<a class="reference internal" href="#c.nghttp2_session_callbacks.adjust_priority_callback" title="nghttp2_session_callbacks.adjust_priority_callback"><tt class="xref c c-member docutils literal"><span class="pre">nghttp2_session_callbacks.adjust_priority_callback</span></tt></a> is
invoked.</li>
<li>If the frame is HEADERS, PUSH_PROMISE or DATA,
<a class="reference internal" href="#c.nghttp2_session_callbacks.select_padding_callback" title="nghttp2_session_callbacks.select_padding_callback"><tt class="xref c c-member docutils literal"><span class="pre">nghttp2_session_callbacks.select_padding_callback</span></tt></a> is
invoked.</li>

View File

@ -167,6 +167,10 @@
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%" valign="top"><dl>
<dt><a href="apiref.html#c.nghttp2_adjust_priority_callback">nghttp2_adjust_priority_callback (C type)</a>
</dt>
<dt><a href="apiref.html#c.NGHTTP2_ALTSVC">NGHTTP2_ALTSVC (C macro)</a>
</dt>
@ -1001,6 +1005,10 @@
</dt>
<dt><a href="apiref.html#c.nghttp2_session_callbacks.adjust_priority_callback">nghttp2_session_callbacks.adjust_priority_callback (C member)</a>
</dt>
<dt><a href="apiref.html#c.nghttp2_session_callbacks.before_frame_send_callback">nghttp2_session_callbacks.before_frame_send_callback (C member)</a>
</dt>

View File

@ -1580,6 +1580,37 @@
<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 to adjust priority value for request</span>
<span class="cm"> * HEADERS. This callback is called only for request HEADERS (which</span>
<span class="cm"> * means, `frame-&gt;hd.type == NGHTTP2_HEADERS &amp;&amp; frame-&gt;headers.cat ==</span>
<span class="cm"> * NGHTTP2_HCAT_REQUEST` hold) and before</span>
<span class="cm"> * :type:`nghttp2_before_frame_send_callback()`. The application can</span>
<span class="cm"> * adjust priority value |pri_spec|. Initially, |pri_spec| is filled</span>
<span class="cm"> * with the current priority value, which is equal to</span>
<span class="cm"> * `frame-&gt;headers.pri_spec`. If the application doesn&#39;t alter</span>
<span class="cm"> * priority value, just return 0 without updating |pri_spec|.</span>
<span class="cm"> *</span>
<span class="cm"> * Since the application doesn&#39;t know stream ID when it submits</span>
<span class="cm"> * requests, it may not be able to add correct priority value to</span>
<span class="cm"> * HEADERS frame and forced to use follwing PRIORITY frame. The</span>
<span class="cm"> * purpose of this callback is give the chance to the application to</span>
<span class="cm"> * adjust priority value with the latest information it has just</span>
<span class="cm"> * before transmission so that correct priority is included in HEADERS</span>
<span class="cm"> * frame and it doesn&#39;t have to send additional PRIORITY frame.</span>
<span class="cm"> *</span>
<span class="cm"> * Returning :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="k">typedef</span> <span class="nf">int</span> <span class="p">(</span><span class="o">*</span><span class="n">nghttp2_adjust_priority_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_priority_spec</span> <span class="o">*</span><span class="n">pri_spec</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>
@ -1653,6 +1684,11 @@
<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="cm">/**</span>
<span class="cm"> * Callback function invoked to adjust priority value just before</span>
<span class="cm"> * request HEADERS is serialized to the wire format.</span>
<span class="cm"> */</span>
<span class="n">nghttp2_adjust_priority_callback</span> <span class="n">adjust_priority_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>
@ -1859,20 +1895,23 @@
<span class="cm"> * are not met (e.g., request HEADERS cannot be sent after GOAWAY),</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"> * 4. If the frame is request HEADERS,</span>
<span class="cm"> * :member:`nghttp2_session_callbacks.adjust_priority_callback` is</span>
<span class="cm"> * invoked.</span>
<span class="cm"> * 5. If the frame is HEADERS, PUSH_PROMISE or DATA,</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"> * 6. :member:`nghttp2_session_callbacks.before_frame_send_callback` is</span>
<span class="cm"> * 6. If the frame is request HEADERS, the stream is opened here.</span>
<span class="cm"> * 7. :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"> * 8. :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"> * :member:`nghttp2_session_callbacks.on_stream_close_callback` is</span>
<span class="cm"> * 9. :member:`nghttp2_session_callbacks.on_frame_send_callback` is</span>
<span class="cm"> * invoked.</span>
<span class="cm"> * 10. If the transmission of the frame triggers closure of the stream,</span>
<span class="cm"> * the stream is closed and</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>

Binary file not shown.

File diff suppressed because one or more lines are too long