Standardize all protocol header guard macros.
[pidgin-git.git] / libpurple / protocols / bonjour / jabber.h
blobb23ddc49f3ffd31076b07111df5b09c67727916b
1 /**
2 * @file jabber.h The Purple interface to mDNS and peer to peer Jabber.
4 * purple
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.
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.
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.
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
26 #ifndef PURPLE_BONJOUR_JABBER_H
27 #define PURPLE_BONJOUR_JABBER_H
29 #include <libxml/parser.h>
31 #include "xmlnode.h"
33 #include "account.h"
34 #include "circularbuffer.h"
36 typedef struct
38 GSocketService *service;
39 guint16 port;
40 PurpleAccount *account;
41 GSList *pending_conversations;
42 } BonjourJabber;
44 typedef struct
46 GCancellable *cancellable;
47 GSocketConnection *socket;
48 GInputStream *input;
49 GOutputStream *output;
50 guint rx_handler;
51 guint tx_handler;
52 guint close_timeout;
53 PurpleCircularBuffer *tx_buf;
54 int sent_stream_start; /* 0 = Unsent, 1 = Partial, 2 = Complete */
55 gboolean recv_stream_start;
56 gpointer stream_data;
57 xmlParserCtxt *context;
58 PurpleXmlNode *current;
59 PurpleBuddy *pb;
60 PurpleAccount *account;
62 /* The following are only needed before attaching to a PurpleBuddy */
63 gchar *buddy_name;
64 gchar *ip;
65 /* This points to a data entry in BonjourBuddy->ips */
66 const gchar *ip_link;
67 } BonjourJabberConversation;
69 /**
70 * Start listening for jabber connections.
72 * @return -1 if there was a problem, else returns the listening
73 * port number.
75 gint bonjour_jabber_start(BonjourJabber *data);
77 int bonjour_jabber_send_message(BonjourJabber *data, const char *to, const char *body);
79 void bonjour_jabber_close_conversation(BonjourJabberConversation *bconv);
81 void async_bonjour_jabber_close_conversation(BonjourJabberConversation *bconv);
83 void bonjour_jabber_stream_started(BonjourJabberConversation *bconv);
85 void bonjour_jabber_process_packet(PurpleBuddy *pb, PurpleXmlNode *packet);
87 void bonjour_jabber_stop(BonjourJabber *data);
89 void bonjour_jabber_conv_match_by_ip(BonjourJabberConversation *bconv);
91 void bonjour_jabber_conv_match_by_name(BonjourJabberConversation *bconv);
93 typedef enum {
94 XEP_IQ_SET,
95 XEP_IQ_GET,
96 XEP_IQ_RESULT,
97 XEP_IQ_ERROR,
98 XEP_IQ_NONE
99 } XepIqType;
101 typedef struct {
102 XepIqType type;
103 char *id;
104 PurpleXmlNode *node;
105 char *to;
106 void *data;
107 } XepIq;
109 XepIq *xep_iq_new(void *data, XepIqType type, const char *to, const char *from, const char *id);
110 int xep_iq_send_and_free(XepIq *iq);
111 GSList * bonjour_jabber_get_local_ips(int fd);
113 void append_iface_if_linklocal(char *ip, guint32 interface_param);
115 #endif /* PURPLE_BONJOUR_JABBER_H */