All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
event.h
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or modify
3  * it under the terms of the GNU General Public License as published by
4  * the Free Software Foundation; either version 2 of the License, or
5  * (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software
14  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
15  */
16 #ifndef _FR_EVENT_H
17 #define _FR_EVENT_H
18 /**
19  * $Id: 31739ff424ec641b3d99b9efb20b3b429f31a601 $
20  *
21  * @file include/event.h
22  * @brief A simple event queue.
23  *
24  * @copyright 2007 The FreeRADIUS server project
25  * @copyright 2007 Alan DeKok <aland@deployingradius.com>
26  */
27 RCSIDH(event_h, "$Id: 31739ff424ec641b3d99b9efb20b3b429f31a601 $")
28 
29 #ifdef __cplusplus
30 extern "C" {
31 #endif
32 
34 typedef struct fr_event_t fr_event_t;
35 
36 typedef void (*fr_event_callback_t)(void *, struct timeval *now);
37 typedef void (*fr_event_status_t)(struct timeval *);
38 typedef void (*fr_event_fd_handler_t)(fr_event_list_t *el, int sock, void *ctx);
39 
41 
44 
46  fr_event_callback_t callback,
47  void *ctx, struct timeval *when, fr_event_t **parent);
48 int fr_event_delete(fr_event_list_t *el, fr_event_t **parent);
49 
50 int fr_event_run(fr_event_list_t *el, struct timeval *when);
51 
52 int fr_event_now(fr_event_list_t *el, struct timeval *when);
53 
54 int fr_event_fd_insert(fr_event_list_t *el, int type, int fd,
55  fr_event_fd_handler_t handler, void *ctx);
56 int fr_event_fd_delete(fr_event_list_t *el, int type, int fd);
58 void fr_event_loop_exit(fr_event_list_t *el, int code);
60 
61 #ifdef __cplusplus
62 }
63 #endif
64 #endif /* _FR_EVENT_H */
#define RCSIDH(h, id)
Definition: build.h:136
int fr_event_fd_delete(fr_event_list_t *el, int type, int fd)
Definition: event.c:444
static fr_event_list_t * el
Definition: process.c:54
void(* fr_event_callback_t)(void *, struct timeval *now)
Definition: event.h:36
fr_event_list_t * fr_event_list_create(TALLOC_CTX *ctx, fr_event_status_t status)
Definition: event.c:120
int fr_event_now(fr_event_list_t *el, struct timeval *when)
Definition: event.c:310
int fr_event_fd_insert(fr_event_list_t *el, int type, int fd, fr_event_fd_handler_t handler, void *ctx)
Definition: event.c:324
void(* fr_event_status_t)(struct timeval *)
Definition: event.h:37
int fr_event_run(fr_event_list_t *el, struct timeval *when)
Definition: event.c:266
int fr_event_list_num_fds(fr_event_list_t *el)
Definition: event.c:157
int fr_event_loop(fr_event_list_t *el)
Definition: event.c:507
int fr_event_delete(fr_event_list_t *el, fr_event_t **parent)
Definition: event.c:172
void fr_event_loop_exit(fr_event_list_t *el, int code)
Definition: event.c:495
int fr_event_insert(fr_event_list_t *el, fr_event_callback_t callback, void *ctx, struct timeval *when, fr_event_t **parent)
Definition: event.c:204
bool fr_event_loop_exiting(fr_event_list_t *el)
Definition: event.c:502
int fr_event_list_num_elements(fr_event_list_t *el)
Definition: event.c:164
void(* fr_event_fd_handler_t)(fr_event_list_t *el, int sock, void *ctx)
Definition: event.h:38