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  *    [email protected]
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  * ([email protected]).  This product includes software written by Tim
00052  * Hudson ([email protected]).
00053  *
00054  */
00055  /*
00056  © Portions copyright (c) 2006 Nokia Corporation.  All rights reserved.
00057  */
00058 
00059 #include <openssl/opensslconf.h>
00060 
00061 
00062 #ifndef HEADER_E_OS2_H
00063 #define HEADER_E_OS2_H
00064 
00065 #if (defined(__SYMBIAN32__) && !defined(SYMBIAN))
00066 #define SYMBIAN
00067 #endif
00068 
00069 #ifdef  __cplusplus
00070 extern "C" {
00071 #endif
00072 
00073 /******************************************************************************
00074  * Detect operating systems.  This probably needs completing.
00075  * The result is that at least one OPENSSL_SYS_os macro should be defined.
00076  * However, if none is defined, Unix is assumed.
00077  **/
00078 
00079 #define OPENSSL_SYS_UNIX
00080 #ifndef SYMBIAN
00081 /* ----------------------- Macintosh, before MacOS X ----------------------- */
00082 #if defined(__MWERKS__) && defined(macintosh) || defined(OPENSSL_SYSNAME_MAC)
00083 # undef OPENSSL_SYS_UNIX
00084 # define OPENSSL_SYS_MACINTOSH_CLASSIC
00085 #endif
00086 
00087 /* ----------------------- NetWare ----------------------------------------- */
00088 #if defined(NETWARE) || defined(OPENSSL_SYSNAME_NETWARE)
00089 # undef OPENSSL_SYS_UNIX
00090 # define OPENSSL_SYS_NETWARE
00091 #endif
00092 
00093 /* ---------------------- Microsoft operating systems ---------------------- */
00094 
00095 /* For 32 bit environment, there seems to be the CygWin environment and then
00096    all the others that try to do the same thing Microsoft does... */
00097 #if defined(OPENSSL_SYSNAME_UWIN)
00098 # undef OPENSSL_SYS_UNIX
00099 # define OPENSSL_SYS_WIN32_UWIN
00100 #else
00101 # if defined(__CYGWIN32__) || defined(OPENSSL_SYSNAME_CYGWIN32)
00102 #  undef OPENSSL_SYS_UNIX
00103 #  define OPENSSL_SYS_WIN32_CYGWIN
00104 # else
00105 #  if defined(_WIN32) || defined(OPENSSL_SYSNAME_WIN32)
00106 #   undef OPENSSL_SYS_UNIX
00107 #   define OPENSSL_SYS_WIN32
00108 #  endif
00109 #  if defined(OPENSSL_SYSNAME_WINNT)
00110 #   undef OPENSSL_SYS_UNIX
00111 #   define OPENSSL_SYS_WINNT
00112 #  endif
00113 #  if defined(OPENSSL_SYSNAME_WINCE)
00114 #   undef OPENSSL_SYS_UNIX
00115 #   define OPENSSL_SYS_WINCE
00116 #  endif
00117 # endif
00118 #endif
00119 
00120 /* Anything that tries to look like Microsoft is "Windows" */
00121 #if defined(OPENSSL_SYS_WIN32) || defined(OPENSSL_SYS_WINNT) || defined(OPENSSL_SYS_WINCE)
00122 # undef OPENSSL_SYS_UNIX
00123 # define OPENSSL_SYS_WINDOWS
00124 # ifndef OPENSSL_SYS_MSDOS
00125 #  define OPENSSL_SYS_MSDOS
00126 # endif
00127 #endif
00128 
00129 /* DLL settings.  This part is a bit tough, because it's up to the application
00130    implementor how he or she will link the application, so it requires some
00131    macro to be used. */
00132 #ifdef OPENSSL_SYS_WINDOWS
00133 # ifndef OPENSSL_OPT_WINDLL
00134 #  if defined(_WINDLL) /* This is used when building OpenSSL to indicate that
00135                           DLL linkage should be used */
00136 #   define OPENSSL_OPT_WINDLL
00137 #  endif
00138 # endif
00139 #endif
00140 
00141 /* -------------------------------- OpenVMS -------------------------------- */
00142 #if defined(__VMS) || defined(VMS) || defined(OPENSSL_SYSNAME_VMS)
00143 # undef OPENSSL_SYS_UNIX
00144 # define OPENSSL_SYS_VMS
00145 # if defined(__DECC)
00146 #  define OPENSSL_SYS_VMS_DECC
00147 # elif defined(__DECCXX)
00148 #  define OPENSSL_SYS_VMS_DECC
00149 #  define OPENSSL_SYS_VMS_DECCXX
00150 # else
00151 #  define OPENSSL_SYS_VMS_NODECC
00152 # endif
00153 #endif
00154 
00155 /* --------------------------------- OS/2 ---------------------------------- */
00156 #if defined(__EMX__) || defined(__OS2__)
00157 # undef OPENSSL_SYS_UNIX
00158 # define OPENSSL_SYS_OS2
00159 #endif
00160 
00161 /* --------------------------------- Unix ---------------------------------- */
00162 #ifdef OPENSSL_SYS_UNIX
00163 # if defined(linux) || defined(__linux__) || defined(OPENSSL_SYSNAME_LINUX)
00164 #  define OPENSSL_SYS_LINUX
00165 # endif
00166 # ifdef OPENSSL_SYSNAME_MPE
00167 #  define OPENSSL_SYS_MPE
00168 # endif
00169 # ifdef OPENSSL_SYSNAME_SNI
00170 #  define OPENSSL_SYS_SNI
00171 # endif
00172 # ifdef OPENSSL_SYSNAME_ULTRASPARC
00173 #  define OPENSSL_SYS_ULTRASPARC
00174 # endif
00175 # ifdef OPENSSL_SYSNAME_NEWS4
00176 #  define OPENSSL_SYS_NEWS4
00177 # endif
00178 # ifdef OPENSSL_SYSNAME_MACOSX
00179 #  define OPENSSL_SYS_MACOSX
00180 # endif
00181 # ifdef OPENSSL_SYSNAME_MACOSX_RHAPSODY
00182 #  define OPENSSL_SYS_MACOSX_RHAPSODY
00183 #  define OPENSSL_SYS_MACOSX
00184 # endif
00185 # ifdef OPENSSL_SYSNAME_SUNOS
00186 #  define OPENSSL_SYS_SUNOS
00187 #endif
00188 # if defined(_CRAY) || defined(OPENSSL_SYSNAME_CRAY)
00189 #  define OPENSSL_SYS_CRAY
00190 # endif
00191 # if defined(_AIX) || defined(OPENSSL_SYSNAME_AIX)
00192 #  define OPENSSL_SYS_AIX
00193 # endif
00194 #endif
00195 
00196 /* --------------------------------- VOS ----------------------------------- */
00197 #ifdef OPENSSL_SYSNAME_VOS
00198 # define OPENSSL_SYS_VOS
00199 #endif
00200 
00201 /* ------------------------------- VxWorks --------------------------------- */
00202 #ifdef OPENSSL_SYSNAME_VXWORKS
00203 # define OPENSSL_SYS_VXWORKS
00204 #endif
00205 
00206 //#ifndef SYMBAIN
00207 #endif
00208 
00213 /* Specials for I/O an exit */
00214 #ifdef OPENSSL_SYS_MSDOS
00215 # define OPENSSL_UNISTD_IO <io.h>
00216 # define OPENSSL_DECLARE_EXIT extern void exit(int);
00217 #else
00218 # define OPENSSL_UNISTD_IO OPENSSL_UNISTD
00219 # define OPENSSL_DECLARE_EXIT /* declared in unistd.h */
00220 #endif
00221 
00222 /* Definitions of OPENSSL_GLOBAL and OPENSSL_EXTERN, to define and declare
00223    certain global symbols that, with some compilers under VMS, have to be
00224    defined and declared explicitely with globaldef and globalref.
00225    Definitions of OPENSSL_EXPORT and OPENSSL_IMPORT, to define and declare
00226    DLL exports and imports for compilers under Win32.  These are a little
00227    more complicated to use.  Basically, for any library that exports some
00228    global variables, the following code must be present in the header file
00229    that declares them, before OPENSSL_EXTERN is used:
00230 
00231    #ifdef SOME_BUILD_FLAG_MACRO
00232    # undef OPENSSL_EXTERN
00233    # define OPENSSL_EXTERN OPENSSL_EXPORT
00234    #endif
00235 
00236    The default is to have OPENSSL_EXPORT, OPENSSL_IMPORT and OPENSSL_GLOBAL
00237    have some generally sensible values, and for OPENSSL_EXTERN to have the
00238    value OPENSSL_IMPORT.
00239 */
00240 
00241 #if defined(OPENSSL_SYS_VMS_NODECC)
00242 # define OPENSSL_EXPORT globalref
00243 # define OPENSSL_IMPORT globalref
00244 # define OPENSSL_GLOBAL globaldef
00245 #elif defined(OPENSSL_SYS_WINDOWS) && defined(OPENSSL_OPT_WINDLL)
00246 # define OPENSSL_EXPORT extern __declspec(dllexport)
00247 # define OPENSSL_IMPORT extern __declspec(dllimport)
00248 # define OPENSSL_GLOBAL
00249 #else
00250 # define OPENSSL_EXPORT extern
00251 # define OPENSSL_IMPORT extern
00252 # define OPENSSL_GLOBAL
00253 #endif
00254 #define OPENSSL_EXTERN OPENSSL_IMPORT
00255 
00256 /* Macros to allow global variables to be reached through function calls when
00257    required (if a shared library version requvres it, for example.
00258    The way it's done allows definitions like this:
00259 
00260         // in foobar.c
00261         OPENSSL_IMPLEMENT_GLOBAL(int,foobar) = 0;
00262         // in foobar.h
00263         OPENSSL_DECLARE_GLOBAL(int,foobar);
00264         #define foobar OPENSSL_GLOBAL_REF(foobar)
00265 */
00266 
00267 #ifdef OPENSSL_EXPORT_VAR_AS_FUNCTION
00268 # define OPENSSL_IMPLEMENT_GLOBAL(type,name)                         \
00269         extern type _hide_##name;                                    \
00270         type *_shadow_##name(void) { return &_hide_##name; }         \
00271         static type _hide_##name
00272 # define OPENSSL_DECLARE_GLOBAL(type,name) type *_shadow_##name(void)
00273 # define OPENSSL_GLOBAL_REF(name) (*(_shadow_##name()))
00274 #else
00275 #ifndef EMULATOR
00276 # define OPENSSL_IMPLEMENT_GLOBAL(type,name) OPENSSL_GLOBAL type _shadow_##name
00277 # define OPENSSL_DECLARE_GLOBAL(type,name) OPENSSL_EXPORT type _shadow_##name
00278 # define OPENSSL_GLOBAL_REF(name) _shadow_##name
00279 #else
00280 # define OPENSSL_IMPLEMENT_GLOBAL(type,name)
00281 # define OPENSSL_DECLARE_GLOBAL(type,name)
00282 # define OPENSSL_GLOBAL_REF(name) libcrypto_ImpurePtr()->_shadow_##name
00283 #endif
00284 #endif
00285 
00286 #ifdef  __cplusplus
00287 }
00288 #endif
00289 #endif

Copyright © Nokia Corporation 2001-2008
Back to top