Leaked source code of windows server 2003
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.

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