175240ed1SBrian Somers /* 275240ed1SBrian Somers * Written by Toshiharu OHNO (tony-o@iij.ad.jp) 375240ed1SBrian Somers * 475240ed1SBrian Somers * Copyright (C) 1993, Internet Initiative Japan, Inc. All rights reserverd. 575240ed1SBrian Somers * 675240ed1SBrian Somers * Redistribution and use in source and binary forms are permitted 775240ed1SBrian Somers * provided that the above copyright notice and this paragraph are 875240ed1SBrian Somers * duplicated in all such forms and that any documentation, 975240ed1SBrian Somers * advertising materials, and other materials related to such 1075240ed1SBrian Somers * distribution and use acknowledge that the software was developed 1175240ed1SBrian Somers * by the Internet Initiative Japan. The name of the 1275240ed1SBrian Somers * IIJ may not be used to endorse or promote products derived 1375240ed1SBrian Somers * from this software without specific prior written permission. 1475240ed1SBrian Somers * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR 1575240ed1SBrian Somers * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED 1675240ed1SBrian Somers * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. 1775240ed1SBrian Somers * 186eaa6ac5SBrian Somers * $Id: timer.h,v 1.1 1997/10/26 01:03:53 brian Exp $ 1975240ed1SBrian Somers * 2075240ed1SBrian Somers * TODO: 2175240ed1SBrian Somers */ 2275240ed1SBrian Somers 2375240ed1SBrian Somers #define TICKUNIT 100000 /* Unit in usec */ 2475240ed1SBrian Somers #define SECTICKS (1000000/TICKUNIT) 2575240ed1SBrian Somers 2675240ed1SBrian Somers struct pppTimer { 2775240ed1SBrian Somers int state; 2875240ed1SBrian Somers u_long rest; /* Ticks to expire */ 2975240ed1SBrian Somers u_long load; /* Initial load value */ 3075240ed1SBrian Somers void (*func)(); /* Function called when timer is expired */ 3175240ed1SBrian Somers void *arg; /* Argument passed to timeout function */ 3275240ed1SBrian Somers struct pppTimer *next; /* Link to next timer */ 3375240ed1SBrian Somers struct pppTimer *enext; /* Link to next expired timer */ 3475240ed1SBrian Somers }; 3575240ed1SBrian Somers 3675240ed1SBrian Somers #define TIMER_STOPPED 0 3775240ed1SBrian Somers #define TIMER_RUNNING 1 3875240ed1SBrian Somers #define TIMER_EXPIRED 2 3975240ed1SBrian Somers 4075240ed1SBrian Somers extern struct pppTimer *TimerList; 4175240ed1SBrian Somers 4275240ed1SBrian Somers extern void StartTimer(struct pppTimer *); 4375240ed1SBrian Somers extern void StopTimer(struct pppTimer *); 4475240ed1SBrian Somers extern void TimerService(void); 4575240ed1SBrian Somers extern void TermTimerService(void); 4675240ed1SBrian Somers extern void ShowTimers(void); 476eaa6ac5SBrian Somers 486eaa6ac5SBrian Somers #ifdef SIGALRM 496eaa6ac5SBrian Somers extern u_int nointr_sleep(u_int); 506eaa6ac5SBrian Somers extern void nointr_usleep(u_int); 516eaa6ac5SBrian Somers #endif 52