Interface RadiusPacket<T extends RadiusPacket<T>>

All Superinterfaces:
AttributeHolder<T>, NestedAttributeHolder<T>
All Known Subinterfaces:
MessageAuthSupport<T>, RadiusRequest, RadiusResponse
All Known Implementing Classes:
AccessRequest, AccessRequestArap, AccessRequestChap, AccessRequestEap, AccessRequestNoAuth, AccessRequestPap, AccessResponse, AccessResponse.Accept, AccessResponse.Challenge, AccessResponse.Reject, AccountingRequest, BaseRadiusPacket, GenericRequest, GenericResponse

public interface RadiusPacket<T extends RadiusPacket<T>> extends NestedAttributeHolder<T>
  • Field Details

  • Method Details

    • getMd5Digest

      static MessageDigest getMd5Digest()
    • readHeader

      static io.netty.buffer.ByteBuf readHeader(io.netty.buffer.ByteBuf data) throws RadiusPacketException
      Returns header of this buffer's starting at the current readerIndex and increases the readerIndex by the size of the new slice (= HEADER_LENGTH).
      Parameters:
      data - byte array to parse
      Returns:
      ByteBuf with 20 readable bytes
      Throws:
      RadiusPacketException - if data is incorrect size or the length field does not match the packet size.
    • buildHeader

      static io.netty.buffer.ByteBuf buildHeader(byte type, byte id, byte[] auth, List<RadiusAttribute> attributes) throws RadiusPacketException
      Parameters:
      type - packet type
      id - packet id
      auth - nullable 16-byte array
      attributes - packet attributes, used to calculate packet length for header
      Returns:
      ByteBuf with 20 readable bytes
      Throws:
      RadiusPacketException - packet validation exceptions
    • getHeader

      io.netty.buffer.ByteBuf getHeader()
    • getType

      byte getType()
      Returns:
      Radius packet type
    • getId

      byte getId()
      Returns:
      Radius packet id
    • getAuthenticator

      byte[] getAuthenticator()
      Returns the authenticator for this Radius packet.

      For a Radius packet read from a stream, this will return the authenticator sent by the server.

      For a new Radius packet to be sent, this will return the authenticator created, or null if no authenticator has been created yet.

      Returns:
      authenticator, 16 bytes
    • getLength

      default int getLength()
    • toByteBuf

      default io.netty.buffer.ByteBuf toByteBuf()
    • toByteBuffer

      default ByteBuffer toByteBuffer()
    • toBytes

      default byte[] toBytes()
    • genHashedAuth

      default byte[] genHashedAuth(String sharedSecret, byte[] requestAuth)
      Generates an authenticator for a Radius packet.

      Note: 'this' packet authenticator is ignored, only requestAuth param is used.

      Parameters:
      sharedSecret - shared secret
      requestAuth - request authenticator if hashing for response, otherwise set to 16 zero octets
      Returns:
      new 16 byte response authenticator