1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/Frameworks/libpurple.framework/Versions/0.6.2/Headers/httpconn.h Fri Aug 21 13:25:11 2009 -0700
1.3 @@ -0,0 +1,111 @@
1.4 +/**
1.5 + * @file httpconn.h HTTP connection
1.6 + *
1.7 + * purple
1.8 + *
1.9 + * Purple is the legal property of its developers, whose names are too numerous
1.10 + * to list here. Please refer to the COPYRIGHT file distributed with this
1.11 + * source distribution.
1.12 + *
1.13 + * This program is free software; you can redistribute it and/or modify
1.14 + * it under the terms of the GNU General Public License as published by
1.15 + * the Free Software Foundation; either version 2 of the License, or
1.16 + * (at your option) any later version.
1.17 + *
1.18 + * This program is distributed in the hope that it will be useful,
1.19 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
1.20 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1.21 + * GNU General Public License for more details.
1.22 + *
1.23 + * You should have received a copy of the GNU General Public License
1.24 + * along with this program; if not, write to the Free Software
1.25 + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
1.26 + */
1.27 +#ifndef _MSN_HTTPCONN_H_
1.28 +#define _MSN_HTTPCONN_H_
1.29 +
1.30 +typedef struct _MsnHttpConn MsnHttpConn;
1.31 +
1.32 +#include "circbuffer.h"
1.33 +#include "servconn.h"
1.34 +
1.35 +/**
1.36 + * An HTTP Connection.
1.37 + */
1.38 +struct _MsnHttpConn
1.39 +{
1.40 + MsnSession *session; /**< The MSN Session. */
1.41 + MsnServConn *servconn; /**< The connection object. */
1.42 +
1.43 + PurpleProxyConnectData *connect_data;
1.44 +
1.45 + char *full_session_id; /**< The full session id. */
1.46 + char *session_id; /**< The trimmed session id. */
1.47 +
1.48 + int timer; /**< The timer for polling. */
1.49 +
1.50 + gboolean waiting_response; /**< The flag that states if we are waiting
1.51 + a response from the server. */
1.52 + gboolean connected; /**< The flag that states if the connection is on. */
1.53 + gboolean virgin; /**< The flag that states if this connection
1.54 + should specify the host (not gateway) to
1.55 + connect to. */
1.56 +
1.57 + char *host; /**< The HTTP gateway host. */
1.58 + GList *queue; /**< The queue of data chunks to write. */
1.59 +
1.60 + int fd; /**< The connection's file descriptor. */
1.61 + guint inpa; /**< The connection's input handler. */
1.62 +
1.63 + char *rx_buf; /**< The receive buffer. */
1.64 + int rx_len; /**< The receive buffer length. */
1.65 +
1.66 + PurpleCircBuffer *tx_buf;
1.67 + guint tx_handler;
1.68 +};
1.69 +
1.70 +/**
1.71 + * Creates a new HTTP connection object.
1.72 + *
1.73 + * @param servconn The connection object.
1.74 + *
1.75 + * @return The new object.
1.76 + */
1.77 +MsnHttpConn *msn_httpconn_new(MsnServConn *servconn);
1.78 +
1.79 +/**
1.80 + * Destroys an HTTP connection object.
1.81 + *
1.82 + * @param httpconn The HTTP connection object.
1.83 + */
1.84 +void msn_httpconn_destroy(MsnHttpConn *httpconn);
1.85 +
1.86 +/**
1.87 + * Writes a chunk of data to the HTTP connection.
1.88 + *
1.89 + * @param servconn The server connection.
1.90 + * @param data The data to write.
1.91 + * @param data_len The size of the data to write.
1.92 + *
1.93 + * @return The number of bytes written.
1.94 + */
1.95 +gssize msn_httpconn_write(MsnHttpConn *httpconn, const char *data, size_t data_len);
1.96 +
1.97 +/**
1.98 + * Connects the HTTP connection object to a host.
1.99 + *
1.100 + * @param httpconn The HTTP connection object.
1.101 + * @param host The host to connect to.
1.102 + * @param port The port to connect to.
1.103 + */
1.104 +gboolean msn_httpconn_connect(MsnHttpConn *httpconn,
1.105 + const char *host, int port);
1.106 +
1.107 +/**
1.108 + * Disconnects the HTTP connection object.
1.109 + *
1.110 + * @param httpconn The HTTP connection object.
1.111 + */
1.112 +void msn_httpconn_disconnect(MsnHttpConn *httpconn);
1.113 +
1.114 +#endif /* _MSN_HTTPCONN_H_ */