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

Event loop (headers) More...

#include <stdint.h>
#include <glib.h>
#include "network.h"
Include dependency graph for loop.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  imquic_source
 Event source base. More...
 
struct  imquic_connection_event
 Events meant for connections. More...
 

Typedefs

typedef struct imquic_source imquic_source
 Event source base.
 
typedef struct imquic_connection_event imquic_connection_event
 Events meant for connections.
 

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.
 
Adding sources to the 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 (headers)

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_event

typedef struct imquic_connection_event imquic_connection_event

Events meant for connections.

◆ imquic_source

typedef struct imquic_source imquic_source

Event source base.

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.