Mercurial > pidgin
comparison libpurple/protocols/jabber/bosh.h @ 25181:7de1f124f95a
Jabber BOSH: Many fixes
* Move most of the function and structure definitions into bosh.c
* Made js->bosh a pointer, the init function allocates and returns
the pointer, etc.
* Drop the account member of PurpleHTTPConnection
* Fix many, many warnings, including a few bug-related things
author | Paul Aurich <paul@darkrain42.org> |
---|---|
date | Mon, 01 Dec 2008 05:47:04 +0000 |
parents | 0a8484372312 |
children | 17b60b844803 |
comparison
equal
deleted
inserted
replaced
25180:1516525c86fa | 25181:7de1f124f95a |
---|---|
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA | 20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
21 */ | 21 */ |
22 #ifndef _PURPLE_JABBER_BOSH_H_ | 22 #ifndef _PURPLE_JABBER_BOSH_H_ |
23 #define _PURPLE_JABBER_BOSH_H_ | 23 #define _PURPLE_JABBER_BOSH_H_ |
24 | 24 |
25 #include <glib.h> | |
26 | |
27 typedef struct _PurpleHTTPRequest PurpleHTTPRequest; | |
28 typedef struct _PurpleHTTPResponse PurpleHTTPResponse; | |
29 typedef struct _PurpleHTTPConnection PurpleHTTPConnection; | |
30 typedef struct _PurpleBOSHConnection PurpleBOSHConnection; | 25 typedef struct _PurpleBOSHConnection PurpleBOSHConnection; |
31 | 26 |
32 typedef void (*PurpleHTTPConnectionConnectFunction)(PurpleHTTPConnection *conn); | 27 #include "jabber.h" |
33 typedef void (*PurpleHTTPConnectionDisconnectFunction)(PurpleHTTPConnection *conn); | |
34 typedef void (*PurpleHTTPRequestCallback)(PurpleHTTPRequest *req, PurpleHTTPResponse *res, void *userdata); | |
35 typedef void (*PurpleBOSHConnectionConnectFunction)(PurpleBOSHConnection *conn); | |
36 typedef void (*PurpleBOSHConnectionReciveFunction)(PurpleBOSHConnection *conn, xmlnode *node); | |
37 | 28 |
38 struct _PurpleBOSHConnection { | 29 PurpleBOSHConnection* jabber_bosh_connection_init(JabberStream *js, const char *url); |
39 /* decoded URL */ | |
40 char *host; | |
41 int port; | |
42 char *path; | |
43 char *user; | |
44 char *passwd; | |
45 | |
46 int rid; | |
47 char *sid; | |
48 int wait; | |
49 | |
50 JabberStream *js; | |
51 void *userdata; | |
52 PurpleAccount *account; | |
53 gboolean pipelining; | |
54 PurpleHTTPConnection *conn_a; | |
55 PurpleHTTPConnection *conn_b; | |
56 | |
57 gboolean ready; | |
58 PurpleBOSHConnectionConnectFunction connect_cb; | |
59 PurpleBOSHConnectionReciveFunction receive_cb; | |
60 }; | |
61 | |
62 struct _PurpleHTTPConnection { | |
63 int fd; | |
64 char *host; | |
65 int port; | |
66 int handle; | |
67 int ie_handle; | |
68 PurpleConnection *conn; | |
69 PurpleAccount *account; | |
70 GQueue *requests; | |
71 | |
72 PurpleHTTPResponse *current_response; | |
73 char *current_data; | |
74 int current_len; | |
75 | |
76 int pih; | |
77 PurpleHTTPConnectionConnectFunction connect_cb; | |
78 PurpleHTTPConnectionConnectFunction disconnect_cb; | |
79 void *userdata; | |
80 }; | |
81 | |
82 struct _PurpleHTTPRequest { | |
83 PurpleHTTPRequestCallback cb; | |
84 char *method; | |
85 char *path; | |
86 GHashTable *header; | |
87 char *data; | |
88 int data_len; | |
89 void *userdata; | |
90 }; | |
91 | |
92 struct _PurpleHTTPResponse { | |
93 int status; | |
94 GHashTable *header; | |
95 char *data; | |
96 int data_len; | |
97 }; | |
98 | |
99 void jabber_bosh_connection_init(PurpleBOSHConnection *conn, PurpleAccount *account, JabberStream *js, char *url); | |
100 void jabber_bosh_connection_connect(PurpleBOSHConnection *conn); | 30 void jabber_bosh_connection_connect(PurpleBOSHConnection *conn); |
101 void jabber_bosh_connection_send_native(PurpleBOSHConnection *conn, xmlnode *node); | |
102 void jabber_bosh_connection_send(PurpleBOSHConnection *conn, xmlnode *node); | 31 void jabber_bosh_connection_send(PurpleBOSHConnection *conn, xmlnode *node); |
103 | |
104 void jabber_bosh_http_connection_init(PurpleHTTPConnection *conn, PurpleAccount *account, char *host, int port); | |
105 void jabber_bosh_http_connection_connect(PurpleHTTPConnection *conn); | |
106 void jabber_bosh_http_connection_send_request(PurpleHTTPConnection *conn, PurpleHTTPRequest *req); | |
107 void jabber_bosh_http_connection_clean(PurpleHTTPConnection *conn); | |
108 | |
109 void jabber_bosh_http_request_init(PurpleHTTPRequest *req, const char *method, const char *path, PurpleHTTPRequestCallback cb, void *userdata); | |
110 void jabber_bosh_http_request_add_to_header(PurpleHTTPRequest *req, const char *field, const char *value); | |
111 void jabber_bosh_http_request_set_data(PurpleHTTPRequest *req, char *data, int len); | |
112 void jabber_bosh_http_request_clean(PurpleHTTPRequest *req); | |
113 | |
114 void jabber_bosh_http_response_init(PurpleHTTPResponse *res); | |
115 void jabber_bosh_http_response_clean(PurpleHTTPResponse *res); | |
116 #endif /* _PURPLE_JABBER_BOSH_H_ */ | 32 #endif /* _PURPLE_JABBER_BOSH_H_ */ |