The FreeRADIUS server  $Id: 15bac2a4c627c01d1aa2047687b3418955ac7f00 $
Functions | Variables
pair_legacy.c File Reference

AVP manipulation and search API. More...

#include <freeradius-devel/util/dict.h>
#include <freeradius-devel/util/pair.h>
#include <freeradius-devel/util/pair_legacy.h>
#include <freeradius-devel/util/misc.h>
#include <freeradius-devel/util/proto.h>
#include <freeradius-devel/util/regex.h>
#include <freeradius-devel/protocol/radius/rfc2865.h>
#include <freeradius-devel/protocol/freeradius/freeradius.internal.h>
+ Include dependency graph for pair_legacy.c:

Go to the source code of this file.

Functions

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. More...
 
fr_slen_t fr_pair_list_afrom_substr (fr_pair_parse_t const *root, fr_pair_parse_t *relative, fr_sbuff_t *in)
 Parse a fr_pair_list_t from a substring. More...
 
void fr_pair_list_move_op (fr_pair_list_t *to, fr_pair_list_t *from, fr_token_t op)
 Move pairs from source list to destination list respecting operator. More...
 
static ssize_t fr_pair_value_from_substr (fr_pair_t *vp, fr_sbuff_t *in, bool tainted)
 

Variables

static fr_sbuff_term_t const bareword_terminals
 
static fr_sbuff_parse_rules_t const bareword_unquoted
 
static fr_table_num_sorted_t const pair_assignment_op_table []
 
static ssize_t pair_assignment_op_table_len = NUM_ELEMENTS(pair_assignment_op_table)
 
static fr_table_num_sorted_t const pair_comparison_op_table []
 
static size_t pair_comparison_op_table_len = NUM_ELEMENTS(pair_comparison_op_table)
 

Detailed Description

AVP manipulation and search API.

Definition in file pair_legacy.c.

Function Documentation

◆ fr_pair_list_afrom_file()

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.

Parameters
[in]ctxfor talloc
[in]dictto resolve attributes in.
[in,out]outwhere the parsed fr_pair_ts will be appended.
[in]fpto read valuepairs from.
[out]pfiledonetrue if file parsing complete;
Returns
  • 0 on success
  • -1 on error

Definition at line 572 of file pair_legacy.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fr_pair_list_afrom_substr()

fr_slen_t fr_pair_list_afrom_substr ( fr_pair_parse_t const *  root,
fr_pair_parse_t relative,
fr_sbuff_t in 
)

Parse a fr_pair_list_t from a substring.

Parameters
[in]rootwhere we start parsing from
[in,out]relativewhere we left off, or where we should continue from
[in]ininput sbuff
Returns
  • <0 on error
  • 0 on no input
  • >0 on how many bytes of input we read

Definition at line 150 of file pair_legacy.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fr_pair_list_move_op()

void fr_pair_list_move_op ( fr_pair_list_t to,
fr_pair_list_t from,
fr_token_t  op 
)

Move pairs from source list to destination list respecting operator.

Note
This function does some additional magic that's probably not needed in most places. Consider using radius_legacy_map_cmp() and radius_legacy_map_apply() instead.
fr_pair_list_free should be called on the head of the source list to free unmoved attributes (if they're no longer needed).
Parameters
[in,out]todestination list.
[in,out]fromsource list.
[in]opoperator for list move.

Definition at line 651 of file pair_legacy.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fr_pair_value_from_substr()

static ssize_t fr_pair_value_from_substr ( fr_pair_t vp,
fr_sbuff_t in,
bool  tainted 
)
static

Definition at line 102 of file pair_legacy.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Variable Documentation

◆ bareword_terminals

fr_sbuff_term_t const bareword_terminals
static
Initial value:
=
L("\t"),
L("\n"),
L(" "),
L("!*"),
L("!="),
L("!~"),
L("&&"),
L(")"),
L("+="),
L("-="),
L(":="),
L("<"),
L("<="),
L("=*"),
L("=="),
L("=~"),
L(">"),
L(">="),
L("||"),
)
#define L(_str)
Helper for initialising arrays of string literals.
Definition: build.h:207
#define FR_SBUFF_TERMS(...)
Initialise a terminal structure with a list of sorted strings.
Definition: sbuff.h:167

Definition at line 36 of file pair_legacy.c.

◆ bareword_unquoted

fr_sbuff_parse_rules_t const bareword_unquoted
static
Initial value:
= {
.terminals = &FR_SBUFF_TERMS(
L(""),
L("\t"),
L("\n"),
L("\r"),
L(" "),
L(","),
L("}")
)
}

Definition at line 89 of file pair_legacy.c.

◆ pair_assignment_op_table

fr_table_num_sorted_t const pair_assignment_op_table[]
static
Initial value:
= {
{ L("+="), T_OP_ADD_EQ },
{ L(":="), T_OP_EQ },
{ L("="), T_OP_EQ },
}
@ T_OP_EQ
Definition: token.h:83
@ T_OP_ADD_EQ
Definition: token.h:69

Definition at line 59 of file pair_legacy.c.

◆ pair_assignment_op_table_len

ssize_t pair_assignment_op_table_len = NUM_ELEMENTS(pair_assignment_op_table)
static

Definition at line 64 of file pair_legacy.c.

◆ pair_comparison_op_table

fr_table_num_sorted_t const pair_comparison_op_table[]
static
Initial value:
= {
{ L("!*"), T_OP_CMP_FALSE },
{ L("!="), T_OP_NE },
{ L("!~"), T_OP_REG_NE },
{ L("+="), T_OP_ADD_EQ },
{ L(":="), T_OP_SET },
{ L("<"), T_OP_LT },
{ L("<="), T_OP_LE },
{ L("="), T_OP_EQ },
{ L("=*"), T_OP_CMP_TRUE },
{ L("=="), T_OP_CMP_EQ },
{ L("=~"), T_OP_REG_EQ },
{ L(">"), T_OP_GT },
{ L(">="), T_OP_GE }
}
@ T_OP_CMP_TRUE
Definition: token.h:104
@ T_OP_SET
Definition: token.h:84
@ T_OP_NE
Definition: token.h:97
@ T_OP_CMP_FALSE
Definition: token.h:105
@ T_OP_REG_EQ
Definition: token.h:102
@ T_OP_CMP_EQ
Definition: token.h:106
@ T_OP_LE
Definition: token.h:100
@ T_OP_GE
Definition: token.h:98
@ T_OP_GT
Definition: token.h:99
@ T_OP_LT
Definition: token.h:101
@ T_OP_REG_NE
Definition: token.h:103

Definition at line 66 of file pair_legacy.c.

◆ pair_comparison_op_table_len

size_t pair_comparison_op_table_len = NUM_ELEMENTS(pair_comparison_op_table)
static

Definition at line 81 of file pair_legacy.c.