Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Sebastian Schrader
Kea
Commits
2ea8006b
Commit
2ea8006b
authored
Aug 11, 2014
by
Tomek Mrugalski
🛰
Browse files
[3508] version reporting added to Kea4,Kea6,D2
parent
1bf7b6c4
Changes
6
Hide whitespace changes
Inline
Side-by-side
src/bin/d2/d2_messages.mes
View file @
2ea8006b
...
...
@@ -457,9 +457,9 @@ error after receiving a signal. This is a programmatic error and should be
reported. While The application will likely continue to operating, it may be
unable to respond correctly to signals.
% DHCP_DDNS_STARTING DHCP-DDNS starting, pid: %1
% DHCP_DDNS_STARTING DHCP-DDNS starting, pid: %1
, version: %2
This is an informational message issued when controller for the
service first starts.
service first starts.
Version is also reported.
% DHCP_DDNS_STARTING_TRANSACTION Transaction Key: %1
This is a debug message issued when DHCP-DDNS has begun a transaction for
...
...
src/bin/d2/d_controller.cc
View file @
2ea8006b
...
...
@@ -12,7 +12,7 @@
// OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
// PERFORMANCE OF THIS SOFTWARE.
#include
<config.h>
#include
<d2/d2_log.h>
#include
<config/ccsession.h>
#include
<d2/d_controller.h>
...
...
@@ -21,6 +21,7 @@
#include
<dhcpsrv/configuration.h>
#include
<sstream>
#include
<unistd.h>
namespace
isc
{
namespace
d2
{
...
...
@@ -68,7 +69,7 @@ DControllerBase::launch(int argc, char* argv[], const bool test_mode) {
// Log the starting of the service. Although this is the controller
// module, use a "DHCP_DDNS_" prefix to the module (to conform to the
// principle of least astonishment).
LOG_INFO
(
dctl_logger
,
DHCP_DDNS_STARTING
).
arg
(
getpid
());
LOG_INFO
(
dctl_logger
,
DHCP_DDNS_STARTING
).
arg
(
getpid
())
.
arg
(
VERSION
)
;
try
{
// Step 2 is to create and initialize the application process object.
initProcess
();
...
...
@@ -123,6 +124,20 @@ DControllerBase::launch(int argc, char* argv[], const bool test_mode) {
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
[])
{
...
...
@@ -132,14 +147,22 @@ DControllerBase::parseArgs(int argc, char* argv[])
int
ch
;
opterr
=
0
;
optind
=
1
;
std
::
string
opts
(
"
v
c:"
+
getCustomOpts
());
std
::
string
opts
(
"
dvV
c:"
+
getCustomOpts
());
while
((
ch
=
getopt
(
argc
,
argv
,
opts
.
c_str
()))
!=
-
1
)
{
switch
(
ch
)
{
case
'
v
'
:
case
'
d
'
:
// Enables verbose logging.
verbose_
=
true
;
break
;
case
'v'
:
printVersion
(
false
);
// print just Kea version and exit
break
;
// break not really needed, print_version never returns
case
'V'
:
printVersion
(
true
);
// print extended Kea version and exit
break
;
// break not really needed, print_version never returns
case
'c'
:
// config file name
if
(
optarg
==
NULL
)
{
...
...
src/bin/d2/d_controller.h
View file @
2ea8006b
...
...
@@ -457,6 +457,12 @@ protected:
/// 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
...
...
src/bin/dhcp4/main.cc
View file @
2ea8006b
...
...
@@ -41,17 +41,43 @@ const char* const DHCP4_NAME = "kea-dhcp4";
const
char
*
const
DHCP4_LOGGER_NAME
=
"kea-dhcp4"
;
/// @brief Prints Kea Usage and exits
///
/// Note: This function never returns. It terminates the process.
void
usage
()
{
cerr
<<
"Usage: "
<<
DHCP4_NAME
<<
" [-v] [-p number] [-c file]"
<<
endl
;
cerr
<<
" -v: verbose output"
<<
endl
;
cerr
<<
"Kea DHCPv4 server, version "
<<
VERSION
<<
endl
;
cerr
<<
endl
;
cerr
<<
"Usage: "
<<
DHCP4_NAME
<<
" [-v] [-V] [-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
<<
" -c file: specify configuration file"
<<
endl
;
cerr
<<
" -v: print version number and exit"
<<
endl
;
cerr
<<
" -V: print extended version and exit"
<<
endl
;
exit
(
EXIT_FAILURE
);
}
}
// 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
;
...
...
@@ -62,12 +88,20 @@ main(int argc, char* argv[]) {
// The standard config file
std
::
string
config_file
(
""
);
while
((
ch
=
getopt
(
argc
,
argv
,
"
v
p:c:"
))
!=
-
1
)
{
while
((
ch
=
getopt
(
argc
,
argv
,
"
dvV
p:c:"
))
!=
-
1
)
{
switch
(
ch
)
{
case
'
v
'
:
case
'
d
'
:
verbose_mode
=
true
;
break
;
case
'v'
:
printVersion
(
false
);
// print just Kea version and exit
break
;
// break not really needed, print_version never returns
case
'V'
:
printVersion
(
true
);
// print extended Kea version and exit
break
;
// break not really needed, print_version never returns
case
'p'
:
try
{
port_number
=
boost
::
lexical_cast
<
int
>
(
optarg
);
...
...
@@ -111,7 +145,7 @@ main(int argc, char* argv[]) {
LOG_DEBUG
(
dhcp4_logger
,
DBG_DHCP4_START
,
DHCP4_START_INFO
)
.
arg
(
getpid
()).
arg
(
port_number
).
arg
(
verbose_mode
?
"yes"
:
"no"
);
LOG_INFO
(
dhcp4_logger
,
DHCP4_STARTING
);
LOG_INFO
(
dhcp4_logger
,
DHCP4_STARTING
)
.
arg
(
VERSION
)
;
// Create the server instance.
ControlledDhcpv4Srv
server
(
port_number
);
...
...
src/bin/dhcp6/dhcp6_messages.mes
View file @
2ea8006b
...
...
@@ -540,9 +540,10 @@ standalone mode, not connected to the message queue. Standalone mode
is only useful during program development, and should not be used in a
production environment.
% DHCP6_STARTING
server
starting
% DHCP6_STARTING
Kea DHCPv6 server version %1
starting
This informational message indicates that the IPv6 DHCP server has
processed any command-line switches and is starting.
processed any command-line switches and is starting. The version
is also printed.
% DHCP6_START_INFO pid: %1, port: %2, verbose: %3
This is a debug message issued during the IPv6 DHCP server startup.
...
...
src/bin/dhcp6/main.cc
View file @
2ea8006b
...
...
@@ -41,17 +41,43 @@ const char* const DHCP6_NAME = "kea-dhcp6";
const
char
*
const
DHCP6_LOGGER_NAME
=
"kea-dhcp6"
;
/// @brief Prints Kea Usage and exits
///
/// Note: This function never returns. It terminates the process.
void
usage
()
{
cerr
<<
"Usage: "
<<
DHCP6_NAME
<<
" [-v] [-p port_number] [-c cfgfile]"
<<
endl
;
cerr
<<
" -v: verbose output"
<<
endl
;
cerr
<<
"Kea DHCPv6 server, version "
<<
VERSION
<<
endl
;
cerr
<<
endl
;
cerr
<<
"Usage: "
<<
DHCP6_NAME
<<
" [-c cfgfile] [-v] [-V] [-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
<<
" -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
<<
" -c file: specify configuration file"
<<
endl
;
exit
(
EXIT_FAILURE
);
}
}
// 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
;
...
...
@@ -62,12 +88,20 @@ main(int argc, char* argv[]) {
// The standard config file
std
::
string
config_file
(
""
);
while
((
ch
=
getopt
(
argc
,
argv
,
"vp:c:"
))
!=
-
1
)
{
while
((
ch
=
getopt
(
argc
,
argv
,
"
d
vp:c:"
))
!=
-
1
)
{
switch
(
ch
)
{
case
'
v
'
:
case
'
d
'
:
verbose_mode
=
true
;
break
;
case
'v'
:
printVersion
(
false
);
// print just Kea version and exit
break
;
// break not really needed, print_version never returns
case
'V'
:
printVersion
(
true
);
// print extended Kea version and exit
break
;
// break not really needed, print_version never returns
case
'p'
:
// port number
try
{
port_number
=
boost
::
lexical_cast
<
int
>
(
optarg
);
...
...
@@ -112,7 +146,7 @@ main(int argc, char* argv[]) {
LOG_DEBUG
(
dhcp6_logger
,
DBG_DHCP6_START
,
DHCP6_START_INFO
)
.
arg
(
getpid
()).
arg
(
port_number
).
arg
(
verbose_mode
?
"yes"
:
"no"
);
LOG_INFO
(
dhcp6_logger
,
DHCP6_STARTING
);
LOG_INFO
(
dhcp6_logger
,
DHCP6_STARTING
)
.
arg
(
VERSION
)
;
// Create the server instance.
ControlledDhcpv6Srv
server
(
port_number
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment