[206] | 1 | /*
|
---|
| 2 | Unix SMB/CIFS implementation.
|
---|
| 3 | event handling
|
---|
| 4 | Copyright (C) Andrew Tridgell 1992-1998
|
---|
| 5 | Copyright (C) Volker Lendecke 2005
|
---|
| 6 |
|
---|
| 7 | This program is free software; you can redistribute it and/or modify
|
---|
| 8 | it under the terms of the GNU General Public License as published by
|
---|
| 9 | the Free Software Foundation; either version 3 of the License, or
|
---|
| 10 | (at your option) any later version.
|
---|
| 11 |
|
---|
| 12 | This program is distributed in the hope that it will be useful,
|
---|
| 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
| 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
| 15 | GNU General Public License for more details.
|
---|
| 16 |
|
---|
| 17 | You should have received a copy of the GNU General Public License
|
---|
| 18 | along with this program. If not, see <http://www.gnu.org/licenses/>.
|
---|
| 19 | */
|
---|
| 20 |
|
---|
| 21 | struct event_context;
|
---|
| 22 | struct fd_event;
|
---|
| 23 | struct timed_event;
|
---|
| 24 |
|
---|
| 25 | /* bits for file descriptor event flags */
|
---|
| 26 | #define EVENT_FD_READ 1
|
---|
| 27 | #define EVENT_FD_WRITE 2
|
---|
| 28 |
|
---|
| 29 | /* The following definitions come from lib/events.c */
|
---|
| 30 |
|
---|
| 31 | struct timed_event *_event_add_timed(struct event_context *event_ctx,
|
---|
| 32 | TALLOC_CTX *mem_ctx,
|
---|
| 33 | struct timeval when,
|
---|
| 34 | const char *event_name,
|
---|
| 35 | void (*handler)(struct event_context *event_ctx,
|
---|
| 36 | struct timed_event *te,
|
---|
| 37 | struct timeval now,
|
---|
| 38 | void *private_data),
|
---|
| 39 | void *private_data);
|
---|
| 40 | #define event_add_timed(event_ctx, mem_ctx, when, handler, private_data) \
|
---|
| 41 | _event_add_timed(event_ctx, mem_ctx, when, #handler, handler, private_data)
|
---|
| 42 | struct fd_event *event_add_fd(struct event_context *event_ctx,
|
---|
| 43 | TALLOC_CTX *mem_ctx,
|
---|
| 44 | int fd, uint16_t flags,
|
---|
| 45 | void (*handler)(struct event_context *event_ctx,
|
---|
| 46 | struct fd_event *event,
|
---|
| 47 | uint16 flags,
|
---|
| 48 | void *private_data),
|
---|
| 49 | void *private_data);
|
---|
| 50 | void event_fd_set_writeable(struct fd_event *fde);
|
---|
| 51 | void event_fd_set_not_writeable(struct fd_event *fde);
|
---|
| 52 | void event_fd_set_readable(struct fd_event *fde);
|
---|
| 53 | void event_fd_set_not_readable(struct fd_event *fde);
|
---|
| 54 | bool event_add_to_select_args(struct event_context *event_ctx,
|
---|
| 55 | const struct timeval *now,
|
---|
| 56 | fd_set *read_fds, fd_set *write_fds,
|
---|
| 57 | struct timeval *timeout, int *maxfd);
|
---|
| 58 | bool run_events(struct event_context *event_ctx,
|
---|
| 59 | int selrtn, fd_set *read_fds, fd_set *write_fds);
|
---|
| 60 | struct timeval *get_timed_events_timeout(struct event_context *event_ctx,
|
---|
| 61 | struct timeval *to_ret);
|
---|
| 62 | int event_loop_once(struct event_context *ev);
|
---|
| 63 | void event_context_reinit(struct event_context *ev);
|
---|
| 64 | struct event_context *event_context_init(TALLOC_CTX *mem_ctx);
|
---|
| 65 | void dump_event_list(struct event_context *event_ctx);
|
---|
| 66 |
|
---|