ReactOS  0.4.12-dev-18-gf469aca
netstat.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  MIB_TCPEXROW
 
struct  MIB_TCPEXTABLE
 
struct  MIB_UDPEXROW
 
struct  MIB_UDPEXTABLE
 

Macros

#define HOSTNAMELEN   256
 
#define PORTNAMELEN   256
 
#define ADDRESSLEN   HOSTNAMELEN+PORTNAMELEN
 

Typedefs

typedef struct MIB_TCPEXROWPMIB_TCPEXROW
 
typedef struct MIB_TCPEXTABLEPMIB_TCPEXTABLE
 
typedef struct MIB_UDPEXROWPMIB_UDPEXROW
 
typedef struct MIB_UDPEXTABLEPMIB_UDPEXTABLE
 

Functions

BOOL ParseCmdline (int argc, char *argv[])
 
BOOL DisplayOutput (VOID)
 
DWORD DoFormatMessage (DWORD ErrorCode)
 
VOID ShowIpStatistics (VOID)
 
VOID ShowIcmpStatistics (VOID)
 
VOID ShowTcpStatistics (VOID)
 
VOID ShowUdpStatistics (VOID)
 
VOID ShowEthernetStatistics (VOID)
 
VOID ShowTcpTable (VOID)
 
VOID ShowUdpTable (VOID)
 
PCHAR GetPortName (UINT Port, PCSTR Proto, CHAR Name[PORTNAMELEN], INT NameLen)
 
PCHAR GetIpHostName (BOOL local, UINT ipaddr, CHAR name[HOSTNAMELEN], int namelen)
 
VOID Usage (VOID)
 

Variables

BOOL bNoOptions = FALSE
 
BOOL bDoShowAllCons = FALSE
 
BOOL bDoShowProcName = FALSE
 
BOOL bDoShowEthStats = FALSE
 
BOOL bDoShowNumbers = FALSE
 
BOOL bDoShowProtoCons = FALSE
 
BOOL bDoShowRouteTable = FALSE
 
BOOL bDoShowProtoStats = FALSE
 
BOOL bDoShowProcessId = FALSE
 
BOOL bDoDispSeqComp = FALSE
 
BOOL bLoopOutput = FALSE
 

Macro Definition Documentation

◆ ADDRESSLEN

#define ADDRESSLEN   HOSTNAMELEN+PORTNAMELEN

Definition at line 5 of file netstat.h.

Referenced by ShowTcpTable(), and ShowUdpTable().

◆ HOSTNAMELEN

#define HOSTNAMELEN   256

Definition at line 3 of file netstat.h.

Referenced by ShowTcpTable(), and ShowUdpTable().

◆ PORTNAMELEN

#define PORTNAMELEN   256

Definition at line 4 of file netstat.h.

Referenced by ShowTcpTable(), and ShowUdpTable().

Typedef Documentation

◆ PMIB_TCPEXROW

◆ PMIB_TCPEXTABLE

◆ PMIB_UDPEXROW

◆ PMIB_UDPEXTABLE

Function Documentation

◆ DisplayOutput()

BOOL DisplayOutput ( VOID  )

◆ DoFormatMessage()

DWORD DoFormatMessage ( DWORD  ErrorCode)

Definition at line 52 of file netstat.c.

Referenced by GetIpHostName(), ShowEthernetStatistics(), ShowIcmpStatistics(), ShowIpStatistics(), ShowTcpStatistics(), ShowTcpTable(), ShowUdpStatistics(), ShowUdpTable(), and wmain().

53 {
54  LPVOID lpMsgBuf;
55  DWORD RetVal;
56 
57  if ((RetVal = FormatMessage(
61  NULL,
62  ErrorCode,
63  MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), /* Default language */
64  (LPTSTR) &lpMsgBuf,
65  0,
66  NULL )))
67  {
68  _tprintf(_T("%s"), (LPTSTR)lpMsgBuf);
69 
70  LocalFree(lpMsgBuf);
71  /* return number of TCHAR's stored in output buffer
72  * excluding '\0' - as FormatMessage does*/
73  return RetVal;
74  }
75  else
76  return 0;
77 }
#define _tprintf
Definition: tchar.h:506
_In_ NDIS_ERROR_CODE ErrorCode
Definition: ndis.h:4418
#define LANG_NEUTRAL
Definition: nls.h:22
#define SUBLANG_DEFAULT
Definition: nls.h:168
CHAR * LPTSTR
Definition: xmlstorage.h:192
#define FORMAT_MESSAGE_ALLOCATE_BUFFER
Definition: winbase.h:400
smooth NULL
Definition: ftsmooth.c:416
#define FORMAT_MESSAGE_FROM_SYSTEM
Definition: winbase.h:404
#define _T(x)
Definition: vfdio.h:22
unsigned long DWORD
Definition: ntddk_ex.h:95
#define FormatMessage
Definition: winbase.h:3609
#define FORMAT_MESSAGE_IGNORE_INSERTS
Definition: winbase.h:401
HLOCAL NTAPI LocalFree(HLOCAL hMem)
Definition: heapmem.c:1577
#define MAKELANGID(p, s)
Definition: nls.h:15

◆ GetIpHostName()

PCHAR GetIpHostName ( BOOL  local,
UINT  ipaddr,
CHAR  name[HOSTNAMELEN],
int  namelen 
)

◆ GetPortName()

PCHAR GetPortName ( UINT  Port,
PCSTR  Proto,
CHAR  Name[PORTNAMELEN],
INT  NameLen 
)

◆ ParseCmdline()

BOOL ParseCmdline ( int  argc,
char argv[] 
)

Definition at line 84 of file netstat.c.

Referenced by main().

85 {
86  LPSTR Proto;
87  CHAR c;
88  INT i;
89 
90  if ((argc == 1) || (_istdigit(*argv[1])))
91  bNoOptions = TRUE;
92 
93  /* Parse command line for options we have been given. */
94  for (i = 1; i < argc; i++)
95  {
96  if ((argc > 1) && (argv[i][0] == '-' || argv[i][0] == '/'))
97  {
98  while ((c = *++argv[i]) != '\0')
99  {
100  switch (tolower(c))
101  {
102  case 'a' :
104  break;
105  case 'b' :
107  break;
108  case 'e' :
110  break;
111  case 'n' :
113  break;
114  case 'p' :
116  Proto = argv[i+1];
117  if (!_stricmp("IP", Proto))
118  Protocol = IP;
119  else if (!_stricmp("ICMP", Proto))
120  Protocol = ICMP;
121  else if (!_stricmp("TCP", Proto))
122  Protocol = TCP;
123  else if (!_stricmp("UDP", Proto))
124  Protocol = UDP;
125  else
126  {
127  Usage();
128  return EXIT_FAILURE;
129  }
130  break;
131  case 'r' :
133  break;
134  case 's' :
136  break;
137  case 'o' :
139  break;
140  case 'v' :
141  _tprintf(_T("got v\n"));
143  break;
144  default :
145  Usage();
146  return EXIT_FAILURE;
147  }
148  }
149  }
150  else if (_istdigit(*argv[i]))
151  {
152  if (_stscanf(argv[i], "%lu", &Interval) != EOF)
153  bLoopOutput = TRUE;
154  else
155  return EXIT_FAILURE;
156  }
157 // else
158 // {
159 // Usage();
160 // EXIT_FAILURE;
161 // }
162  }
163 
164  return EXIT_SUCCESS;
165 }
BOOL bDoShowProtoCons
Definition: netstat.h:13
static int argc
Definition: ServiceArgs.c:12
#define _istdigit
Definition: tchar.h:1494
#define _tprintf
Definition: tchar.h:506
BOOL bDoShowProcessId
Definition: netstat.h:16
#define TRUE
Definition: types.h:120
Definition: netstat.c:29
char CHAR
Definition: xmlstorage.h:175
#define _stscanf
Definition: tchar.h:557
BOOL bDoShowNumbers
Definition: netstat.h:12
char * LPSTR
Definition: xmlstorage.h:182
#define _stricmp
Definition: cat.c:22
int32_t INT
Definition: typedefs.h:56
static char ** argv
Definition: ServiceArgs.c:11
#define EXIT_SUCCESS
Definition: rdjpgcom.c:55
GLenum GLclampf GLint i
Definition: glfuncs.h:14
BOOL bDoDispSeqComp
Definition: netstat.h:17
BOOL bDoShowEthStats
Definition: netstat.h:11
DWORD Interval
Definition: netstat.c:30
#define _T(x)
Definition: vfdio.h:22
Definition: netstat.c:29
#define EXIT_FAILURE
Definition: jerror.c:33
Definition: netstat.c:29
BOOL bDoShowProtoStats
Definition: netstat.h:15
BOOL bDoShowAllCons
Definition: netstat.h:9
BOOL bNoOptions
Definition: netstat.h:8
Definition: netstat.c:29
#define EOF
Definition: stdio.h:24
#define c
Definition: ke_i.h:80
BOOL bLoopOutput
Definition: netstat.h:18
int tolower(int c)
Definition: utclib.c:902
BOOL bDoShowRouteTable
Definition: netstat.h:14
VOID Usage()
Definition: netstat.c:624
BOOL bDoShowProcName
Definition: netstat.h:10

◆ ShowEthernetStatistics()

VOID ShowEthernetStatistics ( VOID  )

◆ ShowIcmpStatistics()

VOID ShowIcmpStatistics ( VOID  )

◆ ShowIpStatistics()

VOID ShowIpStatistics ( VOID  )

◆ ShowTcpStatistics()

VOID ShowTcpStatistics ( VOID  )

◆ ShowTcpTable()

VOID ShowTcpTable ( VOID  )

◆ ShowUdpStatistics()

VOID ShowUdpStatistics ( VOID  )

◆ ShowUdpTable()

VOID ShowUdpTable ( VOID  )

◆ Usage()

VOID Usage ( VOID  )

Definition at line 509 of file arp.c.

Referenced by _tmain(), Addhost(), AnalyzeArgv(), Deletehost(), main(), and ParseCmdline().

510 {
511  _tprintf(_T("\nDisplays and modifies the IP-to-Physical address translation tables used by\n"
512  "address resolution protocol (ARP).\n"
513  "\n"
514  "ARP -s inet_addr eth_addr [if_addr]\n"
515  "ARP -d inet_addr [if_addr]\n"
516  "ARP -a [inet_addr] [-N if_addr]\n"
517  "\n"
518  " -a Displays current ARP entries by interrogating the current\n"
519  " protocol data. If inet_addr is specified, the IP and Physical\n"
520  " addresses for only the specified computer are displayed. If\n"
521  " more than one network interface uses ARP, entries for each ARP\n"
522  " table are displayed.\n"
523  " -g Same as -a.\n"
524  " inet_addr Specifies an internet address.\n"
525  " -N if_addr Displays the ARP entries for the network interface specified\n"
526  " by if_addr.\n"
527  " -d Deletes the host specified by inet_addr. inet_addr may be\n"
528  " wildcarded with * to delete all hosts.\n"
529  " -s Adds the host and associates the Internet address inet_addr\n"
530  " with the Physical address eth_addr. The Physical address is\n"
531  " given as 6 hexadecimal bytes separated by hyphens. The entry\n"
532  " is permanent.\n"
533  " eth_addr Specifies a physical address.\n"
534  " if_addr If present, this specifies the Internet address of the\n"
535  " interface whose address translation table should be modified.\n"
536  " If not present, the first applicable interface will be used.\n"
537  "Example:\n"
538  " > arp -s 157.55.85.212 00-aa-00-62-c6-09 .... Adds a static entry.\n"
539  " > arp -a .... Displays the arp table.\n\n"));
540 }
#define _tprintf
Definition: tchar.h:506
#define _T(x)
Definition: vfdio.h:22

Variable Documentation

◆ bDoDispSeqComp

BOOL bDoDispSeqComp = FALSE

Definition at line 17 of file netstat.h.

Referenced by ParseCmdline().

◆ bDoShowAllCons

BOOL bDoShowAllCons = FALSE

Definition at line 9 of file netstat.h.

Referenced by DisplayOutput(), ParseCmdline(), and ShowTcpTable().

◆ bDoShowEthStats

BOOL bDoShowEthStats = FALSE

Definition at line 11 of file netstat.h.

Referenced by DisplayOutput(), and ParseCmdline().

◆ bDoShowNumbers

BOOL bDoShowNumbers = FALSE

Definition at line 12 of file netstat.h.

Referenced by GetIpHostName(), GetPortName(), and ParseCmdline().

◆ bDoShowProcessId

BOOL bDoShowProcessId = FALSE

Definition at line 16 of file netstat.h.

Referenced by DisplayTableHeader(), ParseCmdline(), ShowTcpTable(), and ShowUdpTable().

◆ bDoShowProcName

BOOL bDoShowProcName = FALSE

Definition at line 10 of file netstat.h.

Referenced by ParseCmdline().

◆ bDoShowProtoCons

BOOL bDoShowProtoCons = FALSE

Definition at line 13 of file netstat.h.

Referenced by DisplayOutput(), and ParseCmdline().

◆ bDoShowProtoStats

BOOL bDoShowProtoStats = FALSE

Definition at line 15 of file netstat.h.

Referenced by DisplayOutput(), and ParseCmdline().

◆ bDoShowRouteTable

BOOL bDoShowRouteTable = FALSE

Definition at line 14 of file netstat.h.

Referenced by DisplayOutput(), and ParseCmdline().

◆ bLoopOutput

BOOL bLoopOutput = FALSE

Definition at line 18 of file netstat.h.

Referenced by main(), and ParseCmdline().

◆ bNoOptions

BOOL bNoOptions = FALSE

Definition at line 8 of file netstat.h.

Referenced by DisplayOutput(), and ParseCmdline().