The FreeRADIUS server $Id: 15bac2a4c627c01d1aa2047687b3418955ac7f00 $
Loading...
Searching...
No Matches
Macros | Functions
skip.c File Reference

Preparse input by skipping known tokens. More...

#include <freeradius-devel/util/misc.h>
#include <freeradius-devel/util/skip.h>
+ Include dependency graph for skip.c:

Go to the source code of this file.

Macros

#define SKIP_MAX_DEPTH   64
 

Functions

ssize_t fr_skip_brackets (char const *start, char const *end, char end_quote)
 Skip a generic {...} or (...) arguments.
 
ssize_t fr_skip_condition (char const *start, char const *end, bool const terminal[static SBUFF_CHAR_CLASS], bool *eol)
 Skip a conditional expression.
 
ssize_t fr_skip_string (char const *start, char const *end)
 Skip a quoted string.
 
ssize_t fr_skip_xlat (char const *start, char const *end)
 Skip an xlat expression.
 
static ssize_t skip_brackets (char const *start, char const *end, char end_quote, unsigned int depth)
 
static ssize_t skip_xlat (char const *start, char const *end, unsigned int depth)
 

Detailed Description

Preparse input by skipping known tokens.

Definition in file skip.c.

Macro Definition Documentation

◆ SKIP_MAX_DEPTH

#define SKIP_MAX_DEPTH   64

Definition at line 119 of file skip.c.

Function Documentation

◆ fr_skip_brackets()

ssize_t fr_skip_brackets ( char const *  start,
char const *  end,
char  end_quote 
)

Skip a generic {...} or (...) arguments.

Definition at line 277 of file skip.c.

+ Here is the call graph for this function:

◆ fr_skip_condition()

ssize_t fr_skip_condition ( char const *  start,
char const *  end,
bool const  terminal[static SBUFF_CHAR_CLASS],
bool eol 
)

Skip a conditional expression.

This is a simple "peek ahead" parser which tries to not be wrong. It may accept some things which will later parse as invalid (e.g. unknown attributes, etc.) But it also rejects all malformed expressions.

It's used as a quick hack because the full parser isn't always available.

Parameters
[in]startstart of the condition.
[in]endend of the string (or NULL for zero-terminated strings)
[in]terminalterminal character(s)
[out]eoldid the parse error happen at eol?
Returns
>0 length of the string which was parsed. *eol is false. <=0 on error, *eol may be set.

Definition at line 317 of file skip.c.

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

◆ fr_skip_string()

ssize_t fr_skip_string ( char const *  start,
char const *  end 
)

Skip a quoted string.

Parameters
[in]startstart of the string, pointing to the quotation character
[in]endend of the string (or NULL for zero-terminated strings)
Returns
>0 length of the string which was parsed <=0 on error

Definition at line 36 of file skip.c.

+ Here is the caller graph for this function:

◆ fr_skip_xlat()

ssize_t fr_skip_xlat ( char const *  start,
char const *  end 
)

Skip an xlat expression.

This is a simple "peek ahead" parser which tries to not be wrong. It may accept some things which will later parse as invalid (e.g. unknown attributes, etc.) But it also rejects all malformed expressions.

It's used as a quick hack because the full parser isn't always available.

Parameters
[in]startstart of the expression, MUST point to the "%{" or "%("
[in]endend of the string (or NULL for zero-terminated strings)
Returns
>0 length of the string which was parsed <=0 on error

Definition at line 296 of file skip.c.

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

◆ skip_brackets()

static ssize_t skip_brackets ( char const *  start,
char const *  end,
char  end_quote,
unsigned int  depth 
)
static

Definition at line 124 of file skip.c.

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

◆ skip_xlat()

static ssize_t skip_xlat ( char const *  start,
char const *  end,
unsigned int  depth 
)
static

Definition at line 216 of file skip.c.

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