Loading...
Searching...
No Matches
Data Structures | Typedefs | Functions
loop.c File Reference

Event loop. More...

#include <stdlib.h>
#include <stdint.h>
#include <stdio.h>
#include <string.h>
#include <inttypes.h>
#include <unistd.h>
#include <arpa/inet.h>
#include "internal/loop.h"
#include "internal/network.h"
#include "internal/quic.h"
#include "imquic/debug.h"
Include dependency graph for loop.c:

Data Structures

struct  imquic_network_source
 
struct  imquic_connection_source
 

Typedefs

typedef struct imquic_network_source imquic_network_source
 
typedef struct imquic_connection_source imquic_connection_source
 

Functions

int imquic_loop_init (void)
 Initialize the event loop.
 
void imquic_loop_wakeup (void)
 Helper method to wake the event loop, in case it's waiting for something and we need to refresh the list of events to monitor.
 
void imquic_loop_deinit (void)
 Uninitialize the event loop.
 
imquic_sourceimquic_loop_poll_endpoint (void *e)
 Monitor an endpoint socket as part of the loop.
 
imquic_sourceimquic_loop_poll_connection (void *c)
 Monitor events associated to a connection in the core as part of the loop.
 
imquic_sourceimquic_loop_add_timer (guint ms, GSourceFunc func, gpointer data)
 Helper method to add a timed source to the loop, to fire the provided callback every tot milliseconds and passing the provided data.
 

Detailed Description

Event loop.

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

Implementation of an event loop to be used in the imquic library internals, mostly for networking and the dispatching of some events.

Typedef Documentation

◆ imquic_connection_source

typedef struct imquic_connection_source imquic_connection_source

◆ imquic_network_source

typedef struct imquic_network_source imquic_network_source

Function Documentation

◆ imquic_loop_add_timer()

imquic_source * imquic_loop_add_timer ( guint ms,
GSourceFunc func,
gpointer data )

Helper method to add a timed source to the loop, to fire the provided callback every tot milliseconds and passing the provided data.

Parameters
msCall the callback every tot milliseconds
funcCallback to invoke when the regular timer fires
dataOptional user data to pass to the callback function, for correlation purposes
Returns
A pointer to the imquic_source, if successful, or NULL otherwise

◆ imquic_loop_deinit()

void imquic_loop_deinit ( void )

Uninitialize the event loop.

◆ imquic_loop_init()

int imquic_loop_init ( void )

Initialize the event loop.

◆ imquic_loop_poll_connection()

imquic_source * imquic_loop_poll_connection ( void * c)

Monitor events associated to a connection in the core as part of the loop.

Parameters
cOpaque pointer to a imquic_connection instance
Returns
A pointer to the imquic_source, if successful, or NULL otherwise

◆ imquic_loop_poll_endpoint()

imquic_source * imquic_loop_poll_endpoint ( void * e)

Monitor an endpoint socket as part of the loop.

Parameters
eOpaque pointer to a imquic_network_endpoint instance
Returns
A pointer to the imquic_source, if successful, or NULL otherwise

◆ imquic_loop_wakeup()

void imquic_loop_wakeup ( void )

Helper method to wake the event loop, in case it's waiting for something and we need to refresh the list of events to monitor.