AttributeFilter Object
Objects of the AttributeFilter class are used to read, write, modify, and reset attributes in the RADIUS request or response packets. To use the AttributeFilter class, scripts must first create an object instance by calling the new AttributeFilter() constructor.
Constructor
new AttributeFilter()
Purpose
The new AttributeFilter() constructor is used to create a new object instance of the AttributeFilter class.
Syntax
Parameters
Returns
The new AttributeFilter() object reference.
Example
filter = new AttributeFilter();AttributeFilter Methods
Methods of the AttributeFilter class operate on either the request or the response attribute list, depending on the context in which they are called. All of the methods of the AttributeFilter class are available to attribute filter scripts. The AttributeFilter.Get() method is also available to realm selection scripts.
Get()
Purpose
The Get() method is used to get a named attribute from the request or response attribute list.
Syntax
Parameters
Specifies the optional index for multi-value attributes; default is 0.
Returns
The attribute value or JavaScript null if not found.
Example
filter.Get("Calling -Station-ID");
Add()
Purpose
The Add() method is used to add a named attribute to the request or response attribute list. If an attribute of the same name already exists, the new data value is appended to the end of the attribute list.
Syntax
Parameters
Returns
Example
filter.Add("NAS-IP-Address", "1.2.3.4");
Reset()
Purpose
The Reset() method is used to remove one or all instances of a named attribute from the request or response attribute list. If the index is given, the specified value is removed from the attribute list and higher-indexed values drop down to fill in the vacancy.
Syntax
Parameters
Specifies the optional index for multi-value attributes; default is remove all.
Returns
Example
filter.Reset("NAS-IP-Address", 3);
Replace()
Purpose
The Replace() method is used to delete a named attribute and add a new attribute of the same name and given value. This is equivalent to Reset() followed by Add(). When an index is given, the specified attribute value is removed, the remaining higher-indexed values drop down to fill in the vacancy, and the new value is appended to the end of the attribute list. List order is not preserved.
Syntax
Parameters
Specifies the string representation of the new attribute value.
Specifies the optional index for multi-value attributes; default is remove all.
Returns
Example
filter.Replace("Calling-Station-ID", "5551212", 2);
Execute()
Purpose
The Execute() method is used to execute a statically-defined attribute filter.
Syntax
Parameters
Returns
Example
filter.Execute("MyStaticFilter");AttributeFilter API
Table 141 provides a list of the RADIUS attribute data types supported by the
AttributeFilterAPI.
Script developers do not control attribute types; a given attribute's type is determined from its name and dictionary entry. Many bit-length variations of integer and hex data types are possible, but not all are supported or used by Steel-Belted Radius Carrier.
When
AttributeFilter.Get()is called, the binary data in the attribute are converted into a JavaScript variable. When eitherAttributeFilter.Add()orAttributeFilter.Replace()is called, the data in a JavaScript variable are converted into the appropriate RADIUS attribute binary type.