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