Main Page | Class List | File List | Class Members

RadiusServerStack Class Reference

Simple RADIUS server stack implementation. More...

#include <RadiusServerStack.h>

List of all members.

Public Member Functions

 RadiusServerStack (RadiusSecret p_secret, uint16_t p_port=D_RADIUS_AUTHENTICATION_PORT, const char *p_hostname=NULL)
 ~RadiusServerStack ()
bool isValid ()
 Server stack was properly created?
int setBlockMode (bool p_block)
 Set blocking mode.
int receiveRequest ()
 Receive RADIUS request from network.
RadiusPacketgetRequest ()
 Get RADIUS request.
RadiusAddressgetClientAddress ()
 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.

Detailed Description

Simple RADIUS server stack implementation.

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 & Destructor Documentation

RadiusServerStack::RadiusServerStack RadiusSecret  p_secret,
const char *  p_hostname = NULL


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

[in] p_secret - secret key
[in] p_port - local port of RADIUS server
[in] p_hostname - local hostname of RADIUS server (if not specified, RADIUS server will listen to all local IP addresses)

Member Function Documentation

int RadiusServerStack::setBlockMode bool  p_block  ) 

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.

[in] p_block - blocking mode (true/false)
RC_SUCCESS if blocking mode was successfully set; RC_FAIL otherwise

int RadiusServerStack::receiveRequest  ) 

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.

RC_SUCCESS if new request was received; RC_FAIL otherwise

RadiusPacket & RadiusServerStack::getRequest  ) 

Get RADIUS request.

Get last RADIUS request received from the network.

request received from the network

RadiusAddress & RadiusServerStack::getClientAddress  ) 

Get client address.

Get address of the RADIUS client that the last request was received from.

address of RADIUS client

int RadiusServerStack::sendResponse RadiusPacket p_response,
bool  p_calculateAuthenticator = true

Send RADIUS response to the network.

Send RADIUS response to the network.

[in] p_response - response packet to be sent
[in] p_calculateAuthenticator - calculate response authenticator prior to sending it
RC_SUCCESS if response packet was successfully sent; RC_FAIL otherwise

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