The FreeRADIUS server
$Id: 15bac2a4c627c01d1aa2047687b3418955ac7f00 $
|
Wrapper around libkqueue to make managing events easier. More...
#include <freeradius-devel/build.h>
#include <freeradius-devel/missing.h>
#include <freeradius-devel/util/time.h>
#include <freeradius-devel/util/talloc.h>
#include <stdbool.h>
#include <sys/event.h>
Go to the source code of this file.
Data Structures | |
union | fr_event_funcs_t |
Union of all filter functions. More... | |
struct | fr_event_io_func_t |
Callbacks for the FR_EVENT_FILTER_IO filter. More... | |
struct | fr_event_update_t |
Structure describing a modification to a filter's state. More... | |
struct | fr_event_vnode_func_t |
Callbacks for the FR_EVENT_FILTER_VNODE filter. More... | |
Typedefs | |
typedef void(* | fr_event_error_cb_t) (fr_event_list_t *el, int fd, int flags, int fd_errno, void *uctx) |
Called when an IO error event occurs on a file descriptor. More... | |
typedef void(* | fr_event_fd_cb_t) (fr_event_list_t *el, int fd, int flags, void *uctx) |
Called when an IO event occurs on a file descriptor. More... | |
typedef struct fr_event_fd | fr_event_fd_t |
An opaque file descriptor handle. More... | |
typedef struct fr_event_list | fr_event_list_t |
An opaque event list handle. More... | |
typedef void(* | fr_event_pid_cb_t) (fr_event_list_t *el, pid_t pid, int status, void *uctx) |
Called when a child process has exited. More... | |
typedef struct fr_event_pid | fr_event_pid_t |
An opaque PID status handle. More... | |
typedef int(* | fr_event_status_cb_t) (fr_time_t now, fr_time_delta_t wake, void *uctx) |
Called after each event loop cycle. More... | |
typedef fr_time_t(* | fr_event_time_source_t) (void) |
Alternative time source, useful for testing. More... | |
typedef void(* | fr_event_timer_cb_t) (fr_event_list_t *el, fr_time_t now, void *uctx) |
Called when a timer event fires. More... | |
typedef struct fr_event_timer | fr_event_timer_t |
An opaque timer handle. More... | |
typedef void(* | fr_event_user_cb_t) (fr_event_list_t *el, void *uctx) |
Called when a user kevent occurs. More... | |
typedef struct fr_event_user_s | fr_event_user_t |
An opaquer user event handle. More... | |
Enumerations | |
enum | fr_event_filter_t { FR_EVENT_FILTER_IO = 1 , FR_EVENT_FILTER_VNODE } |
The type of filter to install for an FD. More... | |
enum | fr_event_op_t { FR_EVENT_OP_SUSPEND = 1 , FR_EVENT_OP_RESUME } |
Operations to perform on filter. More... | |
Functions | |
int | _fr_event_fd_insert (NDEBUG_LOCATION_ARGS TALLOC_CTX *ctx, fr_event_fd_t **ef_out, fr_event_list_t *el, int fd, fr_event_fd_cb_t read_fn, fr_event_fd_cb_t write_fn, fr_event_error_cb_t error, void *uctx) |
Associate I/O callbacks with a file descriptor. More... | |
int | _fr_event_fd_move (NDEBUG_LOCATION_ARGS fr_event_list_t *dst, fr_event_list_t *src, int fd, fr_event_filter_t filter) |
Move a file descriptor event from one event list to another. More... | |
int | _fr_event_filter_insert (NDEBUG_LOCATION_ARGS TALLOC_CTX *ctx, fr_event_fd_t **ef_out, fr_event_list_t *el, int fd, fr_event_filter_t filter, void *funcs, fr_event_error_cb_t error, void *uctx) |
Insert a filter for the specified fd. More... | |
int | _fr_event_filter_update (NDEBUG_LOCATION_ARGS fr_event_list_t *el, int fd, fr_event_filter_t filter, fr_event_update_t const updates[]) |
Suspend/resume a subset of filters. More... | |
int | _fr_event_pid_reap (NDEBUG_LOCATION_ARGS fr_event_list_t *el, pid_t pid, fr_event_pid_cb_t wait_fn, void *uctx))) |
Asynchronously wait for a PID to exit, then reap it. More... | |
int | _fr_event_pid_wait (NDEBUG_LOCATION_ARGS TALLOC_CTX *ctx, fr_event_list_t *el, fr_event_pid_t const **ev_p, pid_t pid, fr_event_pid_cb_t wait_fn, void *uctx))) |
Insert a PID event into an event list. More... | |
int | _fr_event_timer_at (NDEBUG_LOCATION_ARGS TALLOC_CTX *ctx, fr_event_list_t *el, fr_event_timer_t const **ev, fr_time_t when, fr_event_timer_cb_t callback, void const *uctx) |
Insert a timer event into an event list. More... | |
int | _fr_event_timer_in (NDEBUG_LOCATION_ARGS TALLOC_CTX *ctx, fr_event_list_t *el, fr_event_timer_t const **ev, fr_time_delta_t delta, fr_event_timer_cb_t callback, void const *uctx) |
Insert a timer event into an event list. More... | |
int | _fr_event_user_insert (NDEBUG_LOCATION_ARGS TALLOC_CTX *ctx, fr_event_list_t *el, fr_event_user_t **ev_p, bool trigger, fr_event_user_cb_t callback, void *uctx) |
Add a user callback to the event list. More... | |
int | fr_event_corral (fr_event_list_t *el, fr_time_t now, bool wait) |
Gather outstanding timer and file descriptor events. More... | |
int | fr_event_fd_armour (fr_event_list_t *el, int fd, fr_event_filter_t, uintptr_t armour) |
Armour an FD. More... | |
fr_event_fd_cb_t | fr_event_fd_cb (fr_event_fd_t *ef, int filter, int fflags) |
Returns the appropriate callback function for a given event. More... | |
int | fr_event_fd_delete (fr_event_list_t *el, int fd, fr_event_filter_t filter) |
Remove a file descriptor from the event loop. More... | |
fr_event_fd_t * | fr_event_fd_handle (fr_event_list_t *el, int fd, fr_event_filter_t filter) |
Get the opaque event handle from a file descriptor. More... | |
void * | fr_event_fd_uctx (fr_event_fd_t *ef) |
Returns the uctx associated with an fr_event_fd_t handle. More... | |
int | fr_event_fd_unarmour (fr_event_list_t *el, int fd, fr_event_filter_t filter, uintptr_t armour) |
Unarmour an FD. More... | |
fr_event_list_t * | fr_event_list_alloc (TALLOC_CTX *ctx, fr_event_status_cb_t status, void *status_ctx) |
Initialise a new event list. More... | |
bool | fr_event_list_empty (fr_event_list_t *el) |
Return whether the event loop has any active events. More... | |
int | fr_event_list_kq (fr_event_list_t *el) |
Return the kq associated with an event list. More... | |
uint64_t | fr_event_list_num_fds (fr_event_list_t *el) |
Return the number of file descriptors is_registered with this event loop. More... | |
uint64_t | fr_event_list_num_timers (fr_event_list_t *el) |
Return the number of timer events currently scheduled. More... | |
unsigned int | fr_event_list_reap_signal (fr_event_list_t *el, fr_time_delta_t timeout, int signal) |
Send a signal to all the processes we have in our reap list, and reap them. More... | |
void | fr_event_list_set_time_func (fr_event_list_t *el, fr_event_time_source_t func) |
Override event list time source. More... | |
fr_time_t | fr_event_list_time (fr_event_list_t *el) |
Get the current server time according to the event list. More... | |
int | fr_event_loop (fr_event_list_t *el) |
Run an event loop. More... | |
void | fr_event_loop_exit (fr_event_list_t *el, int code) |
Signal an event loop exit with the specified code. More... | |
bool | fr_event_loop_exiting (fr_event_list_t *el) |
Check to see whether the event loop is in the process of exiting. More... | |
int | fr_event_post_delete (fr_event_list_t *el, fr_event_timer_cb_t callback, void *uctx)) |
Delete a post-event callback from the event list. More... | |
int | fr_event_post_insert (fr_event_list_t *el, fr_event_timer_cb_t callback, void *uctx)) |
Add a post-event callback to the event list. More... | |
int | fr_event_pre_delete (fr_event_list_t *el, fr_event_status_cb_t callback, void *uctx)) |
Delete a pre-event callback from the event list. More... | |
int | fr_event_pre_insert (fr_event_list_t *el, fr_event_status_cb_t callback, void *uctx)) |
Add a pre-event callback to the event list. More... | |
void | fr_event_service (fr_event_list_t *el) |
Service any outstanding timer or file descriptor events. More... | |
int | fr_event_timer_delete (fr_event_timer_t const **ev) |
Delete a timer event from the event list. More... | |
int | fr_event_timer_run (fr_event_list_t *el, fr_time_t *when) |
Run a single scheduled timer event. More... | |
fr_time_t | fr_event_timer_when (fr_event_timer_t const *ev) |
Internal timestamp representing when the timer should fire. More... | |
int | fr_event_user_delete (fr_event_list_t *el, fr_event_user_cb_t user, void *uctx)) |
int | fr_event_user_trigger (fr_event_list_t *el, fr_event_user_t *ev) |
Trigger a user event. More... | |
Wrapper around libkqueue to make managing events easier.
Definition in file event.h.
union fr_event_funcs_t |
Data Fields | ||
---|---|---|
fr_event_io_func_t | io | Read/write functions. |
fr_event_vnode_func_t | vnode | vnode callback functions. |
struct fr_event_io_func_t |
Callbacks for the FR_EVENT_FILTER_IO filter.
Data Fields | ||
---|---|---|
fr_event_fd_cb_t | read | Callback for when data is available. |
fr_event_fd_cb_t | write | Callback for when we can write data. |
struct fr_event_update_t |
Data Fields | ||
---|---|---|
size_t | offset | Offset of function in func struct. |
fr_event_op_t | op | Operation to perform on function/filter. |
struct fr_event_vnode_func_t |
Callbacks for the FR_EVENT_FILTER_VNODE filter.
Data Fields | ||
---|---|---|
fr_event_fd_cb_t | attrib | File attributes changed. |
fr_event_fd_cb_t | delete | The file was deleted. |
fr_event_fd_cb_t | extend | Additional files were added to a directory. |
fr_event_fd_cb_t | link | The link count on the file changed. |
fr_event_fd_cb_t | rename | The file was renamed. |
fr_event_fd_cb_t | write | The file was written to. |
#define fr_event_fd_insert | ( | ... | ) | _fr_event_fd_insert(NDEBUG_LOCATION_EXP __VA_ARGS__) |
#define fr_event_fd_mode | ( | ... | ) | _fr_event_fd_move(NDEBUG_LOCATION_EXP __VA_ARGS__) |
#define fr_event_filter_insert | ( | ... | ) | _fr_event_filter_insert(NDEBUG_LOCATION_EXP __VA_ARGS__) |
#define fr_event_filter_update | ( | ... | ) | _fr_event_filter_update(NDEBUG_LOCATION_EXP __VA_ARGS__) |
#define fr_event_pid_reap | ( | ... | ) | _fr_event_pid_reap(NDEBUG_LOCATION_EXP __VA_ARGS__) |
#define fr_event_pid_wait | ( | ... | ) | _fr_event_pid_wait(NDEBUG_LOCATION_EXP __VA_ARGS__) |
#define FR_EVENT_RESUME | ( | _s, | |
_f | |||
) | { .offset = offsetof(_s, _f), .op = FR_EVENT_OP_RESUME } |
Re-add the filter for a func from kevent.
Use to populate elements in an array of fr_event_update_t.
[in] | _s | the structure containing the func to suspend. |
[in] | _f | the func to resume. |
#define FR_EVENT_SUSPEND | ( | _s, | |
_f | |||
) | { .offset = offsetof(_s, _f), .op = FR_EVENT_OP_SUSPEND } |
Temporarily remove the filter for a func from kevent.
Use to populate elements in an array of fr_event_update_t.
[in] | _s | the structure containing the func to suspend. |
[in] | _f | the func to suspend. |
#define fr_event_timer_at | ( | ... | ) | _fr_event_timer_at(NDEBUG_LOCATION_EXP __VA_ARGS__) |
#define fr_event_timer_in | ( | ... | ) | _fr_event_timer_in(NDEBUG_LOCATION_EXP __VA_ARGS__) |
#define fr_event_user_insert | ( | _ctx, | |
_ev_p, | |||
_el, | |||
_trigger, | |||
_callback, | |||
_uctx | |||
) | _fr_event_user_insert(NDEBUG_LOCATION_EXP _ctx, _ev_p, _el, _trigger, _callback, _uctx) |
typedef void(* fr_event_error_cb_t) (fr_event_list_t *el, int fd, int flags, int fd_errno, void *uctx) |
Called when an IO error event occurs on a file descriptor.
[in] | el | Event list the file descriptor was inserted into. |
[in] | fd | That experienced the IO event. |
[in] | flags | field as returned by kevent. |
[in] | fd_errno | File descriptor error. |
[in] | uctx | User ctx passed to fr_event_fd_insert. |
typedef void(* fr_event_fd_cb_t) (fr_event_list_t *el, int fd, int flags, void *uctx) |
Called when an IO event occurs on a file descriptor.
[in] | el | Event list the file descriptor was inserted into. |
[in] | fd | That experienced the IO event. |
[in] | flags | field as returned by kevent. |
[in] | uctx | User ctx passed to fr_event_fd_insert. |
typedef struct fr_event_fd fr_event_fd_t |
typedef struct fr_event_list fr_event_list_t |
typedef void(* fr_event_pid_cb_t) (fr_event_list_t *el, pid_t pid, int status, void *uctx) |
Called when a child process has exited.
[in] | el | Event list |
[in] | pid | That exited |
[in] | status | exit status |
[in] | uctx | User ctx passed to fr_event_fd_insert. |
typedef struct fr_event_pid fr_event_pid_t |
typedef int(* fr_event_status_cb_t) (fr_time_t now, fr_time_delta_t wake, void *uctx) |
Called after each event loop cycle.
Called before calling kqueue to put the thread in a sleeping state.
[in] | now | The current time. |
[in] | wake | When we'll next need to wake up to service an event. |
[in] | uctx | User ctx passed to fr_event_list_alloc. |
typedef fr_time_t(* fr_event_time_source_t) (void) |
typedef void(* fr_event_timer_cb_t) (fr_event_list_t *el, fr_time_t now, void *uctx) |
Called when a timer event fires.
[in] | now | The current time. |
[in] | el | Event list the timer event was inserted into. |
[in] | uctx | User ctx passed to fr_event_timer_in or fr_event_timer_at. |
typedef struct fr_event_timer fr_event_timer_t |
typedef void(* fr_event_user_cb_t) (fr_event_list_t *el, void *uctx) |
Called when a user kevent occurs.
[in] | el | Event list |
[in] | uctx | User ctx passed to fr_event_user_insert. |
typedef struct fr_event_user_s fr_event_user_t |
enum fr_event_filter_t |
enum fr_event_op_t |
int _fr_event_fd_insert | ( | NDEBUG_LOCATION_ARGS TALLOC_CTX * | ctx, |
fr_event_fd_t ** | ef_out, | ||
fr_event_list_t * | el, | ||
int | fd, | ||
fr_event_fd_cb_t | read_fn, | ||
fr_event_fd_cb_t | write_fn, | ||
fr_event_error_cb_t | error, | ||
void * | uctx | ||
) |
Associate I/O callbacks with a file descriptor.
[in] | ctx | to bind lifetime of the event to. |
[out] | ef_out | Where to store the output event |
[in] | el | to insert fd callback into. |
[in] | fd | to install filters for. |
[in] | read_fn | function to call when fd is readable. |
[in] | write_fn | function to call when fd is writable. |
[in] | error | function to call when an error occurs on the fd. |
[in] | uctx | to pass to handler. |
Definition at line 1233 of file event.c.
int _fr_event_fd_move | ( | NDEBUG_LOCATION_ARGS fr_event_list_t * | dst, |
fr_event_list_t * | src, | ||
int | fd, | ||
fr_event_filter_t | filter | ||
) |
Move a file descriptor event from one event list to another.
FIXME - Move suspended events too.
[in] | dst | Event list to move file descriptor event to. |
[in] | src | Event list to move file descriptor from. |
[in] | fd | of the event to move. |
[in] | filter | of the event to move. |
Definition at line 949 of file event.c.
int _fr_event_filter_insert | ( | NDEBUG_LOCATION_ARGS TALLOC_CTX * | ctx, |
fr_event_fd_t ** | ef_out, | ||
fr_event_list_t * | el, | ||
int | fd, | ||
fr_event_filter_t | filter, | ||
void * | funcs, | ||
fr_event_error_cb_t | error, | ||
void * | uctx | ||
) |
Insert a filter for the specified fd.
[in] | ctx | to bind lifetime of the event to. |
[out] | ef_out | Previously allocated ef, or NULL. |
[in] | el | to insert fd callback into. |
[in] | fd | to install filters for. |
[in] | filter | one of the fr_event_filter_t values. |
[in] | funcs | Structure containing callback functions. If a function pointer is set, the equivalent kevent filter will be installed. |
[in] | error | function to call when an error occurs on the fd. |
[in] | uctx | to pass to handler. |
Definition at line 1077 of file event.c.
int _fr_event_filter_update | ( | NDEBUG_LOCATION_ARGS fr_event_list_t * | el, |
int | fd, | ||
fr_event_filter_t | filter, | ||
fr_event_update_t const | updates[] | ||
) |
Suspend/resume a subset of filters.
This function trades producing useful errors for speed.
An example of suspending the read filter for an FD would be:
[in] | el | to update descriptor in. |
[in] | fd | to update filters for. |
[in] | filter | The type of filter to update. |
[in] | updates | An array of updates to toggle filters on/off without removing the callback function. |
Definition at line 1000 of file event.c.
int _fr_event_pid_reap | ( | NDEBUG_LOCATION_ARGS fr_event_list_t * | el, |
pid_t | pid, | ||
fr_event_pid_cb_t | callback, | ||
void * | uctx | ||
) |
Asynchronously wait for a PID to exit, then reap it.
This is intended to be used when we no longer care about a process exiting, but we still want to clean up its state so we don't have zombie processes sticking around.
[in] | el | to use to reap the process. |
[in] | pid | to reap. |
[in] | callback | to call when the process is reaped. May be NULL. |
[in] | uctx | to pass to callback. |
Definition at line 1968 of file event.c.
int _fr_event_pid_wait | ( | NDEBUG_LOCATION_ARGS TALLOC_CTX * | ctx, |
fr_event_list_t * | el, | ||
fr_event_pid_t const ** | ev_p, | ||
pid_t | pid, | ||
fr_event_pid_cb_t | callback, | ||
void * | uctx | ||
) |
Insert a PID event into an event list.
[in] | ctx | to bind lifetime of the event to. |
[in] | el | to insert event into. |
[in,out] | ev_p | If not NULL modify this event instead of creating a new one. This is a parent in a temporal sense, not in a memory structure or dependency sense. |
[in] | pid | child PID to wait for |
[in] | callback | function to execute if the event fires. |
[in] | uctx | user data to pass to the event. |
Definition at line 1741 of file event.c.
int _fr_event_timer_at | ( | NDEBUG_LOCATION_ARGS TALLOC_CTX * | ctx, |
fr_event_list_t * | el, | ||
fr_event_timer_t const ** | ev_p, | ||
fr_time_t | when, | ||
fr_event_timer_cb_t | callback, | ||
void const * | uctx | ||
) |
Insert a timer event into an event list.
[in] | ctx | to bind lifetime of the event to. |
[in] | el | to insert event into. |
[in,out] | ev_p | If not NULL modify this event instead of creating a new one. This is a parent in a temporal sense, not in a memory structure or dependency sense. |
[in] | when | we should run the event. |
[in] | callback | function to execute if the event fires. |
[in] | uctx | user data to pass to the event. |
Definition at line 1451 of file event.c.
int _fr_event_timer_in | ( | NDEBUG_LOCATION_ARGS TALLOC_CTX * | ctx, |
fr_event_list_t * | el, | ||
fr_event_timer_t const ** | ev_p, | ||
fr_time_delta_t | delta, | ||
fr_event_timer_cb_t | callback, | ||
void const * | uctx | ||
) |
Insert a timer event into an event list.
[in] | ctx | to bind lifetime of the event to. |
[in] | el | to insert event into. |
[in,out] | ev_p | If not NULL modify this event instead of creating a new one. This is a parent in a temporal sense, not in a memory structure or dependency sense. |
[in] | delta | In how many nanoseconds to wait before should we execute the event. |
[in] | callback | function to execute if the event fires. |
[in] | uctx | user data to pass to the event. |
Definition at line 1596 of file event.c.
int _fr_event_user_insert | ( | NDEBUG_LOCATION_ARGS TALLOC_CTX * | ctx, |
fr_event_list_t * | el, | ||
fr_event_user_t ** | ev_p, | ||
bool | trigger, | ||
fr_event_user_cb_t | callback, | ||
void * | uctx | ||
) |
Add a user callback to the event list.
[in] | ctx | to allocate the event in. |
[in] | el | Containing the timer events. |
[out] | ev_p | Where to write a pointer. |
[in] | trigger | Whether the user event is triggered initially. |
[in] | callback | for EVFILT_USER. |
[in] | uctx | for the callback. |
Definition at line 2187 of file event.c.
int fr_event_corral | ( | fr_event_list_t * | el, |
fr_time_t | now, | ||
bool | wait | ||
) |
Gather outstanding timer and file descriptor events.
[in] | el | to process events for. |
[in] | now | The current time. |
[in] | wait | if true, block on the kevent() call until a timer or file descriptor event occurs. |
Definition at line 2414 of file event.c.
int fr_event_fd_armour | ( | fr_event_list_t * | el, |
int | fd, | ||
fr_event_filter_t | filter, | ||
uintptr_t | armour | ||
) |
Armour an FD.
[in] | el | to remove file descriptor from. |
[in] | fd | to remove. |
[in] | filter | The type of filter to remove. |
[in] | armour | The armour to add. |
Definition at line 1342 of file event.c.
fr_event_fd_cb_t fr_event_fd_cb | ( | fr_event_fd_t * | ef, |
int | kq_filter, | ||
int | kq_fflags | ||
) |
Returns the appropriate callback function for a given event.
[in] | ef | the event filter fd handle. |
[in] | kq_filter | If the callbacks are indexed by filter. |
[in] | kq_fflags | If the callbacks are indexed by NOTES (fflags). |
Definition at line 1318 of file event.c.
int fr_event_fd_delete | ( | fr_event_list_t * | el, |
int | fd, | ||
fr_event_filter_t | filter | ||
) |
Remove a file descriptor from the event loop.
[in] | el | to remove file descriptor from. |
[in] | fd | to remove. |
[in] | filter | The type of filter to remove. |
Definition at line 1260 of file event.c.
fr_event_fd_t* fr_event_fd_handle | ( | fr_event_list_t * | el, |
int | fd, | ||
fr_event_filter_t | filter | ||
) |
Get the opaque event handle from a file descriptor.
[in] | el | to search for fd/filter in. |
[in] | fd | to search for. |
[in] | filter | to search for. |
Definition at line 1296 of file event.c.
void* fr_event_fd_uctx | ( | fr_event_fd_t * | ef | ) |
int fr_event_fd_unarmour | ( | fr_event_list_t * | el, |
int | fd, | ||
fr_event_filter_t | filter, | ||
uintptr_t | armour | ||
) |
Unarmour an FD.
[in] | el | to remove file descriptor from. |
[in] | fd | to remove. |
[in] | filter | The type of filter to remove. |
[in] | armour | The armour to remove |
Definition at line 1372 of file event.c.
fr_event_list_t* fr_event_list_alloc | ( | TALLOC_CTX * | ctx, |
fr_event_status_cb_t | status, | ||
void * | status_uctx | ||
) |
Initialise a new event list.
[in] | ctx | to allocate memory in. |
[in] | status | callback, called on each iteration of the event list. |
[in] | status_uctx | context for the status callback |
Definition at line 2899 of file event.c.
bool fr_event_list_empty | ( | fr_event_list_t * | el | ) |
int fr_event_list_kq | ( | fr_event_list_t * | el | ) |
uint64_t fr_event_list_num_fds | ( | fr_event_list_t * | el | ) |
uint64_t fr_event_list_num_timers | ( | fr_event_list_t * | el | ) |
unsigned int fr_event_list_reap_signal | ( | fr_event_list_t * | el, |
fr_time_delta_t | timeout, | ||
int | signal | ||
) |
Send a signal to all the processes we have in our reap list, and reap them.
[in] | el | containing the processes to reap. |
[in] | timeout | how long to wait before we signal the processes. |
[in] | signal | to send to processes. Should be a fatal signal. |
Definition at line 2004 of file event.c.
void fr_event_list_set_time_func | ( | fr_event_list_t * | el, |
fr_event_time_source_t | func | ||
) |
fr_time_t fr_event_list_time | ( | fr_event_list_t * | el | ) |
Get the current server time according to the event list.
If the event list is currently dispatching events, we return the time this iteration of the event list started.
If the event list is not currently dispatching events, we return the current system time.
[in] | el | to get time from. |
Definition at line 643 of file event.c.
int fr_event_loop | ( | fr_event_list_t * | el | ) |
Run an event loop.
[in] | el | to start processing. |
Definition at line 2766 of file event.c.
void fr_event_loop_exit | ( | fr_event_list_t * | el, |
int | code | ||
) |
Signal an event loop exit with the specified code.
The event loop will complete its current iteration, and then exit with the specified code.
[in] | el | to signal to exit. |
[in] | code | for fr_event_loop to return. |
Definition at line 2744 of file event.c.
bool fr_event_loop_exiting | ( | fr_event_list_t * | el | ) |
int fr_event_post_delete | ( | fr_event_list_t * | el, |
fr_event_timer_cb_t | callback, | ||
void * | uctx | ||
) |
Delete a post-event callback from the event list.
[in] | el | Containing the timer events. |
[in] | callback | The post-processing callback. |
[in] | uctx | for the callback. |
Definition at line 2335 of file event.c.
int fr_event_post_insert | ( | fr_event_list_t * | el, |
fr_event_timer_cb_t | callback, | ||
void * | uctx | ||
) |
Add a post-event callback to the event list.
Events are serviced in insert order. i.e. insert A, B, we then have A running before B.
[in] | el | Containing the timer events. |
[in] | callback | The post-processing callback. |
[in] | uctx | for the callback. |
Definition at line 2313 of file event.c.
int fr_event_pre_delete | ( | fr_event_list_t * | el, |
fr_event_status_cb_t | callback, | ||
void * | uctx | ||
) |
Delete a pre-event callback from the event list.
[in] | el | Containing the timer events. |
[in] | callback | The pre-processing callback. |
[in] | uctx | for the callback. |
Definition at line 2281 of file event.c.
int fr_event_pre_insert | ( | fr_event_list_t * | el, |
fr_event_status_cb_t | callback, | ||
void * | uctx | ||
) |
Add a pre-event callback to the event list.
Events are serviced in insert order. i.e. insert A, B, we then have A running before B.
[in] | el | Containing the timer events. |
[in] | callback | The pre-processing callback. |
[in] | uctx | for the callback. |
Definition at line 2259 of file event.c.
void fr_event_service | ( | fr_event_list_t * | el | ) |
int fr_event_timer_delete | ( | fr_event_timer_t const ** | ev_p | ) |
int fr_event_timer_run | ( | fr_event_list_t * | el, |
fr_time_t * | when | ||
) |
Run a single scheduled timer event.
[in] | el | containing the timer events. |
[in] | when | Process events scheduled to run before or at this time. |
Definition at line 2363 of file event.c.
fr_time_t fr_event_timer_when | ( | fr_event_timer_t const * | ev | ) |
int fr_event_user_delete | ( | fr_event_list_t * | el, |
fr_event_user_cb_t | user, | ||
void * | uctx | ||
) |
int fr_event_user_trigger | ( | fr_event_list_t * | el, |
fr_event_user_t * | ev | ||
) |