Home | History | Annotate | Download | only in include
      1 /**
      2  * This file has no copyright assigned and is placed in the Public Domain.
      3  * This file is part of the mingw-w64 runtime package.
      4  * No warranty is given; refer to the file DISCLAIMER.PD within this package.
      5  */
      6 #ifndef __IPHLPAPI_H__
      7 #define __IPHLPAPI_H__
      8 
      9 #ifdef __cplusplus
     10 extern "C" {
     11 #endif
     12 
     13 #include <iprtrmib.h>
     14 #include <ipexport.h>
     15 #include <iptypes.h>
     16 #include <netioapi.h>
     17 #include <tcpmib.h>
     18 #include <udpmib.h>
     19 #include <tcpestats.h>
     20 
     21   DWORD WINAPI GetNumberOfInterfaces(PDWORD pdwNumIf);
     22   DWORD WINAPI GetIfEntry(PMIB_IFROW pIfRow);
     23   DWORD WINAPI GetIfTable(PMIB_IFTABLE pIfTable,PULONG pdwSize,WINBOOL bOrder);
     24   DWORD WINAPI GetIpAddrTable(PMIB_IPADDRTABLE pIpAddrTable,PULONG pdwSize,WINBOOL bOrder);
     25   DWORD WINAPI GetIpNetTable(PMIB_IPNETTABLE pIpNetTable,PULONG pdwSize,WINBOOL bOrder);
     26   DWORD WINAPI GetIpForwardTable(PMIB_IPFORWARDTABLE pIpForwardTable,PULONG pdwSize,WINBOOL bOrder);
     27   DWORD WINAPI GetTcpTable(PMIB_TCPTABLE pTcpTable,PDWORD pdwSize,WINBOOL bOrder);
     28   DWORD WINAPI GetUdpTable(PMIB_UDPTABLE pUdpTable,PDWORD pdwSize,WINBOOL bOrder);
     29   DWORD WINAPI GetIpStatistics(PMIB_IPSTATS pStats);
     30   DWORD WINAPI GetIpStatisticsEx(PMIB_IPSTATS pStats,DWORD dwFamily);
     31   DWORD WINAPI GetIcmpStatistics(PMIB_ICMP pStats);
     32   DWORD WINAPI GetIcmpStatisticsEx(PMIB_ICMP_EX pStats,DWORD dwFamily);
     33   DWORD WINAPI GetTcpStatistics(PMIB_TCPSTATS pStats);
     34   DWORD WINAPI GetTcpStatisticsEx(PMIB_TCPSTATS pStats,DWORD dwFamily);
     35   DWORD WINAPI GetUdpStatistics(PMIB_UDPSTATS pStats);
     36   DWORD WINAPI GetUdpStatisticsEx(PMIB_UDPSTATS pStats,DWORD dwFamily);
     37   DWORD WINAPI SetIfEntry(PMIB_IFROW pIfRow);
     38   DWORD WINAPI CreateIpForwardEntry(PMIB_IPFORWARDROW pRoute);
     39   DWORD WINAPI SetIpForwardEntry(PMIB_IPFORWARDROW pRoute);
     40   DWORD WINAPI DeleteIpForwardEntry(PMIB_IPFORWARDROW pRoute);
     41   DWORD WINAPI SetIpStatistics(PMIB_IPSTATS pIpStats);
     42   DWORD WINAPI SetIpTTL(UINT nTTL);
     43   DWORD WINAPI CreateIpNetEntry(PMIB_IPNETROW pArpEntry);
     44   DWORD WINAPI SetIpNetEntry(PMIB_IPNETROW pArpEntry);
     45   DWORD WINAPI DeleteIpNetEntry(PMIB_IPNETROW pArpEntry);
     46   DWORD WINAPI FlushIpNetTable(DWORD dwIfIndex);
     47   DWORD WINAPI CreateProxyArpEntry(DWORD dwAddress,DWORD dwMask,DWORD dwIfIndex);
     48   DWORD WINAPI DeleteProxyArpEntry(DWORD dwAddress,DWORD dwMask,DWORD dwIfIndex);
     49   DWORD WINAPI SetTcpEntry(PMIB_TCPROW pTcpRow);
     50   DWORD WINAPI GetInterfaceInfo(PIP_INTERFACE_INFO pIfTable,PULONG dwOutBufLen);
     51   DWORD WINAPI GetUniDirectionalAdapterInfo(PIP_UNIDIRECTIONAL_ADAPTER_ADDRESS pIPIfInfo,PULONG dwOutBufLen);
     52 
     53 #ifndef NhpAllocateAndGetInterfaceInfoFromStack_DEFINED
     54 #define NhpAllocateAndGetInterfaceInfoFromStack_DEFINED
     55   DWORD WINAPI NhpAllocateAndGetInterfaceInfoFromStack(IP_INTERFACE_NAME_INFO **ppTable,PDWORD pdwCount,WINBOOL bOrder,HANDLE hHeap,DWORD dwFlags);
     56 #endif
     57 
     58   DWORD WINAPI GetBestInterface(IPAddr dwDestAddr,PDWORD pdwBestIfIndex);
     59   DWORD WINAPI GetBestInterfaceEx(struct sockaddr *pDestAddr,PDWORD pdwBestIfIndex);
     60   DWORD WINAPI GetBestRoute(DWORD dwDestAddr,DWORD dwSourceAddr,PMIB_IPFORWARDROW pBestRoute);
     61   DWORD WINAPI GetExtendedTcpTable (PVOID pTcpTable,PDWORD pdwSize,BOOL bOrder,ULONG ulAf,TCP_TABLE_CLASS TableClass,ULONG Reserved);
     62   DWORD WINAPI NotifyAddrChange(PHANDLE Handle,LPOVERLAPPED overlapped);
     63   DWORD WINAPI NotifyRouteChange(PHANDLE Handle,LPOVERLAPPED overlapped);
     64   WINBOOL WINAPI CancelIPChangeNotify(LPOVERLAPPED notifyOverlapped);
     65   DWORD WINAPI GetAdapterIndex(LPWSTR AdapterName,PULONG IfIndex);
     66   DWORD WINAPI AddIPAddress(IPAddr Address,IPMask IpMask,DWORD IfIndex,PULONG NTEContext,PULONG NTEInstance);
     67   DWORD WINAPI DeleteIPAddress(ULONG NTEContext);
     68   DWORD WINAPI GetNetworkParams(PFIXED_INFO pFixedInfo,PULONG pOutBufLen);
     69   DWORD WINAPI GetAdaptersInfo(PIP_ADAPTER_INFO pAdapterInfo,PULONG pOutBufLen);
     70   PIP_ADAPTER_ORDER_MAP WINAPI GetAdapterOrderMap(VOID);
     71 
     72 #ifdef _WINSOCK2API_
     73   DWORD WINAPI GetAdaptersAddresses(ULONG Family,DWORD Flags,PVOID Reserved,PIP_ADAPTER_ADDRESSES pAdapterAddresses,PULONG pOutBufLen);
     74 #endif
     75 
     76   DWORD WINAPI GetPerAdapterInfo(ULONG IfIndex,PIP_PER_ADAPTER_INFO pPerAdapterInfo,PULONG pOutBufLen);
     77   DWORD WINAPI IpReleaseAddress(PIP_ADAPTER_INDEX_MAP AdapterInfo);
     78   DWORD WINAPI IpRenewAddress(PIP_ADAPTER_INDEX_MAP AdapterInfo);
     79   DWORD WINAPI SendARP(IPAddr DestIP,IPAddr SrcIP,PULONG pMacAddr,PULONG PhyAddrLen);
     80   WINBOOL WINAPI GetRTTAndHopCount(IPAddr DestIpAddress,PULONG HopCount,ULONG MaxHops,PULONG RTT);
     81   DWORD WINAPI GetFriendlyIfIndex(DWORD IfIndex);
     82   DWORD WINAPI EnableRouter(HANDLE *pHandle,OVERLAPPED *pOverlapped);
     83   DWORD WINAPI UnenableRouter(OVERLAPPED *pOverlapped,LPDWORD lpdwEnableCount);
     84   DWORD WINAPI DisableMediaSense(HANDLE *pHandle,OVERLAPPED *pOverLapped);
     85   DWORD WINAPI RestoreMediaSense(OVERLAPPED *pOverlapped,LPDWORD lpdwEnableCount);
     86   DWORD WINAPI GetIpErrorString(IP_STATUS ErrorCode,PWCHAR Buffer,PDWORD Size);
     87 
     88 DWORD WINAPI GetExtendedUdpTable(
     89   PVOID pUdpTable,
     90   PDWORD pdwSize,
     91   WINBOOL bOrder,
     92   ULONG ulAf,
     93   UDP_TABLE_CLASS TableClass,
     94   ULONG Reserved
     95 );
     96 
     97 DWORD WINAPI GetOwnerModuleFromTcp6Entry(
     98   PMIB_TCP6ROW_OWNER_MODULE pTcpEntry,
     99   TCPIP_OWNER_MODULE_INFO_CLASS Class,
    100   PVOID Buffer,
    101   PDWORD pdwSize
    102 );
    103 
    104 DWORD WINAPI GetOwnerModuleFromTcpEntry(
    105   PMIB_TCPROW_OWNER_MODULE pTcpEntry,
    106   TCPIP_OWNER_MODULE_INFO_CLASS Class,
    107   PVOID Buffer,
    108   PDWORD pdwSize
    109 );
    110 
    111 DWORD WINAPI GetOwnerModuleFromUdp6Entry(
    112   PMIB_UDP6ROW_OWNER_MODULE pUdpEntry,
    113   TCPIP_OWNER_MODULE_INFO_CLASS Class,
    114   PVOID Buffer,
    115   PDWORD pdwSize
    116 );
    117 
    118 DWORD WINAPI GetOwnerModuleFromUdpEntry(
    119   PMIB_UDPROW_OWNER_MODULE pUdpEntry,
    120   TCPIP_OWNER_MODULE_INFO_CLASS Class,
    121   PVOID Buffer,
    122   PDWORD pdwSize
    123 );
    124 
    125 #if (_WIN32_WINNT == 0x0502) /* Only with Win2003 SP1 and SP2 */
    126   WINBOOL WINAPI CancelSecurityHealthChangeNotify(LPOVERLAPPED notifyOverlapped);
    127 #endif /*(_WIN32_WINNT == 0x0502)*/
    128 
    129 #if (_WIN32_WINNT >= 0x0600)
    130 #include <windns.h>
    131 
    132 typedef enum _NET_ADDRESS_FORMAT {
    133   NET_ADDRESS_FORMAT_UNSPECIFIED   = 0,
    134   NET_ADDRESS_DNS_NAME,
    135   NET_ADDRESS_IPV4,
    136   NET_ADDRESS_IPV6
    137 } NET_ADDRESS_FORMAT;
    138 
    139 typedef struct _NET_ADDRESS_INFO {
    140   NET_ADDRESS_FORMAT Format;
    141   __C89_NAMELESS union {
    142     struct {
    143       WCHAR Address[DNS_MAX_NAME_BUFFER_LENGTH];
    144       WCHAR Port[6];
    145     } NamedAddress;
    146     SOCKADDR_IN  Ipv4Address;
    147     SOCKADDR_IN6 Ipv6Address;
    148     SOCKADDR     IpAddress;
    149   };
    150 } NET_ADDRESS_INFO, *PNET_ADDRESS_INFO;
    151 
    152 ULONG WINAPI GetPerTcp6ConnectionEStats(
    153   PMIB_TCP6ROW Row,
    154   TCP_ESTATS_TYPE EstatsType,
    155   PUCHAR Rw,
    156   ULONG RwVersion,
    157   ULONG RwSize,
    158   PUCHAR Ros,
    159   ULONG RosVersion,
    160   ULONG RosSize,
    161   PUCHAR Rod,
    162   ULONG RodVersion,
    163   ULONG RodSize
    164 );
    165 
    166 ULONG WINAPI SetPerTcp6ConnectionEStats(
    167   PMIB_TCP6ROW Row,
    168   TCP_ESTATS_TYPE EstatsType,
    169   PUCHAR Rw,
    170   ULONG RwVersion,
    171   ULONG RwSize,
    172   ULONG Offset
    173 );
    174 
    175 ULONG WINAPI SetPerTcpConnectionEStats(
    176     PMIB_TCPROW Row,
    177     TCP_ESTATS_TYPE EstatsType,
    178     PUCHAR Rw,
    179     ULONG RwVersion,
    180     ULONG RwSize,
    181     ULONG Offset
    182 );
    183 
    184 ULONG WINAPI GetTcp6Table(
    185   PMIB_TCP6TABLE TcpTable,
    186   PULONG SizePointer,
    187   WINBOOL Order
    188 );
    189 
    190 ULONG WINAPI GetPerTcpConnectionEStats(
    191   PMIB_TCPROW Row,
    192   TCP_ESTATS_TYPE EstatsType,
    193   PUCHAR Rw,
    194   ULONG RwVersion,
    195   ULONG RwSize,
    196   PUCHAR Ros,
    197   ULONG RosVersion,
    198   ULONG RosSize,
    199   PUCHAR Rod,
    200   ULONG RodVersion,
    201   ULONG RodSize
    202 );
    203 
    204 ULONG WINAPI GetTcp6Table2(
    205   PMIB_TCP6TABLE2 TcpTable,
    206   PULONG SizePointer,
    207   WINBOOL Order
    208 );
    209 
    210 ULONG WINAPI GetTcpTable2(
    211   PMIB_TCPTABLE2 TcpTable,
    212   PULONG SizePointer,
    213   WINBOOL Order
    214 );
    215 
    216 ULONG WINAPI GetUdp6Table(
    217   PMIB_UDP6TABLE Udp6Table,
    218   PULONG SizePointer,
    219   WINBOOL Order
    220 );
    221 
    222 DWORD WINAPI NotifySecurityHealthChange(
    223   PHANDLE pHandle,
    224   LPOVERLAPPED pOverLapped,
    225   PULONG SecurityHealthFlags
    226 );
    227 
    228 ULONG WINAPI ResolveNeighbor(
    229   SOCKADDR *NetworkAddress,
    230   PVOID PhysicalAddress,
    231   PULONG PhysicalAddressLength
    232 );
    233 
    234 DWORD WINAPI SetIpStatisticsEx(
    235   PMIB_IPSTATS pIpStats,
    236   ULONG Family
    237 );
    238 
    239 #endif /*(_WIN32_WINNT >= 0x0600)*/
    240 
    241 #ifdef __cplusplus
    242 }
    243 #endif
    244 #endif
    245