Google

"DTD/xhtml1-strict.dtd">
Class Radius::Dict
In: radius/dictionary.rb
Parent: Object

This is a simple class that can read RADIUS dictionary files and parse them, allowing conversion between dictionary names and numbers. Vendor-specific attributes are supported in a way consistent with the standards.

This class is patterned after the Net::Radius::Dictionary Perl module written by Christopher Masto (chris@netmonger.net) and Luis E. Munoz (lem@cantv.net)

Methods
Public Class methods
new()

Initialize all the instance variables. All variables start out as empty versions of the appropriate type.

Public Instance methods
read(fp)

Parse a dictionary file from an IO object and learn the name<->number mappings from it. Only the /first/ definition will apply if multiple definitions are seen. This method may be called multiple times with different IO objects, reading from several files.

Parameters

fp:IO object from which to read the data

Return

None. Any strangeness in the file results in a message being printed to stderr.

attr_num(attrname)

Given an attribute name, return the number corresponding to it, based on the dictionary file(s) that have been read.

Parameters

attrname:Name of the attribute whose number is desired.

Return Value

The number corresponding to the appropriate attribute name given.

attr_type(attrname)

Given an attribute name, return the corresponding type for it, based on the dictionary file(s) that have been read.

Parameters

attrname:Name of the attribute whose type is desired.

Return Value

The type string corresponding to the appropriate attribute name given. This is either string, ipaddr, integer, or date.

attr_name(attrnum)

Given an attribute number, return the name corresponding to it, based on the dictionary file(s) that have been read, the reverse of the attr_num method.

Parameters

attrname:Name of the attribute whose number is desired.

Return Value

The number corresponding to the appropriate attribute name given.

attr_numtype(attrnum)

Given an attribute number, return the type of the attribute corresponding to it, based on the dictionary file(s) that have been read.

Parameters

attrnum:Number of the attribute whose type is desired.

Return Value

The number corresponding to the appropriate attribute name given.

attr_has_val(attrnum)

Given an attribute number, return true or false depending on whether or not a value has been given for it.

Parameters

attrnum:Number of the attribute whose definition is known

Return Value

True or false depending on whether some value has been given to the attribute

val_has_name(attrnum)

Alias for attr_has_val. Don't use this; it's confusing.

Parameters

attrname:Name of the attribute whose number is desired.

Return Value

The number corresponding to the appropriate attribute name given.

val_num(attrnum, valname)

Give the number of the named value for the attribute number supplied.

Parameters

attrnum:the attribute number
valname:the name of the value

Return

The number of the named value and attribute.

val_name(attrnum, valnum)

Returns the name of the numbered value for the attribute value supplied. The reverse of val_num.

Parameters

attrnum:the attribute number
valname:the name of the value

Return

The name of the numbered value and attribute.

vsattr_num(vendorid, name)

Obtains the code of a vendor-specific attribute given the Vendor-Id and the name of the vendor-specific attribute (e.g. 9 for Cisco and 'cisco-avpair').

Parameters
vendorid:the Vendor-Id
name:the name of the vendor-specific attribute to query
Return Value

The code for the vendor-specific attribute

vsattr_type(vendorid, name)

Obtains the type of a vendor-specific attribute given the Vendor-Id and the name of the vendor-specific attribute.

Parameters
vendorid:the Vendor-Id
name:the name of the vendor-specific attribute to query
Return Value

The type for the vendor-specific attribute

vsattr_name(vendorid, code)

Obtains the name of a vendor-specific attribute given the Vendor-Id and the code of the vendor-specific attribute. The inverse of vsattr_num.

Parameters
vendorid:the Vendor-Id
code:the code of the vendor-specific attribute to query
Return Value

The name of the vendor-specific attribute

vsattr_numtype(vendorid, code)

Obtains the type of a vendor-specific attribute given the Vendor-Id and the code of the vendor-specific attribute.

Parameters
vendorid:the Vendor-Id
code:the code of the vendor-specific attribute to query
Return Value

The type of the vendor-specific attribute

vsattr_has_val(vendorid, code)

Determines whether the vendor-specific attibute with the Vendor-Id and code given has a value.

Parameters
vendorid:the Vendor-Id
code:the code of the vendor-specific attribute to query
Return Value

True or false on whether or not the vendor-specific attribute has a value

vsaval_has_name(vendorid, attrnum)

Alias for vsattr_has_val. Don't use this; it's confusing.

Parameters

vendorid:the Vendor-Id
attrnum:Name of the attribute whose number is desired.

Return Value

The number corresponding to the appropriate attribute name given.

vsaval_num(vendorid, attrnum, valname)

Give the number of the named value for the vendor-specific attribute number supplied.

Parameters

vendorid:the Vendor-Id
attrnum:the attribute number
valname:the name of the value

Return

The number of the named value and attribute.

vsaval_name(vendorid, attrnum, valnum)

Returns the name of the numbered value for the vendor-specific attribute value supplied. The reverse of val_num.

Parameters

vendorid:the vendor ID
attrnum:the attribute number
valname:the name of the value

Return

The name of the numbered value and attribute.