Classes | Defines | Functions | Variables
eloop.c File Reference
#include "includes.h"
#include "common.h"
#include "trace.h"
#include "list.h"
#include "eloop.h"
Include dependency graph for eloop.c:

Go to the source code of this file.

Classes

struct  eloop_data
struct  eloop_signal
struct  eloop_sock
struct  eloop_sock_table
struct  eloop_timeout

Defines

#define eloop_trace_sock_add_ref(table)   do { } while (0)
#define eloop_trace_sock_remove_ref(table)   do { } while (0)

Functions

int eloop_cancel_timeout (eloop_timeout_handler handler, void *eloop_data, void *user_data)
void eloop_destroy (void)
static struct eloop_sock_tableeloop_get_sock_table (eloop_event_type type)
static void eloop_handle_alarm (int sig)
static void eloop_handle_signal (int sig)
int eloop_init (void)
int eloop_is_timeout_registered (eloop_timeout_handler handler, void *eloop_data, void *user_data)
static void eloop_process_pending_signals (void)
int eloop_register_read_sock (int sock, eloop_sock_handler handler, void *eloop_data, void *user_data)
int eloop_register_signal (int sig, eloop_signal_handler handler, void *user_data)
int eloop_register_signal_reconfig (eloop_signal_handler handler, void *user_data)
int eloop_register_signal_terminate (eloop_signal_handler handler, void *user_data)
int eloop_register_sock (int sock, eloop_event_type type, eloop_sock_handler handler, void *eloop_data, void *user_data)
int eloop_register_timeout (unsigned int secs, unsigned int usecs, eloop_timeout_handler handler, void *eloop_data, void *user_data)
static void eloop_remove_timeout (struct eloop_timeout *timeout)
void eloop_run (void)
static int eloop_sock_table_add_sock (struct eloop_sock_table *table, int sock, eloop_sock_handler handler, void *eloop_data, void *user_data)
static void eloop_sock_table_destroy (struct eloop_sock_table *table)
static void eloop_sock_table_dispatch (struct eloop_sock_table *table, fd_set *fds)
static void eloop_sock_table_remove_sock (struct eloop_sock_table *table, int sock)
static void eloop_sock_table_set_fds (struct eloop_sock_table *table, fd_set *fds)
void eloop_terminate (void)
int eloop_terminated (void)
void eloop_unregister_read_sock (int sock)
void eloop_unregister_sock (int sock, eloop_event_type type)
void eloop_wait_for_read_sock (int sock)

Variables

static struct eloop_data eloop

Define Documentation

#define eloop_trace_sock_add_ref (   table)    do { } while (0)

Definition at line 115 of file eloop.c.

#define eloop_trace_sock_remove_ref (   table)    do { } while (0)

Definition at line 116 of file eloop.c.


Function Documentation

int eloop_cancel_timeout ( eloop_timeout_handler  handler,
void *  eloop_data,
void *  user_data 
)

eloop_cancel_timeout - Cancel timeouts : Matching callback function : Matching eloop_data or ELOOP_ALL_CTX to match all : Matching user_data or ELOOP_ALL_CTX to match all Returns: Number of cancelled timeouts

Cancel matching <handler,eloop_data,user_data> timeouts registered with eloop_register_timeout(). ELOOP_ALL_CTX can be used as a wildcard for cancelling all timeouts regardless of eloop_data/user_data.

Definition at line 346 of file eloop.c.

void eloop_destroy ( void  )

eloop_destroy - Free any resources allocated for the event loop

After calling eloop_destroy(), other eloop_* functions must not be called before re-running eloop_init().

Definition at line 566 of file eloop.c.

static struct eloop_sock_table* eloop_get_sock_table ( eloop_event_type  type) [static, read]

Definition at line 262 of file eloop.c.

static void eloop_handle_alarm ( int  sig) [static]

Definition at line 385 of file eloop.c.

static void eloop_handle_signal ( int  sig) [static]

Definition at line 397 of file eloop.c.

int eloop_init ( void  )

eloop_init() - Initialize global event loop data Returns: 0 on success, -1 on failure

This function must be called before any other eloop_* function.

Definition at line 121 of file eloop.c.

int eloop_is_timeout_registered ( eloop_timeout_handler  handler,
void *  eloop_data,
void *  user_data 
)

eloop_is_timeout_registered - Check if a timeout is already registered : Matching callback function : Matching eloop_data : Matching user_data Returns: 1 if the timeout is registered, 0 if the timeout is not registered

Determine if a matching <handler,eloop_data,user_data> timeout is registered with eloop_register_timeout().

Definition at line 368 of file eloop.c.

static void eloop_process_pending_signals ( void  ) [static]

Definition at line 421 of file eloop.c.

int eloop_register_read_sock ( int  sock,
eloop_sock_handler  handler,
void *  eloop_data,
void *  user_data 
)

eloop_register_read_sock - Register handler for read events : File descriptor number for the socket : Callback function to be called when data is available for reading : Callback context data (eloop_ctx) : Callback context data (sock_ctx) Returns: 0 on success, -1 on failure

Register a read socket notifier for the given file descriptor. The handler function will be called whenever data is available for reading from the socket. The handler function is responsible for clearing the event after having processed it in order to avoid eloop from calling the handler again for the same event.

Definition at line 248 of file eloop.c.

int eloop_register_signal ( int  sig,
eloop_signal_handler  handler,
void *  user_data 
)

eloop_register_signal - Register handler for signals : Signal number (e.g., SIGHUP) : Callback function to be called when the signal is received : Callback context data (signal_ctx) Returns: 0 on success, -1 on failure

Register a callback function that will be called when a signal is received. The callback function is actually called only after the system signal handler has returned. This means that the normal limits for sighandlers (i.e., only "safe functions" allowed) do not apply for the registered callback.

Definition at line 446 of file eloop.c.

int eloop_register_signal_reconfig ( eloop_signal_handler  handler,
void *  user_data 
)

eloop_register_signal_reconfig - Register handler for reconfig signals : Callback function to be called when the signal is received : Callback context data (signal_ctx) Returns: 0 on success, -1 on failure

Register a callback function that will be called when a reconfiguration / hangup signal is received. The callback function is actually called only after the system signal handler has returned. This means that the normal limits for sighandlers (i.e., only "safe functions" allowed) do not apply for the registered callback.

This function is a more portable version of eloop_register_signal() since the knowledge of exact details of the signals is hidden in eloop implementation. In case of operating systems using signal(), this function registers a handler for SIGHUP.

Definition at line 480 of file eloop.c.

int eloop_register_signal_terminate ( eloop_signal_handler  handler,
void *  user_data 
)

eloop_register_signal_terminate - Register handler for terminate signals : Callback function to be called when the signal is received : Callback context data (signal_ctx) Returns: 0 on success, -1 on failure

Register a callback function that will be called when a process termination signal is received. The callback function is actually called only after the system signal handler has returned. This means that the normal limits for sighandlers (i.e., only "safe functions" allowed) do not apply for the registered callback.

This function is a more portable version of eloop_register_signal() since the knowledge of exact details of the signals is hidden in eloop implementation. In case of operating systems using signal(), this function registers handlers for SIGINT and SIGTERM.

Definition at line 470 of file eloop.c.

int eloop_register_sock ( int  sock,
eloop_event_type  type,
eloop_sock_handler  handler,
void *  eloop_data,
void *  user_data 
)

eloop_register_sock - Register handler for socket events : File descriptor number for the socket : Type of event to wait for : Callback function to be called when the event is triggered : Callback context data (eloop_ctx) : Callback context data (sock_ctx) Returns: 0 on success, -1 on failure

Register an event notifier for the given socket's file descriptor. The handler function will be called whenever the that event is triggered for the socket. The handler function is responsible for clearing the event after having processed it in order to avoid eloop from calling the handler again for the same event.

Definition at line 277 of file eloop.c.

int eloop_register_timeout ( unsigned int  secs,
unsigned int  usecs,
eloop_timeout_handler  handler,
void *  eloop_data,
void *  user_data 
)

eloop_register_timeout - Register timeout : Number of seconds to the timeout : Number of microseconds to the timeout : Callback function to be called when timeout occurs : Callback context data (eloop_ctx) : Callback context data (sock_ctx) Returns: 0 on success, -1 on failure

Register a timeout that will cause the handler function to be called after given time.

Definition at line 298 of file eloop.c.

static void eloop_remove_timeout ( struct eloop_timeout timeout) [static]

Definition at line 337 of file eloop.c.

void eloop_run ( void  )

eloop_run - Start the event loop

Start the event loop and continue running as long as there are any registered event handlers. This function is run after event loop has been initialized with event_init() and one or more events have been registered.

Definition at line 491 of file eloop.c.

static int eloop_sock_table_add_sock ( struct eloop_sock_table table,
int  sock,
eloop_sock_handler  handler,
void *  eloop_data,
void *  user_data 
) [static]

Definition at line 132 of file eloop.c.

static void eloop_sock_table_destroy ( struct eloop_sock_table table) [static]

Definition at line 226 of file eloop.c.

static void eloop_sock_table_dispatch ( struct eloop_sock_table table,
fd_set *  fds 
) [static]

Definition at line 205 of file eloop.c.

static void eloop_sock_table_remove_sock ( struct eloop_sock_table table,
int  sock 
) [static]

Definition at line 164 of file eloop.c.

static void eloop_sock_table_set_fds ( struct eloop_sock_table table,
fd_set *  fds 
) [static]

Definition at line 190 of file eloop.c.

void eloop_terminate ( void  )

eloop_terminate - Terminate event loop

Terminate event loop even if there are registered events. This can be used to request the program to be terminated cleanly.

Definition at line 560 of file eloop.c.

int eloop_terminated ( void  )

eloop_terminated - Check whether event loop has been terminated Returns: 1 = event loop terminate, 0 = event loop still running

This function can be used to check whether eloop_terminate() has been called to request termination of the event loop. This is normally used to abort operations that may still be queued to be run when eloop_terminate() was called.

Definition at line 597 of file eloop.c.

void eloop_unregister_read_sock ( int  sock)

eloop_unregister_read_sock - Unregister handler for read events : File descriptor number for the socket

Unregister a read socket notifier that was previously registered with eloop_register_read_sock().

Definition at line 256 of file eloop.c.

void eloop_unregister_sock ( int  sock,
eloop_event_type  type 
)

eloop_unregister_sock - Unregister handler for socket events : File descriptor number for the socket : Type of event for which sock was registered

Unregister a socket event notifier that was previously registered with eloop_register_sock().

Definition at line 289 of file eloop.c.

void eloop_wait_for_read_sock ( int  sock)

eloop_wait_for_read_sock - Wait for a single reader : File descriptor number for the socket

Do a blocking wait for a single read socket.

Definition at line 603 of file eloop.c.


Variable Documentation

struct eloop_data eloop [static]

Definition at line 75 of file eloop.c.



wpa_supplicant
Author(s): Package maintained by Blaise Gassend
autogenerated on Thu Jan 2 2014 11:26:41