|
AXL Software | |||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
ObjectA
Attribute
RADIUS attribute class. Holds attribute data and provides symbolic values for standard RADIUS attributes. Usually used in conjunction with the AttributeList class which provides convenient methods for access to groups of attributes.
AttributeList,
Serialized Form| Field Summary | |
static int |
DATA_TYPE_DATE
The attribute data is probably a date - 8. |
static int |
DATA_TYPE_ENCRYPT1
The attribute uses encryption type 1 -PAP encoding (can be OR'd with other values) - 64. |
static int |
DATA_TYPE_ENCRYPT2
The attribute uses encryption type 2 - SALT encoding (can be OR'd with other values) - 128. |
static int |
DATA_TYPE_ENCRYPT3
The attribute uses encryption type 3 - Ascend encoding (can be OR'd with other values) - 256. |
static int |
DATA_TYPE_INTEGER
The attribute data is probably an integer - 1. |
static int |
DATA_TYPE_IPADDRESS
The attribute data is probably an IP Address (IPV4 or IPV6) - 16. |
static int |
DATA_TYPE_OCTETS
The attribute data is probably binary octets - 2. |
static int |
DATA_TYPE_STRING
The attribute data is probably a string - 4. |
static int |
DATA_TYPE_TUNNEL
The attribute is a tunnel attribute which can be OR'd with other values - 32. |
static int |
DATA_TYPE_UNKNOWN
The attribute data type is unknown - 0. |
int |
length
Attribute length including tag and length byte. |
| Constructor Summary | |
Attribute(int type)
Attribute Constructor for an attribute with no data. |
|
Attribute(int type,
byte[] attributeData)
Attribute Constructor for an attribute with data. |
|
Attribute(int type,
Date date)
Attribute Constructor for an attribute with a Date value. |
|
Attribute(int type,
int value)
Attribute Constructor for an attribute with integer data. |
|
Attribute(int type,
int tunnelTag,
byte[] attribute)
Attribute Constructor for Tunnel attributes |
|
| Method Summary | |
void |
convertToTunnel()
Convert an attribute to a Tunnel attribute. |
boolean |
equals(Object obj)
Indicates whether some other object is "equal to" this one. |
byte[] |
getAttribute()
Returns raw attribute data including the tag, length, and if it's a tunnel attribute, the tunnel tag. |
byte[] |
getAttributeData()
Get attribute value field data. |
int |
getDataLength()
Get attribute value data field length. |
int |
getDataType()
Get the data type for this attribute. |
int |
getDataType(int vendorId)
Get the data type for this attribute. |
static int |
getDataType(int vendorId,
int tag)
Get the data type for an attribute. |
Date |
getDate()
Return a Date value from a 4 byte attribute. |
int |
getInt()
Get an int value from the Attribute data. |
InetAddress |
getIP()
Return an IP address from a 4 byte binary attribute (like NAS-IP-Address). |
int |
getLength()
Get attribute's raw length including tag, length and data. |
String |
getName()
Get the name of this attribute tag. |
static String |
getName(int tag)
Get the name of an attribute tag. |
String |
getString()
Return an attribute value as a string. |
int |
getTag()
Get tag field value. |
static int |
getTag(String name)
Get the attribute tag number from the symbolic name. |
int |
getTunnelTag()
Get the tunnel tag. |
byte[] |
getTunnelValue()
Get a tunnel attribute's value. |
String |
getValueName()
Get the symbolic representation of this attribute's value. |
static int |
getValueName(int attribute,
String value)
Get the numeric representation of an attribute's symbolic value. |
int |
getVendorID()
Get Vendor-Specific ID number from this attribute. |
boolean |
isLongTag()
Determine if this attribute has a long tag (16 bit). |
boolean |
isPrintable()
Determine if this attribute's data is printable (UTF-8). |
static boolean |
isPrintable(byte[] b)
Determine if a byte array is printable (UTF-8). |
static boolean |
isPrintable(byte[] b,
int start,
int length)
Determine if a byte array is printable (UTF-8). |
boolean |
isPrintableAscii()
Determine if this attribute's data is printable (eg ASCII-printable). |
static boolean |
isPrintableAscii(byte[] b)
Determine if a byte array is printable (eg ASCII-printable). |
static boolean |
isPrintableAscii(byte[] b,
int start,
int length)
Determine if a byte array is printable (eg ASCII-printable). |
boolean |
isTunnelAttribute()
Determine if this is a tunnel attribute. |
static void |
setDataType(int tag,
int dataType)
Set an attribute to a specific data type. |
Attribute |
setLongTag()
Enable the long (16 bit) tags - Warning: - if you think you need to use this you probably don't understand the RADIUS protocol and will cause problems for yourself and others. |
Attribute |
setLongTag(boolean enable)
Optionally enable the long tags - Enable the long (16 bit) tags - Warning: - if you think you need to use this you probably don't understand the RADIUS protocol and will cause problems for yourself and others. |
static String |
toIPString(byte[] b)
Display a 4 octet value as an IP address. |
static String |
toIPString(byte[] b,
int start)
Display a 4 octet value as an IP address. |
String |
toString()
Display Attribute as a string. |
String |
toString(int vendorId)
Display Attribute as a string from a given vendor ID (for Vendor specific attributes). |
| Methods inherited from class Object |
getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
public static final int DATA_TYPE_DATE
getDataType(),
Constant Field Valuespublic static final int DATA_TYPE_ENCRYPT1
public static final int DATA_TYPE_ENCRYPT2
public static final int DATA_TYPE_ENCRYPT3
public static final int DATA_TYPE_INTEGER
getDataType(),
Constant Field Valuespublic static final int DATA_TYPE_IPADDRESS
getDataType(),
Constant Field Valuespublic static final int DATA_TYPE_OCTETS
getDataType(),
Constant Field Valuespublic static final int DATA_TYPE_STRING
getDataType(),
Constant Field Valuespublic static final int DATA_TYPE_TUNNEL
convertToTunnel() method is used.
getDataType(),
Constant Field Valuespublic static final int DATA_TYPE_UNKNOWN
getDataType(),
Constant Field Valuespublic int length
| Constructor Detail |
public Attribute(int type)
type - Attribute tag.
public Attribute(int type,
byte[] attributeData)
type - attribute tag.attributeData - value.
public Attribute(int type,
Date date)
type - Attribute tag.
param date Date.
public Attribute(int type,
int value)
type - Attribute tag.
public Attribute(int type,
int tunnelTag,
byte[] attribute)
type - attribute typetunnelTag - Tunnel tagattribute - value| Method Detail |
public void convertToTunnel()
Attributes in a response must be converted to Tunnel Attributes to be interpreted properly. It's harmless to reconvert attributes.
public boolean equals(Object obj)
obj - - the reference object with which to compare.
public byte[] getAttribute()
public byte[] getAttributeData()
If this is a tunnel attribute the tunnel tag is included in the data.
This is useful if you're moving attribute data around without regard for it's
contents (E.g. getting attributes from an AttributeList and moving
them to another list.
Please use convertToTunnel() if this is a tunnel attribute
to access the tunnel tag properly or use the method getTunnelValue() .
public int getDataLength()
Note for Tunnel attributes:
If this is a tunnel attribute the length reported will depend on whether
the attribute was created as a tunnel attribute or the convertToTunnel() method
was used. In both these cases the value will be the the length of the tunnel data.
If the tunnel attribute has not been converted from an ordinary attribute to a tunnel
attribute the length will include the tunnel tag.
public int getDataType()
public int getDataType(int vendorId)
vendorId - The vendor id for this attribute or 0 for no vendor.
public static int getDataType(int vendorId,
int tag)
vendorId - The vendor id for this attribute or 0 for no vendor.tag - The attribute type - e.g. Attribute.User_Name.
DATA_TYPE_STRING,
DATA_TYPE_INTEGER,
DATA_TYPE_OCTETS,
DATA_TYPE_IPADDRESS,
DATA_TYPE_DATE,
DATA_TYPE_TUNNELpublic Date getDate()
public int getInt()
public InetAddress getIP()
public int getLength()
public String getName()
Attribute.getName(Attribute.NAS_IP_Address) returns"NAS-IP-Address".
public static String getName(int tag)
Attribute.getName(Attribute.NAS_IP_Address) returns"NAS-IP-Address".
tag - Attribute type.
public String getString()
public int getTag()
public static int getTag(String name)
name - Symbolic name of attribute ("NAS-IP-Address");
public int getTunnelTag()
public byte[] getTunnelValue()
public String getValueName()
public static int getValueName(int attribute,
String value)
attribute - Attribute type.value - Symbolic value, like "PPP".
public int getVendorID()
public boolean isLongTag()
public boolean isPrintable()
public static boolean isPrintable(byte[] b)
b - Bytes to test.
public static boolean isPrintable(byte[] b,
int start,
int length)
b - Bytes to test.start - start position.length - Length to test.
public boolean isPrintableAscii()
public static boolean isPrintableAscii(byte[] b)
b - Bytes to test.
public static boolean isPrintableAscii(byte[] b,
int start,
int length)
b - Bytes to test.start - start position.length - Length to test.
public boolean isTunnelAttribute()
public static void setDataType(int tag,
int dataType)
getDataType() method is used to extract a
probable data type. This method can be used to alter the data type for an existing
attribute or create a type for a new attribute.
For example if you want to interpret the User-Password as a STRING instead of
OCTETS use setDataType(Attribute.User_Password, STRING).
tag - Attribute type, E.g. Attribute.User_Name.dataType - Set to one of the data types, E.g. STRING.DATA_TYPE_STRING,
DATA_TYPE_INTEGER,
DATA_TYPE_OCTETS,
DATA_TYPE_IPADDRESS,
DATA_TYPE_DATE,
DATA_TYPE_TUNNELpublic Attribute setLongTag()
public Attribute setLongTag(boolean enable)
enable - Enable the long tags if true.
public static String toIPString(byte[] b)
b - Bytes
public static String toIPString(byte[] b,
int start)
b - Bytesstart - Start position in b.
public String toString()
public String toString(int vendorId)
|
AXL Software | |||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||