Documentation

Functions and procedures

The Security Policy Scripting Language supports functions and procedures.

  • Standalone subroutines that help modularize a company’s security policy files.
  • Programming building blocks that execute specific tasks. These functions and procedures can be called whenever there is a need to perform that task.
  • Useful for repetitive type tasks.
  • Built-in functions and procedures help automate the process of creating security policy files.

The difference between functions and procedures is that functions return values while procedures do not.

Functions and procedures do not support the same notion of scope as C functions. In other words, after a variable is implicitly defined, any function can use it. Its use is global and not limited to the function where it was originally defined.

If a variable is implicitly created in one function and referenced by another function, both functions can access and modify the same variable. The same holds true for procedures.

When adding user-written functions to a security policy file, the code for inline functions is placed at the top of the security policy file that first uses the function.

ℹ️

Note

For more information, see the following:

Built-in functions and procedures

On using user-written functions and procedures, see User and password functions

function statement

Description

A function name can be any length. Its name can consist of any alpha or numeric characters, but it must start with an alphabetic character or an underscore.

The method of returning a value from a function is similar to that used in Pascal. The value is returned in a variable with the same name as the function.

A function must return a value. Otherwise, an error occurs.

Syntax

function FunctionName (argument-list)
{
statements;
FunctionName = expression;
}

Example

function square (x)
{
square = x * x;
}

procedure statement

Description

A procedure name can be any length. It can consist of any alpha, underscore, or numeric characters, but it must start with an alphabetic character or an underscore.

Procedures do not return a value. If a value is returned, an error occurs.

Syntax

procedure ProcedureName (argument-list)
{
statements;
}

Example

procedure print_message(message)
{
print(message);
}

©2003-2025 BeyondTrust Corporation. All Rights Reserved. Other trademarks identified on this page are owned by their respective owners. BeyondTrust is not a chartered bank or trust company, or depository institution. It is not authorized to accept deposits or trust accounts and is not licensed or regulated by any state or federal banking authority.