RADIUS Client API (V3)

com.theorem.radius3.dictionary
Class ParseAttribute

Object
  extended byRADIUSDictionary
      extended byParseAttribute

public final class ParseAttribute
extends RADIUSDictionary

Parse a line and return the attribute(s) found. The class should be loaded with a RADIUS dictionary since it initially is empty of attributes.

The format for attributes is [name] '=' [value]. Values are represented as follows:

 Integers start with '#'.
 IP addresses start with '@'
 Strings are surrounded by double quotation marks
 Binary values start with 0X or 0x.
 Symbolic values are themselves
    For example the  Service-Type attribute has a value of 'Login' with an integer value of 1.
 Time values start with 'T' and have the form 'YYYY-MM-DD-hr:min:sec;
 For example:
      User-Name = "Michael"
      Service-Type = Login
      Service-Type = #1
      NAS-IP-Address = @127.0.0.1
      State = 0x456789012345
      Event_Timestamp = !2003-01-22-03:22:59
 
This class can be used to create new configuration attributes that are outside the normal attribute range, for example addAttribute("Digest00-User-Name", 1010, RADIUSDictionary.STRING);.


Field Summary
 
Fields inherited from class RADIUSDictionary
DATE, ENCRYPT1, ENCRYPT2, ENCRYPT3, INTEGER, IPADDRESS, LONG_TAGS, OCTETS, SHORT_TAGS, STRING, TUNNEL, UNKNOWN, UNKNOWN_DATA_TYPE, UNKNOWN_VENDOR
 
Constructor Summary
ParseAttribute()
          Default constructor.
 
Method Summary
 void addAttribute(String attributeName, int tagValue, int type)
          Add an attribute to the permited attributes.
 Attribute convertToAttribute(ParseAttribute.VP vp)
          Given a value-pair convert it to an attribute.
 Attribute convertToAttributeValue(int vendorId, int tag, ParseAttribute.VP vp)
          Convert the attribute string encoding value to an attribute value for a VSA.
 Attribute convertToAttributeValue(int tag, ParseAttribute.VP vp)
          Convert the attribute string encoding value to an attribute value.
 void merge(RADIUSDictionary dict)
          Add a dictionary file.
 AttributeList toAttributes(String line)
          Convert a line to an attribute list (likely containing one attribute).
 AttributeList toAttributes(String[] lines)
          Convert an array of lines to an attribute list.
 
Methods inherited from class RADIUSDictionary
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, read, setEncryptionType, setEncryptionType, setSymbolicIntValue, setSymbolicIntValue, setTunnel, setTunnel, setVendorId, setVendorTagLength, setVendorTagLength, toString, toVerboseString
 
Methods inherited from class Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ParseAttribute

public ParseAttribute()
Default constructor.

Method Detail

merge

public void merge(RADIUSDictionary dict)
Add a dictionary file. This class has no dictionary of it's own and must be loaded with at least the DefaultDictionary.

Overrides:
merge in class RADIUSDictionary
Parameters:
dict - RADIUSDictionary.

toAttributes

public AttributeList toAttributes(String line)
Convert a line to an attribute list (likely containing one attribute).

Parameters:
line - The line of data to convert to an attribute.
Returns:
An attribute list.

toAttributes

public AttributeList toAttributes(String[] lines)
Convert an array of lines to an attribute list.

Parameters:
lines - The lines of data to convert to an attribute.
Returns:
An attribute list.

addAttribute

public void addAttribute(String attributeName,
                         int tagValue,
                         int type)
Add an attribute to the permited attributes. These can be special parsable attributes that are not RADIUS attributes but are handy to use. For example "Auth-Type" or "Password" could be defined. These must have large or negative values to differentiate them from regular RADIUS attributes whose values range from 1 to 255.

Overrides:
addAttribute in class RADIUSDictionary
Parameters:
attributeName - Attribute name.
tagValue - Tag value.
type - Data type - one of RADIUSDictionary.INTEGER, RADIUSDictionary.OCTETS, RADIUSDictionary.STRING, RADIUSDictionary.DATE, or RADIUSDictionary.IPADDRESS.

convertToAttribute

public Attribute convertToAttribute(ParseAttribute.VP vp)
                             throws IllegalArgumentException
Given a value-pair convert it to an attribute.

Parameters:
vp - VP object.
Returns:
Attribute.
Throws:
Exception - if the attribute name cannot be found or there's an error converting a value.
IllegalArgumentException

convertToAttributeValue

public Attribute convertToAttributeValue(int vendorId,
                                         int tag,
                                         ParseAttribute.VP vp)
                                  throws IllegalArgumentException
Convert the attribute string encoding value to an attribute value for a VSA.

Parameters:
vendorId - Vendor Id.
tag - Attribute tag value.
vp - VP object.
Returns:
Attribute.
Throws:
IllegalArgumentException - if the attribute name cannot be found or there's an error converting a value.

convertToAttributeValue

public Attribute convertToAttributeValue(int tag,
                                         ParseAttribute.VP vp)
                                  throws IllegalArgumentException
Convert the attribute string encoding value to an attribute value.

Parameters:
tag - Attribute tag value.
vp - VP object.
Returns:
Attribute.
Throws:
Exception - if the attribute name cannot be found or there's an error converting a value.
IllegalArgumentException

RADIUS Client 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.