[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The following built-in functions are provided:
Returns the length of the string s.
length("string") ⇒ 6 |
Returns the index of the first occurrence of the character c in the string s. Returns -1 if no such occurrence is found.
index("/raddb/users", 47) ⇒ 0 index("/raddb/users", 45) ⇒ -1 |
Returns the index of the last occurrence of the character c in the string s. Returns -1 if no such occurrence is found.
rindex("/raddb/users", 47) ⇒ 6 |
Returns the substring of s of length at most length starting at position start.
substr("foo-bar-baz", 3, 5) ⇒ "-bar-" |
All character positions in strings are counted from 0.
This function regards the buffer argument as consisting of fields separated with any amount of whitespace. It extracts and returns the nth field. n is counted from 1.
field("GNU's not UNIX", 1) ⇒ "GNU's" field("GNU's not UNIX", 2) ⇒ "not" field("GNU's not UNIX", 3) ⇒ "UNIX" field("GNU's not UNIX", 4) ⇒ "" |
Outputs its argument to the Radius log channel info
. Returns 0.
For debugging purposes.
Converts the Internet host address str from the standard numbers-and-dots notation into the equivalent integer in host byte order.
inet_aton("127.0.0.1") ⇒ 2130706433 |
Converts the Internet host address ip given in host byte order to a string in standard numbers-and-dots notation.
inet_ntoa(2130706433) ⇒ "127.0.0.1" |
Converts the integer n, regarded as long, from host to network byte order.
Converts the integer n, regarded as long, from network to host byte order.
Converts the integer n, regarded as short, from host to network byte order.
Converts the integer n, regarded as short, from network to host byte order.
For each substring matching the regular expression regex in the string str, substitute the string repl, and return the resulting string.
gsub("s","S","strings") ⇒ "StringS" gsub("[0-9][0-9]*","N","28 or 29 days") ⇒ "N or N days" gsub("[()'\"]","/","\"a\" (quoted) 'string'") ⇒ "/a/ /quoted/ /string/" |
Replace all non-printable characters in string S by their corresponding hex value preceeded by a percent sign. Return the resulting string. Printable are alphabetical characters, decimal digits and dash (‘-’). Other characters are considered non-printable. For example:
qprn("a string/value") ⇒ "a%20string%2Fvalue" |
Replace all non-printable characters in string str by their three-digit octal code prefixed with a backslash, or by their C escape notation, as appropriate. Non-printable characters depend on the locale settings. For example, suppose that the current locale is set to ISO-8859-1 (a so called “Latin-1” character set) and ∗ represents a tab character. Then:
quote_string("François contains non∗printable chars") ⇒ "Fran\347ois contains non\tprintable chars" |
Replace C escape notations in string str with corresponding characters using current locale. For example, for ISO-8859-1 locale:
unquote_string("Fran\347ois") ⇒ "François" |
Returns the copy of the string str with all alphabetical characters converted to upper case. For example:
toupper("a-string") ⇒ "A-STRING" |
Returns the copy of the string str with all alphabetical characters converted to lower case. For example:
tolower("A-STRING") ⇒ "a-string" |
Converts integer RADIUS request code to its textual representation as per RFC 3575. This function is useful in logging hooks (see section Logging hooks).
request_code_string(4) ⇒ "Accounting-Request" |
The native language support is provided via the functions described
below. These functions are interfaces to GNU gettext
library.
For the information about general concepts and principles of
Native Language Support, please refer to
GNU gettext
utilities: (gettext)Top section `gettext' in GNU gettext
utilities.
The default current textual domain is ‘radius’.
Sets the new value for the current textual domain. This domain is used by
the functions gettext
and ngettext
.
Returns the name of the previously used domain.
The function returns the translation of the string msgid if it is available in the current domain. If it is not available, the argument itself is returned.
The second form of this function provides a traditional shortcut notation.
For a detailed description of the GNU gettext
interface,
refer to (gettext)Interface to gettext section `Interface to gettext' in GNU gettext
utilities.
Returns the translation of the string msgid if it is available in the domain domain. If it is not available, the argument itself is returned.
The ngettext
function is used to translate the messages that
have singular and plural forms. The msgid_singular parameter
must contain the singular form of the string to be converted. It is
also used as the key for the search in the catalog. The
msgid_plural
parameter is the plural form. The parameter
number is used to determine the plural form. If no message
catalog is found msgid_singular is returned if
number == 1
, otherwise msgid_plural.
For a detailed description of the GNU gettext
interface for the
plural translation,
refer to (gettext)Plural forms section `Additional functions for plural forms' in GNU gettext
utilities.
Similar to ngettext
, but searches translation in the given domain.
The following functions are used to read some internal fields of a RADIUS request.
Returns source IP address of the currently processed request. This function
can be used to add NAS-IP-Address
attribute to the requests
lacking one, e.g.:
integer restore_nas_ip() { if (!*%[NAS-IP-Address]) %[NAS-IP-Address] = request_source_ip(); return 0; } |
Returns the source UDP port.
Returns the request identifier.
Returns the request code.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This document was generated by Sergey Poznyakoff on December, 6 2008 using texi2html 1.78.