 |
Kea
1.5.0
|
Go to the documentation of this file.
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
void deleteAllContext()
Delete all context items.
Wrapper class around callout handle which automatically resets handle's state.
@ NEXT_STEP_SKIP
skip the next processing step
void setArgument(const std::string &name, T value)
Set argument.
ScopedCalloutHandleState(const CalloutHandlePtr &callout_handle)
Constructor.
CalloutHandle(const boost::shared_ptr< CalloutManager > &manager, const boost::shared_ptr< LibraryManagerCollection > &lmcoll=boost::shared_ptr< LibraryManagerCollection >())
Constructor.
void getContext(const std::string &name, T &value) const
Get context.
Per-packet callout handle.
NoSuchArgument(const char *file, size_t line, const char *what)
boost::shared_ptr< CalloutHandle > CalloutHandlePtr
A shared pointer to a CalloutHandle object.
void deleteArgument(const std::string &name)
Delete argument.
std::map< std::string, boost::any > ElementCollection
Typedef to allow abbreviation of iterator specification in methods.
This is a base class for exceptions thrown from the DNS library module.
void setContext(const std::string &name, T value)
Set context.
boost::shared_ptr< ParkingLotHandle > ParkingLotHandlePtr
Pointer to the parking lot handle.
Defines the logger used by the top-level component of kea-dhcp-ddns.
virtual const char * what() const
Returns a C-style character string of the cause of the exception.
void getArgument(const std::string &name, T &value) const
Get argument.
#define isc_throw(type, stream)
A shortcut macro to insert known values into exception arguments.
No such callout context item.
CalloutNextStep getStatus() const
Returns the next processing step.
NoSuchCalloutContext(const char *file, size_t line, const char *what)
CalloutNextStep
Specifies allowed next steps.
std::string getHookName() const
Get hook name.
~ScopedCalloutHandleState()
Destructor.
void deleteAllArguments()
Delete all arguments.
std::vector< std::string > getContextNames() const
Get context names.
ParkingLotHandlePtr getParkingLotHandlePtr() const
Returns pointer to the parking lot handle for this hook point.
LibraryHandle & getLibraryHandle() const
Access current library handle.
void setStatus(const CalloutNextStep next)
Sets the next processing step.
std::map< int, ElementCollection > ContextCollection
Typedef to allow abbreviations in specifications when accessing context.
void deleteContext(const std::string &name)
Delete context element.
@ NEXT_STEP_CONTINUE
continue normally
~CalloutHandle()
Destructor.
@ NEXT_STEP_PARK
park the packet
std::vector< std::string > getArgumentNames() const
Get argument names.
@ NEXT_STEP_DROP
drop the packet