mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 01:55:19 +00:00
[TCPIP] Define a enum to select which information to return
This commit is contained in:
parent
1d55f459d6
commit
655e66bdbd
3 changed files with 28 additions and 11 deletions
|
@ -80,6 +80,12 @@ typedef union TDI_INFO {
|
|||
TDI_PROVIDER_STATISTICS ProviderStats;
|
||||
} TDI_INFO, *PTDI_INFO;
|
||||
|
||||
typedef enum TDI_TCPUDP_CLASS_INFO {
|
||||
TcpUdpClassBasic,
|
||||
TcpUdpClassOwnerPid,
|
||||
TcpUdpClassOwner
|
||||
} TDI_TCPUDP_CLASS_INFO, *PTDI_TCPUDP_CLASS_INFO;
|
||||
|
||||
TDI_STATUS InfoCopyOut( PCHAR DataOut, UINT SizeOut,
|
||||
PNDIS_BUFFER ClientBuf, PUINT ClientBufSize );
|
||||
|
||||
|
@ -117,12 +123,12 @@ TDI_STATUS InfoTdiQueryGetRouteTable( PIP_INTERFACE IF,
|
|||
TDI_STATUS InfoTdiQueryGetConnectionTcpTable( PADDRESS_FILE AddrFile,
|
||||
PNDIS_BUFFER Buffer,
|
||||
PUINT BufferSize,
|
||||
BOOLEAN Extended);
|
||||
TDI_TCPUDP_CLASS_INFO Class);
|
||||
|
||||
TDI_STATUS InfoTdiQueryGetConnectionUdpTable( PADDRESS_FILE AddrFile,
|
||||
PNDIS_BUFFER Buffer,
|
||||
PUINT BufferSize,
|
||||
BOOLEAN Extended);
|
||||
TDI_TCPUDP_CLASS_INFO Class);
|
||||
|
||||
TDI_STATUS InfoTdiSetRoute(PIP_INTERFACE IF,
|
||||
PVOID Buffer,
|
||||
|
|
|
@ -268,12 +268,12 @@ TDI_STATUS InfoTdiQueryInformationEx(
|
|||
return InfoTdiQueryGetAddrTable(ID->toi_entity, Buffer, BufferSize);
|
||||
else if (ID->toi_entity.tei_entity == CO_TL_ENTITY)
|
||||
if ((EntityListContext = GetContext(ID->toi_entity)))
|
||||
return InfoTdiQueryGetConnectionTcpTable(EntityListContext, Buffer, BufferSize, TRUE);
|
||||
return InfoTdiQueryGetConnectionTcpTable(EntityListContext, Buffer, BufferSize, TcpUdpClassOwnerPid);
|
||||
else
|
||||
return TDI_INVALID_PARAMETER;
|
||||
else if (ID->toi_entity.tei_entity == CL_TL_ENTITY)
|
||||
if ((EntityListContext = GetContext(ID->toi_entity)))
|
||||
return InfoTdiQueryGetConnectionUdpTable(EntityListContext, Buffer, BufferSize, TRUE);
|
||||
return InfoTdiQueryGetConnectionUdpTable(EntityListContext, Buffer, BufferSize, TcpUdpClassOwnerPid);
|
||||
else
|
||||
return TDI_INVALID_PARAMETER;
|
||||
else
|
||||
|
@ -297,12 +297,12 @@ TDI_STATUS InfoTdiQueryInformationEx(
|
|||
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, FALSE);
|
||||
return InfoTdiQueryGetConnectionTcpTable(EntityListContext, Buffer, BufferSize, TcpUdpClassBasic);
|
||||
else
|
||||
return TDI_INVALID_PARAMETER;
|
||||
else if (ID->toi_entity.tei_entity == CL_TL_ENTITY)
|
||||
if ((EntityListContext = GetContext(ID->toi_entity)))
|
||||
return InfoTdiQueryGetConnectionUdpTable(EntityListContext, Buffer, BufferSize, FALSE);
|
||||
return InfoTdiQueryGetConnectionUdpTable(EntityListContext, Buffer, BufferSize, TcpUdpClassBasic);
|
||||
else
|
||||
return TDI_INVALID_PARAMETER;
|
||||
else
|
||||
|
|
|
@ -182,7 +182,7 @@ TDI_STATUS InfoTdiQueryGetIPSnmpInfo( TDIEntityID ID,
|
|||
TDI_STATUS InfoTdiQueryGetConnectionTcpTable(PADDRESS_FILE AddrFile,
|
||||
PNDIS_BUFFER Buffer,
|
||||
PUINT BufferSize,
|
||||
BOOLEAN Extended)
|
||||
TDI_TCPUDP_CLASS_INFO Class)
|
||||
{
|
||||
SIZE_T Size;
|
||||
MIB_TCPROW_OWNER_PID TcpRow;
|
||||
|
@ -191,12 +191,13 @@ TDI_STATUS InfoTdiQueryGetConnectionTcpTable(PADDRESS_FILE AddrFile,
|
|||
TI_DbgPrint(DEBUG_INFO, ("Called.\n"));
|
||||
|
||||
TcpRow.dwOwningPid = (DWORD)AddrFile->ProcessId;
|
||||
if (Extended)
|
||||
if (Class == TcpUdpClassOwnerPid)
|
||||
{
|
||||
Size = sizeof(MIB_TCPROW_OWNER_PID);
|
||||
}
|
||||
else
|
||||
{
|
||||
ASSERT(Class != TcpUdpClassOwner);
|
||||
Size = sizeof(MIB_TCPROW);
|
||||
}
|
||||
|
||||
|
@ -255,20 +256,30 @@ TDI_STATUS InfoTdiQueryGetConnectionTcpTable(PADDRESS_FILE AddrFile,
|
|||
TDI_STATUS InfoTdiQueryGetConnectionUdpTable(PADDRESS_FILE AddrFile,
|
||||
PNDIS_BUFFER Buffer,
|
||||
PUINT BufferSize,
|
||||
BOOLEAN Extended)
|
||||
TDI_TCPUDP_CLASS_INFO Class)
|
||||
{
|
||||
SIZE_T Size;
|
||||
MIB_UDPROW_OWNER_PID UdpRow;
|
||||
TDI_STATUS Status = TDI_INVALID_REQUEST;
|
||||
|
||||
TI_DbgPrint(DEBUG_INFO, ("Called.\n"));
|
||||
|
||||
if (Class == TcpUdpClassOwnerPid)
|
||||
{
|
||||
Size = sizeof(MIB_UDPROW_OWNER_PID);
|
||||
}
|
||||
else
|
||||
{
|
||||
ASSERT(Class != TcpUdpClassOwner);
|
||||
Size = sizeof(MIB_UDPROW);
|
||||
}
|
||||
|
||||
UdpRow.dwLocalAddr = AddrFile->Address.Address.IPv4Address;
|
||||
UdpRow.dwLocalPort = AddrFile->Port;
|
||||
UdpRow.dwOwningPid = (DWORD)AddrFile->ProcessId;
|
||||
|
||||
Status = InfoCopyOut( (PCHAR)&UdpRow,
|
||||
(Extended ? sizeof(MIB_UDPROW_OWNER_PID) : sizeof(MIB_UDPROW)),
|
||||
Buffer, BufferSize );
|
||||
Size, Buffer, BufferSize );
|
||||
|
||||
TI_DbgPrint(DEBUG_INFO, ("Returning %08x\n", Status));
|
||||
|
||||
|
|
Loading…
Reference in a new issue