Class Packet

    • Field Detail

      • type

        protected PacketType type
        The packet type.
      • id

        protected short id
        The id of the packet.
      • authenticator

        protected Authenticator authenticator
        The authenticator field of the packet.
      • attrs

        protected AttributeSet attrs
        The attribute instances held by this packet with ordering preserved.
    • Constructor Detail

      • Packet

        public Packet​(PacketType packetType)
        Constructs a new Packet of the specified type in preparation for generating its on-the-wire representation and sending it.
        Parameters:
        packetType - The type of the packet.
      • Packet

        public Packet​(PacketType packetType,
                      short id,
                      Authenticator auth)
        Constructs a new Packet of the specified type, with the indicated identifier and authenticator .
        Parameters:
        packetType - The type of the packet.
        id - The identifier of the packet.
        auth - The authenticator of the packet.
    • Method Detail

      • getType

        public PacketType getType()
        Returns the packet type.
        Returns:
        the packet type.
      • getIdentifier

        public short getIdentifier()
        Returns the identifier of this packet.
        Returns:
        the identifier of this packet.
      • setIdentifier

        public void setIdentifier​(short id)
        Sets the identifier of this packet.
        Parameters:
        id - The identifier.
      • getAuthenticator

        public Authenticator getAuthenticator()
        Returns the authenticator for this packet.
        Returns:
        the authenticator instance for this packet.
      • addAttribute

        public void addAttribute​(Attribute attr)
        Adds the passed-in attribute to the set of attributes for this packet preserving insertion order.
        Parameters:
        attr - the attribute instance to be added.
      • getAttributeSet

        public AttributeSet getAttributeSet()
        Returns the object that holds the attributes for the packet and maintains insertion order.
        Returns:
        the attribute set for this packet.
      • getAttributeAt

        public Attribute getAttributeAt​(int pos)
        Returns the attribute instance at the indicated insertion order or location order on the wire.
        Parameters:
        pos - the index of the attribute
        Returns:
        the attribute instance.
        Throws:
        ArrayIndexOutOfBoundsException - if in index is specified beyond the set of existing attributes.
      • toString

        public String toString()
        Returns a representation of the packet. Used to log packets and their contents if logging is enabled for the RADIUS server functionality.
        Overrides:
        toString in class Object
        Returns:
        a representation of the packet and its contents.
      • setAuthenticator

        public void setAuthenticator​(Authenticator authenticator)
        Sets the authenticator instance for this packet.
        Parameters:
        authenticator - the authenticator.
      • getOctets

        public byte[] getOctets()
        Get the on-the-wire octet sequence for this packet conforming to rfc 2865.
        Returns:
        the octet bytes for streaming across the wire.