40 #include "contiki-net.h"
43 PROCESS(shell_ping_process,
"ping");
46 "ping <host>: ping an IP host",
50 #define UIP_IP_BUF ((struct uip_ip_hdr *)&uip_buf[UIP_LLH_LEN])
51 #define UIP_ICMP_BUF ((struct uip_icmp_hdr *)&uip_buf[UIP_LLH_LEN + UIP_IPH_LEN])
52 #define PING_DATALEN 16
54 #define ICMP_ECHO_REPLY 0
57 #define ICMP6_ECHO_REPLY 129
58 #define ICMP6_ECHO 128
60 static uip_ipaddr_t remoteaddr;
61 static unsigned char running;
64 send_ping(uip_ipaddr_t *dest_addr)
67 static uint16_t count;
86 UIP_IPH_LEN + PING_DATALEN;
97 static uint16_t ipid = 0;
98 static uint16_t seqno = 0;
117 uip_len = UIP_ICMPH_LEN + UIP_IPH_LEN + PING_DATALEN;
123 UIP_ICMPH_LEN + PING_DATALEN);
142 "ping <server>: server as address",
"");
147 send_ping(&remoteaddr);
162 if(input->len1 + input->len2 == 0) {
168 if((
char *)data !=
NULL &&
171 telnet_connect(&s, server, serveraddr, nick);
183 shell_ping_init(
void)
uint16_t uip_ipchksum(void)
Calculate the IP header checksum of the packet header in uip_buf.
uip_len
The length of the packet in the uip_buf buffer.
int etimer_expired(struct etimer *et)
Check if an event timer has expired.
void tcpip_ipv6_output(void)
This function does address resolution and then calls tcpip_output.
Hostname is fresh and usable.
void shell_output_str(struct shell_command *c, char *text1, const char *text2)
Output strings from a shell command.
#define PROCESS_EXIT()
Exit the currently running process.
#define PROCESS_BEGIN()
Define the beginning of a process.
uint16_t uip_chksum(uint16_t *buf, uint16_t len)
Calculate the Internet checksum over a buffer.
Main header file for the Contiki shell
#define NULL
The null pointer.
uint8_t tcpip_output(const uip_lladdr_t *a)
Output packet to layer 2 The eventual parameter is the MAC address of the destination.
#define uiplib_ipaddrconv
Convert a textual representation of an IP address to a numerical representation.
#define PROCESS_THREAD(name, ev, data)
Define the body of a process.
#define UIP_IP_BUF
Pointer to IP header.
#define PROCESS_END()
Define the end of a process.
uint16_t uip_icmp6chksum(void)
Calculate the ICMP checksum of the packet in uip_buf.
CCIF process_event_t resolv_event_found
Event that is broadcasted when a DNS name has been resolved.
#define uip_ipaddr_copy(dest, src)
Copy an IP address from one place to another.
Structure for shell input data.
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.
#define PROCESS_WAIT_EVENT()
Wait for an event to be posted to the process.
#define ICMP6_ECHO_REQUEST
Echo request.
#define PROCESS(name, strname)
Declare a process.
void uip_ds6_select_src(uip_ipaddr_t *src, uip_ipaddr_t *dst)
Source address selection, see RFC 3484.
#define UIP_ICMP_BUF
Pointer to ICMP header.
int shell_event_input
The event number for shell input data.
void etimer_set(struct etimer *et, clock_time_t interval)
Set an event timer.
#define UIP_TTL
The IP TTL (time to live) of IP packets sent by uIP.
#define UIP_ICMP6_ECHO_REQUEST_LEN
Echo Request constant part length.
#define SHELL_COMMAND(name, command, description, process)
Define a shell command.
#define CLOCK_SECOND
A second, measured in system clock time.