Electroneum
Loading...
Searching...
No Matches
ub_event.h
Go to the documentation of this file.
1/*
2 * util/ub_event.h - indirection layer for pluggable events
3 *
4 * Copyright (c) 2007, NLnet Labs. All rights reserved.
5 *
6 * This software is open source.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 *
12 * Redistributions of source code must retain the above copyright notice,
13 * this list of conditions and the following disclaimer.
14 *
15 * Redistributions in binary form must reproduce the above copyright notice,
16 * this list of conditions and the following disclaimer in the documentation
17 * and/or other materials provided with the distribution.
18 *
19 * Neither the name of the NLNET LABS nor the names of its contributors may
20 * be used to endorse or promote products derived from this software without
21 * specific prior written permission.
22 *
23 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
24 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
25 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
26 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
27 * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
28 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
29 * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
30 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
31 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
32 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
33 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34 */
35
42
43#ifndef UB_EVENT_H
44#define UB_EVENT_H
45
46struct ub_event_base;
47struct ub_event;
48struct comm_base;
49struct event_base;
50
52#define UB_EV_TIMEOUT 0x01
54#define UB_EV_READ 0x02
56#define UB_EV_WRITE 0x04
58#define UB_EV_SIGNAL 0x08
60#define UB_EV_PERSIST 0x10
61
66const char* ub_event_get_version(void);
68void ub_get_event_sys(struct ub_event_base*, const char** n, const char** s,
69 const char** m);
73struct ub_event_base* ub_default_event_base(int, time_t*, struct timeval*);
75struct ub_event_base* ub_libevent_event_base(struct event_base*);
79struct event_base* ub_libevent_get_event_base(struct ub_event_base*);
86
89 int fd, short bits, void (*cb)(int, short, void*), void* arg);
91struct ub_event* ub_signal_new(struct ub_event_base*, int fd,
92 void (*cb)(int, short, void*), void* arg);
95 void* wsaevent, void (*cb)(int, short, void*), void* arg);
96
98void ub_event_add_bits(struct ub_event*, short bits);
100void ub_event_del_bits(struct ub_event*, short bits);
102void ub_event_set_fd(struct ub_event*, int fd);
106int ub_event_add(struct ub_event*, struct timeval*);
111 void (*cb)(int, short, void*), void* arg, struct timeval*);
115int ub_signal_add(struct ub_event*, struct timeval*);
123void ub_winsock_tcp_wouldblock(struct ub_event*, int bits);
126
127#endif /* UB_EVENT_H */
struct ub_event_base * ub_default_event_base(int, time_t *, struct timeval *)
void ub_get_event_sys(struct ub_event_base *, const char **n, const char **s, const char **m)
struct ub_event * ub_signal_new(struct ub_event_base *, int fd, void(*cb)(int, short, void *), void *arg)
int ub_signal_del(struct ub_event *)
void ub_winsock_unregister_wsaevent(struct ub_event *ev)
void ub_event_set_fd(struct ub_event *, int fd)
void ub_event_add_bits(struct ub_event *, short bits)
void ub_event_del_bits(struct ub_event *, short bits)
struct ub_event * ub_winsock_register_wsaevent(struct ub_event_base *, void *wsaevent, void(*cb)(int, short, void *), void *arg)
int ub_signal_add(struct ub_event *, struct timeval *)
int ub_event_base_dispatch(struct ub_event_base *)
struct ub_event * ub_event_new(struct ub_event_base *, int fd, short bits, void(*cb)(int, short, void *), void *arg)
struct event_base * ub_libevent_get_event_base(struct ub_event_base *)
int ub_event_del(struct ub_event *)
void ub_event_base_free(struct ub_event_base *)
struct ub_event_base * ub_libevent_event_base(struct event_base *)
void ub_comm_base_now(struct comm_base *cb)
const char * ub_event_get_version(void)
int ub_timer_add(struct ub_event *, struct ub_event_base *, void(*cb)(int, short, void *), void *arg, struct timeval *)
void ub_winsock_tcp_wouldblock(struct ub_event *, int bits)
void ub_event_free(struct ub_event *)
int ub_event_base_loopexit(struct ub_event_base *)
int ub_event_add(struct ub_event *, struct timeval *)
int ub_timer_del(struct ub_event *)