The FreeRADIUS server $Id: 15bac2a4c627c01d1aa2047687b3418955ac7f00 $
Loading...
Searching...
No Matches
Data Structures | Macros | Typedefs | Functions | Variables
virtual_servers.h File Reference

Declarations for functions that parse and manipulate virtual server sections. More...

#include <freeradius-devel/server/virtual_servers.h>
#include <freeradius-devel/io/schedule.h>
#include <freeradius-devel/server/cf_parse.h>
#include <freeradius-devel/unlang/module.h>
#include <freeradius-devel/unlang/mod_action.h>
#include <freeradius-devel/util/dict.h>
+ Include dependency graph for virtual_servers.h:

Go to the source code of this file.

Data Structures

struct  virtual_server_cf_parse_uctx_t
 Additional validation rules for virtual server lookup. More...
 
struct  virtual_server_compile_s
 Processing sections which are allowed in this virtual server. More...
 

Macros

#define COMPILE_TERMINATOR   { .section = NULL }
 

Typedefs

typedef struct virtual_server_compile_s virtual_server_compile_t
 
typedef struct virtual_server_s virtual_server_t
 

Functions

fr_listen_tlisten_find_any (fr_listen_t *li)
 See if another global listener is using a particular IP / port.
 
bool listen_record (fr_listen_t *li)
 Record that we're listening on a particular IP / port.
 
unlang_action_t virtual_server_push (unlang_result_t *p_result, request_t *request, virtual_server_t const *vs, bool top_frame))
 Set the request processing function.
 
section_name_t const ** virtual_server_section_methods (virtual_server_t const *vs, section_name_t const *section)
 Find the component for a section.
 
int virtual_server_section_register (virtual_server_t *vs, virtual_server_compile_t const *entry)
 Register name1 / name2 as allowed processing sections.
 

Variables

const conf_parser_t virtual_servers_config []
 
const conf_parser_t virtual_servers_on_read_config []
 

Debug functions

void virtual_server_listen_debug (void)
 Print all the loaded listener instances.
 
void virtual_server_process_debug (void)
 Print all the loaded process module instances.
 

Resolution functions

module_instance_tvirtual_server_listener_by_data (void const *data)
 Resolve proto data to a module instance.
 

Callbacks for dealing with transports

int virtual_server_listen_transport_parse (TALLOC_CTX *ctx, void *out, void *parent, CONF_ITEM *ci, conf_parser_t const *rule)
 Generic conf_parser_t func for loading drivers.
 

Namespace management

fr_dict_t const * virtual_server_dict_by_child_ci (CONF_ITEM const *ci)
 Return the namespace for a given virtual server specified by a CONF_ITEM within the virtual server.
 
fr_dict_t const * virtual_server_dict_by_cs (CONF_SECTION const *server_cs)
 Return the namespace for the virtual server specified by a config section.
 
fr_dict_t const * virtual_server_dict_by_name (char const *virtual_server)
 Return the namespace for the named virtual server.
 
int virtual_server_has_namespace (CONF_SECTION **out, char const *virtual_server, fr_dict_t const *namespace, CONF_ITEM *ci))
 Verify that a given virtual_server exists and is of a particular namespace.
 

Lookup and namespace management

virtual_server_t const * virtual_server_by_child (CONF_ITEM const *ci)
 Find a virtual server using one of its sections.
 
int virtual_server_cf_parse (TALLOC_CTX *ctx, void *out, void *parent, CONF_ITEM *ci, conf_parser_t const *rule))
 
CONF_SECTIONvirtual_server_cs (virtual_server_t const *vs)
 Return the configuration section for a virtual server.
 
virtual_server_t const * virtual_server_find (char const *name)
 Return virtual server matching the specified name.
 
virtual_server_t const * virtual_server_from_cs (CONF_SECTION *server_cs)
 Resolve a CONF_SECTION to a virtual server.
 

Parsing, bootstrap and instantiation

int virtual_server_section_attribute_define (CONF_SECTION *server_cs, char const *subcs_name, fr_dict_attr_t const *da)
 Define a values for Auth-Type attributes by the sections present in a virtual-server.
 
int virtual_servers_bootstrap (CONF_SECTION *config)
 Load protocol modules and call their bootstrap methods.
 
int virtual_servers_free (void)
 
int virtual_servers_init (void)
 Performs global initialisation for the virtual server code.
 
int virtual_servers_instantiate (void)
 Instantiate all the virtual servers.
 
int virtual_servers_open (fr_schedule_t *sc)
 Open all the listen sockets.
 
void virtual_servers_thread_detach (void)
 Free thread-specific data for all process modules and listeners.
 
int virtual_servers_thread_instantiate (TALLOC_CTX *ctx, fr_event_list_t *el)
 Perform thread instantiation for all process modules and listeners.
 

Detailed Description

Declarations for functions that parse and manipulate virtual server sections.

Id
11f219b11058a672e94830f4e15dae24bb59eed5

Definition in file virtual_servers.h.


Data Structure Documentation

◆ virtual_server_cf_parse_uctx_t

struct virtual_server_cf_parse_uctx_t

Additional validation rules for virtual server lookup.

This is used to ensure that the virtual server we find matches the requirements of the caller.

This should be passed in the rule calling this function:

{ FR_CONF_OFFSET_TYPE_FLAGS("virtual_server", FR_TYPE_VOID, 0, module_conf_t, virtual_server),
.uctx = &(virtual_server_cf_parse_uctx_t){ .process_module_name = "eap_aka"} },
#define FR_CONF_OFFSET_TYPE_FLAGS(_name, _type, _flags, _struct, _field)
conf_parser_t which parses a single CONF_PAIR, writing the result to a field in a struct
Definition cf_parse.h:241
@ FR_TYPE_VOID
User data.
int virtual_server_cf_parse(TALLOC_CTX *ctx, void *out, void *parent, CONF_ITEM *ci, conf_parser_t const *rule))
Additional validation rules for virtual server lookup.
Note
process_module_name is the name field in the exported symbol of the module.

The double dereference is to work around compile time constant issues.

Definition at line 110 of file virtual_servers.h.

+ Collaboration diagram for virtual_server_cf_parse_uctx_t:
Data Fields
char const * process_module_name Virtual server we find must use this this process module.

This is a string identifier as the process modules are often not loaded at the same time as the modules and this makes ordering issues easier to deal with. Ignored if NULL.

fr_dict_t ** required_dict Virtual server we find must have this dictionary.

Ignored if NULL

◆ virtual_server_compile_s

struct virtual_server_compile_s

Processing sections which are allowed in this virtual server.

Definition at line 132 of file virtual_servers.h.

+ Collaboration diagram for virtual_server_compile_s:
Data Fields
unlang_mod_actions_t const * actions Default actions for this section.
bool dont_cache If true, the CONF_SECTION pointer won't be written and the offset will be ignored.
size_t instruction where the instruction pointer is written
section_name_t const ** methods list of auxilliary module methods which are allowed in if the main name doesn't match.
size_t offset where the CONF_SECTION pointer is written
section_name_t const * section Identifier for the section.

Macro Definition Documentation

◆ COMPILE_TERMINATOR

#define COMPILE_TERMINATOR   { .section = NULL }

Definition at line 143 of file virtual_servers.h.

Typedef Documentation

◆ virtual_server_compile_t

Definition at line 34 of file virtual_servers.h.

◆ virtual_server_t

Definition at line 33 of file virtual_servers.h.

Function Documentation

◆ listen_find_any()

fr_listen_t * listen_find_any ( fr_listen_t li)

See if another global listener is using a particular IP / port.

Definition at line 913 of file virtual_servers.c.

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

◆ listen_record()

bool listen_record ( fr_listen_t li)

Record that we're listening on a particular IP / port.

Definition at line 924 of file virtual_servers.c.

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

◆ virtual_server_by_child()

virtual_server_t const * virtual_server_by_child ( CONF_ITEM const *  ci)

Find a virtual server using one of its sections.

Parameters
[in]cito find parent virtual server for.
Returns
  • The virtual server section on success.
  • NULL if the child isn't associated with any virtual server section.

Definition at line 991 of file virtual_servers.c.

+ Here is the call graph for this function:

◆ virtual_server_cf_parse()

int virtual_server_cf_parse ( TALLOC_CTX *  ctx,
void *  out,
void *  parent,
CONF_ITEM ci,
conf_parser_t const *  rule 
)

◆ virtual_server_cs()

CONF_SECTION * virtual_server_cs ( virtual_server_t const *  vs)

Return the configuration section for a virtual server.

Parameters
[in]vsto return conf section for
Returns
  • The CONF_SECTION of the virtual server.

Definition at line 941 of file virtual_servers.c.

+ Here is the caller graph for this function:

◆ virtual_server_dict_by_child_ci()

fr_dict_t const * virtual_server_dict_by_child_ci ( CONF_ITEM const *  ci)

Return the namespace for a given virtual server specified by a CONF_ITEM within the virtual server.

Parameters
[in]cito look for namespace in.
Returns
  • NULL on error.
  • Namespace on success.

Definition at line 614 of file virtual_servers.c.

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

◆ virtual_server_dict_by_cs()

fr_dict_t const * virtual_server_dict_by_cs ( CONF_SECTION const *  server_cs)

Return the namespace for the virtual server specified by a config section.

Parameters
[in]server_csto look for namespace in.
Returns
  • NULL on error.
  • Namespace on success.

Definition at line 593 of file virtual_servers.c.

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

◆ virtual_server_dict_by_name()

fr_dict_t const * virtual_server_dict_by_name ( char const *  virtual_server)

Return the namespace for the named virtual server.

Parameters
[in]virtual_serverto look for namespace in.
Returns
  • NULL on error.
  • Namespace on success.

Definition at line 576 of file virtual_servers.c.

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

◆ virtual_server_find()

virtual_server_t const * virtual_server_find ( char const *  name)

Return virtual server matching the specified name.

Note
May be called in bootstrap or instantiate as all servers should be present.
Parameters
[in]nameof virtual server.
Returns
  • NULL if no virtual server was found.
  • The CONF_SECTION of the named virtual server.

Definition at line 971 of file virtual_servers.c.

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

◆ virtual_server_from_cs()

virtual_server_t const * virtual_server_from_cs ( CONF_SECTION server_cs)

Resolve a CONF_SECTION to a virtual server.

Definition at line 949 of file virtual_servers.c.

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

◆ virtual_server_has_namespace()

int virtual_server_has_namespace ( CONF_SECTION **  out,
char const *  virtual_server,
fr_dict_t const *  namespace,
CONF_ITEM ci 
)

Verify that a given virtual_server exists and is of a particular namespace.

Mostly used by modules to check virtual servers specified by their configs.

Parameters
[out]outwe found. May be NULL if just checking for existence.
[in]virtual_serverto check.
[in]namespacethe virtual server must belong to.
[in]cito log errors against. May be NULL if caller doesn't want errors logged.
Returns
  • 0 on success.
  • -1 if no virtual server could be found.
  • -2 if virtual server is not of the correct namespace.

Definition at line 642 of file virtual_servers.c.

+ Here is the call graph for this function:

◆ virtual_server_listen_debug()

void virtual_server_listen_debug ( void  )

Print all the loaded listener instances.

Definition at line 178 of file virtual_servers.c.

+ Here is the call graph for this function:

◆ virtual_server_listen_transport_parse()

int virtual_server_listen_transport_parse ( TALLOC_CTX *  ctx,
void *  out,
void *  parent,
CONF_ITEM ci,
conf_parser_t const *  rule 
)

Generic conf_parser_t func for loading drivers.

Definition at line 206 of file virtual_servers.c.

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

◆ virtual_server_listener_by_data()

module_instance_t * virtual_server_listener_by_data ( void const *  data)

Resolve proto data to a module instance.

Parameters
[in]dataPointer to the proto data.
Returns
  • The module instance for the proto data.
  • NULL if no data matches.

Definition at line 198 of file virtual_servers.c.

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

◆ virtual_server_process_debug()

void virtual_server_process_debug ( void  )

Print all the loaded process module instances.

Definition at line 186 of file virtual_servers.c.

+ Here is the call graph for this function:

◆ virtual_server_push()

unlang_action_t virtual_server_push ( unlang_result_t p_result,
request_t request,
virtual_server_t const *  vs,
bool  top_frame 
)

Set the request processing function.

Short-term hack

Definition at line 755 of file virtual_servers.c.

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

◆ virtual_server_section_attribute_define()

int virtual_server_section_attribute_define ( CONF_SECTION server_cs,
char const *  subcs_name,
fr_dict_attr_t const *  da 
)

Define a values for Auth-Type attributes by the sections present in a virtual-server.

The.name2 value of any sections found will be converted into values of the specified da.

Parameters
[in]server_csThe virtual server containing the sections.
[in]subcs_nameof the subsection to search for.
[in]dato add enumeration values for.
Returns
  • 0 all values added successfully.
  • -1 an error occurred.

Definition at line 1459 of file virtual_servers.c.

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

◆ virtual_server_section_methods()

section_name_t const ** virtual_server_section_methods ( virtual_server_t const *  vs,
section_name_t const *  section 
)

Find the component for a section.

Definition at line 1420 of file virtual_servers.c.

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

◆ virtual_server_section_register()

int virtual_server_section_register ( virtual_server_t vs,
virtual_server_compile_t const *  entry 
)

Register name1 / name2 as allowed processing sections.

This function is called from the virtual server bootstrap routine, which happens before module_bootstrap();

Definition at line 1375 of file virtual_servers.c.

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

◆ virtual_servers_bootstrap()

int virtual_servers_bootstrap ( CONF_SECTION config)

Load protocol modules and call their bootstrap methods.

Parameters
[in]configsection containing the virtual servers to bootstrap.
Returns
  • 0 on success.
  • -1 on failure.

Definition at line 1971 of file virtual_servers.c.

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

◆ virtual_servers_free()

int virtual_servers_free ( void  )

Definition at line 1992 of file virtual_servers.c.

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

◆ virtual_servers_init()

int virtual_servers_init ( void  )

Performs global initialisation for the virtual server code.

This has to be done separately and explicitly, because the above code makes use of "onread" callbacks.

Will automatically free module lists on exit, but all modules should have been removed from this list by the point that happens.

Definition at line 2018 of file virtual_servers.c.

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

◆ virtual_servers_instantiate()

int virtual_servers_instantiate ( void  )

Instantiate all the virtual servers.

Returns
  • 0 on success.
  • -1 on failure.

Definition at line 1839 of file virtual_servers.c.

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

◆ virtual_servers_open()

int virtual_servers_open ( fr_schedule_t sc)

Open all the listen sockets.

Parameters
[in]scScheduler to add I/O paths to.
Returns
  • 0 on success.
  • -1 on failure.

Definition at line 1738 of file virtual_servers.c.

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

◆ virtual_servers_thread_detach()

void virtual_servers_thread_detach ( void  )

Free thread-specific data for all process modules and listeners.

Definition at line 1814 of file virtual_servers.c.

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

◆ virtual_servers_thread_instantiate()

int virtual_servers_thread_instantiate ( TALLOC_CTX *  ctx,
fr_event_list_t el 
)

Perform thread instantiation for all process modules and listeners.

Definition at line 1823 of file virtual_servers.c.

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

Variable Documentation

◆ virtual_servers_config

const conf_parser_t virtual_servers_config[]
extern

Definition at line 162 of file virtual_servers.c.

◆ virtual_servers_on_read_config

const conf_parser_t virtual_servers_on_read_config[]
extern

Definition at line 134 of file virtual_servers.c.