7 #ifndef CALLOUT_MANAGER_H 8 #define CALLOUT_MANAGER_H 14 #include <boost/shared_ptr.hpp> 142 typedef std::pair<int, CalloutPtr> CalloutEntry;
146 typedef std::vector<CalloutEntry> CalloutVector;
274 return (current_hook_);
284 return (num_libraries_);
300 return (current_library_);
318 checkLibraryIndex(library_index);
319 current_library_ = library_index;
345 return (library_handle_);
355 return (pre_library_handle_);
365 return (post_library_handle_);
372 return (hook_vector_.size());
396 void ensureHookLibsVectorSize();
408 void checkLibraryIndex(
int library_index)
const;
420 class CalloutLibraryEqual :
421 public std::binary_function<CalloutEntry, CalloutEntry, bool> {
423 bool operator()(
const CalloutEntry& ent1,
424 const CalloutEntry& ent2)
const {
425 return (ent1.first == ent2.first);
434 ServerHooks& server_hooks_;
444 int current_library_;
449 std::vector<CalloutVector> hook_vector_;
455 LibraryHandle library_handle_;
459 LibraryHandle pre_library_handle_;
463 LibraryHandle post_library_handle_;
472 #endif // CALLOUT_MANAGER_H int(* CalloutPtr)(CalloutHandle &)
Typedef for a callout pointer. (Callouts must have "C" linkage.)
void registerCommandHook(const std::string &command_name)
Registers a hook point for the specified command name.
void callCallouts(int hook_index, CalloutHandle &callout_handle)
Calls the callouts for a given hook.
void registerCallout(const std::string &name, CalloutPtr callout)
Register a callout on a hook for the current library.
bool commandHandlersPresent(const std::string &command_name) const
Checks if control command handlers are present for the specified command.
LibraryHandle & getPreLibraryHandle()
Return pre-user callouts library handle.
int getHookIndex() const
Get current hook index.
virtual const char * what() const
Returns a C-style character string of the cause of the exception.
LibraryHandle & getPostLibraryHandle()
Return post-user callouts library handle.
bool deregisterCallout(const std::string &name, CalloutPtr callout)
De-Register a callout on a hook for the current library.
Per-packet callout handle.
bool calloutsPresent(int hook_index) const
Checks if callouts are present on a hook.
int getLibraryIndex() const
Get current library index.
bool deregisterAllCallouts(const std::string &name)
Removes all callouts on a hook for the current library.
void setLibraryIndex(int library_index)
Set current library index.
This is a base class for exceptions thrown from the DNS library module.
Defines the logger used by the top-level component of kea-dhcp-ddns.
size_t getHookLibsVectorSize() const
Return number of currently available hooks.
int getNumLibraries() const
Get number of libraries.
LibraryHandle & getLibraryHandle()
Return library handle.
NoSuchLibrary(const char *file, size_t line, const char *what)
CalloutManager(int num_libraries=0)
Constructor.
void callCommandHandlers(const std::string &command_name, CalloutHandle &callout_handle)
Calls the callouts/command handlers for a given command name.