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.

428 lines
11 KiB

  1. /*++
  2. Copyright (c) Microsoft Corporation. All rights reserved.
  3. Module Name:
  4. public\sdk\inc\nhapi.h
  5. Abstract:
  6. Public header for the Networking Helper DLL
  7. This was earlier called IP Helper DLL (iphlpapi.h) - but these
  8. are the new and improved functions.
  9. Revision History:
  10. AmritanR Created
  11. --*/
  12. #pragma once
  13. #pragma warning(push)
  14. #pragma warning(disable:4200)
  15. //////////////////////////////////////////////////////////////////////////////
  16. // //
  17. // The following typedefs allow a 3rd to extend the interface name space of //
  18. // an Windows NT system. //
  19. // //
  20. //////////////////////////////////////////////////////////////////////////////
  21. typedef
  22. DWORD
  23. (WINAPI * PNH_NAME_MAPPER_INIT)(
  24. VOID
  25. );
  26. typedef
  27. VOID
  28. (WINAPI * PNH_NAME_MAPPER_DEINIT)(
  29. VOID
  30. );
  31. typedef
  32. DWORD
  33. (WINAPI * PNH_NAME_MAPPER_MAP_GUID)(
  34. IN GUID *pGuid,
  35. OUT PWCHAR pwszBuffer,
  36. IN OUT PULONG pulBufferSize,
  37. IN BOOL bRefresh,
  38. IN BOOL bCache
  39. );
  40. typedef
  41. DWORD
  42. (WINAPI * PNH_NAME_MAPPER_MAP_NAME)(
  43. IN PWCHAR pwszBuffer,
  44. OUT GUID *pGuid,
  45. IN BOOL bRefresh,
  46. IN BOOL bCache
  47. );
  48. typedef
  49. DWORD
  50. (WINAPI * PNH_NAME_MAPPER_GET_DESCRIPTION)(
  51. IN GUID *pGuid,
  52. OUT PWCHAR pwszBuffer,
  53. IN OUT PULONG pulBufferSize,
  54. IN BOOL bCache,
  55. IN BOOL bRefresh
  56. );
  57. DWORD
  58. NhGetInterfaceNameFromGuid(
  59. IN GUID *pGuid,
  60. OUT PWCHAR pwszBuffer,
  61. IN OUT PULONG pulBufferSize,
  62. IN BOOL bCache,
  63. IN BOOL bRefresh
  64. );
  65. DWORD
  66. NhGetInterfaceNameFromDeviceGuid(
  67. IN GUID *pGuid,
  68. OUT PWCHAR pwszBuffer,
  69. IN OUT PULONG pulBufferSize,
  70. IN BOOL bCache,
  71. IN BOOL bRefresh
  72. );
  73. DWORD
  74. NhGetGuidFromInterfaceName(
  75. IN PWCHAR pwszName,
  76. OUT GUID *pGuid,
  77. IN BOOL bCache,
  78. IN BOOL bRefresh
  79. );
  80. DWORD
  81. NhGetInterfaceDescriptionFromGuid(
  82. IN GUID *pGuid,
  83. OUT PWCHAR pwszBuffer,
  84. IN OUT PULONG pulBufferSize,
  85. IN BOOL bCache,
  86. IN BOOL bRefresh
  87. );
  88. //////////////////////////////////////////////////////////////////////////////
  89. // //
  90. // The following functions get interface related statistics and information //
  91. // //
  92. //////////////////////////////////////////////////////////////////////////////
  93. typedef struct _NH_IF_STATS_0
  94. {
  95. DWORD dwIndex;
  96. DWORD dwAdminStatus;
  97. DWORD dwOperationalStatus;
  98. ULONG ulMtu;
  99. ULONG ulSpeed;
  100. ULONGLONG ullInOctets;
  101. ULONGLONG ullInMulticastOctets;
  102. ULONGLONG ullInBroadcastOctets;
  103. ULONGLONG ullInUnicastPkts;
  104. ULONGLONG ullInBroadcastPkts;
  105. ULONGLONG ullInMulticastPkts;
  106. ULONGLONG ullInDiscardedPkts;
  107. ULONGLONG ullInErrors;
  108. ULONGLONG ullInUnknownUpperLayer;
  109. ULONGLONG ullOutOctets;
  110. ULONGLONG ullOutMulticastOctets;
  111. ULONGLONG ullOutBroadcastOctets;
  112. ULONGLONG ullOutUnicastPkts;
  113. ULONGLONG ullOutBroadcastPkts;
  114. ULONGLONG ullOutMulticastPkts;
  115. ULONGLONG ullOutDiscardedPkts;
  116. ULONGLONG ullOutErrors;
  117. ULONGLONG ullInDifferentIfPkts;
  118. BOOL bPromiscuousMode;
  119. BOOL bMediaSensed;
  120. }NH_IF_STATS_0, *PNH_IF_STATS_0;
  121. typedef struct _NH_IF_INFO_0
  122. {
  123. GUID Guid;
  124. DWORD dwIndex;
  125. DWORD dwMediaType;
  126. USHORT usConnectionType;
  127. USHORT usAccessType;
  128. USHORT usPhysAddrLen;
  129. USHORT usPhysAddrOffset;
  130. }NH_IF_INFO_0, *PNH_IF_INFO_0;
  131. DWORD
  132. NhGetInterfaceTable(
  133. IN DWORD dwVersion,
  134. OUT PBYTE pbyInfoTable,
  135. IN OUT PULONG pulBufferSize,
  136. OUT PULONG pulNumEntries,
  137. IN OUT PVOID pvResumeContext
  138. );
  139. DWORD
  140. NhGetInterface(
  141. IN DWORD dwVersion,
  142. OUT PBYTE pbyInterfaceInfo
  143. );
  144. DWORD
  145. NhGetInterfaceStatisticsTable(
  146. IN DWORD dwVersion,
  147. OUT PBYTE pbyStatisticsTable,
  148. IN OUT PULONG pulBufferSize,
  149. OUT PULONG pulNumEntries,
  150. IN OUT PVOID pvResumeContext
  151. );
  152. DWORD
  153. NhGetInterfaceStatistics(
  154. IN DWORD dwVersion,
  155. OUT PBYTE pbyInterfaceStatistics
  156. );
  157. DWORD
  158. NhGetIp4AddressTable(
  159. );
  160. //////////////////////////////////////////////////////////////////////////////
  161. // //
  162. // The following functions are related to IP ARP entries //
  163. // //
  164. //////////////////////////////////////////////////////////////////////////////
  165. typedef struct _NH_IP4_ARP_ENTRY_0
  166. {
  167. DWORD dwIndex;
  168. DWORD dwIpAddress;
  169. USHORT usType;
  170. USHORT usAddressLength;
  171. BYTE byAddress[0];
  172. }NH_IP4_ARP_ENTRY_0, *PNH_IP4_ARP_ENTRY_0;
  173. DWORD
  174. NhGetIp4ArpTable(
  175. IN DWORD dwVersion,
  176. OUT PBYTE pbyArpTable,
  177. IN OUT PULONG pulBufferSize,
  178. OUT PULONG pulNumEntries,
  179. IN OUT PVOID pvResumeContext
  180. );
  181. DWORD
  182. NhFlushIp4ArpTable(
  183. IN DWORD dwIfIndex OPTIONAL
  184. );
  185. DWORD
  186. NhSetIp4ArpEntry(
  187. );
  188. DWORD
  189. NhDeleteIp4ArpEntry(
  190. );
  191. //////////////////////////////////////////////////////////////////////////////
  192. // //
  193. // The following functions are related to IP Proxy ARP tables //
  194. // //
  195. //////////////////////////////////////////////////////////////////////////////
  196. DWORD
  197. NhGetIp4ProxyArpTable(
  198. );
  199. DWORD
  200. NhSetIp4ProxyArpEntry(
  201. );
  202. DWORD
  203. NhDeleteIp4ProxyArpEntry(
  204. );
  205. //////////////////////////////////////////////////////////////////////////////
  206. // //
  207. // The following functions are related to the IP Routing Table //
  208. // //
  209. //////////////////////////////////////////////////////////////////////////////
  210. typedef struct _NH_IP4_ROUTE_0
  211. {
  212. DWORD dwDestination;
  213. DWORD dwMask;
  214. DWORD dwPolicy;
  215. DWORD dwNextHop;
  216. DWORD dwIfIndex;
  217. DWORD dwType;
  218. DWORD dwProto;
  219. DWORD dwAge;
  220. DWORD dwNextHopAS;
  221. DWORD dwMetric1;
  222. DWORD dwMetric2;
  223. DWORD dwMetric3;
  224. DWORD dwMetric4;
  225. DWORD dwMetric5;
  226. }NH_IP4_ROUTE_0, *PNH_IP4_ROUTE_0;
  227. DWORD
  228. NhGetIp4RouteTable(
  229. );
  230. DWORD
  231. NhGetIp4BestRoute(
  232. );
  233. DWORD
  234. NhSetIp4RouteEntry(
  235. );
  236. DWORD
  237. NhDeleteIp4RouteEntry(
  238. );
  239. //////////////////////////////////////////////////////////////////////////////
  240. // //
  241. // The following functions are related to IP Proxy ARP tables //
  242. // //
  243. //////////////////////////////////////////////////////////////////////////////
  244. typedef struct _NH_IP4_STATISTICS_0
  245. {
  246. DWORD dwForwarding;
  247. DWORD dwDefaultTTL;
  248. ULONGLONG ullInReceives;
  249. ULONGLONG ullInHdrErrors;
  250. ULONGLONG ullInAddrErrors;
  251. ULONGLONG ullForwDatagrams;
  252. ULONGLONG ullInUnknownProtos;
  253. ULONGLONG ullInDiscards;
  254. ULONGLONG ullInDelivers;
  255. ULONGLONG ullOutRequests;
  256. ULONGLONG ullRoutingDiscards;
  257. ULONGLONG ullOutDiscards;
  258. ULONGLONG ullOutNoRoutes;
  259. ULONGLONG ullReasmTimeout;
  260. ULONGLONG ullReasmReqds;
  261. ULONGLONG ullReasmOks;
  262. ULONGLONG ullReasmFails;
  263. ULONGLONG ullFragOks;
  264. ULONGLONG ullFragFails;
  265. ULONGLONG ullFragCreates;
  266. ULONG ulNumIf;
  267. ULONG ulNumAddr;
  268. ULONG ulNumRoutes;
  269. }NH_IP4_STATISTICS_0, *PNH_IP4_STATISTICS_0;
  270. DWORD
  271. NhGetIp4Statistics(
  272. );
  273. typedef struct _NH_IP4_TCP_STATISTICS_0
  274. {
  275. DWORD dwRtoAlgorithm;
  276. DWORD dwRtoMin;
  277. DWORD dwRtoMax;
  278. DWORD dwMaxConn;
  279. DWORD dwActiveOpens;
  280. DWORD dwPassiveOpens;
  281. DWORD dwAttemptFails;
  282. DWORD dwEstabResets;
  283. DWORD dwCurrEstab;
  284. DWORD dwInSegs;
  285. DWORD dwOutSegs;
  286. DWORD dwRetransSegs;
  287. DWORD dwInErrs;
  288. DWORD dwOutRsts;
  289. DWORD dwNumConns;
  290. }NH_IP4_TCP_STATISTICS_0, *PNH_IP4_TCP_STATISTICS_0;
  291. DWORD
  292. NhGetIp4TcpStatistics(
  293. );
  294. typedef struct _NH_IP4_UDP_STATISTICS_0
  295. {
  296. DWORD dwInDatagrams;
  297. DWORD dwNoPorts;
  298. DWORD dwInErrors;
  299. DWORD dwOutDatagrams;
  300. DWORD dwNumAddrs;
  301. }NH_IP4_UDP_STATISTICS_0, *PNH_IP4_UDP_STATISTICS_0;
  302. DWORD
  303. NhGetIp4UdpStatistics(
  304. );
  305. typedef struct _NH_IP4_ICMP_STATISTICS_0
  306. {
  307. DWORD dwInMsgs;
  308. DWORD dwInErrors;
  309. DWORD dwInDestUnreachs;
  310. DWORD dwInTimeExcds;
  311. DWORD dwInParmProbs;
  312. DWORD dwInSrcQuenchs;
  313. DWORD dwInRedirects;
  314. DWORD dwInEchos;
  315. DWORD dwInEchoReps;
  316. DWORD dwInTimestamps;
  317. DWORD dwInTimestampReps;
  318. DWORD dwInAddrMasks;
  319. DWORD dwInAddrMaskReps;
  320. DWORD dwOutMsgs;
  321. DWORD dwOutErrors;
  322. DWORD dwOutDestUnreachs;
  323. DWORD dwOutTimeExcds;
  324. DWORD dwOutParmProbs;
  325. DWORD dwOutSrcQuenchs;
  326. DWORD dwOutRedirects;
  327. DWORD dwOutEchos;
  328. DWORD dwOutEchoReps;
  329. DWORD dwOutTimestamps;
  330. DWORD dwOutTimestampReps;
  331. DWORD dwOutAddrMasks;
  332. DWORD dwOutAddrMaskReps;
  333. }NH_IP4_ICMP_STATISTICS_0, *PNH_IP4_ICMP_STATISTICS_0;
  334. DWORD
  335. NhGetIp4IcmpStatistics(
  336. );
  337. //////////////////////////////////////////////////////////////////////////////
  338. // //
  339. // The following functions are related to Global IP Configuration //
  340. // //
  341. //////////////////////////////////////////////////////////////////////////////
  342. typedef struct _NH_IP4_INFO_0
  343. {
  344. DWORD a;
  345. }NH_IP4_INFO_0, *PNH_IP4_INFO_0;
  346. //////////////////////////////////////////////////////////////////////////////
  347. // //
  348. // The following functions are related to per interface IP Configuration //
  349. // //
  350. //////////////////////////////////////////////////////////////////////////////
  351. typedef struct _NH_IP4_INTERFACE_INFO_0
  352. {
  353. DWORD a;
  354. }NH_IP4_INTERFACE_INFO_0, *PNH_IP4_INTERFACE_INFO_0;
  355. #pragma warning(pop)