dhcp6_unittests_LDADD += $(top_builddir)/src/lib/cc/libb10-cc.la
dhcp6_unittests_LDADD += $(top_builddir)/src/lib/config/libb10-cfgclient.la
dhcp6_unittests_LDADD += $(top_builddir)/src/lib/dhcp/libb10-dhcp++.la
+ dhcp6_unittests_LDADD += $(top_builddir)/src/lib/dhcp_ddns/libb10-dhcp_ddns.la
dhcp6_unittests_LDADD += $(top_builddir)/src/lib/dhcpsrv/libb10-dhcpsrv.la
+dhcp6_unittests_LDADD += $(top_builddir)/src/lib/hooks/libb10-hooks.la
dhcp6_unittests_LDADD += $(top_builddir)/src/lib/exceptions/libb10-exceptions.la
dhcp6_unittests_LDADD += $(top_builddir)/src/lib/log/libb10-log.la
dhcp6_unittests_LDADD += $(top_builddir)/src/lib/util/libb10-util.la
// option only for the same reasons as described in
// for IA_NA and IA_PD above.
return (factoryIAAddr6(type, begin, end));
+ } else if (code_ == D6O_CLIENT_FQDN && haveClientFqdnFormat()) {
+ // FQDN option requires special processing. Thus, there is
+ // a specialized class to handle it.
+ return (OptionPtr(new Option6ClientFqdn(begin, end)));
}
+ } else {
+ if ((code_ == DHO_FQDN) && haveFqdn4Format()) {
+ return (OptionPtr(new Option4ClientFqdn(begin, end)));
+ }
}
}
return (OptionPtr(new OptionCustom(*this, u, begin, end)));
return (haveIAx6Format(OPT_IPV6_ADDRESS_TYPE));
}
+bool
+OptionDefinition::haveFqdn4Format() const {
+ return (haveType(OPT_RECORD_TYPE) &&
+ record_fields_.size() == 4 &&
+ record_fields_[0] == OPT_UINT8_TYPE &&
+ record_fields_[1] == OPT_UINT8_TYPE &&
+ record_fields_[2] == OPT_UINT8_TYPE &&
+ record_fields_[3] == OPT_FQDN_TYPE);
+}
+
+ bool
+ OptionDefinition::haveClientFqdnFormat() const {
+ return (haveType(OPT_RECORD_TYPE) &&
+ (record_fields_.size() == 2) &&
+ (record_fields_[0] == OPT_UINT8_TYPE) &&
+ (record_fields_[1] == OPT_FQDN_TYPE));
+ }
+
template<typename T>
- T OptionDefinition::lexicalCastWithRangeCheck(const std::string& value_str) const {
+ T
+ OptionDefinition::lexicalCastWithRangeCheck(const std::string& value_str)
+ const {
// Lexical cast in case of our data types make sense only
// for uintX_t, intX_t and bool type.
if (!OptionDataTypeTraits<T>::integer_type &&
/// @return true if specified format is IAADDR option format.
bool haveIAAddr6Format() const;
+ /// @brief Check if specified format is OPTION_CLIENT_FQDN option format.
+ ///
+ /// @return true of specified format is OPTION_CLIENT_FQDN option format,
+ /// false otherwise.
+ bool haveClientFqdnFormat() const;
+
+ /// @brief Check if option has format of the DHCPv4 Client FQDN
+ /// %Option.
+ ///
+ /// The encoding of the domain-name carried by the FQDN option is
+ /// conditional and is specified in the flags field of the option.
+ /// The domain-name can be encoded in the ASCII format or canonical
+ /// wire format. The ASCII format is deprecated, therefore canonical
+ /// format is selected for the FQDN option definition and this function
+ /// returns true if the option definition comprises the domain-name
+ /// field encoded in canonical format.
+ ///
+ /// @return true if option has the format of DHCPv4 Client FQDN
+ /// %Option.
+ bool haveFqdn4Format() const;
+
/// @brief Option factory.
///
/// This function creates an instance of DHCP option using
libdhcp___unittests_SOURCES += iface_mgr_unittest.cc
libdhcp___unittests_SOURCES += libdhcp++_unittest.cc
libdhcp___unittests_SOURCES += option4_addrlst_unittest.cc
+libdhcp___unittests_SOURCES += option4_client_fqdn_unittest.cc
libdhcp___unittests_SOURCES += option6_addrlst_unittest.cc
+ libdhcp___unittests_SOURCES += option6_client_fqdn_unittest.cc
libdhcp___unittests_SOURCES += option6_ia_unittest.cc
libdhcp___unittests_SOURCES += option6_iaaddr_unittest.cc
libdhcp___unittests_SOURCES += option_int_unittest.cc
#include <dhcp/dhcp6.h>
#include <dhcp/libdhcp++.h>
#include <dhcp/option4_addrlst.h>
+#include <dhcp/option4_client_fqdn.h>
#include <dhcp/option6_addrlst.h>
+ #include <dhcp/option6_client_fqdn.h>
#include <dhcp/option6_ia.h>
#include <dhcp/option6_iaaddr.h>
#include <dhcp/option_custom.h>