Mercurial > pidgin
comparison libgaim/protocols/msn/soap.h @ 20389:e354528c4163
propagate from branch 'im.pidgin.gaim' (head 70ac931e4936c7916eec18a07fe46a0af0fd7403)
to branch 'im.pidgin.rlaager.merging.soc-msnp13-to-svn18164' (head 5b5cde92182d2a922a8e7e6c2308342a5490a8c9)
author | Richard Laager <rlaager@wiktel.com> |
---|---|
date | Sun, 15 Apr 2007 02:10:37 +0000 |
parents | |
children | 40a04930b233 |
comparison
equal
deleted
inserted
replaced
19842:21cb7a79ac7f | 20389:e354528c4163 |
---|---|
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 * | |
110 msn_soap_request_new(const char *host,const char *post_url,const char *soap_action, | |
111 const char *body, | |
112 GaimInputFunction read_cb,GaimInputFunction written_cb); | |
113 void msn_soap_request_free(MsnSoapReq *request); | |
114 void msn_soap_post_request(MsnSoapConn *soapconn,MsnSoapReq *request); | |
115 void msn_soap_post_head_request(MsnSoapConn *soapconn); | |
116 | |
117 /*new a soap conneciton */ | |
118 MsnSoapConn *msn_soap_new(MsnSession *session,gpointer data,int sslconn); | |
119 | |
120 /*destroy */ | |
121 void msn_soap_destroy(MsnSoapConn *soapconn); | |
122 | |
123 /*init a soap conneciton */ | |
124 void msn_soap_init(MsnSoapConn *soapconn,char * host,int ssl,GaimSslInputFunction connect_cb,GaimSslErrorFunction error_cb); | |
125 void msn_soap_connect(MsnSoapConn *soapconn); | |
126 void msn_soap_close(MsnSoapConn *soapconn); | |
127 | |
128 /*write to soap*/ | |
129 void msn_soap_write(MsnSoapConn * soapconn, char *write_buf, GaimInputFunction written_cb); | |
130 void msn_soap_post(MsnSoapConn *soapconn,MsnSoapReq *request,MsnSoapConnectInitFunction msn_soap_init_func); | |
131 | |
132 void msn_soap_free_read_buf(MsnSoapConn *soapconn); | |
133 void msn_soap_free_write_buf(MsnSoapConn *soapconn); | |
134 void msn_soap_connect_cb(gpointer data, GaimSslConnection *gsc, GaimInputCondition cond); | |
135 void msn_soap_read_cb(gpointer data, gint source, GaimInputCondition cond); | |
136 | |
137 /*clean the unhandled request*/ | |
138 void msn_soap_clean_unhandled_request(MsnSoapConn *soapconn); | |
139 | |
140 /*check if the soap connection is connected*/ | |
141 int msn_soap_connected(MsnSoapConn *soapconn); | |
142 | |
143 #endif/*_MSN_SOAP_H_*/ | |
144 |