X509CRL wrappers (gap in XML-Sec at the moment)
[shibboleth/cpp-xmltooling.git] / xmltooling / internal.h
1 /*
2  *  Copyright 2001-2005 Internet2
3  * 
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 /*
18  *  internal.h - internally visible classes
19  */
20
21 #ifndef __xmltooling_internal_h__
22 #define __xmltooling_internal_h__
23
24 #ifdef WIN32
25 # define _CRT_SECURE_NO_DEPRECATE 1
26 # define _CRT_NONSTDC_NO_DEPRECATE 1
27 #endif
28
29 // Export public APIs.
30 #define XMLTOOLING_EXPORTS
31
32 // eventually we might be able to support autoconf via cygwin...
33 #if defined (_MSC_VER) || defined(__BORLANDC__)
34 # include "config_win32.h"
35 #else
36 # include "config.h"
37 #endif
38
39 #include "base.h"
40 #include "XMLToolingConfig.h"
41 #include "util/ParserPool.h"
42
43 #include <vector>
44 #ifndef XMLTOOLING_NO_XMLSEC
45     #include <xsec/framework/XSECProvider.hpp>
46 #endif
47
48 #define XMLTOOLING_LOGCAT "XMLTooling"
49
50 namespace xmltooling {
51     
52     /// @cond OFF
53     class XMLToolingInternalConfig : public xmltooling::XMLToolingConfig
54     {
55     public:
56         XMLToolingInternalConfig() : m_lock(NULL), m_parserPool(NULL), m_validatingPool(NULL) {
57 #ifndef XMLTOOLING_NO_XMLSEC
58             m_xsecProvider=NULL;
59 #endif
60         }
61
62         static XMLToolingInternalConfig& getInternalConfig();
63
64         // global per-process setup and shutdown of runtime
65         bool init();
66         void term();
67
68         // global mutex available to library applications
69         Lockable* lock();
70         void unlock();
71
72         // configuration
73         bool load_library(const char* path, void* context=NULL);
74         bool log_config(const char* config=NULL);
75
76         // parser access
77         ParserPool& getParser() const {
78             return *m_parserPool;
79         }
80
81         ParserPool& getValidatingParser() const {
82             return *m_validatingPool;
83         }
84
85 #ifndef XMLTOOLING_NO_XMLSEC
86         XSECCryptoX509CRL* X509CRL() const;
87
88         XSECProvider* m_xsecProvider;
89 #endif
90
91     private:
92         std::vector<void*> m_libhandles;
93         void* m_lock;
94         ParserPool* m_parserPool;
95         ParserPool* m_validatingPool;
96     };
97     
98 #ifndef XMLTOOLING_NO_XMLSEC
99     void log_openssl();
100 #endif
101     
102     /// @endcond
103
104 };
105
106 #endif /* __xmltooling_internal_h__ */