2 Unix SMB/CIFS implementation.
4 generalised event loop handling
8 Copyright (C) Stefan Metzmacher 2005
10 This program is free software; you can redistribute it and/or modify
11 it under the terms of the GNU General Public License as published by
12 the Free Software Foundation; either version 2 of the License, or
13 (at your option) any later version.
15 This program is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License for more details.
20 You should have received a copy of the GNU General Public License
21 along with this program; if not, write to the Free Software
22 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
27 int (*context_init)(struct event_context *ev, void *private_data);
29 /* fd_event functions */
30 struct fd_event *(*add_fd)(struct event_context *ev,
32 int fd, uint16_t flags,
33 event_fd_handler_t handler,
35 uint16_t (*get_fd_flags)(struct fd_event *fde);
36 void (*set_fd_flags)(struct fd_event *fde, uint16_t flags);
38 /* timed_event functions */
39 struct timed_event *(*add_timed)(struct event_context *ev,
41 struct timeval next_event,
42 event_timed_handler_t handler,
46 int (*loop_once)(struct event_context *ev);
47 int (*loop_wait)(struct event_context *ev);
51 struct fd_event *prev, *next;
52 struct event_context *event_ctx;
54 uint16_t flags; /* see EVENT_FD_* flags */
55 event_fd_handler_t handler;
56 /* this is private for the specific handler */
58 /* this is private for the events_ops implementation */
59 uint16_t additional_flags;
60 void *additional_data;
64 struct timed_event *prev, *next;
65 struct event_context *event_ctx;
66 struct timeval next_event;
67 event_timed_handler_t handler;
68 /* this is private for the specific handler */
70 /* this is private for the events_ops implementation */
71 void *additional_data;
74 struct event_context {
75 /* the specific events implementation */
76 const struct event_ops *ops;
77 /* this is private for the events_ops implementation */
78 void *additional_data;
81 const struct event_ops *event_standard_get_ops(void);