added icmp_send function and moved rpl input function signature
This commit is contained in:
parent
dc1a5f70ff
commit
167b0d636e
3 changed files with 54 additions and 9 deletions
|
@ -64,6 +64,7 @@
|
|||
/** \brief temporary IP address */
|
||||
static uip_ipaddr_t tmp_ipaddr;
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
void
|
||||
uip_icmp6_echo_request_input(void)
|
||||
{
|
||||
|
@ -123,7 +124,7 @@ uip_icmp6_echo_request_input(void)
|
|||
UIP_STAT(++uip_stat.icmp.sent);
|
||||
return;
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
void
|
||||
uip_icmp6_error_output(u8_t type, u8_t code, u32_t param) {
|
||||
uip_ext_len = 0;
|
||||
|
@ -194,4 +195,31 @@ uip_icmp6_error_output(u8_t type, u8_t code, u32_t param) {
|
|||
return;
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
void
|
||||
uip_icmp6_send(uip_ipaddr_t *dest, int type, int code, int payload_len)
|
||||
{
|
||||
|
||||
UIP_IP_BUF->vtc = 0x60;
|
||||
UIP_IP_BUF->tcflow = 0;
|
||||
UIP_IP_BUF->flow = 0;
|
||||
UIP_IP_BUF->proto = UIP_PROTO_ICMP6;
|
||||
UIP_IP_BUF->ttl = uip_ds6_if.cur_hop_limit;
|
||||
UIP_IP_BUF->len[0] = 0;
|
||||
UIP_IP_BUF->len[1] = UIP_ICMPH_LEN + payload_len;
|
||||
|
||||
memcpy(&UIP_IP_BUF->destipaddr, dest, sizeof(*dest));
|
||||
uip_ds6_select_src(&UIP_IP_BUF->srcipaddr, &UIP_IP_BUF->destipaddr);
|
||||
|
||||
UIP_ICMP_BUF->type = type;
|
||||
UIP_ICMP_BUF->icode = code;
|
||||
|
||||
UIP_ICMP_BUF->icmpchksum = 0;
|
||||
UIP_ICMP_BUF->icmpchksum = ~uip_icmp6chksum();
|
||||
|
||||
uip_len = UIP_IPH_LEN + UIP_ICMPH_LEN + payload_len;
|
||||
tcpip_ipv6_output();
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
||||
/** @} */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue