[TCPIP] Implement returning TCP connections

CORE-5401
This commit is contained in:
Pierre Schweitzer 2018-11-18 16:17:50 +01:00
parent e3cb9697a4
commit 77d5f04f22
No known key found for this signature in database
GPG key ID: 7545556C3D585B0B
3 changed files with 52 additions and 0 deletions

View file

@ -8,6 +8,10 @@
#pragma once #pragma once
#include <tcpioctl.h> #include <tcpioctl.h>
/* FIXME */
#define DWORD ULONG
#include <in6addr.h>
#include <tcpmib.h>
#define MAX_PHYSADDR_LEN 8 #define MAX_PHYSADDR_LEN 8
#define MAX_IFDESCR_LEN 256 #define MAX_IFDESCR_LEN 256
@ -109,6 +113,10 @@ TDI_STATUS InfoTdiQueryGetRouteTable( PIP_INTERFACE IF,
PNDIS_BUFFER Buffer, PNDIS_BUFFER Buffer,
PUINT BufferSize ); PUINT BufferSize );
TDI_STATUS InfoTdiQueryGetConnectionTcpTable( PADDRESS_FILE AddrFile,
PNDIS_BUFFER Buffer,
PUINT BufferSize);
TDI_STATUS InfoTdiSetRoute(PIP_INTERFACE IF, TDI_STATUS InfoTdiSetRoute(PIP_INTERFACE IF,
PVOID Buffer, PVOID Buffer,
UINT BufferSize); UINT BufferSize);

View file

@ -285,6 +285,11 @@ TDI_STATUS InfoTdiQueryInformationEx(
return InfoTdiQueryGetRouteTable(EntityListContext, Buffer, BufferSize); return InfoTdiQueryGetRouteTable(EntityListContext, Buffer, BufferSize);
else else
return TDI_INVALID_PARAMETER; return TDI_INVALID_PARAMETER;
else if (ID->toi_entity.tei_entity == CO_TL_ENTITY)
if ((EntityListContext = GetContext(ID->toi_entity)))
return InfoTdiQueryGetConnectionTcpTable(EntityListContext, Buffer, BufferSize);
else
return TDI_INVALID_PARAMETER;
else else
return TDI_INVALID_PARAMETER; return TDI_INVALID_PARAMETER;

View file

@ -177,6 +177,45 @@ TDI_STATUS InfoTdiQueryGetIPSnmpInfo( TDIEntityID ID,
return Status; return Status;
} }
TDI_STATUS InfoTdiQueryGetConnectionTcpTable(PADDRESS_FILE AddrFile,
PNDIS_BUFFER Buffer,
PUINT BufferSize)
{
MIB_TCPROW TcpRow;
PADDRESS_FILE EndPoint;
TDI_STATUS Status = TDI_INVALID_REQUEST;
TI_DbgPrint(DEBUG_INFO, ("Called.\n"));
EndPoint = NULL;
if (AddrFile->Connection != NULL)
EndPoint = AddrFile->Connection->AddressFile;
else if (AddrFile->Listener != NULL)
EndPoint = AddrFile->Listener->AddressFile;
TcpRow.State = 0; /* FIXME */
TcpRow.dwLocalAddr = AddrFile->Address.Address.IPv4Address;
TcpRow.dwLocalPort = AddrFile->Port;
if (EndPoint != NULL)
{
TcpRow.dwRemoteAddr = EndPoint->Address.Address.IPv4Address;
TcpRow.dwRemotePort = EndPoint->Port;
}
else
{
TcpRow.dwRemoteAddr = 0;
TcpRow.dwRemotePort = 0;
}
Status = InfoCopyOut( (PCHAR)&TcpRow, sizeof(TcpRow),
Buffer, BufferSize );
TI_DbgPrint(DEBUG_INFO, ("Returning %08x\n", Status));
return Status;
}
TDI_STATUS InfoTdiSetRoute(PIP_INTERFACE IF, PVOID Buffer, UINT BufferSize) TDI_STATUS InfoTdiSetRoute(PIP_INTERFACE IF, PVOID Buffer, UINT BufferSize)
{ {
IP_ADDRESS Address, Netmask, Router; IP_ADDRESS Address, Netmask, Router;