static bool RIP_expire_periodic( TCPIP_EVENT_PTR event /* [IN/OUT] the resend event */ ) { /* Body */ RIP_send_resp(ADV_VERSION, FALSE); event->TIME = RND_RANGE(RIP_TIME_MIN_PERIODIC, RIP_TIME_MAX_PERIODIC); return TRUE; } /* Endbody */
void generate_soil( uint8_t *dst[3], int wid, int hgt ) { int row; int col; int component_idx; // Clear the frames for (row = 0; row < hgt; ++row) { for (col = 0; col < wid; ++col) { for (component_idx = 0; component_idx < 3; ++component_idx) { ARR( dst[component_idx], col, row, wid ) = RND_RANGE(0,16); } } } }
static bool RIP_expire_trig_upd( TCPIP_EVENT_PTR event /* [IN/OUT] the resend event */ ) { /* Body */ RIP_CFG_STRUCT_PTR ripcfg = event->PRIVATE; /* if no route has been during the timer run, just leave */ if (ripcfg->RT_CHANGED_F == FALSE) { /* update the internal flag to know if the timer is running or not */ ripcfg->TIMER_TRIG_UPD.PRIVATE = NULL; return FALSE; } /* send the changed routes */ RIP_send_resp(ADV_VERSION, TRUE); /* restart the timer */ event->TIME = RND_RANGE(RIP_TIME_MIN_TRIG_UPD, RIP_TIME_MAX_TRIG_UPD); return TRUE; } /* Endbody */
static void RIP_trig_upd( void ) { /* Body */ RIP_CFG_STRUCT_PTR ripcfg = RTCS_getcfg(RIP); if (RTCS_getcfg(RIP) == NULL) return; /* if the timer is currently running, dont send the data */ if (ripcfg->TIMER_TRIG_UPD.PRIVATE) return; /* send the changed routes */ RIP_send_resp(ADV_VERSION, TRUE); /* start the timer */ ripcfg->TIMER_TRIG_UPD.TIME = RND_RANGE(RIP_TIME_MIN_TRIG_UPD, RIP_TIME_MAX_TRIG_UPD); ripcfg->TIMER_TRIG_UPD.EVENT = RIP_expire_trig_upd; ripcfg->TIMER_TRIG_UPD.PRIVATE = ripcfg; TCPIP_Event_add(&ripcfg->TIMER_TRIG_UPD); } /* Endbody */