dnssrv.h
Go to the documentation of this file.
00001 
00005 /* purple
00006  *
00007  * Copyright (C) 2005, Thomas Butter <butter@uni-mannheim.de>
00008  *
00009  * This program is free software; you can redistribute it and/or modify
00010  * it under the terms of the GNU General Public License as published by
00011  * the Free Software Foundation; either version 2 of the License, or
00012  * (at your option) any later version.
00013  *
00014  * This program is distributed in the hope that it will be useful,
00015  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00016  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017  * GNU General Public License for more details.
00018  *
00019  * You should have received a copy of the GNU General Public License
00020  * along with this program; if not, write to the Free Software
00021  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02111-1301  USA
00022  */
00023 
00024 #ifndef _PURPLE_DNSSRV_H
00025 #define _PURPLE_DNSSRV_H
00026 
00027 #ifdef __cplusplus
00028 extern "C" {
00029 #endif
00030 
00031 typedef struct _PurpleSrvTxtQueryData PurpleSrvTxtQueryData;
00032 typedef struct _PurpleSrvResponse PurpleSrvResponse;
00033 typedef struct _PurpleTxtResponse PurpleTxtResponse;
00034 
00035 /* For compatibility, should be removed for 3.0.0
00036  */
00037 typedef struct _PurpleSrvTxtQueryData PurpleSrvQueryData;
00038 
00039 #include <glib.h>
00040 
00041 enum PurpleDnsType {
00042     PurpleDnsTypeTxt = 16,
00043     PurpleDnsTypeSrv = 33
00044 };
00045 
00046 struct _PurpleSrvResponse {
00047     char hostname[256];
00048     int port;
00049     int weight;
00050     int pref;
00051 };
00052 
00053 struct _PurpleTxtResponse {
00054     char *content;
00055 };
00056 
00057 typedef void  (*PurpleSrvTxtQueryResolvedCallback) (PurpleSrvTxtQueryData *query_data, GList *records);
00058 typedef void  (*PurpleSrvTxtQueryFailedCallback) (PurpleSrvTxtQueryData *query_data, const gchar *error_message);
00059 
00066 typedef struct
00067 {
00071     gboolean (*resolve)(PurpleSrvTxtQueryData *query_data,
00072                         PurpleSrvTxtQueryResolvedCallback resolved_cb,
00073                         PurpleSrvTxtQueryFailedCallback failed_cb);
00074 
00079     void (*destroy)(PurpleSrvTxtQueryData *query_data);
00080 
00081     void (*_purple_reserved1)(void);
00082     void (*_purple_reserved2)(void);
00083     void (*_purple_reserved3)(void);
00084     void (*_purple_reserved4)(void);
00085 } PurpleSrvTxtQueryUiOps;
00086 
00093 typedef void (*PurpleSrvCallback)(PurpleSrvResponse *resp, int results, gpointer data);
00094 
00101 typedef void (*PurpleTxtCallback)(GList *responses, gpointer data);
00102 
00115 PurpleSrvTxtQueryData *purple_srv_resolve_account(PurpleAccount *account, const char *protocol, const char *transport, const char *domain, PurpleSrvCallback cb, gpointer extradata);
00116 
00117 #if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_DNSSRV_C_)
00118 
00129 PurpleSrvTxtQueryData *purple_srv_resolve(const char *protocol, const char *transport, const char *domain, PurpleSrvCallback cb, gpointer extradata);
00130 #endif
00131 
00139 void purple_srv_cancel(PurpleSrvTxtQueryData *query_data);
00140 
00152 PurpleSrvTxtQueryData *purple_txt_resolve_account(PurpleAccount *account, const char *owner, const char *domain, PurpleTxtCallback cb, gpointer extradata);
00153 
00154 #if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_DNSSRV_C_)
00155 
00167 PurpleSrvTxtQueryData *purple_txt_resolve(const char *owner, const char *domain, PurpleTxtCallback cb, gpointer extradata);
00168 #endif
00169 
00178 void purple_txt_cancel(PurpleSrvTxtQueryData *query_data);
00179 
00187 const gchar *purple_txt_response_get_content(PurpleTxtResponse *response);
00188 
00195 void purple_txt_response_destroy(PurpleTxtResponse *response);
00196 
00203 void purple_srv_txt_query_destroy(PurpleSrvTxtQueryData *query_data);
00204 
00212 void purple_srv_txt_query_set_ui_ops(PurpleSrvTxtQueryUiOps *ops);
00213 
00220 PurpleSrvTxtQueryUiOps *purple_srv_txt_query_get_ui_ops(void);
00221 
00228 char *purple_srv_txt_query_get_query(PurpleSrvTxtQueryData *query_data);
00229 
00236 int purple_srv_txt_query_get_type(PurpleSrvTxtQueryData *query_data);
00237 
00238 #ifdef __cplusplus
00239 }
00240 #endif
00241 
00242 #endif /* _PURPLE_DNSSRV_H */