+#ifdef BSD_KERNEL_PRIVATE
+#include <mach/boolean.h>
+
+struct ip;
+struct ifnet;
+struct mbuf;
+
+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) \
+ ip_cksum_hdr_dir(_m, _l, 1)
+
+#define in_cksum_hdr(_ip) \
+ (~b_sum16(_ip, sizeof (struct ip)) & 0xffff)
+
+#define in_cksum_offset(_m, _o) \
+ ((void) in_finalize_cksum(_m, _o, CSUM_DELAY_IP))
+#define in_delayed_cksum(_m) \
+ ((void) in_finalize_cksum(_m, 0, CSUM_DELAY_DATA))
+#define in_delayed_cksum_offset(_m, _o) \
+ ((void) in_finalize_cksum(_m, _o, CSUM_DELAY_DATA))
+
+#define in_hosteq(s, t) ((s).s_addr == (t).s_addr)
+#define in_nullhost(x) ((x).s_addr == INADDR_ANY)
+#define in_allhosts(x) ((x).s_addr == htonl(INADDR_ALLHOSTS_GROUP))
+
+#define SIN(s) ((struct sockaddr_in *)(void *)s)
+#define satosin(sa) SIN(sa)
+#define sintosa(sin) ((struct sockaddr *)(void *)(sin))
+#define SINIFSCOPE(s) ((struct sockaddr_inifscope *)(void *)(s))
+#endif /* BSD_KERNEL_PRIVATE */
+
+#ifdef KERNEL_PRIVATE
+/* 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 const char *inet_ntop(int, const void *, char *, socklen_t); /* in libkern*/