Mercurial > pidgin
comparison libpurple/protocols/msn/soap.h @ 20394:4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
to branch 'im.pidgin.rlaager.merging.msnp13-and-pidgin' (head 4d82c29e56bd33cd6f94302e343dfeb5d68ab3eb)
author | Richard Laager <rlaager@wiktel.com> |
---|---|
date | Sun, 15 Apr 2007 03:43:17 +0000 |
parents | |
children | 4ddc27c18781 |
comparison
equal
deleted
inserted
replaced
20393:40a04930b233 | 20394:4a099e4d0d09 |
---|---|
1 /** | |
2 * @file soap.h | |
3 * header file for SOAP connection related process | |
4 * Author | |
5 * MaYuan<mayuan2006@gmail.com> | |
6 * gaim | |
7 * | |
8 * Gaim is the legal property of its developers, whose names are too numerous | |
9 * to list here. Please refer to the COPYRIGHT file distributed with this | |
10 * source distribution. | |
11 * | |
12 * This program is free software; you can redistribute it and/or modify | |
13 * it under the terms of the GNU General Public License as published by | |
14 * the Free Software Foundation; either version 2 of the License, or | |
15 * (at your option) any later version. | |
16 * | |
17 * This program is distributed in the hope that it will be useful, | |
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
20 * GNU General Public License for more details. | |
21 * | |
22 * You should have received a copy of the GNU General Public License | |
23 * along with this program; if not, write to the Free Software | |
24 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
25 */ | |
26 #ifndef _MSN_SOAP_H_ | |
27 #define _MSN_SOAP_H_ | |
28 | |
29 #define MSN_SOAP_READ_BUFF_SIZE 8192 | |
30 | |
31 typedef enum | |
32 { | |
33 MSN_SOAP_UNCONNECTED, | |
34 MSN_SOAP_CONNECTING, | |
35 MSN_SOAP_CONNECTED, | |
36 MSN_SOAP_PROCESSING, | |
37 MSN_SOAP_CONNECTED_IDLE | |
38 }MsnSoapStep; | |
39 | |
40 /*MSN SoapRequest structure*/ | |
41 typedef struct _MsnSoapReq MsnSoapReq; | |
42 | |
43 /*MSN Https connection structure*/ | |
44 typedef struct _MsnSoapConn MsnSoapConn; | |
45 | |
46 typedef void (*MsnSoapConnectInitFunction)(MsnSoapConn *); | |
47 | |
48 struct _MsnSoapReq{ | |
49 /*request sequence*/ | |
50 int id; | |
51 | |
52 char *login_host; | |
53 char *login_path; | |
54 char *soap_action; | |
55 | |
56 char *body; | |
57 | |
58 GaimInputFunction read_cb; | |
59 GaimInputFunction written_cb; | |
60 }; | |
61 | |
62 struct _MsnSoapConn{ | |
63 MsnSession *session; | |
64 gpointer parent; | |
65 | |
66 char *login_host; | |
67 char *login_path; | |
68 char *soap_action; | |
69 | |
70 MsnSoapStep step; | |
71 /*ssl connection?*/ | |
72 guint ssl_conn; | |
73 /*normal connection*/ | |
74 guint fd; | |
75 /*SSL connection*/ | |
76 GaimSslConnection *gsc; | |
77 /*ssl connection callback*/ | |
78 GaimSslInputFunction connect_cb; | |
79 /*ssl error callback*/ | |
80 GaimSslErrorFunction error_cb; | |
81 | |
82 /*read handler*/ | |
83 guint input_handler; | |
84 /*write handler*/ | |
85 guint output_handler; | |
86 | |
87 /*Queue of SOAP request to send*/ | |
88 int soap_id; | |
89 GQueue *soap_queue; | |
90 | |
91 /*write buffer*/ | |
92 char *write_buf; | |
93 gsize written_len; | |
94 GaimInputFunction written_cb; | |
95 | |
96 /*read buffer*/ | |
97 char *read_buf; | |
98 gsize read_len; | |
99 gsize need_to_read; | |
100 GaimInputFunction read_cb; | |
101 | |
102 /*HTTP reply body part*/ | |
103 char *body; | |
104 int body_len; | |
105 }; | |
106 | |
107 /*Function Prototype*/ | |
108 /*Soap Request Function */ | |
109 MsnSoapReq *msn_soap_request_new(const char *host, const char *post_url, | |
110 const char *soap_action, const char *body, | |
111 GaimInputFunction read_cb, | |
112 GaimInputFunction written_cb); | |
113 | |
114 void msn_soap_request_free(MsnSoapReq *request); | |
115 void msn_soap_post_request(MsnSoapConn *soapconn,MsnSoapReq *request); | |
116 void msn_soap_post_head_request(MsnSoapConn *soapconn); | |
117 | |
118 /*new a soap conneciton */ | |
119 MsnSoapConn *msn_soap_new(MsnSession *session,gpointer data,int sslconn); | |
120 | |
121 /*destroy */ | |
122 void msn_soap_destroy(MsnSoapConn *soapconn); | |
123 | |
124 /*init a soap conneciton */ | |
125 void msn_soap_init(MsnSoapConn *soapconn,char * host,int ssl,GaimSslInputFunction connect_cb,GaimSslErrorFunction error_cb); | |
126 void msn_soap_connect(MsnSoapConn *soapconn); | |
127 void msn_soap_close(MsnSoapConn *soapconn); | |
128 | |
129 /*write to soap*/ | |
130 void msn_soap_write(MsnSoapConn * soapconn, char *write_buf, GaimInputFunction written_cb); | |
131 void msn_soap_post(MsnSoapConn *soapconn,MsnSoapReq *request,MsnSoapConnectInitFunction msn_soap_init_func); | |
132 | |
133 void msn_soap_free_read_buf(MsnSoapConn *soapconn); | |
134 void msn_soap_free_write_buf(MsnSoapConn *soapconn); | |
135 void msn_soap_connect_cb(gpointer data, GaimSslConnection *gsc, GaimInputCondition cond); | |
136 void msn_soap_read_cb(gpointer data, gint source, GaimInputCondition cond); | |
137 | |
138 /*clean the unhandled request*/ | |
139 void msn_soap_clean_unhandled_request(MsnSoapConn *soapconn); | |
140 | |
141 /*check if the soap connection is connected*/ | |
142 int msn_soap_connected(MsnSoapConn *soapconn); | |
143 | |
144 #endif/*_MSN_SOAP_H_*/ | |
145 |