]> git.saurik.com Git - apple/xnu.git/blobdiff - bsd/net/if.h
xnu-3789.41.3.tar.gz
[apple/xnu.git] / bsd / net / if.h
index fd7800d8ae4cff826bb3046a8ae21042b66fd349..9d93391f4f5af9f48223a8925cab36b9ccb23855 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000-2014 Apple Inc. All rights reserved.
+ * Copyright (c) 2000-2016 Apple Inc. All rights reserved.
  *
  * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
  *
 #define        _NET_IF_H_
 
 #include <sys/cdefs.h>
+#include <net/net_kev.h>
 
 #define        IF_NAMESIZE     16
 
 #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
 #include <sys/appleapiopts.h>
 #ifdef __APPLE__
-/*
- * Define Data-Link event subclass, and associated
- * events.
- */
-
-#define        KEV_DL_SUBCLASS 2
-
-#define        KEV_DL_SIFFLAGS                         1
-#define        KEV_DL_SIFMETRICS                       2
-#define        KEV_DL_SIFMTU                           3
-#define        KEV_DL_SIFPHYS                          4
-#define        KEV_DL_SIFMEDIA                         5
-#define        KEV_DL_SIFGENERIC                       6
-#define        KEV_DL_ADDMULTI                         7
-#define        KEV_DL_DELMULTI                         8
-#define        KEV_DL_IF_ATTACHED                      9
-#define        KEV_DL_IF_DETACHING                     10
-#define        KEV_DL_IF_DETACHED                      11
-#define        KEV_DL_LINK_OFF                         12
-#define        KEV_DL_LINK_ON                          13
-#define        KEV_DL_PROTO_ATTACHED                   14
-#define        KEV_DL_PROTO_DETACHED                   15
-#define        KEV_DL_LINK_ADDRESS_CHANGED             16
-#define        KEV_DL_WAKEFLAGS_CHANGED                17
-#define        KEV_DL_IF_IDLE_ROUTE_REFCNT             18
-#define        KEV_DL_IFCAP_CHANGED                    19
-#define        KEV_DL_LINK_QUALITY_METRIC_CHANGED      20
-#define        KEV_DL_NODE_PRESENCE                    21
-#define        KEV_DL_NODE_ABSENCE                     22
-#define        KEV_DL_MASTER_ELECTED                   23
-#define        KEV_DL_ISSUES                           24
-#define        KEV_DL_IFDELEGATE_CHANGED               25
-#define        KEV_DL_AWDL_RESTRICTED                  26
-#define        KEV_DL_AWDL_UNRESTRICTED                27
 
 #include <net/if_var.h>
 #include <sys/types.h>
 #ifdef PRIVATE
 #include <net/if_dl.h>
 #include <netinet/in.h>
-#endif
+#include <mach/vm_types.h>
+#endif /* PRIVATE */
 #endif
 
 struct if_clonereq {
@@ -158,6 +126,10 @@ struct if_clonereq32 {
 #ifdef PRIVATE
 /* extended flags definitions:  (all bits reserved for internal/future use) */
 #define        IFEF_AUTOCONFIGURING    0x00000001      /* allow BOOTP/DHCP replies to enter */
+#define        IFEF_ENQUEUE_MULTI      0x00000002      /* enqueue multiple packets at once */
+#define        IFEF_DELAY_START        0x00000004      /* delay start callback */
+#define        IFEF_PROBE_CONNECTIVITY 0x00000008      /* Probe connections going over this interface */
+#define        IFEF_QOSMARKING_CAPABLE 0x00000010      /* XXX Obsolete, to be removed */
 #define        IFEF_IPV6_DISABLED      0x00000020      /* coupled to ND6_IFF_IFDISABLED */
 #define        IFEF_ACCEPT_RTADV       0x00000040      /* accepts IPv6 RA on the interface */
 #define        IFEF_TXSTART            0x00000080      /* has start callback */
@@ -165,7 +137,13 @@ struct if_clonereq32 {
 #define        IFEF_VLAN               0x00000200      /* interface has one or more vlans */
 #define        IFEF_BOND               0x00000400      /* interface is part of bond */
 #define        IFEF_ARPLL              0x00000800      /* ARP for IPv4LL addresses */
-#define        IFEF_NOWINDOWSCALE      0x00001000      /* Don't scale TCP window on iface */
+/* #define     IFEF_NOWINDOWSCALE      0x00001000 */   /* Don't scale TCP window on iface */
+/*
+ * XXX IFEF_NOAUTOIPV6LL is deprecated and should be done away with.
+ * Configd pretty much manages the interface configuration.
+ * Rather than looking at the flag we check if a specific LLA
+ * has to be configured or the IID has to be generated by kernel.
+ */
 #define        IFEF_NOAUTOIPV6LL       0x00002000      /* Need explicit IPv6 LL address */
 #define        IFEF_EXPENSIVE          0x00004000      /* Data access has a cost */
 #define        IFEF_IPV4_ROUTER        0x00008000      /* interior when in IPv4 router mode */
@@ -178,11 +156,22 @@ struct if_clonereq32 {
 #define        IFEF_NOACKPRI           0x00200000      /* No TCP ACK prioritization */
 #define        IFEF_AWDL_RESTRICTED    0x00400000      /* Restricted AWDL mode */
 #define        IFEF_2KCL               0x00800000      /* prefers 2K cluster (socket based tunnel) */
+#define        IFEF_ECN_ENABLE         0x01000000      /* use ECN for TCP connections on the interface */
+#define        IFEF_ECN_DISABLE        0x02000000      /* do not use ECN for TCP connections on the interface */
+#define        IFEF_SKYWALK_NATIVE     0x04000000      /* Native Skywalk support */
+#define        IFEF_3CA                0x08000000      /* Capable of 3CA */
 #define        IFEF_SENDLIST           0x10000000      /* Supports tx packet lists */
 #define        IFEF_DIRECTLINK         0x20000000      /* point-to-point topology */
-#define        _IFEF_INUSE             0x40000000      /* deprecated */
+#define        IFEF_QOSMARKING_ENABLED 0x40000000      /* OoS marking is enabled */
 #define        IFEF_UPDOWNCHANGE       0x80000000      /* up/down state is changing */
+
 #ifdef XNU_KERNEL_PRIVATE
+/*
+ * Extra flags
+ */
+#define        IFXF_WAKE_ON_MAGIC_PACKET       0x00000001 /* wake on magic packet */
+#define        IFXF_TIMESTAMP_ENABLED                  0x00000002 /* time stamping enabled */
+
 /*
  * Current requirements for an AWDL interface.  Setting/clearing IFEF_AWDL
  * will also trigger the setting/clearing of the rest of the flags.  Once
@@ -241,12 +230,16 @@ struct if_clonereq32 {
 #define        IFCAP_LRO               0x00080 /* can do Large Receive Offload */
 #define        IFCAP_AV                0x00100 /* can do 802.1 AV Bridging */
 #define        IFCAP_TXSTATUS          0x00200 /* can return linklevel xmit status */
+#define        IFCAP_SKYWALK           0x00400 /* Skywalk mode supported/enabled */
+#define        IFCAP_HW_TIMESTAMP      0x00800 /* Time stamping in hardware */
+#define        IFCAP_SW_TIMESTAMP      0x01000 /* Time stamping in software */
 
 #define        IFCAP_HWCSUM    (IFCAP_RXCSUM | IFCAP_TXCSUM)
 #define        IFCAP_TSO       (IFCAP_TSO4 | IFCAP_TSO6)
 
 #define        IFCAP_VALID (IFCAP_HWCSUM | IFCAP_TSO | IFCAP_LRO | IFCAP_VLAN_MTU | \
-       IFCAP_VLAN_HWTAGGING | IFCAP_JUMBO_MTU | IFCAP_AV | IFCAP_TXSTATUS)
+       IFCAP_VLAN_HWTAGGING | IFCAP_JUMBO_MTU | IFCAP_AV | IFCAP_TXSTATUS | \
+       IFCAP_SKYWALK | IFCAP_SW_TIMESTAMP | IFCAP_HW_TIMESTAMP)
 
 #define        IFQ_MAXLEN      128
 #define        IFNET_SLOWHZ    1       /* granularity is 1 second */
@@ -465,10 +458,34 @@ struct    ifreq {
 #define        IFRTYPE_SUBFAMILY_WIFI          3
 #define        IFRTYPE_SUBFAMILY_THUNDERBOLT   4
 #define        IFRTYPE_SUBFAMILY_RESERVED      5
+#define        IFRTYPE_SUBFAMILY_INTCOPROC     6
                } ifru_type;
+               u_int32_t ifru_functional_type;
+#define IFRTYPE_FUNCTIONAL_UNKNOWN     0
+#define IFRTYPE_FUNCTIONAL_LOOPBACK    1
+#define IFRTYPE_FUNCTIONAL_WIRED       2
+#define IFRTYPE_FUNCTIONAL_WIFI_INFRA  3
+#define IFRTYPE_FUNCTIONAL_WIFI_AWDL   4
+#define IFRTYPE_FUNCTIONAL_CELLULAR    5
+#define        IFRTYPE_FUNCTIONAL_INTCOPROC    6          
+#define IFRTYPE_FUNCTIONAL_LAST                6
                u_int32_t ifru_expensive;
-               u_int32_t ifru_awdl_restricted;
                u_int32_t ifru_2kcl;
+               struct {
+                       u_int32_t qlen;
+                       u_int32_t timeout;
+               } ifru_start_delay;
+               struct if_interface_state       ifru_interface_state;
+               u_int32_t ifru_probe_connectivity;
+               u_int32_t ifru_ecn_mode;
+#define        IFRTYPE_ECN_DEFAULT             0
+#define        IFRTYPE_ECN_ENABLE              1
+#define        IFRTYPE_ECN_DISABLE             2
+               u_int32_t ifru_qosmarking_mode;
+#define        IFRTYPE_QOSMARKING_MODE_NONE            0
+#define        IFRTYPE_QOSMARKING_FASTLANE     1
+               u_int32_t ifru_qosmarking_enabled;
+               u_int32_t ifru_disable_output;
 #endif /* PRIVATE */
        } ifr_ifru;
 #define        ifr_addr        ifr_ifru.ifru_addr      /* address */
@@ -505,8 +522,19 @@ struct     ifreq {
 #define        ifr_delegated   ifr_ifru.ifru_delegated /* delegated interface index */
 #define        ifr_expensive   ifr_ifru.ifru_expensive
 #define        ifr_type        ifr_ifru.ifru_type      /* interface type */
-#define        ifr_awdl_restricted ifr_ifru.ifru_awdl_restricted
+#define        ifr_functional_type     ifr_ifru.ifru_functional_type
 #define        ifr_2kcl        ifr_ifru.ifru_2kcl
+#define        ifr_start_delay_qlen    ifr_ifru.ifru_start_delay.qlen
+#define        ifr_start_delay_timeout ifr_ifru.ifru_start_delay.timeout
+#define ifr_interface_state    ifr_ifru.ifru_interface_state
+#define        ifr_probe_connectivity  ifr_ifru.ifru_probe_connectivity
+#define        ifr_ecn_mode    ifr_ifru.ifru_ecn_mode
+#define        ifr_qosmarking_mode     ifr_ifru.ifru_qosmarking_mode
+#define        ifr_fastlane_capable    ifr_qosmarking_mode
+#define ifr_qosmarking_enabled ifr_ifru.ifru_qosmarking_enabled
+#define        ifr_fastlane_enabled    ifr_qosmarking_enabled
+#define        ifr_disable_output      ifr_ifru.ifru_disable_output
+
 #endif /* PRIVATE */
 };
 
@@ -713,8 +741,9 @@ struct if_descreq {
 enum {
        IFNET_SCHED_MODEL_NORMAL                = 0,
        IFNET_SCHED_MODEL_DRIVER_MANAGED        = 1,
+       IFNET_SCHED_MODEL_FQ_CODEL              = 2,
 #ifdef XNU_KERNEL_PRIVATE
-       IFNET_SCHED_MODEL_MAX                   = 2,
+       IFNET_SCHED_MODEL_MAX                   = 3,
 #endif /* XNU_KERNEL_PRIVATE */
 };
 
@@ -818,6 +847,36 @@ enum {
 #endif /* XNU_KERNEL_PRIVATE */
 };
 
+/*
+ * Structure for SIOC[A/D]IFAGENTID
+ */
+struct if_agentidreq {
+       char            ifar_name[IFNAMSIZ];    /* interface name */
+       uuid_t          ifar_uuid;              /* agent UUID to add or delete */
+};
+
+/*
+ * Structure for SIOCGIFAGENTIDS
+ */
+struct if_agentidsreq {
+       char            ifar_name[IFNAMSIZ];    /* interface name */
+       u_int32_t       ifar_count;             /* number of agent UUIDs */
+       uuid_t          *ifar_uuids;            /* array of agent UUIDs */
+};
+
+#ifdef BSD_KERNEL_PRIVATE
+struct if_agentidsreq32 {
+       char            ifar_name[IFNAMSIZ];
+       u_int32_t       ifar_count;
+       user32_addr_t ifar_uuids;
+};
+struct if_agentidsreq64 {
+       char            ifar_name[IFNAMSIZ];
+       u_int32_t       ifar_count;
+       user64_addr_t ifar_uuids __attribute__((aligned(8)));
+};
+#endif /* BSD_KERNEL_PRIVATE */
+
 #define        DLIL_MODIDLEN   20      /* same as IFNET_MODIDLEN */
 #define        DLIL_MODARGLEN  12      /* same as IFNET_MODARGLEN */
 
@@ -830,6 +889,71 @@ struct kev_dl_issues {
        u_int64_t               timestamp;
        u_int8_t                info[DLIL_MODARGLEN];
 };
+
+/*
+ * DLIL KEV_DL_RRC_STATE_CHANGED structure
+ */
+struct kev_dl_rrc_state {
+       struct net_event_data   link_data;
+       u_int32_t               rrc_state;
+};
+
+/*
+ * Length of network signature/fingerprint blob.
+ */
+#define        IFNET_SIGNATURELEN      20
+
+/*
+ * Structure for SIOC[S/G]IFNETSIGNATURE
+ */
+struct if_nsreq {
+       char            ifnsr_name[IFNAMSIZ];
+       u_int8_t        ifnsr_family;   /* address family */
+       u_int8_t        ifnsr_len;      /* data length */
+       u_int16_t       ifnsr_flags;    /* for future */
+       u_int8_t        ifnsr_data[IFNET_SIGNATURELEN];
+};
+
+/*
+ * Structure for SIOC[S/G]IFORDER
+ *
+ * When setting, ifo_count is the number of u_int32_t interface indices
+ * in the ifo_ordered_indices array.
+ *
+ * When getting, if ifo_count is 0, the length of the ordered list will
+ * be returned. If the ifo_count is non-0, it is the number of u_int32_t
+ * interface indices allocated. Upon return, ifo_count will contain the number
+ * of indices copied into the array.
+ */
+struct if_order {
+       u_int32_t                       ifo_count;
+       u_int32_t                       ifo_reserved;
+       mach_vm_address_t       ifo_ordered_indices; /* array of u_int32_t */
+};
+
+/*
+ * Struct for traffic class to DSCP mapping
+ */
+struct if_tdmreq {
+       char                            iftdm_name[IFNAMSIZ];
+       u_int32_t                       iftdm_len;      /* byte length of the table */
+       struct netsvctype_dscp_map      *iftdm_table;
+};
+
+#ifdef BSD_KERNEL_PRIVATE
+struct if_tdmreq32 {
+       char                    iftdm_name[IFNAMSIZ];
+       u_int32_t               iftdm_len;      /* byte length of the table */
+       user32_addr_t           iftdm_table;
+};
+
+struct if_tdmreq64 {
+       char                    iftdm_name[IFNAMSIZ];
+       u_int32_t               iftdm_len;      /* byte length of the table */
+       user64_addr_t           iftdm_table __attribute__((aligned(8)));
+};
+#endif
+
 #endif /* PRIVATE */
 
 #ifdef KERNEL