Kea 3.1.1
isc::radius::Server Class Reference

RADIUS server class. More...

#include <client_server.h>

+ Inheritance diagram for isc::radius::Server:

Public Member Functions

 Server (const asiolink::IOAddress &peer_addr, const uint16_t peer_port, const asiolink::IOAddress &local_addr, const std::string &secret, const unsigned timeout, const unsigned deadtime=0)
 Constructor.
 
virtual ~Server ()
 Destructor.
 
unsigned getDeadtime () const
 Get deadtime.
 
std::chrono::steady_clock::time_point getDeadtimeEnd () const
 Get deadtime end.
 
asiolink::IOAddress getLocalAddress () const
 Get local address.
 
asiolink::IOAddress getPeerAddress () const
 Get peer address.
 
uint16_t getPeerPort () const
 Get peer port.
 
std::string getSecret () const
 Get secret.
 
unsigned getTimeout () const
 Get timeout.
 
void setDeadtime (const unsigned deadtime)
 Set deadtime.
 
void setDeadtimeEnd (const std::chrono::steady_clock::time_point &deadtime_end)
 Set deadtime end.
 
void setLocalAddress (const asiolink::IOAddress &local_addr)
 Set local address.
 
void setPeerPort (const uint16_t peer_port)
 Set peer port.
 
void setSecret (const std::string &secret)
 Set secret.
 
void setTimeout (const unsigned timeout)
 Set timeout.
 
data::ElementPtr toElement () const override
 Unparse server.
 
- Public Member Functions inherited from isc::data::CfgToElement
virtual ~CfgToElement ()
 Destructor.
 

Static Public Member Functions

static asiolink::IOAddress getAddress (const std::string &name)
 Get an address from a name.
 
static asiolink::IOAddress getSrcAddress (const asiolink::IOAddress &dest)
 Get the source address from a destination address.
 

Protected Attributes

unsigned deadtime_
 Deadtime i.e. hold-down delay.
 
std::chrono::steady_clock::time_point deadtime_end_
 Deadtime end i.e.
 
asiolink::IOAddress local_addr_
 Local address.
 
boost::scoped_ptr< std::mutex > mutex_
 Mutex to protect the state.
 
const asiolink::IOAddress peer_addr_
 Peer address.
 
uint16_t peer_port_
 Peer port.
 
std::string secret_
 Secret.
 
unsigned timeout_
 Timeout.
 

Detailed Description

RADIUS server class.

Definition at line 40 of file client_server.h.

Constructor & Destructor Documentation

◆ Server()

isc::radius::Server::Server ( const asiolink::IOAddress & peer_addr,
const uint16_t peer_port,
const asiolink::IOAddress & local_addr,
const std::string & secret,
const unsigned timeout,
const unsigned deadtime = 0 )
inline

Constructor.

Parameters
peer_addrThe peer/server address.
peer_portThe peer/server port.
local_addrThe local/client address.
secretThe shared secret (must not be empty).
timeoutThe timeout in seconds.
deadtimeThe hold-down delay (0 means disabled).

Definition at line 63 of file client_server.h.

References deadtime_, deadtime_end_, local_addr_, mutex_, peer_addr_, peer_port_, secret_, setLocalAddress(), setSecret(), setTimeout(), and timeout_.

+ Here is the call graph for this function:

◆ ~Server()

isc::radius::Server::~Server ( )
virtual

Destructor.

Definition at line 144 of file client_server.cc.

References secret_.

Member Function Documentation

◆ getAddress()

IOAddress isc::radius::Server::getAddress ( const std::string & name)
static

Get an address from a name.

Parameters
namethe FQDN.
Returns
the (first) address of the node with the FQDN.

Definition at line 56 of file client_server.cc.

References AddrInfo::addrinfo_, isc::asiolink::IOAddress::fromBytes(), and isc_throw.

Referenced by isc::radius::RadiusServerParser::parse().

+ Here is the call graph for this function:

◆ getDeadtime()

unsigned isc::radius::Server::getDeadtime ( ) const
inline

Get deadtime.

Returns
the hold-down delay.

Definition at line 140 of file client_server.h.

References deadtime_.

◆ getDeadtimeEnd()

steady_clock::time_point isc::radius::Server::getDeadtimeEnd ( ) const

Get deadtime end.

Returns
the date of the end of hold-down.

Definition at line 179 of file client_server.cc.

References deadtime_end_, and mutex_.

◆ getLocalAddress()

asiolink::IOAddress isc::radius::Server::getLocalAddress ( ) const
inline

Get local address.

Returns
the local address.

Definition at line 104 of file client_server.h.

References local_addr_.

◆ getPeerAddress()

asiolink::IOAddress isc::radius::Server::getPeerAddress ( ) const
inline

Get peer address.

Returns
the peer address.

Definition at line 83 of file client_server.h.

References peer_addr_.

◆ getPeerPort()

uint16_t isc::radius::Server::getPeerPort ( ) const
inline

Get peer port.

Returns
the peer port.

Definition at line 90 of file client_server.h.

References peer_port_.

◆ getSecret()

std::string isc::radius::Server::getSecret ( ) const
inline

Get secret.

Returns
the secret.

Definition at line 111 of file client_server.h.

References secret_.

◆ getSrcAddress()

IOAddress isc::radius::Server::getSrcAddress ( const asiolink::IOAddress & dest)
static

Get the source address from a destination address.

Parameters
destthe destination address.
Returns
the source address to be used to send traffic to the destination address.

Definition at line 77 of file client_server.cc.

References isc::asiolink::IOAddress::fromBytes(), isc_throw, and isc::asiolink::IOAddress::toBytes().

Referenced by isc::radius::RadiusServerParser::parse().

+ Here is the call graph for this function:

◆ getTimeout()

unsigned isc::radius::Server::getTimeout ( ) const
inline

Get timeout.

Returns
the timeout in seconds.

Definition at line 128 of file client_server.h.

References timeout_.

◆ setDeadtime()

void isc::radius::Server::setDeadtime ( const unsigned deadtime)
inline

Set deadtime.

Definition at line 145 of file client_server.h.

References deadtime_, and deadtime_end_.

◆ setDeadtimeEnd()

void isc::radius::Server::setDeadtimeEnd ( const std::chrono::steady_clock::time_point & deadtime_end)

Set deadtime end.

Parameters
deadtime_endnew date of the end of hold-down.

Definition at line 186 of file client_server.cc.

References deadtime_end_, and mutex_.

◆ setLocalAddress()

void isc::radius::Server::setLocalAddress ( const asiolink::IOAddress & local_addr)

Set local address.

Parameters
local_addrnew local address.

Definition at line 153 of file client_server.cc.

References isc::asiolink::IOAddress::getFamily(), isc_throw, local_addr_, peer_addr_, and isc::asiolink::IOAddress::toText().

Referenced by Server().

+ Here is the call graph for this function:

◆ setPeerPort()

void isc::radius::Server::setPeerPort ( const uint16_t peer_port)
inline

Set peer port.

Parameters
peer_portnew peer port.

Definition at line 97 of file client_server.h.

References peer_port_.

◆ setSecret()

void isc::radius::Server::setSecret ( const std::string & secret)

Set secret.

Parameters
secretnew secret (must not be empty).

Definition at line 171 of file client_server.cc.

References isc_throw, and secret_.

Referenced by Server().

◆ setTimeout()

void isc::radius::Server::setTimeout ( const unsigned timeout)

Set timeout.

Parameters
timeoutnew timeout in seconds.

Definition at line 162 of file client_server.cc.

References isc_throw, and timeout_.

Referenced by Server().

◆ toElement()

ElementPtr isc::radius::Server::toElement ( ) const
overridevirtual

Unparse server.

Returns
a pointer to unparsed server.

Implements isc::data::CfgToElement.

Definition at line 193 of file client_server.cc.

References Element::create(), Element::createMap(), deadtime_, deadtime_end_, local_addr_, mutex_, peer_addr_, peer_port_, secret_, and timeout_.

+ Here is the call graph for this function:

Member Data Documentation

◆ deadtime_

unsigned isc::radius::Server::deadtime_
protected

Deadtime i.e. hold-down delay.

Definition at line 185 of file client_server.h.

Referenced by Server(), getDeadtime(), setDeadtime(), and toElement().

◆ deadtime_end_

std::chrono::steady_clock::time_point isc::radius::Server::deadtime_end_
protected

Deadtime end i.e.

date of hold-down end.

Note
This member is the only state member.

Definition at line 190 of file client_server.h.

Referenced by Server(), getDeadtimeEnd(), setDeadtime(), setDeadtimeEnd(), and toElement().

◆ local_addr_

asiolink::IOAddress isc::radius::Server::local_addr_
protected

Local address.

Definition at line 176 of file client_server.h.

Referenced by Server(), getLocalAddress(), setLocalAddress(), and toElement().

◆ mutex_

boost::scoped_ptr<std::mutex> isc::radius::Server::mutex_
protected

Mutex to protect the state.

Definition at line 193 of file client_server.h.

Referenced by Server(), getDeadtimeEnd(), setDeadtimeEnd(), and toElement().

◆ peer_addr_

const asiolink::IOAddress isc::radius::Server::peer_addr_
protected

Peer address.

Definition at line 170 of file client_server.h.

Referenced by Server(), getPeerAddress(), setLocalAddress(), and toElement().

◆ peer_port_

uint16_t isc::radius::Server::peer_port_
protected

Peer port.

Definition at line 173 of file client_server.h.

Referenced by Server(), getPeerPort(), setPeerPort(), and toElement().

◆ secret_

std::string isc::radius::Server::secret_
protected

Secret.

Definition at line 179 of file client_server.h.

Referenced by Server(), ~Server(), getSecret(), setSecret(), and toElement().

◆ timeout_

unsigned isc::radius::Server::timeout_
protected

Timeout.

Definition at line 182 of file client_server.h.

Referenced by Server(), getTimeout(), setTimeout(), and toElement().


The documentation for this class was generated from the following files: