/[LeafOK_CVS]/pvpgn-1.7.4/src/bnetd/timer.h
ViewVC logotype

Annotation of /pvpgn-1.7.4/src/bnetd/timer.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (hide annotations)
Tue Jun 6 03:41:37 2006 UTC (19 years, 9 months ago) by sysadm
Branch point for: GNU, MAIN
Content type: text/x-chdr
Initial revision

1 sysadm 1.1 /*
2     * Copyright (C) 1999 Ross Combs (rocombs@cs.nmsu.edu)
3     *
4     * This program is free software; you can redistribute it and/or
5     * modify it under the terms of the GNU General Public License
6     * as published by the Free Software Foundation; either version 2
7     * of the License, or (at your option) any later version.
8     *
9     * This program is distributed in the hope that it will be useful,
10     * but WITHOUT ANY WARRANTY; without even the implied warranty of
11     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12     * GNU General Public License for more details.
13     *
14     * You should have received a copy of the GNU General Public License
15     * along with this program; if not, write to the Free Software
16     * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17     */
18     #ifndef INCLUDED_TIMER_TYPES
19     #define INCLUDED_TIMER_TYPES
20    
21     #ifdef JUST_NEED_TYPES
22     # ifdef TIME_WITH_SYS_TIME
23     # include <sys/time.h>
24     # include <time.h>
25     # else
26     # if HAVE_SYS_TIME_H
27     # include <sys/time.h>
28     # else
29     # include <time.h>
30     # endif
31     # endif
32     # include "connection.h"
33     #else
34     # define JUST_NEED_TYPES
35     # ifdef TIME_WITH_SYS_TIME
36     # include <sys/time.h>
37     # include <time.h>
38     # else
39     # if HAVE_SYS_TIME_H
40     # include <sys/time.h>
41     # else
42     # include <time.h>
43     # endif
44     # endif
45     # include "connection.h"
46     # undef JUST_NEED_TYPES
47     #endif
48     #include "common/elist.h"
49    
50     typedef union
51     {
52     unsigned long n;
53     void * p;
54     } t_timer_data;
55    
56     typedef void (* t_timer_cb)(t_connection * owner, time_t when, t_timer_data data);
57    
58     typedef struct timer_struct
59     #ifdef TIMER_INTERNAL_ACCESS
60     {
61     t_connection * owner; /* who to notify */
62     time_t when; /* when the timer expires */
63     t_timer_cb cb; /* what to call */
64     t_timer_data data; /* data argument */
65     t_elist owners; /* list to the setup timers of same owner */
66     t_elist timers; /* timers list, used for final cleaning */
67     }
68     #endif
69     t_timer;
70    
71     #endif
72    
73     #ifndef JUST_NEED_TYPES
74     #ifndef INCLUDED_TIMER_PROTOS
75     #define INCLUDED_TIMER_PROTOS
76    
77     #define JUST_NEED_TYPES
78     #ifdef TIME_WITH_SYS_TIME
79     # include <sys/time.h>
80     # include <time.h>
81     #else
82     # if HAVE_SYS_TIME_H
83     # include <sys/time.h>
84     # else
85     # include <time.h>
86     # endif
87     #endif
88     #include "connection.h"
89     #undef JUST_NEED_TYPES
90    
91     extern int timerlist_create(void);
92     extern int timerlist_destroy(void);
93     extern int timerlist_add_timer(t_connection * owner, time_t when, t_timer_cb cb, t_timer_data data);
94     extern int timerlist_del_all_timers(t_connection * owner);
95     extern int timerlist_check_timers(time_t when);
96    
97     #endif
98     #endif

webmaster@leafok.com
ViewVC Help
Powered by ViewVC 1.3.0-beta1