27 #include <freeradius-devel/server/module_rlm.h>
43 RDEBUG3(
"Initialising internal synchronous request");
68 "Request %s is marked as yielded at end of processing", request->name);
71 RDEBUG3(
"Synchronous done external request");
79 RDEBUG3(
"Done synchronous internal request");
86 RDEBUG3(
"Done synchronous detached request");
103 RDEBUG3(
"Synchronous request detached");
116 RDEBUG3(
"Synchronous request stopped");
148 RDEBUG3(
"synchronous request yielded");
156 RDEBUG3(
"synchronous request resumed");
180 .init_internal = _request_init_internal,
182 .done_external = _request_done_external,
183 .done_internal = _request_done_internal,
184 .done_detached = _request_done_detached,
186 .detach = _request_detach,
187 .stop = _request_stop,
188 .yield = _request_yield,
189 .resume = _request_resume,
190 .mark_runnable = _request_runnable,
191 .scheduled = _request_scheduled
222 bool dont_wait_for_event;
226 caller = request->module;
245 DEBUG4(
"Gathering events - %s", dont_wait_for_event ?
"Will not wait" :
"will wait");
247 if (num_events < 0) {
252 DEBUG4(
"%u event(s) pending%s",
253 num_events == -1 ? 0 : num_events, num_events == -1 ?
" - event loop exiting" :
"");
260 if (num_events > 0) {
261 DEBUG4(
"Servicing event(s)");
287 RDEBUG4(
">>> interpreter (iteration %i)", ++iterations);
289 RDEBUG4(
"<<< interpreter (iteration %i) - %s", iterations,
296 if (sub_request == request) rcode = sub_rcode;
303 request->module = caller;
fr_dcursor_eval_t void const * uctx
#define fr_assert_msg(_x, _msg,...)
Calls panic_action ifndef NDEBUG, else logs error and causes the server to exit immediately with code...
void * fr_heap_pop(fr_heap_t **hp)
Remove a node from the heap.
int fr_heap_insert(fr_heap_t **hp, void *data)
Insert a new element into the heap.
int fr_heap_extract(fr_heap_t **hp, void *data)
Remove a node from the heap.
static bool fr_heap_entry_inserted(fr_heap_index_t heap_idx)
Check if an entry is inserted into a heap.
static unsigned int fr_heap_num_elements(fr_heap_t *h)
Return the number of elements in the heap.
#define fr_heap_talloc_alloc(_ctx, _cmp, _talloc_type, _field, _init)
Creates a heap that verifies elements are of a specific talloc type.
rlm_rcode_t unlang_interpret(request_t *request)
Run the interpreter for a current request.
unlang_interpret_t * unlang_interpret_get(request_t *request)
Get the interpreter set for a request.
void unlang_interpret_set(request_t *request, unlang_interpret_t *intp)
Set a specific interpreter for a request.
unlang_interpret_t * unlang_interpret_init(TALLOC_CTX *ctx, fr_event_list_t *el, unlang_request_func_t *funcs, void *uctx)
Initialize a unlang compiler / interpret.
bool unlang_interpret_is_resumable(request_t *request)
Check if a request as resumable.
External functions provided by the owner of the interpret.
Private declarations for the unlang interpreter.
static void _request_yield(request_t *request, void *uctx)
Interpreter yielded request.
static void _request_done_external(request_t *request, UNUSED rlm_rcode_t rcode, UNUSED void *uctx)
External request is now complete.
static void _request_resume(request_t *request, UNUSED void *uctx)
Interpreter is starting to work on request again.
static void _request_runnable(request_t *request, void *uctx)
Request is now runnable.
static void _request_done_internal(request_t *request, UNUSED rlm_rcode_t rcode, UNUSED void *uctx)
Internal request (i.e.
static bool _request_scheduled(request_t const *request, UNUSED void *uctx)
static void _request_detach(request_t *request, UNUSED void *uctx)
We don't need to do anything for internal -> detached.
unlang_interpret_t * intp
static void _request_stop(request_t *request, void *uctx)
Request has been stopped.
static unlang_interpret_synchronous_t * unlang_interpret_synchronous_alloc(TALLOC_CTX *ctx, fr_event_list_t *el)
Allocate a new temporary interpreter.
rlm_rcode_t unlang_interpret_synchronous(fr_event_list_t *el, request_t *request)
Execute an unlang section synchronously.
static void _request_done_detached(request_t *request, UNUSED rlm_rcode_t rcode, UNUSED void *uctx)
static void _request_init_internal(request_t *request, void *uctx)
Internal request (i.e.
#define RPEDEBUG(fmt,...)
void fr_event_service(fr_event_list_t *el)
Service any outstanding timer or file descriptor events.
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.
int fr_event_corral(fr_event_list_t *el, fr_time_t now, bool wait)
Gather outstanding timer and file descriptor events.
Stores all information relating to an event list.
int8_t fr_pointer_cmp(void const *a, void const *b)
Compares two pointers.
fr_table_num_sorted_t const rcode_table[]
rlm_rcode_t
Return codes indicating the result of the module call.
int request_detach(request_t *child)
Unlink a subrequest from its parent.
@ REQUEST_STOP_PROCESSING
Request has been signalled to stop.
MEM(pair_append_request(&vp, attr_eap_aka_sim_identity) >=0)
#define fr_time()
Allow us to arbitrarily manipulate time.
#define fr_table_str_by_value(_table, _number, _def)
Convert an integer to a string.
static fr_event_list_t * el