41 #include "contiki-net.h"
43 static const char closed[] =
44 {0x43, 0x4c, 0x4f, 0x53, 0x45, 0x44, 0};
45 static const char syn_rcvd[] =
46 {0x53, 0x59, 0x4e, 0x2d, 0x52, 0x43, 0x56,
48 static const char syn_sent[] =
49 {0x53, 0x59, 0x4e, 0x2d, 0x53, 0x45, 0x4e,
51 static const char established[] =
52 {0x45, 0x53, 0x54, 0x41, 0x42, 0x4c, 0x49,
53 0x53, 0x48, 0x45, 0x44, 0};
54 static const char fin_wait_1[] =
55 {0x46, 0x49, 0x4e, 0x2d, 0x57, 0x41, 0x49,
57 static const char fin_wait_2[] =
58 {0x46, 0x49, 0x4e, 0x2d, 0x57, 0x41, 0x49,
60 static const char closing[] =
61 {0x43, 0x4c, 0x4f, 0x53, 0x49,
63 static const char time_wait[] =
64 {0x54, 0x49, 0x4d, 0x45, 0x2d, 0x57, 0x41,
66 static const char last_ack[] =
67 {0x4c, 0x41, 0x53, 0x54, 0x2d, 0x41, 0x43,
69 static const char none[] =
70 {0x4e, 0x4f, 0x4e, 0x45, 0};
71 static const char running[] =
72 {0x52, 0x55, 0x4e, 0x4e, 0x49, 0x4e, 0x47,
74 static const char called[] =
75 {0x43, 0x41, 0x4c, 0x4c, 0x45, 0x44, 0};
76 static const char file_name[] =
77 {0x66, 0x69, 0x6c, 0x65, 0x2d, 0x73, 0x74,
79 static const char tcp_name[] =
80 {0x74, 0x63, 0x70, 0x2d, 0x63, 0x6f, 0x6e,
81 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e,
83 static const char proc_name[] =
84 {0x70, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73,
87 static const char *states[] = {
104 PROCESS(shell_netstat_process,
"netstat");
107 "netstat: show UDP and TCP connections",
108 &shell_netstat_process);
118 conn = &uip_conns[i];
119 snprintf(buf, BUFLEN,
120 "%d, %u.%u.%u.%u:%u, %s, %u, %u, %c %c",
130 (uip_outstanding(conn))?
'*':
' ',
138 shell_netstat_init(
void)
#define UIP_CONNS
The maximum number of simultaneously open TCP connections.
void shell_output_str(struct shell_command *c, char *text1, const char *text2)
Output strings from a shell command.
#define PROCESS_BEGIN()
Define the beginning of a process.
Representation of a uIP TCP connection.
uint8_t nrtx
The number of retransmissions for the last segment sent.
uint16_t lport
The local TCP port, in network byte order.
Main header file for the Contiki shell
uint8_t timer
The retransmission timer.
#define PROCESS_THREAD(name, ev, data)
Define the body of a process.
#define PROCESS_END()
Define the end of a process.
uint16_t rport
The local remote TCP port, in network byte order.
CCIF uint16_t uip_htons(uint16_t val)
Convert a 16-bit quantity from host byte order to network byte order.
void shell_register_command(struct shell_command *c)
Register a command with the shell.
uint8_t tcpstateflags
TCP state and flags.
#define PROCESS(name, strname)
Declare a process.
#define uip_stopped(conn)
Find out if the current connection has been previously stopped with uip_stop().
uip_ipaddr_t ripaddr
The IP address of the remote host.
#define SHELL_COMMAND(name, command, description, process)
Define a shell command.