comparison libgaim/dnsquery.h @ 14238:f189327b9968

[gaim-migrate @ 16920] Cancelable DNS queries. This eliminates crashes when you cancel a connection attempt while we're waiting for a response from a DNS server. I tested with all three methods, so they SHOULD be ok. Let me know if you have problems. I should be around today, starting in maybe an hour. I feel like it's kinda dumb for us to have three implementations for the same thing. I want to get rid of the child-process method (currently used in Unix and OS-X) and use the thread-based method (currently used in Windows) everywhere. Then we can get rid of the third method, too (currently used when !Unix and !OS-X and !Windows) Any objections? committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Sun, 20 Aug 2006 22:24:13 +0000
parents 60b1bc8dbf37
children
comparison
equal deleted inserted replaced
14237:7cf90e0b6180 14238:f189327b9968
30 30
31 typedef struct _GaimDnsQueryData GaimDnsQueryData; 31 typedef struct _GaimDnsQueryData GaimDnsQueryData;
32 32
33 /** 33 /**
34 * The "hosts" parameter is a linked list containing pairs of 34 * The "hosts" parameter is a linked list containing pairs of
35 * one size_t addrlen and one struct sockaddr *addr. 35 * one size_t addrlen and one struct sockaddr *addr. It should
36 * be free'd by the callback function.
36 */ 37 */
37 typedef void (*GaimDnsQueryConnectFunction)(GSList *hosts, gpointer data, const char *error_message); 38 typedef void (*GaimDnsQueryConnectFunction)(GSList *hosts, gpointer data, const char *error_message);
38 39
39 40
40 #include "account.h" 41 #include "account.h"
47 /** @name DNS query API */ 48 /** @name DNS query API */
48 /**************************************************************************/ 49 /**************************************************************************/
49 /*@{*/ 50 /*@{*/
50 51
51 /** 52 /**
52 * Do an async dns query 53 * Perform an asynchronous DNS query.
53 * 54 *
54 * @param hostname The hostname to resolve 55 * @param hostname The hostname to resolve.
55 * @param port A portnumber which is stored in the struct sockaddr 56 * @param port A port number which is stored in the struct sockaddr.
56 * @param callback Callback to call after resolving 57 * @param callback The callback function to call after resolving.
57 * @param data Extra data for the callback function 58 * @param data Extra data to pass to the callback function.
58 * 59 *
59 * @return NULL if there was an error, otherwise return a reference to 60 * @return NULL if there was an error, otherwise return a reference to
60 * a data structure that can be used to cancel the pending 61 * a data structure that can be used to cancel the pending
61 * DNS query, if needed. 62 * DNS query, if needed.
62 */ 63 */
63 GaimDnsQueryData *gaim_dnsquery_a(const char *hostname, int port, GaimDnsQueryConnectFunction callback, gpointer data); 64 GaimDnsQueryData *gaim_dnsquery_a(const char *hostname, int port, GaimDnsQueryConnectFunction callback, gpointer data);
65
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);
64 83
65 /*@}*/ 84 /*@}*/
66 85
67 #ifdef __cplusplus 86 #ifdef __cplusplus
68 } 87 }