]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - sys/netatm/port.h
Restore documented tgetstr() behavior.
[FreeBSD/FreeBSD.git] / sys / netatm / port.h
1 /*
2  *
3  * ===================================
4  * HARP  |  Host ATM Research Platform
5  * ===================================
6  *
7  *
8  * This Host ATM Research Platform ("HARP") file (the "Software") is
9  * made available by Network Computing Services, Inc. ("NetworkCS")
10  * "AS IS".  NetworkCS does not provide maintenance, improvements or
11  * support of any kind.
12  *
13  * NETWORKCS MAKES NO WARRANTIES OR REPRESENTATIONS, EXPRESS OR IMPLIED,
14  * INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY
15  * AND FITNESS FOR A PARTICULAR PURPOSE, AS TO ANY ELEMENT OF THE
16  * SOFTWARE OR ANY SUPPORT PROVIDED IN CONNECTION WITH THIS SOFTWARE.
17  * In no event shall NetworkCS be responsible for any damages, including
18  * but not limited to consequential damages, arising from or relating to
19  * any use of the Software or related support.
20  *
21  * Copyright 1994-1998 Network Computing Services, Inc.
22  *
23  * Copies of this Software may be made, however, the above copyright
24  * notice must be reproduced on all copies.
25  *
26  *      @(#) $FreeBSD$
27  *
28  */
29
30 /*
31  * System Configuration
32  * --------------------
33  *
34  * Porting aides
35  *
36  */
37
38 #ifndef _NETATM_PORT_H
39 #define _NETATM_PORT_H
40
41 /*
42  * Try to ensure that this system is supported
43  */
44 #if (defined(BSD) && (BSD >= 199103))
45
46         /* 4.3 BSD Net2 based */
47
48 #elif defined(sun)
49
50         /* SunOS4.x */
51
52 #else
53
54         /* Ooops */
55         #error "Undefined/unsupported system type"
56
57 #endif
58
59
60 /*
61  * Kernel memory management
62  *
63  * KM_ALLOC(size, type, flags)
64  *                      Returns an allocated kernel memory chunk of size bytes.
65  * KM_FREE(addr, size, type)
66  *                      Free a kernel memory chunk of size bytes.
67  * KM_CMP(b1, b2, len)
68  *                      Compares len bytes of data from b1 against b2.
69  * KM_COPY(from, to, len)
70  *                      Copies len bytes of data from from to to.
71  * KM_ZERO(addr, len)
72  *                      Zeros len bytes of data from addr.
73  *
74  */
75 #ifdef ATM_KERNEL
76 #if (defined(BSD) && (BSD >= 199103))
77 #include <sys/malloc.h>
78 #define KM_ALLOC(size, type, flags)     malloc((size), (type), (flags))
79 #define KM_FREE(addr, size, type)       free((addr), (type))
80 #elif defined(sun)
81 #include <sys/kmem_alloc.h>
82 #define KM_ALLOC(size, type, flags)     kmem_alloc(size)
83 #define KM_FREE(addr, size, type)       kmem_free((addr), (size))
84 #endif
85
86 #if defined(BSD)
87 #define KM_CMP(b1, b2, len)             bcmp((void *)(b1), (void *)(b2),\
88                                                 (len))
89 #define KM_COPY(from, to, len)          bcopy((void *)(from), (void *)(to),\
90                                                 (len))
91 #define KM_ZERO(addr, len)              bzero((void *)(addr), (len))
92 #endif
93 #define XM_COPY(f, t, l)        KM_COPY((f), (t), (l))
94
95 #else
96
97 /*
98  * User-space memory management
99  *
100  * UM_ALLOC(size)       Returns an allocated kernel memory chunk of size bytes.
101  * UM_FREE(addr)        Free a kernel memory chunk of size bytes.
102  * UM_COPY(from, to, len)
103  *                      Copies len bytes of data from from to to.
104  * UM_ZERO(addr, len)   Zeros len bytes of data from addr.
105  *
106  */
107 #if (defined(BSD) && (BSD >= 199103))
108 #define UM_ALLOC(size)          malloc((size_t)(size))
109 #define UM_FREE(addr)           free((void *)(addr))
110 #define UM_COPY(from, to, len)  bcopy((void *)(from), (void *)(to),\
111                                                 (size_t)(len))
112 #define UM_ZERO(addr, len)      bzero((void *)(addr), (size_t)(len))
113 #elif defined(sun)
114 #define UM_ALLOC(size)          malloc(size)
115 #define UM_FREE(addr)           free((char *)(addr))
116 #define UM_COPY(from, to, len)  bcopy((char *)(from), (char *)(to), (len))
117 #define UM_ZERO(addr, len)      bzero((char *)(addr), (len))
118
119 #endif
120 #define XM_COPY(f, t, l)        UM_COPY((f), (t), (l))
121
122 #endif  /* ATM_KERNEL */
123
124
125 #ifdef ATM_KERNEL
126 /*
127  * Kernel buffers
128  *
129  * KBuffer              Typedef for a kernel buffer.
130  *
131  * KB_NEXT(bfr)         Access next buffer in chain (r/w).
132  * KB_LEN(bfr)          Access length of data in this buffer (r/w).
133  * KB_QNEXT(bfr)        Access next buffer in queue (r/w).
134  *
135  * KB_ALLOC(bfr, size, flags, type)
136  *                      Allocates a new kernel buffer of at least size bytes.
137  * KB_ALLOCPKT(bfr, size, flags, type)
138  *                      Allocates a new kernel packet header buffer of at
139  *                      least size bytes.
140  * KB_ALLOCEXT(bfr, size, flags, type)
141  *                      Allocates a new kernel buffer with external storage
142  *                      of at least size bytes.
143  * KB_FREEONE(bfr, nxt) Free buffer bfr and set next buffer in chain in nxt.
144  * KB_FREEALL(bfr)      Free bfr's entire buffer chain.
145  * KB_COPY(bfr, off, len, new, flags)
146  *                      Copy len bytes of user data from buffer bfr starting at
147  *                      byte offset off and return new buffer chain in new.
148  *                      If len is KB_COPYALL, copy until end of chain.
149  * KB_COPYDATA(bfr, off, len, datap)
150  *                      Copy data from buffer bfr starting at byte offset off
151  *                      for len bytes into the data area pointed to by datap.
152  *                      Returns the number of bytes not copied to datap.
153  * KB_PULLUP(bfr, n, new)
154  *                      Get at least the first n bytes of data in the buffer 
155  *                      chain headed by bfr contiguous in the first buffer.
156  *                      Returns the (potentially new) head of the chain in new.
157  *                      On failure the chain is freed and NULL is returned.
158  * KB_LINKHEAD(new, head)
159  *                      Link the kernel buffer new at the head of the buffer
160  *                      chain headed by head.  If both new and head are
161  *                      packet header buffers, new will become the packet
162  *                      header for the chain.
163  * KB_LINK(new, prev)
164  *                      Link the kernel buffer new into the buffer chain
165  *                      after the buffer prev.
166  * KB_UNLINKHEAD(head, next)
167  *                      Unlink the kernel buffer from the head of the buffer
168  *                      chain headed by head.  The buffer head will be freed
169  *                      and the new chain head will be placed in next.
170  * KB_UNLINK(old, prev, next)
171  *                      Unlink the kernel buffer old with previous buffer prev
172  *                      from its buffer chain.  The following buffer in the
173  *                      chain will be placed in next and the buffer old will
174  *                      be freed.
175  * KB_ISPKT(bfr)        Tests whether bfr is a packet header buffer.
176  * KB_ISEXT(bfr)        Tests whether bfr has external storage.
177  * KB_BFRSTART(bfr, x, t)
178  *                      Sets x (cast to type t) to point to the start of the
179  *                      buffer space in bfr.
180  * KB_BFREND(bfr, x, t)
181  *                      Sets x (cast to type t) to point one byte past the end
182  *                      of the buffer space in bfr.
183  * KB_BFRLEN(bfr)       Returns length of buffer space in bfr.
184  * KB_DATASTART(bfr, x, t)
185  *                      Sets x (cast to type t) to point to the start of the
186  *                      buffer data contained in bfr.
187  * KB_DATAEND(bfr, x, t)
188  *                      Sets x (cast to type t) to point one byte past the end
189  *                      of the buffer data contained in bfr.
190  * KB_HEADSET(bfr, n)   Sets the start address for buffer data in buffer bfr to
191  *                      n bytes from the beginning of the buffer space.
192  * KB_HEADMOVE(bfr, n)  Adjust buffer data controls to move data down (n > 0) 
193  *                      or up (n < 0) n bytes in the buffer bfr.
194  * KB_HEADADJ(bfr, n)   Adjust buffer data controls to add (n > 0) or subtract
195  *                      (n < 0) n bytes of data to/from the beginning of bfr.
196  * KB_TAILADJ(bfr, n)   Adjust buffer data controls to add (n > 0) or subtract
197  *                      (n < 0) n bytes of data to/from the end of bfr.
198  * KB_TAILALIGN(bfr, n) Set buffer data controls to place an object of size n
199  *                      at the end of bfr, longword aligned.
200  * KB_HEADROOM(bfr, n)  Set n to the amount of buffer space available before
201  *                      the start of data in bfr.
202  * KB_TAILROOM(bfr, n)  Set n to the amount of buffer space available after
203  *                      the end of data in bfr.
204  * KB_PLENGET(bfr, n)   Set n to bfr's packet length.
205  * KB_PLENSET(bfr, n)   Set bfr's packet length to n.
206  * KB_PLENADJ(bfr, n)   Adjust total packet length by n bytes.
207  *
208  */
209 #if defined(BSD)
210 #include <sys/mbuf.h>
211 typedef struct mbuf     KBuffer;
212
213 #define KB_F_WAIT       M_WAIT
214 #define KB_F_NOWAIT     M_DONTWAIT
215
216 #define KB_T_HEADER     MT_HEADER
217 #define KB_T_DATA       MT_DATA
218
219 #define KB_COPYALL      M_COPYALL
220
221 #if BSD >= 199103
222
223 #define KB_NEXT(bfr)            (bfr)->m_next
224 #define KB_LEN(bfr)             (bfr)->m_len
225 #define KB_QNEXT(bfr)           (bfr)->m_nextpkt
226 #define KB_ALLOC(bfr, size, flags, type) {              \
227         if ((size) <= MLEN) {                           \
228                 MGET((bfr), (flags), (type));           \
229         } else                                          \
230                 (bfr) = NULL;                           \
231 }
232 #define KB_ALLOCPKT(bfr, size, flags, type) {           \
233         if ((size) <= MHLEN) {                          \
234                 MGETHDR((bfr), (flags), (type));        \
235         } else                                          \
236                 (bfr) = NULL;                           \
237 }
238 #define KB_ALLOCEXT(bfr, size, flags, type) {           \
239         if ((size) <= MCLBYTES) {                       \
240                 MGET((bfr), (flags), (type));           \
241                 if ((bfr) != NULL) {                    \
242                         MCLGET((bfr), (flags));         \
243                         if (((bfr)->m_flags & M_EXT) == 0) {    \
244                                 m_freem((bfr));         \
245                                 (bfr) = NULL;           \
246                         }                               \
247                 }                                       \
248         } else                                          \
249                 (bfr) = NULL;                           \
250 }
251 #define KB_FREEONE(bfr, nxt) {                          \
252         (nxt) = m_free(bfr);                            \
253 }
254 #define KB_FREEALL(bfr) {                               \
255         m_freem(bfr);                                   \
256 }
257 #define KB_COPY(bfr, off, len, new, flags) {            \
258         (new) = m_copym((bfr), (off), (len), (flags));  \
259 }
260 #define KB_COPYDATA(bfr, off, len, datap)               \
261         (m_copydata((bfr), (off), (len), (datap)), 0)
262 #define KB_PULLUP(bfr, n, new) {                        \
263         (new) = m_pullup((bfr), (n));                   \
264 }
265 #define KB_LINKHEAD(new, head) {                        \
266         if ((head) && KB_ISPKT(new) && KB_ISPKT(head)) {\
267                 M_COPY_PKTHDR((new), (head));           \
268                 (head)->m_flags &= ~M_PKTHDR;           \
269         }                                               \
270         (new)->m_next = (head);                         \
271 }
272 #define KB_LINK(new, prev) {                            \
273         (new)->m_next = (prev)->m_next;                 \
274         (prev)->m_next = (new);                         \
275 }
276 #define KB_UNLINKHEAD(head, next) {                     \
277         MFREE((head), (next));                          \
278 }
279 #define KB_UNLINK(old, prev, next) {                    \
280         MFREE((old), (next));                           \
281         (prev)->m_next = (next);                        \
282 }
283 #define KB_ISPKT(bfr)           (((bfr)->m_flags & M_PKTHDR) != 0)
284 #define KB_ISEXT(bfr)           (((bfr)->m_flags & M_EXT) != 0)
285 #define KB_BFRSTART(bfr, x, t) {                        \
286         if ((bfr)->m_flags & M_EXT)                     \
287                 (x) = (t)((bfr)->m_ext.ext_buf);        \
288         else if ((bfr)->m_flags & M_PKTHDR)             \
289                 (x) = (t)(&(bfr)->m_pktdat);            \
290         else                                            \
291                 (x) = (t)((bfr)->m_dat);                \
292 }
293 #define KB_BFREND(bfr, x, t) {                          \
294         if ((bfr)->m_flags & M_EXT)                     \
295                 (x) = (t)((bfr)->m_ext.ext_buf + (bfr)->m_ext.ext_size);\
296         else if ((bfr)->m_flags & M_PKTHDR)             \
297                 (x) = (t)(&(bfr)->m_pktdat + MHLEN);    \
298         else                                            \
299                 (x) = (t)((bfr)->m_dat + MLEN);         \
300 }
301 #define KB_BFRLEN(bfr)                                  \
302         (((bfr)->m_flags & M_EXT) ? (bfr)->m_ext.ext_size :     \
303                 (((bfr)->m_flags & M_PKTHDR) ? MHLEN : MLEN))
304 #define KB_DATASTART(bfr, x, t) {                       \
305         (x) = mtod((bfr), t);                           \
306 }
307 #define KB_DATAEND(bfr, x, t) {                         \
308         (x) = (t)(mtod((bfr), caddr_t) + (bfr)->m_len); \
309 }
310 #define KB_HEADSET(bfr, n) {                            \
311         if ((bfr)->m_flags & M_EXT)                     \
312                 (bfr)->m_data = (bfr)->m_ext.ext_buf + (n);     \
313         else if ((bfr)->m_flags & M_PKTHDR)             \
314                 (bfr)->m_data = (bfr)->m_pktdat + (n);  \
315         else                                            \
316                 (bfr)->m_data = (bfr)->m_dat + (n);     \
317 }
318 #define KB_HEADMOVE(bfr, n) {                           \
319         (bfr)->m_data += (n);                           \
320 }
321 #define KB_HEADADJ(bfr, n) {                            \
322         (bfr)->m_len += (n);                            \
323         (bfr)->m_data -= (n);                           \
324 }
325 #define KB_TAILADJ(bfr, n) {                            \
326         (bfr)->m_len += (n);                            \
327 }
328 #define KB_TAILALIGN(bfr, n) {                          \
329         (bfr)->m_len = (n);                             \
330         if ((bfr)->m_flags & M_EXT)                     \
331                 (bfr)->m_data = (caddr_t)(((u_int)(bfr)->m_ext.ext_buf  \
332                         + (bfr)->m_ext.ext_size - (n)) & ~(sizeof(long) - 1));\
333         else                                            \
334                 (bfr)->m_data = (caddr_t)(((u_int)(bfr)->m_dat + MLEN - (n)) \
335                         & ~(sizeof(long) - 1));         \
336 }
337 #define KB_HEADROOM(bfr, n) {                           \
338         /* n = M_LEADINGSPACE(bfr) XXX */               \
339         (n) = ((bfr)->m_flags & M_EXT ? (bfr)->m_data - (bfr)->m_ext.ext_buf : \
340                 (bfr)->m_flags & M_PKTHDR ? (bfr)->m_data - (bfr)->m_pktdat : \
341                         (bfr)->m_data - (bfr)->m_dat);  \
342 }
343 #define KB_TAILROOM(bfr, n) {                           \
344         (n) = M_TRAILINGSPACE(bfr);                     \
345 }
346 #define KB_PLENGET(bfr, n) {                            \
347         (n) = (bfr)->m_pkthdr.len;                      \
348 }
349 #define KB_PLENSET(bfr, n) {                            \
350         (bfr)->m_pkthdr.len = (n);                      \
351 }
352 #define KB_PLENADJ(bfr, n) {                            \
353         (bfr)->m_pkthdr.len += (n);                     \
354 }
355
356
357 #else   /* ! BSD >= 199103 */
358
359
360 #define KB_NEXT(bfr)            (bfr)->m_next
361 #define KB_LEN(bfr)             (bfr)->m_len
362 #define KB_QNEXT(bfr)           (bfr)->m_act
363 #define KB_ALLOC(bfr, size, flags, type) {              \
364         if ((size) <= MLEN) {                           \
365                 MGET((bfr), (flags), (type));           \
366         } else                                          \
367                 (bfr) = NULL;                           \
368 }
369 #define KB_ALLOCPKT(bfr, size, flags, type) {           \
370         if ((size) <= MLEN) {                           \
371                 MGET((bfr), (flags), (type));           \
372         } else                                          \
373                 (bfr) = NULL;                           \
374 }
375 #define KB_ALLOCEXT(bfr, size, flags, type) {           \
376         if ((size) <= MCLBYTES) {                       \
377                 MGET((bfr), (flags), (type));           \
378                 if ((bfr) != NULL) {                    \
379                         MCLGET(bfr);                    \
380                         if ((bfr)->m_len != MCLBYTES) { \
381                                 m_freem((bfr));         \
382                                 (bfr) = NULL;           \
383                         }                               \
384                 }                                       \
385         } else                                          \
386                 (bfr) = NULL;                           \
387 }
388 #define KB_FREEONE(bfr, nxt) {                          \
389         (nxt) = m_free(bfr);                            \
390 }
391 #define KB_FREEALL(bfr) {                               \
392         m_freem(bfr);                                   \
393 }
394 #define KB_COPY(bfr, off, len, new, flags) {            \
395         (new) = m_copy((bfr), (off), (len));            \
396 }
397 #define KB_COPYDATA(bfr, off, len, datap)               \
398         m_cpytoc((bfr), (off), (len), (datap))
399 #define KB_PULLUP(bfr, n, new) {                        \
400         (new) = m_pullup((bfr), (n));                   \
401 }
402 #define KB_LINKHEAD(new, head) {                        \
403         (new)->m_next = (head);                         \
404 }
405 #define KB_LINK(new, prev) {                            \
406         (new)->m_next = (prev)->m_next;                 \
407         (prev)->m_next = (new);                         \
408 }
409 #define KB_UNLINKHEAD(head, next) {                     \
410         MFREE((head), (next));                          \
411 }
412 #define KB_UNLINK(old, prev, next) {                    \
413         MFREE((old), (next));                           \
414         (prev)->m_next = (next);                        \
415 }
416 #define KB_ISPKT(bfr)           (0)
417 #define KB_ISEXT(bfr)           M_HASCL(bfr)
418 #define KB_BFRSTART(bfr, x, t) {                        \
419         if (M_HASCL(bfr)) {                             \
420                 if ((bfr)->m_cltype == MCL_STATIC)      \
421                         (x) = (t)(mtod((bfr), int) & ~(MCLBYTES - 1));  \
422                 else                                    \
423                         (x) = (t)NULL;                  \
424         } else                                          \
425                 (x) = (t)((bfr)->m_dat);                \
426 }
427 #define KB_BFREND(bfr, x, t) {                          \
428         if (M_HASCL(bfr)) {                             \
429                 if ((bfr)->m_cltype == MCL_STATIC)      \
430                         (x) = (t)((mtod((bfr), int) & ~(MCLBYTES - 1))  \
431                                 + MCLBYTES);            \
432                 else                                    \
433                         (x) = (t)NULL;                  \
434         } else                                          \
435                 (x) = (t)((bfr)->m_dat + MLEN);         \
436 }
437 #define KB_BFRLEN(bfr)                                  \
438         (M_HASCL(bfr) ? (((bfr)->m_cltype == MCL_STATIC) ? MCLBYTES : 0) : MLEN)
439 #define KB_DATASTART(bfr, x, t) {                       \
440         (x) = mtod((bfr), t);                           \
441 }
442 #define KB_DATAEND(bfr, x, t) {                         \
443         (x) = (t)(mtod((bfr), caddr_t) + (bfr)->m_len); \
444 }
445 #define KB_HEADSET(bfr, n) {                            \
446         if (M_HASCL(bfr)) {                             \
447                 /* Assume cluster buffer is empty XXX */\
448                 (bfr)->m_off += (n);                    \
449         } else                                          \
450                 (bfr)->m_off = MMINOFF + (n);           \
451 }
452 #define KB_HEADMOVE(bfr, n) {                           \
453         (bfr)->m_off += (n);                            \
454 }
455 #define KB_HEADADJ(bfr, n) {                            \
456         (bfr)->m_len += (n);                            \
457         (bfr)->m_off -= (n);                            \
458 }
459 #define KB_TAILADJ(bfr, n) {                            \
460         (bfr)->m_len += (n);                            \
461 }
462 #define KB_TAILALIGN(bfr, n) {                          \
463         (bfr)->m_len = (n);                             \
464         if (M_HASCL(bfr)) {                             \
465                 if ((bfr)->m_cltype == MCL_STATIC)      \
466                         (bfr)->m_off = (int)(((mtod((bfr), int)         \
467                                 & ~(MCLBYTES - 1)) + MCLBYTES - (n))    \
468                                 & ~(sizeof(long) - 1)) - (int)(bfr);    \
469                 /* Out of luck for loaned buffers */    \
470         } else                                          \
471                 (bfr)->m_off = (MMAXOFF - (n))  & ~(sizeof(long) - 1);  \
472 }
473 #define KB_HEADROOM(bfr, n) {                           \
474         if (M_HASCL(bfr)) {                             \
475                 if ((bfr)->m_cltype == MCL_STATIC)      \
476                         (n) = mtod((bfr), int) & (MCLBYTES - 1);        \
477                 else                                    \
478                         (n) = 0;                        \
479         } else                                          \
480                 (n) = (bfr)->m_off - MMINOFF;           \
481 }
482 #define KB_TAILROOM(bfr, n) {                           \
483         if (M_HASCL(bfr)) {                             \
484                 if ((bfr)->m_cltype == MCL_STATIC)      \
485                         (n) = MCLBYTES - ((mtod((bfr), int) + (bfr)->m_len) \
486                                 & (MCLBYTES - 1));      \
487                 else                                    \
488                         (n) = 0;                        \
489         } else                                          \
490                 (n) = MMAXOFF - ((bfr)->m_off + (bfr)->m_len);  \
491 }
492 #define KB_PLENGET(bfr, n) {                            \
493         struct mbuf     *zz;                            \
494         for ((n) = 0, zz = (bfr); zz; zz = zz->m_next)  \
495                 (n) += zz->m_len;                       \
496 }
497 #define KB_PLENSET(bfr, n) {                            \
498 }
499 #define KB_PLENADJ(bfr, n) {                            \
500 }
501
502
503 #endif  /* ! BSD >= 199103 */
504
505 #endif  /* defined(BSD) */
506
507
508 /*
509  * Kernel time
510  *
511  * KTimeout_ret         Typedef for timeout() function return
512  *
513  * KT_TIME(t)           Sets t to the current time.
514  *
515  */
516 #if (defined(BSD) && (BSD >= 199306))
517 typedef void    KTimeout_ret;
518 #else
519 typedef int     KTimeout_ret;
520 #endif
521 #if (defined(BSD) && (BSD >= 199103))
522 #define KT_TIME(t)      microtime(&t)
523 #elif defined(sun)
524 #define KT_TIME(t)      uniqtime(&t)
525 #else
526 #define KT_TIME(t)      ((t) = time)
527 #endif
528
529 #endif  /* ATM_KERNEL */
530
531 #ifndef NTOHL
532 #if BYTE_ORDER == BIG_ENDIAN
533 #define NTOHL(x)        (x)
534 #define NTOHS(x)        (x)
535 #define HTONL(x)        (x)
536 #define HTONS(x)        (x)
537 #else
538 #define NTOHL(x)        (x) = ntohl((u_long)(x))
539 #define NTOHS(x)        (x) = ntohs((u_short)(x))
540 #define HTONL(x)        (x) = htonl((u_long)(x))
541 #define HTONS(x)        (x) = htons((u_short)(x))
542 #endif
543 #endif  /* NTOHL */
544
545 #ifndef MAX
546 #define MAX(a,b)        max((a),(b))
547 #endif
548 #ifndef MIN
549 #define MIN(a,b)        min((a),(b))
550 #endif
551
552 #if (!(defined(BSD) && (BSD >= 199306)))
553 #ifndef __BIT_TYPES_DEFINED__
554 #define __BIT_TYPES_DEFINED__
555 typedef char            int8_t;
556 typedef unsigned char   u_int8_t;
557 typedef short           int16_t;
558 typedef unsigned short  u_int16_t;
559 typedef int             int32_t;
560 typedef unsigned int    u_int32_t;
561 #endif
562 #endif
563
564 #endif  /* _NETATM_PORT_H */