1
2nghttp2_submit_extension
3========================
4
5Synopsis
6--------
7
8*#include <nghttp2/nghttp2.h>*
9
10.. function:: int nghttp2_submit_extension(nghttp2_session *session, uint8_t type, uint8_t flags, int32_t stream_id, void *payload)
11
12
13    Submits extension frame.
14
15    Application can pass arbitrary frame flags and stream ID in *flags*
16    and *stream_id* respectively.  The *payload* is opaque pointer, and
17    it can be accessible though ``frame->ext.payload`` in
18    :type:`nghttp2_pack_extension_callback`.  The library will not own
19    passed *payload* pointer.
20
21    The application must set :type:`nghttp2_pack_extension_callback`
22    using `nghttp2_session_callbacks_set_pack_extension_callback()`.
23
24    The application should retain the memory pointed by *payload* until
25    the transmission of extension frame is done (which is indicated by
26    :type:`nghttp2_on_frame_send_callback`), or transmission fails
27    (which is indicated by :type:`nghttp2_on_frame_not_send_callback`).
28    If application does not touch this memory region after packing it
29    into a wire format, application can free it inside
30    :type:`nghttp2_pack_extension_callback`.
31
32    The standard HTTP/2 frame cannot be sent with this function, so
33    *type* must be strictly grater than 0x9.  Otherwise, this function
34    will fail with error code
35    :macro:`nghttp2_error.NGHTTP2_ERR_INVALID_ARGUMENT`.
36
37    This function returns 0 if it succeeds, or one of the following
38    negative error codes:
39
40    :macro:`nghttp2_error.NGHTTP2_ERR_INVALID_STATE`
41        If :type:`nghttp2_pack_extension_callback` is not set.
42    :macro:`nghttp2_error.NGHTTP2_ERR_INVALID_ARGUMENT`
43        If  *type* specifies  standard  HTTP/2 frame  type.  The  frame
44        types  in the  rage [0x0,  0x9], both  inclusive, are  standard
45        HTTP/2 frame type, and cannot be sent using this function.
46    :macro:`nghttp2_error.NGHTTP2_ERR_NOMEM`
47        Out of memory
48