Added a function rpl_get_parent_link_metric() for obtaining the link metric of a given parent

This commit is contained in:
Adam Dunkels 2013-08-11 23:50:37 +02:00 committed by Simon Duquennoy
parent c52fc2fd19
commit 9a74ada90c
2 changed files with 13 additions and 1 deletions

View file

@ -95,6 +95,17 @@ rpl_get_parent_rank(uip_lladdr_t *addr)
} }
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
uint16_t
rpl_get_parent_link_metric(uip_lladdr_t *addr)
{
rpl_parent_t *p = nbr_table_get_from_lladdr(rpl_parents, (rimeaddr_t *)addr);
if(p != NULL) {
return p->link_metric;
} else {
return 0;
}
}
/*---------------------------------------------------------------------------*/
uip_ipaddr_t * uip_ipaddr_t *
rpl_get_parent_ipaddr(rpl_parent_t *p) rpl_get_parent_ipaddr(rpl_parent_t *p)
{ {

View file

@ -244,6 +244,7 @@ void rpl_remove_header(void);
uint8_t rpl_invert_header(void); uint8_t rpl_invert_header(void);
uip_ipaddr_t *rpl_get_parent_ipaddr(rpl_parent_t *nbr); uip_ipaddr_t *rpl_get_parent_ipaddr(rpl_parent_t *nbr);
rpl_rank_t rpl_get_parent_rank(uip_lladdr_t *addr); rpl_rank_t rpl_get_parent_rank(uip_lladdr_t *addr);
void rpl_dag_init(); uint16_t rpl_get_parent_link_metric(uip_lladdr_t *addr);
void rpl_dag_init(void);
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
#endif /* RPL_H */ #endif /* RPL_H */