dnsquery.h
Go to the documentation of this file.
1
6 /* purple
7 *
8 * Purple is the legal property of its developers, whose names are too numerous
9 * to list here. Please refer to the COPYRIGHT file distributed with this
10 * source distribution.
11 *
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation; either version 2 of the License, or
15 * (at your option) any later version.
16 *
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, write to the Free Software
24 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
25 */
26 #ifndef _PURPLE_DNSQUERY_H_
27 #define _PURPLE_DNSQUERY_H_
28
29 #include <glib.h>
30 #include "eventloop.h"
31 #include "account.h"
32
38 typedef struct _PurpleDnsQueryData PurpleDnsQueryData;
39
45 typedef void (*PurpleDnsQueryConnectFunction)(GSList *hosts, gpointer data, const char *error_message);
46
50 typedef void (*PurpleDnsQueryResolvedCallback) (PurpleDnsQueryData *query_data, GSList *hosts);
51 typedef void (*PurpleDnsQueryFailedCallback) (PurpleDnsQueryData *query_data, const gchar *error_message);
52
59 typedef struct
60 {
63 gboolean (*resolve_host)(PurpleDnsQueryData *query_data,
64 PurpleDnsQueryResolvedCallback resolved_cb,
65 PurpleDnsQueryFailedCallback failed_cb);
66
71 void (*destroy)(PurpleDnsQueryData *query_data);
72
73 void (*_purple_reserved1)(void);
74 void (*_purple_reserved2)(void);
75 void (*_purple_reserved3)(void);
76 void (*_purple_reserved4)(void);
77 } PurpleDnsQueryUiOps;
78
79 #ifdef __cplusplus
80 extern "C" {
81 #endif
82
83 /**************************************************************************/
85 /**************************************************************************/
103 PurpleDnsQueryData *purple_dnsquery_a_account(PurpleAccount *account, const char *hostname, int port, PurpleDnsQueryConnectFunction callback, gpointer data);
104
105 #if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_DNSQUERY_C_)
106
120 PurpleDnsQueryData *purple_dnsquery_a(const char *hostname, int port, PurpleDnsQueryConnectFunction callback, gpointer data);
121 #endif
122
129 void purple_dnsquery_destroy(PurpleDnsQueryData *query_data);
130
138 void purple_dnsquery_set_ui_ops(PurpleDnsQueryUiOps *ops);
139
146 PurpleDnsQueryUiOps *purple_dnsquery_get_ui_ops(void);
147
154 char *purple_dnsquery_get_host(PurpleDnsQueryData *query_data);
155
162 unsigned short purple_dnsquery_get_port(PurpleDnsQueryData *query_data);
163
167 void purple_dnsquery_init(void);
168
172 void purple_dnsquery_uninit(void);
173
176 #ifdef __cplusplus
177 }
178 #endif
179
180 #endif /* _PURPLE_DNSQUERY_H_ */
purple_dnsquery_get_ui_ops
PurpleDnsQueryUiOps * purple_dnsquery_get_ui_ops(void)
Returns the UI operations structure to be used when doing a DNS resolve.
PurpleDnsQueryResolvedCallback
void(* PurpleDnsQueryResolvedCallback)(PurpleDnsQueryData *query_data, GSList *hosts)
Callbacks used by the UI if it handles resolving DNS.
Definition: dnsquery.h:50
purple_dnsquery_destroy
void purple_dnsquery_destroy(PurpleDnsQueryData *query_data)
Cancel a DNS query and destroy the associated data structure.
eventloop.h
Purple Event Loop API.
purple_dnsquery_a_account
PurpleDnsQueryData * purple_dnsquery_a_account(PurpleAccount *account, const char *hostname, int port, PurpleDnsQueryConnectFunction callback, gpointer data)
Perform an asynchronous DNS query.
_PurpleAccount
Structure representing an account.
Definition: account.h:169
PurpleDnsQueryUiOps
DNS Request UI operations; UIs should implement this if they want to do DNS lookups themselves...
Definition: dnsquery.h:59
PurpleDnsQueryConnectFunction
void(* PurpleDnsQueryConnectFunction)(GSList *hosts, gpointer data, const char *error_message)
The "hosts" parameter is a linked list containing pairs of one size_t addrlen and one struct sockaddr...
Definition: dnsquery.h:45
purple_dnsquery_init
void purple_dnsquery_init(void)
Initializes the DNS query subsystem.
account.h
Account API.
purple_dnsquery_get_host
char * purple_dnsquery_get_host(PurpleDnsQueryData *query_data)
Get the host associated with a PurpleDnsQueryData.
PurpleDnsQueryData
struct _PurpleDnsQueryData PurpleDnsQueryData
An opaque structure representing a DNS query.
Definition: dnsquery.h:38
purple_dnsquery_a
PurpleDnsQueryData * purple_dnsquery_a(const char *hostname, int port, PurpleDnsQueryConnectFunction callback, gpointer data)
Perform an asynchronous DNS query.
purple_dnsquery_set_ui_ops
void purple_dnsquery_set_ui_ops(PurpleDnsQueryUiOps *ops)
Sets the UI operations structure to be used when doing a DNS resolve.
purple_dnsquery_get_port
unsigned short purple_dnsquery_get_port(PurpleDnsQueryData *query_data)
Get the port associated with a PurpleDnsQueryData.
purple_dnsquery_uninit
void purple_dnsquery_uninit(void)
Uninitializes the DNS query subsystem.