2 * @file httpconn.h HTTP connection
6 * Purple 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
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.
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.
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., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
24 #ifndef _MSN_HTTPCONN_H_
25 #define _MSN_HTTPCONN_H_
27 typedef struct _MsnHttpConn MsnHttpConn;
29 #include "circbuffer.h"
37 MsnSession *session; /**< The MSN Session. */
38 MsnServConn *servconn; /**< The connection object. */
40 PurpleProxyConnectData *connect_data;
42 char *full_session_id; /**< The full session id. */
43 char *session_id; /**< The trimmed session id. */
45 int timer; /**< The timer for polling. */
47 gboolean waiting_response; /**< The flag that states if we are waiting
48 a response from the server. */
49 gboolean connected; /**< The flag that states if the connection is on. */
50 gboolean virgin; /**< The flag that states if this connection
51 should specify the host (not gateway) to
54 char *host; /**< The HTTP gateway host. */
55 GList *queue; /**< The queue of data chunks to write. */
57 int fd; /**< The connection's file descriptor. */
58 guint inpa; /**< The connection's input handler. */
60 char *rx_buf; /**< The receive buffer. */
61 int rx_len; /**< The receive buffer length. */
63 PurpleCircBuffer *tx_buf;
68 * Creates a new HTTP connection object.
70 * @param servconn The connection object.
72 * @return The new object.
74 MsnHttpConn *msn_httpconn_new(MsnServConn *servconn);
77 * Destroys an HTTP connection object.
79 * @param httpconn The HTTP connection object.
81 void msn_httpconn_destroy(MsnHttpConn *httpconn);
84 * Writes a chunk of data to the HTTP connection.
86 * @param servconn The server connection.
87 * @param data The data to write.
88 * @param data_len The size of the data to write.
90 * @return The number of bytes written.
92 gssize msn_httpconn_write(MsnHttpConn *httpconn, const char *data, size_t data_len);
95 * Connects the HTTP connection object to a host.
97 * @param httpconn The HTTP connection object.
98 * @param host The host to connect to.
99 * @param port The port to connect to.
101 gboolean msn_httpconn_connect(MsnHttpConn *httpconn,
102 const char *host, int port);
105 * Disconnects the HTTP connection object.
107 * @param httpconn The HTTP connection object.
109 void msn_httpconn_disconnect(MsnHttpConn *httpconn);
111 #endif /* _MSN_HTTPCONN_H_ */