FreeRADIUS InkBridge

Summary of all Built-in Functions

Attribute-Value Pair Manipulation

Table 1. Attribute-Value Pair manipulation
Function Description

%debug

Print attributes to the debug output

%immutable

Mark attributes as immutable (cannot be changed)

%print

Print attribute name and value to string

Data Conversion

Table 2. Conversion functions
Function Description

%base64_encode

Encode a string using Base64

%base64_decode

Decode a Base64 string

%bin

Convert string to binary

%hex

Convert to hex

%url.quote

Quote URL special characters

%url.unquote

Unquote URL special characters

File Handling

Table 3. File handling functions
Function Description

%file.cat

Returns the contents of a file

%file.escape

Returns an escaped or safe version of the input string

%file.exists

Checks to see if a file exists on the filesystem

%file.head

Returns the first line of the file

%file.mkdir

Create a directory on the filesystem

%file.rm

Removes a file from the filesystem

%file.rmdir

Removes a directory from the filesystem

%file.size

Returns the size of a file

%file.tail

Return the last line of a file or the last number(n) of lines of a file

%file.touch

Create a file if it does not already exist

Hashing Functions

Table 4. Hash/digest functions
Function Description

%hash.blake2b_512

BLAKE2b-512

%hash.blake2s_256

BLAKE2s-256

%hash.md4

MD4

%hash.md5

MD5

%hash.sha1

SHA1

%hash.sha224

SHA224

%hash.sha256

SHA256

%hash.sha384

SHA384

%hash.sha512

SHA512

%hash.sha2_224

SHA2-224

%hash.sha2_256

SHA2-256

%hash.sha2_384

SHA2-384

%hash.sha2_512

SHA2-512

%hash.sha3_224

SHA3-224

%hash.sha3_256

SHA3-256

%hash.sha3_384

SHA3-384

%hash.sha3_512

SHA3-512

HMAC Functions

Table 5. HMAC functions
Function Description

%hmac.md5

Generate HMAC-MD5 of string

%hmac.sha1

Generate HMAC-SHA1 of string

Interpreter State and Debugging

Table 6. Interpreter functions
Function Description

%debug

Dynamically change the debug level

%interpreter('filename')

Current file being executed

%interpreter('line')

Line number in the current file

%interpreter('module')

Current module being executed

%interpreter('processing_stage')

Section processing the request

%interpreter('rcode')

Return current rcode (noop, ok, etc)

%interpreter('server')

Name of current virtual server

%interpreter.module.force

Force rcode for a module

%client

Variable defined in a client definition

Logging

Table 7. Logging functions
Function Description

%log.debug

Log message at DEBUG level

%log.destination

Add new debug log destination to current request

%log.err

Log message at ERROR level

%log.info

Log message at INFO level

%log.warn

Log message at WARN level

Miscellaneous Functions

Table 8. Miscellaneous functions
Function Description

%config

Examine server configuration items

%eval

Evalute a string as an xlat expansion

%length

Get the length of data in octets

%module.call

Call a virtual module

%rand

Generate random integers

%regex.*

Perform regular expression search

%uuid.*

Generation of UUIDs

Network Address Handling

Table 9. Network address handling
Function Description

%ip.v4.broadcast

Get the broadcast address from an IPv4 prefix

%ip.v4.netmask

Get the netmask from an IPv4 prefix

Profiling Functions

Table 10. Profiling functions
Function Description

%callgrind.start

Switch callgrind instrumentation on

%callgrind.stop

Switch callgrind instrumentation off

%callgrind.dump

Write a callgrind profile dump, then zero the costs

%callgrind.zero

Zero the callgrind costs without writing a dump

%gperftools.start

Start the gperftools CPU profiler, writing samples to a file

%gperftools.stop

Write buffered gperftools samples, then stop the profiler

%gperftools.flush

Write buffered gperftools samples and keep the profiler running

Protocol Encoding and Decoding

Table 11. Protocol encoding and decoding
Function Description

%PROTO.decode

Decodes as the named protocol

%PROTO.encode

Encodes as the named protocol

String Manipulation

Table 12. String manipulation functions
Function Description

%concat

Concatenate strings with delimiters

%split

Split a string based on delimiters

%length

Returns the size of the data

%lpad

Left pad a string

%rpad

Right pad a string

%rand

Return a random string based on input format

%lower

Convert the input string to lowercase

%upper

Convert the input string to uppercase

Time Management

Table 13. Time management functions
Function Description

Single Character

Single character expansions (%c, %D etc.)

%time

Generic (too complex) time function

%time.is_dst

Is the system running in DST?

%time.next

Number of seconds until next hour, day, etc

%time.now

Return the current time

%time.offset

Return UTC offset

%time.request

Return the time when the request was received

Deprecated Functions

Table 14. Deprecated functions
Function Replacement

%expr

%{...}

%integer

%{(integer) ...}

%pack

(octets) Attr + (octets) Attr

%string

%{(string) ...}

%strlen

%length(...)