Mercurial > pidgin
annotate src/protocols/msn/servconn.h @ 8723:07f670358f6e
[gaim-migrate @ 9478]
update
committer: Tailor Script <tailor@pidgin.im>
author | Luke Schierer <lschiere@pidgin.im> |
---|---|
date | Tue, 20 Apr 2004 05:34:41 +0000 |
parents | 1e211dde3cae |
children | bbd8cdaf0ad5 |
rev | line source |
---|---|
5309 | 1 /** |
2 * @file servconn.h Server connection functions | |
3 * | |
4 * gaim | |
5 * | |
8475
06f57183e29f
[gaim-migrate @ 9208]
Christian Hammond <chipx86@chipx86.com>
parents:
7288
diff
changeset
|
6 * Copyright (C) 2003-2004 Christian Hammond <chipx86@gnupdate.org> |
6701
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
5962
diff
changeset
|
7 * |
5309 | 8 * This program is free software; you can redistribute it and/or modify |
9 * it under the terms of the GNU General Public License as published by | |
10 * the Free Software Foundation; either version 2 of the License, or | |
11 * (at your option) any later version. | |
12 * | |
13 * This program is distributed in the hope that it will be useful, | |
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
16 * GNU General Public License for more details. | |
17 * | |
18 * You should have received a copy of the GNU General Public License | |
19 * along with this program; if not, write to the Free Software | |
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
21 */ | |
22 #ifndef _MSN_SERVCONN_H_ | |
23 #define _MSN_SERVCONN_H_ | |
24 | |
6701
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
5962
diff
changeset
|
25 #include "proxy.h" |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
5962
diff
changeset
|
26 |
5309 | 27 typedef struct _MsnServConn MsnServConn; |
28 | |
29 #include "msg.h" | |
7288
ff9127038a5a
[gaim-migrate @ 7869]
Christian Hammond <chipx86@chipx86.com>
parents:
6701
diff
changeset
|
30 #include "httpmethod.h" |
5309 | 31 |
32 typedef gboolean (*MsnServConnCommandCb)(MsnServConn *servconn, | |
33 const char *cmd, const char **params, | |
34 size_t param_count); | |
35 | |
5506
4f72b611f0ee
[gaim-migrate @ 5905]
Christian Hammond <chipx86@chipx86.com>
parents:
5309
diff
changeset
|
36 typedef gboolean (*MsnServConnMsgCb)(MsnServConn *servconn, MsnMessage *msg); |
5309 | 37 |
8646
1e211dde3cae
[gaim-migrate @ 9398]
Christian Hammond <chipx86@chipx86.com>
parents:
8583
diff
changeset
|
38 typedef void (*MsnPayloadCb)(MsnServConn *servconn, char *payload, |
1e211dde3cae
[gaim-migrate @ 9398]
Christian Hammond <chipx86@chipx86.com>
parents:
8583
diff
changeset
|
39 size_t len); |
5309 | 40 |
8646
1e211dde3cae
[gaim-migrate @ 9398]
Christian Hammond <chipx86@chipx86.com>
parents:
8583
diff
changeset
|
41 #include "session.h" |
5962
115769a4c6fc
[gaim-migrate @ 6409]
Christian Hammond <chipx86@chipx86.com>
parents:
5506
diff
changeset
|
42 |
5309 | 43 struct _MsnServConn |
44 { | |
45 MsnSession *session; | |
46 | |
47 gboolean connected; | |
8646
1e211dde3cae
[gaim-migrate @ 9398]
Christian Hammond <chipx86@chipx86.com>
parents:
8583
diff
changeset
|
48 gboolean wasted; |
5309 | 49 |
7288
ff9127038a5a
[gaim-migrate @ 7869]
Christian Hammond <chipx86@chipx86.com>
parents:
6701
diff
changeset
|
50 MsnHttpMethodData *http_data; |
ff9127038a5a
[gaim-migrate @ 7869]
Christian Hammond <chipx86@chipx86.com>
parents:
6701
diff
changeset
|
51 |
8583
fc27237783ee
[gaim-migrate @ 9333]
Christian Hammond <chipx86@chipx86.com>
parents:
8475
diff
changeset
|
52 #if 0 |
fc27237783ee
[gaim-migrate @ 9333]
Christian Hammond <chipx86@chipx86.com>
parents:
8475
diff
changeset
|
53 /* shx: not used */ |
fc27237783ee
[gaim-migrate @ 9333]
Christian Hammond <chipx86@chipx86.com>
parents:
8475
diff
changeset
|
54 char *host; |
5309 | 55 int port; |
8583
fc27237783ee
[gaim-migrate @ 9333]
Christian Hammond <chipx86@chipx86.com>
parents:
8475
diff
changeset
|
56 #endif |
5309 | 57 |
58 int fd; | |
59 int inpa; | |
60 | |
8646
1e211dde3cae
[gaim-migrate @ 9398]
Christian Hammond <chipx86@chipx86.com>
parents:
8583
diff
changeset
|
61 char *rx_buf; |
1e211dde3cae
[gaim-migrate @ 9398]
Christian Hammond <chipx86@chipx86.com>
parents:
8583
diff
changeset
|
62 int rx_len; |
1e211dde3cae
[gaim-migrate @ 9398]
Christian Hammond <chipx86@chipx86.com>
parents:
8583
diff
changeset
|
63 |
1e211dde3cae
[gaim-migrate @ 9398]
Christian Hammond <chipx86@chipx86.com>
parents:
8583
diff
changeset
|
64 MsnPayloadCb payload_cb; |
1e211dde3cae
[gaim-migrate @ 9398]
Christian Hammond <chipx86@chipx86.com>
parents:
8583
diff
changeset
|
65 int payload_len; |
5309 | 66 |
5506
4f72b611f0ee
[gaim-migrate @ 5905]
Christian Hammond <chipx86@chipx86.com>
parents:
5309
diff
changeset
|
67 GSList *msg_queue; |
4f72b611f0ee
[gaim-migrate @ 5905]
Christian Hammond <chipx86@chipx86.com>
parents:
5309
diff
changeset
|
68 |
5309 | 69 GSList *txqueue; |
70 | |
71 char *msg_passport; | |
72 | |
73 GHashTable *commands; | |
74 GHashTable *msg_types; | |
75 | |
8583
fc27237783ee
[gaim-migrate @ 9333]
Christian Hammond <chipx86@chipx86.com>
parents:
8475
diff
changeset
|
76 gboolean (*connect_cb)(MsnServConn *servconn); |
fc27237783ee
[gaim-migrate @ 9333]
Christian Hammond <chipx86@chipx86.com>
parents:
8475
diff
changeset
|
77 void (*disconnect_cb)(MsnServConn *servconn); |
5309 | 78 |
79 void *data; | |
80 }; | |
81 | |
82 MsnServConn *msn_servconn_new(MsnSession *session); | |
83 | |
84 void msn_servconn_destroy(MsnServConn *servconn); | |
85 | |
8583
fc27237783ee
[gaim-migrate @ 9333]
Christian Hammond <chipx86@chipx86.com>
parents:
8475
diff
changeset
|
86 gboolean msn_servconn_connect(MsnServConn *servconn, const char *host, |
fc27237783ee
[gaim-migrate @ 9333]
Christian Hammond <chipx86@chipx86.com>
parents:
8475
diff
changeset
|
87 int port); |
5309 | 88 void msn_servconn_disconnect(MsnServConn *servconn); |
89 | |
8583
fc27237783ee
[gaim-migrate @ 9333]
Christian Hammond <chipx86@chipx86.com>
parents:
8475
diff
changeset
|
90 #if 0 |
fc27237783ee
[gaim-migrate @ 9333]
Christian Hammond <chipx86@chipx86.com>
parents:
8475
diff
changeset
|
91 /* shx: not used */ |
5309 | 92 void msn_servconn_set_server(MsnServConn *servconn, const char *server, |
93 int port); | |
94 | |
95 const char *msn_servconn_get_server(const MsnServConn *servconn); | |
96 int msn_servconn_get_port(const MsnServConn *servconn); | |
8583
fc27237783ee
[gaim-migrate @ 9333]
Christian Hammond <chipx86@chipx86.com>
parents:
8475
diff
changeset
|
97 #endif |
5309 | 98 |
99 void msn_servconn_set_connect_cb(MsnServConn *servconn, | |
8583
fc27237783ee
[gaim-migrate @ 9333]
Christian Hammond <chipx86@chipx86.com>
parents:
8475
diff
changeset
|
100 gboolean (*connect_cb)(MsnServConn *servconn)); |
5309 | 101 |
8583
fc27237783ee
[gaim-migrate @ 9333]
Christian Hammond <chipx86@chipx86.com>
parents:
8475
diff
changeset
|
102 void msn_servconn_set_disconnect_cb(MsnServConn *servconn, |
fc27237783ee
[gaim-migrate @ 9333]
Christian Hammond <chipx86@chipx86.com>
parents:
8475
diff
changeset
|
103 void (*disconnect_cb)(MsnServConn *servconn)); |
5309 | 104 |
105 size_t msn_servconn_write(MsnServConn *servconn, const char *buf, | |
106 size_t size); | |
107 | |
108 gboolean msn_servconn_send_command(MsnServConn *servconn, const char *command, | |
109 const char *params); | |
110 | |
5506
4f72b611f0ee
[gaim-migrate @ 5905]
Christian Hammond <chipx86@chipx86.com>
parents:
5309
diff
changeset
|
111 void msn_servconn_queue_message(MsnServConn *servconn, const char *command, |
4f72b611f0ee
[gaim-migrate @ 5905]
Christian Hammond <chipx86@chipx86.com>
parents:
5309
diff
changeset
|
112 MsnMessage *msg); |
4f72b611f0ee
[gaim-migrate @ 5905]
Christian Hammond <chipx86@chipx86.com>
parents:
5309
diff
changeset
|
113 |
4f72b611f0ee
[gaim-migrate @ 5905]
Christian Hammond <chipx86@chipx86.com>
parents:
5309
diff
changeset
|
114 void msn_servconn_unqueue_message(MsnServConn *servconn, MsnMessage *msg); |
4f72b611f0ee
[gaim-migrate @ 5905]
Christian Hammond <chipx86@chipx86.com>
parents:
5309
diff
changeset
|
115 |
5309 | 116 void msn_servconn_register_command(MsnServConn *servconn, |
117 const char *command, | |
118 MsnServConnCommandCb cb); | |
119 | |
120 void msn_servconn_register_msg_type(MsnServConn *servconn, | |
121 const char *content_type, | |
122 MsnServConnMsgCb cb); | |
123 | |
8646
1e211dde3cae
[gaim-migrate @ 9398]
Christian Hammond <chipx86@chipx86.com>
parents:
8583
diff
changeset
|
124 gboolean msn_servconn_process_message(MsnServConn *servconn, |
1e211dde3cae
[gaim-migrate @ 9398]
Christian Hammond <chipx86@chipx86.com>
parents:
8583
diff
changeset
|
125 MsnMessage *msg); |
5309 | 126 |
127 #endif /* _MSN_SERVCONN_H_ */ |