mirror of
https://github.com/oliverschmidt/contiki.git
synced 2024-12-22 10:30:13 +00:00
uip-ds6-route: added callback for next hop addition and removal
This commit is contained in:
parent
08bcfd6972
commit
77d8322da8
@ -47,12 +47,22 @@
|
||||
|
||||
#include <string.h>
|
||||
|
||||
/* A configurable function called after adding a new neighbor as next hop */
|
||||
#ifdef NETSTACK_CONF_ROUTING_NEIGHBOR_ADDED_CALLBACK
|
||||
void NETSTACK_CONF_ROUTING_NEIGHBOR_ADDED_CALLBACK(const linkaddr_t *addr);
|
||||
#endif /* NETSTACK_CONF_ROUTING_NEIGHBOR_ADDED_CALLBACK */
|
||||
|
||||
/* A configurable function called after removing a next hop neighbor */
|
||||
#ifdef NETSTACK_CONF_ROUTING_NEIGHBOR_REMOVED_CALLBACK
|
||||
void NETSTACK_CONF_ROUTING_NEIGHBOR_REMOVED_CALLBACK(const linkaddr_t *addr);
|
||||
#endif /* NETSTACK_CONF_ROUTING_NEIGHBOR_REMOVED_CALLBACK */
|
||||
|
||||
/* The nbr_routes holds a neighbor table to be able to maintain
|
||||
information about what routes go through what neighbor. This
|
||||
neighbor table is registered with the central nbr-table repository
|
||||
so that it will be maintained along with the rest of the neighbor
|
||||
tables in the system. */
|
||||
NBR_TABLE(struct uip_ds6_route_neighbor_routes, nbr_routes);
|
||||
NBR_TABLE_GLOBAL(struct uip_ds6_route_neighbor_routes, nbr_routes);
|
||||
MEMB(neighborroutememb, struct uip_ds6_route_neighbor_route, UIP_DS6_ROUTE_NB);
|
||||
|
||||
/* Each route is repressented by a uip_ds6_route_t structure and
|
||||
@ -335,6 +345,9 @@ uip_ds6_route_add(uip_ipaddr_t *ipaddr, uint8_t length,
|
||||
return NULL;
|
||||
}
|
||||
LIST_STRUCT_INIT(routes, route_list);
|
||||
#ifdef NETSTACK_CONF_ROUTING_NEIGHBOR_ADDED_CALLBACK
|
||||
NETSTACK_CONF_ROUTING_NEIGHBOR_ADDED_CALLBACK((const linkaddr_t *)nexthop_lladdr);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Allocate a routing entry and populate it. */
|
||||
@ -435,6 +448,10 @@ uip_ds6_route_rm(uip_ds6_route_t *route)
|
||||
#endif /* (DEBUG) & DEBUG_ANNOTATE */
|
||||
PRINTF("uip_ds6_route_rm: removing neighbor too\n");
|
||||
nbr_table_remove(nbr_routes, route->neighbor_routes->route_list);
|
||||
#ifdef NETSTACK_CONF_ROUTING_NEIGHBOR_REMOVED_CALLBACK
|
||||
NETSTACK_CONF_ROUTING_NEIGHBOR_REMOVED_CALLBACK(
|
||||
(const linkaddr_t *)nbr_table_get_lladdr(nbr_routes, route->neighbor_routes->route_list));
|
||||
#endif
|
||||
}
|
||||
memb_free(&routememb, route);
|
||||
memb_free(&neighborroutememb, neighbor_route);
|
||||
|
Loading…
Reference in New Issue
Block a user