Add "extern C {...} to header files for C++ builds.
[freeradius.git] / src / include / event.h
1 #ifndef FR_EVENT_H
2 #define FR_EVENT_H
3
4 /*
5  * event.h      Simple event queue
6  *
7  * Version:     $Id$
8  *
9  *   This program is free software; you can redistribute it and/or modify
10  *   it under the terms of the GNU General Public License as published by
11  *   the Free Software Foundation; either version 2 of the License, or
12  *   (at your option) any later version.
13  *
14  *   This program is distributed in the hope that it will be useful,
15  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
16  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  *   GNU General Public License for more details.
18  *
19  *   You should have received a copy of the GNU General Public License
20  *   along with this program; if not, write to the Free Software
21  *   Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
22  *
23  * Copyright 2007 The FreeRADIUS server project
24  * Copyright 2007 Alan DeKok <aland@deployingradius.com>
25  */
26
27 #include <freeradius-devel/ident.h>
28 RCSIDH(event_h, "$Id$")
29
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
33
34 typedef struct fr_event_list_t fr_event_list_t;
35 typedef struct fr_event_t fr_event_t;
36
37 typedef void (*fr_event_callback_t)(void *);
38 typedef void (*fr_event_status_t)(struct timeval *);
39 typedef void (*fr_event_fd_handler_t)(fr_event_list_t *el, int sock, void *ctx);
40
41 fr_event_list_t *fr_event_list_create(fr_event_status_t status);
42 void fr_event_list_free(fr_event_list_t *el);
43
44 int fr_event_list_num_elements(fr_event_list_t *el);
45
46 int fr_event_insert(fr_event_list_t *el,
47                       fr_event_callback_t callback,
48                       void *ctx, struct timeval *when, fr_event_t **ev_p);
49 int fr_event_delete(fr_event_list_t *el, fr_event_t **ev_p);
50
51 int fr_event_run(fr_event_list_t *el, struct timeval *when);
52
53 int fr_event_now(fr_event_list_t *el, struct timeval *when);
54
55 int fr_event_fd_insert(fr_event_list_t *el, int type, int fd,
56                          fr_event_fd_handler_t handler, void *ctx);
57 int fr_event_fd_delete(fr_event_list_t *el, int type, int fd);
58 int fr_event_loop(fr_event_list_t *el);
59 void fr_event_loop_exit(fr_event_list_t *el, int code);
60
61 #ifdef __cplusplus
62 }
63 #endif
64
65 #endif /* FR_HASH_H */