e_os2.h revision 280304
155714Skris/* e_os2.h */ 2109998Smarkm/* ==================================================================== 3109998Smarkm * Copyright (c) 1998-2000 The OpenSSL Project. All rights reserved. 4109998Smarkm * 5109998Smarkm * Redistribution and use in source and binary forms, with or without 6109998Smarkm * modification, are permitted provided that the following conditions 7109998Smarkm * are met: 8109998Smarkm * 9109998Smarkm * 1. Redistributions of source code must retain the above copyright 10280304Sjkim * notice, this list of conditions and the following disclaimer. 11109998Smarkm * 12109998Smarkm * 2. Redistributions in binary form must reproduce the above copyright 13109998Smarkm * notice, this list of conditions and the following disclaimer in 14109998Smarkm * the documentation and/or other materials provided with the 15109998Smarkm * distribution. 16109998Smarkm * 17109998Smarkm * 3. All advertising materials mentioning features or use of this 18109998Smarkm * software must display the following acknowledgment: 19109998Smarkm * "This product includes software developed by the OpenSSL Project 20109998Smarkm * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" 21109998Smarkm * 22109998Smarkm * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to 23109998Smarkm * endorse or promote products derived from this software without 24109998Smarkm * prior written permission. For written permission, please contact 25109998Smarkm * openssl-core@openssl.org. 26109998Smarkm * 27109998Smarkm * 5. Products derived from this software may not be called "OpenSSL" 28109998Smarkm * nor may "OpenSSL" appear in their names without prior written 29109998Smarkm * permission of the OpenSSL Project. 30109998Smarkm * 31109998Smarkm * 6. Redistributions of any form whatsoever must retain the following 32109998Smarkm * acknowledgment: 33109998Smarkm * "This product includes software developed by the OpenSSL Project 34109998Smarkm * for use in the OpenSSL Toolkit (http://www.openssl.org/)" 35109998Smarkm * 36109998Smarkm * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY 37109998Smarkm * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 38109998Smarkm * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 39109998Smarkm * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR 40109998Smarkm * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 41109998Smarkm * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 42109998Smarkm * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 43109998Smarkm * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 44109998Smarkm * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 45109998Smarkm * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 46109998Smarkm * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 47109998Smarkm * OF THE POSSIBILITY OF SUCH DAMAGE. 48109998Smarkm * ==================================================================== 49109998Smarkm * 50109998Smarkm * This product includes cryptographic software written by Eric Young 51109998Smarkm * (eay@cryptsoft.com). This product includes software written by Tim 52109998Smarkm * Hudson (tjh@cryptsoft.com). 53109998Smarkm * 54109998Smarkm */ 5555714Skris 56109998Smarkm#include <openssl/opensslconf.h> 57109998Smarkm 5855714Skris#ifndef HEADER_E_OS2_H 59280304Sjkim# define HEADER_E_OS2_H 6055714Skris 6155714Skris#ifdef __cplusplus 6255714Skrisextern "C" { 6355714Skris#endif 6455714Skris 65109998Smarkm/****************************************************************************** 66109998Smarkm * Detect operating systems. This probably needs completing. 67109998Smarkm * The result is that at least one OPENSSL_SYS_os macro should be defined. 68109998Smarkm * However, if none is defined, Unix is assumed. 69109998Smarkm **/ 70109998Smarkm 71280304Sjkim# define OPENSSL_SYS_UNIX 72109998Smarkm 73280304Sjkim/* ---------------------- Macintosh, before MacOS X ----------------------- */ 74280304Sjkim# if defined(__MWERKS__) && defined(macintosh) || defined(OPENSSL_SYSNAME_MAC) 75280304Sjkim# undef OPENSSL_SYS_UNIX 76280304Sjkim# define OPENSSL_SYS_MACINTOSH_CLASSIC 77280304Sjkim# endif 78109998Smarkm 79280304Sjkim/* ---------------------- NetWare ----------------------------------------- */ 80280304Sjkim# if defined(NETWARE) || defined(OPENSSL_SYSNAME_NETWARE) 81280304Sjkim# undef OPENSSL_SYS_UNIX 82280304Sjkim# define OPENSSL_SYS_NETWARE 83280304Sjkim# endif 84160814Ssimon 85280304Sjkim/* --------------------- Microsoft operating systems ---------------------- */ 86109998Smarkm 87280304Sjkim/* 88280304Sjkim * Note that MSDOS actually denotes 32-bit environments running on top of 89280304Sjkim * MS-DOS, such as DJGPP one. 90280304Sjkim */ 91280304Sjkim# if defined(OPENSSL_SYSNAME_MSDOS) 92280304Sjkim# undef OPENSSL_SYS_UNIX 93280304Sjkim# define OPENSSL_SYS_MSDOS 94280304Sjkim# endif 95109998Smarkm 96280304Sjkim/* 97280304Sjkim * For 32 bit environment, there seems to be the CygWin environment and then 98280304Sjkim * all the others that try to do the same thing Microsoft does... 99280304Sjkim */ 100280304Sjkim# if defined(OPENSSL_SYSNAME_UWIN) 101109998Smarkm# undef OPENSSL_SYS_UNIX 102280304Sjkim# define OPENSSL_SYS_WIN32_UWIN 103109998Smarkm# else 104280304Sjkim# if defined(__CYGWIN32__) || defined(OPENSSL_SYSNAME_CYGWIN32) 105109998Smarkm# undef OPENSSL_SYS_UNIX 106280304Sjkim# define OPENSSL_SYS_WIN32_CYGWIN 107280304Sjkim# else 108280304Sjkim# if defined(_WIN32) || defined(OPENSSL_SYSNAME_WIN32) 109280304Sjkim# undef OPENSSL_SYS_UNIX 110280304Sjkim# define OPENSSL_SYS_WIN32 111280304Sjkim# endif 112280304Sjkim# if defined(OPENSSL_SYSNAME_WINNT) 113280304Sjkim# undef OPENSSL_SYS_UNIX 114280304Sjkim# define OPENSSL_SYS_WINNT 115280304Sjkim# endif 116280304Sjkim# if defined(OPENSSL_SYSNAME_WINCE) 117280304Sjkim# undef OPENSSL_SYS_UNIX 118280304Sjkim# define OPENSSL_SYS_WINCE 119280304Sjkim# endif 120109998Smarkm# endif 121109998Smarkm# endif 122109998Smarkm 123109998Smarkm/* Anything that tries to look like Microsoft is "Windows" */ 124280304Sjkim# if defined(OPENSSL_SYS_WIN32) || defined(OPENSSL_SYS_WINNT) || defined(OPENSSL_SYS_WINCE) 125280304Sjkim# undef OPENSSL_SYS_UNIX 126280304Sjkim# define OPENSSL_SYS_WINDOWS 127280304Sjkim# ifndef OPENSSL_SYS_MSDOS 128280304Sjkim# define OPENSSL_SYS_MSDOS 129280304Sjkim# endif 130109998Smarkm# endif 131109998Smarkm 132280304Sjkim/* 133280304Sjkim * DLL settings. This part is a bit tough, because it's up to the 134280304Sjkim * application implementor how he or she will link the application, so it 135280304Sjkim * requires some macro to be used. 136280304Sjkim */ 137280304Sjkim# ifdef OPENSSL_SYS_WINDOWS 138280304Sjkim# ifndef OPENSSL_OPT_WINDLL 139280304Sjkim# if defined(_WINDLL) /* This is used when building OpenSSL to 140280304Sjkim * indicate that DLL linkage should be used */ 141280304Sjkim# define OPENSSL_OPT_WINDLL 142280304Sjkim# endif 143109998Smarkm# endif 144109998Smarkm# endif 145109998Smarkm 146280304Sjkim/* ------------------------------- OpenVMS -------------------------------- */ 147280304Sjkim# if defined(__VMS) || defined(VMS) || defined(OPENSSL_SYSNAME_VMS) 148280304Sjkim# undef OPENSSL_SYS_UNIX 149280304Sjkim# define OPENSSL_SYS_VMS 150280304Sjkim# if defined(__DECC) 151280304Sjkim# define OPENSSL_SYS_VMS_DECC 152280304Sjkim# elif defined(__DECCXX) 153280304Sjkim# define OPENSSL_SYS_VMS_DECC 154280304Sjkim# define OPENSSL_SYS_VMS_DECCXX 155280304Sjkim# else 156280304Sjkim# define OPENSSL_SYS_VMS_NODECC 157280304Sjkim# endif 158109998Smarkm# endif 159109998Smarkm 160280304Sjkim/* -------------------------------- OS/2 ---------------------------------- */ 161280304Sjkim# if defined(__EMX__) || defined(__OS2__) 162280304Sjkim# undef OPENSSL_SYS_UNIX 163280304Sjkim# define OPENSSL_SYS_OS2 164280304Sjkim# endif 165109998Smarkm 166280304Sjkim/* -------------------------------- Unix ---------------------------------- */ 167280304Sjkim# ifdef OPENSSL_SYS_UNIX 168280304Sjkim# if defined(linux) || defined(__linux__) || defined(OPENSSL_SYSNAME_LINUX) 169280304Sjkim# define OPENSSL_SYS_LINUX 170280304Sjkim# endif 171280304Sjkim# ifdef OPENSSL_SYSNAME_MPE 172280304Sjkim# define OPENSSL_SYS_MPE 173280304Sjkim# endif 174280304Sjkim# ifdef OPENSSL_SYSNAME_SNI 175280304Sjkim# define OPENSSL_SYS_SNI 176280304Sjkim# endif 177280304Sjkim# ifdef OPENSSL_SYSNAME_ULTRASPARC 178280304Sjkim# define OPENSSL_SYS_ULTRASPARC 179280304Sjkim# endif 180280304Sjkim# ifdef OPENSSL_SYSNAME_NEWS4 181280304Sjkim# define OPENSSL_SYS_NEWS4 182280304Sjkim# endif 183280304Sjkim# ifdef OPENSSL_SYSNAME_MACOSX 184280304Sjkim# define OPENSSL_SYS_MACOSX 185280304Sjkim# endif 186280304Sjkim# ifdef OPENSSL_SYSNAME_MACOSX_RHAPSODY 187280304Sjkim# define OPENSSL_SYS_MACOSX_RHAPSODY 188280304Sjkim# define OPENSSL_SYS_MACOSX 189280304Sjkim# endif 190280304Sjkim# ifdef OPENSSL_SYSNAME_SUNOS 191280304Sjkim# define OPENSSL_SYS_SUNOS 192280304Sjkim# endif 193280304Sjkim# if defined(_CRAY) || defined(OPENSSL_SYSNAME_CRAY) 194280304Sjkim# define OPENSSL_SYS_CRAY 195280304Sjkim# endif 196280304Sjkim# if defined(_AIX) || defined(OPENSSL_SYSNAME_AIX) 197280304Sjkim# define OPENSSL_SYS_AIX 198280304Sjkim# endif 199109998Smarkm# endif 200280304Sjkim 201280304Sjkim/* -------------------------------- VOS ----------------------------------- */ 202280304Sjkim# if defined(__VOS__) || defined(OPENSSL_SYSNAME_VOS) 203280304Sjkim# define OPENSSL_SYS_VOS 204280304Sjkim# ifdef __HPPA__ 205280304Sjkim# define OPENSSL_SYS_VOS_HPPA 206280304Sjkim# endif 207280304Sjkim# ifdef __IA32__ 208280304Sjkim# define OPENSSL_SYS_VOS_IA32 209280304Sjkim# endif 210109998Smarkm# endif 211280304Sjkim 212280304Sjkim/* ------------------------------ VxWorks --------------------------------- */ 213280304Sjkim# ifdef OPENSSL_SYSNAME_VXWORKS 214280304Sjkim# define OPENSSL_SYS_VXWORKS 215109998Smarkm# endif 216109998Smarkm 217280304Sjkim/* -------------------------------- BeOS ---------------------------------- */ 218280304Sjkim# if defined(__BEOS__) 219280304Sjkim# define OPENSSL_SYS_BEOS 220280304Sjkim# include <sys/socket.h> 221280304Sjkim# if defined(BONE_VERSION) 222280304Sjkim# define OPENSSL_SYS_BEOS_BONE 223280304Sjkim# else 224280304Sjkim# define OPENSSL_SYS_BEOS_R5 225280304Sjkim# endif 226238405Sjkim# endif 227238405Sjkim 228109998Smarkm/** 229109998Smarkm * That's it for OS-specific stuff 230109998Smarkm *****************************************************************************/ 231109998Smarkm 232109998Smarkm/* Specials for I/O an exit */ 233280304Sjkim# ifdef OPENSSL_SYS_MSDOS 234280304Sjkim# define OPENSSL_UNISTD_IO <io.h> 235280304Sjkim# define OPENSSL_DECLARE_EXIT extern void exit(int); 236280304Sjkim# else 237280304Sjkim# define OPENSSL_UNISTD_IO OPENSSL_UNISTD 238280304Sjkim# define OPENSSL_DECLARE_EXIT /* declared in unistd.h */ 239280304Sjkim# endif 24055714Skris 241280304Sjkim/*- 242280304Sjkim * Definitions of OPENSSL_GLOBAL and OPENSSL_EXTERN, to define and declare 243280304Sjkim * certain global symbols that, with some compilers under VMS, have to be 244280304Sjkim * defined and declared explicitely with globaldef and globalref. 245280304Sjkim * Definitions of OPENSSL_EXPORT and OPENSSL_IMPORT, to define and declare 246280304Sjkim * DLL exports and imports for compilers under Win32. These are a little 247280304Sjkim * more complicated to use. Basically, for any library that exports some 248280304Sjkim * global variables, the following code must be present in the header file 249280304Sjkim * that declares them, before OPENSSL_EXTERN is used: 250280304Sjkim * 251280304Sjkim * #ifdef SOME_BUILD_FLAG_MACRO 252280304Sjkim * # undef OPENSSL_EXTERN 253280304Sjkim * # define OPENSSL_EXTERN OPENSSL_EXPORT 254280304Sjkim * #endif 255280304Sjkim * 256280304Sjkim * The default is to have OPENSSL_EXPORT, OPENSSL_IMPORT and OPENSSL_GLOBAL 257280304Sjkim * have some generally sensible values, and for OPENSSL_EXTERN to have the 258280304Sjkim * value OPENSSL_IMPORT. 259280304Sjkim */ 26055714Skris 261280304Sjkim# if defined(OPENSSL_SYS_VMS_NODECC) 262280304Sjkim# define OPENSSL_EXPORT globalref 263280304Sjkim# define OPENSSL_IMPORT globalref 264280304Sjkim# define OPENSSL_GLOBAL globaldef 265280304Sjkim# elif defined(OPENSSL_SYS_WINDOWS) && defined(OPENSSL_OPT_WINDLL) 266280304Sjkim# define OPENSSL_EXPORT extern __declspec(dllexport) 267280304Sjkim# define OPENSSL_IMPORT extern __declspec(dllimport) 268280304Sjkim# define OPENSSL_GLOBAL 269280304Sjkim# else 270280304Sjkim# define OPENSSL_EXPORT extern 271280304Sjkim# define OPENSSL_IMPORT extern 272280304Sjkim# define OPENSSL_GLOBAL 273280304Sjkim# endif 274280304Sjkim# define OPENSSL_EXTERN OPENSSL_IMPORT 275109998Smarkm 276280304Sjkim/*- 277280304Sjkim * Macros to allow global variables to be reached through function calls when 278280304Sjkim * required (if a shared library version requires it, for example. 279280304Sjkim * The way it's done allows definitions like this: 280280304Sjkim * 281280304Sjkim * // in foobar.c 282280304Sjkim * OPENSSL_IMPLEMENT_GLOBAL(int,foobar,0) 283280304Sjkim * // in foobar.h 284280304Sjkim * OPENSSL_DECLARE_GLOBAL(int,foobar); 285280304Sjkim * #define foobar OPENSSL_GLOBAL_REF(foobar) 286280304Sjkim */ 287280304Sjkim# ifdef OPENSSL_EXPORT_VAR_AS_FUNCTION 288280304Sjkim# define OPENSSL_IMPLEMENT_GLOBAL(type,name,value) \ 289280304Sjkim type *_shadow_##name(void) \ 290280304Sjkim { static type _hide_##name=value; return &_hide_##name; } 291280304Sjkim# define OPENSSL_DECLARE_GLOBAL(type,name) type *_shadow_##name(void) 292280304Sjkim# define OPENSSL_GLOBAL_REF(name) (*(_shadow_##name())) 293280304Sjkim# else 294280304Sjkim# define OPENSSL_IMPLEMENT_GLOBAL(type,name,value) OPENSSL_GLOBAL type _shadow_##name=value; 295280304Sjkim# define OPENSSL_DECLARE_GLOBAL(type,name) OPENSSL_EXPORT type _shadow_##name 296280304Sjkim# define OPENSSL_GLOBAL_REF(name) _shadow_##name 297280304Sjkim# endif 298109998Smarkm 299280304Sjkim# if defined(OPENSSL_SYS_MACINTOSH_CLASSIC) && macintosh==1 && !defined(MAC_OS_GUSI_SOURCE) 300238405Sjkim# define ossl_ssize_t long 301280304Sjkim# endif 302238405Sjkim 303280304Sjkim# ifdef OPENSSL_SYS_MSDOS 304238405Sjkim# define ossl_ssize_t long 305280304Sjkim# endif 306238405Sjkim 307280304Sjkim# if defined(NeXT) || defined(OPENSSL_SYS_NEWS4) || defined(OPENSSL_SYS_SUNOS) 308238405Sjkim# define ssize_t int 309280304Sjkim# endif 310238405Sjkim 311280304Sjkim# if defined(__ultrix) && !defined(ssize_t) 312280304Sjkim# define ossl_ssize_t int 313280304Sjkim# endif 314238405Sjkim 315280304Sjkim# ifndef ossl_ssize_t 316238405Sjkim# define ossl_ssize_t ssize_t 317280304Sjkim# endif 318238405Sjkim 31955714Skris#ifdef __cplusplus 32055714Skris} 32155714Skris#endif 32255714Skris#endif 323