2 * Licensed to the University Corporation for Advanced Internet
3 * Development, Inc. (UCAID) under one or more contributor license
4 * agreements. See the NOTICE file distributed with this work for
5 * additional information regarding copyright ownership.
7 * UCAID licenses this file to you under the Apache License,
8 * Version 2.0 (the "License"); you may not use this file except
9 * in compliance with the License. You may obtain a copy of the
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing,
15 * software distributed under the License is distributed on an
16 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
17 * either express or implied. See the License for the specific
18 * language governing permissions and limitations under the License.
22 * internal.h - internally visible classes
25 #ifndef __xmltooling_internal_h__
26 #define __xmltooling_internal_h__
29 # define _CRT_SECURE_NO_DEPRECATE 1
30 # define _CRT_NONSTDC_NO_DEPRECATE 1
31 # define _SCL_SECURE_NO_WARNINGS 1
34 // Export public APIs.
35 #define XMLTOOLING_EXPORTS
37 // eventually we might be able to support autoconf via cygwin...
38 #if defined (_MSC_VER) || defined(__BORLANDC__)
39 # include "config_win32.h"
45 #include "XMLToolingConfig.h"
46 #include "util/ParserPool.h"
52 #ifndef XMLTOOLING_NO_XMLSEC
53 #include <xsec/framework/XSECProvider.hpp>
56 #define XMLTOOLING_LOGCAT "XMLTooling"
58 // Macros for path and directory separators.
59 #if defined __CYGWIN32__ && !defined __CYGWIN__
60 /* For backwards compatibility with Cygwin b19 and
61 earlier, we define __CYGWIN__ here, so that
62 we can rely on checking just for that macro. */
63 # define __CYGWIN__ __CYGWIN32__
66 #if defined _WIN32 && !defined __CYGWIN__
67 /* Use Windows separators on all _WIN32 defining
68 environments, except Cygwin. */
69 # define DIR_SEPARATOR_CHAR '\\'
70 # define DIR_SEPARATOR_STR "\\"
71 # define PATH_SEPARATOR_CHAR ';'
72 # define PATH_SEPARATOR_STR ";"
74 #ifndef DIR_SEPARATOR_CHAR
75 /* Assume that not having this is an indicator that all
77 # define DIR_SEPARATOR_CHAR '/'
78 # define DIR_SEPARATOR_STR "/"
79 # define PATH_SEPARATOR_CHAR ':'
80 # define PATH_SEPARATOR_STR ":"
81 #endif /* !DIR_SEPARATOR_CHAR */
83 namespace xmltooling {
86 class XMLTOOL_DLLLOCAL XMLToolingInternalConfig : public XMLToolingConfig
89 XMLToolingInternalConfig();
90 ~XMLToolingInternalConfig();
92 static XMLToolingInternalConfig& getInternalConfig();
94 // global per-process setup and shutdown of runtime
98 // global mutex available to library applications
102 // named mutexes to limit lock scope
103 Mutex& getNamedMutex(const char* name);
106 bool load_library(const char* path, void* context=nullptr);
107 bool log_config(const char* config=nullptr);
110 ParserPool& getParser() const {
111 return *m_parserPool;
114 ParserPool& getValidatingParser() const {
115 return *m_validatingPool;
118 #ifndef XMLTOOLING_NO_XMLSEC
119 XSECCryptoX509CRL* X509CRL() const;
120 std::pair<const char*,unsigned int> mapXMLAlgorithmToKeyAlgorithm(const XMLCh* xmlAlgorithm) const;
121 void registerXMLAlgorithm(
122 const XMLCh* xmlAlgorithm, const char* keyAlgorithm, unsigned int size=0, XMLSecurityAlgorithmType type=ALGTYPE_UNK
124 bool isXMLAlgorithmSupported(const XMLCh* xmlAlgorithm, XMLSecurityAlgorithmType type=ALGTYPE_UNK);
125 void registerXMLAlgorithms();
127 XSECProvider* m_xsecProvider;
129 typedef std::map<XMLSecurityAlgorithmType, std::map< xstring,std::pair<std::string,unsigned int> > > algmap_t;
130 algmap_t m_algorithmMap;
136 std::map<std::string,Mutex*> m_namedLocks;
137 std::vector<void*> m_libhandles;
138 ParserPool* m_parserPool;
139 ParserPool* m_validatingPool;
142 #ifndef XMLTOOLING_NO_XMLSEC
150 #endif /* __xmltooling_internal_h__ */