Keywords in Unlang

The following tables list the keywords used in Unlang. These keywords implement the "flow control" of the policies.

Table 1. Flow Control
Keyword Description

break

Exit early from a foreach loop.

case

Match inside of a switch.

else

Do something when an if does not match.

elsif

Check for condition when a previous if does not match.

foreach

Loop over a list of attributes.

if

Check for a condition, and execute a sub-policy if it matches.

return

Immediately stop processing a section.

switch

Check for multiple values.

update

Edit a list of attributes.

The following keywords are also used in unlang. These keywords define policies and groups of policies.

Table 2. Grouping
Keyword Description

group

Group a series of statements.

load-balance

Define a load balancing group without fail-over.

redundant

Define a redundant group with fail-over.

redundant-load-balance

Define a redundant group with fail-over and load balancing.

The unlang statements can also refer to modules. The modules are pre-packaged libraries that implement specific functionality, such as connecting to SQL, LDAP, etc. The module used here is not the literal string module. Instead, it is the name of a pre-packaged module such as sql, or ldap, or eap.

Table 3. Modules
Keyword Description

module

Execute a named module, e.g., sql.

module.method

Execute a particular method of a named module, e.g., pap.authorize

reject

Built-in modules, e.g., reject, or ok, etc.