Commit 3a0c0870 authored by Tatsuhiro Tsujikawa's avatar Tatsuhiro Tsujikawa

Update doc

parent 5caecebc
...@@ -709,7 +709,9 @@ Types (structs, unions and typedefs) ...@@ -709,7 +709,9 @@ Types (structs, unions and typedefs)
not used and always 0. It must return the number of bytes sent if not used and always 0. It must return the number of bytes sent if
it succeeds. If it cannot send any single byte without blocking, it succeeds. If it cannot send any single byte without blocking,
it must return :macro:`NGHTTP2_ERR_WOULDBLOCK`. For other errors, it it must return :macro:`NGHTTP2_ERR_WOULDBLOCK`. For other errors, it
must return :macro:`NGHTTP2_ERR_CALLBACK_FAILURE`. must return :macro:`NGHTTP2_ERR_CALLBACK_FAILURE`. The *user_data*
pointer is the third argument passed in to the call to
`nghttp2_session_client_new()` or `nghttp2_session_server_new()`.
.. type:: typedef ssize_t (*nghttp2_recv_callback) (nghttp2_session *session, uint8_t *buf, size_t length, int flags, void *user_data) .. type:: typedef ssize_t (*nghttp2_recv_callback) (nghttp2_session *session, uint8_t *buf, size_t length, int flags, void *user_data)
...@@ -723,13 +725,17 @@ Types (structs, unions and typedefs) ...@@ -723,13 +725,17 @@ Types (structs, unions and typedefs)
it gets EOF before it reads any single byte, it must return it gets EOF before it reads any single byte, it must return
:macro:`NGHTTP2_ERR_EOF`. For other errors, it must return :macro:`NGHTTP2_ERR_EOF`. For other errors, it must return
:macro:`NGHTTP2_ERR_CALLBACK_FAILURE`. Returning 0 is treated as :macro:`NGHTTP2_ERR_CALLBACK_FAILURE`. Returning 0 is treated as
:macro:`NGHTTP2_ERR_WOULDBLOCK`. :macro:`NGHTTP2_ERR_WOULDBLOCK`. The *user_data* pointer is the
third argument passed in to the call to
`nghttp2_session_client_new()` or `nghttp2_session_server_new()`.
.. type:: typedef int (*nghttp2_on_frame_recv_callback) (nghttp2_session *session, const nghttp2_frame *frame, void *user_data) .. type:: typedef int (*nghttp2_on_frame_recv_callback) (nghttp2_session *session, const nghttp2_frame *frame, void *user_data)
Callback function invoked by `nghttp2_session_recv()` when a Callback function invoked by `nghttp2_session_recv()` when a
non-DATA frame is received. non-DATA frame is received. The *user_data* pointer is the third
argument passed in to the call to `nghttp2_session_client_new()` or
`nghttp2_session_server_new()`.
The implementation of this function must return 0 if it The implementation of this function must return 0 if it
succeeds. If nonzero is returned, it is treated as fatal error and succeeds. If nonzero is returned, it is treated as fatal error and
...@@ -743,7 +749,9 @@ Types (structs, unions and typedefs) ...@@ -743,7 +749,9 @@ Types (structs, unions and typedefs)
invalid non-DATA frame is received. The *error_code* is one of the invalid non-DATA frame is received. The *error_code* is one of the
:macro:`nghttp2_error_code` and indicates the error. When this :macro:`nghttp2_error_code` and indicates the error. When this
callback function is invoked, the library automatically submits callback function is invoked, the library automatically submits
either RST_STREAM or GOAWAY frame. either RST_STREAM or GOAWAY frame. The *user_data* pointer is the
third argument passed in to the call to
`nghttp2_session_client_new()` or `nghttp2_session_server_new()`.
The implementation of this function must return 0 if it The implementation of this function must return 0 if it
succeeds. If nonzero is returned, it is treated as fatal error and succeeds. If nonzero is returned, it is treated as fatal error and
...@@ -759,7 +767,9 @@ Types (structs, unions and typedefs) ...@@ -759,7 +767,9 @@ Types (structs, unions and typedefs)
contained. ``(flags & NGHTTP2_FLAG_END_STREAM) != 0`` does not contained. ``(flags & NGHTTP2_FLAG_END_STREAM) != 0`` does not
necessarily mean this chunk of data is the last one in the necessarily mean this chunk of data is the last one in the
stream. You should use :type:`nghttp2_on_data_recv_callback` to stream. You should use :type:`nghttp2_on_data_recv_callback` to
know all data frames are received. know all data frames are received. The *user_data* pointer is the
third argument passed in to the call to
`nghttp2_session_client_new()` or `nghttp2_session_server_new()`.
The implementation of this function must return 0 if it The implementation of this function must return 0 if it
succeeds. If nonzero is returned, it is treated as fatal error and succeeds. If nonzero is returned, it is treated as fatal error and
...@@ -771,7 +781,9 @@ Types (structs, unions and typedefs) ...@@ -771,7 +781,9 @@ Types (structs, unions and typedefs)
Callback function invoked when DATA frame is received. The actual Callback function invoked when DATA frame is received. The actual
data it contains are received by data it contains are received by
:type:`nghttp2_on_data_chunk_recv_callback`. :type:`nghttp2_on_data_chunk_recv_callback`. The *user_data*
pointer is the third argument passed in to the call to
`nghttp2_session_client_new()` or `nghttp2_session_server_new()`.
The implementation of this function must return 0 if it The implementation of this function must return 0 if it
succeeds. If nonzero is returned, it is treated as fatal error and succeeds. If nonzero is returned, it is treated as fatal error and
...@@ -785,7 +797,9 @@ Types (structs, unions and typedefs) ...@@ -785,7 +797,9 @@ Types (structs, unions and typedefs)
sent. This may be useful, for example, to know the stream ID of sent. This may be useful, for example, to know the stream ID of
HEADERS and PUSH_PROMISE frame (see also HEADERS and PUSH_PROMISE frame (see also
`nghttp2_session_get_stream_user_data()`), which is not assigned `nghttp2_session_get_stream_user_data()`), which is not assigned
when it was queued. when it was queued. The *user_data* pointer is the third argument
passed in to the call to `nghttp2_session_client_new()` or
`nghttp2_session_server_new()`.
The implementation of this function must return 0 if it The implementation of this function must return 0 if it
succeeds. If nonzero is returned, it is treated as fatal error and succeeds. If nonzero is returned, it is treated as fatal error and
...@@ -796,6 +810,9 @@ Types (structs, unions and typedefs) ...@@ -796,6 +810,9 @@ Types (structs, unions and typedefs)
Callback function invoked after the non-DATA frame *frame* is sent. Callback function invoked after the non-DATA frame *frame* is sent.
The *user_data* pointer is the third argument passed in to the call
to `nghttp2_session_client_new()` or
`nghttp2_session_server_new()`.
The implementation of this function must return 0 if it The implementation of this function must return 0 if it
succeeds. If nonzero is returned, it is treated as fatal error and succeeds. If nonzero is returned, it is treated as fatal error and
...@@ -808,7 +825,9 @@ Types (structs, unions and typedefs) ...@@ -808,7 +825,9 @@ Types (structs, unions and typedefs)
Callback function invoked after the non-DATA frame *frame* is not Callback function invoked after the non-DATA frame *frame* is not
sent because of the error. The error is indicated by the sent because of the error. The error is indicated by the
*lib_error_code*, which is one of the values defined in *lib_error_code*, which is one of the values defined in
:type:`nghttp2_error`. :type:`nghttp2_error`. The *user_data* pointer is the third
argument passed in to the call to `nghttp2_session_client_new()` or
`nghttp2_session_server_new()`.
The implementation of this function must return 0 if it The implementation of this function must return 0 if it
succeeds. If nonzero is returned, it is treated as fatal error and succeeds. If nonzero is returned, it is treated as fatal error and
...@@ -818,7 +837,9 @@ Types (structs, unions and typedefs) ...@@ -818,7 +837,9 @@ Types (structs, unions and typedefs)
.. type:: typedef int (*nghttp2_on_data_send_callback) (nghttp2_session *session, uint16_t length, uint8_t flags, int32_t stream_id, void *user_data) .. type:: typedef int (*nghttp2_on_data_send_callback) (nghttp2_session *session, uint16_t length, uint8_t flags, int32_t stream_id, void *user_data)
Callback function invoked after DATA frame is sent. Callback function invoked after DATA frame is sent. The *user_data*
pointer is the third argument passed in to the call to
`nghttp2_session_client_new()` or `nghttp2_session_server_new()`.
The implementation of this function must return 0 if it The implementation of this function must return 0 if it
succeeds. If nonzero is returned, it is treated as fatal error and succeeds. If nonzero is returned, it is treated as fatal error and
...@@ -829,10 +850,12 @@ Types (structs, unions and typedefs) ...@@ -829,10 +850,12 @@ Types (structs, unions and typedefs)
Callback function invoked when the stream *stream_id* is Callback function invoked when the stream *stream_id* is
closed. The reason of closure is indicated by the closed. The reason of closure is indicated by the *error_code*. The
*error_code*. The stream_user_data, which was specified in stream_user_data, which was specified in `nghttp2_submit_request()`
`nghttp2_submit_request()` or `nghttp2_submit_headers()`, is or `nghttp2_submit_headers()`, is still available in this
still available in this function. function. The *user_data* pointer is the third argument passed in
to the call to `nghttp2_session_client_new()` or
`nghttp2_session_server_new()`.
The implementation of this function must return 0 if it The implementation of this function must return 0 if it
succeeds. If nonzero is returned, it is treated as fatal error and succeeds. If nonzero is returned, it is treated as fatal error and
...@@ -845,7 +868,9 @@ Types (structs, unions and typedefs) ...@@ -845,7 +868,9 @@ Types (structs, unions and typedefs)
Callback function invoked when the request from the remote peer is Callback function invoked when the request from the remote peer is
received. In other words, the frame with END_STREAM flag set is received. In other words, the frame with END_STREAM flag set is
received. In HTTP, this means HTTP request, including request received. In HTTP, this means HTTP request, including request
body, is fully received. body, is fully received. The *user_data* pointer is the third
argument passed in to the call to `nghttp2_session_client_new()` or
`nghttp2_session_server_new()`.
The implementation of this function must return 0 if it The implementation of this function must return 0 if it
succeeds. If nonzero is returned, it is treated as fatal error and succeeds. If nonzero is returned, it is treated as fatal error and
...@@ -863,8 +888,10 @@ Types (structs, unions and typedefs) ...@@ -863,8 +888,10 @@ Types (structs, unions and typedefs)
words, the *head* is the first 8 bytes of the received frame. The words, the *head* is the first 8 bytes of the received frame. The
*payload* is the pointer to the data portion of the received frame. *payload* is the pointer to the data portion of the received frame.
The *payloadlen* is the length of the *payload*. This is the data The *payloadlen* is the length of the *payload*. This is the data
after the length field. The *lib_error_code* is one of the error code after the length field. The *lib_error_code* is one of the error
defined in :macro:`nghttp2_error` and indicates the error. code defined in :macro:`nghttp2_error` and indicates the error. The
*user_data* pointer is the third argument passed in to the call to
`nghttp2_session_client_new()` or `nghttp2_session_server_new()`.
The implementation of this function must return 0 if it The implementation of this function must return 0 if it
succeeds. If nonzero is returned, it is treated as fatal error and succeeds. If nonzero is returned, it is treated as fatal error and
...@@ -880,7 +907,10 @@ Types (structs, unions and typedefs) ...@@ -880,7 +907,10 @@ Types (structs, unions and typedefs)
spec, the *headlen* is always 8. In other words, the *head* is the spec, the *headlen* is always 8. In other words, the *head* is the
first 8 bytes of the received frame. The *payload* is the pointer first 8 bytes of the received frame. The *payload* is the pointer
to the data portion of the received frame. The *payloadlen* is the to the data portion of the received frame. The *payloadlen* is the
length of the *payload*. This is the data after the length field. length of the *payload*. This is the data after the length
field. The *user_data* pointer is the third argument passed in to
the call to `nghttp2_session_client_new()` or
`nghttp2_session_server_new()`.
The implementation of this function must return 0 if it The implementation of this function must return 0 if it
succeeds. If nonzero is returned, it is treated as fatal error and succeeds. If nonzero is returned, it is treated as fatal error and
...@@ -1278,7 +1308,7 @@ Functions ...@@ -1278,7 +1308,7 @@ Functions
to hold serialized data. The required space for the *niv* entries to hold serialized data. The required space for the *niv* entries
are ``8*niv`` bytes. This function is used mainly for creating are ``8*niv`` bytes. This function is used mainly for creating
SETTINGS payload to be sent with ``HTTP2-Settings`` header field in SETTINGS payload to be sent with ``HTTP2-Settings`` header field in
HTTP Upgrade request. The data written in *buf* is not still HTTP Upgrade request. The data written in *buf* is NOT
base64url encoded and the application is responsible for encoding. base64url encoded and the application is responsible for encoding.
This function returns the number of bytes written in *buf*, or one This function returns the number of bytes written in *buf*, or one
......
This diff is collapsed.
This diff is collapsed.
No preview for this file type
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment