AXL RADIUS Server API V3

com.theorem.radserver3.dictionary
Class FreeRadius

Object
  extended byRADIUSDictionary
      extended byFreeRadius

public final class FreeRadius
extends RADIUSDictionary

Class to read and parse FreeRadius style dictionary files.

It understands the current dictionary files and handles $INCLUDE statements. Included processing may be altered using the enableIncludes() method.

Note that the RADIUSDictionary.setVendorId(int vendorId) can change how the default attributes and value are displayed.

Some examples are found in DictionaryExamples.java.

Since:
3.32

Field Summary
static int ONE
          Value indicating this attribute MUST occur once in the packet.
static int UNKNOWN
          Value indicating it is unknown how often this attribute may appear.
static int ZERO
          Value indicating this attribute may never occur.
static int ZEROONE
          Value indicating this attribute may occur zero or once.
static int ZEROPLUS
          Value indicating this attribute may occur zero of more times.
 
Fields inherited from class RADIUSDictionary
DATE, ENCRYPT1, ENCRYPT2, ENCRYPT3, INTEGER, IPADDRESS, LONG_TAGS, OCTETS, SHORT_TAGS, STRING, TUNNEL, UNKNOWN_DATA_TYPE, UNKNOWN_VENDOR
 
Constructor Summary
FreeRadius(String fileName)
          Dictionary constructor.
 
Method Summary
 void enableIncludes(boolean enable)
          Disable or enable the reading of $INCLUDE files.
 String[] getFileList()
          Get the list of files read.
 int getOccurrence(int packetType, int attributeTag)
          Get the number of occurrences permitted for RFC standard attributes.
 String getOccurrenceName(int occurrenceType)
          Get the name of the occurrence given the numerical value.
 void read()
          Read the dictionary file.
 String toString()
          Returns the representation of this class as a string.
 
Methods inherited from class RADIUSDictionary
addAttribute, addAttribute, addAttribute, addAttribute, addAttribute, addVendor, attributeIterator, attributeIterator, createAttribute, createAttribute, createAttribute, createAttribute, getAllValueNames, getAllValueNames, getDataType, getDataType, getDataTypeFlags, getDataTypeFlags, getDataTypeName, getEncryptionType, getEncryptionType, getIntValue, getIntValue, getName, getName, getTag, getTag, getValueName, getValueName, getVendorId, getVendorId, getVendorName, getVendorNames, getVendorTagLength, getVendorTagLength, hasValue, hasValue, hasValue, isTunnel, isTunnel, isVSA, isVSA, merge, setEncryptionType, setEncryptionType, setSymbolicIntValue, setSymbolicIntValue, setTunnel, setTunnel, setVendorId, setVendorTagLength, setVendorTagLength, toVerboseString
 
Methods inherited from class Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

ONE

public static final int ONE
Value indicating this attribute MUST occur once in the packet.

See Also:
getOccurrence(), Constant Field Values

UNKNOWN

public static final int UNKNOWN
Value indicating it is unknown how often this attribute may appear.

See Also:
getOccurrence(), Constant Field Values

ZERO

public static final int ZERO
Value indicating this attribute may never occur.

See Also:
getOccurrence(), Constant Field Values

ZEROONE

public static final int ZEROONE
Value indicating this attribute may occur zero or once.

See Also:
get)ccurrence(), Constant Field Values

ZEROPLUS

public static final int ZEROPLUS
Value indicating this attribute may occur zero of more times.

See Also:
getOccurrence(), Constant Field Values
Constructor Detail

FreeRadius

public FreeRadius(String fileName)
Dictionary constructor.

Parameters:
fileName - Path to dictionary file.
Method Detail

enableIncludes

public void enableIncludes(boolean enable)
Disable or enable the reading of $INCLUDE files. The default is to permit includes. Note: although included files may be nested there is no attempt to determine if there's a self referencial loop.

This must be set before using the read() method.

Parameters:
enable - Set to true to enable including files, false to ignore included files.

getFileList

public String[] getFileList()
Get the list of files read. This includes the original dictionary file and any included files.

Returns:
Array of files read.

getOccurrence

public int getOccurrence(int packetType,
                         int attributeTag)
Get the number of occurrences permitted for RFC standard attributes. This is not applicable to Vendor-Specific attributes.

In the RFC's this is shown in tables as:

 0     This attribute MUST NOT be present in packet.
 0+    Zero or more instances of this attribute MAY be present in packet.
 0-1   Zero or one instance of this attribute MAY be present in packet.
 1     Exactly one instance of this attribute MUST be present in packet.
 
These are represented in coresponding order as ZERO, ZEROPLUS, ZEROONE, ONE, and UNKNOWN when there is no correspondence with the RFC's. UNKNOWN is returned when the packet type is not in the list, the attribute is not in the list, or the attribute's behavior hasn't been defined.

For example a packet type of Accounting-Reponse has no defined attribute occurrences so will return UNKNOWN for all queries.

Known RFC attribute types are from tables in: rfc2865, rfc2866, rfc2868, rfc2867, and rfc2869.

Parameters:
packetType - Packet type - see PacketType.
Returns:
An indicator suggesting the number of occurrences this attribute may have in the given packet type.
See Also:
ZERO, ZEROPLUS, ZEROONE, ONE, UNKNOWN

getOccurrenceName

public String getOccurrenceName(int occurrenceType)
Get the name of the occurrence given the numerical value.

Parameters:
occurrenceType - Occurence type from getOccurrence().
Returns:
human readable occurence type.

read

public void read()
          throws IOException
Read the dictionary file.

Overrides:
read in class RADIUSDictionary
Throws:
IOException - if there's a problem reading or parsing the file.

toString

public String toString()
Returns the representation of this class as a string.

Overrides:
toString in class RADIUSDictionary
Returns:
String listing the vendors, files read, and a list of vendors & id's.

AXL RADIUS Server API V3

Submit a bug report or feature request

Copyright 1998-2008 AXL Software. PO Box 97, Viola, Delaware 19979, U.S.A. All Rights Reserved.