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)
65 #if NETSTACK_CONF_WITH_IPV6
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.
static uip_ipaddr_t ipaddr
Pointer to prefix information option in uip_buf.
#define UIP_TTL
The IP TTL (time to live) of IP packets sent by uIP.
uint16_t uip_chksum(uint16_t *data, uint16_t len)
Calculate the Internet checksum over a buffer.
#define ICMP6_ECHO_REQUEST
Echo request.
Main header file for the Contiki shell
void shell_output_str(struct shell_command *c, char *text1, const char *text2)
Output strings from a shell command.
void etimer_set(struct etimer *et, clock_time_t interval)
Set an event timer.
#define PROCESS_END()
Define the end of a process.
#define PROCESS(name, strname)
Declare a process.
static void input(void)
Process a received 6lowpan packet.
#define PROCESS_THREAD(name, ev, data)
Define the body of a process.
uint16_t uip_icmp6chksum(void)
Calculate the ICMP checksum of the packet in uip_buf.
#define PROCESS_EXIT()
Exit the currently running process.
#define UIP_ICMP6_ECHO_REQUEST_LEN
Echo Request constant part length.
#define uip_ipaddr_copy(dest, src)
Copy an IP address from one place to another.
#define SHELL_COMMAND(name, command, description, process)
Define a shell command.
#define UIP_IP_BUF
Pointer to IP header.
process_event_t resolv_event_found
Event that is broadcasted when a DNS name has been resolved.
int shell_event_input
The event number for shell input data.
void shell_register_command(struct shell_command *c)
Register a command with the shell.
void uip_ds6_select_src(uip_ipaddr_t *src, uip_ipaddr_t *dst)
Source address selection, see RFC 3484.
void tcpip_ipv6_output(void)
This function does address resolution and then calls tcpip_output.
#define NULL
The null pointer.
resolv_status_t resolv_lookup(const char *name, uip_ipaddr_t **ipaddr)
Look up a hostname in the array of known hostnames.
int etimer_expired(struct etimer *et)
Check if an event timer has expired.
Structure for shell input data.
Hostname is fresh and usable.
#define UIP_ICMP_BUF
Pointer to ICMP header.
#define CLOCK_SECOND
A second, measured in system clock time.
static volatile clock_time_t count
These routines define the AVR-specific calls declared in /core/sys/clock.h CLOCK_SECOND is the number...
#define uiplib_ipaddrconv
Convert a textual representation of an IP address to a numerical representation.
uint8_t tcpip_output(const uip_lladdr_t *a)
Output packet to layer 2 The eventual parameter is the MAC address of the destination.
uip_ds6_netif_t uip_ds6_if
The single interface.
#define PROCESS_WAIT_EVENT()
Wait for an event to be posted to the process.
CCIF uint16_t uip_htons(uint16_t val)
Convert a 16-bit quantity from host byte order to network byte order.
#define PROCESS_BEGIN()
Define the beginning of a process.