Watt-32 tcp/ip  2.2 dev-rel.10
wtypes.h
Go to the documentation of this file.
1 
5 /*-
6  * Copyright (c) 1982, 1986, 1991 The Regents of the University of California.
7  * All rights reserved.
8  *
9  * Redistribution and use in source and binary forms, with or without
10  * modification, are permitted provided that the following conditions
11  * are met:
12  * 1. Redistributions of source code must retain the above copyright
13  * notice, this list of conditions and the following disclaimer.
14  * 2. Redistributions in binary form must reproduce the above copyright
15  * notice, this list of conditions and the following disclaimer in the
16  * documentation and/or other materials provided with the distribution.
17  * 3. All advertising materials mentioning features or use of this software
18  * must display the following acknowledgement:
19  * This product includes software developed by the University of
20  * California, Berkeley and its contributors.
21  * 4. Neither the name of the University nor the names of its contributors
22  * may be used to endorse or promote products derived from this software
23  * without specific prior written permission.
24  *
25  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
26  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
28  * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
29  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
30  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
31  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
32  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
33  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
34  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
35  * SUCH DAMAGE.
36  *
37  * @(#)types.h 7.17 (Berkeley) 5/6/91
38  * @(#)wtypes.h Waterloo TCP/IP
39  */
40 
41 /*
42  * the naming <sys/wtypes.h> is required for those compilers that
43  * have <sys/types.h> in the usual place but doesn't define
44  * the following types. This file is included from <sys/socket.h>,
45  * <tcp.h> etc.
46  *
47  * Our basic types (BYTE, WORD, etc.) are defined in the bottom.
48  */
49 
50 #ifndef __SYS_WTYPES_H
51 #define __SYS_WTYPES_H
52 
53 #ifndef __SYS_W32API_H
54 #include <sys/w32api.h>
55 #endif
56 
57 #if defined(__DJGPP__) || defined(__DMC__) || \
58  defined(__MINGW32__) || defined(__POCC__)
59  #include <sys/types.h>
60 #endif
61 
62 #if defined(__DJGPP__)
63  #include <machine/endian.h>
64 #endif
65 
66 #if defined(__MINGW32__) || (defined(__DJGPP__) && DJGPP_MINOR >= 4) || \
67  (defined(__WATCOMC__) && __WATCOMC__ >= 1230) || /* OW 1.3+ */ \
68  defined(__POCC__) /* PellesC */
69  #undef W32_HAVE_STDINT_H
70  #define W32_HAVE_STDINT_H
71  #include <stdint.h> /* doesn't define 'u_char' etc. */
72 #endif
73 
74 /* MSVC 16+ do have <stdint.h> with 'int32_t' etc.
75  */
76 #if defined(_MSC_VER) && (_MSC_VER >= 1600)
77  #undef W32_HAVE_STDINT_H
78  #define W32_HAVE_STDINT_H
79  #include <stdint.h> /* doesn't define 'u_char' etc. */
80 #endif
81 
82 #if !defined(HAVE_U_INT64_T) && !defined(u_int64_t)
83  #if defined(__HIGHC__) || defined(__GNUC__) || defined(__CCDL__) || \
84  defined(__LCC__) || defined(__POCC__)
85  typedef unsigned long long u_int64_t;
86  #define HAVE_U_INT64_T
87 
88  #elif defined(__DMC__) && (__INTSIZE == 4)
89  typedef unsigned long long u_int64_t;
90  #define HAVE_U_INT64_T
91 
92  #elif defined(__WATCOMC__) && defined(__WATCOM_INT64__) && \
93  !(defined(__SMALL__) || defined(__LARGE__))
94  typedef unsigned __int64 u_int64_t;
95  #define HAVE_U_INT64_T
96 
97  #elif defined(_MSC_VER) && (_MSC_VER >= 900)
98  typedef unsigned __int64 u_int64_t;
99  #define HAVE_U_INT64_T
100 
101  #elif defined(__BORLANDC__) && defined(WIN32)
102  typedef unsigned __int64 u_int64_t;
103  #define HAVE_U_INT64_T
104  #endif
105 #endif
106 
107 #if !defined(__GLIBC__)
108  #if !defined(HAVE_U_CHAR) && !defined(u_char)
109  typedef unsigned char u_char;
110  #define HAVE_U_CHAR
111  #endif
112 
113  #if !defined(HAVE_U_SHORT) && !defined(u_short)
114  typedef unsigned short u_short;
115  #define HAVE_U_SHORT
116  #endif
117 
118  #if !defined(HAVE_USHORT) && !defined(ushort)
119  typedef unsigned short ushort; /* SysV compatibility */
120  #define HAVE_USHORT
121  #endif
122 
123  #if !defined(HAVE_U_LONG) && !defined(u_long)
124  typedef unsigned long u_long;
125  #define HAVE_U_LONG
126  #endif
127 
128  #if !defined(HAVE_U_INT) && !defined(u_int)
129  #if defined(__SMALL__) || defined(__LARGE__)
130  typedef unsigned long u_int; /* too many headers assumes u_int is >=32-bit */
131  #else
132  typedef unsigned int u_int;
133  #endif
134  #define HAVE_U_INT
135  #endif
136 
137  #if !defined(HAVE_CADDR_T) && !defined(caddr_t) && !defined(__CYGWIN__)
138  /* !! typedef unsigned long caddr_t; */
139  typedef char *caddr_t;
140  #define HAVE_CADDR_T
141  #endif
142 #endif
143 
144 #if !defined(HAVE_U_INT8_T) && !defined(u_int8_t)
145  typedef unsigned char u_int8_t;
146 #endif
147 
148 #if !defined(HAVE_U_INT16_T) && !defined(u_int16_t)
149  typedef unsigned short u_int16_t;
150 #endif
151 
152 #if !defined(HAVE_U_INT32_T) && !defined(u_int32_t) && !defined(__CYGWIN__)
153  typedef unsigned long u_int32_t;
154 #endif
155 
156 #if !defined(W32_HAVE_STDINT_H)
157  #if !defined(HAVE_INT16_T) && !defined(int16_t)
158  typedef short int16_t;
159  #define HAVE_INT16_T
160  #endif
161 
162  #if !defined(HAVE_INT32_T) && !defined(int32_t) && !defined(__CYGWIN__)
163  typedef long int32_t;
164  #define HAVE_INT32_T
165  #endif
166 #endif
167 
168 #if !defined(HAVE_U_QUAD_T) && !defined(u_quad_t)
169  #define HAVE_U_QUAD_T
170  #ifdef HAVE_U_INT64_T
171  #define u_quad_t u_int64_t
172  #else
173  #define u_quad_t unsigned long
174  #endif
175 #endif
176 
177 #if !defined(IOVEC_DEFINED)
178  #define IOVEC_DEFINED
179  struct iovec {
180  void *iov_base;
181  int iov_len;
182  };
183 #endif
184 
185 #ifndef __BIT_TYPES_DEFINED__
186 #define __BIT_TYPES_DEFINED__
187 #endif
188 
189 #if !defined(FD_SET) /* not djgpp */
190  #undef FD_SETSIZE
191  #define FD_SETSIZE 512
192  #define FD_SET(n, p) ((p)->fd_bits[(n)/8] |= (1 << ((n) & 7)))
193  #define FD_CLR(n, p) ((p)->fd_bits[(n)/8] &= ~(1 << ((n) & 7)))
194  #define FD_ISSET(n,p) ((p)->fd_bits[(n)/8] & (1 << ((n) & 7)))
195  #define FD_ZERO(p) memset ((void*)(p), 0, sizeof(*(p)))
196 
197  typedef struct fd_set {
198  unsigned char fd_bits [(FD_SETSIZE+7)/8];
199  } fd_set;
200 #endif
201 
202 #if defined(__CYGWIN__)
203  #include <endian.h>
204 #else
205 
206  #ifndef LITTLE_ENDIAN
207  #define LITTLE_ENDIAN 1234
208  #endif
209 
210  #ifndef BIG_ENDIAN
211  #define BIG_ENDIAN 4321
212  #endif
213 
214  #if defined(BIG_ENDIAN_MACHINE) || defined(USE_BIGENDIAN)
215  #define BYTE_ORDER BIG_ENDIAN
216  #else
217  #define BYTE_ORDER LITTLE_ENDIAN
218  #endif
219 #endif /* __CYGWIN__ */
220 
221 /*
222  * Pull in Watt-32 basic types.
223  */
224 #if !defined (WATT32_ON_WINDOWS)
225  typedef unsigned char BYTE;
226  typedef unsigned short WORD;
227  typedef unsigned long DWORD;
228  typedef unsigned int UINT;
229  typedef int BOOL;
230 #endif
231 
232 /*
233  * Old compatibility
234  */
235 #if !defined (WATT32_NO_OLDIES)
236  #ifndef byte
237  #define byte unsigned char
238  #endif
239 
240  #ifndef word
241  #define word unsigned short
242  #endif
243 
244  #ifndef dword
245  #define dword unsigned long
246  #endif
247 
248  #ifndef longword
249  #define longword unsigned long
250  #endif
251 #endif
252 
253 /* Link/network-layer address types
254  */
255 typedef BYTE eth_address[6];
256 typedef BYTE tok_address[6];
257 typedef BYTE fddi_address[6];
258 typedef BYTE ax25_address[7];
259 typedef BYTE arcnet_address;
260 typedef BYTE ip6_address[16];
262 #define mac_address eth_address /* !!fix-me: breaks AX25 drivers */
263 
264 /*
265  * Function-ptr types
266  */
267 
270 typedef int (W32_CALL *ProtoHandler) (void *sock, const BYTE *data, unsigned len,
271  const void *tcp_phdr, const void *udp_hdr);
272 
276 typedef int (W32_CALL *UserHandler) (void *sock);
277 
281 typedef void (W32_CALL *VoidProc) (void);
282 
286 typedef int (W32_CALL *icmp_upcall) (void *socket, BYTE icmp_type, BYTE icmp_code);
287 
288 #endif
Definition: wtypes.h:197
int W32_CALL socket(int family, int type, int protocol)
socket().
Definition: socket.c:1794
Definition: wtypes.h:179