mirror of
https://github.com/reactos/reactos.git
synced 2025-07-24 15:13:36 +00:00
Created framework for new network utility applications.
svn path=/trunk/; revision=3376
This commit is contained in:
parent
ed21a6af20
commit
3a41864fff
16 changed files with 934 additions and 0 deletions
74
rosapps/net/netstat/netstat.c
Normal file
74
rosapps/net/netstat/netstat.c
Normal file
|
@ -0,0 +1,74 @@
|
|||
/*
|
||||
* netstat - display IP stack statistics.
|
||||
*
|
||||
* This source code is in the PUBLIC DOMAIN and has NO WARRANTY.
|
||||
*
|
||||
* Robert Dickenson <robd@reactos.org>, August 15, 2002.
|
||||
*/
|
||||
#include <windows.h>
|
||||
#include <tchar.h>
|
||||
#include <stdio.h>
|
||||
#include <time.h>
|
||||
|
||||
#include <iptypes.h>
|
||||
#include <ipexport.h>
|
||||
#include <iphlpapi.h>
|
||||
#include <snmp.h>
|
||||
|
||||
#include "trace.h"
|
||||
#include "resource.h"
|
||||
|
||||
|
||||
#define MAX_RESLEN 4000
|
||||
|
||||
/*
|
||||
typedef struct {
|
||||
UINT idLength;
|
||||
UINT* ids;
|
||||
} AsnObjectIdentifier;
|
||||
|
||||
VOID SnmpUtilPrintAsnAny(AsnAny* pAny); // pointer to value to print
|
||||
VOID SnmpUtilPrintOid(AsnObjectIdentifier* Oid); // object identifier to print
|
||||
|
||||
*/
|
||||
void test_snmp(void)
|
||||
{
|
||||
int nBytes = 500;
|
||||
BYTE* pCache;
|
||||
|
||||
pCache = (BYTE*)SnmpUtilMemAlloc(nBytes);
|
||||
if (pCache != NULL) {
|
||||
AsnObjectIdentifier* pOidSrc = NULL;
|
||||
AsnObjectIdentifier AsnObId;
|
||||
if (SnmpUtilOidCpy(&AsnObId, pOidSrc)) {
|
||||
//
|
||||
//
|
||||
//
|
||||
SnmpUtilOidFree(&AsnObId);
|
||||
}
|
||||
SnmpUtilMemFree(pCache);
|
||||
} else {
|
||||
_tprintf(_T("ERROR: call to SnmpUtilMemAlloc() failed\n"));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void usage(void)
|
||||
{
|
||||
TCHAR buffer[MAX_RESLEN];
|
||||
|
||||
int length = LoadString(GetModuleHandle(NULL), IDS_APP_USAGE, buffer, sizeof(buffer)/sizeof(buffer[0]));
|
||||
_fputts(buffer, stderr);
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
if (argc > 1) {
|
||||
usage();
|
||||
return 1;
|
||||
}
|
||||
_tprintf(_T("\nActive Connections\n\n")\
|
||||
_T(" Proto Local Address Foreign Address State\n\n"));
|
||||
test_snmp();
|
||||
return 0;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue