int dotcpwatch (int argc, char** argv, void *p) { if(argc < 2) { tprintf ("TCP Watch Dog timer %d/%d seconds\n", read_timer (&TcpWatchTimer)/1000, dur_timer(&TcpWatchTimer)/1000); return 0; } stop_timer (&TcpWatchTimer); /* in case it's already running */ /* what to call on timeout */ TcpWatchTimer.func = (void (*)(void*))dowatchtick; TcpWatchTimer.arg = NULLCHAR; /* dummy value */ /* set timer duration */ set_timer (&TcpWatchTimer, (uint32)atoi (argv[1])*1000); start_timer (&TcpWatchTimer); /* and fire it up */ return 0; }
static int domail_timer(int argc, char *argv[], void *p) { if (argc < 2) { printf("%ld/%ld\n", read_timer(&Mail_timer) / 1000, dur_timer(&Mail_timer) / 1000); return 0; } Mail_timer.func = (void (*)(void *)) mail_tick; Mail_timer.arg = 0; set_timer(&Mail_timer, atol(argv[1]) * 1000L); start_timer(&Mail_timer); return 0; }
/* Flush all automatic entries in the arp cache */ static int doarpflush( int argc, char *argv[], void *p) { struct arp_tab *ap; struct arp_tab *aptmp; int i; for(i=0;i<HASHMOD;i++){ for(ap = Arp_tab[i];ap != NULL;ap = aptmp){ aptmp = ap->next; if(dur_timer(&ap->timer) != 0) arp_drop(ap); } } return 0; }