Moved ReplayCache into xmltooling
[shibboleth/xmltooling.git] / xmltooling / XMLToolingConfig.h
index 406bbd0..737fe31 100644 (file)
  * Library configuration \r
  */\r
 \r
-#if !defined(__xmltooling_config_h__)\r
+#ifndef __xmltooling_config_h__\r
 #define __xmltooling_config_h__\r
 \r
-#include <xmltooling/ILockable.h>\r
+#include <xmltooling/Lockable.h>\r
+#include <xmltooling/PluginManager.h>\r
+#include <xmltooling/util/ParserPool.h>\r
+\r
+#ifndef XMLTOOLING_NO_XMLSEC\r
+namespace xmlsignature {\r
+    class XMLTOOL_API CredentialResolver;\r
+    class XMLTOOL_API KeyResolver;\r
+};\r
+#endif\r
+\r
+#if defined (_MSC_VER)\r
+    #pragma warning( push )\r
+    #pragma warning( disable : 4251 )\r
+#endif\r
 \r
 namespace xmltooling {\r
+    \r
+    class XMLTOOL_API ReplayCache;\r
+    class XMLTOOL_API StorageService;\r
+    class XMLTOOL_API TrustEngine;\r
+    class XMLTOOL_API XSECCryptoX509CRL;\r
 \r
     /**\r
      * Singleton object that manages library startup/shutdown.configuration.\r
@@ -34,9 +53,14 @@ namespace xmltooling {
      * obtain a global system lock, but the actual configuration itself is not\r
      * synchronized.\r
      */\r
-    class XMLTOOL_API XMLToolingConfig : public ILockable\r
+    class XMLTOOL_API XMLToolingConfig : public Lockable\r
     {\r
-    MAKE_NONCOPYABLE(XMLToolingConfig);\r
+        MAKE_NONCOPYABLE(XMLToolingConfig);\r
+    protected:\r
+        XMLToolingConfig() : m_replayCache(NULL), clock_skew_secs(180) {}\r
+        \r
+        /** Global ReplayCache instance. */\r
+        ReplayCache* m_replayCache;\r
     public:\r
         virtual ~XMLToolingConfig() {}\r
 \r
@@ -91,21 +115,87 @@ namespace xmltooling {
          * @return true iff configuration was successful\r
          */\r
         virtual bool log_config(const char* config=NULL)=0;\r
+\r
+        /**\r
+         * Obtains a non-validating parser pool.\r
+         * Library must be initialized first.\r
+         *\r
+         * @return reference to a non-validating parser pool.\r
+         */\r
+        virtual ParserPool& getParser() const=0;\r
+\r
+        /**\r
+         * Obtains a validating parser pool.\r
+         * Library must be initialized first. Schema/catalog registration must be\r
+         * externally synchronized.\r
+         *\r
+         * @return reference to a validating parser pool.\r
+         */\r
+        virtual ParserPool& getValidatingParser() const=0;\r
+\r
+        /**\r
+         * Sets the global ReplayCache 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 replayCache   new ReplayCache instance to store\r
+         */\r
+        void setReplayCache(ReplayCache* replayCache);\r
+\r
+        /**\r
+         * Returns the global ReplayCache instance.\r
+         * \r
+         * @return  global ReplayCache or NULL\r
+         */\r
+        ReplayCache* getReplayCache() const {\r
+            return m_replayCache;\r
+        }\r
+                \r
+        /**\r
+         * List of catalog files to load into validating parser pool at initialization time.\r
+         * Like other path settings, the separator depends on the platform\r
+         * (semicolon on Windows, colon otherwise). \r
+         */\r
+        std::string catalog_path;\r
         \r
         /**\r
-         * Allow and capture unknown attributes during unmarshalling\r
+         * Adjusts any clock comparisons to be more liberal/permissive by the\r
+         * indicated number of seconds.\r
          */\r
-        bool ignoreUnknownAttributes;\r
+        unsigned int clock_skew_secs;\r
 \r
+#ifndef XMLTOOLING_NO_XMLSEC\r
         /**\r
-         * Allow and capture unknown elements during unmarshalling \r
+         * Returns an X.509 CRL implementation object.\r
          */\r
-        bool ignoreUnknownElements;\r
+        virtual XSECCryptoX509CRL* X509CRL() const=0;\r
 \r
-    protected:\r
-        XMLToolingConfig() : ignoreUnknownAttributes(true), ignoreUnknownElements(true) {}\r
+        /**\r
+         * Manages factories for KeyResolver plugins.\r
+         */\r
+        PluginManager<xmlsignature::KeyResolver,const DOMElement*> KeyResolverManager;\r
+\r
+        /**\r
+         * Manages factories for CredentialResolver plugins.\r
+         */\r
+        PluginManager<xmlsignature::CredentialResolver,const DOMElement*> CredentialResolverManager;\r
+\r
+        /**\r
+         * Manages factories for TrustEngine plugins.\r
+         */\r
+        PluginManager<TrustEngine,const DOMElement*> TrustEngineManager;\r
+#endif\r
+\r
+        /**\r
+         * Manages factories for StorageService plugins.\r
+         */\r
+        PluginManager<StorageService,const DOMElement*> StorageServiceManager;\r
     };\r
 \r
 };\r
 \r
+#if defined (_MSC_VER)\r
+    #pragma warning( pop )\r
+#endif\r
+\r
 #endif /* __xmltooling_config_h__ */\r