comparison libpurple/dnssrv.h @ 29471:d83ee160ffb6

propagate from branch 'im.pidgin.pidgin' (head eb9385f349a20856b9d3f9911dbc8024caa44052) to branch 'im.pidgin.pidgin.next.minor' (head 439fb2dd7a285d9ca645f65f36ef0f037abe7311)
author Elliott Sales de Andrade <qulogic@pidgin.im>
date Wed, 19 Aug 2009 00:46:04 +0000
parents a71cc338f0fd
children 63cb8c4f3c66
comparison
equal deleted inserted replaced
29470:7a3458436140 29471:d83ee160ffb6
26 26
27 #ifdef __cplusplus 27 #ifdef __cplusplus
28 extern "C" { 28 extern "C" {
29 #endif 29 #endif
30 30
31 typedef struct _PurpleSrvQueryData PurpleSrvQueryData;
31 typedef struct _PurpleSrvResponse PurpleSrvResponse; 32 typedef struct _PurpleSrvResponse PurpleSrvResponse;
32 typedef struct _PurpleSrvQueryData PurpleSrvQueryData; 33 typedef struct _PurpleTxtResponse PurpleTxtResponse;
34
35 #include <glib.h>
33 36
34 struct _PurpleSrvResponse { 37 struct _PurpleSrvResponse {
35 char hostname[256]; 38 char hostname[256];
36 int port; 39 int port;
37 int weight; 40 int weight;
38 int pref; 41 int pref;
39 }; 42 };
40 43
44 /**
45 * @param resp An array of PurpleSrvResponse of size results. The array
46 * is sorted based on the order described in the DNS SRV RFC.
47 * Users of this API should try each record in resp in order,
48 * starting at the beginning.
49 */
41 typedef void (*PurpleSrvCallback)(PurpleSrvResponse *resp, int results, gpointer data); 50 typedef void (*PurpleSrvCallback)(PurpleSrvResponse *resp, int results, gpointer data);
51
52 /**
53 * Callback that returns the data retrieved from a DNS TXT lookup.
54 *
55 * @param responses A GList of PurpleTxtResponse objects.
56 * @param data The extra data passed to purple_txt_resolve.
57 */
58 typedef void (*PurpleTxtCallback)(GList *responses, gpointer data);
42 59
43 /** 60 /**
44 * Queries an SRV record. 61 * Queries an SRV record.
45 * 62 *
46 * @param protocol Name of the protocol (e.g. "sip") 63 * @param protocol Name of the protocol (e.g. "sip")
56 * 73 *
57 * @param query_data The request to cancel. 74 * @param query_data The request to cancel.
58 */ 75 */
59 void purple_srv_cancel(PurpleSrvQueryData *query_data); 76 void purple_srv_cancel(PurpleSrvQueryData *query_data);
60 77
78 /**
79 * Queries an TXT record.
80 *
81 * @param owner Name of the protocol (e.g. "_xmppconnect")
82 * @param domain Domain name to query (e.g. "blubb.com")
83 * @param cb A callback which will be called with the results
84 * @param extradata Extra data to be passed to the callback
85 *
86 * @since 2.6.0
87 */
88 PurpleSrvQueryData *purple_txt_resolve(const char *owner, const char *domain, PurpleTxtCallback cb, gpointer extradata);
89
90 /**
91 * Cancel an TXT DNS query.
92 *
93 * @param query_data The request to cancel.
94 * @since 2.6.0
95 */
96 void purple_txt_cancel(PurpleSrvQueryData *query_data);
97
98 /**
99 * Get the value of the current TXT record.
100 *
101 * @param resp The TXT response record
102 * @returns The value of the current TXT record.
103 * @since 2.6.0
104 */
105 const gchar *purple_txt_response_get_content(PurpleTxtResponse *resp);
106
107 /**
108 * Destroy a TXT DNS response object.
109 *
110 * @param response The PurpleTxtResponse to destroy.
111 * @since 2.6.0
112 */
113 void purple_txt_response_destroy(PurpleTxtResponse *resp);
114
61 #ifdef __cplusplus 115 #ifdef __cplusplus
62 } 116 }
63 #endif 117 #endif
64 118
65 #endif /* _PURPLE_DNSSRV_H */ 119 #endif /* _PURPLE_DNSSRV_H */