14192
|
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 #include "eventloop.h"
|
|
30
|
|
31 typedef struct _GaimDnsQueryData GaimDnsQueryData;
|
|
32
|
|
33 /**
|
|
34 * The "hosts" parameter is a linked list containing pairs of
|
14238
|
35 * one size_t addrlen and one struct sockaddr *addr. It should
|
|
36 * be free'd by the callback function.
|
14192
|
37 */
|
|
38 typedef void (*GaimDnsQueryConnectFunction)(GSList *hosts, gpointer data, const char *error_message);
|
|
39
|
|
40
|
|
41 #include "account.h"
|
|
42
|
|
43 #ifdef __cplusplus
|
|
44 extern "C" {
|
|
45 #endif
|
|
46
|
|
47 /**************************************************************************/
|
|
48 /** @name DNS query API */
|
|
49 /**************************************************************************/
|
|
50 /*@{*/
|
|
51
|
|
52 /**
|
14238
|
53 * Perform an asynchronous DNS query.
|
14192
|
54 *
|
14238
|
55 * @param hostname The hostname to resolve.
|
|
56 * @param port A port number which is stored in the struct sockaddr.
|
|
57 * @param callback The callback function to call after resolving.
|
|
58 * @param data Extra data to pass to the callback function.
|
14192
|
59 *
|
|
60 * @return NULL if there was an error, otherwise return a reference to
|
|
61 * a data structure that can be used to cancel the pending
|
|
62 * DNS query, if needed.
|
|
63 */
|
|
64 GaimDnsQueryData *gaim_dnsquery_a(const char *hostname, int port, GaimDnsQueryConnectFunction callback, gpointer data);
|
|
65
|
14238
|
66 /**
|
|
67 * Cancel a DNS query and destroy the associated data structure.
|
|
68 *
|
|
69 * @param query_data The DNS query to cancel. This data structure
|
|
70 * is freed by this function.
|
|
71 */
|
|
72 void gaim_dnsquery_destroy(GaimDnsQueryData *query_data);
|
|
73
|
|
74 /**
|
|
75 * Initializes the DNS query subsystem.
|
|
76 */
|
|
77 void gaim_dnsquery_init(void);
|
|
78
|
|
79 /**
|
|
80 * Uninitializes the DNS query subsystem.
|
|
81 */
|
|
82 void gaim_dnsquery_uninit(void);
|
|
83
|
14192
|
84 /*@}*/
|
|
85
|
|
86 #ifdef __cplusplus
|
|
87 }
|
|
88 #endif
|
|
89
|
|
90 #endif /* _GAIM_DNSQUERY_H_ */
|