The FreeRADIUS server $Id: 15bac2a4c627c01d1aa2047687b3418955ac7f00 $
Loading...
Searching...
No Matches
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 <freeradius-devel/util/strerror.h>
+ Include dependency graph for skip.c:

Go to the source code of this file.

Functions

ssize_t fr_skip_condition (char const *start, char const *end, bool const terminal[static UINT8_MAX+1], 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.
 

Detailed Description

Preparse input by skipping known tokens.

Definition in file skip.c.

Function Documentation

◆ fr_skip_condition()

ssize_t fr_skip_condition ( char const *  start,
char const *  end,
bool const  terminal[static UINT8_MAX+1],
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 264 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 37 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 128 of file skip.c.

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