コード例 #1
0
/* Resets the DIO timer in the DAG to its minimal interval. */
void
rpl_reset_dio_timer(rpl_dag_t *dag, uint8_t force)
{
  /* only reset if not just reset or started */
  if(force || dag->dio_intcurrent > dag->dio_intmin) {
    dag->dio_counter = 0;
    dag->dio_intcurrent = dag->dio_intmin;
    new_dio_interval(dag);
  }
#if RPL_CONF_STATS
  rpl_stats.resets++;
#endif
}
コード例 #2
0
ファイル: rpl-timers.c プロジェクト: 32bitmicro/zephyr
/*---------------------------------------------------------------------------*/
static void
handle_dio_timer(struct net_buf *not_used, void *ptr)
{
  rpl_instance_t *instance;

  instance = (rpl_instance_t *)ptr;

  PRINTF("RPL: DIO Timer triggered\n");
  if(!dio_send_ok) {
    if(uip_ds6_get_link_local(ADDR_PREFERRED) != NULL) {
      dio_send_ok = 1;
    } else {
      PRINTF("RPL: Postponing DIO transmission since link local address is not ok\n");
      ctimer_set(NULL, &instance->dio_timer, CLOCK_SECOND, &handle_dio_timer,
		 instance);
      return;
    }
  }

  if(instance->dio_send) {
    /* send DIO if counter is less than desired redundancy */
    if(instance->dio_redundancy != 0 && instance->dio_counter < instance->dio_redundancy) {
#if RPL_CONF_STATS
      instance->dio_totsend++;
#endif /* RPL_CONF_STATS */
      dio_output(instance, NULL);
    } else {
      PRINTF("RPL: Supressing DIO transmission (%d >= %d)\n",
             instance->dio_counter, instance->dio_redundancy);
    }
    instance->dio_send = 0;
    PRINTF("RPL: Scheduling DIO timer %lu ticks in future (sent)\n",
           instance->dio_next_delay);
    ctimer_set(NULL, &instance->dio_timer, instance->dio_next_delay,
	       handle_dio_timer, instance);
  } else {
    /* check if we need to double interval */
    if(instance->dio_intcurrent < instance->dio_intmin + instance->dio_intdoubl) {
      instance->dio_intcurrent++;
      PRINTF("RPL: DIO Timer interval doubled %d\n", instance->dio_intcurrent);
    }
    new_dio_interval(instance);
  }

#if DEBUG
  rpl_print_neighbor_list();
#endif
}
コード例 #3
0
ファイル: rpl-timers.c プロジェクト: AWGES/StormSAMR21
/* Resets the DIO timer in the instance to its minimal interval. */
void
rpl_reset_dio_timer(rpl_instance_t *instance)
{
#if !RPL_LEAF_ONLY
  /* Do not reset if we are already on the minimum interval,
     unless forced to do so. */
  if(instance->dio_intcurrent > instance->dio_intmin) {
    instance->dio_counter = 0;
    instance->dio_intcurrent = instance->dio_intmin;
    new_dio_interval(instance);
  }
#if RPL_CONF_STATS
  rpl_stats.resets++;
#endif /* RPL_CONF_STATS */
#endif /* RPL_LEAF_ONLY */
}
コード例 #4
0
static void
handle_dio_timer(void *ptr)
{
  rpl_dag_t *dag;

  dag = (rpl_dag_t *)ptr;

  PRINTF("RPL: DIO Timer triggered");
  if(!dio_send_ok) {
    if(uip_ds6_get_link_local(ADDR_PREFERRED) != NULL) {
      dio_send_ok = 1;
    } else {
      PRINTF("RPL: Postponing DIO transmission since link local address is not ok");
      ctimer_set(&dag->dio_timer, CLOCK_SECOND, &handle_dio_timer, dag);
      return;
    }
  }

  if(dag->dio_send) {
    /* send DIO if counter is less than desired redundancy */
    if(dag->dio_counter < dag->dio_redundancy) {
#if RPL_CONF_STATS
      dag->dio_totsend++;
#endif /* RPL_CONF_STATS */
      dio_output(dag, NULL);
    } else {
      PRINTF("RPL: Supressing DIO transmission (Xd >= Xd)");//, dag->dio_counter, dag->dio_redundancy);
    }
    dag->dio_send = 0;
    PRINTF("RPL: Scheduling DIO timer Xu ticks in future (sent)");//, dag->dio_next_delay);
    ctimer_set(&dag->dio_timer, dag->dio_next_delay, handle_dio_timer, dag);
  } else {
    /* check if we need to double interval */
    if(dag->dio_intcurrent < dag->dio_intmin + dag->dio_intdoubl) {
      dag->dio_intcurrent++;
      PRINTF("RPL: DIO Timer interval doubled Xd");//, dag->dio_intcurrent);
    }
    new_dio_interval(dag);
  }
}