1 /* IODNSHandler.h - IOMultiplexer
2 * Copyright (C) 2012 Philipp Kreil (pk910)
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 #ifndef _IODNSHandler_h
18 #define _IODNSHandler_h
21 #define IODNS_CALLBACK(NAME) void NAME(struct IODNSEvent *event)
22 typedef IODNS_CALLBACK(iodns_callback);
29 #define IODNS_RECORD_A 0x01
30 #define IODNS_RECORD_AAAA 0x02
31 #define IODNS_RECORD_PTR 0x04
33 #define IODNS_FORWARD 0x03
34 #define IODNS_REVERSE 0x04
38 unsigned int type : 8;
42 struct sockaddr *address;
43 struct IODNSResult *results
45 iodns_callback *callback;
48 struct IODNSQuery *next, *prev;
52 unsigned int type : 8;
54 struct sockaddr *address;
55 struct IODNSResult *next;
59 enum IODNSEventType type;
60 struct IODNSQuery *query;
63 struct IODNSQuery *iodns_getaddrinfo(char *hostname, int records, iodns_callback *callback);
64 struct IODNSQuery *iodns_getnameinfo(const struct sockaddr *addr, socklen_t addrlen, iodns_callback *callback);
65 void iodns_abort(struct IODNSQuery *query);
68 void iodns_free_result(struct IODNSResult *result);