// Refer to config_report so it will be embedded in the binary
const char* const* d2_config_report = isc::detail::config_report;
-}; // namespace isc::d2
-
-}; // namespace isc
-
std::string
-isc::dhcp::Daemon::getVersion(bool extended) {
+DControllerBase::getVersion(bool extended) {
std::stringstream tmp;
tmp << VERSION;
if (extended) {
tmp << std::endl << EXTENDED_VERSION << std::endl;
- tmp << "linked with " << isc::log::Logger::getVersion() << std::endl;
- tmp << "and " << isc::cryptolink::CryptoLink::getVersion()
+ tmp << "linked with " << log::Logger::getVersion() << std::endl;
+ tmp << "and " << cryptolink::CryptoLink::getVersion()
<< std::endl;
#ifdef HAVE_MYSQL
tmp << "database: MySQL";
return (tmp.str());
}
+
+}; // namespace isc::d2
+
+}; // namespace isc
/// @brief Destructor
virtual ~DControllerBase();
+ /// @brief returns Kea version on stdout and exit.
+ /// redeclaration/redefinition. @ref Daemon::getVersion())
+ static std::string getVersion(bool extended);
+
/// @brief Acts as the primary entry point into the controller execution
/// and provides the outermost application control logic:
///
const char* const* dhcp4_config_report = isc::detail::config_report;
std::string
-Daemon::getVersion(bool extended) {
+Dhcpv4Srv::getVersion(bool extended) {
std::stringstream tmp;
tmp << VERSION;
/// @brief Destructor. Used during DHCPv4 service shutdown.
virtual ~Dhcpv4Srv();
+ /// @brief returns Kea version on stdout and exit.
+ /// redeclaration/redefinition. @ref Daemon::getVersion())
+ static std::string getVersion(bool extended);
+
/// @brief Main server processing loop.
///
/// Main server processing loop. Receives incoming packets, verifies
break;
case 'v':
- cout << Daemon::getVersion(false) << endl;
+ cout << Dhcpv4Srv::getVersion(false) << endl;
return (EXIT_SUCCESS);
case 'V':
- cout << Daemon::getVersion(true) << endl;
+ cout << Dhcpv4Srv::getVersion(true) << endl;
return (EXIT_SUCCESS);
case 'p':
const char* const* dhcp6_config_report = isc::detail::config_report;
std::string
-Daemon::getVersion(bool extended) {
+Dhcpv6Srv::getVersion(bool extended) {
std::stringstream tmp;
tmp << VERSION;
/// @brief Destructor. Used during DHCPv6 service shutdown.
virtual ~Dhcpv6Srv();
+ /// @brief returns Kea version on stdout and exit.
+ /// redeclaration/redefinition. @ref Daemon::getVersion())
+ static std::string getVersion(bool extended);
+
/// @brief Returns server-indentifier option.
///
/// @return server-id option
break;
case 'v':
- cout << Daemon::getVersion(false) << endl;
+ cout << Dhcpv6Srv::getVersion(false) << endl;
return (EXIT_SUCCESS);
case 'V':
- cout << Daemon::getVersion(true) << endl;
+ cout << Dhcpv6Srv::getVersion(true) << endl;
return (EXIT_SUCCESS);
case 'p': // port number
-// Copyright (C) 2014 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2014, 2015 Internet Systems Consortium, Inc. ("ISC")
//
// Permission to use, copy, modify, and/or distribute this software for any
// purpose with or without fee is hereby granted, provided that the above
isc::log::setDefaultLoggingOutput(verbose);
}
+std::string Daemon::getVersion(bool /*extended*/) {
+ isc_throw(isc::NotImplemented, "Daemon::getVersion() called");
+}
+
};
};
/// also additional information about sources. It is expected to
/// return extra information about dependencies and used DB backends.
///
+ /// As there is no static virtual methods in C++ this class method
+ /// has to be redefined in derived classes and called with the
+ /// derived class name or a child name.
+ ///
/// @param extended print additional information?
/// @return text string
static std::string getVersion(bool extended);
-// Copyright (C) 2014 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2014, 2015 Internet Systems Consortium, Inc. ("ISC")
//
// Permission to use, copy, modify, and/or distribute this software for any
// purpose with or without fee is hereby granted, provided that the above
using namespace isc::dhcp;
using namespace isc::data;
-std::string isc::dhcp::Daemon::getVersion(bool extended) {
+namespace isc {
+namespace dhcp {
+
+// @brief Derived Daemon class
+class DaemonImpl : public Daemon {
+public:
+ static std::string getVersion(bool extended);
+};
+
+std::string DaemonImpl::getVersion(bool extended) {
if (extended) {
return (std::string("EXTENDED"));
} else {
}
}
+};
+};
+
namespace {
/// @brief Daemon Test test fixture class
EXPECT_EQ("stdout" , storage->getLoggingInfo()[0].destinations_[0].output_);
}
+// Test the getVersion() redefinition
+TEST_F(DaemonTest, getVersion) {
+ EXPECT_THROW(Daemon::getVersion(false), NotImplemented);
+
+ ASSERT_NO_THROW(DaemonImpl::getVersion(false));
+
+ EXPECT_EQ(DaemonImpl::getVersion(true), "EXTENDED");
+}
+
// More tests will appear here as we develop Daemon class.