From: Scott Cantor Date: Wed, 3 May 2006 20:57:04 +0000 (+0000) Subject: Initial check-in. X-Git-Tag: 2.0-alpha1~268 X-Git-Url: http://www.project-moonshot.org/gitweb/?p=shibboleth%2Fcpp-opensaml.git;a=commitdiff_plain;h=7283a1f3e79d0f6235afa8d2e7a0d17771a3d64b Initial check-in. --- diff --git a/saml/Makefile.am b/saml/Makefile.am new file mode 100644 index 0000000..145f099 --- /dev/null +++ b/saml/Makefile.am @@ -0,0 +1,34 @@ +AUTOMAKE_OPTIONS = foreign + +lib_LTLIBRARIES = libsaml.la + +libsamlincludedir = $(includedir)/saml + +sigincludedir = $(includedir)/saml/signature + +utilincludedir = $(includedir)/saml/util + +libsamlinclude_HEADERS = \ + base.h \ + exceptions.h \ + version.h \ + SAMLConfig.h + +utilinclude_HEADERS = \ + util/XMLConstants.h + +noinst_HEADERS = \ + internal.h + +libsaml_la_SOURCES = \ + SAMLConfig.cpp \ + util/XMLConstants.cpp + +# this is different from the project version +# http://sources.redhat.com/autobook/autobook/autobook_91.html +libxmltooling_la_LDFLAGS = -version-info 2:0:0 + +install-exec-hook: + for la in $(lib_LTLIBRARIES) ; do rm -f $(DESTDIR)$(libdir)/$$la ; done + +EXTRA_DIST = saml.vcproj diff --git a/saml/SAMLConfig.h b/saml/SAMLConfig.h new file mode 100644 index 0000000..c8a00d6 --- /dev/null +++ b/saml/SAMLConfig.h @@ -0,0 +1,70 @@ +/* + * Copyright 2001-2006 Internet2 + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @file SAMLConfig.h + * + * Library configuration + */ + +#ifndef __saml_config_h__ +#define __saml_config_h__ + +#include + +namespace opensaml { + + /** + * Singleton object that manages library startup/shutdown.configuration. + */ + class SAML_API SAMLConfig + { + MAKE_NONCOPYABLE(SAMLConfig); + public: + virtual ~SAMLConfig() {} + + /** + * Returns the global configuration object for the library. + * + * @return reference to the global library configuration object + */ + static SAMLConfig& getConfig(); + + /** + * Initializes library + * + * Each process using the library MUST call this function exactly once + * before using any library classes. + * + * @return true iff initialization was successful + */ + virtual bool init()=0; + + /** + * Shuts down library + * + * Each process using the library SHOULD call this function exactly once + * before terminating itself + */ + virtual void term()=0; + + protected: + SAMLConfig() {} + }; + +}; + +#endif /* __saml_config_h__ */ diff --git a/saml/base.h b/saml/base.h new file mode 100644 index 0000000..a5e581d --- /dev/null +++ b/saml/base.h @@ -0,0 +1,64 @@ +/* + * Copyright 2001-2006 Internet2 + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @file base.h + * + * Base header file definitions + * Must be included prior to including any other header + */ + +#ifndef __saml_base_h__ +#define __saml_base_h__ + +#include + +// Windows and GCC4 Symbol Visibility Macros +#ifdef WIN32 + #define SAML_IMPORT __declspec(dllimport) + #define SAML_EXPORT __declspec(dllexport) + #define SAML_DLLLOCAL + #define SAML_DLLPUBLIC +#else + #define SAML_IMPORT + #ifdef GCC_HASCLASSVISIBILITY + #define SAML_EXPORT __attribute__ ((visibility("default"))) + #define SAML_DLLLOCAL __attribute__ ((visibility("hidden"))) + #define SAML_DLLPUBLIC __attribute__ ((visibility("default"))) + #else + #define SAML_EXPORT + #define SAML_DLLLOCAL + #define SAML_DLLPUBLIC + #endif +#endif + +// Define SAML_API for DLL builds +#ifdef SAML_EXPORTS + #define SAML_API SAML_EXPORT +#else + #define SAML_API SAML_IMPORT +#endif + +// Throwable classes must always be visible on GCC in all binaries +#ifdef WIN32 + #define SAML_EXCEPTIONAPI(api) api +#elif defined(GCC_HASCLASSVISIBILITY) + #define SAML_EXCEPTIONAPI(api) SAML_EXPORT +#else + #define SAML_EXCEPTIONAPI(api) +#endif + +#endif /* __saml_base_h__ */ diff --git a/saml/exceptions.h b/saml/exceptions.h new file mode 100644 index 0000000..4aea899 --- /dev/null +++ b/saml/exceptions.h @@ -0,0 +1,32 @@ +/* + * Copyright 2001-2006 Internet2 + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @file exceptions.h + * + * Exception classes + */ + +#ifndef __saml_exceptions_h__ +#define __saml_exceptions_h__ + +#include + +namespace opensaml { + +}; + +#endif /* __saml_exceptions_h__ */ diff --git a/saml/internal.h b/saml/internal.h new file mode 100644 index 0000000..12d8662 --- /dev/null +++ b/saml/internal.h @@ -0,0 +1,64 @@ +/* + * Copyright 2001-2005 Internet2 + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/* + * internal.h - internally visible classes + */ + +#ifndef __saml_internal_h__ +#define __saml_internal_h__ + +#ifdef WIN32 +# define _CRT_SECURE_NO_DEPRECATE 1 +# define _CRT_NONSTDC_NO_DEPRECATE 1 +#endif + +// Export public APIs +#define SAML_EXPORTS + +// eventually we might be able to support autoconf via cygwin... +#if defined (_MSC_VER) || defined(__BORLANDC__) +# include "config_win32.h" +#else +# include "config.h" +#endif + +#include "base.h" +#include "SAMLConfig.h" + +#define SAML_LOGCAT "OpenSAML" + +namespace opensaml { + + /// @cond OFF + class SAMLInternalConfig : public SAMLConfig + { + public: + SAMLInternalConfig() {} + + static SAMLInternalConfig& getInternalConfig(); + + // global per-process setup and shutdown of runtime + bool init(); + void term(); + + private: + }; + /// @endcond + +}; + +#endif /* __saml_internal_h__ */ diff --git a/saml/saml.vcproj b/saml/saml.vcproj new file mode 100644 index 0000000..0a3a162 --- /dev/null +++ b/saml/saml.vcproj @@ -0,0 +1,236 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/saml/version.h b/saml/version.h new file mode 100644 index 0000000..c7bd3f8 --- /dev/null +++ b/saml/version.h @@ -0,0 +1,74 @@ +/* + * Copyright 2001-2006 Internet2 + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * version.h + * + * Library version macros and constants + */ + +#ifndef __saml_version_h__ +#define __saml_version_h__ + +// This is all based on Xerces, on the theory it might be useful to +// support this kind of stuff in the future. If they ever yank some +// of this stuff, it can be copied into here. + +#include + +// --------------------------------------------------------------------------- +// V E R S I O N S P E C I F I C A T I O N + +/** + * MODIFY THESE NUMERIC VALUES TO COINCIDE WITH OPENSAML VERSION + * AND DO NOT MODIFY ANYTHING ELSE IN THIS VERSION HEADER FILE + */ + +#define OPENSAML_VERSION_MAJOR 1 +#define OPENSAML_VERSION_MINOR 0 +#define OPENSAML_VERSION_REVISION 0 + +/** DO NOT MODIFY BELOW THIS LINE */ + +/** + * MAGIC THAT AUTOMATICALLY GENERATES THE FOLLOWING: + * + * gOpenSAMLVersionStr, gOpenSAMLFullVersionStr, gOpenSAMLMajVersion, gOpenSAMLMinVersion, gOpenSAMLRevision + */ + +// --------------------------------------------------------------------------- +// V E R S I O N I N F O R M A T I O N + +// OpenSAML version strings; these particular macros cannot be used for +// conditional compilation as they are not numeric constants + +#define OPENSAML_FULLVERSIONSTR INVK_CAT3_SEP_UNDERSCORE(OPENSAML_VERSION_MAJOR,OPENSAML_VERSION_MINOR,OPENSAML_VERSION_REVISION) +#define OPENSAML_FULLVERSIONDOT INVK_CAT3_SEP_PERIOD(OPENSAML_VERSION_MAJOR,OPENSAML_VERSION_MINOR,OPENSAML_VERSION_REVISION) +#define OPENSAML_FULLVERSIONNUM INVK_CAT3_SEP_NIL(OPENSAML_VERSION_MAJOR,OPENSAML_VERSION_MINOR,OPENSAML_VERSION_REVISION) +#define OPENSAML_VERSIONSTR INVK_CAT2_SEP_UNDERSCORE(OPENSAML_VERSION_MAJOR,OPENSAML_VERSION_MINOR) + +const char* const gOpenSAMLVersionStr = OPENSAML_VERSIONSTR; +const char* const gOpenSAMLFullVersionStr = OPENSAML_FULLVERSIONSTR; +const unsigned int gOpenSAMLMajVersion = OPENSAML_VERSION_MAJOR; +const unsigned int gOpenSAMLMinVersion = OPENSAML_VERSION_MINOR; +const unsigned int gOpenSAMLRevision = OPENSAML_VERSION_REVISION; + +// OpenSAML version numeric constants that can be used for conditional +// compilation purposes. + +#define _OPENSAML_VERSION CALC_EXPANDED_FORM (OPENSAML_VERSION_MAJOR,OPENSAML_VERSION_MINOR,OPENSAML_VERSION_REVISION) + +#endif /* __saml_version_h__ */