AXL RADIUS Server API V3

com.theorem.radserver3
Class VendorSpecific

Object
  extended byAttributeList
      extended byVendorSpecific
All Implemented Interfaces:
Serializable

public final class VendorSpecific
extends AttributeList

Vendor-Specific attribute handler.

Vendor-Specific attributes (VSA) are used to encapsulate attributes peculiar to a vendor. Usually only one vendor sub-attribute is attached to the VSA, but this will vary with servers and clients.

The Vendor Id is found in the table of Private Enterprise Numbers which can be found on the internet. Vendors offer dictionaries containing the sub-attribute numbers, data types, and formats. These dictionaries are usually provided with the hardware. Please see the RADIUSDictionary class for more information on dictionaries.

Some vendors are introducing a new style of sub-attribute. These have longer tags to increase the number of sub-attribute types. The normal tags are 8 bits in length allowing 256 values while the long tags are 16 bits allowing 65535 values. For client applications long tags can only be used with servers that are configured to handle long tags.

Some vendors require long attribute tags within a VSA, notably Ascend. These are supported using the VendorSpecific(int vendorID, boolean longTags) method. The client and server must agree that long tags will be used in VSA's.

Since this class extends the AttributeList class all addAttribute() methods available. For examples of VendorSpecific activities see VSExamples.java.

See Also:
AttributeList, Serialized Form

Field Summary
static boolean LONG_TAGS
          Use long tags (16 bit) -true.
static boolean SHORT_TAGS
          Use short tags (8 bit - the default) -false.
 
Constructor Summary
VendorSpecific(Attribute vs)
          Constructor to extract sub-attributes from a Vendor-Specific attribute.
VendorSpecific(byte[] attrData)
          Constructor for creating Vendor-Specific sub-attributes from the attribute data value.
VendorSpecific(byte[] attrData, boolean longTags)
          Constructor for extracting Vendor-Specific attribute(s) from the attribute data field with long or short tags.
VendorSpecific(int vendorID)
          Constructor for creating a Vendor-Specific attribute using standard short tags.
VendorSpecific(int vendorID, boolean longTags)
          Constructor forcreating a Vendor-Specific attribute using either long or short tags.
 
Method Summary
static void addVendor(String className, int vendorID)
          Add a Vendor-Specific definition class for debugging.
 byte[] createRadiusAttributeBlock()
          Create the RADIUS attribute block.
 Attribute getAttribute()
          Return the completed attribute.
 byte[] getRawData()
          Get the raw data content of the Vendor-Specific attribute.
 int getVendorID()
          Get the vendor ID for this attribute.
 boolean hasVendorAttributes()
          Determine if there are valid vendor attributes.
 Attribute setData(byte[] data)
          Set the data portion of the attribute.
 VendorSpecific setLongTag()
          Set the Vendor-Specific sub-attribute to use long tags.
 VendorSpecific setLongTag(boolean longTags)
          Set the Vendor-Specific sub-attribute to use a particular type of tag.
 String toString()
          Return the string representation of a VendorSpecific attribute.
 
Methods inherited from class AttributeList
addAttribute, addAttribute, addAttribute, addAttribute, addAttribute, addAttribute, addAttribute, addAttribute, addAttribute, addAttribute, addAttribute, addAttribute, clearAttributes, createCHAPChallenge, dataSize, decodeAll, delete, deleteAll, elements, encodeAll, exists, findPosition, getAllBinaryAttributes, getAllStringAttributes, getAttributeArray, getAttributeAt, getAttributeList, getAttributes, getBinaryAttribute, getInt, getIPAttribute, getShort, getSize, getStringAttribute, getVendorSpecific, getVendorSpecific, loadRadiusAttributes, loadRadiusAttributes, mergeAttributes, mergeAttributes, mergeAttributes, mergeAttributes, parseIPAttribute, parseIPv6Attribute, setAttribute, setAttributeAt, size, size, toHexString, toUTF8
 
Methods inherited from class Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

LONG_TAGS

public static final boolean LONG_TAGS
Use long tags (16 bit) -true.

See Also:
Constant Field Values

SHORT_TAGS

public static final boolean SHORT_TAGS
Use short tags (8 bit - the default) -false.

See Also:
Constant Field Values
Constructor Detail

VendorSpecific

public VendorSpecific(Attribute vs)
Constructor to extract sub-attributes from a Vendor-Specific attribute.

Parameters:
vs - Vendor-Specific attribute.

VendorSpecific

public VendorSpecific(byte[] attrData)
Constructor for creating Vendor-Specific sub-attributes from the attribute data value.

Parameters:
attrData - Bytes specifying the value portion of the Vendor-Specific attribute.

VendorSpecific

public VendorSpecific(byte[] attrData,
                      boolean longTags)
Constructor for extracting Vendor-Specific attribute(s) from the attribute data field with long or short tags.

Parameters:
attrData - Bytes specifying the value portion of the Vendor-Specific attribute.
longTags - If set to true use long (16 bit) tags. Normally tags are 8 bits. Some vendors are using long tags to increase the number of attribute types they can define.

VendorSpecific

public VendorSpecific(int vendorID)
Constructor for creating a Vendor-Specific attribute using standard short tags.

Parameters:
vendorID - Vendor-ID for this attribute.

VendorSpecific

public VendorSpecific(int vendorID,
                      boolean longTags)
Constructor forcreating a Vendor-Specific attribute using either long or short tags.

Parameters:
vendorID - Vendor-ID for this attribute.
longTags - If set to true use long (16 bit) tags. Normally tags are 8 bits. Some vendors are using long tags to increase the number of attribute types they can define.
Method Detail

addVendor

public static void addVendor(String className,
                             int vendorID)
Add a Vendor-Specific definition class for debugging. This is not required if you are using dictionaries RADIUSDictionary. This adds a new Vendor-Specific class to the existing list for the VendorSpecific.toString() method as well as the AttributeList.toString() method.

This class must contain a VENDORID definition like this:
public static final int VENDORID = nnn;
where nnn is the vendor ID. All other similar definitions will be taken to be attribute tag types.

For an example of this see Microsoft.java or Cisco.java. If you follow these examples to produce MyCompanyVS.java you can more easily include your Vendor-Specific definitions using the statement: new MyCompanyVS().

To use this method explicitly:
VendorSpecific.addVendor("com.myCompany,MyCompanyVS",       MyCompanyVS.VENDORID);
For example, the Cisco class is added like this:
add("com.theorem.radserver.Cisco", Cisco.VENDORID);

For more vendor ID's see the IANA Private Enterprise Numbers

Parameters:
className - Class name
vendorID - Vendor number.

createRadiusAttributeBlock

public byte[] createRadiusAttributeBlock()
Create the RADIUS attribute block. This method should not be called directly.

Overrides:
createRadiusAttributeBlock in class AttributeList
Returns:
RADIUS attribute block.
See Also:
AttributeList.loadRadiusAttributes(byte[], int, int)

getAttribute

public Attribute getAttribute()
Return the completed attribute. If the setData() method is used no attributes accumulated by the addAttribute() methods will be used.

Returns:
the Attribute.

getRawData

public byte[] getRawData()
Get the raw data content of the Vendor-Specific attribute. This will be the actual data past the VendorID value.

Returns:
the data.

getVendorID

public int getVendorID()
Get the vendor ID for this attribute.


hasVendorAttributes

public boolean hasVendorAttributes()
Determine if there are valid vendor attributes.

Returns:
true if sub-attributes are present.

setData

public Attribute setData(byte[] data)
Set the data portion of the attribute. This is used for older non-Tag/Length/Value type data that use straight data.

For example the old Telebit_Login_Command data just passed a String.

Once set no accumulated attributes using addAttribute() methods will be used.

Parameters:
data - Raw data to be used for the attribute data portion.
Returns:
The resulting Attribute.

setLongTag

public VendorSpecific setLongTag()
Set the Vendor-Specific sub-attribute to use long tags.

Setting this after using any constructor other than VendorSpecific(int vendorID) will cause further conversions to or from RADIUS data blocks to use the new format. In the case of the VendorSpecific(int vendorID) constructor the method loadRadiusAttributes() the attributes will be loaded with the given tag type (the default is to use short tags).

This can be used to convert types after loading a VSA. If set to false or SHORT_TAGS normal tags of 8 bits. Some vendors are using long tags to increase the number of sub-attribute types they can define.

Since:
Server 3.43

setLongTag

public VendorSpecific setLongTag(boolean longTags)
Set the Vendor-Specific sub-attribute to use a particular type of tag.

Setting this after using any constructor other than VendorSpecific(int vendorID) will cause further conversions to or from RADIUS data blocks to use the new format. In the case of the VendorSpecific(int vendorID) constructor the method loadRadiusAttributes() the attributes will be loaded with the given tag type (the default is to use short tags).

This can be used to convert types after loading a VSA.

Parameters:
longTags - If set to true or LONG_TAGS use long (16 bit) tags. If set to false or SHORT_TAGS normal tags of 8 bits. Some vendors are using long tags to increase the number of sub-attribute types they can define.
Since:
Server 3.43

toString

public String toString()
Return the string representation of a VendorSpecific attribute.

Overrides:
toString in class AttributeList
Returns:
string.

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.