25#include <freeradius-devel/server/cf_parse.h>
26#include <freeradius-devel/server/tmpl.h>
27#include <freeradius-devel/util/perm.h>
29#include <freeradius-devel/bio/fd_priv.h>
32 {
L(
"read-only"), O_RDONLY },
33 {
L(
"read-write"), O_RDWR },
34 {
L(
"ro"), O_RDONLY },
60 int socket_type = SOCK_STREAM;
80 cf_log_perr(ci,
"Failed finding transport configuration section %s { ... }",
name);
93 if (strcmp(
name,
"udp") == 0) socket_type = SOCK_DGRAM;
231 if (strcmp(
name,
"udp") != 0) {
232 cf_log_err(ci,
"Invalid transport for unconnected UDP socket");
383 if (rcode < 0)
return rcode;
#define L(_str)
Helper for initialising arrays of string literals.
int cf_parse_gid(TALLOC_CTX *ctx, void *out, UNUSED void *parent, CONF_ITEM *ci, UNUSED conf_parser_t const *rule)
Generic function for resolving GID strings to uid_t values.
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.
int cf_parse_uid(TALLOC_CTX *ctx, void *out, UNUSED void *parent, CONF_ITEM *ci, UNUSED conf_parser_t const *rule)
Generic function for resolving UID strings to uid_t values.
#define CONF_PARSER_TERMINATOR
cf_parse_t func
Override default parsing behaviour for the specified type with a custom parsing function.
#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 cf_section_rules_push(_cs, _rule)
#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
@ CONF_FLAG_REQUIRED
Error out if no matching CONF_PAIR is found, and no dflt value is set.
@ 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.
A section grouping multiple 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_SECTION * cf_item_to_section(CONF_ITEM const *ci)
Cast a CONF_ITEM to a CONF_SECTION.
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 cf_log_perr(_cf, _fmt,...)
@ FR_BIO_FD_CONNECTED
connected client sockets (UDP or TCP)
@ FR_BIO_FD_INVALID
not set
@ FR_BIO_FD_UNCONNECTED
unconnected UDP / datagram only
@ FR_BIO_FD_LISTEN
returns new fd in buffer on fr_bio_read() or fr_bio_fd_accept()
fr_bio_fd_type_t type
accept, connected, unconnected, etc.
bool server
is this a client or a server?
int socket_type
SOCK_STREAM or SOCK_DGRAM.
Configuration for sockets.
const conf_parser_t fr_bio_fd_server_config[]
static conf_parser_t const client_udp_unconnected_config[]
static conf_parser_t const client_file_config[]
static const conf_parser_t server_unix_sub_config[]
static size_t server_transport_names_len
static conf_parser_t const server_unix_config[]
static const conf_parser_t server_udp_sub_config[]
static int mode_parse(UNUSED TALLOC_CTX *ctx, void *out, UNUSED void *parent, CONF_ITEM *ci, UNUSED conf_parser_t const *rule)
static const conf_parser_t client_udp_sub_config[]
static const conf_parser_t server_file_sub_config[]
static const conf_parser_t client_unix_sub_config[]
static int common_transport_parse(UNUSED TALLOC_CTX *ctx, void *out, void *parent, CONF_ITEM *ci, UNUSED conf_parser_t const *rule, fr_table_ptr_sorted_t const *transport_table, size_t transport_table_len)
Parse "transport" and then set the subconfig.
static const conf_parser_t client_udp_unconnected_sub_config[]
const conf_parser_t fr_bio_fd_client_config[]
static conf_parser_t const client_udp_config[]
static int server_transport_parse(TALLOC_CTX *ctx, void *out, void *parent, CONF_ITEM *ci, conf_parser_t const *rule)
Parse "transport" and then set the subconfig.
static fr_table_ptr_sorted_t client_transport_names[]
static size_t client_transport_names_len
static const conf_parser_t client_file_sub_config[]
static int client_transport_parse(TALLOC_CTX *ctx, void *out, void *parent, CONF_ITEM *ci, conf_parser_t const *rule)
Parse "transport" and then set the subconfig.
static conf_parser_t const client_unix_config[]
static const conf_parser_t client_tcp_sub_config[]
static conf_parser_t const server_file_config[]
static conf_parser_t const server_udp_config[]
static const conf_parser_t server_peercred_config[]
static const conf_parser_t server_tcp_sub_config[]
static size_t mode_names_len
static fr_table_num_sorted_t mode_names[]
static conf_parser_t const server_tcp_config[]
static fr_table_ptr_sorted_t server_transport_names[]
static conf_parser_t const client_tcp_config[]
@ FR_TYPE_IPV4_ADDR
32 Bit IPv4 Address.
@ FR_TYPE_UINT32
32 Bit unsigned integer.
@ FR_TYPE_IPV6_ADDR
128 Bit IPv6 Address.
@ FR_TYPE_COMBO_IP_ADDR
IPv4 or IPv6 address depending on length.
static fr_bio_fd_config_t fd_config
#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 num mappings.
An element in a lexicographically sorted array of name to ptr mappings.
static size_t char ** out