libpurple/protocols/bonjour/xmpp.h

changeset 42670
a3b862b8dcde
parent 42669
6d41b29637ef
child 42671
68cc8544b438
equal deleted inserted replaced
42669:6d41b29637ef 42670:a3b862b8dcde
1 /**
2 * @file xmpp.h The Purple interface to mDNS and peer to peer XMPP.
3 *
4 * purple
5 *
6 * Purple is the legal property of its developers, whose names are too numerous
7 * to list here. Please refer to the COPYRIGHT file distributed with this
8 * source distribution.
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
23 *
24 */
25
26 #ifndef PURPLE_BONJOUR_XMPP_H
27 #define PURPLE_BONJOUR_XMPP_H
28
29 #include <libxml/parser.h>
30
31 #include <purple.h>
32
33 typedef struct
34 {
35 GSocketService *service;
36 guint16 port;
37 PurpleAccount *account;
38 GSList *pending_conversations;
39 } BonjourXMPP;
40
41 typedef struct
42 {
43 GCancellable *cancellable;
44 GSocketConnection *socket;
45 GInputStream *input;
46 GOutputStream *output;
47 guint rx_handler;
48 guint tx_handler;
49 guint close_timeout;
50 PurpleCircularBuffer *tx_buf;
51 int sent_stream_start; /* 0 = Unsent, 1 = Partial, 2 = Complete */
52 gboolean recv_stream_start;
53 gpointer stream_data;
54 xmlParserCtxt *context;
55 PurpleXmlNode *current;
56 PurpleContact *contact;
57 PurpleAccount *account;
58
59 /* The following are only needed before attaching to a PurpleBuddy */
60 gchar *buddy_name;
61 gchar *ip;
62 /* This points to a data entry in BonjourBuddy->ips */
63 const gchar *ip_link;
64 } BonjourXMPPConversation;
65
66 /**
67 * Start listening for xmpp connections.
68 *
69 * @return -1 if there was a problem, else returns the listening
70 * port number.
71 */
72 gint bonjour_xmpp_start(BonjourXMPP *data);
73
74 int bonjour_xmpp_send_message(BonjourXMPP *data, const char *to, const char *body);
75
76 void bonjour_xmpp_close_conversation(BonjourXMPPConversation *bconv);
77
78 void async_bonjour_xmpp_close_conversation(BonjourXMPPConversation *bconv);
79
80 void bonjour_xmpp_stream_started(BonjourXMPPConversation *bconv);
81
82 void bonjour_xmpp_process_packet(PurpleContact *contact, PurpleXmlNode *packet);
83
84 void bonjour_xmpp_stop(BonjourXMPP *data);
85
86 void bonjour_xmpp_conv_match_by_ip(BonjourXMPPConversation *bconv);
87
88 void bonjour_xmpp_conv_match_by_name(BonjourXMPPConversation *bconv);
89
90 typedef enum {
91 XEP_IQ_SET,
92 XEP_IQ_GET,
93 XEP_IQ_RESULT,
94 XEP_IQ_ERROR,
95 XEP_IQ_NONE
96 } XepIqType;
97
98 typedef struct {
99 XepIqType type;
100 char *id;
101 PurpleXmlNode *node;
102 char *to;
103 void *data;
104 } XepIq;
105
106 XepIq *xep_iq_new(void *data, XepIqType type, const char *to, const char *from, const char *id);
107 int xep_iq_send_and_free(XepIq *iq);
108
109 void append_iface_if_linklocal(char *ip, guint32 interface_param);
110
111 #endif /* PURPLE_BONJOUR_XMPP_H */

mercurial