Routing API: added link_callback

This commit is contained in:
Simon Duquennoy 2017-12-10 06:39:38 -08:00
parent fac66307f6
commit eaa3b6ad79
6 changed files with 19 additions and 5 deletions

View File

@ -1431,10 +1431,8 @@ packet_sent(void *ptr, int status, int transmissions)
/* Update neighbor link statistics */
link_stats_packet_sent(dest, status, transmissions);
#if UIP_CONF_IPV6_RPL
/* Call RPL link callback */
rpl_link_callback(dest, status, transmissions);
#endif /* UIP_CONF_IPV6_RPL */
/* Call routing protocol link callback */
NETSTACK_ROUTING.link_callback(dest, status, transmissions);
/* DS6 callback, used for UIP_DS6_LL_NUD */
uip_ds6_link_callback(status, transmissions);

View File

@ -60,7 +60,7 @@
void
tsch_rpl_callback_ka_sent(int status, int transmissions)
{
rpl_link_callback(packetbuf_addr(PACKETBUF_ADDR_RECEIVER), status, transmissions);
NETSTACK_ROUTING.link_callback(packetbuf_addr(PACKETBUF_ADDR_RECEIVER), status, transmissions);
}
/*---------------------------------------------------------------------------*/
/* To use, set #define TSCH_CALLBACK_JOINING_NETWORK tsch_rpl_callback_joining_network */

View File

@ -98,6 +98,11 @@ ext_header_srh_get_next_hop(uip_ipaddr_t *ipaddr)
return 0;
}
/*---------------------------------------------------------------------------*/
static void
link_callback(const linkaddr_t *addr, int status, int numtx)
{
}
/*---------------------------------------------------------------------------*/
const struct routing_driver nullrouting_driver = {
"Null Routing",
init,
@ -110,6 +115,7 @@ const struct routing_driver nullrouting_driver = {
ext_header_hbh_update,
ext_header_srh_update,
ext_header_srh_get_next_hop,
link_callback,
};
/*---------------------------------------------------------------------------*/

View File

@ -110,6 +110,14 @@ struct routing_driver {
* \return 1 if a next hop was found, 0 otherwise
*/
int (* ext_header_srh_get_next_hop)(uip_ipaddr_t *ipaddr);
/**
* Called by lower layers after every packet transmission
*
* \param addr The link-layer addrress of the packet destination
* \param status The transmission status (see os/net/mac/mac.h)
* \param numtx The total number of transmission attempts
*/
void (* link_callback)(const linkaddr_t *addr, int status, int numtx);
};
#endif /* ROUTING_H_ */

View File

@ -383,6 +383,7 @@ const struct routing_driver rpl_classic_driver = {
rpl_ext_header_hbh_update,
rpl_ext_header_srh_update,
rpl_ext_header_srh_get_next_hop,
rpl_link_callback,
};
/*---------------------------------------------------------------------------*/

View File

@ -205,6 +205,7 @@ const struct routing_driver rpl_lite_driver = {
rpl_ext_header_hbh_update,
rpl_ext_header_srh_update,
rpl_ext_header_srh_get_next_hop,
rpl_link_callback,
};
/*---------------------------------------------------------------------------*/