xref: /freebsd/usr.sbin/ppp/timer.h (revision 609e0c94f2ea3e5e75ddf58a45ec23613265f2a6)
1 /*
2  *	    Written by Toshiharu OHNO (tony-o@iij.ad.jp)
3  *
4  *   Copyright (C) 1993, Internet Initiative Japan, Inc. All rights reserverd.
5  *
6  * Redistribution and use in source and binary forms are permitted
7  * provided that the above copyright notice and this paragraph are
8  * duplicated in all such forms and that any documentation,
9  * advertising materials, and other materials related to such
10  * distribution and use acknowledge that the software was developed
11  * by the Internet Initiative Japan.  The name of the
12  * IIJ may not be used to endorse or promote products derived
13  * from this software without specific prior written permission.
14  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
15  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
16  * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
17  *
18  * $Id: timer.h,v 1.4 1997/12/28 21:55:05 brian Exp $
19  *
20  *	TODO:
21  */
22 
23 #define	TICKUNIT	100000	/* Unit in usec */
24 #define	SECTICKS	(1000000/TICKUNIT)
25 
26 struct pppTimer {
27   int state;
28   u_long rest;			/* Ticks to expire */
29   u_long load;			/* Initial load value */
30   void (*func)(void *);		/* Function called when timer is expired */
31   void *arg;			/* Argument passed to timeout function */
32   struct pppTimer *next;	/* Link to next timer */
33   struct pppTimer *enext;	/* Link to next expired timer */
34 };
35 
36 #define	TIMER_STOPPED	0
37 #define	TIMER_RUNNING	1
38 #define	TIMER_EXPIRED	2
39 
40 extern void StartTimer(struct pppTimer *);
41 extern void StopTimer(struct pppTimer *);
42 extern void TermTimerService(void);
43 extern void ShowTimers(void);
44 
45 #ifdef SIGALRM
46 extern void nointr_sleep(u_int);
47 extern void nointr_usleep(u_int);
48 #endif
49