Main Page | Class List | File List | Class Members

RadiusClientStack Class Reference

Simple RADIUS client stack implementation. More...

#include <RadiusClientStack.h>

List of all members.

Public Member Functions

 RadiusClientStack (uint16_t p_port=0, const char *p_hostname=NULL)
 Constructor.
 ~RadiusClientStack ()
 Destructor.
bool isValid ()
 Client stack was properly created?
int addServer (const char *p_hostname, uint16_t p_port, RadiusSecret p_secret, int p_responseTimeout=5, int p_retransmitCount=2)
 Add RADIUS server to work with.
RadiusPacketsendPacket (RadiusPacket &p_packet)
 Send packet to the network.
int getNextPacketID ()
 Get next ID for RADIUS packet.

Private Attributes

RadiusClientConnectionm_connections [D_MAX_RADIUS_CLIENT_CONNECTIONS]
 Client connections.
int m_connectionsNum
 Number of client connections.
int m_lastConnection
 Last used client connection.
int m_nextPacketID
 Next packet ID.
RadiusAddress m_clientAddress
 Client address.
int m_socket
 UDP socket.
bool m_isValid
 Socket was properly created?


Detailed Description

Simple RADIUS client stack implementation.

A relatively simple fully-synchronic RADIUS client stack implementation. Packet transmission is performed on the context of the calling application thread and blocks until the response is received or (re)transmission times out.

Multiple RADIUS server connections (with per-connection secret keys and retransmission settings) are supported. Note, however, that these multiple connections are used for high-availability and not for load-balancing.

Packets are initially sent via the first connection. If corresponding RADIUS server doesn't respond, client stack switches to the next available connection. "Last known good" connection is used for transmission of consequent packets. Packet transmission is considered "failed" when all available connections fail to transmit it.

See test/client.cpp for a sample RADIUS client application.


Constructor & Destructor Documentation

RadiusClientStack::RadiusClientStack uint16_t  p_port = 0,
const char *  p_hostname = NULL
 

Constructor.

Both p_port and p_hostname parameters are optional and normally are not used.

Parameters:
[in] p_port - local port of RADIUS client
[in] p_hostname - local hostname of RADIUS client


Member Function Documentation

int RadiusClientStack::addServer const char *  p_hostname,
uint16_t  p_port,
RadiusSecret  p_secret,
int  p_responseTimeout = 5,
int  p_retransmitCount = 2
 

Add RADIUS server to work with.

At least one RADIUS server should be added to the RadiusClientStack before transmitting any packet.

Multiple RADIUS servers (with per-server retransmission settings) may be specified for high-availability (but not for load-balancing).

Returns:
RC_SUCCESS if server was successfully added; RC_FAIL otherwise

RadiusPacket * RadiusClientStack::sendPacket RadiusPacket p_packet  ) 
 

Send packet to the network.

Send packet to the RADIUS server and wait for response. If response is received - it's returned; otherwise NULL is returned.

If more than one connection exists, packet will first be transmitted via the "last known good" connection. If the transmission fails, next connection will be tried. And so on and so forth.

Only when all connections fail to transmit the packet, we give up and return NULL.

Parameters:
[in] p_packet - request packet to be sent
Returns:
response packet received or NULL

int RadiusClientStack::getNextPacketID  ) 
 

Get next ID for RADIUS packet.

Returns:
next packet ID


The documentation for this class was generated from the following files:
Generated on Tue Aug 11 18:35:07 2009 for ace-radius by doxygen 1.3.7-20040704