Created framework for new network utility applications.
[reactos.git] / rosapps / net / netstat / netstat.c
1 /*
2 * netstat - display IP stack statistics.
3 *
4 * This source code is in the PUBLIC DOMAIN and has NO WARRANTY.
5 *
6 * Robert Dickenson <robd@reactos.org>, August 15, 2002.
7 */
8 #include <windows.h>
9 #include <tchar.h>
10 #include <stdio.h>
11 #include <time.h>
12
13 #include <iptypes.h>
14 #include <ipexport.h>
15 #include <iphlpapi.h>
16 #include <snmp.h>
17
18 #include "trace.h"
19 #include "resource.h"
20
21
22 #define MAX_RESLEN 4000
23
24 /*
25 typedef struct {
26 UINT idLength;
27 UINT* ids;
28 } AsnObjectIdentifier;
29
30 VOID SnmpUtilPrintAsnAny(AsnAny* pAny); // pointer to value to print
31 VOID SnmpUtilPrintOid(AsnObjectIdentifier* Oid); // object identifier to print
32
33 */
34 void test_snmp(void)
35 {
36 int nBytes = 500;
37 BYTE* pCache;
38
39 pCache = (BYTE*)SnmpUtilMemAlloc(nBytes);
40 if (pCache != NULL) {
41 AsnObjectIdentifier* pOidSrc = NULL;
42 AsnObjectIdentifier AsnObId;
43 if (SnmpUtilOidCpy(&AsnObId, pOidSrc)) {
44 //
45 //
46 //
47 SnmpUtilOidFree(&AsnObId);
48 }
49 SnmpUtilMemFree(pCache);
50 } else {
51 _tprintf(_T("ERROR: call to SnmpUtilMemAlloc() failed\n"));
52 }
53 }
54
55
56 void usage(void)
57 {
58 TCHAR buffer[MAX_RESLEN];
59
60 int length = LoadString(GetModuleHandle(NULL), IDS_APP_USAGE, buffer, sizeof(buffer)/sizeof(buffer[0]));
61 _fputts(buffer, stderr);
62 }
63
64 int main(int argc, char *argv[])
65 {
66 if (argc > 1) {
67 usage();
68 return 1;
69 }
70 _tprintf(_T("\nActive Connections\n\n")\
71 _T(" Proto Local Address Foreign Address State\n\n"));
72 test_snmp();
73 return 0;
74 }