Moved ReplayCache into xmltooling
[shibboleth/cpp-opensaml.git] / saml / SAMLConfig.h
index cd9dfa1..6945ab4 100644 (file)
@@ -15,7 +15,7 @@
  */\r
 \r
 /**\r
- * @file SAMLConfig.h\r
+ * @file saml/SAMLConfig.h\r
  * \r
  * Library configuration \r
  */\r
@@ -24,7 +24,8 @@
 #define __saml_config_h__\r
 \r
 #include <saml/base.h>\r
-#include <xmltooling/unicode.h>\r
+\r
+#include <xmltooling/PluginManager.h>\r
 #include <xmltooling/XMLToolingConfig.h>\r
 \r
 #include <string>\r
  */\r
 namespace opensaml {\r
 \r
+    class SAML_API ArtifactMap;\r
+    class SAML_API MessageEncoder;\r
+    class SAML_API MessageDecoder;\r
+    class SAML_API SAMLArtifact;\r
+    class SAML_API TrustEngine;\r
+    class SAML_API URLEncoder;\r
+\r
+    namespace saml2md {\r
+        class SAML_API MetadataProvider;\r
+        class SAML_API MetadataFilter;\r
+    };\r
+\r
+#if defined (_MSC_VER)\r
+    #pragma warning( push )\r
+    #pragma warning( disable : 4250 4251 )\r
+#endif\r
+\r
     /**\r
      * Singleton object that manages library startup/shutdown.configuration.\r
      */\r
@@ -55,19 +73,62 @@ namespace opensaml {
          * Initializes library\r
          * \r
          * Each process using the library MUST call this function exactly once\r
-         * before using any library classes.\r
+         * before using any library classes. The flag controls whether this is the\r
+         * "dominant" library or not and can allow the SAML library to be loaded\r
+         * as an extension of XMLTooling rather than subsuming it.\r
          * \r
+         * @param initXMLTooling true iff this method should initialize the XMLTooling layer\r
          * @return true iff initialization was successful \r
          */\r
-        virtual bool init()=0;\r
+        virtual bool init(bool initXMLTooling=true)=0;\r
         \r
         /**\r
          * Shuts down library\r
          * \r
          * Each process using the library SHOULD call this function exactly once\r
-         * before terminating itself\r
+         * before terminating itself. The flag controls whether this is the\r
+         * "dominant" library or not and can allow the SAML library to be loaded\r
+         * as an extension of XMLTooling rather than subsuming it.\r
+         * \r
+         * @param termXMLTooling true iff this method should shutdown the XMLTooling layer\r
          */\r
-        virtual void term()=0;\r
+        virtual void term(bool termXMLTooling=true)=0;\r
+        \r
+        /**\r
+         * Sets the global ArtifactMap instance.\r
+         * This method must be externally synchronized with any code that uses the object.\r
+         * Any previously set object is destroyed.\r
+         * \r
+         * @param artifactMap   new ArtifactMap instance to store\r
+         */\r
+        void setArtifactMap(ArtifactMap* artifactMap);\r
+        \r
+        /**\r
+         * Returns the global ArtifactMap instance.\r
+         * \r
+         * @return  global ArtifactMap or NULL\r
+         */\r
+        ArtifactMap* getArtifactMap() const {\r
+            return m_artifactMap;\r
+        }\r
+\r
+        /**\r
+         * Sets the global URLEncoder instance.\r
+         * This method must be externally synchronized with any code that uses the object.\r
+         * Any previously set object is destroyed.\r
+         * \r
+         * @param urlEncoder   new URLEncoder instance to store\r
+         */\r
+        void setURLEncoder(URLEncoder* urlEncoder);\r
+        \r
+        /**\r
+         * Returns the global URLEncoder instance.\r
+         * \r
+         * @return  global URLEncoder or NULL\r
+         */\r
+        URLEncoder* getURLEncoder() const {\r
+            return m_urlEncoder;\r
+        }\r
         \r
         /**\r
          * Generate random information using the underlying security library\r
@@ -92,11 +153,61 @@ namespace opensaml {
          * @return a valid null-terminated XML ID\r
          */\r
         virtual XMLCh* generateIdentifier()=0;\r
+        \r
+        /**\r
+         * Generate the SHA-1 hash of a string\r
+         * \r
+         * @param s     NULL-terminated string to hash\r
+         * @param toHex true iff the result should be encoded in hexadecimal form or left as raw bytes\r
+         *  \r
+         * @return  SHA-1 hash of the data\r
+         */\r
+        virtual std::string hashSHA1(const char* s, bool toHex=false)=0;\r
+\r
+        /**\r
+         * Manages factories for MessageDecoder plugins.\r
+         */\r
+        xmltooling::PluginManager<MessageDecoder,const DOMElement*> MessageDecoderManager;\r
+\r
+        /**\r
+         * Manages factories for MessageEncoder plugins.\r
+         */\r
+        xmltooling::PluginManager<MessageEncoder,const DOMElement*> MessageEncoderManager;        \r
+\r
+        /**\r
+         * Manages factories for SAMLArtifact plugins.\r
+         */\r
+        xmltooling::PluginManager<SAMLArtifact,const char*> SAMLArtifactManager;\r
+\r
+        /**\r
+         * Manages factories for TrustEngine plugins.\r
+         */\r
+        xmltooling::PluginManager<TrustEngine,const DOMElement*> TrustEngineManager;\r
+\r
+        /**\r
+         * Manages factories for MetadataProvider plugins.\r
+         */\r
+        xmltooling::PluginManager<saml2md::MetadataProvider,const DOMElement*> MetadataProviderManager;\r
+        \r
+        /**\r
+         * Manages factories for MetadataFilter plugins.\r
+         */\r
+        xmltooling::PluginManager<saml2md::MetadataFilter,const DOMElement*> MetadataFilterManager;\r
 \r
     protected:\r
-        SAMLConfig() {}\r
+        SAMLConfig() : m_artifactMap(NULL), m_urlEncoder(NULL) {}\r
+        \r
+        /** Global ArtifactMap instance for use by artifact-related functions. */\r
+        ArtifactMap* m_artifactMap;\r
+\r
+        /** Global URLEncoder instance for use by URL-related functions. */\r
+        URLEncoder* m_urlEncoder;\r
     };\r
 \r
+#if defined (_MSC_VER)\r
+    #pragma warning( pop )\r
+#endif\r
+    \r
 };\r
 \r
 #endif /* __saml_config_h__ */\r