#include <RadiusClientStack.h>
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. | |
RadiusPacket * | sendPacket (RadiusPacket &p_packet) |
Send packet to the network. | |
int | getNextPacketID () |
Get next ID for RADIUS packet. | |
Private Attributes | |
RadiusClientConnection * | m_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? |
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. Both p_port and p_hostname parameters are optional and normally are not used.
|
|
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).
|
|
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.
|
|
Get next ID for RADIUS packet.
|