+AM_CPPFLAGS = -I$(top_srcdir)/src/bin -I$(top_builddir)/src/bin
+
# Get rid of generated message files on a clean
CLEANFILES = *.gcno *.gcda
# convenience archive
noinst_LTLIBRARIES = libcfgrpt.la
-libcfgrpt_la_SOURCES = config_report.h config_report.cc
+libcfgrpt_la_SOURCES = config_report.h config_report.cc cfgrpt.cc
--- /dev/null
+// Copyright (C) 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
+// copyright notice and this permission notice appear in all copies.
+//
+// THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
+// REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+// AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
+// INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
+// LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
+// OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+// PERFORMANCE OF THIS SOFTWARE.
+
+#include <sstream>
+
+#include <cfgrpt/config_report.h>
+
+namespace isc {
+namespace detail {
+
+// The config_report array finished by an empty line ("")
+// Each line before this final one begins by four semicolons (;;;;)
+// in order to be easy to extract from binaries.
+std::string
+getConfigReport() {
+ std::stringstream tmp;
+
+ size_t linenum = 0;
+ for (;;) {
+ const char* const line = config_report[linenum++];
+ if (line[0] == '\0')
+ break;
+ tmp << line + 4 << std::endl;
+ }
+ return (tmp.str());
+}
+
+}
+}
extern const char* const config_report[];
+// The config_report array finished by an empty line ("")
+// Each line before this final one begins by four semicolons (;;;;)
+// in order to be easy to extract from binaries.
+std::string getConfigReport();
+
}
}
int ch;
opterr = 0;
optind = 1;
- std::string opts("dvVc:" + getCustomOpts());
+ std::string opts("dvVWc:" + getCustomOpts());
while ((ch = getopt(argc, argv, opts.c_str())) != -1) {
switch (ch) {
case 'd':
isc_throw(VersionMessage, getVersion(true));
break;
+ case 'W':
+ // gather Kea config report and throw so main() can catch and
+ // return rather than calling exit() here which disrupts gtest.
+ isc_throw(VersionMessage, isc::detail::getConfigReport());
+ break;
+
case 'c':
// config file name
if (optarg == NULL) {
<< " -d: optional, verbose output " << std::endl
<< " -v: print version number and exit" << std::endl
<< " -V: print extended version information and exit"
+ << std::endl
+ << " -W: display the configuration report and exit"
<< std::endl;
// add any derivation specific usage
#include <dhcpsrv/cfgmgr.h>
#include <log/logger_support.h>
#include <log/logger_manager.h>
+#include <cfgrpt/config_report.h>
#include <boost/lexical_cast.hpp>
cerr << "Kea DHCPv4 server, version " << VERSION << endl;
cerr << endl;
cerr << "Usage: " << DHCP4_NAME
- << " [-v] [-V] [-d] [-p number] [-c file]" << endl;
+ << " -[v|V|W] [-d] [-p number] [-c file]" << endl;
cerr << " -c file: specify configuration file" << endl;
cerr << " -d: debug mode with extra verbosity (former -v)" << endl;
cerr << " -p number: specify non-standard port number 1-65535 "
<< "(useful for testing only)" << endl;
cerr << " -v: print version number and exit" << endl;
cerr << " -V: print extended version and exit" << endl;
+ cerr << " -W: display the configuration report and exit" << endl;
exit(EXIT_FAILURE);
}
} // end of anonymous namespace
// The standard config file
std::string config_file("");
- while ((ch = getopt(argc, argv, "dvVp:c:")) != -1) {
+ while ((ch = getopt(argc, argv, "dvVWp:c:")) != -1) {
switch (ch) {
case 'd':
verbose_mode = true;
cout << Daemon::getVersion(true) << endl;
return (EXIT_SUCCESS);
+ case 'W':
+ cout << isc::detail::getConfigReport() << endl;
+ return (EXIT_SUCCESS);
+
case 'p':
try {
port_number = boost::lexical_cast<int>(optarg);
#include <log/logger_support.h>
#include <log/logger_manager.h>
#include <exceptions/exceptions.h>
+#include <cfgrpt/config_report.h>
#include <boost/lexical_cast.hpp>
cerr << "Kea DHCPv6 server, version " << VERSION << endl;
cerr << endl;
cerr << "Usage: " << DHCP6_NAME
- << " [-c cfgfile] [-v] [-V] [-d] [-p port_number]" << endl;
+ << " [-c cfgfile] -[v|V|W] [-d] [-p port_number]" << endl;
cerr << " -c file: specify configuration file" << endl;
cerr << " -v: print version number and exit." << endl;
cerr << " -V: print extended version and exit" << endl;
+ cerr << " -W: display the configuration report and exit" << endl;
cerr << " -d: debug mode with extra verbosity (former -v)" << endl;
cerr << " -p number: specify non-standard port number 1-65535 "
<< "(useful for testing only)" << endl;
// The standard config file
std::string config_file("");
- while ((ch = getopt(argc, argv, "dvVp:c:")) != -1) {
+ while ((ch = getopt(argc, argv, "dvVWp:c:")) != -1) {
switch (ch) {
case 'd':
verbose_mode = true;
cout << Daemon::getVersion(true) << endl;
return (EXIT_SUCCESS);
+ case 'W':
+ cout << isc::detail::getConfigReport() << endl;
+ return (EXIT_SUCCESS);
+
case 'p': // port number
try {
port_number = boost::lexical_cast<int>(optarg);