ngtcp2_conn_client_new

Synopsis

#include <ngtcp2/ngtcp2.h>

int ngtcp2_conn_client_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_client_new() creates new ngtcp2_conn, and initializes it as client. On success, it stores the pointer to the newly allocated object in *pconn. dcid is a randomized Destination Connection ID which must be longer than or equal to NGTCP2_MIN_INITIAL_DCIDLEN. scid is a Source Connection ID chosen by client. client_chosen_version is a QUIC version that a client chooses. path is the network path where this QUIC connection is being established, and must not be NULL. 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.