Kea  1.5.0
stat_cmds_callouts.cc
Go to the documentation of this file.
1 // Copyright (C) 2018 Internet Systems Consortium, Inc. ("ISC")
2 //
3 // This Source Code Form is subject to the terms of the End User License
4 // Agreement. See COPYING file in the premium/ directory.
5 
6 
7 // Functions accessed by the hooks framework use C linkage to avoid the name
8 // mangling that accompanies use of the C++ compiler as well as to avoid
9 // issues related to namespaces.
10 
11 #include <config.h>
12 
13 #include <stat_cmds.h>
14 #include <stat_cmds_log.h>
15 #include <cc/command_interpreter.h>
16 #include <hooks/hooks.h>
17 
18 using namespace isc::hooks;
19 using namespace isc::stat_cmds;
20 
21 extern "C" {
22 
30  StatCmds stat_cmds;
31  return(stat_cmds.statLease4GetHandler(handle));
32 }
33 
41  StatCmds stat_cmds;
42  return(stat_cmds.statLease6GetHandler(handle));
43 }
44 
49 int load(LibraryHandle& handle) {
50  handle.registerCommandCallout("stat-lease4-get", stat_lease4_get);
51  handle.registerCommandCallout("stat-lease6-get", stat_lease6_get);
52  LOG_INFO(stat_cmds_logger, STAT_CMDS_INIT_OK);
53  return (0);
54 }
55 
59 int unload() {
60  LOG_INFO(stat_cmds_logger, STAT_CMDS_DEINIT_OK);
61  return (0);
62 }
63 
64 } // end extern "C"
#define LOG_INFO(LOGGER, MESSAGE)
Macro to conveniently test info output and log it.
Definition: macros.h:20
void registerCommandCallout(const std::string &command_name, CalloutPtr callout)
Register control command handler.
Implements the logic for processing commands pertaining to stat manipulation.
Definition: stat_cmds.h:25
Per-packet callout handle.
int stat_lease4_get(CalloutHandle &handle)
This is a command callout for 'stat-lease4-get' command.
int load(LibraryHandle &handle)
This function is called when the library is loaded.
int statLease4GetHandler(hooks::CalloutHandle &handle)
stat-lease4-get command handler
Definition: stat_cmds.cc:665
int stat_lease6_get(CalloutHandle &handle)
This is a command callout for 'stat-lease6-get' command.
int statLease6GetHandler(hooks::CalloutHandle &handle)
stat-lease6-get command handler
Definition: stat_cmds.cc:671
This file contains several functions and constants that are used for handling commands and responses ...
int unload()
This function is called when the library is unloaded.
isc::log::Logger stat_cmds_logger("stat-cmds-hooks")
Definition: stat_cmds_log.h:17