e_os2.h

Go to the documentation of this file.
00001 /* e_os2.h */
00002 /* ====================================================================
00003  * Copyright (c) 1998-2000 The OpenSSL Project.  All rights reserved.
00004  *
00005  * Redistribution and use in source and binary forms, with or without
00006  * modification, are permitted provided that the following conditions
00007  * are met:
00008  *
00009  * 1. Redistributions of source code must retain the above copyright
00010  *    notice, this list of conditions and the following disclaimer.
00011  *
00012  * 2. Redistributions in binary form must reproduce the above copyright
00013  *    notice, this list of conditions and the following disclaimer in
00014  *    the documentation and/or other materials provided with the
00015  *    distribution.
00016  *
00017  * 3. All advertising materials mentioning features or use of this
00018  *    software must display the following acknowledgment:
00019  *    "This product includes software developed by the OpenSSL Project
00020  *    for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
00021  *
00022  * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
00023  *    endorse or promote products derived from this software without
00024  *    prior written permission. For written permission, please contact
00025  *    openssl-core@openssl.org.
00026  *
00027  * 5. Products derived from this software may not be called "OpenSSL"
00028  *    nor may "OpenSSL" appear in their names without prior written
00029  *    permission of the OpenSSL Project.
00030  *
00031  * 6. Redistributions of any form whatsoever must retain the following
00032  *    acknowledgment:
00033  *    "This product includes software developed by the OpenSSL Project
00034  *    for use in the OpenSSL Toolkit (http://www.openssl.org/)"
00035  *
00036  * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
00037  * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00038  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
00039  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OpenSSL PROJECT OR
00040  * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
00041  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
00042  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
00043  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
00044  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
00045  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
00046  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
00047  * OF THE POSSIBILITY OF SUCH DAMAGE.
00048  * ====================================================================
00049  *
00050  * This product includes cryptographic software written by Eric Young
00051  * (eay@cryptsoft.com).  This product includes software written by Tim
00052  * Hudson (tjh@cryptsoft.com).
00053  *
00054  */
00055 
00056 #include <openssl/opensslconf.h>
00057 
00058 #ifndef HEADER_E_OS2_H
00059 #define HEADER_E_OS2_H
00060 
00061 #ifdef  __cplusplus
00062 extern "C" {
00063 #endif
00064 
00065 /******************************************************************************
00066  * Detect operating systems.  This probably needs completing.
00067  * The result is that at least one OPENSSL_SYS_os macro should be defined.
00068  * However, if none is defined, Unix is assumed.
00069  **/
00070 
00071 #define OPENSSL_SYS_UNIX
00072 
00073 /* ----------------------- Macintosh, before MacOS X ----------------------- */
00074 #if defined(__MWERKS__) && defined(macintosh) || defined(OPENSSL_SYSNAME_MAC)
00075 # undef OPENSSL_SYS_UNIX
00076 # define OPENSSL_SYS_MACINTOSH_CLASSIC
00077 #endif
00078 
00079 /* ----------------------- NetWare ----------------------------------------- */
00080 #if defined(NETWARE) || defined(OPENSSL_SYSNAME_NETWARE)
00081 # undef OPENSSL_SYS_UNIX
00082 # define OPENSSL_SYS_NETWARE
00083 #endif
00084 
00085 /* ---------------------- Microsoft operating systems ---------------------- */
00086 
00087 /* Note that MSDOS actually denotes 32-bit environments running on top of
00088    MS-DOS, such as DJGPP one. */
00089 #if defined(OPENSSL_SYSNAME_MSDOS)
00090 # undef OPENSSL_SYS_UNIX
00091 # define OPENSSL_SYS_MSDOS
00092 #endif
00093 
00094 /* For 32 bit environment, there seems to be the CygWin environment and then
00095    all the others that try to do the same thing Microsoft does... */
00096 #if defined(OPENSSL_SYSNAME_UWIN)
00097 # undef OPENSSL_SYS_UNIX
00098 # define OPENSSL_SYS_WIN32_UWIN
00099 #else
00100 # if defined(__CYGWIN32__) || defined(OPENSSL_SYSNAME_CYGWIN32)
00101 #  undef OPENSSL_SYS_UNIX
00102 #  define OPENSSL_SYS_WIN32_CYGWIN
00103 # else
00104 #  if defined(_WIN32) || defined(OPENSSL_SYSNAME_WIN32)
00105 #   undef OPENSSL_SYS_UNIX
00106 #   define OPENSSL_SYS_WIN32
00107 #  endif
00108 #  if defined(OPENSSL_SYSNAME_WINNT)
00109 #   undef OPENSSL_SYS_UNIX
00110 #   define OPENSSL_SYS_WINNT
00111 #  endif
00112 #  if defined(OPENSSL_SYSNAME_WINCE)
00113 #   undef OPENSSL_SYS_UNIX
00114 #   define OPENSSL_SYS_WINCE
00115 #  endif
00116 # endif
00117 #endif
00118 
00119 /* Anything that tries to look like Microsoft is "Windows" */
00120 #if defined(OPENSSL_SYS_WIN32) || defined(OPENSSL_SYS_WINNT) || defined(OPENSSL_SYS_WINCE)
00121 # undef OPENSSL_SYS_UNIX
00122 # define OPENSSL_SYS_WINDOWS
00123 # ifndef OPENSSL_SYS_MSDOS
00124 #  define OPENSSL_SYS_MSDOS
00125 # endif
00126 #endif
00127 
00128 /* DLL settings.  This part is a bit tough, because it's up to the application
00129    implementor how he or she will link the application, so it requires some
00130    macro to be used. */
00131 #ifdef OPENSSL_SYS_WINDOWS
00132 # ifndef OPENSSL_OPT_WINDLL
00133 #  if defined(_WINDLL) /* This is used when building OpenSSL to indicate that
00134                           DLL linkage should be used */
00135 #   define OPENSSL_OPT_WINDLL
00136 #  endif
00137 # endif
00138 #endif
00139 
00140 /* -------------------------------- OpenVMS -------------------------------- */
00141 #if defined(__VMS) || defined(VMS) || defined(OPENSSL_SYSNAME_VMS)
00142 # undef OPENSSL_SYS_UNIX
00143 # define OPENSSL_SYS_VMS
00144 # if defined(__DECC)
00145 #  define OPENSSL_SYS_VMS_DECC
00146 # elif defined(__DECCXX)
00147 #  define OPENSSL_SYS_VMS_DECC
00148 #  define OPENSSL_SYS_VMS_DECCXX
00149 # else
00150 #  define OPENSSL_SYS_VMS_NODECC
00151 # endif
00152 #endif
00153 
00154 /* --------------------------------- OS/2 ---------------------------------- */
00155 #if defined(__EMX__) || defined(__OS2__)
00156 # undef OPENSSL_SYS_UNIX
00157 # define OPENSSL_SYS_OS2
00158 #endif
00159 
00160 /* --------------------------------- Unix ---------------------------------- */
00161 #ifdef OPENSSL_SYS_UNIX
00162 # if defined(linux) || defined(__linux__) || defined(OPENSSL_SYSNAME_LINUX)
00163 #  define OPENSSL_SYS_LINUX
00164 # endif
00165 # ifdef OPENSSL_SYSNAME_MPE
00166 #  define OPENSSL_SYS_MPE
00167 # endif
00168 # ifdef OPENSSL_SYSNAME_SNI
00169 #  define OPENSSL_SYS_SNI
00170 # endif
00171 # ifdef OPENSSL_SYSNAME_ULTRASPARC
00172 #  define OPENSSL_SYS_ULTRASPARC
00173 # endif
00174 # ifdef OPENSSL_SYSNAME_NEWS4
00175 #  define OPENSSL_SYS_NEWS4
00176 # endif
00177 # ifdef OPENSSL_SYSNAME_MACOSX
00178 #  define OPENSSL_SYS_MACOSX
00179 # endif
00180 # ifdef OPENSSL_SYSNAME_MACOSX_RHAPSODY
00181 #  define OPENSSL_SYS_MACOSX_RHAPSODY
00182 #  define OPENSSL_SYS_MACOSX
00183 # endif
00184 # ifdef OPENSSL_SYSNAME_SUNOS
00185 #  define OPENSSL_SYS_SUNOS
00186 #endif
00187 # if defined(_CRAY) || defined(OPENSSL_SYSNAME_CRAY)
00188 #  define OPENSSL_SYS_CRAY
00189 # endif
00190 # if defined(_AIX) || defined(OPENSSL_SYSNAME_AIX)
00191 #  define OPENSSL_SYS_AIX
00192 # endif
00193 #endif
00194 
00195 /* --------------------------------- VOS ----------------------------------- */
00196 #ifdef OPENSSL_SYSNAME_VOS
00197 # define OPENSSL_SYS_VOS
00198 #endif
00199 
00200 /* ------------------------------- VxWorks --------------------------------- */
00201 #ifdef OPENSSL_SYSNAME_VXWORKS
00202 # define OPENSSL_SYS_VXWORKS
00203 #endif
00204 
00210 /* Specials for I/O an exit */
00211 #ifdef OPENSSL_SYS_MSDOS
00212 # define OPENSSL_UNISTD_IO <io.h>
00213 # define OPENSSL_DECLARE_EXIT extern void exit(int);
00214 #else
00215 # define OPENSSL_UNISTD_IO OPENSSL_UNISTD
00216 # define OPENSSL_DECLARE_EXIT /* declared in unistd.h */
00217 #endif
00218 
00219 /* Definitions of OPENSSL_GLOBAL and OPENSSL_EXTERN, to define and declare
00220    certain global symbols that, with some compilers under VMS, have to be
00221    defined and declared explicitely with globaldef and globalref.
00222    Definitions of OPENSSL_EXPORT and OPENSSL_IMPORT, to define and declare
00223    DLL exports and imports for compilers under Win32.  These are a little
00224    more complicated to use.  Basically, for any library that exports some
00225    global variables, the following code must be present in the header file
00226    that declares them, before OPENSSL_EXTERN is used:
00227 
00228    #ifdef SOME_BUILD_FLAG_MACRO
00229    # undef OPENSSL_EXTERN
00230    # define OPENSSL_EXTERN OPENSSL_EXPORT
00231    #endif
00232 
00233    The default is to have OPENSSL_EXPORT, OPENSSL_IMPORT and OPENSSL_GLOBAL
00234    have some generally sensible values, and for OPENSSL_EXTERN to have the
00235    value OPENSSL_IMPORT.
00236 */
00237 
00238 #if defined(OPENSSL_SYS_VMS_NODECC)
00239 # define OPENSSL_EXPORT globalref
00240 # define OPENSSL_IMPORT globalref
00241 # define OPENSSL_GLOBAL globaldef
00242 #elif defined(OPENSSL_SYS_WINDOWS) && defined(OPENSSL_OPT_WINDLL)
00243 # define OPENSSL_EXPORT extern __declspec(dllexport)
00244 # define OPENSSL_IMPORT extern __declspec(dllimport)
00245 # define OPENSSL_GLOBAL
00246 #else
00247 # define OPENSSL_EXPORT extern
00248 # define OPENSSL_IMPORT extern
00249 # define OPENSSL_GLOBAL
00250 #endif
00251 #define OPENSSL_EXTERN OPENSSL_IMPORT
00252 
00253 /* Macros to allow global variables to be reached through function calls when
00254    required (if a shared library version requvres it, for example.
00255    The way it's done allows definitions like this:
00256 
00257    // in foobar.c
00258    OPENSSL_IMPLEMENT_GLOBAL(int,foobar) = 0;
00259    // in foobar.h
00260    OPENSSL_DECLARE_GLOBAL(int,foobar);
00261    #define foobar OPENSSL_GLOBAL_REF(foobar)
00262 */
00263 #ifdef OPENSSL_EXPORT_VAR_AS_FUNCTION
00264 # define OPENSSL_IMPLEMENT_GLOBAL(type,name)            \
00265    extern type _hide_##name;                \
00266    type *_shadow_##name(void) { return &_hide_##name; }       \
00267    static type _hide_##name
00268 # define OPENSSL_DECLARE_GLOBAL(type,name) type *_shadow_##name(void)
00269 # define OPENSSL_GLOBAL_REF(name) (*(_shadow_##name()))
00270 #else
00271 # define OPENSSL_IMPLEMENT_GLOBAL(type,name) OPENSSL_GLOBAL type _shadow_##name
00272 # define OPENSSL_DECLARE_GLOBAL(type,name) OPENSSL_EXPORT type _shadow_##name
00273 # define OPENSSL_GLOBAL_REF(name) _shadow_##name
00274 #endif
00275 
00276 #ifdef  __cplusplus
00277 }
00278 #endif
00279 #endif

Generated on Thu Aug 20 22:33:05 2009 for OpenXDAS by  doxygen 1.5.6