24 #include <freeradius-devel/server/base.h>
25 #include <freeradius-devel/io/listen.h>
26 #include <freeradius-devel/unlang/base.h>
27 #include <freeradius-devel/util/debug.h>
84 fr_dict_enum_t
const *type_enum;
90 inst->dict = virtual_server_namespace_by_ci(ci);
92 cf_log_err(ci,
"Please define 'namespace' in this virtual server");
97 if (!
inst->attr_packet_type) {
98 cf_log_err(ci,
"Failed to find 'Packet-Type' attribute");
113 inst->code = type_enum->value->vb_uint32;
128 unsigned int num, last = 0;
129 bool last_is_set =
false;
130 bool wildcard =
false;
162 cf_log_err(ci,
"Cannot use wildcard and numbers for %s at %s",
name, p);
170 num = strtoul(p, &end, 10);
171 if ((num <
min) || (num > max)) {
172 cf_log_err(ci,
"Number is invalid or out of bounds (%d..%d) for %s at %s",
184 }
else if (num <= last) {
185 cf_log_err(ci,
"Number overlaps with previous value of %u, for %s at %s",
198 next = strtoul(p, &end, 10);
200 cf_log_err(ci,
"End of range number overlaps with previous value of %u, for %s at %s",
206 cf_log_err(ci,
"End of range number is invalid or out of bounds (%d..%d) for %s at %s",
220 num = strtoul(p, &end, 10);
222 cf_log_err(ci,
"Failed parsing step value for %s at %s",
name, p);
239 if (!(!*end || isspace((
uint8_t) *end))) {
253 {
L(
"annually"),
"0 0 1 1 *" },
254 {
L(
"daily"),
"0 0 * * *" },
255 {
L(
"hourly"),
"0 * * * *" },
256 {
L(
"midnight"),
"0 0 * * *" },
257 {
L(
"monthly"),
"0 0 1 * *" },
258 {
L(
"reboot"),
"+" },
259 {
L(
"shutdown"),
"-" },
260 {
L(
"startup"),
"+" },
261 {
L(
"weekly"),
"0 0 * * 0" },
262 {
L(
"yearly"),
"0 0 1 1 *" },
302 *((
char const **)
out) = p;
308 if (
parse_field(ci, &p,
"minute", 0, 59) < 0)
return -1;
309 if (
parse_field(ci, &p,
"hour", 0, 59) < 0)
return -1;
310 if (
parse_field(ci, &p,
"day of month", 1, 31) < 0)
return -1;
311 if (
parse_field(ci, &p,
"month", 1,12) < 0)
return -1;
312 if (
parse_field(ci, &p,
"day of week", 0, 6) < 0)
return -1;
317 cf_log_err(ci,
"Unexpected text after cron time specification");
376 DEBUG(951, 951,
"Listening on %s bound to virtual server %s",
408 virtual_server_dict_set(
inst->server_cs,
inst->dict,
false);
418 fp = fopen(
inst->filename,
"r");
437 .magic = RLM_MODULE_INIT,
Describes a new application (protocol)
#define UNCONST(_type, _ptr)
Remove const qualification from a pointer.
#define L(_str)
Helper for initialising arrays of string literals.
#define CONF_PARSER_TERMINATOR
#define FR_INTEGER_BOUND_CHECK(_name, _var, _op, _bound)
#define FR_CONF_OFFSET(_name, _struct, _field)
conf_parser_t which parses a single CONF_PAIR, writing the result to a field in a struct
#define FR_CONF_POINTER(_name, _type, _flags, _res_p)
conf_parser_t which parses a single CONF_PAIR producing a single global result
#define FR_CONF_OFFSET_FLAGS(_name, _flags, _struct, _field)
conf_parser_t which parses a single CONF_PAIR, writing the result to a field in a struct
@ CONF_FLAG_REQUIRED
Error out if no matching CONF_PAIR is found, and no dflt value is set.
@ CONF_FLAG_FILE_INPUT
File matching value must exist, and must be readable.
@ CONF_FLAG_NOT_EMPTY
CONF_PAIR is required to have a non zero length value.
@ CONF_FLAG_SUBSECTION
Instead of putting the information into a configuration structure, the configuration file routines MA...
#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
Defines a CONF_PAIR to C data type mapping.
Common header for all CONF_* types.
Configuration AVP similar to a fr_pair_t.
A section grouping multiple CONF_PAIR.
CONF_PAIR * cf_item_to_pair(CONF_ITEM const *ci)
Cast a CONF_ITEM to a CONF_PAIR.
char const * cf_section_name2(CONF_SECTION const *cs)
Return the second identifier of a CONF_SECTION.
char const * cf_pair_value(CONF_PAIR const *pair)
Return the value of a CONF_PAIR.
CONF_SECTION * cf_item_to_section(CONF_ITEM const *ci)
Cast a CONF_ITEM to a CONF_SECTION.
#define cf_log_err(_cf, _fmt,...)
#define cf_log_warn(_cf, _fmt,...)
static fr_dict_t const * dict_cron
static conf_parser_t const limit_config[]
static int type_parse(TALLOC_CTX *ctx, void *out, UNUSED void *parent, CONF_ITEM *ci, conf_parser_t const *rule)
static int mod_instantiate(void *instance, CONF_SECTION *conf)
Instantiate the application.
static size_t time_names_len
static int parse_field(CONF_ITEM *ci, char const **start, char const *name, unsigned int min, unsigned int max)
static int time_parse(TALLOC_CTX *ctx, void *out, UNUSED void *parent, CONF_ITEM *ci, conf_parser_t const *rule)
static conf_parser_t const proto_cron_config[]
How to parse a CRON listen section.
static int mod_open(void *instance, fr_schedule_t *sc, UNUSED CONF_SECTION *conf)
Open listen sockets/connect to external event source.
static fr_table_ptr_sorted_t time_names[]
fr_dict_autoload_t proto_cron_dict[]
fr_dict_attr_t const * fr_dict_attr_by_name(fr_dict_attr_err_t *err, fr_dict_attr_t const *parent, char const *attr))
Locate a fr_dict_attr_t by its name.
fr_dict_t const ** out
Where to write a pointer to the loaded/resolved fr_dict_t.
fr_dict_attr_t const * fr_dict_root(fr_dict_t const *dict)
Return the root attribute of a dictionary.
fr_dict_enum_value_t * fr_dict_enum_by_name(fr_dict_attr_t const *da, char const *name, ssize_t len)
Specifies a dictionary which must be loaded/loadable for the module to function.
size_t num_messages
for the message ring buffer
char const * name
printable name for this socket - set by open
void const * app_instance
size_t default_message_size
copied from app_io, but may be changed
void const * app_io_instance
I/O path configuration context.
int fr_io_listen_free(fr_listen_t *li)
CONF_SECTION * server_cs
CONF_SECTION of the server.
void * thread_instance
thread / socket context
int fd
file descriptor for this socket - set by open
#define fr_skip_whitespace(_p)
Skip whitespace ('\t', '\n', '\v', '\f', '\r', ' ')
int fr_pair_list_afrom_file(TALLOC_CTX *ctx, fr_dict_t const *dict, fr_pair_list_t *out, FILE *fp, bool *pfiledone)
Read valuepairs from the fp up to End-Of-File.
Cron master protocol handler.
static int instantiate(module_inst_ctx_t const *mctx)
static size_t min(size_t x, size_t y)
fr_network_t * fr_schedule_listen_add(fr_schedule_t *sc, fr_listen_t *li)
Add a fr_listen_t to a scheduler.
static const uchar sc[16]
eap_aka_sim_process_conf_t * inst
fr_aka_sim_id_type_t type
char const * fr_syserror(int num)
Guaranteed to be thread-safe version of strerror.
#define fr_table_value_by_str(_table, _name, _def)
Convert a string to a value using a sorted or ordered table.
An element in a lexicographically sorted array of name to ptr mappings.
char const * fr_strerror(void)
Get the last library error.
static size_t char ** out