57    for (
auto const& name : names) {
 
   58        if (keywords.count(name) == 0) {
 
   81    uint32_t subnet_id = subnet->getID();
 
   82    uint32_t host_subnet_id =
 
   83        (subnet->getReservationsGlobal() ? SUBNET_ID_GLOBAL : subnet_id);
 
   86    if (!
impl.auth_->getIdentifier(*query, 
id, text)) {
 
   97    if (host && host->getContext() &&
 
   99        host->getContext()->contains(
"subnet-id")) {
 
  102            subnet_id = 
static_cast<uint32_t
>(reselected->intValue());
 
  105                .arg(subnet->getID())
 
  108            if (subnet_id == SUBNET_ID_UNUSED) {
 
  114            uint32_t new_host_subnet_id = host_subnet_id;
 
  115            if (subnet_id != subnet->getID()) {
 
  118                    getCfgSubnets4()->getSubnet(subnet_id);
 
  121                              "can't find subnet with id: " << subnet_id);
 
  124                    (new_subnet->getReservationsGlobal() ?
 
  125                     SUBNET_ID_GLOBAL : subnet_id);
 
  129            if (new_host_subnet_id != host_subnet_id) {
 
  134        } 
catch (
const std::exception&) {
 
  137            static_cast<void>(
impl.cache_->remove(bad));
 
  144    if (host && host->getContext() &&
 
  156        if (!host->getIPv4Reservation().isV4Zero()) {
 
  161        if (framed_pool && (framed_pool->getValueType() == 
PW_TYPE_STRING)) {
 
  162            query->addClass(framed_pool->toString());
 
  177        impl.auth_->requests4_.get(
id);
 
  180    if (pending_request) {
 
  182          .arg(query->getLabel())
 
  189    size_t max_requests = 
impl.auth_->max_pending_requests_;
 
  190    if ((max_requests > 0) && (
impl.auth_->requests4_.size() >= max_requests)) {
 
  193            .arg(query->getLabel())
 
  200    handler = 
impl.auth_->buildAuth(*query, subnet_id, 
id, text);
 
  208    impl.auth_->requests4_.set(
id, query);
 
  225    uint32_t subnet_id = subnet->getID();
 
  226    uint32_t host_subnet_id =
 
  227        (subnet->getReservationsGlobal() ? SUBNET_ID_GLOBAL : subnet_id);
 
  230    if (!
impl.auth_->getIdentifier(*query, 
id, text)) {
 
  241    if (host && host->getContext() &&
 
  243        host->getContext()->contains(
"subnet-id")) {
 
  246            subnet_id = 
static_cast<uint32_t
>(reselected->intValue());
 
  249                .arg(subnet->getID())
 
  252            if (subnet_id == SUBNET_ID_UNUSED) {
 
  258            uint32_t new_host_subnet_id = host_subnet_id;
 
  259            if (subnet_id != subnet->getID()) {
 
  262                    getCfgSubnets6()->getSubnet(subnet_id);
 
  265                              "can't find subnet with id: " << subnet_id);
 
  268                    (new_subnet->getReservationsGlobal() ?
 
  269                     SUBNET_ID_GLOBAL : subnet_id);
 
  273            if (new_host_subnet_id != host_subnet_id) {
 
  278        } 
catch (
const std::exception&) {
 
  281            static_cast<void>(
impl.cache_->remove(bad));
 
  288    if (host && host->getContext() &&
 
  301        if (host->hasIPv6Reservation()) {
 
  306        if (framed_pool && (framed_pool->getValueType() == 
PW_TYPE_STRING)) {
 
  307            query->addClass(framed_pool->toString());
 
  322        impl.auth_->requests6_.get(
id);
 
  325    if (pending_request) {
 
  327          .arg(query->getLabel())
 
  334    size_t max_requests = 
impl.auth_->max_pending_requests_;
 
  335    if ((max_requests > 0) && (
impl.auth_->requests6_.size() >= max_requests)) {
 
  338            .arg(query->getLabel())
 
  345    handler = 
impl.auth_->buildAuth(*query, subnet_id, 
id, text);
 
  353    impl.auth_->requests6_.set(
id, query);
 
  372        if (family == AF_INET) {
 
  373            if (proc_name != 
"kea-dhcp4") {
 
  375                          << 
", expected kea-dhcp4");
 
  378            if (proc_name != 
"kea-dhcp6") {
 
  380                          << 
", expected kea-dhcp6");
 
  388    } 
catch (
const std::exception& ex) {
 
 
  456    if (!impl.auth_ || !impl.checkHostBackends()) {
 
  463    if (!query || !subnet || (subnet->getID() == 0)) {
 
  467    parking_lot->reference(query);
 
  471            parking_lot->dereference(query);
 
  477        parking_lot->dereference(query);
 
 
  501    if (!impl.auth_ || !impl.checkHostBackends()) {
 
  508    if (!query || !subnet || (subnet->getID() == 0)) {
 
  512    parking_lot->reference(query);
 
  516            parking_lot->dereference(query);
 
  522        parking_lot->dereference(query);
 
 
  545    if (!impl.acct_ || !impl.getIOContext()) {
 
  549    bool fake_allocation = 
false;
 
  550    handle.
getArgument(
"fake_allocation", fake_allocation);
 
  551    if (fake_allocation) {
 
  562    } 
catch (
const std::exception& ex) {
 
  564            .arg(
"lease4_select")
 
 
  586    if (!impl.acct_ || !impl.getIOContext()) {
 
  595    } 
catch (
const std::exception& ex) {
 
 
  619    if (!impl.acct_ || !impl.getIOContext()) {
 
  628    } 
catch (
const std::exception& ex) {
 
  630            .arg(
"lease4_release")
 
 
  652    if (!impl.acct_ || !impl.getIOContext()) {
 
  661    } 
catch (
const std::exception& ex) {
 
  663            .arg(
"lease4_decline")
 
 
  682    if (!impl.acct_ || !impl.getIOContext()) {
 
  690    } 
catch (
const std::exception& ex) {
 
  692            .arg(
"lease4_expire")
 
 
  711    if (!impl.acct_ || !impl.getIOContext()) {
 
  714    bool fake_allocation;
 
  715    handle.
getArgument(
"fake_allocation", fake_allocation);
 
  716    if (fake_allocation) {
 
  724    } 
catch (
const std::exception& ex) {
 
  726            .arg(
"lease6_select")
 
 
  745    if (!impl.acct_ || !impl.getIOContext()) {
 
  753    } 
catch (
const std::exception& ex) {
 
 
  774    if (!impl.acct_ || !impl.getIOContext()) {
 
  782    } 
catch (
const std::exception& ex) {
 
  784            .arg(
"lease6_rebind")
 
 
  803    if (!impl.acct_ || !impl.getIOContext()) {
 
  811    } 
catch (
const std::exception& ex) {
 
  813            .arg(
"lease6_release")
 
 
  832    if (!impl.acct_ || !impl.getIOContext()) {
 
  840    } 
catch (
const std::exception& ex) {
 
  842            .arg(
"lease6_decline")
 
 
  861    if (!impl.acct_ || !impl.getIOContext()) {
 
  869    } 
catch (
const std::exception& ex) {
 
  871            .arg(
"lease6_expire")
 
 
  887    if (!impl.acct_ || !impl.getIOContext()) {
 
  897        if (!arguments || !response) {
 
  917                                          origin->stringValue() == 
"ha-partner");
 
  918            if (!impl.acct_->peer_updates_ && is_from_ha_partner) {
 
  924        if (name == 
"lease4-add") {
 
  925            handler = impl.acct_->buildAcct4(arguments, 
EVENT_ADD);
 
  926        } 
else if (name == 
"lease4-update") {
 
  927            handler = impl.acct_->buildAcct4(arguments, 
EVENT_UPDATE);
 
  928        } 
else if (name== 
"lease4-del") {
 
  929            handler = impl.acct_->buildAcct4(arguments, 
EVENT_DEL);
 
  930        } 
else if (name == 
"lease6-add") {
 
  931            handler = impl.acct_->buildAcct6(arguments, 
EVENT_ADD);
 
  932        } 
else if (name == 
"lease6-update") {
 
  933            handler = impl.acct_->buildAcct6(arguments, 
EVENT_UPDATE);
 
  934        } 
else if (name== 
"lease6-del") {
 
  935            handler = impl.acct_->buildAcct6(arguments, 
EVENT_DEL);
 
  941    } 
catch (
const std::exception& ex) {
 
  943        ss << 
"command_processed: " << name;
 
 
CalloutNextStep
Specifies allowed next steps.
@ NEXT_STEP_PARK
park the packet
@ NEXT_STEP_DROP
drop the packet
@ NEXT_STEP_SKIP
skip the next processing step
static ElementPtr createMap(const Position &pos=ZERO_POSITION())
Creates an empty MapElement type ElementPtr.
A generic exception that is thrown if a parameter given to a method is considered invalid in that con...
A generic exception that is thrown when an unexpected error condition occurs.
static IOServiceMgr & instance()
Access the IOServiceMgr singleton instance.
void registerIOService(IOServicePtr io_service)
Register IOService.
void unregisterIOService(IOServicePtr io_service)
Unregister IOService.
static int64_t getInteger(isc::data::ConstElementPtr scope, const std::string &name)
Returns an integer parameter from a scope.
uint16_t getFamily() const
Returns address family.
static CfgMgr & instance()
returns a single instance of Configuration Manager
SrvConfigPtr getCurrentCfg()
Returns a pointer to the current configuration.
ConstHostPtr get6Any(const SubnetID &subnet_id, const Host::IdentifierType &identifier_type, const uint8_t *identifier_begin, const size_t identifier_len, const HostMgrOperationTarget target) const
Returns any host connected to the IPv6 subnet.
ConstHostPtr get4Any(const SubnetID &subnet_id, const Host::IdentifierType &identifier_type, const uint8_t *identifier_begin, const size_t identifier_len, const HostMgrOperationTarget target) const
Returns any host connected to the IPv4 subnet.
static HostMgr & instance()
Returns a sole instance of the HostMgr.
Represents a device with IPv4 and/or IPv6 reservations.
Per-packet callout handle.
ParkingLotHandlePtr getParkingLotHandlePtr() const
Returns pointer to the parking lot handle for this hook point.
CalloutNextStep getStatus() const
Returns the next processing step.
void setStatus(const CalloutNextStep next)
Sets the next processing step.
void getArgument(const std::string &name, T &value) const
Get argument.
void setArgument(const std::string &name, T value)
Set argument.
isc::data::ConstElementPtr getParameter(const std::string &name)
Returns configuration parameter for the library.
std::vector< std::string > getParameterNames()
Returns names of configuration parameters for the library.
static std::string getProcName()
returns the process name This value is used as when forming the default PID file name
Collection of attributes.
std::string toText(size_t indent=0) const
Returns text representation of the collection.
ConstAttributePtr get(const uint8_t type) const
Get instance of the attribute in the collection.
static Attributes fromElement(const data::ConstElementPtr &attr_list)
Parse collection.
InHook class (RAII style).
static void runAsync(RadiusAcctHandlerPtr handler)
Run asynchronously.
static const std::set< std::string > RADIUS_KEYWORDS
Keywords (aka global configuration entry names).
Radius hooks library implementation.
void reset()
Reset the state as it was just created.
void startServices()
Start the I/O mechanisms.
static RadiusImpl & instance()
RadiusImpl is a singleton class.
This file contains several functions and constants that are used for handling commands and responses ...
#define isc_throw(type, stream)
A shortcut macro to insert known values into exception arguments.
#define LOG_ERROR(LOGGER, MESSAGE)
Macro to conveniently test error output and log it.
#define LOG_INFO(LOGGER, MESSAGE)
Macro to conveniently test info output and log it.
#define LOG_DEBUG(LOGGER, LEVEL, MESSAGE)
Macro to conveniently test debug output and log it.
const int CONTROL_RESULT_ERROR
Status code indicating a general failure.
const int CONTROL_RESULT_SUCCESS
Status code indicating a successful operation.
boost::shared_ptr< const Element > ConstElementPtr
boost::shared_ptr< Element > ElementPtr
boost::shared_ptr< const Subnet6 > ConstSubnet6Ptr
A const pointer to a Subnet6 object.
boost::shared_ptr< Host > HostPtr
Pointer to the Host object.
boost::shared_ptr< const Subnet4 > ConstSubnet4Ptr
A const pointer to a Subnet4 object.
boost::shared_ptr< Pkt4 > Pkt4Ptr
A pointer to Pkt4 object.
boost::shared_ptr< Lease6 > Lease6Ptr
Pointer to a Lease6 structure.
boost::shared_ptr< const Host > ConstHostPtr
Const pointer to the Host object.
boost::shared_ptr< Pkt6 > Pkt6Ptr
A pointer to Pkt6 packet.
boost::shared_ptr< Lease4 > Lease4Ptr
Pointer to a Lease4 structure.
GssTsigImplPtr impl
The GSS-TSIG hook implementation object.
boost::shared_ptr< ParkingLotHandle > ParkingLotHandlePtr
Pointer to the parking lot handle.
boost::shared_ptr< RadiusAcctHandler > RadiusAcctHandlerPtr
Type of pointers to Radius accounting communication handler.
boost::shared_ptr< RadiusAuthPendingRequest< PktPtrType > > RadiusAuthPendingRequestPtr
Pointer to a pending Radius access request.
const isc::log::MessageID RADIUS_ACCESS_CONFLICT
const isc::log::MessageID RADIUS_ACCESS_MAX_PENDING_REQUESTS
boost::shared_ptr< const Attribute > ConstAttributePtr
const isc::log::MessageID RADIUS_INIT_OK
const isc::log::MessageID RADIUS_DEINIT_OK
const int RADIUS_DBG_TRACE
Radius logging levels.
const isc::log::MessageID RADIUS_ACCESS_CACHE_GET
boost::shared_ptr< RadiusAuthHandler > RadiusAuthHandlerPtr
Type of pointers to Radius access communication handler.
isc::log::Logger radius_logger("radius-hooks")
Radius Logger.
const isc::log::MessageID RADIUS_ACCESS_SUBNET_RESELECT
const isc::log::MessageID RADIUS_CONFIGURATION_FAILED
const isc::log::MessageID RADIUS_HOOK_FAILED
Defines the logger used by the top-level component of kea-lfc.
int subnet4_select(CalloutHandle &handle)
This callout tries to retrieve host information from cache.
int lease4_release(CalloutHandle &handle)
This callout is called at the "lease4_release" hook.
int lease4_decline(CalloutHandle &handle)
This callout is called at the "lease4_decline" hook.
int dhcp6_srv_configured(CalloutHandle &)
This function is called by the DHCPv6 server when it is configured.
int dhcp4_srv_configured(CalloutHandle &)
This function is called by the DHCPv4 server when it is configured.
int lease6_release(CalloutHandle &handle)
This callout is called at the "lease6_release" hook.
int command_processed(CalloutHandle &handle)
This callout is called at the "command_processed" hook point.
int lease6_rebind(CalloutHandle &handle)
This callout is called at the "lease6_rebind" hook.
int multi_threading_compatible()
This function is called to retrieve the multi-threading compatibility.
int lease4_renew(CalloutHandle &handle)
This callout is called at the "lease4_renew" hook.
int subnet6_select(CalloutHandle &handle)
This callout tries to retrieve host information from cache.
int lease4_select(CalloutHandle &handle)
This callout is called at the "lease4_select" hook.
int unload()
This function is called when the library is unloaded.
int lease6_expire(CalloutHandle &handle)
This callout is called at the "lease6_expire" hook.
int lease4_expire(CalloutHandle &handle)
This callout is called at the "lease4_expire" hook.
int lease6_select(CalloutHandle &handle)
This callout is called at the "lease6_select" hook.
int load(LibraryHandle &handle)
This function is called when the library is loaded.
int lease6_decline(CalloutHandle &handle)
This callout is called at the "lease6_decline" hook.
int lease6_renew(CalloutHandle &handle)
This callout is called at the "lease6_renew" hook.
RAII lock object to protect the code in the same scope with a mutex.