#include <RadiusServerStack.h>
Public Member Functions | |
RadiusServerStack (RadiusSecret p_secret, uint16_t p_port=D_RADIUS_AUTHENTICATION_PORT, const char *p_hostname=NULL) | |
Constructor. | |
~RadiusServerStack () | |
Destructor. | |
bool | isValid () |
Server stack was properly created? | |
int | setBlockMode (bool p_block) |
Set blocking mode. | |
int | receiveRequest () |
Receive RADIUS request from network. | |
RadiusPacket & | getRequest () |
Get RADIUS request. | |
RadiusAddress & | getClientAddress () |
Get client address. | |
int | sendResponse (RadiusPacket &p_response, bool p_calculateAuthenticator=true) |
Send RADIUS response to the network. | |
Private Attributes | |
RadiusAddress | m_serverAddress |
Server address. | |
int | m_socket |
UDP socket. | |
bool | m_isValid |
Socket was properly created? | |
RadiusPacket | m_request |
Request received from the network. | |
RadiusSecret | m_secret |
Secret key. | |
RadiusAddress | m_clientAddress |
Client address. |
A relatively simple fully-synchronic RADIUS server stack implementation. Packet transmission is performed on the context of the calling application thread.
Typical server application should do the following sequence of actions in a loop:
Application may choose whether receivePacket() blocks until new packet is available or not - refer to setBlockMode() method.
See test/server.cpp for a sample RADIUS server application.
|
Constructor. Both p_port and p_hostname parameters are optional and normally are not used.
|
|
Set blocking mode. Blocking mode determines whether receivePacket() call blocks until new packet is available or immediately returns with a failure code. By default blocking mode is turned on, but application may use this API to change it.
|
|
Receive RADIUS request from network. Receive RADIUS request from the network. If new packet is available, RC_SUCCESS is returned and received packet is accessible via getRequest() method. Otherwise, depending on the blocking mode, this method either blocks until the new packet is available, or immediately returns RC_FAIL.
|
|
Get RADIUS request. Get last RADIUS request received from the network.
|
|
Get client address. Get address of the RADIUS client that the last request was received from.
|
|
Send RADIUS response to the network. Send RADIUS response to the network.
|