Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

464 lines
16 KiB

  1. /*++
  2. Copyright (c) Microsoft Corporation. All rights reserved.
  3. Module Name:
  4. ntddip.h
  5. Abstract:
  6. This header file defines constants and types for accessing the NT
  7. IP driver.
  8. Author:
  9. Mike Massa (mikemas) 13-Aug-1993
  10. Revision History:
  11. --*/
  12. #ifndef _NTDDIP_
  13. #define _NTDDIP_
  14. #pragma once
  15. #include <ipexport.h>
  16. //
  17. // Device Name - this string is the name of the device. It is the name
  18. // that should be passed to NtOpenFile when accessing the device.
  19. //
  20. #define DD_IP_DEVICE_NAME L"\\Device\\Ip"
  21. #define DD_IP_SYMBOLIC_DEVICE_NAME L"\\DosDevices\\Ip"
  22. #define IP_ADDRTYPE_TRANSIENT 0x01
  23. //
  24. // Structures used in IOCTLs.
  25. //
  26. typedef struct set_ip_address_request {
  27. USHORT Context; // Context value for the target NTE
  28. IPAddr Address; // IP address to set, or zero to clear
  29. IPMask SubnetMask; // Subnet mask to set
  30. } IP_SET_ADDRESS_REQUEST, *PIP_SET_ADDRESS_REQUEST;
  31. //
  32. // Structures used in IOCTLs.
  33. //
  34. typedef struct set_ip_address_request_ex {
  35. USHORT Context; // Context value for the target NTE
  36. IPAddr Address; // IP address to set, or zero to clear
  37. IPMask SubnetMask; // Subnet mask to set
  38. USHORT Type; // Type of address being added
  39. } IP_SET_ADDRESS_REQUEST_EX, *PIP_SET_ADDRESS_REQUEST_EX;
  40. typedef struct set_dhcp_interface_request {
  41. ULONG Context; // Context value identifying the NTE
  42. // Valid contexts are 16 bit quantities.
  43. } IP_SET_DHCP_INTERFACE_REQUEST, *PIP_SET_DHCP_INTERFACE_REQUEST;
  44. typedef struct add_ip_nte_request {
  45. ULONG InterfaceContext; // Context value for the IP interface
  46. // to which to add the NTE
  47. IPAddr Address; // IP address to set, or zero to clear
  48. IPMask SubnetMask; // Subnet mask to set
  49. UNICODE_STRING InterfaceName; // Interface name when interface context
  50. // is 0xffff
  51. CHAR InterfaceNameBuffer[1]; // Buffer to hold interface name
  52. // from above
  53. } IP_ADD_NTE_REQUEST, *PIP_ADD_NTE_REQUEST;
  54. #if defined(_WIN64)
  55. typedef struct add_ip_nte_request32 {
  56. ULONG InterfaceContext; // Context value for the IP interface
  57. // to which to add the NTE
  58. IPAddr Address; // IP address to set, or zero to clear
  59. IPMask SubnetMask; // Subnet mask to set
  60. UNICODE_STRING32 InterfaceName; // Interface name when interface context
  61. // is 0xffff
  62. CHAR InterfaceNameBuffer[1]; // Buffer to hold interface name
  63. // from above
  64. } IP_ADD_NTE_REQUEST32, *PIP_ADD_NTE_REQUEST32;
  65. #endif // _WIN64
  66. typedef struct _ip_rtchange_notify {
  67. IPAddr Addr;
  68. IPMask Mask;
  69. } IP_RTCHANGE_NOTIFY, *PIP_RTCHANGE_NOTIFY;
  70. typedef struct _ip_addchange_notify {
  71. IPAddr Addr;
  72. IPMask Mask;
  73. PVOID pContext;
  74. USHORT IPContext;
  75. ULONG AddrAdded;
  76. ULONG UniAddr;
  77. UNICODE_STRING ConfigName;
  78. CHAR NameData[1];
  79. } IP_ADDCHANGE_NOTIFY, *PIP_ADDCHANGE_NOTIFY;
  80. typedef struct _ip_ifchange_notify
  81. {
  82. USHORT Context;
  83. UCHAR Pad[2];
  84. ULONG IfAdded;
  85. } IP_IFCHANGE_NOTIFY, *PIP_IFCHANGE_NOTIFY;
  86. typedef struct add_ip_nte_request_old {
  87. USHORT InterfaceContext; // Context value for the IP interface
  88. // to which to add the NTE
  89. IPAddr Address; // IP address to set, or zero to clear
  90. IPMask SubnetMask; // Subnet mask to set
  91. } IP_ADD_NTE_REQUEST_OLD, *PIP_ADD_NTE_REQUEST_OLD;
  92. typedef struct add_ip_nte_response {
  93. USHORT Context; // Context value for the new NTE
  94. ULONG Instance; // Instance ID for the new NTE
  95. } IP_ADD_NTE_RESPONSE, *PIP_ADD_NTE_RESPONSE;
  96. typedef struct delete_ip_nte_request {
  97. USHORT Context; // Context value for the NTE
  98. } IP_DELETE_NTE_REQUEST, *PIP_DELETE_NTE_REQUEST;
  99. typedef struct get_ip_nte_info_request {
  100. USHORT Context; // Context value for the NTE
  101. } IP_GET_NTE_INFO_REQUEST, *PIP_GET_NTE_INFO_REQUEST;
  102. typedef struct get_ip_nte_info_response {
  103. ULONG Instance; // Instance ID for the NTE
  104. IPAddr Address;
  105. IPMask SubnetMask;
  106. ULONG Flags;
  107. } IP_GET_NTE_INFO_RESPONSE, *PIP_GET_NTE_INFO_RESPONSE;
  108. typedef struct _net_pm_wakeup_pattern_desc {
  109. struct _net_pm_wakeup_pattern_desc *Next; // points to the next descriptor
  110. // on the list.
  111. UCHAR *Ptrn; // the wakeup pattern
  112. UCHAR *Mask; // bit mask for matching wakeup pattern,
  113. // 1 -match, 0 - ignore
  114. USHORT PtrnLen; // length of the Pattern. len of mask
  115. // is retrieved via GetWakeupPatternMaskLength
  116. } NET_PM_WAKEUP_PATTERN_DESC, *PNET_PM_WAKEUP_PATTERN_DESC;
  117. typedef struct wakeup_pattern_request {
  118. ULONG InterfaceContext; // Context value
  119. PNET_PM_WAKEUP_PATTERN_DESC PtrnDesc; // higher level protocol pattern
  120. // descriptor
  121. BOOLEAN AddPattern; // TRUE - Add, FALSE - Delete
  122. } IP_WAKEUP_PATTERN_REQUEST, *PIP_WAKEUP_PATTERN_REQUEST;
  123. typedef struct ip_get_ip_event_response {
  124. ULONG SequenceNo; // SequenceNo of the this event
  125. USHORT ContextStart; // Context value for the first NTE of the
  126. // adapter.
  127. USHORT ContextEnd; // Context value for the last NTE of the adapter
  128. IP_STATUS MediaStatus; // Status of the media.
  129. UNICODE_STRING AdapterName;
  130. } IP_GET_IP_EVENT_RESPONSE, *PIP_GET_IP_EVENT_RESPONSE;
  131. typedef struct ip_get_ip_event_request {
  132. ULONG SequenceNo; // SequenceNo of the last event notified.
  133. } IP_GET_IP_EVENT_REQUEST, *PIP_GET_IP_EVENT_REQUEST;
  134. #define IP_PNP_RECONFIG_VERSION 2
  135. typedef struct ip_pnp_reconfig_request {
  136. USHORT version;
  137. USHORT arpConfigOffset; // If 0, this is an IP layer request;
  138. // else this is the offset from the start
  139. // of this structure at which the ARP layer
  140. // reconfig request is located.
  141. BOOLEAN gatewayListUpdate; // is gateway list changed?
  142. BOOLEAN IPEnableRouter; // is ip forwarding on?
  143. UCHAR PerformRouterDiscovery : 4; // is PerformRouterDiscovery on?
  144. BOOLEAN DhcpPerformRouterDiscovery : 4; // has DHCP server specified
  145. // IRDP?
  146. BOOLEAN EnableSecurityFilter; // Enable/disable security filter
  147. BOOLEAN InterfaceMetricUpdate; // re-read interface metric
  148. UCHAR Flags; // mask of valid fields
  149. USHORT NextEntryOffset; // the offset from the start of this
  150. // structure at which the next
  151. // reconfig entry for the IP layer
  152. // (if any) is located.
  153. } IP_PNP_RECONFIG_REQUEST, *PIP_PNP_RECONFIG_REQUEST;
  154. #define IP_IRDP_DISABLED 0
  155. #define IP_IRDP_ENABLED 1
  156. #define IP_IRDP_DISABLED_USE_DHCP 2
  157. #define IP_PNP_FLAG_IP_ENABLE_ROUTER 0x01
  158. #define IP_PNP_FLAG_PERFORM_ROUTER_DISCOVERY 0x02
  159. #define IP_PNP_FLAG_ENABLE_SECURITY_FILTER 0x04
  160. #define IP_PNP_FLAG_GATEWAY_LIST_UPDATE 0x08
  161. #define IP_PNP_FLAG_INTERFACE_METRIC_UPDATE 0x10
  162. #define IP_PNP_FLAG_DHCP_PERFORM_ROUTER_DISCOVERY 0x20
  163. #define IP_PNP_FLAG_INTERFACE_TCP_PARAMETER_UPDATE 0x40
  164. #define IP_PNP_FLAG_ALL 0x6f
  165. typedef enum {
  166. IPPnPInitCompleteEntryType = 1,
  167. IPPnPMaximumEntryType
  168. } IP_PNP_RECONFIG_ENTRY_TYPE;
  169. typedef struct ip_pnp_reconfig_header {
  170. USHORT NextEntryOffset;
  171. UCHAR EntryType;
  172. } IP_PNP_RECONFIG_HEADER, *PIP_PNP_RECONFIG_HEADER;
  173. typedef struct ip_pnp_init_complete {
  174. IP_PNP_RECONFIG_HEADER Header;
  175. } IP_PNP_INIT_COMPLETE, *PIP_PNP_INIT_COMPLETE;
  176. //
  177. // Enumerated data type for Query procedure in NetBT
  178. //
  179. enum DnsOption {
  180. WinsOnly =0,
  181. WinsThenDns,
  182. DnsOnly
  183. };
  184. typedef struct netbt_pnp_reconfig_request {
  185. USHORT version; // always 1
  186. enum DnsOption enumDnsOption; // Enable Dns box. 3 states: WinsOnly,
  187. // WinsThenDns, DnsOnly
  188. BOOLEAN fLmhostsEnabled; // EnableLmhosts box is checked.
  189. // Checked: TRUE, unchecked: FALSE
  190. BOOLEAN fLmhostsFileSet; // TRUE <==> user has successfully
  191. // chosen a file & filecopy succeeded
  192. BOOLEAN fScopeIdUpdated; // True if the new value for ScopeId
  193. // is different from the old
  194. } NETBT_PNP_RECONFIG_REQUEST, *PNETBT_PNP_RECONFIG_REQUEST;
  195. typedef struct _ip_set_if_promiscuous_info {
  196. ULONG Index; // IP's interface index
  197. UCHAR Type; // PROMISCUOUS_MCAST or PROMISCUOUS_BCAST
  198. UCHAR Add; // 1 to add, 0 to delete
  199. } IP_SET_IF_PROMISCUOUS_INFO, *PIP_SET_IF_PROMISCUOUS_INFO;
  200. #define PROMISCUOUS_MCAST 0
  201. #define PROMISCUOUS_BCAST 1
  202. typedef struct _ip_get_if_index_info {
  203. ULONG Index;
  204. WCHAR Name[1];
  205. } IP_GET_IF_INDEX_INFO, *PIP_GET_IF_INDEX_INFO;
  206. typedef struct ip_interface_name_info {
  207. ULONG Index; // Interface Index
  208. ULONG MediaType; // Interface Types - see ipifcons.h
  209. UCHAR ConnectionType;
  210. UCHAR AccessType;
  211. GUID DeviceGuid; // Device GUID is the guid of the device
  212. // that IP exposes
  213. GUID InterfaceGuid; // Interface GUID, if not GUID_NULL is the
  214. // GUID for the interface mapped to the device.
  215. } IP_INTERFACE_NAME_INFO, *PIP_INTERFACE_NAME_INFO;
  216. typedef struct _ip_get_if_name_info {
  217. ULONG Context; // Set this to 0 to start enumeration
  218. // To resume enumeration, copy the value
  219. // returned by the last enum
  220. ULONG Count;
  221. IP_INTERFACE_NAME_INFO Info[1];
  222. } IP_GET_IF_NAME_INFO, *PIP_GET_IF_NAME_INFO;
  223. //
  224. // NTE Flags
  225. //
  226. #define IP_NTE_DYNAMIC 0x00000010
  227. //
  228. // IP IOCTL code definitions
  229. //
  230. #define FSCTL_IP_BASE FILE_DEVICE_NETWORK
  231. #define _IP_CTL_CODE(function, method, access) \
  232. CTL_CODE(FSCTL_IP_BASE, function, method, access)
  233. //
  234. // This IOCTL is used to send an ICMP Echo request. It is synchronous and
  235. // returns any replies received.
  236. //
  237. #define IOCTL_ICMP_ECHO_REQUEST \
  238. _IP_CTL_CODE(0, METHOD_BUFFERED, FILE_ANY_ACCESS)
  239. //
  240. // This IOCTL is used to set the IP address for an interface. It is meant to
  241. // be issued by a DHCP client. Setting the address to 0 deletes the current
  242. // address and disables the interface. It may only be issued by a process
  243. // with Administrator privilege.
  244. //
  245. #define IOCTL_IP_SET_ADDRESS \
  246. _IP_CTL_CODE(1, METHOD_BUFFERED, FILE_WRITE_ACCESS)
  247. //
  248. // This IOCTL is used to specify on which uninitialized interface a DHCP
  249. // client intends to send its requests. The Interface Context parameter is
  250. // a 16-bit quantity. The IOCTL takes a 32-bit Context as its argument. This
  251. // IOCTL with a Context value of 0xFFFFFFFF must be issued to disable special
  252. // processing in IP when a DHCP client is finished initializing interfaces.
  253. // This IOCTL may only be issued by a process with Administrator privilege.
  254. //
  255. #define IOCTL_IP_SET_DHCP_INTERFACE \
  256. _IP_CTL_CODE(2, METHOD_BUFFERED, FILE_WRITE_ACCESS)
  257. //
  258. // This ioctl may only be issued by a process with Administrator privilege.
  259. //
  260. #define IOCTL_IP_SET_IF_CONTEXT \
  261. _IP_CTL_CODE(3, METHOD_BUFFERED, FILE_WRITE_ACCESS)
  262. //
  263. // This ioctl may only be issued by a process with Administrator privilege.
  264. //
  265. #define IOCTL_IP_SET_FILTER_POINTER \
  266. _IP_CTL_CODE(4, METHOD_BUFFERED, FILE_WRITE_ACCESS)
  267. //
  268. // This ioctl may only be issued by a process with Administrator privilege.
  269. //
  270. #define IOCTL_IP_SET_MAP_ROUTE_POINTER \
  271. _IP_CTL_CODE(5, METHOD_BUFFERED, FILE_WRITE_ACCESS)
  272. //
  273. // This ioctl may only be issued by a process with Administrator privilege.
  274. //
  275. #define IOCTL_IP_GET_PNP_ARP_POINTERS \
  276. _IP_CTL_CODE(6, METHOD_BUFFERED, FILE_WRITE_ACCESS)
  277. //
  278. // This ioctl creates a new, dynamic NTE. It may only be issued by a process
  279. // with Administrator privilege.
  280. //
  281. #define IOCTL_IP_ADD_NTE \
  282. _IP_CTL_CODE(7, METHOD_BUFFERED, FILE_WRITE_ACCESS)
  283. //
  284. // This ioctl deletes a dynamic NTE. It may only be issued by a process with
  285. // Administrator privilege.
  286. //
  287. #define IOCTL_IP_DELETE_NTE \
  288. _IP_CTL_CODE(8, METHOD_BUFFERED, FILE_WRITE_ACCESS)
  289. //
  290. // This ioctl gathers information about an NTE. It requires no special
  291. // privilege.
  292. //
  293. #define IOCTL_IP_GET_NTE_INFO \
  294. _IP_CTL_CODE(9, METHOD_BUFFERED, FILE_ANY_ACCESS)
  295. //
  296. // This ioctl adds or removes wakeup patterns
  297. //
  298. #define IOCTL_IP_WAKEUP_PATTERN \
  299. _IP_CTL_CODE(10, METHOD_BUFFERED, FILE_WRITE_ACCESS)
  300. //
  301. // This ioctl allows DHCP to get media sense notifications.
  302. //
  303. #define IOCTL_IP_GET_IP_EVENT \
  304. _IP_CTL_CODE(11, METHOD_BUFFERED, FILE_WRITE_ACCESS)
  305. //
  306. // This ioctl may only be issued by a process with Administrator privilege.
  307. //
  308. #define IOCTL_IP_SET_FIREWALL_HOOK \
  309. _IP_CTL_CODE(12, METHOD_BUFFERED, FILE_WRITE_ACCESS)
  310. #define IOCTL_IP_RTCHANGE_NOTIFY_REQUEST \
  311. _IP_CTL_CODE(13, METHOD_BUFFERED, FILE_ANY_ACCESS)
  312. #define IOCTL_IP_ADDCHANGE_NOTIFY_REQUEST \
  313. _IP_CTL_CODE(14, METHOD_BUFFERED, FILE_ANY_ACCESS)
  314. #define IOCTL_ARP_SEND_REQUEST \
  315. _IP_CTL_CODE(15, METHOD_BUFFERED, FILE_ANY_ACCESS)
  316. #define IOCTL_IP_INTERFACE_INFO \
  317. _IP_CTL_CODE(16, METHOD_BUFFERED, FILE_ANY_ACCESS)
  318. #define IOCTL_IP_GET_BEST_INTERFACE \
  319. _IP_CTL_CODE(17, METHOD_BUFFERED, FILE_ANY_ACCESS)
  320. #define IOCTL_IP_SET_IF_PROMISCUOUS \
  321. _IP_CTL_CODE(19, METHOD_BUFFERED, FILE_WRITE_ACCESS)
  322. #define IOCTL_IP_FLUSH_ARP_TABLE \
  323. _IP_CTL_CODE(20, METHOD_BUFFERED, FILE_WRITE_ACCESS)
  324. #define IOCTL_IP_GET_IGMPLIST \
  325. _IP_CTL_CODE(21, METHOD_BUFFERED, FILE_ANY_ACCESS)
  326. #define IOCTL_IP_SET_BLOCKOFROUTES \
  327. _IP_CTL_CODE(23, METHOD_BUFFERED, FILE_WRITE_ACCESS)
  328. #define IOCTL_IP_SET_ROUTEWITHREF \
  329. _IP_CTL_CODE(24, METHOD_BUFFERED, FILE_WRITE_ACCESS)
  330. #define IOCTL_IP_SET_ADDRESS_DUP \
  331. _IP_CTL_CODE(25, METHOD_BUFFERED, FILE_WRITE_ACCESS)
  332. #define IOCTL_IP_GET_IF_INDEX \
  333. _IP_CTL_CODE(26, METHOD_BUFFERED, FILE_ANY_ACCESS)
  334. #define IOCTL_IP_GET_IF_NAME \
  335. _IP_CTL_CODE(27, METHOD_BUFFERED, FILE_ANY_ACCESS)
  336. #define IOCTL_IP_GET_BESTINTFC_FUNC_ADDR \
  337. _IP_CTL_CODE(28, METHOD_BUFFERED, FILE_WRITE_ACCESS)
  338. #define IOCTL_IP_SET_MULTIHOPROUTE \
  339. _IP_CTL_CODE(29, METHOD_BUFFERED, FILE_WRITE_ACCESS)
  340. #define IOCTL_IP_GET_WOL_CAPABILITY \
  341. _IP_CTL_CODE(30, METHOD_BUFFERED, FILE_WRITE_ACCESS)
  342. #define IOCTL_IP_RTCHANGE_NOTIFY_REQUEST_EX \
  343. _IP_CTL_CODE(31, METHOD_BUFFERED, FILE_ANY_ACCESS)
  344. #define IOCTL_IP_ENABLE_ROUTER_REQUEST \
  345. _IP_CTL_CODE(32, METHOD_BUFFERED, FILE_WRITE_ACCESS)
  346. #define IOCTL_IP_UNENABLE_ROUTER_REQUEST \
  347. _IP_CTL_CODE(33, METHOD_BUFFERED, FILE_WRITE_ACCESS)
  348. #define IOCTL_IP_GET_OFFLOAD_CAPABILITY \
  349. _IP_CTL_CODE(34, METHOD_BUFFERED, FILE_WRITE_ACCESS)
  350. #define IOCTL_IP_IFCHANGE_NOTIFY_REQUEST \
  351. _IP_CTL_CODE(35, METHOD_BUFFERED, FILE_ANY_ACCESS)
  352. #define IOCTL_IP_UNIDIRECTIONAL_ADAPTER_ADDRESS \
  353. _IP_CTL_CODE(36, METHOD_BUFFERED, FILE_ANY_ACCESS)
  354. #define IOCTL_IP_GET_MCAST_COUNTERS \
  355. _IP_CTL_CODE(37, METHOD_BUFFERED, FILE_ANY_ACCESS)
  356. #define IOCTL_IP_ENABLE_MEDIA_SENSE_REQUEST \
  357. _IP_CTL_CODE(38, METHOD_BUFFERED, FILE_WRITE_ACCESS)
  358. #define IOCTL_IP_DISABLE_MEDIA_SENSE_REQUEST \
  359. _IP_CTL_CODE(39, METHOD_BUFFERED, FILE_WRITE_ACCESS)
  360. #define IOCTL_IP_SET_ADDRESS_EX \
  361. _IP_CTL_CODE(40, METHOD_BUFFERED, FILE_WRITE_ACCESS)
  362. #endif // _NTDDIP_