Register generic handlers for ICMPv6 Echo Request / Reply

This commit is contained in:
George Oikonomou 2014-03-08 21:31:53 +00:00
parent 1d84962e80
commit af43d2125b
3 changed files with 26 additions and 22 deletions

View File

@ -119,8 +119,8 @@ uip_icmp6_register_input_handler(uip_icmp6_input_handler_t *handler)
list_add(input_handler_list, handler);
}
/*---------------------------------------------------------------------------*/
void
uip_icmp6_echo_request_input(void)
static void
echo_request_input(void)
{
#if UIP_CONF_IPV6_RPL
uint8_t temp_ext_len;
@ -318,8 +318,8 @@ uip_icmp6_send(const uip_ipaddr_t *dest, int type, int code, int payload_len)
tcpip_ipv6_output();
}
/*---------------------------------------------------------------------------*/
void
uip_icmp6_echo_reply_input(void)
static void
echo_reply_input(void)
{
int ttl;
uip_ipaddr_t sender;
@ -386,6 +386,8 @@ uip_icmp6_echo_reply_input(void)
}
}
}
uip_len = 0;
return;
}
/*---------------------------------------------------------------------------*/
@ -405,5 +407,18 @@ uip_icmp6_echo_reply_callback_rm(struct uip_icmp6_echo_reply_notification *n)
list_remove(echo_reply_callback_list, n);
}
/*---------------------------------------------------------------------------*/
UIP_ICMP6_HANDLER(echo_request_handler, ICMP6_ECHO_REQUEST,
UIP_ICMP6_HANDLER_CODE_ANY, echo_request_input);
UIP_ICMP6_HANDLER(echo_reply_handler, ICMP6_ECHO_REPLY,
UIP_ICMP6_HANDLER_CODE_ANY, echo_reply_input);
/*---------------------------------------------------------------------------*/
void
uip_icmp6_init()
{
/* Register Echo Request and Reply handlers */
uip_icmp6_register_input_handler(&echo_request_handler);
uip_icmp6_register_input_handler(&echo_reply_handler);
}
/*---------------------------------------------------------------------------*/
/** @} */
#endif /* UIP_CONF_IPV6 */

View File

@ -109,24 +109,6 @@ typedef struct uip_icmp6_error{
/** \name ICMPv6 RFC4443 Message processing and sending */
/** @{ */
/** \
* brief Process an echo request
*
* Perform a few checks, then send an Echo reply. The reply is
* built here.
*/
void
uip_icmp6_echo_request_input(void);
/** \
* brief Process an echo reply
*
* Perform a few checks, then call applications to inform that an echo
* reply has been received.
*/
void
uip_icmp6_echo_reply_input(void);
/**
* \brief Send an icmpv6 error message
* \param type type of the error message
@ -247,6 +229,12 @@ uint8_t uip_icmp6_input(uint8_t type, uint8_t icode);
*/
void uip_icmp6_register_input_handler(uip_icmp6_input_handler_t *handler);
/**
* \brief Initialise the uIP ICMPv6 core
*/
void uip_icmp6_init(void);
/** @} */
#endif /*ICMP6_H_*/

View File

@ -411,6 +411,7 @@ uip_init(void)
{
uip_ds6_init();
uip_icmp6_init();
#if UIP_TCP
for(c = 0; c < UIP_LISTENPORTS; ++c) {