ngtcp2_conn_server_new

Synopsis

#include <ngtcp2/ngtcp2.h>

int ngtcp2_conn_server_new(ngtcp2_conn **pconn, const ngtcp2_cid *dcid, const ngtcp2_cid *scid, const ngtcp2_path *path, uint32_t client_chosen_version, const ngtcp2_callbacks *callbacks, const ngtcp2_settings *settings, const ngtcp2_transport_params *params, const ngtcp2_mem *mem, void *user_data)

ngtcp2_conn_server_new() creates new ngtcp2_conn, and initializes it as server. On success, it stores the pointer to the newly allocated object in *pconn. dcid is a Destination Connection ID, and is usually the Connection ID that appears in client Initial packet as Source Connection ID. scid is a Source Connection ID chosen by server. path is the network path where this QUIC connection is being established, and must not be NULL. client_chosen_version is a QUIC version that a client chooses. callbacks, settings, and params must not be NULL, and the function makes a copy of each of them. params is a local QUIC transport parameters, and sent to a remote endpoint during handshake. user_data is the arbitrary pointer which is passed to the user-defined callback functions. If mem is NULL, the memory allocator returned by ngtcp2_mem_default() is used.

Call ngtcp2_conn_del() to free memory allocated for *pconn.

This function returns 0 if it succeeds, or one of the following negative error codes:

NGTCP2_ERR_NOMEM

Out of memory.