Mercurial > pidgin.yaz
annotate libpurple/protocols/jabber/bosh.h @ 25749:b5dbf1d9930b
Whitespace, formatting, and // -> /* */
author | Paul Aurich <paul@darkrain42.org> |
---|---|
date | Fri, 21 Nov 2008 17:52:56 +0000 |
parents | 0a8484372312 |
children | 7de1f124f95a |
rev | line source |
---|---|
25596
7768cad83127
* looking for alternative connection methods if direct connection fails
Tobias Markmann <tfar@soc.pidgin.im>
parents:
diff
changeset
|
1 /** |
7768cad83127
* looking for alternative connection methods if direct connection fails
Tobias Markmann <tfar@soc.pidgin.im>
parents:
diff
changeset
|
2 * @file bosh.h Buddy handlers |
7768cad83127
* looking for alternative connection methods if direct connection fails
Tobias Markmann <tfar@soc.pidgin.im>
parents:
diff
changeset
|
3 * |
7768cad83127
* looking for alternative connection methods if direct connection fails
Tobias Markmann <tfar@soc.pidgin.im>
parents:
diff
changeset
|
4 * purple |
7768cad83127
* looking for alternative connection methods if direct connection fails
Tobias Markmann <tfar@soc.pidgin.im>
parents:
diff
changeset
|
5 * |
7768cad83127
* looking for alternative connection methods if direct connection fails
Tobias Markmann <tfar@soc.pidgin.im>
parents:
diff
changeset
|
6 * Copyright (C) 2008, Tobias Markmann <tmarkmann@googlemail.com> |
7768cad83127
* looking for alternative connection methods if direct connection fails
Tobias Markmann <tfar@soc.pidgin.im>
parents:
diff
changeset
|
7 * |
7768cad83127
* looking for alternative connection methods if direct connection fails
Tobias Markmann <tfar@soc.pidgin.im>
parents:
diff
changeset
|
8 * This program is free software; you can redistribute it and/or modify |
7768cad83127
* looking for alternative connection methods if direct connection fails
Tobias Markmann <tfar@soc.pidgin.im>
parents:
diff
changeset
|
9 * it under the terms of the GNU General Public License as published by |
7768cad83127
* looking for alternative connection methods if direct connection fails
Tobias Markmann <tfar@soc.pidgin.im>
parents:
diff
changeset
|
10 * the Free Software Foundation; either version 2 of the License, or |
7768cad83127
* looking for alternative connection methods if direct connection fails
Tobias Markmann <tfar@soc.pidgin.im>
parents:
diff
changeset
|
11 * (at your option) any later version. |
7768cad83127
* looking for alternative connection methods if direct connection fails
Tobias Markmann <tfar@soc.pidgin.im>
parents:
diff
changeset
|
12 * |
7768cad83127
* looking for alternative connection methods if direct connection fails
Tobias Markmann <tfar@soc.pidgin.im>
parents:
diff
changeset
|
13 * This program is distributed in the hope that it will be useful, |
7768cad83127
* looking for alternative connection methods if direct connection fails
Tobias Markmann <tfar@soc.pidgin.im>
parents:
diff
changeset
|
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
7768cad83127
* looking for alternative connection methods if direct connection fails
Tobias Markmann <tfar@soc.pidgin.im>
parents:
diff
changeset
|
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
7768cad83127
* looking for alternative connection methods if direct connection fails
Tobias Markmann <tfar@soc.pidgin.im>
parents:
diff
changeset
|
16 * GNU General Public License for more details. |
7768cad83127
* looking for alternative connection methods if direct connection fails
Tobias Markmann <tfar@soc.pidgin.im>
parents:
diff
changeset
|
17 * |
7768cad83127
* looking for alternative connection methods if direct connection fails
Tobias Markmann <tfar@soc.pidgin.im>
parents:
diff
changeset
|
18 * You should have received a copy of the GNU General Public License |
7768cad83127
* looking for alternative connection methods if direct connection fails
Tobias Markmann <tfar@soc.pidgin.im>
parents:
diff
changeset
|
19 * along with this program; if not, write to the Free Software |
7768cad83127
* looking for alternative connection methods if direct connection fails
Tobias Markmann <tfar@soc.pidgin.im>
parents:
diff
changeset
|
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
7768cad83127
* looking for alternative connection methods if direct connection fails
Tobias Markmann <tfar@soc.pidgin.im>
parents:
diff
changeset
|
21 */ |
7768cad83127
* looking for alternative connection methods if direct connection fails
Tobias Markmann <tfar@soc.pidgin.im>
parents:
diff
changeset
|
22 #ifndef _PURPLE_JABBER_BOSH_H_ |
7768cad83127
* looking for alternative connection methods if direct connection fails
Tobias Markmann <tfar@soc.pidgin.im>
parents:
diff
changeset
|
23 #define _PURPLE_JABBER_BOSH_H_ |
7768cad83127
* looking for alternative connection methods if direct connection fails
Tobias Markmann <tfar@soc.pidgin.im>
parents:
diff
changeset
|
24 |
25598 | 25 #include <glib.h> |
26 | |
27 typedef struct _PurpleHTTPRequest PurpleHTTPRequest; | |
28 typedef struct _PurpleHTTPResponse PurpleHTTPResponse; | |
25600
1cbe5a9f6efb
* adding bosh files to Makefile.am & .mingw
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25598
diff
changeset
|
29 typedef struct _PurpleHTTPConnection PurpleHTTPConnection; |
1cbe5a9f6efb
* adding bosh files to Makefile.am & .mingw
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25598
diff
changeset
|
30 typedef struct _PurpleBOSHConnection PurpleBOSHConnection; |
25598 | 31 |
25600
1cbe5a9f6efb
* adding bosh files to Makefile.am & .mingw
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25598
diff
changeset
|
32 typedef void (*PurpleHTTPConnectionConnectFunction)(PurpleHTTPConnection *conn); |
25610
0a8484372312
* sending empty <body> requests if there are not othere requests to be answered to keep a CM -> client channel open
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25609
diff
changeset
|
33 typedef void (*PurpleHTTPConnectionDisconnectFunction)(PurpleHTTPConnection *conn); |
25598 | 34 typedef void (*PurpleHTTPRequestCallback)(PurpleHTTPRequest *req, PurpleHTTPResponse *res, void *userdata); |
25600
1cbe5a9f6efb
* adding bosh files to Makefile.am & .mingw
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25598
diff
changeset
|
35 typedef void (*PurpleBOSHConnectionConnectFunction)(PurpleBOSHConnection *conn); |
1cbe5a9f6efb
* adding bosh files to Makefile.am & .mingw
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25598
diff
changeset
|
36 typedef void (*PurpleBOSHConnectionReciveFunction)(PurpleBOSHConnection *conn, xmlnode *node); |
25598 | 37 |
25600
1cbe5a9f6efb
* adding bosh files to Makefile.am & .mingw
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25598
diff
changeset
|
38 struct _PurpleBOSHConnection { |
1cbe5a9f6efb
* adding bosh files to Makefile.am & .mingw
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25598
diff
changeset
|
39 /* decoded URL */ |
1cbe5a9f6efb
* adding bosh files to Makefile.am & .mingw
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25598
diff
changeset
|
40 char *host; |
1cbe5a9f6efb
* adding bosh files to Makefile.am & .mingw
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25598
diff
changeset
|
41 int port; |
1cbe5a9f6efb
* adding bosh files to Makefile.am & .mingw
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25598
diff
changeset
|
42 char *path; |
1cbe5a9f6efb
* adding bosh files to Makefile.am & .mingw
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25598
diff
changeset
|
43 char *user; |
1cbe5a9f6efb
* adding bosh files to Makefile.am & .mingw
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25598
diff
changeset
|
44 char *passwd; |
1cbe5a9f6efb
* adding bosh files to Makefile.am & .mingw
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25598
diff
changeset
|
45 |
25602
f9322be084c4
* doing HTTP requests
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25601
diff
changeset
|
46 int rid; |
25607
f775f6021654
* using libpurple's internal SASL mechanisms during BOSH authentication phase
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25604
diff
changeset
|
47 char *sid; |
f775f6021654
* using libpurple's internal SASL mechanisms during BOSH authentication phase
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25604
diff
changeset
|
48 int wait; |
25610
0a8484372312
* sending empty <body> requests if there are not othere requests to be answered to keep a CM -> client channel open
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25609
diff
changeset
|
49 |
25602
f9322be084c4
* doing HTTP requests
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25601
diff
changeset
|
50 JabberStream *js; |
25598 | 51 void *userdata; |
25600
1cbe5a9f6efb
* adding bosh files to Makefile.am & .mingw
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25598
diff
changeset
|
52 PurpleAccount *account; |
25596
7768cad83127
* looking for alternative connection methods if direct connection fails
Tobias Markmann <tfar@soc.pidgin.im>
parents:
diff
changeset
|
53 gboolean pipelining; |
25598 | 54 PurpleHTTPConnection *conn_a; |
55 PurpleHTTPConnection *conn_b; | |
25600
1cbe5a9f6efb
* adding bosh files to Makefile.am & .mingw
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25598
diff
changeset
|
56 |
25601
15d9825a5621
* adding receive callback; preparing receiving and boot code
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25600
diff
changeset
|
57 gboolean ready; |
25600
1cbe5a9f6efb
* adding bosh files to Makefile.am & .mingw
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25598
diff
changeset
|
58 PurpleBOSHConnectionConnectFunction connect_cb; |
1cbe5a9f6efb
* adding bosh files to Makefile.am & .mingw
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25598
diff
changeset
|
59 PurpleBOSHConnectionReciveFunction receive_cb; |
1cbe5a9f6efb
* adding bosh files to Makefile.am & .mingw
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25598
diff
changeset
|
60 }; |
1cbe5a9f6efb
* adding bosh files to Makefile.am & .mingw
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25598
diff
changeset
|
61 |
1cbe5a9f6efb
* adding bosh files to Makefile.am & .mingw
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25598
diff
changeset
|
62 struct _PurpleHTTPConnection { |
1cbe5a9f6efb
* adding bosh files to Makefile.am & .mingw
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25598
diff
changeset
|
63 int fd; |
1cbe5a9f6efb
* adding bosh files to Makefile.am & .mingw
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25598
diff
changeset
|
64 char *host; |
1cbe5a9f6efb
* adding bosh files to Makefile.am & .mingw
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25598
diff
changeset
|
65 int port; |
1cbe5a9f6efb
* adding bosh files to Makefile.am & .mingw
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25598
diff
changeset
|
66 int handle; |
25601
15d9825a5621
* adding receive callback; preparing receiving and boot code
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25600
diff
changeset
|
67 int ie_handle; |
25600
1cbe5a9f6efb
* adding bosh files to Makefile.am & .mingw
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25598
diff
changeset
|
68 PurpleConnection *conn; |
1cbe5a9f6efb
* adding bosh files to Makefile.am & .mingw
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25598
diff
changeset
|
69 PurpleAccount *account; |
1cbe5a9f6efb
* adding bosh files to Makefile.am & .mingw
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25598
diff
changeset
|
70 GQueue *requests; |
25604
e28f1711f402
* parsing HTTP response and emitting HTTP request callback
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25603
diff
changeset
|
71 |
25603
24b97b8359ff
* preparing handling of multiple requests for pipelining support
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25602
diff
changeset
|
72 PurpleHTTPResponse *current_response; |
25604
e28f1711f402
* parsing HTTP response and emitting HTTP request callback
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25603
diff
changeset
|
73 char *current_data; |
25609
5f70e13db5cc
* data buffer for received data. Support for any HTTP resonse size now.
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25607
diff
changeset
|
74 int current_len; |
25604
e28f1711f402
* parsing HTTP response and emitting HTTP request callback
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25603
diff
changeset
|
75 |
25602
f9322be084c4
* doing HTTP requests
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25601
diff
changeset
|
76 int pih; |
25600
1cbe5a9f6efb
* adding bosh files to Makefile.am & .mingw
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25598
diff
changeset
|
77 PurpleHTTPConnectionConnectFunction connect_cb; |
25610
0a8484372312
* sending empty <body> requests if there are not othere requests to be answered to keep a CM -> client channel open
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25609
diff
changeset
|
78 PurpleHTTPConnectionConnectFunction disconnect_cb; |
25600
1cbe5a9f6efb
* adding bosh files to Makefile.am & .mingw
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25598
diff
changeset
|
79 void *userdata; |
1cbe5a9f6efb
* adding bosh files to Makefile.am & .mingw
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25598
diff
changeset
|
80 }; |
25596
7768cad83127
* looking for alternative connection methods if direct connection fails
Tobias Markmann <tfar@soc.pidgin.im>
parents:
diff
changeset
|
81 |
25598 | 82 struct _PurpleHTTPRequest { |
83 PurpleHTTPRequestCallback cb; | |
84 char *method; | |
25602
f9322be084c4
* doing HTTP requests
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25601
diff
changeset
|
85 char *path; |
f9322be084c4
* doing HTTP requests
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25601
diff
changeset
|
86 GHashTable *header; |
25598 | 87 char *data; |
25602
f9322be084c4
* doing HTTP requests
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25601
diff
changeset
|
88 int data_len; |
25598 | 89 void *userdata; |
90 }; | |
91 | |
92 struct _PurpleHTTPResponse { | |
93 int status; | |
25600
1cbe5a9f6efb
* adding bosh files to Makefile.am & .mingw
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25598
diff
changeset
|
94 GHashTable *header; |
25598 | 95 char *data; |
25602
f9322be084c4
* doing HTTP requests
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25601
diff
changeset
|
96 int data_len; |
25598 | 97 }; |
25596
7768cad83127
* looking for alternative connection methods if direct connection fails
Tobias Markmann <tfar@soc.pidgin.im>
parents:
diff
changeset
|
98 |
25602
f9322be084c4
* doing HTTP requests
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25601
diff
changeset
|
99 void jabber_bosh_connection_init(PurpleBOSHConnection *conn, PurpleAccount *account, JabberStream *js, char *url); |
25600
1cbe5a9f6efb
* adding bosh files to Makefile.am & .mingw
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25598
diff
changeset
|
100 void jabber_bosh_connection_connect(PurpleBOSHConnection *conn); |
25607
f775f6021654
* using libpurple's internal SASL mechanisms during BOSH authentication phase
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25604
diff
changeset
|
101 void jabber_bosh_connection_send_native(PurpleBOSHConnection *conn, xmlnode *node); |
25601
15d9825a5621
* adding receive callback; preparing receiving and boot code
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25600
diff
changeset
|
102 void jabber_bosh_connection_send(PurpleBOSHConnection *conn, xmlnode *node); |
25598 | 103 |
25600
1cbe5a9f6efb
* adding bosh files to Makefile.am & .mingw
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25598
diff
changeset
|
104 void jabber_bosh_http_connection_init(PurpleHTTPConnection *conn, PurpleAccount *account, char *host, int port); |
25598 | 105 void jabber_bosh_http_connection_connect(PurpleHTTPConnection *conn); |
25602
f9322be084c4
* doing HTTP requests
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25601
diff
changeset
|
106 void jabber_bosh_http_connection_send_request(PurpleHTTPConnection *conn, PurpleHTTPRequest *req); |
25598 | 107 void jabber_bosh_http_connection_clean(PurpleHTTPConnection *conn); |
108 | |
25600
1cbe5a9f6efb
* adding bosh files to Makefile.am & .mingw
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25598
diff
changeset
|
109 void jabber_bosh_http_request_init(PurpleHTTPRequest *req, const char *method, const char *path, PurpleHTTPRequestCallback cb, void *userdata); |
25602
f9322be084c4
* doing HTTP requests
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25601
diff
changeset
|
110 void jabber_bosh_http_request_add_to_header(PurpleHTTPRequest *req, const char *field, const char *value); |
f9322be084c4
* doing HTTP requests
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25601
diff
changeset
|
111 void jabber_bosh_http_request_set_data(PurpleHTTPRequest *req, char *data, int len); |
25598 | 112 void jabber_bosh_http_request_clean(PurpleHTTPRequest *req); |
25604
e28f1711f402
* parsing HTTP response and emitting HTTP request callback
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25603
diff
changeset
|
113 |
e28f1711f402
* parsing HTTP response and emitting HTTP request callback
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25603
diff
changeset
|
114 void jabber_bosh_http_response_init(PurpleHTTPResponse *res); |
e28f1711f402
* parsing HTTP response and emitting HTTP request callback
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25603
diff
changeset
|
115 void jabber_bosh_http_response_clean(PurpleHTTPResponse *res); |
25596
7768cad83127
* looking for alternative connection methods if direct connection fails
Tobias Markmann <tfar@soc.pidgin.im>
parents:
diff
changeset
|
116 #endif /* _PURPLE_JABBER_BOSH_H_ */ |