e_os.h

00001 /* e_os.h */
00002 /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
00003  * All rights reserved.
00004  *
00005  * This package is an SSL implementation written
00006  * by Eric Young (eay@cryptsoft.com).
00007  * The implementation was written so as to conform with Netscapes SSL.
00008  * 
00009  * This library is free for commercial and non-commercial use as long as
00010  * the following conditions are aheared to.  The following conditions
00011  * apply to all code found in this distribution, be it the RC4, RSA,
00012  * lhash, DES, etc., code; not just the SSL code.  The SSL documentation
00013  * included with this distribution is covered by the same copyright terms
00014  * except that the holder is Tim Hudson (tjh@cryptsoft.com).
00015  * 
00016  * Copyright remains Eric Young's, and as such any Copyright notices in
00017  * the code are not to be removed.
00018  * If this package is used in a product, Eric Young should be given attribution
00019  * as the author of the parts of the library used.
00020  * This can be in the form of a textual message at program startup or
00021  * in documentation (online or textual) provided with the package.
00022  * 
00023  * Redistribution and use in source and binary forms, with or without
00024  * modification, are permitted provided that the following conditions
00025  * are met:
00026  * 1. Redistributions of source code must retain the copyright
00027  *    notice, this list of conditions and the following disclaimer.
00028  * 2. Redistributions in binary form must reproduce the above copyright
00029  *    notice, this list of conditions and the following disclaimer in the
00030  *    documentation and/or other materials provided with the distribution.
00031  * 3. All advertising materials mentioning features or use of this software
00032  *    must display the following acknowledgement:
00033  *    "This product includes cryptographic software written by
00034  *     Eric Young (eay@cryptsoft.com)"
00035  *    The word 'cryptographic' can be left out if the rouines from the library
00036  *    being used are not cryptographic related :-).
00037  * 4. If you include any Windows specific code (or a derivative thereof) from 
00038  *    the apps directory (application code) you must include an acknowledgement:
00039  *    "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
00040  * 
00041  * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
00042  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00043  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00044  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
00045  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
00046  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
00047  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
00048  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
00049  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
00050  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
00051  * SUCH DAMAGE.
00052  * 
00053  * The licence and distribution terms for any publically available version or
00054  * derivative of this code cannot be changed.  i.e. this code cannot simply be
00055  * copied and put under another distribution licence
00056  * [including the GNU Public Licence.]
00057  */
00058 
00059 #ifndef HEADER_E_OS_H
00060 #define HEADER_E_OS_H
00061 
00062 #include <openssl/opensslconf.h>
00063 
00064 #include <openssl/e_os2.h>
00065 /* <openssl/e_os2.h> contains what we can justify to make visible
00066  * to the outside; this file e_os.h is not part of the exported
00067  * interface. */
00068 
00069 #ifdef  __cplusplus
00070 extern "C" {
00071 #endif
00072 
00073 /* Used to checking reference counts, most while doing perl5 stuff :-) */
00074 #ifdef REF_PRINT
00075 #undef REF_PRINT
00076 #define REF_PRINT(a,b)  fprintf(stderr,"%08X:%4d:%s\n",(int)b,b->references,a)
00077 #endif
00078 
00079 #ifndef DEVRANDOM
00080 /* set this to a comma-separated list of 'random' device files to try out.
00081  * My default, we will try to read at least one of these files */
00082 #define DEVRANDOM "/dev/urandom","/dev/random","/dev/srandom"
00083 #endif
00084 #ifndef DEVRANDOM_EGD
00085 /* set this to a comma-seperated list of 'egd' sockets to try out. These
00086  * sockets will be tried in the order listed in case accessing the device files
00087  * listed in DEVRANDOM did not return enough entropy. */
00088 #define DEVRANDOM_EGD "/var/run/egd-pool","/dev/egd-pool","/etc/egd-pool","/etc/entropy"
00089 #endif
00090 
00091 #if defined(OPENSSL_SYS_VXWORKS)
00092 #  define NO_SYS_PARAM_H
00093 #  define NO_CHMOD
00094 #  define NO_SYSLOG
00095 #endif
00096   
00097 #if defined(OPENSSL_SYS_MACINTOSH_CLASSIC)
00098 # if macintosh==1
00099 #  ifndef MAC_OS_GUSI_SOURCE
00100 #    define MAC_OS_pre_X
00101 #    define NO_SYS_TYPES_H
00102      typedef long ssize_t;
00103 #  endif
00104 #  define NO_SYS_PARAM_H
00105 #  define NO_CHMOD
00106 #  define NO_SYSLOG
00107 #  undef  DEVRANDOM
00108 #  define GETPID_IS_MEANINGLESS
00109 # endif
00110 #endif
00111 
00112 /********************************************************************
00113  The Microsoft section
00114  ********************************************************************/
00115 /* The following is used because of the small stack in some
00116  * Microsoft operating systems */
00117 #if defined(OPENSSL_SYS_MSDOS) && !defined(OPENSSL_SYSNAME_WIN32)
00118 #  define MS_STATIC     static
00119 #else
00120 #  define MS_STATIC
00121 #endif
00122 
00123 #if defined(OPENSSL_SYS_WIN32) && !defined(WIN32)
00124 #  define WIN32
00125 #endif
00126 #if defined(OPENSSL_SYS_WINDOWS) && !defined(WINDOWS)
00127 #  define WINDOWS
00128 #endif
00129 #if defined(OPENSSL_SYS_MSDOS) && !defined(MSDOS)
00130 #  define MSDOS
00131 #endif
00132 
00133 #if defined(MSDOS) && !defined(GETPID_IS_MEANINGLESS)
00134 #  define GETPID_IS_MEANINGLESS
00135 #endif
00136 
00137 #ifdef WIN32
00138 #define get_last_sys_error()    GetLastError()
00139 #define clear_sys_error()       SetLastError(0)
00140 #if !defined(WINNT)
00141 #define WIN_CONSOLE_BUG
00142 #endif
00143 #else
00144 #define get_last_sys_error()    errno
00145 #define clear_sys_error()       errno=0
00146 #endif
00147 
00148 #if defined(WINDOWS)
00149 #define get_last_socket_error() WSAGetLastError()
00150 #define clear_socket_error()    WSASetLastError(0)
00151 #define readsocket(s,b,n)       recv((s),(b),(n),0)
00152 #define writesocket(s,b,n)      send((s),(b),(n),0)
00153 #elif defined(__DJGPP__)
00154 #define WATT32
00155 #define get_last_socket_error() errno
00156 #define clear_socket_error()    errno=0
00157 #define closesocket(s)          close_s(s)
00158 #define readsocket(s,b,n)       read_s(s,b,n)
00159 #define writesocket(s,b,n)      send(s,b,n,0)
00160 #elif defined(MAC_OS_pre_X)
00161 #define get_last_socket_error() errno
00162 #define clear_socket_error()    errno=0
00163 #define closesocket(s)          MacSocket_close(s)
00164 #define readsocket(s,b,n)       MacSocket_recv((s),(b),(n),true)
00165 #define writesocket(s,b,n)      MacSocket_send((s),(b),(n))
00166 #elif defined(OPENSSL_SYS_VMS)
00167 #define get_last_socket_error() errno
00168 #define clear_socket_error()    errno=0
00169 #define ioctlsocket(a,b,c)      ioctl(a,b,c)
00170 #define closesocket(s)          close(s)
00171 #define readsocket(s,b,n)       recv((s),(b),(n),0)
00172 #define writesocket(s,b,n)      send((s),(b),(n),0)
00173 #elif defined(OPENSSL_SYS_VXWORKS)
00174 #define get_last_socket_error() errno
00175 #define clear_socket_error()    errno=0
00176 #define ioctlsocket(a,b,c)          ioctl((a),(b),(int)(c))
00177 #define closesocket(s)              close(s)
00178 #define readsocket(s,b,n)           read((s),(b),(n))
00179 #define writesocket(s,b,n)          write((s),(char *)(b),(n))
00180 #elif defined(OPENSSL_SYS_BEOS_R5)
00181 #define get_last_socket_error() errno
00182 #define clear_socket_error()    errno=0
00183 #define FIONBIO SO_NONBLOCK
00184 #define ioctlsocket(a,b,c)                setsockopt((a),SOL_SOCKET,(b),(c),sizeof(*(c)))
00185 #define readsocket(s,b,n)       recv((s),(b),(n),0)
00186 #define writesocket(s,b,n)      send((s),(b),(n),0)
00187 #elif defined(OPENSSL_SYS_NETWARE)
00188 #if defined(NETWARE_BSDSOCK)
00189 #define get_last_socket_error() errno
00190 #define clear_socket_error()    errno=0
00191 #define closesocket(s)          close(s)
00192 #define ioctlsocket(a,b,c)      ioctl(a,b,c)
00193 #if defined(NETWARE_LIBC)
00194 #define readsocket(s,b,n)       recv((s),(b),(n),0)
00195 #define writesocket(s,b,n)      send((s),(b),(n),0)
00196 #else
00197 #define readsocket(s,b,n)       recv((s),(char*)(b),(n),0)
00198 #define writesocket(s,b,n)      send((s),(char*)(b),(n),0)
00199 #endif
00200 #else
00201 #define get_last_socket_error() WSAGetLastError()
00202 #define clear_socket_error()    WSASetLastError(0)
00203 #define readsocket(s,b,n)               recv((s),(b),(n),0)
00204 #define writesocket(s,b,n)              send((s),(b),(n),0)
00205 #endif
00206 #else
00207 #define get_last_socket_error() errno
00208 #define clear_socket_error()    errno=0
00209 #define ioctlsocket(a,b,c)      ioctl(a,b,c)
00210 #define closesocket(s)          close(s)
00211 #define readsocket(s,b,n)       read((s),(b),(n))
00212 #define writesocket(s,b,n)      write((s),(b),(n))
00213 #endif
00214 
00215 #ifdef WIN16 /* never the case */
00216 #  define MS_CALLBACK   _far _loadds
00217 #  define MS_FAR        _far
00218 #else
00219 #  define MS_CALLBACK
00220 #  define MS_FAR
00221 #endif
00222 
00223 #ifdef OPENSSL_NO_STDIO
00224 #  undef OPENSSL_NO_FP_API
00225 #  define OPENSSL_NO_FP_API
00226 #endif
00227 
00228 #if (defined(WINDOWS) || defined(MSDOS))
00229 
00230 #  ifdef __DJGPP__
00231 #    include <unistd.h>
00232 #    include <sys/stat.h>
00233 #    include <sys/socket.h>
00234 #    include <tcp.h>
00235 #    include <netdb.h>
00236 #    define _setmode setmode
00237 #    define _O_TEXT O_TEXT
00238 #    define _O_BINARY O_BINARY
00239 #    undef DEVRANDOM
00240 #    define DEVRANDOM "/dev/urandom\x24"
00241 #  endif /* __DJGPP__ */
00242 
00243 #  ifndef S_IFDIR
00244 #    define S_IFDIR     _S_IFDIR
00245 #  endif
00246 
00247 #  ifndef S_IFMT
00248 #    define S_IFMT      _S_IFMT
00249 #  endif
00250 
00251 #  if !defined(WINNT) && !defined(__DJGPP__)
00252 #    define NO_SYSLOG
00253 #  endif
00254 #  define NO_DIRENT
00255 
00256 #  ifdef WINDOWS
00257 #    if !defined(_WIN32_WCE) && !defined(_WIN32_WINNT)
00258        /*
00259         * Defining _WIN32_WINNT here in e_os.h implies certain "discipline."
00260         * Most notably we ought to check for availability of each specific
00261         * routine with GetProcAddress() and/or guard NT-specific calls with
00262         * GetVersion() < 0x80000000. One can argue that in latter "or" case
00263         * we ought to /DELAYLOAD some .DLLs in order to protect ourselves
00264         * against run-time link errors. This doesn't seem to be necessary,
00265         * because it turned out that already Windows 95, first non-NT Win32
00266         * implementation, is equipped with at least NT 3.51 stubs, dummy
00267         * routines with same name, but which do nothing. Meaning that it's
00268         * apparently sufficient to guard "vanilla" NT calls with GetVersion
00269         * alone, while NT 4.0 and above interfaces ought to be linked with
00270         * GetProcAddress at run-time.
00271         */
00272 #      define _WIN32_WINNT 0x0400
00273 #    endif
00274 #    if !defined(OPENSSL_NO_SOCK) && defined(_WIN32_WINNT)
00275        /*
00276         * Just like defining _WIN32_WINNT including winsock2.h implies
00277         * certain "discipline" for maintaining [broad] binary compatibility.
00278         * As long as structures are invariant among Winsock versions,
00279         * it's sufficient to check for specific Winsock2 API availability
00280         * at run-time [DSO_global_lookup is recommended]...
00281         */
00282 #      include <winsock2.h>
00283 #      include <ws2tcpip.h>
00284        /* yes, they have to be #included prior to <windows.h> */
00285 #    endif
00286 #    include <windows.h>
00287 #    include <stdio.h>
00288 #    include <stddef.h>
00289 #    include <errno.h>
00290 #    include <string.h>
00291 #    ifdef _WIN64
00292 #      define strlen(s) _strlen31(s)
00293 /* cut strings to 2GB */
00294 static unsigned int _strlen31(const char *str)
00295         {
00296         unsigned int len=0;
00297         while (*str && len<0x80000000U) str++, len++;
00298         return len&0x7FFFFFFF;
00299         }
00300 #    endif
00301 #    include <malloc.h>
00302 #    if defined(_MSC_VER) && _MSC_VER<=1200 && defined(_MT) && defined(isspace)
00303        /* compensate for bug in VC6 ctype.h */
00304 #      undef isspace
00305 #      undef isdigit
00306 #      undef isalnum
00307 #      undef isupper
00308 #      undef isxdigit
00309 #    endif
00310 #    if defined(_MSC_VER) && !defined(_DLL) && defined(stdin)
00311 #      if _MSC_VER>=1300
00312 #        undef stdin
00313 #        undef stdout
00314 #        undef stderr
00315          FILE *__iob_func();
00316 #        define stdin  (&__iob_func()[0])
00317 #        define stdout (&__iob_func()[1])
00318 #        define stderr (&__iob_func()[2])
00319 #      elif defined(I_CAN_LIVE_WITH_LNK4049)
00320 #        undef stdin
00321 #        undef stdout
00322 #        undef stderr
00323          /* pre-1300 has __p__iob(), but it's available only in msvcrt.lib,
00324           * or in other words with /MD. Declaring implicit import, i.e.
00325           * with _imp_ prefix, works correctly with all compiler options,
00326           * but without /MD results in LINK warning LNK4049:
00327           * 'locally defined symbol "__iob" imported'.
00328           */
00329          extern FILE *_imp___iob;
00330 #        define stdin  (&_imp___iob[0])
00331 #        define stdout (&_imp___iob[1])
00332 #        define stderr (&_imp___iob[2])
00333 #      endif
00334 #    endif
00335 #  endif
00336 #  include <io.h>
00337 #  include <fcntl.h>
00338 
00339 #  ifdef OPENSSL_SYS_WINCE
00340 #    define OPENSSL_NO_POSIX_IO
00341 #  endif
00342 
00343 #  define ssize_t long
00344 
00345 #  if defined (__BORLANDC__)
00346 #    define _setmode setmode
00347 #    define _O_TEXT O_TEXT
00348 #    define _O_BINARY O_BINARY
00349 #    define _int64 __int64
00350 #    define _kbhit kbhit
00351 #  endif
00352 
00353 #  define EXIT(n) exit(n)
00354 #  define LIST_SEPARATOR_CHAR ';'
00355 #  ifndef X_OK
00356 #    define X_OK        0
00357 #  endif
00358 #  ifndef W_OK
00359 #    define W_OK        2
00360 #  endif
00361 #  ifndef R_OK
00362 #    define R_OK        4
00363 #  endif
00364 #  define OPENSSL_CONF  "openssl.cnf"
00365 #  define SSLEAY_CONF   OPENSSL_CONF
00366 #  define NUL_DEV       "nul"
00367 #  define RFILE         ".rnd"
00368 #  ifdef OPENSSL_SYS_WINCE
00369 #    define DEFAULT_HOME  ""
00370 #  else
00371 #    define DEFAULT_HOME  "C:"
00372 #  endif
00373 
00374 #else /* The non-microsoft world */
00375 
00376 #  ifdef OPENSSL_SYS_VMS
00377 #    define VMS 1
00378   /* some programs don't include stdlib, so exit() and others give implicit 
00379      function warnings */
00380 #    include <stdlib.h>
00381 #    if defined(__DECC)
00382 #      include <unistd.h>
00383 #    else
00384 #      include <unixlib.h>
00385 #    endif
00386 #    define OPENSSL_CONF        "openssl.cnf"
00387 #    define SSLEAY_CONF         OPENSSL_CONF
00388 #    define RFILE               ".rnd"
00389 #    define LIST_SEPARATOR_CHAR ','
00390 #    define NUL_DEV             "NLA0:"
00391   /* We don't have any well-defined random devices on VMS, yet... */
00392 #    undef DEVRANDOM
00393   /* We need to do this since VMS has the following coding on status codes:
00394 
00395      Bits 0-2: status type: 0 = warning, 1 = success, 2 = error, 3 = info ...
00396                The important thing to know is that odd numbers are considered
00397                good, while even ones are considered errors.
00398      Bits 3-15: actual status number
00399      Bits 16-27: facility number.  0 is considered "unknown"
00400      Bits 28-31: control bits.  If bit 28 is set, the shell won't try to
00401                  output the message (which, for random codes, just looks ugly)
00402 
00403      So, what we do here is to change 0 to 1 to get the default success status,
00404      and everything else is shifted up to fit into the status number field, and
00405      the status is tagged as an error, which I believe is what is wanted here.
00406      -- Richard Levitte
00407   */
00408 #    define EXIT(n)             do { int __VMS_EXIT = n; \
00409                                      if (__VMS_EXIT == 0) \
00410                                        __VMS_EXIT = 1; \
00411                                      else \
00412                                        __VMS_EXIT = (n << 3) | 2; \
00413                                      __VMS_EXIT |= 0x10000000; \
00414                                      exit(__VMS_EXIT); } while(0)
00415 #    define NO_SYS_PARAM_H
00416 
00417 #  elif defined(OPENSSL_SYS_NETWARE)
00418 #    include <fcntl.h>
00419 #    include <unistd.h>
00420 #    define NO_SYS_TYPES_H
00421 #    undef  DEVRANDOM
00422 #    ifdef NETWARE_CLIB
00423 #      define getpid GetThreadID
00424        extern int GetThreadID(void);
00425 /* #      include <conio.h> */
00426        extern int kbhit(void);
00427 #    else
00428 #      include <screen.h>
00429 #    endif
00430 #    define NO_SYSLOG
00431 #    define _setmode setmode
00432 #    define _kbhit kbhit
00433 #    define _O_TEXT O_TEXT
00434 #    define _O_BINARY O_BINARY
00435 #    define OPENSSL_CONF   "openssl.cnf"
00436 #    define SSLEAY_CONF    OPENSSL_CONF
00437 #    define RFILE    ".rnd"
00438 #    define LIST_SEPARATOR_CHAR ';'
00439 #    define EXIT(n)  { if (n) printf("ERROR: %d\n", (int)n); exit(n); }
00440 
00441 #  else
00442      /* !defined VMS */
00443 #    ifdef OPENSSL_SYS_MPE
00444 #      define NO_SYS_PARAM_H
00445 #    endif
00446 #    ifdef OPENSSL_UNISTD
00447 #      include OPENSSL_UNISTD
00448 #    else
00449 #      include <unistd.h>
00450 #    endif
00451 #    ifndef NO_SYS_TYPES_H
00452 #      include <sys/types.h>
00453 #    endif
00454 #    if defined(NeXT) || defined(OPENSSL_SYS_NEWS4)
00455 #      define pid_t int /* pid_t is missing on NEXTSTEP/OPENSTEP
00456                          * (unless when compiling with -D_POSIX_SOURCE,
00457                          * which doesn't work for us) */
00458 #    endif
00459 #    if defined(NeXT) || defined(OPENSSL_SYS_NEWS4) || defined(OPENSSL_SYS_SUNOS)
00460 #      define ssize_t int /* ditto */
00461 #    endif
00462 #    ifdef OPENSSL_SYS_NEWS4 /* setvbuf is missing on mips-sony-bsd */
00463 #      define setvbuf(a, b, c, d) setbuffer((a), (b), (d))
00464        typedef unsigned long clock_t;
00465 #    endif
00466 #    ifdef OPENSSL_SYS_WIN32_CYGWIN
00467 #      include <io.h>
00468 #      include <fcntl.h>
00469 #    endif
00470 
00471 #    define OPENSSL_CONF        "openssl.cnf"
00472 #    define SSLEAY_CONF         OPENSSL_CONF
00473 #    define RFILE               ".rnd"
00474 #    define LIST_SEPARATOR_CHAR ':'
00475 #    define NUL_DEV             "/dev/null"
00476 #    define EXIT(n)             exit(n)
00477 #  endif
00478 
00479 #  define SSLeay_getpid()       getpid()
00480 
00481 #endif
00482 
00483 
00484 /*************/
00485 
00486 #ifdef USE_SOCKETS
00487 #  if defined(WINDOWS) || defined(MSDOS)
00488       /* windows world */
00489 
00490 #    ifdef OPENSSL_NO_SOCK
00491 #      define SSLeay_Write(a,b,c)       (-1)
00492 #      define SSLeay_Read(a,b,c)        (-1)
00493 #      define SHUTDOWN(fd)              close(fd)
00494 #      define SHUTDOWN2(fd)             close(fd)
00495 #    elif !defined(__DJGPP__)
00496 #      if defined(_WIN32_WCE) && _WIN32_WCE<410
00497 #        define getservbyname _masked_declaration_getservbyname
00498 #      endif
00499 #      if !defined(IPPROTO_IP)
00500          /* winsock[2].h was included already? */
00501 #        include <winsock.h>
00502 #      endif
00503 #      ifdef getservbyname
00504 #        undef getservbyname
00505          /* this is used to be wcecompat/include/winsock_extras.h */
00506          struct servent* PASCAL getservbyname(const char*,const char*);
00507 #      endif
00508 
00509 #      ifdef _WIN64
00510 /*
00511  * Even though sizeof(SOCKET) is 8, it's safe to cast it to int, because
00512  * the value constitutes an index in per-process table of limited size
00513  * and not a real pointer.
00514  */
00515 #        define socket(d,t,p)   ((int)socket(d,t,p))
00516 #        define accept(s,f,l)   ((int)accept(s,f,l))
00517 #      endif
00518 #      define SSLeay_Write(a,b,c)       send((a),(b),(c),0)
00519 #      define SSLeay_Read(a,b,c)        recv((a),(b),(c),0)
00520 #      define SHUTDOWN(fd)              { shutdown((fd),0); closesocket(fd); }
00521 #      define SHUTDOWN2(fd)             { shutdown((fd),2); closesocket(fd); }
00522 #    else
00523 #      define SSLeay_Write(a,b,c)       write_s(a,b,c,0)
00524 #      define SSLeay_Read(a,b,c)        read_s(a,b,c)
00525 #      define SHUTDOWN(fd)              close_s(fd)
00526 #      define SHUTDOWN2(fd)             close_s(fd)
00527 #    endif
00528 
00529 #  elif defined(MAC_OS_pre_X)
00530 
00531 #    include "MacSocket.h"
00532 #    define SSLeay_Write(a,b,c)         MacSocket_send((a),(b),(c))
00533 #    define SSLeay_Read(a,b,c)          MacSocket_recv((a),(b),(c),true)
00534 #    define SHUTDOWN(fd)                MacSocket_close(fd)
00535 #    define SHUTDOWN2(fd)               MacSocket_close(fd)
00536 
00537 #  elif defined(OPENSSL_SYS_NETWARE)
00538          /* NetWare uses the WinSock2 interfaces by default, but can be configured for BSD
00539          */
00540 #      if defined(NETWARE_BSDSOCK)
00541 #        include <sys/socket.h>
00542 #        include <netinet/in.h>
00543 #        include <sys/time.h>
00544 #        if defined(NETWARE_CLIB)
00545 #          include <sys/bsdskt.h>
00546 #        else
00547 #          include <sys/select.h>
00548 #        endif
00549 #        define INVALID_SOCKET (int)(~0)
00550 #      else
00551 #        include <novsock2.h>
00552 #      endif
00553 #      define SSLeay_Write(a,b,c)   send((a),(b),(c),0)
00554 #      define SSLeay_Read(a,b,c) recv((a),(b),(c),0)
00555 #      define SHUTDOWN(fd)    { shutdown((fd),0); closesocket(fd); }
00556 #      define SHUTDOWN2(fd)      { shutdown((fd),2); closesocket(fd); }
00557 
00558 #  else
00559 
00560 #    ifndef NO_SYS_PARAM_H
00561 #      include <sys/param.h>
00562 #    endif
00563 #    ifdef OPENSSL_SYS_VXWORKS
00564 #      include <time.h> 
00565 #    elif !defined(OPENSSL_SYS_MPE)
00566 #      include <sys/time.h> /* Needed under linux for FD_XXX */
00567 #    endif
00568 
00569 #    include <netdb.h>
00570 #    if defined(OPENSSL_SYS_VMS_NODECC)
00571 #      include <socket.h>
00572 #      include <in.h>
00573 #      include <inet.h>
00574 #    else
00575 #      include <sys/socket.h>
00576 #      ifdef FILIO_H
00577 #        include <sys/filio.h> /* Added for FIONBIO under unixware */
00578 #      endif
00579 #      include <netinet/in.h>
00580 #      if !defined(OPENSSL_SYS_BEOS_R5)
00581 #      include <arpa/inet.h>
00582 #    endif
00583 #    endif
00584 
00585 #    if defined(NeXT) || defined(_NEXT_SOURCE)
00586 #      include <sys/fcntl.h>
00587 #      include <sys/types.h>
00588 #    endif
00589 
00590 #    ifdef OPENSSL_SYS_AIX
00591 #      include <sys/select.h>
00592 #    endif
00593 
00594 #    ifdef __QNX__
00595 #      include <sys/select.h>
00596 #    endif
00597 
00598 #    if defined(sun)
00599 #      include <sys/filio.h>
00600 #    else
00601 #      ifndef VMS
00602 #        include <sys/ioctl.h>
00603 #      else
00604          /* ioctl is only in VMS > 7.0 and when socketshr is not used */
00605 #        if !defined(TCPIP_TYPE_SOCKETSHR) && defined(__VMS_VER) && (__VMS_VER > 70000000)
00606 #          include <sys/ioctl.h>
00607 #        endif
00608 #      endif
00609 #    endif
00610 
00611 #    ifdef VMS
00612 #      include <unixio.h>
00613 #      if defined(TCPIP_TYPE_SOCKETSHR)
00614 #        include <socketshr.h>
00615 #      endif
00616 #    endif
00617 
00618 #    define SSLeay_Read(a,b,c)     read((a),(b),(c))
00619 #    define SSLeay_Write(a,b,c)    write((a),(b),(c))
00620 #    define SHUTDOWN(fd)    { shutdown((fd),0); closesocket((fd)); }
00621 #    define SHUTDOWN2(fd)   { shutdown((fd),2); closesocket((fd)); }
00622 #    ifndef INVALID_SOCKET
00623 #    define INVALID_SOCKET      (-1)
00624 #    endif /* INVALID_SOCKET */
00625 #  endif
00626 
00627 /* Some IPv6 implementations are broken, disable them in known bad
00628  * versions.
00629  */
00630 #  if !defined(OPENSSL_USE_IPV6)
00631 #    if defined(AF_INET6) && !defined(OPENSSL_SYS_BEOS_BONE) && !defined(NETWARE_CLIB)
00632 #      define OPENSSL_USE_IPV6 1
00633 #    else
00634 #      define OPENSSL_USE_IPV6 0
00635 #    endif
00636 #  endif
00637 
00638 #endif
00639 
00640 #if defined(__ultrix)
00641 #  ifndef ssize_t
00642 #    define ssize_t int 
00643 #  endif
00644 #endif
00645 
00646 #if defined(sun) && !defined(__svr4__) && !defined(__SVR4)
00647   /* include headers first, so our defines don't break it */
00648 #include <stdlib.h>
00649 #include <string.h>
00650   /* bcopy can handle overlapping moves according to SunOS 4.1.4 manpage */
00651 # define memmove(s1,s2,n) bcopy((s2),(s1),(n))
00652 # define strtoul(s,e,b) ((unsigned long int)strtol((s),(e),(b)))
00653 extern char *sys_errlist[]; extern int sys_nerr;
00654 # define strerror(errnum) \
00655         (((errnum)<0 || (errnum)>=sys_nerr) ? NULL : sys_errlist[errnum])
00656   /* Being signed SunOS 4.x memcpy breaks ASN1_OBJECT table lookup */
00657 #include "crypto/o_str.h"
00658 # define memcmp OPENSSL_memcmp
00659 #endif
00660 
00661 #ifndef OPENSSL_EXIT
00662 # if defined(MONOLITH) && !defined(OPENSSL_C)
00663 #  define OPENSSL_EXIT(n) return(n)
00664 # else
00665 #  define OPENSSL_EXIT(n) do { EXIT(n); return(n); } while(0)
00666 # endif
00667 #endif
00668 
00669 /***********************************************/
00670 
00671 #define DG_GCC_BUG      /* gcc < 2.6.3 on DGUX */
00672 
00673 #ifdef sgi
00674 #define IRIX_CC_BUG     /* all version of IRIX I've tested (4.* 5.*) */
00675 #endif
00676 #ifdef OPENSSL_SYS_SNI
00677 #define IRIX_CC_BUG     /* CDS++ up to V2.0Bsomething suffered from the same bug.*/
00678 #endif
00679 
00680 #if defined(OPENSSL_SYS_WINDOWS)
00681 #  define strcasecmp _stricmp
00682 #  define strncasecmp _strnicmp
00683 #elif defined(OPENSSL_SYS_VMS)
00684 /* VMS below version 7.0 doesn't have strcasecmp() */
00685 #  include "o_str.h"
00686 #  define strcasecmp OPENSSL_strcasecmp
00687 #  define strncasecmp OPENSSL_strncasecmp
00688 #  define OPENSSL_IMPLEMENTS_strncasecmp
00689 #elif defined(OPENSSL_SYS_OS2) && defined(__EMX__)
00690 #  define strcasecmp stricmp
00691 #  define strncasecmp strnicmp
00692 #elif defined(OPENSSL_SYS_NETWARE)
00693 #  include <string.h>
00694 #  if defined(NETWARE_CLIB)
00695 #    define strcasecmp stricmp
00696 #    define strncasecmp strnicmp
00697 #  endif /* NETWARE_CLIB */
00698 #endif
00699 
00700 #if defined(OPENSSL_SYS_OS2) && defined(__EMX__)
00701 # include <io.h>
00702 # include <fcntl.h>
00703 # define NO_SYSLOG
00704 #endif
00705 
00706 /* vxworks */
00707 #if defined(OPENSSL_SYS_VXWORKS)
00708 #include <ioLib.h>
00709 #include <tickLib.h>
00710 #include <sysLib.h>
00711 
00712 #define TTY_STRUCT int
00713 
00714 #define sleep(a) taskDelay((a) * sysClkRateGet())
00715 
00716 #include <vxWorks.h>
00717 #include <sockLib.h>
00718 #include <taskLib.h>
00719 
00720 #define getpid taskIdSelf
00721 
00722 /* NOTE: these are implemented by helpers in database app!
00723  * if the database is not linked, we need to implement them
00724  * elswhere */
00725 struct hostent *gethostbyname(const char *name);
00726 struct hostent *gethostbyaddr(const char *addr, int length, int type);
00727 struct servent *getservbyname(const char *name, const char *proto);
00728 
00729 #endif
00730 /* end vxworks */
00731 
00732 /* beos */
00733 #if defined(OPENSSL_SYS_BEOS_R5)
00734 #define SO_ERROR 0
00735 #define NO_SYS_UN
00736 #define IPPROTO_IP 0
00737 #include <OS.h>
00738 #endif
00739 
00740 
00741 #ifdef  __cplusplus
00742 }
00743 #endif
00744 
00745 #endif
00746 

Generated on Thu Sep 16 11:29:42 2010 for Policy Component by  doxygen 1.4.7