19namespace ph = std::placeholders;
 
   26    auto const by_id = remap.find(subnet_id);
 
   27    if (by_id != remap.end()) {
 
   28        return (by_id->second);
 
   30    auto const by_id0 = remap.find(SUBNET_ID_DEFAULT);
 
   31    if (by_id0 != remap.end()) {
 
   32        return (by_id0->second);
 
 
   65                                     request, maxretries, servers,
 
 
   75        send_attrs = request->getAttributes();
 
   79        .arg(send_attrs ? send_attrs->toText() : 
"no attributes");
 
   85    if (result == 
OK_RC) {
 
   88            .arg(recv_attrs ? recv_attrs->toText() : 
"no attributes");
 
   92            .arg(recv_attrs ? recv_attrs->toText() : 
"no attributes");
 
 
  122        send_attrs = request->getAttributes();
 
  126        .arg(send_attrs ? send_attrs->toText() : 
"no attributes");
 
 
  137        result = exchange->getRC();
 
  138        MessagePtr response = exchange->getResponse();
 
  140            recv_attrs = response->getAttributes();
 
  143    if (result == 
OK_RC) {
 
  146            .arg(recv_attrs ? recv_attrs->toText() : 
"no attributes");
 
  150            .arg(recv_attrs ? recv_attrs->toText() : 
"no attributes");
 
  160            callback(result, recv_attrs);
 
  164    exchange->shutdown();
 
 
  173        send_attrs = request->getAttributes();
 
  177        .arg(send_attrs ? send_attrs->toText() : 
"no attributes");
 
  181    int result = 
getRC();
 
  182    if (result == 
OK_RC) {
 
 
  214        send_attrs = request->getAttributes();
 
  218        .arg(send_attrs ? send_attrs->toText() : 
"no attributes");
 
 
  228        result = exchange->getRC();
 
  230    if (result == 
OK_RC) {
 
  246    exchange->shutdown();
 
 
static AttributePtr fromInt(const uint8_t type, const uint32_t value)
From integer with type.
Collection of attributes.
std::function< void(const ExchangePtr ex)> Handler
Termination handler.
RadiusAcct(uint32_t subnet_id, const AttributesPtr &send_attrs, bool sync, const Exchange::Handler &handler)
Constructor.
static void invokeCallback(const CallbackAcct &callback, const ExchangePtr exchange)
Invoke accounting communication callback.
virtual void start() override
Start communication.
RadiusAsyncAcct(uint32_t subnet_id, const AttributesPtr &send_attrs, const CallbackAcct &callback)
Constructor.
static void invokeCallback(const CallbackAuth &callback, const ExchangePtr exchange)
Invoke authentication communication callback.
virtual void start() override
Start communication.
RadiusAsyncAuth(uint32_t subnet_id, const AttributesPtr &send_attrs, const CallbackAuth &callback)
Constructor.
RadiusAuth(uint32_t subnet_id, const AttributesPtr &send_attrs, bool sync, const Exchange::Handler &handler)
Constructor.
void unregisterExchange(ExchangePtr exchange)
Unregister Exchange.
boost::shared_ptr< RadiusAccess > auth_
boost::shared_ptr< RadiusAccounting > acct_
Pointer to accounting (never null).
unsigned retries_
Retries.
std::map< uint32_t, uint32_t > remap_
Subnet ID to NAS port map.
static RadiusImpl & instance()
RadiusImpl is a singleton class.
int getRC() const
Get the error code.
RadiusRequest(const MsgCode code, uint32_t subnet_id, const AttributesPtr &send_attrs, bool sync, const Exchange::Handler &handler)
Constructor.
AttributesPtr getRespAttrs() const
Get response attributes.
virtual void start()
Start communication.
uint32_t nas_port_
Client/NAS port (from Subnet Id).
ExchangePtr exchange_
Exchange.
virtual void start() override
Start communication.
CallbackAcct callback_
Accounting termination callback.
CallbackAuth callback_
Authentication termination callback.
virtual void start() override
Start communication.
#define LOG_DEBUG(LOGGER, LEVEL, MESSAGE)
Macro to conveniently test debug output and log it.
const isc::log::MessageID RADIUS_AUTHENTICATION_SYNC_FAILED
const isc::log::MessageID RADIUS_AUTHENTICATION_ASYNC_FAILED
const isc::log::MessageID RADIUS_ACCOUNTING_ASYNC_SUCCEED
const isc::log::MessageID RADIUS_ACCOUNTING_SYNC_SUCCEED
const isc::log::MessageID RADIUS_AUTHENTICATION_ASYNC
const isc::log::MessageID RADIUS_AUTHENTICATION_SYNC
boost::shared_ptr< Attributes > AttributesPtr
Shared pointers to attribute collection.
std::function< void(int)> CallbackAcct
Type of callback for accounting termination.
const isc::log::MessageID RADIUS_ACCOUNTING_SYNC
string exchangeRCtoText(const int rc)
ExchangeRC value -> name function.
const isc::log::MessageID RADIUS_AUTHENTICATION_SYNC_REJECTED
std::vector< ServerPtr > Servers
Type of RADIUS server collection.
boost::shared_ptr< Exchange > ExchangePtr
Type of shared pointers to RADIUS exchange object.
const isc::log::MessageID RADIUS_ACCOUNTING_SYNC_FAILED
const int RADIUS_DBG_TRACE
Radius logging levels.
const isc::log::MessageID RADIUS_ACCOUNTING_ASYNC_FAILED
const isc::log::MessageID RADIUS_ACCOUNTING_ASYNC
const isc::log::MessageID RADIUS_AUTHENTICATION_SYNC_ACCEPTED
std::function< void(int, AttributesPtr)> CallbackAuth
Type of callback for authentication termination.
isc::log::Logger radius_logger("radius-hooks")
Radius Logger.
boost::shared_ptr< Message > MessagePtr
Shared pointers to message.
MsgCode
Standard RADIUS message code.
uint32_t getNASPort(uint32_t subnet_id)
Remap a subnet ID to a NAS port.
const isc::log::MessageID RADIUS_AUTHENTICATION_ASYNC_ACCEPTED
const isc::log::MessageID RADIUS_AUTHENTICATION_ASYNC_REJECTED
Defines the logger used by the top-level component of kea-lfc.