Kea 3.1.10
isc::radius::Exchange Class Referenceabstract

RADIUS Base Exchange. More...

#include <client_exchange.h>

Inheritance diagram for isc::radius::Exchange:

Public Types

typedef std::function< void(const ExchangePtr ex)> Handler
 Termination handler.
typedef asiolink::UDPSocket< const SocketCallbackRadiusSocket
 Type of RADIUS UDP sockets.
typedef std::function< void(const boost::system::error_code ec, const size_t size)> SocketCallback
 Type of UDP socket callback functions.

Public Member Functions

virtual ~Exchange ()=default
 Destructor.
const std::string & getId () const
 Get identifier.
int getRC () const
 Get the error code.
MessagePtr getRequest () const
 Get the request.
MessagePtr getResponse () const
 Get the response.
void logReplyMessages () const
 Log reply messages.
void processResponse ()
 Process response.
virtual void shutdown ()=0
 Shutdown.
virtual void start ()=0
 Start.

Static Public Member Functions

static ExchangePtr create (const asiolink::IOServicePtr io_service, const MessagePtr &request, unsigned maxretries, const Servers &servers, Handler handler, RadiusProtocol protocol=PW_PROTO_UDP)
 Factory.
static ExchangePtr create (const MessagePtr &request, unsigned maxretries, const Servers &servers)
 Factory.

Static Public Attributes

static constexpr size_t BUF_LEN = 8192
 Receive buffer size.

Protected Member Functions

 Exchange (const MessagePtr &request, unsigned maxretries, const Servers &servers)
 Constructor.
 Exchange (const MessagePtr &request, unsigned maxretries, const Servers &servers, Handler handler)
 Constructor.
void buildRequest (const ServerPtr &server, std::chrono::steady_clock::time_point start_time)
 Build request.
void createIdentifier ()
 Create identifier.

Protected Attributes

Handler handler_
 Termination handler.
std::string identifier_
 The identifier (random value in hexadecimal).
unsigned maxretries_
 Maximum number of retries for a server.
int rc_
 Error/return code.
MessagePtr received_
 Received message.
MessagePtr request_
 Request message.
MessagePtr sent_
 Sent message.
Servers servers_
 Servers (a copy which is what we need).
bool sync_
 Sync / async flag.

Detailed Description

RADIUS Base Exchange.

Definition at line 58 of file client_exchange.h.

Member Typedef Documentation

◆ Handler

typedef std::function<void(const ExchangePtr ex)> isc::radius::Exchange::Handler

Termination handler.

Definition at line 71 of file client_exchange.h.

◆ RadiusSocket

Type of RADIUS UDP sockets.

Definition at line 68 of file client_exchange.h.

◆ SocketCallback

typedef std::function<void(const boost::system::error_code ec, const size_t size)> isc::radius::Exchange::SocketCallback

Type of UDP socket callback functions.

Definition at line 65 of file client_exchange.h.

Constructor & Destructor Documentation

◆ ~Exchange()

virtual isc::radius::Exchange::~Exchange ( )
virtualdefault

Destructor.

◆ Exchange() [1/2]

isc::radius::Exchange::Exchange ( const MessagePtr & request,
unsigned maxretries,
const Servers & servers,
Handler handler )
protected

Constructor.

Async version.

Parameters
requestrequest message to send.
maxretriesmaximum number of retries for a server.
serversServers.
handlerTermination handler.

Definition at line 59 of file client_exchange.cc.

References createIdentifier(), isc::radius::ERROR_RC, handler_, identifier_, if(), isc_throw, maxretries_, rc_, received_, request_, sent_, servers_, and sync_.

Referenced by isc::radius::TcpExchange::TcpExchange(), isc::radius::UdpExchange::UdpExchange(), and isc::radius::UdpExchange::UdpExchange().

Here is the call graph for this function:

◆ Exchange() [2/2]

isc::radius::Exchange::Exchange ( const MessagePtr & request,
unsigned maxretries,
const Servers & servers )
protected

Constructor.

Sync version.

Parameters
requestrequest message to send.
maxretriesmaximum number of retries for a server.
serversServers.

Definition at line 78 of file client_exchange.cc.

References createIdentifier(), isc::radius::ERROR_RC, handler_, identifier_, isc_throw, maxretries_, rc_, received_, request_, sent_, servers_, and sync_.

Here is the call graph for this function:

Member Function Documentation

◆ buildRequest()

void isc::radius::Exchange::buildRequest ( const ServerPtr & server,
std::chrono::steady_clock::time_point start_time )
protected

◆ create() [1/2]

ExchangePtr isc::radius::Exchange::create ( const asiolink::IOServicePtr io_service,
const MessagePtr & request,
unsigned maxretries,
const Servers & servers,
Handler handler,
RadiusProtocol protocol = PW_PROTO_UDP )
static

Factory.

Async version.

Parameters
io_serviceReference to the IO service.
requestrequest message to send.
maxretriesmaximum number of retries for a server.
serversServers.
handlerTermination handler.
protocolProtocol (default to UDP).

Definition at line 94 of file client_exchange.cc.

References isc::radius::PW_PROTO_UDP.

Referenced by isc::radius::RadiusAcctStatus::RadiusAcctStatus(), isc::radius::RadiusAuthStatus::RadiusAuthStatus(), isc::radius::RadiusRequest::RadiusRequest(), and isc::radius::RadiusTlsStatus::RadiusTlsStatus().

◆ create() [2/2]

ExchangePtr isc::radius::Exchange::create ( const MessagePtr & request,
unsigned maxretries,
const Servers & servers )
static

Factory.

Sync version (UDP only).

Parameters
requestrequest message to send.
maxretriesmaximum number of retries for a server.
serversServers.

Definition at line 110 of file client_exchange.cc.

◆ createIdentifier()

void isc::radius::Exchange::createIdentifier ( )
protected

Create identifier.

Definition at line 157 of file client_exchange.cc.

References identifier_, isc_throw, and isc::cryptolink::random().

Referenced by Exchange(), and Exchange().

Here is the call graph for this function:

◆ getId()

const std::string & isc::radius::Exchange::getId ( ) const
inline

Get identifier.

Returns
the identifier.

Definition at line 107 of file client_exchange.h.

References identifier_.

◆ getRC()

int isc::radius::Exchange::getRC ( ) const
inline

Get the error code.

Returns
the error code.

Definition at line 114 of file client_exchange.h.

References rc_.

◆ getRequest()

MessagePtr isc::radius::Exchange::getRequest ( ) const
inline

Get the request.

Returns
the request.

Definition at line 121 of file client_exchange.h.

References request_.

◆ getResponse()

MessagePtr isc::radius::Exchange::getResponse ( ) const
inline

Get the response.

Returns
the response.

Definition at line 128 of file client_exchange.h.

References received_.

◆ logReplyMessages()

void isc::radius::Exchange::logReplyMessages ( ) const

◆ processResponse()

◆ shutdown()

virtual void isc::radius::Exchange::shutdown ( )
pure virtual

Shutdown.

Implemented in isc::radius::TcpExchange, and isc::radius::UdpExchange.

◆ start()

virtual void isc::radius::Exchange::start ( )
pure virtual

Member Data Documentation

◆ BUF_LEN

size_t isc::radius::Exchange::BUF_LEN = 8192
staticconstexpr

Receive buffer size.

Definition at line 61 of file client_exchange.h.

Referenced by isc::radius::UdpExchange::sentHandler().

◆ handler_

◆ identifier_

std::string isc::radius::Exchange::identifier_
protected

◆ maxretries_

unsigned isc::radius::Exchange::maxretries_
protected

Maximum number of retries for a server.

Note
0 is a valid value which means no retry.

Definition at line 189 of file client_exchange.h.

Referenced by Exchange(), Exchange(), and isc::radius::UdpExchange::open().

◆ rc_

◆ received_

MessagePtr isc::radius::Exchange::received_
protected

Received message.

Definition at line 185 of file client_exchange.h.

Referenced by Exchange(), Exchange(), getResponse(), logReplyMessages(), and processResponse().

◆ request_

MessagePtr isc::radius::Exchange::request_
protected

Request message.

Definition at line 179 of file client_exchange.h.

Referenced by Exchange(), Exchange(), buildRequest(), getRequest(), and processResponse().

◆ sent_

MessagePtr isc::radius::Exchange::sent_
protected

◆ servers_

Servers isc::radius::Exchange::servers_
protected

Servers (a copy which is what we need).

Definition at line 192 of file client_exchange.h.

Referenced by Exchange(), Exchange(), isc::radius::TcpExchange::TcpExchange(), and isc::radius::UdpExchange::open().

◆ sync_


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