1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/ossrv/genericopenlibs/openenvcore/include/netinet/in.h Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,683 @@
1.4 +// © Portions copyright (c) 2006 Nokia Corporation. All rights reserved.
1.5 +
1.6 +/*-
1.7 + * Copyright (c) 1982, 1986, 1990, 1993
1.8 + * The Regents of the University of California. All rights reserved.
1.9 + *
1.10 + * Redistribution and use in source and binary forms, with or without
1.11 + * modification, are permitted provided that the following conditions
1.12 + * are met:
1.13 + * 1. Redistributions of source code must retain the above copyright
1.14 + * notice, this list of conditions and the following disclaimer.
1.15 + * 2. Redistributions in binary form must reproduce the above copyright
1.16 + * notice, this list of conditions and the following disclaimer in the
1.17 + * documentation and/or other materials provided with the distribution.
1.18 + * 4. Neither the name of the University nor the names of its contributors
1.19 + * may be used to endorse or promote products derived from this software
1.20 + * without specific prior written permission.
1.21 + *
1.22 + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
1.23 + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1.24 + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1.25 + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
1.26 + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
1.27 + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
1.28 + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
1.29 + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
1.30 + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
1.31 + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
1.32 + * SUCH DAMAGE.
1.33 + *
1.34 + * @(#)in.h 8.3 (Berkeley) 1/3/94
1.35 + * $FreeBSD: src/sys/netinet/in.h,v 1.90.2.3 2005/10/02 15:45:47 andre Exp $
1.36 + */
1.37 +
1.38 +#ifndef _NETINET_IN_H_
1.39 +#define _NETINET_IN_H_
1.40 +
1.41 +#include <sys/cdefs.h>
1.42 +#include <sys/_types.h>
1.43 +#include <stdapis/machine/endian.h>
1.44 +
1.45 +/* Protocols common to RFC 1700, POSIX, and X/Open. */
1.46 +#ifdef __SYMBIAN32__
1.47 +#define IPPROTO_IP 0x100 /* KProtocolInetIp */
1.48 +#else
1.49 +#define IPPROTO_IP 0 /* dummy for IP */
1.50 +#endif // __SYMBIAN32__
1.51 +#define IPPROTO_ICMP 1 /* control message protocol KProtocolInetIcmp */
1.52 +#define IPPROTO_TCP 6 /* tcp KProtocolInetTcp */
1.53 +#define IPPROTO_UDP 17 /* user datagram protocol KProtocolInetUdp */
1.54 +
1.55 +#define INADDR_ANY (u_int32_t)0x00000000
1.56 +#define INADDR_BROADCAST (u_int32_t)0xffffffff /* must be masked */
1.57 +
1.58 +#ifndef _UINT8_T_DECLARED
1.59 +typedef __uint8_t uint8_t;
1.60 +#define _UINT8_T_DECLARED
1.61 +#endif
1.62 +
1.63 +#ifndef _UINT16_T_DECLARED
1.64 +typedef __uint16_t uint16_t;
1.65 +#define _UINT16_T_DECLARED
1.66 +#endif
1.67 +
1.68 +#ifndef _UINT32_T_DECLARED
1.69 +typedef __uint32_t uint32_t;
1.70 +#define _UINT32_T_DECLARED
1.71 +#endif
1.72 +
1.73 +#ifndef _IN_ADDR_T_DECLARED
1.74 +typedef uint32_t in_addr_t;
1.75 +#define _IN_ADDR_T_DECLARED
1.76 +#endif
1.77 +
1.78 +#ifndef _IN_PORT_T_DECLARED
1.79 +typedef uint16_t in_port_t;
1.80 +#define _IN_PORT_T_DECLARED
1.81 +#endif
1.82 +
1.83 +#ifndef _SA_FAMILY_T_DECLARED
1.84 +typedef __sa_family_t sa_family_t;
1.85 +#define _SA_FAMILY_T_DECLARED
1.86 +#endif
1.87 +
1.88 +/* Internet address (a structure for historical reasons). */
1.89 +#ifndef _STRUCT_IN_ADDR_DECLARED
1.90 +struct in_addr {
1.91 + in_addr_t s_addr;
1.92 +};
1.93 +#define _STRUCT_IN_ADDR_DECLARED
1.94 +#endif
1.95 +
1.96 +/* Socket address, internet style. */
1.97 +#ifdef __SYMBIAN32__
1.98 +struct sockaddr_in {
1.99 + u_short sin_family;
1.100 + u_short sin_port;
1.101 + struct in_addr sin_addr;
1.102 + char sin_zero[20];
1.103 +};
1.104 +#else
1.105 +struct sockaddr_in {
1.106 + uint8_t sin_len;
1.107 + sa_family_t sin_family;
1.108 + in_port_t sin_port;
1.109 + struct in_addr sin_addr;
1.110 + char sin_zero[8];
1.111 +};
1.112 +#endif // __SYMBIAN32__
1.113 +
1.114 +#ifdef __SYMBIAN32__
1.115 +#define SOL_IP 0x100 /* options for IP level KSolInetIp */
1.116 +#define SOL_TCP 0x106 /* options for TCP level KSolInetTcp */
1.117 +
1.118 +/*
1.119 + * User-settable options (used with setsockopt).
1.120 + */
1.121 +#define TCP_NODELAY 0x304 /* don't delay send to coalesce packets KSoTcpNoDelay */
1.122 +#define TCP_MAXSEG 0x303 /* set maximum segment size KSoTcpMaxSegSize */
1.123 +
1.124 +#endif //__SYMBIAN32__
1.125 +
1.126 +#ifndef _KERNEL
1.127 +
1.128 +#ifndef _BYTEORDER_PROTOTYPED
1.129 +#define _BYTEORDER_PROTOTYPED
1.130 +__BEGIN_DECLS
1.131 +IMPORT_C uint32_t htonl(uint32_t);
1.132 +IMPORT_C uint16_t htons(uint16_t);
1.133 +uint32_t ntohl(uint32_t);
1.134 +uint16_t ntohs(uint16_t);
1.135 +__END_DECLS
1.136 +#endif
1.137 +
1.138 +#ifndef _BYTEORDER_FUNC_DEFINED
1.139 +#define _BYTEORDER_FUNC_DEFINED
1.140 +#define htonl(x) __htonl(x)
1.141 +#define htons(x) __htons(x)
1.142 +#define ntohl(x) __ntohl(x)
1.143 +#define ntohs(x) __ntohs(x)
1.144 +#endif
1.145 +
1.146 +#endif /* !_KERNEL */
1.147 +
1.148 +#if __POSIX_VISIBLE >= 200112
1.149 +#define IPPROTO_RAW 255 /* raw IP packet */
1.150 +#define INET_ADDRSTRLEN 16
1.151 +#endif
1.152 +
1.153 +#if __BSD_VISIBLE
1.154 +/*
1.155 + * Constants and structures defined by the internet system,
1.156 + * Per RFC 790, September 1981, and numerous additions.
1.157 + */
1.158 +
1.159 +/*
1.160 + * Protocols (RFC 1700)
1.161 + */
1.162 +#define IPPROTO_HOPOPTS 0 /* IP6 hop-by-hop options */
1.163 +#define IPPROTO_IGMP 2 /* group mgmt protocol */
1.164 +#define IPPROTO_GGP 3 /* gateway^2 (deprecated) */
1.165 +#define IPPROTO_IPV4 4 /* IPv4 encapsulation */
1.166 +#define IPPROTO_IPIP IPPROTO_IPV4 /* for compatibility */
1.167 +#define IPPROTO_ST 7 /* Stream protocol II */
1.168 +#define IPPROTO_EGP 8 /* exterior gateway protocol */
1.169 +#define IPPROTO_PIGP 9 /* private interior gateway */
1.170 +#define IPPROTO_RCCMON 10 /* BBN RCC Monitoring */
1.171 +#define IPPROTO_NVPII 11 /* network voice protocol*/
1.172 +#define IPPROTO_PUP 12 /* pup */
1.173 +#define IPPROTO_ARGUS 13 /* Argus */
1.174 +#define IPPROTO_EMCON 14 /* EMCON */
1.175 +#define IPPROTO_XNET 15 /* Cross Net Debugger */
1.176 +#define IPPROTO_CHAOS 16 /* Chaos*/
1.177 +#define IPPROTO_MUX 18 /* Multiplexing */
1.178 +#define IPPROTO_MEAS 19 /* DCN Measurement Subsystems */
1.179 +#define IPPROTO_HMP 20 /* Host Monitoring */
1.180 +#define IPPROTO_PRM 21 /* Packet Radio Measurement */
1.181 +#define IPPROTO_IDP 22 /* xns idp */
1.182 +#define IPPROTO_TRUNK1 23 /* Trunk-1 */
1.183 +#define IPPROTO_TRUNK2 24 /* Trunk-2 */
1.184 +#define IPPROTO_LEAF1 25 /* Leaf-1 */
1.185 +#define IPPROTO_LEAF2 26 /* Leaf-2 */
1.186 +#define IPPROTO_RDP 27 /* Reliable Data */
1.187 +#define IPPROTO_IRTP 28 /* Reliable Transaction */
1.188 +#define IPPROTO_TP 29 /* tp-4 w/ class negotiation */
1.189 +#define IPPROTO_BLT 30 /* Bulk Data Transfer */
1.190 +#define IPPROTO_NSP 31 /* Network Services */
1.191 +#define IPPROTO_INP 32 /* Merit Internodal */
1.192 +#define IPPROTO_SEP 33 /* Sequential Exchange */
1.193 +#define IPPROTO_3PC 34 /* Third Party Connect */
1.194 +#define IPPROTO_IDPR 35 /* InterDomain Policy Routing */
1.195 +#define IPPROTO_XTP 36 /* XTP */
1.196 +#define IPPROTO_DDP 37 /* Datagram Delivery */
1.197 +#define IPPROTO_CMTP 38 /* Control Message Transport */
1.198 +#define IPPROTO_TPXX 39 /* TP++ Transport */
1.199 +#define IPPROTO_IL 40 /* IL transport protocol */
1.200 +#define IPPROTO_IPV6 41 /* IP6 header */
1.201 +#define IPPROTO_SDRP 42 /* Source Demand Routing */
1.202 +#define IPPROTO_ROUTING 43 /* IP6 routing header */
1.203 +#define IPPROTO_FRAGMENT 44 /* IP6 fragmentation header */
1.204 +#define IPPROTO_IDRP 45 /* InterDomain Routing*/
1.205 +#define IPPROTO_RSVP 46 /* resource reservation */
1.206 +#define IPPROTO_GRE 47 /* General Routing Encap. */
1.207 +#define IPPROTO_MHRP 48 /* Mobile Host Routing */
1.208 +#define IPPROTO_BHA 49 /* BHA */
1.209 +#define IPPROTO_ESP 50 /* IP6 Encap Sec. Payload */
1.210 +#define IPPROTO_AH 51 /* IP6 Auth Header */
1.211 +#define IPPROTO_INLSP 52 /* Integ. Net Layer Security */
1.212 +#define IPPROTO_SWIPE 53 /* IP with encryption */
1.213 +#define IPPROTO_NHRP 54 /* Next Hop Resolution */
1.214 +#define IPPROTO_MOBILE 55 /* IP Mobility */
1.215 +#define IPPROTO_TLSP 56 /* Transport Layer Security */
1.216 +#define IPPROTO_SKIP 57 /* SKIP */
1.217 +#define IPPROTO_ICMPV6 58 /* ICMP6 */
1.218 +#define IPPROTO_NONE 59 /* IP6 no next header */
1.219 +#define IPPROTO_DSTOPTS 60 /* IP6 destination option */
1.220 +#define IPPROTO_AHIP 61 /* any host internal protocol */
1.221 +#define IPPROTO_CFTP 62 /* CFTP */
1.222 +#define IPPROTO_HELLO 63 /* "hello" routing protocol */
1.223 +#define IPPROTO_SATEXPAK 64 /* SATNET/Backroom EXPAK */
1.224 +#define IPPROTO_KRYPTOLAN 65 /* Kryptolan */
1.225 +#define IPPROTO_RVD 66 /* Remote Virtual Disk */
1.226 +#define IPPROTO_IPPC 67 /* Pluribus Packet Core */
1.227 +#define IPPROTO_ADFS 68 /* Any distributed FS */
1.228 +#define IPPROTO_SATMON 69 /* Satnet Monitoring */
1.229 +#define IPPROTO_VISA 70 /* VISA Protocol */
1.230 +#define IPPROTO_IPCV 71 /* Packet Core Utility */
1.231 +#define IPPROTO_CPNX 72 /* Comp. Prot. Net. Executive */
1.232 +#define IPPROTO_CPHB 73 /* Comp. Prot. HeartBeat */
1.233 +#define IPPROTO_WSN 74 /* Wang Span Network */
1.234 +#define IPPROTO_PVP 75 /* Packet Video Protocol */
1.235 +#define IPPROTO_BRSATMON 76 /* BackRoom SATNET Monitoring */
1.236 +#define IPPROTO_ND 77 /* Sun net disk proto (temp.) */
1.237 +#define IPPROTO_WBMON 78 /* WIDEBAND Monitoring */
1.238 +#define IPPROTO_WBEXPAK 79 /* WIDEBAND EXPAK */
1.239 +#define IPPROTO_EON 80 /* ISO cnlp */
1.240 +#define IPPROTO_VMTP 81 /* VMTP */
1.241 +#define IPPROTO_SVMTP 82 /* Secure VMTP */
1.242 +#define IPPROTO_VINES 83 /* Banyon VINES */
1.243 +#define IPPROTO_TTP 84 /* TTP */
1.244 +#define IPPROTO_IGP 85 /* NSFNET-IGP */
1.245 +#define IPPROTO_DGP 86 /* dissimilar gateway prot. */
1.246 +#define IPPROTO_TCF 87 /* TCF */
1.247 +#define IPPROTO_IGRP 88 /* Cisco/GXS IGRP */
1.248 +#define IPPROTO_OSPFIGP 89 /* OSPFIGP */
1.249 +#define IPPROTO_SRPC 90 /* Strite RPC protocol */
1.250 +#define IPPROTO_LARP 91 /* Locus Address Resoloution */
1.251 +#define IPPROTO_MTP 92 /* Multicast Transport */
1.252 +#define IPPROTO_AX25 93 /* AX.25 Frames */
1.253 +#define IPPROTO_IPEIP 94 /* IP encapsulated in IP */
1.254 +#define IPPROTO_MICP 95 /* Mobile Int.ing control */
1.255 +#define IPPROTO_SCCSP 96 /* Semaphore Comm. security */
1.256 +#define IPPROTO_ETHERIP 97 /* Ethernet IP encapsulation */
1.257 +#ifdef __SYMBIAN32__
1.258 +#define IPPROTO_ENCAP 4 /* IP in IP encapsulation */
1.259 +#else
1.260 +#define IPPROTO_ENCAP 98 /* encapsulation header */
1.261 +#endif // __SYMBIAN32__
1.262 +#define IPPROTO_APES 99 /* any private encr. scheme */
1.263 +#define IPPROTO_GMTP 100 /* GMTP*/
1.264 +#define IPPROTO_IPCOMP 108 /* payload compression (IPComp) */
1.265 +/* 101-254: Partly Unassigned */
1.266 +#define IPPROTO_PIM 103 /* Protocol Independent Mcast */
1.267 +#define IPPROTO_CARP 112 /* CARP */
1.268 +#define IPPROTO_PGM 113 /* PGM */
1.269 +#define IPPROTO_PFSYNC 240 /* PFSYNC */
1.270 +/* 255: Reserved */
1.271 +/* BSD Private, local use, namespace incursion, no longer used */
1.272 +#define IPPROTO_OLD_DIVERT 254 /* OLD divert pseudo-proto */
1.273 +#ifdef __SYMBIAN32__
1.274 +#define IPPROTO_MAX 0x101
1.275 +#else
1.276 +#define IPPROTO_MAX 256
1.277 +#endif // __SYMBIAN32__
1.278 +
1.279 +/* last return value of *_input(), meaning "all job for this pkt is done". */
1.280 +#define IPPROTO_DONE 257
1.281 +
1.282 +/* Only used internally, so can be outside the range of valid IP protocols. */
1.283 +#define IPPROTO_DIVERT 258 /* divert pseudo-protocol */
1.284 +
1.285 +/*
1.286 + * Defined to avoid confusion. The master value is defined by
1.287 + * PROTO_SPACER in sys/protosw.h.
1.288 + */
1.289 +#define IPPROTO_SPACER 32767 /* spacer for loadable protos */
1.290 +
1.291 +/*
1.292 + * Local port number conventions:
1.293 + *
1.294 + * When a user does a bind(2) or connect(2) with a port number of zero,
1.295 + * a non-conflicting local port address is chosen.
1.296 + * The default range is IPPORT_HIFIRSTAUTO through
1.297 + * IPPORT_HILASTAUTO, although that is settable by sysctl.
1.298 + *
1.299 + * A user may set the IPPROTO_IP option IP_PORTRANGE to change this
1.300 + * default assignment range.
1.301 + *
1.302 + * The value IP_PORTRANGE_DEFAULT causes the default behavior.
1.303 + *
1.304 + * The value IP_PORTRANGE_HIGH changes the range of candidate port numbers
1.305 + * into the "high" range. These are reserved for client outbound connections
1.306 + * which do not want to be filtered by any firewalls. Note that by default
1.307 + * this is the same as IP_PORTRANGE_DEFAULT.
1.308 + *
1.309 + * The value IP_PORTRANGE_LOW changes the range to the "low" are
1.310 + * that is (by convention) restricted to privileged processes. This
1.311 + * convention is based on "vouchsafe" principles only. It is only secure
1.312 + * if you trust the remote host to restrict these ports.
1.313 + *
1.314 + * The default range of ports and the high range can be changed by
1.315 + * sysctl(3). (net.inet.ip.port{hi,low}{first,last}_auto)
1.316 + *
1.317 + * Changing those values has bad security implications if you are
1.318 + * using a stateless firewall that is allowing packets outside of that
1.319 + * range in order to allow transparent outgoing connections.
1.320 + *
1.321 + * Such a firewall configuration will generally depend on the use of these
1.322 + * default values. If you change them, you may find your Security
1.323 + * Administrator looking for you with a heavy object.
1.324 + *
1.325 + * For a slightly more orthodox text view on this:
1.326 + *
1.327 + * ftp://ftp.isi.edu/in-notes/iana/assignments/port-numbers
1.328 + *
1.329 + * port numbers are divided into three ranges:
1.330 + *
1.331 + * 0 - 1023 Well Known Ports
1.332 + * 1024 - 49151 Registered Ports
1.333 + * 49152 - 65535 Dynamic and/or Private Ports
1.334 + *
1.335 + */
1.336 +
1.337 +/*
1.338 + * Ports < IPPORT_RESERVED are reserved for
1.339 + * privileged processes (e.g. root). (IP_PORTRANGE_LOW)
1.340 + */
1.341 +#define IPPORT_RESERVED 1024
1.342 +
1.343 +/*
1.344 + * Default local port range, used by both IP_PORTRANGE_DEFAULT
1.345 + * and IP_PORTRANGE_HIGH.
1.346 + */
1.347 +#define IPPORT_HIFIRSTAUTO 49152
1.348 +#define IPPORT_HILASTAUTO 65535
1.349 +
1.350 +/*
1.351 + * Scanning for a free reserved port return a value below IPPORT_RESERVED,
1.352 + * but higher than IPPORT_RESERVEDSTART. Traditionally the start value was
1.353 + * 512, but that conflicts with some well-known-services that firewalls may
1.354 + * have a fit if we use.
1.355 + */
1.356 +#define IPPORT_RESERVEDSTART 600
1.357 +
1.358 +#define IPPORT_MAX 65535
1.359 +
1.360 +/*
1.361 + * Definitions of bits in internet address integers.
1.362 + * On subnets, the decomposition of addresses to host and net parts
1.363 + * is done according to subnet mask, not the masks here.
1.364 + */
1.365 +#define IN_CLASSA(i) (((u_int32_t)(i) & 0x80000000) == 0)
1.366 +#define IN_CLASSA_NET 0xff000000
1.367 +#define IN_CLASSA_NSHIFT 24
1.368 +#define IN_CLASSA_HOST 0x00ffffff
1.369 +#define IN_CLASSA_MAX 128
1.370 +
1.371 +#define IN_CLASSB(i) (((u_int32_t)(i) & 0xc0000000) == 0x80000000)
1.372 +#define IN_CLASSB_NET 0xffff0000
1.373 +#define IN_CLASSB_NSHIFT 16
1.374 +#define IN_CLASSB_HOST 0x0000ffff
1.375 +#define IN_CLASSB_MAX 65536
1.376 +
1.377 +#define IN_CLASSC(i) (((u_int32_t)(i) & 0xe0000000) == 0xc0000000)
1.378 +#define IN_CLASSC_NET 0xffffff00
1.379 +#define IN_CLASSC_NSHIFT 8
1.380 +#define IN_CLASSC_HOST 0x000000ff
1.381 +
1.382 +#define IN_CLASSD(i) (((u_int32_t)(i) & 0xf0000000) == 0xe0000000)
1.383 +#define IN_CLASSD_NET 0xf0000000 /* These ones aren't really */
1.384 +#define IN_CLASSD_NSHIFT 28 /* net and host fields, but */
1.385 +#define IN_CLASSD_HOST 0x0fffffff /* routing needn't know. */
1.386 +#define IN_MULTICAST(i) IN_CLASSD(i)
1.387 +
1.388 +#define IN_EXPERIMENTAL(i) (((u_int32_t)(i) & 0xf0000000) == 0xf0000000)
1.389 +#define IN_BADCLASS(i) (((u_int32_t)(i) & 0xf0000000) == 0xf0000000)
1.390 +
1.391 +#define INADDR_LOOPBACK (u_int32_t)0x7f000001
1.392 +#ifndef _KERNEL
1.393 +#define INADDR_NONE 0xffffffff /* -1 return */
1.394 +#endif
1.395 +
1.396 +#define INADDR_UNSPEC_GROUP (u_int32_t)0xe0000000 /* 224.0.0.0 */
1.397 +#define INADDR_ALLHOSTS_GROUP (u_int32_t)0xe0000001 /* 224.0.0.1 */
1.398 +#define INADDR_ALLRTRS_GROUP (u_int32_t)0xe0000002 /* 224.0.0.2 */
1.399 +#define INADDR_CARP_GROUP (u_int32_t)0xe0000012 /* 224.0.0.18 */
1.400 +#define INADDR_PFSYNC_GROUP (u_int32_t)0xe00000f0 /* 224.0.0.240 */
1.401 +#define INADDR_ALLMDNS_GROUP (u_int32_t)0xe00000fb /* 224.0.0.251 */
1.402 +#define INADDR_MAX_LOCAL_GROUP (u_int32_t)0xe00000ff /* 224.0.0.255 */
1.403 +
1.404 +#define IN_LOOPBACKNET 127 /* official! */
1.405 +
1.406 +/*
1.407 + * Options for use with [gs]etsockopt at the IP level.
1.408 + * First word of comment is data type; bool is stored in int.
1.409 + */
1.410 +#ifdef __SYMBIAN32__
1.411 +#define IP_OPTIONS 0x306 /* buf/ip_opts; set/get IP options */
1.412 +#else
1.413 +#define IP_OPTIONS 1 /* buf/ip_opts; set/get IP options */
1.414 +#endif // __SYMBIAN32__
1.415 +#ifdef __SYMBIAN32__
1.416 +#define IP_HDRINCL 0x308 /* int; header is included with data */
1.417 +#else
1.418 +#define IP_HDRINCL 2 /* int; header is included with data */
1.419 +#endif // __SYMBIAN32__
1.420 +#ifdef __SYMBIAN32__
1.421 +#define IP_TOS 0x309 /* int; IP type of service and preced. */
1.422 +#else
1.423 +#define IP_TOS 3 /* int; IP type of service and preced. */
1.424 +#endif // __SYMBIAN32__
1.425 +#ifdef __SYMBIAN32__
1.426 +#define IP_TTL 0x310 /* int; IP time to live */
1.427 +#else
1.428 +#define IP_TTL 4 /* int; IP time to live */
1.429 +#endif // __SYMBIAN32__
1.430 +#ifdef __SYMBIAN32__
1.431 +#define IP_RECVOPTS -1 /* bool; receive all IP opts w/dgram */
1.432 +#else
1.433 +#define IP_RECVOPTS 5 /* bool; receive all IP opts w/dgram */
1.434 +#endif
1.435 +#ifdef __SYMBIAN32__
1.436 +#define IP_RECVRETOPTS -2 /* bool; receive IP opts for response */
1.437 +#else
1.438 +#define IP_RECVRETOPTS 6 /* bool; receive IP opts for response */
1.439 +#endif
1.440 +#ifdef __SYMBIAN32__
1.441 +#define IP_RECVDSTADDR -3 /* bool; receive IP dst addr w/dgram */
1.442 +#else
1.443 +#define IP_RECVDSTADDR 7 /* bool; receive IP dst addr w/dgram */
1.444 +#endif
1.445 +#define IP_SENDSRCADDR IP_RECVDSTADDR /* cmsg_type to set src addr */
1.446 +#ifdef __SYMBIAN32__
1.447 +#define IP_RETOPTS -4 /* ip_opts; set/get IP options */
1.448 +#else
1.449 +#define IP_RETOPTS 8 /* ip_opts; set/get IP options */
1.450 +#endif // __SYMBIAN32__
1.451 +#ifdef __SYMBIAN32__
1.452 +#define IP_MULTICAST_IF -5 /* set/get IP multicast interface */
1.453 +#else
1.454 +#define IP_MULTICAST_IF 9 /* u_char; set/get IP multicast i/f */
1.455 +#endif // __SYMBIAN32__
1.456 +#ifdef __SYMBIAN32__
1.457 +#define IP_MULTICAST_TTL -6 /* set/get IP multicast timetolive */
1.458 +#else
1.459 +#define IP_MULTICAST_TTL 10 /* u_char; set/get IP multicast ttl */
1.460 +#endif // __SYMBIAN32__
1.461 +#ifdef __SYMBIAN32__
1.462 +#define IP_MULTICAST_LOOP -7 /* u_char; set/get IP multicast loopback */
1.463 +#else
1.464 +#define IP_MULTICAST_LOOP 11 /* u_char; set/get IP multicast loopback */
1.465 +#endif // __SYMBIAN32__
1.466 +#ifdef __SYMBIAN32__
1.467 +#define IP_ADD_MEMBERSHIP 0x46d /* ip_mreq; add an IP group membership */
1.468 +#else
1.469 +#define IP_ADD_MEMBERSHIP 12 /* ip_mreq; add an IP group membership */
1.470 +#endif // __SYMBIAN32__
1.471 +#ifdef __SYMBIAN32__
1.472 +#define IP_DROP_MEMBERSHIP 0x46e /* ip_mreq; drop an IP group membership */
1.473 +#else
1.474 +#define IP_DROP_MEMBERSHIP 13 /* ip_mreq; drop an IP group membership */
1.475 +#endif // __SYMBIAN32__
1.476 +#define IP_MULTICAST_VIF 14 /* set/get IP mcast virt. iface */
1.477 +#define IP_RSVP_ON 15 /* enable RSVP in kernel */
1.478 +#define IP_RSVP_OFF 16 /* disable RSVP in kernel */
1.479 +#define IP_RSVP_VIF_ON 17 /* set RSVP per-vif socket */
1.480 +#define IP_RSVP_VIF_OFF 18 /* unset RSVP per-vif socket */
1.481 +#define IP_PORTRANGE 19 /* int; range to choose for unspec port */
1.482 +#define IP_RECVIF 20 /* bool; receive reception if w/dgram */
1.483 +/* for IPSEC */
1.484 +#define IP_IPSEC_POLICY 21 /* int; set/get security policy */
1.485 +#define IP_FAITH 22 /* bool; accept FAITH'ed connections */
1.486 +
1.487 +#define IP_ONESBCAST 23 /* bool: send all-ones broadcast */
1.488 +
1.489 +#define IP_FW_TABLE_ADD 40 /* add entry */
1.490 +#define IP_FW_TABLE_DEL 41 /* delete entry */
1.491 +#define IP_FW_TABLE_FLUSH 42 /* flush table */
1.492 +#define IP_FW_TABLE_GETSIZE 43 /* get table size */
1.493 +#define IP_FW_TABLE_LIST 44 /* list table contents */
1.494 +
1.495 +#define IP_FW_ADD 50 /* add a firewall rule to chain */
1.496 +#define IP_FW_DEL 51 /* delete a firewall rule from chain */
1.497 +#define IP_FW_FLUSH 52 /* flush firewall rule chain */
1.498 +#define IP_FW_ZERO 53 /* clear single/all firewall counter(s) */
1.499 +#define IP_FW_GET 54 /* get entire firewall rule chain */
1.500 +#define IP_FW_RESETLOG 55 /* reset logging counters */
1.501 +
1.502 +#define IP_DUMMYNET_CONFIGURE 60 /* add/configure a dummynet pipe */
1.503 +#define IP_DUMMYNET_DEL 61 /* delete a dummynet pipe from chain */
1.504 +#define IP_DUMMYNET_FLUSH 62 /* flush dummynet */
1.505 +#define IP_DUMMYNET_GET 64 /* get entire dummynet pipes */
1.506 +
1.507 +#define IP_RECVTTL 65 /* bool; receive IP TTL w/dgram */
1.508 +#define IP_MINTTL 66 /* minimum TTL for packet or drop */
1.509 +#define IP_DONTFRAG 67 /* don't fragment packet */
1.510 +
1.511 +/*
1.512 + * Defaults and limits for options
1.513 + */
1.514 +#define IP_DEFAULT_MULTICAST_TTL 1 /* normally limit m'casts to 1 hop */
1.515 +#define IP_DEFAULT_MULTICAST_LOOP 1 /* normally hear sends if a member */
1.516 +#define IP_MAX_MEMBERSHIPS 20 /* per socket */
1.517 +
1.518 +/*
1.519 + * Argument structure for IP_ADD_MEMBERSHIP and IP_DROP_MEMBERSHIP.
1.520 + */
1.521 +struct ip_mreq {
1.522 + struct in_addr imr_multiaddr; /* IP multicast address of group */
1.523 + struct in_addr imr_interface; /* local IP address of interface */
1.524 +};
1.525 +
1.526 +/*
1.527 + * Argument for IP_PORTRANGE:
1.528 + * - which range to search when port is unspecified at bind() or connect()
1.529 + */
1.530 +#define IP_PORTRANGE_DEFAULT 0 /* default range */
1.531 +#define IP_PORTRANGE_HIGH 1 /* "high" - request firewall bypass */
1.532 +#define IP_PORTRANGE_LOW 2 /* "low" - vouchsafe security */
1.533 +
1.534 +/*
1.535 + * Definitions for inet sysctl operations.
1.536 + *
1.537 + * Third level is protocol number.
1.538 + * Fourth level is desired variable within that protocol.
1.539 + */
1.540 +#define IPPROTO_MAXID (IPPROTO_AH + 1) /* don't list to IPPROTO_MAX */
1.541 +
1.542 +#define CTL_IPPROTO_NAMES { \
1.543 + { "ip", CTLTYPE_NODE }, \
1.544 + { "icmp", CTLTYPE_NODE }, \
1.545 + { "igmp", CTLTYPE_NODE }, \
1.546 + { "ggp", CTLTYPE_NODE }, \
1.547 + { 0, 0 }, \
1.548 + { 0, 0 }, \
1.549 + { "tcp", CTLTYPE_NODE }, \
1.550 + { 0, 0 }, \
1.551 + { "egp", CTLTYPE_NODE }, \
1.552 + { 0, 0 }, \
1.553 + { 0, 0 }, \
1.554 + { 0, 0 }, \
1.555 + { "pup", CTLTYPE_NODE }, \
1.556 + { 0, 0 }, \
1.557 + { 0, 0 }, \
1.558 + { 0, 0 }, \
1.559 + { 0, 0 }, \
1.560 + { "udp", CTLTYPE_NODE }, \
1.561 + { 0, 0 }, \
1.562 + { 0, 0 }, \
1.563 + { 0, 0 }, \
1.564 + { 0, 0 }, \
1.565 + { "idp", CTLTYPE_NODE }, \
1.566 + { 0, 0 }, \
1.567 + { 0, 0 }, \
1.568 + { 0, 0 }, \
1.569 + { 0, 0 }, \
1.570 + { 0, 0 }, \
1.571 + { 0, 0 }, \
1.572 + { 0, 0 }, \
1.573 + { 0, 0 }, \
1.574 + { 0, 0 }, \
1.575 + { 0, 0 }, \
1.576 + { 0, 0 }, \
1.577 + { 0, 0 }, \
1.578 + { 0, 0 }, \
1.579 + { 0, 0 }, \
1.580 + { 0, 0 }, \
1.581 + { 0, 0 }, \
1.582 + { 0, 0 }, \
1.583 + { 0, 0 }, \
1.584 + { 0, 0 }, \
1.585 + { 0, 0 }, \
1.586 + { 0, 0 }, \
1.587 + { 0, 0 }, \
1.588 + { 0, 0 }, \
1.589 + { 0, 0 }, \
1.590 + { 0, 0 }, \
1.591 + { 0, 0 }, \
1.592 + { 0, 0 }, \
1.593 + { 0, 0 }, \
1.594 + { "ipsec", CTLTYPE_NODE }, \
1.595 + { 0, 0 }, \
1.596 + { 0, 0 }, \
1.597 + { 0, 0 }, \
1.598 + { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \
1.599 + { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \
1.600 + { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \
1.601 + { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \
1.602 + { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \
1.603 + { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \
1.604 + { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \
1.605 + { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \
1.606 + { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \
1.607 + { 0, 0 }, \
1.608 + { 0, 0 }, \
1.609 + { 0, 0 }, \
1.610 + { "pim", CTLTYPE_NODE }, \
1.611 +}
1.612 +
1.613 +/*
1.614 + * Names for IP sysctl objects
1.615 + */
1.616 +#define IPCTL_FORWARDING 1 /* act as router */
1.617 +#define IPCTL_SENDREDIRECTS 2 /* may send redirects when forwarding */
1.618 +#define IPCTL_DEFTTL 3 /* default TTL */
1.619 +#ifdef notyet
1.620 +#define IPCTL_DEFMTU 4 /* default MTU */
1.621 +#endif
1.622 +#define IPCTL_RTEXPIRE 5 /* cloned route expiration time */
1.623 +#define IPCTL_RTMINEXPIRE 6 /* min value for expiration time */
1.624 +#define IPCTL_RTMAXCACHE 7 /* trigger level for dynamic expire */
1.625 +#define IPCTL_SOURCEROUTE 8 /* may perform source routes */
1.626 +#define IPCTL_DIRECTEDBROADCAST 9 /* may re-broadcast received packets */
1.627 +#define IPCTL_INTRQMAXLEN 10 /* max length of netisr queue */
1.628 +#define IPCTL_INTRQDROPS 11 /* number of netisr q drops */
1.629 +#define IPCTL_STATS 12 /* ipstat structure */
1.630 +#define IPCTL_ACCEPTSOURCEROUTE 13 /* may accept source routed packets */
1.631 +#define IPCTL_FASTFORWARDING 14 /* use fast IP forwarding code */
1.632 +#define IPCTL_KEEPFAITH 15 /* FAITH IPv4->IPv6 translater ctl */
1.633 +#define IPCTL_GIF_TTL 16 /* default TTL for gif encap packet */
1.634 +#define IPCTL_MAXID 17
1.635 +
1.636 +#define IPCTL_NAMES { \
1.637 + { 0, 0 }, \
1.638 + { "forwarding", CTLTYPE_INT }, \
1.639 + { "redirect", CTLTYPE_INT }, \
1.640 + { "ttl", CTLTYPE_INT }, \
1.641 + { "mtu", CTLTYPE_INT }, \
1.642 + { "rtexpire", CTLTYPE_INT }, \
1.643 + { "rtminexpire", CTLTYPE_INT }, \
1.644 + { "rtmaxcache", CTLTYPE_INT }, \
1.645 + { "sourceroute", CTLTYPE_INT }, \
1.646 + { "directed-broadcast", CTLTYPE_INT }, \
1.647 + { "intr-queue-maxlen", CTLTYPE_INT }, \
1.648 + { "intr-queue-drops", CTLTYPE_INT }, \
1.649 + { "stats", CTLTYPE_STRUCT }, \
1.650 + { "accept_sourceroute", CTLTYPE_INT }, \
1.651 + { "fastforwarding", CTLTYPE_INT }, \
1.652 +}
1.653 +
1.654 +#endif /* __BSD_VISIBLE */
1.655 +
1.656 +#ifdef _KERNEL
1.657 +
1.658 +struct ifnet; struct mbuf; /* forward declarations for Standard C */
1.659 +
1.660 +char *inet_ntoa(struct in_addr); /* in libkern */
1.661 +
1.662 +#define in_hosteq(s, t) ((s).s_addr == (t).s_addr)
1.663 +#define in_nullhost(x) ((x).s_addr == INADDR_ANY)
1.664 +
1.665 +#define satosin(sa) ((struct sockaddr_in *)(sa))
1.666 +#define sintosa(sin) ((struct sockaddr *)(sin))
1.667 +#define ifatoia(ifa) ((struct in_ifaddr *)(ifa))
1.668 +
1.669 +#endif /* _KERNEL */
1.670 +
1.671 +/* INET6 stuff */
1.672 +#if __POSIX_VISIBLE >= 200112
1.673 +#define __KAME_NETINET_IN_H_INCLUDED_
1.674 +#include <stdapis/netinet6/in6.h>
1.675 +#undef __KAME_NETINET_IN_H_INCLUDED_
1.676 +#endif
1.677 +
1.678 +#ifndef _KERNEL
1.679 +
1.680 +__BEGIN_DECLS
1.681 +IMPORT_C int bindresvport (int __sockfd, struct sockaddr_in *__sock_in);
1.682 +__END_DECLS
1.683 +
1.684 +#endif /* _KERNEL */
1.685 +
1.686 +#endif /* !_NETINET_IN_H_*/