+#pragma pack(4)
+
+#if defined(__LP64__)
+struct _inpcb_list_entry {
+ u_int32_t le_next;
+ u_int32_t le_prev;
+};
+#define _INPCB_PTR(x) u_int32_t
+#define _INPCB_LIST_ENTRY(x) struct _inpcb_list_entry
+#else /* !__LP64__ */
+#define _INPCB_PTR(x) x
+#define _INPCB_LIST_ENTRY(x) LIST_ENTRY(x)
+#endif /* !__LP64__ */
+
+#ifdef XNU_KERNEL_PRIVATE
+/*
+ * This is a copy of the inpcb as it shipped in Panther. This structure
+ * is filled out in a copy function. This allows the inpcb to change
+ * without breaking userland tools.
+ *
+ * CAUTION: Many fields may not be filled out. Fewer may be filled out
+ * in the future. Code defensively.
+ */
+struct inpcb_compat {
+#else
+struct inpcbinfo;
+struct inpcbport;
+struct mbuf;
+struct ip6_pktopts;
+struct ip6_moptions;
+struct icmp6_filter;
+struct inpcbpolicy;
+
+struct inpcb {
+#endif /* KERNEL_PRIVATE */
+ _INPCB_LIST_ENTRY(inpcb) inp_hash; /* hash list */
+ struct in_addr reserved1; /* reserved */
+ struct in_addr reserved2; /* reserved */
+ u_short inp_fport; /* foreign port */
+ u_short inp_lport; /* local port */
+ _INPCB_LIST_ENTRY(inpcb) inp_list; /* list for all peer PCBs */
+ _INPCB_PTR(caddr_t) inp_ppcb; /* per-protocol pcb */
+ _INPCB_PTR(struct inpcbinfo *) inp_pcbinfo; /* PCB list info */
+ _INPCB_PTR(void *) inp_socket; /* back pointer to socket */
+ u_char nat_owner; /* Used to NAT TCP/UDP traffic */
+ u_int32_t nat_cookie; /* Cookie stored and returned to NAT */
+ _INPCB_LIST_ENTRY(inpcb) inp_portlist; /* this PCB's local port list */
+ _INPCB_PTR(struct inpcbport *) inp_phd; /* head of this list */
+ inp_gen_t inp_gencnt; /* generation count of this instance */
+ int inp_flags; /* generic IP/datagram flags */
+ u_int32_t inp_flow;
+
+ u_char inp_vflag;
+
+ u_char inp_ip_ttl; /* time to live proto */
+ u_char inp_ip_p; /* protocol proto */
+ /* protocol dependent part */
+ union {
+ /* foreign host table entry */
+ struct in_addr_4in6 inp46_foreign;
+ struct in6_addr inp6_foreign;
+ } inp_dependfaddr;
+ union {
+ /* local host table entry */
+ struct in_addr_4in6 inp46_local;
+ struct in6_addr inp6_local;
+ } inp_dependladdr;
+ union {
+ /* placeholder for routing entry */
+ u_char inp4_route[20];
+ u_char inp6_route[32];
+ } inp_dependroute;
+ struct {
+ /* type of service proto */
+ u_char inp4_ip_tos;
+ /* IP options */
+ _INPCB_PTR(struct mbuf *) inp4_options;
+ /* IP multicast options */
+ _INPCB_PTR(struct ip_moptions *) inp4_moptions;
+ } inp_depend4;
+
+ struct {
+ /* IP options */
+ _INPCB_PTR(struct mbuf *) inp6_options;
+ u_int8_t inp6_hlim;
+ u_int8_t unused_uint8_1;
+ ushort unused_uint16_1;
+ /* IP6 options for outgoing packets */
+ _INPCB_PTR(struct ip6_pktopts *) inp6_outputopts;
+ /* IP multicast options */
+ _INPCB_PTR(struct ip6_moptions *) inp6_moptions;
+ /* ICMPv6 code type filter */
+ _INPCB_PTR(struct icmp6_filter *) inp6_icmp6filt;
+ /* IPV6_CHECKSUM setsockopt */
+ int inp6_cksum;
+ u_short inp6_ifindex;
+ short inp6_hops;
+ } inp_depend6;
+
+ int hash_element; /* Array index of pcb's hash list */
+ _INPCB_PTR(caddr_t) inp_saved_ppcb; /* pointer while cached */
+ _INPCB_PTR(struct inpcbpolicy *) inp_sp;
+ u_int32_t reserved[3]; /* reserved */
+};
+
+struct xinpcb {
+ u_int32_t xi_len; /* length of this structure */
+#ifdef XNU_KERNEL_PRIVATE
+ struct inpcb_compat xi_inp;
+#else
+ struct inpcb xi_inp;
+#endif
+ struct xsocket xi_socket;
+ u_quad_t xi_alignment_hack;
+};
+
+#if !CONFIG_EMBEDDED
+struct inpcb64_list_entry {
+ u_int64_t le_next;
+ u_int64_t le_prev;
+};
+
+struct xinpcb64 {
+ u_int64_t xi_len; /* length of this structure */
+ u_int64_t xi_inpp;
+ u_short inp_fport; /* foreign port */
+ u_short inp_lport; /* local port */
+ struct inpcb64_list_entry inp_list; /* list for all PCBs */
+ u_int64_t inp_ppcb; /* ptr to per-protocol PCB */
+ u_int64_t inp_pcbinfo; /* PCB list info */
+ struct inpcb64_list_entry inp_portlist; /* this PCB's local port list */
+ u_int64_t inp_phd; /* head of this list */
+ inp_gen_t inp_gencnt; /* current generation count */
+ int inp_flags; /* generic IP/datagram flags */
+ u_int32_t inp_flow;
+ u_char inp_vflag;
+ u_char inp_ip_ttl; /* time to live */
+ u_char inp_ip_p; /* protocol */
+ union { /* foreign host table entry */
+ struct in_addr_4in6 inp46_foreign;
+ struct in6_addr inp6_foreign;
+ } inp_dependfaddr;
+ union { /* local host table entry */
+ struct in_addr_4in6 inp46_local;
+ struct in6_addr inp6_local;
+ } inp_dependladdr;
+ struct {
+ u_char inp4_ip_tos; /* type of service */
+ } inp_depend4;
+ struct {
+ u_int8_t inp6_hlim;
+ int inp6_cksum;
+ u_short inp6_ifindex;
+ short inp6_hops;
+ } inp_depend6;
+ struct xsocket64 xi_socket;
+ u_quad_t xi_alignment_hack;
+};
+#endif /* !CONFIG_EMBEDDED */
+
+#ifdef PRIVATE
+struct xinpcb_list_entry {
+ u_int64_t le_next;
+ u_int64_t le_prev;
+};
+
+struct xinpcb_n {
+ u_int32_t xi_len; /* length of this structure */
+ u_int32_t xi_kind; /* XSO_INPCB */
+ u_int64_t xi_inpp;
+ u_short inp_fport; /* foreign port */
+ u_short inp_lport; /* local port */
+ u_int64_t inp_ppcb; /* pointer to per-protocol pcb */
+ inp_gen_t inp_gencnt; /* generation count of this instance */
+ int inp_flags; /* generic IP/datagram flags */
+ u_int32_t inp_flow;
+ u_char inp_vflag;
+ u_char inp_ip_ttl; /* time to live */
+ u_char inp_ip_p; /* protocol */
+ union { /* foreign host table entry */
+ struct in_addr_4in6 inp46_foreign;
+ struct in6_addr inp6_foreign;
+ } inp_dependfaddr;
+ union { /* local host table entry */
+ struct in_addr_4in6 inp46_local;
+ struct in6_addr inp6_local;
+ } inp_dependladdr;
+ struct {
+ u_char inp4_ip_tos; /* type of service */
+ } inp_depend4;
+ struct {
+ u_int8_t inp6_hlim;
+ int inp6_cksum;
+ u_short inp6_ifindex;
+ short inp6_hops;
+ } inp_depend6;
+ u_int32_t inp_flowhash;
+ u_int32_t inp_flags2;