The FreeRADIUS server  $Id: 15bac2a4c627c01d1aa2047687b3418955ac7f00 $
Macros | Typedefs | Functions
function.h File Reference

Declarations for generic unlang functions. More...

#include <freeradius-devel/server/rcode.h>
#include <freeradius-devel/server/request.h>
#include <freeradius-devel/server/signal.h>
+ Include dependency graph for function.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define unlang_function_push(_request, _func, _repeat, _signal, _sigmask, _top_frame, _uctx)
 Push a generic function onto the unlang stack. More...
 
#define unlang_function_repeat_set(_request, _repeat)    _unlang_function_repeat_set(_request, _repeat, STRINGIFY(_repeat))
 Set a new repeat function for an existing function frame. More...
 
#define unlang_function_signal_set(_request, _signal, _sigmask)    _unlang_function_signal_set(_request, _signal, _sigmask, STRINGIFY(_signal))
 Set a new signal function for an existing function frame. More...
 

Typedefs

typedef void(* unlang_function_signal_t) (request_t *request, fr_signal_t action, void *uctx)
 Function to call if the request was signalled. More...
 
typedef unlang_action_t(* unlang_function_t) (rlm_rcode_t *p_result, int *priority, request_t *request, void *uctx)
 A generic function pushed by a module or xlat to functions deeper in the C call stack to create resumption points. More...
 

Functions

unlang_action_t _unlang_function_push (request_t *request, unlang_function_t func, char const *func_name, unlang_function_t repeat, char const *repeat_name, unlang_function_signal_t signal, fr_signal_t sigmask, char const *signal_name, bool top_frame, void *uctx)
 Push a generic function onto the unlang stack. More...
 
int _unlang_function_repeat_set (request_t *request, unlang_function_t repeat, char const *name)
 Set a new repeat function for an existing function frame. More...
 
int _unlang_function_signal_set (request_t *request, unlang_function_signal_t signal, fr_signal_t sigmask, char const *name)
 Set a new signal function for an existing function frame. More...
 
int unlang_function_clear (request_t *request)
 Clear pending repeat function calls, and remove the signal handler. More...
 

Detailed Description

Declarations for generic unlang functions.

Id
30f27591bb7a3c021e805aa23a3115ca21280dc4

These are a useful alternative to module methods for library code. They're more light weight, and don't require instance data lookups to function.

Definition in file function.h.

Macro Definition Documentation

◆ unlang_function_push

#define unlang_function_push (   _request,
  _func,
  _repeat,
  _signal,
  _sigmask,
  _top_frame,
  _uctx 
)
Value:
_func, STRINGIFY(_func), \
_repeat, STRINGIFY(_repeat), \
_signal, _sigmask, STRINGIFY(_signal), \
_top_frame, _uctx)
#define STRINGIFY(x)
Definition: build.h:195
unlang_action_t _unlang_function_push(request_t *request, unlang_function_t func, char const *func_name, unlang_function_t repeat, char const *repeat_name, unlang_function_signal_t signal, fr_signal_t sigmask, char const *signal_name, bool top_frame, void *uctx)
Push a generic function onto the unlang stack.
Definition: function.c:279

Push a generic function onto the unlang stack.

These can be pushed by any other type of unlang op to allow a submodule or function deeper in the C call stack to establish a new resumption point.

Parameters
[in]_requestThe current request.
[in]_functo call going up the stack.
[in]_repeatfunction to call going back down the stack (may be NULL). This may be the same as func.
[in]_signalfunction to call if the request is signalled.
[in]_sigmaskSignals to block.
[in]_top_frameReturn out of the unlang interpreter when popping this frame.
[in]_uctxto pass to func(s).
Returns
  • UNLANG_ACTION_PUSHED_CHILD on success.
  • UNLANG_ACTION_FAIL on failure.

Definition at line 111 of file function.h.

◆ unlang_function_repeat_set

#define unlang_function_repeat_set (   _request,
  _repeat 
)     _unlang_function_repeat_set(_request, _repeat, STRINGIFY(_repeat))

Set a new repeat function for an existing function frame.

The function frame being modified must be at the top of the stack.

Parameters
[in]_requestThe current request.
[in]_repeatthe repeat function to set.
Returns
  • 0 on success.
  • -1 on failure.

Definition at line 89 of file function.h.

◆ unlang_function_signal_set

#define unlang_function_signal_set (   _request,
  _signal,
  _sigmask 
)     _unlang_function_signal_set(_request, _signal, _sigmask, STRINGIFY(_signal))

Set a new signal function for an existing function frame.

The function frame being modified must be at the top of the stack.

Parameters
[in]_requestThe current request.
[in]_signalThe signal function to set.
[in]_sigmaskSignals to block.
Returns
  • 0 on success.
  • -1 on failure.

Definition at line 74 of file function.h.

Typedef Documentation

◆ unlang_function_signal_t

typedef void(* unlang_function_signal_t) (request_t *request, fr_signal_t action, void *uctx)

Function to call if the request was signalled.

Parameters
[in]requestThe current request.
[in]actionWe're being signalled with.
[in,out]uctxProvided by whatever pushed the function. Is opaque to the interpreter, but should be usable by the function. All input (args) and output will be done using this structure.

Definition at line 59 of file function.h.

◆ unlang_function_t

typedef unlang_action_t(* unlang_function_t) (rlm_rcode_t *p_result, int *priority, request_t *request, void *uctx)

A generic function pushed by a module or xlat to functions deeper in the C call stack to create resumption points.

Parameters
[in]p_resultThe module return code.
[in]priorityfor the return code.
[in]requestThe current request.
[in,out]uctxProvided by whatever pushed the function. Is opaque to the interpreter, but should be usable by the function. All input (args) and output will be done using this structure.
Returns
an unlang_action_t.

Definition at line 49 of file function.h.

Function Documentation

◆ _unlang_function_push()

unlang_action_t _unlang_function_push ( request_t request,
unlang_function_t  func,
char const *  func_name,
unlang_function_t  repeat,
char const *  repeat_name,
unlang_function_signal_t  signal,
fr_signal_t  sigmask,
char const *  signal_name,
bool  top_frame,
void *  uctx 
)

Push a generic function onto the unlang stack.

These can be pushed by any other type of unlang op to allow a submodule or function deeper in the C call stack to establish a new resumption point.

Parameters
[in]requestThe current request.
[in]functo call going up the stack.
[in]func_nameName of the function call (for debugging).
[in]repeatfunction to call going back down the stack (may be NULL). This may be the same as func.
[in]repeat_nameName of the repeat function call (for debugging).
[in]signalfunction to call if the request is signalled.
[in]sigmaskSignals to block.
[in]signal_nameName of the signal function call (for debugging).
[in]top_frameReturn out of the unlang interpreter when popping this frame.
[in]uctxto pass to func(s).
Returns
  • UNLANG_ACTION_PUSHED_CHILD on success.
  • UNLANG_ACTION_FAIL on failure.

Definition at line 279 of file function.c.

+ Here is the call graph for this function:

◆ _unlang_function_repeat_set()

int _unlang_function_repeat_set ( request_t request,
unlang_function_t  repeat,
char const *  repeat_name 
)

Set a new repeat function for an existing function frame.

The function frame being modified must be at the top of the stack.

Parameters
[in]requestThe current request.
[in]repeatthe repeat function to set.
[in]repeat_nameName of the repeat function call (for debugging).
Returns
  • 0 on success.
  • -1 on failure.

Definition at line 232 of file function.c.

+ Here is the call graph for this function:

◆ _unlang_function_signal_set()

int _unlang_function_signal_set ( request_t request,
unlang_function_signal_t  signal,
fr_signal_t  sigmask,
char const *  signal_name 
)

Set a new signal function for an existing function frame.

The function frame being modified must be at the top of the stack.

Parameters
[in]requestThe current request.
[in]signalThe signal function to set.
[in]sigmaskSignals to block.
[in]signal_nameName of the signal function call (for debugging).
Returns
  • 0 on success.
  • -1 on failure.

Definition at line 194 of file function.c.

◆ unlang_function_clear()

int unlang_function_clear ( request_t request)

Clear pending repeat function calls, and remove the signal handler.

The function frame being modified must be at the top of the stack.

Parameters
[in]requestThe current request.
Returns
  • 0 on success.
  • -1 on failure.

Definition at line 160 of file function.c.

+ Here is the call graph for this function: