23RCSID(
"$Id: 87d3742995e3e1d649773e8e690b358547fd547b $")
25#include <freeradius-devel/server/base.h>
26#include <freeradius-devel/server/module_rlm.h>
27#include <freeradius-devel/server/tmpl_dcursor.h>
28#include <freeradius-devel/unlang/tmpl.h>
30#include <freeradius-devel/util/iovec.h>
31#include <freeradius-devel/util/perm.h>
32#include <freeradius-devel/util/print.h>
34#include <freeradius-devel/unlang/xlat_func.h>
143#define LINELOG_BOX_ESCAPE { \
144 .func = linelog_escape_func, \
145 .safe_for = (fr_value_box_safe_for_t) linelog_escape_func, \
146 .always_escape = false, \
193 switch (
inst->log_dst) {
195 DEBUG2(
"Opening UNIX socket at \"%s\"",
inst->unix_sock.path);
198 PERROR(
"Failed opening UNIX socket");
208 PERROR(
"Failed opening TCP socket");
218 PERROR(
"Failed opening UDP socket");
236 if (errno == EINPROGRESS) {
238 DEBUG2(
"Waiting for connection to complete...");
240 DEBUG2(
"Blocking until connection complete...");
243 PERROR(
"Failed connecting to log destination");
248 DEBUG2(
"Connection successful");
254 ERROR(
"Failed setting nonblock flag on fd");
282 if (vb->vb_length == 0)
return 0;
284 MEM(escaped =
fr_asprint(vb, vb->vb_strvalue, vb->vb_length, 0));
309 switch (
inst->log_dst) {
318 RERROR(
"Missing filename");
322 path = call_env->
filename->vb_strvalue;
325 p = strrchr(path,
'/');
328 if (
fr_mkdir(NULL, path, -1, 0700, NULL, NULL) < 0) {
343 if (
inst->file.group_str && (chown(path, -1,
inst->file.group) == -1)) {
352 if (call_env->
log_head && (offset == 0)) {
353 struct iovec head_vector_s[2];
354 size_t head_vector_len;
356 memcpy(&head_vector_s[0].iov_base, &call_env->
log_head->vb_strvalue,
sizeof(head_vector_s[0].iov_base));
357 head_vector_s[0].iov_len = call_env->
log_head->vb_length;
362 memcpy(&head_vector_s[1].iov_base, &(
inst->delimiter),
363 sizeof(head_vector_s[1].iov_base));
364 head_vector_s[1].iov_len =
inst->delimiter_len;
370 if (writev(fd, &head_vector_s[0], head_vector_len) < 0) {
376 fr_assert((errno != EINVAL) && (errno != EFAULT));
380 if (
inst->file.fsync && (fsync(fd) < 0)) {
389 ret = writev(fd, vector_p, vector_len);
390 if (ret < 0)
goto write_fail;
401 for (i = 0; i < vector_len; i++) {
402 RINFO(
"%.*s", (
int)vector_p[i].iov_len, (
char *)vector_p[i].iov_base);
403 ret += vector_p[i].iov_len;
410 timeout =
inst->unix_sock.timeout;
416 timeout =
inst->udp.timeout;
424 timeout =
inst->tcp.timeout;
430 if (!conn)
return -1;
432 for (i = num; i >= 0; i--) {
438 if (wrote < 0)
switch (errno) {
447 RWARN(
"Failed writing to socket: %s. Will reconnect and try again...",
468 RDEBUG2(
"Wrote %zi bytes", wrote);
472 while (read(conn->
sockfd, discard,
sizeof(discard)) > 0);
486 for (i = 0; i < vector_len; i++) {
487 syslog(
inst->syslog.priority,
"%.*s", (
int)vector_p[i].iov_len, (
char *)vector_p[i].iov_base);
488 ret += vector_p[i].iov_len;
498 if ((ret = writev(fd, vector_p, vector_len)) < 0) {
499 RERROR(
"Failed writing to \"%s\": %s",
517 fr_value_box_list_t *
args)
522 struct iovec vector[2];
530 vector[i].iov_base =
UNCONST(
char *,
msg->vb_strvalue);
531 vector[i].iov_len =
msg->vb_length;
536 memcpy(&vector[i].iov_base, &(
inst->delimiter),
sizeof(vector[i].iov_base));
537 vector[i].iov_len =
inst->delimiter_len;
541 if (
inst->file.buffer_write) {
563 wrote->vb_size = (
size_t)slen;
580 struct iovec *vector;
581 struct iovec *vector_p;
584 vector_len = fr_value_box_list_num_elements(&rctx->
expanded);
585 if (vector_len == 0) {
595 MEM(vector = vector_p = talloc_array(rctx,
struct iovec, vector_len));
600 REDEBUG(
"Failed casting value to string");
606 vector_p->iov_base =
UNCONST(
char *, vb->vb_strvalue);
607 vector_p->iov_len = vb->vb_length;
612 vector_p->iov_base =
UNCONST(
char *, vb->vb_octets);
613 vector_p->iov_len = vb->vb_length;
622 memcpy(&vector_p->iov_base, &(
inst->delimiter),
sizeof(vector_p->iov_base));
623 vector_p->iov_len =
inst->delimiter_len;
628 if (
inst->file.buffer_write) {
665 tmpl_t *empty, *
vpt = NULL, *vpt_p = NULL;
672 cf_log_err(
conf,
"A 'format', or 'reference' configuration item must be set to call this module");
687 char const *tmpl_str;
689 if (call_env->
log_ref->vb_length >= (
sizeof(
buff) - 2)) {
690 REDEBUG(
"Invalid log_ref - too long (%zu >= %zu)",
698 if (
buff[1] ==
'.') p++;
703 if (
buff[2] ==
'.') {
704 REDEBUG(
"Invalid path \"%s\"", p);
710 RPDEBUG2(
"Failed finding reference '%s'", p);
715 REDEBUG(
"Path \"%s\" resolves to a section (should be a pair)", p);
721 if (!tmpl_str || (tmpl_str[0] ==
'\0')) {
722 RDEBUG2(
"Path \"%s\" resolves to an empty config pair", p);
723 empty = talloc(frame_ctx,
tmpl_t);
741 .dict_def = request->local_dict,
742 .allow_unknown =
true,
743 .allow_unresolved =
false,
756 RPERROR(
"Runtime resolution of tmpl failed");
767 RDEBUG2(
"No default message configured");
773 RDEBUG2(
"Using default message");
783 switch (vpt_p->type) {
786 #define VECTOR_INCREMENT 20
791 struct iovec *vector = NULL, *vector_p;
795 MEM(vector = talloc_array(frame_ctx,
struct iovec, alloced));
800 if ((with_delim && ((i + 1) >= alloced)) ||
803 MEM(vector = talloc_realloc(frame_ctx, vector,
struct iovec, alloced));
806 switch (
vp->vp_type) {
809 vector[i].iov_len =
vp->vp_length;
810 vector[i].iov_base =
vp->vp_ptr;
815 vector[i].iov_base = p;
824 memcpy(&vector[i].iov_base, &(
inst->delimiter),
sizeof(vector[i].iov_base));
825 vector[i].iov_len =
inst->delimiter_len;
832 if (vector_len == 0) {
836 }
else if (
inst->file.buffer_write) {
873 fr_value_box_list_init(&rctx->
expanded);
897 our_rules = *t_rules;
902 .always_escape =
false,
910 &our_rules) < 0)
return -1;
912 *(
void **)
out = parsed;
940 snprintf(prefix,
sizeof(prefix),
"rlm_linelog (%s)", mctx->
mi->
name);
945 switch (
inst->log_dst) {
957 inst->triggers, NULL, NULL);
958 if (!
inst->file.ef) {
963 if (
inst->file.group_str) {
966 inst->file.group = strtol(
inst->file.group_str, &endptr, 10);
967 if (*endptr !=
'\0') {
970 inst->file.group_str);
980 inst->file.buffer_write =
true;
982 if (
inst->file.buffer_delay_is_set && !
inst->file.buffer_expiry_is_set) {
999 inst->file.buffer_write =
false;
1008#ifndef HAVE_SYSLOG_H
1009 cf_log_err(
conf,
"Syslog output is not supported on this system");
1012 if (
inst->syslog.facility) {
1018 inst->syslog.priority |= num;
1026 inst->syslog.priority |= num;
1032#ifndef HAVE_SYS_UN_H
1033 cf_log_err(
conf,
"Unix sockets are not supported on this system");
1038 if (!
inst->pool)
return -1;
1045 if (!
inst->pool)
return -1;
1051 if (!
inst->pool)
return -1;
unlang_action_t
Returned by unlang_op_t calls, determine the next action of the interpreter.
#define UNCONST(_type, _ptr)
Remove const qualification from a pointer.
#define L(_str)
Helper for initialising arrays of string literals.
#define FALL_THROUGH
clang 10 doesn't recognised the FALL-THROUGH comment anymore
#define CALL_ENV_TERMINATOR
#define FR_CALL_ENV_METHOD_OUT(_inst)
Helper macro for populating the size/type fields of a call_env_method_t from the output structure typ...
call_env_parser_t const * env
Parsing rules for call method env.
#define FR_CALL_ENV_SUBSECTION(_name, _name2, _flags, _subcs)
Specify a call_env_parser_t which defines a nested subsection.
@ CALL_ENV_FLAG_CONCAT
If the tmpl produced multiple boxes they should be concatenated.
@ CALL_ENV_FLAG_PARSE_ONLY
The result of parsing will not be evaluated at runtime.
@ CALL_ENV_FLAG_BARE_WORD_ATTRIBUTE
bare words are treated as an attribute, but strings may be xlats.
module_instance_t const * mi
Module instance that the callenv is registered to.
#define FR_CALL_ENV_OFFSET(_name, _cast_type, _flags, _struct, _field)
Specify a call_env_parser_t which writes out runtime results to the specified field.
#define FR_CALL_ENV_PARSE_ONLY_OFFSET(_name, _cast_type, _flags, _struct, _parse_field)
Specify a call_env_parser_t which writes out the result of the parsing phase to the field specified.
CONF_ITEM * cf_reference_item(CONF_SECTION const *parent_cs, CONF_SECTION const *outer_cs, char const *ptr)
int cf_parse_permissions(UNUSED TALLOC_CTX *ctx, void *out, UNUSED void *parent, CONF_ITEM *ci, UNUSED conf_parser_t const *rule)
Generic function for resolving permissions to a mode-t.
#define CONF_PARSER_TERMINATOR
cf_parse_t func
Override default parsing behaviour for the specified type with a custom parsing function.
#define FR_CONF_DEPRECATED(_name, _struct, _field)
conf_parser_t entry which raises an error if a matching CONF_PAIR is found
#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_TIME_DELTA_COND_CHECK(_name, _var, _cond, _new)
#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_IS_SET(_name, _type, _flags, _struct, _field)
conf_parser_t which parses a single CONF_PAIR, writing the result to a field in a struct,...
#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
#define FR_CONF_OFFSET_SUBSECTION(_name, _flags, _struct, _field, _subcs)
conf_parser_t which populates a sub-struct using a CONF_SECTION
@ CONF_FLAG_REQUIRED
Error out if no matching CONF_PAIR is found, and no dflt value is set.
@ CONF_FLAG_FILE_SOCKET
File matching value must exist, and must be a unix socket.
@ CONF_FLAG_SUBSECTION
Instead of putting the information into a configuration structure, the configuration file routines MA...
@ CONF_FLAG_HIDDEN
Used by scripts to omit items from the generated documentation.
#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.
bool cf_item_is_pair(CONF_ITEM const *ci)
Determine if CONF_ITEM is a CONF_PAIR.
CONF_SECTION * cf_section_find(CONF_SECTION const *cs, char const *name1, char const *name2)
Find a CONF_SECTION with name1 and optionally name2.
CONF_PAIR * cf_pair_find(CONF_SECTION const *cs, char const *attr)
Search for a CONF_PAIR with a specific name.
fr_token_t cf_pair_value_quote(CONF_PAIR const *pair)
Return the value (rhs) quoting of a pair.
CONF_PAIR * cf_item_to_pair(CONF_ITEM const *ci)
Cast a CONF_ITEM to a CONF_PAIR.
char const * cf_pair_value(CONF_PAIR const *pair)
Return the value of a CONF_PAIR.
#define cf_log_err(_cf, _fmt,...)
#define fr_dbuff_used(_dbuff_or_marker)
Return the number of bytes remaining between the start of the dbuff or marker and the current positio...
#define fr_dbuff_start(_dbuff_or_marker)
Return the 'start' position of a dbuff or marker.
#define FR_DBUFF_TALLOC_THREAD_LOCAL(_out, _init, _max)
Create a function local and thread local extensible dbuff.
static void * fr_dcursor_next(fr_dcursor_t *cursor)
Advanced the cursor to the next item.
static int fr_dcursor_insert(fr_dcursor_t *cursor, void *v)
Insert directly after the current item.
#define MODULE_MAGIC_INIT
Stop people using different module/library/server versions together.
int exfile_open(exfile_t *ef, char const *filename, mode_t permissions, int flags, off_t *offset)
Open a new log file, or maybe an existing one.
int exfile_close(exfile_t *ef, int fd)
Close the log file.
TALLOC_CTX * unlang_interpret_frame_talloc_ctx(request_t *request)
Get a talloc_ctx which is valid only for this frame.
fr_event_list_t * unlang_interpret_event_list(request_t *request)
Get the event list for the current interpreter.
ssize_t fr_writev(int fd, struct iovec vector[], int iovcnt, fr_time_delta_t timeout)
Write out a vector to a file descriptor.
fr_slen_t fr_concatv(fr_dbuff_t *out, struct iovec vector[], int iovcnt)
Concatenate an iovec into a dbuff.
fr_table_num_sorted_t const syslog_severity_table[]
Syslog severity table.
fr_table_num_sorted_t const syslog_facility_table[]
Syslog facility table.
#define RPDEBUG2(fmt,...)
#define RDEBUG_ENABLED3
True if request debug level 1-3 messages are enabled.
#define REMARKER(_str, _marker_idx, _marker,...)
Output string with error marker, showing where format error occurred.
#define RHEXDUMP3(_data, _len, _fmt,...)
int rad_filename_box_escape(fr_value_box_t *vb, UNUSED void *uxtc)
int rad_filename_box_make_safe(fr_value_box_t *vb, UNUSED void *uxtc)
ssize_t fr_mkdir(int *fd_out, char const *path, ssize_t len, mode_t mode, fr_mkdir_func_t func, void *uctx)
Create directories that are missing in the specified path.
@ FR_TYPE_TIME_DELTA
A period of time measured in nanoseconds.
@ FR_TYPE_STRING
String of printable characters.
@ FR_TYPE_SIZE
Unsigned integer capable of representing any memory address on the local system.
@ FR_TYPE_COMBO_IP_ADDR
IPv4 or IPv6 address depending on length.
@ FR_TYPE_OCTETS
Raw octets.
int fr_blocking(UNUSED int fd)
void * env_data
Per call environment data.
module_instance_t const * mi
Instance of the module being instantiated.
void * rctx
Resume ctx that a module previously set.
fr_event_list_t * el
Event list to register any IO handlers and timers against.
module_instance_t * mi
Module instance to detach.
void * thread
Thread instance data.
module_instance_t const * mi
Instance of the module being instantiated.
module_instance_t * mi
Instance of the module being instantiated.
Temporary structure to hold arguments for module calls.
Temporary structure to hold arguments for detach calls.
Temporary structure to hold arguments for instantiation calls.
Temporary structure to hold arguments for thread_instantiation calls.
exfile_t * module_rlm_exfile_init(TALLOC_CTX *ctx, CONF_SECTION *module, uint32_t max_entries, fr_time_delta_t max_idle, bool locking, bool triggers, char const *trigger_prefix, fr_pair_list_t *trigger_args)
Initialise a module specific exfile handle.
xlat_t * module_rlm_xlat_register(TALLOC_CTX *ctx, module_inst_ctx_t const *mctx, char const *name, xlat_func_t func, fr_type_t return_type)
fr_pool_t * module_rlm_connection_pool_init(CONF_SECTION *module, void *opaque, fr_pool_connection_create_t c, fr_pool_connection_alive_t a, char const *log_prefix, char const *trigger_prefix, fr_pair_list_t *trigger_args)
Initialise a module specific connection pool.
module_t common
Common fields presented by all modules.
linelog_buffer_action_t file_enqueue_write(rlm_linelog_file_entry_t **entry_p, module_ctx_t const *mctx, linelog_call_env_t const *call_env, request_t *request, struct iovec *vector_p, size_t vector_len)
void file_batching_mod_handle_signal(module_ctx_t const *mctx, request_t *request, fr_signal_t action)
void file_thread_init(rlm_linelog_thread_t *thread, fr_timer_list_t *tl)
void file_batching_xlat_handle_signal(xlat_ctx_t const *xctx, request_t *request, fr_signal_t action)
unlang_action_t file_batching_mod_resume(UNUSED unlang_result_t *p_result, module_ctx_t const *mctx, request_t *request)
xlat_action_t file_batching_xlat_resume(TALLOC_CTX *ctx, fr_dcursor_t *out, xlat_ctx_t const *xctx, request_t *request, UNUSED fr_value_box_list_t *in)
size_t data_len
How much data this entry holds in the sbuff.
@ LINELOG_BUFFER_WRITE_YIELD
Writing buffered data yielded.
@ LINELOG_BUFFER_WRITE_DONE
Writing buffered data completed.
@ LINELOG_BUFFER_WRITE_FAIL
Writing buffered data failed.
linelog module thread specific structure
int fr_perm_gid_from_str(TALLOC_CTX *ctx, gid_t *out, char const *name)
Resolve a group name to a GID.
void fr_pool_connection_release(fr_pool_t *pool, request_t *request, void *conn)
Release a connection.
void fr_pool_free(fr_pool_t *pool)
Delete a connection pool.
fr_pool_state_t const * fr_pool_state(fr_pool_t *pool)
Get the number of connections currently in the pool.
void * fr_pool_connection_get(fr_pool_t *pool, request_t *request)
Reserve a connection in the connection pool.
void * fr_pool_connection_reconnect(fr_pool_t *pool, request_t *request, void *conn)
Reconnect a suspected inviable connection.
uint32_t num
Number of connections in the pool.
char * fr_asprint(TALLOC_CTX *ctx, char const *in, ssize_t inlen, char quote)
Escape string that may contain binary data, and write it to a new buffer.
static const conf_parser_t config[]
#define RETURN_UNLANG_RCODE(_rcode)
#define RETURN_UNLANG_FAIL
rlm_rcode_t
Return codes indicating the result of the module call.
@ RLM_MODULE_OK
The module is OK, continue.
@ RLM_MODULE_FAIL
Module failed, don't reply.
@ RLM_MODULE_NOOP
Module succeeded without doing anything.
#define RETURN_UNLANG_NOOP
fr_dict_attr_t const * request_attr_request
static int mod_detach(module_detach_ctx_t const *mctx)
static int call_env_filename_parse(TALLOC_CTX *ctx, void *out, tmpl_rules_t const *t_rules, CONF_ITEM *ci, call_env_ctx_t const *cec, UNUSED call_env_parser_t const *rule)
static const conf_parser_t file_config[]
static const call_env_method_t linelog_xlat_method_env
static unlang_action_t mod_do_linelog_resume(unlang_result_t *p_result, module_ctx_t const *mctx, request_t *request)
#define LINELOG_BOX_ESCAPE
static unlang_action_t mod_do_linelog(unlang_result_t *p_result, module_ctx_t const *mctx, request_t *request)
Write a linelog message.
static const conf_parser_t syslog_config[]
static xlat_action_t linelog_xlat(TALLOC_CTX *ctx, fr_dcursor_t *out, xlat_ctx_t const *xctx, request_t *request, fr_value_box_list_t *args)
static int _mod_conn_free(linelog_conn_t *conn)
static int mod_bootstrap(module_inst_ctx_t const *mctx)
fr_value_box_list_t expanded
The result of expanding the fmt tmpl.
static const conf_parser_t udp_config[]
static void linelog_hexdump(request_t *request, struct iovec *vector_p, size_t vector_len, char const *msg)
static int linelog_write(rlm_linelog_t const *inst, linelog_call_env_t const *call_env, request_t *request, struct iovec *vector_p, size_t vector_len, bool with_delim)
int sockfd
File descriptor associated with socket.
static int mod_thread_instantiate(module_thread_inst_ctx_t const *mctx)
Initialise thread specific data strcuture.
static void * mod_conn_create(TALLOC_CTX *ctx, void *instance, fr_time_delta_t timeout)
static fr_table_num_sorted_t const linefr_log_dst_table[]
static const call_env_method_t linelog_method_env
static const conf_parser_t module_config[]
static int linelog_escape_func(fr_value_box_t *vb, UNUSED void *uctx)
Escape unprintable characters.
static const conf_parser_t unix_config[]
static size_t linefr_log_dst_table_len
static int mod_instantiate(module_inst_ctx_t const *mctx)
bool with_delim
Whether to add a delimiter.
static const conf_parser_t tcp_config[]
tmpl_t * log_src
Source of log messages.
@ LINELOG_DST_FILE
Log to a file.
@ LINELOG_DST_STDERR
Log to stderr.
@ LINELOG_DST_UNIX
Log via Unix socket.
@ LINELOG_DST_STDOUT
Log to stdout.
@ LINELOG_DST_TCP
Log via TCP.
@ LINELOG_DST_REQUEST
Log to the request->log.
@ LINELOG_DST_UDP
Log via UDP.
@ LINELOG_DST_SYSLOG
Log to syslog.
fr_value_box_t * log_head
Header to add to each new log file.
fr_value_box_t * log_ref
Path to a CONF_PAIR (to use as the source of log messages).
fr_value_box_t * filename
File name, if output is to a file.
#define FR_SBUFF_IN(_start, _len_or_end)
#define SECTION_NAME(_name1, _name2)
Define a section name consisting of a verb and a noun.
#define MODULE_THREAD_INST(_ctype)
char const * name
Instance name e.g. user_database.
CONF_SECTION * conf
Module's instance configuration.
size_t inst_size
Size of the module's instance data.
void * data
Module's instance data.
void * boot
Data allocated during the boostrap phase.
#define MODULE_BINDING_TERMINATOR
Terminate a module binding list.
Named methods exported by a module.
tmpl_escape_t escape
How escaping should be handled during evaluation.
int tmpl_resolve(tmpl_t *vpt, tmpl_res_rules_t const *tr_rules))
Attempt to resolve functions and attributes in xlats and attribute references.
fr_value_box_safe_for_t literals_safe_for
safe_for value assigned to literal values in xlats, execs, and data.
@ TMPL_TYPE_ATTR
Reference to one or more attributes.
@ TMPL_TYPE_DATA
Value in native boxed format.
ssize_t tmpl_afrom_substr(TALLOC_CTX *ctx, tmpl_t **out, fr_sbuff_t *in, fr_token_t quote, fr_sbuff_parse_rules_t const *p_rules, tmpl_rules_t const *t_rules))
Convert an arbitrary string into a tmpl_t.
tmpl_t * tmpl_init_shallow(tmpl_t *vpt, tmpl_type_t type, fr_token_t quote, char const *name, ssize_t len, tmpl_rules_t const *t_rules))
Initialise a tmpl without copying the input name string.
Optional arguments passed to vp_tmpl functions.
@ FR_SIGNAL_CANCEL
Request has been cancelled.
static char buff[sizeof("18446744073709551615")+3]
PUBLIC int snprintf(char *string, size_t length, char *format, va_alist)
int fr_socket_client_udp(char const *ifname, fr_ipaddr_t *src_ipaddr, uint16_t *src_port, fr_ipaddr_t const *dst_ipaddr, uint16_t dst_port, bool async)
Establish a connected UDP socket.
int fr_socket_client_tcp(char const *ifname, fr_ipaddr_t *src_ipaddr, fr_ipaddr_t const *dst_ipaddr, uint16_t dst_port, bool async)
Establish a connected TCP socket.
int fr_socket_wait_for_connect(int sockfd, fr_time_delta_t timeout)
Wait for a socket to be connected, with an optional timeout.
int fr_socket_client_unix(UNUSED char const *path, UNUSED bool async)
unlang_action_t unlang_module_yield(request_t *request, module_method_t resume, unlang_module_signal_t signal, fr_signal_t sigmask, void *rctx)
Yield a request back to the interpreter from within a module.
unlang_action_t unlang_module_yield_to_tmpl(TALLOC_CTX *ctx, fr_value_box_list_t *out, request_t *request, tmpl_t const *vpt, unlang_tmpl_args_t *args, module_method_t resume, unlang_module_signal_t signal, fr_signal_t sigmask, void *rctx)
Push a pre-compiled tmpl and resumption state onto the stack for evaluation.
eap_aka_sim_process_conf_t * inst
Stores an attribute, a value and various bits of other data.
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.
#define fr_table_str_by_value(_table, _number, _def)
Convert an integer to a string.
An element in a lexicographically sorted array of name to num mappings.
#define talloc_get_type_abort_const
static size_t talloc_strlen(char const *s)
Returns the length of a talloc array containing a string.
static int64_t fr_time_delta_unwrap(fr_time_delta_t time)
#define fr_time_delta_lt(_a, _b)
#define fr_time_delta_wrap(_time)
#define fr_time_delta_ispos(_a)
static fr_time_delta_t fr_time_delta_mul(fr_time_delta_t a, int64_t b)
#define fr_time_delta_gt(_a, _b)
A time delta, a difference in time measured in nanoseconds.
void tmpl_dcursor_clear(tmpl_dcursor_ctx_t *cc)
Clear any temporary state allocations.
#define tmpl_dcursor_init(_err, _ctx, _cc, _cursor, _request, _vpt)
Maintains state between cursor calls.
fr_value_box_escape_t box_escape
How to escape when returned from evaluation.
@ TMPL_ESCAPE_PRE_CONCAT
Pre-concatenation escaping is useful for DSLs where elements of the expansion are static,...
tmpl_escape_mode_t mode
Whether to apply escape function after concatenation, i.e.
xlat_action_t unlang_xlat_yield(request_t *request, xlat_func_t resume, xlat_func_signal_t signal, fr_signal_t sigmask, void *rctx)
Yield a request back to the interpreter from within a module.
#define XLAT_ARGS(_list,...)
Populate local variables with value boxes from the input list.
unsigned int required
Argument must be present, and non-empty.
#define XLAT_ARG_PARSER_TERMINATOR
@ XLAT_ACTION_FAIL
An xlat function failed.
@ XLAT_ACTION_DONE
We're done evaluating this level of nesting.
Definition for a single argument consumed by an xlat function.
char const * fr_strerror(void)
Get the last library error.
fr_sbuff_parse_rules_t const * value_parse_rules_quoted[T_TOKEN_LAST]
Parse rules for quoted strings.
int fr_value_box_cast_in_place(TALLOC_CTX *ctx, fr_value_box_t *vb, fr_type_t dst_type, fr_dict_attr_t const *dst_enumv)
Convert one type of fr_value_box_t to another in place.
void fr_value_box_strdup_shallow_replace(fr_value_box_t *vb, char const *src, ssize_t len)
Free the existing buffer (if talloced) associated with the valuebox, and replace it with a new one.
void fr_value_box_strdup_shallow(fr_value_box_t *dst, fr_dict_attr_t const *enumv, char const *src, bool tainted)
Assign a buffer containing a nul terminated string to a box, but don't copy it.
#define fr_value_box_alloc(_ctx, _type, _enumv)
Allocate a value box of a specific type.
static fr_slen_t fr_value_box_aprint(TALLOC_CTX *ctx, char **out, fr_value_box_t const *data, fr_sbuff_escape_rules_t const *e_rules) 1(fr_value_box_print
#define fr_box_ipaddr(_val)
#define fr_value_box_init_null(_vb)
Initialise an empty/null box that will be filled later.
fr_value_box_safe_for_t safe_for
uintptr_t fr_value_box_safe_for_t
Escaping that's been applied to a value box.
fr_value_box_escape_func_t func
#define fr_value_box_list_foreach(_list_head, _iter)
static size_t char ** out
#define FR_VALUE_BOX_SAFE_FOR_ANY
void * env_data
Expanded call env data.
module_ctx_t const * mctx
Synthesised module calling ctx.
int xlat_func_args_set(xlat_t *x, xlat_arg_parser_t const args[])
Register the arguments of an xlat.
void xlat_func_call_env_set(xlat_t *x, call_env_method_t const *env_method)
Register call environment of an xlat.