ReactOS  0.4.15-dev-4934-gfd1e799
ipstats.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  _RouteEntry
 
struct  _RouteTable
 

Typedefs

typedef struct _RouteEntry RouteEntry
 
typedef struct _RouteTable RouteTable
 
typedef enum _CLASS_TABLE CLASS_TABLE
 

Enumerations

enum  _CLASS_TABLE { ClassBasic, ClassModulePid, ClassModule }
 

Functions

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)
 
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)
 

Typedef Documentation

◆ CLASS_TABLE

◆ RouteEntry

◆ RouteTable

Enumeration Type Documentation

◆ _CLASS_TABLE

Enumerator
ClassBasic 
ClassModulePid 
ClassModule 

Definition at line 79 of file ipstats.h.

79  {
80  ClassBasic,
83 } CLASS_TABLE;
enum _CLASS_TABLE CLASS_TABLE

Function Documentation

◆ getArpTable()

PMIB_IPNETTABLE getArpTable ( void  )

Definition at line 543 of file ipstats_reactos.c.

544 {
545  DWORD numEntities, returnSize;
546  TDIEntityID *entitySet;
547  HANDLE tcpFile;
548  int i, totalNumber, TmpIdx, CurrIdx = 0;
550  PMIB_IPNETTABLE IpArpTable = NULL;
551  PMIB_IPNETROW AdapterArpTable = NULL;
552 
553  TRACE("called.\n");
554 
555  totalNumber = getNumArpEntries();
556 
557  status = openTcpFile( &tcpFile, FILE_READ_DATA );
558  if( !NT_SUCCESS(status) ) {
559  ERR("openTcpFile returned 0x%08lx\n", status);
560  return 0;
561  }
562 
563  IpArpTable = HeapAlloc
564  ( GetProcessHeap(), 0,
565  sizeof(DWORD) + (sizeof(MIB_IPNETROW) * totalNumber) );
566  if (!IpArpTable) {
567  closeTcpFile(tcpFile);
568  return NULL;
569  }
570 
571  status = tdiGetEntityIDSet( tcpFile, &entitySet, &numEntities );
572 
573  for( i = 0; i < numEntities; i++ ) {
574  if( isInterface( &entitySet[i] ) &&
575  hasArp( tcpFile, &entitySet[i] ) ) {
576 
577  status = tdiGetSetOfThings( tcpFile,
581  AT_ENTITY,
582  entitySet[i].tei_instance,
583  0,
584  sizeof(MIB_IPNETROW),
585  (PVOID *)&AdapterArpTable,
586  &returnSize );
587 
588  if( status == STATUS_SUCCESS ) {
589  for( TmpIdx = 0; TmpIdx < returnSize; TmpIdx++, CurrIdx++ )
590  IpArpTable->table[CurrIdx] = AdapterArpTable[TmpIdx];
591  tdiFreeThingSet( AdapterArpTable );
592  }
593  }
594  }
595 
596  closeTcpFile( tcpFile );
597 
598  tdiFreeThingSet( entitySet );
599  IpArpTable->dwNumEntries = CurrIdx;
600 
601  return IpArpTable;
602 }
#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:54
NTSTATUS tdiGetEntityIDSet(HANDLE tcpFile, TDIEntityID **entitySet, PDWORD numEntities)
Definition: enum.c:122
DWORD getNumArpEntries(void)
#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 GetProcessHeap()
Definition: compat.h:595
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:110
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
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 NULL
Definition: types.h:112
#define INFO_TYPE_PROVIDER
Definition: tdiinfo.h:69
NTSTATUS openTcpFile(PHANDLE tcpFile, ACCESS_MASK DesiredAccess)
Definition: handle.c:12
#define STATUS_SUCCESS
Definition: shellext.h:65
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:101
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
DWORD dwTimeExcds
Definition: ipmib.h:179
DWORD dwEchoReps
Definition: ipmib.h:184
#define NO_ERROR
Definition: dderror.h:5
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
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:101

◆ 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:101
#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 
338  if (family != AF_INET && family != AF_INET6)
340 
341  return NO_ERROR;
342 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
#define NO_ERROR
Definition: dderror.h:5
#define AF_INET6
Definition: winsock.h:369
#define AF_INET
Definition: tcpip.h:117

Referenced by GetIpStatisticsEx().

◆ getNumArpEntries()

DWORD getNumArpEntries ( void  )

Definition at line 495 of file ipstats_reactos.c.

496 {
497  DWORD numEntities;
498  TDIEntityID *entitySet = NULL;
499  HANDLE tcpFile;
500  int i, totalNumber = 0;
502  PMIB_IPNETROW IpArpTable = NULL;
503  DWORD returnSize;
504 
505  TRACE("called.\n");
506 
507  status = openTcpFile( &tcpFile, FILE_READ_DATA );
508  if( !NT_SUCCESS(status) ) {
509  ERR("openTcpFile returned 0x%08lx\n", status);
510  return 0;
511  }
512 
513  status = tdiGetEntityIDSet( tcpFile, &entitySet, &numEntities );
514 
515  for( i = 0; i < numEntities; i++ ) {
516  if( isInterface( &entitySet[i] ) &&
517  hasArp( tcpFile, &entitySet[i] ) ) {
518 
519  status = tdiGetSetOfThings( tcpFile,
523  AT_ENTITY,
524  entitySet[i].tei_instance,
525  0,
526  sizeof(MIB_IPNETROW),
527  (PVOID *)&IpArpTable,
528  &returnSize );
529 
530  if( status == STATUS_SUCCESS ) totalNumber += returnSize;
531  if( IpArpTable ) {
532  tdiFreeThingSet( IpArpTable );
533  IpArpTable = NULL;
534  }
535  }
536  }
537 
538  closeTcpFile( tcpFile );
539  if( entitySet ) tdiFreeThingSet( entitySet );
540  return totalNumber;
541 }
#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:54
NTSTATUS tdiGetEntityIDSet(HANDLE tcpFile, TDIEntityID **entitySet, PDWORD numEntities)
Definition: enum.c:122
#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
BOOL hasArp(HANDLE tcpFile, TDIEntityID *arp_maybe)
#define ERR(fmt,...)
Definition: debug.h:110
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
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 NULL
Definition: types.h:112
#define INFO_TYPE_PROVIDER
Definition: tdiinfo.h:69
NTSTATUS openTcpFile(PHANDLE tcpFile, ACCESS_MASK DesiredAccess)
Definition: handle.c:12
#define STATUS_SUCCESS
Definition: shellext.h:65
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 366 of file ipstats_reactos.c.

367 {
368  DWORD numEntities, numRoutes = 0;
369  TDIEntityID *entitySet;
370  HANDLE tcpFile;
371  int i;
373 
374  TRACE("called.\n");
375 
376  status = openTcpFile( &tcpFile, FILE_READ_DATA );
377  if( !NT_SUCCESS(status) ) {
378  ERR("openTcpFile returned 0x%08lx\n", status);
379  return 0;
380  }
381 
382  status = tdiGetEntityIDSet( tcpFile, &entitySet, &numEntities );
383  if( !NT_SUCCESS(status) ) {
384  ERR("tdiGetEntityIDSet returned 0x%08lx\n", status);
385  closeTcpFile( tcpFile );
386  return 0;
387  }
388 
389  for( i = 0; i < numEntities; i++ ) {
390  if( isIpEntity( tcpFile, &entitySet[i] ) ) {
391  IPSNMPInfo isnmp;
392  memset( &isnmp, 0, sizeof( isnmp ) );
393  status = tdiGetMibForIpEntity( tcpFile, &entitySet[i], &isnmp );
394  if( !NT_SUCCESS(status) ) {
395  ERR("tdiGetMibForIpEntity returned 0x%08lx, for i = %d\n", status, i);
396  numRoutes = 0;
397  break;
398  }
399  numRoutes += isnmp.ipsi_numroutes;
400  }
401  }
402 
403  TRACE("numRoutes = %lu\n", numRoutes);
404 
405  tdiFreeThingSet( entitySet );
406  closeTcpFile( tcpFile );
407 
408  return numRoutes;
409 }
BOOL isIpEntity(HANDLE tcpFile, TDIEntityID *ent)
LONG NTSTATUS
Definition: precomp.h:26
ULONG ipsi_numroutes
Definition: tcpioctl.h:157
NTSTATUS tdiGetEntityIDSet(HANDLE tcpFile, TDIEntityID **entitySet, PDWORD numEntities)
Definition: enum.c:122
#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:110
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
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 730 of file ipstats_reactos.c.

731 {
732  DWORD numEntities;
733  TDIEntityID *entitySet = NULL;
734  HANDLE tcpFile;
735  int i, totalNumber = 0;
737  PMIB_TCPROW IpTcpTable = NULL;
738  DWORD returnSize;
739 
740  TRACE("called.\n");
741 
742  status = openTcpFile( &tcpFile, FILE_READ_DATA );
743  if( !NT_SUCCESS(status) ) {
744  ERR("openTcpFile returned 0x%08lx\n", status);
745  return 0;
746  }
747 
748  status = tdiGetEntityIDSet( tcpFile, &entitySet, &numEntities );
749 
750  for( i = 0; i < numEntities; i++ ) {
751  if( entitySet[i].tei_entity == CO_TL_ENTITY &&
752  hasArp( tcpFile, &entitySet[i] ) ) {
753 
754  status = tdiGetSetOfThings( tcpFile,
758  CO_TL_ENTITY,
759  entitySet[i].tei_instance,
760  0,
761  sizeof(MIB_TCPROW),
762  (PVOID *)&IpTcpTable,
763  &returnSize );
764 
765  if( status == STATUS_SUCCESS ) totalNumber += returnSize;
766  if( IpTcpTable ) {
767  tdiFreeThingSet( IpTcpTable );
768  IpTcpTable = NULL;
769  }
770  }
771  }
772 
773  closeTcpFile( tcpFile );
774  if( entitySet ) tdiFreeThingSet( entitySet );
775  return totalNumber;
776 }
LONG NTSTATUS
Definition: precomp.h:26
#define IP_MIB_ARPTABLE_ENTRY_ID
Definition: tcpioctl.h:54
NTSTATUS tdiGetEntityIDSet(HANDLE tcpFile, TDIEntityID **entitySet, PDWORD numEntities)
Definition: enum.c:122
#define FILE_READ_DATA
Definition: nt_native.h:628
#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:110
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
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 NULL
Definition: types.h:112
#define INFO_TYPE_PROVIDER
Definition: tdiinfo.h:69
NTSTATUS openTcpFile(PHANDLE tcpFile, ACCESS_MASK DesiredAccess)
Definition: handle.c:12
#define STATUS_SUCCESS
Definition: shellext.h:65
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 619 of file ipstats_reactos.c.

620 {
621  DWORD numEntities;
622  TDIEntityID *entitySet = NULL;
623  HANDLE tcpFile;
624  int i, totalNumber = 0;
626  PMIB_UDPROW IpUdpTable = NULL;
627  DWORD returnSize;
628 
629  TRACE("called.\n");
630 
631  status = openTcpFile( &tcpFile, FILE_READ_DATA );
632  if( !NT_SUCCESS(status) ) {
633  ERR("openTcpFile returned 0x%08lx\n", status);
634  return 0;
635  }
636 
637  status = tdiGetEntityIDSet( tcpFile, &entitySet, &numEntities );
638 
639  for( i = 0; i < numEntities; i++ ) {
640  if( entitySet[i].tei_entity == CL_TL_ENTITY &&
641  hasArp( tcpFile, &entitySet[i] ) ) {
642 
643  status = tdiGetSetOfThings( tcpFile,
647  CL_TL_ENTITY,
648  entitySet[i].tei_instance,
649  0,
650  sizeof(MIB_UDPROW),
651  (PVOID *)&IpUdpTable,
652  &returnSize );
653 
654  if( status == STATUS_SUCCESS ) totalNumber += returnSize;
655  if( IpUdpTable ) {
656  tdiFreeThingSet( IpUdpTable );
657  IpUdpTable = NULL;
658  }
659  }
660  }
661 
662  closeTcpFile( tcpFile );
663  if( entitySet ) tdiFreeThingSet( entitySet );
664  return totalNumber;
665 }
LONG NTSTATUS
Definition: precomp.h:26
#define IP_MIB_ARPTABLE_ENTRY_ID
Definition: tcpioctl.h:54
NTSTATUS tdiGetEntityIDSet(HANDLE tcpFile, TDIEntityID **entitySet, PDWORD numEntities)
Definition: enum.c:122
#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
BOOL hasArp(HANDLE tcpFile, TDIEntityID *arp_maybe)
#define ERR(fmt,...)
Definition: debug.h:110
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
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 NULL
Definition: types.h:112
#define INFO_TYPE_PROVIDER
Definition: tdiinfo.h:69
NTSTATUS openTcpFile(PHANDLE tcpFile, ACCESS_MASK DesiredAccess)
Definition: handle.c:12
#define STATUS_SUCCESS
Definition: shellext.h:65
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 424 of file ipstats_reactos.c.

425 {
426  RouteTable *out_route_table;
427  DWORD numRoutes = getNumRoutes(), routesAdded = 0;
428  TDIEntityID ent;
429  HANDLE tcpFile;
430  NTSTATUS status = openTcpFile( &tcpFile, FILE_READ_DATA );
431  int i;
432 
433  if( !NT_SUCCESS(status) )
434  return 0;
435 
436  TRACE("GETTING ROUTE TABLE\n");
437 
438  out_route_table = HeapAlloc( GetProcessHeap(), 0,
439  sizeof(RouteTable) +
440  (sizeof(RouteEntry) * (numRoutes - 1)) );
441  if (!out_route_table) {
442  closeTcpFile(tcpFile);
443  return NULL;
444  }
445 
446  out_route_table->numRoutes = numRoutes;
447 
448  for( i = 0; routesAdded < out_route_table->numRoutes; i++ ) {
449  int j;
450  IPRouteEntry *route_set;
451 
452  getNthIpEntity( tcpFile, i, &ent );
453 
454  tdiGetRoutesForIpEntity( tcpFile, &ent, &route_set, &numRoutes );
455 
456  if( !route_set ) {
457  closeTcpFile( tcpFile );
458  HeapFree( GetProcessHeap(), 0, out_route_table );
459  return 0;
460  }
461 
462  TRACE("%lu routes in instance %d\n", numRoutes, i);
463 #if 0
464  HexDump( route_set,
465  sizeof( IPRouteEntry ) *
466  snmpInfo.ipsi_numroutes );
467 #endif
468 
469  for( j = 0; j < numRoutes; j++ ) {
470  int routeNum = j + routesAdded;
471  out_route_table->routes[routeNum].dest =
472  route_set[j].ire_dest;
473  out_route_table->routes[routeNum].mask =
474  route_set[j].ire_mask;
475  out_route_table->routes[routeNum].gateway =
476  route_set[j].ire_gw;
477  out_route_table->routes[routeNum].ifIndex =
478  route_set[j].ire_index;
479  out_route_table->routes[routeNum].metric =
480  route_set[j].ire_metric1;
481  }
482 
483  if( route_set ) tdiFreeThingSet( route_set );
484 
485  routesAdded += numRoutes;
486  }
487 
488  closeTcpFile( tcpFile );
489 
490  TRACE("status = 0x%08lx, out_route_table = 0x%p\n", status, out_route_table);
491 
492  return out_route_table;
493 }
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
#define FILE_READ_DATA
Definition: nt_native.h:628
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:595
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
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 NULL
Definition: types.h:112
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:594
Definition: ps.c:97

Referenced by getInterfaceGatewayByIndex(), and GetIpForwardTable().

◆ getTCPStats()

DWORD getTCPStats ( MIB_TCPSTATS stats,
DWORD  family 
)

Definition at line 344 of file ipstats_reactos.c.

345 {
346  if (!stats)
348 
349  if (family != AF_INET && family != AF_INET6)
351 
352  return NO_ERROR;
353 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
#define NO_ERROR
Definition: dderror.h:5
#define AF_INET6
Definition: winsock.h:369
#define AF_INET
Definition: tcpip.h:117

Referenced by GetTcpStatisticsEx().

◆ getTcpTable()

PVOID getTcpTable ( CLASS_TABLE  Class)

Definition at line 778 of file ipstats_reactos.c.

779 {
780  DWORD numEntities, returnSize;
781  TDIEntityID *entitySet;
782  HANDLE tcpFile;
783  int i, totalNumber, TmpIdx, CurrIdx = 0;
785  PMIB_TCPTABLE IpTcpTable = NULL;
786  PVOID AdapterTcpTable = NULL;
787 
788  TRACE("called.\n");
789 
790  totalNumber = getNumTcpEntries();
791 
792  status = openTcpFile( &tcpFile, FILE_READ_DATA );
793  if( !NT_SUCCESS(status) ) {
794  ERR("openTcpFile returned 0x%08lx\n", status);
795  return 0;
796  }
797 
798  IpTcpTable = HeapAlloc
799  ( GetProcessHeap(), 0,
800  UdpTcpTableCall[Class].TcpOffset + (UdpTcpTableCall[Class].TcpSize * totalNumber) );
801  if (!IpTcpTable) {
802  closeTcpFile(tcpFile);
803  return NULL;
804  }
805 
806  status = tdiGetEntityIDSet( tcpFile, &entitySet, &numEntities );
807 
808  for( i = 0; i < numEntities; i++ ) {
809  if( entitySet[i].tei_entity == CO_TL_ENTITY &&
810  hasArp( tcpFile, &entitySet[i] ) ) {
811 
812  status = tdiGetSetOfThings( tcpFile,
815  UdpTcpTableCall[Class].TOIID,
816  CO_TL_ENTITY,
817  entitySet[i].tei_instance,
818  0,
819  UdpTcpTableCall[Class].TcpSize,
820  &AdapterTcpTable,
821  &returnSize );
822 
823  if( status == STATUS_SUCCESS ) {
824  for( TmpIdx = 0; TmpIdx < returnSize; TmpIdx++, CurrIdx++ )
825  CopyMemory(Add2Ptr(IpTcpTable, UdpTcpTableCall[Class].TcpOffset + UdpTcpTableCall[Class].TcpSize * CurrIdx),
826  Add2Ptr(AdapterTcpTable, UdpTcpTableCall[Class].TcpSize * TmpIdx),
827  UdpTcpTableCall[Class].TcpSize);
828  tdiFreeThingSet( AdapterTcpTable );
829  }
830  }
831  }
832 
833  closeTcpFile( tcpFile );
834 
835  tdiFreeThingSet( entitySet );
836  IpTcpTable->dwNumEntries = CurrIdx;
837 
838  return IpTcpTable;
839 }
#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
#define FILE_READ_DATA
Definition: nt_native.h:628
#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:595
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define CopyMemory
Definition: winbase.h:1665
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:110
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
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 NULL
Definition: types.h:112
#define INFO_TYPE_PROVIDER
Definition: tdiinfo.h:69
NTSTATUS openTcpFile(PHANDLE tcpFile, ACCESS_MASK DesiredAccess)
Definition: handle.c:12
struct _TABLE_CALL UdpTcpTableCall[]
#define STATUS_SUCCESS
Definition: shellext.h:65
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 355 of file ipstats_reactos.c.

356 {
357  if (!stats)
359 
360  if (family != AF_INET && family != AF_INET6)
362 
363  return NO_ERROR;
364 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
#define NO_ERROR
Definition: dderror.h:5
#define AF_INET6
Definition: winsock.h:369
#define AF_INET
Definition: tcpip.h:117

Referenced by GetUdpStatisticsEx().

◆ getUdpTable()

PVOID getUdpTable ( CLASS_TABLE  Class)

Definition at line 667 of file ipstats_reactos.c.

668 {
669  DWORD numEntities, returnSize;
670  TDIEntityID *entitySet;
671  HANDLE tcpFile;
672  int i, totalNumber, TmpIdx, CurrIdx = 0;
674  PMIB_UDPTABLE IpUdpTable = NULL;
675  PVOID AdapterUdpTable = NULL;
676 
677  TRACE("called.\n");
678 
679  totalNumber = getNumUdpEntries();
680 
681  status = openTcpFile( &tcpFile, FILE_READ_DATA );
682  if( !NT_SUCCESS(status) ) {
683  ERR("openTcpFile returned 0x%08lx\n", status);
684  return 0;
685  }
686 
687  IpUdpTable = HeapAlloc
688  ( GetProcessHeap(), 0,
689  UdpTcpTableCall[Class].UdpOffset + (UdpTcpTableCall[Class].UdpSize * totalNumber) );
690  if (!IpUdpTable) {
691  closeTcpFile(tcpFile);
692  return NULL;
693  }
694 
695  status = tdiGetEntityIDSet( tcpFile, &entitySet, &numEntities );
696 
697  for( i = 0; i < numEntities; i++ ) {
698  if( entitySet[i].tei_entity == CL_TL_ENTITY &&
699  hasArp( tcpFile, &entitySet[i] ) ) {
700 
701  status = tdiGetSetOfThings( tcpFile,
704  UdpTcpTableCall[Class].TOIID,
705  CL_TL_ENTITY,
706  entitySet[i].tei_instance,
707  0,
708  UdpTcpTableCall[Class].UdpSize,
709  &AdapterUdpTable,
710  &returnSize );
711 
712  if( status == STATUS_SUCCESS ) {
713  for( TmpIdx = 0; TmpIdx < returnSize; TmpIdx++, CurrIdx++ )
714  CopyMemory(Add2Ptr(IpUdpTable, UdpTcpTableCall[Class].UdpOffset + UdpTcpTableCall[Class].UdpSize * CurrIdx),
715  Add2Ptr(AdapterUdpTable, UdpTcpTableCall[Class].UdpSize * TmpIdx),
716  UdpTcpTableCall[Class].UdpSize);
717  tdiFreeThingSet( AdapterUdpTable );
718  }
719  }
720  }
721 
722  closeTcpFile( tcpFile );
723 
724  tdiFreeThingSet( entitySet );
725  IpUdpTable->dwNumEntries = CurrIdx;
726 
727  return IpUdpTable;
728 }
#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
DWORD dwNumEntries
Definition: udpmib.h:34
#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 GetProcessHeap()
Definition: compat.h:595
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define CopyMemory
Definition: winbase.h:1665
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:110
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
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 NULL
Definition: types.h:112
#define INFO_TYPE_PROVIDER
Definition: tdiinfo.h:69
NTSTATUS openTcpFile(PHANDLE tcpFile, ACCESS_MASK DesiredAccess)
Definition: handle.c:12
struct _TABLE_CALL UdpTcpTableCall[]
#define STATUS_SUCCESS
Definition: shellext.h:65
static SERVICE_STATUS status
Definition: service.c:31
#define INFO_CLASS_PROTOCOL
Definition: tdiinfo.h:65
Definition: ps.c:97

Referenced by GetExtendedUdpTable().