summaryrefslogtreecommitdiffstats
path: root/src/lib/dhcp/pkt4o6.h
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-13 12:15:43 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-13 12:15:43 +0000
commitf5f56e1a1c4d9e9496fcb9d81131066a964ccd23 (patch)
tree49e44c6f87febed37efb953ab5485aa49f6481a7 /src/lib/dhcp/pkt4o6.h
parentInitial commit. (diff)
downloadisc-kea-f5f56e1a1c4d9e9496fcb9d81131066a964ccd23.tar.xz
isc-kea-f5f56e1a1c4d9e9496fcb9d81131066a964ccd23.zip
Adding upstream version 2.4.1.upstream/2.4.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/lib/dhcp/pkt4o6.h')
-rw-r--r--src/lib/dhcp/pkt4o6.h88
1 files changed, 88 insertions, 0 deletions
diff --git a/src/lib/dhcp/pkt4o6.h b/src/lib/dhcp/pkt4o6.h
new file mode 100644
index 0000000..be46460
--- /dev/null
+++ b/src/lib/dhcp/pkt4o6.h
@@ -0,0 +1,88 @@
+// Copyright (C) 2015-2018 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 PKT4O6_H
+#define PKT4O6_H
+
+#include <dhcp/pkt4.h>
+#include <dhcp/pkt6.h>
+
+#include <boost/shared_ptr.hpp>
+
+namespace isc {
+
+namespace dhcp {
+
+/// @brief Represents DHCPv4-over-DHCPv6 packet
+///
+/// This class derives from @c Pkt4 in order to be handled by
+/// the DHCPv4 server code. It includes a shared pointer to the
+/// DHCPv6 message too.
+///
+/// This is an implementation of the DHCPv4-query/response DHCPv6 messages
+/// defined in RFC 7341 (http://ietf.org/rfc/rfc7341.txt).
+/// See also
+/// https://gitlab.isc.org/isc-projects/kea/wikis/designs/dhcpv4o6-design
+/// for design discussions.
+class Pkt4o6 : public Pkt4 {
+public:
+
+ /// @brief Constructor, used in message reception.
+ ///
+ /// @param pkt4 Content of the DHCPv4-message option
+ /// @param pkt6 encapsulating unpacked DHCPv6 message
+ /// the DHCPv4 message option will be removed
+ Pkt4o6(const OptionBuffer& pkt4, const Pkt6Ptr& pkt6);
+
+ /// @brief Constructor, used in replying to a message
+ ///
+ /// @param pkt4 DHCPv4 message
+ /// @param pkt6 DHCPv6 message
+ Pkt4o6(const Pkt4Ptr& pkt4, const Pkt6Ptr& pkt6);
+
+ /// @brief Returns encapsulating DHCPv6 message
+ Pkt6Ptr getPkt6() const { return (pkt6_); }
+
+ /// @brief Prepares on-wire format of DHCPv4-over-DHCPv6 packet.
+ ///
+ /// Calls pack() on both DHCPv4 and DHCPv6 parts
+ /// Inserts the DHCPv4-message option
+ /// @ref Pkt4::pack and @ref Pkt6::pack
+ virtual void pack();
+
+ /// @brief Checks if a DHCPv4 message has been transported over DHCPv6
+ ///
+ /// @return Boolean value which indicates whether the message is
+ /// transported over DHCPv6 (true) or native DHCPv4 (false)
+ virtual bool isDhcp4o6() const {
+ return (true);
+ }
+
+ /// @brief Overrides the @ref Pkt::setCopyRetrievedOptions to also
+ /// set the flag for encapsulated @ref Pkt6 instance.
+ ///
+ /// When the flag is set for the instance of the @ref Pkt4o6 the
+ /// encapsulated Pkt6, retrieved with @ref Pkt4o6::getPkt6, will
+ /// inherit this setting.
+ ///
+ /// @param copy Indicates if the options should be copied when
+ /// retrieved (if true), or not copied (if false).
+ virtual void setCopyRetrievedOptions(const bool copy);
+
+private:
+ /// Encapsulating DHCPv6 message
+ Pkt6Ptr pkt6_;
+
+}; // Pkt4o6 class
+
+/// @brief A pointer to Pkt4o6 object.
+typedef boost::shared_ptr<Pkt4o6> Pkt4o6Ptr;
+
+} // isc::dhcp namespace
+
+} // isc namespace
+
+#endif