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

Preparse input by skipping known tokens. More...

#include <sys/types.h>
#include <stdbool.h>
+ Include dependency graph for skip.h:

Go to the source code of this file.

Macros

#define fr_bskip_whitespace(_p, _e)   while((_p < _e) && isspace((uint8_t)*(_p))) _p++
 Skip whitespace, stopping at end ('\t', '\n', '\v', '\f', '\r', ' ')
 
#define fr_skip_not_whitespace(_p)   while(*_p && !isspace((uint8_t)*(_p))) _p++
 Skip everything that's not whitespace ('\t', '\n', '\v', '\f', '\r', ' ')
 
#define fr_skip_whitespace(_p)   while(isspace((uint8_t)*(_p))) _p++
 Skip whitespace ('\t', '\n', '\v', '\f', '\r', ' ')
 

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.h.

Macro Definition Documentation

◆ fr_bskip_whitespace

#define fr_bskip_whitespace (   _p,
  _e 
)    while((_p < _e) && isspace((uint8_t)*(_p))) _p++

Skip whitespace, stopping at end ('\t', '\n', '\v', '\f', '\r', ' ')

Parameters
[in,out]_pstring to skip over.
[in]_epointer to end of string.

Definition at line 44 of file skip.h.

◆ fr_skip_not_whitespace

#define fr_skip_not_whitespace (   _p)    while(*_p && !isspace((uint8_t)*(_p))) _p++

Skip everything that's not whitespace ('\t', '\n', '\v', '\f', '\r', ' ')

Parameters
[in,out]_pstring to skip over.

Definition at line 50 of file skip.h.

◆ fr_skip_whitespace

#define fr_skip_whitespace (   _p)    while(isspace((uint8_t)*(_p))) _p++

Skip whitespace ('\t', '\n', '\v', '\f', '\r', ' ')

Parameters
[in,out]_pstring to skip over.

Definition at line 37 of file skip.h.

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: