/*
- * Copyright (c) 2000-2013 Apple Inc. All rights reserved.
+ * Copyright (c) 2000-2017 Apple Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
#define IPPROTO_SWIPE 53 /* IP with encryption */
#define IPPROTO_NHRP 54 /* Next Hop Resolution */
/* 55-57: Unassigned */
-#define IPPROTO_ICMPV6 58 /* ICMP6 */
-#define IPPROTO_NONE 59 /* IP6 no next header */
-#define IPPROTO_DSTOPTS 60 /* IP6 destination option */
+#define IPPROTO_ICMPV6 58 /* ICMP6 */
+#define IPPROTO_NONE 59 /* IP6 no next header */
+#define IPPROTO_DSTOPTS 60 /* IP6 destination option */
#define IPPROTO_AHIP 61 /* any host internal protocol */
#define IPPROTO_CFTP 62 /* CFTP */
#define IPPROTO_HELLO 63 /* "hello" routing protocol */
(((u_int32_t)(i) & 0xfff00000) == 0xac100000) || \
(((u_int32_t)(i) & 0xffff0000) == 0xc0a80000))
+#ifdef PRIVATE
+#define IN_SHARED_ADDRESS_SPACE(i) ((((u_int32_t)(i)) & (u_int32_t)0xffc00000) \
+ == (u_int32_t)0x64400000)
+
+#define IN_DS_LITE(i) ((((u_int32_t)(i)) & (u_int32_t)0xfffffff8) == (u_int32_t)0xc0000000)
+
+#define IN_6TO4_RELAY_ANYCAST(i) ((((u_int32_t)(i)) & (u_int32_t)IN_CLASSC_NET) == (u_int32_t)0xc0586300)
+#endif
+
#define IN_LOCAL_GROUP(i) (((u_int32_t)(i) & 0xffffff00) == 0xe0000000)
-
+
#define IN_ANY_LOCAL(i) (IN_LINKLOCAL(i) || IN_LOCAL_GROUP(i))
-#endif
+#endif /* __APPLE__ */
#define IN_LOOPBACKNET 127 /* official! */
#endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */
#define IP_BOUND_IF 25 /* int; set/get bound interface */
#define IP_PKTINFO 26 /* get pktinfo on recv socket, set src on sent dgram */
#define IP_RECVPKTINFO IP_PKTINFO /* receive pktinfo w/dgram */
-
+#define IP_RECVTOS 27 /* bool; receive IP TOS w/dgram */
#define IP_FW_ADD 40 /* add a firewall rule to chain */
#define IP_FW_DEL 41 /* delete a firewall rule from chain */
#define MCAST_UNBLOCK_SOURCE 85 /* unblock a source */
#ifdef PRIVATE
-#define IP_FORCE_OUT_IFP 69 /* deprecated; use IP_BOUND_IF instead */
+#define IP_FORCE_OUT_IFP 69 /* not implemented; use IP_BOUND_IF instead */
#define IP_NO_IFT_CELLULAR 6969 /* for internal use only */
#define IP_NO_IFT_PDP IP_NO_IFT_CELLULAR /* deprecated */
#define IP_OUT_IF 9696 /* for internal use only */
struct sockaddr_in sin;
struct sockaddr_in6 sin6;
};
+
+/*
+ * Recommended DiffServ Code Point values
+ */
+
+#define _DSCP_DF 0 /* RFC 2474 */
+
+#define _DSCP_CS0 0 /* RFC 2474 */
+#define _DSCP_CS1 8 /* RFC 2474 */
+#define _DSCP_CS2 16 /* RFC 2474 */
+#define _DSCP_CS3 24 /* RFC 2474 */
+#define _DSCP_CS4 32 /* RFC 2474 */
+#define _DSCP_CS5 40 /* RFC 2474 */
+#define _DSCP_CS6 48 /* RFC 2474 */
+#define _DSCP_CS7 56 /* RFC 2474 */
+
+#define _DSCP_EF 46 /* RFC 2474 */
+#define _DSCP_VA 44 /* RFC 5865 */
+
+#define _DSCP_AF11 10 /* RFC 2597 */
+#define _DSCP_AF12 12 /* RFC 2597 */
+#define _DSCP_AF13 14 /* RFC 2597 */
+#define _DSCP_AF21 18 /* RFC 2597 */
+#define _DSCP_AF22 20 /* RFC 2597 */
+#define _DSCP_AF23 22 /* RFC 2597 */
+#define _DSCP_AF31 26 /* RFC 2597 */
+#define _DSCP_AF32 28 /* RFC 2597 */
+#define _DSCP_AF33 30 /* RFC 2597 */
+#define _DSCP_AF41 34 /* RFC 2597 */
+#define _DSCP_AF42 36 /* RFC 2597 */
+#define _DSCP_AF43 38 /* RFC 2597 */
+
+#define _DSCP_52 52 /* Wi-Fi WMM Certification: Sigma */
+
+#define _MAX_DSCP 63 /* coded on 6 bits */
+
#endif /* PRIVATE */
#ifdef KERNEL
extern boolean_t in_canforward(struct in_addr);
extern u_int32_t in_netof(struct in_addr);
+extern uint32_t os_cpu_in_cksum_mbuf(struct mbuf *m, int len, int off,
+ uint32_t initial_sum);
+
extern uint16_t inet_cksum(struct mbuf *, uint32_t, uint32_t, uint32_t);
+extern uint16_t inet_cksum_buffer(const void *, uint32_t, uint32_t, uint32_t);
extern uint16_t in_addword(uint16_t, uint16_t);
extern uint16_t in_pseudo(uint32_t, uint32_t, uint32_t);
extern uint16_t in_pseudo64(uint64_t, uint64_t, uint64_t);
extern uint16_t in_cksum_hdr_opt(const struct ip *);
extern uint16_t ip_cksum_hdr_dir(struct mbuf *, uint32_t, int);
+extern uint16_t ip_cksum_hdr_dir_buffer(const void *, uint32_t, uint32_t, int);
extern uint32_t in_finalize_cksum(struct mbuf *, uint32_t, uint32_t);
extern uint16_t b_sum16(const void *buf, int len);
+#if DEBUG || DEVELOPMENT
+extern uint32_t in_cksum_mbuf_ref(struct mbuf *, int, int, uint32_t);
+#endif /* DEBUG || DEVELOPMENT */
+
+extern int in_getconninfo(struct socket *, sae_connid_t, uint32_t *,
+ uint32_t *, int32_t *, user_addr_t, socklen_t *, user_addr_t, socklen_t *,
+ uint32_t *, user_addr_t, uint32_t *);
#define in_cksum(_m, _l) \
inet_cksum(_m, 0, 0, _l)
+#define in_cksum_buffer(_b, _l) \
+ inet_cksum_buffer(_b, 0, 0, _l)
#define ip_cksum_hdr_in(_m, _l) \
ip_cksum_hdr_dir(_m, _l, 0)
#define ip_cksum_hdr_out(_m, _l) \