public class FreeRadiusFormat extends RadiusFormat
Format.AttributeParseContextVSA_HEADER_LENGTH| Constructor and Description |
|---|
FreeRadiusFormat() |
| Modifier and Type | Method and Description |
|---|---|
void |
packAttribute(ByteBuffer buffer,
RadiusAttribute a)
Packs a RadiusAttribute into a DataOutputStream
|
void |
packHeader(ByteBuffer buffer,
RadiusAttribute a)
Packs a RadiusAttribute header into a DataOutputStream
|
void |
packHeader(ByteBuffer buffer,
RadiusPacket p,
int attributesLength,
String sharedSecret) |
void |
packPacket(RadiusPacket packet,
String sharedSecret,
ByteBuffer buffer,
boolean onWire)
Packs a RadiusPacket into a byte array
|
static void |
setAttributeBytes(RadiusPacket p,
ByteBuffer buffer,
int length) |
void |
unpackAttributeHeader(ByteBuffer buffer,
Format.AttributeParseContext ctx) |
getInstance, headerLength, headerLength, packHeader, packHeader, packHeader, packHeader, unpackAttributeHeadergetUnsignedByte, getUnsignedByte, getUnsignedInt, getUnsignedInt, getUnsignedShort, getUnsignedShort, packAttributeList, packAttributes, putUnsignedByte, putUnsignedByte, putUnsignedInt, putUnsignedInt, putUnsignedShort, putUnsignedShort, readUnsignedByte, readUnsignedInt, readUnsignedShort, unpackAttributes, writeUnsignedByte, writeUnsignedInt, writeUnsignedShortpublic static void setAttributeBytes(RadiusPacket p, ByteBuffer buffer, int length)
public static void setAttributeBytes(RadiusPacket p, byte[] bAttributes)
{
int attributesLength = bAttributes.length;
if (attributesLength > 0)
{
staticFormat.unpackAttributes(p.getAttributes(), bAttributes, 0, attributesLength);
}
}public void packAttribute(ByteBuffer buffer, RadiusAttribute a)
RadiusFormatpackAttribute in class RadiusFormata - The RadiusAttribute to packpublic void packHeader(ByteBuffer buffer, RadiusPacket p, int attributesLength, String sharedSecret)
public void packHeader(OutputStream out, RadiusPacket p, byte[] attributeBytes, String sharedSecret) throws IOException
{
writeUnsignedInt(out, p.getCode());
writeUnsignedInt(out, p.getIdentifier());
writeUnsignedInt(out, attributeBytes == null ? 0 : attributeBytes.length);
}public void packPacket(RadiusPacket packet, String sharedSecret, ByteBuffer buffer, boolean onWire) throws IOException
RadiusFormatpackPacket in class RadiusFormatpacket - The RadiusPacket to packIOExceptionpublic void packHeader(ByteBuffer buffer, RadiusAttribute a)
RadiusFormatpackHeader in class RadiusFormata - The RadiusAttribute to packpublic void packHeader(OutputStream out, RadiusAttribute a) throws IOException
{
AttributeValue attributeValue = a.getValue();
writeUnsignedInt(out, a.getFormattedType());
writeUnsignedInt(out, attributeValue.getLength());
writeUnsignedInt(out, a.getAttributeOp());
}public void unpackAttributeHeader(ByteBuffer buffer, Format.AttributeParseContext ctx) throws IOException
unpackAttributeHeader in class RadiusFormatIOExceptionpublic int unpackAttributeHeader(InputStream in, AttributeParseContext ctx) throws IOException
{
ctx.attributeType = readUnsignedInt(in);
ctx.attributeLength = readUnsignedInt(in);
ctx.attributeOp = readUnsignedInt(in);
if (ctx.attributeType > (1 << 16))
{
// FreeRADIUS encodes the vendor number in the type
// with: if (vendor) attr->attr |= (vendor << 16);
ctx.vendorNumber = (int)((ctx.attributeType >> 16) & 0xffff);
ctx.attributeType &= 0xffff;
}
return 12;
}Copyright © 2017. All rights reserved.