1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
// Copyright (C) 2022 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Kea Hooks Basic
// Commercial End User License Agreement v2.0. See COPYING file in the premium/
// directory.

#include <config.h>

#include <dhcpsrv/lease_mgr_factory.h>
#include <dhcpsrv/srv_config.h>
#include <hooks/callout_handle.h>
#include <limits/limit_manager.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
#include <util/dhcp_space.h>

using namespace isc::dhcp;
using namespace isc::hooks;

using isc::hooks::CalloutHandle;
using isc::util::DHCPv6;

namespace isc {
namespace limits {

// Functions accessed by the hooks framework use C linkage to avoid the name
// mangling that accompanies use of the C++ compiler as well as to avoid
// issues related to namespaces
extern "C" {

/// @brief Callout at the cb6_updated hook point
///
/// @param handle CalloutHandle which provides access to context
///
/// @return 0 upon success
int
cb6_updated(CalloutHandle& handle) {
    return (LimitManager::instance().cb_updated<DHCPv6>(handle));
}

/// @brief dhcp6_srv_configured callout implementation
///
/// @param handle CalloutHandle
///
/// @return 0 on success, non-zero otherwise.
int
dhcp6_srv_configured(CalloutHandle& handle) {
    return (LimitManager::instance().dhcp_srv_configured<DHCPv6>(handle));
}

/// @brief Callout at the pkt6_receive hook point
///
/// @param handle CalloutHandle which provides access to context
///
/// @return 0 upon success, non-zero otherwise.
int
pkt6_receive(CalloutHandle& handle) {
    return (LimitManager::instance().pkt_receive<DHCPv6>(handle));
}

/// @brief Callout at the subnet6_select hook point
///
/// @param handle CalloutHandle which provides access to context
///
/// @return 0 upon success, non-zero otherwise.
int
subnet6_select(CalloutHandle& handle) {
    return (LimitManager::instance().subnet_select<DHCPv6>(handle));
}

/// @brief Callout at the lease6_select hook point
///
/// @param handle CalloutHandle which provides access to context
///
/// @return 0 upon success, non-zero otherwise.
int
lease6_select(CalloutHandle& handle) {
    return (LimitManager::instance().lease_callout<DHCPv6>(handle));
}

/// @brief Callout at the lease6_renew hook point
///
/// @param handle CalloutHandle which provides access to context
///
/// @return 0 upon success, non-zero otherwise.
int
lease6_renew(CalloutHandle& handle) {
    return (LimitManager::instance().lease_callout<DHCPv6>(handle, /* lease_update = */ true));
}

/// @brief Callout at the lease6_rebind hook point
///
/// @param handle CalloutHandle which provides access to context
///
/// @return 0 upon success, non-zero otherwise.
int
lease6_rebind(CalloutHandle& handle) {
    return (LimitManager::instance().lease_callout<DHCPv6>(handle, /* lease_update = */ true));
}

}  // extern "C"

}  // namespace limits
}  // namespace isc