The FreeRADIUS server  $Id: 15bac2a4c627c01d1aa2047687b3418955ac7f00 $
Macros | Typedefs | Enumerations | Functions | Variables
token.h File Reference

Tokenisation code and constants. More...

#include <freeradius-devel/build.h>
#include <freeradius-devel/missing.h>
#include <freeradius-devel/util/table.h>
#include <stdbool.h>
#include <stdint.h>
+ Include dependency graph for token.h:

Go to the source code of this file.

Macros

#define FR_TABLE_NOT_FOUND   INT32_MIN
 Macro to use as dflt. More...
 
#define T_EQEND   (T_HASH)
 
#define T_EQSTART   T_OP_ADD_EQ
 
#define T_OP_XOR_EQ   T_OP_PREPEND
 
#define T_TOKEN_LAST   (T_SOLIDUS_QUOTED_STRING + 1)
 

Typedefs

typedef enum fr_token fr_token_t
 

Enumerations

enum  fr_token {
  T_INVALID = 0 ,
  T_EOL ,
  T_LCBRACE ,
  T_RCBRACE ,
  T_LBRACE ,
  T_RBRACE ,
  T_COMMA ,
  T_SEMICOLON ,
  T_ADD ,
  T_SUB ,
  T_MUL ,
  T_DIV ,
  T_AND ,
  T_OR ,
  T_NOT ,
  T_XOR ,
  T_COMPLEMENT ,
  T_MOD ,
  T_RSHIFT ,
  T_LSHIFT ,
  T_OP_ADD_EQ ,
  T_OP_SUB_EQ ,
  T_OP_MUL_EQ ,
  T_OP_DIV_EQ ,
  T_OP_OR_EQ ,
  T_OP_AND_EQ ,
  T_OP_RSHIFT_EQ ,
  T_OP_LSHIFT_EQ ,
  T_OP_EQ ,
  T_OP_SET ,
  T_OP_PREPEND ,
  T_LAND ,
  T_LOR ,
  T_OP_NE ,
  T_OP_GE ,
  T_OP_GT ,
  T_OP_LE ,
  T_OP_LT ,
  T_OP_REG_EQ ,
  T_OP_REG_NE ,
  T_OP_CMP_TRUE ,
  T_OP_CMP_FALSE ,
  T_OP_CMP_EQ ,
  T_OP_CMP_EQ_TYPE ,
  T_OP_CMP_NE_TYPE ,
  T_OP_INCRM ,
  T_HASH ,
  T_BARE_WORD ,
  T_DOUBLE_QUOTED_STRING ,
  T_SINGLE_QUOTED_STRING ,
  T_BACK_QUOTED_STRING ,
  T_SOLIDUS_QUOTED_STRING
}
 

Functions

ssize_t fr_skip_string (char const *start, char const *end)
 Skip a quoted string. More...
 
char const * fr_token_name (int)
 
fr_token_t getop (char const **ptr)
 
fr_token_t getstring (char const **ptr, char *buf, int buflen, bool unescape)
 
fr_token_t gettoken (char const **ptr, char *buf, int buflen, bool unescape)
 
int getword (char const **ptr, char *buf, int buflen, bool unescape)
 

Variables

const bool fr_assignment_op [T_TOKEN_LAST]
 
const bool fr_binary_op [T_TOKEN_LAST]
 
const bool fr_comparison_op [T_TOKEN_LAST]
 
const bool fr_list_assignment_op [T_TOKEN_LAST]
 
const bool fr_str_tok [T_TOKEN_LAST]
 
const char fr_token_quote [T_TOKEN_LAST]
 Convert tokens back to a quoting character. More...
 
fr_table_num_sorted_t const fr_token_quotes_table []
 
size_t fr_token_quotes_table_len
 
const char * fr_tokens [T_TOKEN_LAST]
 
fr_table_num_ordered_t const fr_tokens_table []
 
size_t fr_tokens_table_len
 

Detailed Description

Tokenisation code and constants.

This is mostly for the attribute filter and user files.

Definition in file token.h.

Macro Definition Documentation

◆ FR_TABLE_NOT_FOUND

#define FR_TABLE_NOT_FOUND   INT32_MIN

Macro to use as dflt.

Definition at line 137 of file token.h.

◆ T_EQEND

#define T_EQEND   (T_HASH)

Definition at line 132 of file token.h.

◆ T_EQSTART

#define T_EQSTART   T_OP_ADD_EQ

Definition at line 131 of file token.h.

◆ T_OP_XOR_EQ

#define T_OP_XOR_EQ   T_OP_PREPEND

Definition at line 86 of file token.h.

◆ T_TOKEN_LAST

#define T_TOKEN_LAST   (T_SOLIDUS_QUOTED_STRING + 1)

Definition at line 129 of file token.h.

Typedef Documentation

◆ fr_token_t

typedef enum fr_token fr_token_t

Enumeration Type Documentation

◆ fr_token

enum fr_token
Enumerator
T_INVALID 
T_EOL 
T_LCBRACE 
T_RCBRACE 
T_LBRACE 
T_RBRACE 
T_COMMA 
T_SEMICOLON 
T_ADD 
T_SUB 
T_MUL 
T_DIV 
T_AND 
T_OR 
T_NOT 
T_XOR 
T_COMPLEMENT 
T_MOD 
T_RSHIFT 
T_LSHIFT 
T_OP_ADD_EQ 
T_OP_SUB_EQ 
T_OP_MUL_EQ 
T_OP_DIV_EQ 
T_OP_OR_EQ 
T_OP_AND_EQ 
T_OP_RSHIFT_EQ 
T_OP_LSHIFT_EQ 
T_OP_EQ 
T_OP_SET 
T_OP_PREPEND 
T_LAND 
T_LOR 
T_OP_NE 
T_OP_GE 
T_OP_GT 
T_OP_LE 
T_OP_LT 
T_OP_REG_EQ 
T_OP_REG_NE 
T_OP_CMP_TRUE 
T_OP_CMP_FALSE 
T_OP_CMP_EQ 
T_OP_CMP_EQ_TYPE 
T_OP_CMP_NE_TYPE 
T_OP_INCRM 
T_HASH 
T_BARE_WORD 
T_DOUBLE_QUOTED_STRING 
T_SINGLE_QUOTED_STRING 
T_BACK_QUOTED_STRING 
T_SOLIDUS_QUOTED_STRING 

Definition at line 38 of file token.h.

Function Documentation

◆ 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 504 of file token.c.

+ Here is the caller graph for this function:

◆ fr_token_name()

char const* fr_token_name ( int  token)

Definition at line 490 of file token.c.

+ Here is the caller graph for this function:

◆ getop()

fr_token_t getop ( char const **  ptr)

Definition at line 455 of file token.c.

+ Here is the call graph for this function:

◆ getstring()

fr_token_t getstring ( char const **  ptr,
char *  buf,
int  buflen,
bool  unescape 
)

Definition at line 471 of file token.c.

+ Here is the call graph for this function:

◆ gettoken()

fr_token_t gettoken ( char const **  ptr,
char *  buf,
int  buflen,
bool  unescape 
)

Definition at line 447 of file token.c.

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

◆ getword()

int getword ( char const **  ptr,
char *  buf,
int  buflen,
bool  unescape 
)

Definition at line 438 of file token.c.

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

Variable Documentation

◆ fr_assignment_op

const bool fr_assignment_op[T_TOKEN_LAST]
extern

Definition at line 168 of file token.c.

◆ fr_binary_op

const bool fr_binary_op[T_TOKEN_LAST]
extern

Definition at line 216 of file token.c.

◆ fr_comparison_op

const bool fr_comparison_op[T_TOKEN_LAST]
extern

Definition at line 198 of file token.c.

◆ fr_list_assignment_op

const bool fr_list_assignment_op[T_TOKEN_LAST]
extern

Definition at line 185 of file token.c.

◆ fr_str_tok

const bool fr_str_tok[T_TOKEN_LAST]
extern

Definition at line 231 of file token.c.

◆ fr_token_quote

const char fr_token_quote[T_TOKEN_LAST]
extern

Convert tokens back to a quoting character.

Non-string types convert to '?' to screw ups can be identified easily

Definition at line 156 of file token.c.

◆ fr_token_quotes_table

fr_table_num_sorted_t const fr_token_quotes_table[]
extern

Definition at line 66 of file token.c.

◆ fr_token_quotes_table_len

size_t fr_token_quotes_table_len
extern

Definition at line 73 of file token.c.

◆ fr_tokens

const char* fr_tokens[T_TOKEN_LAST]
extern

Definition at line 78 of file token.c.

◆ fr_tokens_table

fr_table_num_ordered_t const fr_tokens_table[]
extern

Definition at line 33 of file token.c.

◆ fr_tokens_table_len

size_t fr_tokens_table_len
extern

Definition at line 64 of file token.c.