dnssrv.h
Go to the documentation of this file.
1
5 /* purple
6 *
7 * Copyright (C) 2005, Thomas Butter <butter@uni-mannheim.de>
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
22 */
23
24 #ifndef _PURPLE_DNSSRV_H
25 #define _PURPLE_DNSSRV_H
26
27 #ifdef __cplusplus
28 extern "C" {
29 #endif
30
31 typedef struct _PurpleSrvTxtQueryData PurpleSrvTxtQueryData;
32 typedef struct _PurpleSrvResponse PurpleSrvResponse;
33 typedef struct _PurpleTxtResponse PurpleTxtResponse;
34
35 /* For compatibility, should be removed for 3.0.0
36 */
37 typedef struct _PurpleSrvTxtQueryData PurpleSrvQueryData;
38
39 #include <glib.h>
40
41 enum PurpleDnsType {
42 PurpleDnsTypeTxt = 16,
43 PurpleDnsTypeSrv = 33
44 };
45
46 struct _PurpleSrvResponse {
47 char hostname[256];
48 int port;
49 int weight;
50 int pref;
51 };
52
53 struct _PurpleTxtResponse {
54 char *content;
55 };
56
57 typedef void (*PurpleSrvTxtQueryResolvedCallback) (PurpleSrvTxtQueryData *query_data, GList *records);
58 typedef void (*PurpleSrvTxtQueryFailedCallback) (PurpleSrvTxtQueryData *query_data, const gchar *error_message);
59
66 typedef struct
67 {
71 gboolean (*resolve)(PurpleSrvTxtQueryData *query_data,
72 PurpleSrvTxtQueryResolvedCallback resolved_cb,
73 PurpleSrvTxtQueryFailedCallback failed_cb);
74
79 void (*destroy)(PurpleSrvTxtQueryData *query_data);
80
81 void (*_purple_reserved1)(void);
82 void (*_purple_reserved2)(void);
83 void (*_purple_reserved3)(void);
84 void (*_purple_reserved4)(void);
85 } PurpleSrvTxtQueryUiOps;
86
93 typedef void (*PurpleSrvCallback)(PurpleSrvResponse *resp, int results, gpointer data);
94
101 typedef void (*PurpleTxtCallback)(GList *responses, gpointer data);
102
115 PurpleSrvTxtQueryData *purple_srv_resolve_account(PurpleAccount *account, const char *protocol, const char *transport, const char *domain, PurpleSrvCallback cb, gpointer extradata);
116
117 #if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_DNSSRV_C_)
118
129 PurpleSrvTxtQueryData *purple_srv_resolve(const char *protocol, const char *transport, const char *domain, PurpleSrvCallback cb, gpointer extradata);
130 #endif
131
139 void purple_srv_cancel(PurpleSrvTxtQueryData *query_data);
140
152 PurpleSrvTxtQueryData *purple_txt_resolve_account(PurpleAccount *account, const char *owner, const char *domain, PurpleTxtCallback cb, gpointer extradata);
153
154 #if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_DNSSRV_C_)
155
167 PurpleSrvTxtQueryData *purple_txt_resolve(const char *owner, const char *domain, PurpleTxtCallback cb, gpointer extradata);
168 #endif
169
178 void purple_txt_cancel(PurpleSrvTxtQueryData *query_data);
179
187 const gchar *purple_txt_response_get_content(PurpleTxtResponse *response);
188
195 void purple_txt_response_destroy(PurpleTxtResponse *response);
196
203 void purple_srv_txt_query_destroy(PurpleSrvTxtQueryData *query_data);
204
212 void purple_srv_txt_query_set_ui_ops(PurpleSrvTxtQueryUiOps *ops);
213
220 PurpleSrvTxtQueryUiOps *purple_srv_txt_query_get_ui_ops(void);
221
228 char *purple_srv_txt_query_get_query(PurpleSrvTxtQueryData *query_data);
229
236 int purple_srv_txt_query_get_type(PurpleSrvTxtQueryData *query_data);
237
238 #ifdef __cplusplus
239 }
240 #endif
241
242 #endif /* _PURPLE_DNSSRV_H */
_PurpleSrvResponse
Definition: dnssrv.h:46
purple_srv_txt_query_get_ui_ops
PurpleSrvTxtQueryUiOps * purple_srv_txt_query_get_ui_ops(void)
Returns the UI operations structure to be used when doing a SRV/TXT resolve.
purple_txt_response_destroy
void purple_txt_response_destroy(PurpleTxtResponse *response)
Destroy a TXT DNS response object.
purple_txt_response_get_content
const gchar * purple_txt_response_get_content(PurpleTxtResponse *response)
Get the value of the current TXT record.
purple_srv_resolve_account
PurpleSrvTxtQueryData * purple_srv_resolve_account(PurpleAccount *account, const char *protocol, const char *transport, const char *domain, PurpleSrvCallback cb, gpointer extradata)
Queries an SRV record.
purple_srv_txt_query_destroy
void purple_srv_txt_query_destroy(PurpleSrvTxtQueryData *query_data)
Cancel a SRV/TXT query and destroy the associated data structure.
purple_txt_resolve
PurpleSrvTxtQueryData * purple_txt_resolve(const char *owner, const char *domain, PurpleTxtCallback cb, gpointer extradata)
Queries an TXT record.
_PurpleAccount
Structure representing an account.
Definition: account.h:169
PurpleTxtCallback
void(* PurpleTxtCallback)(GList *responses, gpointer data)
Callback that returns the data retrieved from a DNS TXT lookup.
Definition: dnssrv.h:101
PurpleSrvTxtQueryUiOps
SRV Request UI operations; UIs should implement this if they want to do SRV lookups themselves...
Definition: dnssrv.h:66
purple_txt_resolve_account
PurpleSrvTxtQueryData * purple_txt_resolve_account(PurpleAccount *account, const char *owner, const char *domain, PurpleTxtCallback cb, gpointer extradata)
Queries an TXT record.
_PurpleTxtResponse
Definition: dnssrv.h:53
purple_srv_txt_query_set_ui_ops
void purple_srv_txt_query_set_ui_ops(PurpleSrvTxtQueryUiOps *ops)
Sets the UI operations structure to be used when doing a SRV/TXT resolve.
purple_srv_txt_query_get_type
int purple_srv_txt_query_get_type(PurpleSrvTxtQueryData *query_data)
Get the type from a PurpleDnsQueryData (TXT or SRV)
purple_txt_cancel
void purple_txt_cancel(PurpleSrvTxtQueryData *query_data)
Cancel an TXT DNS query.
purple_srv_cancel
void purple_srv_cancel(PurpleSrvTxtQueryData *query_data)
Cancel an SRV or DNS query.
purple_srv_txt_query_get_query
char * purple_srv_txt_query_get_query(PurpleSrvTxtQueryData *query_data)
Get the query from a PurpleDnsQueryData.
PurpleSrvCallback
void(* PurpleSrvCallback)(PurpleSrvResponse *resp, int results, gpointer data)
Definition: dnssrv.h:93
purple_srv_resolve
PurpleSrvTxtQueryData * purple_srv_resolve(const char *protocol, const char *transport, const char *domain, PurpleSrvCallback cb, gpointer extradata)
Queries an SRV record.