LTKCPP-- LLRP Toolkit C Plus Plus Library
e_os2.h
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 /*
00088  * Note that MSDOS actually denotes 32-bit environments running on top of
00089  * MS-DOS, such as DJGPP one.
00090  */
00091 # if defined(OPENSSL_SYSNAME_MSDOS)
00092 #  undef OPENSSL_SYS_UNIX
00093 #  define OPENSSL_SYS_MSDOS
00094 # endif
00095 
00096 /*
00097  * For 32 bit environment, there seems to be the CygWin environment and then
00098  * all the others that try to do the same thing Microsoft does...
00099  */
00100 # if defined(OPENSSL_SYSNAME_UWIN)
00101 #  undef OPENSSL_SYS_UNIX
00102 #  define OPENSSL_SYS_WIN32_UWIN
00103 # else
00104 #  if defined(__CYGWIN__) || defined(OPENSSL_SYSNAME_CYGWIN)
00105 #   undef OPENSSL_SYS_UNIX
00106 #   define OPENSSL_SYS_WIN32_CYGWIN
00107 #  else
00108 #   if defined(_WIN32) || defined(OPENSSL_SYSNAME_WIN32)
00109 #    undef OPENSSL_SYS_UNIX
00110 #    define OPENSSL_SYS_WIN32
00111 #   endif
00112 #   if defined(_WIN64) || defined(OPENSSL_SYSNAME_WIN64)
00113 #    undef OPENSSL_SYS_UNIX
00114 #    if !defined(OPENSSL_SYS_WIN64)
00115 #     define OPENSSL_SYS_WIN64
00116 #    endif
00117 #   endif
00118 #   if defined(OPENSSL_SYSNAME_WINNT)
00119 #    undef OPENSSL_SYS_UNIX
00120 #    define OPENSSL_SYS_WINNT
00121 #   endif
00122 #   if defined(OPENSSL_SYSNAME_WINCE)
00123 #    undef OPENSSL_SYS_UNIX
00124 #    define OPENSSL_SYS_WINCE
00125 #   endif
00126 #  endif
00127 # endif
00128 
00129 /* Anything that tries to look like Microsoft is "Windows" */
00130 # if defined(OPENSSL_SYS_WIN32) || defined(OPENSSL_SYS_WIN64) || defined(OPENSSL_SYS_WINNT) || defined(OPENSSL_SYS_WINCE)
00131 #  undef OPENSSL_SYS_UNIX
00132 #  define OPENSSL_SYS_WINDOWS
00133 #  ifndef OPENSSL_SYS_MSDOS
00134 #   define OPENSSL_SYS_MSDOS
00135 #  endif
00136 # endif
00137 
00138 /*
00139  * DLL settings.  This part is a bit tough, because it's up to the
00140  * application implementor how he or she will link the application, so it
00141  * requires some macro to be used.
00142  */
00143 # ifdef OPENSSL_SYS_WINDOWS
00144 #  ifndef OPENSSL_OPT_WINDLL
00145 #   if defined(_WINDLL)         /* This is used when building OpenSSL to
00146                                  * indicate that DLL linkage should be used */
00147 #    define OPENSSL_OPT_WINDLL
00148 #   endif
00149 #  endif
00150 # endif
00151 
00152 /* ------------------------------- OpenVMS -------------------------------- */
00153 # if defined(__VMS) || defined(VMS) || defined(OPENSSL_SYSNAME_VMS)
00154 #  undef OPENSSL_SYS_UNIX
00155 #  define OPENSSL_SYS_VMS
00156 #  if defined(__DECC)
00157 #   define OPENSSL_SYS_VMS_DECC
00158 #  elif defined(__DECCXX)
00159 #   define OPENSSL_SYS_VMS_DECC
00160 #   define OPENSSL_SYS_VMS_DECCXX
00161 #  else
00162 #   define OPENSSL_SYS_VMS_NODECC
00163 #  endif
00164 # endif
00165 
00166 /* -------------------------------- OS/2 ---------------------------------- */
00167 # if defined(__EMX__) || defined(__OS2__)
00168 #  undef OPENSSL_SYS_UNIX
00169 #  define OPENSSL_SYS_OS2
00170 # endif
00171 
00172 /* -------------------------------- Unix ---------------------------------- */
00173 # ifdef OPENSSL_SYS_UNIX
00174 #  if defined(linux) || defined(__linux__) || defined(OPENSSL_SYSNAME_LINUX)
00175 #   define OPENSSL_SYS_LINUX
00176 #  endif
00177 #  ifdef OPENSSL_SYSNAME_MPE
00178 #   define OPENSSL_SYS_MPE
00179 #  endif
00180 #  ifdef OPENSSL_SYSNAME_SNI
00181 #   define OPENSSL_SYS_SNI
00182 #  endif
00183 #  ifdef OPENSSL_SYSNAME_ULTRASPARC
00184 #   define OPENSSL_SYS_ULTRASPARC
00185 #  endif
00186 #  ifdef OPENSSL_SYSNAME_NEWS4
00187 #   define OPENSSL_SYS_NEWS4
00188 #  endif
00189 #  ifdef OPENSSL_SYSNAME_MACOSX
00190 #   define OPENSSL_SYS_MACOSX
00191 #  endif
00192 #  ifdef OPENSSL_SYSNAME_MACOSX_RHAPSODY
00193 #   define OPENSSL_SYS_MACOSX_RHAPSODY
00194 #   define OPENSSL_SYS_MACOSX
00195 #  endif
00196 #  ifdef OPENSSL_SYSNAME_SUNOS
00197 #   define OPENSSL_SYS_SUNOS
00198 #  endif
00199 #  if defined(_CRAY) || defined(OPENSSL_SYSNAME_CRAY)
00200 #   define OPENSSL_SYS_CRAY
00201 #  endif
00202 #  if defined(_AIX) || defined(OPENSSL_SYSNAME_AIX)
00203 #   define OPENSSL_SYS_AIX
00204 #  endif
00205 # endif
00206 
00207 /* -------------------------------- VOS ----------------------------------- */
00208 # if defined(__VOS__) || defined(OPENSSL_SYSNAME_VOS)
00209 #  define OPENSSL_SYS_VOS
00210 #  ifdef __HPPA__
00211 #   define OPENSSL_SYS_VOS_HPPA
00212 #  endif
00213 #  ifdef __IA32__
00214 #   define OPENSSL_SYS_VOS_IA32
00215 #  endif
00216 # endif
00217 
00218 /* ------------------------------ VxWorks --------------------------------- */
00219 # ifdef OPENSSL_SYSNAME_VXWORKS
00220 #  define OPENSSL_SYS_VXWORKS
00221 # endif
00222 
00223 /* -------------------------------- BeOS ---------------------------------- */
00224 # if defined(__BEOS__)
00225 #  define OPENSSL_SYS_BEOS
00226 #  include <sys/socket.h>
00227 #  if defined(BONE_VERSION)
00228 #   define OPENSSL_SYS_BEOS_BONE
00229 #  else
00230 #   define OPENSSL_SYS_BEOS_R5
00231 #  endif
00232 # endif
00233 
00238 /* Specials for I/O an exit */
00239 # ifdef OPENSSL_SYS_MSDOS
00240 #  define OPENSSL_UNISTD_IO <io.h>
00241 #  define OPENSSL_DECLARE_EXIT extern void exit(int);
00242 # else
00243 #  define OPENSSL_UNISTD_IO OPENSSL_UNISTD
00244 #  define OPENSSL_DECLARE_EXIT  /* declared in unistd.h */
00245 # endif
00246 
00247 /*-
00248  * Definitions of OPENSSL_GLOBAL and OPENSSL_EXTERN, to define and declare
00249  * certain global symbols that, with some compilers under VMS, have to be
00250  * defined and declared explicitely with globaldef and globalref.
00251  * Definitions of OPENSSL_EXPORT and OPENSSL_IMPORT, to define and declare
00252  * DLL exports and imports for compilers under Win32.  These are a little
00253  * more complicated to use.  Basically, for any library that exports some
00254  * global variables, the following code must be present in the header file
00255  * that declares them, before OPENSSL_EXTERN is used:
00256  *
00257  * #ifdef SOME_BUILD_FLAG_MACRO
00258  * # undef OPENSSL_EXTERN
00259  * # define OPENSSL_EXTERN OPENSSL_EXPORT
00260  * #endif
00261  *
00262  * The default is to have OPENSSL_EXPORT, OPENSSL_IMPORT and OPENSSL_GLOBAL
00263  * have some generally sensible values, and for OPENSSL_EXTERN to have the
00264  * value OPENSSL_IMPORT.
00265  */
00266 
00267 # if defined(OPENSSL_SYS_VMS_NODECC)
00268 #  define OPENSSL_EXPORT globalref
00269 #  define OPENSSL_IMPORT globalref
00270 #  define OPENSSL_GLOBAL globaldef
00271 # elif defined(OPENSSL_SYS_WINDOWS) && defined(OPENSSL_OPT_WINDLL)
00272 #  define OPENSSL_EXPORT extern __declspec(dllexport)
00273 #  define OPENSSL_IMPORT extern __declspec(dllimport)
00274 #  define OPENSSL_GLOBAL
00275 # else
00276 #  define OPENSSL_EXPORT extern
00277 #  define OPENSSL_IMPORT extern
00278 #  define OPENSSL_GLOBAL
00279 # endif
00280 # define OPENSSL_EXTERN OPENSSL_IMPORT
00281 
00282 /*-
00283  * Macros to allow global variables to be reached through function calls when
00284  * required (if a shared library version requires it, for example.
00285  * The way it's done allows definitions like this:
00286  *
00287  *      // in foobar.c
00288  *      OPENSSL_IMPLEMENT_GLOBAL(int,foobar,0)
00289  *      // in foobar.h
00290  *      OPENSSL_DECLARE_GLOBAL(int,foobar);
00291  *      #define foobar OPENSSL_GLOBAL_REF(foobar)
00292  */
00293 # ifdef OPENSSL_EXPORT_VAR_AS_FUNCTION
00294 #  define OPENSSL_IMPLEMENT_GLOBAL(type,name,value)                      \
00295         type *_shadow_##name(void)                                      \
00296         { static type _hide_##name=value; return &_hide_##name; }
00297 #  define OPENSSL_DECLARE_GLOBAL(type,name) type *_shadow_##name(void)
00298 #  define OPENSSL_GLOBAL_REF(name) (*(_shadow_##name()))
00299 # else
00300 #  define OPENSSL_IMPLEMENT_GLOBAL(type,name,value) OPENSSL_GLOBAL type _shadow_##name=value;
00301 #  define OPENSSL_DECLARE_GLOBAL(type,name) OPENSSL_EXPORT type _shadow_##name
00302 #  define OPENSSL_GLOBAL_REF(name) _shadow_##name
00303 # endif
00304 
00305 # if defined(OPENSSL_SYS_MACINTOSH_CLASSIC) && macintosh==1 && !defined(MAC_OS_GUSI_SOURCE)
00306 #  define ossl_ssize_t long
00307 # endif
00308 
00309 # ifdef OPENSSL_SYS_MSDOS
00310 #  define ossl_ssize_t long
00311 # endif
00312 
00313 # if defined(NeXT) || defined(OPENSSL_SYS_NEWS4) || defined(OPENSSL_SYS_SUNOS)
00314 #  define ssize_t int
00315 # endif
00316 
00317 # if defined(__ultrix) && !defined(ssize_t)
00318 #  define ossl_ssize_t int
00319 # endif
00320 
00321 # ifndef ossl_ssize_t
00322 #  define ossl_ssize_t ssize_t
00323 # endif
00324 
00325 #ifdef  __cplusplus
00326 }
00327 #endif
00328 #endif