7 #ifndef CALLOUT_HANDLE_H 8 #define CALLOUT_HANDLE_H 14 #include <boost/any.hpp> 15 #include <boost/shared_ptr.hpp> 52 class LibraryManagerCollection;
135 CalloutHandle(
const boost::shared_ptr<CalloutManager>& manager,
136 const boost::shared_ptr<LibraryManagerCollection>& lmcoll =
137 boost::shared_ptr<LibraryManagerCollection>());
152 template <
typename T>
154 arguments_[name] = value;
169 template <
typename T>
171 ElementCollection::const_iterator element_ptr = arguments_.find(name);
172 if (element_ptr == arguments_.end()) {
177 value = boost::any_cast<T>(element_ptr->second);
198 static_cast<void>(arguments_.erase(name));
273 template <
typename T>
275 getContextForLibrary()[name] = value;
291 template <
typename T>
295 ElementCollection::const_iterator element_ptr = lib_context.find(name);
296 if (element_ptr == lib_context.end()) {
298 "item " << name <<
" in the context associated with " 302 value = boost::any_cast<T>(element_ptr->second);
325 static_cast<void>(getContextForLibrary().erase(name));
335 getContextForLibrary().clear();
363 int getLibraryIndex()
const;
395 boost::shared_ptr<LibraryManagerCollection> lm_collection_;
404 boost::shared_ptr<CalloutManager> manager_;
488 #endif // CALLOUT_HANDLE_H LibraryHandle & getLibraryHandle() const
Access current library handle.
void setStatus(const CalloutNextStep next)
Sets the next processing step.
ParkingLotHandlePtr getParkingLotHandlePtr() const
Returns pointer to the parking lot handle for this hook point.
std::vector< std::string > getArgumentNames() const
Get argument names.
CalloutNextStep getStatus() const
Returns the next processing step.
~ScopedCalloutHandleState()
Destructor.
void getContext(const std::string &name, T &value) const
Get context.
virtual const char * what() const
Returns a C-style character string of the cause of the exception.
ScopedCalloutHandleState(const CalloutHandlePtr &callout_handle)
Constructor.
#define isc_throw(type, stream)
A shortcut macro to insert known values into exception arguments.
std::string getHookName() const
Get hook name.
Per-packet callout handle.
NoSuchCalloutContext(const char *file, size_t line, const char *what)
~CalloutHandle()
Destructor.
Wrapper class around callout handle which automatically resets handle's state.
CalloutNextStep
Specifies allowed next steps.
void setArgument(const std::string &name, T value)
Set argument.
std::map< std::string, boost::any > ElementCollection
Typedef to allow abbreviation of iterator specification in methods.
void deleteContext(const std::string &name)
Delete context element.
void deleteAllContext()
Delete all context items.
std::map< int, ElementCollection > ContextCollection
Typedef to allow abbreviations in specifications when accessing context.
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.
CalloutHandle(const boost::shared_ptr< CalloutManager > &manager, const boost::shared_ptr< LibraryManagerCollection > &lmcoll=boost::shared_ptr< LibraryManagerCollection >())
Constructor.
void getArgument(const std::string &name, T &value) const
Get argument.
boost::shared_ptr< CalloutHandle > CalloutHandlePtr
A shared pointer to a CalloutHandle object.
std::vector< std::string > getContextNames() const
Get context names.
void setContext(const std::string &name, T value)
Set context.
void deleteArgument(const std::string &name)
Delete argument.
No such callout context item.
boost::shared_ptr< ParkingLotHandle > ParkingLotHandlePtr
Pointer to the parking lot handle.
NoSuchArgument(const char *file, size_t line, const char *what)
skip the next processing step
void deleteAllArguments()
Delete all arguments.