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
// 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::DHCPv4;

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 cb4_updated hook point
///
/// @param handle CalloutHandle which provides access to context
///
/// @return 0 upon success
int
cb4_updated(CalloutHandle& handle) {
    return (LimitManager::instance().cb_updated<DHCPv4>(handle));
}

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

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

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

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

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

}  // extern "C"

}  // namespace limits
}  // namespace isc