| |
1 /** |
| |
2 * @file dnsquery.h DNS query API |
| |
3 * @ingroup core |
| |
4 * |
| |
5 * gaim |
| |
6 * |
| |
7 * Gaim is the legal property of its developers, whose names are too numerous |
| |
8 * to list here. Please refer to the COPYRIGHT file distributed with this |
| |
9 * source distribution. |
| |
10 * |
| |
11 * This program is free software; you can redistribute it and/or modify |
| |
12 * it under the terms of the GNU General Public License as published by |
| |
13 * the Free Software Foundation; either version 2 of the License, or |
| |
14 * (at your option) any later version. |
| |
15 * |
| |
16 * This program is distributed in the hope that it will be useful, |
| |
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| |
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| |
19 * GNU General Public License for more details. |
| |
20 * |
| |
21 * You should have received a copy of the GNU General Public License |
| |
22 * along with this program; if not, write to the Free Software |
| |
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| |
24 */ |
| |
25 #ifndef _GAIM_DNSQUERY_H_ |
| |
26 #define _GAIM_DNSQUERY_H_ |
| |
27 |
| |
28 #include <glib.h> |
| |
29 |
| |
30 typedef struct _GaimDnsqueryData GaimDnsqueryData; |
| |
31 |
| |
32 /** |
| |
33 * The "hosts" parameter is a linked list containing pairs of |
| |
34 * one size_t addrlen and one struct sockaddr *addr. |
| |
35 */ |
| |
36 typedef void (*GaimDnsqueryConnectFunction)(GSList *hosts, gpointer data, const char *error_message); |
| |
37 |
| |
38 |
| |
39 #ifdef __cplusplus |
| |
40 extern "C" { |
| |
41 #endif |
| |
42 |
| |
43 /**************************************************************************/ |
| |
44 /** @name DNS query API */ |
| |
45 /**************************************************************************/ |
| |
46 /*@{*/ |
| |
47 |
| |
48 /** |
| |
49 * Do an asynchronous DNS query. |
| |
50 * |
| |
51 * @param hostname The hostname to resolve |
| |
52 * @param port A portnumber which is stored in the struct sockaddr |
| |
53 * @param callback Callback to call after resolving |
| |
54 * @param data Extra data for the callback function |
| |
55 * |
| |
56 * @return NULL if there was an error, or a reference to a data |
| |
57 * structure that can be used to cancel the pending |
| |
58 * connection, if needed. |
| |
59 */ |
| |
60 GaimDnsqueryData *gaim_dnsquery_a(const char *hostname, int port, GaimDnsqueryConnectFunction callback, gpointer data); |
| |
61 |
| |
62 /** |
| |
63 * Cancel a DNS query. |
| |
64 * |
| |
65 * @param query_data A pointer to the DNS query data that you want |
| |
66 * to cancel. |
| |
67 */ |
| |
68 void gaim_dnsquery_destroy(GaimDnsqueryData *query_data); |
| |
69 |
| |
70 /*@}*/ |
| |
71 |
| |
72 #ifdef __cplusplus |
| |
73 } |
| |
74 #endif |
| |
75 |
| |
76 #endif /* _GAIM_DNSQUERY_H_ */ |