Package org.tinyradius.core.packet
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
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
static final int
Fields inherited from interface org.tinyradius.core.attribute.AttributeHolder
attrHolderLogger
-
Method Summary
Modifier and TypeMethodDescriptionstatic io.netty.buffer.ByteBuf
buildHeader
(byte type, byte id, byte[] auth, List<RadiusAttribute> attributes) default byte[]
genHashedAuth
(String sharedSecret, byte[] requestAuth) Generates an authenticator for a Radius packet.byte[]
Returns the authenticator for this Radius packet.io.netty.buffer.ByteBuf
byte
getId()
default int
static MessageDigest
byte
getType()
static io.netty.buffer.ByteBuf
readHeader
(io.netty.buffer.ByteBuf data) Returns header of this buffer's starting at the currentreaderIndex
and increases thereaderIndex
by the size of the new slice (=HEADER_LENGTH
).default io.netty.buffer.ByteBuf
default ByteBuffer
default byte[]
toBytes()
Methods inherited from interface org.tinyradius.core.attribute.AttributeHolder
addAttribute, addAttribute, decodeAttributes, encodeAttributes, getAttribute, getAttribute, getAttributeByteBuf, getAttributes, getAttributes, getAttributes, getAttributes, getChildVendorId, getDictionary, removeAttributes, removeLastAttribute, withAttributes
Methods inherited from interface org.tinyradius.core.attribute.NestedAttributeHolder
addAttribute, getAttribute, getAttributes, getAttributes, getFlattenedAttributes, getVendorAttributes, removeAttribute, removeAttributes
-
Field Details
-
HEADER_LENGTH
static final int HEADER_LENGTH- See Also:
-
MAX_PACKET_LENGTH
static final int MAX_PACKET_LENGTH- See Also:
-
-
Method Details
-
getMd5Digest
-
readHeader
static io.netty.buffer.ByteBuf readHeader(io.netty.buffer.ByteBuf data) throws RadiusPacketException Returns header of this buffer's starting at the currentreaderIndex
and increases thereaderIndex
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 typeid
- packet idauth
- nullable 16-byte arrayattributes
- 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
-
toBytes
default byte[] toBytes() -
genHashedAuth
Generates an authenticator for a Radius packet.Note: 'this' packet authenticator is ignored, only requestAuth param is used.
- Parameters:
sharedSecret
- shared secretrequestAuth
- request authenticator if hashing for response, otherwise set to 16 zero octets- Returns:
- new 16 byte response authenticator
-