net.jradius.packet
Class PacketFactory

java.lang.Object
  extended by net.jradius.packet.PacketFactory

public class PacketFactory
extends Object

RADIUS Packet Factor. Parses RADIUS packets and constructs the appropriate Java class instance.

Author:
David Bird

Constructor Summary
PacketFactory()
           
 
Method Summary
static RadiusPacket copyPacket(RadiusPacket req)
           
static String getPoolStatus()
           
static RadiusPacket newPacket(byte b)
           
static RadiusPacket newPacket(byte b, AttributeList list)
           
static RadiusPacket newPacket(byte b, int identifier)
           
static RadiusPacket newPacket(byte b, int identifier, AttributeList list)
           
static RadiusRequest newPacket(byte b, RadiusClient client, AttributeList list)
           
static RadiusPacket newPacket(Integer code)
           
static RadiusPacket[] parse(ByteBuffer buffer, int packetCount)
          Parse multiple RadiusPackets from a data stream
static RadiusPacket parse(DatagramPacket dp)
          Parse a UDP RADIUS message
static RadiusPacket parsePacket(ByteBuffer buffer)
           
static RadiusPacket parseUDP(ByteBuffer buffer)
           
static RadiusPacket parseUDP(int code, int identifier, int length, ByteBuffer buffer)
           
static void poolStatus()
           
static void recycle(RadiusPacket p)
           
static void recycle(RadiusPacket[] rp)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PacketFactory

public PacketFactory()
Method Detail

newPacket

public static RadiusPacket newPacket(Integer code)

newPacket

public static RadiusPacket newPacket(byte b)

newPacket

public static RadiusPacket newPacket(byte b,
                                     int identifier)

newPacket

public static RadiusPacket newPacket(byte b,
                                     int identifier,
                                     AttributeList list)

newPacket

public static RadiusPacket newPacket(byte b,
                                     AttributeList list)

newPacket

public static RadiusRequest newPacket(byte b,
                                      RadiusClient client,
                                      AttributeList list)

copyPacket

public static RadiusPacket copyPacket(RadiusPacket req)

parse

public static RadiusPacket parse(DatagramPacket dp)
                          throws RadiusException
Parse a UDP RADIUS message

Parameters:
dp - The Datagram to be parsed
Returns:
Returns the RadiusPacket
Throws:
RadiusException

parseUDP

public static RadiusPacket parseUDP(ByteBuffer buffer)
                             throws RadiusException,
                                    IOException
Throws:
RadiusException
IOException

parseUDP

public static RadiusPacket parseUDP(int code,
                                    int identifier,
                                    int length,
                                    ByteBuffer buffer)
                             throws RadiusException,
                                    IOException
Throws:
RadiusException
IOException

parsePacket

public static RadiusPacket parsePacket(ByteBuffer buffer)
                                throws RadiusException
Throws:
RadiusException

parse

public static RadiusPacket[] parse(ByteBuffer buffer,
                                   int packetCount)
Parse multiple RadiusPackets from a data stream

Parameters:
in - The input data stream
packetCount - Number of packets to expect
Returns:
Returns an array of RadiusPackets
Throws:
RadiusException - public static RadiusPacket[] parse(InputStream in, int packetCount) throws RadiusException { RadiusPacket rp[] = new RadiusPacket[packetCount]; try { for (int i=0; i < packetCount; i++) { rp[i] = parsePacket(in); } } catch (IOException e) { RadiusLog.error(e.getMessage(), e); } return rp; }

poolStatus

public static void poolStatus()

getPoolStatus

public static String getPoolStatus()

recycle

public static void recycle(RadiusPacket p)

recycle

public static void recycle(RadiusPacket[] rp)


Copyright © 2011 Coova Technologies, LLC, All Rights Reserved.