IPHlpApi.h
上传用户:feituo2008
上传日期:2013-02-02
资源大小:493k
文件大小:15k
源码类别:

Email客户端

开发平台:

Visual C++

  1. /*++
  2. Copyright (c) 1997-1999  Microsoft Corporation
  3. Module Name:
  4.     publicsdkinciphlpapi.h
  5. Abstract:
  6.     Header file for functions to interact with the IP Stack for MIB-II and
  7.     related functionality
  8. Revision History:
  9.     Amritansh Raghav    Created
  10.     NK Srinivas         Added
  11. --*/
  12. #ifndef __IPHLPAPI_H__
  13. #define __IPHLPAPI_H__
  14. #if _MSC_VER > 1000
  15. #pragma once
  16. #endif
  17. #ifdef __cplusplus
  18. extern "C" {
  19. #endif
  20. //////////////////////////////////////////////////////////////////////////////
  21. //                                                                          //
  22. // IPRTRMIB.H has the definitions of the strcutures used to set and get     //
  23. // information                                                              //
  24. //                                                                          //
  25. //////////////////////////////////////////////////////////////////////////////
  26. #include <iprtrmib.h>
  27. #include "ipexport.h"
  28. #include "iptypes.h"
  29. //////////////////////////////////////////////////////////////////////////////
  30. //                                                                          //
  31. // The GetXXXTable APIs take a buffer and a size of buffer.  If the buffer  //
  32. // is not large enough, they APIs return ERROR_INSUFFICIENT_BUFFER  and     //
  33. // *pdwSize is the required buffer size                                     //
  34. // The bOrder is a BOOLEAN, which if TRUE sorts the table according to      //
  35. // MIB-II (RFC XXXX)                                                        //
  36. //                                                                          //
  37. //////////////////////////////////////////////////////////////////////////////
  38. //////////////////////////////////////////////////////////////////////////////
  39. //                                                                          //
  40. // Retrieves the number of interfaces in the system. These include LAN and  //
  41. // WAN interfaces                                                           //
  42. //                                                                          //
  43. //////////////////////////////////////////////////////////////////////////////
  44. DWORD
  45. WINAPI
  46. GetNumberOfInterfaces(
  47.     OUT PDWORD  pdwNumIf
  48.     );
  49. //////////////////////////////////////////////////////////////////////////////
  50. //                                                                          //
  51. // Gets the MIB-II ifEntry                                                  //
  52. // The dwIndex field of the MIB_IFROW should be set to the index of the     //
  53. // interface being queried                                                  //
  54. //                                                                          //
  55. //////////////////////////////////////////////////////////////////////////////
  56. DWORD
  57. WINAPI
  58. GetIfEntry(
  59.     IN OUT PMIB_IFROW   pIfRow
  60.     );
  61. //////////////////////////////////////////////////////////////////////////////
  62. //                                                                          //
  63. // Gets the MIB-II IfTable                                                  //
  64. //                                                                          //
  65. //////////////////////////////////////////////////////////////////////////////
  66. DWORD
  67. WINAPI
  68. GetIfTable(
  69.     OUT    PMIB_IFTABLE pIfTable,
  70.     IN OUT PULONG       pdwSize,
  71.     IN     BOOL         bOrder
  72.     );
  73. //////////////////////////////////////////////////////////////////////////////
  74. //                                                                          //
  75. // Gets the Interface to IP Address mapping                                 //
  76. //                                                                          //
  77. //////////////////////////////////////////////////////////////////////////////
  78. DWORD
  79. WINAPI
  80. GetIpAddrTable(
  81.     OUT    PMIB_IPADDRTABLE pIpAddrTable,
  82.     IN OUT PULONG           pdwSize,
  83.     IN     BOOL             bOrder
  84.     );
  85. //////////////////////////////////////////////////////////////////////////////
  86. //                                                                          //
  87. // Gets the current IP Address to Physical Address (ARP) mapping            //
  88. //                                                                          //
  89. //////////////////////////////////////////////////////////////////////////////
  90. DWORD
  91. WINAPI
  92. GetIpNetTable(
  93.     OUT    PMIB_IPNETTABLE pIpNetTable,
  94.     IN OUT PULONG          pdwSize,
  95.     IN     BOOL            bOrder
  96.     );
  97. //////////////////////////////////////////////////////////////////////////////
  98. //                                                                          //
  99. // Gets the IP Routing Table  (RFX XXXX)                                    //
  100. //                                                                          //
  101. //////////////////////////////////////////////////////////////////////////////
  102. DWORD
  103. WINAPI
  104. GetIpForwardTable(
  105.     OUT    PMIB_IPFORWARDTABLE pIpForwardTable,
  106.     IN OUT PULONG              pdwSize,
  107.     IN     BOOL                bOrder
  108.     );
  109. //////////////////////////////////////////////////////////////////////////////
  110. //                                                                          //
  111. // Gets TCP Connection/UDP Listener Table                                   //
  112. //                                                                          //
  113. //////////////////////////////////////////////////////////////////////////////
  114. DWORD
  115. WINAPI
  116. GetTcpTable(
  117.     OUT    PMIB_TCPTABLE pTcpTable,
  118.     IN OUT PDWORD        pdwSize,
  119.     IN     BOOL          bOrder
  120.     );
  121. DWORD
  122. WINAPI
  123. GetUdpTable(
  124.     OUT    PMIB_UDPTABLE pUdpTable,
  125.     IN OUT PDWORD        pdwSize,
  126.     IN     BOOL          bOrder
  127.     );
  128. //////////////////////////////////////////////////////////////////////////////
  129. //                                                                          //
  130. // Gets IP/ICMP/TCP/UDP Statistics                                          //
  131. //                                                                          //
  132. //////////////////////////////////////////////////////////////////////////////
  133. DWORD
  134. WINAPI
  135. GetIpStatistics(
  136.     OUT  PMIB_IPSTATS   pStats
  137.     );
  138. DWORD
  139. WINAPI
  140. GetIcmpStatistics(
  141.     OUT PMIB_ICMP   pStats
  142.     );
  143. DWORD
  144. WINAPI
  145. GetTcpStatistics(
  146.     OUT PMIB_TCPSTATS   pStats
  147.     );
  148. DWORD
  149. WINAPI
  150. GetUdpStatistics(
  151.     OUT PMIB_UDPSTATS   pStats
  152.     );
  153. //////////////////////////////////////////////////////////////////////////////
  154. //                                                                          //
  155. // Used to set the ifAdminStatus on an interface.  The only fields of the   //
  156. // MIB_IFROW that are relevant are the dwIndex (index of the interface      //
  157. // whose status needs to be set) and the dwAdminStatus which can be either  //
  158. // MIB_IF_ADMIN_STATUS_UP or MIB_IF_ADMIN_STATUS_DOWN                       //
  159. //                                                                          //
  160. //////////////////////////////////////////////////////////////////////////////
  161. DWORD
  162. WINAPI
  163. SetIfEntry(
  164.     IN PMIB_IFROW pIfRow
  165.     );
  166. //////////////////////////////////////////////////////////////////////////////
  167. //                                                                          //
  168. // Used to create, modify or delete a route.  In all cases the              //
  169. // dwForwardIfIndex, dwForwardDest, dwForwardMask, dwForwardNextHop and     //
  170. // dwForwardPolicy MUST BE SPECIFIED. Currently dwForwardPolicy is unused   //
  171. // and MUST BE 0.                                                           //
  172. // For a set, the complete MIB_IPFORWARDROW structure must be specified     //
  173. //                                                                          //
  174. //////////////////////////////////////////////////////////////////////////////
  175. DWORD
  176. WINAPI
  177. CreateIpForwardEntry(
  178.     IN PMIB_IPFORWARDROW pRoute
  179.     );
  180. DWORD
  181. WINAPI
  182. SetIpForwardEntry(
  183.     IN PMIB_IPFORWARDROW pRoute
  184.     );
  185. DWORD
  186. WINAPI
  187. DeleteIpForwardEntry(
  188.     IN PMIB_IPFORWARDROW pRoute
  189.     );
  190. //////////////////////////////////////////////////////////////////////////////
  191. //                                                                          //
  192. // Used to set the ipForwarding to ON or OFF (currently only ON->OFF is     //
  193. // allowed) and to set the defaultTTL.  If only one of the fields needs to  //
  194. // be modified and the other needs to be the same as before the other field //
  195. // needs to be set to MIB_USE_CURRENT_TTL or MIB_USE_CURRENT_FORWARDING as  //
  196. // the case may be                                                          //
  197. //                                                                          //
  198. //////////////////////////////////////////////////////////////////////////////
  199. DWORD
  200. WINAPI
  201. SetIpStatistics(
  202.     IN PMIB_IPSTATS pIpStats
  203.     );
  204. //////////////////////////////////////////////////////////////////////////////
  205. //                                                                          //
  206. // Used to set the defaultTTL.                                              //
  207. //                                                                          //
  208. //////////////////////////////////////////////////////////////////////////////
  209. DWORD
  210. WINAPI
  211. SetIpTTL(
  212.     UINT nTTL
  213.     );
  214. //////////////////////////////////////////////////////////////////////////////
  215. //                                                                          //
  216. // Used to create, modify or delete an ARP entry.  In all cases the dwIndex //
  217. // dwAddr field MUST BE SPECIFIED.                                          //
  218. // For a set, the complete MIB_IPNETROW structure must be specified         //
  219. //                                                                          //
  220. //////////////////////////////////////////////////////////////////////////////
  221. DWORD
  222. WINAPI
  223. CreateIpNetEntry(
  224.     IN PMIB_IPNETROW    pArpEntry
  225.     );
  226. DWORD
  227. WINAPI
  228. SetIpNetEntry(
  229.     IN PMIB_IPNETROW    pArpEntry
  230.     );
  231. DWORD
  232. WINAPI
  233. DeleteIpNetEntry(
  234.     IN PMIB_IPNETROW    pArpEntry
  235.     );
  236. DWORD
  237. WINAPI
  238. FlushIpNetTable(
  239.     IN DWORD   dwIfIndex
  240.     );
  241. //////////////////////////////////////////////////////////////////////////////
  242. //                                                                          //
  243. // Used to create or delete a Proxy ARP entry. The dwIndex is the index of  //
  244. // the interface on which to PARP for the dwAddress.  If the interface is   //
  245. // of a type that doesnt support ARP, e.g. PPP, then the call will fail     //
  246. //                                                                          //
  247. //////////////////////////////////////////////////////////////////////////////
  248. DWORD
  249. WINAPI
  250. CreateProxyArpEntry(
  251.     IN  DWORD   dwAddress,
  252.     IN  DWORD   dwMask,
  253.     IN  DWORD   dwIfIndex
  254.     );
  255. DWORD
  256. WINAPI
  257. DeleteProxyArpEntry(
  258.     IN  DWORD   dwAddress,
  259.     IN  DWORD   dwMask,
  260.     IN  DWORD   dwIfIndex
  261.     );
  262. //////////////////////////////////////////////////////////////////////////////
  263. //                                                                          //
  264. // Used to set the state of a TCP Connection. The only state that it can be //
  265. // set to is MIB_TCP_STATE_DELETE_TCB.  The complete MIB_TCPROW structure   //
  266. // MUST BE SPECIFIED                                                        //
  267. //                                                                          //
  268. //////////////////////////////////////////////////////////////////////////////
  269. DWORD
  270. WINAPI
  271. SetTcpEntry(
  272.     IN PMIB_TCPROW pTcpRow
  273.     );
  274. DWORD
  275. WINAPI
  276. GetInterfaceInfo(
  277.     IN PIP_INTERFACE_INFO pIfTable,
  278.     OUT PULONG            dwOutBufLen
  279.     );
  280. DWORD
  281. WINAPI
  282. GetUniDirectionalAdapterInfo(OUT PIP_UNIDIRECTIONAL_ADAPTER_ADDRESS pIPIfInfo,
  283.                  OUT PULONG dwOutBufLen
  284.                  );
  285. //////////////////////////////////////////////////////////////////////////////
  286. //                                                                          //
  287. // Gets the "best" outgoing interface for the specified destination address //
  288. //                                                                          //
  289. //////////////////////////////////////////////////////////////////////////////
  290. DWORD
  291. WINAPI
  292. GetBestInterface(
  293.     IN  IPAddr  dwDestAddr,
  294.     OUT PDWORD  pdwBestIfIndex
  295.     );
  296. //////////////////////////////////////////////////////////////////////////////
  297. //                                                                          //
  298. // Gets the best (longest matching prefix) route for the given destination  //
  299. // If the source address is also specified (i.e. is not 0x00000000), and    //
  300. // there are multiple "best" routes to the given destination, the returned  //
  301. // route will be one that goes out over the interface which has an address  //
  302. // that matches the source address                                          //
  303. //                                                                          //
  304. //////////////////////////////////////////////////////////////////////////////
  305. DWORD
  306. WINAPI
  307. GetBestRoute(
  308.     IN  DWORD               dwDestAddr,
  309.     IN  DWORD               dwSourceAddr, OPTIONAL
  310.     OUT PMIB_IPFORWARDROW   pBestRoute
  311.     );
  312. DWORD
  313. WINAPI
  314. NotifyAddrChange(
  315.     OUT PHANDLE      Handle,
  316.     IN  LPOVERLAPPED overlapped
  317.     );
  318. DWORD
  319. WINAPI
  320. NotifyRouteChange(
  321.     OUT PHANDLE      Handle,
  322.     IN  LPOVERLAPPED overlapped
  323.     );
  324. DWORD
  325. WINAPI
  326. GetAdapterIndex(
  327.     IN LPWSTR  AdapterName,
  328.     OUT PULONG IfIndex
  329.     );
  330. DWORD
  331. WINAPI
  332. AddIPAddress(
  333.     IPAddr  Address,
  334.     IPMask  IpMask,
  335.     DWORD   IfIndex,
  336.     PULONG  NTEContext,
  337.     PULONG  NTEInstance
  338.     );
  339. DWORD
  340. WINAPI
  341. DeleteIPAddress(
  342.     ULONG NTEContext
  343.     );
  344. DWORD
  345. WINAPI
  346. GetNetworkParams(
  347.     PFIXED_INFO pFixedInfo, PULONG pOutBufLen
  348.     );
  349. DWORD
  350. WINAPI
  351. GetAdaptersInfo(
  352.     PIP_ADAPTER_INFO pAdapterInfo, PULONG pOutBufLen
  353.     );
  354. DWORD
  355. WINAPI
  356. GetPerAdapterInfo(
  357.     ULONG IfIndex, PIP_PER_ADAPTER_INFO pPerAdapterInfo, PULONG pOutBufLen
  358.     );
  359. DWORD
  360. WINAPI
  361. IpReleaseAddress(
  362.     PIP_ADAPTER_INDEX_MAP  AdapterInfo
  363.     );
  364. DWORD
  365. WINAPI
  366. IpRenewAddress(
  367.     PIP_ADAPTER_INDEX_MAP  AdapterInfo
  368.     );
  369. DWORD
  370. WINAPI
  371. SendARP(
  372.     IPAddr DestIP,
  373.     IPAddr SrcIP,
  374.     PULONG pMacAddr,
  375.     PULONG  PhyAddrLen
  376.     );
  377. BOOL
  378. WINAPI
  379. GetRTTAndHopCount(
  380.     IPAddr DestIpAddress,
  381.     PULONG HopCount,
  382.     ULONG  MaxHops,
  383.     PULONG RTT
  384.     );
  385. DWORD
  386. WINAPI
  387. GetFriendlyIfIndex(
  388.     DWORD IfIndex
  389.     );
  390. DWORD
  391. WINAPI
  392. EnableRouter(
  393.     HANDLE* pHandle,
  394.     OVERLAPPED* pOverlapped
  395.     );
  396. DWORD
  397. WINAPI
  398. UnenableRouter(
  399.     OVERLAPPED* pOverlapped,
  400.     LPDWORD lpdwEnableCount OPTIONAL
  401.     );
  402. #ifdef __cplusplus
  403. }
  404. #endif
  405. #endif //__IPHLPAPI_H__