Added rpl_print_neighbor_list function for RPL state monitoring
This commit is contained in:
parent
be47673d40
commit
529376be77
3 changed files with 30 additions and 0 deletions
|
@ -81,6 +81,28 @@ NBR_TABLE(rpl_parent_t, rpl_parents);
|
||||||
rpl_instance_t instance_table[RPL_MAX_INSTANCES];
|
rpl_instance_t instance_table[RPL_MAX_INSTANCES];
|
||||||
rpl_instance_t *default_instance;
|
rpl_instance_t *default_instance;
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
|
void
|
||||||
|
rpl_print_neighbor_list()
|
||||||
|
{
|
||||||
|
if(default_instance != NULL && default_instance->current_dag != NULL &&
|
||||||
|
default_instance->of != NULL && default_instance->of->calculate_rank != NULL) {
|
||||||
|
int curr_dio_interval = default_instance->dio_intcurrent;
|
||||||
|
int curr_rank = default_instance->current_dag->rank;
|
||||||
|
rpl_parent_t *p = nbr_table_head(rpl_parents);
|
||||||
|
|
||||||
|
printf("RPL: rank %u dioint %u, %u nbr(s)\n", curr_rank, curr_dio_interval, uip_ds6_nbr_num());
|
||||||
|
while(p != NULL) {
|
||||||
|
uip_ds6_nbr_t *nbr = rpl_get_nbr(p);
|
||||||
|
printf("RPL: nbr %3u %5u, %5u => %5u %c\n",
|
||||||
|
nbr_table_get_lladdr(rpl_parents, p)->u8[7],
|
||||||
|
p->rank, nbr ? nbr->link_metric : 0, default_instance->of->calculate_rank(p, 0),
|
||||||
|
p == default_instance->current_dag->preferred_parent ? '*' : ' ');
|
||||||
|
p = nbr_table_next(rpl_parents, p);
|
||||||
|
}
|
||||||
|
printf("RPL: end of list\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
uip_ds6_nbr_t *
|
uip_ds6_nbr_t *
|
||||||
rpl_get_nbr(rpl_parent_t *parent)
|
rpl_get_nbr(rpl_parent_t *parent)
|
||||||
|
@ -729,6 +751,9 @@ rpl_select_dag(rpl_instance_t *instance, rpl_parent_t *p)
|
||||||
rpl_schedule_dao(instance);
|
rpl_schedule_dao(instance);
|
||||||
}
|
}
|
||||||
rpl_reset_dio_timer(instance);
|
rpl_reset_dio_timer(instance);
|
||||||
|
#if DEBUG
|
||||||
|
rpl_print_neighbor_list();
|
||||||
|
#endif
|
||||||
} else if(best_dag->rank != old_rank) {
|
} else if(best_dag->rank != old_rank) {
|
||||||
PRINTF("RPL: Preferred parent update, rank changed from %u to %u\n",
|
PRINTF("RPL: Preferred parent update, rank changed from %u to %u\n",
|
||||||
(unsigned)old_rank, best_dag->rank);
|
(unsigned)old_rank, best_dag->rank);
|
||||||
|
|
|
@ -166,6 +166,10 @@ handle_dio_timer(void *ptr)
|
||||||
}
|
}
|
||||||
new_dio_interval(instance);
|
new_dio_interval(instance);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if DEBUG
|
||||||
|
rpl_print_neighbor_list();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
void
|
void
|
||||||
|
|
|
@ -251,6 +251,7 @@ rpl_rank_t rpl_get_parent_rank(uip_lladdr_t *addr);
|
||||||
uint16_t rpl_get_parent_link_metric(const uip_lladdr_t *addr);
|
uint16_t rpl_get_parent_link_metric(const uip_lladdr_t *addr);
|
||||||
void rpl_dag_init(void);
|
void rpl_dag_init(void);
|
||||||
uip_ds6_nbr_t *rpl_get_nbr(rpl_parent_t *parent);
|
uip_ds6_nbr_t *rpl_get_nbr(rpl_parent_t *parent);
|
||||||
|
void rpl_print_neighbor_list();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* RPL modes
|
* RPL modes
|
||||||
|
|
Loading…
Reference in a new issue