+/*
+ * Indicate whether or not the immediate interface, or the interface delegated
+ * by it, is a cellular interface (IFT_CELLULAR). Delegated interface type is
+ * set/cleared along with the delegated ifp; we cache the type for performance
+ * to avoid dereferencing delegated ifp each time.
+ *
+ * Note that this is meant to be used only for accounting and policy purposes;
+ * certain places need to explicitly know the immediate interface type, and
+ * this macro should not be used there.
+ *
+ * The test is done against IFT_CELLULAR instead of IFNET_FAMILY_CELLULAR to
+ * handle certain cases where the family isn't set to the latter.
+ */
+#define IFNET_IS_CELLULAR(_ifp) \
+ ((_ifp)->if_type == IFT_CELLULAR || \
+ (_ifp)->if_delegated.type == IFT_CELLULAR)
+
+/*
+ * Indicate whether or not the immediate interface, or the interface delegated
+ * by it, is a Wi-Fi interface (IFNET_SUBFAMILY_WIFI). Delegated interface
+ * subfamily is set/cleared along with the delegated ifp; we cache the subfamily
+ * for performance to avoid dereferencing delegated ifp each time.
+ *
+ * Note that this is meant to be used only for accounting and policy purposes;
+ * certain places need to explicitly know the immediate interface type, and
+ * this macro should not be used there.
+ *
+ * The test is done against IFNET_SUBFAMILY_WIFI as the family may be set to
+ * IFNET_FAMILY_ETHERNET (as well as type to IFT_ETHER) which is too generic.
+ */
+#define IFNET_IS_WIFI(_ifp) \
+ ((_ifp)->if_subfamily == IFNET_SUBFAMILY_WIFI || \
+ (_ifp)->if_delegated.subfamily == IFNET_SUBFAMILY_WIFI)
+
+/*
+ * Indicate whether or not the immediate interface, or the interface delegated
+ * by it, is a Wired interface (several families). Delegated interface
+ * family is set/cleared along with the delegated ifp; we cache the family
+ * for performance to avoid dereferencing delegated ifp each time.
+ *
+ * Note that this is meant to be used only for accounting and policy purposes;
+ * certain places need to explicitly know the immediate interface type, and
+ * this macro should not be used there.
+ */
+#define IFNET_IS_WIRED(_ifp) \
+ ((_ifp)->if_family == IFNET_FAMILY_ETHERNET || \
+ (_ifp)->if_delegated.family == IFNET_FAMILY_ETHERNET || \
+ (_ifp)->if_family == IFNET_FAMILY_FIREWIRE || \
+ (_ifp)->if_delegated.family == IFNET_FAMILY_FIREWIRE)
+
+/*
+ * Indicate whether or not the immediate interface, or the interface delegated
+ * by it, is marked as expensive. The delegated interface is set/cleared
+ * along with the delegated ifp; we cache the flag for performance to avoid
+ * dereferencing delegated ifp each time.
+ *
+ * Note that this is meant to be used only for policy purposes.
+ */
+#define IFNET_IS_EXPENSIVE(_ifp) \
+ ((_ifp)->if_eflags & IFEF_EXPENSIVE || \
+ (_ifp)->if_delegated.expensive)
+
+/*
+ * We don't support AWDL interface delegation.
+ */
+#define IFNET_IS_AWDL_RESTRICTED(_ifp) \
+ (((_ifp)->if_eflags & (IFEF_AWDL|IFEF_AWDL_RESTRICTED)) == \
+ (IFEF_AWDL|IFEF_AWDL_RESTRICTED))
+
+
+extern struct ifnethead ifnet_head;
+extern struct ifnet **ifindex2ifnet;
+extern u_int32_t if_sndq_maxlen;
+extern u_int32_t if_rcvq_maxlen;
+extern int if_index;
+extern struct ifaddr **ifnet_addrs;
+extern lck_attr_t *ifa_mtx_attr;
+extern lck_grp_t *ifa_mtx_grp;
+extern lck_grp_t *ifnet_lock_group;
+extern lck_attr_t *ifnet_lock_attr;