Iphlpapi is now fully merged. Further changes should be synced with wine.

svn path=/trunk/; revision=8367
This commit is contained in:
Art Yerkes 2004-02-25 07:41:50 +00:00
parent 5e2693380d
commit 5c85402724
26 changed files with 1038 additions and 2159 deletions

View file

@ -0,0 +1,28 @@
EXTRADEFS =
TOPSRCDIR = @top_srcdir@
TOPOBJDIR = ../..
SRCDIR = @srcdir@
VPATH = @srcdir@
MODULE = iphlpapi.dll
IMPORTS = advapi32 kernel32
DELAYIMPORTS =
EXTRALIBS =
C_SRCS = \
icmp_reactos.c \
ifenum_reactos.c \
ipstats_reactos.c \
iphlpapi_main.c \
iphlpv6_reactos.c \
media.c \
registry.c \
resinfo_reactos.c \
route.c
RC_SRCS = iphlpapi.rc
RC_BINSRC = iphlpapi.rc
RC_BINARIES =
@MAKE_DLL_RULES@
### Dependencies:

View file

@ -0,0 +1,21 @@
# $Id: Makefile.ros-template,v 1.1 2004/02/25 07:41:50 arty Exp $
TARGET_NAME = iphlpapi
TARGET_OBJECTS = @C_SRCS@
TARGET_CFLAGS = @EXTRADEFS@ -D__REACTOS__
TARGET_SDKLIBS = @IMPORTS@ libwine.a advapi32.a kernel32.a ws2_32.a wine_uuid.a ntdll.a
TARGET_BASE = 0x77300000
TARGET_RC_SRCS = @RC_SRCS@
TARGET_RC_BINSRC = @RC_BINSRC@
TARGET_RC_BINARIES = @RC_BINARIES@
default: all
DEP_OBJECTS = $(TARGET_OBJECTS)
include $(TOOLS_PATH)/depend.mk

View file

@ -49,15 +49,6 @@ extern DWORD DebugTraceLevel;
#endif /* DBG */
#define assert(x) ASSERT(x)
#define assert_irql(x) ASSERT_IRQL(x)
#define UNIMPLEMENTED \
WSH_DbgPrint(MIN_TRACE, ("(%s:%d)(%s) is unimplemented, \
please try again later.\n", __FILE__, __LINE__, __FUNCTION__));
#define CHECKPOINT \
WSH_DbgPrint(MIN_TRACE, ("\n"));

View file

@ -1,6 +1,27 @@
#ifdef HAVE_CONFIG_H
/*
* iphlpapi dll implementation -- Auxiliary icmp functions
*
* These are stubs for functions that provide a simple ICMP probing API. They
* will be operating system specific when implemented.
*
* Copyright (C) 2004 Art Yerkes
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "config.h"
#endif
#include "iphlpapi_private.h"
#include <stdarg.h>
#include <stdlib.h>
@ -18,67 +39,55 @@
# include <resolv.h>
#endif
#ifdef __REACTOS__
# include <windows.h>
# include <windef.h>
# include <winbase.h>
# include <net/miniport.h>
# include <winsock2.h>
# include <nspapi.h>
# include <iptypes.h>
# include "iphlpapiextra.h"
#else
# include "windef.h"
# include "winbase.h"
# include "winreg.h"
#endif
#include "windef.h"
#include "winbase.h"
#include "winreg.h"
#include "resinfo.h"
#include "iphlpapi.h"
#include "ifenum.h"
#include "ipstats.h"
#include "iphlp_res.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(iphlpapi);
/*
* @unimplemented
*/
DWORD
STDCALL
WINAPI
IcmpParseReplies(
LPVOID ReplyBuffer,
DWORD ReplySize
)
{
UNIMPLEMENTED
FIXME(":stub\n");
return 0L;
}
/*
* @unimplemented
*/
HANDLE STDCALL IcmpCreateFile(
HANDLE WINAPI IcmpCreateFile(
VOID
)
{
UNIMPLEMENTED
FIXME(":stub\n");
return 0L;
}
/*
* @unimplemented
*/
BOOL STDCALL IcmpCloseHandle(
BOOL WINAPI IcmpCloseHandle(
HANDLE IcmpHandle
)
{
UNIMPLEMENTED
FIXME(":stub\n");
return 0L;
}
/*
* @unimplemented
*/
DWORD STDCALL IcmpSendEcho(
DWORD WINAPI IcmpSendEcho(
HANDLE IcmpHandle,
IPAddr DestinationAddress,
LPVOID RequestData,
@ -89,7 +98,7 @@ DWORD STDCALL IcmpSendEcho(
DWORD Timeout
)
{
UNIMPLEMENTED
FIXME(":stub\n");
return 0L;
}
@ -97,7 +106,7 @@ DWORD STDCALL IcmpSendEcho(
* @unimplemented
*/
DWORD
STDCALL
WINAPI
IcmpSendEcho2(
HANDLE IcmpHandle,
HANDLE Event,
@ -112,6 +121,6 @@ IcmpSendEcho2(
DWORD Timeout
)
{
UNIMPLEMENTED
FIXME(":stub\n");
return 0L;
}

View file

@ -0,0 +1,127 @@
/*
* iphlpapi dll implementation -- Auxiliary ICMP functions.
*
* These are stubs for functions that set routing information on the target
* operating system. They are grouped here because their implementation will
* vary widely by operating system.
*
* Copyright (C) 2004 Art Yerkes
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "config.h"
#include "iphlpapi_private.h"
#include <stdarg.h>
#include <stdlib.h>
#include <sys/types.h>
#ifdef HAVE_NETINET_IN_H
# include <netinet/in.h>
#endif
#ifdef HAVE_ARPA_INET_H
# include <arpa/inet.h>
#endif
#ifdef HAVE_ARPA_NAMESER_H
# include <arpa/nameser.h>
#endif
#ifdef HAVE_RESOLV_H
# include <resolv.h>
#endif
#include "windef.h"
#include "winbase.h"
#include "winreg.h"
#include "resinfo.h"
#include "iphlpapi.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(iphlpapi);
/*
* @unimplemented
*/
DWORD
STDCALL
IcmpParseReplies(
LPVOID ReplyBuffer,
DWORD ReplySize
)
{
UNIMPLEMENTED
return 0L;
}
/*
* @unimplemented
*/
HANDLE STDCALL IcmpCreateFile(
VOID
)
{
UNIMPLEMENTED
return 0L;
}
/*
* @unimplemented
*/
BOOL STDCALL IcmpCloseHandle(
HANDLE IcmpHandle
)
{
UNIMPLEMENTED
return 0L;
}
/*
* @unimplemented
*/
DWORD STDCALL IcmpSendEcho(
HANDLE IcmpHandle,
IPAddr DestinationAddress,
LPVOID RequestData,
WORD RequestSize,
PIP_OPTION_INFORMATION RequestOptions,
LPVOID ReplyBuffer,
DWORD ReplySize,
DWORD Timeout
)
{
UNIMPLEMENTED
return 0L;
}
/*
* @unimplemented
*/
DWORD
STDCALL
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
)
{
UNIMPLEMENTED
return 0L;
}

View file

@ -139,4 +139,7 @@ DWORD getInterfaceEntryByIndex(DWORD index, PMIB_IFROW entry);
*/
char *toIPAddressString(unsigned int addr, char string[16]);
/* Inserts a route into the route table. */
DWORD createIpForwardEntryOS(PMIB_IPFORWARDROW pRoute);
#endif /* ndef WINE_IFENUM_H_ */

View file

@ -37,7 +37,7 @@
* functions into iphlpv6.c (arty)
*/
#include "ipprivate.h"
#include "iphlpapi_private.h"
#include "ifenum.h"
/* Globals */
@ -45,6 +45,10 @@ const PWCHAR TcpFileName = L"\\Device\\Tcp";
/* Functions */
/* I'm a bit skittish about maintaining this info in memory, as I'd rather
* not add any mutex or critical section blockers to these functions. I've
* encountered far too many windows functions that contribute to deadlock
* by not announcing themselves. */
void interfaceMapInit(void)
{
/* For now, nothing */
@ -212,19 +216,18 @@ VOID tdiFreeThingSet( PVOID things ) {
}
NTSTATUS tdiGetMibForIfEntity
( HANDLE tcpFile, DWORD entityId, IFEntrySafelySized *entry ) {
( HANDLE tcpFile, TDIEntityID *ent, IFEntrySafelySized *entry ) {
TCP_REQUEST_QUERY_INFORMATION_EX req = TCP_REQUEST_QUERY_INFORMATION_INIT;
NTSTATUS status = STATUS_SUCCESS;
DWORD returnSize;
DPRINT("TdiGetMibForIfEntity(tcpFile %x,entityId %x)\n",
(int)tcpFile, (int)entityId);
(int)tcpFile, (int)ent->tei_instance);
req.ID.toi_class = INFO_CLASS_PROTOCOL;
req.ID.toi_type = INFO_TYPE_PROVIDER;
req.ID.toi_id = IF_MIB_STATS_ID;
req.ID.toi_entity.tei_entity = IF_ENTITY;
req.ID.toi_entity.tei_instance = entityId;
req.ID.toi_entity = *ent;
status = DeviceIoControl( tcpFile,
IOCTL_TCP_QUERY_INFORMATION_EX,
@ -245,23 +248,22 @@ NTSTATUS tdiGetMibForIfEntity
" if_type ........................ %x\n"
" if_mtu ......................... %d\n"
" if_speed ....................... %x\n"
" if_physaddrlen ................. %d\n"
" if_physaddr .................... %02x:%02x:%02x:%02x:%02x:%02x\n",
" if_descr ....................... %s\n"
"} status %08x\n",
(int)entry->offset.ent.if_index,
(int)entry->offset.ent.if_type,
(int)entry->offset.ent.if_mtu,
(int)entry->offset.ent.if_speed,
(int)entry->offset.ent.if_physaddrlen,
entry->offset.ent.if_physaddr[0] & 0xff,
entry->offset.ent.if_physaddr[1] & 0xff,
entry->offset.ent.if_physaddr[2] & 0xff,
entry->offset.ent.if_physaddr[3] & 0xff,
entry->offset.ent.if_physaddr[4] & 0xff,
entry->offset.ent.if_physaddr[5] & 0xff,
entry->offset.ent.if_descr,
(int)status);
" if_physaddrlen ................. %d\n",
entry->ent.if_index,
entry->ent.if_type,
entry->ent.if_mtu,
entry->ent.if_speed,
entry->ent.if_physaddrlen);
DPRINT(" if_physaddr .................... %02x:%02x:%02x:%02x:%02x:%02x\n",
" if_descr ....................... %s\n",
entry->ent.if_physaddr[0] & 0xff,
entry->ent.if_physaddr[1] & 0xff,
entry->ent.if_physaddr[2] & 0xff,
entry->ent.if_physaddr[3] & 0xff,
entry->ent.if_physaddr[4] & 0xff,
entry->ent.if_physaddr[5] & 0xff,
entry->ent.if_descr);
DPRINT("} status %08x\n",status);
return status;
}
@ -301,11 +303,11 @@ static BOOL isLoopback( HANDLE tcpFile, TDIEntityID *loop_maybe ) {
IFEntrySafelySized entryInfo;
tdiGetMibForIfEntity( tcpFile,
loop_maybe->tei_instance,
loop_maybe,
&entryInfo );
return !entryInfo.offset.ent.if_type ||
entryInfo.offset.ent.if_type == IFENT_SOFTWARE_LOOPBACK;
return !entryInfo.ent.if_type ||
entryInfo.ent.if_type == IFENT_SOFTWARE_LOOPBACK;
}
NTSTATUS tdiGetEntityType( HANDLE tcpFile, TDIEntityID *ent, PULONG type ) {
@ -336,6 +338,63 @@ NTSTATUS tdiGetEntityType( HANDLE tcpFile, TDIEntityID *ent, PULONG type ) {
return status;
}
static NTSTATUS getInterfaceInfoSet( HANDLE tcpFile,
IFInfo **infoSet,
PDWORD numInterfaces ) {
DWORD numEntities;
TDIEntityID *entIDSet = 0;
NTSTATUS status = tdiGetEntityIDSet( tcpFile, &entIDSet, &numEntities );
IFInfo *infoSetInt = 0;
BOOL interfaceInfoComplete;
int curInterf = 0, i;
if( NT_SUCCESS(status) )
infoSetInt = HeapAlloc( GetProcessHeap(), 0,
sizeof(IFInfo) * numEntities );
if( infoSetInt ) {
for( i = 0; i < numEntities; i++ ) {
if( isInterface( &entIDSet[i] ) ) {
status = tdiGetMibForIfEntity
( tcpFile,
&entIDSet[i],
&infoSetInt[curInterf].if_info );
if( NT_SUCCESS(status) ) {
DWORD numAddrs;
IPAddrEntry *addrs;
TDIEntityID ip_ent;
int j,k;
interfaceInfoComplete = FALSE;
for( j = 0; NT_SUCCESS(status); j++ ) {
status = getNthIpEntity( tcpFile, j, &ip_ent );
if( NT_SUCCESS(status) )
status = tdiGetIpAddrsForIpEntity
( tcpFile, &ip_ent, &addrs, &numAddrs );
for( k = 0; k < numAddrs && NT_SUCCESS(status); k++ ) {
if( addrs[k].iae_index ==
infoSetInt[curInterf].if_info.ent.if_index ) {
memcpy( &infoSetInt[curInterf].ip_addr,
&addrs[k],
sizeof( addrs[k] ) );
interfaceInfoComplete = TRUE;
break;
}
}
if( interfaceInfoComplete ) break;
}
}
if( NT_SUCCESS(status) ) curInterf++;
}
}
}
*infoSet = infoSetInt;
*numInterfaces = curInterf;
return STATUS_SUCCESS;
}
static DWORD getNumInterfacesInt(BOOL onlyLoopback)
{
DWORD numEntities, numInterfaces = 0;
@ -413,48 +472,70 @@ DWORD getNthInterfaceEntity( HANDLE tcpFile, DWORD index, TDIEntityID *ent ) {
return STATUS_UNSUCCESSFUL;
}
}
NTSTATUS getInterfaceInfoByIndex( HANDLE tcpFile, DWORD index, IFInfo *info ) {
IFInfo *ifInfo;
DWORD numInterfaces;
NTSTATUS status = getInterfaceInfoSet( tcpFile, &ifInfo, &numInterfaces );
int i;
if( NT_SUCCESS(status) )
for( i = 0; i < numInterfaces; i++ ) {
if( ifInfo[i].if_info.ent.if_index == index ) {
memcpy( info, &ifInfo[i], sizeof(*info) );
break;
}
}
if( NT_SUCCESS(status) )
return i < numInterfaces ? STATUS_SUCCESS : STATUS_UNSUCCESSFUL;
else
return status;
}
NTSTATUS getInterfaceInfoByName( HANDLE tcpFile, char *name, IFInfo *info ) {
IFInfo *ifInfo;
DWORD numInterfaces;
int i;
NTSTATUS status = getInterfaceInfoSet( tcpFile, &ifInfo, &numInterfaces );
if( NT_SUCCESS(status) )
for( i = 0; i < numInterfaces; i++ ) {
if( !strcmp(ifInfo[i].if_info.ent.if_descr, name) ) {
memcpy( info, &ifInfo[i], sizeof(*info) );
break;
}
}
if( NT_SUCCESS(status) )
return i < numInterfaces ? STATUS_SUCCESS : STATUS_UNSUCCESSFUL;
else
return status;
}
/* Note that the result of this operation must be freed later */
const char *getInterfaceNameByIndex(DWORD index)
{
TDIEntityID ent;
IFEntrySafelySized entityInfo;
HANDLE tcpFile = INVALID_HANDLE_VALUE;
NTSTATUS status = STATUS_SUCCESS;
PCHAR interfaceName = 0;
char simple_name_buf[100];
char *adapter_name;
IFInfo ifInfo;
HANDLE tcpFile;
char *interfaceName = 0, *adapter_name = 0;
NTSTATUS status = openTcpFile( &tcpFile );
status = openTcpFile( &tcpFile );
if( !NT_SUCCESS(status) ) {
DPRINT("failed %08x\n", status );
return 0;
}
status = getNthInterfaceEntity( tcpFile, index, &ent );
if( !NT_SUCCESS(status) ) {
DPRINT("failed %08x\n", status );
return 0;
}
status = tdiGetMibForIfEntity( tcpFile,
ent.tei_instance,
&entityInfo );
if( NT_SUCCESS(status) ) {
adapter_name = entityInfo.offset.ent.if_descr;
} else {
sprintf( simple_name_buf, "eth%x",
(int)ent.tei_instance );
adapter_name = simple_name_buf;
status = getInterfaceInfoByIndex( tcpFile, index, &ifInfo );
if( NT_SUCCESS(status) ) {
adapter_name = ifInfo.if_info.ent.if_descr;
interfaceName = HeapAlloc( GetProcessHeap(), 0,
strlen(adapter_name) + 1 );
strcpy( interfaceName, adapter_name );
closeTcpFile( tcpFile );
}
}
interfaceName = HeapAlloc( GetProcessHeap(), 0,
strlen(adapter_name) + 1 );
strcpy( interfaceName, adapter_name );
closeTcpFile( tcpFile );
return interfaceName;
}
@ -464,63 +545,58 @@ void consumeInterfaceName(const char *name) {
DWORD getInterfaceIndexByName(const char *name, PDWORD index)
{
DWORD ret = STATUS_SUCCESS;
int numInterfaces = getNumInterfaces();
const char *iname = 0;
int i;
IFInfo ifInfo;
HANDLE tcpFile;
NTSTATUS status = openTcpFile( &tcpFile );
ret = openTcpFile( &tcpFile );
if( !NT_SUCCESS(ret) ) {
DPRINT("Failure: %08x\n", ret);
return ret;
}
for( i = 0; i < numInterfaces; i++ ) {
iname = getInterfaceNameByIndex( i );
if( !strcmp(iname, name) ) {
*index = i;
if( NT_SUCCESS(status) ) {
status = getInterfaceInfoByName( tcpFile, (char *)name, &ifInfo );
if( NT_SUCCESS(status) ) {
*index = ifInfo.if_info.ent.if_index;
closeTcpFile( tcpFile );
}
HeapFree( GetProcessHeap(), 0, (char *)iname );
}
closeTcpFile( tcpFile );
return ret;
return status;
}
InterfaceIndexTable *getInterfaceIndexTableInt( BOOL nonLoopbackOnly ) {
HANDLE tcpFile;
DWORD numInterfaces, curInterface = 0;
int i;
InterfaceIndexTable *ret;
TDIEntityID *entitySet;
DWORD numEntities;
NTSTATUS status;
IFInfo *ifInfo;
InterfaceIndexTable *ret = 0;
HANDLE tcpFile;
NTSTATUS status = openTcpFile( &tcpFile );
numInterfaces = getNumInterfaces();
TRACE("getInterfaceIndexTable: numInterfaces: %d\n", numInterfaces);
ret = (InterfaceIndexTable *)calloc(1,
sizeof(InterfaceIndexTable) + (numInterfaces - 1) * sizeof(DWORD));
if (ret) {
ret->numAllocated = numInterfaces;
}
status = openTcpFile( &tcpFile );
tdiGetEntityIDSet( tcpFile, &entitySet, &numEntities );
for( i = 0; i < numEntities; i++ ) {
if( isInterface( &entitySet[i] ) &&
(!nonLoopbackOnly || !isLoopback( tcpFile, &entitySet[i] )) ) {
ret->indexes[curInterface++] = entitySet[i].tei_instance;
if( NT_SUCCESS(status) ) {
status = getInterfaceInfoSet( tcpFile, &ifInfo, &numInterfaces );
if( NT_SUCCESS(status) ) {
ret = (InterfaceIndexTable *)
calloc(1,
sizeof(InterfaceIndexTable) +
(numInterfaces - 1) * sizeof(DWORD));
if (ret) {
ret->numAllocated = numInterfaces;
for( i = 0; i < numInterfaces; i++ ) {
if( !nonLoopbackOnly ||
!isLoopback( tcpFile, &ifInfo[i].entity_id ) ) {
ret->indexes[curInterface++] =
ifInfo[i].if_info.ent.if_index;
}
}
ret->numIndexes = curInterface;
}
tdiFreeThingSet( ifInfo );
}
closeTcpFile( tcpFile );
}
tdiFreeThingSet( entitySet );
closeTcpFile( tcpFile );
ret->numIndexes = curInterface;
return ret;
}
@ -537,175 +613,167 @@ DWORD getInterfaceIPAddrByName(const char *name)
return INADDR_ANY;
}
DWORD getInterfaceIPAddrByIndex(DWORD index)
{
return INADDR_ANY;
NTSTATUS getIPAddrEntryForIf(HANDLE tcpFile,
char *name,
DWORD index,
IFInfo *ifInfo) {
NTSTATUS status =
name ?
getInterfaceInfoByName( tcpFile, name, ifInfo ) :
getInterfaceInfoByIndex( tcpFile, index, ifInfo );
return status;
}
DWORD getInterfaceBCastAddrByName(const char *name)
{
return INADDR_ANY;
DWORD getAddrByIndexOrName( char *name, DWORD index, IPHLPAddrType addrType ) {
IFInfo ifInfo;
HANDLE tcpFile = INVALID_HANDLE_VALUE;
NTSTATUS status = STATUS_SUCCESS;
DWORD addrOut = INADDR_ANY;
status = openTcpFile( &tcpFile );
if( NT_SUCCESS(status) ) {
status = getIPAddrEntryForIf( tcpFile, name, index, &ifInfo );
if( NT_SUCCESS(status) ) {
switch( addrType ) {
case IPAAddr: addrOut = ifInfo.ip_addr.iae_addr; break;
case IPABcast: addrOut = ifInfo.ip_addr.iae_bcastaddr; break;
case IPAMask: addrOut = ifInfo.ip_addr.iae_mask; break;
case IFMtu: addrOut = ifInfo.if_info.ent.if_mtu; break;
case IFStatus: addrOut = ifInfo.if_info.ent.if_operstatus; break;
}
}
closeTcpFile( &tcpFile );
}
return addrOut;
}
DWORD getInterfaceIPAddrByIndex(DWORD index) {
return getAddrByIndexOrName( 0, index, IPAAddr );
}
DWORD getInterfaceBCastAddrByIndex(DWORD index)
{
return INADDR_ANY;
DWORD getInterfaceBCastAddrByName(const char *name) {
return getAddrByIndexOrName( (char *)name, 0, IPABcast );
}
DWORD getInterfaceMaskByName(const char *name)
{
DWORD ret = INADDR_NONE;
return ret;
DWORD getInterfaceBCastAddrByIndex(DWORD index) {
return getAddrByIndexOrName( 0, index, IPABcast );
}
DWORD getInterfaceMaskByIndex(DWORD index)
{
DWORD ret = INADDR_NONE;
return ret;
DWORD getInterfaceMaskByName(const char *name) {
return getAddrByIndexOrName( (char *)name, 0, IPAMask );
}
DWORD getInterfaceMaskByIndex(DWORD index) {
return getAddrByIndexOrName( 0, index, IPAMask );
}
void getInterfacePhysicalFromInfo( IFInfo *info,
PDWORD len, PBYTE addr, PDWORD type ) {
*len = info->if_info.ent.if_physaddrlen;
memcpy( addr, info->if_info.ent.if_physaddr, *len );
*type = info->if_info.ent.if_type;
}
DWORD getInterfacePhysicalByName(const char *name, PDWORD len, PBYTE addr,
PDWORD type)
PDWORD type)
{
DWORD ret;
DWORD addrLen;
HANDLE tcpFile;
IFInfo info;
NTSTATUS status = openTcpFile( &tcpFile );
if (!name || !len || !addr || !type)
return ERROR_INVALID_PARAMETER;
if( NT_SUCCESS(status) ) {
status = getInterfaceInfoByName( tcpFile, (char *)name, &info );
if( NT_SUCCESS(status) )
getInterfacePhysicalFromInfo( &info, len, addr, type );
closeTcpFile( tcpFile );
}
if (addrLen > *len) {
ret = ERROR_INSUFFICIENT_BUFFER;
*len = addrLen;
}
else {
/* zero out remaining bytes for broken implementations */
memset(addr + addrLen, 0, *len - addrLen);
*len = addrLen;
ret = NO_ERROR;
}
ret = ERROR_NO_MORE_FILES;
return ret;
return status;
}
DWORD getInterfacePhysicalByIndex(DWORD index, PDWORD len, PBYTE addr,
PDWORD type)
{
const char *name = getInterfaceNameByIndex(index);
HANDLE tcpFile;
IFInfo info;
NTSTATUS status = openTcpFile( &tcpFile );
if (name)
return getInterfacePhysicalByName(name, len, addr, type);
else
return ERROR_INVALID_DATA;
if( NT_SUCCESS(status) ) {
status = getInterfaceInfoByIndex( tcpFile, index, &info );
if( NT_SUCCESS(status) )
getInterfacePhysicalFromInfo( &info, len, addr, type );
closeTcpFile( tcpFile );
}
return status;
}
DWORD getInterfaceMtuByName(const char *name, PDWORD mtu)
{
*mtu = 0;
return ERROR_SUCCESS;
DWORD getInterfaceMtuByName(const char *name, PDWORD mtu) {
*mtu = getAddrByIndexOrName( (char *)name, 0, IFMtu );
return STATUS_SUCCESS;
}
DWORD getInterfaceMtuByIndex(DWORD index, PDWORD mtu)
{
const char *name = getInterfaceNameByIndex(index);
if (name)
return getInterfaceMtuByName(name, mtu);
else
return ERROR_INVALID_DATA;
DWORD getInterfaceMtuByIndex(DWORD index, PDWORD mtu) {
*mtu = getAddrByIndexOrName( 0, index, IFMtu );
return STATUS_SUCCESS;
}
DWORD getInterfaceStatusByName(const char *name, PDWORD status)
{
DWORD ret;
if (!name)
return ERROR_INVALID_PARAMETER;
if (!status)
return ERROR_INVALID_PARAMETER;
ret = ERROR_NO_MORE_FILES;
return ret;
DWORD getInterfaceStatusByName(const char *name, PDWORD status) {
*status = getAddrByIndexOrName( (char *)name, 0, IFStatus );
return STATUS_SUCCESS;
}
DWORD getInterfaceStatusByIndex(DWORD index, PDWORD status)
{
const char *name = getInterfaceNameByIndex(index);
if (name)
return getInterfaceStatusByName(name, status);
else
return ERROR_INVALID_DATA;
*status = getAddrByIndexOrName( 0, index, IFStatus );
return STATUS_SUCCESS;
}
DWORD getInterfaceEntryByName(const char *name, PMIB_IFROW entry)
{
BYTE addr[MAX_INTERFACE_PHYSADDR];
DWORD ret, len = sizeof(addr), type;
HANDLE tcpFile;
IFInfo info;
NTSTATUS status = openTcpFile( &tcpFile );
if (!name)
return ERROR_INVALID_PARAMETER;
if (!entry)
return ERROR_INVALID_PARAMETER;
DPRINT("Called.\n");
if (getInterfacePhysicalByName(name, &len, addr, &type) == NO_ERROR) {
WCHAR *assigner;
const char *walker;
if( NT_SUCCESS(status) ) {
status = getInterfaceInfoByName( tcpFile, (char *)name, &info );
if( NT_SUCCESS(status) ) {
memcpy( &entry->wszName[MAX_INTERFACE_NAME_LEN],
&info.if_info,
sizeof(info.if_info) );
}
closeTcpFile( tcpFile );
}
memset(entry, 0, sizeof(MIB_IFROW));
for (assigner = entry->wszName, walker = name; *walker;
walker++, assigner++)
*assigner = *walker;
*assigner = 0;
getInterfaceIndexByName(name, &entry->dwIndex);
entry->dwPhysAddrLen = len;
memcpy(entry->bPhysAddr, addr, len);
memset(entry->bPhysAddr + len, 0, sizeof(entry->bPhysAddr) - len);
entry->dwType = type;
/* FIXME: how to calculate real speed? */
getInterfaceMtuByName(name, &entry->dwMtu);
/* lie, there's no "administratively down" here */
entry->dwAdminStatus = MIB_IF_ADMIN_STATUS_UP;
getInterfaceStatusByName(name, &entry->dwOperStatus);
/* punt on dwLastChange? */
entry->dwDescrLen = min(strlen(name), MAX_INTERFACE_DESCRIPTION - 1);
memcpy(entry->bDescr, name, entry->dwDescrLen);
entry->bDescr[entry->dwDescrLen] = '\0';
entry->dwDescrLen++;
ret = NO_ERROR;
}
else
ret = ERROR_INVALID_DATA;
return ret;
return status;
}
DWORD getInterfaceEntryByIndex(DWORD index, PMIB_IFROW entry)
{
HANDLE tcpFile;
IFInfo info;
NTSTATUS status = openTcpFile( &tcpFile );
TDIEntityID entity;
DPRINT("Called.\n");
if( !NT_SUCCESS(status) ) {
DPRINT("Failed: %08x\n", status);
return status;
}
status = getNthInterfaceEntity( tcpFile, index, &entity );
if( !NT_SUCCESS(status) ) {
DPRINT("Failed: %08x\n", status);
if( NT_SUCCESS(status) ) {
status = getInterfaceInfoByIndex( tcpFile, index, &info );
if( NT_SUCCESS(status) ) {
memcpy( &entry->wszName[MAX_INTERFACE_NAME_LEN],
&info.if_info,
sizeof(info.if_info) );
}
closeTcpFile( tcpFile );
return status;
}
status = tdiGetMibForIfEntity( tcpFile,
entity.tei_instance,
(IFEntrySafelySized *)
&entry->wszName[MAX_INTERFACE_NAME_LEN] );
closeTcpFile( tcpFile );
return status;
}
@ -721,3 +789,48 @@ char *toIPAddressString(unsigned int addr, char string[16])
}
return string;
}
DWORD createIpForwardEntryOS( PMIB_IPFORWARDROW pRoute ) {
HANDLE tcpFile = INVALID_HANDLE_VALUE;
NTSTATUS status = openTcpFile( &tcpFile );
TCP_REQUEST_SET_INFORMATION_EX_SAFELY_SIZED req =
TCP_REQUEST_SET_INFORMATION_INIT;
IPRouteEntry *rte;
TDIEntityID id;
DWORD returnSize = 0;
DPRINT("Called.\n");
if( NT_SUCCESS(status) )
status = getNthIpEntity( tcpFile, 0, &id );
if( NT_SUCCESS(status) ) {
req.Req.ID.toi_class = INFO_CLASS_PROTOCOL;
req.Req.ID.toi_type = INFO_TYPE_PROVIDER;
req.Req.ID.toi_id = IP_MIB_ROUTETABLE_ENTRY_ID;
req.Req.ID.toi_entity = id;
req.Req.BufferSize = sizeof(*rte);
rte =
(IPRouteEntry *)&req.Req.Buffer[0];
rte->ire_dest = pRoute->dwForwardDest;
rte->ire_index = pRoute->dwForwardIfIndex;
rte->ire_metric = pRoute->dwForwardMetric1;
rte->ire_gw = pRoute->dwForwardNextHopAS;
rte->ire_mask = pRoute->dwForwardMask;
status = DeviceIoControl( tcpFile,
IOCTL_TCP_SET_INFORMATION_EX,
&req,
sizeof(req),
NULL,
0,
&returnSize,
NULL );
}
if( tcpFile != INVALID_HANDLE_VALUE )
closeTcpFile( tcpFile );
return status;
}

View file

@ -1,12 +0,0 @@
#ifndef _IPHLP_RES_H
#define _IPHLP_RES_H
typedef struct _IPHLP_RES_INFO {
DWORD riCount;
LPSOCKADDR riAddressList;
} IPHLP_RES_INFO, *PIPHLP_RES_INFO;
PIPHLP_RES_INFO getResInfo();
VOID disposeResInfo( PIPHLP_RES_INFO InfoPtr );
#endif/*_IPHLP_RES_H*/

File diff suppressed because it is too large Load diff

View file

@ -1,158 +0,0 @@
; IPHLPAPI.DLL - ReactOS Sockets 2 IP Helper API DLL
LIBRARY iphlpapi.dll
EXPORTS
AddIPAddress@20
SetIpNetEntry@4
CreateIpForwardEntry@4
GetAdaptersInfo@8
GetNetworkParams@8
GetNumberOfInterfaces@4
GetIfEntry@4
GetIfTable@12
GetInterfaceInfo@8
GetTcpStatistics@4
GetTcpTable@12
GetUdpStatistics@4
GetUdpTable@12
FlushIpNetTable@4
;IpHlpDllEntry
;AllocateAndGetArpEntTableFromStack=AllocateAndGetArpEntTableFromStack
AllocateAndGetIfTableFromStack=AllocateAndGetIfTableFromStack@16
AllocateAndGetIpAddrTableFromStack=AllocateAndGetIpAddrTableFromStack@16
AllocateAndGetIpForwardTableFromStack=AllocateAndGetIpForwardTableFromStack@16
AllocateAndGetIpNetTableFromStack=AllocateAndGetIpNetTableFromStack@16
;AllocateAndGetTcpExTableFromStack
AllocateAndGetTcpTableFromStack=AllocateAndGetTcpTableFromStack@16
;AllocateAndGetUdpExTableFromStack
AllocateAndGetUdpTableFromStack=AllocateAndGetUdpTableFromStack@16
CreateIpNetEntry@4
CreateProxyArpEntry@12
DeleteIPAddress@4
DeleteIpForwardEntry@4
DeleteIpNetEntry@4
DeleteProxyArpEntry@12
DisableMediaSense@8
EnableRouter@8
;FlushIpNetTableFromStack
GetAdapterIndex@8
GetAdapterOrderMap@0
GetAdaptersAddresses@20
GetBestInterface@8
GetBestInterfaceEx@8
;GetBestInterfaceFromStack
GetBestRoute@12
;GetBestRouteFromStack
GetFriendlyIfIndex@4
GetIcmpStatistics@4
GetIcmpStatisticsEx@8
;GetIcmpStatsFromStack
;GetIcmpStatsFromStackEx
;GetIfEntryFromStack
;GetIfTableFromStack
;GetIgmpList
GetIpAddrTable@12
;GetIpAddrTableFromStack
GetIpErrorString@12
GetIpForwardTable@12
;GetIpForwardTableFromStack
GetIpNetTable@12
;GetIpNetTableFromStack
GetIpStatistics@4
GetIpStatisticsEx@8
;GetIpStatsFromStack
;GetIpStatsFromStackEx
GetPerAdapterInfo@12
GetRTTAndHopCount@16
GetTcpStatisticsEx@8
;GetTcpStatsFromStack
;GetTcpStatsFromStackEx
;GetTcpTableFromStack
GetUdpStatisticsEx@8
;GetUdpStatsFromStack
;GetUdpStatsFromStackEx
;GetUdpTableFromStack
GetUniDirectionalAdapterInfo@8
Icmp6CreateFile@0
Icmp6ParseReplies@8
Icmp6SendEcho2@48
IcmpCloseHandle@4
IcmpCreateFile@0
IcmpParseReplies@8
IcmpSendEcho@32
IcmpSendEcho2@44
;InternalCreateIpForwardEntry
;InternalCreateIpNetEntry
;InternalDeleteIpForwardEntry
;InternalDeleteIpNetEntry
;InternalGetIfTable
;InternalGetIpAddrTable
;InternalGetIpForwardTable
;InternalGetIpNetTable
;InternalGetTcpTable
;InternalGetUdpTable
;InternalSetIfEntry
;InternalSetIpForwardEntry
;InternalSetIpNetEntry
;InternalSetIpStats
;InternalSetTcpEntry
IpReleaseAddress@4
IpRenewAddress@4
;IsLocalAddress
;NTPTimeToNTFileTime
;NTTimeToNTPTime
;NhGetGuidFromInterfaceName
;NhGetInterfaceNameFromDeviceGuid
;NhGetInterfaceNameFromGuid
NhpAllocateAndGetInterfaceInfoFromStack@20
;NhpGetInterfaceIndexFromStack
NotifyAddrChange@8
NotifyRouteChange@8
;NotifyRouteChangeEx
RestoreMediaSense@8
;RtlIpv4AddressToStringExA
;RtlIpv4AddressToStringExW
;RtlIpv4StringToAddressExA
;RtlIpv4StringToAddressExW
;RtlIpv6AddressToStringExA
;RtlIpv6AddressToStringExW
;RtlIpv6StringToAddressExA
;RtlIpv6StringToAddressExW
SendARP@16
;SetAdapterIpAddress
;SetBlockRoutes
SetIfEntry@4
;SetIfEntryToStack
SetIpForwardEntry@4
;SetIpForwardEntryToStack
;SetIpMultihopRouteEntryToStack
;SetIpNetEntryToStack
;SetIpRouteEntryToStack
SetIpStatistics@4
;SetIpStatsToStack
SetIpTTL@4
;SetProxyArpEntryToStack
;SetRouteWithRef
SetTcpEntry@4
;SetTcpEntryToStack
UnenableRouter@8
;@_PfAddFiltersToInterface@24
;@_PfAddGlobalFilterToInterface@8
;@_PfBindInterfaceToIPAddress@12
;@_PfBindInterfaceToIndex@16
;@_PfCreateInterface@24
;@_PfDeleteInterface@4
;@_PfDeleteLog@0
;@_PfGetInterfaceStatistics@16
;@_PfMakeLog@4
;@_PfRebindFilters@8
;@_PfRemoveFilterHandles@12
;@_PfRemoveFiltersFromInterface@20
;@_PfRemoveGlobalFilterFromInterface@8
;@_PfSetLogBuffer@28
;@_PfTestPacket@20
;@_PfUnBindInterface@4
;do_echo_rep
;do_echo_req
;register_icmp

View file

@ -1,159 +0,0 @@
; IPHLPAPI.DLL - ReactOS Sockets 2 IP Helper API DLL
LIBRARY iphlpapi.dll
EXPORTS
AddIPAddress=AddIPAddress@20
SetIpNetEntry=SetIpNetEntry@4
CreateIpForwardEntry=CreateIpForwardEntry@4
GetAdaptersInfo=GetAdaptersInfo@8
GetNetworkParams=GetNetworkParams@8
GetNumberOfInterfaces=GetNumberOfInterfaces@4
GetIfEntry=GetIfEntry@4
GetIfTable=GetIfTable@12
GetInterfaceInfo=GetInterfaceInfo@8
GetTcpStatistics=GetTcpStatistics@4
GetTcpTable=GetTcpTable@12
GetUdpStatistics=GetUdpStatistics@4
GetUdpTable=GetUdpTable@12
FlushIpNetTable=FlushIpNetTable@4
;IpHlpDllEntry
;AllocateAndGetArpEntTableFromStack
AllocateAndGetIfTableFromStack=AllocateAndGetIfTableFromStack@16
AllocateAndGetIpAddrTableFromStack=AllocateAndGetIpAddrTableFromStack@16
AllocateAndGetIpForwardTableFromStack=AllocateAndGetIpForwardTableFromStack@16
AllocateAndGetIpNetTableFromStack=AllocateAndGetIpNetTableFromStack@16
;AllocateAndGetTcpExTableFromStack
AllocateAndGetTcpTableFromStack=AllocateAndGetTcpTableFromStack@16
;AllocateAndGetUdpExTableFromStack
AllocateAndGetUdpTableFromStack=AllocateAndGetUdpTableFromStack@16
CreateIpNetEntry=CreateIpNetEntry@4
CreateProxyArpEntry=CreateProxyArpEntry@12
DeleteIPAddress=DeleteIPAddress@4
DeleteIpForwardEntry=DeleteIpForwardEntry@4
DeleteIpNetEntry=DeleteIpNetEntry@4
DeleteProxyArpEntry=DeleteProxyArpEntry@12
DisableMediaSense=DisableMediaSense@8
EnableRouter=EnableRouter@8
;FlushIpNetTableFromStack
GetAdapterIndex=GetAdapterIndex@8
GetAdapterOrderMap=GetAdapterOrderMap@0
GetAdaptersAddresses=GetAdaptersAddresses@20
GetBestInterface=GetBestInterface@8
GetBestInterfaceEx=GetBestInterfaceEx@8
;GetBestInterfaceFromStack
GetBestRoute=GetBestRoute@12
;GetBestRouteFromStack
GetFriendlyIfIndex=GetFriendlyIfIndex@4
GetIcmpStatistics=GetIcmpStatistics@4
GetIcmpStatisticsEx=GetIcmpStatisticsEx@8
;GetIcmpStatsFromStack
;GetIcmpStatsFromStackEx
;GetIfEntryFromStack
;GetIfTableFromStack
;GetIgmpList
GetIpAddrTable=GetIpAddrTable@12
;GetIpAddrTableFromStack
GetIpErrorString=GetIpErrorString@12
GetIpForwardTable=GetIpForwardTable@12
;GetIpForwardTableFromStack
GetIpNetTable=GetIpNetTable@12
;GetIpNetTableFromStack
GetIpStatistics=GetIpStatistics@4
GetIpStatisticsEx=GetIpStatisticsEx@8
;GetIpStatsFromStack
;GetIpStatsFromStackEx
GetPerAdapterInfo=GetPerAdapterInfo@12
GetRTTAndHopCount=GetRTTAndHopCount@16
GetTcpStatisticsEx=GetTcpStatisticsEx@8
;GetTcpStatsFromStack
;GetTcpStatsFromStackEx
;GetTcpTableFromStack
GetUdpStatisticsEx=GetUdpStatisticsEx@8
;GetUdpStatsFromStack
;GetUdpStatsFromStackEx
;GetUdpTableFromStack
GetUniDirectionalAdapterInfo=GetUniDirectionalAdapterInfo@8
Icmp6CreateFile=Icmp6CreateFile@0
Icmp6ParseReplies=Icmp6ParseReplies@8
Icmp6SendEcho2=Icmp6SendEcho2@48
IcmpCloseHandle=IcmpCloseHandle@4
IcmpCreateFile=IcmpCreateFile@0
IcmpParseReplies=IcmpParseReplies@8
IcmpSendEcho=IcmpSendEcho@32
IcmpSendEcho2=IcmpSendEcho2@44
;InternalCreateIpForwardEntry
;InternalCreateIpNetEntry
;InternalDeleteIpForwardEntry
;InternalDeleteIpNetEntry
;InternalGetIfTable
;InternalGetIpAddrTable
;InternalGetIpForwardTable
;InternalGetIpNetTable
;InternalGetTcpTable
;InternalGetUdpTable
;InternalSetIfEntry
;InternalSetIpForwardEntry
;InternalSetIpNetEntry
;InternalSetIpStats
;InternalSetTcpEntry
IpReleaseAddress=IpReleaseAddress@4
IpRenewAddress=IpRenewAddress@4
;IsLocalAddress
;NTPTimeToNTFileTime
;NTTimeToNTPTime
;NhGetGuidFromInterfaceName
;NhGetInterfaceNameFromDeviceGuid
;NhGetInterfaceNameFromGuid
NhpAllocateAndGetInterfaceInfoFromStack=NhpAllocateAndGetInterfaceInfoFromStack@20
;NhpGetInterfaceIndexFromStack
NotifyAddrChange=NotifyAddrChange@8
NotifyRouteChange=NotifyRouteChange@8
;NotifyRouteChangeEx
RestoreMediaSense=RestoreMediaSense@8
;RtlIpv4AddressToStringExA
;RtlIpv4AddressToStringExW
;RtlIpv4StringToAddressExA
;RtlIpv4StringToAddressExW
;RtlIpv6AddressToStringExA
;RtlIpv6AddressToStringExW
;RtlIpv6StringToAddressExA
;RtlIpv6StringToAddressExW
SendARP=SendARP@16
;SetAdapterIpAddress
;SetBlockRoutes
SetIfEntry=SetIfEntry@4
;SetIfEntryToStack
SetIpForwardEntry=SetIpForwardEntry@4
;SetIpForwardEntryToStack
;SetIpMultihopRouteEntryToStack
;SetIpNetEntryToStack
;SetIpRouteEntryToStack
SetIpStatistics=SetIpStatistics@4
;SetIpStatsToStack
SetIpTTL=SetIpTTL@4
;SetProxyArpEntryToStack
;SetRouteWithRef
SetTcpEntry=SetTcpEntry@4
;SetTcpEntryToStack
UnenableRouter=UnenableRouter@8
;_PfAddFiltersToInterface@24
;_PfAddGlobalFilterToInterface@8
;_PfBindInterfaceToIPAddress@12
;_PfBindInterfaceToIndex@16
;_PfCreateInterface@24
;_PfDeleteInterface@4
;_PfDeleteLog@0
;_PfGetInterfaceStatistics@16
;_PfMakeLog@4
;_PfRebindFilters@8
;_PfRemoveFilterHandles@12
;_PfRemoveFiltersFromInterface@20
;_PfRemoveGlobalFilterFromInterface@8
;_PfSetLogBuffer@28
;_PfTestPacket@20
;_PfUnBindInterface@4
;do_echo_rep
;do_echo_req
;register_icmp
; EOF

View file

@ -0,0 +1,117 @@
@ stdcall AddIPAddress( long long long ptr ptr )
@ stub AllocateAndGetArpEntTableFromStack
@ stdcall AllocateAndGetIfTableFromStack( ptr long long long )
@ stdcall AllocateAndGetIpAddrTableFromStack( ptr long long long )
@ stdcall AllocateAndGetIpForwardTableFromStack( ptr long long long )
@ stdcall AllocateAndGetIpNetTableFromStack( ptr long long long )
@ stdcall AllocateAndGetTcpTableFromStack( ptr long long long )
@ stdcall AllocateAndGetUdpTableFromStack( ptr long long long )
@ stdcall CreateIpForwardEntry( ptr )
@ stdcall CreateIpNetEntry( ptr )
@ stdcall CreateProxyArpEntry( long long long )
@ stdcall DeleteIPAddress( long )
@ stdcall DeleteIpForwardEntry( ptr )
@ stdcall DeleteIpNetEntry( ptr )
@ stdcall DeleteProxyArpEntry( long long long )
@ stdcall EnableRouter( ptr ptr )
@ stdcall FlushIpNetTable( long )
@ stub FlushIpNetTableFromStack
@ stdcall GetAdapterIndex( wstr ptr )
@ stub GetAdapterOrderMap
@ stdcall GetAdaptersInfo( ptr ptr )
@ stdcall GetBestInterface( long ptr )
@ stub GetBestInterfaceFromStack
@ stdcall GetBestRoute( long long long )
@ stub GetBestRouteFromStack
@ stdcall GetFriendlyIfIndex( long )
@ stdcall GetIcmpStatistics( ptr )
@ stub GetIcmpStatsFromStack
@ stdcall GetIfEntry( ptr )
@ stub GetIfEntryFromStack
@ stdcall GetIfTable( ptr ptr long )
@ stub GetIfTableFromStack
@ stub GetIgmpList
@ stdcall GetInterfaceInfo( ptr ptr )
@ stdcall GetIpAddrTable( ptr ptr long )
@ stub GetIpAddrTableFromStack
@ stdcall GetIpForwardTable( ptr ptr long )
@ stub GetIpForwardTableFromStack
@ stdcall GetIpNetTable( ptr ptr long )
@ stub GetIpNetTableFromStack
@ stdcall GetIpStatistics( ptr )
@ stub GetIpStatsFromStack
@ stdcall GetNetworkParams( ptr ptr )
@ stdcall GetNumberOfInterfaces( ptr )
@ stdcall GetPerAdapterInfo( long ptr ptr )
@ stdcall GetRTTAndHopCount( long ptr long ptr )
@ stdcall GetTcpStatistics( ptr )
@ stub GetTcpStatsFromStack
@ stdcall GetTcpTable( ptr ptr long )
@ stub GetTcpTableFromStack
@ stdcall GetUdpStatistics( ptr )
@ stub GetUdpStatsFromStack
@ stdcall GetUdpTable( ptr ptr long )
@ stub GetUdpTableFromStack
@ stdcall GetUniDirectionalAdapterInfo( ptr ptr )
@ stub InternalCreateIpForwardEntry
@ stub InternalCreateIpNetEntry
@ stub InternalDeleteIpForwardEntry
@ stub InternalDeleteIpNetEntry
@ stub InternalGetIfTable
@ stub InternalGetIpAddrTable
@ stub InternalGetIpForwardTable
@ stub InternalGetIpNetTable
@ stub InternalGetTcpTable
@ stub InternalGetUdpTable
@ stub InternalSetIfEntry
@ stub InternalSetIpForwardEntry
@ stub InternalSetIpNetEntry
@ stub InternalSetIpStats
@ stub InternalSetTcpEntry
@ stdcall IpReleaseAddress( ptr )
@ stdcall IpRenewAddress( ptr )
@ stub IsLocalAddress
@ stub NTPTimeToNTFileTime
@ stub NTTimeToNTPTime
@ stub NhGetGuidFromInterfaceName
@ stub NhGetInterfaceNameFromGuid
@ stub NhpAllocateAndGetInterfaceInfoFromStack
@ stub NhpGetInterfaceIndexFromStack
@ stdcall NotifyAddrChange( ptr ptr )
@ stdcall NotifyRouteChange( ptr ptr )
@ stub NotifyRouteChangeEx
@ stub _PfAddFiltersToInterface@24
@ stub _PfAddGlobalFilterToInterface@8
@ stub _PfBindInterfaceToIPAddress@12
@ stub _PfBindInterfaceToIndex@16
@ stub _PfCreateInterface@24
@ stub _PfDeleteInterface@4
@ stub _PfDeleteLog@0
@ stub _PfGetInterfaceStatistics@16
@ stub _PfMakeLog@4
@ stub _PfRebindFilters@8
@ stub _PfRemoveFilterHandles@12
@ stub _PfRemoveFiltersFromInterface@20
@ stub _PfRemoveGlobalFilterFromInterface@8
@ stub _PfSetLogBuffer@28
@ stub _PfTestPacket@20
@ stub _PfUnBindInterface@4
@ stdcall SendARP( long long ptr ptr )
@ stub SetAdapterIpAddress
@ stub SetBlockRoutes
@ stdcall SetIfEntry( ptr )
@ stub SetIfEntryToStack
@ stdcall SetIpForwardEntry( ptr )
@ stub SetIpForwardEntryToStack
@ stub SetIpMultihopRouteEntryToStack
@ stdcall SetIpNetEntry( ptr )
@ stub SetIpNetEntryToStack
@ stub SetIpRouteEntryToStack
@ stdcall SetIpStatistics( ptr )
@ stub SetIpStatsToStack
@ stdcall SetIpTTL( long )
@ stub SetProxyArpEntryToStack
@ stub SetRouteWithRef
@ stdcall SetTcpEntry( ptr )
@ stub SetTcpEntryToStack
@ stdcall UnenableRouter( ptr ptr )

View file

@ -18,9 +18,8 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "iphlpapi_private.h"
#include <stdarg.h>
#include <stdlib.h>
@ -38,28 +37,16 @@
# include <resolv.h>
#endif
#ifdef __REACTOS__
# include <windows.h>
# include <windef.h>
# include <winbase.h>
# include <net/miniport.h>
# include <winsock2.h>
# include <nspapi.h>
# include <iptypes.h>
# include "iphlpapiextra.h"
# include "wine/debug.h"
#else
# include "windef.h"
# include "winbase.h"
# include "winreg.h"
# include "debug.h"
#endif
#include <stdio.h>
#include "windef.h"
#include "winbase.h"
#include "winreg.h"
#include "iphlpapi.h"
#include "ifenum.h"
#include "ipstats.h"
#include "iphlp_res.h"
#include "resinfo.h"
#include "route.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(iphlpapi);
@ -350,10 +337,7 @@ DWORD WINAPI AllocateAndGetUdpTableFromStack(PMIB_UDPTABLE *ppUdpTable,
*/
DWORD WINAPI CreateIpForwardEntry(PMIB_IPFORWARDROW pRoute)
{
TRACE("pRoute %p\n", pRoute);
/* could use SIOCADDRT, not sure I want to */
FIXME(":stub\n");
return (DWORD) 0;
return createIpForwardEntry( pRoute );
}
@ -441,10 +425,7 @@ DWORD WINAPI DeleteIPAddress(ULONG NTEContext)
*/
DWORD WINAPI DeleteIpForwardEntry(PMIB_IPFORWARDROW pRoute)
{
TRACE("pRoute %p\n", pRoute);
/* could use SIOCDELRT, not sure I want to */
FIXME(":stub\n");
return (DWORD) 0;
return deleteIpForwardEntry( pRoute );
}
@ -847,7 +828,7 @@ DWORD WINAPI GetIfEntry(PMIB_IFROW pIfRow)
if (name) {
ret = getInterfaceEntryByIndex(pIfRow->dwIndex, pIfRow);
if (ret == NO_ERROR)
ret = getInterfaceStatsByIndex(pIfRow->dwIndex, pIfRow);
ret = getInterfaceStatsByName(name, pIfRow);
consumeInterfaceName(name);
}
else
@ -1355,8 +1336,6 @@ DWORD WINAPI GetNetworkParams(PFIXED_INFO pFixedInfo, PULONG pOutBufLen)
if (!resInfo)
return ERROR_OUTOFMEMORY;
TRACE("resInfo->riCount = %d\n", resInfo->riCount);
size = sizeof(FIXED_INFO) + (resInfo->riCount > 0 ? (resInfo->riCount - 1) *
sizeof(IP_ADDR_STRING) : 0);
if (!pFixedInfo || *pOutBufLen < size) {
@ -1379,8 +1358,10 @@ DWORD WINAPI GetNetworkParams(PFIXED_INFO pFixedInfo, PULONG pOutBufLen)
for (i = 0, ptr = &pFixedInfo->DnsServerList; i < resInfo->riCount && ptr;
i++, ptr = ptr->Next) {
struct sockaddr_in *addr_v4 =
(struct sockaddr_in *)&resInfo->riAddressList[i];
toIPAddressString
(((PSOCKADDR_IN)&resInfo->riAddressList[i])->sin_addr.s_addr,
(addr_v4->sin_addr.s_addr,
ptr->IpAddress.String);
if (i == resInfo->riCount - 1)
ptr->Next = NULL;
@ -1916,12 +1897,7 @@ DWORD WINAPI SetIfEntry(PMIB_IFROW pIfRow)
*/
DWORD WINAPI SetIpForwardEntry(PMIB_IPFORWARDROW pRoute)
{
TRACE("pRoute %p\n", pRoute);
/* this is to add a route entry, how's it distinguishable from
CreateIpForwardEntry?
could use SIOCADDRT, not sure I want to */
FIXME(":stub\n");
return (DWORD) 0;
return setIpForwardEntry( pRoute );
}
@ -2039,9 +2015,9 @@ DWORD WINAPI UnenableRouter(OVERLAPPED * pOverlapped, LPDWORD lpdwEnableCount)
/*
* @unimplemented
*/
DWORD STDCALL GetIpErrorString(IP_STATUS ErrorCode,PWCHAR Buffer,PDWORD Size)
DWORD WINAPI GetIpErrorString(IP_STATUS ErrorCode,PWCHAR Buffer,PDWORD Size)
{
UNIMPLEMENTED
FIXME(":stub\n");
return 0L;
}
@ -2049,54 +2025,55 @@ DWORD STDCALL GetIpErrorString(IP_STATUS ErrorCode,PWCHAR Buffer,PDWORD Size)
/*
* @unimplemented
*/
PIP_ADAPTER_ORDER_MAP STDCALL GetAdapterOrderMap(VOID)
PIP_ADAPTER_ORDER_MAP WINAPI GetAdapterOrderMap(VOID)
{
UNIMPLEMENTED
FIXME(":stub\n");
return 0L;
}
/*
* @unimplemented
*/
DWORD STDCALL GetAdaptersAddresses(ULONG Family,DWORD Flags,PVOID Reserved,PIP_ADAPTER_ADDRESSES pAdapterAddresses,PULONG pOutBufLen)
DWORD WINAPI GetAdaptersAddresses(ULONG Family,DWORD Flags,PVOID Reserved,PIP_ADAPTER_ADDRESSES pAdapterAddresses,PULONG pOutBufLen)
{
UNIMPLEMENTED
FIXME(":stub\n");
return 0L;
}
/*
* @unimplemented
*/
BOOL STDCALL CancelIPChangeNotify(LPOVERLAPPED notifyOverlapped)
BOOL WINAPI CancelIPChangeNotify(LPOVERLAPPED notifyOverlapped)
{
UNIMPLEMENTED
FIXME(":stub\n");
return 0L;
}
/*
* @unimplemented
*/
DWORD STDCALL GetBestInterfaceEx(struct sockaddr *pDestAddr,PDWORD pdwBestIfIndex)
DWORD WINAPI GetBestInterfaceEx(struct sockaddr *pDestAddr,PDWORD pdwBestIfIndex)
{
UNIMPLEMENTED
FIXME(":stub\n");
return 0L;
}
/*
* @unimplemented
*/
DWORD STDCALL NhpAllocateAndGetInterfaceInfoFromStack(IP_INTERFACE_NAME_INFO **ppTable,PDWORD pdwCount,BOOL bOrder,HANDLE hHeap,DWORD dwFlags)
DWORD WINAPI NhpAllocateAndGetInterfaceInfoFromStack(IP_INTERFACE_NAME_INFO **ppTable,PDWORD pdwCount,BOOL bOrder,HANDLE hHeap,DWORD dwFlags)
{
UNIMPLEMENTED
FIXME(":stub\n");
return 0L;
}
/*
* @unimplemented
*/
DWORD STDCALL GetIcmpStatisticsEx(PMIB_ICMP_EX pStats,DWORD dwFamily)
DWORD WINAPI GetIcmpStatisticsEx(PMIB_ICMP_EX pStats,DWORD dwFamily)
{
UNIMPLEMENTED
FIXME(":stub\n");
return 0L;
}

View file

@ -1,6 +1,28 @@
#ifdef HAVE_CONFIG_H
/*
* iphlpapi dll implementation -- Auxiliary IPv6 stubs
*
* These are stubs for functions that provide and set IPv6 information on the
* target operating system. They are grouped here because their
* implementation will vary widely by operating system.
*
* Copyright (C) 2004 Art Yerkes
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "config.h"
#endif
#include "iphlpapi_private.h"
#include <stdarg.h>
#include <stdlib.h>
@ -18,36 +40,23 @@
# include <resolv.h>
#endif
#ifdef __REACTOS__
# include <windows.h>
# include <windef.h>
# include <winbase.h>
# include <net/miniport.h>
# include <winsock2.h>
# include <nspapi.h>
# include <iptypes.h>
# include <ws2tcpip.h>
# include "iphlpapiextra.h"
#else
# include "windef.h"
# include "winbase.h"
# include "winreg.h"
#endif
#include "windef.h"
#include "winbase.h"
#include "winreg.h"
#include "resinfo.h"
#include "iphlpapi.h"
#include "ifenum.h"
#include "ipstats.h"
#include "iphlp_res.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(iphlpapi);
/*
* @unimplemented
*/
HANDLE STDCALL Icmp6CreateFile(
HANDLE WINAPI Icmp6CreateFile(
VOID
)
{
UNIMPLEMENTED
FIXME(":stub\n");
return 0L;
}
@ -55,7 +64,7 @@ HANDLE STDCALL Icmp6CreateFile(
* @unimplemented
*/
DWORD
STDCALL
WINAPI
Icmp6SendEcho2(
HANDLE IcmpHandle,
HANDLE Event,
@ -71,7 +80,7 @@ Icmp6SendEcho2(
DWORD Timeout
)
{
UNIMPLEMENTED
FIXME(":stub\n");
return 0L;
}
@ -79,13 +88,13 @@ Icmp6SendEcho2(
* @unimplemented
*/
DWORD
STDCALL
WINAPI
Icmp6ParseReplies(
LPVOID ReplyBuffer,
DWORD ReplySize
)
{
UNIMPLEMENTED
FIXME(":stub\n");
return 0L;
}

View file

@ -1,92 +0,0 @@
#ifndef IPPRIVATE_H
#define IPPRIVATE_H
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <stdarg.h>
#include <stdlib.h>
#include <sys/types.h>
#ifdef HAVE_NETINET_IN_H
# include <netinet/in.h>
#endif
#ifdef HAVE_ARPA_INET_H
# include <arpa/inet.h>
#endif
#ifdef HAVE_ARPA_NAMESER_H
# include <arpa/nameser.h>
#endif
#ifdef HAVE_RESOLV_H
# include <resolv.h>
#endif
#define NTOS_MODE_USER
#include <ntos.h>
#include <ddk/ntddk.h>
#include <rosrtl/string.h>
#include <ntdll/rtl.h>
#include <windows.h>
#include <windef.h>
#include <winbase.h>
#include <net/miniport.h>
#include <winsock2.h>
#include <nspapi.h>
#include <iptypes.h>
#include "iphlpapiextra.h"
#include "ipregprivate.h"
#include "iphlpapi.h"
#include "ifenum.h"
#include "ipstats.h"
#include "iphlp_res.h"
#include "wine/debug.h"
#undef TRACE
#define TRACE(fmt,args...) DbgPrint("(%s:%d - %s) " fmt, __FILE__, __LINE__, __FUNCTION__, ## args)
#include "net/tdiinfo.h"
#include "tcpioctl.h"
#ifndef ETH_ALEN
#define ETH_ALEN 6
#endif
#ifndef INADDR_NONE
#define INADDR_NONE (~0U)
#endif
#ifndef IFENT_SOFTWARE_LOOPBACK
#define IFENT_SOFTWARE_LOOPBACK 24 /* This is an SNMP constant from rfc1213 */
#endif/*IFENT_SOFTWARE_LOOPBACK*/
#define INDEX_IS_LOOPBACK 0x00800000
/* Type declarations */
#ifndef IFNAMSIZ
#define IFNAMSIZ 0x20
#endif/*IFNAMSIZ*/
#define TCP_REQUEST_QUERY_INFORMATION_INIT { { { 0 } } }
/* No caddr_t in reactos headers */
typedef char *caddr_t;
typedef union _IFEntrySafelySized {
PCHAR MaxSize[sizeof(DWORD) +
sizeof(IFEntry) +
MAX_ADAPTER_DESCRIPTION_LENGTH + 1];
struct {
DWORD ProperlyOffsetTheStructure;
IFEntry ent;
} offset;
} IFEntrySafelySized;
/** Prototypes **/
NTSTATUS openTcpFile(PHANDLE tcpFile);
VOID closeTcpFile(HANDLE tcpFile);
NTSTATUS tdiGetEntityIDSet( HANDLE tcpFile, TDIEntityID **entitySet,
PDWORD numEntities );
VOID tdiFreeThingSet( PVOID things );
#endif/*IPPRIVATE_H*/

View file

@ -1,13 +0,0 @@
#ifndef IPREGPRIVATE_H
#define IPREGPRIVATE_H
int GetLongestChildKeyName( HANDLE RegHandle );
LONG OpenChildKeyRead( HANDLE RegHandle,
PCHAR ChildKeyName,
PHKEY ReturnHandle );
PCHAR GetNthChildKeyName( HANDLE RegHandle, DWORD n );
void ConsumeChildKeyName( PCHAR Name );
PCHAR QueryRegistryValueString( HANDLE RegHandle, PCHAR ValueName );
void ConsumeRegValueString( PCHAR NameServer );
#endif/*IPREGPRIVATE_H*/

View file

@ -1,4 +1,5 @@
/* Copyright (C) 2003 Juan Lang
/* Copyright (C) 2003 Art Yerkes
* A reimplementation of ifenum.c by Juan Lang
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@ -14,11 +15,11 @@
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* This file implements statistics getting using the /proc filesystem exported
* by Linux, and maybe other OSes.
* This file is implemented on the IOCTL_TCP_QUERY_INFORMATION_EX ioctl on
* tcpip.sys
*/
#include "ipprivate.h"
#include "iphlpapi_private.h"
#include "ipstats.h"
#include "ifenum.h"
@ -101,10 +102,9 @@ NTSTATUS getNthIpEntity( HANDLE tcpFile, DWORD index, TDIEntityID *ent ) {
}
}
DPRINT("Index %d is entity #%d - %04x:%08x\n", index, i,
entitySet[i].tei_entity, entitySet[i].tei_instance );
if( numRoutes == index && i < numEntities ) {
DPRINT("Index %d is entity #%d - %04x:%08x\n", index, i,
entitySet[i].tei_entity, entitySet[i].tei_instance );
memcpy( ent, &entitySet[i], sizeof(*ent) );
tdiFreeThingSet( entitySet );
return STATUS_SUCCESS;
@ -169,27 +169,41 @@ NTSTATUS tdiGetMibForIpEntity
}
NTSTATUS tdiGetRoutesForIpEntity
( HANDLE tcpFile, TDIEntityID *ent, int numRoutes, IPRouteEntry *routes ) {
TCP_REQUEST_QUERY_INFORMATION_EX req = TCP_REQUEST_QUERY_INFORMATION_INIT;
( HANDLE tcpFile, TDIEntityID *ent, IPRouteEntry **routes, PDWORD numRoutes ) {
NTSTATUS status = STATUS_SUCCESS;
DWORD returnSize;
DPRINT("TdiGetRoutesForIpEntity(tcpFile %x,entityId %x)\n",
(DWORD)tcpFile, ent->tei_instance);
req.ID.toi_class = INFO_CLASS_PROTOCOL;
req.ID.toi_type = INFO_TYPE_PROVIDER;
req.ID.toi_id = IP_MIB_ROUTETABLE_ENTRY_ID;
req.ID.toi_entity = *ent;
status = tdiGetSetOfThings( tcpFile,
INFO_CLASS_PROTOCOL,
INFO_TYPE_PROVIDER,
IP_MIB_ROUTETABLE_ENTRY_ID,
ent->tei_entity,
0,
sizeof(IPRouteEntry),
(PVOID *)routes,
numRoutes);
status = DeviceIoControl( tcpFile,
IOCTL_TCP_QUERY_INFORMATION_EX,
&req,
sizeof(req),
routes,
sizeof(*routes) * numRoutes,
&returnSize,
NULL );
return status;
}
NTSTATUS tdiGetIpAddrsForIpEntity
( HANDLE tcpFile, TDIEntityID *ent, IPAddrEntry **addrs, PDWORD numAddrs ) {
NTSTATUS status;
DPRINT("TdiGetIpAddrsForIpEntity(tcpFile %x,entityId %x)\n",
(DWORD)tcpFile, ent->tei_instance);
status = tdiGetSetOfThings( tcpFile,
INFO_CLASS_PROTOCOL,
INFO_TYPE_PROVIDER,
IP_MIB_ADDRTABLE_ENTRY_ID,
ent->tei_entity,
0,
sizeof(IPAddrEntry),
(PVOID *)addrs,
numAddrs );
return status;
}
@ -444,9 +458,6 @@ RouteTable *getRouteTable(void)
getNthIpEntity( tcpFile, i, &ent );
tdiGetMibForIpEntity( tcpFile, &ent, &snmpInfo );
route_set = HeapAlloc( GetProcessHeap(), 0,
sizeof( IPRouteEntry ) *
snmpInfo.ipsi_numroutes );
DPRINT( "%d routes in instance %d\n", snmpInfo.ipsi_numroutes, i );
@ -456,7 +467,7 @@ RouteTable *getRouteTable(void)
return 0;
}
tdiGetRoutesForIpEntity( tcpFile, &ent, numRoutes, route_set );
tdiGetRoutesForIpEntity( tcpFile, &ent, &route_set, &numRoutes );
DPRINT("Route set returned\n");
#if 0
@ -479,6 +490,8 @@ RouteTable *getRouteTable(void)
route_set[j].ire_metric;
}
if( route_set ) tdiFreeThingSet( route_set );
routesAdded += snmpInfo.ipsi_numroutes;
}

View file

@ -2,20 +2,17 @@
PATH_TO_TOP = ../..
TARGET_TYPE = dynlink
TARGET_TYPE = winedll
TARGET_NAME = iphlpapi
TARGET_BASE = 0x777c0000
TARGET_CFLAGS += -DYDEBUG -DUNICODE -D_UNICODE -D__USE_W32API -D__REACTOS__ -D_WIN32_WINNT=0x0500 -Wall
#-Werror
TARGET_CFLAGS += -DYDEBUG -DUNICODE -D_UNICODE -D__USE_W32API -D__REACTOS__ -Wall -Werror
# -D_WIN32_WINNT=0x0500
TARGET_SDKLIBS = ntdll.a kernel32.a ws2_32.a
TARGET_OBJECTS = iphlpapi_main.o icmp.o iphlpv6.o media.o registry.o \
ifenum_reactos.o ipstats_reactos.o resinfo_reactos.o
DEP_OBJECTS = $(TARGET_OBJECTS)
include $(PATH_TO_TOP)/rules.mak

View file

@ -1,43 +1,23 @@
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <stdarg.h>
#include <stdlib.h>
#include <sys/types.h>
#ifdef HAVE_NETINET_IN_H
# include <netinet/in.h>
#endif
#ifdef HAVE_ARPA_INET_H
# include <arpa/inet.h>
#endif
#ifdef HAVE_ARPA_NAMESER_H
# include <arpa/nameser.h>
#endif
#ifdef HAVE_RESOLV_H
# include <resolv.h>
#endif
#ifdef __REACTOS__
# include <windows.h>
# include <windef.h>
# include <winbase.h>
# include <net/miniport.h>
# include <winsock2.h>
# include <nspapi.h>
# include <iptypes.h>
# include "iphlpapiextra.h"
#else
# include "windef.h"
# include "winbase.h"
# include "winreg.h"
#endif
#include "iphlpapi.h"
#include "ifenum.h"
#include "ipstats.h"
#include "iphlp_res.h"
#include "wine/debug.h"
/*
* iphlpapi dll implementation -- physical media stubs
*
* Copyright (C) 2004 Art Yerkes
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "iphlpapi_private.h"
/*
* @unimplemented

View file

@ -3,11 +3,14 @@ Wine uses: Software\\Wine\\Wine\\Config\\Network
-- Wins support is todo so this part isn't so important.
-- Overall, workable
Wine uses ansi functions
-- Done --
GetNetworkParams --
-- Make workable interface for _res
-- Wine based on real _res
-- Reactos based on my enumerator funcs
-- Done -- Prints route info on windows
ROUTE PRINT:
iphlpapi_main.c:137 - ppIfTable 0104bd80, bOrder 1, heap 0xa0000000, flags 0x00000001
@ -34,3 +37,20 @@ iphlpapi_main.c:1151 - pIpForwardTable a0001d68, pdwSize 0104bd00, bOrder 1
- GetIpForwardTable again
iphlpapi_main.c:1214 - returning 122
iphlpapi_main.c:225 - returning 122
Overall architecture of the ifenum and ipstats functions.
Right now, I rely heavily on a couple of enumeration functions.
What I need to do is consolidate them and reduce traffic on the ioctl.
There are two things I need to do:
1. Lookup an interface by index (or name)
2. Get the IP info
I have too many functions that loop over various things.
What I need are the get** functions from ipstats (which I think are ok)
And then to change the detritus in ifenum to be all based on
getInterfaceIndexTable and getInterfaceMibByIndex, getInterfaceMibByName

View file

@ -1,8 +1,4 @@
#include <stdio.h>
#include <windows.h>
#include <tchar.h>
#include <stdlib.h>
#include "ipregprivate.h"
#include "iphlpapi_private.h"
#include "debug.h"

View file

@ -0,0 +1,61 @@
/*
* iphlpapi dll implementation -- Setting and storing route information
*
* These are stubs for functions that set routing information on the target
* operating system. They are grouped here because their implementation will
* vary widely by operating system.
*
* Copyright (C) 2004 Art Yerkes
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "config.h"
#include "iphlpapi_private.h"
#include <stdarg.h>
#include <stdlib.h>
#include <sys/types.h>
#ifdef HAVE_NETINET_IN_H
# include <netinet/in.h>
#endif
#ifdef HAVE_ARPA_INET_H
# include <arpa/inet.h>
#endif
#ifdef HAVE_ARPA_NAMESER_H
# include <arpa/nameser.h>
#endif
#ifdef HAVE_RESOLV_H
# include <resolv.h>
#endif
#include "windef.h"
#include "winbase.h"
#include "winreg.h"
#include "resinfo.h"
#include "iphlpapi.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(iphlpapi);
IPHLP_RES_INFO ResInfo;
PIPHLP_RES_INFO getResInfo() {
ResInfo.riCount = _res.nscount;
ResInfo.riAddressList = _res.nsaddr_list;
return &ResInfo;
}
VOID disposeResInfo( PIPHLP_RES_INFO InfoPtr ) {
}

View file

@ -0,0 +1,35 @@
/*
* iphlpapi dll implementation -- Resolver information helper function
* prototypes
*
* Copyright (C) 2004 Art Yerkes
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef _IPHLP_RES_H
#define _IPHLP_RES_H
typedef struct _IPHLP_RES_INFO {
DWORD riCount;
struct sockaddr_in *riAddressList;
} IPHLP_RES_INFO, *PIPHLP_RES_INFO;
/* Get resolver info. This currently is limited to a list of IP addresses
* that name our DNS server list. */
PIPHLP_RES_INFO getResInfo();
/* Release any resources used in acquiring the resolver information */
VOID disposeResInfo( PIPHLP_RES_INFO InfoPtr );
#endif/*_IPHLP_RES_H*/

View file

@ -1,6 +1,27 @@
#ifdef HAVE_CONFIG_H
/*
* iphlpapi dll implementation -- Auxiliary icmp functions
*
* These are stubs for functions that provide a simple ICMP probing API. They
* will be operating system specific when implemented.
*
* Copyright (C) 2004 Art Yerkes
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "config.h"
#endif
#include "iphlpapi_private.h"
#include <stdarg.h>
#include <stdlib.h>
@ -21,20 +42,12 @@
#include "windef.h"
#include "winbase.h"
#include "winreg.h"
#ifdef __REACTOS__
# include <net/miniport.h> /* ULONGLONG */
# include <winsock2.h> /* Enables NSPAPI */
# include <nspapi.h> /* SOCKET_ADDRESS */
# include <iptypes.h> /* IP_ADAPTER_ADDRESSES */
#endif
#include "resinfo.h"
#include "iphlpapi.h"
#include "ifenum.h"
#include "ipstats.h"
#include "iphlp_res.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(iphlpapi);
PIPHLP_RES_INFO getResInfo() {
PIPHLP_RES_INFO InfoPtr =
(PIPHLP_RES_INFO)HeapAlloc( GetProcessHeap(), 0,

View file

@ -0,0 +1,69 @@
/*
* iphlpapi dll implementation -- Setting and storing route information
*
* These are stubs for functions that set routing information on the target
* operating system. They are grouped here because their implementation will
* vary widely by operating system.
*
* Copyright (C) 2004 Art Yerkes
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "config.h"
#include "iphlpapi_private.h"
#include <stdarg.h>
#include <stdlib.h>
#include <sys/types.h>
#ifdef HAVE_NETINET_IN_H
# include <netinet/in.h>
#endif
#ifdef HAVE_ARPA_INET_H
# include <arpa/inet.h>
#endif
#ifdef HAVE_ARPA_NAMESER_H
# include <arpa/nameser.h>
#endif
#ifdef HAVE_RESOLV_H
# include <resolv.h>
#endif
#include "windef.h"
#include "winbase.h"
#include "winreg.h"
#include "resinfo.h"
#include "iphlpapi.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(iphlpapi);
DWORD createIpForwardEntry( PMIB_IPFORWARDROW pRoute ) {
TRACE("pRoute %p\n", pRoute);
/* could use SIOCADDRT, not sure I want to */
FIXME(":stub\n");
return (DWORD) 0;
}
DWORD setIpForwardEntry( PMIB_IPFORWARDROW pRoute ) {
FIXME(":stub\n");
return (DWORD) 0;
}
DWORD deleteIpForwardEntry( PMIB_IPFORWARDROW pRoute ) {
TRACE("pRoute %p\n", pRoute);
/* could use SIOCDELRT, not sure I want to */
FIXME(":stub\n");
return (DWORD) 0;
}

View file

@ -0,0 +1,29 @@
/*
* iphlpapi dll implementation -- Route function prototypes.
*
* Copyright (C) 2004 Art Yerkes
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef WINE_IPHLP_ROUTE_H_
#define WINE_IPHLP_ROUTE_H_
/* Create a route entry. */
DWORD createIpForwardEntry( PMIB_IPFORWARDROW Route );
DWORD setIpForwardEntry( PMIB_IPFORWARDROW Route );
DWORD deleteIpForwardEntry( PMIB_IPFORWARDROW Route );
#endif/*WINE_IPHLP_ROUTE_H_*/