Routing API: added ext_header_remove

This commit is contained in:
Simon Duquennoy 2017-12-10 05:59:19 -08:00
parent 53facf941e
commit 03bab6f119
5 changed files with 16 additions and 7 deletions

View File

@ -185,11 +185,8 @@ uip_icmp6_error_output(uint8_t type, uint8_t code, uint32_t param) {
}
}
#if UIP_CONF_IPV6_RPL
rpl_ext_header_remove();
#else
uip_ext_len = 0;
#endif /* UIP_CONF_IPV6_RPL */
/* Remove all extension headers related to the routing protocol in place */
NETSTACK_ROUTING.ext_header_remove();
/* remember data of original packet before shifting */
uip_ipaddr_copy(&tmp_ipaddr, &UIP_IP_BUF->destipaddr);

View File

@ -68,13 +68,20 @@ local_repair(const char *str)
{
}
/*---------------------------------------------------------------------------*/
static void
ext_header_remove(void)
{
uip_ext_len = 0;
}
/*---------------------------------------------------------------------------*/
const struct routing_driver nullrouting_driver = {
"Null Routing",
init,
root_set_prefix,
root_start,
global_repair,
local_repair
local_repair,
ext_header_remove
};
/*---------------------------------------------------------------------------*/

View File

@ -71,13 +71,16 @@ struct routing_driver {
* \param str A textual description of the cause for triggering a repair
*/
void (* global_repair)(const char *str);
/**
* Triggers a RPL local topology repair
*
* \param str A textual description of the cause for triggering a repair
*/
void (* local_repair)(const char *str);
/**
* Removes all extension headers that pertain to the routing protocol.
*/
void (* ext_header_remove)(void);
};
#endif /* ROUTING_H_ */

View File

@ -378,6 +378,7 @@ const struct routing_driver rpl_classic_driver = {
rpl_dag_root_start,
global_repair,
local_repair,
rpl_ext_header_remove,
};
/*---------------------------------------------------------------------------*/

View File

@ -200,6 +200,7 @@ const struct routing_driver rpl_lite_driver = {
rpl_dag_root_start,
rpl_global_repair,
rpl_local_repair,
rpl_ext_header_remove,
};
/*---------------------------------------------------------------------------*/