1 
2 /* Maximum string lengths for ASCII ip address and port names */
3 #define HOSTNAMELEN     256
4 #define PORTNAMELEN     256
5 #define ADDRESSLEN      HOSTNAMELEN+PORTNAMELEN
6 
7 /* command line options */
8 BOOL bNoOptions        = FALSE; // print default
9 BOOL bDoShowAllCons    = FALSE; // -a
10 BOOL bDoShowProcName   = FALSE; // -b
11 BOOL bDoShowEthStats   = FALSE; // -e
12 BOOL bDoShowNumbers    = FALSE; // -n
13 BOOL bDoShowProtoCons  = FALSE; // -p
14 BOOL bDoShowRouteTable = FALSE; // -r
15 BOOL bDoShowProtoStats = FALSE; // -s
16 BOOL bDoShowProcessId  = FALSE; // -o
17 BOOL bDoDispSeqComp    = FALSE; // -v
18 BOOL bLoopOutput       = FALSE; // interval
19 
20 /* Undocumented extended information structures available only on XP and higher */
21 typedef struct {
22   DWORD dwState;        // state of the connection
23   DWORD dwLocalAddr;    // address on local computer
24   DWORD dwLocalPort;    // port number on local computer
25   DWORD dwRemoteAddr;   // address on remote computer
26   DWORD dwRemotePort;   // port number on remote computer
27   DWORD dwProcessId;
28 } MIB_TCPEXROW, *PMIB_TCPEXROW;
29 
30 typedef struct {
31     DWORD dwNumEntries;
32     MIB_TCPEXROW table;
33 } MIB_TCPEXTABLE, *PMIB_TCPEXTABLE;
34 
35 typedef struct {
36   DWORD   dwLocalAddr;    // address on local computer
37   DWORD   dwLocalPort;    // port number on local computer
38   DWORD   dwProcessId;
39 } MIB_UDPEXROW, *PMIB_UDPEXROW;
40 
41 typedef struct {
42     DWORD dwNumEntries;
43     MIB_UDPEXROW table;
44 } MIB_UDPEXTABLE, *PMIB_UDPEXTABLE;
45 
46 /* function declarations */
47 VOID ShowIpStatistics(VOID);
48 VOID ShowIcmpStatistics(VOID);
49 VOID ShowTcpStatistics(VOID);
50 VOID ShowUdpStatistics(VOID);
51 VOID ShowEthernetStatistics(VOID);
52 BOOL ShowTcpTable(VOID);
53 BOOL ShowUdpTable(VOID);
54 PCHAR GetPortName(UINT Port, PCSTR Proto, CHAR Name[], INT NameLen);
55 PCHAR GetIpHostName(BOOL Local, UINT IpAddr, CHAR Name[], INT NameLen);
56