Networking utilities. More...
#include <stdlib.h>
#include <stdint.h>
#include <stdio.h>
#include <string.h>
#include <inttypes.h>
#include <unistd.h>
#include <arpa/inet.h>
#include <sys/socket.h>
#include <netdb.h>
#include <ifaddrs.h>
#include <net/if.h>
#include "internal/network.h"
#include "internal/loop.h"
#include "internal/quic.h"
#include "internal/utils.h"
#include "imquic/debug.h"
Functions | |
char * | imquic_network_address_str (imquic_network_address *address, char *output, size_t outlen) |
Helper to serialize a network address to a string. | |
void | imquic_network_endpoint_add_connection (imquic_network_endpoint *ne, imquic_connection *conn, gboolean lock_mutex) |
Helper to add a new connection to the list of connections originated by this endpoint. | |
void | imquic_network_endpoint_remove_connection (imquic_network_endpoint *ne, imquic_connection *conn, gboolean lock_mutex) |
Helper to remove an existing connection from the list of connections originated by this endpoint. | |
void | imquic_network_endpoint_shutdown (imquic_network_endpoint *ne) |
Helper to shutdown an existing endpoint. | |
void | imquic_network_endpoint_destroy (imquic_network_endpoint *ne) |
Helper to destroy an existing endpoint instance. | |
imquic_network_endpoint * | imquic_network_endpoint_create (imquic_configuration *config) |
Helper to create a new imquic_network_endpoint instance from a imquic_configuration object. | |
int | imquic_network_send (imquic_connection *conn, uint8_t *bytes, size_t blen) |
Helper to send data on a connection. | |
Networking utilities.
Implementation of the networking functionality of the QUIC stack. This is where client and server instances are allocated and managed, taking care of actually sending data out, and to notify upper layers about new connections or data coming in. The networking stack relies on a separate event loop for polling the sockets.
char * imquic_network_address_str | ( | imquic_network_address * | address, |
char * | output, | ||
size_t | outlen ) |
Helper to serialize a network address to a string.
[in] | address | The imquic_network_address instance to serialize |
[out] | output | The buffer to put the serialized string into |
[in] | outlen | The size of the output buffer |
void imquic_network_endpoint_add_connection | ( | imquic_network_endpoint * | ne, |
imquic_connection * | conn, | ||
gboolean | lock_mutex ) |
Helper to add a new connection to the list of connections originated by this endpoint.
ne | The imquic_network_endpoint instance to add the connection to |
conn | The imquic_connection instance to add to the endpoint |
lock_mutex | Whether the endpoint mutex should be used to protect the action (to avoid double locks) |
imquic_network_endpoint * imquic_network_endpoint_create | ( | imquic_configuration * | config | ) |
Helper to create a new imquic_network_endpoint instance from a imquic_configuration object.
config | The imquic_configuration object to use to configure and create the new endpoint |
void imquic_network_endpoint_destroy | ( | imquic_network_endpoint * | ne | ) |
Helper to destroy an existing endpoint instance.
ne | The imquic_network_endpoint instance to destroy |
void imquic_network_endpoint_remove_connection | ( | imquic_network_endpoint * | ne, |
imquic_connection * | conn, | ||
gboolean | lock_mutex ) |
Helper to remove an existing connection from the list of connections originated by this endpoint.
ne | The imquic_network_endpoint instance to remove the connection from |
conn | The imquic_connection instance to remove from the endpoint |
lock_mutex | Whether the endpoint mutex should be used to protect the action (to avoid double locks) |
void imquic_network_endpoint_shutdown | ( | imquic_network_endpoint * | ne | ) |
Helper to shutdown an existing endpoint.
ne | The imquic_network_endpoint instance to shut down |
int imquic_network_send | ( | imquic_connection * | conn, |
uint8_t * | bytes, | ||
size_t | blen ) |
Helper to send data on a connection.
conn | The imquic_connection instance to send the data on |
bytes | The data to send |
blen | the size of the data to send |