X-Git-Url: https://git.saurik.com/apple/xnu.git/blobdiff_plain/fe8ab488e9161c46dd9885d58fc52996dc0249ff..a39ff7e25e19b3a8c3020042a3872ca9ec9659f1:/bsd/netinet/in.h diff --git a/bsd/netinet/in.h b/bsd/netinet/in.h index 53c436517..07732679a 100644 --- a/bsd/netinet/in.h +++ b/bsd/netinet/in.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000-2013 Apple Inc. All rights reserved. + * Copyright (c) 2000-2017 Apple Inc. All rights reserved. * * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ * @@ -162,9 +162,9 @@ #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 */ @@ -364,10 +364,19 @@ struct in_addr { (((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) */ @@ -461,7 +470,7 @@ struct ip_opts { #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 */ @@ -505,7 +514,7 @@ struct ip_opts { #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 */ @@ -801,6 +810,42 @@ union sockaddr_in_4_6 { 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 @@ -815,17 +860,31 @@ extern boolean_t in_broadcast(struct in_addr, struct ifnet *); 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) \ @@ -855,17 +914,18 @@ extern uint16_t b_sum16(const void *buf, int len); /* exported for ApplicationFirewall */ extern int in_localaddr(struct in_addr); extern int inaddr_local(struct in_addr); + +extern char *inet_ntoa(struct in_addr); +extern char *inet_ntoa_r(struct in_addr ina, char *buf, + size_t buflen); +extern int inet_pton(int af, const char *, void *); #endif /* KERNEL_PRIVATE */ #define MAX_IPv4_STR_LEN 16 #define MAX_IPv6_STR_LEN 64 extern int inet_aton(const char *, struct in_addr *); /* in libkern */ -extern char *inet_ntoa(struct in_addr); /* in libkern */ -extern char *inet_ntoa_r(struct in_addr ina, char *buf, - size_t buflen); /* in libkern */ extern const char *inet_ntop(int, const void *, char *, socklen_t); /* in libkern*/ -extern int inet_pton(int af, const char *, void *); /* in libkern */ #endif /* KERNEL */ #ifndef KERNEL