mirror of
https://github.com/reactos/reactos.git
synced 2024-06-30 01:42:30 +00:00
[0.4.7][IPHLPAPI][TCPIP][IP][LWIP][SDK][PSDK] Port back groundworks for netstat
This fixes: CORE-15363 'netstat TCP foreign address port is wrong' CORE-5401 'Netstat returns ERROR_NO_DATA Pipe being closed' CORE-5126 'UNIMPLEMENTED: iphlpapi: GetExtendedUdpTable' even without touching the netstat binary yet. And is mostly based on work done by Pierre Schweitzer during 0.4.11-dev'ing. by porting back: 0.4.15-dev-6231-ga5360f542f
[IPHLPAPI] Formatting only, no functional change partially 0.4.14-dev-1425-gf540b2b20c
[IPHLPAPI] GetAdaptersAddresses(): Add 1 free() in ERROR_NO_DATA case (#2526) (but leave out adding the comments in .h) 0.4.12-dev-686-g22f60faf43
[IPHLPAPI] Remove dead code to fix CID 513306, 1442673, 1442697 0.4.11-dev-880-gbf052e120b
[IPHLPAPI] Reduce code duplication and use a single function for TCP and UDP enumerations + fix corruption 0.4.11-dev-867-g159f5b676a
[IPHLPAPI] Fix broken size computation leading to buffer overrun 0.4.11-dev-861-g05657bfcfd
[SDK] Add a non documenter TOIID used to query modules information 0.4.11-dev-827-gce7f9211a0
[TCPIP] In InfoTdiQueryGetConnectionTcpTable(), only return if there's a connection 0.4.11-dev-823-g0ec92100bc
[TCPIP] Properly display local information for established connections 0.4.11-dev-819-gfbdfe7bd40
[SDK] Add GetExtendedUdpTable() 0.4.11-dev-818-g370b03b523
[IPHLPAPI] Reimplement GetUdpTable() using GetExtendedUdpTable() 0.4.11-dev-817-g58cef01422
[IPHLPAPI] Implement GetExtendedUdpTable() CORE-5126 0.4.11-dev-816-g6fb6c7b50b
[IPHLPAPI] Implement getOwnerUdoTable(), to get UDP connections with owner PID 0.4.11-dev-815-g13de7f08af
[TCPIP] Implement enumerating UDP connections with owner PID 0.4.11-dev-813-g73c87d5c14
[IPHLPAPI] Reimplement GetTcpTable() using GetExtendedTcpTable() 0.4.11-dev-812-gd76ac645e8
[IPHLPAPI] Don't leak memory 0.4.11-dev-811-gc949a12506
[IPHLPAPI] Implement the IPv4 TCP_TABLE_OWNER_PID_* cases in GetExtendedTcpTable() 0.4.11-dev-810-gdca7e5689f
[IPHLPAPI] Implement getOwnerTcpTable(), to get TCP connections with owner PID 0.4.11-dev-809-g411504b5f4
[TCPIP] Implement enumerating TCP connections with owner PID 0.4.11-dev-808-g935978ee57
[TCPIP] Store creator PID in ADDRESS_FILE 0.4.11-dev-807-g702d44c683
[IPHLPAPI] Implement the IPv4 TCP_TABLE_BASIC_* cases in GetExtendedTcpTable() 0.4.11-dev-804-g91b013d387
[TCPIP] When enumerating sockets, retrieve their state and return it 0.4.11-dev-803-g738f327668
[IP] Add a TCPGetSocketStatus() wrapper around LibTCPGetSocketStatus() 0.4.11-dev-802-g29c1510423
[LWIP] Implement a LibTCPGetSocketStatus() function in our LwIP glue 0.4.11-dev-792-g8a98c85c1f
[IPHLPAPI] Fix checking entity when enumerating TCP/UDP connections 0.4.11-dev-784-gf29016dabe
[TCPIP] Properly handle listening sockets 0.4.11-dev-782-g007f43dd56
[TCPIP] Implement returning UDP connections CORE-5401 0.4.11-dev-781-g77d5f04f22
[TCPIP] Implement returning TCP connections CORE-5401 0.4.11-dev-799-g500a5151ea
[TCPIP] Fix returned IP address when querying TCP connections CORE-15363 0.4.11-dev-783-gd18b1fe24b
[IPHLPAPI] Properly count UDP entries CORE-5401 0.4.11-dev-780-ge3cb9697a4
[IPHLPAPI] Implement getNumUdpEntries() and getUdpTable() CORE-5401 0.4.11-dev-779-g678204790c
[IPHLPAPI] Implement getNumTcpEntries() and getTcpTable() CORE-5401 0.4.9-dev-59-gb6c060ce04
[IPHLPAPI] Fix getNumRoutes() return value on Mib error (#391) ---------------- Strip some DPRINTs entirely in IPHLPAPI/TCPIP in releases/0.4.7 - 0.4.10 (instead of fixing them like we did on master). Many of them had x64 issues: This was partially *inspired* by watching the following commits: 0.4.13-dev-14-gf9a967b2ae
[IPHLPAPI] Fix misc 64 bit issues (only the parts in iphlpapi_main.c with the format strings) 0.4.10-dev-409-g0f8439aa71
[IPHLPAPI] Fix 64 bit issue, just the one within [IPHLPAPI] ifenum_reactos.c 0.4.9-dev-856-g6c9359221c
[IPHLPAPI] ipstats_reactos: Review all TRACE/WARN calls This does not only fix the x64 incompatibilities by superseding those 3 commits but also will keep the file-sizes under control for the backports.
This commit is contained in:
parent
6812097a8b
commit
40bbab2b8c
|
@ -62,9 +62,6 @@ NTSTATUS tdiGetMibForIfEntity
|
||||||
NTSTATUS status = STATUS_SUCCESS;
|
NTSTATUS status = STATUS_SUCCESS;
|
||||||
DWORD returnSize;
|
DWORD returnSize;
|
||||||
|
|
||||||
WARN("TdiGetMibForIfEntity(tcpFile %x,entityId %x)\n",
|
|
||||||
(int)tcpFile, (int)ent->tei_instance);
|
|
||||||
|
|
||||||
req.ID.toi_class = INFO_CLASS_PROTOCOL;
|
req.ID.toi_class = INFO_CLASS_PROTOCOL;
|
||||||
req.ID.toi_type = INFO_TYPE_PROVIDER;
|
req.ID.toi_type = INFO_TYPE_PROVIDER;
|
||||||
req.ID.toi_id = IF_MIB_STATS_ID;
|
req.ID.toi_id = IF_MIB_STATS_ID;
|
||||||
|
|
|
@ -1,84 +1,84 @@
|
||||||
@ stdcall AddIPAddress( long long long ptr ptr )
|
@ stdcall AddIPAddress(long long long ptr ptr)
|
||||||
@ stub AllocateAndGetArpEntTableFromStack
|
@ stub AllocateAndGetArpEntTableFromStack
|
||||||
@ stdcall AllocateAndGetIfTableFromStack( ptr long long long )
|
@ stdcall AllocateAndGetIfTableFromStack(ptr long long long)
|
||||||
@ stdcall AllocateAndGetIpAddrTableFromStack( ptr long long long )
|
@ stdcall AllocateAndGetIpAddrTableFromStack(ptr long long long)
|
||||||
@ stdcall AllocateAndGetIpForwardTableFromStack( ptr long long long )
|
@ stdcall AllocateAndGetIpForwardTableFromStack(ptr long long long)
|
||||||
@ stdcall AllocateAndGetIpNetTableFromStack( ptr long long long )
|
@ stdcall AllocateAndGetIpNetTableFromStack(ptr long long long)
|
||||||
@ stub AllocateAndGetTcpExTable2FromStack
|
@ stub AllocateAndGetTcpExTable2FromStack
|
||||||
@ stub AllocateAndGetTcpExTableFromStack
|
@ stub AllocateAndGetTcpExTableFromStack
|
||||||
@ stdcall AllocateAndGetTcpTableFromStack( ptr long long long )
|
@ stdcall AllocateAndGetTcpTableFromStack(ptr long long long)
|
||||||
@ stub AllocateAndGetUdpExTable2FromStack
|
@ stub AllocateAndGetUdpExTable2FromStack
|
||||||
@ stub AllocateAndGetUdpExTableFromStack
|
@ stub AllocateAndGetUdpExTableFromStack
|
||||||
@ stdcall AllocateAndGetUdpTableFromStack( ptr long long long )
|
@ stdcall AllocateAndGetUdpTableFromStack(ptr long long long)
|
||||||
@ stdcall CancelIPChangeNotify(ptr)
|
@ stdcall CancelIPChangeNotify(ptr)
|
||||||
@ stub CancelSecurityHealthChangeNotify
|
@ stub CancelSecurityHealthChangeNotify
|
||||||
@ stdcall CreateIpForwardEntry( ptr )
|
@ stdcall CreateIpForwardEntry(ptr)
|
||||||
@ stdcall CreateIpNetEntry( ptr )
|
@ stdcall CreateIpNetEntry(ptr)
|
||||||
@ stdcall CreateProxyArpEntry( long long long )
|
@ stdcall CreateProxyArpEntry(long long long)
|
||||||
@ stdcall DeleteIPAddress( long )
|
@ stdcall DeleteIPAddress(long)
|
||||||
@ stdcall DeleteIpForwardEntry( ptr )
|
@ stdcall DeleteIpForwardEntry(ptr)
|
||||||
@ stdcall DeleteIpNetEntry( ptr )
|
@ stdcall DeleteIpNetEntry(ptr)
|
||||||
@ stdcall DeleteProxyArpEntry( long long long )
|
@ stdcall DeleteProxyArpEntry(long long long)
|
||||||
@ stdcall DisableMediaSense(ptr ptr)
|
@ stdcall DisableMediaSense(ptr ptr)
|
||||||
@ stdcall EnableRouter( ptr ptr )
|
@ stdcall EnableRouter(ptr ptr)
|
||||||
@ stdcall FlushIpNetTable( long )
|
@ stdcall FlushIpNetTable(long)
|
||||||
@ stub FlushIpNetTableFromStack
|
@ stub FlushIpNetTableFromStack
|
||||||
@ stdcall GetAdapterIndex( wstr ptr )
|
@ stdcall GetAdapterIndex(wstr ptr)
|
||||||
@ stdcall GetAdapterOrderMap()
|
@ stdcall GetAdapterOrderMap()
|
||||||
@ stdcall GetAdaptersAddresses( long long ptr ptr ptr )
|
@ stdcall GetAdaptersAddresses(long long ptr ptr ptr)
|
||||||
@ stdcall GetAdaptersInfo( ptr ptr )
|
@ stdcall GetAdaptersInfo(ptr ptr)
|
||||||
@ stdcall GetBestInterface( long ptr )
|
@ stdcall GetBestInterface(long ptr)
|
||||||
@ stdcall GetBestInterfaceEx(ptr ptr)
|
@ stdcall GetBestInterfaceEx(ptr ptr)
|
||||||
@ stub GetBestInterfaceFromStack
|
@ stub GetBestInterfaceFromStack
|
||||||
@ stdcall GetBestRoute( long long long )
|
@ stdcall GetBestRoute(long long long)
|
||||||
@ stub GetBestRouteFromStack
|
@ stub GetBestRouteFromStack
|
||||||
@ stdcall GetExtendedTcpTable( ptr ptr long long long long )
|
@ stdcall GetExtendedTcpTable(ptr ptr long long long long)
|
||||||
@ stdcall -stub GetExtendedUdpTable( ptr ptr long long long long )
|
@ stdcall GetExtendedUdpTable(ptr ptr long long long long)
|
||||||
@ stdcall GetFriendlyIfIndex( long )
|
@ stdcall GetFriendlyIfIndex(long)
|
||||||
@ stdcall GetIcmpStatistics( ptr )
|
@ stdcall GetIcmpStatistics(ptr)
|
||||||
@ stdcall GetIcmpStatisticsEx(ptr long)
|
@ stdcall GetIcmpStatisticsEx(ptr long)
|
||||||
@ stub GetIcmpStatsFromStack
|
@ stub GetIcmpStatsFromStack
|
||||||
@ stub GetIcmpStatsFromStackEx
|
@ stub GetIcmpStatsFromStackEx
|
||||||
@ stdcall GetIfEntry( ptr )
|
@ stdcall GetIfEntry(ptr)
|
||||||
@ stub GetIfEntryFromStack
|
@ stub GetIfEntryFromStack
|
||||||
@ stdcall GetIfTable( ptr ptr long )
|
@ stdcall GetIfTable(ptr ptr long)
|
||||||
@ stub GetIfTableFromStack
|
@ stub GetIfTableFromStack
|
||||||
@ stub GetIgmpList
|
@ stub GetIgmpList
|
||||||
@ stdcall GetInterfaceInfo( ptr ptr )
|
@ stdcall GetInterfaceInfo(ptr ptr)
|
||||||
@ stdcall GetIpAddrTable( ptr ptr long )
|
@ stdcall GetIpAddrTable(ptr ptr long)
|
||||||
@ stub GetIpAddrTableFromStack
|
@ stub GetIpAddrTableFromStack
|
||||||
@ stdcall GetIpErrorString(long ptr ptr)
|
@ stdcall GetIpErrorString(long ptr ptr)
|
||||||
@ stdcall GetIpForwardTable( ptr ptr long )
|
@ stdcall GetIpForwardTable(ptr ptr long)
|
||||||
@ stub GetIpForwardTableFromStack
|
@ stub GetIpForwardTableFromStack
|
||||||
@ stdcall GetIpNetTable( ptr ptr long )
|
@ stdcall GetIpNetTable(ptr ptr long)
|
||||||
@ stub GetIpNetTableFromStack
|
@ stub GetIpNetTableFromStack
|
||||||
@ stdcall GetIpStatistics( ptr )
|
@ stdcall GetIpStatistics(ptr)
|
||||||
@ stdcall GetIpStatisticsEx(ptr long)
|
@ stdcall GetIpStatisticsEx(ptr long)
|
||||||
@ stub GetIpStatsFromStack
|
@ stub GetIpStatsFromStack
|
||||||
@ stub GetIpStatsFromStackEx
|
@ stub GetIpStatsFromStackEx
|
||||||
@ stdcall GetNetworkParams( ptr ptr )
|
@ stdcall GetNetworkParams(ptr ptr)
|
||||||
@ stdcall GetNumberOfInterfaces( ptr )
|
@ stdcall GetNumberOfInterfaces(ptr)
|
||||||
@ stub GetOwnerModuleFromTcp6Entry
|
@ stub GetOwnerModuleFromTcp6Entry
|
||||||
@ stdcall GetOwnerModuleFromTcpEntry ( ptr long ptr ptr )
|
@ stdcall GetOwnerModuleFromTcpEntry(ptr long ptr ptr)
|
||||||
@ stub GetOwnerModuleFromUdp6Entry
|
@ stub GetOwnerModuleFromUdp6Entry
|
||||||
@ stub GetOwnerModuleFromUdpEntry
|
@ stub GetOwnerModuleFromUdpEntry
|
||||||
@ stdcall GetPerAdapterInfo( long ptr ptr )
|
@ stdcall GetPerAdapterInfo(long ptr ptr)
|
||||||
@ stdcall GetRTTAndHopCount( long ptr long ptr )
|
@ stdcall GetRTTAndHopCount(long ptr long ptr)
|
||||||
@ stub GetTcpExTable2FromStack
|
@ stub GetTcpExTable2FromStack
|
||||||
@ stdcall GetTcpStatistics( ptr )
|
@ stdcall GetTcpStatistics(ptr)
|
||||||
@ stdcall GetTcpStatisticsEx(ptr long)
|
@ stdcall GetTcpStatisticsEx(ptr long)
|
||||||
@ stub GetTcpStatsFromStack
|
@ stub GetTcpStatsFromStack
|
||||||
@ stub GetTcpStatsFromStackEx
|
@ stub GetTcpStatsFromStackEx
|
||||||
@ stdcall GetTcpTable( ptr ptr long )
|
@ stdcall GetTcpTable(ptr ptr long)
|
||||||
@ stub GetTcpTableFromStack
|
@ stub GetTcpTableFromStack
|
||||||
@ stub GetUdpExTable2FromStack
|
@ stub GetUdpExTable2FromStack
|
||||||
@ stdcall GetUdpStatistics( ptr )
|
@ stdcall GetUdpStatistics(ptr)
|
||||||
@ stdcall GetUdpStatisticsEx(ptr long)
|
@ stdcall GetUdpStatisticsEx(ptr long)
|
||||||
@ stub GetUdpStatsFromStack
|
@ stub GetUdpStatsFromStack
|
||||||
@ stub GetUdpStatsFromStackEx
|
@ stub GetUdpStatsFromStackEx
|
||||||
@ stdcall GetUdpTable( ptr ptr long )
|
@ stdcall GetUdpTable(ptr ptr long)
|
||||||
@ stub GetUdpTableFromStack
|
@ stub GetUdpTableFromStack
|
||||||
@ stdcall GetUniDirectionalAdapterInfo( ptr ptr )
|
@ stdcall GetUniDirectionalAdapterInfo(ptr ptr)
|
||||||
@ stdcall Icmp6CreateFile()
|
@ stdcall Icmp6CreateFile()
|
||||||
@ stdcall -stub Icmp6ParseReplies(ptr long)
|
@ stdcall -stub Icmp6ParseReplies(ptr long)
|
||||||
@ stdcall Icmp6SendEcho2(ptr ptr ptr ptr ptr ptr ptr long ptr ptr long long)
|
@ stdcall Icmp6SendEcho2(ptr ptr ptr ptr ptr ptr ptr long ptr ptr long long)
|
||||||
|
@ -102,8 +102,8 @@
|
||||||
@ stub InternalSetIpNetEntry
|
@ stub InternalSetIpNetEntry
|
||||||
@ stub InternalSetIpStats
|
@ stub InternalSetIpStats
|
||||||
@ stub InternalSetTcpEntry
|
@ stub InternalSetTcpEntry
|
||||||
@ stdcall IpReleaseAddress( ptr )
|
@ stdcall IpReleaseAddress(ptr)
|
||||||
@ stdcall IpRenewAddress( ptr )
|
@ stdcall IpRenewAddress(ptr)
|
||||||
@ stub IsLocalAddress
|
@ stub IsLocalAddress
|
||||||
@ stub NTPTimeToNTFileTime
|
@ stub NTPTimeToNTFileTime
|
||||||
@ stub NTTimeToNTPTime
|
@ stub NTTimeToNTPTime
|
||||||
|
@ -112,30 +112,30 @@
|
||||||
@ stub NhGetInterfaceNameFromGuid
|
@ stub NhGetInterfaceNameFromGuid
|
||||||
@ stdcall NhpAllocateAndGetInterfaceInfoFromStack(ptr ptr long ptr long)
|
@ stdcall NhpAllocateAndGetInterfaceInfoFromStack(ptr ptr long ptr long)
|
||||||
@ stub NhpGetInterfaceIndexFromStack
|
@ stub NhpGetInterfaceIndexFromStack
|
||||||
@ stdcall NotifyAddrChange( ptr ptr )
|
@ stdcall NotifyAddrChange(ptr ptr)
|
||||||
@ stdcall NotifyRouteChange( ptr ptr )
|
@ stdcall NotifyRouteChange(ptr ptr)
|
||||||
@ stub NotifyRouteChangeEx
|
@ stub NotifyRouteChangeEx
|
||||||
@ stub NotifySecurityHealthChange
|
@ stub NotifySecurityHealthChange
|
||||||
@ stdcall RestoreMediaSense(ptr ptr)
|
@ stdcall RestoreMediaSense(ptr ptr)
|
||||||
@ stdcall SendARP(long long ptr ptr)
|
@ stdcall SendARP(long long ptr ptr)
|
||||||
@ stub SetAdapterIpAddress
|
@ stub SetAdapterIpAddress
|
||||||
@ stub SetBlockRoutes
|
@ stub SetBlockRoutes
|
||||||
@ stdcall SetIfEntry( ptr )
|
@ stdcall SetIfEntry(ptr)
|
||||||
@ stub SetIfEntryToStack
|
@ stub SetIfEntryToStack
|
||||||
@ stdcall SetIpForwardEntry( ptr )
|
@ stdcall SetIpForwardEntry(ptr)
|
||||||
@ stdcall SetIpForwardEntryToStack( ptr )
|
@ stdcall SetIpForwardEntryToStack(ptr)
|
||||||
@ stub SetIpMultihopRouteEntryToStack
|
@ stub SetIpMultihopRouteEntryToStack
|
||||||
@ stdcall SetIpNetEntry( ptr )
|
@ stdcall SetIpNetEntry(ptr)
|
||||||
@ stub SetIpNetEntryToStack
|
@ stub SetIpNetEntryToStack
|
||||||
@ stub SetIpRouteEntryToStack
|
@ stub SetIpRouteEntryToStack
|
||||||
@ stdcall SetIpStatistics( ptr )
|
@ stdcall SetIpStatistics(ptr)
|
||||||
@ stub SetIpStatsToStack
|
@ stub SetIpStatsToStack
|
||||||
@ stdcall SetIpTTL( long )
|
@ stdcall SetIpTTL(long)
|
||||||
@ stub SetProxyArpEntryToStack
|
@ stub SetProxyArpEntryToStack
|
||||||
@ stub SetRouteWithRef
|
@ stub SetRouteWithRef
|
||||||
@ stdcall SetTcpEntry( ptr )
|
@ stdcall SetTcpEntry(ptr)
|
||||||
@ stub SetTcpEntryToStack
|
@ stub SetTcpEntryToStack
|
||||||
@ stdcall UnenableRouter( ptr ptr )
|
@ stdcall UnenableRouter(ptr ptr)
|
||||||
@ stub _PfAddFiltersToInterface@24
|
@ stub _PfAddFiltersToInterface@24
|
||||||
@ stub _PfAddGlobalFilterToInterface@8
|
@ stub _PfAddGlobalFilterToInterface@8
|
||||||
@ stub _PfBindInterfaceToIPAddress@12
|
@ stub _PfBindInterfaceToIPAddress@12
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -76,6 +76,12 @@ typedef struct _RouteTable {
|
||||||
RouteEntry routes[1];
|
RouteEntry routes[1];
|
||||||
} RouteTable;
|
} RouteTable;
|
||||||
|
|
||||||
|
typedef enum _CLASS_TABLE {
|
||||||
|
ClassBasic,
|
||||||
|
ClassModulePid,
|
||||||
|
ClassModule
|
||||||
|
} CLASS_TABLE;
|
||||||
|
|
||||||
/* Allocates and returns to you the route table, or NULL if it can't allocate
|
/* Allocates and returns to you the route table, or NULL if it can't allocate
|
||||||
* enough memory. free() the returned table.
|
* enough memory. free() the returned table.
|
||||||
*/
|
*/
|
||||||
|
@ -95,7 +101,7 @@ DWORD getNumUdpEntries(void);
|
||||||
/* Allocates and returns to you the UDP state table, or NULL if it can't
|
/* Allocates and returns to you the UDP state table, or NULL if it can't
|
||||||
* allocate enough memory. free() the returned table.
|
* allocate enough memory. free() the returned table.
|
||||||
*/
|
*/
|
||||||
PMIB_UDPTABLE getUdpTable(void);
|
PVOID getUdpTable(CLASS_TABLE Class);
|
||||||
|
|
||||||
/* Returns the number of entries in the TCP state table. */
|
/* Returns the number of entries in the TCP state table. */
|
||||||
DWORD getNumTcpEntries(void);
|
DWORD getNumTcpEntries(void);
|
||||||
|
@ -103,6 +109,6 @@ DWORD getNumTcpEntries(void);
|
||||||
/* Allocates and returns to you the TCP state table, or NULL if it can't
|
/* Allocates and returns to you the TCP state table, or NULL if it can't
|
||||||
* allocate enough memory. free() the returned table.
|
* allocate enough memory. free() the returned table.
|
||||||
*/
|
*/
|
||||||
PMIB_TCPTABLE getTcpTable(void);
|
PVOID getTcpTable(CLASS_TABLE Class);
|
||||||
|
|
||||||
#endif /* ndef WINE_IPSTATS_H_ */
|
#endif /* ndef WINE_IPSTATS_H_ */
|
||||||
|
|
|
@ -74,15 +74,12 @@ NTSTATUS getNthIpEntity( HANDLE tcpFile, DWORD index, TDIEntityID *ent ) {
|
||||||
|
|
||||||
for( i = 0; i < numEntities; i++ ) {
|
for( i = 0; i < numEntities; i++ ) {
|
||||||
if( isIpEntity( tcpFile, &entitySet[i] ) ) {
|
if( isIpEntity( tcpFile, &entitySet[i] ) ) {
|
||||||
TRACE("Entity %d is an IP Entity\n", i);
|
|
||||||
if( numRoutes == index ) break;
|
if( numRoutes == index ) break;
|
||||||
else numRoutes++;
|
else numRoutes++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( numRoutes == index && i < numEntities ) {
|
if( numRoutes == index && i < numEntities ) {
|
||||||
TRACE("Index %d is entity #%d - %04x:%08x\n", index, i,
|
|
||||||
entitySet[i].tei_entity, entitySet[i].tei_instance );
|
|
||||||
memcpy( ent, &entitySet[i], sizeof(*ent) );
|
memcpy( ent, &entitySet[i], sizeof(*ent) );
|
||||||
tdiFreeThingSet( entitySet );
|
tdiFreeThingSet( entitySet );
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
|
@ -100,48 +97,19 @@ NTSTATUS tdiGetMibForIpEntity
|
||||||
|
|
||||||
memset( entry, 0, sizeof( *entry ) );
|
memset( entry, 0, sizeof( *entry ) );
|
||||||
|
|
||||||
TRACE("TdiGetMibForIpEntity(tcpFile %x,entityId %x)\n",
|
|
||||||
(DWORD)tcpFile, ent->tei_instance);
|
|
||||||
|
|
||||||
req.ID.toi_class = INFO_CLASS_PROTOCOL;
|
req.ID.toi_class = INFO_CLASS_PROTOCOL;
|
||||||
req.ID.toi_type = INFO_TYPE_PROVIDER;
|
req.ID.toi_type = INFO_TYPE_PROVIDER;
|
||||||
req.ID.toi_id = IP_MIB_STATS_ID;
|
req.ID.toi_id = IP_MIB_STATS_ID;
|
||||||
req.ID.toi_entity = *ent;
|
req.ID.toi_entity = *ent;
|
||||||
|
|
||||||
status = DeviceIoControl( tcpFile,
|
status = DeviceIoControl(tcpFile,
|
||||||
IOCTL_TCP_QUERY_INFORMATION_EX,
|
IOCTL_TCP_QUERY_INFORMATION_EX,
|
||||||
&req,
|
&req,
|
||||||
sizeof(req),
|
sizeof(req),
|
||||||
entry,
|
entry,
|
||||||
sizeof(*entry),
|
sizeof(*entry),
|
||||||
&returnSize,
|
&returnSize,
|
||||||
NULL );
|
NULL);
|
||||||
|
|
||||||
TRACE("TdiGetMibForIpEntity() => {\n"
|
|
||||||
" ipsi_forwarding ............ %d\n"
|
|
||||||
" ipsi_defaultttl ............ %d\n"
|
|
||||||
" ipsi_inreceives ............ %d\n"
|
|
||||||
" ipsi_indelivers ............ %d\n"
|
|
||||||
" ipsi_outrequests ........... %d\n"
|
|
||||||
" ipsi_routingdiscards ....... %d\n"
|
|
||||||
" ipsi_outdiscards ........... %d\n"
|
|
||||||
" ipsi_outnoroutes ........... %d\n"
|
|
||||||
" ipsi_numif ................. %d\n"
|
|
||||||
" ipsi_numaddr ............... %d\n"
|
|
||||||
" ipsi_numroutes ............. %d\n"
|
|
||||||
"} status %08x\n",
|
|
||||||
entry->ipsi_forwarding,
|
|
||||||
entry->ipsi_defaultttl,
|
|
||||||
entry->ipsi_inreceives,
|
|
||||||
entry->ipsi_indelivers,
|
|
||||||
entry->ipsi_outrequests,
|
|
||||||
entry->ipsi_routingdiscards,
|
|
||||||
entry->ipsi_outdiscards,
|
|
||||||
entry->ipsi_outnoroutes,
|
|
||||||
entry->ipsi_numif,
|
|
||||||
entry->ipsi_numaddr,
|
|
||||||
entry->ipsi_numroutes,
|
|
||||||
status);
|
|
||||||
|
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
@ -150,10 +118,7 @@ NTSTATUS tdiGetRoutesForIpEntity
|
||||||
( HANDLE tcpFile, TDIEntityID *ent, IPRouteEntry **routes, PDWORD numRoutes ) {
|
( HANDLE tcpFile, TDIEntityID *ent, IPRouteEntry **routes, PDWORD numRoutes ) {
|
||||||
NTSTATUS status = STATUS_SUCCESS;
|
NTSTATUS status = STATUS_SUCCESS;
|
||||||
|
|
||||||
TRACE("TdiGetRoutesForIpEntity(tcpFile %x,entityId %x)\n",
|
status = tdiGetSetOfThings(tcpFile,
|
||||||
(DWORD)tcpFile, ent->tei_instance);
|
|
||||||
|
|
||||||
status = tdiGetSetOfThings( tcpFile,
|
|
||||||
INFO_CLASS_PROTOCOL,
|
INFO_CLASS_PROTOCOL,
|
||||||
INFO_TYPE_PROVIDER,
|
INFO_TYPE_PROVIDER,
|
||||||
IP_MIB_ARPTABLE_ENTRY_ID,
|
IP_MIB_ARPTABLE_ENTRY_ID,
|
||||||
|
@ -171,10 +136,7 @@ NTSTATUS tdiGetIpAddrsForIpEntity
|
||||||
( HANDLE tcpFile, TDIEntityID *ent, IPAddrEntry **addrs, PDWORD numAddrs ) {
|
( HANDLE tcpFile, TDIEntityID *ent, IPAddrEntry **addrs, PDWORD numAddrs ) {
|
||||||
NTSTATUS status;
|
NTSTATUS status;
|
||||||
|
|
||||||
TRACE("TdiGetIpAddrsForIpEntity(tcpFile %x,entityId %x)\n",
|
status = tdiGetSetOfThings(tcpFile,
|
||||||
(DWORD)tcpFile, ent->tei_instance);
|
|
||||||
|
|
||||||
status = tdiGetSetOfThings( tcpFile,
|
|
||||||
INFO_CLASS_PROTOCOL,
|
INFO_CLASS_PROTOCOL,
|
||||||
INFO_TYPE_PROVIDER,
|
INFO_TYPE_PROVIDER,
|
||||||
IP_MIB_ADDRTABLE_ENTRY_ID,
|
IP_MIB_ADDRTABLE_ENTRY_ID,
|
||||||
|
@ -183,7 +145,7 @@ NTSTATUS tdiGetIpAddrsForIpEntity
|
||||||
0,
|
0,
|
||||||
sizeof(IPAddrEntry),
|
sizeof(IPAddrEntry),
|
||||||
(PVOID *)addrs,
|
(PVOID *)addrs,
|
||||||
numAddrs );
|
numAddrs);
|
||||||
|
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
@ -351,11 +313,6 @@ DWORD getUDPStats(MIB_UDPSTATS *stats, DWORD family)
|
||||||
return NO_ERROR;
|
return NO_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
static DWORD getNumWithOneHeader(const char *filename)
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
DWORD getNumRoutes(void)
|
DWORD getNumRoutes(void)
|
||||||
{
|
{
|
||||||
DWORD numEntities, numRoutes = 0;
|
DWORD numEntities, numRoutes = 0;
|
||||||
|
@ -364,75 +321,50 @@ DWORD getNumRoutes(void)
|
||||||
int i;
|
int i;
|
||||||
NTSTATUS status;
|
NTSTATUS status;
|
||||||
|
|
||||||
TRACE("called.\n");
|
status = openTcpFile(&tcpFile, FILE_READ_DATA);
|
||||||
|
if (!NT_SUCCESS(status))
|
||||||
status = openTcpFile( &tcpFile, FILE_READ_DATA );
|
|
||||||
|
|
||||||
if( !NT_SUCCESS(status) ) {
|
|
||||||
TRACE("failure: %08x\n", (int)status );
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
|
||||||
|
|
||||||
status = tdiGetEntityIDSet( tcpFile, &entitySet, &numEntities );
|
status = tdiGetEntityIDSet(tcpFile, &entitySet, &numEntities);
|
||||||
|
if (!NT_SUCCESS(status)) {
|
||||||
if( !NT_SUCCESS(status) ) {
|
|
||||||
TRACE("failure: %08x\n", (int)status );
|
|
||||||
closeTcpFile( tcpFile );
|
closeTcpFile( tcpFile );
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
for( i = 0; i < numEntities; i++ ) {
|
for (i = 0; i < numEntities; i++) {
|
||||||
if( isIpEntity( tcpFile, &entitySet[i] ) ) {
|
if (isIpEntity(tcpFile, &entitySet[i])) {
|
||||||
IPSNMPInfo isnmp;
|
IPSNMPInfo isnmp;
|
||||||
memset( &isnmp, 0, sizeof( isnmp ) );
|
memset(&isnmp, 0, sizeof(isnmp));
|
||||||
status = tdiGetMibForIpEntity( tcpFile, &entitySet[i], &isnmp );
|
status = tdiGetMibForIpEntity(tcpFile, &entitySet[i], &isnmp);
|
||||||
if( !NT_SUCCESS(status) ) {
|
if (!NT_SUCCESS(status)) {
|
||||||
tdiFreeThingSet( entitySet );
|
numRoutes = 0;
|
||||||
closeTcpFile( tcpFile );
|
break;
|
||||||
return status;
|
|
||||||
}
|
}
|
||||||
numRoutes += isnmp.ipsi_numroutes;
|
numRoutes += isnmp.ipsi_numroutes;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TRACE("numRoutes: %d\n", (int)numRoutes);
|
tdiFreeThingSet(entitySet);
|
||||||
|
closeTcpFile(tcpFile);
|
||||||
tdiFreeThingSet( entitySet );
|
|
||||||
closeTcpFile( tcpFile );
|
|
||||||
|
|
||||||
return numRoutes;
|
return numRoutes;
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID HexDump( PCHAR Data, DWORD Len ) {
|
|
||||||
int i;
|
|
||||||
|
|
||||||
for( i = 0; i < Len; i++ ) {
|
|
||||||
if( !(i & 0xf) ) {
|
|
||||||
if( i ) fprintf(stderr,"\n");
|
|
||||||
fprintf(stderr,"%08x:", i);
|
|
||||||
}
|
|
||||||
fprintf( stderr, " %02x", Data[i] & 0xff );
|
|
||||||
}
|
|
||||||
fprintf(stderr,"\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
RouteTable *getRouteTable(void)
|
RouteTable *getRouteTable(void)
|
||||||
{
|
{
|
||||||
RouteTable *out_route_table;
|
RouteTable *out_route_table;
|
||||||
DWORD numRoutes = getNumRoutes(), routesAdded = 0;
|
DWORD numRoutes = getNumRoutes(), routesAdded = 0;
|
||||||
TDIEntityID ent;
|
TDIEntityID ent;
|
||||||
HANDLE tcpFile;
|
HANDLE tcpFile;
|
||||||
NTSTATUS status = openTcpFile( &tcpFile, FILE_READ_DATA );
|
NTSTATUS status = openTcpFile(&tcpFile, FILE_READ_DATA);
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if( !NT_SUCCESS(status) )
|
if (!NT_SUCCESS(status))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
TRACE("GETTING ROUTE TABLE\n");
|
out_route_table = HeapAlloc(GetProcessHeap(), 0,
|
||||||
|
|
||||||
out_route_table = HeapAlloc( GetProcessHeap(), 0,
|
|
||||||
sizeof(RouteTable) +
|
sizeof(RouteTable) +
|
||||||
(sizeof(RouteEntry) * (numRoutes - 1)) );
|
(sizeof(RouteEntry) * (numRoutes - 1)));
|
||||||
if (!out_route_table) {
|
if (!out_route_table) {
|
||||||
closeTcpFile(tcpFile);
|
closeTcpFile(tcpFile);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -440,28 +372,20 @@ RouteTable *getRouteTable(void)
|
||||||
|
|
||||||
out_route_table->numRoutes = numRoutes;
|
out_route_table->numRoutes = numRoutes;
|
||||||
|
|
||||||
for( i = 0; routesAdded < out_route_table->numRoutes; i++ ) {
|
for (i = 0; routesAdded < out_route_table->numRoutes; i++) {
|
||||||
int j;
|
int j;
|
||||||
IPRouteEntry *route_set;
|
IPRouteEntry *route_set;
|
||||||
|
|
||||||
getNthIpEntity( tcpFile, i, &ent );
|
getNthIpEntity(tcpFile, i, &ent);
|
||||||
|
|
||||||
tdiGetRoutesForIpEntity( tcpFile, &ent, &route_set, &numRoutes );
|
tdiGetRoutesForIpEntity(tcpFile, &ent, &route_set, &numRoutes);
|
||||||
|
if (!route_set) {
|
||||||
if( !route_set ) {
|
closeTcpFile(tcpFile);
|
||||||
closeTcpFile( tcpFile );
|
HeapFree(GetProcessHeap(), 0, out_route_table);
|
||||||
HeapFree( GetProcessHeap(), 0, out_route_table );
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
TRACE( "%d routes in instance %d\n", numRoutes, i );
|
for (j = 0; j < numRoutes; j++) {
|
||||||
#if 0
|
|
||||||
HexDump( route_set,
|
|
||||||
sizeof( IPRouteEntry ) *
|
|
||||||
snmpInfo.ipsi_numroutes );
|
|
||||||
#endif
|
|
||||||
|
|
||||||
for( j = 0; j < numRoutes; j++ ) {
|
|
||||||
int routeNum = j + routesAdded;
|
int routeNum = j + routesAdded;
|
||||||
out_route_table->routes[routeNum].dest =
|
out_route_table->routes[routeNum].dest =
|
||||||
route_set[j].ire_dest;
|
route_set[j].ire_dest;
|
||||||
|
@ -475,15 +399,12 @@ RouteTable *getRouteTable(void)
|
||||||
route_set[j].ire_metric1;
|
route_set[j].ire_metric1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( route_set ) tdiFreeThingSet( route_set );
|
if (route_set) tdiFreeThingSet(route_set);
|
||||||
|
|
||||||
routesAdded += numRoutes;
|
routesAdded += numRoutes;
|
||||||
}
|
}
|
||||||
|
|
||||||
closeTcpFile( tcpFile );
|
closeTcpFile(tcpFile);
|
||||||
|
|
||||||
TRACE("Return: %08x, %08x\n", status, out_route_table);
|
|
||||||
|
|
||||||
return out_route_table;
|
return out_route_table;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -497,22 +418,16 @@ DWORD getNumArpEntries(void)
|
||||||
PMIB_IPNETROW IpArpTable = NULL;
|
PMIB_IPNETROW IpArpTable = NULL;
|
||||||
DWORD returnSize;
|
DWORD returnSize;
|
||||||
|
|
||||||
TRACE("called.\n");
|
status = openTcpFile(&tcpFile, FILE_READ_DATA);
|
||||||
|
if (!NT_SUCCESS(status))
|
||||||
status = openTcpFile( &tcpFile, FILE_READ_DATA );
|
|
||||||
|
|
||||||
if( !NT_SUCCESS(status) ) {
|
|
||||||
TRACE("failure: %08x\n", (int)status );
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
|
||||||
|
|
||||||
status = tdiGetEntityIDSet( tcpFile, &entitySet, &numEntities );
|
status = tdiGetEntityIDSet(tcpFile, &entitySet, &numEntities);
|
||||||
|
|
||||||
for( i = 0; i < numEntities; i++ ) {
|
for (i = 0; i < numEntities; i++) {
|
||||||
if( isInterface( &entitySet[i] ) &&
|
if (isInterface(&entitySet[i]) && hasArp(tcpFile, &entitySet[i]))
|
||||||
hasArp( tcpFile, &entitySet[i] ) ) {
|
{
|
||||||
|
status = tdiGetSetOfThings(tcpFile,
|
||||||
status = tdiGetSetOfThings( tcpFile,
|
|
||||||
INFO_CLASS_PROTOCOL,
|
INFO_CLASS_PROTOCOL,
|
||||||
INFO_TYPE_PROVIDER,
|
INFO_TYPE_PROVIDER,
|
||||||
IP_MIB_ARPTABLE_ENTRY_ID,
|
IP_MIB_ARPTABLE_ENTRY_ID,
|
||||||
|
@ -521,19 +436,18 @@ DWORD getNumArpEntries(void)
|
||||||
0,
|
0,
|
||||||
sizeof(MIB_IPNETROW),
|
sizeof(MIB_IPNETROW),
|
||||||
(PVOID *)&IpArpTable,
|
(PVOID *)&IpArpTable,
|
||||||
&returnSize );
|
&returnSize);
|
||||||
|
|
||||||
if( status == STATUS_SUCCESS ) totalNumber += returnSize;
|
if (status == STATUS_SUCCESS) totalNumber += returnSize;
|
||||||
if( IpArpTable ) {
|
if (IpArpTable) {
|
||||||
tdiFreeThingSet( IpArpTable );
|
tdiFreeThingSet(IpArpTable);
|
||||||
IpArpTable = NULL;
|
IpArpTable = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
closeTcpFile( tcpFile );
|
closeTcpFile(tcpFile);
|
||||||
if( IpArpTable ) tdiFreeThingSet( IpArpTable );
|
if (entitySet) tdiFreeThingSet(entitySet);
|
||||||
if( entitySet ) tdiFreeThingSet( entitySet );
|
|
||||||
return totalNumber;
|
return totalNumber;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -547,32 +461,25 @@ PMIB_IPNETTABLE getArpTable(void)
|
||||||
PMIB_IPNETTABLE IpArpTable = NULL;
|
PMIB_IPNETTABLE IpArpTable = NULL;
|
||||||
PMIB_IPNETROW AdapterArpTable = NULL;
|
PMIB_IPNETROW AdapterArpTable = NULL;
|
||||||
|
|
||||||
TRACE("called.\n");
|
|
||||||
|
|
||||||
totalNumber = getNumArpEntries();
|
totalNumber = getNumArpEntries();
|
||||||
|
|
||||||
status = openTcpFile( &tcpFile, FILE_READ_DATA );
|
status = openTcpFile(&tcpFile, FILE_READ_DATA);
|
||||||
|
if (!NT_SUCCESS(status))
|
||||||
if( !NT_SUCCESS(status) ) {
|
|
||||||
TRACE("failure: %08x\n", (int)status );
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
|
||||||
|
|
||||||
IpArpTable = HeapAlloc
|
IpArpTable = HeapAlloc(GetProcessHeap(), 0,
|
||||||
( GetProcessHeap(), 0,
|
sizeof(DWORD) + (sizeof(MIB_IPNETROW) * totalNumber));
|
||||||
sizeof(DWORD) + (sizeof(MIB_IPNETROW) * totalNumber) );
|
|
||||||
if (!IpArpTable) {
|
if (!IpArpTable) {
|
||||||
closeTcpFile(tcpFile);
|
closeTcpFile(tcpFile);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
status = tdiGetEntityIDSet( tcpFile, &entitySet, &numEntities );
|
status = tdiGetEntityIDSet(tcpFile, &entitySet, &numEntities);
|
||||||
|
|
||||||
for( i = 0; i < numEntities; i++ ) {
|
for (i = 0; i < numEntities; i++) {
|
||||||
if( isInterface( &entitySet[i] ) &&
|
if (isInterface(&entitySet[i]) && hasArp(tcpFile, &entitySet[i]))
|
||||||
hasArp( tcpFile, &entitySet[i] ) ) {
|
{
|
||||||
|
status = tdiGetSetOfThings(tcpFile,
|
||||||
status = tdiGetSetOfThings( tcpFile,
|
|
||||||
INFO_CLASS_PROTOCOL,
|
INFO_CLASS_PROTOCOL,
|
||||||
INFO_TYPE_PROVIDER,
|
INFO_TYPE_PROVIDER,
|
||||||
IP_MIB_ARPTABLE_ENTRY_ID,
|
IP_MIB_ARPTABLE_ENTRY_ID,
|
||||||
|
@ -581,82 +488,229 @@ PMIB_IPNETTABLE getArpTable(void)
|
||||||
0,
|
0,
|
||||||
sizeof(MIB_IPNETROW),
|
sizeof(MIB_IPNETROW),
|
||||||
(PVOID *)&AdapterArpTable,
|
(PVOID *)&AdapterArpTable,
|
||||||
&returnSize );
|
&returnSize);
|
||||||
|
|
||||||
if( status == STATUS_SUCCESS ) {
|
if (status == STATUS_SUCCESS) {
|
||||||
for( TmpIdx = 0; TmpIdx < returnSize; TmpIdx++, CurrIdx++ )
|
for (TmpIdx = 0; TmpIdx < returnSize; TmpIdx++, CurrIdx++)
|
||||||
IpArpTable->table[CurrIdx] = AdapterArpTable[TmpIdx];
|
IpArpTable->table[CurrIdx] = AdapterArpTable[TmpIdx];
|
||||||
tdiFreeThingSet( AdapterArpTable );
|
tdiFreeThingSet(AdapterArpTable);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
closeTcpFile( tcpFile );
|
closeTcpFile(tcpFile);
|
||||||
|
tdiFreeThingSet(entitySet);
|
||||||
tdiFreeThingSet( entitySet );
|
|
||||||
IpArpTable->dwNumEntries = CurrIdx;
|
IpArpTable->dwNumEntries = CurrIdx;
|
||||||
|
|
||||||
return IpArpTable;
|
return IpArpTable;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct _TABLE_CALL
|
||||||
|
{
|
||||||
|
DWORD TOIID;
|
||||||
|
SIZE_T UdpSize;
|
||||||
|
SIZE_T TcpSize;
|
||||||
|
SIZE_T UdpOffset;
|
||||||
|
SIZE_T TcpOffset;
|
||||||
|
} UdpTcpTableCall[] = {
|
||||||
|
{IP_MIB_ARPTABLE_ENTRY_ID, sizeof(MIB_UDPROW), sizeof(MIB_TCPROW), FIELD_OFFSET(MIB_UDPTABLE, table), FIELD_OFFSET(MIB_TCPTABLE, table)},
|
||||||
|
{IP_MIB_ADDRTABLE_ENTRY_ID, sizeof(MIB_UDPROW_OWNER_PID), sizeof(MIB_TCPROW_OWNER_PID), FIELD_OFFSET(MIB_UDPTABLE_OWNER_PID, table), FIELD_OFFSET(MIB_TCPTABLE_OWNER_PID, table)},
|
||||||
|
{IP_SPECIFIC_MODULE_ENTRY_ID, sizeof(MIB_UDPROW_OWNER_MODULE), sizeof(MIB_TCPROW_OWNER_MODULE), FIELD_OFFSET(MIB_UDPTABLE_OWNER_MODULE, table), FIELD_OFFSET(MIB_TCPTABLE_OWNER_MODULE, table)},
|
||||||
|
};
|
||||||
|
|
||||||
|
#define Add2Ptr(PTR, INC) (PVOID)((ULONG_PTR)(PTR) + (INC))
|
||||||
|
|
||||||
DWORD getNumUdpEntries(void)
|
DWORD getNumUdpEntries(void)
|
||||||
{
|
{
|
||||||
return getNumWithOneHeader("/proc/net/udp");
|
DWORD numEntities;
|
||||||
|
TDIEntityID *entitySet = NULL;
|
||||||
|
HANDLE tcpFile;
|
||||||
|
int i, totalNumber = 0;
|
||||||
|
NTSTATUS status;
|
||||||
|
PMIB_UDPROW IpUdpTable = NULL;
|
||||||
|
DWORD returnSize;
|
||||||
|
|
||||||
|
status = openTcpFile(&tcpFile, FILE_READ_DATA);
|
||||||
|
if (!NT_SUCCESS(status))
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
status = tdiGetEntityIDSet(tcpFile, &entitySet, &numEntities);
|
||||||
|
|
||||||
|
for (i = 0; i < numEntities; i++) {
|
||||||
|
if (entitySet[i].tei_entity == CL_TL_ENTITY && hasArp(tcpFile, &entitySet[i]))
|
||||||
|
{
|
||||||
|
status = tdiGetSetOfThings(tcpFile,
|
||||||
|
INFO_CLASS_PROTOCOL,
|
||||||
|
INFO_TYPE_PROVIDER,
|
||||||
|
IP_MIB_ARPTABLE_ENTRY_ID,
|
||||||
|
CL_TL_ENTITY,
|
||||||
|
entitySet[i].tei_instance,
|
||||||
|
0,
|
||||||
|
sizeof(MIB_UDPROW),
|
||||||
|
(PVOID *)&IpUdpTable,
|
||||||
|
&returnSize);
|
||||||
|
|
||||||
|
if (status == STATUS_SUCCESS) totalNumber += returnSize;
|
||||||
|
if (IpUdpTable) {
|
||||||
|
tdiFreeThingSet(IpUdpTable);
|
||||||
|
IpUdpTable = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
closeTcpFile(tcpFile);
|
||||||
|
if (entitySet) tdiFreeThingSet(entitySet);
|
||||||
|
return totalNumber;
|
||||||
}
|
}
|
||||||
|
|
||||||
PMIB_UDPTABLE getUdpTable(void)
|
PVOID getUdpTable(CLASS_TABLE Class)
|
||||||
{
|
{
|
||||||
DWORD numEntries = getNumUdpEntries();
|
DWORD numEntities, returnSize;
|
||||||
PMIB_UDPTABLE ret;
|
TDIEntityID *entitySet;
|
||||||
|
HANDLE tcpFile;
|
||||||
|
int i, totalNumber, TmpIdx, CurrIdx = 0;
|
||||||
|
NTSTATUS status;
|
||||||
|
PMIB_UDPTABLE IpUdpTable = NULL;
|
||||||
|
PVOID AdapterUdpTable = NULL;
|
||||||
|
|
||||||
ret = (PMIB_UDPTABLE)calloc(1, sizeof(MIB_UDPTABLE) +
|
totalNumber = getNumUdpEntries();
|
||||||
(numEntries - 1) * sizeof(MIB_UDPROW));
|
|
||||||
if (ret) {
|
|
||||||
FILE *fp;
|
|
||||||
|
|
||||||
/* get from /proc/net/udp, no error if can't */
|
status = openTcpFile(&tcpFile, FILE_READ_DATA);
|
||||||
fp = fopen("/proc/net/udp", "r");
|
if (!NT_SUCCESS(status))
|
||||||
if (fp) {
|
return 0;
|
||||||
char buf[512] = { 0 }, *ptr;
|
|
||||||
|
|
||||||
/* skip header line */
|
IpUdpTable = HeapAlloc(GetProcessHeap(), 0,
|
||||||
ptr = fgets(buf, sizeof(buf), fp);
|
UdpTcpTableCall[Class].UdpOffset + (UdpTcpTableCall[Class].UdpSize * totalNumber));
|
||||||
while (ptr && ret->dwNumEntries < numEntries) {
|
if (!IpUdpTable) {
|
||||||
ptr = fgets(buf, sizeof(buf), fp);
|
closeTcpFile(tcpFile);
|
||||||
if (ptr) {
|
return NULL;
|
||||||
char *endPtr;
|
}
|
||||||
|
|
||||||
if (ptr && *ptr) {
|
status = tdiGetEntityIDSet(tcpFile, &entitySet, &numEntities);
|
||||||
strtoul(ptr, &endPtr, 16); /* skip */
|
|
||||||
ptr = endPtr;
|
for (i = 0; i < numEntities; i++) {
|
||||||
}
|
if (entitySet[i].tei_entity == CL_TL_ENTITY && hasArp(tcpFile, &entitySet[i]))
|
||||||
if (ptr && *ptr) {
|
{
|
||||||
ptr++;
|
status = tdiGetSetOfThings(tcpFile,
|
||||||
ret->table[ret->dwNumEntries].dwLocalAddr = strtoul(ptr, &endPtr,
|
INFO_CLASS_PROTOCOL,
|
||||||
16);
|
INFO_TYPE_PROVIDER,
|
||||||
ptr = endPtr;
|
UdpTcpTableCall[Class].TOIID,
|
||||||
}
|
CL_TL_ENTITY,
|
||||||
if (ptr && *ptr) {
|
entitySet[i].tei_instance,
|
||||||
ptr++;
|
0,
|
||||||
ret->table[ret->dwNumEntries].dwLocalPort = strtoul(ptr, &endPtr,
|
UdpTcpTableCall[Class].UdpSize,
|
||||||
16);
|
&AdapterUdpTable,
|
||||||
ptr = endPtr;
|
&returnSize);
|
||||||
}
|
|
||||||
ret->dwNumEntries++;
|
if (status == STATUS_SUCCESS) {
|
||||||
|
for (TmpIdx = 0; TmpIdx < returnSize; TmpIdx++, CurrIdx++)
|
||||||
|
CopyMemory(Add2Ptr(IpUdpTable, UdpTcpTableCall[Class].UdpOffset + UdpTcpTableCall[Class].UdpSize * CurrIdx),
|
||||||
|
Add2Ptr(AdapterUdpTable, UdpTcpTableCall[Class].UdpSize * TmpIdx),
|
||||||
|
UdpTcpTableCall[Class].UdpSize);
|
||||||
|
tdiFreeThingSet(AdapterUdpTable);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fclose(fp);
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return ret;
|
closeTcpFile(tcpFile);
|
||||||
|
tdiFreeThingSet(entitySet);
|
||||||
|
IpUdpTable->dwNumEntries = CurrIdx;
|
||||||
|
return IpUdpTable;
|
||||||
}
|
}
|
||||||
|
|
||||||
DWORD getNumTcpEntries(void)
|
DWORD getNumTcpEntries(void)
|
||||||
{
|
{
|
||||||
return getNumWithOneHeader("/proc/net/tcp");
|
DWORD numEntities;
|
||||||
|
TDIEntityID *entitySet = NULL;
|
||||||
|
HANDLE tcpFile;
|
||||||
|
int i, totalNumber = 0;
|
||||||
|
NTSTATUS status;
|
||||||
|
PMIB_TCPROW IpTcpTable = NULL;
|
||||||
|
DWORD returnSize;
|
||||||
|
|
||||||
|
status = openTcpFile(&tcpFile, FILE_READ_DATA);
|
||||||
|
if (!NT_SUCCESS(status))
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
status = tdiGetEntityIDSet(tcpFile, &entitySet, &numEntities);
|
||||||
|
|
||||||
|
for (i = 0; i < numEntities; i++) {
|
||||||
|
if (entitySet[i].tei_entity == CO_TL_ENTITY && hasArp(tcpFile, &entitySet[i]))
|
||||||
|
{
|
||||||
|
status = tdiGetSetOfThings(tcpFile,
|
||||||
|
INFO_CLASS_PROTOCOL,
|
||||||
|
INFO_TYPE_PROVIDER,
|
||||||
|
IP_MIB_ARPTABLE_ENTRY_ID,
|
||||||
|
CO_TL_ENTITY,
|
||||||
|
entitySet[i].tei_instance,
|
||||||
|
0,
|
||||||
|
sizeof(MIB_TCPROW),
|
||||||
|
(PVOID *)&IpTcpTable,
|
||||||
|
&returnSize);
|
||||||
|
|
||||||
|
if (status == STATUS_SUCCESS) totalNumber += returnSize;
|
||||||
|
if (IpTcpTable) {
|
||||||
|
tdiFreeThingSet(IpTcpTable);
|
||||||
|
IpTcpTable = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
closeTcpFile(tcpFile);
|
||||||
|
if (entitySet) tdiFreeThingSet(entitySet);
|
||||||
|
return totalNumber;
|
||||||
}
|
}
|
||||||
|
|
||||||
PMIB_TCPTABLE getTcpTable(void)
|
PVOID getTcpTable(CLASS_TABLE Class)
|
||||||
{
|
{
|
||||||
|
DWORD numEntities, returnSize;
|
||||||
|
TDIEntityID *entitySet;
|
||||||
|
HANDLE tcpFile;
|
||||||
|
int i, totalNumber, TmpIdx, CurrIdx = 0;
|
||||||
|
NTSTATUS status;
|
||||||
|
PMIB_TCPTABLE IpTcpTable = NULL;
|
||||||
|
PVOID AdapterTcpTable = NULL;
|
||||||
|
|
||||||
|
totalNumber = getNumTcpEntries();
|
||||||
|
|
||||||
|
status = openTcpFile(&tcpFile, FILE_READ_DATA);
|
||||||
|
if (!NT_SUCCESS(status))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
IpTcpTable = HeapAlloc(GetProcessHeap(), 0,
|
||||||
|
UdpTcpTableCall[Class].TcpOffset + (UdpTcpTableCall[Class].TcpSize * totalNumber));
|
||||||
|
if (!IpTcpTable) {
|
||||||
|
closeTcpFile(tcpFile);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
status = tdiGetEntityIDSet(tcpFile, &entitySet, &numEntities);
|
||||||
|
|
||||||
|
for (i = 0; i < numEntities; i++) {
|
||||||
|
if (entitySet[i].tei_entity == CO_TL_ENTITY && hasArp(tcpFile, &entitySet[i]))
|
||||||
|
{
|
||||||
|
status = tdiGetSetOfThings(tcpFile,
|
||||||
|
INFO_CLASS_PROTOCOL,
|
||||||
|
INFO_TYPE_PROVIDER,
|
||||||
|
UdpTcpTableCall[Class].TOIID,
|
||||||
|
CO_TL_ENTITY,
|
||||||
|
entitySet[i].tei_instance,
|
||||||
|
0,
|
||||||
|
UdpTcpTableCall[Class].TcpSize,
|
||||||
|
&AdapterTcpTable,
|
||||||
|
&returnSize);
|
||||||
|
|
||||||
|
if (status == STATUS_SUCCESS) {
|
||||||
|
for (TmpIdx = 0; TmpIdx < returnSize; TmpIdx++, CurrIdx++)
|
||||||
|
CopyMemory(Add2Ptr(IpTcpTable, UdpTcpTableCall[Class].TcpOffset + UdpTcpTableCall[Class].TcpSize * CurrIdx),
|
||||||
|
Add2Ptr(AdapterTcpTable, UdpTcpTableCall[Class].TcpSize * TmpIdx),
|
||||||
|
UdpTcpTableCall[Class].TcpSize);
|
||||||
|
tdiFreeThingSet(AdapterTcpTable);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
closeTcpFile(tcpFile);
|
||||||
|
tdiFreeThingSet(entitySet);
|
||||||
|
IpTcpTable->dwNumEntries = CurrIdx;
|
||||||
|
return IpTcpTable;
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,6 +8,10 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <tcpioctl.h>
|
#include <tcpioctl.h>
|
||||||
|
#define DWORD ULONG
|
||||||
|
#include <in6addr.h>
|
||||||
|
#include <tcpmib.h>
|
||||||
|
#include <udpmib.h>
|
||||||
|
|
||||||
#define MAX_PHYSADDR_LEN 8
|
#define MAX_PHYSADDR_LEN 8
|
||||||
#define MAX_IFDESCR_LEN 256
|
#define MAX_IFDESCR_LEN 256
|
||||||
|
@ -109,6 +113,16 @@ 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,
|
||||||
|
BOOLEAN Extended);
|
||||||
|
|
||||||
|
TDI_STATUS InfoTdiQueryGetConnectionUdpTable(PADDRESS_FILE AddrFile,
|
||||||
|
PNDIS_BUFFER Buffer,
|
||||||
|
PUINT BufferSize,
|
||||||
|
BOOLEAN Extended);
|
||||||
|
|
||||||
TDI_STATUS InfoTdiSetRoute(PIP_INTERFACE IF,
|
TDI_STATUS InfoTdiSetRoute(PIP_INTERFACE IF,
|
||||||
PVOID Buffer,
|
PVOID Buffer,
|
||||||
UINT BufferSize);
|
UINT BufferSize);
|
||||||
|
|
|
@ -216,3 +216,5 @@ VOID CompleteBucket(PCONNECTION_ENDPOINT Connection, PTDI_BUCKET Bucket, const B
|
||||||
|
|
||||||
void
|
void
|
||||||
LibTCPDumpPcb(PVOID SocketContext);
|
LibTCPDumpPcb(PVOID SocketContext);
|
||||||
|
|
||||||
|
NTSTATUS TCPGetSocketStatus(PCONNECTION_ENDPOINT Connection, PULONG State);
|
||||||
|
|
|
@ -154,6 +154,7 @@ typedef struct _ADDRESS_FILE {
|
||||||
/* Associated listener (see transport/tcp/accept.c) */
|
/* Associated listener (see transport/tcp/accept.c) */
|
||||||
IP_ADDRESS AddrCache; /* One entry address cache (destination
|
IP_ADDRESS AddrCache; /* One entry address cache (destination
|
||||||
address of last packet transmitted) */
|
address of last packet transmitted) */
|
||||||
|
HANDLE ProcessId;
|
||||||
|
|
||||||
/* The following members are used to control event notification */
|
/* The following members are used to control event notification */
|
||||||
|
|
||||||
|
|
|
@ -58,8 +58,6 @@ TDI_STATUS SetAddressFileInfo(TDIObjectID *ID,
|
||||||
return TDI_SUCCESS;
|
return TDI_SUCCESS;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
DbgPrint("Unimplemented option %x\n", ID->toi_id);
|
|
||||||
|
|
||||||
return TDI_INVALID_REQUEST;
|
return TDI_INVALID_REQUEST;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -252,14 +252,6 @@ PADDRESS_FILE AddrSearchNext(
|
||||||
|
|
||||||
IPAddress = &Current->Address;
|
IPAddress = &Current->Address;
|
||||||
|
|
||||||
TI_DbgPrint(DEBUG_ADDRFILE, ("Comparing: ((%d, %d, %s), (%d, %d, %s)).\n",
|
|
||||||
WN2H(Current->Port),
|
|
||||||
Current->Protocol,
|
|
||||||
A2S(IPAddress),
|
|
||||||
WN2H(SearchContext->Port),
|
|
||||||
SearchContext->Protocol,
|
|
||||||
A2S(SearchContext->Address)));
|
|
||||||
|
|
||||||
/* See if this address matches the search criteria */
|
/* See if this address matches the search criteria */
|
||||||
if ((Current->Port == SearchContext->Port) &&
|
if ((Current->Port == SearchContext->Port) &&
|
||||||
(Current->Protocol == SearchContext->Protocol) &&
|
(Current->Protocol == SearchContext->Protocol) &&
|
||||||
|
@ -309,8 +301,6 @@ VOID AddrFileFree(
|
||||||
PDATAGRAM_SEND_REQUEST SendRequest;
|
PDATAGRAM_SEND_REQUEST SendRequest;
|
||||||
PLIST_ENTRY CurrentEntry;
|
PLIST_ENTRY CurrentEntry;
|
||||||
|
|
||||||
TI_DbgPrint(MID_TRACE, ("Called.\n"));
|
|
||||||
|
|
||||||
/* We should not be associated with a connection here */
|
/* We should not be associated with a connection here */
|
||||||
ASSERT(!AddrFile->Connection);
|
ASSERT(!AddrFile->Connection);
|
||||||
|
|
||||||
|
@ -323,8 +313,6 @@ VOID AddrFileFree(
|
||||||
|
|
||||||
/* Return pending requests with error */
|
/* Return pending requests with error */
|
||||||
|
|
||||||
TI_DbgPrint(DEBUG_ADDRFILE, ("Aborting receive requests on AddrFile at (0x%X).\n", AddrFile));
|
|
||||||
|
|
||||||
/* Go through pending receive request list and cancel them all */
|
/* Go through pending receive request list and cancel them all */
|
||||||
while ((CurrentEntry = ExInterlockedRemoveHeadList(&AddrFile->ReceiveQueue, &AddrFile->Lock))) {
|
while ((CurrentEntry = ExInterlockedRemoveHeadList(&AddrFile->ReceiveQueue, &AddrFile->Lock))) {
|
||||||
ReceiveRequest = CONTAINING_RECORD(CurrentEntry, DATAGRAM_RECEIVE_REQUEST, ListEntry);
|
ReceiveRequest = CONTAINING_RECORD(CurrentEntry, DATAGRAM_RECEIVE_REQUEST, ListEntry);
|
||||||
|
@ -332,8 +320,6 @@ VOID AddrFileFree(
|
||||||
/* ExFreePoolWithTag(ReceiveRequest, DATAGRAM_RECV_TAG); FIXME: WTF? */
|
/* ExFreePoolWithTag(ReceiveRequest, DATAGRAM_RECV_TAG); FIXME: WTF? */
|
||||||
}
|
}
|
||||||
|
|
||||||
TI_DbgPrint(DEBUG_ADDRFILE, ("Aborting send requests on address file at (0x%X).\n", AddrFile));
|
|
||||||
|
|
||||||
/* Go through pending send request list and cancel them all */
|
/* Go through pending send request list and cancel them all */
|
||||||
while ((CurrentEntry = ExInterlockedRemoveHeadList(&AddrFile->ReceiveQueue, &AddrFile->Lock))) {
|
while ((CurrentEntry = ExInterlockedRemoveHeadList(&AddrFile->ReceiveQueue, &AddrFile->Lock))) {
|
||||||
SendRequest = CONTAINING_RECORD(CurrentEntry, DATAGRAM_SEND_REQUEST, ListEntry);
|
SendRequest = CONTAINING_RECORD(CurrentEntry, DATAGRAM_SEND_REQUEST, ListEntry);
|
||||||
|
@ -393,8 +379,6 @@ NTSTATUS FileOpenAddress(
|
||||||
{
|
{
|
||||||
PADDRESS_FILE AddrFile;
|
PADDRESS_FILE AddrFile;
|
||||||
|
|
||||||
TI_DbgPrint(MID_TRACE, ("Called (Proto %d).\n", Protocol));
|
|
||||||
|
|
||||||
/* If it's shared and has a port specified, look for a match */
|
/* If it's shared and has a port specified, look for a match */
|
||||||
if ((Shared != FALSE) && (Address->Address[0].Address[0].sin_port != 0))
|
if ((Shared != FALSE) && (Address->Address[0].Address[0].sin_port != 0))
|
||||||
{
|
{
|
||||||
|
@ -424,6 +408,7 @@ NTSTATUS FileOpenAddress(
|
||||||
AddrFile->DF = 0;
|
AddrFile->DF = 0;
|
||||||
AddrFile->BCast = 1;
|
AddrFile->BCast = 1;
|
||||||
AddrFile->HeaderIncl = 1;
|
AddrFile->HeaderIncl = 1;
|
||||||
|
AddrFile->ProcessId = PsGetCurrentProcessId();
|
||||||
|
|
||||||
/* Make sure address is a local unicast address or 0 */
|
/* Make sure address is a local unicast address or 0 */
|
||||||
/* FIXME: IPv4 only */
|
/* FIXME: IPv4 only */
|
||||||
|
@ -438,9 +423,6 @@ NTSTATUS FileOpenAddress(
|
||||||
return STATUS_INVALID_ADDRESS;
|
return STATUS_INVALID_ADDRESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
TI_DbgPrint(MID_TRACE, ("Opening address %s for communication (P=%d U=%d).\n",
|
|
||||||
A2S(&AddrFile->Address), Protocol, IPPROTO_UDP));
|
|
||||||
|
|
||||||
/* Protocol specific handling */
|
/* Protocol specific handling */
|
||||||
switch (Protocol) {
|
switch (Protocol) {
|
||||||
case IPPROTO_TCP:
|
case IPPROTO_TCP:
|
||||||
|
@ -483,7 +465,6 @@ NTSTATUS FileOpenAddress(
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case IPPROTO_UDP:
|
case IPPROTO_UDP:
|
||||||
TI_DbgPrint(MID_TRACE,("Allocating udp port\n"));
|
|
||||||
AddrFile->Port =
|
AddrFile->Port =
|
||||||
UDPAllocatePort(Address->Address[0].Address[0].sin_port);
|
UDPAllocatePort(Address->Address[0].Address[0].sin_port);
|
||||||
|
|
||||||
|
@ -495,10 +476,6 @@ NTSTATUS FileOpenAddress(
|
||||||
return STATUS_ADDRESS_ALREADY_EXISTS;
|
return STATUS_ADDRESS_ALREADY_EXISTS;
|
||||||
}
|
}
|
||||||
|
|
||||||
TI_DbgPrint(MID_TRACE,("Setting port %d (wanted %d)\n",
|
|
||||||
AddrFile->Port,
|
|
||||||
Address->Address[0].Address[0].sin_port));
|
|
||||||
|
|
||||||
AddEntity(CL_TL_ENTITY, AddrFile, CL_TL_UDP);
|
AddEntity(CL_TL_ENTITY, AddrFile, CL_TL_UDP);
|
||||||
|
|
||||||
AddrFile->Send = UDPSendDatagram;
|
AddrFile->Send = UDPSendDatagram;
|
||||||
|
@ -522,12 +499,6 @@ NTSTATUS FileOpenAddress(
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
TI_DbgPrint(MID_TRACE, ("IP protocol number for address file object is %d.\n",
|
|
||||||
Protocol));
|
|
||||||
|
|
||||||
TI_DbgPrint(MID_TRACE, ("Port number for address file object is %d.\n",
|
|
||||||
WN2H(AddrFile->Port)));
|
|
||||||
|
|
||||||
/* Set protocol */
|
/* Set protocol */
|
||||||
AddrFile->Protocol = Protocol;
|
AddrFile->Protocol = Protocol;
|
||||||
|
|
||||||
|
@ -547,8 +518,6 @@ NTSTATUS FileOpenAddress(
|
||||||
&AddrFile->ListEntry,
|
&AddrFile->ListEntry,
|
||||||
&AddressFileListLock);
|
&AddressFileListLock);
|
||||||
|
|
||||||
TI_DbgPrint(MAX_TRACE, ("Leaving.\n"));
|
|
||||||
|
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -587,8 +556,6 @@ NTSTATUS FileCloseAddress(
|
||||||
|
|
||||||
DereferenceObject(AddrFile);
|
DereferenceObject(AddrFile);
|
||||||
|
|
||||||
TI_DbgPrint(MAX_TRACE, ("Leaving.\n"));
|
|
||||||
|
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -608,8 +575,6 @@ NTSTATUS FileOpenConnection(
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
PCONNECTION_ENDPOINT Connection;
|
PCONNECTION_ENDPOINT Connection;
|
||||||
|
|
||||||
TI_DbgPrint(MID_TRACE, ("Called.\n"));
|
|
||||||
|
|
||||||
Connection = TCPAllocateConnectionEndpoint( ClientContext );
|
Connection = TCPAllocateConnectionEndpoint( ClientContext );
|
||||||
|
|
||||||
if( !Connection ) return STATUS_NO_MEMORY;
|
if( !Connection ) return STATUS_NO_MEMORY;
|
||||||
|
@ -624,8 +589,6 @@ NTSTATUS FileOpenConnection(
|
||||||
/* Return connection endpoint file object */
|
/* Return connection endpoint file object */
|
||||||
Request->Handle.ConnectionContext = Connection;
|
Request->Handle.ConnectionContext = Connection;
|
||||||
|
|
||||||
TI_DbgPrint(MAX_TRACE, ("Leaving.\n"));
|
|
||||||
|
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -641,8 +604,6 @@ NTSTATUS FileCloseConnection(
|
||||||
{
|
{
|
||||||
PCONNECTION_ENDPOINT Connection;
|
PCONNECTION_ENDPOINT Connection;
|
||||||
|
|
||||||
TI_DbgPrint(MID_TRACE, ("Called.\n"));
|
|
||||||
|
|
||||||
Connection = Request->Handle.ConnectionContext;
|
Connection = Request->Handle.ConnectionContext;
|
||||||
|
|
||||||
if (!Connection) return STATUS_INVALID_PARAMETER;
|
if (!Connection) return STATUS_INVALID_PARAMETER;
|
||||||
|
@ -651,8 +612,6 @@ NTSTATUS FileCloseConnection(
|
||||||
|
|
||||||
Request->Handle.ConnectionContext = NULL;
|
Request->Handle.ConnectionContext = NULL;
|
||||||
|
|
||||||
TI_DbgPrint(MAX_TRACE, ("Leaving.\n"));
|
|
||||||
|
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -667,7 +626,6 @@ NTSTATUS FileOpenControlChannel(
|
||||||
PTDI_REQUEST Request)
|
PTDI_REQUEST Request)
|
||||||
{
|
{
|
||||||
PCONTROL_CHANNEL ControlChannel;
|
PCONTROL_CHANNEL ControlChannel;
|
||||||
TI_DbgPrint(MID_TRACE, ("Called.\n"));
|
|
||||||
|
|
||||||
ControlChannel = ExAllocatePoolWithTag(NonPagedPool, sizeof(*ControlChannel),
|
ControlChannel = ExAllocatePoolWithTag(NonPagedPool, sizeof(*ControlChannel),
|
||||||
CONTROL_CHANNEL_TAG);
|
CONTROL_CHANNEL_TAG);
|
||||||
|
@ -695,8 +653,6 @@ NTSTATUS FileOpenControlChannel(
|
||||||
/* Return address file object */
|
/* Return address file object */
|
||||||
Request->Handle.ControlChannel = ControlChannel;
|
Request->Handle.ControlChannel = ControlChannel;
|
||||||
|
|
||||||
TI_DbgPrint(MAX_TRACE, ("Leaving.\n"));
|
|
||||||
|
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -83,7 +83,6 @@ PVOID GetContext(TDIEntityID ID)
|
||||||
if (i == EntityCount)
|
if (i == EntityCount)
|
||||||
{
|
{
|
||||||
TcpipReleaseSpinLock(&EntityListLock, OldIrql);
|
TcpipReleaseSpinLock(&EntityListLock, OldIrql);
|
||||||
DbgPrint("WARNING: Unable to get context for %d %d\n", ID.tei_entity, ID.tei_instance);
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -260,14 +259,24 @@ TDI_STATUS InfoTdiQueryInformationEx(
|
||||||
return TDI_INVALID_PARAMETER;
|
return TDI_INVALID_PARAMETER;
|
||||||
|
|
||||||
case IP_MIB_ADDRTABLE_ENTRY_ID:
|
case IP_MIB_ADDRTABLE_ENTRY_ID:
|
||||||
if (ID->toi_entity.tei_entity != CL_NL_ENTITY &&
|
|
||||||
ID->toi_entity.tei_entity != CO_NL_ENTITY)
|
|
||||||
return TDI_INVALID_PARAMETER;
|
|
||||||
|
|
||||||
if (ID->toi_type != INFO_TYPE_PROVIDER)
|
if (ID->toi_type != INFO_TYPE_PROVIDER)
|
||||||
return TDI_INVALID_PARAMETER;
|
return TDI_INVALID_PARAMETER;
|
||||||
|
|
||||||
|
if (ID->toi_entity.tei_entity == CL_NL_ENTITY ||
|
||||||
|
ID->toi_entity.tei_entity == CO_NL_ENTITY)
|
||||||
return InfoTdiQueryGetAddrTable(ID->toi_entity, Buffer, BufferSize);
|
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);
|
||||||
|
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);
|
||||||
|
else
|
||||||
|
return TDI_INVALID_PARAMETER;
|
||||||
|
else
|
||||||
|
return TDI_INVALID_PARAMETER;
|
||||||
|
|
||||||
case IP_MIB_ARPTABLE_ENTRY_ID:
|
case IP_MIB_ARPTABLE_ENTRY_ID:
|
||||||
if (ID->toi_type != INFO_TYPE_PROVIDER)
|
if (ID->toi_type != INFO_TYPE_PROVIDER)
|
||||||
|
@ -285,6 +294,16 @@ 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, FALSE);
|
||||||
|
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);
|
||||||
|
else
|
||||||
|
return TDI_INVALID_PARAMETER;
|
||||||
else
|
else
|
||||||
return TDI_INVALID_PARAMETER;
|
return TDI_INVALID_PARAMETER;
|
||||||
|
|
||||||
|
@ -371,13 +390,11 @@ TDI_STATUS InfoTdiSetInformationEx
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
DbgPrint("TCPIP: IOCTL_TCP_SET_INFORMATION_EX - Unrecognized information type for INFO_CLASS_PROTOCOL: %#x.\n", ID->toi_type);
|
|
||||||
return TDI_INVALID_PARAMETER;
|
return TDI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
DbgPrint("TCPIP: IOCTL_TCP_SET_INFORMATION_EX - Unrecognized information class %#x.\n", ID->toi_class);
|
|
||||||
return TDI_INVALID_REQUEST;
|
return TDI_INVALID_REQUEST;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,9 +23,6 @@ TDI_STATUS InfoTdiQueryGetRouteTable( PIP_INTERFACE IF, PNDIS_BUFFER Buffer, PUI
|
||||||
PIPROUTE_ENTRY RouteEntries, RtCurrent;
|
PIPROUTE_ENTRY RouteEntries, RtCurrent;
|
||||||
UINT i;
|
UINT i;
|
||||||
|
|
||||||
TI_DbgPrint(DEBUG_INFO, ("Called, routes = %d\n",
|
|
||||||
RtCount));
|
|
||||||
|
|
||||||
if (RtCount == 0)
|
if (RtCount == 0)
|
||||||
return InfoCopyOut(NULL, 0, NULL, BufferSize);
|
return InfoCopyOut(NULL, 0, NULL, BufferSize);
|
||||||
|
|
||||||
|
@ -47,7 +44,6 @@ TDI_STATUS InfoTdiQueryGetRouteTable( PIP_INTERFACE IF, PNDIS_BUFFER Buffer, PUI
|
||||||
|
|
||||||
while( RtCurrent < RouteEntries + RtCount ) {
|
while( RtCurrent < RouteEntries + RtCount ) {
|
||||||
ASSERT(RCacheCur->Router);
|
ASSERT(RCacheCur->Router);
|
||||||
|
|
||||||
RtlCopyMemory( &RtCurrent->Dest,
|
RtlCopyMemory( &RtCurrent->Dest,
|
||||||
&RCacheCur->NetworkAddress.Address,
|
&RCacheCur->NetworkAddress.Address,
|
||||||
sizeof(RtCurrent->Dest) );
|
sizeof(RtCurrent->Dest) );
|
||||||
|
@ -61,15 +57,6 @@ TDI_STATUS InfoTdiQueryGetRouteTable( PIP_INTERFACE IF, PNDIS_BUFFER Buffer, PUI
|
||||||
RtCurrent->Metric1 = RCacheCur->Metric;
|
RtCurrent->Metric1 = RCacheCur->Metric;
|
||||||
RtCurrent->Type = TDI_ADDRESS_TYPE_IP;
|
RtCurrent->Type = TDI_ADDRESS_TYPE_IP;
|
||||||
|
|
||||||
TI_DbgPrint
|
|
||||||
(DEBUG_INFO,
|
|
||||||
("%d: NA %08x NM %08x GW %08x MT %x\n",
|
|
||||||
RtCurrent - RouteEntries,
|
|
||||||
RtCurrent->Dest,
|
|
||||||
RtCurrent->Mask,
|
|
||||||
RtCurrent->Gw,
|
|
||||||
RtCurrent->Metric1 ));
|
|
||||||
|
|
||||||
TcpipAcquireSpinLock(&EntityListLock, &OldIrql);
|
TcpipAcquireSpinLock(&EntityListLock, &OldIrql);
|
||||||
for (i = 0; i < EntityCount; i++)
|
for (i = 0; i < EntityCount; i++)
|
||||||
if (EntityList[i].context == IF)
|
if (EntityList[i].context == IF)
|
||||||
|
@ -90,8 +77,6 @@ TDI_STATUS InfoTdiQueryGetRouteTable( PIP_INTERFACE IF, PNDIS_BUFFER Buffer, PUI
|
||||||
ExFreePoolWithTag( RouteEntries, ROUTE_ENTRY_TAG );
|
ExFreePoolWithTag( RouteEntries, ROUTE_ENTRY_TAG );
|
||||||
ExFreePoolWithTag( RCache, FIB_TAG );
|
ExFreePoolWithTag( RCache, FIB_TAG );
|
||||||
|
|
||||||
TI_DbgPrint(DEBUG_INFO, ("Returning %08x\n", Status));
|
|
||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -104,9 +89,6 @@ TDI_STATUS InfoTdiQueryGetAddrTable(TDIEntityID ID,
|
||||||
PIP_INTERFACE CurrentIF;
|
PIP_INTERFACE CurrentIF;
|
||||||
UINT i;
|
UINT i;
|
||||||
|
|
||||||
TI_DbgPrint(DEBUG_INFO, ("Called.\n"));
|
|
||||||
|
|
||||||
|
|
||||||
TcpipAcquireSpinLock(&EntityListLock, &OldIrql);
|
TcpipAcquireSpinLock(&EntityListLock, &OldIrql);
|
||||||
|
|
||||||
for (i = 0; i < EntityCount; i++)
|
for (i = 0; i < EntityCount; i++)
|
||||||
|
@ -161,8 +143,6 @@ TDI_STATUS InfoTdiQueryGetIPSnmpInfo( TDIEntityID ID,
|
||||||
UINT RouteCount = CountFIBs(IF);
|
UINT RouteCount = CountFIBs(IF);
|
||||||
TDI_STATUS Status = TDI_INVALID_REQUEST;
|
TDI_STATUS Status = TDI_INVALID_REQUEST;
|
||||||
|
|
||||||
TI_DbgPrint(DEBUG_INFO, ("Called.\n"));
|
|
||||||
|
|
||||||
RtlZeroMemory(&SnmpInfo, sizeof(SnmpInfo));
|
RtlZeroMemory(&SnmpInfo, sizeof(SnmpInfo));
|
||||||
|
|
||||||
SnmpInfo.ipsi_numif = IfCount;
|
SnmpInfo.ipsi_numif = IfCount;
|
||||||
|
@ -172,7 +152,80 @@ TDI_STATUS InfoTdiQueryGetIPSnmpInfo( TDIEntityID ID,
|
||||||
Status = InfoCopyOut( (PCHAR)&SnmpInfo, sizeof(SnmpInfo),
|
Status = InfoCopyOut( (PCHAR)&SnmpInfo, sizeof(SnmpInfo),
|
||||||
Buffer, BufferSize );
|
Buffer, BufferSize );
|
||||||
|
|
||||||
TI_DbgPrint(DEBUG_INFO, ("Returning %08x\n", Status));
|
return Status;
|
||||||
|
}
|
||||||
|
|
||||||
|
#define ntohs(n) ((((n) & 0xff) << 8) | (((n) & 0xff00) >> 8))
|
||||||
|
|
||||||
|
TDI_STATUS InfoTdiQueryGetConnectionTcpTable(PADDRESS_FILE AddrFile,
|
||||||
|
PNDIS_BUFFER Buffer,
|
||||||
|
PUINT BufferSize,
|
||||||
|
BOOLEAN Extended)
|
||||||
|
{
|
||||||
|
SIZE_T Size;
|
||||||
|
MIB_TCPROW_OWNER_PID TcpRow;
|
||||||
|
TDI_STATUS Status = TDI_INVALID_REQUEST;
|
||||||
|
|
||||||
|
TcpRow.dwOwningPid = HandleToUlong(AddrFile->ProcessId);
|
||||||
|
if (Extended)
|
||||||
|
Size = sizeof(MIB_TCPROW_OWNER_PID);
|
||||||
|
else
|
||||||
|
Size = sizeof(MIB_TCPROW);
|
||||||
|
|
||||||
|
if (AddrFile->Listener)
|
||||||
|
{
|
||||||
|
PADDRESS_FILE EndPoint;
|
||||||
|
|
||||||
|
EndPoint = AddrFile->Listener->AddressFile;
|
||||||
|
|
||||||
|
TcpRow.dwState = MIB_TCP_STATE_LISTEN;
|
||||||
|
TcpRow.dwLocalAddr = AddrFile->Address.Address.IPv4Address;
|
||||||
|
TcpRow.dwLocalPort = AddrFile->Port;
|
||||||
|
TcpRow.dwRemoteAddr = EndPoint->Address.Address.IPv4Address;
|
||||||
|
TcpRow.dwRemotePort = EndPoint->Port;
|
||||||
|
|
||||||
|
Status = TDI_SUCCESS;
|
||||||
|
}
|
||||||
|
else if (AddrFile->Connection && AddrFile->Connection->SocketContext)
|
||||||
|
{
|
||||||
|
TA_IP_ADDRESS EndPoint;
|
||||||
|
|
||||||
|
Status = TCPGetSockAddress(AddrFile->Connection, (PTRANSPORT_ADDRESS)&EndPoint, FALSE);
|
||||||
|
if (NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
TcpRow.dwLocalAddr = EndPoint.Address[0].Address[0].in_addr;
|
||||||
|
TcpRow.dwLocalPort = ntohs(EndPoint.Address[0].Address[0].sin_port);
|
||||||
|
|
||||||
|
Status = TCPGetSockAddress(AddrFile->Connection, (PTRANSPORT_ADDRESS)&EndPoint, TRUE);
|
||||||
|
if (NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
TcpRow.dwRemoteAddr = EndPoint.Address[0].Address[0].in_addr;
|
||||||
|
TcpRow.dwRemotePort = ntohs(EndPoint.Address[0].Address[0].sin_port);
|
||||||
|
|
||||||
|
Status = TCPGetSocketStatus(AddrFile->Connection, &TcpRow.dwState);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (NT_SUCCESS(Status))
|
||||||
|
Status = InfoCopyOut((PCHAR)&TcpRow, Size, Buffer, BufferSize);
|
||||||
|
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
|
|
||||||
|
TDI_STATUS InfoTdiQueryGetConnectionUdpTable(PADDRESS_FILE AddrFile,
|
||||||
|
PNDIS_BUFFER Buffer,
|
||||||
|
PUINT BufferSize,
|
||||||
|
BOOLEAN Extended)
|
||||||
|
{
|
||||||
|
MIB_UDPROW_OWNER_PID UdpRow;
|
||||||
|
TDI_STATUS Status = TDI_INVALID_REQUEST;
|
||||||
|
|
||||||
|
UdpRow.dwLocalAddr = AddrFile->Address.Address.IPv4Address;
|
||||||
|
UdpRow.dwLocalPort = AddrFile->Port;
|
||||||
|
UdpRow.dwOwningPid = HandleToUlong(AddrFile->ProcessId);
|
||||||
|
|
||||||
|
Status = InfoCopyOut((PCHAR)&UdpRow, (Extended ? sizeof(MIB_UDPROW_OWNER_PID) : sizeof(MIB_UDPROW)), Buffer, BufferSize);
|
||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
@ -190,20 +243,15 @@ TDI_STATUS InfoTdiSetRoute(PIP_INTERFACE IF, PVOID Buffer, UINT BufferSize)
|
||||||
return TDI_INVALID_PARAMETER;
|
return TDI_INVALID_PARAMETER;
|
||||||
|
|
||||||
if (IF == Loopback)
|
if (IF == Loopback)
|
||||||
{
|
|
||||||
DbgPrint("Failing attempt to add route to loopback adapter\n");
|
|
||||||
return TDI_INVALID_PARAMETER;
|
return TDI_INVALID_PARAMETER;
|
||||||
}
|
|
||||||
|
|
||||||
if( Route->Type == IP_ROUTE_TYPE_ADD ) { /* Add the route */
|
if( Route->Type == IP_ROUTE_TYPE_ADD ) { /* Add the route */
|
||||||
TI_DbgPrint(DEBUG_INFO,("Adding route (%s)\n", A2S(&Address)));
|
|
||||||
if (!RouterCreateRoute( &Address, &Netmask, &Router,
|
if (!RouterCreateRoute( &Address, &Netmask, &Router,
|
||||||
IF, Route->Metric1))
|
IF, Route->Metric1))
|
||||||
return TDI_NO_RESOURCES;
|
return TDI_NO_RESOURCES;
|
||||||
|
|
||||||
return TDI_SUCCESS;
|
return TDI_SUCCESS;
|
||||||
} else if( Route->Type == IP_ROUTE_TYPE_DEL ) {
|
} else if( Route->Type == IP_ROUTE_TYPE_DEL ) {
|
||||||
TI_DbgPrint(DEBUG_INFO,("Removing route (%s)\n", A2S(&Address)));
|
|
||||||
if (NT_SUCCESS(RouterRemoveRoute( &Address, &Router )))
|
if (NT_SUCCESS(RouterRemoveRoute( &Address, &Router )))
|
||||||
return TDI_SUCCESS;
|
return TDI_SUCCESS;
|
||||||
else
|
else
|
||||||
|
|
|
@ -27,6 +27,7 @@ DWORD WINAPI GetAdaptersInfo(PIP_ADAPTER_INFO,PULONG);
|
||||||
DWORD WINAPI GetBestInterface(IPAddr,PDWORD);
|
DWORD WINAPI GetBestInterface(IPAddr,PDWORD);
|
||||||
DWORD WINAPI GetBestRoute(DWORD,DWORD,PMIB_IPFORWARDROW);
|
DWORD WINAPI GetBestRoute(DWORD,DWORD,PMIB_IPFORWARDROW);
|
||||||
DWORD WINAPI GetExtendedTcpTable(PVOID,PDWORD,BOOL,ULONG,TCP_TABLE_CLASS,ULONG);
|
DWORD WINAPI GetExtendedTcpTable(PVOID,PDWORD,BOOL,ULONG,TCP_TABLE_CLASS,ULONG);
|
||||||
|
DWORD WINAPI GetExtendedUdpTable(PVOID,PDWORD,BOOL,ULONG,UDP_TABLE_CLASS,ULONG);
|
||||||
DWORD WINAPI GetFriendlyIfIndex(DWORD);
|
DWORD WINAPI GetFriendlyIfIndex(DWORD);
|
||||||
DWORD WINAPI GetIcmpStatistics(PMIB_ICMP);
|
DWORD WINAPI GetIcmpStatistics(PMIB_ICMP);
|
||||||
DWORD WINAPI GetIfEntry(PMIB_IFROW);
|
DWORD WINAPI GetIfEntry(PMIB_IFROW);
|
||||||
|
|
|
@ -51,6 +51,10 @@
|
||||||
#define IP_MIB_ARPTABLE_ENTRY_ID 0x101
|
#define IP_MIB_ARPTABLE_ENTRY_ID 0x101
|
||||||
#define IP_MIB_ADDRTABLE_ENTRY_ID 0x102
|
#define IP_MIB_ADDRTABLE_ENTRY_ID 0x102
|
||||||
#define IP_INTFC_INFO_ID 0x103
|
#define IP_INTFC_INFO_ID 0x103
|
||||||
|
/* Non public TOIID used to query modules info */
|
||||||
|
#ifdef __REACTOS__
|
||||||
|
#define IP_SPECIFIC_MODULE_ENTRY_ID 0x110
|
||||||
|
#endif
|
||||||
#define MAX_PHYSADDR_SIZE 8
|
#define MAX_PHYSADDR_SIZE 8
|
||||||
|
|
||||||
/* Address Object Options */
|
/* Address Object Options */
|
||||||
|
|
|
@ -691,5 +691,19 @@ TCPSetNoDelay(
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NTSTATUS
|
||||||
|
TCPGetSocketStatus(
|
||||||
|
PCONNECTION_ENDPOINT Connection,
|
||||||
|
PULONG State)
|
||||||
|
{
|
||||||
|
if (!Connection)
|
||||||
|
return STATUS_UNSUCCESSFUL;
|
||||||
|
|
||||||
|
if (Connection->SocketContext == NULL)
|
||||||
|
return STATUS_UNSUCCESSFUL;
|
||||||
|
|
||||||
|
LibTCPGetSocketStatus(Connection->SocketContext, State);
|
||||||
|
return STATUS_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
/* EOF */
|
/* EOF */
|
||||||
|
|
|
@ -110,6 +110,7 @@ err_t LibTCPGetPeerName(PTCP_PCB pcb, struct ip_addr *const ipaddr, u16_t
|
||||||
err_t LibTCPGetHostName(PTCP_PCB pcb, struct ip_addr *const ipaddr, u16_t *const port);
|
err_t LibTCPGetHostName(PTCP_PCB pcb, struct ip_addr *const ipaddr, u16_t *const port);
|
||||||
void LibTCPAccept(PTCP_PCB pcb, struct tcp_pcb *listen_pcb, void *arg);
|
void LibTCPAccept(PTCP_PCB pcb, struct tcp_pcb *listen_pcb, void *arg);
|
||||||
void LibTCPSetNoDelay(PTCP_PCB pcb, BOOLEAN Set);
|
void LibTCPSetNoDelay(PTCP_PCB pcb, BOOLEAN Set);
|
||||||
|
void LibTCPGetSocketStatus(PTCP_PCB pcb, PULONG State);
|
||||||
|
|
||||||
/* IP functions */
|
/* IP functions */
|
||||||
void LibIPInsertPacket(void *ifarg, const void *const data, const u32_t size);
|
void LibIPInsertPacket(void *ifarg, const void *const data, const u32_t size);
|
||||||
|
|
|
@ -840,3 +840,11 @@ LibTCPSetNoDelay(
|
||||||
else
|
else
|
||||||
pcb->flags &= ~TF_NODELAY;
|
pcb->flags &= ~TF_NODELAY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
LibTCPGetSocketStatus(
|
||||||
|
PTCP_PCB pcb,
|
||||||
|
PULONG State)
|
||||||
|
{
|
||||||
|
*State = pcb->state + 1;
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue