in.h

Go to the documentation of this file.
00001 // © Portions copyright (c) 2006 Nokia Corporation.  All rights reserved.
00002 
00003 /*-
00004  * Copyright (c) 1982, 1986, 1990, 1993
00005  *      The Regents of the University of California.  All rights reserved.
00006  *
00007  * Redistribution and use in source and binary forms, with or without
00008  * modification, are permitted provided that the following conditions
00009  * are met:
00010  * 1. Redistributions of source code must retain the above copyright
00011  *    notice, this list of conditions and the following disclaimer.
00012  * 2. Redistributions in binary form must reproduce the above copyright
00013  *    notice, this list of conditions and the following disclaimer in the
00014  *    documentation and/or other materials provided with the distribution.
00015  * 4. Neither the name of the University nor the names of its contributors
00016  *    may be used to endorse or promote products derived from this software
00017  *    without specific prior written permission.
00018  *
00019  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
00020  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00021  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00022  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
00023  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
00024  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
00025  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
00026  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
00027  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
00028  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
00029  * SUCH DAMAGE.
00030  *
00031  *      @(#)in.h        8.3 (Berkeley) 1/3/94
00032  * $FreeBSD: src/sys/netinet/in.h,v 1.90.2.3 2005/10/02 15:45:47 andre Exp $
00033  */
00034 
00035 #ifndef _NETINET_IN_H_
00036 #define _NETINET_IN_H_
00037 
00038 #include <sys/cdefs.h>
00039 
00040 #ifdef __SYMBIAN32__
00041 #include <sys/types.h>
00042 #else
00043 #include <sys/_types.h>
00044 // __SYMBIAN32__
00045 #endif
00046 
00047 #include <machine/endian.h>
00048 
00049 /* Protocols common to RFC 1700, POSIX, and X/Open. */
00050 #ifdef __SYMBIAN32__
00051 #define IPPROTO_IP              0x100   /* KProtocolInetIp */
00052 #else
00053 #define IPPROTO_IP              0               /* dummy for IP */
00054 // __SYMBIAN32__
00055 #endif
00056 #define IPPROTO_ICMP            1               /* control message protocol KProtocolInetIcmp */
00057 #define IPPROTO_TCP             6               /* tcp  KProtocolInetTcp */
00058 #define IPPROTO_UDP             17              /* user datagram protocol KProtocolInetUdp */
00059 
00060 #define INADDR_ANY              (u_int32_t)0x00000000
00061 #define INADDR_BROADCAST        (u_int32_t)0xffffffff   /* must be masked */
00062 
00063 #ifndef _UINT8_T_DECLARED
00064 typedef __uint8_t               uint8_t;
00065 #define _UINT8_T_DECLARED
00066 #endif
00067 
00068 #ifndef _UINT16_T_DECLARED
00069 typedef __uint16_t              uint16_t;
00070 #define _UINT16_T_DECLARED
00071 #endif
00072 
00073 #ifndef _UINT32_T_DECLARED
00074 typedef __uint32_t              uint32_t;
00075 #define _UINT32_T_DECLARED
00076 #endif
00077 
00078 #ifndef _IN_ADDR_T_DECLARED
00079 typedef uint32_t                in_addr_t;
00080 #define _IN_ADDR_T_DECLARED
00081 #endif
00082 
00083 #ifndef _IN_PORT_T_DECLARED
00084 typedef uint16_t                in_port_t;
00085 #define _IN_PORT_T_DECLARED
00086 #endif
00087 
00088 #ifndef _SA_FAMILY_T_DECLARED
00089 typedef __sa_family_t           sa_family_t;
00090 #define _SA_FAMILY_T_DECLARED
00091 #endif
00092 
00093 /* Internet address (a structure for historical reasons). */
00094 #ifndef _STRUCT_IN_ADDR_DECLARED
00095 struct in_addr {
00096         in_addr_t s_addr;
00097 };
00098 #define _STRUCT_IN_ADDR_DECLARED
00099 #endif
00100 
00101 /* Socket address, internet style. */
00102 #ifdef __SYMBIAN32__
00103 struct sockaddr_in {
00104         u_short sin_family;
00105         u_short sin_port;
00106         struct  in_addr sin_addr;
00107         char    sin_zero[20];
00108 };
00109 #else
00110 struct sockaddr_in {
00111         uint8_t sin_len;
00112         sa_family_t     sin_family;
00113         in_port_t       sin_port;
00114         struct  in_addr sin_addr;
00115         char    sin_zero[8];
00116 };
00117 // __SYMBIAN32__
00118 #endif
00119 
00120 #ifdef __SYMBIAN32__
00121 #define SOL_IP          0x100   /* options for IP level KSolInetIp */
00122 #define SOL_TCP         0x106   /* options for TCP level KSolInetTcp */
00123 
00124 /*
00125  * User-settable options (used with setsockopt).
00126  */
00127 #define TCP_NODELAY     0x304   /* don't delay send to coalesce packets KSoTcpNoDelay */
00128 #define TCP_MAXSEG      0x303   /* set maximum segment size KSoTcpMaxSegSize */
00129 
00130 //__SYMBIAN32__
00131 #endif
00132 
00133 #ifndef _KERNEL
00134 
00135 #ifndef _BYTEORDER_PROTOTYPED
00136 #define _BYTEORDER_PROTOTYPED
00137 __BEGIN_DECLS
00138 IMPORT_C uint32_t       htonl(uint32_t);
00139 IMPORT_C uint16_t       htons(uint16_t);
00140 uint32_t        ntohl(uint32_t);
00141 uint16_t        ntohs(uint16_t);
00142 __END_DECLS
00143 #endif
00144 
00145 #ifndef _BYTEORDER_FUNC_DEFINED
00146 #define _BYTEORDER_FUNC_DEFINED
00147 #define htonl(x)        __htonl(x)
00148 #define htons(x)        __htons(x)
00149 #define ntohl(x)        __ntohl(x)
00150 #define ntohs(x)        __ntohs(x)
00151 #endif
00152 
00153 #endif /* !_KERNEL */
00154 
00155 #if __POSIX_VISIBLE >= 200112
00156 #define IPPROTO_RAW             255             /* raw IP packet */
00157 #define INET_ADDRSTRLEN         16
00158 #endif
00159 
00160 #if __BSD_VISIBLE
00161 /*
00162  * Constants and structures defined by the internet system,
00163  * Per RFC 790, September 1981, and numerous additions.
00164  */
00165 
00166 /*
00167  * Protocols (RFC 1700)
00168  */
00169 #define IPPROTO_HOPOPTS         0               /* IP6 hop-by-hop options */
00170 #define IPPROTO_IGMP            2               /* group mgmt protocol */
00171 #define IPPROTO_GGP             3               /* gateway^2 (deprecated) */
00172 #define IPPROTO_IPV4            4               /* IPv4 encapsulation */
00173 #define IPPROTO_IPIP            IPPROTO_IPV4    /* for compatibility */
00174 #define IPPROTO_ST              7               /* Stream protocol II */
00175 #define IPPROTO_EGP             8               /* exterior gateway protocol */
00176 #define IPPROTO_PIGP            9               /* private interior gateway */
00177 #define IPPROTO_RCCMON          10              /* BBN RCC Monitoring */
00178 #define IPPROTO_NVPII           11              /* network voice protocol*/
00179 #define IPPROTO_PUP             12              /* pup */
00180 #define IPPROTO_ARGUS           13              /* Argus */
00181 #define IPPROTO_EMCON           14              /* EMCON */
00182 #define IPPROTO_XNET            15              /* Cross Net Debugger */
00183 #define IPPROTO_CHAOS           16              /* Chaos*/
00184 #define IPPROTO_MUX             18              /* Multiplexing */
00185 #define IPPROTO_MEAS            19              /* DCN Measurement Subsystems */
00186 #define IPPROTO_HMP             20              /* Host Monitoring */
00187 #define IPPROTO_PRM             21              /* Packet Radio Measurement */
00188 #define IPPROTO_IDP             22              /* xns idp */
00189 #define IPPROTO_TRUNK1          23              /* Trunk-1 */
00190 #define IPPROTO_TRUNK2          24              /* Trunk-2 */
00191 #define IPPROTO_LEAF1           25              /* Leaf-1 */
00192 #define IPPROTO_LEAF2           26              /* Leaf-2 */
00193 #define IPPROTO_RDP             27              /* Reliable Data */
00194 #define IPPROTO_IRTP            28              /* Reliable Transaction */
00195 #define IPPROTO_TP              29              /* tp-4 w/ class negotiation */
00196 #define IPPROTO_BLT             30              /* Bulk Data Transfer */
00197 #define IPPROTO_NSP             31              /* Network Services */
00198 #define IPPROTO_INP             32              /* Merit Internodal */
00199 #define IPPROTO_SEP             33              /* Sequential Exchange */
00200 #define IPPROTO_3PC             34              /* Third Party Connect */
00201 #define IPPROTO_IDPR            35              /* InterDomain Policy Routing */
00202 #define IPPROTO_XTP             36              /* XTP */
00203 #define IPPROTO_DDP             37              /* Datagram Delivery */
00204 #define IPPROTO_CMTP            38              /* Control Message Transport */
00205 #define IPPROTO_TPXX            39              /* TP++ Transport */
00206 #define IPPROTO_IL              40              /* IL transport protocol */
00207 #define IPPROTO_IPV6            41              /* IP6 header */
00208 #define IPPROTO_SDRP            42              /* Source Demand Routing */
00209 #define IPPROTO_ROUTING         43              /* IP6 routing header */
00210 #define IPPROTO_FRAGMENT        44              /* IP6 fragmentation header */
00211 #define IPPROTO_IDRP            45              /* InterDomain Routing*/
00212 #define IPPROTO_RSVP            46              /* resource reservation */
00213 #define IPPROTO_GRE             47              /* General Routing Encap. */
00214 #define IPPROTO_MHRP            48              /* Mobile Host Routing */
00215 #define IPPROTO_BHA             49              /* BHA */
00216 #define IPPROTO_ESP             50              /* IP6 Encap Sec. Payload */
00217 #define IPPROTO_AH              51              /* IP6 Auth Header */
00218 #define IPPROTO_INLSP           52              /* Integ. Net Layer Security */
00219 #define IPPROTO_SWIPE           53              /* IP with encryption */
00220 #define IPPROTO_NHRP            54              /* Next Hop Resolution */
00221 #define IPPROTO_MOBILE          55              /* IP Mobility */
00222 #define IPPROTO_TLSP            56              /* Transport Layer Security */
00223 #define IPPROTO_SKIP            57              /* SKIP */
00224 #define IPPROTO_ICMPV6          58              /* ICMP6 */
00225 #define IPPROTO_NONE            59              /* IP6 no next header */
00226 #define IPPROTO_DSTOPTS         60              /* IP6 destination option */
00227 #define IPPROTO_AHIP            61              /* any host internal protocol */
00228 #define IPPROTO_CFTP            62              /* CFTP */
00229 #define IPPROTO_HELLO           63              /* "hello" routing protocol */
00230 #define IPPROTO_SATEXPAK        64              /* SATNET/Backroom EXPAK */
00231 #define IPPROTO_KRYPTOLAN       65              /* Kryptolan */
00232 #define IPPROTO_RVD             66              /* Remote Virtual Disk */
00233 #define IPPROTO_IPPC            67              /* Pluribus Packet Core */
00234 #define IPPROTO_ADFS            68              /* Any distributed FS */
00235 #define IPPROTO_SATMON          69              /* Satnet Monitoring */
00236 #define IPPROTO_VISA            70              /* VISA Protocol */
00237 #define IPPROTO_IPCV            71              /* Packet Core Utility */
00238 #define IPPROTO_CPNX            72              /* Comp. Prot. Net. Executive */
00239 #define IPPROTO_CPHB            73              /* Comp. Prot. HeartBeat */
00240 #define IPPROTO_WSN             74              /* Wang Span Network */
00241 #define IPPROTO_PVP             75              /* Packet Video Protocol */
00242 #define IPPROTO_BRSATMON        76              /* BackRoom SATNET Monitoring */
00243 #define IPPROTO_ND              77              /* Sun net disk proto (temp.) */
00244 #define IPPROTO_WBMON           78              /* WIDEBAND Monitoring */
00245 #define IPPROTO_WBEXPAK         79              /* WIDEBAND EXPAK */
00246 #define IPPROTO_EON             80              /* ISO cnlp */
00247 #define IPPROTO_VMTP            81              /* VMTP */
00248 #define IPPROTO_SVMTP           82              /* Secure VMTP */
00249 #define IPPROTO_VINES           83              /* Banyon VINES */
00250 #define IPPROTO_TTP             84              /* TTP */
00251 #define IPPROTO_IGP             85              /* NSFNET-IGP */
00252 #define IPPROTO_DGP             86              /* dissimilar gateway prot. */
00253 #define IPPROTO_TCF             87              /* TCF */
00254 #define IPPROTO_IGRP            88              /* Cisco/GXS IGRP */
00255 #define IPPROTO_OSPFIGP         89              /* OSPFIGP */
00256 #define IPPROTO_SRPC            90              /* Strite RPC protocol */
00257 #define IPPROTO_LARP            91              /* Locus Address Resoloution */
00258 #define IPPROTO_MTP             92              /* Multicast Transport */
00259 #define IPPROTO_AX25            93              /* AX.25 Frames */
00260 #define IPPROTO_IPEIP           94              /* IP encapsulated in IP */
00261 #define IPPROTO_MICP            95              /* Mobile Int.ing control */
00262 #define IPPROTO_SCCSP           96              /* Semaphore Comm. security */
00263 #define IPPROTO_ETHERIP         97              /* Ethernet IP encapsulation */
00264 #ifdef __SYMBIAN32__
00265 #define IPPROTO_ENCAP           4               /* IP in IP encapsulation */
00266 #else
00267 #define IPPROTO_ENCAP           98              /* encapsulation header */
00268 // __SYMBIAN32__
00269 #endif
00270 #define IPPROTO_APES            99              /* any private encr. scheme */
00271 #define IPPROTO_GMTP            100             /* GMTP*/
00272 #define IPPROTO_IPCOMP          108             /* payload compression (IPComp) */
00273 /* 101-254: Partly Unassigned */
00274 #define IPPROTO_PIM             103             /* Protocol Independent Mcast */
00275 #define IPPROTO_CARP            112             /* CARP */
00276 #define IPPROTO_PGM             113             /* PGM */
00277 #define IPPROTO_PFSYNC          240             /* PFSYNC */
00278 /* 255: Reserved */
00279 /* BSD Private, local use, namespace incursion, no longer used */
00280 #define IPPROTO_OLD_DIVERT      254             /* OLD divert pseudo-proto */
00281 #ifdef __SYMBIAN32__
00282 #define IPPROTO_MAX             0x101
00283 #else
00284 #define IPPROTO_MAX             256
00285 // __SYMBIAN32__
00286 #endif
00287 
00288 /* last return value of *_input(), meaning "all job for this pkt is done".  */
00289 #define IPPROTO_DONE            257
00290 
00291 /* Only used internally, so can be outside the range of valid IP protocols. */
00292 #define IPPROTO_DIVERT          258             /* divert pseudo-protocol */
00293 
00294 /*
00295  * Defined to avoid confusion.  The master value is defined by
00296  * PROTO_SPACER in sys/protosw.h.
00297  */
00298 #define IPPROTO_SPACER          32767           /* spacer for loadable protos */
00299 
00300 /*
00301  * Local port number conventions:
00302  *
00303  * When a user does a bind(2) or connect(2) with a port number of zero,
00304  * a non-conflicting local port address is chosen.
00305  * The default range is IPPORT_HIFIRSTAUTO through
00306  * IPPORT_HILASTAUTO, although that is settable by sysctl.
00307  *
00308  * A user may set the IPPROTO_IP option IP_PORTRANGE to change this
00309  * default assignment range.
00310  *
00311  * The value IP_PORTRANGE_DEFAULT causes the default behavior.
00312  *
00313  * The value IP_PORTRANGE_HIGH changes the range of candidate port numbers
00314  * into the "high" range.  These are reserved for client outbound connections
00315  * which do not want to be filtered by any firewalls.  Note that by default
00316  * this is the same as IP_PORTRANGE_DEFAULT.
00317  *
00318  * The value IP_PORTRANGE_LOW changes the range to the "low" are
00319  * that is (by convention) restricted to privileged processes.  This
00320  * convention is based on "vouchsafe" principles only.  It is only secure
00321  * if you trust the remote host to restrict these ports.
00322  *
00323  * The default range of ports and the high range can be changed by
00324  * sysctl(3).  (net.inet.ip.port{hi,low}{first,last}_auto)
00325  *
00326  * Changing those values has bad security implications if you are
00327  * using a stateless firewall that is allowing packets outside of that
00328  * range in order to allow transparent outgoing connections.
00329  *
00330  * Such a firewall configuration will generally depend on the use of these
00331  * default values.  If you change them, you may find your Security
00332  * Administrator looking for you with a heavy object.
00333  *
00334  * For a slightly more orthodox text view on this:
00335  *
00336  *            ftp://ftp.isi.edu/in-notes/iana/assignments/port-numbers
00337  *
00338  *    port numbers are divided into three ranges:
00339  *
00340  *                0 -  1023 Well Known Ports
00341  *             1024 - 49151 Registered Ports
00342  *            49152 - 65535 Dynamic and/or Private Ports
00343  *
00344  */
00345 
00346 /*
00347  * Ports < IPPORT_RESERVED are reserved for
00348  * privileged processes (e.g. root).         (IP_PORTRANGE_LOW)
00349  */
00350 #define IPPORT_RESERVED         1024
00351 
00352 /*
00353  * Default local port range, used by both IP_PORTRANGE_DEFAULT
00354  * and IP_PORTRANGE_HIGH.
00355  */
00356 #define IPPORT_HIFIRSTAUTO      49152
00357 #define IPPORT_HILASTAUTO       65535
00358 
00359 /*
00360  * Scanning for a free reserved port return a value below IPPORT_RESERVED,
00361  * but higher than IPPORT_RESERVEDSTART.  Traditionally the start value was
00362  * 512, but that conflicts with some well-known-services that firewalls may
00363  * have a fit if we use.
00364  */
00365 #define IPPORT_RESERVEDSTART    600
00366 
00367 #define IPPORT_MAX              65535
00368 
00369 /*
00370  * Definitions of bits in internet address integers.
00371  * On subnets, the decomposition of addresses to host and net parts
00372  * is done according to subnet mask, not the masks here.
00373  */
00374 #define IN_CLASSA(i)            (((u_int32_t)(i) & 0x80000000) == 0)
00375 #define IN_CLASSA_NET           0xff000000
00376 #define IN_CLASSA_NSHIFT        24
00377 #define IN_CLASSA_HOST          0x00ffffff
00378 #define IN_CLASSA_MAX           128
00379 
00380 #define IN_CLASSB(i)            (((u_int32_t)(i) & 0xc0000000) == 0x80000000)
00381 #define IN_CLASSB_NET           0xffff0000
00382 #define IN_CLASSB_NSHIFT        16
00383 #define IN_CLASSB_HOST          0x0000ffff
00384 #define IN_CLASSB_MAX           65536
00385 
00386 #define IN_CLASSC(i)            (((u_int32_t)(i) & 0xe0000000) == 0xc0000000)
00387 #define IN_CLASSC_NET           0xffffff00
00388 #define IN_CLASSC_NSHIFT        8
00389 #define IN_CLASSC_HOST          0x000000ff
00390 
00391 #define IN_CLASSD(i)            (((u_int32_t)(i) & 0xf0000000) == 0xe0000000)
00392 #define IN_CLASSD_NET           0xf0000000      /* These ones aren't really */
00393 #define IN_CLASSD_NSHIFT        28              /* net and host fields, but */
00394 #define IN_CLASSD_HOST          0x0fffffff      /* routing needn't know.    */
00395 #define IN_MULTICAST(i)         IN_CLASSD(i)
00396 
00397 #define IN_EXPERIMENTAL(i)      (((u_int32_t)(i) & 0xf0000000) == 0xf0000000)
00398 #define IN_BADCLASS(i)          (((u_int32_t)(i) & 0xf0000000) == 0xf0000000)
00399 
00400 #define INADDR_LOOPBACK         (u_int32_t)0x7f000001
00401 #ifndef _KERNEL
00402 #define INADDR_NONE             0xffffffff              /* -1 return */
00403 #endif
00404 
00405 #define INADDR_UNSPEC_GROUP     (u_int32_t)0xe0000000   /* 224.0.0.0 */
00406 #define INADDR_ALLHOSTS_GROUP   (u_int32_t)0xe0000001   /* 224.0.0.1 */
00407 #define INADDR_ALLRTRS_GROUP    (u_int32_t)0xe0000002   /* 224.0.0.2 */
00408 #define INADDR_CARP_GROUP       (u_int32_t)0xe0000012   /* 224.0.0.18 */
00409 #define INADDR_PFSYNC_GROUP     (u_int32_t)0xe00000f0   /* 224.0.0.240 */
00410 #define INADDR_ALLMDNS_GROUP    (u_int32_t)0xe00000fb   /* 224.0.0.251 */
00411 #define INADDR_MAX_LOCAL_GROUP  (u_int32_t)0xe00000ff   /* 224.0.0.255 */
00412 
00413 #define IN_LOOPBACKNET          127                     /* official! */
00414 
00415 /*
00416  * Options for use with [gs]etsockopt at the IP level.
00417  * First word of comment is data type; bool is stored in int.
00418  */
00419 #ifdef __SYMBIAN32__
00420 #define IP_OPTIONS              0x306   /* buf/ip_opts; set/get IP options */
00421 #else
00422 #define IP_OPTIONS              1               /* buf/ip_opts; set/get IP options */
00423 // __SYMBIAN32__
00424 #endif
00425 #ifdef __SYMBIAN32__
00426 #define IP_HDRINCL              0x308   /* int; header is included with data */
00427 #else
00428 #define IP_HDRINCL              2               /* int; header is included with data */
00429 // __SYMBIAN32__
00430 #endif
00431 #ifdef __SYMBIAN32__
00432 #define IP_TOS                  0x309   /* int; IP type of service and preced. */
00433 #else
00434 #define IP_TOS                  3               /* int; IP type of service and preced. */
00435 // __SYMBIAN32__
00436 #endif
00437 #ifdef __SYMBIAN32__
00438 #define IP_TTL                  0x310   /* int; IP time to live */
00439 #else
00440 #define IP_TTL                  4    /* int; IP time to live */
00441 // __SYMBIAN32__
00442 #endif
00443 #ifdef __SYMBIAN32__
00444 #define IP_RECVOPTS             -1    /* bool; receive all IP opts w/dgram */
00445 #else
00446 #define IP_RECVOPTS             5    /* bool; receive all IP opts w/dgram */
00447 #endif
00448 #ifdef __SYMBIAN32__
00449 #define IP_RECVRETOPTS          -2    /* bool; receive IP opts for response */
00450 #else
00451 #define IP_RECVRETOPTS          6    /* bool; receive IP opts for response */
00452 #endif
00453 #ifdef __SYMBIAN32__
00454 #define IP_RECVDSTADDR          -3    /* bool; receive IP dst addr w/dgram */
00455 #else
00456 #define IP_RECVDSTADDR          7    /* bool; receive IP dst addr w/dgram */
00457 #endif
00458 #define IP_SENDSRCADDR          IP_RECVDSTADDR /* cmsg_type to set src addr */
00459 #ifdef __SYMBIAN32__
00460 #define IP_RETOPTS              -4    /* ip_opts; set/get IP options */
00461 #else
00462 #define IP_RETOPTS              8    /* ip_opts; set/get IP options */
00463 // __SYMBIAN32__
00464 #endif
00465 #ifdef __SYMBIAN32__
00466 #define IP_MULTICAST_IF         -5      /* set/get IP multicast interface  */
00467 #else
00468 #define IP_MULTICAST_IF         9    /* u_char; set/get IP multicast i/f  */
00469 // __SYMBIAN32__
00470 #endif
00471 #ifdef __SYMBIAN32__
00472 #define IP_MULTICAST_TTL        -6      /* set/get IP multicast timetolive */
00473 #else
00474 #define IP_MULTICAST_TTL        10   /* u_char; set/get IP multicast ttl */
00475 // __SYMBIAN32__
00476 #endif
00477 #ifdef __SYMBIAN32__
00478 #define IP_MULTICAST_LOOP       -7   /* u_char; set/get IP multicast loopback */
00479 #else
00480 #define IP_MULTICAST_LOOP       11   /* u_char; set/get IP multicast loopback */
00481 // __SYMBIAN32__
00482 #endif
00483 #ifdef __SYMBIAN32__
00484 #define IP_ADD_MEMBERSHIP       0x46d   /* ip_mreq; add an IP group membership */
00485 #else
00486 #define IP_ADD_MEMBERSHIP       12   /* ip_mreq; add an IP group membership */
00487 // __SYMBIAN32__
00488 #endif
00489 #ifdef __SYMBIAN32__
00490 #define IP_DROP_MEMBERSHIP      0x46e   /* ip_mreq; drop an IP group membership */
00491 #else
00492 #define IP_DROP_MEMBERSHIP      13   /* ip_mreq; drop an IP group membership */
00493 // __SYMBIAN32__
00494 #endif
00495 #define IP_MULTICAST_VIF        14   /* set/get IP mcast virt. iface */
00496 #define IP_RSVP_ON              15   /* enable RSVP in kernel */
00497 #define IP_RSVP_OFF             16   /* disable RSVP in kernel */
00498 #define IP_RSVP_VIF_ON          17   /* set RSVP per-vif socket */
00499 #define IP_RSVP_VIF_OFF         18   /* unset RSVP per-vif socket */
00500 #define IP_PORTRANGE            19   /* int; range to choose for unspec port */
00501 #define IP_RECVIF               20   /* bool; receive reception if w/dgram */
00502 /* for IPSEC */
00503 #define IP_IPSEC_POLICY         21   /* int; set/get security policy */
00504 #define IP_FAITH                22   /* bool; accept FAITH'ed connections */
00505 
00506 #define IP_ONESBCAST            23   /* bool: send all-ones broadcast */
00507 
00508 #define IP_FW_TABLE_ADD         40   /* add entry */
00509 #define IP_FW_TABLE_DEL         41   /* delete entry */
00510 #define IP_FW_TABLE_FLUSH       42   /* flush table */
00511 #define IP_FW_TABLE_GETSIZE     43   /* get table size */
00512 #define IP_FW_TABLE_LIST        44   /* list table contents */
00513 
00514 #define IP_FW_ADD               50   /* add a firewall rule to chain */
00515 #define IP_FW_DEL               51   /* delete a firewall rule from chain */
00516 #define IP_FW_FLUSH             52   /* flush firewall rule chain */
00517 #define IP_FW_ZERO              53   /* clear single/all firewall counter(s) */
00518 #define IP_FW_GET               54   /* get entire firewall rule chain */
00519 #define IP_FW_RESETLOG          55   /* reset logging counters */
00520 
00521 #define IP_DUMMYNET_CONFIGURE   60   /* add/configure a dummynet pipe */
00522 #define IP_DUMMYNET_DEL         61   /* delete a dummynet pipe from chain */
00523 #define IP_DUMMYNET_FLUSH       62   /* flush dummynet */
00524 #define IP_DUMMYNET_GET         64   /* get entire dummynet pipes */
00525 
00526 #define IP_RECVTTL              65   /* bool; receive IP TTL w/dgram */
00527 #define IP_MINTTL               66   /* minimum TTL for packet or drop */
00528 #define IP_DONTFRAG             67   /* don't fragment packet */
00529 
00530 /*
00531  * Defaults and limits for options
00532  */
00533 #define IP_DEFAULT_MULTICAST_TTL  1     /* normally limit m'casts to 1 hop  */
00534 #define IP_DEFAULT_MULTICAST_LOOP 1     /* normally hear sends if a member  */
00535 #define IP_MAX_MEMBERSHIPS      20      /* per socket */
00536 
00537 /*
00538  * Argument structure for IP_ADD_MEMBERSHIP and IP_DROP_MEMBERSHIP.
00539  */
00540 struct ip_mreq {
00541         struct  in_addr imr_multiaddr;  /* IP multicast address of group */
00542         struct  in_addr imr_interface;  /* local IP address of interface */
00543 };
00544 
00545 /*
00546  * Argument for IP_PORTRANGE:
00547  * - which range to search when port is unspecified at bind() or connect()
00548  */
00549 #define IP_PORTRANGE_DEFAULT    0       /* default range */
00550 #define IP_PORTRANGE_HIGH       1       /* "high" - request firewall bypass */
00551 #define IP_PORTRANGE_LOW        2       /* "low" - vouchsafe security */
00552 
00553 /*
00554  * Definitions for inet sysctl operations.
00555  *
00556  * Third level is protocol number.
00557  * Fourth level is desired variable within that protocol.
00558  */
00559 #define IPPROTO_MAXID   (IPPROTO_AH + 1)        /* don't list to IPPROTO_MAX */
00560 
00561 #define CTL_IPPROTO_NAMES { \
00562         { "ip", CTLTYPE_NODE }, \
00563         { "icmp", CTLTYPE_NODE }, \
00564         { "igmp", CTLTYPE_NODE }, \
00565         { "ggp", CTLTYPE_NODE }, \
00566         { 0, 0 }, \
00567         { 0, 0 }, \
00568         { "tcp", CTLTYPE_NODE }, \
00569         { 0, 0 }, \
00570         { "egp", CTLTYPE_NODE }, \
00571         { 0, 0 }, \
00572         { 0, 0 }, \
00573         { 0, 0 }, \
00574         { "pup", CTLTYPE_NODE }, \
00575         { 0, 0 }, \
00576         { 0, 0 }, \
00577         { 0, 0 }, \
00578         { 0, 0 }, \
00579         { "udp", CTLTYPE_NODE }, \
00580         { 0, 0 }, \
00581         { 0, 0 }, \
00582         { 0, 0 }, \
00583         { 0, 0 }, \
00584         { "idp", CTLTYPE_NODE }, \
00585         { 0, 0 }, \
00586         { 0, 0 }, \
00587         { 0, 0 }, \
00588         { 0, 0 }, \
00589         { 0, 0 }, \
00590         { 0, 0 }, \
00591         { 0, 0 }, \
00592         { 0, 0 }, \
00593         { 0, 0 }, \
00594         { 0, 0 }, \
00595         { 0, 0 }, \
00596         { 0, 0 }, \
00597         { 0, 0 }, \
00598         { 0, 0 }, \
00599         { 0, 0 }, \
00600         { 0, 0 }, \
00601         { 0, 0 }, \
00602         { 0, 0 }, \
00603         { 0, 0 }, \
00604         { 0, 0 }, \
00605         { 0, 0 }, \
00606         { 0, 0 }, \
00607         { 0, 0 }, \
00608         { 0, 0 }, \
00609         { 0, 0 }, \
00610         { 0, 0 }, \
00611         { 0, 0 }, \
00612         { 0, 0 }, \
00613         { "ipsec", CTLTYPE_NODE }, \
00614         { 0, 0 }, \
00615         { 0, 0 }, \
00616         { 0, 0 }, \
00617         { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \
00618         { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \
00619         { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \
00620         { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \
00621         { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \
00622         { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \
00623         { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \
00624         { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \
00625         { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \
00626         { 0, 0 }, \
00627         { 0, 0 }, \
00628         { 0, 0 }, \
00629         { "pim", CTLTYPE_NODE }, \
00630 }
00631 
00632 /*
00633  * Names for IP sysctl objects
00634  */
00635 #define IPCTL_FORWARDING        1       /* act as router */
00636 #define IPCTL_SENDREDIRECTS     2       /* may send redirects when forwarding */
00637 #define IPCTL_DEFTTL            3       /* default TTL */
00638 #ifdef notyet
00639 #define IPCTL_DEFMTU            4       /* default MTU */
00640 #endif
00641 #define IPCTL_RTEXPIRE          5       /* cloned route expiration time */
00642 #define IPCTL_RTMINEXPIRE       6       /* min value for expiration time */
00643 #define IPCTL_RTMAXCACHE        7       /* trigger level for dynamic expire */
00644 #define IPCTL_SOURCEROUTE       8       /* may perform source routes */
00645 #define IPCTL_DIRECTEDBROADCAST 9       /* may re-broadcast received packets */
00646 #define IPCTL_INTRQMAXLEN       10      /* max length of netisr queue */
00647 #define IPCTL_INTRQDROPS        11      /* number of netisr q drops */
00648 #define IPCTL_STATS             12      /* ipstat structure */
00649 #define IPCTL_ACCEPTSOURCEROUTE 13      /* may accept source routed packets */
00650 #define IPCTL_FASTFORWARDING    14      /* use fast IP forwarding code */
00651 #define IPCTL_KEEPFAITH         15      /* FAITH IPv4->IPv6 translater ctl */
00652 #define IPCTL_GIF_TTL           16      /* default TTL for gif encap packet */
00653 #define IPCTL_MAXID             17
00654 
00655 #define IPCTL_NAMES { \
00656         { 0, 0 }, \
00657         { "forwarding", CTLTYPE_INT }, \
00658         { "redirect", CTLTYPE_INT }, \
00659         { "ttl", CTLTYPE_INT }, \
00660         { "mtu", CTLTYPE_INT }, \
00661         { "rtexpire", CTLTYPE_INT }, \
00662         { "rtminexpire", CTLTYPE_INT }, \
00663         { "rtmaxcache", CTLTYPE_INT }, \
00664         { "sourceroute", CTLTYPE_INT }, \
00665         { "directed-broadcast", CTLTYPE_INT }, \
00666         { "intr-queue-maxlen", CTLTYPE_INT }, \
00667         { "intr-queue-drops", CTLTYPE_INT }, \
00668         { "stats", CTLTYPE_STRUCT }, \
00669         { "accept_sourceroute", CTLTYPE_INT }, \
00670         { "fastforwarding", CTLTYPE_INT }, \
00671 }
00672 
00673 #endif /* __BSD_VISIBLE */
00674 
00675 #ifdef _KERNEL
00676 
00677 struct ifnet; struct mbuf;      /* forward declarations for Standard C */
00678 
00679 char    *inet_ntoa(struct in_addr); /* in libkern */
00680 
00681 #define in_hosteq(s, t) ((s).s_addr == (t).s_addr)
00682 #define in_nullhost(x)  ((x).s_addr == INADDR_ANY)
00683 
00684 #define satosin(sa)     ((struct sockaddr_in *)(sa))
00685 #define sintosa(sin)    ((struct sockaddr *)(sin))
00686 #define ifatoia(ifa)    ((struct in_ifaddr *)(ifa))
00687 
00688 #endif /* _KERNEL */
00689 
00690 /* INET6 stuff */
00691 #if __POSIX_VISIBLE >= 200112
00692 #define __KAME_NETINET_IN_H_INCLUDED_
00693 #include <netinet6/in6.h>
00694 #undef __KAME_NETINET_IN_H_INCLUDED_
00695 #endif
00696 
00697 #ifndef _KERNEL
00698 
00699 __BEGIN_DECLS
00700 IMPORT_C int bindresvport (int __sockfd, struct sockaddr_in *__sock_in);
00701 __END_DECLS
00702 
00703 #endif /* _KERNEL */
00704 
00705 #endif /* !_NETINET_IN_H_*/

Copyright © Nokia Corporation 2001-2008
Back to top