ReactOS  0.4.14-dev-604-gcfdd483
ipstats_reactos.c File Reference
#include "iphlpapi_private.h"
Include dependency graph for ipstats_reactos.c:

Go to the source code of this file.

Classes

struct  _TABLE_CALL
 

Macros

#define TCPS_ESTABLISHED   TCP_ESTABLISHED
 
#define TCPS_SYN_SENT   TCP_SYN_SENT
 
#define TCPS_SYN_RECEIVED   TCP_SYN_RECV
 
#define TCPS_FIN_WAIT_1   TCP_FIN_WAIT1
 
#define TCPS_FIN_WAIT_2   TCP_FIN_WAIT2
 
#define TCPS_TIME_WAIT   TCP_TIME_WAIT
 
#define TCPS_CLOSED   TCP_CLOSE
 
#define TCPS_CLOSE_WAIT   TCP_CLOSE_WAIT
 
#define TCPS_LAST_ACK   TCP_LAST_ACK
 
#define TCPS_LISTEN   TCP_LISTEN
 
#define TCPS_CLOSING   TCP_CLOSING
 
#define Add2Ptr(PTR, INC)   (PVOID)((ULONG_PTR)(PTR) + (INC))
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (iphlpapi)
 
BOOL isIpEntity (HANDLE tcpFile, TDIEntityID *ent)
 
NTSTATUS getNthIpEntity (HANDLE tcpFile, DWORD index, TDIEntityID *ent)
 
NTSTATUS tdiGetMibForIpEntity (HANDLE tcpFile, TDIEntityID *ent, IPSNMPInfo *entry)
 
NTSTATUS tdiGetRoutesForIpEntity (HANDLE tcpFile, TDIEntityID *ent, IPRouteEntry **routes, PDWORD numRoutes)
 
NTSTATUS tdiGetIpAddrsForIpEntity (HANDLE tcpFile, TDIEntityID *ent, IPAddrEntry **addrs, PDWORD numAddrs)
 
DWORD getInterfaceStatsByName (const char *name, PMIB_IFROW entry)
 
DWORD getInterfaceStatsByIndex (DWORD index, PMIB_IFROW entry)
 
DWORD getICMPStats (MIB_ICMP *stats)
 
DWORD getIPStats (PMIB_IPSTATS stats, DWORD family)
 
DWORD getTCPStats (MIB_TCPSTATS *stats, DWORD family)
 
DWORD getUDPStats (MIB_UDPSTATS *stats, DWORD family)
 
DWORD getNumRoutes (void)
 
VOID HexDump (PCHAR Data, DWORD Len)
 
RouteTablegetRouteTable (void)
 
DWORD getNumArpEntries (void)
 
PMIB_IPNETTABLE getArpTable (void)
 
DWORD getNumUdpEntries (void)
 
PVOID getUdpTable (CLASS_TABLE Class)
 
DWORD getNumTcpEntries (void)
 
PVOID getTcpTable (CLASS_TABLE Class)
 

Variables

struct _TABLE_CALL UdpTcpTableCall []
 

Macro Definition Documentation

◆ Add2Ptr

#define Add2Ptr (   PTR,
  INC 
)    (PVOID)((ULONG_PTR)(PTR) + (INC))

Definition at line 605 of file ipstats_reactos.c.

◆ TCPS_CLOSE_WAIT

#define TCPS_CLOSE_WAIT   TCP_CLOSE_WAIT

Definition at line 48 of file ipstats_reactos.c.

◆ TCPS_CLOSED

#define TCPS_CLOSED   TCP_CLOSE

Definition at line 45 of file ipstats_reactos.c.

◆ TCPS_CLOSING

#define TCPS_CLOSING   TCP_CLOSING

Definition at line 57 of file ipstats_reactos.c.

◆ TCPS_ESTABLISHED

#define TCPS_ESTABLISHED   TCP_ESTABLISHED

Definition at line 27 of file ipstats_reactos.c.

◆ TCPS_FIN_WAIT_1

#define TCPS_FIN_WAIT_1   TCP_FIN_WAIT1

Definition at line 36 of file ipstats_reactos.c.

◆ TCPS_FIN_WAIT_2

#define TCPS_FIN_WAIT_2   TCP_FIN_WAIT2

Definition at line 39 of file ipstats_reactos.c.

◆ TCPS_LAST_ACK

#define TCPS_LAST_ACK   TCP_LAST_ACK

Definition at line 51 of file ipstats_reactos.c.

◆ TCPS_LISTEN

#define TCPS_LISTEN   TCP_LISTEN

Definition at line 54 of file ipstats_reactos.c.

◆ TCPS_SYN_RECEIVED

#define TCPS_SYN_RECEIVED   TCP_SYN_RECV

Definition at line 33 of file ipstats_reactos.c.

◆ TCPS_SYN_SENT

#define TCPS_SYN_SENT   TCP_SYN_SENT

Definition at line 30 of file ipstats_reactos.c.

◆ TCPS_TIME_WAIT

#define TCPS_TIME_WAIT   TCP_TIME_WAIT

Definition at line 42 of file ipstats_reactos.c.

Function Documentation

◆ getArpTable()

PMIB_IPNETTABLE getArpTable ( void  )

Definition at line 531 of file ipstats_reactos.c.

532 {
533  DWORD numEntities, returnSize;
534  TDIEntityID *entitySet;
535  HANDLE tcpFile;
536  int i, totalNumber, TmpIdx, CurrIdx = 0;
538  PMIB_IPNETTABLE IpArpTable = NULL;
539  PMIB_IPNETROW AdapterArpTable = NULL;
540 
541  TRACE("called.\n");
542 
543  totalNumber = getNumArpEntries();
544 
545  status = openTcpFile( &tcpFile, FILE_READ_DATA );
546  if( !NT_SUCCESS(status) ) {
547  ERR("openTcpFile returned 0x%08lx\n", status);
548  return 0;
549  }
550 
551  IpArpTable = HeapAlloc
552  ( GetProcessHeap(), 0,
553  sizeof(DWORD) + (sizeof(MIB_IPNETROW) * totalNumber) );
554  if (!IpArpTable) {
555  closeTcpFile(tcpFile);
556  return NULL;
557  }
558 
559  status = tdiGetEntityIDSet( tcpFile, &entitySet, &numEntities );
560 
561  for( i = 0; i < numEntities; i++ ) {
562  if( isInterface( &entitySet[i] ) &&
563  hasArp( tcpFile, &entitySet[i] ) ) {
564 
565  status = tdiGetSetOfThings( tcpFile,
569  AT_ENTITY,
570  entitySet[i].tei_instance,
571  0,
572  sizeof(MIB_IPNETROW),
573  (PVOID *)&AdapterArpTable,
574  &returnSize );
575 
576  if( status == STATUS_SUCCESS ) {
577  for( TmpIdx = 0; TmpIdx < returnSize; TmpIdx++, CurrIdx++ )
578  IpArpTable->table[CurrIdx] = AdapterArpTable[TmpIdx];
579  tdiFreeThingSet( AdapterArpTable );
580  }
581  }
582  }
583 
584  closeTcpFile( tcpFile );
585 
586  tdiFreeThingSet( entitySet );
587  IpArpTable->dwNumEntries = CurrIdx;
588 
589  return IpArpTable;
590 }
#define AT_ENTITY
Definition: tdiinfo.h:41
LONG NTSTATUS
Definition: precomp.h:26
BOOL isInterface(TDIEntityID *if_maybe)
#define IP_MIB_ARPTABLE_ENTRY_ID
Definition: tcpioctl.h:51
NTSTATUS tdiGetEntityIDSet(HANDLE tcpFile, TDIEntityID **entitySet, PDWORD numEntities)
Definition: enum.c:122
DWORD getNumArpEntries(void)
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define FILE_READ_DATA
Definition: nt_native.h:628
smooth NULL
Definition: ftsmooth.c:416
VOID tdiFreeThingSet(PVOID things)
Definition: enum.c:118
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:403
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
unsigned long DWORD
Definition: ntddk_ex.h:95
VOID closeTcpFile(HANDLE h)
Definition: handle.c:43
BOOL hasArp(HANDLE tcpFile, TDIEntityID *arp_maybe)
MIB_IPNETROW table[1]
Definition: ipmib.h:128
#define ERR(fmt,...)
Definition: debug.h:109
NTSTATUS tdiGetSetOfThings(HANDLE tcpFile, DWORD toiClass, DWORD toiType, DWORD toiId, DWORD teiEntity, DWORD teiInstance, DWORD fixedPart, DWORD entrySize, PVOID *tdiEntitySet, PDWORD numEntries)
Definition: enum.c:24
#define INFO_TYPE_PROVIDER
Definition: tdiinfo.h:69
NTSTATUS openTcpFile(PHANDLE tcpFile, ACCESS_MASK DesiredAccess)
Definition: handle.c:12
return STATUS_SUCCESS
Definition: btrfs.c:2938
static SERVICE_STATUS status
Definition: service.c:31
DWORD dwNumEntries
Definition: ipmib.h:127
#define INFO_CLASS_PROTOCOL
Definition: tdiinfo.h:65
Definition: ps.c:97

Referenced by GetIpNetTable().

◆ getICMPStats()

DWORD getICMPStats ( MIB_ICMP stats)

Definition at line 206 of file ipstats_reactos.c.

207 {
208  FILE *fp;
209 
210  if (!stats)
212 
213  memset(stats, 0, sizeof(MIB_ICMP));
214  /* get most of these stats from /proc/net/snmp, no error if can't */
215  fp = fopen("/proc/net/snmp", "r");
216  if (fp) {
217  const char hdr[] = "Icmp:";
218  char buf[512] = { 0 }, *ptr;
219 
220  do {
221  ptr = fgets(buf, sizeof(buf), fp);
222  } while (ptr && strncasecmp(buf, hdr, sizeof(hdr) - 1));
223  if (ptr) {
224  /* last line was a header, get another */
225  ptr = fgets(buf, sizeof(buf), fp);
226  if (ptr && strncasecmp(buf, hdr, sizeof(hdr) - 1) == 0) {
227  char *endPtr;
228 
229  ptr += sizeof(hdr);
230  if (ptr && *ptr) {
231  stats->stats.icmpInStats.dwMsgs = strtoul(ptr, &endPtr, 10);
232  ptr = endPtr;
233  }
234  if (ptr && *ptr) {
235  stats->stats.icmpInStats.dwErrors = strtoul(ptr, &endPtr, 10);
236  ptr = endPtr;
237  }
238  if (ptr && *ptr) {
239  stats->stats.icmpInStats.dwDestUnreachs = strtoul(ptr, &endPtr, 10);
240  ptr = endPtr;
241  }
242  if (ptr && *ptr) {
243  stats->stats.icmpInStats.dwTimeExcds = strtoul(ptr, &endPtr, 10);
244  ptr = endPtr;
245  }
246  if (ptr && *ptr) {
247  stats->stats.icmpInStats.dwParmProbs = strtoul(ptr, &endPtr, 10);
248  ptr = endPtr;
249  }
250  if (ptr && *ptr) {
251  stats->stats.icmpInStats.dwSrcQuenchs = strtoul(ptr, &endPtr, 10);
252  ptr = endPtr;
253  }
254  if (ptr && *ptr) {
255  stats->stats.icmpInStats.dwRedirects = strtoul(ptr, &endPtr, 10);
256  ptr = endPtr;
257  }
258  if (ptr && *ptr) {
259  stats->stats.icmpInStats.dwEchoReps = strtoul(ptr, &endPtr, 10);
260  ptr = endPtr;
261  }
262  if (ptr && *ptr) {
263  stats->stats.icmpInStats.dwTimestamps = strtoul(ptr, &endPtr, 10);
264  ptr = endPtr;
265  }
266  if (ptr && *ptr) {
267  stats->stats.icmpInStats.dwTimestampReps = strtoul(ptr, &endPtr, 10);
268  ptr = endPtr;
269  }
270  if (ptr && *ptr) {
271  stats->stats.icmpInStats.dwAddrMasks = strtoul(ptr, &endPtr, 10);
272  ptr = endPtr;
273  }
274  if (ptr && *ptr) {
275  stats->stats.icmpInStats.dwAddrMaskReps = strtoul(ptr, &endPtr, 10);
276  ptr = endPtr;
277  }
278  if (ptr && *ptr) {
279  stats->stats.icmpOutStats.dwMsgs = strtoul(ptr, &endPtr, 10);
280  ptr = endPtr;
281  }
282  if (ptr && *ptr) {
283  stats->stats.icmpOutStats.dwErrors = strtoul(ptr, &endPtr, 10);
284  ptr = endPtr;
285  }
286  if (ptr && *ptr) {
287  stats->stats.icmpOutStats.dwDestUnreachs = strtoul(ptr, &endPtr, 10);
288  ptr = endPtr;
289  }
290  if (ptr && *ptr) {
291  stats->stats.icmpOutStats.dwTimeExcds = strtoul(ptr, &endPtr, 10);
292  ptr = endPtr;
293  }
294  if (ptr && *ptr) {
295  stats->stats.icmpOutStats.dwParmProbs = strtoul(ptr, &endPtr, 10);
296  ptr = endPtr;
297  }
298  if (ptr && *ptr) {
299  stats->stats.icmpOutStats.dwSrcQuenchs = strtoul(ptr, &endPtr, 10);
300  ptr = endPtr;
301  }
302  if (ptr && *ptr) {
303  stats->stats.icmpOutStats.dwRedirects = strtoul(ptr, &endPtr, 10);
304  ptr = endPtr;
305  }
306  if (ptr && *ptr) {
307  stats->stats.icmpOutStats.dwEchoReps = strtoul(ptr, &endPtr, 10);
308  ptr = endPtr;
309  }
310  if (ptr && *ptr) {
311  stats->stats.icmpOutStats.dwTimestamps = strtoul(ptr, &endPtr, 10);
312  ptr = endPtr;
313  }
314  if (ptr && *ptr) {
315  stats->stats.icmpOutStats.dwTimestampReps = strtoul(ptr, &endPtr, 10);
316  ptr = endPtr;
317  }
318  if (ptr && *ptr) {
319  stats->stats.icmpOutStats.dwAddrMasks = strtoul(ptr, &endPtr, 10);
320  ptr = endPtr;
321  }
322  if (ptr && *ptr) {
323  stats->stats.icmpOutStats.dwAddrMaskReps = strtoul(ptr, &endPtr, 10);
324  ptr = endPtr;
325  }
326  }
327  }
328  fclose(fp);
329  }
330  return NO_ERROR;
331 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
UINT32 strtoul(const char *String, char **Terminator, UINT32 Base)
Definition: utclib.c:696
char hdr[14]
Definition: iptest.cpp:33
MIBICMPSTATS icmpInStats
Definition: ipmib.h:193
DWORD dwTimestamps
Definition: ipmib.h:185
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
DWORD dwTimeExcds
Definition: ipmib.h:179
DWORD dwEchoReps
Definition: ipmib.h:184
#define NO_ERROR
Definition: dderror.h:5
MIBICMPINFO stats
Definition: ipmib.h:199
DWORD dwErrors
Definition: ipmib.h:177
static PVOID ptr
Definition: dispmode.c:27
#define strncasecmp
Definition: fake.h:10
DWORD dwTimestampReps
Definition: ipmib.h:186
DWORD dwParmProbs
Definition: ipmib.h:180
DWORD dwRedirects
Definition: ipmib.h:182
DWORD dwAddrMasks
Definition: ipmib.h:187
_Check_return_opt_ _CRTIMP int __cdecl fclose(_Inout_ FILE *_File)
_Check_return_ _CRTIMP FILE *__cdecl fopen(_In_z_ const char *_Filename, _In_z_ const char *_Mode)
MIBICMPSTATS icmpOutStats
Definition: ipmib.h:194
_Check_return_opt_ _CRTIMP char *__cdecl fgets(_Out_writes_z_(_MaxCount) char *_Buf, _In_ int _MaxCount, _Inout_ FILE *_File)
DWORD dwSrcQuenchs
Definition: ipmib.h:181
DWORD dwDestUnreachs
Definition: ipmib.h:178
DWORD dwAddrMaskReps
Definition: ipmib.h:188
#define memset(x, y, z)
Definition: compat.h:39
DWORD dwMsgs
Definition: ipmib.h:176

Referenced by GetIcmpStatistics().

◆ getInterfaceStatsByIndex()

DWORD getInterfaceStatsByIndex ( DWORD  index,
PMIB_IFROW  entry 
)

Definition at line 201 of file ipstats_reactos.c.

202 {
204 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91

◆ getInterfaceStatsByName()

DWORD getInterfaceStatsByName ( const char name,
PMIB_IFROW  entry 
)

Definition at line 191 of file ipstats_reactos.c.

192 {
193  if (!name)
195  if (!entry)
197 
198  return NO_ERROR;
199 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
#define NO_ERROR
Definition: dderror.h:5
uint32_t entry
Definition: isohybrid.c:63
Definition: name.c:38

Referenced by GetIfEntry().

◆ getIPStats()

DWORD getIPStats ( PMIB_IPSTATS  stats,
DWORD  family 
)

Definition at line 333 of file ipstats_reactos.c.

334 {
335  if (!stats)
337  return NO_ERROR;
338 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
#define NO_ERROR
Definition: dderror.h:5

Referenced by GetIpStatisticsEx().

◆ getNthIpEntity()

NTSTATUS getNthIpEntity ( HANDLE  tcpFile,
DWORD  index,
TDIEntityID ent 
)

Prototypes

Definition at line 65 of file ipstats_reactos.c.

65  {
66  DWORD numEntities = 0;
67  DWORD numRoutes = 0;
68  TDIEntityID *entitySet = 0;
69  NTSTATUS status = tdiGetEntityIDSet( tcpFile, &entitySet, &numEntities );
70  int i;
71 
72  if( !NT_SUCCESS(status) )
73  return status;
74 
75  for( i = 0; i < numEntities; i++ ) {
76  if( isIpEntity( tcpFile, &entitySet[i] ) ) {
77  TRACE("Entity %d is an IP Entity\n", i);
78  if( numRoutes == index ) break;
79  else numRoutes++;
80  }
81  }
82 
83  if( numRoutes == index && i < numEntities ) {
84  TRACE("Index %lu is entity #%d - %04x:%08x\n", index, i,
85  entitySet[i].tei_entity, entitySet[i].tei_instance);
86  memcpy( ent, &entitySet[i], sizeof(*ent) );
87  tdiFreeThingSet( entitySet );
88  return STATUS_SUCCESS;
89  } else {
90  tdiFreeThingSet( entitySet );
91  return STATUS_UNSUCCESSFUL;
92  }
93 }
BOOL isIpEntity(HANDLE tcpFile, TDIEntityID *ent)
LONG NTSTATUS
Definition: precomp.h:26
NTSTATUS tdiGetEntityIDSet(HANDLE tcpFile, TDIEntityID **entitySet, PDWORD numEntities)
Definition: enum.c:122
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
GLuint index
Definition: glext.h:6031
VOID tdiFreeThingSet(PVOID things)
Definition: enum.c:118
#define TRACE(s)
Definition: solgame.cpp:4
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
unsigned long DWORD
Definition: ntddk_ex.h:95
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
return STATUS_SUCCESS
Definition: btrfs.c:2938
static SERVICE_STATUS status
Definition: service.c:31
Definition: ps.c:97

Referenced by createIpForwardEntry(), deleteIpForwardEntry(), getInterfaceInfoSet(), getRouteTable(), and SetIpNetEntry().

◆ getNumArpEntries()

DWORD getNumArpEntries ( void  )

Definition at line 483 of file ipstats_reactos.c.

484 {
485  DWORD numEntities;
486  TDIEntityID *entitySet = NULL;
487  HANDLE tcpFile;
488  int i, totalNumber = 0;
490  PMIB_IPNETROW IpArpTable = NULL;
491  DWORD returnSize;
492 
493  TRACE("called.\n");
494 
495  status = openTcpFile( &tcpFile, FILE_READ_DATA );
496  if( !NT_SUCCESS(status) ) {
497  ERR("openTcpFile returned 0x%08lx\n", status);
498  return 0;
499  }
500 
501  status = tdiGetEntityIDSet( tcpFile, &entitySet, &numEntities );
502 
503  for( i = 0; i < numEntities; i++ ) {
504  if( isInterface( &entitySet[i] ) &&
505  hasArp( tcpFile, &entitySet[i] ) ) {
506 
507  status = tdiGetSetOfThings( tcpFile,
511  AT_ENTITY,
512  entitySet[i].tei_instance,
513  0,
514  sizeof(MIB_IPNETROW),
515  (PVOID *)&IpArpTable,
516  &returnSize );
517 
518  if( status == STATUS_SUCCESS ) totalNumber += returnSize;
519  if( IpArpTable ) {
520  tdiFreeThingSet( IpArpTable );
521  IpArpTable = NULL;
522  }
523  }
524  }
525 
526  closeTcpFile( tcpFile );
527  if( entitySet ) tdiFreeThingSet( entitySet );
528  return totalNumber;
529 }
#define AT_ENTITY
Definition: tdiinfo.h:41
LONG NTSTATUS
Definition: precomp.h:26
BOOL isInterface(TDIEntityID *if_maybe)
#define IP_MIB_ARPTABLE_ENTRY_ID
Definition: tcpioctl.h:51
NTSTATUS tdiGetEntityIDSet(HANDLE tcpFile, TDIEntityID **entitySet, PDWORD numEntities)
Definition: enum.c:122
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define FILE_READ_DATA
Definition: nt_native.h:628
smooth NULL
Definition: ftsmooth.c:416
VOID tdiFreeThingSet(PVOID things)
Definition: enum.c:118
#define TRACE(s)
Definition: solgame.cpp:4
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
unsigned long DWORD
Definition: ntddk_ex.h:95
VOID closeTcpFile(HANDLE h)
Definition: handle.c:43
BOOL hasArp(HANDLE tcpFile, TDIEntityID *arp_maybe)
#define ERR(fmt,...)
Definition: debug.h:109
NTSTATUS tdiGetSetOfThings(HANDLE tcpFile, DWORD toiClass, DWORD toiType, DWORD toiId, DWORD teiEntity, DWORD teiInstance, DWORD fixedPart, DWORD entrySize, PVOID *tdiEntitySet, PDWORD numEntries)
Definition: enum.c:24
#define INFO_TYPE_PROVIDER
Definition: tdiinfo.h:69
NTSTATUS openTcpFile(PHANDLE tcpFile, ACCESS_MASK DesiredAccess)
Definition: handle.c:12
return STATUS_SUCCESS
Definition: btrfs.c:2938
static SERVICE_STATUS status
Definition: service.c:31
#define INFO_CLASS_PROTOCOL
Definition: tdiinfo.h:65
Definition: ps.c:97

Referenced by getArpTable(), and GetIpNetTable().

◆ getNumRoutes()

DWORD getNumRoutes ( void  )

Definition at line 354 of file ipstats_reactos.c.

355 {
356  DWORD numEntities, numRoutes = 0;
357  TDIEntityID *entitySet;
358  HANDLE tcpFile;
359  int i;
361 
362  TRACE("called.\n");
363 
364  status = openTcpFile( &tcpFile, FILE_READ_DATA );
365  if( !NT_SUCCESS(status) ) {
366  ERR("openTcpFile returned 0x%08lx\n", status);
367  return 0;
368  }
369 
370  status = tdiGetEntityIDSet( tcpFile, &entitySet, &numEntities );
371  if( !NT_SUCCESS(status) ) {
372  ERR("tdiGetEntityIDSet returned 0x%08lx\n", status);
373  closeTcpFile( tcpFile );
374  return 0;
375  }
376 
377  for( i = 0; i < numEntities; i++ ) {
378  if( isIpEntity( tcpFile, &entitySet[i] ) ) {
379  IPSNMPInfo isnmp;
380  memset( &isnmp, 0, sizeof( isnmp ) );
381  status = tdiGetMibForIpEntity( tcpFile, &entitySet[i], &isnmp );
382  if( !NT_SUCCESS(status) ) {
383  ERR("tdiGetMibForIpEntity returned 0x%08lx, for i = %d", status, i);
384  numRoutes = 0;
385  break;
386  }
387  numRoutes += isnmp.ipsi_numroutes;
388  }
389  }
390 
391  TRACE("numRoutes = %lu\n", numRoutes);
392 
393  tdiFreeThingSet( entitySet );
394  closeTcpFile( tcpFile );
395 
396  return numRoutes;
397 }
BOOL isIpEntity(HANDLE tcpFile, TDIEntityID *ent)
LONG NTSTATUS
Definition: precomp.h:26
ULONG ipsi_numroutes
Definition: tcpioctl.h:154
NTSTATUS tdiGetEntityIDSet(HANDLE tcpFile, TDIEntityID **entitySet, PDWORD numEntities)
Definition: enum.c:122
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define FILE_READ_DATA
Definition: nt_native.h:628
VOID tdiFreeThingSet(PVOID things)
Definition: enum.c:118
#define TRACE(s)
Definition: solgame.cpp:4
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
unsigned long DWORD
Definition: ntddk_ex.h:95
VOID closeTcpFile(HANDLE h)
Definition: handle.c:43
#define ERR(fmt,...)
Definition: debug.h:109
NTSTATUS tdiGetMibForIpEntity(HANDLE tcpFile, TDIEntityID *ent, IPSNMPInfo *entry)
NTSTATUS openTcpFile(PHANDLE tcpFile, ACCESS_MASK DesiredAccess)
Definition: handle.c:12
#define memset(x, y, z)
Definition: compat.h:39
static SERVICE_STATUS status
Definition: service.c:31
Definition: ps.c:97

Referenced by getInterfaceGatewayByIndex(), GetIpForwardTable(), and getRouteTable().

◆ getNumTcpEntries()

DWORD getNumTcpEntries ( void  )

Definition at line 718 of file ipstats_reactos.c.

719 {
720  DWORD numEntities;
721  TDIEntityID *entitySet = NULL;
722  HANDLE tcpFile;
723  int i, totalNumber = 0;
725  PMIB_TCPROW IpTcpTable = NULL;
726  DWORD returnSize;
727 
728  TRACE("called.\n");
729 
730  status = openTcpFile( &tcpFile, FILE_READ_DATA );
731  if( !NT_SUCCESS(status) ) {
732  ERR("openTcpFile returned 0x%08lx\n", status);
733  return 0;
734  }
735 
736  status = tdiGetEntityIDSet( tcpFile, &entitySet, &numEntities );
737 
738  for( i = 0; i < numEntities; i++ ) {
739  if( entitySet[i].tei_entity == CO_TL_ENTITY &&
740  hasArp( tcpFile, &entitySet[i] ) ) {
741 
742  status = tdiGetSetOfThings( tcpFile,
746  CO_TL_ENTITY,
747  entitySet[i].tei_instance,
748  0,
749  sizeof(MIB_TCPROW),
750  (PVOID *)&IpTcpTable,
751  &returnSize );
752 
753  if( status == STATUS_SUCCESS ) totalNumber += returnSize;
754  if( IpTcpTable ) {
755  tdiFreeThingSet( IpTcpTable );
756  IpTcpTable = NULL;
757  }
758  }
759  }
760 
761  closeTcpFile( tcpFile );
762  if( entitySet ) tdiFreeThingSet( entitySet );
763  return totalNumber;
764 }
LONG NTSTATUS
Definition: precomp.h:26
#define IP_MIB_ARPTABLE_ENTRY_ID
Definition: tcpioctl.h:51
NTSTATUS tdiGetEntityIDSet(HANDLE tcpFile, TDIEntityID **entitySet, PDWORD numEntities)
Definition: enum.c:122
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define FILE_READ_DATA
Definition: nt_native.h:628
smooth NULL
Definition: ftsmooth.c:416
#define CO_TL_ENTITY
Definition: tdiinfo.h:45
VOID tdiFreeThingSet(PVOID things)
Definition: enum.c:118
#define TRACE(s)
Definition: solgame.cpp:4
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
unsigned long DWORD
Definition: ntddk_ex.h:95
VOID closeTcpFile(HANDLE h)
Definition: handle.c:43
BOOL hasArp(HANDLE tcpFile, TDIEntityID *arp_maybe)
#define ERR(fmt,...)
Definition: debug.h:109
NTSTATUS tdiGetSetOfThings(HANDLE tcpFile, DWORD toiClass, DWORD toiType, DWORD toiId, DWORD teiEntity, DWORD teiInstance, DWORD fixedPart, DWORD entrySize, PVOID *tdiEntitySet, PDWORD numEntries)
Definition: enum.c:24
#define INFO_TYPE_PROVIDER
Definition: tdiinfo.h:69
NTSTATUS openTcpFile(PHANDLE tcpFile, ACCESS_MASK DesiredAccess)
Definition: handle.c:12
return STATUS_SUCCESS
Definition: btrfs.c:2938
static SERVICE_STATUS status
Definition: service.c:31
#define INFO_CLASS_PROTOCOL
Definition: tdiinfo.h:65
Definition: ps.c:97

Referenced by getTcpTable().

◆ getNumUdpEntries()

DWORD getNumUdpEntries ( void  )

Definition at line 607 of file ipstats_reactos.c.

608 {
609  DWORD numEntities;
610  TDIEntityID *entitySet = NULL;
611  HANDLE tcpFile;
612  int i, totalNumber = 0;
614  PMIB_UDPROW IpUdpTable = NULL;
615  DWORD returnSize;
616 
617  TRACE("called.\n");
618 
619  status = openTcpFile( &tcpFile, FILE_READ_DATA );
620  if( !NT_SUCCESS(status) ) {
621  ERR("openTcpFile returned 0x%08lx\n", status);
622  return 0;
623  }
624 
625  status = tdiGetEntityIDSet( tcpFile, &entitySet, &numEntities );
626 
627  for( i = 0; i < numEntities; i++ ) {
628  if( entitySet[i].tei_entity == CL_TL_ENTITY &&
629  hasArp( tcpFile, &entitySet[i] ) ) {
630 
631  status = tdiGetSetOfThings( tcpFile,
635  CL_TL_ENTITY,
636  entitySet[i].tei_instance,
637  0,
638  sizeof(MIB_UDPROW),
639  (PVOID *)&IpUdpTable,
640  &returnSize );
641 
642  if( status == STATUS_SUCCESS ) totalNumber += returnSize;
643  if( IpUdpTable ) {
644  tdiFreeThingSet( IpUdpTable );
645  IpUdpTable = NULL;
646  }
647  }
648  }
649 
650  closeTcpFile( tcpFile );
651  if( entitySet ) tdiFreeThingSet( entitySet );
652  return totalNumber;
653 }
LONG NTSTATUS
Definition: precomp.h:26
#define IP_MIB_ARPTABLE_ENTRY_ID
Definition: tcpioctl.h:51
NTSTATUS tdiGetEntityIDSet(HANDLE tcpFile, TDIEntityID **entitySet, PDWORD numEntities)
Definition: enum.c:122
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define FILE_READ_DATA
Definition: nt_native.h:628
smooth NULL
Definition: ftsmooth.c:416
VOID tdiFreeThingSet(PVOID things)
Definition: enum.c:118
#define TRACE(s)
Definition: solgame.cpp:4
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
unsigned long DWORD
Definition: ntddk_ex.h:95
VOID closeTcpFile(HANDLE h)
Definition: handle.c:43
BOOL hasArp(HANDLE tcpFile, TDIEntityID *arp_maybe)
#define ERR(fmt,...)
Definition: debug.h:109
NTSTATUS tdiGetSetOfThings(HANDLE tcpFile, DWORD toiClass, DWORD toiType, DWORD toiId, DWORD teiEntity, DWORD teiInstance, DWORD fixedPart, DWORD entrySize, PVOID *tdiEntitySet, PDWORD numEntries)
Definition: enum.c:24
#define CL_TL_ENTITY
Definition: tdiinfo.h:43
#define INFO_TYPE_PROVIDER
Definition: tdiinfo.h:69
NTSTATUS openTcpFile(PHANDLE tcpFile, ACCESS_MASK DesiredAccess)
Definition: handle.c:12
return STATUS_SUCCESS
Definition: btrfs.c:2938
static SERVICE_STATUS status
Definition: service.c:31
#define INFO_CLASS_PROTOCOL
Definition: tdiinfo.h:65
Definition: ps.c:97

Referenced by getUdpTable().

◆ getRouteTable()

RouteTable* getRouteTable ( void  )

Definition at line 412 of file ipstats_reactos.c.

413 {
414  RouteTable *out_route_table;
415  DWORD numRoutes = getNumRoutes(), routesAdded = 0;
416  TDIEntityID ent;
417  HANDLE tcpFile;
418  NTSTATUS status = openTcpFile( &tcpFile, FILE_READ_DATA );
419  int i;
420 
421  if( !NT_SUCCESS(status) )
422  return 0;
423 
424  TRACE("GETTING ROUTE TABLE\n");
425 
426  out_route_table = HeapAlloc( GetProcessHeap(), 0,
427  sizeof(RouteTable) +
428  (sizeof(RouteEntry) * (numRoutes - 1)) );
429  if (!out_route_table) {
430  closeTcpFile(tcpFile);
431  return NULL;
432  }
433 
434  out_route_table->numRoutes = numRoutes;
435 
436  for( i = 0; routesAdded < out_route_table->numRoutes; i++ ) {
437  int j;
438  IPRouteEntry *route_set;
439 
440  getNthIpEntity( tcpFile, i, &ent );
441 
442  tdiGetRoutesForIpEntity( tcpFile, &ent, &route_set, &numRoutes );
443 
444  if( !route_set ) {
445  closeTcpFile( tcpFile );
446  HeapFree( GetProcessHeap(), 0, out_route_table );
447  return 0;
448  }
449 
450  TRACE("%lu routes in instance %d\n", numRoutes, i);
451 #if 0
452  HexDump( route_set,
453  sizeof( IPRouteEntry ) *
454  snmpInfo.ipsi_numroutes );
455 #endif
456 
457  for( j = 0; j < numRoutes; j++ ) {
458  int routeNum = j + routesAdded;
459  out_route_table->routes[routeNum].dest =
460  route_set[j].ire_dest;
461  out_route_table->routes[routeNum].mask =
462  route_set[j].ire_mask;
463  out_route_table->routes[routeNum].gateway =
464  route_set[j].ire_gw;
465  out_route_table->routes[routeNum].ifIndex =
466  route_set[j].ire_index;
467  out_route_table->routes[routeNum].metric =
468  route_set[j].ire_metric1;
469  }
470 
471  if( route_set ) tdiFreeThingSet( route_set );
472 
473  routesAdded += numRoutes;
474  }
475 
476  closeTcpFile( tcpFile );
477 
478  TRACE("status = 0x%08lx, out_route_table = 0x%p\n", status, out_route_table);
479 
480  return out_route_table;
481 }
unsigned long ire_dest
Definition: tcp_info.c:24
LONG NTSTATUS
Definition: precomp.h:26
DWORD getNumRoutes(void)
VOID HexDump(PCHAR Data, DWORD Len)
unsigned long ire_mask
Definition: tcp_info.c:34
RouteEntry routes[1]
Definition: ipstats.h:76
DWORD ifIndex
Definition: ipstats.h:70
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define FILE_READ_DATA
Definition: nt_native.h:628
smooth NULL
Definition: ftsmooth.c:416
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
Definition: glfuncs.h:250
NTSTATUS getNthIpEntity(HANDLE tcpFile, DWORD index, TDIEntityID *ent)
VOID tdiFreeThingSet(PVOID things)
Definition: enum.c:118
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:403
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
unsigned long DWORD
Definition: ntddk_ex.h:95
VOID closeTcpFile(HANDLE h)
Definition: handle.c:43
DWORD metric
Definition: ipstats.h:71
unsigned long ire_metric1
Definition: tcp_info.c:26
NTSTATUS openTcpFile(PHANDLE tcpFile, ACCESS_MASK DesiredAccess)
Definition: handle.c:12
DWORD dest
Definition: ipstats.h:67
NTSTATUS tdiGetRoutesForIpEntity(HANDLE tcpFile, TDIEntityID *ent, IPRouteEntry **routes, PDWORD numRoutes)
unsigned long ire_index
Definition: tcp_info.c:25
DWORD gateway
Definition: ipstats.h:69
DWORD mask
Definition: ipstats.h:68
DWORD numRoutes
Definition: ipstats.h:75
#define HeapFree(x, y, z)
Definition: compat.h:402
Definition: ps.c:97

Referenced by getInterfaceGatewayByIndex(), and GetIpForwardTable().

◆ getTCPStats()

DWORD getTCPStats ( MIB_TCPSTATS stats,
DWORD  family 
)

Definition at line 340 of file ipstats_reactos.c.

341 {
342  if (!stats)
344  return NO_ERROR;
345 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
#define NO_ERROR
Definition: dderror.h:5

Referenced by GetTcpStatisticsEx().

◆ getTcpTable()

PVOID getTcpTable ( CLASS_TABLE  Class)

Definition at line 766 of file ipstats_reactos.c.

767 {
768  DWORD numEntities, returnSize;
769  TDIEntityID *entitySet;
770  HANDLE tcpFile;
771  int i, totalNumber, TmpIdx, CurrIdx = 0;
773  PMIB_TCPTABLE IpTcpTable = NULL;
774  PVOID AdapterTcpTable = NULL;
775 
776  TRACE("called.\n");
777 
778  totalNumber = getNumTcpEntries();
779 
780  status = openTcpFile( &tcpFile, FILE_READ_DATA );
781  if( !NT_SUCCESS(status) ) {
782  ERR("openTcpFile returned 0x%08lx\n", status);
783  return 0;
784  }
785 
786  IpTcpTable = HeapAlloc
787  ( GetProcessHeap(), 0,
788  UdpTcpTableCall[Class].TcpOffset + (UdpTcpTableCall[Class].TcpSize * totalNumber) );
789  if (!IpTcpTable) {
790  closeTcpFile(tcpFile);
791  return NULL;
792  }
793 
794  status = tdiGetEntityIDSet( tcpFile, &entitySet, &numEntities );
795 
796  for( i = 0; i < numEntities; i++ ) {
797  if( entitySet[i].tei_entity == CO_TL_ENTITY &&
798  hasArp( tcpFile, &entitySet[i] ) ) {
799 
800  status = tdiGetSetOfThings( tcpFile,
803  UdpTcpTableCall[Class].TOIID,
804  CO_TL_ENTITY,
805  entitySet[i].tei_instance,
806  0,
807  UdpTcpTableCall[Class].TcpSize,
808  &AdapterTcpTable,
809  &returnSize );
810 
811  if( status == STATUS_SUCCESS ) {
812  for( TmpIdx = 0; TmpIdx < returnSize; TmpIdx++, CurrIdx++ )
813  CopyMemory(Add2Ptr(IpTcpTable, UdpTcpTableCall[Class].TcpOffset + UdpTcpTableCall[Class].TcpSize * CurrIdx),
814  Add2Ptr(AdapterTcpTable, UdpTcpTableCall[Class].TcpSize * TmpIdx),
815  UdpTcpTableCall[Class].TcpSize);
816  tdiFreeThingSet( AdapterTcpTable );
817  }
818  }
819  }
820 
821  closeTcpFile( tcpFile );
822 
823  tdiFreeThingSet( entitySet );
824  IpTcpTable->dwNumEntries = CurrIdx;
825 
826  return IpTcpTable;
827 }
#define Add2Ptr(PTR, INC)
LONG NTSTATUS
Definition: precomp.h:26
DWORD getNumTcpEntries(void)
DWORD dwNumEntries
Definition: tcpmib.h:66
NTSTATUS tdiGetEntityIDSet(HANDLE tcpFile, TDIEntityID **entitySet, PDWORD numEntities)
Definition: enum.c:122
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define FILE_READ_DATA
Definition: nt_native.h:628
smooth NULL
Definition: ftsmooth.c:416
#define CO_TL_ENTITY
Definition: tdiinfo.h:45
VOID tdiFreeThingSet(PVOID things)
Definition: enum.c:118
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:403
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define CopyMemory
Definition: winbase.h:1640
unsigned long DWORD
Definition: ntddk_ex.h:95
VOID closeTcpFile(HANDLE h)
Definition: handle.c:43
BOOL hasArp(HANDLE tcpFile, TDIEntityID *arp_maybe)
#define ERR(fmt,...)
Definition: debug.h:109
NTSTATUS tdiGetSetOfThings(HANDLE tcpFile, DWORD toiClass, DWORD toiType, DWORD toiId, DWORD teiEntity, DWORD teiInstance, DWORD fixedPart, DWORD entrySize, PVOID *tdiEntitySet, PDWORD numEntries)
Definition: enum.c:24
#define INFO_TYPE_PROVIDER
Definition: tdiinfo.h:69
NTSTATUS openTcpFile(PHANDLE tcpFile, ACCESS_MASK DesiredAccess)
Definition: handle.c:12
struct _TABLE_CALL UdpTcpTableCall[]
return STATUS_SUCCESS
Definition: btrfs.c:2938
static SERVICE_STATUS status
Definition: service.c:31
#define INFO_CLASS_PROTOCOL
Definition: tdiinfo.h:65
Definition: ps.c:97

Referenced by GetExtendedTcpTable().

◆ getUDPStats()

DWORD getUDPStats ( MIB_UDPSTATS stats,
DWORD  family 
)

Definition at line 347 of file ipstats_reactos.c.

348 {
349  if (!stats)
351  return NO_ERROR;
352 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
#define NO_ERROR
Definition: dderror.h:5

Referenced by GetUdpStatisticsEx().

◆ getUdpTable()

PVOID getUdpTable ( CLASS_TABLE  Class)

Definition at line 655 of file ipstats_reactos.c.

656 {
657  DWORD numEntities, returnSize;
658  TDIEntityID *entitySet;
659  HANDLE tcpFile;
660  int i, totalNumber, TmpIdx, CurrIdx = 0;
662  PMIB_UDPTABLE IpUdpTable = NULL;
663  PVOID AdapterUdpTable = NULL;
664 
665  TRACE("called.\n");
666 
667  totalNumber = getNumUdpEntries();
668 
669  status = openTcpFile( &tcpFile, FILE_READ_DATA );
670  if( !NT_SUCCESS(status) ) {
671  ERR("openTcpFile returned 0x%08lx\n", status);
672  return 0;
673  }
674 
675  IpUdpTable = HeapAlloc
676  ( GetProcessHeap(), 0,
677  UdpTcpTableCall[Class].UdpOffset + (UdpTcpTableCall[Class].UdpSize * totalNumber) );
678  if (!IpUdpTable) {
679  closeTcpFile(tcpFile);
680  return NULL;
681  }
682 
683  status = tdiGetEntityIDSet( tcpFile, &entitySet, &numEntities );
684 
685  for( i = 0; i < numEntities; i++ ) {
686  if( entitySet[i].tei_entity == CL_TL_ENTITY &&
687  hasArp( tcpFile, &entitySet[i] ) ) {
688 
689  status = tdiGetSetOfThings( tcpFile,
692  UdpTcpTableCall[Class].TOIID,
693  CL_TL_ENTITY,
694  entitySet[i].tei_instance,
695  0,
696  UdpTcpTableCall[Class].UdpSize,
697  &AdapterUdpTable,
698  &returnSize );
699 
700  if( status == STATUS_SUCCESS ) {
701  for( TmpIdx = 0; TmpIdx < returnSize; TmpIdx++, CurrIdx++ )
702  CopyMemory(Add2Ptr(IpUdpTable, UdpTcpTableCall[Class].UdpOffset + UdpTcpTableCall[Class].UdpSize * CurrIdx),
703  Add2Ptr(AdapterUdpTable, UdpTcpTableCall[Class].UdpSize * TmpIdx),
704  UdpTcpTableCall[Class].UdpSize);
705  tdiFreeThingSet( AdapterUdpTable );
706  }
707  }
708  }
709 
710  closeTcpFile( tcpFile );
711 
712  tdiFreeThingSet( entitySet );
713  IpUdpTable->dwNumEntries = CurrIdx;
714 
715  return IpUdpTable;
716 }
#define Add2Ptr(PTR, INC)
LONG NTSTATUS
Definition: precomp.h:26
DWORD getNumUdpEntries(void)
NTSTATUS tdiGetEntityIDSet(HANDLE tcpFile, TDIEntityID **entitySet, PDWORD numEntities)
Definition: enum.c:122
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
DWORD dwNumEntries
Definition: udpmib.h:34
#define FILE_READ_DATA
Definition: nt_native.h:628
smooth NULL
Definition: ftsmooth.c:416
VOID tdiFreeThingSet(PVOID things)
Definition: enum.c:118
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:403
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define CopyMemory
Definition: winbase.h:1640
unsigned long DWORD
Definition: ntddk_ex.h:95
VOID closeTcpFile(HANDLE h)
Definition: handle.c:43
BOOL hasArp(HANDLE tcpFile, TDIEntityID *arp_maybe)
#define ERR(fmt,...)
Definition: debug.h:109
NTSTATUS tdiGetSetOfThings(HANDLE tcpFile, DWORD toiClass, DWORD toiType, DWORD toiId, DWORD teiEntity, DWORD teiInstance, DWORD fixedPart, DWORD entrySize, PVOID *tdiEntitySet, PDWORD numEntries)
Definition: enum.c:24
#define CL_TL_ENTITY
Definition: tdiinfo.h:43
#define INFO_TYPE_PROVIDER
Definition: tdiinfo.h:69
NTSTATUS openTcpFile(PHANDLE tcpFile, ACCESS_MASK DesiredAccess)
Definition: handle.c:12
struct _TABLE_CALL UdpTcpTableCall[]
return STATUS_SUCCESS
Definition: btrfs.c:2938
static SERVICE_STATUS status
Definition: service.c:31
#define INFO_CLASS_PROTOCOL
Definition: tdiinfo.h:65
Definition: ps.c:97

Referenced by GetExtendedUdpTable().

◆ HexDump()

VOID HexDump ( PCHAR  Data,
DWORD  Len 
)

Definition at line 399 of file ipstats_reactos.c.

399  {
400  int i;
401 
402  for( i = 0; i < Len; i++ ) {
403  if( !(i & 0xf) ) {
404  if( i ) fprintf(stderr,"\n");
405  fprintf(stderr,"%08x:", i);
406  }
407  fprintf( stderr, " %02x", Data[i] & 0xff );
408  }
409  fprintf(stderr,"\n");
410 }
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
#define Len
Definition: deflate.h:82
FILE * stderr

Referenced by getRouteTable().

◆ isIpEntity()

BOOL isIpEntity ( HANDLE  tcpFile,
TDIEntityID ent 
)

Definition at line 60 of file ipstats_reactos.c.

60  {
61  return (ent->tei_entity == CL_NL_ENTITY ||
62  ent->tei_entity == CO_NL_ENTITY);
63 }
ULONG tei_entity
Definition: tdiinfo.h:31
#define CO_NL_ENTITY
Definition: tdiinfo.h:44
#define CL_NL_ENTITY
Definition: tdiinfo.h:42

Referenced by getNthIpEntity(), and getNumRoutes().

◆ tdiGetIpAddrsForIpEntity()

NTSTATUS tdiGetIpAddrsForIpEntity ( HANDLE  tcpFile,
TDIEntityID ent,
IPAddrEntry **  addrs,
PDWORD  numAddrs 
)

Definition at line 171 of file ipstats_reactos.c.

171  {
173 
174  TRACE("TdiGetIpAddrsForIpEntity(tcpFile 0x%p, entityId 0x%x)\n",
175  tcpFile, ent->tei_instance);
176 
177  status = tdiGetSetOfThings( tcpFile,
181  CL_NL_ENTITY,
182  ent->tei_instance,
183  0,
184  sizeof(IPAddrEntry),
185  (PVOID *)addrs,
186  numAddrs );
187 
188  return status;
189 }
LONG NTSTATUS
Definition: precomp.h:26
#define TRACE(s)
Definition: solgame.cpp:4
ULONG tei_instance
Definition: tdiinfo.h:32
#define CL_NL_ENTITY
Definition: tdiinfo.h:42
NTSTATUS tdiGetSetOfThings(HANDLE tcpFile, DWORD toiClass, DWORD toiType, DWORD toiId, DWORD teiEntity, DWORD teiInstance, DWORD fixedPart, DWORD entrySize, PVOID *tdiEntitySet, PDWORD numEntries)
Definition: enum.c:24
#define INFO_TYPE_PROVIDER
Definition: tdiinfo.h:69
#define IP_MIB_ADDRTABLE_ENTRY_ID
Definition: afd.h:36
static SERVICE_STATUS status
Definition: service.c:31
#define INFO_CLASS_PROTOCOL
Definition: tdiinfo.h:65
Definition: ps.c:97

Referenced by getInterfaceInfoSet().

◆ tdiGetMibForIpEntity()

NTSTATUS tdiGetMibForIpEntity ( HANDLE  tcpFile,
TDIEntityID ent,
IPSNMPInfo entry 
)

Definition at line 96 of file ipstats_reactos.c.

96  {
99  DWORD returnSize;
100 
101  memset( entry, 0, sizeof( *entry ) );
102 
103  TRACE("TdiGetMibForIpEntity(tcpFile 0x%p, entityId 0x%x)\n",
104  tcpFile, ent->tei_instance);
105 
108  req.ID.toi_id = IP_MIB_STATS_ID;
109  req.ID.toi_entity = *ent;
110 
111  status = DeviceIoControl( tcpFile,
113  &req,
114  sizeof(req),
115  entry,
116  sizeof(*entry),
117  &returnSize,
118  NULL );
119 
120  TRACE("TdiGetMibForIpEntity() => status = 0x%08lx, entry = {\n"
121  " ipsi_forwarding ............ %lu\n"
122  " ipsi_defaultttl ............ %lu\n"
123  " ipsi_inreceives ............ %lu\n"
124  " ipsi_indelivers ............ %lu\n"
125  " ipsi_outrequests ........... %lu\n"
126  " ipsi_routingdiscards ....... %lu\n"
127  " ipsi_outdiscards ........... %lu\n"
128  " ipsi_outnoroutes ........... %lu\n"
129  " ipsi_numif ................. %lu\n"
130  " ipsi_numaddr ............... %lu\n"
131  " ipsi_numroutes ............. %lu\n"
132  "}\n",
133  status,
134  entry->ipsi_forwarding,
135  entry->ipsi_defaultttl,
136  entry->ipsi_inreceives,
137  entry->ipsi_indelivers,
138  entry->ipsi_outrequests,
139  entry->ipsi_routingdiscards,
140  entry->ipsi_outdiscards,
141  entry->ipsi_outnoroutes,
142  entry->ipsi_numif,
143  entry->ipsi_numaddr,
144  entry->ipsi_numroutes);
145 
146  return status;
147 }
TDIEntityID toi_entity
Definition: tdiinfo.h:74
#define TCP_REQUEST_QUERY_INFORMATION_INIT
ULONG toi_class
Definition: tdiinfo.h:75
LONG NTSTATUS
Definition: precomp.h:26
#define IOCTL_TCP_QUERY_INFORMATION_EX
Definition: ticonsts.h:42
ULONG toi_id
Definition: tdiinfo.h:77
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
#define IP_MIB_STATS_ID
Definition: afd.h:35
ULONG tei_instance
Definition: tdiinfo.h:32
unsigned long DWORD
Definition: ntddk_ex.h:95
uint32_t entry
Definition: isohybrid.c:63
BOOL WINAPI DeviceIoControl(IN HANDLE hDevice, IN DWORD dwIoControlCode, IN LPVOID lpInBuffer OPTIONAL, IN DWORD nInBufferSize OPTIONAL, OUT LPVOID lpOutBuffer OPTIONAL, IN DWORD nOutBufferSize OPTIONAL, OUT LPDWORD lpBytesReturned OPTIONAL, IN LPOVERLAPPED lpOverlapped OPTIONAL)
Definition: deviceio.c:136
#define INFO_TYPE_PROVIDER
Definition: tdiinfo.h:69
return STATUS_SUCCESS
Definition: btrfs.c:2938
#define memset(x, y, z)
Definition: compat.h:39
static SERVICE_STATUS status
Definition: service.c:31
ULONG toi_type
Definition: tdiinfo.h:76
#define INFO_CLASS_PROTOCOL
Definition: tdiinfo.h:65
Definition: ps.c:97

Referenced by getNumRoutes().

◆ tdiGetRoutesForIpEntity()

NTSTATUS tdiGetRoutesForIpEntity ( HANDLE  tcpFile,
TDIEntityID ent,
IPRouteEntry **  routes,
PDWORD  numRoutes 
)

Definition at line 150 of file ipstats_reactos.c.

150  {
152 
153  TRACE("TdiGetRoutesForIpEntity(tcpFile 0x%p, entityId 0x%x)\n",
154  tcpFile, ent->tei_instance);
155 
156  status = tdiGetSetOfThings( tcpFile,
160  CL_NL_ENTITY,
161  ent->tei_instance,
162  0,
163  sizeof(IPRouteEntry),
164  (PVOID *)routes,
165  numRoutes);
166 
167  return status;
168 }
LONG NTSTATUS
Definition: precomp.h:26
#define IP_MIB_ARPTABLE_ENTRY_ID
Definition: tcpioctl.h:51
#define TRACE(s)
Definition: solgame.cpp:4
ULONG tei_instance
Definition: tdiinfo.h:32
#define CL_NL_ENTITY
Definition: tdiinfo.h:42
NTSTATUS tdiGetSetOfThings(HANDLE tcpFile, DWORD toiClass, DWORD toiType, DWORD toiId, DWORD teiEntity, DWORD teiInstance, DWORD fixedPart, DWORD entrySize, PVOID *tdiEntitySet, PDWORD numEntries)
Definition: enum.c:24
#define INFO_TYPE_PROVIDER
Definition: tdiinfo.h:69
return STATUS_SUCCESS
Definition: btrfs.c:2938
static SERVICE_STATUS status
Definition: service.c:31
#define INFO_CLASS_PROTOCOL
Definition: tdiinfo.h:65
Definition: ps.c:97

Referenced by getRouteTable().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( iphlpapi  )

Variable Documentation

◆ UdpTcpTableCall

struct _TABLE_CALL UdpTcpTableCall[]