Mercurial > pidgin
diff src/protocols/msn/httpconn.h @ 10481:bcfea6c3d5c9
[gaim-migrate @ 11769]
Patch 1093958 from Felipe Contreras. It fixes stuff.
I also made some tweaks to make valgrind a bit happier.
committer: Tailor Script <tailor@pidgin.im>
author | Stu Tomlinson <stu@nosnilmot.com> |
---|---|
date | Fri, 07 Jan 2005 02:48:33 +0000 |
parents | 9bed28273ec7 |
children | 33bef17125c2 |
line wrap: on
line diff
--- a/src/protocols/msn/httpconn.h Thu Jan 06 23:11:12 2005 +0000 +++ b/src/protocols/msn/httpconn.h Fri Jan 07 02:48:33 2005 +0000 @@ -28,101 +28,79 @@ #include "servconn.h" +/** + * An HTTP Connection. + */ struct _MsnHttpConn { - MsnSession *session; - MsnServConn *servconn; - - char *full_session_id; - char *session_id; + MsnSession *session; /**< The MSN Session. */ + MsnServConn *servconn; /**< The connection object. */ - int timer; + char *full_session_id; /**< The full session id. */ + char *session_id; /**< The trimmed session id. */ - gboolean waiting_response; - gboolean dirty; /**< The flag that states if we should poll. */ - gboolean connected; + int timer; /**< The timer for polling. */ - char *host; - GList *queue; - - int fd; - int inpa; + gboolean waiting_response; /**< The flag that states if we are waiting + a response from the server. */ + gboolean dirty; /**< The flag that states if we should poll. */ + gboolean connected; /**< The flag that states if the connection is on. */ + gboolean virgin; /**< The flag that states if this connection + should specify the host (not gateway) to + connect to. */ - char *rx_buf; - int rx_len; + char *host; /**< The HTTP gateway host. */ + GList *queue; /**< The queue of data chunks to write. */ -#if 0 - GQueue *servconn_queue; -#endif + int fd; /**< The connection's file descriptor. */ + int inpa; /**< The connection's input handler. */ - gboolean virgin; + char *rx_buf; /**< The receive buffer. */ + int rx_len; /**< The receive buffer lenght. */ }; +/** + * Creates a new HTTP connection object. + * + * @param servconn The connection object. + * + * @return The new object. + */ MsnHttpConn *msn_httpconn_new(MsnServConn *servconn); -void msn_httpconn_destroy(MsnHttpConn *httpconn); -size_t msn_httpconn_write(MsnHttpConn *httpconn, const char *buf, size_t size); - -gboolean msn_httpconn_connect(MsnHttpConn *httpconn, - const char *host, int port); -void msn_httpconn_disconnect(MsnHttpConn *httpconn); - -#if 0 -void msn_httpconn_queue_servconn(MsnHttpConn *httpconn, MsnServConn *servconn); -#endif - -#if 0 -/** - * Initializes the HTTP data for a session. - * - * @param session The session. - */ -void msn_http_session_init(MsnSession *session); /** - * Uninitializes the HTTP data for a session. + * Destroys an HTTP connection object. * - * @param session The session. + * @param httpconn The HTTP connection object. */ -void msn_http_session_uninit(MsnSession *session); +void msn_httpconn_destroy(MsnHttpConn *httpconn); /** - * Writes data to the server using the HTTP connection method. + * Writes a chunk of data to the HTTP connection. * * @param servconn The server connection. - * @param buf The data to write. + * @param data The data to write. * @param size The size of the data to write. - * @param server_type The optional server type. * * @return The number of bytes written. */ -size_t msn_http_servconn_write(MsnServConn *servconn, const char *buf, - size_t size, const char *server_type); - -/** - * Polls the server for data. - * - * @param servconn The server connection. - */ -void msn_http_servconn_poll(MsnServConn *servconn); +size_t msn_httpconn_write(MsnHttpConn *httpconn, const char *data, size_t size); /** - * Processes an incoming message and returns a string the rest of MSN - * can deal with. + * Connects the HTTP connection object to a host. * - * @param servconn The server connection. - * @param buf The incoming buffer. - * @param size The incoming size. - * @param ret_buf The returned buffer. - * @param ret_len The returned length. - * @param error TRUE if there was an HTTP error. + * @param httpconn The HTTP connection object. + * @param host The host to connect to. + * @param port The port to connect to. + */ +gboolean msn_httpconn_connect(MsnHttpConn *httpconn, + const char *host, int port); + +/** + * Disconnects the HTTP connection object. * - * @return TRUE if the returned buffer is ready to be processed. - * FALSE otherwise. + * @param httpconn The HTTP connection object. */ -gboolean msn_http_servconn_parse_data(MsnServConn *servconn, - const char *buf, size_t size, - char **ret_buf, size_t *ret_size, - gboolean *error); -#endif +void msn_httpconn_disconnect(MsnHttpConn *httpconn); #endif /* _MSN_HTTPCONN_H_ */