Sun, 03 Aug 2008 22:50:13 +0000
* some refactoring
|
23607
bc82598d3798
* looking for alternative connection methods if direct connection fails
Tobias Markmann <tfar@soc.pidgin.im>
parents:
diff
changeset
|
1 | /** |
|
bc82598d3798
* looking for alternative connection methods if direct connection fails
Tobias Markmann <tfar@soc.pidgin.im>
parents:
diff
changeset
|
2 | * @file bosh.h Buddy handlers |
|
bc82598d3798
* looking for alternative connection methods if direct connection fails
Tobias Markmann <tfar@soc.pidgin.im>
parents:
diff
changeset
|
3 | * |
|
bc82598d3798
* looking for alternative connection methods if direct connection fails
Tobias Markmann <tfar@soc.pidgin.im>
parents:
diff
changeset
|
4 | * purple |
|
bc82598d3798
* looking for alternative connection methods if direct connection fails
Tobias Markmann <tfar@soc.pidgin.im>
parents:
diff
changeset
|
5 | * |
|
bc82598d3798
* 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> |
|
bc82598d3798
* looking for alternative connection methods if direct connection fails
Tobias Markmann <tfar@soc.pidgin.im>
parents:
diff
changeset
|
7 | * |
|
bc82598d3798
* 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 |
|
bc82598d3798
* 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 |
|
bc82598d3798
* 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 |
|
bc82598d3798
* 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. |
|
bc82598d3798
* looking for alternative connection methods if direct connection fails
Tobias Markmann <tfar@soc.pidgin.im>
parents:
diff
changeset
|
12 | * |
|
bc82598d3798
* 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, |
|
bc82598d3798
* 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 |
|
bc82598d3798
* 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 |
|
bc82598d3798
* 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. |
|
bc82598d3798
* looking for alternative connection methods if direct connection fails
Tobias Markmann <tfar@soc.pidgin.im>
parents:
diff
changeset
|
17 | * |
|
bc82598d3798
* 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 |
|
bc82598d3798
* 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 |
|
bc82598d3798
* 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 |
|
bc82598d3798
* looking for alternative connection methods if direct connection fails
Tobias Markmann <tfar@soc.pidgin.im>
parents:
diff
changeset
|
21 | */ |
|
bc82598d3798
* looking for alternative connection methods if direct connection fails
Tobias Markmann <tfar@soc.pidgin.im>
parents:
diff
changeset
|
22 | #ifndef _PURPLE_JABBER_BOSH_H_ |
|
bc82598d3798
* looking for alternative connection methods if direct connection fails
Tobias Markmann <tfar@soc.pidgin.im>
parents:
diff
changeset
|
23 | #define _PURPLE_JABBER_BOSH_H_ |
|
bc82598d3798
* looking for alternative connection methods if direct connection fails
Tobias Markmann <tfar@soc.pidgin.im>
parents:
diff
changeset
|
24 | |
| 23609 | 25 | #include <glib.h> |
| 26 | ||
| 27 | typedef struct _PurpleHTTPRequest PurpleHTTPRequest; | |
| 28 | typedef struct _PurpleHTTPResponse PurpleHTTPResponse; | |
| 29 | typedef struct _PurpleHTTPHeaderField PurpleHTTPHeaderField; | |
| 30 | ||
| 31 | typedef void (*PurpleHTTPRequestCallback)(PurpleHTTPRequest *req, PurpleHTTPResponse *res, void *userdata); | |
| 32 | ||
| 33 | typedef struct { | |
| 34 | int fd; | |
| 35 | PurpleConnection *conn; | |
| 36 | GQueue *requests; | |
| 37 | void *userdata; | |
| 38 | } PurpleHTTPConnection; | |
| 39 | ||
|
23607
bc82598d3798
* looking for alternative connection methods if direct connection fails
Tobias Markmann <tfar@soc.pidgin.im>
parents:
diff
changeset
|
40 | typedef struct { |
|
bc82598d3798
* looking for alternative connection methods if direct connection fails
Tobias Markmann <tfar@soc.pidgin.im>
parents:
diff
changeset
|
41 | char *url; |
|
bc82598d3798
* looking for alternative connection methods if direct connection fails
Tobias Markmann <tfar@soc.pidgin.im>
parents:
diff
changeset
|
42 | gboolean pipelining; |
| 23609 | 43 | PurpleHTTPConnection *conn_a; |
| 44 | PurpleHTTPConnection *conn_b; | |
|
23607
bc82598d3798
* looking for alternative connection methods if direct connection fails
Tobias Markmann <tfar@soc.pidgin.im>
parents:
diff
changeset
|
45 | } PurpleBOSHConnection; |
|
bc82598d3798
* looking for alternative connection methods if direct connection fails
Tobias Markmann <tfar@soc.pidgin.im>
parents:
diff
changeset
|
46 | |
| 23609 | 47 | struct _PurpleHTTPRequest { |
| 48 | PurpleHTTPRequestCallback cb; | |
| 49 | char *method; | |
| 50 | char *url; | |
| 51 | GList *header; | |
| 52 | char *data; | |
| 53 | void *userdata; | |
| 54 | }; | |
| 55 | ||
| 56 | struct _PurpleHTTPResponse { | |
| 57 | int status; | |
| 58 | GList *header; | |
| 59 | char *data; | |
| 60 | }; | |
|
23607
bc82598d3798
* looking for alternative connection methods if direct connection fails
Tobias Markmann <tfar@soc.pidgin.im>
parents:
diff
changeset
|
61 | |
| 23609 | 62 | struct _PurpleHTTPHeaderField { |
| 63 | char *name; | |
| 64 | char *value; | |
| 65 | }; | |
| 66 | ||
| 67 | PurpleHTTPHeaderField *jabber_bosh_http_header_field(const char *name, const char *value); | |
| 68 | ||
| 69 | void jabber_bosh_http_connection_connect(PurpleHTTPConnection *conn); | |
| 70 | void jabber_bosh_http_send_request(PurpleHTTPConnection *conn, PurpleHTTPRequest *req); | |
| 71 | void jabber_bosh_http_connection_clean(PurpleHTTPConnection *conn); | |
| 72 | ||
| 73 | void jabber_bosh_http_request_init(PurpleHTTPRequest *req, const char *method, const char *url, PurpleHTTPRequestCallback cb, void *userdata); | |
| 74 | void jabber_bosh_http_request_clean(PurpleHTTPRequest *req); | |
|
23607
bc82598d3798
* looking for alternative connection methods if direct connection fails
Tobias Markmann <tfar@soc.pidgin.im>
parents:
diff
changeset
|
75 | #endif /* _PURPLE_JABBER_BOSH_H_ */ |