/*---------------------------------------------------------------------------*/ void uip_ds6_send_rs(void) { #if CONF_6LOWPAN_ND uint16_t r; #endif /* CONF_6LOWPAN_ND */ if((uip_ds6_defrt_choose() == NULL) && (rscount < UIP_ND6_MAX_RTR_SOLICITATIONS)) { PRINTF("Sending RS %u\n", rscount); uip_nd6_rs_output(); rscount++; etimer_set(&uip_ds6_timer_rs, UIP_ND6_RTR_SOLICITATION_INTERVAL * CLOCK_SECOND); #if CONF_6LOWPAN_ND } else if(uip_ds6_defrt_choose() == NULL) { /* Slower retransmissions */ PRINTF("Sending RS slower %u\n", rscount); uip_nd6_rs_output(); rscount++; r = (((uint16_t)random_rand()) % ((2 << (rscount - 1) - 1) + 1)) * UIP_ND6_RTR_SOLICITATION_INTERVAL; if(r >= UIP_ND6_MAX_RTR_SOLICITATION_INTERVAL) { r = UIP_ND6_MAX_RTR_SOLICITATION_INTERVAL; } etimer_set(&uip_ds6_timer_rs, r * CLOCK_SECOND); #endif /* CONF_6LOWPAN_ND */ } else { PRINTF("Router found ? (boolean): %u\n", (uip_ds6_defrt_choose() != NULL)); etimer_stop(&uip_ds6_timer_rs); } return; }
void uip_ds6_send_rs(uip_ds6_defrt_t *defrt) { u8_t unicast_rs = 0; if (!timer_expired(&uip_ds6_timer_rs)) { return; } locdefrt = NULL; /* First check whether we can unicast the RS to a specific router rather than * multicasting it. */ if ((defrt != NULL) && (defrt->isused)){ /* Mark this router as "sending_rs" in case it wasn't marked already */ defrt->sending_rs = 1; locdefrt = defrt; unicast_rs = 1; } else { for(locdefrt = uip_ds6_defrt_list; locdefrt < uip_ds6_defrt_list + UIP_DS6_DEFRT_NB; locdefrt++) { if((locdefrt->isused) && (locdefrt->sending_rs)) { unicast_rs = 1; break; } } } if (unicast_rs) { if (locdefrt->rscount < UIP_ND6_MAX_RTR_SOLICITATIONS) { /* Unicast RS and update count and timer */ uip_nd6_rs_output(&locdefrt->ipaddr); locdefrt->rscount = locdefrt->rscount > 10 ? locdefrt->rscount : locdefrt->rscount + 1; timer_set(&uip_ds6_timer_rs, rs_rtx_time(locdefrt->rscount) * CLOCK_SECOND); return; } else { /* Switch to multicast */ locdefrt->sending_rs = 0; rscount = locdefrt->rscount; locdefrt->rscount = 0; } } /* Multicast RS and update RS count and timer */ uip_nd6_rs_output(NULL); if(uip_ds6_defrt_choose() == NULL) { rscount = rscount > 10 ? rscount : rscount + 1; } else { rscount = 0; } /* Make sure we do not send rs more frequently than UIP_ND6_RTR_SOLICITATION_INTERVAL */ timer_set(&uip_ds6_timer_rs, rs_rtx_time(rscount) * CLOCK_SECOND); }
/*---------------------------------------------------------------------------*/ void uip_ds6_send_rs(void) { if((uip_ds6_defrt_choose() == NULL) && (rscount < UIP_ND6_MAX_RTR_SOLICITATIONS)) { PRINTF("Sending RS u");//, rscount); uip_nd6_rs_output(); rscount++; etimer_set(&uip_ds6_timer_rs, tcpip_process, UIP_ND6_RTR_SOLICITATION_INTERVAL * CLOCK_SECOND); } else { PRINTF("Router found ? (boolean): u");//, (uip_ds6_defrt_choose() != NULL)); etimer_stop(&uip_ds6_timer_rs); } return; }
/*---------------------------------------------------------------------------*/ void uip_ds6_send_rs(void) { if((uip_ds6_defrt_choose() == NULL) && (rscount < UIP_ND6_MAX_RTR_SOLICITATIONS)) { PRINTF("Sending RS %u\n", rscount); uip_nd6_rs_output(); rscount++; timer_set(&uip_ds6_timer_rs, UIP_ND6_RTR_SOLICITATION_INTERVAL * CLOCK_SECOND); // xxx changed from etimer } else { PRINTF("Router found ? (boolean): %u\n", (uip_ds6_defrt_choose() != NULL)); timer_stop(&uip_ds6_timer_rs); // xxx changed from etimer } return; }
/*---------------------------------------------------------------------------*/ void uip_ds6_send_rs(struct net_buf *buf) { if((uip_ds6_defrt_choose() == NULL) && (rscount < UIP_ND6_MAX_RTR_SOLICITATIONS)) { PRINTF("Sending RS %u\n", rscount); uip_nd6_rs_output(buf); rscount++; etimer_set(&uip_ds6_timer_rs, UIP_ND6_RTR_SOLICITATION_INTERVAL * CLOCK_SECOND, &tcpip_process); } else { PRINTF("Router found ? (boolean): %u\n", (uip_ds6_defrt_choose() != NULL)); etimer_stop(&uip_ds6_timer_rs); } return; }