Electroneum
Loading...
Searching...
No Matches
unbound-event.h
Go to the documentation of this file.
1/*
2 * unbound-event.h - unbound validating resolver public API with 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
55#ifndef _UB_UNBOUND_EVENT_H
56#define _UB_UNBOUND_EVENT_H
57
58#ifdef __cplusplus
59extern "C" {
60#endif
61
62struct ub_ctx;
63struct ub_result;
64struct event_base;
65
67#define UB_EV_TIMEOUT 0x01
69#define UB_EV_READ 0x02
71#define UB_EV_WRITE 0x04
73#define UB_EV_SIGNAL 0x08
75#define UB_EV_PERSIST 0x10
76
78#define UB_EVENT_MAGIC 0x44d74d78
79
80struct ub_event;
81struct ub_event_base;
82struct timeval;
83
90 void (*free)(struct ub_event_base*);
93 int (*dispatch)(struct ub_event_base*);
95 int (*loopexit)(struct ub_event_base*, struct timeval*);
97 struct ub_event* (*new_event)(struct ub_event_base*,
98 int fd, short bits, void (*cb)(int, short, void*), void* arg);
101 struct ub_event* (*new_signal)(struct ub_event_base*, int fd,
102 void (*cb)(int, short, void*), void* arg);
105 struct ub_event* (*winsock_register_wsaevent)(struct ub_event_base*,
106 void* wsaevent, void (*cb)(int, short, void*), void* arg);
107};
108
117 unsigned long magic;
120};
121
128 void (*add_bits)(struct ub_event*, short);
131 void (*del_bits)(struct ub_event*, short);
134 void (*set_fd)(struct ub_event*, int);
136 void (*free)(struct ub_event*);
138 int (*add)(struct ub_event*, struct timeval*);
140 int (*del)(struct ub_event*);
142 int (*add_timer)(struct ub_event*, struct ub_event_base*,
143 void (*cb)(int, short, void*), void* arg, struct timeval*);
145 int (*del_timer)(struct ub_event*);
147 int (*add_signal)(struct ub_event*, struct timeval*);
149 int (*del_signal)(struct ub_event*);
158 void (*winsock_tcp_wouldblock)(struct ub_event*, int eventbit);
159};
160
166struct ub_event {
168 unsigned long magic;
171};
172
173typedef void (*ub_event_callback_type)(void*, int, void*, int, int, char*);
174
188
205
216int ub_ctx_set_event(struct ub_ctx* ctx, struct event_base* base);
217
256int ub_resolve_event(struct ub_ctx* ctx, const char* name, int rrtype,
257 int rrclass, void* mydata, ub_event_callback_type callback,
258 int* async_id);
259
260#ifdef __cplusplus
261}
262#endif
263
264#endif /* _UB_UNBOUND_H */
struct ub_event_base * event_base
Definition context.h:118
int(* loopexit)(struct ub_event_base *, struct timeval *)
void(* free)(struct ub_event_base *)
int(* dispatch)(struct ub_event_base *)
struct ub_event_base_vmt * vmt
unsigned long magic
void(* winsock_tcp_wouldblock)(struct ub_event *, int eventbit)
int(* del_timer)(struct ub_event *)
void(* set_fd)(struct ub_event *, int)
void(* del_bits)(struct ub_event *, short)
int(* add)(struct ub_event *, struct timeval *)
int(* del)(struct ub_event *)
int(* add_signal)(struct ub_event *, struct timeval *)
void(* free)(struct ub_event *)
int(* add_timer)(struct ub_event *, struct ub_event_base *, void(*cb)(int, short, void *), void *arg, struct timeval *)
void(* winsock_unregister_wsaevent)(struct ub_event *ev)
void(* add_bits)(struct ub_event *, short)
int(* del_signal)(struct ub_event *)
struct ub_event_vmt * vmt
unsigned long magic
int ub_ctx_set_event(struct ub_ctx *ctx, struct event_base *base)
void(* ub_event_callback_type)(void *, int, void *, int, int, char *)
struct ub_ctx * ub_ctx_create_ub_event(struct ub_event_base *base)
int ub_resolve_event(struct ub_ctx *ctx, const char *name, int rrtype, int rrclass, void *mydata, ub_event_callback_type callback, int *async_id)
struct ub_ctx * ub_ctx_create_event(struct event_base *base)