2 * Copyright 2001-2010 Internet2
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
18 * internal.h - internally visible classes
21 #ifndef __xmltooling_internal_h__
22 #define __xmltooling_internal_h__
25 # define _CRT_SECURE_NO_DEPRECATE 1
26 # define _CRT_NONSTDC_NO_DEPRECATE 1
29 // Export public APIs.
30 #define XMLTOOLING_EXPORTS
32 // eventually we might be able to support autoconf via cygwin...
33 #if defined (_MSC_VER) || defined(__BORLANDC__)
34 # include "config_win32.h"
40 #include "XMLToolingConfig.h"
41 #include "util/ParserPool.h"
44 #ifndef XMLTOOLING_NO_XMLSEC
45 #include <xsec/framework/XSECProvider.hpp>
48 #define XMLTOOLING_LOGCAT "XMLTooling"
50 // Macros for path and directory separators.
51 #if defined __CYGWIN32__ && !defined __CYGWIN__
52 /* For backwards compatibility with Cygwin b19 and
53 earlier, we define __CYGWIN__ here, so that
54 we can rely on checking just for that macro. */
55 # define __CYGWIN__ __CYGWIN32__
58 #if defined _WIN32 && !defined __CYGWIN__
59 /* Use Windows separators on all _WIN32 defining
60 environments, except Cygwin. */
61 # define DIR_SEPARATOR_CHAR '\\'
62 # define DIR_SEPARATOR_STR "\\"
63 # define PATH_SEPARATOR_CHAR ';'
64 # define PATH_SEPARATOR_STR ";"
66 #ifndef DIR_SEPARATOR_CHAR
67 /* Assume that not having this is an indicator that all
69 # define DIR_SEPARATOR_CHAR '/'
70 # define DIR_SEPARATOR_STR "/"
71 # define PATH_SEPARATOR_CHAR ':'
72 # define PATH_SEPARATOR_STR ":"
73 #endif /* !DIR_SEPARATOR_CHAR */
75 namespace xmltooling {
78 class XMLToolingInternalConfig : public XMLToolingConfig
81 XMLToolingInternalConfig() :
82 #ifndef XMLTOOLING_NO_XMLSEC
83 m_xsecProvider(nullptr),
85 m_lock(nullptr), m_parserPool(nullptr), m_validatingPool(nullptr)
89 static XMLToolingInternalConfig& getInternalConfig();
91 // global per-process setup and shutdown of runtime
95 // global mutex available to library applications
100 bool load_library(const char* path, void* context=nullptr);
101 bool log_config(const char* config=nullptr);
104 ParserPool& getParser() const {
105 return *m_parserPool;
108 ParserPool& getValidatingParser() const {
109 return *m_validatingPool;
112 #ifndef XMLTOOLING_NO_XMLSEC
113 XSECCryptoX509CRL* X509CRL() const;
114 std::pair<const char*,unsigned int> mapXMLAlgorithmToKeyAlgorithm(const XMLCh* xmlAlgorithm) const;
115 void registerXMLAlgorithm(
116 const XMLCh* xmlAlgorithm, const char* keyAlgorithm, unsigned int size=0, XMLSecurityAlgorithmType type=ALGTYPE_UNK
118 bool isXMLAlgorithmSupported(const XMLCh* xmlAlgorithm, XMLSecurityAlgorithmType type=ALGTYPE_UNK);
119 void registerXMLAlgorithms();
121 XSECProvider* m_xsecProvider;
123 typedef std::map<XMLSecurityAlgorithmType, std::map< xstring,std::pair<std::string,unsigned int> > > algmap_t;
124 algmap_t m_algorithmMap;
128 std::vector<void*> m_libhandles;
130 ParserPool* m_parserPool;
131 ParserPool* m_validatingPool;
134 #ifndef XMLTOOLING_NO_XMLSEC
142 #endif /* __xmltooling_internal_h__ */