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.

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