OpenVPN
Data Structures | Macros | Functions
event.c File Reference
#include "syshead.h"
#include "buffer.h"
#include "error.h"
#include "integer.h"
#include "event.h"
#include "fdmisc.h"
#include "memdbg.h"
Include dependency graph for event.c:

Go to the source code of this file.

Data Structures

struct  we_set
 

Macros

#define SELECT   0
 
#define SELECT_MAX_FDS   256
 

Functions

static int tv_to_ms_timeout (const struct timeval *tv)
 Convert timeval value (which is in seconds and microseconds) to a value of milliseconds which is required by multiple polling APIs.
 
static void we_set_event (struct we_set *wes, int i, event_t event, unsigned int rwflags, void *arg)
 
static bool we_append_event (struct we_set *wes, event_t event, unsigned int rwflags, void *arg)
 
static void we_del_event (struct we_set *wes, event_t event)
 
static void we_del_index (struct we_set *wes, int index)
 
static void we_get_rw_indices (struct we_set *wes, event_t event, int *ri, int *wi)
 
static void we_free (struct event_set *es)
 
static void we_reset (struct event_set *es)
 
static void we_del (struct event_set *es, event_t event)
 
static void we_ctl (struct event_set *es, event_t event, unsigned int rwflags, void *arg)
 
static int we_wait (struct event_set *es, const struct timeval *tv, struct event_set_return *out, int outlen)
 
static struct event_setwe_init (int *maxevents, unsigned int flags)
 
static struct event_setevent_set_init_simple (int *maxevents, unsigned int flags)
 
static struct event_setevent_set_init_scalable (int *maxevents, unsigned int flags)
 
struct event_setevent_set_init (int *maxevents, unsigned int flags)
 

Macro Definition Documentation

◆ SELECT

#define SELECT   0

Definition at line 53 of file event.c.

◆ SELECT_MAX_FDS

#define SELECT_MAX_FDS   256

Definition at line 65 of file event.c.

Function Documentation

◆ event_set_init()

struct event_set * event_set_init ( int *  maxevents,
unsigned int  flags 
)

◆ event_set_init_scalable()

static struct event_set * event_set_init_scalable ( int *  maxevents,
unsigned int  flags 
)
static

Definition at line 1159 of file event.c.

References ASSERT, event_set_init_simple(), M_WARN, and msg.

Referenced by event_set_init().

◆ event_set_init_simple()

static struct event_set * event_set_init_simple ( int *  maxevents,
unsigned int  flags 
)
static

Definition at line 1116 of file event.c.

References ASSERT, EVENT_METHOD_US_TIMEOUT, and we_init().

Referenced by event_set_init(), and event_set_init_scalable().

◆ tv_to_ms_timeout()

static int tv_to_ms_timeout ( const struct timeval *  tv)
inlinestatic

Convert timeval value (which is in seconds and microseconds) to a value of milliseconds which is required by multiple polling APIs.

Parameters
tvtimeval to convert
Returns
Milliseconds to wait. Zero if tv is zero. Otherwise the return value is always greater than zero.

Definition at line 78 of file event.c.

References max_int().

Referenced by we_wait().

◆ we_append_event()

static bool we_append_event ( struct we_set wes,
event_t  event,
unsigned int  rwflags,
void *  arg 
)
inlinestatic

◆ we_ctl()

static void we_ctl ( struct event_set es,
event_t  event,
unsigned int  rwflags,
void *  arg 
)
static

◆ we_del()

static void we_del ( struct event_set es,
event_t  event 
)
static

Definition at line 234 of file event.c.

References ASSERT, es, we_set::fast, and we_del_event().

Referenced by we_init().

◆ we_del_event()

static void we_del_event ( struct we_set wes,
event_t  event 
)
static

Definition at line 158 of file event.c.

References we_set::esr, we_set::events, i, we_set::n_events, rw_handle::read, and rw_handle::write.

Referenced by we_ctl(), and we_del().

◆ we_del_index()

static void we_del_index ( struct we_set wes,
int  index 
)
static

Definition at line 183 of file event.c.

References ASSERT, we_set::esr, we_set::events, i, and we_set::n_events.

Referenced by we_ctl().

◆ we_free()

static void we_free ( struct event_set es)
static

Definition at line 217 of file event.c.

References es, we_set::esr, and we_set::events.

Referenced by we_init().

◆ we_get_rw_indices()

static void we_get_rw_indices ( struct we_set wes,
event_t  event,
int *  ri,
int *  wi 
)
static

Definition at line 196 of file event.c.

References ASSERT, we_set::events, i, we_set::n_events, rw_handle::read, and rw_handle::write.

Referenced by we_ctl().

◆ we_init()

static struct event_set * we_init ( int *  maxevents,
unsigned int  flags 
)
static

◆ we_reset()

static void we_reset ( struct event_set es)
static

Definition at line 226 of file event.c.

References ASSERT, es, we_set::fast, and we_set::n_events.

Referenced by we_init().

◆ we_set_event()

static void we_set_event ( struct we_set wes,
int  i,
event_t  event,
unsigned int  rwflags,
void *  arg 
)
inlinestatic

◆ we_wait()

static int we_wait ( struct event_set es,
const struct timeval *  tv,
struct event_set_return out,
int  outlen 
)
static