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 __saml_internal_h__
26 #define __saml_internal_h__
29 # define _CRT_SECURE_NO_DEPRECATE 1
30 # define _CRT_NONSTDC_NO_DEPRECATE 1
31 # define _SCL_SECURE_NO_WARNINGS 1
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 "SAMLConfig.h"
49 using namespace xercesc;
51 // C99 defines LLONG_MIN, LLONG_MAX and ULLONG_MAX, but this part of
52 // C99 is not yet included into the C++ standard.
53 // GCC defines LONG_LONG_MIN, LONG_LONG_MAX and ULONG_LONG_MAX.
54 // Some compilers (such as Comeau C++ up to and including version 4.3.3)
55 // define nothing. In this last case we make a reasonable guess.
57 #if defined(LONG_LONG_MIN)
58 #define LLONG_MIN LONG_LONG_MIN
59 #elif SIZEOF_LONG_LONG == 8
60 #define LLONG_MIN 0x8000000000000000LL
65 #if defined(LONG_LONG_MAX)
66 #define LLONG_MAX LONG_LONG_MAX
67 #elif SIZEOF_LONG_LONG == 8
68 #define LLONG_MAX 0x7fffffffffffffffLL
73 #if defined(ULONG_LONG_MAX)
74 #define ULLONG_MAX ULONG_LONG_MAX
75 #elif SIZEOF_UNSIGNED_LONG_LONG == 8
76 #define ULLONG_MAX 0xffffffffffffffffULL
80 #if SIZEOF_TIME_T == 8
81 # define SAMLTIME_MAX LLONG_MAX
82 #elif SIZEOF_TIME_T == 4
83 # define SAMLTIME_MAX INT_MAX
86 #define SAML_LOGCAT "OpenSAML"
88 namespace xmltooling {
89 class XMLTOOL_API Mutex;
95 class SAML_DLLLOCAL SAMLInternalConfig : public SAMLConfig
99 ~SAMLInternalConfig();
101 static SAMLInternalConfig& getInternalConfig();
103 // global per-process setup and shutdown of runtime
104 bool init(bool initXMLTooling=true);
105 void term(bool termXMLTooling=true);
107 void generateRandomBytes(void* buf, unsigned int len);
108 void generateRandomBytes(std::string& buf, unsigned int len);
109 XMLCh* generateIdentifier();
110 std::string hashSHA1(const char* data, bool toHex=false);
114 xmltooling::Mutex* m_lock;
120 #endif /* __saml_internal_h__ */