2 /* Maximum string lengths for ASCII ip address and port names */
3 #define HOSTNAMELEN 256
4 #define PORTNAMELEN 256
5 #define ADDRESSLEN HOSTNAMELEN+PORTNAMELEN
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 bDoDispSeqComp
= FALSE
; // -v
17 BOOL bLoopOutput
= FALSE
; // interval
20 /* Undocumented extended information structures available only on XP and higher */
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
28 } MIB_TCPEXROW
, *PMIB_TCPEXROW
;
33 } MIB_TCPEXTABLE
, *PMIB_TCPEXTABLE
;
36 DWORD dwLocalAddr
; // address on local computer
37 DWORD dwLocalPort
; // port number on local computer
39 } MIB_UDPEXROW
, *PMIB_UDPEXROW
;
44 } MIB_UDPEXTABLE
, *PMIB_UDPEXTABLE
;
47 /* function declerations */
48 BOOL
ParseCmdline(int argc
, char* argv
[]);
49 BOOL
DisplayOutput(VOID
);
50 DWORD
DoFormatMessage(DWORD ErrorCode
);
51 VOID
ShowIpStatistics(VOID
);
52 VOID
ShowIcmpStatistics(VOID
);
53 VOID
ShowTcpStatistics(VOID
);
54 VOID
ShowUdpStatistics(VOID
);
55 VOID
ShowEthernetStatistics(VOID
);
56 VOID
ShowTcpTable(VOID
);
57 VOID
ShowUdpTable(VOID
);
58 PCHAR
GetPortName(UINT Port
, PCSTR Proto
, CHAR Name
[PORTNAMELEN
], INT NameLen
);
59 PCHAR
GetIpHostName(BOOL local
, UINT ipaddr
, CHAR name
[HOSTNAMELEN
], int namelen
);