added icmp_send function and moved rpl input function signature
This commit is contained in:
parent
dc1a5f70ff
commit
167b0d636e
|
@ -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();
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
||||
/** @} */
|
||||
|
|
|
@ -115,19 +115,25 @@ uip_icmp6_echo_request_input(void);
|
|||
|
||||
/**
|
||||
* \brief Send an icmpv6 error message
|
||||
* \param type type of the Error message
|
||||
* \param type type of the error message
|
||||
* \param code of the error message
|
||||
* \param type 32 bit parameter of the error message, semantic depends on error
|
||||
*/
|
||||
void
|
||||
uip_icmp6_error_output(u8_t type, u8_t code, u32_t param);
|
||||
|
||||
/** @} */
|
||||
|
||||
#if UIP_CONF_IPV6_RPL
|
||||
/**
|
||||
* \brief Send an icmpv6 message
|
||||
* \param dest destination address of the message
|
||||
* \param type type of the message
|
||||
* \param code of the message
|
||||
* \param payload_len length of the payload
|
||||
*/
|
||||
void
|
||||
uip_rpl_input(void);
|
||||
#endif /* UIP_CONF_IPV6_RPL */
|
||||
uip_icmp6_send(uip_ipaddr_t *dest, int type, int code, int payload_len);
|
||||
|
||||
|
||||
/** @} */
|
||||
|
||||
#endif /*__ICMP6_H__*/
|
||||
/** @} */
|
||||
|
|
|
@ -41,7 +41,7 @@
|
|||
*
|
||||
* This file is part of the uIP TCP/IP stack.
|
||||
*
|
||||
* $Id: uip6.c,v 1.18 2010/04/30 08:46:27 joxe Exp $
|
||||
* $Id: uip6.c,v 1.19 2010/04/30 13:22:21 joxe Exp $
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -94,6 +94,10 @@
|
|||
#define PRINT6ADDR(addr)
|
||||
#endif
|
||||
|
||||
#if UIP_CONF_IPV6_RPL
|
||||
void uip_rpl_input(void);
|
||||
#endif /* UIP_CONF_IPV6_RPL */
|
||||
|
||||
#if UIP_LOGGING == 1
|
||||
#include <stdio.h>
|
||||
void uip_log(char *msg);
|
||||
|
@ -1404,8 +1408,15 @@ uip_process(u8_t flag)
|
|||
}
|
||||
}
|
||||
PRINTF("udp: no matching connection found\n");
|
||||
|
||||
#if UIP_UDP_SEND_UNREACH_NOPORT
|
||||
uip_icmp6_error_output(ICMP6_DST_UNREACH, ICMP6_DST_UNREACH_NOPORT, 0);
|
||||
UIP_STAT(++uip_stat.ip.drop);
|
||||
goto send;
|
||||
#else
|
||||
goto drop;
|
||||
|
||||
#endif
|
||||
|
||||
udp_found:
|
||||
PRINTF("In udp_found\n");
|
||||
|
||||
|
|
Loading…
Reference in a new issue