25RCSID(
"$Id: ec6b4205d319c3b7557436c0c96477806c617a69 $")
27#include <freeradius-devel/io/listen.h>
28#include <freeradius-devel/util/debug.h>
29#include <freeradius-devel/util/rb.h>
48 return CMP(a->
id, b->id);
79 fr_app_t const *app,
void const *app_instance,
89 listen->
cs = listen_cs;
Public structure describing an I/O path for a protocol.
Describes a new application (protocol)
#define CMP(_a, _b)
Same as CMP_PREFER_SMALLER use when you don't really care about ordering, you just want an ordering.
fr_cmp_ret_t
Result of an ordering comparison.
A section grouping multiple CONF_PAIR.
#define fr_cond_assert_msg(_x, _fmt,...)
Calls panic_action ifndef NDEBUG, else logs error and evaluates to value of _x.
int fr_io_listen_free(fr_listen_instance_t *li)
Free a socket's thread instance along with it.
static pthread_once_t listen_by_id_once
fr_listen_t * fr_listen_alloc(TALLOC_CTX *ctx, CONF_SECTION *listen_cs, CONF_SECTION *server_cs, fr_app_t const *app, void const *app_instance, fr_app_io_t const *app_io, void const *app_io_instance)
Allocate a listener, and give it its id.
static int _listen_free(fr_listen_t *listen)
Take a listener out of the table, as it is being freed.
static uint32_t listen_next_id
static fr_cmp_ret_t listen_id_cmp(void const *one, void const *two)
static fr_rb_tree_t listen_by_id
fr_listen_instance_t * fr_listen_instance_alloc(TALLOC_CTX *ctx, fr_listen_t *listen)
Allocate a socket of a listener.
static void listen_by_id_init(void)
fr_listen_t * fr_listen_by_id(uint32_t id)
Find a listener by its id.
fr_listen_t * listen
the listener this is a socket of.
fr_app_io_t const * app_io
I/O path functions.
void const * app_instance
void const * app_io_instance
I/O path configuration context.
CONF_SECTION * cs
of this listener
void * thread_instance
thread / socket context
uint32_t id
Unique for the life of the process.
CONF_SECTION * server_cs
CONF_SECTION of the server.
static fr_app_io_t app_io
int fr_rb_find(void **found, fr_rb_tree_t const *tree, void const *data)
Find an element in the tree, returning the data, not the node.
int fr_rb_delete(fr_rb_tree_t *tree, void const *data)
Remove node and free data (if a free function was specified)
int fr_rb_insert(fr_rb_tree_t *tree, void const *data)
Insert data into a tree.
#define fr_rb_inline_init(_tree, _type, _field, _data_cmp, _data_free)
Initialises a red black tree.
The main red black tree structure.