Routing API: added ext_header_srh_get_next_hop

This commit is contained in:
Simon Duquennoy 2017-12-10 06:10:35 -08:00
parent 03bab6f119
commit 4cdf2d4819
5 changed files with 18 additions and 7 deletions

View File

@ -95,11 +95,6 @@ enum {
PACKET_INPUT
};
#if UIP_CONF_IPV6_RPL && RPL_WITH_NON_STORING
#define NEXTHOP_NON_STORING(addr) rpl_ext_header_srh_get_next_hop(addr)
#else
#define NEXTHOP_NON_STORING(addr) 0
#endif
/*---------------------------------------------------------------------------*/
static void
init_appstate(uip_tcp_appstate_t *as, void *state)
@ -525,7 +520,7 @@ get_nexthop(uip_ipaddr_t *addr)
LOG_INFO_6ADDR(&UIP_IP_BUF->destipaddr);
LOG_INFO_("\n");
if(NEXTHOP_NON_STORING(addr)) {
if(NETSTACK_ROUTING.ext_header_srh_get_next_hop(addr)) {
LOG_INFO("output: selected next hop from SRH: ");
LOG_INFO_6ADDR(addr);
LOG_INFO_("\n");

View File

@ -74,6 +74,12 @@ ext_header_remove(void)
uip_ext_len = 0;
}
/*---------------------------------------------------------------------------*/
static int
ext_header_srh_get_next_hop(uip_ipaddr_t *ipaddr)
{
return 0;
}
/*---------------------------------------------------------------------------*/
const struct routing_driver nullrouting_driver = {
"Null Routing",
init,
@ -81,7 +87,8 @@ const struct routing_driver nullrouting_driver = {
root_start,
global_repair,
local_repair,
ext_header_remove
ext_header_remove,
ext_header_srh_get_next_hop,
};
/*---------------------------------------------------------------------------*/

View File

@ -81,6 +81,13 @@ struct routing_driver {
* Removes all extension headers that pertain to the routing protocol.
*/
void (* ext_header_remove)(void);
/**
* Look for next hop from SRH of current uIP packet.
*
* \param ipaddr A pointer to the address where to store the next hop.
* \return 1 if a next hop was found, 0 otherwise
*/
int (* ext_header_srh_get_next_hop)(uip_ipaddr_t *ipaddr);
};
#endif /* ROUTING_H_ */

View File

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

View File

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