24 CalloutHandle::CalloutHandle(
const boost::shared_ptr<CalloutManager>& manager,
25 const boost::shared_ptr<LibraryManagerCollection>& lmcoll)
26 : lm_collection_(lmcoll), arguments_(), context_collection_(),
27 manager_(manager), server_hooks_(
ServerHooks::getServerHooks()),
28 next_step_(NEXT_STEP_CONTINUE) {
47 context_collection_.clear();
69 for (ElementCollection::const_iterator i = arguments_.begin();
70 i != arguments_.end(); ++i) {
71 names.push_back(i->first);
79 return (boost::make_shared<ParkingLotHandle>(server_hooks_.
getParkingLotPtr(manager_->getHookIndex())));
87 return (manager_->getLibraryHandle());
95 CalloutHandle::getContextForLibrary() {
96 int libindex = manager_->getLibraryIndex();
100 return (context_collection_[libindex]);
107 CalloutHandle::getContextForLibrary()
const {
108 int libindex = manager_->getLibraryIndex();
110 ContextCollection::const_iterator libcontext =
111 context_collection_.find(libindex);
112 if (libcontext == context_collection_.end()) {
113 isc_throw(NoSuchCalloutContext,
"unable to find callout context " 114 "associated with the current library index (" << libindex <<
119 return (libcontext->second);
128 vector<string> names;
131 for (ElementCollection::const_iterator i = elements.begin();
132 i != elements.end(); ++i) {
133 names.push_back(i->first);
146 int index = manager_->getHookIndex();
151 hook = server_hooks_.
getName(index);
163 : callout_handle_(callout_handle) {
164 if (!callout_handle_) {
176 ScopedCalloutHandleState::resetState() {
179 callout_handle_->deleteAllArguments();
LibraryHandle & getLibraryHandle() const
Access current library handle.
static const int CONTEXT_CREATE
Index numbers for pre-defined hooks.
ParkingLotHandlePtr getParkingLotHandlePtr() const
Returns pointer to the parking lot handle for this hook point.
ParkingLotPtr getParkingLotPtr(const int hook_index)
Returns pointer to the ParkingLot for the specified hook index.
std::vector< std::string > getArgumentNames() const
Get argument names.
~ScopedCalloutHandleState()
Destructor.
std::string getName(int index) const
Get hook name.
ScopedCalloutHandleState(const CalloutHandlePtr &callout_handle)
Constructor.
#define isc_throw(type, stream)
A shortcut macro to insert known values into exception arguments.
A generic exception that is thrown if a parameter given to a method is considered invalid in that con...
std::string getHookName() const
Get hook name.
~CalloutHandle()
Destructor.
std::map< std::string, boost::any > ElementCollection
Typedef to allow abbreviation of iterator specification in methods.
static const int CONTEXT_DESTROY
Defines the logger used by the top-level component of kea-dhcp-ddns.
boost::shared_ptr< CalloutHandle > CalloutHandlePtr
A shared pointer to a CalloutHandle object.
std::vector< std::string > getContextNames() const
Get context names.
boost::shared_ptr< ParkingLotHandle > ParkingLotHandlePtr
Pointer to the parking lot handle.