Loading...
Searching...
No Matches
Data Structures | Typedefs | Functions
network.h File Reference

Networking utilities (headers) More...

#include <stdint.h>
#include <sys/socket.h>
#include "../imquic/imquic.h"
#include "configuration.h"
#include "loop.h"
#include "crypto.h"
#include "moq.h"
#include "roq.h"
#include "refcount.h"
Include dependency graph for network.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  imquic_network_address
 Abstraction of a network address. More...
 
struct  imquic_network_endpoint
 Abstraction of a network endpoint (client or server) More...
 

Typedefs

typedef struct imquic_network_address imquic_network_address
 Abstraction of a network address.
 
typedef struct imquic_network_endpoint imquic_network_endpoint
 Abstraction of a network endpoint (client or server)
 

Functions

char * imquic_network_address_str (imquic_network_address *address, char *output, size_t outlen)
 Helper to serialize a network address to a string.
 
imquic_network_endpointimquic_network_endpoint_create (imquic_configuration *config)
 Helper to create a new imquic_network_endpoint instance from a imquic_configuration object.
 
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.
 
int imquic_network_send (imquic_connection *conn, uint8_t *bytes, size_t blen)
 Helper to send data on a connection.
 

Detailed Description

Networking utilities (headers)

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.

Typedef Documentation

◆ imquic_network_address

typedef struct imquic_network_address imquic_network_address

Abstraction of a network address.

◆ imquic_network_endpoint

typedef struct imquic_network_endpoint imquic_network_endpoint

Abstraction of a network endpoint (client or server)

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