The FreeRADIUS server $Id: 15bac2a4c627c01d1aa2047687b3418955ac7f00 $
Loading...
Searching...
No Matches
Macros | Typedefs | Enumerations | Functions
function.h File Reference

Declarations for generic unlang functions. More...

#include <freeradius-devel/unlang/interpret.h>
#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.
 
#define unlang_function_push_with_result(_result_p, _request, _func, _repeat, _signal, _sigmask, _top_frame, _uctx)
 Push a generic function onto the unlang stack that produces a result.
 
#define unlang_function_repeat_set(_request, _repeat)
 Set a new repeat function for an existing function frame.
 
#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.
 

Typedefs

typedef unlang_action_t(* unlang_function_no_result_t) (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.
 
typedef void(* unlang_function_signal_t) (request_t *request, fr_signal_t action, void *uctx)
 Function to call if the request was signalled.
 
typedef unlang_action_t(* unlang_function_with_result_t) (unlang_result_t *p_result, 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.
 

Enumerations

enum  unlang_function_type_t {
  UNLANG_FUNCTION_TYPE_WITH_RESULT ,
  UNLANG_FUNCTION_TYPE_NO_RESULT
}
 

Functions

unlang_action_t _unlang_function_push_no_result (request_t *request, unlang_function_no_result_t func, char const *func_name, unlang_function_no_result_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.
 
unlang_action_t _unlang_function_push_with_result (unlang_result_t *p_result, request_t *request, unlang_function_with_result_t func, char const *func_name, unlang_function_with_result_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 with a result.
 
int _unlang_function_repeat_set (request_t *request, void *repeat, char const *name, unlang_function_type_t type)
 Set a new repeat function for an existing function frame.
 
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.
 
int unlang_function_clear (request_t *request)
 Clear pending repeat function calls, and remove the signal handler.
 

Detailed Description

Declarations for generic unlang functions.

Id
767841b615062ab5e2821f1fd4f7d33b97f43f69

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:197
unlang_action_t _unlang_function_push_no_result(request_t *request, unlang_function_no_result_t func, char const *func_name, unlang_function_no_result_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:539

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.

Note
If you're pushing a function onto the stack to resume execution in a module, you're probably doing it wrong. Use unlang_module_yield() instead, and change the process function for the module.
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 179 of file function.h.

◆ unlang_function_push_with_result

#define unlang_function_push_with_result (   _result_p,
  _request,
  _func,
  _repeat,
  _signal,
  _sigmask,
  _top_frame,
  _uctx 
)
Value:
_unlang_function_push_with_result(_result_p, _request, \
_func, STRINGIFY(_func), \
_repeat, STRINGIFY(_repeat), \
_signal, _sigmask, STRINGIFY(_signal), \
_top_frame, _uctx)
unlang_action_t _unlang_function_push_with_result(unlang_result_t *p_result, request_t *request, unlang_function_with_result_t func, char const *func_name, unlang_function_with_result_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 with a result.
Definition function.c:488

Push a generic function onto the unlang stack that produces a result.

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.

Note
If you're pushing a function onto the stack to resume execution in a module, you're probably doing it wrong. Use unlang_module_yield() instead, and change the process function for the module.
Parameters
[in]_result_pWhere to write the result.
[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 144 of file function.h.

◆ unlang_function_repeat_set

#define unlang_function_repeat_set (   _request,
  _repeat 
)
Value:
_Generic((&(_repeat)), \
(void *)(_repeat), \
STRINGIFY(_repeat), \
(void *)(_repeat), \
STRINGIFY(_repeat), \
)
@ UNLANG_FUNCTION_TYPE_NO_RESULT
Function without a result.
Definition function.h:43
@ UNLANG_FUNCTION_TYPE_WITH_RESULT
Function with a result.
Definition function.h:42
unlang_action_t(* unlang_function_no_result_t)(request_t *request, void *uctx)
A generic function pushed by a module or xlat to functions deeper in the C call stack to create resum...
Definition function.h:68
int _unlang_function_repeat_set(request_t *request, void *repeat, char const *name, unlang_function_type_t type)
Set a new repeat function for an existing function frame.
Definition function.c:383
unlang_action_t(* unlang_function_with_result_t)(unlang_result_t *p_result, request_t *request, void *uctx)
A generic function pushed by a module or xlat to functions deeper in the C call stack to create resum...
Definition function.h:55

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 108 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 93 of file function.h.

Typedef Documentation

◆ unlang_function_no_result_t

typedef unlang_action_t(* unlang_function_no_result_t) (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.

Note
Returning UNLANG_ACTION_FAIL has an identical effect to returning UNLANG_ACTION_CALCULATE_RESULT and will not be visible to the caller.
Parameters
[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 68 of file function.h.

◆ 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 78 of file function.h.

◆ unlang_function_with_result_t

typedef unlang_action_t(* unlang_function_with_result_t) (unlang_result_t *p_result, 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 and priority.
[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 55 of file function.h.

Enumeration Type Documentation

◆ unlang_function_type_t

Enumerator
UNLANG_FUNCTION_TYPE_WITH_RESULT 

Function with a result.

UNLANG_FUNCTION_TYPE_NO_RESULT 

Function without a result.

Definition at line 41 of file function.h.

Function Documentation

◆ _unlang_function_push_no_result()

unlang_action_t _unlang_function_push_no_result ( request_t request,
unlang_function_no_result_t  func,
char const *  func_name,
unlang_function_no_result_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 539 of file function.c.

+ Here is the call graph for this function:

◆ _unlang_function_push_with_result()

unlang_action_t _unlang_function_push_with_result ( unlang_result_t p_result,
request_t request,
unlang_function_with_result_t  func,
char const *  func_name,
unlang_function_with_result_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 with a result.

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]p_resultWhere to write the result of the function evaluation.
[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 488 of file function.c.

+ Here is the call graph for this function:

◆ _unlang_function_repeat_set()

int _unlang_function_repeat_set ( request_t request,
void *  repeat,
char const *  repeat_name,
unlang_function_type_t  type 
)

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).
[in]typeType of repeat function (with or without result).
Returns
  • 0 on success.
  • -1 on failure.

Definition at line 383 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 344 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 310 of file function.c.

+ Here is the call graph for this function: