epoc32/include/stdapis/netinet/in.h
author William Roberts <williamr@symbian.org>
Wed, 31 Mar 2010 12:33:34 +0100
branchSymbian3
changeset 4 837f303aceeb
parent 2 2fe1408b6811
permissions -rw-r--r--
Current Symbian^3 public API header files (from PDK 3.0.h)
This is the epoc32/include tree with the "platform" subtrees removed, and
all but a selected few mbg and rsg files removed.
     1 // © Portions copyright (c) 2006 Nokia Corporation.  All rights reserved.
     2 
     3 /*-
     4  * Copyright (c) 1982, 1986, 1990, 1993
     5  *	The Regents of the University of California.  All rights reserved.
     6  *
     7  * Redistribution and use in source and binary forms, with or without
     8  * modification, are permitted provided that the following conditions
     9  * are met:
    10  * 1. Redistributions of source code must retain the above copyright
    11  *    notice, this list of conditions and the following disclaimer.
    12  * 2. Redistributions in binary form must reproduce the above copyright
    13  *    notice, this list of conditions and the following disclaimer in the
    14  *    documentation and/or other materials provided with the distribution.
    15  * 4. Neither the name of the University nor the names of its contributors
    16  *    may be used to endorse or promote products derived from this software
    17  *    without specific prior written permission.
    18  *
    19  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
    20  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
    21  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
    22  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
    23  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
    24  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
    25  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
    26  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
    27  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
    28  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
    29  * SUCH DAMAGE.
    30  *
    31  *	@(#)in.h	8.3 (Berkeley) 1/3/94
    32  * $FreeBSD: src/sys/netinet/in.h,v 1.90.2.3 2005/10/02 15:45:47 andre Exp $
    33  */
    34 
    35 #ifndef _NETINET_IN_H_
    36 #define	_NETINET_IN_H_
    37 
    38 #include <sys/cdefs.h>
    39 #include <sys/_types.h>
    40 #include <stdapis/machine/endian.h>
    41 
    42 /* Protocols common to RFC 1700, POSIX, and X/Open. */
    43 #ifdef __SYMBIAN32__
    44 #define	IPPROTO_IP		0x100	/* KProtocolInetIp */
    45 #else
    46 #define	IPPROTO_IP		0		/* dummy for IP */
    47 #endif	// __SYMBIAN32__
    48 #define	IPPROTO_ICMP		1		/* control message protocol KProtocolInetIcmp */
    49 #define	IPPROTO_TCP		6		/* tcp  KProtocolInetTcp */
    50 #define	IPPROTO_UDP		17		/* user datagram protocol KProtocolInetUdp */
    51 
    52 #define	INADDR_ANY		(u_int32_t)0x00000000
    53 #define	INADDR_BROADCAST	(u_int32_t)0xffffffff	/* must be masked */
    54 
    55 #ifndef _UINT8_T_DECLARED
    56 typedef	__uint8_t		uint8_t;
    57 #define	_UINT8_T_DECLARED
    58 #endif
    59 
    60 #ifndef _UINT16_T_DECLARED
    61 typedef	__uint16_t		uint16_t;
    62 #define	_UINT16_T_DECLARED
    63 #endif
    64 
    65 #ifndef _UINT32_T_DECLARED
    66 typedef	__uint32_t		uint32_t;
    67 #define	_UINT32_T_DECLARED
    68 #endif
    69 
    70 #ifndef _IN_ADDR_T_DECLARED
    71 typedef	uint32_t		in_addr_t;
    72 #define	_IN_ADDR_T_DECLARED
    73 #endif
    74 
    75 #ifndef _IN_PORT_T_DECLARED
    76 typedef	uint16_t		in_port_t;
    77 #define	_IN_PORT_T_DECLARED
    78 #endif
    79 
    80 #ifndef _SA_FAMILY_T_DECLARED
    81 typedef	__sa_family_t		sa_family_t;
    82 #define	_SA_FAMILY_T_DECLARED
    83 #endif
    84 
    85 /* Internet address (a structure for historical reasons). */
    86 #ifndef	_STRUCT_IN_ADDR_DECLARED
    87 struct in_addr {
    88 	in_addr_t s_addr;
    89 };
    90 #define	_STRUCT_IN_ADDR_DECLARED
    91 #endif
    92 
    93 /* Socket address, internet style. */
    94 #ifdef __SYMBIAN32__
    95 struct sockaddr_in {
    96 	u_short	sin_family;
    97 	u_short	sin_port;
    98 	struct	in_addr sin_addr;
    99 	char	sin_zero[20];
   100 };
   101 #else
   102 struct sockaddr_in {
   103 	uint8_t	sin_len;
   104 	sa_family_t	sin_family;
   105 	in_port_t	sin_port;
   106 	struct	in_addr sin_addr;
   107 	char	sin_zero[8];
   108 };
   109 #endif	// __SYMBIAN32__
   110 
   111 #ifdef __SYMBIAN32__
   112 #define SOL_IP		0x100	/* options for IP level KSolInetIp */
   113 #define SOL_TCP		0x106	/* options for TCP level KSolInetTcp */
   114 
   115 /*
   116  * User-settable options (used with setsockopt).
   117  */
   118 #define	TCP_NODELAY	0x304	/* don't delay send to coalesce packets KSoTcpNoDelay */
   119 #define	TCP_MAXSEG	0x303	/* set maximum segment size KSoTcpMaxSegSize */
   120 
   121 #endif //__SYMBIAN32__
   122 
   123 #ifndef _KERNEL
   124 
   125 #ifndef _BYTEORDER_PROTOTYPED
   126 #define	_BYTEORDER_PROTOTYPED
   127 __BEGIN_DECLS
   128 IMPORT_C uint32_t	htonl(uint32_t);
   129 IMPORT_C uint16_t	htons(uint16_t);
   130 uint32_t	ntohl(uint32_t);
   131 uint16_t	ntohs(uint16_t);
   132 __END_DECLS
   133 #endif
   134 
   135 #ifndef _BYTEORDER_FUNC_DEFINED
   136 #define	_BYTEORDER_FUNC_DEFINED
   137 #define	htonl(x)	__htonl(x)
   138 #define	htons(x)	__htons(x)
   139 #define	ntohl(x)	__ntohl(x)
   140 #define	ntohs(x)	__ntohs(x)
   141 #endif
   142 
   143 #endif /* !_KERNEL */
   144 
   145 #if __POSIX_VISIBLE >= 200112
   146 #define	IPPROTO_RAW		255		/* raw IP packet */
   147 #define	INET_ADDRSTRLEN		16
   148 #endif
   149 
   150 #if __BSD_VISIBLE
   151 /*
   152  * Constants and structures defined by the internet system,
   153  * Per RFC 790, September 1981, and numerous additions.
   154  */
   155 
   156 /*
   157  * Protocols (RFC 1700)
   158  */
   159 #define	IPPROTO_HOPOPTS		0		/* IP6 hop-by-hop options */
   160 #define	IPPROTO_IGMP		2		/* group mgmt protocol */
   161 #define	IPPROTO_GGP		3		/* gateway^2 (deprecated) */
   162 #define	IPPROTO_IPV4		4		/* IPv4 encapsulation */
   163 #define	IPPROTO_IPIP		IPPROTO_IPV4	/* for compatibility */
   164 #define	IPPROTO_ST		7		/* Stream protocol II */
   165 #define	IPPROTO_EGP		8		/* exterior gateway protocol */
   166 #define	IPPROTO_PIGP		9		/* private interior gateway */
   167 #define	IPPROTO_RCCMON		10		/* BBN RCC Monitoring */
   168 #define	IPPROTO_NVPII		11		/* network voice protocol*/
   169 #define	IPPROTO_PUP		12		/* pup */
   170 #define	IPPROTO_ARGUS		13		/* Argus */
   171 #define	IPPROTO_EMCON		14		/* EMCON */
   172 #define	IPPROTO_XNET		15		/* Cross Net Debugger */
   173 #define	IPPROTO_CHAOS		16		/* Chaos*/
   174 #define	IPPROTO_MUX		18		/* Multiplexing */
   175 #define	IPPROTO_MEAS		19		/* DCN Measurement Subsystems */
   176 #define	IPPROTO_HMP		20		/* Host Monitoring */
   177 #define	IPPROTO_PRM		21		/* Packet Radio Measurement */
   178 #define	IPPROTO_IDP		22		/* xns idp */
   179 #define	IPPROTO_TRUNK1		23		/* Trunk-1 */
   180 #define	IPPROTO_TRUNK2		24		/* Trunk-2 */
   181 #define	IPPROTO_LEAF1		25		/* Leaf-1 */
   182 #define	IPPROTO_LEAF2		26		/* Leaf-2 */
   183 #define	IPPROTO_RDP		27		/* Reliable Data */
   184 #define	IPPROTO_IRTP		28		/* Reliable Transaction */
   185 #define	IPPROTO_TP		29		/* tp-4 w/ class negotiation */
   186 #define	IPPROTO_BLT		30		/* Bulk Data Transfer */
   187 #define	IPPROTO_NSP		31		/* Network Services */
   188 #define	IPPROTO_INP		32		/* Merit Internodal */
   189 #define	IPPROTO_SEP		33		/* Sequential Exchange */
   190 #define	IPPROTO_3PC		34		/* Third Party Connect */
   191 #define	IPPROTO_IDPR		35		/* InterDomain Policy Routing */
   192 #define	IPPROTO_XTP		36		/* XTP */
   193 #define	IPPROTO_DDP		37		/* Datagram Delivery */
   194 #define	IPPROTO_CMTP		38		/* Control Message Transport */
   195 #define	IPPROTO_TPXX		39		/* TP++ Transport */
   196 #define	IPPROTO_IL		40		/* IL transport protocol */
   197 #define	IPPROTO_IPV6		41		/* IP6 header */
   198 #define	IPPROTO_SDRP		42		/* Source Demand Routing */
   199 #define	IPPROTO_ROUTING		43		/* IP6 routing header */
   200 #define	IPPROTO_FRAGMENT	44		/* IP6 fragmentation header */
   201 #define	IPPROTO_IDRP		45		/* InterDomain Routing*/
   202 #define	IPPROTO_RSVP		46		/* resource reservation */
   203 #define	IPPROTO_GRE		47		/* General Routing Encap. */
   204 #define	IPPROTO_MHRP		48		/* Mobile Host Routing */
   205 #define	IPPROTO_BHA		49		/* BHA */
   206 #define	IPPROTO_ESP		50		/* IP6 Encap Sec. Payload */
   207 #define	IPPROTO_AH		51		/* IP6 Auth Header */
   208 #define	IPPROTO_INLSP		52		/* Integ. Net Layer Security */
   209 #define	IPPROTO_SWIPE		53		/* IP with encryption */
   210 #define	IPPROTO_NHRP		54		/* Next Hop Resolution */
   211 #define	IPPROTO_MOBILE		55		/* IP Mobility */
   212 #define	IPPROTO_TLSP		56		/* Transport Layer Security */
   213 #define	IPPROTO_SKIP		57		/* SKIP */
   214 #define	IPPROTO_ICMPV6		58		/* ICMP6 */
   215 #define	IPPROTO_NONE		59		/* IP6 no next header */
   216 #define	IPPROTO_DSTOPTS		60		/* IP6 destination option */
   217 #define	IPPROTO_AHIP		61		/* any host internal protocol */
   218 #define	IPPROTO_CFTP		62		/* CFTP */
   219 #define	IPPROTO_HELLO		63		/* "hello" routing protocol */
   220 #define	IPPROTO_SATEXPAK	64		/* SATNET/Backroom EXPAK */
   221 #define	IPPROTO_KRYPTOLAN	65		/* Kryptolan */
   222 #define	IPPROTO_RVD		66		/* Remote Virtual Disk */
   223 #define	IPPROTO_IPPC		67		/* Pluribus Packet Core */
   224 #define	IPPROTO_ADFS		68		/* Any distributed FS */
   225 #define	IPPROTO_SATMON		69		/* Satnet Monitoring */
   226 #define	IPPROTO_VISA		70		/* VISA Protocol */
   227 #define	IPPROTO_IPCV		71		/* Packet Core Utility */
   228 #define	IPPROTO_CPNX		72		/* Comp. Prot. Net. Executive */
   229 #define	IPPROTO_CPHB		73		/* Comp. Prot. HeartBeat */
   230 #define	IPPROTO_WSN		74		/* Wang Span Network */
   231 #define	IPPROTO_PVP		75		/* Packet Video Protocol */
   232 #define	IPPROTO_BRSATMON	76		/* BackRoom SATNET Monitoring */
   233 #define	IPPROTO_ND		77		/* Sun net disk proto (temp.) */
   234 #define	IPPROTO_WBMON		78		/* WIDEBAND Monitoring */
   235 #define	IPPROTO_WBEXPAK		79		/* WIDEBAND EXPAK */
   236 #define	IPPROTO_EON		80		/* ISO cnlp */
   237 #define	IPPROTO_VMTP		81		/* VMTP */
   238 #define	IPPROTO_SVMTP		82		/* Secure VMTP */
   239 #define	IPPROTO_VINES		83		/* Banyon VINES */
   240 #define	IPPROTO_TTP		84		/* TTP */
   241 #define	IPPROTO_IGP		85		/* NSFNET-IGP */
   242 #define	IPPROTO_DGP		86		/* dissimilar gateway prot. */
   243 #define	IPPROTO_TCF		87		/* TCF */
   244 #define	IPPROTO_IGRP		88		/* Cisco/GXS IGRP */
   245 #define	IPPROTO_OSPFIGP		89		/* OSPFIGP */
   246 #define	IPPROTO_SRPC		90		/* Strite RPC protocol */
   247 #define	IPPROTO_LARP		91		/* Locus Address Resoloution */
   248 #define	IPPROTO_MTP		92		/* Multicast Transport */
   249 #define	IPPROTO_AX25		93		/* AX.25 Frames */
   250 #define	IPPROTO_IPEIP		94		/* IP encapsulated in IP */
   251 #define	IPPROTO_MICP		95		/* Mobile Int.ing control */
   252 #define	IPPROTO_SCCSP		96		/* Semaphore Comm. security */
   253 #define	IPPROTO_ETHERIP		97		/* Ethernet IP encapsulation */
   254 #ifdef __SYMBIAN32__
   255 #define	IPPROTO_ENCAP		4		/* IP in IP encapsulation */
   256 #else
   257 #define	IPPROTO_ENCAP		98		/* encapsulation header */
   258 #endif	// __SYMBIAN32__
   259 #define	IPPROTO_APES		99		/* any private encr. scheme */
   260 #define	IPPROTO_GMTP		100		/* GMTP*/
   261 #define	IPPROTO_IPCOMP		108		/* payload compression (IPComp) */
   262 /* 101-254: Partly Unassigned */
   263 #define	IPPROTO_PIM		103		/* Protocol Independent Mcast */
   264 #define	IPPROTO_CARP		112		/* CARP */
   265 #define	IPPROTO_PGM		113		/* PGM */
   266 #define	IPPROTO_PFSYNC		240		/* PFSYNC */
   267 /* 255: Reserved */
   268 /* BSD Private, local use, namespace incursion, no longer used */
   269 #define	IPPROTO_OLD_DIVERT	254		/* OLD divert pseudo-proto */
   270 #ifdef __SYMBIAN32__
   271 #define	IPPROTO_MAX		0x101
   272 #else
   273 #define	IPPROTO_MAX		256
   274 #endif	// __SYMBIAN32__
   275 
   276 /* last return value of *_input(), meaning "all job for this pkt is done".  */
   277 #define	IPPROTO_DONE		257
   278 
   279 /* Only used internally, so can be outside the range of valid IP protocols. */
   280 #define	IPPROTO_DIVERT		258		/* divert pseudo-protocol */
   281 
   282 /*
   283  * Defined to avoid confusion.  The master value is defined by
   284  * PROTO_SPACER in sys/protosw.h.
   285  */
   286 #define	IPPROTO_SPACER		32767		/* spacer for loadable protos */
   287 
   288 /*
   289  * Local port number conventions:
   290  *
   291  * When a user does a bind(2) or connect(2) with a port number of zero,
   292  * a non-conflicting local port address is chosen.
   293  * The default range is IPPORT_HIFIRSTAUTO through
   294  * IPPORT_HILASTAUTO, although that is settable by sysctl.
   295  *
   296  * A user may set the IPPROTO_IP option IP_PORTRANGE to change this
   297  * default assignment range.
   298  *
   299  * The value IP_PORTRANGE_DEFAULT causes the default behavior.
   300  *
   301  * The value IP_PORTRANGE_HIGH changes the range of candidate port numbers
   302  * into the "high" range.  These are reserved for client outbound connections
   303  * which do not want to be filtered by any firewalls.  Note that by default
   304  * this is the same as IP_PORTRANGE_DEFAULT.
   305  *
   306  * The value IP_PORTRANGE_LOW changes the range to the "low" are
   307  * that is (by convention) restricted to privileged processes.  This
   308  * convention is based on "vouchsafe" principles only.  It is only secure
   309  * if you trust the remote host to restrict these ports.
   310  *
   311  * The default range of ports and the high range can be changed by
   312  * sysctl(3).  (net.inet.ip.port{hi,low}{first,last}_auto)
   313  *
   314  * Changing those values has bad security implications if you are
   315  * using a stateless firewall that is allowing packets outside of that
   316  * range in order to allow transparent outgoing connections.
   317  *
   318  * Such a firewall configuration will generally depend on the use of these
   319  * default values.  If you change them, you may find your Security
   320  * Administrator looking for you with a heavy object.
   321  *
   322  * For a slightly more orthodox text view on this:
   323  *
   324  *            ftp://ftp.isi.edu/in-notes/iana/assignments/port-numbers
   325  *
   326  *    port numbers are divided into three ranges:
   327  *
   328  *                0 -  1023 Well Known Ports
   329  *             1024 - 49151 Registered Ports
   330  *            49152 - 65535 Dynamic and/or Private Ports
   331  *
   332  */
   333 
   334 /*
   335  * Ports < IPPORT_RESERVED are reserved for
   336  * privileged processes (e.g. root).         (IP_PORTRANGE_LOW)
   337  */
   338 #define	IPPORT_RESERVED		1024
   339 
   340 /*
   341  * Default local port range, used by both IP_PORTRANGE_DEFAULT
   342  * and IP_PORTRANGE_HIGH.
   343  */
   344 #define	IPPORT_HIFIRSTAUTO	49152
   345 #define	IPPORT_HILASTAUTO	65535
   346 
   347 /*
   348  * Scanning for a free reserved port return a value below IPPORT_RESERVED,
   349  * but higher than IPPORT_RESERVEDSTART.  Traditionally the start value was
   350  * 512, but that conflicts with some well-known-services that firewalls may
   351  * have a fit if we use.
   352  */
   353 #define	IPPORT_RESERVEDSTART	600
   354 
   355 #define	IPPORT_MAX		65535
   356 
   357 /*
   358  * Definitions of bits in internet address integers.
   359  * On subnets, the decomposition of addresses to host and net parts
   360  * is done according to subnet mask, not the masks here.
   361  */
   362 #define	IN_CLASSA(i)		(((u_int32_t)(i) & 0x80000000) == 0)
   363 #define	IN_CLASSA_NET		0xff000000
   364 #define	IN_CLASSA_NSHIFT	24
   365 #define	IN_CLASSA_HOST		0x00ffffff
   366 #define	IN_CLASSA_MAX		128
   367 
   368 #define	IN_CLASSB(i)		(((u_int32_t)(i) & 0xc0000000) == 0x80000000)
   369 #define	IN_CLASSB_NET		0xffff0000
   370 #define	IN_CLASSB_NSHIFT	16
   371 #define	IN_CLASSB_HOST		0x0000ffff
   372 #define	IN_CLASSB_MAX		65536
   373 
   374 #define	IN_CLASSC(i)		(((u_int32_t)(i) & 0xe0000000) == 0xc0000000)
   375 #define	IN_CLASSC_NET		0xffffff00
   376 #define	IN_CLASSC_NSHIFT	8
   377 #define	IN_CLASSC_HOST		0x000000ff
   378 
   379 #define	IN_CLASSD(i)		(((u_int32_t)(i) & 0xf0000000) == 0xe0000000)
   380 #define	IN_CLASSD_NET		0xf0000000	/* These ones aren't really */
   381 #define	IN_CLASSD_NSHIFT	28		/* net and host fields, but */
   382 #define	IN_CLASSD_HOST		0x0fffffff	/* routing needn't know.    */
   383 #define	IN_MULTICAST(i)		IN_CLASSD(i)
   384 
   385 #define	IN_EXPERIMENTAL(i)	(((u_int32_t)(i) & 0xf0000000) == 0xf0000000)
   386 #define	IN_BADCLASS(i)		(((u_int32_t)(i) & 0xf0000000) == 0xf0000000)
   387 
   388 #define	INADDR_LOOPBACK		(u_int32_t)0x7f000001
   389 #ifndef _KERNEL
   390 #define	INADDR_NONE		0xffffffff		/* -1 return */
   391 #endif
   392 
   393 #define	INADDR_UNSPEC_GROUP	(u_int32_t)0xe0000000	/* 224.0.0.0 */
   394 #define	INADDR_ALLHOSTS_GROUP	(u_int32_t)0xe0000001	/* 224.0.0.1 */
   395 #define	INADDR_ALLRTRS_GROUP	(u_int32_t)0xe0000002	/* 224.0.0.2 */
   396 #define	INADDR_CARP_GROUP	(u_int32_t)0xe0000012	/* 224.0.0.18 */
   397 #define	INADDR_PFSYNC_GROUP	(u_int32_t)0xe00000f0	/* 224.0.0.240 */
   398 #define	INADDR_ALLMDNS_GROUP	(u_int32_t)0xe00000fb	/* 224.0.0.251 */
   399 #define	INADDR_MAX_LOCAL_GROUP	(u_int32_t)0xe00000ff	/* 224.0.0.255 */
   400 
   401 #define	IN_LOOPBACKNET		127			/* official! */
   402 
   403 /*
   404  * Options for use with [gs]etsockopt at the IP level.
   405  * First word of comment is data type; bool is stored in int.
   406  */
   407 #ifdef __SYMBIAN32__
   408 #define	IP_OPTIONS		0x306   /* buf/ip_opts; set/get IP options */
   409 #else
   410 #define	IP_OPTIONS		1		/* buf/ip_opts; set/get IP options */
   411 #endif	// __SYMBIAN32__
   412 #ifdef __SYMBIAN32__
   413 #define	IP_HDRINCL		0x308	/* int; header is included with data */
   414 #else
   415 #define	IP_HDRINCL		2		/* int; header is included with data */
   416 #endif	// __SYMBIAN32__
   417 #ifdef __SYMBIAN32__
   418 #define	IP_TOS			0x309	/* int; IP type of service and preced. */
   419 #else
   420 #define	IP_TOS			3		/* int; IP type of service and preced. */
   421 #endif	// __SYMBIAN32__
   422 #ifdef __SYMBIAN32__
   423 #define	IP_TTL			0x310	/* int; IP time to live */
   424 #else
   425 #define	IP_TTL			4    /* int; IP time to live */
   426 #endif	// __SYMBIAN32__
   427 #ifdef __SYMBIAN32__
   428 #define	IP_RECVOPTS		-1    /* bool; receive all IP opts w/dgram */
   429 #else
   430 #define	IP_RECVOPTS		5    /* bool; receive all IP opts w/dgram */
   431 #endif
   432 #ifdef __SYMBIAN32__
   433 #define	IP_RECVRETOPTS		-2    /* bool; receive IP opts for response */
   434 #else
   435 #define	IP_RECVRETOPTS		6    /* bool; receive IP opts for response */
   436 #endif
   437 #ifdef __SYMBIAN32__
   438 #define	IP_RECVDSTADDR		-3    /* bool; receive IP dst addr w/dgram */
   439 #else
   440 #define	IP_RECVDSTADDR		7    /* bool; receive IP dst addr w/dgram */
   441 #endif
   442 #define	IP_SENDSRCADDR		IP_RECVDSTADDR /* cmsg_type to set src addr */
   443 #ifdef __SYMBIAN32__
   444 #define	IP_RETOPTS		-4    /* ip_opts; set/get IP options */
   445 #else
   446 #define	IP_RETOPTS		8    /* ip_opts; set/get IP options */
   447 #endif	// __SYMBIAN32__
   448 #ifdef __SYMBIAN32__
   449 #define	IP_MULTICAST_IF		-5	/* set/get IP multicast interface  */
   450 #else
   451 #define	IP_MULTICAST_IF		9    /* u_char; set/get IP multicast i/f  */
   452 #endif	// __SYMBIAN32__
   453 #ifdef __SYMBIAN32__
   454 #define	IP_MULTICAST_TTL	-6	/* set/get IP multicast timetolive */
   455 #else
   456 #define	IP_MULTICAST_TTL	10   /* u_char; set/get IP multicast ttl */
   457 #endif	// __SYMBIAN32__
   458 #ifdef __SYMBIAN32__
   459 #define	IP_MULTICAST_LOOP	-7   /* u_char; set/get IP multicast loopback */
   460 #else
   461 #define	IP_MULTICAST_LOOP	11   /* u_char; set/get IP multicast loopback */
   462 #endif	// __SYMBIAN32__
   463 #ifdef __SYMBIAN32__
   464 #define	IP_ADD_MEMBERSHIP	0x46d   /* ip_mreq; add an IP group membership */
   465 #else
   466 #define	IP_ADD_MEMBERSHIP	12   /* ip_mreq; add an IP group membership */
   467 #endif	// __SYMBIAN32__
   468 #ifdef __SYMBIAN32__
   469 #define	IP_DROP_MEMBERSHIP	0x46e   /* ip_mreq; drop an IP group membership */
   470 #else
   471 #define	IP_DROP_MEMBERSHIP	13   /* ip_mreq; drop an IP group membership */
   472 #endif	// __SYMBIAN32__
   473 #define	IP_MULTICAST_VIF	14   /* set/get IP mcast virt. iface */
   474 #define	IP_RSVP_ON		15   /* enable RSVP in kernel */
   475 #define	IP_RSVP_OFF		16   /* disable RSVP in kernel */
   476 #define	IP_RSVP_VIF_ON		17   /* set RSVP per-vif socket */
   477 #define	IP_RSVP_VIF_OFF		18   /* unset RSVP per-vif socket */
   478 #define	IP_PORTRANGE		19   /* int; range to choose for unspec port */
   479 #define	IP_RECVIF		20   /* bool; receive reception if w/dgram */
   480 /* for IPSEC */
   481 #define	IP_IPSEC_POLICY		21   /* int; set/get security policy */
   482 #define	IP_FAITH		22   /* bool; accept FAITH'ed connections */
   483 
   484 #define	IP_ONESBCAST		23   /* bool: send all-ones broadcast */
   485 
   486 #define	IP_FW_TABLE_ADD		40   /* add entry */
   487 #define	IP_FW_TABLE_DEL		41   /* delete entry */
   488 #define	IP_FW_TABLE_FLUSH	42   /* flush table */
   489 #define	IP_FW_TABLE_GETSIZE	43   /* get table size */
   490 #define	IP_FW_TABLE_LIST	44   /* list table contents */
   491 
   492 #define	IP_FW_ADD		50   /* add a firewall rule to chain */
   493 #define	IP_FW_DEL		51   /* delete a firewall rule from chain */
   494 #define	IP_FW_FLUSH		52   /* flush firewall rule chain */
   495 #define	IP_FW_ZERO		53   /* clear single/all firewall counter(s) */
   496 #define	IP_FW_GET		54   /* get entire firewall rule chain */
   497 #define	IP_FW_RESETLOG		55   /* reset logging counters */
   498 
   499 #define	IP_DUMMYNET_CONFIGURE	60   /* add/configure a dummynet pipe */
   500 #define	IP_DUMMYNET_DEL		61   /* delete a dummynet pipe from chain */
   501 #define	IP_DUMMYNET_FLUSH	62   /* flush dummynet */
   502 #define	IP_DUMMYNET_GET		64   /* get entire dummynet pipes */
   503 
   504 #define	IP_RECVTTL		65   /* bool; receive IP TTL w/dgram */
   505 #define	IP_MINTTL		66   /* minimum TTL for packet or drop */
   506 #define	IP_DONTFRAG		67   /* don't fragment packet */
   507 
   508 /*
   509  * Defaults and limits for options
   510  */
   511 #define	IP_DEFAULT_MULTICAST_TTL  1	/* normally limit m'casts to 1 hop  */
   512 #define	IP_DEFAULT_MULTICAST_LOOP 1	/* normally hear sends if a member  */
   513 #define	IP_MAX_MEMBERSHIPS	20	/* per socket */
   514 
   515 /*
   516  * Argument structure for IP_ADD_MEMBERSHIP and IP_DROP_MEMBERSHIP.
   517  */
   518 struct ip_mreq {
   519 	struct	in_addr imr_multiaddr;	/* IP multicast address of group */
   520 	struct	in_addr imr_interface;	/* local IP address of interface */
   521 };
   522 
   523 /*
   524  * Argument for IP_PORTRANGE:
   525  * - which range to search when port is unspecified at bind() or connect()
   526  */
   527 #define	IP_PORTRANGE_DEFAULT	0	/* default range */
   528 #define	IP_PORTRANGE_HIGH	1	/* "high" - request firewall bypass */
   529 #define	IP_PORTRANGE_LOW	2	/* "low" - vouchsafe security */
   530 
   531 /*
   532  * Definitions for inet sysctl operations.
   533  *
   534  * Third level is protocol number.
   535  * Fourth level is desired variable within that protocol.
   536  */
   537 #define	IPPROTO_MAXID	(IPPROTO_AH + 1)	/* don't list to IPPROTO_MAX */
   538 
   539 #define	CTL_IPPROTO_NAMES { \
   540 	{ "ip", CTLTYPE_NODE }, \
   541 	{ "icmp", CTLTYPE_NODE }, \
   542 	{ "igmp", CTLTYPE_NODE }, \
   543 	{ "ggp", CTLTYPE_NODE }, \
   544 	{ 0, 0 }, \
   545 	{ 0, 0 }, \
   546 	{ "tcp", CTLTYPE_NODE }, \
   547 	{ 0, 0 }, \
   548 	{ "egp", CTLTYPE_NODE }, \
   549 	{ 0, 0 }, \
   550 	{ 0, 0 }, \
   551 	{ 0, 0 }, \
   552 	{ "pup", CTLTYPE_NODE }, \
   553 	{ 0, 0 }, \
   554 	{ 0, 0 }, \
   555 	{ 0, 0 }, \
   556 	{ 0, 0 }, \
   557 	{ "udp", CTLTYPE_NODE }, \
   558 	{ 0, 0 }, \
   559 	{ 0, 0 }, \
   560 	{ 0, 0 }, \
   561 	{ 0, 0 }, \
   562 	{ "idp", CTLTYPE_NODE }, \
   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 	{ 0, 0 }, \
   572 	{ 0, 0 }, \
   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 	{ "ipsec", CTLTYPE_NODE }, \
   592 	{ 0, 0 }, \
   593 	{ 0, 0 }, \
   594 	{ 0, 0 }, \
   595 	{ 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \
   596 	{ 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \
   597 	{ 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \
   598 	{ 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \
   599 	{ 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \
   600 	{ 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \
   601 	{ 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \
   602 	{ 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \
   603 	{ 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \
   604 	{ 0, 0 }, \
   605 	{ 0, 0 }, \
   606 	{ 0, 0 }, \
   607 	{ "pim", CTLTYPE_NODE }, \
   608 }
   609 
   610 /*
   611  * Names for IP sysctl objects
   612  */
   613 #define	IPCTL_FORWARDING	1	/* act as router */
   614 #define	IPCTL_SENDREDIRECTS	2	/* may send redirects when forwarding */
   615 #define	IPCTL_DEFTTL		3	/* default TTL */
   616 #ifdef notyet
   617 #define	IPCTL_DEFMTU		4	/* default MTU */
   618 #endif
   619 #define	IPCTL_RTEXPIRE		5	/* cloned route expiration time */
   620 #define	IPCTL_RTMINEXPIRE	6	/* min value for expiration time */
   621 #define	IPCTL_RTMAXCACHE	7	/* trigger level for dynamic expire */
   622 #define	IPCTL_SOURCEROUTE	8	/* may perform source routes */
   623 #define	IPCTL_DIRECTEDBROADCAST	9	/* may re-broadcast received packets */
   624 #define	IPCTL_INTRQMAXLEN	10	/* max length of netisr queue */
   625 #define	IPCTL_INTRQDROPS	11	/* number of netisr q drops */
   626 #define	IPCTL_STATS		12	/* ipstat structure */
   627 #define	IPCTL_ACCEPTSOURCEROUTE	13	/* may accept source routed packets */
   628 #define	IPCTL_FASTFORWARDING	14	/* use fast IP forwarding code */
   629 #define	IPCTL_KEEPFAITH		15	/* FAITH IPv4->IPv6 translater ctl */
   630 #define	IPCTL_GIF_TTL		16	/* default TTL for gif encap packet */
   631 #define	IPCTL_MAXID		17
   632 
   633 #define	IPCTL_NAMES { \
   634 	{ 0, 0 }, \
   635 	{ "forwarding", CTLTYPE_INT }, \
   636 	{ "redirect", CTLTYPE_INT }, \
   637 	{ "ttl", CTLTYPE_INT }, \
   638 	{ "mtu", CTLTYPE_INT }, \
   639 	{ "rtexpire", CTLTYPE_INT }, \
   640 	{ "rtminexpire", CTLTYPE_INT }, \
   641 	{ "rtmaxcache", CTLTYPE_INT }, \
   642 	{ "sourceroute", CTLTYPE_INT }, \
   643 	{ "directed-broadcast", CTLTYPE_INT }, \
   644 	{ "intr-queue-maxlen", CTLTYPE_INT }, \
   645 	{ "intr-queue-drops", CTLTYPE_INT }, \
   646 	{ "stats", CTLTYPE_STRUCT }, \
   647 	{ "accept_sourceroute", CTLTYPE_INT }, \
   648 	{ "fastforwarding", CTLTYPE_INT }, \
   649 }
   650 
   651 #endif /* __BSD_VISIBLE */
   652 
   653 #ifdef _KERNEL
   654 
   655 struct ifnet; struct mbuf;	/* forward declarations for Standard C */
   656 
   657 char	*inet_ntoa(struct in_addr); /* in libkern */
   658 
   659 #define	in_hosteq(s, t)	((s).s_addr == (t).s_addr)
   660 #define	in_nullhost(x)	((x).s_addr == INADDR_ANY)
   661 
   662 #define	satosin(sa)	((struct sockaddr_in *)(sa))
   663 #define	sintosa(sin)	((struct sockaddr *)(sin))
   664 #define	ifatoia(ifa)	((struct in_ifaddr *)(ifa))
   665 
   666 #endif /* _KERNEL */
   667 
   668 /* INET6 stuff */
   669 #if __POSIX_VISIBLE >= 200112
   670 #define	__KAME_NETINET_IN_H_INCLUDED_
   671 #include <stdapis/netinet6/in6.h>
   672 #undef __KAME_NETINET_IN_H_INCLUDED_
   673 #endif
   674 
   675 #ifndef _KERNEL
   676 
   677 __BEGIN_DECLS
   678 IMPORT_C int bindresvport (int __sockfd, struct sockaddr_in *__sock_in);
   679 __END_DECLS
   680 
   681 #endif /* _KERNEL */
   682 
   683 #endif /* !_NETINET_IN_H_*/