home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / detk45he.zip / types.h < prev    next >
Text File  |  1999-05-11  |  5KB  |  157 lines

  1. /*-
  2.  * Copyright (c) 1982, 1986, 1991, 1993, 1994
  3.  *      The Regents of the University of California.  All rights reserved.
  4.  * (c) UNIX System Laboratories, Inc.
  5.  * All or some portions of this file are derived from material licensed
  6.  * to the University of California by American Telephone and Telegraph
  7.  * Co. or Unix System Laboratories, Inc. and are reproduced herein with
  8.  * the permission of UNIX System Laboratories, Inc.
  9.  *
  10.  * Redistribution and use in source and binary forms, with or without
  11.  * modification, are permitted provided that the following conditions
  12.  * are met:
  13.  * 1. Redistributions of source code must retain the above copyright
  14.  *    notice, this list of conditions and the following disclaimer.
  15.  * 2. Redistributions in binary form must reproduce the above copyright
  16.  *    notice, this list of conditions and the following disclaimer in the
  17.  *    documentation and/or other materials provided with the distribution.
  18.  * 3. All advertising materials mentioning features or use of this software
  19.  *    must display the following acknowledgement:
  20.  *      This product includes software developed by the University of
  21.  *      California, Berkeley and its contributors.
  22.  * 4. Neither the name of the University nor the names of its contributors
  23.  *    may be used to endorse or promote products derived from this software
  24.  *    without specific prior written permission.
  25.  *
  26.  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  27.  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  28.  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  29.  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  30.  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  31.  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  32.  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  33.  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  34.  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  35.  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  36.  * SUCH DAMAGE.
  37.  *
  38.  *      @(#)types.h     8.6 (Berkeley) 2/19/95
  39.  */
  40.  
  41. #ifndef _TYPES_H_
  42. #define _TYPES_H_
  43.  
  44. #ifdef TCPV40HDRS
  45. #include <stack16\types.h>
  46. #else
  47. /* Machine type dependent parameters. */
  48. #include <machine/ansi.h>
  49. #include <machine/types.h>
  50.  
  51. #ifndef _POSIX_SOURCE
  52. typedef unsigned char   u_char;
  53. typedef unsigned short  u_short;
  54. typedef unsigned long   u_long;
  55. typedef unsigned short  ushort;         /* Sys V compatibility */
  56. #ifdef __32BIT__
  57. typedef unsigned int    u_int;
  58. typedef unsigned int    uint;           /* Sys V compatibility */
  59. #else
  60. typedef unsigned long int u_int;
  61. typedef unsigned long int uint;         /* Sys V compatibility */
  62. #endif
  63. #endif
  64.  
  65. #ifdef __32BIT__
  66. typedef int             long_int;       /* 32-bit compilers */
  67. #else
  68. typedef long int        long_int;       /* 16-bit compilers */
  69. #endif
  70.  
  71. typedef char *          caddr_t;        /* core address */
  72. typedef int32_t         pid_t;          /* process id */
  73.  
  74. /*
  75.  * This belongs in unistd.h, but is placed here to ensure that programs
  76.  * casting the second parameter of lseek to off_t will get the correct
  77.  * version of lseek.
  78.  */
  79. #ifndef KERNEL
  80. #include <sys/cdefs.h>
  81. #endif
  82.  
  83. #include <machine/endian.h>
  84.  
  85. #ifdef  _BSD_SIZE_T_
  86. typedef _BSD_SIZE_T_    size_t;
  87. #undef  _BSD_SIZE_T_
  88. #endif
  89.  
  90. #ifdef  _BSD_SSIZE_T_
  91. typedef _BSD_SSIZE_T_   ssize_t;
  92. #undef  _BSD_SSIZE_T_
  93. #endif
  94.  
  95. #ifndef _POSIX_SOURCE
  96. #define NBBY    8               /* number of bits in a byte */
  97.  
  98. /*
  99.  * Select uses bit masks of file descriptors in longs.  These macros
  100.  * manipulate such bit fields (the filesystem macros use chars).
  101.  * FD_SETSIZE may be defined by the user, but the default here should
  102.  * be enough for most uses.
  103.  */
  104. #ifndef FD_SETSIZE
  105. #define FD_SETSIZE      64
  106. #endif
  107.  
  108. #pragma pack(4)
  109. typedef struct fd_set {
  110.         u_short fd_count;               /* how many are SET? */
  111.         int     fd_array[FD_SETSIZE];   /* an array of SOCKETs */
  112. } fd_set;
  113. #pragma pack()
  114.  
  115.  
  116. #ifndef KERNEL
  117. __BEGIN_DECLS
  118. extern int _System __TCPFDIsSet __TCPPROTO((int, fd_set *));
  119. __END_DECLS
  120. #endif
  121.  
  122. #define FD_CLR(fd, set) do { \
  123.     u_int __i; \
  124.     for (__i = 0; __i < ((fd_set *)(set))->fd_count ; __i++) { \
  125.         if (((fd_set *)(set))->fd_array[__i] == fd) { \
  126.             while (__i < ((fd_set *)(set))->fd_count-1) { \
  127.                 ((fd_set *)(set))->fd_array[__i] = \
  128.                     ((fd_set *)(set))->fd_array[__i+1]; \
  129.                 __i++; \
  130.             } \
  131.             ((fd_set *)(set))->fd_count--; \
  132.             break; \
  133.         } \
  134.     } \
  135. } while(0)
  136.  
  137. #define FD_SET(fd, set) do { \
  138.     if (((fd_set *)(set))->fd_count < FD_SETSIZE) \
  139.         ((fd_set *)(set))->fd_array[((fd_set *)(set))->fd_count++]=fd;\
  140. } while(0)
  141.  
  142. #define FD_ZERO(set) (((fd_set *)(set))->fd_count=0)
  143.  
  144. #define FD_ISSET(fd, set) __TCPFDIsSet((int)fd, (fd_set *)set)
  145.  
  146. #define FD_COPY(f, t)   memcpy(t, f, sizeof(*(f)))
  147.  
  148. #endif /* !_POSIX_SOURCE */
  149.  
  150.  
  151. /* OS/2 additions */
  152. #define MAXSOCKETS 32768
  153. #define BSDMAXSOCKETS 2048
  154.  
  155. #endif /* TCPV40HDRS */
  156. #endif /* _TYPES_H_ */
  157.