Upgrade to 1.46.0
[platform/upstream/nghttp2.git] / doc / nghttp2_pack_settings_payload.rst
1
2 nghttp2_pack_settings_payload
3 =============================
4
5 Synopsis
6 --------
7
8 *#include <nghttp2/nghttp2.h>*
9
10 .. function:: ssize_t nghttp2_pack_settings_payload( uint8_t *buf, size_t buflen, const nghttp2_settings_entry *iv, size_t niv)
11
12     
13     Serializes the SETTINGS values *iv* in the *buf*.  The size of the
14     *buf* is specified by *buflen*.  The number of entries in the *iv*
15     array is given by *niv*.  The required space in *buf* for the *niv*
16     entries is ``6*niv`` bytes and if the given buffer is too small, an
17     error is returned.  This function is used mainly for creating a
18     SETTINGS payload to be sent with the ``HTTP2-Settings`` header
19     field in an HTTP Upgrade request.  The data written in *buf* is NOT
20     base64url encoded and the application is responsible for encoding.
21     
22     This function returns the number of bytes written in *buf*, or one
23     of the following negative error codes:
24     
25     :macro:`nghttp2_error.NGHTTP2_ERR_INVALID_ARGUMENT`
26         The *iv* contains duplicate settings ID or invalid value.
27     
28     :macro:`nghttp2_error.NGHTTP2_ERR_INSUFF_BUFSIZE`
29         The provided *buflen* size is too small to hold the output.