/// @brief Creates input binding for user context parameter.
///
- /// @param T Type of the configuration element to which context belongs.
+ /// @tparam T Type of the configuration element to which context belongs.
/// @param network Pointer to a shared network, subnet or other configuration
/// element for which binding should be created.
/// @return Pointer to the binding (possibly null binding if context is
libkea_dhcp___la_SOURCES += pkt_filter6.h pkt_filter6.cc
libkea_dhcp___la_SOURCES += pkt_filter_inet.cc pkt_filter_inet.h
libkea_dhcp___la_SOURCES += pkt_filter_inet6.cc pkt_filter_inet6.h
+libkea_dhcp___la_SOURCES += pkt_template.h
libkea_dhcp___la_SOURCES += socket_info.h
# Utilize Linux Packet Filtering on Linux.
pkt_filter6.h \
pkt_filter_inet.h \
pkt_filter_inet6.h \
+ pkt_template.h \
protocol_util.h \
socket_info.h \
std_option_defs.h
/// - int16_t,
/// - int32_t.
///
-/// @param T data field type (see above).
+/// @tparam T data field type (see above).
template<typename T>
class OptionInt: public Option {
private:
/// allow addition of sub-options but they will be ignored during
/// packing and unpacking option data.
///
-/// @param T data field type (see above).
+/// @tparam T data field type (see above).
template<typename T>
class OptionIntArray : public Option {
private:
--- /dev/null
+// Copyright (C) 2022 Internet Systems Consortium, Inc. ("ISC")
+//
+// This Source Code Form is subject to the terms of the Mozilla Public
+// License, v. 2.0. If a copy of the MPL was not distributed with this
+// file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+#ifndef ISC_PKT_TEMPLATE_H
+#define ISC_PKT_TEMPLATE_H
+
+#include <dhcp/pkt4.h>
+#include <dhcp/pkt6.h>
+#include <util/dhcp_space.h>
+
+namespace isc {
+
+namespace dhcp {
+
+/// @brief adapters for linking templates to qualified names
+/// @{
+namespace {
+
+template <isc::util::DhcpSpace D>
+struct adapter_Pkt {};
+
+template <>
+struct adapter_Pkt<isc::util::DHCPv4> {
+ using type = Pkt4;
+};
+
+template <>
+struct adapter_Pkt<isc::util::DHCPv6> {
+ using type = Pkt6;
+};
+
+} // namespace
+
+template <isc::util::DhcpSpace D>
+using PktT = typename adapter_Pkt<D>::type;
+
+template <isc::util::DhcpSpace D>
+using PktTPtr = boost::shared_ptr<PktT<D>>;
+/// @}
+
+} // namespace dhcp
+} // namespace isc
+
+#endif // ISC_PKT_TEMPLATE_H
#include <dhcpsrv/network.h>
#include <dhcpsrv/pool.h>
#include <dhcpsrv/subnet_id.h>
+#include <util/dhcp_space.h>
#include <util/triplet.h>
+
#include <boost/multi_index/mem_fun.hpp>
#include <boost/multi_index/indexed_by.hpp>
#include <boost/multi_index/ordered_index.hpp>
#include <boost/pointer_cast.hpp>
#include <boost/scoped_ptr.hpp>
#include <boost/shared_ptr.hpp>
+
#include <cstdint>
#include <map>
#include <mutex>
/// @brief Type of the @c SubnetFetcher used for IPv6.
using SubnetFetcher6 = SubnetFetcher<Subnet6Ptr, Subnet6Collection>;
+//@}
+/// @brief adapters for linking templates to qualified names
+/// @{
+namespace {
-//@}
+template <isc::util::DhcpSpace D>
+struct adapter_Subnet {};
+
+template <>
+struct adapter_Subnet<isc::util::DHCPv4> {
+ using type = Subnet4;
+};
+
+template <>
+struct adapter_Subnet<isc::util::DHCPv6> {
+ using type = Subnet6;
+};
+
+} // namespace
+
+template <isc::util::DhcpSpace D>
+using SubnetT = typename adapter_Subnet<D>::type;
+
+template <isc::util::DhcpSpace D>
+using SubnetTPtr = boost::shared_ptr<SubnetT<D>>;
+/// @}
} // end of isc::dhcp namespace
} // end of isc namespace
callout_handle_->setStatus(CalloutHandle::NEXT_STEP_CONTINUE);
}
+template <>
+char const* queryArgument<isc::util::DHCPv4>() {
+ return "query4";
+}
+
+template <>
+char const* queryArgument<isc::util::DHCPv6>() {
+ return "query6";
+}
+
+template <>
+char const* subnetArgument<isc::util::DHCPv4>() {
+ return "subnet4";
+}
+
+template <>
+char const* subnetArgument<isc::util::DHCPv6>() {
+ return "subnet6";
+}
+
} // namespace hooks
} // namespace isc
#include <exceptions/exceptions.h>
#include <hooks/library_handle.h>
#include <hooks/parking_lots.h>
+#include <util/dhcp_space.h>
#include <boost/any.hpp>
#include <boost/shared_ptr.hpp>
CalloutHandlePtr callout_handle_;
};
+template <isc::util::DhcpSpace D>
+char const* queryArgument();
+
+template <isc::util::DhcpSpace D>
+char const* subnetArgument();
+
} // namespace hooks
} // namespace isc
libkea_util_la_SOURCES += buffer.h io_utilities.h
libkea_util_la_SOURCES += chrono_time_utils.h chrono_time_utils.cc
libkea_util_la_SOURCES += csv_file.h csv_file.cc
+libkea_util_la_SOURCES += dhcp_space.cc dhcp_space.h
libkea_util_la_SOURCES += doubles.h
libkea_util_la_SOURCES += file_utilities.h file_utilities.cc
libkea_util_la_SOURCES += filename.h filename.cc
boost_time_utils.h \
buffer.h \
csv_file.h \
+ dhcp_space.h \
doubles.h \
file_utilities.h \
filename.h \
--- /dev/null
+// Copyright (C) 2022 Internet Systems Consortium, Inc. ("ISC")
+//
+// This Source Code Form is subject to the terms of the Mozilla Public
+// License, v. 2.0. If a copy of the MPL was not distributed with this
+// file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+#include <config.h>
+
+#include <util/dhcp_space.h>
+
+namespace isc {
+namespace util {
+
+template <>
+uint16_t integerDhcpSpace<DHCPv4>() {
+ return 4;
+}
+
+template <>
+uint16_t integerDhcpSpace<DHCPv6>() {
+ return 6;
+}
+
+template <>
+char const* cStringDhcpSpace<DHCPv4>() {
+ return "4";
+}
+
+template <>
+char const* cStringDhcpSpace<DHCPv6>() {
+ return "6";
+}
+
+} // namespace util
+} // namespace isc
--- /dev/null
+// Copyright (C) 2022 Internet Systems Consortium, Inc. ("ISC")
+//
+// This Source Code Form is subject to the terms of the Mozilla Public
+// License, v. 2.0. If a copy of the MPL was not distributed with this
+// file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+#ifndef ISC_DHCP_SPACE_H
+#define ISC_DHCP_SPACE_H 1
+
+#include <cstdint>
+
+namespace isc {
+namespace util {
+
+enum DhcpSpace {
+ DHCPv4,
+ DHCPv6,
+};
+
+template <DhcpSpace D>
+constexpr uint16_t integerDhcpSpace();
+
+template <DhcpSpace D>
+constexpr char const* cStringDhcpSpace();
+
+} // namespace util
+} // namespace isc
+
+#endif // ISC_DHCP_SPACE_H