Package org.tinyradius.attribute
Class VendorSpecificAttribute
java.lang.Object
org.tinyradius.attribute.RadiusAttribute
org.tinyradius.attribute.VendorSpecificAttribute
- All Implemented Interfaces:
AttributeHolder
public class VendorSpecificAttribute extends RadiusAttribute implements AttributeHolder
This class represents a "Vendor-Specific" attribute.
-
Field Summary
Fields Modifier and Type Field Description static byte
VENDOR_SPECIFIC
-
Constructor Summary
Constructors Constructor Description VendorSpecificAttribute(Dictionary dictionary, int vendorId, int attributeType, byte[] data)
VendorSpecificAttribute(Dictionary dictionary, int vendorId, int attributeType, java.lang.String data)
VendorSpecificAttribute(Dictionary dictionary, java.util.List<RadiusAttribute> subAttributes, int requiredVendorId)
Constructs a new Vendor-Specific attribute to be sent. -
Method Summary
Modifier and Type Method Description void
addAttribute(RadiusAttribute attribute)
Adds a sub-attribute to this attribute.java.util.Map<java.lang.String,java.lang.String>
getAttributeMap()
Returns set of entry of Attribute name and Value as string.java.util.List<RadiusAttribute>
getAttributes()
Returns the list of sub-attributes.int
getChildVendorId()
void
removeAttribute(RadiusAttribute attribute)
Removes the specified sub-attribute from this attribute.byte[]
toByteArray()
Renders this attribute as a byte array.java.lang.String
toString()
Returns a string representation for debugging.Methods inherited from class org.tinyradius.attribute.RadiusAttribute
equals, getAttributeKey, getAttributeType, getDictionary, getType, getValue, getValueString, getVendorId, hashCode
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.tinyradius.attribute.util.AttributeHolder
addAttribute, addAttribute, getAttribute, getAttribute, getAttributeBytes, getAttributes, getAttributes, getAttributes, getAttributeString, getDictionary, lookupAttributeType, removeAttributes, removeLastAttribute
-
Field Details
-
VENDOR_SPECIFIC
public static final byte VENDOR_SPECIFIC- See Also:
- Constant Field Values
-
-
Constructor Details
-
VendorSpecificAttribute
public VendorSpecificAttribute(Dictionary dictionary, int vendorId, int attributeType, java.lang.String data)- Parameters:
dictionary
- dictionary to use for (sub)attributesvendorId
- ignored, VSAs should always be -1 (top level attribute)attributeType
- ignored, should always be Vendor-Specific (26)data
- data as hex to parse for vendorId and sub-attributes
-
VendorSpecificAttribute
public VendorSpecificAttribute(Dictionary dictionary, int vendorId, int attributeType, byte[] data)- Parameters:
dictionary
- dictionary to use for (sub)attributesvendorId
- ignored, VSAs should always be -1 (top level attribute)attributeType
- ignored, should always be Vendor-Specific (26)data
- data to parse for vendorId and sub-attributes
-
VendorSpecificAttribute
public VendorSpecificAttribute(Dictionary dictionary, java.util.List<RadiusAttribute> subAttributes, int requiredVendorId)Constructs a new Vendor-Specific attribute to be sent.- Parameters:
dictionary
- dictionary to use for (sub)attributessubAttributes
- sub-attributes heldrequiredVendorId
- vendor ID of the sub-attributes
-
-
Method Details
-
getChildVendorId
public int getChildVendorId()- Specified by:
getChildVendorId
in interfaceAttributeHolder
- Returns:
- VendorId to restrict (sub)attributes, or -1 for top level
-
addAttribute
Adds a sub-attribute to this attribute.- Specified by:
addAttribute
in interfaceAttributeHolder
- Parameters:
attribute
- sub-attribute to add
-
removeAttribute
Removes the specified sub-attribute from this attribute.- Specified by:
removeAttribute
in interfaceAttributeHolder
- Parameters:
attribute
- RadiusAttribute to remove
-
getAttributes
Returns the list of sub-attributes.- Specified by:
getAttributes
in interfaceAttributeHolder
- Returns:
- List of RadiusAttributes
-
toByteArray
public byte[] toByteArray()Renders this attribute as a byte array.- Overrides:
toByteArray
in classRadiusAttribute
- Returns:
- entire attribute (including headers) as byte array
-
toString
public java.lang.String toString()Returns a string representation for debugging.- Overrides:
toString
in classRadiusAttribute
-
getAttributeMap
public java.util.Map<java.lang.String,java.lang.String> getAttributeMap()Description copied from class:RadiusAttribute
Returns set of entry of Attribute name and Value as string. Size is generally 1, except in case of VendorSpecificAttribute where it is merge of sub-attributes.- Specified by:
getAttributeMap
in interfaceAttributeHolder
- Overrides:
getAttributeMap
in classRadiusAttribute
- Returns:
- Set of String/String Entry
-