Interface RadiusAttribute

All Known Implementing Classes:
AnonSubAttribute, EncodedAttribute, IntegerAttribute, IpAttribute, IpAttribute.V4, IpAttribute.V6, Ipv6PrefixAttribute, OctetsAttribute, StringAttribute, VendorSpecificAttribute

public interface RadiusAttribute
  • Method Details

    • getVendorId

      int getVendorId()
      Returns:
      vendor Id if Vendor-Specific attribute or sub-attribute, otherwise -1
    • getType

      default int getType()
      Returns:
      attribute type code, typically 0-255
    • getLength

      default int getLength()
      Returns:
      number of octets used by attribute - uses declared length where possible, otherwise uses readableBytes
    • getHeaderSize

      default int getHeaderSize()
      Returns:
      number of octets used for header, typically 2 except for VSAs with custom type/length sizes
    • getTag

      Optional<Byte> getTag()
      Returns:
      Tag if available and specified for attribute type (RFC2868)
    • getValue

      byte[] getValue()
      Returns:
      attribute data as raw bytes
    • getValueString

      String getValueString()
      Returns:
      value of this attribute as a hex string.
    • getDictionary

      Dictionary getDictionary()
      Returns:
      dictionary that attribute uses
    • getData

      io.netty.buffer.ByteBuf getData()
      toByteBuf() is preferred if caller exposes a reference to the ByteBuf elsewhere to avoid mutating netty ref counts
      Returns:
      underlying ByteBuf for attribute, includes attribute header, (optional) tag, and value
    • toByteBuf

      default io.netty.buffer.ByteBuf toByteBuf()
      Returns:
      underlying ByteBuf for attribute, includes attribute header, (optional) tag, and value
    • toByteArray

      default byte[] toByteArray()
      Returns:
      entire attribute (including headers) as byte array
    • getTypeSize

      default int getTypeSize()
      Returns:
      number of octets used for type, typically 1 except certain VSAs
    • getLengthSize

      default int getLengthSize()
      Returns:
      number of octets used for length, typically 1 except certain VSAs
    • getTagSize

      default int getTagSize()
      Returns:
      1 if attribute supports a tag, otherwise 0
    • getVendor

      default Optional<Vendor> getVendor()
    • isTagged

      default boolean isTagged()
    • getAttributeName

      default String getAttributeName()
    • flatten

      default List<RadiusAttribute> flatten()
      Returns set of all nested attributes if contains sub-attributes, otherwise singleton set of current attribute.
      Returns:
      List of RadiusAttributes
    • getAttributeTemplate

      default Optional<AttributeTemplate> getAttributeTemplate()
      Returns:
      AttributeTemplate used to define this attribute
    • encode

      default RadiusAttribute encode(byte[] requestAuth, String secret) throws RadiusPacketException
      Encodes attribute. Must be idempotent.
      Parameters:
      requestAuth - (corresponding) request packet authenticator
      secret - shared secret to encode with
      Returns:
      attribute with encoded data
      Throws:
      RadiusPacketException - errors encoding attribute
    • decode

      default RadiusAttribute decode(byte[] requestAuth, String secret) throws RadiusPacketException
      Decodes attribute. Must be idempotent.
      Parameters:
      requestAuth - (corresponding) request packet authenticator
      secret - shared secret to encode with
      Returns:
      attribute with encoded data
      Throws:
      RadiusPacketException - errors decoding attribute
    • isEncoded

      default boolean isEncoded()