/** * SACT.TimerSet (1.0~) * 指定のIDのタイマーをwCount値でリセット * @param wTimerID: タイマーID * @param wCount: リセットする値 */ void TimerSet() { int wTimerID = getCaliValue(); int wCount = getCaliValue(); stimer_reset(wTimerID, wCount); DEBUG_COMMAND("SACT.TimerSet %d,%d:\n", wTimerID, wCount); }
void debugPrint() { //Print all our IP addresses when timer expires. if (stimer_expired(&ipPrintTimer)) { stimer_reset(&ipPrintTimer); printIPAddresses(); printLinkLocalAddress(); printGloballAddress(); printIPV6Neighbourlist(); //PRINT_CYAN("Rx counter = %i, TX counter = %i\n",ule6loTestIn_getnofReceivedPacket(),ule6loTestIn_getnofSentPacket()); } }
/** * \brief Performs periodic tasks for 6LP-GW variable management, such as * processing of neighbor lifetimes and DAD timers */ void pgw_periodic() { /* periodic processing of contexts */ for(loccontext = pgw_addr_context_table; loccontext < pgw_addr_context_table + SICSLOWPAN_CONF_MAX_ADDR_CONTEXTS; loccontext++) { if (loccontext->state != NOT_IN_USE) { if (stimer_expired(&loccontext->vlifetime)) { switch(loccontext->state) { case IN_USE_UNCOMPRESS_ONLY: loccontext->state = IN_USE_COMPRESS; stimer_set(&loccontext->vlifetime, PGW_CONTEXT_LIFETIME); context_chaged = 1; break; case IN_USE_COMPRESS: loccontext->state = EXPIRED; if (loccontext->vlifetime.interval > PGW_MIN_CONTEXT_CHANGE_DELAY) { stimer_reset(&loccontext->vlifetime); } else { /* This way we make sure that, if the context is eventually deleted, * No other context will use its id in a period of at least * MIN_CONTEXT_CHANGE_DELAY */ stimer_set(&loccontext->vlifetime, PGW_MIN_CONTEXT_CHANGE_DELAY); } context_chaged = 1; break; case EXPIRED: pgw_context_rm(loccontext); break; } } } } /* periodic processing of neighbors */ for(locnbr = pgw_6ln_cache; locnbr < pgw_6ln_cache + MAX_6LOWPAN_NEIGHBORS; locnbr++) { if(locnbr->isused) { /* * If the reachable timer is expired, we delete the NCE, * regardless of the NCE's state. */ if(stimer_expired(&(locnbr->reachable))) { /* I-D.ietf-6lowpan-nd: Should the Registration Lifetime in a NCE expire, * then the router MUST delete the cache entry. */ pgw_nbr_rm(locnbr); } else if ((locnbr->state == PGW_TENTATIVE) && (!uip_is_addr_link_local(&locnbr->ipaddr))) { if ((locnbr->dadnscount <= PGW_MAX_DAD_NS) && (timer_expired(&locnbr->dadtimer))) { pgw_dad(locnbr); /* If we found a neighbor requiring DAD, perform it. If there were * more neighbors requiring it, we'll do it in further invocations */ return; } } } } etimer_reset(&pgw_timer_periodic); return; }