OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [ecos-2.0/] [packages/] [net/] [tcpip/] [v2_0/] [include/] [netinet/] [in.h] - Blame information for rev 565

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 27 unneback
//==========================================================================
2
//
3
//      include/netinet/in.h
4
//
5
//      
6
//
7
//==========================================================================
8
//####BSDCOPYRIGHTBEGIN####
9
//
10
// -------------------------------------------
11
//
12
// Portions of this software may have been derived from OpenBSD or other sources,
13
// and are covered by the appropriate copyright disclaimers included herein.
14
//
15
// -------------------------------------------
16
//
17
//####BSDCOPYRIGHTEND####
18
//==========================================================================
19
//#####DESCRIPTIONBEGIN####
20
//
21
// Author(s):    gthomas
22
// Contributors: gthomas
23
// Date:         2000-01-10
24
// Purpose:      
25
// Description:  
26
//              
27
//
28
//####DESCRIPTIONEND####
29
//
30
//==========================================================================
31
 
32
 
33
/*      $OpenBSD: in.h,v 1.27 1999/12/16 21:30:34 deraadt Exp $ */
34
/*      $NetBSD: in.h,v 1.20 1996/02/13 23:41:47 christos Exp $ */
35
 
36
/*
37
 * Copyright (c) 1982, 1986, 1990, 1993
38
 *      The Regents of the University of California.  All rights reserved.
39
 *
40
 * Redistribution and use in source and binary forms, with or without
41
 * modification, are permitted provided that the following conditions
42
 * are met:
43
 * 1. Redistributions of source code must retain the above copyright
44
 *    notice, this list of conditions and the following disclaimer.
45
 * 2. Redistributions in binary form must reproduce the above copyright
46
 *    notice, this list of conditions and the following disclaimer in the
47
 *    documentation and/or other materials provided with the distribution.
48
 * 3. All advertising materials mentioning features or use of this software
49
 *    must display the following acknowledgement:
50
 *      This product includes software developed by the University of
51
 *      California, Berkeley and its contributors.
52
 * 4. Neither the name of the University nor the names of its contributors
53
 *    may be used to endorse or promote products derived from this software
54
 *    without specific prior written permission.
55
 *
56
 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
57
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
58
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
59
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
60
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
61
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
62
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
63
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
64
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
65
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
66
 * SUCH DAMAGE.
67
 *
68
 *      @(#)in.h        8.3 (Berkeley) 1/3/94
69
 */
70
 
71
/*
72
 * Constants and structures defined by the internet system,
73
 * Per RFC 790, September 1981, and numerous additions.
74
 */
75
 
76
#ifndef _NETINET_IN_H_
77
#define _NETINET_IN_H_
78
 
79
/*
80
 * Protocols
81
 */
82
#define IPPROTO_IP              0                /* dummy for IP */
83
#define IPPROTO_HOPOPTS         IPPROTO_IP      /* Hop-by-hop option header. */
84
#define IPPROTO_ICMP            1               /* control message protocol */
85
#define IPPROTO_IGMP            2               /* group mgmt protocol */
86
#define IPPROTO_GGP             3               /* gateway^2 (deprecated) */
87
#define IPPROTO_IPIP            4               /* IP inside IP */
88
#define IPPROTO_IPV4            IPPROTO_IPIP    /* IP inside IP */
89
#define IPPROTO_TCP             6               /* tcp */
90
#define IPPROTO_EGP             8               /* exterior gateway protocol */
91
#define IPPROTO_PUP             12              /* pup */
92
#define IPPROTO_UDP             17              /* user datagram protocol */
93
#define IPPROTO_IDP             22              /* xns idp */
94
#define IPPROTO_TP              29              /* tp-4 w/ class negotiation */
95
#define IPPROTO_IPV6            41              /* IPv6 in IPv6 */
96
#define IPPROTO_ROUTING         43              /* Routing header. */
97
#define IPPROTO_FRAGMENT        44              /* Fragmentation/reassembly header. */
98
#define IPPROTO_RSVP            46              /* resource reservation */
99
#define IPPROTO_ESP             50              /* Encap. Security Payload */
100
#define IPPROTO_AH              51              /* Authentication header */
101
#define IPPROTO_ICMPV6          58              /* ICMP for IPv6 */
102
#define IPPROTO_NONE            59              /* No next header */
103
#define IPPROTO_DSTOPTS         60              /* Destination options header. */
104
#define IPPROTO_EON             80              /* ISO cnlp */
105
#define IPPROTO_ETHERIP         97              /* Ethernet in IPv4 */
106
#define IPPROTO_ENCAP           98              /* encapsulation header */
107
#define IPPROTO_PIM             103             /* Protocol indep. multicast */
108
#define IPPROTO_IPCOMP          108             /* IP Payload Comp. Protocol */
109
#define IPPROTO_RAW             255             /* raw IP packet */
110
 
111
#define IPPROTO_MAX             256
112
 
113
/*
114
 * From FreeBSD:
115
 *
116
 * Local port number conventions:
117
 *
118
 * When a user does a bind(2) or connect(2) with a port number of zero,
119
 * a non-conflicting local port address is chosen.
120
 * The default range is IPPORT_RESERVED through
121
 * IPPORT_USERRESERVED, although that is settable by sysctl.
122
 *
123
 * A user may set the IPPROTO_IP option IP_PORTRANGE to change this
124
 * default assignment range.
125
 *
126
 * The value IP_PORTRANGE_DEFAULT causes the default behavior.
127
 *
128
 * The value IP_PORTRANGE_HIGH changes the range of candidate port numbers
129
 * into the "high" range.  These are reserved for client outbound connections
130
 * which do not want to be filtered by any firewalls.
131
 *
132
 * The value IP_PORTRANGE_LOW changes the range to the "low" are
133
 * that is (by convention) restricted to privileged processes.  This
134
 * convention is based on "vouchsafe" principles only.  It is only secure
135
 * if you trust the remote host to restrict these ports.
136
 *
137
 * The default range of ports and the high range can be changed by
138
 * sysctl(3).  (net.inet.ip.port{hi}{first,last})
139
 *
140
 * Changing those values has bad security implications if you are
141
 * using a a stateless firewall that is allowing packets outside of that
142
 * range in order to allow transparent outgoing connections.
143
 *
144
 * Such a firewall configuration will generally depend on the use of these
145
 * default values.  If you change them, you may find your Security
146
 * Administrator looking for you with a heavy object.
147
 */
148
 
149
/*
150
 * Ports < IPPORT_RESERVED are reserved for
151
 * privileged processes (e.g. root).
152
 * Ports > IPPORT_USERRESERVED are reserved
153
 * for servers, not necessarily privileged.
154
 */
155
#define IPPORT_RESERVED         1024
156
#define IPPORT_USERRESERVED     49151
157
 
158
/*
159
 * Default local port range to use by setting IP_PORTRANGE_HIGH
160
 */
161
#define IPPORT_HIFIRSTAUTO      49152
162
#define IPPORT_HILASTAUTO       65535
163
 
164
/*
165
 * IP Version 4 Internet address (a structure for historical reasons)
166
 */
167
struct in_addr {
168
        in_addr_t s_addr;
169
};
170
 
171
#if 0   /*NRL IPv6*/
172
/*
173
 * IP Version 6 Internet address
174
 */
175
struct in6_addr {
176
        union {
177
                u_int8_t s6u_addr8[16];
178
                u_int16_t s6u_addr16[8];
179
                u_int32_t s6u_addr32[4];
180
        } s6_u;
181
#define s6_addr s6_u.s6u_addr8
182
/*
183
 * The rest are common, but not guaranteed to be portable. 64 bit access are
184
 * not available because the in6_addr in a sockaddr_in6 is not 64 bit aligned.
185
 */
186
#define s6_addr8 s6_u.s6u_addr8
187
#define s6_addr16 s6_u.s6u_addr16
188
#define s6_addr32 s6_u.s6u_addr32
189
};
190
#endif
191
 
192
/* last return value of *_input(), meaning "all job for this pkt is done".  */
193
#define IPPROTO_DONE            257
194
 
195
/*
196
 * Definitions of bits in internet address integers.
197
 * On subnets, the decomposition of addresses to host and net parts
198
 * is done according to subnet mask, not the masks here.
199
 *
200
 * By byte-swapping the constants, we avoid ever having to byte-swap IP
201
 * addresses inside the kernel.  Unfortunately, user-level programs rely
202
 * on these macros not doing byte-swapping.
203
 */
204
#ifdef _KERNEL
205
#define __IPADDR(x)     ((u_int32_t) htonl((u_int32_t)(x)))
206
#else
207
#define __IPADDR(x)     ((u_int32_t)(x))
208
#endif
209
 
210
#define IN_CLASSA(i)            (((u_int32_t)(i) & __IPADDR(0x80000000)) == \
211
                                 __IPADDR(0x00000000))
212
#define IN_CLASSA_NET           __IPADDR(0xff000000)
213
#define IN_CLASSA_NSHIFT        24
214
#define IN_CLASSA_HOST          __IPADDR(0x00ffffff)
215
#define IN_CLASSA_MAX           128
216
 
217
#define IN_CLASSB(i)            (((u_int32_t)(i) & __IPADDR(0xc0000000)) == \
218
                                 __IPADDR(0x80000000))
219
#define IN_CLASSB_NET           __IPADDR(0xffff0000)
220
#define IN_CLASSB_NSHIFT        16
221
#define IN_CLASSB_HOST          __IPADDR(0x0000ffff)
222
#define IN_CLASSB_MAX           65536
223
 
224
#define IN_CLASSC(i)            (((u_int32_t)(i) & __IPADDR(0xe0000000)) == \
225
                                 __IPADDR(0xc0000000))
226
#define IN_CLASSC_NET           __IPADDR(0xffffff00)
227
#define IN_CLASSC_NSHIFT        8
228
#define IN_CLASSC_HOST          __IPADDR(0x000000ff)
229
 
230
#define IN_CLASSD(i)            (((u_int32_t)(i) & __IPADDR(0xf0000000)) == \
231
                                 __IPADDR(0xe0000000))
232
/* These ones aren't really net and host fields, but routing needn't know. */
233
#define IN_CLASSD_NET           __IPADDR(0xf0000000)
234
#define IN_CLASSD_NSHIFT        28
235
#define IN_CLASSD_HOST          __IPADDR(0x0fffffff)
236
#define IN_MULTICAST(i)         IN_CLASSD(i)
237
 
238
#define IN_EXPERIMENTAL(i)      (((u_int32_t)(i) & __IPADDR(0xf0000000)) == \
239
                                 __IPADDR(0xf0000000))
240
#define IN_BADCLASS(i)          (((u_int32_t)(i) & __IPADDR(0xf0000000)) == \
241
                                 __IPADDR(0xf0000000))
242
 
243
#define IN_LOCAL_GROUP(i)       (((u_int32_t)(i) & __IPADDR(0xffffff00)) == \
244
                                 __IPADDR(0xe0000000))
245
 
246
#define INADDR_ANY              __IPADDR(0x00000000)
247
#define INADDR_LOOPBACK         __IPADDR(0x7f000001)
248
#define INADDR_BROADCAST        __IPADDR(0xffffffff)    /* must be masked */
249
#ifndef _KERNEL
250
#define INADDR_NONE             __IPADDR(0xffffffff)    /* -1 return */
251
#endif
252
 
253
#define INADDR_UNSPEC_GROUP     __IPADDR(0xe0000000)    /* 224.0.0.0 */
254
#define INADDR_ALLHOSTS_GROUP   __IPADDR(0xe0000001)    /* 224.0.0.1 */
255
#define INADDR_MAX_LOCAL_GROUP  __IPADDR(0xe00000ff)    /* 224.0.0.255 */
256
 
257
#define IN_LOOPBACKNET          127                     /* official! */
258
 
259
#if 0   /*NRL IPv6*/
260
/*
261
 * Tests for IPv6 address types
262
 */
263
 
264
#define IN6_IS_ADDR_LINKLOCAL(addr) \
265
        (((addr)->s6_addr32[0] & htonl(0xffc00000)) == htonl(0xfe800000))
266
 
267
#define IN6_IS_ADDR_LOOPBACK(addr) \
268
        (((addr)->s6_addr32[0] == 0) && ((addr)->s6_addr32[1] == 0) && \
269
         ((addr)->s6_addr32[2] == 0) && ((addr)->s6_addr32[3] == htonl(1)))
270
 
271
#define IN6_IS_ADDR_MULTICAST(addr) \
272
        ((addr)->s6_addr8[0] == 0xff)
273
 
274
#define IN6_IS_ADDR_SITELOCAL(addr) \
275
        (((addr)->s6_addr32[0] & htonl(0xffc00000)) == htonl(0xfec00000))
276
 
277
#define IN6_IS_ADDR_UNSPECIFIED(addr) \
278
        (((addr)->s6_addr32[0] == 0) && ((addr)->s6_addr32[1] == 0) && \
279
         ((addr)->s6_addr32[2] == 0) && ((addr)->s6_addr32[3] == 0))
280
 
281
#define IN6_IS_ADDR_V4COMPAT(addr) \
282
        (((addr)->s6_addr32[0] == 0) && ((addr)->s6_addr32[1] == 0) && \
283
         ((addr)->s6_addr32[2] == 0) && ((addr)->s6_addr32[3] & ~htonl(1)))
284
 
285
#define IN6_IS_ADDR_V4MAPPED(addr) \
286
        (((addr)->s6_addr32[0] == 0) && ((addr)->s6_addr32[1] == 0) && \
287
         ((addr)->s6_addr32[2] == htonl(0xffff)))
288
 
289
#define IN6_ARE_ADDR_EQUAL(addr1, addr2) \
290
        (((addr1)->s6_addr32[0] == (addr2)->s6_addr32[0]) && \
291
         ((addr1)->s6_addr32[1] == (addr2)->s6_addr32[1]) && \
292
         ((addr1)->s6_addr32[2] == (addr2)->s6_addr32[2]) && \
293
         ((addr1)->s6_addr32[3] == (addr2)->s6_addr32[3]))
294
 
295
/*
296
 * IPv6 Multicast scoping.  The scope is stored
297
 * in the bottom 4 bits of the second byte of the
298
 * multicast address.
299
 */
300
                     /* 0x0 */  /* reserved */
301
#define IN6_NODE_LOCAL  0x1     /* node-local scope */
302
#define IN6_LINK_LOCAL  0x2     /* link-local scope */
303
                     /* 0x3 */  /* (unassigned) */
304
                     /* 0x4 */  /* (unassigned) */
305
#define IN6_SITE_LOCAL  0x5     /* site-local scope */
306
                     /* 0x6 */  /* (unassigned) */
307
                     /* 0x7 */  /* (unassigned) */
308
#define IN6_ORG_LOCAL   0x8     /* organization-local scope */
309
                     /* 0x9 */  /* (unassigned) */
310
                     /* 0xA */  /* (unassigned) */
311
                     /* 0xB */  /* (unassigned) */
312
                     /* 0xC */  /* (unassigned) */
313
                     /* 0xD */  /* (unassigned) */
314
#define IN6_GLOBAL      0xE     /* global scope */
315
                     /* 0xF */  /* reserved */
316
 
317
#define IN6_MSCOPE(addr)        ((addr)->s6_addr8[1] & 0x0f)
318
 
319
#define IN6_IS_ADDR_MC_NODELOCAL(addr) \
320
        (IN6_IS_ADDR_MULTICAST(addr) && (IN6_MSCOPE(addr) == IN6_NODE_LOCAL))
321
#define IN6_IS_ADDR_MC_LINKLOCAL(addr) \
322
        (IN6_IS_ADDR_MULTICAST(addr) && (IN6_MSCOPE(addr) == IN6_LINK_LOCAL))
323
#define IN6_IS_ADDR_MC_SITELOCAL(addr) \
324
        (IN6_IS_ADDR_MULTICAST(addr) && (IN6_MSCOPE(addr) == IN6_SITE_LOCAL))
325
#define IN6_IS_ADDR_MC_ORGLOCAL(addr) \
326
        (IN6_IS_ADDR_MULTICAST(addr) && (IN6_MSCOPE(addr) == IN6_ORG_LOCAL))
327
#define IN6_IS_ADDR_MC_GLOBAL(addr) \
328
        (IN6_IS_ADDR_MULTICAST(addr) && (IN6_MSCOPE(addr) == IN6_GLOBAL))
329
 
330
/*
331
 * Definitions of the IPv6 special addresses
332
 */
333
extern const struct in6_addr in6addr_any;
334
#define IN6ADDR_ANY_INIT {{{ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 }}}
335
 
336
extern const struct in6_addr in6addr_loopback;
337
#define IN6ADDR_LOOPBACK_INIT {{{ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 }}}
338
#endif
339
 
340
/*
341
 * IP Version 4 socket address.
342
 */
343
struct sockaddr_in {
344
        u_int8_t    sin_len;
345
        sa_family_t sin_family;
346
        in_port_t   sin_port;
347
        struct      in_addr sin_addr;
348
        int8_t      sin_zero[8];
349
};
350
 
351
#if 0   /*NRL IPv6*/
352
/*
353
 * IP Version 6 socket address.
354
 */
355
#define SIN6_LEN 1
356
struct sockaddr_in6 {
357
        u_int8_t        sin6_len;
358
        sa_family_t     sin6_family;
359
        in_port_t       sin6_port;
360
        u_int32_t       sin6_flowinfo;
361
        struct in6_addr sin6_addr;
362
        u_int32_t       sin6_scope_id;
363
};
364
#endif
365
 
366
#define INET_ADDRSTRLEN                 16
367
 
368
/*
369
 * Structure used to describe IP options.
370
 * Used to store options internally, to pass them to a process,
371
 * or to restore options retrieved earlier.
372
 * The ip_dst is used for the first-hop gateway when using a source route
373
 * (this gets put into the header proper).
374
 */
375
struct ip_opts {
376
        struct in_addr  ip_dst;         /* first hop, 0 w/o src rt */
377
#if defined(__cplusplus)
378
        int8_t          Ip_opts[40];    /* cannot have same name as class */
379
#else
380
        int8_t          ip_opts[40];    /* actually variable in size */
381
#endif
382
};
383
 
384
/*
385
 * Options for use with [gs]etsockopt at the IP level.
386
 * First word of comment is data type; bool is stored in int.
387
 */
388
#define IP_OPTIONS              1    /* buf/ip_opts; set/get IP options */
389
#define IP_HDRINCL              2    /* int; header is included with data */
390
#define IP_TOS                  3    /* int; IP type of service and preced. */
391
#define IP_TTL                  4    /* int; IP time to live */
392
#define IP_RECVOPTS             5    /* bool; receive all IP opts w/dgram */
393
#define IP_RECVRETOPTS          6    /* bool; receive IP opts for response */
394
#define IP_RECVDSTADDR          7    /* bool; receive IP dst addr w/dgram */
395
#define IP_RETOPTS              8    /* ip_opts; set/get IP options */
396
#define IP_MULTICAST_IF         9    /* in_addr; set/get IP multicast i/f  */
397
#define IP_MULTICAST_TTL        10   /* u_char; set/get IP multicast ttl */
398
#define IP_MULTICAST_LOOP       11   /* u_char; set/get IP multicast loopback */
399
#define IP_ADD_MEMBERSHIP       12   /* ip_mreq; add an IP group membership */
400
#define IP_DROP_MEMBERSHIP      13   /* ip_mreq; drop an IP group membership */
401
 
402
/* 14-17 left empty for future compatibility with FreeBSD */
403
 
404
#define IP_PORTRANGE            19   /* int; range to choose for unspec port */
405
#define IP_AUTH_LEVEL           20   /* u_char; authentication used */
406
#define IP_ESP_TRANS_LEVEL      21   /* u_char; transport encryption */
407
#define IP_ESP_NETWORK_LEVEL    22   /* u_char; full-packet encryption */
408
 
409
#if 0 /* NRL IPv6 */
410
#define IPV6_MULTICAST_IF       23   /* u_int; set/get multicast interface */
411
#define IPV6_MULTICAST_HOPS     24   /* int; set/get multicast hop limit */
412
#define IPV6_MULTICAST_LOOP     25   /* u_int; set/get multicast loopback */
413
#define IPV6_JOIN_GROUP         26   /* ipv6_mreq; join multicast group */
414
#define IPV6_ADD_MEMBERSHIP     IPV6_JOIN_GROUP /* XXX - for compatibility */
415
#define IPV6_LEAVE_GROUP        27   /* ipv6_mreq: leave multicast group */
416
#define IPV6_DROP_MEMBERSHIP    IPV6_LEAVE_GROUP /* XXX - for compatibility */
417
#define IPV6_ADDRFORM           28   /* int; get/set form of returned addrs */
418
#define IPV6_UNICAST_HOPS       29   /* int; get/set unicast hop limit */
419
#define IPV6_PKTINFO            30   /* int; receive in6_pktinfo as cmsg */
420
#define IPV6_HOPLIMIT           31   /* int; receive int hoplimit as cmsg */
421
#define IPV6_NEXTHOP            32   /* int; receive sockaddr_in6 as cmsg */
422
#define IPV6_HOPOPTS            33   /* int; receive hop options as cmsg */
423
#define IPV6_DSTOPTS            34   /* int; receive dst options as cmsg */
424
#define IPV6_RTHDR              35   /* int; receive routing header as cmsg */
425
#define IPV6_PKTOPTIONS         36   /* int; send/receive cmsgs for TCP */
426
#define IPV6_CHECKSUM           37   /* int; offset to place send checksum */
427
#define ICMPV6_FILTER           38   /* struct icmpv6_filter; get/set filter */
428
#define ICMP6_FILTER            ICMP6_FILTER
429
#endif
430
 
431
#define IPSEC_OUTSA             39   /* set the outbound SA for a socket */
432
 
433
#if 0 /*KAME IPSEC*/
434
#define IP_IPSEC_POLICY         ?? /* struct; get/set security policy */
435
#endif
436
 
437
/*
438
 * Security levels - IPsec, not IPSO
439
 */
440
 
441
#define IPSEC_LEVEL_BYPASS      0x00    /* Bypass policy altogether */
442
#define IPSEC_LEVEL_NONE        0x00    /* Send clear, accept any */
443
#define IPSEC_LEVEL_AVAIL       0x01    /* Send secure if SA available */
444
#define IPSEC_LEVEL_USE         0x02    /* Send secure, accept any */
445
#define IPSEC_LEVEL_REQUIRE     0x03    /* Require secure inbound, also use */
446
#define IPSEC_LEVEL_UNIQUE      0x04    /* Use outbound SA that is unique */
447
#define IPSEC_LEVEL_DEFAULT     IPSEC_LEVEL_AVAIL
448
 
449
#define IPSEC_AUTH_LEVEL_DEFAULT IPSEC_LEVEL_DEFAULT
450
#define IPSEC_ESP_TRANS_LEVEL_DEFAULT IPSEC_LEVEL_DEFAULT
451
#define IPSEC_ESP_NETWORK_LEVEL_DEFAULT IPSEC_LEVEL_DEFAULT
452
 
453
#if 0 /* NRL IPv6 */
454
/*
455
 * IPv6 Routing header types
456
 */
457
#define IPV6_RTHDR_TYPE_0       0 /* IPv6 Routing header type 0 */   
458
 
459
#define IPV6_RTHDR_LOOSE        0 /* this hop need not be a neighbor */
460
#define IPV6_RTHDR_STRICT       1 /* this hop must be a neighbor */
461
#endif
462
 
463
/*
464
 * Defaults and limits for options
465
 */
466
#define IP_DEFAULT_MULTICAST_TTL  1     /* normally limit m'casts to 1 hop  */
467
#define IP_DEFAULT_MULTICAST_LOOP 1     /* normally hear sends if a member  */
468
#define IP_MAX_MEMBERSHIPS      20      /* per socket; must fit in one mbuf */
469
 
470
/*
471
 * Argument structure for IP_ADD_MEMBERSHIP and IP_DROP_MEMBERSHIP.
472
 */
473
struct ip_mreq {
474
        struct  in_addr imr_multiaddr;  /* IP multicast address of group */
475
        struct  in_addr imr_interface;  /* local IP address of interface */
476
};
477
 
478
#if 0 /* NRL IPv6 */
479
/*
480
 * Argument structure for IPV6_ADD_MEMBERSHIP and IPV6_DROP_MEMBERSHIP.
481
 */
482
struct ipv6_mreq {
483
        struct  in6_addr        ipv6mr_multiaddr; /* IPv6 multicast addr */
484
        unsigned int            ipv6mr_interface; /* Interface index */
485
};
486
 
487
/*
488
 * Argument structure for IPV6_PKTINFO control messages
489
 */
490
struct in6_pktinfo {
491
        struct in6_addr ipi6_addr;
492
        unsigned int ipi6_ifindex;
493
};
494
#endif
495
 
496
/*
497
 * Argument for IP_PORTRANGE:
498
 * - which range to search when port is unspecified at bind() or connect()
499
 */
500
#define IP_PORTRANGE_DEFAULT    0        /* default range */
501
#define IP_PORTRANGE_HIGH       1       /* "high" - request firewall bypass */
502
#define IP_PORTRANGE_LOW        2       /* "low" - vouchsafe security */
503
 
504
/*
505
 * Buffer lengths for strings containing printable IP addresses
506
 */
507
#define INET_ADDRSTRLEN         16
508
#if 0 /* NRL IPv6 */
509
#define INET6_ADDRSTRLEN        46
510
#endif
511
 
512
/*
513
 * Definitions for inet sysctl operations.
514
 *
515
 * Third level is protocol number.
516
 * Fourth level is desired variable within that protocol.
517
 */
518
#define IPPROTO_MAXID   (IPPROTO_AH + 1)        /* don't list to IPPROTO_MAX */
519
 
520
#define CTL_IPPROTO_NAMES { \
521
        { "ip", CTLTYPE_NODE }, \
522
        { "icmp", CTLTYPE_NODE }, \
523
        { "igmp", CTLTYPE_NODE }, \
524
        { "ggp", CTLTYPE_NODE }, \
525
        { "ip4", CTLTYPE_NODE }, \
526
        { 0, 0 }, \
527
        { "tcp", CTLTYPE_NODE }, \
528
        { 0, 0 }, \
529
        { "egp", CTLTYPE_NODE }, \
530
        { 0, 0 }, \
531
        { 0, 0 }, \
532
        { 0, 0 }, \
533
        { "pup", CTLTYPE_NODE }, \
534
        { 0, 0 }, \
535
        { 0, 0 }, \
536
        { 0, 0 }, \
537
        { 0, 0 }, \
538
        { "udp", CTLTYPE_NODE }, \
539
        { 0, 0 }, \
540
        { 0, 0 }, \
541
        { 0, 0 }, \
542
        { 0, 0 }, \
543
        { 0, 0 }, \
544
        { 0, 0 }, \
545
        { 0, 0 }, \
546
        { 0, 0 }, \
547
        { 0, 0 }, \
548
        { 0, 0 }, \
549
        { 0, 0 }, \
550
        { 0, 0 }, \
551
        { 0, 0 }, \
552
        { 0, 0 }, \
553
        { 0, 0 }, \
554
        { 0, 0 }, \
555
        { 0, 0 }, \
556
        { 0, 0 }, \
557
        { 0, 0 }, \
558
        { 0, 0 }, \
559
        { 0, 0 }, \
560
        { 0, 0 }, \
561
        { 0, 0 }, \
562
        { 0, 0 }, \
563
        { 0, 0 }, \
564
        { 0, 0 }, \
565
        { 0, 0 }, \
566
        { 0, 0 }, \
567
        { 0, 0 }, \
568
        { 0, 0 }, \
569
        { 0, 0 }, \
570
        { 0, 0 }, \
571
        { "esp", CTLTYPE_NODE }, \
572
        { "ah", CTLTYPE_NODE }, \
573
        { 0, 0 }, \
574
        { 0, 0 }, \
575
        { 0, 0 }, \
576
        { 0, 0 }, \
577
        { 0, 0 }, \
578
        { 0, 0 }, \
579
        { 0, 0 }, \
580
        { 0, 0 }, \
581
        { 0, 0 }, \
582
        { 0, 0 }, \
583
        { 0, 0 }, \
584
        { 0, 0 }, \
585
        { 0, 0 }, \
586
        { 0, 0 }, \
587
        { 0, 0 }, \
588
        { 0, 0 }, \
589
        { 0, 0 }, \
590
        { 0, 0 }, \
591
        { 0, 0 }, \
592
        { 0, 0 }, \
593
        { 0, 0 }, \
594
        { 0, 0 }, \
595
        { 0, 0 }, \
596
        { 0, 0 }, \
597
        { 0, 0 }, \
598
        { 0, 0 }, \
599
        { 0, 0 }, \
600
        { 0, 0 }, \
601
        { 0, 0 }, \
602
        { 0, 0 }, \
603
        { 0, 0 }, \
604
        { 0, 0 }, \
605
        { 0, 0 }, \
606
        { 0, 0 }, \
607
        { 0, 0 }, \
608
        { 0, 0 }, \
609
        { 0, 0 }, \
610
        { 0, 0 }, \
611
        { 0, 0 }, \
612
        { 0, 0 }, \
613
        { 0, 0 }, \
614
        { 0, 0 }, \
615
        { 0, 0 }, \
616
        { 0, 0 }, \
617
        { 0, 0 }, \
618
        { "etherip", CTLTYPE_NODE }, \
619
}
620
 
621
/*
622
 * Names for IP sysctl objects
623
 */
624
#define IPCTL_FORWARDING        1       /* act as router */
625
#define IPCTL_SENDREDIRECTS     2       /* may send redirects when forwarding */
626
#define IPCTL_DEFTTL            3       /* default TTL */
627
#ifdef notyet
628
#define IPCTL_DEFMTU            4       /* default MTU */
629
#endif
630
#define IPCTL_SOURCEROUTE       5       /* may perform source routes */
631
#define IPCTL_DIRECTEDBCAST     6       /* default broadcast behavior */
632
#define IPCTL_IPPORT_FIRSTAUTO  7
633
#define IPCTL_IPPORT_LASTAUTO   8
634
#define IPCTL_IPPORT_HIFIRSTAUTO 9
635
#define IPCTL_IPPORT_HILASTAUTO 10
636
#define IPCTL_IPPORT_MAXQUEUE   11
637
#define IPCTL_ENCDEBUG          12
638
#define IPCTL_GIF_TTL           13      /* default TTL for gif encap packet */
639
#define IPCTL_MAXID             14
640
 
641
#define IPCTL_NAMES { \
642
        { 0, 0 }, \
643
        { "forwarding", CTLTYPE_INT }, \
644
        { "redirect", CTLTYPE_INT }, \
645
        { "ttl", CTLTYPE_INT }, \
646
        /* { "mtu", CTLTYPE_INT }, */ { 0, 0 }, \
647
        { "sourceroute", CTLTYPE_INT }, \
648
        { "directed-broadcast", CTLTYPE_INT }, \
649
        { "portfirst", CTLTYPE_INT }, \
650
        { "portlast", CTLTYPE_INT }, \
651
        { "porthifirst", CTLTYPE_INT }, \
652
        { "porthilast", CTLTYPE_INT }, \
653
        { "maxqueue", CTLTYPE_INT }, \
654
        { "encdebug", CTLTYPE_INT }, \
655
        { "gifttl", CTLTYPE_INT }, \
656
}
657
 
658
/* INET6 stuff */
659
#include <netinet6/in6.h>
660
 
661
#ifndef _KERNEL
662
 
663
#include <sys/cdefs.h>
664
 
665
__BEGIN_DECLS
666
int        bindresvport __P((int, struct sockaddr_in *));
667
int        bindresvport_af __P((int, struct sockaddr *, int af));
668
__END_DECLS
669
 
670
#else
671
int        in_broadcast __P((struct in_addr, struct ifnet *));
672
int        in_canforward __P((struct in_addr));
673
int        in_cksum __P((struct mbuf *, int));
674
int        in_localaddr __P((struct in_addr));
675
void       in_socktrim __P((struct sockaddr_in *));
676
char      *inet_ntoa __P((struct in_addr));
677
 
678
#define satosin(sa)     ((struct sockaddr_in *)(sa))
679
#define sintosa(sin)    ((struct sockaddr *)(sin))
680
#define ifatoia(ifa)    ((struct in_ifaddr *)(ifa))
681
#endif
682
#endif /* !_NETINET_IN_H_ */

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.