Add accessor for feature bitmask.
[shibboleth/sp.git] / shibsp / SPConfig.h
index c9985a9..73a70a1 100644 (file)
@@ -1,5 +1,5 @@
 /*
- *  Copyright 2001-2009 Internet2
+ *  Copyright 2001-2010 Internet2
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -17,7 +17,7 @@
 /**
  * @file shibsp/SPConfig.h
  *
- * Library configuration
+ * Library configuration.
  */
 
 #ifndef __shibsp_config_h__
@@ -25,6 +25,7 @@
 
 #include <shibsp/base.h>
 
+#include <string>
 #ifndef SHIBSP_LITE
 # include <saml/binding/MessageDecoder.h>
 # include <saml/binding/MessageEncoder.h>
@@ -43,6 +44,7 @@ namespace shibsp {
     class SHIBSP_API Handler;
     class SHIBSP_API ListenerService;
     class SHIBSP_API RequestMapper;
+    class SHIBSP_API ProtocolProvider;
     class SHIBSP_API ServiceProvider;
     class SHIBSP_API SessionCache;
     class SHIBSP_API SessionInitiator;
@@ -54,6 +56,7 @@ namespace shibsp {
     class SHIBSP_API AttributeResolver;
     class SHIBSP_API FilterPolicyContext;
     class SHIBSP_API MatchFunctor;
+    class SHIBSP_API SecurityPolicyProvider;
 #endif
 
 #if defined (_MSC_VER)
@@ -68,14 +71,9 @@ namespace shibsp {
     {
         MAKE_NONCOPYABLE(SPConfig);
     public:
-        SPConfig() : attribute_value_delimeter(';'), m_serviceProvider(NULL),
-#ifndef SHIBSP_LITE
-            m_artifactResolver(NULL),
-#endif
-            m_features(0), m_configDoc(NULL) {
-        }
+        SPConfig();
 
-        virtual ~SPConfig() {}
+        virtual ~SPConfig();
 
         /**
          * Returns the global configuration object for the library.
@@ -108,9 +106,15 @@ namespace shibsp {
          *
          * @param enabled   bitmask of component constants
          */
-        void setFeatures(unsigned long enabled) {
-            m_features = enabled;
-        }
+        void setFeatures(unsigned long enabled);
+
+
+        /**
+         * Gets the bitmask of subsystems being activated.
+         *
+         * @return bitmask of component constants
+         */
+        unsigned long getFeatures() const;
 
         /**
          * Test whether a subsystem is enabled.
@@ -118,9 +122,7 @@ namespace shibsp {
          * @param feature   subsystem/component to test
          * @return true iff feature is enabled
          */
-        bool isEnabled(components_t feature) {
-            return (m_features & feature)>0;
-        }
+        bool isEnabled(components_t feature) const;
 
         /**
          * Initializes library
@@ -132,7 +134,7 @@ namespace shibsp {
          * @param inst_prefix   installation prefix for software
          * @return true iff initialization was successful
          */
-        virtual bool init(const char* catalog_path=NULL, const char* inst_prefix=NULL);
+        virtual bool init(const char* catalog_path=nullptr, const char* inst_prefix=nullptr);
 
         /**
          * Shuts down library
@@ -154,11 +156,9 @@ namespace shibsp {
         /**
          * Returns the global ServiceProvider instance.
          *
-         * @return  global ServiceProvider or NULL
+         * @return  global ServiceProvider or nullptr
          */
-        ServiceProvider* getServiceProvider() const {
-            return m_serviceProvider;
-        }
+        ServiceProvider* getServiceProvider() const;
 
         /**
          * Instantiates and installs a ServiceProvider instance based on an XML configuration string
@@ -168,7 +168,7 @@ namespace shibsp {
          * @param rethrow   true iff caught exceptions should be rethrown instead of just returning the status
          * @return true iff instantiation was successful
          */
-        virtual bool instantiate(const char* config=NULL, bool rethrow=false);
+        virtual bool instantiate(const char* config=nullptr, bool rethrow=false);
 
 #ifndef SHIBSP_LITE
         /**
@@ -179,19 +179,14 @@ namespace shibsp {
          *
          * @param artifactResolver   new ArtifactResolver instance to store
          */
-        void setArtifactResolver(opensaml::MessageDecoder::ArtifactResolver* artifactResolver) {
-            delete m_artifactResolver;
-            m_artifactResolver = artifactResolver;
-        }
+        void setArtifactResolver(opensaml::MessageDecoder::ArtifactResolver* artifactResolver);
 
         /**
          * Returns the global ArtifactResolver instance.
          *
-         * @return  global ArtifactResolver or NULL
+         * @return  global ArtifactResolver or nullptr
          */
-        const opensaml::MessageDecoder::ArtifactResolver* getArtifactResolver() const {
-            return m_artifactResolver;
-        }
+        const opensaml::MessageDecoder::ArtifactResolver* getArtifactResolver() const;
 #endif
 
         /** Separator for serialized values of multi-valued attributes. */
@@ -227,6 +222,11 @@ namespace shibsp {
          * Manages factories for MatchFunctor plugins.
          */
         xmltooling::PluginManager< MatchFunctor,xmltooling::QName,std::pair<const FilterPolicyContext*,const xercesc::DOMElement*> > MatchFunctorManager;
+
+        /**
+         * Manages factories for SecurityPolicyProvider plugins.
+         */
+        xmltooling::PluginManager<SecurityPolicyProvider,std::string,const xercesc::DOMElement*> SecurityPolicyProviderManager;
 #endif
 
         /**
@@ -260,6 +260,11 @@ namespace shibsp {
         xmltooling::PluginManager< Handler,std::string,std::pair<const xercesc::DOMElement*,const char*> > ManageNameIDServiceManager;
 
         /**
+         * Manages factories for ProtocolProvider plugins.
+         */
+        xmltooling::PluginManager<ProtocolProvider,std::string,const xercesc::DOMElement*> ProtocolProviderManager;
+
+        /**
          * Manages factories for RequestMapper plugins.
          */
         xmltooling::PluginManager<RequestMapper,std::string,const xercesc::DOMElement*> RequestMapperManager;