1 // Licensed under the Apache License, Version 2.0 2 // <LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0> or the MIT license 3 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your option. 4 // All files in the project carrying such notice may not be copied, modified, or distributed 5 // except according to those terms. 6 use shared::basetsd::{UINT16, UINT32, ULONG32, ULONG64}; 7 use shared::guiddef::GUID; 8 use shared::ntdef::{BOOLEAN, UCHAR, ULONG, USHORT, WCHAR}; 9 pub type NET_IF_COMPARTMENT_ID = UINT32; 10 pub type PNET_IF_COMPARTMENT_ID = *mut NET_IF_COMPARTMENT_ID; 11 pub const NET_IF_COMPARTMENT_ID_UNSPECIFIED: NET_IF_COMPARTMENT_ID = 0; 12 pub const NET_IF_COMPARTMENT_ID_PRIMARY: NET_IF_COMPARTMENT_ID = 1; 13 pub type NET_IF_NETWORK_GUID = GUID; 14 pub type PNET_IF_NETWORK_GUID = *mut NET_IF_NETWORK_GUID; 15 ENUM!{enum NET_IF_OPER_STATUS { 16 NET_IF_OPER_STATUS_UP = 1, 17 NET_IF_OPER_STATUS_DOWN = 2, 18 NET_IF_OPER_STATUS_TESTING = 3, 19 NET_IF_OPER_STATUS_UNKNOWN = 4, 20 NET_IF_OPER_STATUS_DORMANT = 5, 21 NET_IF_OPER_STATUS_NOT_PRESENT = 6, 22 NET_IF_OPER_STATUS_LOWER_LAYER_DOWN = 7, 23 }} 24 pub type PNET_IF_OPER_STATUS = *mut NET_IF_OPER_STATUS; 25 pub type NET_IF_OBJECT_ID = ULONG32; 26 pub type PNET_IF_OBJECT_ID = *mut NET_IF_OBJECT_ID; 27 ENUM!{enum NET_IF_ADMIN_STATUS { 28 NET_IF_ADMIN_STATUS_UP = 1, 29 NET_IF_ADMIN_STATUS_DOWN = 2, 30 NET_IF_ADMIN_STATUS_TESTING = 3, 31 }} 32 pub type PNET_IF_ADMIN_STATUS = *mut NET_IF_ADMIN_STATUS; 33 pub type NET_IF_COMPARTMENT_SCOPE = UINT32; 34 pub type PNET_IF_COMPARTMENT_SCOPE = *mut NET_IF_COMPARTMENT_SCOPE; 35 pub const NET_IF_COMPARTMENT_SCOPE_UNSPECIFIED: NET_IF_COMPARTMENT_SCOPE = 0; 36 pub const NET_IF_COMPARTMENT_SCOPE_ALL: NET_IF_COMPARTMENT_SCOPE = -1i32 as u32; 37 ENUM!{enum NET_IF_RCV_ADDRESS_TYPE { 38 NET_IF_RCV_ADDRESS_TYPE_OTHER = 1, 39 NET_IF_RCV_ADDRESS_TYPE_VOLATILE = 2, 40 NET_IF_RCV_ADDRESS_TYPE_NON_VOLATILE = 3, 41 }} 42 pub type PNET_IF_RCV_ADDRESS_TYPE = *mut NET_IF_RCV_ADDRESS_TYPE; 43 STRUCT!{struct NET_IF_RCV_ADDRESS_LH { 44 ifRcvAddressType: NET_IF_RCV_ADDRESS_TYPE, 45 ifRcvAddressLength: USHORT, 46 ifRcvAddressOffset: USHORT, 47 }} 48 pub type PNET_IF_RCV_ADDRESS_LH = *mut NET_IF_RCV_ADDRESS_LH; 49 STRUCT!{struct NET_IF_ALIAS_LH { 50 ifAliasLength: USHORT, 51 ifAliasOffset: USHORT, 52 }} 53 pub type PNET_IF_ALIAS_LH = *mut NET_IF_ALIAS_LH; 54 // FIXME: Switch to union version in 0.4 55 // STRUCT!{struct NET_LUID_LH_Info { 56 // bitfield: ULONG64, 57 // }} 58 // BITFIELD!{NET_LUID_LH_Info bitfield: ULONG64 [ 59 // Reserved set_Reserved[0..24], 60 // NetLuidIndex set_NetLuidIndex[24..48], 61 // IfType set_IfType[48..64], 62 // ]} 63 // UNION!{struct NET_LUID_LH { 64 // [u64; 1], 65 // Value Value_mut: ULONG64, 66 // Info Info_mut: NET_LUID_LH_Info, 67 // }} 68 STRUCT!{struct NET_LUID_LH { 69 Value: ULONG64, 70 }} 71 BITFIELD!{NET_LUID_LH Value: ULONG64 [ 72 Reserved set_Reserved[0..24], 73 NetLuidIndex set_NetLuidIndex[24..48], 74 IfType set_IfType[48..64], 75 ]} 76 pub type PNET_LUID_LH = *mut NET_LUID_LH; 77 pub type NET_IF_RCV_ADDRESS = NET_IF_RCV_ADDRESS_LH; 78 pub type PNET_IF_RCV_ADDRESS = *mut NET_IF_RCV_ADDRESS; 79 pub type NET_IF_ALIAS = NET_IF_ALIAS_LH; 80 pub type PNET_IF_ALIAS = *mut NET_IF_ALIAS; 81 pub type NET_LUID = NET_LUID_LH; 82 pub type PNET_LUID = *mut NET_LUID; 83 pub type IF_LUID = NET_LUID; 84 pub type PIF_LUID = *mut NET_LUID; 85 pub type NET_IFINDEX = ULONG; 86 pub type PNET_IFINDEX = *mut NET_IFINDEX; 87 pub type NET_IFTYPE = UINT16; 88 pub type PNET_IFTYPE = *mut NET_IFTYPE; 89 pub type IF_INDEX = NET_IFINDEX; 90 pub type PIF_INDEX = *mut NET_IFINDEX; 91 ENUM!{enum NET_IF_CONNECTION_TYPE { 92 NET_IF_CONNECTION_DEDICATED = 1, 93 NET_IF_CONNECTION_PASSIVE = 2, 94 NET_IF_CONNECTION_DEMAND = 3, 95 NET_IF_CONNECTION_MAXIMUM = 4, 96 }} 97 pub type PNET_IF_CONNECTION_TYPE = *mut NET_IF_CONNECTION_TYPE; 98 ENUM!{enum TUNNEL_TYPE { 99 TUNNEL_TYPE_NONE = 0, 100 TUNNEL_TYPE_OTHER = 1, 101 TUNNEL_TYPE_DIRECT = 2, 102 TUNNEL_TYPE_6TO4 = 11, 103 TUNNEL_TYPE_ISATAP = 13, 104 TUNNEL_TYPE_TEREDO = 14, 105 TUNNEL_TYPE_IPHTTPS = 15, 106 }} 107 pub type PTUNNEL_TYPE = *mut TUNNEL_TYPE; 108 ENUM!{enum NET_IF_ACCESS_TYPE { 109 NET_IF_ACCESS_LOOPBACK = 1, 110 NET_IF_ACCESS_BROADCAST = 2, 111 NET_IF_ACCESS_POINT_TO_POINT = 3, 112 NET_IF_ACCESS_POINT_TO_MULTI_POINT = 4, 113 NET_IF_ACCESS_MAXIMUM = 5, 114 }} 115 pub type PNET_IF_ACCESS_TYPE = *mut NET_IF_ACCESS_TYPE; 116 ENUM!{enum NET_IF_DIRECTION_TYPE { 117 NET_IF_DIRECTION_SENDRECEIVE, 118 NET_IF_DIRECTION_SENDONLY, 119 NET_IF_DIRECTION_RECEIVEONLY, 120 NET_IF_DIRECTION_MAXIMUM, 121 }} 122 pub type PNET_IF_DIRECTION_TYPE = *mut NET_IF_DIRECTION_TYPE; 123 ENUM!{enum NET_IF_MEDIA_CONNECT_STATE { 124 MediaConnectStateUnknown, 125 MediaConnectStateConnected, 126 MediaConnectStateDisconnected, 127 }} 128 pub type PNET_IF_MEDIA_CONNECT_STATE = *mut NET_IF_MEDIA_CONNECT_STATE; 129 ENUM!{enum NET_IF_MEDIA_DUPLEX_STATE { 130 MediaDuplexStateUnknown = 0, 131 MediaDuplexStateHalf = 1, 132 MediaDuplexStateFull = 2, 133 }} 134 pub type PNET_IF_MEDIA_DUPLEX_STATE = *mut NET_IF_MEDIA_DUPLEX_STATE; 135 STRUCT!{struct NET_PHYSICAL_LOCATION_LH { 136 BusNumber: ULONG, 137 SlotNumber: ULONG, 138 FunctionNumber: ULONG, 139 }} 140 pub type PNET_PHYSICAL_LOCATION_LH = *mut NET_PHYSICAL_LOCATION_LH; 141 pub const IF_MAX_STRING_SIZE: usize = 256; 142 pub const IF_MAX_PHYS_ADDRESS_LENGTH: usize = 32; 143 STRUCT!{struct IF_COUNTED_STRING_LH { 144 Length: USHORT, 145 String: [WCHAR; IF_MAX_STRING_SIZE + 1], 146 }} 147 pub type PIF_COUNTED_STRING_LH = *mut IF_COUNTED_STRING_LH; 148 STRUCT!{struct IF_PHYSICAL_ADDRESS_LH { 149 Length: USHORT, 150 Address: [UCHAR; IF_MAX_PHYS_ADDRESS_LENGTH], 151 }} 152 pub type PIF_PHYSICAL_ADDRESS_LH = *mut IF_PHYSICAL_ADDRESS_LH; 153 pub type NET_PHYSICAL_LOCATION = NET_PHYSICAL_LOCATION_LH; 154 pub type PNET_PHYSICAL_LOCATION = *mut NET_PHYSICAL_LOCATION; 155 pub type IF_COUNTED_STRING = IF_COUNTED_STRING_LH; 156 pub type PIF_COUNTED_STRING = *mut IF_COUNTED_STRING; 157 pub type IF_PHYSICAL_ADDRESS = IF_PHYSICAL_ADDRESS_LH; 158 pub type PIF_PHYSICAL_ADDRESS = *mut IF_PHYSICAL_ADDRESS; 159 ENUM!{enum IF_ADMINISTRATIVE_STATE { 160 IF_ADMINISTRATIVE_DISABLED = 0, 161 IF_ADMINISTRATIVE_ENABLED = 1, 162 IF_ADMINISTRATIVE_DEMANDDIAL = 2, 163 }} 164 pub type PIF_ADMINISTRATIVE_STATE = *mut IF_ADMINISTRATIVE_STATE; 165 ENUM!{enum IF_OPER_STATUS { 166 IfOperStatusUp = 1, 167 IfOperStatusDown, 168 IfOperStatusTesting, 169 IfOperStatusUnknown, 170 IfOperStatusDormant, 171 IfOperStatusNotPresent, 172 IfOperStatusLowerLayerDown, 173 }} 174 STRUCT!{struct NDIS_INTERFACE_INFORMATION { 175 ifOperStatus: NET_IF_OPER_STATUS, 176 ifOperStatusFlags: ULONG, 177 MediaConnectState: NET_IF_MEDIA_CONNECT_STATE, 178 MediaDuplexState: NET_IF_MEDIA_DUPLEX_STATE, 179 ifMtu: ULONG, 180 ifPromiscuousMode: BOOLEAN, 181 ifDeviceWakeUpEnable: BOOLEAN, 182 XmitLinkSpeed: ULONG64, 183 RcvLinkSpeed: ULONG64, 184 ifLastChange: ULONG64, 185 ifCounterDiscontinuityTime: ULONG64, 186 ifInUnknownProtos: ULONG64, 187 ifInDiscards: ULONG64, 188 ifInErrors: ULONG64, 189 ifHCInOctets: ULONG64, 190 ifHCInUcastPkts: ULONG64, 191 ifHCInMulticastPkts: ULONG64, 192 ifHCInBroadcastPkts: ULONG64, 193 ifHCOutOctets: ULONG64, 194 ifHCOutUcastPkts: ULONG64, 195 ifHCOutMulticastPkts: ULONG64, 196 ifHCOutBroadcastPkts: ULONG64, 197 ifOutErrors: ULONG64, 198 ifOutDiscards: ULONG64, 199 ifHCInUcastOctets: ULONG64, 200 ifHCInMulticastOctets: ULONG64, 201 ifHCInBroadcastOctets: ULONG64, 202 ifHCOutUcastOctets: ULONG64, 203 ifHCOutMulticastOctets: ULONG64, 204 ifHCOutBroadcastOctets: ULONG64, 205 CompartmentId: NET_IF_COMPARTMENT_ID, 206 SupportedStatistics: ULONG, 207 }} 208 pub type PNDIS_INTERFACE_INFORMATION = *mut NDIS_INTERFACE_INFORMATION; 209