</listitem>
<listitem>
<simpara>
- <command>-v</command> - prints out Kea version and exists.
+ <command>-v</command> - prints out Kea version and exits.
</simpara>
</listitem>
<listitem>
<simpara>
<command>-V</command> - prints out Kea extended version with
- additional parameters and exists.
+ additional parameters and exits.
</simpara>
</listitem>
</itemizedlist>
</listitem>
<listitem>
<simpara>
- <command>-v</command> - prints out Kea version and exists.
+ <command>-v</command> - prints out Kea version and exits.
</simpara>
</listitem>
<listitem>
<simpara>
<command>-V</command> - prints out Kea extended version with
- additional parameters and exists.
+ additional parameters and exits.
</simpara>
</listitem>
</itemizedlist>
</listitem>
<listitem>
<simpara>
- <command>-v</command> - prints out Kea version and exists.
+ <command>-v</command> - prints out Kea version and exits.
</simpara>
</listitem>
<listitem>
<simpara>
<command>-V</command> - prints out Kea extended version with
- additional parameters and exists.
+ additional parameters and exits.
</simpara>
</listitem>
</itemizedlist>
LOG_INFO(dctl_logger, DHCP_DDNS_SHUTDOWN);
}
-void
-DControllerBase::printVersion(bool extended) const {
- std::cout << VERSION << std::endl;
- if (extended) {
- std::cout << EXTENDED_VERSION << std::endl;
-
- // @todo print more details (is it Botan or OpenSSL build,
- // with or without MySQL/Postgres? What compilation options were
- // used? etc)
- }
-
- exit(EXIT_SUCCESS);
-}
-
void
DControllerBase::parseArgs(int argc, char* argv[])
{
break;
case 'v':
- printVersion(false); // print just Kea version and exit
- break; // break not really needed, print_version never returns
+ // Print just Kea version and exit
+ std::cout << getVersion(false) << std::endl;
+ exit(EXIT_SUCCESS);
case 'V':
- printVersion(true); // print extended Kea version and exit
- break; // break not really needed, print_version never returns
+ // Print extended Kea version and exit
+ std::cout << getVersion(true) << std::endl;
+ exit(EXIT_SUCCESS);
case 'c':
// config file name
}
}; // namespace isc
+
+std::string
+isc::dhcp::Daemon::getVersion(bool extended) {
+ std::stringstream tmp;
+
+ tmp << VERSION;
+ if (extended) {
+ tmp << std::endl << EXTENDED_VERSION;
+
+ // @todo print more details (is it Botan or OpenSSL build,
+ // with or without MySQL/Postgres? What compilation options were
+ // used? etc)
+ }
+
+ return (tmp.str());
+}
/// This is intended to be used for specific usage violation messages.
void usage(const std::string& text);
- /// @brief Prints version number to stdout and exit.
- ///
- /// Note: This method never returns, it terminates the process.
- /// @param extended print additional information?
- void printVersion(bool extended) const;
-
private:
/// @brief Name of the service under control.
/// This name is used as the configuration module name and appears in log
CfgMgr::instance().getD2ClientMgr().suspendUpdates();
}
+std::string
+Daemon::getVersion(bool extended) {
+ std::stringstream tmp;
+
+ tmp << VERSION;
+ if (extended) {
+ tmp << endl << EXTENDED_VERSION;
+
+ // @todo print more details (is it Botan or OpenSSL build,
+ // with or without MySQL/Postgres? What compilation options were
+ // used? etc)
+ }
+
+ return (tmp.str());
+}
+
} // namespace dhcp
} // namespace isc
}
} // end of anonymous namespace
-/// @brief Prints Kea version on stdout and exits.
-///
-/// Note: This function never returns. It terminates the process.
-/// @param extended print additional information?
-void
-printVersion(bool extended) {
- cout << VERSION << endl;
- if (extended) {
- cout << EXTENDED_VERSION << endl;
-
- // @todo print more details (is it Botan or OpenSSL build,
- // with or without MySQL/Postgres? What compilation options were
- // used? etc)
- }
-
- exit(EXIT_SUCCESS);
-}
-
int
main(int argc, char* argv[]) {
int ch;
break;
case 'v':
- printVersion(false); // print just Kea version and exit
- break; // break not really needed, print_version never returns
+ cout << Daemon::getVersion(false) << endl;
+ return (EXIT_SUCCESS);
case 'V':
- printVersion(true); // print extended Kea version and exit
- break; // break not really needed, print_version never returns
+ cout << Daemon::getVersion(false) << endl;
+ return (EXIT_SUCCESS);
case 'p':
try {
CfgMgr::instance().getD2ClientMgr().suspendUpdates();
}
+std::string
+Daemon::getVersion(bool extended) {
+ std::stringstream tmp;
+
+ tmp << VERSION;
+ if (extended) {
+ tmp << endl << EXTENDED_VERSION;
+
+ // @todo print more details (is it Botan or OpenSSL build,
+ // with or without MySQL/Postgres? What compilation options were
+ // used? etc)
+ }
+
+ return (tmp.str());
+}
+
};
};
}
} // end of anonymous namespace
-/// @brief Prints Kea version on stdout and exits.
-///
-/// Note: This function never returns. It terminates the process.
-/// @param extended print additional information?
-void
-printVersion(bool extended) {
- cout << VERSION << endl;
- if (extended) {
- cout << EXTENDED_VERSION << endl;
-
- // @todo print more details (is it Botan or OpenSSL build,
- // with or without MySQL/Postgres? What compilation options were
- // used? etc)
- }
-
- exit(EXIT_SUCCESS);
-}
-
int
main(int argc, char* argv[]) {
int ch;
break;
case 'v':
- printVersion(false); // print just Kea version and exit
- break; // break not really needed, print_version never returns
+ cout << Daemon::getVersion(false) << endl;
+ return (EXIT_SUCCESS);
case 'V':
- printVersion(true); // print extended Kea version and exit
- break; // break not really needed, print_version never returns
+ cout << Daemon::getVersion(true) << endl;
+ return (EXIT_SUCCESS);
case 'p': // port number
try {
return (verbose_);
}
+ /// @brief returns Kea version on stdout and exits.
+ ///
+ /// With extended == false, this method returns a simple string
+ /// containing version number. With extended == true, it returns
+ /// also additional information about sources. It is expected to
+ /// return extra information about dependencies and used DB backends.
+ ///
+ /// @param extended print additional information?
+ /// @return text string
+ static std::string getVersion(bool extended);
+
protected:
/// @brief Invokes handler for the next received signal.
using namespace isc::dhcp;
using namespace isc::data;
+std::string isc::dhcp::Daemon::getVersion(bool extended) {
+ if (extended) {
+ return (std::string("EXTENDED"));
+ } else {
+ return (std::string("BASIC"));
+ }
+}
+
namespace {
+
// Very simple test. Checks whether Daemon can be instantiated and its
// default parameters are sane
TEST(DaemonTest, constructor) {
kill -${sig} ${_GET_PIDS}
}
-# This test verifies that DHCPv4 server is reporting its version properly.
+# This test verifies that the binary is reporting its version properly.
version_test() {
test_name=${1} # Test name