[hydra-commits] hydra/team/ken.hunt/routing.git branch "master" updated.

Commits to the Hydra project code repositories hydra-commits at lists.digium.com
Thu Aug 12 09:53:13 CDT 2010


branch "master" has been updated
       via  43fe873e3297d30d60d5a025bcd6f1180934ff7e (commit)
      from  1bfea880c7a1bfd84a29d728ce7b6de6aa2330db (commit)

Summary of changes:
 src/BasicRoutingService.cpp          |   63 +++++++++++-
 src/CMakeLists.txt                   |   21 ++++-
 src/EndpointRegistry.cpp             |  180 +++++++++++++++++++++++++++++++++
 src/EndpointRegistry.h               |   41 ++++++++
 src/LuaScriptProcessor.cpp           |  185 ++++++++++++++++++++++++++++++++++
 src/LuaScriptProcessor.h             |   31 ++++++
 src/RoutingServiceEventPublisher.cpp |   98 ++++++++++++++++++
 src/RoutingServiceEventPublisher.h   |   41 ++++++++
 src/ScriptProcessor.h                |   24 +++++
 9 files changed, 680 insertions(+), 4 deletions(-)
 create mode 100644 src/EndpointRegistry.cpp
 create mode 100644 src/EndpointRegistry.h
 create mode 100644 src/LuaScriptProcessor.cpp
 create mode 100644 src/LuaScriptProcessor.h
 create mode 100644 src/RoutingAdmin.cpp
 create mode 100644 src/RoutingAdmin.h
 create mode 100644 src/RoutingServiceEventPublisher.cpp
 create mode 100644 src/RoutingServiceEventPublisher.h
 create mode 100644 src/ScriptProcessor.h


- Log -----------------------------------------------------------------
commit 43fe873e3297d30d60d5a025bcd6f1180934ff7e
Author: Ken Hunt <ken.hunt at digium.com>
Date:   Wed Aug 11 20:28:51 2010 -0500

    Roughed out implementation.

diff --git a/src/BasicRoutingService.cpp b/src/BasicRoutingService.cpp
index a708dd7..c34e19d 100644
--- a/src/BasicRoutingService.cpp
+++ b/src/BasicRoutingService.cpp
@@ -1,6 +1,65 @@
 #include <Ice/Ice.h>
-#include <IceBox/IceBox.h>
 #include <IceStorm/IceStorm.h>
 
-#include "RoutingI.h"
+#include <boost/thread.hpp>
+#include <boost/shared_ptr.hpp>
 
+#include "RoutingIf.h"
+#include "LuaScriptProcessor.h"
+#include "RoutingServiceEventPublisher.h"
+#include "EndpointRegistry.h"
+
+using namespace std;
+using namespace Hydra::BasicRoutingService;
+using namespace Hydra::Core::Routing::V1;
+
+class BasicRoutingServiceApp : public Ice::Application
+{
+public: 
+	BasicRoutingServiceApp() : mDone(false) {}
+
+   // Overrides
+   virtual int run(int, char*[]);
+	virtual void interruptCallback(int);
+
+private:
+   bool mDone;
+   std::string mAppName;
+   // EndpointRegistry mRegistry;
+};
+
+static BasicRoutingServiceApp app;
+int main(int argc, char* argv[])
+{
+	 app.callbackOnInterrupt();
+    return app.main(argc, argv);
+}
+
+void BasicRoutingServiceApp::interruptCallback(int val)
+{
+    cout << "Interrupted..." << endl;
+	 mDone = true;
+	 _exit(EXIT_SUCCESS);
+}
+
+/**
+ * Overload of the Ice::Application::run method. 
+ */
+int BasicRoutingServiceApp::run(int argc, char* argv[])
+{
+    mAppName = argv[0];
+	 Ice::ObjectAdapterPtr adapter = communicator()->createObjectAdapter("BasicRoutingServiceAdapter");
+
+    EndpointRegistry *registry(new EndpointRegistry());
+    boost::shared_ptr<ScriptProcessor> scriptProcesor(new LuaScriptProcessor());
+    registry->setScriptProcessor(scriptProcesor);
+
+    LocatorRegistryPtr locatorRegistry(registry);
+    adapter->add(locatorRegistry, communicator()->stringToIdentity("RoutingService"));
+
+    adapter->activate();
+
+    communicator()->waitForShutdown();
+
+    return EXIT_SUCCESS;
+}
\ No newline at end of file
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index c5e5dee..ac26c72 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -1,8 +1,25 @@
 # Create the actual standalone basic routing component
 hydra_component_init(BasicRoutingService CXX)
-hydra_component_add_slice(BasicRoutingService RoutingI)
+INCLUDE(FindLua51)
+get_filename_component(LUA_LOC ${LUA_LIBRARIES} PATH)
+LINK_DIRECTORIES(${LUA_LOC})
+include_directories(${LUA_INCLUDE_DIR})
+hydra_component_add_slice(BasicRoutingService RoutingIf)
 hydra_component_add_file(BasicRoutingService BasicRoutingService.cpp)
+hydra_component_add_file(BasicRoutingService RoutingAdmin.cpp)
+hydra_component_add_file(BasicRoutingService RoutingAdmin.h)
+hydra_component_add_file(BasicRoutingService EndpointRegistry.cpp)
+hydra_component_add_file(BasicRoutingService EndpointRegistry.h)
+hydra_component_add_file(BasicRoutingService ScriptProcessor.h)
+hydra_component_add_file(BasicRoutingService LuaScriptProcessor.cpp)
+hydra_component_add_file(BasicRoutingService LuaScriptProcessor.h)
+hydra_component_add_file(BasicRoutingService RoutingServiceEventPublisher.cpp)
+hydra_component_add_file(BasicRoutingService RoutingServiceEventPublisher.h)
+
 hydra_component_add_ice_libraries(BasicRoutingService IceStorm)
-hydra_component_add_boost_libraries(BasicRoutingService core thread)
+hydra_component_add_boost_libraries(BasicRoutingService thread core regex)
+
 hydra_component_build_standalone(BasicRoutingService)
+target_link_libraries(BasicRoutingService ${LUA_LIBRARIES})
+
 hydra_component_install(BasicRoutingService RUNTIME bin "Basic Routing Service" Core)
diff --git a/src/EndpointRegistry.cpp b/src/EndpointRegistry.cpp
new file mode 100644
index 0000000..69a2dc6
--- /dev/null
+++ b/src/EndpointRegistry.cpp
@@ -0,0 +1,180 @@
+#include <boost/regex.hpp> 
+
+#include "EndpointRegistry.h"
+#include "ScriptProcessor.h"
+
+using namespace ::Hydra::Core::Routing::V1;
+using namespace ::std;
+
+namespace Hydra
+{
+namespace BasicRoutingService
+{
+
+struct RegisteredLocator
+{
+public:
+   RegisteredLocator() {};
+   RegisteredLocator(EndpointLocatorPrx l, const RegExSeq &inputStringList) : locator(l)
+   {
+      setRegEx(inputStringList);
+   }
+
+   void setRegEx(const RegExSeq &inputStringList)
+   {
+      regexList.clear();
+
+      // Store the string representations as regular expressions.
+      vector<string>::const_iterator s;
+      for(s=inputStringList.begin(); s != inputStringList.end(); s++)
+      {
+         boost::regex reg;
+         reg.assign(*s);
+         regexList.push_back(reg);
+      }
+   }
+
+   EndpointLocatorPrx locator;
+   vector<boost::regex> regexList;
+};
+
+/**
+ * Provides the private implementation of the EndpointRegistry. 
+ */
+class EndpointRegistryPriv
+{
+public:
+   map<std::string, RegisteredLocator> mEndpointLocatorMap;
+   boost::shared_ptr<ScriptProcessor> mScriptProcessor;
+};
+typedef map<std::string, RegisteredLocator>::iterator EndpointLocatorMapIterator;
+
+/**
+ * Constructor.
+ */
+EndpointRegistry::EndpointRegistry() : mImpl(new EndpointRegistryPriv())
+{
+}
+
+/**
+ * Register an EndpointLocator that can provide endpoints.
+ *   @param id A unique identifier for the added EndpointLocator. 
+ *   @param destinationIdRangeList A set of regular expressions that define the valid endpoint ids 
+ *     the locator being added supports. 
+ */
+void EndpointRegistry::addEndpointLocator(const ::std::string& locatorId, 
+                                          const RegExSeq& regexList, 
+                                          const EndpointLocatorPrx& locator, 
+                                          const ::Ice::Current&)
+{
+   try
+   {
+      EndpointLocatorMapIterator existing = mImpl->mEndpointLocatorMap.find(locatorId);
+      if (existing != mImpl->mEndpointLocatorMap.end())
+      {
+          throw LocatorAlreadyRegisteredException(locatorId);
+      }
+
+      RegisteredLocator newLocator(locator, regexList);
+
+      mImpl->mEndpointLocatorMap[locatorId] = newLocator;
+   }
+   catch (...)
+   {
+      // TBD... Logging! 
+      cout << "Exception adding EndpointLocator." << endl;
+      return;
+   }
+}
+
+/**
+ * Remove an EndpointLocator.
+ *   @param The unique id of the locator to remove. 
+ */
+void EndpointRegistry::removeEndpointLocator(const ::std::string& locatorId, const ::Ice::Current&)
+{
+   try
+   {
+      mImpl->mEndpointLocatorMap.erase(locatorId);
+   }
+   catch(const std::exception &e)
+   {
+      // TBD... Logging! 
+      cout << e.what() << endl;
+   }
+}
+
+/**
+ * Modify the range of device ids managed by a previously added EndpointLocator. 
+ *   @param id A unique identifier for the added EndpointLocator. 
+ *   @param A list of reqular expressions that define the the valid endpoint ids. This 
+ *     set of regular expressions completely replaces the current set. 
+ */
+void EndpointRegistry::setEndpointLocatorDestinationIds(const ::std::string& locatorId, 
+                                                        const ::Hydra::Core::Routing::V1::RegExSeq& regExList, 
+                                                        const ::Ice::Current&)
+{
+   try
+   {
+       EndpointLocatorMapIterator existing = mImpl->mEndpointLocatorMap.find(locatorId);
+       if (existing == mImpl->mEndpointLocatorMap.end())
+       {
+           throw DestinationNotFoundException(locatorId);
+       }
+
+       // Replace the regular expression. 
+       existing->second.setRegEx(regExList);
+   }
+   catch(const std::exception &e)
+   {
+      // TBD... Logging! 
+      cout << "Exception modifying the destination specifications for EndpointLocator " << locatorId << endl;
+      cout << "   - " << e.what() << endl;
+   }
+
+}
+
+/**
+ * Returns the endpoints that match the specified destination id. 
+ *   @param id String identifier of the the destination. 
+ */
+::Hydra::Core::Endpoint::V1::EndpointSeq EndpointRegistry::lookup(const ::std::string& destination, const ::Ice::Current&)
+{
+   ::Hydra::Core::Endpoint::V1::EndpointSeq endpoints;
+
+   string modifiedDestination;
+   if (!mImpl->mScriptProcessor->confirmLookup(destination, modifiedDestination))
+   {
+      // TBD.. logging
+      cout << "lookup(): denied by confirmLookup() script." << endl;
+      return endpoints;
+   }
+
+   EndpointLocatorMapIterator entry;
+   for(entry = mImpl->mEndpointLocatorMap.begin(); entry != mImpl->mEndpointLocatorMap.end(); entry++)
+   {
+      // Test to see if the destination matches any of this entry's regular expressions. 
+      vector<boost::regex>::iterator reg;
+      for(reg=entry->second.regexList.begin(); reg != entry->second.regexList.end(); reg++)
+      {
+         if (boost::regex_match(destination, *reg))
+         {
+            endpoints = entry->second.locator->lookup(destination);
+            break;
+         }
+      }
+   }
+
+   return endpoints;
+}
+
+/**
+ * Configure this object with a ScriptProcessor. 
+ */
+void EndpointRegistry::setScriptProcessor(boost::shared_ptr<ScriptProcessor> scriptProcessor)
+{ 
+   mImpl->mScriptProcessor = scriptProcessor;
+}
+
+}; // end BasicRoutingService
+}; // end Hydra
\ No newline at end of file
diff --git a/src/EndpointRegistry.h b/src/EndpointRegistry.h
new file mode 100644
index 0000000..fd5f93f
--- /dev/null
+++ b/src/EndpointRegistry.h
@@ -0,0 +1,41 @@
+#pragma once
+
+#include <boost/shared_ptr.hpp>
+
+#include "RoutingIf.h"
+
+namespace Hydra
+{
+namespace BasicRoutingService
+{
+
+class EndpointRegistryPriv;
+class ScriptProcessor;
+
+class EndpointRegistry : public Hydra::Core::Routing::V1::LocatorRegistry
+{
+public:
+   EndpointRegistry();
+
+   void EndpointRegistry::setScriptProcessor(boost::shared_ptr<ScriptProcessor> scriptProcessor);
+
+   // LocatorRegistry overrides
+   virtual void addEndpointLocator(const ::std::string& locatorId, 
+                                   const ::Hydra::Core::Routing::V1::RegExSeq& regexList, 
+                                   const ::Hydra::Core::Routing::V1::EndpointLocatorPrx& locator, 
+                                   const ::Ice::Current& = ::Ice::Current());
+   virtual void removeEndpointLocator(const ::std::string& locatorId, const ::Ice::Current& = ::Ice::Current());
+   virtual void setEndpointLocatorDestinationIds(const ::std::string& locatorId, 
+                                                 const ::Hydra::Core::Routing::V1::RegExSeq& regexList, 
+                                                 const ::Ice::Current& = ::Ice::Current());
+   
+   // EndpointLocator overrides
+   virtual ::Hydra::Core::Endpoint::V1::EndpointSeq lookup(const ::std::string& , const ::Ice::Current& = ::Ice::Current());
+
+
+private:
+   boost::shared_ptr<EndpointRegistryPriv> mImpl;
+};
+
+}; // end BasicRoutingService
+}; // end Hydra
\ No newline at end of file
diff --git a/src/LuaScriptProcessor.cpp b/src/LuaScriptProcessor.cpp
new file mode 100644
index 0000000..c920f3d
--- /dev/null
+++ b/src/LuaScriptProcessor.cpp
@@ -0,0 +1,185 @@
+#include "lua.hpp"
+
+#include <boost/thread/locks.hpp>
+#include <boost/thread/shared_mutex.hpp>
+
+#include "LuaScriptProcessor.h"
+
+using namespace ::Hydra::Core::Endpoint::V1;
+using namespace ::std;
+
+namespace Hydra
+{
+namespace BasicRoutingService
+{
+
+struct RawEndpointId
+{
+public:
+   string endpointId;
+   string managerId;
+};
+
+typedef std::vector<RawEndpointId> RawEndpointVector;
+
+/**
+ * Provides the private implementation of the LuaScriptProcessor. 
+ */
+class LuaScriptProcessorPriv
+{
+public:
+   LuaScriptProcessorPriv()
+   {
+   }
+
+   ~LuaScriptProcessorPriv() 
+   {
+       boost::shared_lock<boost::shared_mutex> lock(mLock);
+
+      lua_close(mLuaState);
+   }
+
+   void initialize()
+   {
+      boost::shared_lock<boost::shared_mutex> lock(mLock);
+
+      mLuaState = lua_open();
+      luaL_openlibs(mLuaState);
+
+      // Load script
+      if (luaL_dofile(mLuaState, "routing.lua"))
+      {
+         cout << lua_tostring(mLuaState, -1) << std::endl;
+         return ;
+      }
+   }
+
+   void setPolicy(const string& policy)
+   {
+      mCurrentPolicy = policy;
+      
+      // Call the lua script.
+      // Set function name.
+	   lua_getglobal(mLuaState, "setPolicy");
+
+      // Push input arg
+      lua_pushstring(mLuaState, policy.c_str());
+
+      // Call function. One arg, no return results...
+      lua_call(mLuaState, 1, 0);
+   }
+
+   RawEndpointVector lookup(const string& destination)
+   {
+      RawEndpointVector endpoints;
+
+      try
+      {
+         // Call the lua script.
+         // Set function name.
+	      lua_getglobal(mLuaState, "lookup");
+
+         // Push input arg
+	      lua_pushstring(mLuaState, destination.c_str());
+
+         // Call function. One arg, multiple results...
+         lua_call(mLuaState, 1, LUA_MULTRET);
+
+         int numEndpoints = (int)lua_tonumber(mLuaState, -1);
+	      lua_pop(mLuaState, 1);
+
+         if (numEndpoints == 0)
+         {
+            return endpoints;
+         }
+
+         for (int i=0; i < numEndpoints; i++)
+         {
+            RawEndpointId rawEndpoint;
+
+            rawEndpoint.endpointId =lua_tostring(mLuaState, -1);
+	         lua_pop(mLuaState, 1);
+
+            rawEndpoint.managerId = lua_tostring(mLuaState, -1);
+	         lua_pop(mLuaState, 1);
+
+            endpoints.push_back(rawEndpoint);
+         }
+      }
+      catch (...)
+      {
+         // TBD... Most likely a script error of some type. 
+         cout << "Lua Script error in call to lookup()." << endl;
+      }
+   }
+
+   bool confirmLookup(const string& destination, string &modifiedDestination)
+   {
+      try
+      {
+         // Call the lua script.
+         // Set function name.
+	      lua_getglobal(mLuaState, "confirmLookup");
+
+         // Push input arg
+	      lua_pushstring(mLuaState, destination.c_str());
+
+         // Call function. One arg, 2 results...
+         lua_call(mLuaState, 1, 1);
+
+         int allow = (int)lua_toboolean(mLuaState, -1);
+	      lua_pop(mLuaState, 1);
+
+         if (allow == 0)
+         {
+            return false;
+         }
+
+         modifiedDestination = lua_tostring(mLuaState, -1);
+	      lua_pop(mLuaState, 1);
+      }
+      catch (...)
+      {
+         // TBD... Most likely a script error of some type. 
+         cout << "Lua Script error in call to confirmLookup()." << endl;
+      }
+      return true;
+   }
+private:
+   string mCurrentPolicy;
+   // boost::shared_ptr<lua_State> mLuaState;
+   lua_State *mLuaState;
+	boost::shared_mutex mLock;
+};
+
+/**
+ * Constructor.
+ */
+LuaScriptProcessor::LuaScriptProcessor() : mImpl(new LuaScriptProcessorPriv())
+{
+}
+
+/**
+ * Check with the script confirmLookup method to see if a lookup should be allowed. 
+ * Also allows the script to alter the destination.
+ * @param destination The destination to be looked up. 
+ * @param modifiedDestination The destination as modified by the script.
+ * @return true if the lookup is allowed. 
+ */
+bool LuaScriptProcessor::confirmLookup(const ::std::string& destination, ::std::string& modifiedDestination)
+{
+   return mImpl->confirmLookup(destination, modifiedDestination);
+}
+
+/**
+ * Sets a policy for the script. The default script implementation is a no-op. 
+ * This allows for site-specific policy implementations. 
+ * @param policy New value for the policy setting. 
+ */
+void LuaScriptProcessor::setPolicy(const string& policy)
+{
+   mImpl->setPolicy(policy);
+}
+
+}; // end BasicRoutingService
+}; // end Hydra
\ No newline at end of file
diff --git a/src/LuaScriptProcessor.h b/src/LuaScriptProcessor.h
new file mode 100644
index 0000000..4afc062
--- /dev/null
+++ b/src/LuaScriptProcessor.h
@@ -0,0 +1,31 @@
+#pragma once
+
+#include <boost/shared_ptr.hpp>
+
+#include "ScriptProcessor.h"
+#include "RoutingIf.h"
+
+namespace Hydra
+{
+namespace BasicRoutingService
+{
+class LuaScriptProcessorPriv;
+ 
+/**
+ * Wrapper for the Lua script processor. 
+ */
+class LuaScriptProcessor : public ScriptProcessor
+{
+public:
+   LuaScriptProcessor();
+
+   bool confirmLookup(const ::std::string& destination, ::std::string& modifiedDestination);
+   void setPolicy(const ::std::string& policy);
+
+private:
+   boost::shared_ptr<LuaScriptProcessorPriv> mImpl;
+
+};
+
+}; // BasicRoutingService
+}; // Hydra
\ No newline at end of file
diff --git a/src/RoutingAdmin.cpp b/src/RoutingAdmin.cpp
new file mode 100644
index 0000000..e69de29
diff --git a/src/RoutingAdmin.h b/src/RoutingAdmin.h
new file mode 100644
index 0000000..e69de29
diff --git a/src/RoutingServiceEventPublisher.cpp b/src/RoutingServiceEventPublisher.cpp
new file mode 100644
index 0000000..7888f1c
--- /dev/null
+++ b/src/RoutingServiceEventPublisher.cpp
@@ -0,0 +1,98 @@
+#include <Ice/Ice.h>
+#include <IceStorm/IceStorm.h>
+
+#include "RoutingServiceEventPublisher.h"
+
+using namespace ::std;
+using namespace ::Hydra::Core::Routing::V1;
+
+namespace Hydra
+{
+namespace BasicRoutingService
+{
+
+class RoutingServiceEventPublisherPriv
+{
+public:
+   RoutingServiceEventPublisherPriv(const Ice::CommunicatorPtr& communicator) : mCommunicator(communicator), mInitialized(false)
+   {
+   }
+
+   const Ice::CommunicatorPtr& mCommunicator;
+   Event::RoutingEventsPrx mEventTopic;
+   bool mInitialized;
+};
+
+RoutingServiceEventPublisher::RoutingServiceEventPublisher(const Ice::CommunicatorPtr& communicator) 
+                                      : mImpl(new RoutingServiceEventPublisherPriv(communicator))
+{
+}
+
+void RoutingServiceEventPublisher::initialize()
+{
+    IceStorm::TopicManagerPrx topicManager = 
+       IceStorm::TopicManagerPrx::checkedCast(mImpl->mCommunicator->propertyToProxy("TopicManager.Proxy"));
+
+    if(!topicManager)
+    {
+        cerr <<  "Invalid proxy to IceStorm. Missing config for TopicManager.Proxy?" << endl;
+    }
+
+    cout << "RoutingServiceEventPublisher::initialize(): Got IceStorm proxy: TopicManager.Proxy" << endl;
+
+    IceStorm::TopicPrx topic;
+    try
+    {  
+        topic = topicManager->retrieve(Event::TopicId);
+    }
+    catch(const IceStorm::NoSuchTopic&)
+    {
+        try
+        {
+            topic = topicManager->create(Event::TopicId);
+        }
+        catch(const IceStorm::TopicExists&)
+        {
+           cerr << "Possible race condition creating IceStorm topic " << Event::TopicId << ". Suggest Restart!" << endl;
+        }
+    }
+
+    Ice::ObjectPrx publisher = topic->getPublisher();
+    mImpl->mEventTopic = Event::RoutingEventsPrx::uncheckedCast(publisher);
+    
+    mImpl->mInitialized = true;
+}
+
+void RoutingServiceEventPublisher::lookupEvent(const ::std::string&, 
+                                               ::Hydra::Core::Routing::V1::Event::OperationResult)
+{
+}
+
+void RoutingServiceEventPublisher::addEndpointLocatorEvent(const ::std::string&, 
+                                                           const ::Hydra::Core::Routing::V1::RegExSeq&, 
+                                                           ::Hydra::Core::Routing::V1::Event::OperationResult)
+{
+}
+
+void RoutingServiceEventPublisher::removeEndpointLocatorEvent(const ::std::string&, 
+                                                              ::Hydra::Core::Routing::V1::Event::OperationResult)
+{
+}
+
+void RoutingServiceEventPublisher::setEndpointLocatorDestinationIdsEvent(const ::std::string&, 
+                                                               const ::Hydra::Core::Routing::V1::RegExSeq&, 
+                                                               ::Hydra::Core::Routing::V1::Event::OperationResult)
+{
+}
+
+void RoutingServiceEventPublisher::clearEndpointLocatorsEvent()
+{
+}
+
+void RoutingServiceEventPublisher::setPolicyEvent(const ::std::string& policy)
+{
+}
+
+
+}; // end BasicRoutingService
+}; // end Hydra
\ No newline at end of file
diff --git a/src/RoutingServiceEventPublisher.h b/src/RoutingServiceEventPublisher.h
new file mode 100644
index 0000000..55921a6
--- /dev/null
+++ b/src/RoutingServiceEventPublisher.h
@@ -0,0 +1,41 @@
+#pragma once
+
+#include <boost/shared_ptr.hpp>
+
+#include "RoutingIf.h"
+
+namespace Hydra
+{
+namespace BasicRoutingService
+{
+class RoutingServiceEventPublisherPriv;
+
+/**
+ * 
+ */
+class RoutingServiceEventPublisher 
+{
+public:
+   RoutingServiceEventPublisher(const Ice::CommunicatorPtr&); 
+
+   // RoutingEvents Overrides
+   virtual void lookupEvent(const ::std::string&, 
+                            ::Hydra::Core::Routing::V1::Event::OperationResult);
+   virtual void addEndpointLocatorEvent(const ::std::string&, 
+                                        const ::Hydra::Core::Routing::V1::RegExSeq&, 
+                                        ::Hydra::Core::Routing::V1::Event::OperationResult);
+   virtual void removeEndpointLocatorEvent(const ::std::string&, 
+                                           ::Hydra::Core::Routing::V1::Event::OperationResult);
+   virtual void setEndpointLocatorDestinationIdsEvent(const ::std::string&, 
+                                            const ::Hydra::Core::Routing::V1::RegExSeq&, 
+                                            ::Hydra::Core::Routing::V1::Event::OperationResult);
+   virtual void clearEndpointLocatorsEvent();
+   virtual void setPolicyEvent(const ::std::string&);
+
+private:
+   void initialize();
+   boost::shared_ptr<RoutingServiceEventPublisherPriv> mImpl;
+};
+
+}; // end BasicRoutingService
+}; // end Hydra
diff --git a/src/ScriptProcessor.h b/src/ScriptProcessor.h
new file mode 100644
index 0000000..7c5829b
--- /dev/null
+++ b/src/ScriptProcessor.h
@@ -0,0 +1,24 @@
+#pragma once
+
+#include "RoutingIf.h"
+
+namespace Hydra
+{
+namespace BasicRoutingService
+{
+/**
+ * Interface for all script processors. 
+ */
+class ScriptProcessor
+{
+protected: // Abstract interface. Can't be instantiated.
+   ScriptProcessor() {};
+
+public:
+   virtual bool confirmLookup(const ::std::string& destination, ::std::string& modifiedDestination) = 0;
+   virtual void setPolicy(const ::std::string& policy) = 0;
+
+};
+
+}; // BasicRoutingService
+}; // Hydra
\ No newline at end of file

-----------------------------------------------------------------------


-- 
hydra/team/ken.hunt/routing.git




More information about the asterisk-scf-commits mailing list