Loading...
Searching...
No Matches
Functions
network.c File Reference

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"
Include dependency graph for network.c:

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_endpointimquic_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.
 

Detailed Description

Networking utilities.

Author
Lorenzo Miniero loren.nosp@m.zo@m.nosp@m.eetec.nosp@m.ho.c.nosp@m.om

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.

Function Documentation

◆ imquic_network_address_str()

char * imquic_network_address_str ( imquic_network_address * address,
char * output,
size_t outlen )

Helper to serialize a network address to a string.

Parameters
[in]addressThe imquic_network_address instance to serialize
[out]outputThe buffer to put the serialized string into
[in]outlenThe size of the output buffer
Returns
A pointer to output, if successful, or NULL otherwise

◆ imquic_network_endpoint_add_connection()

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.

Parameters
neThe imquic_network_endpoint instance to add the connection to
connThe imquic_connection instance to add to the endpoint
lock_mutexWhether the endpoint mutex should be used to protect the action (to avoid double locks)

◆ imquic_network_endpoint_create()

imquic_network_endpoint * imquic_network_endpoint_create ( imquic_configuration * config)

Helper to create a new imquic_network_endpoint instance from a imquic_configuration object.

Parameters
configThe imquic_configuration object to use to configure and create the new endpoint
Returns
A pointer to a new imquic_network_endpoint instance, if successful, or NULL otherwise

◆ imquic_network_endpoint_destroy()

void imquic_network_endpoint_destroy ( imquic_network_endpoint * ne)

Helper to destroy an existing endpoint instance.

Parameters
neThe imquic_network_endpoint instance to destroy

◆ imquic_network_endpoint_remove_connection()

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.

Parameters
neThe imquic_network_endpoint instance to remove the connection from
connThe imquic_connection instance to remove from the endpoint
lock_mutexWhether the endpoint mutex should be used to protect the action (to avoid double locks)

◆ imquic_network_endpoint_shutdown()

void imquic_network_endpoint_shutdown ( imquic_network_endpoint * ne)

Helper to shutdown an existing endpoint.

Parameters
neThe imquic_network_endpoint instance to shut down

◆ imquic_network_send()

int imquic_network_send ( imquic_connection * conn,
uint8_t * bytes,
size_t blen )

Helper to send data on a connection.

Parameters
connThe imquic_connection instance to send the data on
bytesThe data to send
blenthe size of the data to send
Returns
0 in case of success, a negative integer otherwise