Class OctetsAttribute
java.lang.Object
org.tinyradius.core.attribute.type.OctetsAttribute
- All Implemented Interfaces:
RadiusAttribute
- Direct Known Subclasses:
IntegerAttribute
,IpAttribute
,Ipv6PrefixAttribute
,StringAttribute
,VendorSpecificAttribute
public class OctetsAttribute extends java.lang.Object implements RadiusAttribute
The basic generic Radius attribute. All type-specific implementations extend this class
by adding additional type conversion methods and validations.
-
Constructor Summary
Constructors Constructor Description OctetsAttribute(Dictionary dictionary, int vendorId, int type, byte[] value)
OctetsAttribute(Dictionary dictionary, int vendorId, int type, java.lang.String value)
-
Method Summary
Modifier and Type Method Description RadiusAttribute
encode(byte[] requestAuth, java.lang.String secret)
Encodes attribute.boolean
equals(java.lang.Object o)
Dictionary
getDictionary()
byte
getTag()
int
getType()
byte[]
getValue()
java.lang.String
getValueString()
int
getVendorId()
int
hashCode()
java.lang.String
toString()
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.tinyradius.core.attribute.type.RadiusAttribute
decode, flatten, getAttributeName, getAttributeTemplate, getTagBytes, isEncoded, toByteArray
-
Constructor Details
-
OctetsAttribute
- Parameters:
dictionary
- dictionary to usevendorId
- vendor ID or -1type
- attribute type codevalue
- value of attribute as byte array, excluding type and length bytes
-
OctetsAttribute
- Parameters:
dictionary
- dictionary to usevendorId
- vendor ID or -1type
- attribute type codevalue
- value of attribute as hex string
-
-
Method Details
-
getVendorId
public int getVendorId()- Specified by:
getVendorId
in interfaceRadiusAttribute
- Returns:
- vendor Id if Vendor-Specific attribute or sub-attribute, otherwise -1
-
getType
public int getType()- Specified by:
getType
in interfaceRadiusAttribute
- Returns:
- attribute type code, typically 0-255
-
getTag
public byte getTag()- Specified by:
getTag
in interfaceRadiusAttribute
- Returns:
- Tag if available and specified for attribute type (RFC2868)
-
getValue
public byte[] getValue()- Specified by:
getValue
in interfaceRadiusAttribute
- Returns:
- attribute data as raw bytes
-
getValueString
public java.lang.String getValueString()- Specified by:
getValueString
in interfaceRadiusAttribute
- Returns:
- value of this attribute as a hex string.
-
getDictionary
- Specified by:
getDictionary
in interfaceRadiusAttribute
- Returns:
- dictionary that attribute uses
-
toString
public java.lang.String toString()- Overrides:
toString
in classjava.lang.Object
-
encode
public RadiusAttribute encode(byte[] requestAuth, java.lang.String secret) throws RadiusPacketExceptionDescription copied from interface:RadiusAttribute
Encodes attribute. Must be idempotent.- Specified by:
encode
in interfaceRadiusAttribute
- Parameters:
requestAuth
- (corresponding) request packet authenticatorsecret
- shared secret to encode with- Returns:
- attribute with encoded data
- Throws:
RadiusPacketException
- errors encoding attribute
-
equals
public boolean equals(java.lang.Object o)- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()- Overrides:
hashCode
in classjava.lang.Object
-