Class Attribute

    • Field Summary

      Fields 
      Modifier and Type Field Description
      static int MAX_ATTRIBUTE_LENGTH
      The maximum number of bytes in the on-the-wire format of an attribute since RFC 2865 gives the length field a single octet in the on-the-wire format.
      static int MAX_ATTRIBUTE_VALUE_LENGTH
      Since the on-the-wire format has a single type octet followed by a single length octet the maximum length of an attribute's value is 255 - 2 which is 253.
    • Constructor Summary

      Constructors 
      Constructor Description
      Attribute​(byte[] octets)
      Constructor using the on-the-wire octets for the attribute.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      byte[] getOctets()
      Returns a byte array with on-the-wire attribute format including the two byte prefix consisting of the type octet and length octet defined in section 3 of RFC 2865.
      AttributeType getType()
      Returns the type code of the attribute.
      protected void setOctets​(byte[] octets)
      Sets the array of octets representing the format of a given attribute on-the-wire including prefixed type and length octets as defined in section 3 of RFC 2865.
      String toString()
      Shows a String representation of the contents of a given field.
      String toStringImpl()
      Method expected to be overridden by subclasses to append detail beyond attribute type name.
    • Field Detail

      • MAX_ATTRIBUTE_LENGTH

        public static final int MAX_ATTRIBUTE_LENGTH
        The maximum number of bytes in the on-the-wire format of an attribute since RFC 2865 gives the length field a single octet in the on-the-wire format.
        See Also:
        Constant Field Values
      • MAX_ATTRIBUTE_VALUE_LENGTH

        public static final int MAX_ATTRIBUTE_VALUE_LENGTH
        Since the on-the-wire format has a single type octet followed by a single length octet the maximum length of an attribute's value is 255 - 2 which is 253.
        See Also:
        Constant Field Values
    • Constructor Detail

      • Attribute

        public Attribute​(byte[] octets)
        Constructor using the on-the-wire octets for the attribute.
        Parameters:
        octets - the on-the-wire octets
    • Method Detail

      • getType

        public AttributeType getType()
        Returns the type code of the attribute.
        Returns:
        code indicative of the type of radius attribute.
      • setOctets

        protected void setOctets​(byte[] octets)
        Sets the array of octets representing the format of a given attribute on-the-wire including prefixed type and length octets as defined in section 3 of RFC 2865. Subclasses should call this method in their constructors for injecting the proper set of octest to represent this attribute instance in the on-the-wire format.
        Parameters:
        octets - the octets
      • getOctets

        public byte[] getOctets()
        Returns a byte array with on-the-wire attribute format including the two byte prefix consisting of the type octet and length octet defined in section 3 of RFC 2865.
        Returns:
        the on-the-wire byte representation of this attribute including preceding type and length octets.
      • toString

        public String toString()
        Shows a String representation of the contents of a given field. Used for logging packet traffic.
        Overrides:
        toString in class Object
        Returns:
        the representation of the attribute when traffic logging is enabled
      • toStringImpl

        public String toStringImpl()
        Method expected to be overridden by subclasses to append detail beyond attribute type name. Used by logging to portray attribute field structure when logging packet traffic if special handling is required for a given field distinct from that provided by the super class.
        Returns:
        the string representation of this attribute which is an empty string by default.