Go to the first, previous, next, last section, table of contents.
A symbol is a lexical token. The following symbols are recognized:
- Arithmetical operators
-
These are `+', `-', `*', `/' representing the basic
arithmetical operations and `%' meaning remainder.
- Comparison operators
-
These are: `==', `!=', `<', `<=', `>',
`>=' with the same meaning they have in C. Special operators
are provided for regular expression matching. Binary
operator `=~' returns true, if its left-hand-side operand
matches the regular expression on its right-hand side. `!~'
returns true if the left-hand side operand does not match
the regexp on right-hand side. The right-hand side operand of
`!~' or `=~' must be a literal string, i.e. the regular
expression must be known at compile time.
- Unary operators.
-
Unary operators are `-' and `+' for unary plus and minus,
`!' for boolean negation and `*' for testing for the
existence of an attribute.
- Boolean operators.
-
These are: `&&' and `||'.
- Parentheses `(' and `)'
-
These are used to change the precedence of operators, to introduce
type casts (type coercions), to declare functions and to pass actual
arguments to functions.
- Curly braces (`{' and `}')
-
These are used to delimit blocks of code.
- Numbers
-
Numbers follow usual C convention for integers. A number consisting of
a sequence of digits, is taken to be octal if it begins with `0'
(digit zero) and decimal otherwise. If the sequence of digits is
preceded by `0x' or `0X', it is taken to be a hexadecimal
integer.
- Characters
-
These follow usual C convention for characters, i.e. either
an ASCII character or its value enclosed in a pair of single
quotes. The character value begins with `\' (backslash) and
consists either of three octal or of two hexadecimal digits.
A character does not form a special data type, it is represented
internally by an integer.
- Quoted strings
-
These follow usual C conventions for strings.
- Attribute values
-
The incoming request is passed implicitly to functions, invoked via
Rewrite-Function
attribute. It is kept as an associative array,
whose entries can be accessed using the following syntax:
`%[' attribute-name `]'
Thus notation returns the value of the attribute attribute-name.
attribute-name should be a valid Radius dictionary name
(see section Dictionary of Attributes -- `raddb/dictionary').
- Identifiers
-
Identifiers represent functions and variables. These are described in
the next section.
- Regexp group references
-
A sequence of characters in the form:
`\number'
refers to the contents of parenthesized group number number
obtained as a result of the last executed `=~' command.
The regexp group reference has always string data type. E.g.
string
basename(string arg)
{
if (arg =~ ".*/\(.*\)\..*")
return \1;
else
return arg;
}
This function strips from arg all leading components up to the
last slash character, and all trailing components after the last dot
character. It returns arg unaltered, if it does not contain
slashes and dots. Roughly, it is analogous to the system basename
utility.
Go to the first, previous, next, last section, table of contents.