The FreeRADIUS server  $Id: 15bac2a4c627c01d1aa2047687b3418955ac7f00 $
Data Structures | Macros | Typedefs | Enumerations | Functions
merged_model.c File Reference

Go to the source code of this file.

Data Structures

struct  decode_fail_t
 
struct  fr_dbuff_t
 
struct  fr_dict_attr_flags_t
 Values of the encryption flags. More...
 
struct  fr_dict_attr_t
 
struct  fr_dict_t
 
struct  fr_ipaddr_t
 IPv4/6 prefix. More...
 
struct  fr_sbuff_escape_rules_t
 
struct  fr_sbuff_t
 
struct  fr_sbuff_term_t
 Set of terminal elements. More...
 
struct  fr_sbuff_unescape_rules_t
 Set of parsing rules for *unescape_until functions. More...
 
struct  fr_value_box_t
 
union  pthread_mutex_t
 
struct  request_t
 
struct  tmpl_t
 

Macros

#define MD5_DIGEST_LENGTH   16
 
#define UINT8_MAX   255
 

Typedefs

typedef unsigned char bool
 
typedef ssize_t fr_slen_t
 
typedef unsigned int mode_t
 
typedef long long int off_t
 
typedef unsigned long int size_t
 
typedef long int ssize_t
 
typedef unsigned short uint16_t
 
typedef unsigned int uint32_t
 
typedef unsigned char uint8_t
 
typedef size_t(* xlat_escape_legacy_t) (request_t *request, char *out, size_t outlen, char const *in, void *arg)
 

Enumerations

enum  fr_sbuff_parse_error_t {
  FR_SBUFF_PARSE_OK = 0 ,
  FR_SBUFF_PARSE_ERROR_NOT_FOUND = -1 ,
  FR_SBUFF_PARSE_ERROR_TRAILING = -2 ,
  FR_SBUFF_PARSE_ERROR_FORMAT = -3 ,
  FR_SBUFF_PARSE_ERROR_OUT_OF_SPACE = -4 ,
  FR_SBUFF_PARSE_ERROR_NUM_OVERFLOW = -5 ,
  FR_SBUFF_PARSE_ERROR_NUM_UNDERFLOW = -6
}
 
enum  fr_type_t {
  FR_TYPE_NULL = 0 ,
  FR_TYPE_STRING ,
  FR_TYPE_OCTETS ,
  FR_TYPE_IPV4_ADDR ,
  FR_TYPE_IPV4_PREFIX ,
  FR_TYPE_IPV6_ADDR ,
  FR_TYPE_IPV6_PREFIX ,
  FR_TYPE_IFID ,
  FR_TYPE_COMBO_IP_ADDR ,
  FR_TYPE_COMBO_IP_PREFIX ,
  FR_TYPE_ETHERNET ,
  FR_TYPE_BOOL ,
  FR_TYPE_UINT8 ,
  FR_TYPE_UINT16 ,
  FR_TYPE_UINT32 ,
  FR_TYPE_UINT64 ,
  FR_TYPE_INT8 ,
  FR_TYPE_INT16 ,
  FR_TYPE_INT32 ,
  FR_TYPE_INT64 ,
  FR_TYPE_FLOAT32 ,
  FR_TYPE_FLOAT64 ,
  FR_TYPE_DATE ,
  FR_TYPE_TIME_DELTA ,
  FR_TYPE_SIZE ,
  FR_TYPE_TLV ,
  FR_TYPE_STRUCT ,
  FR_TYPE_VSA ,
  FR_TYPE_VENDOR ,
  FR_TYPE_GROUP ,
  FR_TYPE_VALUE_BOX ,
  FR_TYPE_VOID ,
  FR_TYPE_MAX ,
  FR_TYPE_NULL = 0 ,
  FR_TYPE_STRING ,
  FR_TYPE_OCTETS ,
  FR_TYPE_IPV4_ADDR ,
  FR_TYPE_IPV4_PREFIX ,
  FR_TYPE_IPV6_ADDR ,
  FR_TYPE_IPV6_PREFIX ,
  FR_TYPE_IFID ,
  FR_TYPE_COMBO_IP_ADDR ,
  FR_TYPE_COMBO_IP_PREFIX ,
  FR_TYPE_ETHERNET ,
  FR_TYPE_BOOL ,
  FR_TYPE_UINT8 ,
  FR_TYPE_UINT16 ,
  FR_TYPE_UINT32 ,
  FR_TYPE_UINT64 ,
  FR_TYPE_INT8 ,
  FR_TYPE_INT16 ,
  FR_TYPE_INT32 ,
  FR_TYPE_INT64 ,
  FR_TYPE_FLOAT32 ,
  FR_TYPE_FLOAT64 ,
  FR_TYPE_DATE ,
  FR_TYPE_TIME_DELTA ,
  FR_TYPE_SIZE ,
  FR_TYPE_TLV ,
  FR_TYPE_STRUCT ,
  FR_TYPE_VSA ,
  FR_TYPE_VENDOR ,
  FR_TYPE_GROUP ,
  FR_TYPE_VALUE_BOX ,
  FR_TYPE_VOID ,
  FR_TYPE_MAX
}
 
enum  tmpl_attr_prefix_t {
  TMPL_ATTR_REF_PREFIX_YES = 0 ,
  TMPL_ATTR_REF_PREFIX_NO ,
  TMPL_ATTR_REF_PREFIX_AUTO ,
  TMPL_ATTR_REF_PREFIX_YES = 0 ,
  TMPL_ATTR_REF_PREFIX_NO ,
  TMPL_ATTR_REF_PREFIX_AUTO
}
 

Functions

fr_slen_t fr_base16_decode_nstd (fr_sbuff_parse_error_t *err, fr_dbuff_t *out, fr_sbuff_t *in, bool no_trailing, uint8_t const alphabet[static UINT8_MAX+1])
 
fr_slen_t fr_base16_encode_nstd (fr_sbuff_t *out, fr_dbuff_t *in, char const alphabet[static UINT8_MAX+1])
 
ssize_t fr_dict_attr_flags_print (fr_sbuff_t *out, fr_dict_t const *dict, fr_type_t type, fr_dict_attr_flags_t const *flags)
 
ssize_t fr_dict_attr_oid_print (fr_sbuff_t *out, fr_dict_attr_t const *ancestor, fr_dict_attr_t const *da, bool numeric)
 
int fr_inet_pton4 (fr_ipaddr_t *out, char const *value, ssize_t inlen, bool resolve, bool fallback, bool mask_bits)
 
void fr_md5_calc (uint8_t out[static MD5_DIGEST_LENGTH], uint8_t const *in, size_t inlen)
 Perform a single digest operation on a single input buffer. More...
 
bool fr_radius_ok (uint8_t const *packet, size_t *packet_len_p, uint32_t max_attributes, bool require_message_authenticator, decode_fail_t *reason)
 
size_t fr_sbuff_out_bstrncpy_allowed (fr_sbuff_t *out, fr_sbuff_t *in, size_t len, bool const allowed[static UINT8_MAX+1])
 
ssize_t fr_sbuff_out_bstrncpy_exact (fr_sbuff_t *out, fr_sbuff_t *in, size_t len)
 
size_t fr_sbuff_out_bstrncpy_until (fr_sbuff_t *out, fr_sbuff_t *in, size_t len, fr_sbuff_term_t const *tt, fr_sbuff_unescape_rules_t const *u_rules)
 
size_t fr_sbuff_out_unescape_until (fr_sbuff_t *out, fr_sbuff_t *in, size_t len, fr_sbuff_term_t const *tt, fr_sbuff_unescape_rules_t const *u_rules)
 
fr_slen_t tmpl_print (fr_sbuff_t *out, tmpl_t const *vpt, tmpl_attr_prefix_t ar_prefix, fr_sbuff_escape_rules_t const *e_rules)
 
ssize_t xlat_eval (char *out, size_t outlen, request_t *request, char const *fmt, xlat_escape_legacy_t escape, void const *escape_ctx)
 

Data Structure Documentation

◆ decode_fail_t

struct decode_fail_t

Definition at line 256 of file merged_model.c.

◆ fr_dbuff_t

struct fr_dbuff_t

Definition at line 41 of file merged_model.c.

Data Fields
uint8_t * p

◆ fr_dict_attr_flags_t

struct fr_dict_attr_flags_t

Values of the encryption flags.

Definition at line 139 of file merged_model.c.

Data Fields
unsigned int array: 1 Pack multiples into 1 attr.
unsigned int counter: 1 integer attribute is actually an impulse / counter
unsigned int extra: 1 really "subtype is used by dict, not by protocol"
unsigned int has_value: 1 Has a value.
unsigned int: 1 is a local variable
unsigned int internal: 1 Internal attribute, should not be received in protocol packets, should not be encoded.
unsigned int is_alias: 1 This isn't a real attribute, it's a reference to to one.
unsigned int is_known_width: 1 is treated as if it has a known width for structs
unsigned int is_raw: 1 This dictionary attribute was constructed from a known attribute to allow the user to assign octets values directly.

See .is_unknown to determine if it is ephemeral.

unsigned int is_root: 1 Is root of a dictionary.
unsigned int is_unknown: 1 This dictionary attribute is ephemeral and not part of the main dictionary.
unsigned int is_unsigned: 1 hackity hack for dates and time deltas
uint8_t length length of the attribute
unsigned int name_only: 1 this attribute should always be referred to by name.

A number will be allocated, but the allocation scheme will depend on the parent, and definition type, and may not be stable in all instances.

unsigned int secret: 1 this attribute should be omitted in debug mode
uint8_t subtype protocol-specific values, OR key fields
uint8_t type_size For TLV2 and root attributes.

◆ fr_dict_attr_t

struct fr_dict_attr_t

Definition at line 133 of file merged_model.c.

◆ fr_dict_t

struct fr_dict_t

Definition at line 198 of file merged_model.c.

◆ fr_ipaddr_t

struct fr_ipaddr_t

IPv4/6 prefix.

Abstraction around the standard in_addr/in6_addr structures to support address family agnostic functions.

Definition at line 272 of file merged_model.c.

Data Fields
union fr_ipaddr_t addr
int af Address family.
uint8_t prefix Prefix length - Between 0-32 for IPv4 and 0-128 for IPv6.
uint32_t scope_id A host may have multiple link-local interfaces the scope ID allows the application to specify which of those interfaces the IP applies to.

A special scope_id of zero means that any interface of a given scope can be used.

◆ fr_sbuff_escape_rules_t

struct fr_sbuff_escape_rules_t

Definition at line 234 of file merged_model.c.

◆ fr_sbuff_t

struct fr_sbuff_t

Definition at line 37 of file merged_model.c.

Data Fields
char * p

◆ fr_sbuff_term_t

struct fr_sbuff_term_t

Set of terminal elements.

The elements MUST be listed in sorted order. If the inputs are not sorted, then all kinds of things will break.

Definition at line 161 of file merged_model.c.

+ Collaboration diagram for fr_sbuff_term_t:
Data Fields
fr_sbuff_term_elem_t * elem A sorted list of terminal strings.
size_t len Length of the list.

◆ fr_sbuff_unescape_rules_t

struct fr_sbuff_unescape_rules_t

Set of parsing rules for *unescape_until functions.

Definition at line 163 of file merged_model.c.

Data Fields
char chr Character at the start of an escape sequence.
bool do_hex Process hex sequences i.e.
\x<hex><hex>.
bool do_oct Process oct sequences i.e.
\<oct><oct><oct>.
char const * name Name for rule set to aid we debugging.
bool skip[UINT8_MAX+1] Characters that are escaped, but left in the output along with the escape character.

This is useful where we need to interpret escape sequences for parsing, but where the string will be passed off to a 3rd party library which will need to interpret the same sequences.

char subs[UINT8_MAX+1] Special characters and their substitutions.

Indexed by the printable representation i.e. 'n' for
.

◆ fr_value_box_t

struct fr_value_box_t

Definition at line 136 of file merged_model.c.

◆ pthread_mutex_t

union pthread_mutex_t

Definition at line 27 of file merged_model.c.

◆ request_t

struct request_t

Definition at line 210 of file merged_model.c.

◆ tmpl_t

struct tmpl_t

Definition at line 225 of file merged_model.c.

Macro Definition Documentation

◆ MD5_DIGEST_LENGTH

#define MD5_DIGEST_LENGTH   16

Definition at line 248 of file merged_model.c.

◆ UINT8_MAX

#define UINT8_MAX   255

Definition at line 32 of file merged_model.c.

Typedef Documentation

◆ bool

typedef unsigned char bool

Definition at line 19 of file merged_model.c.

◆ fr_slen_t

typedef ssize_t fr_slen_t

Definition at line 35 of file merged_model.c.

◆ mode_t

typedef unsigned int mode_t

Definition at line 21 of file merged_model.c.

◆ off_t

typedef long long int off_t

Definition at line 22 of file merged_model.c.

◆ size_t

typedef unsigned long int size_t

Definition at line 25 of file merged_model.c.

◆ ssize_t

typedef long int ssize_t

Definition at line 24 of file merged_model.c.

◆ uint16_t

typedef unsigned short uint16_t

Definition at line 31 of file merged_model.c.

◆ uint32_t

typedef unsigned int uint32_t

Definition at line 33 of file merged_model.c.

◆ uint8_t

typedef unsigned char uint8_t

Definition at line 30 of file merged_model.c.

◆ xlat_escape_legacy_t

typedef size_t(* xlat_escape_legacy_t) (request_t *request, char *out, size_t outlen, char const *in, void *arg)

Definition at line 213 of file merged_model.c.

Enumeration Type Documentation

◆ fr_sbuff_parse_error_t

Enumerator
FR_SBUFF_PARSE_OK 

No error.

FR_SBUFF_PARSE_ERROR_NOT_FOUND 

String does not contain a token matching the output type.

FR_SBUFF_PARSE_ERROR_TRAILING 

Trailing characters found.

FR_SBUFF_PARSE_ERROR_FORMAT 

Format of data was invalid.

FR_SBUFF_PARSE_ERROR_OUT_OF_SPACE 

No space available in output buffer.

FR_SBUFF_PARSE_ERROR_NUM_OVERFLOW 

Integer type would overflow.

FR_SBUFF_PARSE_ERROR_NUM_UNDERFLOW 

Integer type would underflow.

Definition at line 45 of file merged_model.c.

◆ fr_type_t

enum fr_type_t
Enumerator
FR_TYPE_NULL 

Invalid (uninitialised) attribute type.

FR_TYPE_STRING 

String of printable characters.

FR_TYPE_OCTETS 

Raw octets.

FR_TYPE_IPV4_ADDR 

32 Bit IPv4 Address.

FR_TYPE_IPV4_PREFIX 

IPv4 Prefix.

FR_TYPE_IPV6_ADDR 

128 Bit IPv6 Address.

FR_TYPE_IPV6_PREFIX 

IPv6 Prefix.

FR_TYPE_IFID 

Interface ID.

FR_TYPE_COMBO_IP_ADDR 

IPv4 or IPv6 address depending on length.

FR_TYPE_COMBO_IP_PREFIX 

IPv4 or IPv6 address prefix depending on length.

FR_TYPE_ETHERNET 

48 Bit Mac-Address.

FR_TYPE_BOOL 

A truth value.

FR_TYPE_UINT8 

8 Bit unsigned integer.

FR_TYPE_UINT16 

16 Bit unsigned integer.

FR_TYPE_UINT32 

32 Bit unsigned integer.

FR_TYPE_UINT64 

64 Bit unsigned integer.

FR_TYPE_INT8 

8 Bit signed integer.

FR_TYPE_INT16 

16 Bit signed integer.

FR_TYPE_INT32 

32 Bit signed integer.

FR_TYPE_INT64 

64 Bit signed integer.

FR_TYPE_FLOAT32 

Single precision floating point.

FR_TYPE_FLOAT64 

Double precision floating point.

FR_TYPE_DATE 

Unix time stamp, always has value >2^31.

FR_TYPE_TIME_DELTA 

A period of time measured in nanoseconds.

FR_TYPE_SIZE 

Unsigned integer capable of representing any memory address on the local system.

FR_TYPE_TLV 

Contains nested attributes.

FR_TYPE_STRUCT 

like TLV, but without T or L, and fixed-width children

FR_TYPE_VSA 

Vendor-Specific, for RADIUS attribute 26.

FR_TYPE_VENDOR 

Attribute that represents a vendor in the attribute tree.

FR_TYPE_GROUP 

A grouping of other attributes.

FR_TYPE_VALUE_BOX 

A boxed value.

FR_TYPE_VOID 

User data.

Should be a talloced chunk assigned to the ptr value of the union.

FR_TYPE_MAX 

Number of defined data types.

FR_TYPE_NULL 

Invalid (uninitialised) attribute type.

FR_TYPE_STRING 

String of printable characters.

FR_TYPE_OCTETS 

Raw octets.

FR_TYPE_IPV4_ADDR 

32 Bit IPv4 Address.

FR_TYPE_IPV4_PREFIX 

IPv4 Prefix.

FR_TYPE_IPV6_ADDR 

128 Bit IPv6 Address.

FR_TYPE_IPV6_PREFIX 

IPv6 Prefix.

FR_TYPE_IFID 

Interface ID.

FR_TYPE_COMBO_IP_ADDR 

IPv4 or IPv6 address depending on length.

FR_TYPE_COMBO_IP_PREFIX 

IPv4 or IPv6 address prefix depending on length.

FR_TYPE_ETHERNET 

48 Bit Mac-Address.

FR_TYPE_BOOL 

A truth value.

FR_TYPE_UINT8 

8 Bit unsigned integer.

FR_TYPE_UINT16 

16 Bit unsigned integer.

FR_TYPE_UINT32 

32 Bit unsigned integer.

FR_TYPE_UINT64 

64 Bit unsigned integer.

FR_TYPE_INT8 

8 Bit signed integer.

FR_TYPE_INT16 

16 Bit signed integer.

FR_TYPE_INT32 

32 Bit signed integer.

FR_TYPE_INT64 

64 Bit signed integer.

FR_TYPE_FLOAT32 

Single precision floating point.

FR_TYPE_FLOAT64 

Double precision floating point.

FR_TYPE_DATE 

Unix time stamp, always has value >2^31.

FR_TYPE_TIME_DELTA 

A period of time measured in nanoseconds.

FR_TYPE_SIZE 

Unsigned integer capable of representing any memory address on the local system.

FR_TYPE_TLV 

Contains nested attributes.

FR_TYPE_STRUCT 

like TLV, but without T or L, and fixed-width children

FR_TYPE_VSA 

Vendor-Specific, for RADIUS attribute 26.

FR_TYPE_VENDOR 

Attribute that represents a vendor in the attribute tree.

FR_TYPE_GROUP 

A grouping of other attributes.

FR_TYPE_VALUE_BOX 

A boxed value.

FR_TYPE_VOID 

User data.

Should be a talloced chunk assigned to the ptr value of the union.

FR_TYPE_MAX 

Number of defined data types.

Definition at line 80 of file merged_model.c.

◆ tmpl_attr_prefix_t

Enumerator
TMPL_ATTR_REF_PREFIX_YES 

Attribute refs must have '&' prefix.

TMPL_ATTR_REF_PREFIX_NO 

Attribute refs have no '&' prefix.

TMPL_ATTR_REF_PREFIX_AUTO 

Attribute refs may have a '&' prefix.

TMPL_ATTR_REF_PREFIX_YES 

Attribute refs must have '&' prefix.

TMPL_ATTR_REF_PREFIX_NO 

Attribute refs have no '&' prefix.

TMPL_ATTR_REF_PREFIX_AUTO 

Attribute refs may have a '&' prefix.

Definition at line 228 of file merged_model.c.

Function Documentation

◆ fr_base16_decode_nstd()

fr_slen_t fr_base16_decode_nstd ( fr_sbuff_parse_error_t err,
fr_dbuff_t out,
fr_sbuff_t in,
bool  no_trailing,
uint8_t const  alphabet[static UINT8_MAX+1] 
)

Definition at line 65 of file merged_model.c.

◆ fr_base16_encode_nstd()

fr_slen_t fr_base16_encode_nstd ( fr_sbuff_t out,
fr_dbuff_t in,
char const  alphabet[static UINT8_MAX+1] 
)

Definition at line 56 of file merged_model.c.

◆ fr_dict_attr_flags_print()

ssize_t fr_dict_attr_flags_print ( fr_sbuff_t out,
fr_dict_t const *  dict,
fr_type_t  type,
fr_dict_attr_flags_t const *  flags 
)

Definition at line 201 of file merged_model.c.

+ Here is the caller graph for this function:

◆ fr_dict_attr_oid_print()

ssize_t fr_dict_attr_oid_print ( fr_sbuff_t out,
fr_dict_attr_t const *  ancestor,
fr_dict_attr_t const *  da,
bool  numeric 
)

Definition at line 188 of file merged_model.c.

+ Here is the caller graph for this function:

◆ fr_inet_pton4()

int fr_inet_pton4 ( fr_ipaddr_t out,
char const *  value,
ssize_t  inlen,
bool  resolve,
bool  fallback,
bool  mask_bits 
)

Definition at line 275 of file merged_model.c.

+ Here is the caller graph for this function:

◆ fr_md5_calc()

void fr_md5_calc ( uint8_t  out[static MD5_DIGEST_LENGTH],
uint8_t const *  in,
size_t  inlen 
)

Perform a single digest operation on a single input buffer.

Definition at line 251 of file merged_model.c.

+ Here is the caller graph for this function:

◆ fr_radius_ok()

bool fr_radius_ok ( uint8_t const *  packet,
size_t packet_len_p,
uint32_t  max_attributes,
bool  require_message_authenticator,
decode_fail_t reason 
)

Definition at line 259 of file merged_model.c.

+ Here is the caller graph for this function:

◆ fr_sbuff_out_bstrncpy_allowed()

size_t fr_sbuff_out_bstrncpy_allowed ( fr_sbuff_t out,
fr_sbuff_t in,
size_t  len,
bool const  allowed[static UINT8_MAX+1] 
)

Definition at line 151 of file merged_model.c.

+ Here is the caller graph for this function:

◆ fr_sbuff_out_bstrncpy_exact()

ssize_t fr_sbuff_out_bstrncpy_exact ( fr_sbuff_t out,
fr_sbuff_t in,
size_t  len 
)

Definition at line 142 of file merged_model.c.

+ Here is the caller graph for this function:

◆ fr_sbuff_out_bstrncpy_until()

size_t fr_sbuff_out_bstrncpy_until ( fr_sbuff_t out,
fr_sbuff_t in,
size_t  len,
fr_sbuff_term_t const *  tt,
fr_sbuff_unescape_rules_t const *  u_rules 
)

Definition at line 166 of file merged_model.c.

+ Here is the caller graph for this function:

◆ fr_sbuff_out_unescape_until()

size_t fr_sbuff_out_unescape_until ( fr_sbuff_t out,
fr_sbuff_t in,
size_t  len,
fr_sbuff_term_t const *  tt,
fr_sbuff_unescape_rules_t const *  u_rules 
)

Definition at line 177 of file merged_model.c.

+ Here is the caller graph for this function:

◆ tmpl_print()

fr_slen_t tmpl_print ( fr_sbuff_t out,
tmpl_t const *  vpt,
tmpl_attr_prefix_t  ar_prefix,
fr_sbuff_escape_rules_t const *  e_rules 
)

Definition at line 237 of file merged_model.c.

+ Here is the caller graph for this function:

◆ xlat_eval()

ssize_t xlat_eval ( char *  out,
size_t  outlen,
request_t request,
char const *  fmt,
xlat_escape_legacy_t  escape,
void const *  escape_ctx 
)

Definition at line 215 of file merged_model.c.

+ Here is the caller graph for this function: