IPHLPAPI(IP Helper API) functions
Headers
#include <winsock2.h>
#include <iphlpapi.h>
Library
Adapter Configuration
DWORD
GetAdapterIndex(
LPWSTR AdapterName,
PULONG IfIndex
);
DWORD WINAPI
GetAdaptersAddresses(
ULONG Family,
DWORD Flags,
PVOID Reserved,
PIP_ADAPTER_ADDRESSES pAdapterAddresses,
PULONG pOutBufLen
);
DWORD
GetAdaptersInfo(
PIP_ADAPTER_INFO pAdapterInfo,
PULONG pOutBufLen
);
DWORD
GetPerAdapterInfo(
ULONG IfIndex,
PIP_PER_ADAPTER_INFO pPerAdapterInfo,
PULONG pOutBufLen
);
DWORD
GetUniDirectionalAdapterInfo(
PIP_UNIDIRECTIONAL_ADAPTER_ADDRESS pIPIfInfo,
PULONG dwOutBufLen
);
ARP
DWORD
CreateIpNetEntry(
PMIB_IPNETROW pArpEntry
);
DWORD
CreateProxyArpEntry(
DWORD dwAddress,
DWORD dwMask,
DWORD dwIfIndex
);
DWORD
DeleteIpNetEntry(
PMIB_IPNETROW pArpEntry
);
DWORD
DeleteProxyArpEntry(
DWORD dwAddress,
DWORD dwMask,
DWORD dwIfIndex
);
DWORD
FlushIpNetTable(
DWORD dwIfIndex
);
DWORD
GetIpNetTable(
PMIB_IPNETTABLE pIpNetTable,
PULONG pdwSize,
BOOL bOrder
);
DWORD
SendARP(
IPAddr DestIP,
IPAddr SrcIP,
PULONG pMacAddr,
PULONG PhyAddrLen
);
DWORD
SetIpNetEntry(
PMIB_IPNETROW pArpEntry
);
Network Interface
DWORD
GetFriendlyIfIndex(
DWORD IfIndex
);
DWORD
GetIfEntry(
PMIB_IFROW pIfRow
);
DWORD
GetIfTable(
PMIB_IFTABLE pIfTable,
PULONG pdwSize,
BOOL bOrder
);
DWORD
GetInterfaceInfo(
PIP_INTERFACE_INFO pIfTable,
PULONG dwOutBufLen
);
DWORD
GetNumberOfInterfaces(
PDWORD pdwNumIf
);
DWORD
SetIfEntry(
PMIB_IFROW pIfRow
);
IP, ICMP
DWORD
GetIcmpStatistics(
PMIB_ICMP pStats
);
DWORD
GetIpStatistics(
PMIB_IPSTATS pStats
);
BOOL
IcmpCloseHandle(
HANDLE IcmpHandle
);
HANDLE
IcmpCreateFile(void);
DWORD
IcmpParseReplies(
LPVOID ReplyBuffer,
DWORD ReplySize
);
DWORD
IcmpSendEcho(
HANDLE IcmpHandle,
IPAddr DestinationAddress,
LPVOID RequestData,
WORD RequestSize,
PIP_OPTION_INFORMATION RequestOptions,
LPVOID ReplyBuffer,
DWORD ReplySize,
DWORD Timeout
);
DWORD
IcmpSendEcho2(
HANDLE IcmpHandle,
HANDLE Event,
FARPROC ApcRoutine,
PVOID ApcContext,
IPAddr DestinationAddress,
LPVOID RequestData,
WORD RequestSize,
PIP_OPTION_INFORMATION RequestOptions,
LPVOID ReplyBuffer,
DWORD ReplySize,
DWORD Timeout
);
DWORD
SetIpStatistics(
PMIB_IPSTATS pIpStats
);
DWORD
SetIpTTL(
UINT nTTL
);
IP address configuration
DWORD
AddIPAddress(
IPAddr Address,
IPMask IpMask,
DWORD IfIndex,
PULONG NTEContext,
PULONG NTEInstance
);
DWORD
DeleteIPAddress(
ULONG NTEContext
);
DWORD
GetIpAddrTable(
PMIB_IPADDRTABLE pIpAddrTable,
PULONG pdwSize,
BOOL bOrder
);
DWORD
IpReleaseAddress(
PIP_ADAPTER_INDEX_MAP AdapterInfo
);
DWORD
IpRenewAddress(
PIP_ADAPTER_INDEX_MAP AdapterInfo
);
Network configuration
DWORD
GetNetworkParams(
PFIXED_INFO pFixedInfo,
PULONG pOutBufLen
);
Notification
DWORD
NotifyAddrChange(
PHANDLE Handle,
LPOVERLAPPED overlapped
);
DWORD
NotifyRouteChange(
PHANDLE Handle,
LPOVERLAPPED overlapped
);
Routing
DWORD
CreateIpForwardEntry(
PMIB_IPFORWARDROW pRoute
);
DWORD
DeleteIpForwardEntry(
PMIB_IPFORWARDROW pRoute
);
DWORD WINAPI
EnableRouter(
HANDLE* pHandle,
OVERLAPPED* pOverlapped
);
DWORD
GetBestInterface(
IPAddr dwDestAddr,
PDWORD pdwBestIfIndex
);
DWORD
GetBestRoute(
DWORD dwDestAddr,
DWORD dwSourceAddr,
PMIB_IPFORWARDROW pBestRoute
);
DWORD
GetIpForwardTable(
PMIB_IPFORWARDTABLE pIpForwardTable,
PULONG pdwSize,
BOOL bOrder
);
BOOL
GetRTTAndHopCount(
IPAddr DestIpAddress,
PULONG HopCount,
ULONG MaxHops,
PULONG RTT
);
DWORD
SetIpForwardEntry(
PMIB_IPFORWARDROW pRoute
);
DWORD WINAPI
UnenableRouter(
OVERLAPPED* pOverlapped,
LPDWORD lpdwEnableCount
);
TCP, UDP
DWORD
GetExtendedTcpTable(
PVOID pTcpTable,
PDWORD pdwSize,
BOOL bOrder,
ULONG ulAf,
TCP_TABLE_CLASS TableClass,
ULONG Reserved
);
DWORD
GetExtendedUdpTable(
PVOID pUdpTable,
PDWORD pdwSize,
BOOL bOrder,
ULONG ulAf,
UDP_TABLE_CLASS TableClass,
ULONG Reserved
);
DWORD
GetOwnerModuleFromTcpEntry(
PMIB_TCPROW_OWNER_MODULE pTcpEntry,
TCPIP_OWNER_MODULE_INFO_CLASS Class,
PVOID Buffer,
PDWORD pdwSize
);
DWORD
GetOwnerModuleFromTcp6Entry(
PMIB_TCP6ROW_OWNER_MODULE pTcpEntry,
TCPIP_OWNER_MODULE_INFO_CLASS Class,
PVOID Buffer,
PDWORD pdwSize
);
DWORD
GetOwnerModuleFromUdpEntry(
PMIB_UDPROW_OWNER_MODULE pUdpEntry,
TCPIP_OWNER_MODULE_INFO_CLASS Class,
PVOID Buffer,
PDWORD pdwSize
);
DWORD
GetOwnerModuleFromUdp6Entry(
PMIB_UDP6ROW_OWNER_MODULE pUdpEntry,
TCPIP_OWNER_MODULE_INFO_CLASS Class,
PVOID Buffer,
PDWORD pdwSize
);
DWORD
GetTcpStatistics(
PMIB_TCPSTATS pStats
);
DWORD
GetTcpTable(
PMIB_TCPTABLE pTcpTable,
PDWORD pdwSize,
BOOL bOrder
);
DWORD
SetTcpEntry(
PMIB_TCPROW pTcpRow
);
DWORD
GetUdpStatistics(
PMIB_UDPSTATS pStats
);
DWORD
GetUdpTable(
PMIB_UDPTABLE pUdpTable,
PDWORD pdwSize,
BOOL bOrder
);