Mercurial > pidgin.yaz
annotate src/protocols/msn/servconn.h @ 10463:9bed28273ec7
[gaim-migrate @ 11737]
Felipe Contreras fixed the MSN HTTP Method. Yay! Thanks Felipe.
committer: Tailor Script <tailor@pidgin.im>
author | Stu Tomlinson <stu@nosnilmot.com> |
---|---|
date | Fri, 31 Dec 2004 16:34:22 +0000 |
parents | ecf3ce2e2ab1 |
children | bcfea6c3d5c9 |
rev | line source |
---|---|
5309 | 1 /** |
2 * @file servconn.h Server connection functions | |
3 * | |
4 * gaim | |
5 * | |
9198
ab6636c5a136
[gaim-migrate @ 9993]
Christian Hammond <chipx86@chipx86.com>
parents:
9193
diff
changeset
|
6 * Gaim is the legal property of its developers, whose names are too numerous |
ab6636c5a136
[gaim-migrate @ 9993]
Christian Hammond <chipx86@chipx86.com>
parents:
9193
diff
changeset
|
7 * to list here. Please refer to the COPYRIGHT file distributed with this |
ab6636c5a136
[gaim-migrate @ 9993]
Christian Hammond <chipx86@chipx86.com>
parents:
9193
diff
changeset
|
8 * source distribution. |
6701
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
5962
diff
changeset
|
9 * |
5309 | 10 * This program is free software; you can redistribute it and/or modify |
11 * it under the terms of the GNU General Public License as published by | |
12 * the Free Software Foundation; either version 2 of the License, or | |
13 * (at your option) any later version. | |
14 * | |
15 * This program is distributed in the hope that it will be useful, | |
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
18 * GNU General Public License for more details. | |
19 * | |
20 * You should have received a copy of the GNU General Public License | |
21 * along with this program; if not, write to the Free Software | |
22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
23 */ | |
24 #ifndef _MSN_SERVCONN_H_ | |
25 #define _MSN_SERVCONN_H_ | |
26 | |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8646
diff
changeset
|
27 typedef struct _MsnServConn MsnServConn; |
6701
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
5962
diff
changeset
|
28 |
9193
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
29 #include "session.h" |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8646
diff
changeset
|
30 #include "cmdproc.h" |
9193
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
31 |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8646
diff
changeset
|
32 #include "proxy.h" |
10463 | 33 #include "httpconn.h" |
5309 | 34 |
9193
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
35 /* |
10463 | 36 * Connection types |
37 */ | |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8646
diff
changeset
|
38 typedef enum |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8646
diff
changeset
|
39 { |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8646
diff
changeset
|
40 MSN_SERVER_NS, |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8646
diff
changeset
|
41 MSN_SERVER_SB, |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8646
diff
changeset
|
42 MSN_SERVER_NX, |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8646
diff
changeset
|
43 MSN_SERVER_DC, |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8646
diff
changeset
|
44 MSN_SERVER_HT |
5309 | 45 |
9158
c30d81b4dd22
[gaim-migrate @ 9942]
Christian Hammond <chipx86@chipx86.com>
parents:
8808
diff
changeset
|
46 } MsnServConnType; |
5962
115769a4c6fc
[gaim-migrate @ 6409]
Christian Hammond <chipx86@chipx86.com>
parents:
5506
diff
changeset
|
47 |
10463 | 48 /* |
49 * A Connection | |
50 */ | |
5309 | 51 struct _MsnServConn |
52 { | |
10463 | 53 MsnServConnType type; /**< The type of this connection. */ |
54 MsnSession *session; /**< The MSN session of this connection. */ | |
55 MsnCmdProc *cmdproc; /**< The command processor of this connection. */ | |
5309 | 56 |
10463 | 57 gboolean connected; /**< A flag that states if it's connected. */ |
58 gboolean processing; /**< A flag that states if something is working | |
59 with this connection. */ | |
60 gboolean wasted; /**< A flag that states if it should be destroyed. */ | |
61 gboolean destroying; /**< A flag that states if the connection is on | |
62 the process of being destroyed. */ | |
5309 | 63 |
10463 | 64 char *host; /**< The host this connection is connected or should be |
65 connected to. */ | |
66 int num; /**< A number id of this connection. */ | |
7288
ff9127038a5a
[gaim-migrate @ 7869]
Christian Hammond <chipx86@chipx86.com>
parents:
6701
diff
changeset
|
67 |
10463 | 68 MsnHttpConn *httpconn; /**< The HTTP connection this connection should use. */ |
5309 | 69 |
10463 | 70 int fd; /**< The connection's file descriptor. */ |
71 int inpa; /**< The connection's input handler. */ | |
72 | |
73 char *rx_buf; /**< The receive buffer. */ | |
74 int rx_len; /**< The receive buffer lenght. */ | |
8646
1e211dde3cae
[gaim-migrate @ 9398]
Christian Hammond <chipx86@chipx86.com>
parents:
8583
diff
changeset
|
75 |
10463 | 76 size_t payload_len; /**< The length of the payload. |
77 It's only set when we've received a command that | |
78 has a payload. */ | |
5309 | 79 |
10463 | 80 void (*connect_cb)(MsnServConn *); /**< The callback to call when connecting. */ |
81 void (*disconnect_cb)(MsnServConn *); /**< The callback to call when disconnecting. */ | |
82 void (*destroy_cb)(MsnServConn *); /**< The callback to call when destroying. */ | |
5309 | 83 }; |
84 | |
10463 | 85 /** |
86 * Creates a new connection object. | |
87 * | |
88 * @param session The session. | |
89 * @param type The type of the connection. | |
90 */ | |
9158
c30d81b4dd22
[gaim-migrate @ 9942]
Christian Hammond <chipx86@chipx86.com>
parents:
8808
diff
changeset
|
91 MsnServConn *msn_servconn_new(MsnSession *session, MsnServConnType type); |
10463 | 92 |
93 /** | |
94 * Destroys a connection object. | |
95 * | |
96 * @param servconn The connection. | |
97 */ | |
5309 | 98 void msn_servconn_destroy(MsnServConn *servconn); |
99 | |
10463 | 100 /** |
101 * Connects to a host. | |
102 * | |
103 * @param servconn The connection. | |
104 * @param host The host. | |
105 * @param port The port. | |
106 */ | |
9193
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
107 gboolean msn_servconn_connect(MsnServConn *servconn, const char *host, int port); |
10463 | 108 |
109 /** | |
110 * Disconnects. | |
111 * | |
112 * @param servconn The connection. | |
113 */ | |
5309 | 114 void msn_servconn_disconnect(MsnServConn *servconn); |
115 | |
10463 | 116 /** |
117 * Sets the connect callback. | |
118 * | |
119 * @param servconn The servconn. | |
120 * @param connect_cb The connect callback. | |
121 */ | |
5309 | 122 void msn_servconn_set_connect_cb(MsnServConn *servconn, |
9193
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
123 void (*connect_cb)(MsnServConn *)); |
10463 | 124 /** |
125 * Sets the disconnect callback. | |
126 * | |
127 * @param servconn The servconn. | |
128 * @param disconnect_cb The disconnect callback. | |
129 */ | |
8583
fc27237783ee
[gaim-migrate @ 9333]
Christian Hammond <chipx86@chipx86.com>
parents:
8475
diff
changeset
|
130 void msn_servconn_set_disconnect_cb(MsnServConn *servconn, |
9193
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
131 void (*disconnect_cb)(MsnServConn *)); |
10463 | 132 /** |
133 * Sets the destroy callback. | |
134 * | |
135 * @param servconn The servconn that's being destroyed. | |
136 * @param destroy_cb The destroy callback. | |
137 */ | |
138 void msn_servconn_set_destroy_cb(MsnServConn *servconn, | |
139 void (*destroy_cb)(MsnServConn *)); | |
140 | |
141 /** | |
142 * Writes a chunck of data to the servconn. | |
143 * | |
144 * @param servconn The servconn. | |
145 * @param buf The data to write. | |
146 * @param size The size of the data. | |
147 */ | |
148 size_t msn_servconn_write(MsnServConn *servconn, const char *buf, | |
149 size_t size); | |
5309 | 150 |
151 #endif /* _MSN_SERVCONN_H_ */ |