10463
|
1 /**
|
|
2 * @file httpconn.h HTTP connection
|
|
3 *
|
|
4 * gaim
|
|
5 *
|
|
6 * Gaim is the legal property of its developers, whose names are too numerous
|
|
7 * to list here. Please refer to the COPYRIGHT file distributed with this
|
|
8 * source distribution.
|
|
9 *
|
|
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_HTTPCONN_H_
|
|
25 #define _MSN_HTTPCONN_H_
|
|
26
|
|
27 typedef struct _MsnHttpConn MsnHttpConn;
|
|
28
|
|
29 #include "servconn.h"
|
|
30
|
10481
|
31 /**
|
|
32 * An HTTP Connection.
|
|
33 */
|
10463
|
34 struct _MsnHttpConn
|
|
35 {
|
10481
|
36 MsnSession *session; /**< The MSN Session. */
|
|
37 MsnServConn *servconn; /**< The connection object. */
|
10463
|
38
|
10481
|
39 char *full_session_id; /**< The full session id. */
|
|
40 char *session_id; /**< The trimmed session id. */
|
10463
|
41
|
10481
|
42 int timer; /**< The timer for polling. */
|
10463
|
43
|
10481
|
44 gboolean waiting_response; /**< The flag that states if we are waiting
|
|
45 a response from the server. */
|
|
46 gboolean dirty; /**< The flag that states if we should poll. */
|
|
47 gboolean connected; /**< The flag that states if the connection is on. */
|
|
48 gboolean virgin; /**< The flag that states if this connection
|
|
49 should specify the host (not gateway) to
|
|
50 connect to. */
|
10463
|
51
|
10481
|
52 char *host; /**< The HTTP gateway host. */
|
|
53 GList *queue; /**< The queue of data chunks to write. */
|
10463
|
54
|
10481
|
55 int fd; /**< The connection's file descriptor. */
|
|
56 int inpa; /**< The connection's input handler. */
|
10463
|
57
|
10481
|
58 char *rx_buf; /**< The receive buffer. */
|
|
59 int rx_len; /**< The receive buffer lenght. */
|
10463
|
60 };
|
|
61
|
10481
|
62 /**
|
|
63 * Creates a new HTTP connection object.
|
|
64 *
|
|
65 * @param servconn The connection object.
|
|
66 *
|
|
67 * @return The new object.
|
|
68 */
|
10463
|
69 MsnHttpConn *msn_httpconn_new(MsnServConn *servconn);
|
|
70
|
|
71 /**
|
10481
|
72 * Destroys an HTTP connection object.
|
10463
|
73 *
|
10481
|
74 * @param httpconn The HTTP connection object.
|
10463
|
75 */
|
10481
|
76 void msn_httpconn_destroy(MsnHttpConn *httpconn);
|
10463
|
77
|
|
78 /**
|
10481
|
79 * Writes a chunk of data to the HTTP connection.
|
10463
|
80 *
|
|
81 * @param servconn The server connection.
|
10481
|
82 * @param data The data to write.
|
10463
|
83 * @param size The size of the data to write.
|
|
84 *
|
|
85 * @return The number of bytes written.
|
|
86 */
|
10481
|
87 size_t msn_httpconn_write(MsnHttpConn *httpconn, const char *data, size_t size);
|
10463
|
88
|
|
89 /**
|
10481
|
90 * Connects the HTTP connection object to a host.
|
10463
|
91 *
|
10481
|
92 * @param httpconn The HTTP connection object.
|
|
93 * @param host The host to connect to.
|
|
94 * @param port The port to connect to.
|
|
95 */
|
|
96 gboolean msn_httpconn_connect(MsnHttpConn *httpconn,
|
|
97 const char *host, int port);
|
|
98
|
|
99 /**
|
|
100 * Disconnects the HTTP connection object.
|
10463
|
101 *
|
10481
|
102 * @param httpconn The HTTP connection object.
|
10463
|
103 */
|
10481
|
104 void msn_httpconn_disconnect(MsnHttpConn *httpconn);
|
10463
|
105
|
|
106 #endif /* _MSN_HTTPCONN_H_ */
|