The FreeRADIUS server  $Id: 15bac2a4c627c01d1aa2047687b3418955ac7f00 $
Data Structures | Macros | Typedefs | Enumerations | Functions
tmpl.h File Reference

Functions to allow tmpls to push resumption frames onto the stack and inform the interpreter about the conditions they need to be resumed under (usually an I/O event or timer event). More...

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

Go to the source code of this file.

Data Structures

struct  unlang_tmpl_args_t
 Arguments for evaluating different types of tmpls. More...
 
struct  unlang_tmpl_args_t.exec
 Exec specific arguments. More...
 

Macros

#define TMPL_ARGS_EXEC(_env, _timeout, _stdout_on_error, _status_out)
 Create a temporary argument structure for evaluating an exec type tmpl. More...
 

Typedefs

typedef unlang_action_t(* fr_unlang_tmpl_resume_t) (rlm_rcode_t *p_result, request_t *request, void *rctx)
 A callback for when the request is resumed. More...
 
typedef void(* fr_unlang_tmpl_signal_t) (request_t *request, void *rctx, fr_signal_t action)
 A callback when the request gets a fr_signal_t. More...
 

Enumerations

enum  unlang_tmpl_args_type_t { UNLANG_TMPL_ARGS_TYPE_EXEC = 1 }
 Flags that show the type of arguments included. More...
 

Functions

int unlang_tmpl_push (TALLOC_CTX *ctx, fr_value_box_list_t *out, request_t *request, tmpl_t const *tmpl, unlang_tmpl_args_t *args)
 Push a tmpl onto the stack for evaluation. More...
 

Detailed Description

Functions to allow tmpls to push resumption frames onto the stack and inform the interpreter about the conditions they need to be resumed under (usually an I/O event or timer event).

Id
f9ce7ac95985e3d133fc19384637fb804b8965e7

Definition in file tmpl.h.


Data Structure Documentation

◆ unlang_tmpl_args_t

struct unlang_tmpl_args_t

Arguments for evaluating different types of tmpls.

Definition at line 47 of file tmpl.h.

Data Fields
struct unlang_tmpl_args_t exec Exec specific arguments.
unlang_tmpl_args_type_t type Flags field showing which argument structs were explicitly populated.

Can help with setting defaults.

◆ unlang_tmpl_args_t.exec

struct unlang_tmpl_args_t.exec

Exec specific arguments.

Definition at line 55 of file tmpl.h.

Data Fields
fr_pair_list_t * env Environmental variables.
int * status_out Where to write the exit code or fatal signal that killed the process.
bool stdout_on_error If true don't clear stdout if we get a non-zero status code.

This allows more nuanced interpretation of status codes.

fr_time_delta_t timeout How long to wait for the process to finish.

Macro Definition Documentation

◆ TMPL_ARGS_EXEC

#define TMPL_ARGS_EXEC (   _env,
  _timeout,
  _stdout_on_error,
  _status_out 
)
Value:
.exec = { \
.env = _env, \
.timeout = _timeout, \
.stdout_on_error = _stdout_on_error, \
.status_out = _status_out \
}, \
}
@ UNLANG_TMPL_ARGS_TYPE_EXEC
We have arguments for performing an exec.
Definition: tmpl.h:41
Arguments for evaluating different types of tmpls.
Definition: tmpl.h:47

Create a temporary argument structure for evaluating an exec type tmpl.

Parameters
[in]_envEnvironmental variables specified as a pair list.
[in]_timeoutHow long to wait for program to complete.
[in]_stdout_on_errorIf true we keep stdout even on non-zero status code.
[out]_status_outWhere to store the exit code of the program.
  • Will be positive if it's an exit code.
  • Will be negative if it's a fatal signal.

Definition at line 75 of file tmpl.h.

Typedef Documentation

◆ fr_unlang_tmpl_resume_t

typedef unlang_action_t(* fr_unlang_tmpl_resume_t) (rlm_rcode_t *p_result, request_t *request, void *rctx)

A callback for when the request is resumed.

The resumed request cannot call the normal "authorize", etc. method. It needs a separate callback.

Parameters
[in]p_resultthe module return code.
[in]requestthe current request.
[in]rctxa local context for the callback.
Returns
an unlang action.

Definition at line 108 of file tmpl.h.

◆ fr_unlang_tmpl_signal_t

typedef void(* fr_unlang_tmpl_signal_t) (request_t *request, void *rctx, fr_signal_t action)

A callback when the request gets a fr_signal_t.

A module may call unlang_yeild(), but still need to do something on FR_SIGNAL_DUP. If so, it's set here.

Note
The callback is automatically removed on unlang_interpret_mark_runnable().
Parameters
[in]rctxResume ctx for the callback.
[in]requestThe current request.
[in]actionwhich is signalling the request.

Definition at line 97 of file tmpl.h.

Enumeration Type Documentation

◆ unlang_tmpl_args_type_t

Flags that show the type of arguments included.

Enumerator
UNLANG_TMPL_ARGS_TYPE_EXEC 

We have arguments for performing an exec.

Definition at line 40 of file tmpl.h.

Function Documentation

◆ unlang_tmpl_push()

int unlang_tmpl_push ( TALLOC_CTX *  ctx,
fr_value_box_list_t *  out,
request_t request,
tmpl_t const *  tmpl,
unlang_tmpl_args_t args 
)

Push a tmpl onto the stack for evaluation.

Parameters
[in]ctxTo allocate value boxes and values in.
[out]outThe value_box created from the tmpl. May be NULL, in which case the result is discarded.
[in]requestThe current request.
[in]tmplthe tmpl to expand
[in]argsadditional controls for expanding TMPL_TYPE_EXEC, and where the status of exited programs will be stored.

Definition at line 259 of file tmpl.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function: