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

Temporary argument structures for module calls. More...

#include <freeradius-devel/server/dl_module.h>
#include <freeradius-devel/util/event.h>
+ Include dependency graph for module_ctx.h:

Go to the source code of this file.

Data Structures

struct  module_ctx_t
 Temporary structure to hold arguments for module calls. More...
 
struct  module_inst_ctx_t
 Temporary structure to hold arguments for instantiation calls. More...
 
struct  module_thread_inst_ctx_t
 Temporary structure to hold arguments for thread_instantiation calls. More...
 

Macros

#define MODULE_CTX(_dl_inst, _thread, _env_data, _rctx)   &(module_ctx_t){ .inst = _dl_inst, .thread = _thread, .env_data = _env_data, .rctx = _rctx }
 Wrapper to create a module_ctx_t as a compound literal. More...
 
#define MODULE_CTX_FROM_INST(_mctx)   &(module_ctx_t){ .inst = (_mctx)->inst }
 Wrapper to create a module_ctx_t as a compound literal from a module_inst_ctx_t. More...
 
#define MODULE_CTX_FROM_THREAD_INST(_mctx)   &(module_ctx_t){ .inst = (_mctx)->inst, .thread = (_mctx)->thread, .env_data = (_mctx)->env_data }
 Wrapper to create a module_ctx_t as a compound literal from a module_inst_ctx_t. More...
 
#define MODULE_INST_CTX(_dl_inst)   &(module_inst_ctx_t){ .inst = _dl_inst }
 Wrapper to create a module_inst_ctx_t as a compound literal. More...
 
#define MODULE_THREAD_INST_CTX(_dl_inst, _thread, _el)   &(module_thread_inst_ctx_t){ .inst = _dl_inst, .thread = _thread, .el = _el }
 Wrapper to create a module_thread_inst_ctx_t as a compound literal. More...
 
#define MODULE_THREAD_INST_CTX_FROM_INST_CTX(_mctx)   &(module_ctx_t){ .inst = (_mctx)->inst }
 Wrapper to create a module_inst_ctx_t as a comound listeral from a module_thread_ctx_t. More...
 

Functions

static module_ctx_tmodule_ctx_dup (TALLOC_CTX *ctx, module_ctx_t const *mctx)
 Duplicate a stack based module_ctx_t on the heap. More...
 
static module_ctx_tmodule_ctx_from_inst (TALLOC_CTX *ctx, module_inst_ctx_t const *mctx)
 Allocate a module calling ctx on the heap based on an instance ctx. More...
 
static module_ctx_tmodule_ctx_from_thread_inst (TALLOC_CTX *ctx, module_thread_inst_ctx_t const *mctx)
 Allocate a module calling ctx on the heap based on an instance ctx. More...
 

Detailed Description

Temporary argument structures for module calls.

Id
aa05f838015e12e458fef82fe4840662891057b2

These get used in various places where we may not want to include the full module.h.

Definition in file module_ctx.h.


Data Structure Documentation

◆ module_ctx_t

struct module_ctx_t

Temporary structure to hold arguments for module calls.

Definition at line 41 of file module_ctx.h.

+ Collaboration diagram for module_ctx_t:
Data Fields
void * env_data Per call environment data.
dl_module_inst_t const * inst Dynamic loader API handle for the module.
void * rctx Resume ctx that a module previously set.
void * thread Thread specific instance data.

◆ module_inst_ctx_t

struct module_inst_ctx_t

Temporary structure to hold arguments for instantiation calls.

Definition at line 51 of file module_ctx.h.

+ Collaboration diagram for module_inst_ctx_t:
Data Fields
dl_module_inst_t const * inst Dynamic loader API handle for the module.

◆ module_thread_inst_ctx_t

struct module_thread_inst_ctx_t

Temporary structure to hold arguments for thread_instantiation calls.

Definition at line 58 of file module_ctx.h.

+ Collaboration diagram for module_thread_inst_ctx_t:
Data Fields
fr_event_list_t * el Event list to register any IO handlers and timers against.
dl_module_inst_t const * inst Dynamic loader API handle for the module.

Must come first to allow cast between module_inst_ctx.

void * thread Thread instance data.

Macro Definition Documentation

◆ MODULE_CTX

#define MODULE_CTX (   _dl_inst,
  _thread,
  _env_data,
  _rctx 
)    &(module_ctx_t){ .inst = _dl_inst, .thread = _thread, .env_data = _env_data, .rctx = _rctx }

Wrapper to create a module_ctx_t as a compound literal.

This is used so that the compiler will flag any uses of (module_ctx_t) which don't set the required fields. Additional arguments should be added to this macro whenever the module_ctx_t fields are altered.

Parameters
[in]_dl_instof the module being called.
[in]_threadinstance of the module being called.
[in]_env_dataCall environment data.
[in]_rctxResume ctx (if any).

Definition at line 123 of file module_ctx.h.

◆ MODULE_CTX_FROM_INST

#define MODULE_CTX_FROM_INST (   _mctx)    &(module_ctx_t){ .inst = (_mctx)->inst }

Wrapper to create a module_ctx_t as a compound literal from a module_inst_ctx_t.

This is used so that the compiler will flag any uses of (module_ctx_t) which don't set the required fields. Additional arguments should be added to this macro whenever the module_ctx_t fields are altered.

Parameters
[in]_mctxto copy fields from.

Definition at line 133 of file module_ctx.h.

◆ MODULE_CTX_FROM_THREAD_INST

#define MODULE_CTX_FROM_THREAD_INST (   _mctx)    &(module_ctx_t){ .inst = (_mctx)->inst, .thread = (_mctx)->thread, .env_data = (_mctx)->env_data }

Wrapper to create a module_ctx_t as a compound literal from a module_inst_ctx_t.

This is used so that the compiler will flag any uses of (module_ctx_t) which don't set the required fields. Additional arguments should be added to this macro whenever the module_ctx_t fields are altered.

Parameters
[in]_mctxto copy fields from.

Definition at line 143 of file module_ctx.h.

◆ MODULE_INST_CTX

#define MODULE_INST_CTX (   _dl_inst)    &(module_inst_ctx_t){ .inst = _dl_inst }

Wrapper to create a module_inst_ctx_t as a compound literal.

This is used so that the compiler will flag any uses of (module_inst_ctx_t) which don't set the required fields. Additional arguments should be added to this macro whenever the module_inst_ctx_t fields are altered.

Parameters
[in]_dl_instof the module being called..

Definition at line 153 of file module_ctx.h.

◆ MODULE_THREAD_INST_CTX

#define MODULE_THREAD_INST_CTX (   _dl_inst,
  _thread,
  _el 
)    &(module_thread_inst_ctx_t){ .inst = _dl_inst, .thread = _thread, .el = _el }

Wrapper to create a module_thread_inst_ctx_t as a compound literal.

This is used so that the compiler will flag any uses of (module_thread_inst_ctx_t) which don't set the required fields. Additional arguments should be added to this macro whenever the module_thread_inst_ctx_t fields are altered.

Parameters
[in]_dl_instof the module being called.
[in]_threadinstance of the module being called.
[in]_elThread specific event list.

Definition at line 165 of file module_ctx.h.

◆ MODULE_THREAD_INST_CTX_FROM_INST_CTX

#define MODULE_THREAD_INST_CTX_FROM_INST_CTX (   _mctx)    &(module_ctx_t){ .inst = (_mctx)->inst }

Wrapper to create a module_inst_ctx_t as a comound listeral from a module_thread_ctx_t.

Extract the dl_module_inst_t from a module_thread_inst_ctx_t.

Parameters
[in]_mctxto extract module_thread_inst_ctx_t from.

Definition at line 173 of file module_ctx.h.

Function Documentation

◆ module_ctx_dup()

static module_ctx_t* module_ctx_dup ( TALLOC_CTX *  ctx,
module_ctx_t const *  mctx 
)
static

Duplicate a stack based module_ctx_t on the heap.

Definition at line 100 of file module_ctx.h.

◆ module_ctx_from_inst()

static module_ctx_t* module_ctx_from_inst ( TALLOC_CTX *  ctx,
module_inst_ctx_t const *  mctx 
)
static

Allocate a module calling ctx on the heap based on an instance ctx.

Definition at line 71 of file module_ctx.h.

+ Here is the caller graph for this function:

◆ module_ctx_from_thread_inst()

static module_ctx_t* module_ctx_from_thread_inst ( TALLOC_CTX *  ctx,
module_thread_inst_ctx_t const *  mctx 
)
static

Allocate a module calling ctx on the heap based on an instance ctx.

Definition at line 85 of file module_ctx.h.