[cpp-sp] branch main updated: Begin transition to new RemotingService.

Scott Cantor cantor.2 at osu.edu
Tue Dec 31 15:02:59 UTC 2024


This is an automated email from the git hooks/post-receive script.

scantor pushed a commit to branch main
in repository cpp-sp.

View the commit online:
http://git.shibboleth.net/view/?p=cpp-sp.git;a=commit;h=d94e06a7d59230a6fa0216c436bf4815ac39aac6

The following commit(s) were added to refs/heads/main by this push:
     new d94e06a7 Begin transition to new RemotingService.
d94e06a7 is described below

commit d94e06a7d59230a6fa0216c436bf4815ac39aac6
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Tue Dec 31 10:02:41 2024 -0500

    Begin transition to new RemotingService.
---
 shibsp/Agent.h                               |  10 +-
 shibsp/AgentConfig.h                         |  12 ++
 shibsp/Application.cpp                       |   4 +-
 shibsp/Makefile.am                           |   7 +-
 shibsp/SPConfig.cpp                          |   7 -
 shibsp/SPConfig.h                            |   5 -
 shibsp/ServiceProvider.h                     |   8 --
 shibsp/handler/RemotedHandler.h              |   4 +-
 shibsp/handler/impl/AbstractHandler.cpp      |  15 +--
 shibsp/handler/impl/LogoutHandler.cpp        |   2 +-
 shibsp/handler/impl/RemotedHandler.cpp       |   8 +-
 shibsp/impl/AgentConfig.cpp                  |  18 +--
 shibsp/impl/DefaultAgent.cpp                 | 124 ++++++-----------
 shibsp/impl/StorageServiceSessionCache.cpp   |  24 +---
 shibsp/impl/StorageServiceSessionCache.h     |   3 +-
 shibsp/impl/StoredSession.cpp                |   2 +-
 shibsp/impl/XMLAccessControl.cpp             |   2 +-
 shibsp/impl/XMLApplication.cpp               |  23 ----
 shibsp/impl/XMLApplication.h                 |   5 +-
 shibsp/impl/XMLServiceProvider.cpp           |  32 -----
 shibsp/impl/XMLServiceProvider.h             |  10 --
 shibsp/logging/impl/SyslogLoggingService.cpp |   7 +-
 shibsp/remoting/ListenerService.h            | 190 ---------------------------
 shibsp/remoting/RemotingService.h            |  60 +++++++++
 shibsp/remoting/impl/ListenerService.cpp     | 173 ------------------------
 shibsp/remoting/impl/RemotingService.cpp     |  44 +++++++
 shibsp/util/ReloadableXMLFile.cpp            |  13 +-
 shibsp/util/ReloadableXMLFile.h              |   2 +-
 tests/data/console-shibboleth.ini            |   2 +-
 tests/util/ReloadableXMLFileTests.cpp        |   4 +-
 30 files changed, 206 insertions(+), 614 deletions(-)

diff --git a/shibsp/Agent.h b/shibsp/Agent.h
index 5bc2fac3..408499cd 100644
--- a/shibsp/Agent.h
+++ b/shibsp/Agent.h
@@ -29,7 +29,7 @@ namespace shibsp {
 
     class SHIBSP_API Application;
     class SHIBSP_API Handler;
-    class SHIBSP_API ListenerService;
+    class SHIBSP_API RemotingService;
     class SHIBSP_API RequestMapper;
     class SHIBSP_API SessionCache;
     class SHIBSP_API AgentRequest;
@@ -71,12 +71,12 @@ namespace shibsp {
         virtual SessionCache* getSessionCache(bool required=true) const=0;
 
         /**
-         * Returns a ListenerService instance.
+         * Returns a RemotingService instance.
          * 
-         * @param required  true iff an exception should be thrown if no ListenerService is available
-         * @return  a ListenerService
+         * @param required  true iff an exception should be thrown if no RemotingService is available
+         * @return  a RemotingService
          */
-        virtual ListenerService* getListenerService(bool required=true) const=0;
+        virtual RemotingService* getRemotingService(bool required=true) const=0;
         
         /**
          * Returns a RequestMapper instance.
diff --git a/shibsp/AgentConfig.h b/shibsp/AgentConfig.h
index 3aec1672..1dd22de3 100644
--- a/shibsp/AgentConfig.h
+++ b/shibsp/AgentConfig.h
@@ -33,7 +33,9 @@ namespace shibsp {
     class SHIBSP_API Category;
     class SHIBSP_API LoggingService;
     class SHIBSP_API PathResolver;
+    class SHIBSP_API RemotingService;
     class SHIBSP_API RequestMapper;
+    class SHIBSP_API SessionCache;
     class SHIBSP_API URLEncoder;
 
 #if defined (_MSC_VER)
@@ -93,11 +95,21 @@ namespace shibsp {
          */
         PluginManager<LoggingService,std::string,boost::property_tree::ptree&> LoggingServiceManager;
 
+        /**
+         * Manages factories for RemotingService plugins.
+         */
+        PluginManager<RemotingService,std::string,boost::property_tree::ptree&> RemotingServiceManager;
+
         /**
          * Manages factories for RequestMapper plugins.
          */
         PluginManager<RequestMapper,std::string,boost::property_tree::ptree&> RequestMapperManager;
 
+        /**
+         * Manages factories for SessionCache plugins.
+         */
+        PluginManager<SessionCache,std::string,boost::property_tree::ptree&> SessionCacheManager;
+
         /**
          * Returns a PathResolver instance.
          * 
diff --git a/shibsp/Application.cpp b/shibsp/Application.cpp
index d7bca168..88abdee0 100644
--- a/shibsp/Application.cpp
+++ b/shibsp/Application.cpp
@@ -29,7 +29,7 @@
 #include "SPRequest.h"
 #include "ServiceProvider.h"
 #include "attribute/Attribute.h"
-#include "remoting/ListenerService.h"
+#include "remoting/RemotingService.h"
 
 #include <algorithm>
 #define BOOST_BIND_GLOBAL_PLACEHOLDERS
@@ -149,7 +149,7 @@ void Application::clearAttributeHeaders(SPRequest& request) const
             string addr=string(getId()) + "::getHeaders::Application";
             DDF out,in = DDF(addr.c_str());
             DDFJanitor jin(in),jout(out);
-            out = getServiceProvider().getListenerService()->send(in);
+            //out = getServiceProvider().getListenerService()->send(in);
             if (out.islist()) {
                 DDF header = out.first();
                 while (header.name() && header.isstring()) {
diff --git a/shibsp/Makefile.am b/shibsp/Makefile.am
index 40864e73..6a2fdc0d 100644
--- a/shibsp/Makefile.am
+++ b/shibsp/Makefile.am
@@ -64,7 +64,7 @@ loginclude_HEADERS = \
 
 reminclude_HEADERS = \
 	remoting/ddf.h \
-	remoting/ListenerService.h
+	remoting/RemotingService.h
 	
 utilinclude_HEADERS = \
 	util/BoostPropertySet.h \
@@ -142,10 +142,7 @@ libshibsp_la_SOURCES = \
 	logging/impl/StringUtil.cpp \
 	logging/impl/SyslogLoggingService.cpp \
 	remoting/impl/ddf.cpp \
-	remoting/impl/ListenerService.cpp \
-	remoting/impl/SocketListener.cpp \
-	remoting/impl/TCPListener.cpp \
-	remoting/impl/UnixListener.cpp \
+	remoting/impl/RemotingService.cpp \
 	util/BoostPropertySet.cpp \
 	util/CGIParser.cpp \
 	util/DOMPropertySet.cpp \
diff --git a/shibsp/SPConfig.cpp b/shibsp/SPConfig.cpp
index 89d9c3e7..5840a036 100644
--- a/shibsp/SPConfig.cpp
+++ b/shibsp/SPConfig.cpp
@@ -36,7 +36,6 @@
 #include "attribute/Attribute.h"
 #include "handler/LogoutInitiator.h"
 #include "handler/SessionInitiator.h"
-#include "remoting/ListenerService.h"
 
 #include <ctime>
 #include <sstream>
@@ -157,9 +156,6 @@ bool SPConfig::init(const char* catalog_path, const char* inst_prefix)
 
     registerServiceProviders();
 
-    if (isEnabled(Listener))
-        registerListenerServices();
-
     if (isEnabled(RequestMapping)) {
         registerAccessControls();
         registerRequestMappers();
@@ -197,9 +193,6 @@ void SPConfig::term()
     ServiceProviderManager.deregisterFactories();
     Attribute::deregisterFactories();
 
-    if (isEnabled(Listener))
-        ListenerServiceManager.deregisterFactories();
-
     if (isEnabled(RequestMapping)) {
         AccessControlManager.deregisterFactories();
         RequestMapperManager.deregisterFactories();
diff --git a/shibsp/SPConfig.h b/shibsp/SPConfig.h
index 086b0209..7cb837a2 100644
--- a/shibsp/SPConfig.h
+++ b/shibsp/SPConfig.h
@@ -178,11 +178,6 @@ namespace shibsp {
          */
         PluginManager< Handler,std::string,std::pair<const xercesc::DOMElement*,const char*> > HandlerManager;
 
-        /**
-         * Manages factories for ListenerService plugins.
-         */
-        PluginManager<ListenerService,std::string,const xercesc::DOMElement*> ListenerServiceManager;
-
         /**
          * Manages factories for Handler plugins that implement LogoutInitiator functionality.
          */
diff --git a/shibsp/ServiceProvider.h b/shibsp/ServiceProvider.h
index 41d68d57..8c62cf76 100644
--- a/shibsp/ServiceProvider.h
+++ b/shibsp/ServiceProvider.h
@@ -77,14 +77,6 @@ namespace shibsp {
          * @return  a SessionCache
          */
         virtual SessionCache* getSessionCache(bool required=true) const=0;
-
-        /**
-         * Returns a ListenerService instance.
-         * 
-         * @param required  true iff an exception should be thrown if no ListenerService is available
-         * @return  a ListenerService
-         */
-        virtual ListenerService* getListenerService(bool required=true) const=0;
         
         /**
          * Returns a RequestMapper instance.
diff --git a/shibsp/handler/RemotedHandler.h b/shibsp/handler/RemotedHandler.h
index a424597b..76788767 100644
--- a/shibsp/handler/RemotedHandler.h
+++ b/shibsp/handler/RemotedHandler.h
@@ -28,7 +28,7 @@
 #define __shibsp_remhandler_h__
 
 #include <shibsp/handler/Handler.h>
-#include <shibsp/remoting/ListenerService.h>
+#include <shibsp/remoting/ddf.h>
 
 #include <set>
 
@@ -45,7 +45,7 @@ namespace shibsp {
     /**
      * Base class for handlers that need HTTP request/response layer to be remoted.
      */
-    class SHIBSP_API RemotedHandler : public virtual Handler, public Remoted 
+    class SHIBSP_API RemotedHandler : public virtual Handler
     {
         static std::set<std::string> m_remotedHeaders;
 
diff --git a/shibsp/handler/impl/AbstractHandler.cpp b/shibsp/handler/impl/AbstractHandler.cpp
index 47c904f1..58d9e477 100644
--- a/shibsp/handler/impl/AbstractHandler.cpp
+++ b/shibsp/handler/impl/AbstractHandler.cpp
@@ -27,7 +27,6 @@
 #include "SPRequest.h"
 #include "handler/AbstractHandler.h"
 #include "handler/LogoutHandler.h"
-#include "remoting/ListenerService.h"
 #include "util/CGIParser.h"
 #include "util/SPConstants.h"
 #include "util/PathResolver.h"
@@ -254,7 +253,7 @@ void Handler::preserveRelayState(const Application& application, HTTPResponse& r
                     in.addmember("id").string(mech.second);
                     in.addmember("value").unsafe_string(relayState.c_str());
                     DDFJanitor jin(in),jout(out);
-                    out = application.getServiceProvider().getListenerService()->send(in);
+                    //out = application.getServiceProvider().getListenerService()->send(in);
                     if (!out.isstring())
                         throw IOException("StorageService-backed RelayState mechanism did not return a state key.");
                     relayState = string(mech.second-3) + ':' + out.string();
@@ -323,7 +322,7 @@ void Handler::recoverRelayState(
                     in.addmember("key").string(key);
                     in.addmember("clear").integer(clear ? 1 : 0);
                     DDFJanitor jin(in),jout(out);
-                    out = application.getServiceProvider().getListenerService()->send(in);
+                    //out = application.getServiceProvider().getListenerService()->send(in);
                     if (!out.isstring()) {
                         log(SPRequest::SPError, "StorageService-backed RelayState mechanism did not return a state value.");
                         relayState.erase();
@@ -598,7 +597,7 @@ void AbstractHandler::preservePostData(
             DDFJanitor jin(in),jout(out);
             in.addmember("id").string(mech.second);
             in.add(postData);
-            out = application.getServiceProvider().getListenerService()->send(in);
+            //out = application.getServiceProvider().getListenerService()->send(in);
             if (!out.isstring())
                 throw IOException("StorageService-backed PostData mechanism did not return a state key.");
             postkey = string(mech.second-3) + ':' + out.string();
@@ -687,10 +686,10 @@ DDF AbstractHandler::recoverPostData(
                     DDFJanitor jin(in);
                     in.addmember("id").string(ssid.c_str());
                     in.addmember("key").string(key);
-                    DDF out = application.getServiceProvider().getListenerService()->send(in);
-                    if (out.islist())
-                        return out;
-                    out.destroy();
+                    //DDF out = application.getServiceProvider().getListenerService()->send(in);
+                    //if (out.islist())
+                    //    return out;
+                    //out.destroy();
                     m_log.error("storageService-backed PostData mechanism did not return preserved data.");
                 }
             }
diff --git a/shibsp/handler/impl/LogoutHandler.cpp b/shibsp/handler/impl/LogoutHandler.cpp
index 307f215c..3a245750 100644
--- a/shibsp/handler/impl/LogoutHandler.cpp
+++ b/shibsp/handler/impl/LogoutHandler.cpp
@@ -282,6 +282,6 @@ bool LogoutHandler::notifyBackChannel(
         DDF temp = DDF(nullptr).string(i->c_str());
         s.add(temp);
     }
-    out = application.getServiceProvider().getListenerService()->send(in);
+    //out = application.getServiceProvider().getListenerService()->send(in);
     return (out.integer() == 1);
 }
diff --git a/shibsp/handler/impl/RemotedHandler.cpp b/shibsp/handler/impl/RemotedHandler.cpp
index 90c732aa..cc129217 100644
--- a/shibsp/handler/impl/RemotedHandler.cpp
+++ b/shibsp/handler/impl/RemotedHandler.cpp
@@ -279,9 +279,6 @@ void RemotedHandler::setAddress(const char* address)
     if (!m_address.empty())
         throw ConfigurationException("Cannot register a remoting address twice for the same Handler.");
     m_address = address;
-    SPConfig& conf = SPConfig::getConfig();
-    if (conf.isEnabled(SPConfig::OutOfProcess) && !conf.isEnabled(SPConfig::InProcess))
-        conf.getServiceProvider()->regListener(address, this);
 }
 
 set<string> RemotedHandler::m_remotedHeaders;
@@ -292,9 +289,6 @@ RemotedHandler::RemotedHandler()
 
 RemotedHandler::~RemotedHandler()
 {
-    SPConfig& conf = SPConfig::getConfig();
-    if (conf.isEnabled(SPConfig::OutOfProcess) && !conf.isEnabled(SPConfig::InProcess))
-        conf.getServiceProvider()->unregListener(m_address.c_str(), this);
 }
 
 void RemotedHandler::addRemotedHeader(const char* header)
@@ -314,7 +308,7 @@ DDF RemotedHandler::send(const SPRequest& request, DDF& in) const
         in.addmember("_mapped.entityID").string(s.c_str());
     }
 
-    return request.getServiceProvider().getListenerService()->send(in);
+    //return request.getServiceProvider().getListenerService()->send(in);
 }
 
 DDF RemotedHandler::wrap(const SPRequest& request, const vector<string>* headers, bool certs) const
diff --git a/shibsp/impl/AgentConfig.cpp b/shibsp/impl/AgentConfig.cpp
index 76caeb62..6cdd1d16 100644
--- a/shibsp/impl/AgentConfig.cpp
+++ b/shibsp/impl/AgentConfig.cpp
@@ -26,8 +26,10 @@
 #include "Agent.h"
 #include "AgentConfig.h"
 #include "RequestMapper.h"
+#include "SessionCache.h"
 #include "io/HTTPResponse.h"
 #include "logging/LoggingService.h"
+#include "remoting/RemotingService.h"
 #include "util/Misc.h"
 #include "util/PathResolver.h"
 #include "util/URLEncoder.h"
@@ -217,19 +219,16 @@ bool AgentInternalConfig::_init(const char* inst_prefix, const char* config_file
         XMLToolingConfig::getConfig().user_agent = string(PACKAGE_NAME) + '/' + PACKAGE_VERSION;
 
         registerAttributeFactories();
-
         registerHandlers();
         registerLogoutInitiators();
         registerSessionInitiators();
         */
 
         registerAgents();
-
-        /*
-        registerListenerServices();
-
+        registerRemotingServices();
         registerSessionCaches();
 
+        /*
         // Yes, this isn't secure, will review where we do any random generation
         // after full code cleanup is done.
         srand(static_cast<unsigned int>(std::time(nullptr)));
@@ -324,11 +323,11 @@ void AgentInternalConfig::_term()
     */
 
     AgentManager.deregisterFactories();
+    RemotingServiceManager.deregisterFactories();
+    SessionCacheManager.deregisterFactories();
 
     /*
     Attribute::deregisterFactories();
-    ListenerServiceManager.deregisterFactories();
-    SessionCacheManager.deregisterFactories();
     */
 }
 
@@ -345,8 +344,6 @@ void AgentInternalConfig::loadExtensions(Category& log)
             continue;
         }
 
-        cout << path.first << endl;
-        
         try {
             if (!load_library(path.first.c_str(), const_cast<ptree*>(&path.second))) {
                 throw ConfigurationException("Extension library failed to load.");
@@ -369,9 +366,6 @@ void AgentInternalConfig::loadExtensions(Category& log)
 
 bool AgentInternalConfig::load_library(const char* path, void* context)
 {
-#ifdef _DEBUG
-    xmltooling::NDC ndc("LoadLibrary");
-#endif
     Category& log=Category::getInstance(SHIBSP_LOGCAT ".Config");
     log.info("loading extension: %s", path);
 
diff --git a/shibsp/impl/DefaultAgent.cpp b/shibsp/impl/DefaultAgent.cpp
index 833fff7b..c9962fb8 100644
--- a/shibsp/impl/DefaultAgent.cpp
+++ b/shibsp/impl/DefaultAgent.cpp
@@ -28,6 +28,7 @@
 #include "SessionCache.h"
 #include "io/HTTPResponse.h"
 #include "logging/Category.h"
+#include "remoting/RemotingService.h"
 #include "util/BoostPropertySet.h"
 #include "util/PathResolver.h"
 #include "util/SPConstants.h"
@@ -40,10 +41,6 @@ using namespace shibsp;
 using namespace boost::property_tree;
 using namespace std;
 
-#ifndef min
-# define min(a,b)            (((a) < (b)) ? (a) : (b))
-#endif
-
 namespace {
 
 #if defined (_MSC_VER)
@@ -62,16 +59,16 @@ namespace {
 
         // Agent services.
 
-        ListenerService* getListenerService(bool required = true) const {
-            //if (required && !m_listener)
+        RemotingService* getRemotingService(bool required = true) const {
+            if (required && !m_remotingService)
                 throw ConfigurationException("No ListenerService available.");
-            //return m_listener.get();
+            return m_remotingService.get();
         }
 
         SessionCache* getSessionCache(bool required = true) const {
-            //if (required && !m_sessionCache)
+            if (required && !m_sessionCache)
                 throw ConfigurationException("No SessionCache available.");
-            //return m_sessionCache.get();
+            return m_sessionCache.get();
         }
 
         RequestMapper* getRequestMapper(bool required = true) const {
@@ -81,7 +78,7 @@ namespace {
         }
 
     private:
-        void doRemoting();
+        void doRemotingService();
         void doSessionCache();
         void doRequestMapper();
 
@@ -91,7 +88,7 @@ namespace {
         // The order of these members actually matters. If we want to rely on auto-destruction, then
         // anything dependent on anything else has to come later in the object so it will pop first.
         // Remoting is the lowest, then the cache, and finally the rest.
-        //unique_ptr<ListenerService> m_listener;
+        unique_ptr<RemotingService> m_remotingService;
         unique_ptr<SessionCache> m_sessionCache;
         unique_ptr<RequestMapper> m_requestMapper;
     };
@@ -100,24 +97,6 @@ namespace {
     #pragma warning( pop )
 #endif
 
-    static const XMLCh applicationId[] =        UNICODE_LITERAL_13(a,p,p,l,i,c,a,t,i,o,n,I,d);
-    static const XMLCh _default[] =             UNICODE_LITERAL_7(d,e,f,a,u,l,t);
-    static const XMLCh _id[] =                  UNICODE_LITERAL_2(i,d);
-    static const XMLCh InProcess[] =            UNICODE_LITERAL_9(I,n,P,r,o,c,e,s,s);
-    static const XMLCh Listener[] =             UNICODE_LITERAL_8(L,i,s,t,e,n,e,r);
-    static const XMLCh logger[] =               UNICODE_LITERAL_6(l,o,g,g,e,r);
-    static const XMLCh _option[] =              UNICODE_LITERAL_6(o,p,t,i,o,n);
-    static const XMLCh OutOfProcess[] =         UNICODE_LITERAL_12(O,u,t,O,f,P,r,o,c,e,s,s);
-    static const XMLCh _path[] =                UNICODE_LITERAL_4(p,a,t,h);
-    static const XMLCh _provider[] =            UNICODE_LITERAL_8(p,r,o,v,i,d,e,r);
-    static const XMLCh _RequestMapper[] =       UNICODE_LITERAL_13(R,e,q,u,e,s,t,M,a,p,p,e,r);
-    static const XMLCh RequestMap[] =           UNICODE_LITERAL_10(R,e,q,u,e,s,t,M,a,p);
-    static const XMLCh _SessionCache[] =        UNICODE_LITERAL_12(S,e,s,s,i,o,n,C,a,c,h,e);
-    static const XMLCh Site[] =                 UNICODE_LITERAL_4(S,i,t,e);
-    static const XMLCh TCPListener[] =          UNICODE_LITERAL_11(T,C,P,L,i,s,t,e,n,e,r);
-    static const XMLCh _type[] =                UNICODE_LITERAL_4(t,y,p,e);
-    static const XMLCh UnixListener[] =         UNICODE_LITERAL_12(U,n,i,x,L,i,s,t,e,n,e,r);
-
     Agent* DefaultAgentFactory(ptree& pt, bool deprecationSupport)
     {
         return new DefaultAgent(pt);
@@ -156,83 +135,60 @@ void DefaultAgent::init()
 
     const AgentConfig& conf = AgentConfig::getConfig();
 
-    doRemoting();
+    doRemotingService();
     doSessionCache();
     doRequestMapper();
 
     // TODO: the Application related material needs to be replaced with new approaches.
 }
 
-void DefaultAgent::doRemoting()
+void DefaultAgent::doRemotingService()
 {
-    /*
-#ifdef WIN32
-    string plugtype(TCP_LISTENER_SERVICE);
-#else
-    string plugtype(UNIX_LISTENER_SERVICE);
-#endif
-    DOMElement* child = XMLHelper::getFirstChildElement(e, UnixListener);
-    if (child)
-        plugtype = UNIX_LISTENER_SERVICE;
-    else {
-        child = XMLHelper::getFirstChildElement(e, TCPListener);
-        if (child)
-            plugtype = TCP_LISTENER_SERVICE;
-        else {
-            child = XMLHelper::getFirstChildElement(e, Listener);
-            if (child) {
-                auto_ptr_char type(child->getAttributeNS(nullptr, _type));
-                if (type.get() && *type.get())
-                    plugtype = type.get();
-            }
+    boost::optional<ptree&> child = m_pt.get_child_optional("remoting");
+    if (child) {
+        string t(child->get("type", ""));
+        if (!t.empty()) {
+            m_log.info("building RemotingService of type %s...", t.c_str());
+            m_remotingService.reset(AgentConfig::getConfig().RemotingServiceManager.newPlugin(t.c_str(), *child, true));
+        } else {
+            m_log.error("[remoting] section missing type property");
+            throw ConfigurationException("Missing type property in [remoting] section.");
         }
+    } else {
+        m_log.debug("[remoting] section absent, skipping RemotingService creation");
     }
-
-    log.info("building ListenerService of type %s...", plugtype.c_str());
-    conf->m_listener.reset(SPConfig::getConfig().ListenerServiceManager.newPlugin(plugtype.c_str(), child, m_deprecationSupport));
-    */
 }
 
 void DefaultAgent::doSessionCache()
 {
-    /*
-    const SPConfig& spConf = SPConfig::getConfig();
-
-    DOMElement* child = XMLHelper::getFirstChildElement(e, _SessionCache);
+    boost::optional<ptree&> child = m_pt.get_child_optional("session-cache");
     if (child) {
-        string t(XMLHelper::getAttrString(child, nullptr, _type));
+        string t(child->get("type", ""));
         if (!t.empty()) {
-            log.info("building SessionCache of type %s...", t.c_str());
-            conf->m_sessionCache.reset(spConf.SessionCacheManager.newPlugin(t.c_str(), child, m_deprecationSupport));
+            m_log.info("building SessionCache of type %s...", t.c_str());
+            m_sessionCache.reset(AgentConfig::getConfig().SessionCacheManager.newPlugin(t.c_str(), *child, true));
+        } else {
+            m_log.error("[session-cache] section missing type property");
+            throw ConfigurationException("Missing type property in [session-cache] section.");
         }
+    } else {
+        m_log.debug("[session-cache] section absent, skipping SessionCache creation");
     }
-    if (!conf->m_sessionCache) {
-        log.info("no SessionCache specified, using StorageService-backed instance");
-        conf->m_sessionCache.reset(spConf.SessionCacheManager.newPlugin(STORAGESERVICE_SESSION_CACHE, nullptr, m_deprecationSupport));
-    }
-    */
 }
 
 void DefaultAgent::doRequestMapper()
 {
-    const boost::optional<ptree&> child = m_pt.get_child_optional("request-mapper");
-
-    /*
-    // Back to the fully dynamic stuff...next up is the RequestMapper.
-    if (child = XMLHelper::getFirstChildElement(e, _RequestMapper)) {
-        string t(XMLHelper::getAttrString(child, nullptr, _type));
+    boost::optional<ptree&> child = m_pt.get_child_optional("request-mapper");
+    if (child) {
+        string t(child->get("type", ""));
         if (!t.empty()) {
-            log.info("building RequestMapper of type %s...", t.c_str());
-            m_requestMapper.reset(conf.RequestMapperManager.newPlugin(t.c_str(), child, m_deprecationSupport));
+            m_log.info("building RequestMapper of type %s...", t.c_str());
+            m_requestMapper.reset(AgentConfig::getConfig().RequestMapperManager.newPlugin(t.c_str(), *child, true));
+        } else {
+            m_log.error("[request-mapper] section missing type property");
+            throw ConfigurationException("Missing type property in [request-mapper] section.");
         }
+    } else {
+        m_log.debug("[request-mapper] section absent, skipping RequestMapper creation");
     }
-    if (!m_requestMapper) {
-        log.info("no RequestMapper specified, using 'Native' plugin with empty/default map");
-        child = e->getOwnerDocument()->createElementNS(nullptr, _RequestMapper);
-        DOMElement* mapperDummy = e->getOwnerDocument()->createElementNS(e->getNamespaceURI(), RequestMap);
-        mapperDummy->setAttributeNS(nullptr, applicationId, _default);
-        child->appendChild(mapperDummy);
-        m_requestMapper.reset(conf.RequestMapperManager.newPlugin(NATIVE_REQUEST_MAPPER, child, m_deprecationSupport));
-    }
-    */
 }
diff --git a/shibsp/impl/StorageServiceSessionCache.cpp b/shibsp/impl/StorageServiceSessionCache.cpp
index 84680eb8..1a44782b 100644
--- a/shibsp/impl/StorageServiceSessionCache.cpp
+++ b/shibsp/impl/StorageServiceSessionCache.cpp
@@ -187,27 +187,11 @@ SSCache::SSCache(const DOMElement* e, bool deprecationSupport)
         }
     }
 
-    ListenerService* listener=conf.getServiceProvider()->getListenerService(false);
     if (inproc) {
-        if (!conf.isEnabled(SPConfig::OutOfProcess) && !listener)
-            throw ConfigurationException("SessionCache requires a ListenerService, but none available.");
         m_lock.reset(RWLock::create());
         shutdown_wait.reset(CondWait::create());
         cleanup_thread.reset(Thread::create(&cleanup_fn, this));
     }
-#ifndef SHIBSP_LITE
-    else {
-        if (listener && conf.isEnabled(SPConfig::OutOfProcess)) {
-            listener->regListener("find::" STORAGESERVICE_SESSION_CACHE "::SessionCache",this);
-            listener->regListener("recover::" STORAGESERVICE_SESSION_CACHE "::SessionCache", this);
-            listener->regListener("remove::" STORAGESERVICE_SESSION_CACHE "::SessionCache",this);
-            listener->regListener("touch::" STORAGESERVICE_SESSION_CACHE "::SessionCache",this);
-        }
-        else {
-            m_log.info("no ListenerService available, cache remoting disabled");
-        }
-    }
-#endif
 }
 
 SSCache::~SSCache()
@@ -881,7 +865,7 @@ Session* SSCache::_find(const Application& app, const char* key, const char* rec
             }
 
             try {
-                out=app.getServiceProvider().getListenerService()->send(in);
+                //out=app.getServiceProvider().getListenerService()->send(in);
                 if (!out.isstruct()) {
                     out.destroy();
                     m_log.debug("session not found in remote cache");
@@ -1051,7 +1035,7 @@ bool SSCache::recover(const Application& app, const char* key, const char* data)
         in.addmember("application_id").string(app.getId());
         in.addmember("sealed").string(data);
 
-        out = app.getServiceProvider().getListenerService()->send(in);
+        //out = app.getServiceProvider().getListenerService()->send(in);
         if (!out.isint() || out.integer() != 1) {
             out.destroy();
             m_log.debug("recovery of session (%s) failed", key);
@@ -1228,8 +1212,8 @@ void SSCache::remove(const Application& app, const char* key, time_t revocationE
         in.addmember("key").string(key);
         in.addmember("application_id").string(app.getId());
 
-        DDF out = app.getServiceProvider().getListenerService()->send(in);
-        out.destroy();
+        //DDF out = app.getServiceProvider().getListenerService()->send(in);
+        //out.destroy();
     }
 }
 
diff --git a/shibsp/impl/StorageServiceSessionCache.h b/shibsp/impl/StorageServiceSessionCache.h
index 65eb1453..f33f7daf 100644
--- a/shibsp/impl/StorageServiceSessionCache.h
+++ b/shibsp/impl/StorageServiceSessionCache.h
@@ -29,10 +29,9 @@
 
 #include "SessionCache.h"
 #include "io/HTTPResponse.h"
-#include "remoting/ListenerService.h"
 
 #include <ctime>
-#include <boost/shared_ptr.hpp>
+#include <boost/scoped_ptr.hpp>
 
 namespace xmltooling {
     class CondWait;
diff --git a/shibsp/impl/StoredSession.cpp b/shibsp/impl/StoredSession.cpp
index ae9db433..ca89ae49 100644
--- a/shibsp/impl/StoredSession.cpp
+++ b/shibsp/impl/StoredSession.cpp
@@ -172,7 +172,7 @@ void StoredSession::validate(const Application& app, const char* client_addr, ti
             in.addmember("timeout").string(timebuf);
         }
 
-        out = app.getServiceProvider().getListenerService()->send(in);
+        //out = app.getServiceProvider().getListenerService()->send(in);
         if (out.isstruct()) {
             // We got an updated record back.
             m_cache->m_log.debug("session updated, reconstituting it");
diff --git a/shibsp/impl/XMLAccessControl.cpp b/shibsp/impl/XMLAccessControl.cpp
index 752c7faa..c6fac11b 100644
--- a/shibsp/impl/XMLAccessControl.cpp
+++ b/shibsp/impl/XMLAccessControl.cpp
@@ -106,7 +106,7 @@ namespace {
     class XMLAccessControl : public AccessControl, public ReloadableXMLFile
     {
     public:
-        XMLAccessControl(const ptree& pt)
+        XMLAccessControl(ptree& pt)
             : ReloadableXMLFile(ACCESS_CONTROL_PROP_PATH, pt, Category::getInstance(SHIBSP_LOGCAT ".AccessControl.XML")) {
             if (!load().second) {
                 throw ConfigurationException("Initial AccessControl configuration was invalid.");
diff --git a/shibsp/impl/XMLApplication.cpp b/shibsp/impl/XMLApplication.cpp
index 368fd93a..8d9d9be5 100644
--- a/shibsp/impl/XMLApplication.cpp
+++ b/shibsp/impl/XMLApplication.cpp
@@ -262,20 +262,10 @@ XMLApplication::XMLApplication(
         }
     }
 #endif
-
-    // Out of process only, we register a listener endpoint.
-    if (!conf.isEnabled(SPConfig::InProcess)) {
-        string addr=string(getId()) + "::getHeaders::Application";
-        const_cast<ServiceProvider*>(sp)->regListener(addr.c_str(), this);
-    }
 }
 
 XMLApplication::~XMLApplication()
 {
-    if (SPConfig::getConfig().isEnabled(SPConfig::OutOfProcess) && !SPConfig::getConfig().isEnabled(SPConfig::InProcess)) {
-        string addr=string(getId()) + "::getHeaders::Application";
-        const_cast<ServiceProvider&>(getServiceProvider()).unregListener(addr.c_str(), this);
-    }
     if (m_doc)
         m_doc->release();
 }
@@ -568,19 +558,6 @@ void XMLApplication::doArtifactResolution(const char* protocol, DOMElement* e, C
  
 }
 
-void XMLApplication::receive(DDF& in, ostream& out)
-{
-    // Only current function is to return the headers to clear.
-    DDF header;
-    DDF ret = DDF(nullptr).list();
-    DDFJanitor jret(ret);
-    for (vector< pair<string, string> >::const_iterator i = m_unsetHeaders.begin(); i != m_unsetHeaders.end(); ++i) {
-        header = DDF(i->first.c_str()).string(i->second.c_str());
-        ret.add(header);
-    }
-    out << ret;
-}
-
 DOMNodeFilter::FilterAction XMLApplication::acceptNode(const DOMNode* node) const
 {
     const XMLCh* name=node->getLocalName();
diff --git a/shibsp/impl/XMLApplication.h b/shibsp/impl/XMLApplication.h
index a0a44801..8ad8dc24 100644
--- a/shibsp/impl/XMLApplication.h
+++ b/shibsp/impl/XMLApplication.h
@@ -31,7 +31,6 @@
 #include "exceptions.h"
 #include "SPRequest.h"
 #include "handler/Handler.h"
-#include "remoting/ListenerService.h"
 #include "util/DOMPropertySet.h"
 #include "util/PluginManager.h"
 
@@ -55,7 +54,7 @@ namespace shibsp {
 #endif
 
     class SHIBSP_DLLLOCAL XMLApplication
-        : public Application, public Remoted, public DOMPropertySet, public xercesc::DOMNodeFilter
+        : public Application, public DOMPropertySet, public xercesc::DOMNodeFilter
     {
     public:
         XMLApplication(
@@ -97,8 +96,6 @@ namespace shibsp {
         void getHandlers(std::vector<const Handler*>& handlers) const;
         void limitRedirect(const GenericRequest& request, const char* url) const;
 
-        void receive(DDF& in, std::ostream& out);
-
         // Provides filter to exclude special config elements.
         xercesc::DOMNodeFilter::FilterAction acceptNode(const xercesc::DOMNode* node) const;
 
diff --git a/shibsp/impl/XMLServiceProvider.cpp b/shibsp/impl/XMLServiceProvider.cpp
index 7c25e23f..2fed70ef 100644
--- a/shibsp/impl/XMLServiceProvider.cpp
+++ b/shibsp/impl/XMLServiceProvider.cpp
@@ -154,34 +154,6 @@ void XMLConfigImpl::doExtensions(const DOMElement* e, const char* label, Categor
     }
 }
 
-void XMLConfigImpl::doListener(const DOMElement* e, XMLConfig* conf, Category& log)
-{
-#ifdef WIN32
-    string plugtype(TCP_LISTENER_SERVICE);
-#else
-    string plugtype(UNIX_LISTENER_SERVICE);
-#endif
-    DOMElement* child = XMLHelper::getFirstChildElement(e, UnixListener);
-    if (child)
-        plugtype = UNIX_LISTENER_SERVICE;
-    else {
-        child = XMLHelper::getFirstChildElement(e, TCPListener);
-        if (child)
-            plugtype = TCP_LISTENER_SERVICE;
-        else {
-            child = XMLHelper::getFirstChildElement(e, Listener);
-            if (child) {
-                auto_ptr_char type(child->getAttributeNS(nullptr, _type));
-                if (type.get() && *type.get())
-                    plugtype = type.get();
-            }
-        }
-    }
-
-    log.info("building ListenerService of type %s...", plugtype.c_str());
-    conf->m_listener.reset(SPConfig::getConfig().ListenerServiceManager.newPlugin(plugtype.c_str(), child, m_deprecationSupport));
-}
-
 void XMLConfigImpl::doCaching(const DOMElement* e, XMLConfig* conf, Category& log)
 {
     const SPConfig& spConf = SPConfig::getConfig();
@@ -281,10 +253,6 @@ XMLConfigImpl::XMLConfigImpl(const DOMElement* e, bool first, XMLConfig* outer,
         if (conf.isEnabled(SPConfig::InProcess))
             doExtensions(SHIRE, "in process", log);
 
-        // Instantiate the ListenerService and SessionCache objects.
-        if (conf.isEnabled(SPConfig::Listener))
-            doListener(e, outer, log);
-
         if (conf.isEnabled(SPConfig::Caching))
             doCaching(e, outer, log);
     } // end of first-time-only stuff
diff --git a/shibsp/impl/XMLServiceProvider.h b/shibsp/impl/XMLServiceProvider.h
index 1d2c27e0..94dc9b88 100644
--- a/shibsp/impl/XMLServiceProvider.h
+++ b/shibsp/impl/XMLServiceProvider.h
@@ -30,7 +30,6 @@
 #include "Application.h"
 #include "exceptions.h"
 #include "ServiceProvider.h"
-#include "remoting/ListenerService.h"
 #include "util/DOMPropertySet.h"
 #include "util/PluginManager.h"
 
@@ -79,7 +78,6 @@ namespace shibsp {
 
     private:
         void doExtensions(const xercesc::DOMElement*, const char*, Category&);
-        void doListener(const xercesc::DOMElement*, XMLConfig*, Category&);
         void doCaching(const xercesc::DOMElement*, XMLConfig*, Category&);
 
         xercesc::DOMDocument* m_document;
@@ -106,13 +104,6 @@ namespace shibsp {
         std::pair<bool, int> getInt(const char* name) const { return m_impl->getInt(name); }
         const PropertySet* getPropertySet(const char* name) const { return m_impl->getPropertySet(name); }
 
-        // ServiceProvider
-        ListenerService* getListenerService(bool required = true) const {
-            if (required && !m_listener)
-                throw ConfigurationException("No ListenerService available.");
-            return m_listener.get();
-        }
-
         SessionCache* getSessionCache(bool required = true) const {
             if (required && !m_sessionCache)
                 throw ConfigurationException("No SessionCache available.");
@@ -143,7 +134,6 @@ namespace shibsp {
         // The order of these members actually matters. If we want to rely on auto-destruction, then
         // anything dependent on anything else has to come later in the object so it will pop first.
         // Remoring is the lowest, then the cache, and finally the rest.
-        boost::scoped_ptr<ListenerService> m_listener;
         boost::scoped_ptr<SessionCache> m_sessionCache;
         boost::scoped_ptr<XMLConfigImpl> m_impl;
     };
diff --git a/shibsp/logging/impl/SyslogLoggingService.cpp b/shibsp/logging/impl/SyslogLoggingService.cpp
index 77072a8b..1bd65806 100644
--- a/shibsp/logging/impl/SyslogLoggingService.cpp
+++ b/shibsp/logging/impl/SyslogLoggingService.cpp
@@ -20,6 +20,7 @@
 
 #include "internal.h"
 #include "logging/impl/AbstractLoggingService.h"
+#include "util/Misc.h"
 
 #include <syslog.h>
 #include <boost/lexical_cast.hpp>
@@ -63,10 +64,10 @@ SyslogLoggingService::SyslogLoggingService(const ptree& pt)
     static const char OPENSYSLOG_PROP_PATH[] = "logging.openSyslog";
     static const char FACILITY_PROP_PATH[] = "logging.facility";
 
-    string opt = pt.get(OPENSYSLOG_PROP_PATH, "1");
-    m_open = (opt == "1" || opt == "true");
+    string_to_bool_translator tr;
+    m_open = pt.get(OPENSYSLOG_PROP_PATH, true, tr);
 
-    opt = pt.get(FACILITY_PROP_PATH, "0");
+    string opt = pt.get(FACILITY_PROP_PATH, "0");
     try {
         m_facility = lexical_cast<int>(opt);
         if (m_facility == 0) {
diff --git a/shibsp/remoting/ListenerService.h b/shibsp/remoting/ListenerService.h
deleted file mode 100644
index 8e115b38..00000000
--- a/shibsp/remoting/ListenerService.h
+++ /dev/null
@@ -1,190 +0,0 @@
-/**
- * Licensed to the University Corporation for Advanced Internet
- * Development, Inc. (UCAID) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for
- * additional information regarding copyright ownership.
- *
- * UCAID licenses this file to you under the Apache License,
- * Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the
- * License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
- * either express or implied. See the License for the specific
- * language governing permissions and limitations under the License.
- */
-
-/**
- * @file shibsp/remoting/ListenerService.h
- *
- * Interprocess remoting engine.
- */
-
-#ifndef __shibsp_listener_h__
-#define __shibsp_listener_h__
-
-#include <shibsp/remoting/ddf.h>
-
-#include <map>
-#include <boost/scoped_ptr.hpp>
-
-namespace xmltooling {
-    class RWLock;
-    class ThreadKey;
-}
-
-namespace shibsp {
-
-    /**
-     * Interface to a remoted service
-     *
-     * Classes that support remoted messages delivered by the Listener runtime
-     * support this interface and register themselves with the runtime to receive
-     * particular messages.
-     */
-    class SHIBSP_API Remoted
-    {
-        MAKE_NONCOPYABLE(Remoted);
-    protected:
-        Remoted();
-    public:
-        virtual ~Remoted();
-
-        /**
-         * Remoted classes implement this method to process incoming messages.
-         *
-         * @param in    incoming DDF message
-         * @param out   stream to write outgoing DDF message to
-         */
-        virtual void receive(DDF& in, std::ostream& out)=0;
-    };
-
-#if defined (_MSC_VER)
-    #pragma warning( push )
-    #pragma warning( disable : 4250 4251 )
-#endif
-
-    /**
-     * Interface to a remoting engine.
-     *
-     * A ListenerService supports the remoting of DDF objects, which are dynamic data trees
-     * that other class implementations can use to remote themselves by calling an
-     * out-of-process peer implementation with arbitrary data to carry out tasks
-     * on the implementation's behalf that require isolation from the dynamic process
-     * fluctuations that web servers are prone to. The ability to pass arbitrary data
-     * trees across the boundary allows arbitrary separation of duty between the
-     * in-process and out-of-process "halves". The ListenerService is responsible
-     * for marshalling and transmitting messages, as well as managing connections
-     * and communication errors.
-     */
-    class SHIBSP_API ListenerService : public virtual Remoted
-    {
-    protected:
-        ListenerService();
-    public:
-        virtual ~ListenerService();
-
-        /**
-         * Send a remoted message and return the response.
-         *
-         * @param in    input message to send
-         * @return      response from remote service
-         */
-        virtual DDF send(const DDF& in)=0;
-
-        /**
-        * Receive a remoted message and write the response.
-        *
-        * @param in    input message
-        * @param out   output stream to write to
-        */
-        void receive(DDF& in, std::ostream& out);
-
-        /**
-         * Access the input message being processed by the active worker thread.
-         *
-         * @return a reference to the input object
-         */
-        DDF* getInput() const;
-
-        // Remoted classes register and unregister for messages using these methods.
-
-        /**
-         * Register for a message. Returns existing remote service, allowing message hooking.
-         *
-         * @param address   message address to register
-         * @param svc       pointer to remote service
-         */
-        virtual void regListener(const char* address, Remoted* svc);
-
-        /**
-         * Unregisters service from an address, possibly restoring an original.
-         *
-         * @param address   message address to modify
-         * @param current   pointer to unregistering service
-         * @return  true iff the current service was still registered
-         */
-        virtual bool unregListener(const char* address, Remoted* current);
-
-        /**
-         * Returns current service registered at an address, if any.
-         *
-         * @param address message address to access
-         * @return  registered service, or nullptr
-         */
-        virtual Remoted* lookup(const char* address) const;
-
-        /**
-         * OutOfProcess servers can implement server-side initialization that should occur
-         * before daemonization.
-         *
-         * <p>The parameter applies to implementations that can detect and remove
-         * the results of ungraceful shutdowns of previous executions and continue
-         * successfully. File-based sockets are the most common example.
-         *
-         * @param force     true iff remnant network state should be forcibly cleared
-         * @return true iff the service initialization was successful
-         */
-        virtual bool init(bool force);
-
-        /**
-         * OutOfProcess servers can implement server-side transport handling by
-         * calling the run method and supplying a flag to monitor for shutdown.
-         *
-         * @param shutdown  pointer to flag that caller will set when shutdown is required
-         * @return true iff the service execution was successful
-         */
-        virtual bool run(bool* shutdown)=0;
-
-        /**
-         * OutOfProcess servers can implement server-side termination/cleanup.
-         */
-        virtual void term();
-
-    private:
-        std::map<std::string,Remoted*> m_listenerMap;
-        boost::scoped_ptr<xmltooling::RWLock> m_listenerLock;
-        boost::scoped_ptr<xmltooling::ThreadKey> m_threadLocalKey;
-    };
-
-#if defined (_MSC_VER)
-    #pragma warning( pop )
-#endif
-
-    /**
-     * Registers ListenerService classes into the runtime.
-     */
-    void SHIBSP_API registerListenerServices();
-
-    /** Listener based on TCP socket remoting. */
-    #define TCP_LISTENER_SERVICE "TCPListener"
-
-    /** Listener based on UNIX domain socket remoting. */
-    #define UNIX_LISTENER_SERVICE "UnixListener"
-};
-
-#endif /* __shibsp_listener_h__ */
diff --git a/shibsp/remoting/RemotingService.h b/shibsp/remoting/RemotingService.h
new file mode 100644
index 00000000..dcacaf98
--- /dev/null
+++ b/shibsp/remoting/RemotingService.h
@@ -0,0 +1,60 @@
+/**
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file shibsp/remoting/RemotingService.h
+ *
+ * Interface to a remoting service for agent/hub communication.
+ */
+
+#ifndef __shibsp_remotingservice_h__
+#define __shibsp_remotingservice_h__
+
+#include <shibsp/remoting/ddf.h>
+
+namespace shibsp {
+
+    /**
+     * Interface to a remoting service.
+     *
+     * A RemotingService supports the remoting of DDF objects. It is responsible
+     * for marshalling and transmitting messages, as well as managing connections
+     * and communication errors.
+     */
+    class SHIBSP_API RemotingService
+    {
+    protected:
+        RemotingService();
+    public:
+        virtual ~RemotingService();
+
+        /**
+         * Send a remoted message and return the response.
+         *
+         * @param in    input message to send
+         * @return      response from remote service
+         */
+        virtual DDF send(const DDF& in)=0;
+    };
+
+    /**
+     * Registers RemotingService classes into the runtime.
+     */
+    void SHIBSP_API registerRemotingServices();
+
+    /** RemotingService based on an HTTP transport layer */
+    #define HTTP_REMOTING_SERVICE "HTTP"
+};
+
+#endif /* __shibsp_remotingservice_h__ */
diff --git a/shibsp/remoting/impl/ListenerService.cpp b/shibsp/remoting/impl/ListenerService.cpp
deleted file mode 100644
index f70b1a65..00000000
--- a/shibsp/remoting/impl/ListenerService.cpp
+++ /dev/null
@@ -1,173 +0,0 @@
-/**
- * Licensed to the University Corporation for Advanced Internet
- * Development, Inc. (UCAID) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for
- * additional information regarding copyright ownership.
- *
- * UCAID licenses this file to you under the Apache License,
- * Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the
- * License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
- * either express or implied. See the License for the specific
- * language governing permissions and limitations under the License.
- */
-
-/**
- * ListenerService.cpp
- *
- * Interprocess remoting engine.
- */
-
-#include "internal.h"
-#include "exceptions.h"
-#include "ServiceProvider.h"
-#include "remoting/ListenerService.h"
-
-#include <xercesc/dom/DOM.hpp>
-#include <xmltooling/security/SecurityHelper.h>
-#include <xmltooling/util/Threads.h>
-
-using namespace shibsp;
-using namespace xmltooling;
-using namespace xercesc;
-using namespace std;
-
-namespace shibsp {
-    SHIBSP_DLLLOCAL PluginManager<ListenerService,string,const DOMElement*>::Factory TCPListenerServiceFactory;
-#ifndef WIN32
-    SHIBSP_DLLLOCAL PluginManager<ListenerService,string,const DOMElement*>::Factory UnixListenerServiceFactory;
-#endif
-};
-
-void SHIBSP_API shibsp::registerListenerServices()
-{
-    SPConfig& conf=SPConfig::getConfig();
-    conf.ListenerServiceManager.registerFactory(TCP_LISTENER_SERVICE, TCPListenerServiceFactory);
-#ifndef WIN32
-    conf.ListenerServiceManager.registerFactory(UNIX_LISTENER_SERVICE, UnixListenerServiceFactory);
-#endif
-}
-
-Remoted::Remoted()
-{
-}
-
-Remoted::~Remoted()
-{
-}
-
-ListenerService::ListenerService() : m_listenerLock(RWLock::create()), m_threadLocalKey(ThreadKey::create(nullptr))
-{
-}
-
-ListenerService::~ListenerService()
-{
-}
-
-void ListenerService::regListener(const char* address, Remoted* listener)
-{
-    m_listenerLock->wrlock();
-    SharedLock locker(m_listenerLock, false);
-
-    Remoted* ret=nullptr;
-    map<string,Remoted*>::const_iterator i=m_listenerMap.find(address);
-    if (i!=m_listenerMap.end())
-        ret=i->second;
-    m_listenerMap[address]=listener;
-    Category::getInstance(SHIBSP_LOGCAT ".Listener").debug("registered remoted message endpoint (%s)",address);
-}
-
-bool ListenerService::unregListener(const char* address, Remoted* current)
-{
-    m_listenerLock->wrlock();
-    SharedLock locker(m_listenerLock, false);
-
-    map<string,Remoted*>::const_iterator i=m_listenerMap.find(address);
-    if (i!=m_listenerMap.end() && i->second==current) {
-        m_listenerMap.erase(address);
-        Category::getInstance(SHIBSP_LOGCAT ".Listener").debug("unregistered remoted message endpoint (%s)",address);
-        return true;
-    }
-    return false;
-}
-
-Remoted* ListenerService::lookup(const char *address) const
-{
-    SharedLock locker(m_listenerLock, true);
-    map<string,Remoted*>::const_iterator i=m_listenerMap.find(address);
-    return (i==m_listenerMap.end()) ? nullptr : i->second;
-}
-
-void ListenerService::receive(DDF &in, ostream& out)
-{
-    if (!in.name())
-        throw ListenerException("Incoming message with no destination address rejected.");
-    else if (!strcmp("ping", in.name())) {
-        DDF outmsg = DDF(nullptr).integer(in.integer() + 1);
-        DDFJanitor jan(outmsg);
-        out << outmsg;
-        return;
-    }
-    else if (!strcmp("hash", in.name())) {
-#ifndef SHIBSP_LITE
-        const char* hashAlg = in["alg"].string();
-        const char* data = in["data"].string();
-        if (!hashAlg || !*hashAlg || !data || !*data)
-            throw ListenerException("Hash request missing algorithm or data parameters.");
-        DDF outmsg(nullptr);
-        DDFJanitor jan(outmsg);
-        outmsg.string(SecurityHelper::doHash(hashAlg, data, strlen(data)).c_str());
-        out << outmsg;
-        return;
-#else
-        throw ListenerException("Hash algorithms unavailable in lite build of library.");
-#endif
-    }
-
-    // Two stage lookup, on the listener itself, and the SP interface.
-    ServiceProvider* sp = SPConfig::getConfig().getServiceProvider();
-    Locker locker(sp);
-    Remoted* dest = lookup(in.name());
-    if (!dest) {
-        dest = sp->lookupListener(in.name());
-        if (!dest)
-            throw ListenerException("No destination registered for incoming message addressed to ($1).", params(1,in.name()));
-    }
-
-    try {
-        // Input is saved for surreptitious access by components without direct API access to the data.
-        m_threadLocalKey->setData(&in);
-        auto_ptr_XMLCh selfEntityID(in["_mapped.entityID"].string());
-        if (selfEntityID.get()) {
-            in.addmember("_mapped.entityID-16").pointer(const_cast<XMLCh*>(selfEntityID.get()));
-        }
-
-        dest->receive(in, out);
-        m_threadLocalKey->setData(nullptr);
-    }
-    catch (...) {
-        // Clear on error.
-        m_threadLocalKey->setData(nullptr);
-        throw;
-    }
-}
-
-DDF* ListenerService::getInput() const
-{
-    return reinterpret_cast<DDF*>(m_threadLocalKey->getData());
-}
-
-bool ListenerService::init(bool force)
-{
-    return true;
-}
-
-void ListenerService::term()
-{
-}
diff --git a/shibsp/remoting/impl/RemotingService.cpp b/shibsp/remoting/impl/RemotingService.cpp
new file mode 100644
index 00000000..12ab0c63
--- /dev/null
+++ b/shibsp/remoting/impl/RemotingService.cpp
@@ -0,0 +1,44 @@
+/**
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * remoting/impl/RemotingService.cpp
+ *
+ * Remoting service for agent/hub communication.
+ */
+
+#include "internal.h"
+
+#include "exceptions.h"
+#include "AgentConfig.h"
+#include "remoting/RemotingService.h"
+
+#include <boost/property_tree/ptree.hpp>
+
+using namespace shibsp;
+using namespace boost::property_tree;
+using namespace std;
+
+namespace shibsp {
+    //extern RemotingService* SHIBSP_DLLLOCAL HTTPRemotingServiceFactory(ptree& pt, bool deprecationSupport);
+};
+
+void SHIBSP_API shibsp::registerRemotingServices()
+{
+    //AgentConfig::getConfig().RemotingServiceManager.registerFactory(HTTP_REMOTING_SERVICE, HTTPRemotingServiceFactory);
+}
+
+RemotingService::RemotingService() {}
+
+RemotingService::~RemotingService() {}
diff --git a/shibsp/util/ReloadableXMLFile.cpp b/shibsp/util/ReloadableXMLFile.cpp
index 93e1980c..dd8e4deb 100644
--- a/shibsp/util/ReloadableXMLFile.cpp
+++ b/shibsp/util/ReloadableXMLFile.cpp
@@ -34,10 +34,10 @@ using namespace boost::property_tree;
 using namespace shibsp;
 using namespace std;
 
-const char ReloadableXMLFile::PATH_PROP_NAME[] = "<xmlattr>.path";
-const char ReloadableXMLFile::RELOAD_CHANGES_PROP_NAME[] = "<xmlattr>.reloadChanges";
+const char ReloadableXMLFile::PATH_PROP_NAME[] = "path";
+const char ReloadableXMLFile::RELOAD_CHANGES_PROP_NAME[] = "reloadChanges";
 
-ReloadableXMLFile::ReloadableXMLFile(const string& rootElementName, const ptree& pt, Category& log)
+ReloadableXMLFile::ReloadableXMLFile(const string& rootElementName, ptree& pt, Category& log)
     : m_root(pt), m_log(log), m_rootElementName(rootElementName), m_filestamp(0)
 #ifdef HAVE_CXX17
         , m_lock(nullptr)
@@ -45,13 +45,16 @@ ReloadableXMLFile::ReloadableXMLFile(const string& rootElementName, const ptree&
         , m_lock(nullptr)
 #endif
 {
-    boost::optional<string> path = pt.get_optional<string>(PATH_PROP_NAME);
+    boost::optional<ptree&> xmlattr = pt.get_child_optional("<xmlattr>");
+    const ptree& property_root = xmlattr ? xmlattr.get() : pt;
+
+    boost::optional<string> path = property_root.get_optional<string>(PATH_PROP_NAME);
     if (path) {
         m_source = path.get();
         AgentConfig::getConfig().getPathResolver().resolve(m_source, PathResolver::SHIBSP_CFG_FILE);
 
         string_to_bool_translator tr;
-        bool reloadChanges = pt.get(RELOAD_CHANGES_PROP_NAME, false, tr);
+        bool reloadChanges = property_root.get(RELOAD_CHANGES_PROP_NAME, false, tr);
 #ifndef HAVE_CXX14
         if (reloadChanges) {
             log.warn("C++ compiler level does not allow for reloadChanges, ignoring");
diff --git a/shibsp/util/ReloadableXMLFile.h b/shibsp/util/ReloadableXMLFile.h
index 9a41cceb..d6008db4 100644
--- a/shibsp/util/ReloadableXMLFile.h
+++ b/shibsp/util/ReloadableXMLFile.h
@@ -88,7 +88,7 @@ namespace shibsp {
          * @param rootElementName       name of expexcted root element of XML configuration
          * @param log                   logging object to use
          */
-        ReloadableXMLFile(const std::string& rootElementName, const boost::property_tree::ptree& pt, Category& log);
+        ReloadableXMLFile(const std::string& rootElementName, boost::property_tree::ptree& pt, Category& log);
     
         virtual ~ReloadableXMLFile();
 
diff --git a/tests/data/console-shibboleth.ini b/tests/data/console-shibboleth.ini
index a5523093..fc892452 100644
--- a/tests/data/console-shibboleth.ini
+++ b/tests/data/console-shibboleth.ini
@@ -12,4 +12,4 @@ defaultLevel = WARN
 
 [logging-categories]
 Shibboleth.AgentConfig = DEBUG
-
+Shibboleth.Agent = DEBUG
diff --git a/tests/util/ReloadableXMLFileTests.cpp b/tests/util/ReloadableXMLFileTests.cpp
index 8e68266e..8814317f 100644
--- a/tests/util/ReloadableXMLFileTests.cpp
+++ b/tests/util/ReloadableXMLFileTests.cpp
@@ -36,7 +36,7 @@ namespace {
 class DummyXMLFile : virtual public ReloadableXMLFile
 {
 public:
-    DummyXMLFile(const ptree& pt)
+    DummyXMLFile(ptree& pt)
         : ReloadableXMLFile("RequestMap", pt, Category::getInstance("DummyXMLFile")),
             m_log(Category::getInstance("DummyXMLFile")), m_tree(nullptr), m_forceReload(false) {
         if (!load().second) {
@@ -191,4 +191,4 @@ BOOST_FIXTURE_TEST_CASE(ReloadableFileTest_external_valid, ReloadableXMLFileFixt
     dummy.unlock_shared();
 }
 
-};
\ No newline at end of file
+};

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the commits mailing list