The FreeRADIUS server $Id: 15bac2a4c627c01d1aa2047687b3418955ac7f00 $
Loading...
Searching...
No Matches
virtual_servers.h
Go to the documentation of this file.
1#pragma once
2/*
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation; either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
16 */
17
18/**
19 * $Id: cdb87abcc7b8ddd50558fa8809e74a6c7f006aa9 $
20 *
21 * @file src/lib/server/virtual_servers.h
22 * @brief Declarations for functions that parse and manipulate virtual server sections.
23 *
24 * @copyright 2019 The FreeRADIUS server project
25 */
26
27
28#ifdef __cplusplus
29extern "C" {
30#endif
31
33
34#include <freeradius-devel/io/schedule.h>
35#include <freeradius-devel/server/cf_parse.h>
36#include <freeradius-devel/unlang/module.h>
37#include <freeradius-devel/unlang/mod_action.h>
38#include <freeradius-devel/util/dict.h>
39
42
43/** @name Debug functions
44 * @{
45 */
47
49/** @} */
50
51/** @name Resolution functions
52 * @{
53 */
55/** @} */
56
57/** @name Callbacks for dealing with transports
58 *
59 * @{
60 */
61int virtual_server_listen_transport_parse(TALLOC_CTX *ctx, void *out, void *parent,
62 CONF_ITEM *ci, conf_parser_t const *rule);
63/** @} */
64
65/** @name Namespace management
66 *
67 * @{
68 */
69fr_dict_t const *virtual_server_dict_by_name(char const *virtual_server) CC_HINT(nonnull);
70
72
74
76 char const *virtual_server, fr_dict_t const *namespace,
77 CONF_ITEM *ci) CC_HINT(nonnull(2,3));
78/** @} */
79
80/** @name Lookup and namespace management
81 *
82 * @{
83 */
85
86virtual_server_t const *virtual_server_find(char const *name) CC_HINT(nonnull);
87
89
90int virtual_server_cf_parse(TALLOC_CTX *ctx, void *out, void *parent,
91 CONF_ITEM *ci, conf_parser_t const *rule) CC_HINT(nonnull(2,4));
92/** @} */
93
95bool listen_record(fr_listen_t *li) CC_HINT(nonnull);
96
97/** Processing sections which are allowed in this virtual server.
98 *
99 */
100typedef struct {
101 section_name_t const *section; //!< Identifier for the section.
102 size_t offset; //!< where the CONF_SECTION pointer is written
103 bool dont_cache; //!< If true, the CONF_SECTION pointer won't be written
104 ///< and the offset will be ignored.
105 size_t instruction; //!< where the instruction pointer is written
106 unlang_mod_actions_t const *actions; //!< Default actions for this section.
107 section_name_t const **methods; //!< list of auxilliary module methods which are allowed in
108 ///< if the main name doesn't match.
110
111#define COMPILE_TERMINATOR { .section = NULL }
112
114
116
117int virtual_server_compile_sections(virtual_server_t const *vs, tmpl_rules_t const *rules) CC_HINT(nonnull);
118
119unlang_action_t virtual_server_push(request_t *request, CONF_SECTION *server_cs, bool top_frame) CC_HINT(nonnull);
120
121/** @name Parsing, bootstrap and instantiation
122 *
123 * @{
124 */
125int virtual_server_section_attribute_define(CONF_SECTION *server_cs, char const *subcs_name,
126 fr_dict_attr_t const *da) CC_HINT(nonnull);
127
129
131
132int virtual_servers_thread_instantiate(TALLOC_CTX *ctx, fr_event_list_t *el) CC_HINT(nonnull);
133
134int virtual_servers_instantiate(void) CC_HINT(nonnull);
135
137
138int virtual_servers_free(void);
139
140int virtual_servers_init(void) CC_HINT(nonnull);
141/** @} */
142
143#ifdef __cplusplus
144}
145#endif
unlang_action_t
Returned by unlang_op_t calls, determine the next action of the interpreter.
Definition action.h:35
Defines a CONF_PAIR to C data type mapping.
Definition cf_parse.h:579
Common header for all CONF_* types.
Definition cf_priv.h:49
A section grouping multiple CONF_PAIR.
Definition cf_priv.h:101
Stores all information relating to an event list.
Definition event.c:411
static const conf_parser_t config[]
Definition base.c:183
static char const * name
The scheduler.
Definition schedule.c:125
Section name identifier.
Definition section.h:44
Module instance data.
Definition module.h:265
Optional arguments passed to vp_tmpl functions.
Definition tmpl.h:341
static const uchar sc[16]
Definition smbdes.c:115
static fr_event_list_t * el
static fr_slen_t parent
Definition pair.h:851
static fr_slen_t data
Definition value.h:1265
int nonnull(2, 5))
static size_t char ** out
Definition value.h:997
CONF_SECTION * server_cs
The server section.
bool listen_record(fr_listen_t *li)
Record that we're listening on a particular IP / port.
int virtual_server_section_register(virtual_server_t *vs, virtual_server_compile_t const *entry)
Register name1 / name2 as allowed processing sections.
int virtual_servers_bootstrap(CONF_SECTION *config)
Load protocol modules and call their bootstrap methods.
const conf_parser_t virtual_servers_on_read_config[]
fr_dict_t const * virtual_server_dict_by_name(char const *virtual_server)
Return the namespace for the named virtual server.
bool dont_cache
If true, the CONF_SECTION pointer won't be written and the offset will be ignored.
module_instance_t * virtual_server_listener_by_data(void const *data)
Resolve proto data to a module instance.
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_servers_open(fr_schedule_t *sc)
Open all the listen sockets.
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.
const conf_parser_t virtual_servers_config[]
int virtual_server_cf_parse(TALLOC_CTX *ctx, void *out, void *parent, CONF_ITEM *ci, conf_parser_t const *rule))
virtual_server_t const * virtual_server_find(char const *name)
Return virtual server matching the specified name.
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.
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.
fr_listen_t * listen_find_any(fr_listen_t *li)
See if another global listener is using a particular IP / port.
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.
unlang_action_t virtual_server_push(request_t *request, CONF_SECTION *server_cs, bool top_frame)
Set the request processing function.
void virtual_servers_thread_detach(void)
Free thread-specific data for all process modules and listeners.
void virtual_server_process_debug(void)
Print all the loaded process module instances.
CONF_SECTION * virtual_server_cs(virtual_server_t const *vs)
Return the configuration section for a 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.
int virtual_servers_init(void)
Performs global initialisation for the virtual server code.
size_t instruction
where the instruction pointer is written
void virtual_server_listen_debug(void)
Print all the loaded listener instances.
int virtual_server_compile_sections(virtual_server_t const *vs, tmpl_rules_t const *rules)
Compile sections for a virtual server.
int virtual_servers_instantiate(void)
Instantiate all the virtual servers.
virtual_server_t const * virtual_server_by_child(CONF_ITEM const *ci)
Find a virtual server using one of its sections.
int virtual_servers_free(void)
unlang_mod_actions_t const * actions
Default actions for this section.
int virtual_servers_thread_instantiate(TALLOC_CTX *ctx, fr_event_list_t *el)
Perform thread instantiation for all process modules and listeners.
section_name_t const * section
Identifier for the section.
size_t offset
where the CONF_SECTION pointer is written
section_name_t const ** methods
list of auxilliary module methods which are allowed in if the main name doesn't match.
Processing sections which are allowed in this virtual server.