Mercurial > pidgin
comparison libpurple/dnssrv.h @ 32819:2c6510167895 default tip
propagate from branch 'im.pidgin.pidgin.2.x.y' (head 3315c5dfbd0ad16511bdcf865e5b07c02d07df24)
to branch 'im.pidgin.pidgin' (head cbd1eda6bcbf0565ae7766396bb8f6f419cb6a9a)
author | Elliott Sales de Andrade <qulogic@pidgin.im> |
---|---|
date | Sat, 02 Jun 2012 02:30:49 +0000 |
parents | 98520ee78f12 |
children |
comparison
equal
deleted
inserted
replaced
32818:01ff09d4a463 | 32819:2c6510167895 |
---|---|
22 */ | 22 */ |
23 | 23 |
24 #ifndef _PURPLE_DNSSRV_H | 24 #ifndef _PURPLE_DNSSRV_H |
25 #define _PURPLE_DNSSRV_H | 25 #define _PURPLE_DNSSRV_H |
26 | 26 |
27 #ifdef __cplusplus | |
28 extern "C" { | |
29 #endif | |
30 | |
31 typedef struct _PurpleSrvTxtQueryData PurpleSrvTxtQueryData; | 27 typedef struct _PurpleSrvTxtQueryData PurpleSrvTxtQueryData; |
32 typedef struct _PurpleSrvResponse PurpleSrvResponse; | 28 typedef struct _PurpleSrvResponse PurpleSrvResponse; |
33 typedef struct _PurpleTxtResponse PurpleTxtResponse; | 29 typedef struct _PurpleTxtResponse PurpleTxtResponse; |
34 | |
35 /* For compatibility, should be removed for 3.0.0 | |
36 */ | |
37 typedef struct _PurpleSrvTxtQueryData PurpleSrvQueryData; | |
38 | 30 |
39 #include <glib.h> | 31 #include <glib.h> |
40 | 32 |
41 enum PurpleDnsType { | 33 enum PurpleDnsType { |
42 PurpleDnsTypeTxt = 16, | 34 PurpleDnsTypeTxt = 16, |
72 PurpleSrvTxtQueryResolvedCallback resolved_cb, | 64 PurpleSrvTxtQueryResolvedCallback resolved_cb, |
73 PurpleSrvTxtQueryFailedCallback failed_cb); | 65 PurpleSrvTxtQueryFailedCallback failed_cb); |
74 | 66 |
75 /** Called just before @a query_data is freed; this should cancel any | 67 /** Called just before @a query_data is freed; this should cancel any |
76 * further use of @a query_data the UI would make. Unneeded if | 68 * further use of @a query_data the UI would make. Unneeded if |
77 * #resolve_host is not implemented. | 69 * #resolve is not implemented. |
78 */ | 70 */ |
79 void (*destroy)(PurpleSrvTxtQueryData *query_data); | 71 void (*destroy)(PurpleSrvTxtQueryData *query_data); |
80 | 72 |
81 void (*_purple_reserved1)(void); | 73 void (*_purple_reserved1)(void); |
82 void (*_purple_reserved2)(void); | 74 void (*_purple_reserved2)(void); |
98 * @param responses A GList of PurpleTxtResponse objects. | 90 * @param responses A GList of PurpleTxtResponse objects. |
99 * @param data The extra data passed to purple_txt_resolve. | 91 * @param data The extra data passed to purple_txt_resolve. |
100 */ | 92 */ |
101 typedef void (*PurpleTxtCallback)(GList *responses, gpointer data); | 93 typedef void (*PurpleTxtCallback)(GList *responses, gpointer data); |
102 | 94 |
95 G_BEGIN_DECLS | |
96 | |
103 /** | 97 /** |
104 * Queries an SRV record. | 98 * Queries an SRV record. |
105 * | 99 * |
106 * @param account the account that the query is being done for (or NULL) | 100 * @param account The account that the query is being done for (or NULL) |
107 * @param protocol Name of the protocol (e.g. "sip") | 101 * @param protocol Name of the protocol (e.g. "sip") |
108 * @param transport Name of the transport ("tcp" or "udp") | 102 * @param transport Name of the transport ("tcp" or "udp") |
109 * @param domain Domain name to query (e.g. "blubb.com") | 103 * @param domain Domain name to query (e.g. "blubb.com") |
110 * @param cb A callback which will be called with the results | 104 * @param cb A callback which will be called with the results |
111 * @param extradata Extra data to be passed to the callback | 105 * @param extradata Extra data to be passed to the callback |
112 * | 106 * |
113 * @since 2.8.0 | 107 * @return NULL if there was an error, otherwise return a reference to |
108 * a data structure that can be used to cancel the pending | |
109 * DNS query, if needed. | |
114 */ | 110 */ |
115 PurpleSrvTxtQueryData *purple_srv_resolve_account(PurpleAccount *account, const char *protocol, const char *transport, const char *domain, PurpleSrvCallback cb, gpointer extradata); | 111 PurpleSrvTxtQueryData *purple_srv_resolve(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 /** | |
119 * Queries an SRV record. | |
120 * | |
121 * @param protocol Name of the protocol (e.g. "sip") | |
122 * @param transport Name of the transport ("tcp" or "udp") | |
123 * @param domain Domain name to query (e.g. "blubb.com") | |
124 * @param cb A callback which will be called with the results | |
125 * @param extradata Extra data to be passed to the callback | |
126 * | |
127 * @deprecated Use purple_srv_resolve_account instead | |
128 */ | |
129 PurpleSrvTxtQueryData *purple_srv_resolve(const char *protocol, const char *transport, const char *domain, PurpleSrvCallback cb, gpointer extradata); | |
130 #endif | |
131 | |
132 /** | |
133 * Cancel an SRV or DNS query. | |
134 * | |
135 * @param query_data The request to cancel. | |
136 * | |
137 * @deprecated Use purple_srv_txt_query_destroy instead | |
138 */ | |
139 void purple_srv_cancel(PurpleSrvTxtQueryData *query_data); | |
140 | 112 |
141 /** | 113 /** |
142 * Queries an TXT record. | 114 * Queries an TXT record. |
143 * | 115 * |
144 * @param account the account that the query is being done for (or NULL) | 116 * @param account The account that the query is being done for (or NULL) |
145 * @param owner Name of the protocol (e.g. "_xmppconnect") | 117 * @param owner Name of the protocol (e.g. "_xmppconnect") |
146 * @param domain Domain name to query (e.g. "blubb.com") | 118 * @param domain Domain name to query (e.g. "blubb.com") |
147 * @param cb A callback which will be called with the results | 119 * @param cb A callback which will be called with the results |
148 * @param extradata Extra data to be passed to the callback | 120 * @param extradata Extra data to be passed to the callback |
149 * | 121 * |
150 * @since 2.8.0 | 122 * @return NULL if there was an error, otherwise return a reference to |
123 * a data structure that can be used to cancel the pending | |
124 * DNS query, if needed. | |
151 */ | 125 */ |
152 PurpleSrvTxtQueryData *purple_txt_resolve_account(PurpleAccount *account, const char *owner, const char *domain, PurpleTxtCallback cb, gpointer extradata); | 126 PurpleSrvTxtQueryData *purple_txt_resolve(PurpleAccount *account, const char *owner, const char *domain, PurpleTxtCallback cb, gpointer extradata); |
153 | |
154 #if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_DNSSRV_C_) | |
155 /** | |
156 * Queries an TXT record. | |
157 * | |
158 * @param owner Name of the protocol (e.g. "_xmppconnect") | |
159 * @param domain Domain name to query (e.g. "blubb.com") | |
160 * @param cb A callback which will be called with the results | |
161 * @param extradata Extra data to be passed to the callback | |
162 * | |
163 * @deprecated Use purple_txt_resolve_account instead | |
164 * | |
165 * @since 2.6.0 | |
166 */ | |
167 PurpleSrvTxtQueryData *purple_txt_resolve(const char *owner, const char *domain, PurpleTxtCallback cb, gpointer extradata); | |
168 #endif | |
169 | |
170 /** | |
171 * Cancel an TXT DNS query. | |
172 * | |
173 * @param query_data The request to cancel. | |
174 * @since 2.6.0 | |
175 * | |
176 * @deprecated Use purple_srv_txt_query_destroy instead | |
177 */ | |
178 void purple_txt_cancel(PurpleSrvTxtQueryData *query_data); | |
179 | 127 |
180 /** | 128 /** |
181 * Get the value of the current TXT record. | 129 * Get the value of the current TXT record. |
182 * | 130 * |
183 * @param response The TXT response record | 131 * @param response The TXT response record |
184 * @returns The value of the current TXT record. | 132 * |
185 * @since 2.6.0 | 133 * @return The value of the current TXT record. |
186 */ | 134 */ |
187 const gchar *purple_txt_response_get_content(PurpleTxtResponse *response); | 135 const gchar *purple_txt_response_get_content(PurpleTxtResponse *response); |
188 | 136 |
189 /** | 137 /** |
190 * Destroy a TXT DNS response object. | 138 * Destroy a TXT DNS response object. |
191 * | 139 * |
192 * @param response The PurpleTxtResponse to destroy. | 140 * @param response The PurpleTxtResponse to destroy. |
193 * @since 2.6.0 | |
194 */ | 141 */ |
195 void purple_txt_response_destroy(PurpleTxtResponse *response); | 142 void purple_txt_response_destroy(PurpleTxtResponse *response); |
196 | 143 |
197 /** | 144 /** |
198 * Cancel a SRV/TXT query and destroy the associated data structure. | 145 * Cancel a SRV/TXT query and destroy the associated data structure. |
218 * @return The UI operations structure. | 165 * @return The UI operations structure. |
219 */ | 166 */ |
220 PurpleSrvTxtQueryUiOps *purple_srv_txt_query_get_ui_ops(void); | 167 PurpleSrvTxtQueryUiOps *purple_srv_txt_query_get_ui_ops(void); |
221 | 168 |
222 /** | 169 /** |
223 * Get the query from a PurpleDnsQueryData | 170 * Get the query from a PurpleSrvTxtQueryData |
224 * | 171 * |
225 * @param query_data The SRV/TXT query | 172 * @param query_data The SRV/TXT query |
226 * @return The query. | 173 * @return The query. |
227 */ | 174 */ |
228 char *purple_srv_txt_query_get_query(PurpleSrvTxtQueryData *query_data); | 175 char *purple_srv_txt_query_get_query(PurpleSrvTxtQueryData *query_data); |
229 | 176 |
230 /** | 177 /** |
231 * Get the type from a PurpleDnsQueryData (TXT or SRV) | 178 * Get the type from a PurpleSrvTxtQueryData (TXT or SRV) |
232 * | 179 * |
233 * @param query_data The query | 180 * @param query_data The query |
234 * @return The query. | 181 * @return The query. |
235 */ | 182 */ |
236 int purple_srv_txt_query_get_type(PurpleSrvTxtQueryData *query_data); | 183 int purple_srv_txt_query_get_type(PurpleSrvTxtQueryData *query_data); |
237 | 184 |
238 #ifdef __cplusplus | 185 G_END_DECLS |
239 } | |
240 #endif | |
241 | 186 |
242 #endif /* _PURPLE_DNSSRV_H */ | 187 #endif /* _PURPLE_DNSSRV_H */ |
188 |