-
-== The break Statement
+= The break Statement
.Syntax
[source,unlang]
-
-== The call Statement
+= The call Statement
[source,unlang]
----
-
-== The case Statement
+= The case Statement
.Syntax
[source,unlang]
-
-== The && Operator
+= The && Operator
.Syntax
[source,unlang]
-
-== The &Attribute-Name Reference
+= The &Attribute-Name Reference
.Syntax
[source,unlang]
-
-== Conditional Comparisons
+= Conditional Comparisons
.Syntax
[source,unlang]
which interpret the `lhs` as a printable string, and the `rhs` as a
regular expression.
-=== IP Address Comparisons
+== IP Address Comparisons
The type-specific comparisons operate as expected for most data types.
The only exception is data types that are IP addresses or IP address
condition will return `true`, as the IP address `192.0.2.1' is within
the network `192.0.2/24`.
-=== Casting
+== Casting
In some situations, it is useful to force the left side to be
interpreted as a particular data type.
-
-== The data Operator
+= The data Operator
.Syntax
[source,unlang]
-
-== The == Operator
+= The == Operator
`(data-1 == data-2)`
-
-== The module-code Operator
+= The module-code Operator
.Syntax
[source,unlang]
-
-== The ! Operator
+= The ! Operator
.Syntax
[source,unlang]
-
-== The || Operator
+= The || Operator
.Syntax
[source,unlang]
-
-== The ( ) Operator
+= The ( ) Operator
.Syntax
[source,unlang]
-
-== Conditional Expressions
+= Conditional Expressions
Conditions are evaluated when parsing link:if.adoc[if] and
link:elsif.adoc[elsif] statements. These conditions allow the server to
-
-== Data Types
+= Data Types
Unlang supports a number of data types. These data types can be used
in conditional expressions or when assigning a value to an attribute.
Similar processing rules are applied when parsing assignments and
comparisons, for all attributes and data types.
-=== Basic Data Types
+== Basic Data Types
The following data types are "basic" data types. They are fixed-size,
and encapsulate simple concepts such as "integer" or "IP address".
| uint64 | 64-bit unsigned integer
|=====
-=== Structural Data Types
+== Structural Data Types
The following data types are "structural", in that they form
parent-child relationships between attributes. These data types can
| vsa | Encapsulation of vendor-specific attributes
|=====
-=== Protocol-Specific Data Types
+== Protocol-Specific Data Types
The following data types are used only in certain protocols. These
attributes can generally be used only in the dictionaries. They
-
-== Character Escaping
+= Character Escaping
The quotation characters in the above string data types can be
escaped by using the backslash, or `\,` character. The backslash
-
-== Double-Quoted Strings
+= Double-Quoted Strings
`"string"`
-
-== IP Addresses
+= IP Addresses
.Examples
-
-== Numbers
+= Numbers
.Examples
-
-== The detach Statement
+= The detach Statement
.Syntax
[source,unlang]
}
----
-=== Child Lifetime
+== Child Lifetime
The lifetime of the child request is normally limited by the lifetime
of the parent request. The default configuration has
-
-== The else Statement
+= The else Statement
.Syntax
[source,unlang]
-
-== The elsif Statement
+= The elsif Statement
.Syntax
[source,unlang]
-== The filter Statement
+= The filter Statement
.Syntax
[source,unlang]
}
----
-=== Lists
+== Lists
The _<list>_ field sets the attribute list that will be filter. If
the _<list>_ qualifier is omitted, then each entry inside of the
Please see the link:list.adoc[list] page for valid list names.
-=== Server Attributes
+== Server Attributes
The _<server-attribute>_ field is an attribute name, such as
`&Reply-Message`. The attribute name may also be prefixed with a
NOTE: In version 3, the leading `&` was optional. In version 4, the
leading `&` is required.
-=== Editing Operators
+== Editing Operators
The `<op>` field is used to define how the values are filtered
Different operators allow attributes to be added, deleted, or
replaced, as defined below.
-=== Filtering Operators
+== Filtering Operators
The following operators may also be used in addition to the ones
listed above. These operators use the _<server-attribute>_ and
_filtering_ of the attributes. That is, the filtering operators will
modify or delete attributes, but they will never create an attribute.
-=== Values
+== Values
The _<value>_ field is the value which is used to filter the
_<server-attribute>_. The interpretation of the _<value>_ field
-
-== The foreach Statement
+= The foreach Statement
.Syntax
[source,unlang]
-
-== The group Statement
+= The group Statement
[source,unlang]
----
-
-== The if Statement
+= The if Statement
.Syntax
[source,unlang]
-
-== Keywords in Unlang
+= Keywords in Unlang
The following tables list the keywords used in `Unlang`. These keywords
implement the "flow control" of the policies.
-=== Flow Control Keywords
+== Flow Control Keywords
The _flow control_ keywords allow _if / then / else_ checks, simple
looping, etc.
| link:switch.adoc[switch] | Check for multiple values.
|=====
-=== Attribute Editing Keywords
+== Attribute Editing Keywords
The _attribute editing_ keywords allow policies to add, delete, and
modify attributes in any list or packet.
| link:update.adoc[update] | Add attributes to a list
|=====
-=== Grouping Keywords
+== Grouping Keywords
The _grouping_ keywords allow policies to be organized into groups,
including load-balancing.
| link:redundant-load-balance.adoc[redundant-load-balance] | Define a redundant group with fail-over and load balancing.
|=====
-=== Parent-Child Keywords
+== Parent-Child Keywords
The _parent-child_ keywords allow for creation of parent-child
relationships between requests.
| link:subrequest.adoc[subrequest] | Create a child request
|=====
-=== Module Keywords
+== Module Keywords
The _module_ keywords refer pre-packaged libraries that implement
specific functionality, such as connecting to SQL, LDAP, etc. The
-== Attribute Lists
+= Attribute Lists
An attribute list contains a set of attributes. The allowed lists
are:
-
-== The load-balance Statement
+= The load-balance Statement
[source,unlang]
----
-
-== The map Statement
+= The map Statement
[source,unlang]
----
-
-== The module Statement
+= The module Statement
.Syntax
[source,unlang]
-
-== Built-in Modules
+= Built-in Modules
In some cases, it is useful to reject a request immediately or
perform another action on it. The built-in modules can be used to perform these actions. These modules are named for the return codes given in the
-
-== The module.method Statement
+= The module.method Statement
.Syntax
[source,unlang]
-
-== The parallel Statement
+= The parallel Statement
[source,unlang]
----
}
----
-=== Child Requests are Independent
+== Child Requests are Independent
Each module or subsection runs as a new child request, i.e. a
link:subrequest.adoc[subrequest]. Each child request is an identical
}
----
-=== Subrequests are Synchronous
+== Subrequests are Synchronous
Execution of the parent request is paused while each child request is
running. The parent request continues execution once all of the the
requests of a `parallel` section cannot be made asynchronous via the
link:detach.adoc[detach] keyword.
-=== parallel empty
+== parallel empty
The `parallel empty { ... }` syntax creates empty child requests.
These requests contain no attributes. Attributes in the child request
}
----
-=== parallel detach
+== parallel detach
The `parallel detach { ... }` syntax creates child requests which are
immediately detached from the parent request. Each child request
}
----
-=== Exiting Early from a Parallel Section
+== Exiting Early from a Parallel Section
In some situations, it may be useful to exit early from a parallel
section. For example, to proxy a packet to multiple destinations, and
-
-== The redundant-load-balance Statement
+= The redundant-load-balance Statement
[source,unlang]
----
-
-== The redundant Statement
+= The redundant Statement
[source,unlang]
----
-
-== Regular Expression Comparisons
+= Regular Expression Comparisons
.Example
[source,unlang]
-
-== The return Statement
+= The return Statement
.Syntax
[source,unlang]
-
-== Backtick-quoted string
+= Backtick-quoted string
`{backtick}string{backtick}`
-
-== Double Quoted Strings
+= Double Quoted Strings
`"string"`
NOTE: Most values retrieved from external datastores will be treated implicitly
as double-quoted strings.
-=== Escape sequences
+== Escape sequences
Escape sequences allow the inclusion of characters that may be difficult to
represent in datastores, or the FreeRADIUS configuration files.
-
-== Single Quoted Strings
+= Single Quoted Strings
`'string'`
-
-== Unquoted Strings
+= Unquoted Strings
Where a series of characters cannot be parsed as a decimal number,
they are interpreted as a simple string composed of one word. This
-
-== The subrequest Statement
+= The subrequest Statement
[source,unlang]
----
}
----
-=== Changing Protocols
+== Changing Protocols
The `subrequest` keyword can also be used to change protocols. For
example, the server can receive a RADIUS `Access-Request`, and then
}
----
-=== Subrequests are Synchronous
+== Subrequests are Synchronous
Execution of the parent request is paused while the child request is
running. The parent request continues execution once the child request
-
-== The switch Statement
+= The switch Statement
.Syntax
[source,unlang]
-== The update Statement
+= The update Statement
.Syntax
[source,unlang]
}
----
-=== Lists
+== Lists
The _<list>_ field sets the attribute list that will be updated. If
the _<list>_ qualifier is omitted, then each entry inside of the
Please see the link:list.adoc[list] page for valid list names.
-=== Server Attributes
+== Server Attributes
The _<server-attribute>_ field is an attribute name, such as
`&Reply-Message`. The attribute name may also be prefixed with a
NOTE: In version 3, the leading `&` was optional. In version 4, the
leading `&` is required.
-=== Editing Operators
+== Editing Operators
The `<op>` field is used to define how the attribute is processed.
Different operators allow attributes to be added, deleted, or
}
----
-=== Values
+== Values
The _<value>_ field is the value which is assigned to the
_<server-attribute>_. The interpretation of the _<value>_ field
-
-== String Expansion
+= String Expansion
String expansion is a feature that allows strings to dynamically
define their value at run time. For historical reasons, these string
-
-== Attribute References
+= Attribute References
Attributes in a list may be referenced via one of the following two
syntaxes:
-
-== Single Letter Expansions
+= Single Letter Expansions
The following are single letter expansions. These expansions do not
use the typical `%{...}` format. Instead, they are short-cuts for
simple, common cases.
-### Miscellaneous
+== Miscellaneous
`%%`::
Returns `%`.
-### Current Time
+== Current Time
`%c`::
decimal number. It should be used with time-based calculations.
-### Request Time
+== Request Time
`%l`::
-
-== Conditional Syntax
+= Conditional Syntax
Conditional syntax similar to that used in Unix shells may also be
used:
-
-== Module References
+= Module References
Individual modules may be referenced via the following syntax:
-
= Pre-defined Expansions
In addition to storing attribute references, the server has a number