|
|
1.1 ! root 1: /*++ ! 2: ! 3: Copyright (c) Microsoft Corporation. All rights reserved. ! 4: ! 5: Module Name: ! 6: ! 7: iphlpapi.h ! 8: ! 9: Abstract: ! 10: Header file for functions to interact with the IP Stack for MIB-II and ! 11: related functionality ! 12: ! 13: --*/ ! 14: ! 15: #ifndef __IPHLPAPI_H__ ! 16: #define __IPHLPAPI_H__ ! 17: ! 18: #if _MSC_VER > 1000 ! 19: #pragma once ! 20: #endif ! 21: ! 22: #ifdef __cplusplus ! 23: extern "C" { ! 24: #endif ! 25: ! 26: ////////////////////////////////////////////////////////////////////////////// ! 27: // // ! 28: // IPRTRMIB.H has the definitions of the strcutures used to set and get // ! 29: // information // ! 30: // // ! 31: ////////////////////////////////////////////////////////////////////////////// ! 32: ! 33: #include <iprtrmib.h> ! 34: #include <ipexport.h> ! 35: #include <iptypes.h> ! 36: ! 37: ////////////////////////////////////////////////////////////////////////////// ! 38: // // ! 39: // The GetXXXTable APIs take a buffer and a size of buffer. If the buffer // ! 40: // is not large enough, the APIs return ERROR_INSUFFICIENT_BUFFER and // ! 41: // *pdwSize is the required buffer size // ! 42: // The bOrder is a BOOLEAN, which if TRUE sorts the table according to // ! 43: // MIB-II (RFC XXXX) // ! 44: // // ! 45: ////////////////////////////////////////////////////////////////////////////// ! 46: ! 47: ! 48: ////////////////////////////////////////////////////////////////////////////// ! 49: // // ! 50: // Retrieves the number of interfaces in the system. These include LAN and // ! 51: // WAN interfaces // ! 52: // // ! 53: ////////////////////////////////////////////////////////////////////////////// ! 54: ! 55: ! 56: DWORD ! 57: WINAPI ! 58: GetNumberOfInterfaces( ! 59: OUT PDWORD pdwNumIf ! 60: ); ! 61: ! 62: ////////////////////////////////////////////////////////////////////////////// ! 63: // // ! 64: // Gets the MIB-II ifEntry // ! 65: // The dwIndex field of the MIB_IFROW should be set to the index of the // ! 66: // interface being queried // ! 67: // // ! 68: ////////////////////////////////////////////////////////////////////////////// ! 69: ! 70: DWORD ! 71: WINAPI ! 72: GetIfEntry( ! 73: IN OUT PMIB_IFROW pIfRow ! 74: ); ! 75: ! 76: ////////////////////////////////////////////////////////////////////////////// ! 77: // // ! 78: // Gets the MIB-II IfTable // ! 79: // // ! 80: ////////////////////////////////////////////////////////////////////////////// ! 81: ! 82: DWORD ! 83: WINAPI ! 84: GetIfTable( ! 85: OUT PMIB_IFTABLE pIfTable, ! 86: IN OUT PULONG pdwSize, ! 87: IN BOOL bOrder ! 88: ); ! 89: ! 90: ////////////////////////////////////////////////////////////////////////////// ! 91: // // ! 92: // Gets the Interface to IP Address mapping // ! 93: // // ! 94: ////////////////////////////////////////////////////////////////////////////// ! 95: ! 96: DWORD ! 97: WINAPI ! 98: GetIpAddrTable( ! 99: OUT PMIB_IPADDRTABLE pIpAddrTable, ! 100: IN OUT PULONG pdwSize, ! 101: IN BOOL bOrder ! 102: ); ! 103: ! 104: ////////////////////////////////////////////////////////////////////////////// ! 105: // // ! 106: // Gets the current IP Address to Physical Address (ARP) mapping // ! 107: // // ! 108: ////////////////////////////////////////////////////////////////////////////// ! 109: ! 110: DWORD ! 111: WINAPI ! 112: GetIpNetTable( ! 113: OUT PMIB_IPNETTABLE pIpNetTable, ! 114: IN OUT PULONG pdwSize, ! 115: IN BOOL bOrder ! 116: ); ! 117: ! 118: ////////////////////////////////////////////////////////////////////////////// ! 119: // // ! 120: // Gets the IP Routing Table (RFX XXXX) // ! 121: // // ! 122: ////////////////////////////////////////////////////////////////////////////// ! 123: ! 124: DWORD ! 125: WINAPI ! 126: GetIpForwardTable( ! 127: OUT PMIB_IPFORWARDTABLE pIpForwardTable, ! 128: IN OUT PULONG pdwSize, ! 129: IN BOOL bOrder ! 130: ); ! 131: ! 132: ////////////////////////////////////////////////////////////////////////////// ! 133: // // ! 134: // Gets TCP Connection/UDP Listener Table // ! 135: // // ! 136: ////////////////////////////////////////////////////////////////////////////// ! 137: ! 138: DWORD ! 139: WINAPI ! 140: GetTcpTable( ! 141: OUT PMIB_TCPTABLE pTcpTable, ! 142: IN OUT PDWORD pdwSize, ! 143: IN BOOL bOrder ! 144: ); ! 145: ! 146: DWORD ! 147: WINAPI ! 148: GetUdpTable( ! 149: OUT PMIB_UDPTABLE pUdpTable, ! 150: IN OUT PDWORD pdwSize, ! 151: IN BOOL bOrder ! 152: ); ! 153: ! 154: ! 155: ////////////////////////////////////////////////////////////////////////////// ! 156: // // ! 157: // Gets IP/ICMP/TCP/UDP Statistics // ! 158: // // ! 159: ////////////////////////////////////////////////////////////////////////////// ! 160: ! 161: DWORD ! 162: WINAPI ! 163: GetIpStatistics( ! 164: OUT PMIB_IPSTATS pStats ! 165: ); ! 166: ! 167: DWORD ! 168: WINAPI ! 169: GetIpStatisticsEx( ! 170: OUT PMIB_IPSTATS pStats, ! 171: IN DWORD dwFamily ! 172: ); ! 173: ! 174: DWORD ! 175: WINAPI ! 176: GetIcmpStatistics( ! 177: OUT PMIB_ICMP pStats ! 178: ); ! 179: ! 180: DWORD ! 181: WINAPI ! 182: GetIcmpStatisticsEx( ! 183: OUT PMIB_ICMP_EX pStats, ! 184: IN DWORD dwFamily ! 185: ); ! 186: ! 187: DWORD ! 188: WINAPI ! 189: GetTcpStatistics( ! 190: OUT PMIB_TCPSTATS pStats ! 191: ); ! 192: ! 193: DWORD ! 194: WINAPI ! 195: GetTcpStatisticsEx( ! 196: OUT PMIB_TCPSTATS pStats, ! 197: IN DWORD dwFamily ! 198: ); ! 199: ! 200: DWORD ! 201: WINAPI ! 202: GetUdpStatistics( ! 203: OUT PMIB_UDPSTATS pStats ! 204: ); ! 205: ! 206: DWORD ! 207: WINAPI ! 208: GetUdpStatisticsEx( ! 209: OUT PMIB_UDPSTATS pStats, ! 210: IN DWORD dwFamily ! 211: ); ! 212: ! 213: ////////////////////////////////////////////////////////////////////////////// ! 214: // // ! 215: // Used to set the ifAdminStatus on an interface. The only fields of the // ! 216: // MIB_IFROW that are relevant are the dwIndex (index of the interface // ! 217: // whose status needs to be set) and the dwAdminStatus which can be either // ! 218: // MIB_IF_ADMIN_STATUS_UP or MIB_IF_ADMIN_STATUS_DOWN // ! 219: // // ! 220: ////////////////////////////////////////////////////////////////////////////// ! 221: ! 222: DWORD ! 223: WINAPI ! 224: SetIfEntry( ! 225: IN PMIB_IFROW pIfRow ! 226: ); ! 227: ! 228: ////////////////////////////////////////////////////////////////////////////// ! 229: // // ! 230: // Used to create, modify or delete a route. In all cases the // ! 231: // dwForwardIfIndex, dwForwardDest, dwForwardMask, dwForwardNextHop and // ! 232: // dwForwardPolicy MUST BE SPECIFIED. Currently dwForwardPolicy is unused // ! 233: // and MUST BE 0. // ! 234: // For a set, the complete MIB_IPFORWARDROW structure must be specified // ! 235: // // ! 236: ////////////////////////////////////////////////////////////////////////////// ! 237: ! 238: DWORD ! 239: WINAPI ! 240: CreateIpForwardEntry( ! 241: IN PMIB_IPFORWARDROW pRoute ! 242: ); ! 243: ! 244: DWORD ! 245: WINAPI ! 246: SetIpForwardEntry( ! 247: IN PMIB_IPFORWARDROW pRoute ! 248: ); ! 249: ! 250: DWORD ! 251: WINAPI ! 252: DeleteIpForwardEntry( ! 253: IN PMIB_IPFORWARDROW pRoute ! 254: ); ! 255: ! 256: ////////////////////////////////////////////////////////////////////////////// ! 257: // // ! 258: // Used to set the ipForwarding to ON or OFF (currently only ON->OFF is // ! 259: // allowed) and to set the defaultTTL. If only one of the fields needs to // ! 260: // be modified and the other needs to be the same as before the other field // ! 261: // needs to be set to MIB_USE_CURRENT_TTL or MIB_USE_CURRENT_FORWARDING as // ! 262: // the case may be // ! 263: // // ! 264: ////////////////////////////////////////////////////////////////////////////// ! 265: ! 266: ! 267: DWORD ! 268: WINAPI ! 269: SetIpStatistics( ! 270: IN PMIB_IPSTATS pIpStats ! 271: ); ! 272: ! 273: ////////////////////////////////////////////////////////////////////////////// ! 274: // // ! 275: // Used to set the defaultTTL. // ! 276: // // ! 277: ////////////////////////////////////////////////////////////////////////////// ! 278: ! 279: DWORD ! 280: WINAPI ! 281: SetIpTTL( ! 282: UINT nTTL ! 283: ); ! 284: ! 285: ////////////////////////////////////////////////////////////////////////////// ! 286: // // ! 287: // Used to create, modify or delete an ARP entry. In all cases the dwIndex // ! 288: // dwAddr field MUST BE SPECIFIED. // ! 289: // For a set, the complete MIB_IPNETROW structure must be specified // ! 290: // // ! 291: ////////////////////////////////////////////////////////////////////////////// ! 292: ! 293: DWORD ! 294: WINAPI ! 295: CreateIpNetEntry( ! 296: IN PMIB_IPNETROW pArpEntry ! 297: ); ! 298: ! 299: DWORD ! 300: WINAPI ! 301: SetIpNetEntry( ! 302: IN PMIB_IPNETROW pArpEntry ! 303: ); ! 304: ! 305: DWORD ! 306: WINAPI ! 307: DeleteIpNetEntry( ! 308: IN PMIB_IPNETROW pArpEntry ! 309: ); ! 310: ! 311: DWORD ! 312: WINAPI ! 313: FlushIpNetTable( ! 314: IN DWORD dwIfIndex ! 315: ); ! 316: ! 317: ! 318: ////////////////////////////////////////////////////////////////////////////// ! 319: // // ! 320: // Used to create or delete a Proxy ARP entry. The dwIndex is the index of // ! 321: // the interface on which to PARP for the dwAddress. If the interface is // ! 322: // of a type that doesnt support ARP, e.g. PPP, then the call will fail // ! 323: // // ! 324: ////////////////////////////////////////////////////////////////////////////// ! 325: ! 326: DWORD ! 327: WINAPI ! 328: CreateProxyArpEntry( ! 329: IN DWORD dwAddress, ! 330: IN DWORD dwMask, ! 331: IN DWORD dwIfIndex ! 332: ); ! 333: ! 334: DWORD ! 335: WINAPI ! 336: DeleteProxyArpEntry( ! 337: IN DWORD dwAddress, ! 338: IN DWORD dwMask, ! 339: IN DWORD dwIfIndex ! 340: ); ! 341: ! 342: ////////////////////////////////////////////////////////////////////////////// ! 343: // // ! 344: // Used to set the state of a TCP Connection. The only state that it can be // ! 345: // set to is MIB_TCP_STATE_DELETE_TCB. The complete MIB_TCPROW structure // ! 346: // MUST BE SPECIFIED // ! 347: // // ! 348: ////////////////////////////////////////////////////////////////////////////// ! 349: ! 350: DWORD ! 351: WINAPI ! 352: SetTcpEntry( ! 353: IN PMIB_TCPROW pTcpRow ! 354: ); ! 355: ! 356: ! 357: DWORD ! 358: WINAPI ! 359: GetInterfaceInfo( ! 360: IN PIP_INTERFACE_INFO pIfTable, ! 361: OUT PULONG dwOutBufLen ! 362: ); ! 363: ! 364: DWORD ! 365: WINAPI ! 366: GetUniDirectionalAdapterInfo(OUT PIP_UNIDIRECTIONAL_ADAPTER_ADDRESS pIPIfInfo, ! 367: OUT PULONG dwOutBufLen ! 368: ); ! 369: ! 370: #ifndef NhpAllocateAndGetInterfaceInfoFromStack_DEFINED ! 371: #define NhpAllocateAndGetInterfaceInfoFromStack_DEFINED ! 372: ! 373: DWORD ! 374: WINAPI ! 375: NhpAllocateAndGetInterfaceInfoFromStack( ! 376: OUT IP_INTERFACE_NAME_INFO **ppTable, ! 377: OUT PDWORD pdwCount, ! 378: IN BOOL bOrder, ! 379: IN HANDLE hHeap, ! 380: IN DWORD dwFlags ! 381: ); ! 382: ! 383: #endif ! 384: ! 385: ////////////////////////////////////////////////////////////////////////////// ! 386: // // ! 387: // Gets the "best" outgoing interface for the specified destination address // ! 388: // // ! 389: ////////////////////////////////////////////////////////////////////////////// ! 390: ! 391: DWORD ! 392: WINAPI ! 393: GetBestInterface( ! 394: IN IPAddr dwDestAddr, ! 395: OUT PDWORD pdwBestIfIndex ! 396: ); ! 397: ! 398: #pragma warning(push) ! 399: #pragma warning(disable:4115) ! 400: DWORD ! 401: WINAPI ! 402: GetBestInterfaceEx( ! 403: IN struct sockaddr *pDestAddr, ! 404: OUT PDWORD pdwBestIfIndex ! 405: ); ! 406: #pragma warning(pop) ! 407: ! 408: ////////////////////////////////////////////////////////////////////////////// ! 409: // // ! 410: // Gets the best (longest matching prefix) route for the given destination // ! 411: // If the source address is also specified (i.e. is not 0x00000000), and // ! 412: // there are multiple "best" routes to the given destination, the returned // ! 413: // route will be one that goes out over the interface which has an address // ! 414: // that matches the source address // ! 415: // // ! 416: ////////////////////////////////////////////////////////////////////////////// ! 417: ! 418: DWORD ! 419: WINAPI ! 420: GetBestRoute( ! 421: IN DWORD dwDestAddr, ! 422: IN DWORD dwSourceAddr, OPTIONAL ! 423: OUT PMIB_IPFORWARDROW pBestRoute ! 424: ); ! 425: ! 426: DWORD ! 427: WINAPI ! 428: NotifyAddrChange( ! 429: OUT PHANDLE Handle, ! 430: IN LPOVERLAPPED overlapped ! 431: ); ! 432: ! 433: ! 434: DWORD ! 435: WINAPI ! 436: NotifyRouteChange( ! 437: OUT PHANDLE Handle, ! 438: IN LPOVERLAPPED overlapped ! 439: ); ! 440: ! 441: BOOL ! 442: WINAPI ! 443: CancelIPChangeNotify( ! 444: IN LPOVERLAPPED notifyOverlapped ! 445: ); ! 446: ! 447: DWORD ! 448: WINAPI ! 449: GetAdapterIndex( ! 450: IN LPWSTR AdapterName, ! 451: OUT PULONG IfIndex ! 452: ); ! 453: ! 454: DWORD ! 455: WINAPI ! 456: AddIPAddress( ! 457: IPAddr Address, ! 458: IPMask IpMask, ! 459: DWORD IfIndex, ! 460: PULONG NTEContext, ! 461: PULONG NTEInstance ! 462: ); ! 463: ! 464: DWORD ! 465: WINAPI ! 466: DeleteIPAddress( ! 467: ULONG NTEContext ! 468: ); ! 469: ! 470: DWORD ! 471: WINAPI ! 472: GetNetworkParams( ! 473: PFIXED_INFO pFixedInfo, PULONG pOutBufLen ! 474: ); ! 475: ! 476: DWORD ! 477: WINAPI ! 478: GetAdaptersInfo( ! 479: PIP_ADAPTER_INFO pAdapterInfo, PULONG pOutBufLen ! 480: ); ! 481: ! 482: PIP_ADAPTER_ORDER_MAP ! 483: WINAPI ! 484: GetAdapterOrderMap( ! 485: VOID ! 486: ); ! 487: ! 488: #ifdef _WINSOCK2API_ ! 489: ! 490: // ! 491: // The following functions require Winsock2. ! 492: // ! 493: ! 494: DWORD ! 495: WINAPI ! 496: GetAdaptersAddresses( ! 497: IN ULONG Family, ! 498: IN DWORD Flags, ! 499: IN PVOID Reserved, ! 500: OUT PIP_ADAPTER_ADDRESSES pAdapterAddresses, ! 501: IN OUT PULONG pOutBufLen ! 502: ); ! 503: ! 504: #endif ! 505: ! 506: DWORD ! 507: WINAPI ! 508: GetPerAdapterInfo( ! 509: ULONG IfIndex, PIP_PER_ADAPTER_INFO pPerAdapterInfo, PULONG pOutBufLen ! 510: ); ! 511: ! 512: DWORD ! 513: WINAPI ! 514: IpReleaseAddress( ! 515: PIP_ADAPTER_INDEX_MAP AdapterInfo ! 516: ); ! 517: ! 518: ! 519: DWORD ! 520: WINAPI ! 521: IpRenewAddress( ! 522: PIP_ADAPTER_INDEX_MAP AdapterInfo ! 523: ); ! 524: ! 525: DWORD ! 526: WINAPI ! 527: SendARP( ! 528: IPAddr DestIP, ! 529: IPAddr SrcIP, ! 530: PULONG pMacAddr, ! 531: PULONG PhyAddrLen ! 532: ); ! 533: ! 534: BOOL ! 535: WINAPI ! 536: GetRTTAndHopCount( ! 537: IPAddr DestIpAddress, ! 538: PULONG HopCount, ! 539: ULONG MaxHops, ! 540: PULONG RTT ! 541: ); ! 542: ! 543: DWORD ! 544: WINAPI ! 545: GetFriendlyIfIndex( ! 546: DWORD IfIndex ! 547: ); ! 548: ! 549: DWORD ! 550: WINAPI ! 551: EnableRouter( ! 552: HANDLE* pHandle, ! 553: OVERLAPPED* pOverlapped ! 554: ); ! 555: ! 556: DWORD ! 557: WINAPI ! 558: UnenableRouter( ! 559: OVERLAPPED* pOverlapped, ! 560: LPDWORD lpdwEnableCount OPTIONAL ! 561: ); ! 562: DWORD ! 563: WINAPI ! 564: DisableMediaSense( ! 565: HANDLE *pHandle, ! 566: OVERLAPPED *pOverLapped ! 567: ); ! 568: ! 569: DWORD ! 570: WINAPI ! 571: RestoreMediaSense( ! 572: OVERLAPPED* pOverlapped, ! 573: LPDWORD lpdwEnableCount OPTIONAL ! 574: ); ! 575: ! 576: DWORD ! 577: WINAPI ! 578: GetIpErrorString( ! 579: IN IP_STATUS ErrorCode, ! 580: OUT PWCHAR Buffer, ! 581: IN OUT PDWORD Size ! 582: ); ! 583: ! 584: #ifdef __cplusplus ! 585: } ! 586: #endif ! 587: ! 588: #endif //__IPHLPAPI_H__
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.