11ae349f5Scvs2svn /* 21ae349f5Scvs2svn * Written by Toshiharu OHNO (tony-o@iij.ad.jp) 31ae349f5Scvs2svn * 41ae349f5Scvs2svn * Copyright (C) 1993, Internet Initiative Japan, Inc. All rights reserverd. 51ae349f5Scvs2svn * 61ae349f5Scvs2svn * Redistribution and use in source and binary forms are permitted 71ae349f5Scvs2svn * provided that the above copyright notice and this paragraph are 81ae349f5Scvs2svn * duplicated in all such forms and that any documentation, 91ae349f5Scvs2svn * advertising materials, and other materials related to such 101ae349f5Scvs2svn * distribution and use acknowledge that the software was developed 111ae349f5Scvs2svn * by the Internet Initiative Japan. The name of the 121ae349f5Scvs2svn * IIJ may not be used to endorse or promote products derived 131ae349f5Scvs2svn * from this software without specific prior written permission. 141ae349f5Scvs2svn * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR 151ae349f5Scvs2svn * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED 161ae349f5Scvs2svn * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. 171ae349f5Scvs2svn * 183b0f8d2eSBrian Somers * $Id: timer.h,v 1.5 1998/01/21 02:15:30 brian Exp $ 191ae349f5Scvs2svn * 201ae349f5Scvs2svn * TODO: 211ae349f5Scvs2svn */ 221ae349f5Scvs2svn 233b0f8d2eSBrian Somers #define TICKUNIT 100000 /* usec's per Unit */ 243b0f8d2eSBrian Somers #define SECTICKS (1000000/TICKUNIT) /* Units per second */ 251ae349f5Scvs2svn 261ae349f5Scvs2svn struct pppTimer { 271ae349f5Scvs2svn int state; 283b0f8d2eSBrian Somers const char *name; 291ae349f5Scvs2svn u_long rest; /* Ticks to expire */ 301ae349f5Scvs2svn u_long load; /* Initial load value */ 311ae349f5Scvs2svn void (*func)(void *); /* Function called when timer is expired */ 321ae349f5Scvs2svn void *arg; /* Argument passed to timeout function */ 331ae349f5Scvs2svn struct pppTimer *next; /* Link to next timer */ 341ae349f5Scvs2svn struct pppTimer *enext; /* Link to next expired timer */ 351ae349f5Scvs2svn }; 361ae349f5Scvs2svn 371ae349f5Scvs2svn #define TIMER_STOPPED 0 381ae349f5Scvs2svn #define TIMER_RUNNING 1 391ae349f5Scvs2svn #define TIMER_EXPIRED 2 401ae349f5Scvs2svn 411ae349f5Scvs2svn extern void StartTimer(struct pppTimer *); 421ae349f5Scvs2svn extern void StopTimer(struct pppTimer *); 431ae349f5Scvs2svn extern void TermTimerService(void); 443b0f8d2eSBrian Somers extern void ShowTimers(int LogLevel); 451ae349f5Scvs2svn 461ae349f5Scvs2svn #ifdef SIGALRM 471ae349f5Scvs2svn extern void nointr_sleep(u_int); 481ae349f5Scvs2svn extern void nointr_usleep(u_int); 491ae349f5Scvs2svn #endif 50