+++ /dev/null
-/* $NetBSD: in.h,v 1.77 2006/11/13 05:13:41 dyoung Exp $ */\r
-\r
-/*\r
- * Copyright (c) 1982, 1986, 1990, 1993\r
- * The Regents of the University of California. All rights reserved.\r
- *\r
- * Redistribution and use in source and binary forms, with or without\r
- * modification, are permitted provided that the following conditions\r
- * are met:\r
- * 1. Redistributions of source code must retain the above copyright\r
- * notice, this list of conditions and the following disclaimer.\r
- * 2. Redistributions in binary form must reproduce the above copyright\r
- * notice, this list of conditions and the following disclaimer in the\r
- * documentation and/or other materials provided with the distribution.\r
- * 3. Neither the name of the University nor the names of its contributors\r
- * may be used to endorse or promote products derived from this software\r
- * without specific prior written permission.\r
- *\r
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\r
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\r
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\r
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\r
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\r
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\r
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\r
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\r
- * SUCH DAMAGE.\r
- *\r
- * @(#)in.h 8.3 (Berkeley) 1/3/94\r
- */\r
-\r
-/*\r
- * Constants and structures defined by the internet system,\r
- * Per RFC 790, September 1981, and numerous additions.\r
- */\r
-\r
-#ifndef _NETINET_IN_H_\r
-#define _NETINET_IN_H_\r
-\r
-#include <machine/int_types.h>\r
-\r
-#ifndef uint8_t\r
-typedef __uint8_t uint8_t;\r
-#define uint8_t __uint8_t\r
-#endif\r
-\r
-#ifndef uint32_t\r
-typedef __uint32_t uint32_t;\r
-#define uint32_t __uint32_t\r
-#endif\r
-\r
-#include <sys/ansi.h>\r
-\r
-#ifndef in_addr_t\r
-typedef __in_addr_t in_addr_t;\r
-#define in_addr_t __in_addr_t\r
-#endif\r
-\r
-#ifndef in_port_t\r
-typedef __in_port_t in_port_t;\r
-#define in_port_t __in_port_t\r
-#endif\r
-\r
-#ifndef sa_family_t\r
-typedef __sa_family_t sa_family_t;\r
-#define sa_family_t __sa_family_t\r
-#endif\r
-\r
-/*\r
- * Protocols\r
- */\r
-#define IPPROTO_IP 0 /* dummy for IP */\r
-#define IPPROTO_HOPOPTS 0 /* IP6 hop-by-hop options */\r
-#define IPPROTO_ICMP 1 /* control message protocol */\r
-#define IPPROTO_IGMP 2 /* group mgmt protocol */\r
-#define IPPROTO_GGP 3 /* gateway^2 (deprecated) */\r
-#define IPPROTO_IPV4 4 /* IP header */\r
-#define IPPROTO_IPIP 4 /* IP inside IP */\r
-#define IPPROTO_TCP 6 /* tcp */\r
-#define IPPROTO_EGP 8 /* exterior gateway protocol */\r
-#define IPPROTO_PUP 12 /* pup */\r
-#define IPPROTO_UDP 17 /* user datagram protocol */\r
-#define IPPROTO_IDP 22 /* xns idp */\r
-#define IPPROTO_TP 29 /* tp-4 w/ class negotiation */\r
-#define IPPROTO_IPV6 41 /* IP6 header */\r
-#define IPPROTO_ROUTING 43 /* IP6 routing header */\r
-#define IPPROTO_FRAGMENT 44 /* IP6 fragmentation header */\r
-#define IPPROTO_RSVP 46 /* resource reservation */\r
-#define IPPROTO_GRE 47 /* GRE encaps RFC 1701 */\r
-#define IPPROTO_ESP 50 /* encap. security payload */\r
-#define IPPROTO_AH 51 /* authentication header */\r
-#define IPPROTO_MOBILE 55 /* IP Mobility RFC 2004 */\r
-#define IPPROTO_IPV6_ICMP 58 /* IPv6 ICMP */\r
-#define IPPROTO_ICMPV6 58 /* ICMP6 */\r
-#define IPPROTO_NONE 59 /* IP6 no next header */\r
-#define IPPROTO_DSTOPTS 60 /* IP6 destination option */\r
-#define IPPROTO_EON 80 /* ISO cnlp */\r
-#define IPPROTO_ETHERIP 97 /* Ethernet-in-IP */\r
-#define IPPROTO_ENCAP 98 /* encapsulation header */\r
-#define IPPROTO_PIM 103 /* Protocol indep. multicast */\r
-#define IPPROTO_IPCOMP 108 /* IP Payload Comp. Protocol */\r
-#define IPPROTO_VRRP 112 /* VRRP RFC 2338 */\r
-#define IPPROTO_CARP 112 /* Common Address Resolution Protocol */\r
-#define IPPROTO_RAW 255 /* raw IP packet */\r
-#define IPPROTO_MAX 256\r
-\r
-/* last return value of *_input(), meaning "all job for this pkt is done". */\r
-#define IPPROTO_DONE 257\r
-\r
-/* sysctl placeholder for (FAST_)IPSEC */\r
-#define CTL_IPPROTO_IPSEC 258\r
-\r
-\r
-/*\r
- * Local port number conventions:\r
- *\r
- * Ports < IPPORT_RESERVED are reserved for privileged processes (e.g. root),\r
- * unless a kernel is compiled with IPNOPRIVPORTS defined.\r
- *\r
- * When a user does a bind(2) or connect(2) with a port number of zero,\r
- * a non-conflicting local port address is chosen.\r
- *\r
- * The default range is IPPORT_ANONMIN to IPPORT_ANONMAX, although\r
- * that is settable by sysctl(3); net.inet.ip.anonportmin and\r
- * net.inet.ip.anonportmax respectively.\r
- *\r
- * A user may set the IPPROTO_IP option IP_PORTRANGE to change this\r
- * default assignment range.\r
- *\r
- * The value IP_PORTRANGE_DEFAULT causes the default behavior.\r
- *\r
- * The value IP_PORTRANGE_HIGH is the same as IP_PORTRANGE_DEFAULT,\r
- * and exists only for FreeBSD compatibility purposes.\r
- *\r
- * The value IP_PORTRANGE_LOW changes the range to the "low" are\r
- * that is (by convention) restricted to privileged processes.\r
- * This convention is based on "vouchsafe" principles only.\r
- * It is only secure if you trust the remote host to restrict these ports.\r
- * The range is IPPORT_RESERVEDMIN to IPPORT_RESERVEDMAX.\r
- */\r
-\r
-#define IPPORT_RESERVED 1024\r
-#define IPPORT_ANONMIN 49152\r
-#define IPPORT_ANONMAX 65535\r
-#define IPPORT_RESERVEDMIN 600\r
-#define IPPORT_RESERVEDMAX (IPPORT_RESERVED-1)\r
-\r
-/*\r
- * Internet address (a structure for historical reasons)\r
- */\r
-struct in_addr {\r
- in_addr_t s_addr;\r
-} __attribute__((__packed__));\r
-\r
-/*\r
- * Definitions of bits in internet address integers.\r
- * On subnets, the decomposition of addresses to host and net parts\r
- * is done according to subnet mask, not the masks here.\r
- *\r
- * By byte-swapping the constants, we avoid ever having to byte-swap IP\r
- * addresses inside the kernel. Unfortunately, user-level programs rely\r
- * on these macros not doing byte-swapping.\r
- */\r
-#ifdef _KERNEL\r
-#define __IPADDR(x) ((uint32_t) htonl((uint32_t)(x)))\r
-#else\r
-#define __IPADDR(x) ((uint32_t)(x))\r
-#endif\r
-\r
-#define IN_CLASSA(i) (((uint32_t)(i) & __IPADDR(0x80000000)) == \\r
- __IPADDR(0x00000000))\r
-#define IN_CLASSA_NET __IPADDR(0xff000000)\r
-#define IN_CLASSA_NSHIFT 24\r
-#define IN_CLASSA_HOST __IPADDR(0x00ffffff)\r
-#define IN_CLASSA_MAX 128\r
-\r
-#define IN_CLASSB(i) (((uint32_t)(i) & __IPADDR(0xc0000000)) == \\r
- __IPADDR(0x80000000))\r
-#define IN_CLASSB_NET __IPADDR(0xffff0000)\r
-#define IN_CLASSB_NSHIFT 16\r
-#define IN_CLASSB_HOST __IPADDR(0x0000ffff)\r
-#define IN_CLASSB_MAX 65536\r
-\r
-#define IN_CLASSC(i) (((uint32_t)(i) & __IPADDR(0xe0000000)) == \\r
- __IPADDR(0xc0000000))\r
-#define IN_CLASSC_NET __IPADDR(0xffffff00)\r
-#define IN_CLASSC_NSHIFT 8\r
-#define IN_CLASSC_HOST __IPADDR(0x000000ff)\r
-\r
-#define IN_CLASSD(i) (((uint32_t)(i) & __IPADDR(0xf0000000)) == \\r
- __IPADDR(0xe0000000))\r
-/* These ones aren't really net and host fields, but routing needn't know. */\r
-#define IN_CLASSD_NET __IPADDR(0xf0000000)\r
-#define IN_CLASSD_NSHIFT 28\r
-#define IN_CLASSD_HOST __IPADDR(0x0fffffff)\r
-#define IN_MULTICAST(i) IN_CLASSD(i)\r
-\r
-#define IN_EXPERIMENTAL(i) (((uint32_t)(i) & __IPADDR(0xf0000000)) == \\r
- __IPADDR(0xf0000000))\r
-#define IN_BADCLASS(i) (((uint32_t)(i) & __IPADDR(0xf0000000)) == \\r
- __IPADDR(0xf0000000))\r
-\r
-#define IN_LINKLOCAL(i) (((uint32_t)(i) & __IPADDR(0xffff0000)) == \\r
- __IPADDR(0xa9fe0000))\r
-\r
-#define IN_PRIVATE(i) ((((uint32_t)(i) & __IPADDR(0xff000000)) == \\r
- __IPADDR(0x0a000000)) || \\r
- (((uint32_t)(i) & __IPADDR(0xfff00000)) == \\r
- __IPADDR(0xac100000)) || \\r
- (((uint32_t)(i) & __IPADDR(0xffff0000)) == \\r
- __IPADDR(0xc0a80000)))\r
-\r
-#define IN_LOCAL_GROUP(i) (((uint32_t)(i) & __IPADDR(0xffffff00)) == \\r
- __IPADDR(0xe0000000))\r
-\r
-#define IN_ANY_LOCAL(i) (IN_LINKLOCAL(i) || IN_LOCAL_GROUP(i))\r
-\r
-#define INADDR_ANY __IPADDR(0x00000000)\r
-#define INADDR_LOOPBACK __IPADDR(0x7f000001)\r
-#define INADDR_BROADCAST __IPADDR(0xffffffff) /* must be masked */\r
-#define INADDR_NONE __IPADDR(0xffffffff) /* -1 return */\r
-\r
-#define INADDR_UNSPEC_GROUP __IPADDR(0xe0000000) /* 224.0.0.0 */\r
-#define INADDR_ALLHOSTS_GROUP __IPADDR(0xe0000001) /* 224.0.0.1 */\r
-#define INADDR_ALLRTRS_GROUP __IPADDR(0xe0000002) /* 224.0.0.2 */\r
-#define INADDR_CARP_GROUP __IPADDR(0xe0000012) /* 224.0.0.18 */\r
-#define INADDR_MAX_LOCAL_GROUP __IPADDR(0xe00000ff) /* 224.0.0.255 */\r
-\r
-#define IN_LOOPBACKNET 127 /* official! */\r
-\r
-/*\r
- * Socket address, internet style.\r
- */\r
-struct sockaddr_in {\r
- uint8_t sin_len;\r
- sa_family_t sin_family;\r
- in_port_t sin_port;\r
- struct in_addr sin_addr;\r
- __int8_t sin_zero[8];\r
-};\r
-\r
-#define INET_ADDRSTRLEN 16\r
-\r
-/*\r
- * Structure used to describe IP options.\r
- * Used to store options internally, to pass them to a process,\r
- * or to restore options retrieved earlier.\r
- * The ip_dst is used for the first-hop gateway when using a source route\r
- * (this gets put into the header proper).\r
- */\r
-struct ip_opts {\r
- struct in_addr ip_dst; /* first hop, 0 w/o src rt */\r
-#if defined(__cplusplus)\r
- __int8_t Ip_opts[40]; /* actually variable in size */\r
-#else\r
- __int8_t ip_opts[40]; /* actually variable in size */\r
-#endif\r
-};\r
-\r
-/*\r
- * Options for use with [gs]etsockopt at the IP level.\r
- * First word of comment is data type; bool is stored in int.\r
- */\r
-#define IP_OPTIONS 1 /* buf/ip_opts; set/get IP options */\r
-#define IP_HDRINCL 2 /* int; header is included with data */\r
-#define IP_TOS 3 /* int; IP type of service and preced. */\r
-#define IP_TTL 4 /* int; IP time to live */\r
-#define IP_RECVOPTS 5 /* bool; receive all IP opts w/dgram */\r
-#define IP_RECVRETOPTS 6 /* bool; receive IP opts for response */\r
-#define IP_RECVDSTADDR 7 /* bool; receive IP dst addr w/dgram */\r
-#define IP_RETOPTS 8 /* ip_opts; set/get IP options */\r
-#define IP_MULTICAST_IF 9 /* in_addr; set/get IP multicast i/f */\r
-#define IP_MULTICAST_TTL 10 /* u_char; set/get IP multicast ttl */\r
-#define IP_MULTICAST_LOOP 11 /* u_char; set/get IP multicast loopback */\r
-#define IP_ADD_MEMBERSHIP 12 /* ip_mreq; add an IP group membership */\r
-#define IP_DROP_MEMBERSHIP 13 /* ip_mreq; drop an IP group membership */\r
-#define IP_PORTRANGE 19 /* int; range to use for ephemeral port */\r
-#define IP_RECVIF 20 /* bool; receive reception if w/dgram */\r
-#define IP_ERRORMTU 21 /* int; get MTU of last xmit = EMSGSIZE */\r
-#if 1 /*IPSEC*/\r
-#define IP_IPSEC_POLICY 22 /* struct; get/set security policy */\r
-#endif\r
-\r
-/*\r
- * Defaults and limits for options\r
- */\r
-#define IP_DEFAULT_MULTICAST_TTL 1 /* normally limit m'casts to 1 hop */\r
-#define IP_DEFAULT_MULTICAST_LOOP 1 /* normally hear sends if a member */\r
-#define IP_MAX_MEMBERSHIPS 20 /* per socket; must fit in one mbuf */\r
-\r
-/*\r
- * Argument structure for IP_ADD_MEMBERSHIP and IP_DROP_MEMBERSHIP.\r
- */\r
-struct ip_mreq {\r
- struct in_addr imr_multiaddr; /* IP multicast address of group */\r
- struct in_addr imr_interface; /* local IP address of interface */\r
-};\r
-\r
-/*\r
- * Argument for IP_PORTRANGE:\r
- * - which range to search when port is unspecified at bind() or connect()\r
- */\r
-#define IP_PORTRANGE_DEFAULT 0 /* default range */\r
-#define IP_PORTRANGE_HIGH 1 /* same as DEFAULT (FreeBSD compat) */\r
-#define IP_PORTRANGE_LOW 2 /* use privileged range */\r
-\r
-#if defined(_NETBSD_SOURCE)\r
-/*\r
- * Definitions for inet sysctl operations.\r
- *\r
- * Third level is protocol number.\r
- * Fourth level is desired variable within that protocol.\r
- */\r
-#define IPPROTO_MAXID (IPPROTO_AH + 1) /* don't list to IPPROTO_MAX */\r
-\r
-#define CTL_IPPROTO_NAMES { \\r
- { "ip", CTLTYPE_NODE }, \\r
- { "icmp", CTLTYPE_NODE }, \\r
- { "igmp", CTLTYPE_NODE }, \\r
- { "ggp", CTLTYPE_NODE }, \\r
- { 0, 0 }, \\r
- { 0, 0 }, \\r
- { "tcp", CTLTYPE_NODE }, \\r
- { 0, 0 }, \\r
- { "egp", CTLTYPE_NODE }, \\r
- { 0, 0 }, \\r
- { 0, 0 }, \\r
- { 0, 0 }, \\r
- { "pup", CTLTYPE_NODE }, \\r
- { 0, 0 }, \\r
- { 0, 0 }, \\r
- { 0, 0 }, \\r
- { 0, 0 }, \\r
- { "udp", CTLTYPE_NODE }, \\r
- { 0, 0 }, \\r
- { 0, 0 }, \\r
- { 0, 0 }, \\r
- { 0, 0 }, \\r
- { "idp", CTLTYPE_NODE }, \\r
- { 0, 0 }, \\r
- { 0, 0 }, \\r
- { 0, 0 }, \\r
- { 0, 0 }, \\r
- { 0, 0 }, \\r
- { 0, 0 }, \\r
- { 0, 0 }, \\r
- { 0, 0 }, \\r
- { 0, 0 }, \\r
- { 0, 0 }, \\r
- { 0, 0 }, \\r
- { 0, 0 }, \\r
- { 0, 0 }, \\r
- { 0, 0 }, \\r
- { 0, 0 }, \\r
- { 0, 0 }, \\r
- { 0, 0 }, \\r
- { 0, 0 }, \\r
- { 0, 0 }, \\r
- { 0, 0 }, \\r
- { 0, 0 }, \\r
- { 0, 0 }, \\r
- { 0, 0 }, \\r
- { 0, 0 }, \\r
- { 0, 0 }, \\r
- { 0, 0 }, \\r
- { 0, 0 }, \\r
- { 0, 0 }, \\r
- { "ipsec", CTLTYPE_NODE }, \\r
- { 0, 0 }, \\r
- { 0, 0 }, \\r
- { 0, 0 }, \\r
- { 0, 0 }, \\r
- { 0, 0 }, \\r
- { 0, 0 }, \\r
- { 0, 0 }, \\r
- { 0, 0 }, \\r
- { 0, 0 }, \\r
- { 0, 0 }, \\r
- { 0, 0 }, \\r
- { 0, 0 }, \\r
- { 0, 0 }, \\r
- { 0, 0 }, \\r
- { 0, 0 }, \\r
- { 0, 0 }, \\r
- { 0, 0 }, \\r
- { 0, 0 }, \\r
- { 0, 0 }, \\r
- { 0, 0 }, \\r
- { 0, 0 }, \\r
- { 0, 0 }, \\r
- { 0, 0 }, \\r
- { 0, 0 }, \\r
- { 0, 0 }, \\r
- { 0, 0 }, \\r
- { 0, 0 }, \\r
- { 0, 0 }, \\r
- { 0, 0 }, \\r
- { 0, 0 }, \\r
- { 0, 0 }, \\r
- { 0, 0 }, \\r
- { 0, 0 }, \\r
- { 0, 0 }, \\r
- { 0, 0 }, \\r
- { 0, 0 }, \\r
- { 0, 0 }, \\r
- { 0, 0 }, \\r
- { 0, 0 }, \\r
- { 0, 0 }, \\r
- { 0, 0 }, \\r
- { 0, 0 }, \\r
- { 0, 0 }, \\r
- { 0, 0 }, \\r
- { 0, 0 }, \\r
- { 0, 0 }, \\r
- { 0, 0 }, \\r
- { 0, 0 }, \\r
- { 0, 0 }, \\r
- { 0, 0 }, \\r
- { 0, 0 }, \\r
- { "pim", CTLTYPE_NODE }, \\r
-}\r
-\r
-/*\r
- * Names for IP sysctl objects\r
- */\r
-#define IPCTL_FORWARDING 1 /* act as router */\r
-#define IPCTL_SENDREDIRECTS 2 /* may send redirects when forwarding */\r
-#define IPCTL_DEFTTL 3 /* default TTL */\r
-#ifdef notyet\r
-#define IPCTL_DEFMTU 4 /* default MTU */\r
-#endif\r
-#define IPCTL_FORWSRCRT 5 /* forward source-routed packets */\r
-#define IPCTL_DIRECTEDBCAST 6 /* default broadcast behavior */\r
-#define IPCTL_ALLOWSRCRT 7 /* allow/drop all source-routed pkts */\r
-#define IPCTL_SUBNETSARELOCAL 8 /* treat subnets as local addresses */\r
-#define IPCTL_MTUDISC 9 /* allow path MTU discovery */\r
-#define IPCTL_ANONPORTMIN 10 /* minimum ephemeral port */\r
-#define IPCTL_ANONPORTMAX 11 /* maximum ephemeral port */\r
-#define IPCTL_MTUDISCTIMEOUT 12 /* allow path MTU discovery */\r
-#define IPCTL_MAXFLOWS 13 /* maximum ip flows allowed */\r
-#define IPCTL_HOSTZEROBROADCAST 14 /* is host zero a broadcast addr? */\r
-#define IPCTL_GIF_TTL 15 /* default TTL for gif encap packet */\r
-#define IPCTL_LOWPORTMIN 16 /* minimum reserved port */\r
-#define IPCTL_LOWPORTMAX 17 /* maximum reserved port */\r
-#define IPCTL_MAXFRAGPACKETS 18 /* max packets reassembly queue */\r
-#define IPCTL_GRE_TTL 19 /* default TTL for gre encap packet */\r
-#define IPCTL_CHECKINTERFACE 20 /* drop pkts in from 'wrong' iface */\r
-#define IPCTL_IFQ 21 /* ipintrq node */\r
-#define IPCTL_RANDOMID 22 /* use random IP ids (if configured) */\r
-#define IPCTL_LOOPBACKCKSUM 23 /* do IP checksum on loopback */\r
-#define IPCTL_STATS 24 /* IP statistics */\r
-#define IPCTL_MAXID 25\r
-\r
-#define IPCTL_NAMES { \\r
- { 0, 0 }, \\r
- { "forwarding", CTLTYPE_INT }, \\r
- { "redirect", CTLTYPE_INT }, \\r
- { "ttl", CTLTYPE_INT }, \\r
- { "mtu", CTLTYPE_INT }, \\r
- { "forwsrcrt", CTLTYPE_INT }, \\r
- { "directed-broadcast", CTLTYPE_INT }, \\r
- { "allowsrcrt", CTLTYPE_INT }, \\r
- { "subnetsarelocal", CTLTYPE_INT }, \\r
- { "mtudisc", CTLTYPE_INT }, \\r
- { "anonportmin", CTLTYPE_INT }, \\r
- { "anonportmax", CTLTYPE_INT }, \\r
- { "mtudisctimeout", CTLTYPE_INT }, \\r
- { "maxflows", CTLTYPE_INT }, \\r
- { "hostzerobroadcast", CTLTYPE_INT }, \\r
- { "gifttl", CTLTYPE_INT }, \\r
- { "lowportmin", CTLTYPE_INT }, \\r
- { "lowportmax", CTLTYPE_INT }, \\r
- { "maxfragpackets", CTLTYPE_INT }, \\r
- { "grettl", CTLTYPE_INT }, \\r
- { "checkinterface", CTLTYPE_INT }, \\r
- { "ifq", CTLTYPE_NODE }, \\r
- { "random_id", CTLTYPE_INT }, \\r
- { "do_loopback_cksum", CTLTYPE_INT }, \\r
- { "stats", CTLTYPE_STRUCT }, \\r
-}\r
-#endif /* _NETBSD_SOURCE */\r
-\r
-/* INET6 stuff */\r
-#define __KAME_NETINET_IN_H_INCLUDED_\r
-#include <netinet6/in6.h>\r
-#undef __KAME_NETINET_IN_H_INCLUDED_\r
-\r
-#ifdef _KERNEL\r
-/*\r
- * in_cksum_phdr:\r
- *\r
- * Compute significant parts of the IPv4 checksum pseudo-header\r
- * for use in a delayed TCP/UDP checksum calculation.\r
- *\r
- * Args:\r
- *\r
- * src Source IP address\r
- * dst Destination IP address\r
- * lenproto htons(proto-hdr-len + proto-number)\r
- */\r
-static __inline u_int16_t __attribute__((__unused__))\r
-in_cksum_phdr(u_int32_t src, u_int32_t dst, u_int32_t lenproto)\r
-{\r
- u_int32_t sum;\r
-\r
- sum = lenproto +\r
- (u_int16_t)(src >> 16) +\r
- (u_int16_t)(src /*& 0xffff*/) +\r
- (u_int16_t)(dst >> 16) +\r
- (u_int16_t)(dst /*& 0xffff*/);\r
-\r
- sum = (u_int16_t)(sum >> 16) + (u_int16_t)(sum /*& 0xffff*/);\r
-\r
- if (sum > 0xffff)\r
- sum -= 0xffff;\r
-\r
- return (sum);\r
-}\r
-\r
-/*\r
- * in_cksum_addword:\r
- *\r
- * Add the two 16-bit network-order values, carry, and return.\r
- */\r
-static __inline u_int16_t __attribute__((__unused__))\r
-in_cksum_addword(u_int16_t a, u_int16_t b)\r
-{\r
- u_int32_t sum = a + b;\r
-\r
- if (sum > 0xffff)\r
- sum -= 0xffff;\r
-\r
- return (sum);\r
-}\r
-\r
-extern struct in_addr zeroin_addr;\r
-extern u_char ip_protox[];\r
-\r
-int in_broadcast(struct in_addr, struct ifnet *);\r
-int in_canforward(struct in_addr);\r
-int in_cksum(struct mbuf *, int);\r
-int in4_cksum(struct mbuf *, u_int8_t, int, int);\r
-void in_delayed_cksum(struct mbuf *);\r
-int in_localaddr(struct in_addr);\r
-void in_socktrim(struct sockaddr_in *);\r
-\r
-#define in_hosteq(s,t) ((s).s_addr == (t).s_addr)\r
-#define in_nullhost(x) ((x).s_addr == INADDR_ANY)\r
-\r
-#define satosin(sa) ((struct sockaddr_in *)(sa))\r
-#define sintosa(sin) ((struct sockaddr *)(sin))\r
-#define ifatoia(ifa) ((struct in_ifaddr *)(ifa))\r
-#endif /* _KERNEL */\r
-\r
-#endif /* !_NETINET_IN_H_ */\r