lander/include/event_loop.h

34 lines
696 B
C

#ifndef LANDER_EVENT_LOOP
#define LANDER_EVENT_LOOP
// Size of the read and write buffers for each connection, in bytes
#define EVENT_LOOP_BUFFER_SIZE 1024
/**
* Represents an active connection managed by the event loop
*/
typedef struct event_loop_conn event_loop_conn;
typedef enum {
event_loop_conn_state_req = 0,
event_loop_conn_state_res = 1,
event_loop_conn_state_end = 2,
} event_loop_conn_state;
/*
* Main struct object representing the event loop
*/
typedef struct event_loop event_loop;
/*
* Initialize a new event loop
*/
event_loop *event_loop_init();
/*
* Run the event loop. This function never returns.
*/
void event_loop_run(event_loop *el, int port);
#endif