Frameworks/libpurple.framework/Versions/2.10.12r8d2874a79747/Headers/httpconn.h
branchadium-1.5.11-merge
changeset 6013 f8d0dc659e3f
parent 5941 307f53385811
parent 6012 200a01709ba4
child 6014 fcb71cb71a3d
child 6015 2b01cc935b7c
equal deleted inserted replaced
5941:307f53385811 6013:f8d0dc659e3f
     1 /**
       
     2  * @file httpconn.h HTTP connection
       
     3  *
       
     4  * purple
       
     5  *
       
     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
       
     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., 51 Franklin Street, Fifth Floor, Boston, MA  02111-1301  USA
       
    23  */
       
    24 #ifndef MSN_HTTPCONN_H
       
    25 #define MSN_HTTPCONN_H
       
    26 
       
    27 typedef struct _MsnHttpConn MsnHttpConn;
       
    28 
       
    29 #include "circbuffer.h"
       
    30 #include "servconn.h"
       
    31 #include "session.h"
       
    32 
       
    33 /**
       
    34  * An HTTP Connection.
       
    35  */
       
    36 struct _MsnHttpConn
       
    37 {
       
    38 	MsnSession *session; /**< The MSN Session. */
       
    39 	MsnServConn *servconn; /**< The connection object. */
       
    40 
       
    41 	PurpleProxyConnectData *connect_data;
       
    42 
       
    43 	char *full_session_id; /**< The full session id. */
       
    44 	char *session_id; /**< The trimmed session id. */
       
    45 
       
    46 	int timer; /**< The timer for polling. */
       
    47 
       
    48 	gboolean waiting_response; /**< The flag that states if we are waiting
       
    49 								 a response from the server. */
       
    50 	gboolean connected;        /**< The flag that states if the connection is on. */
       
    51 	gboolean virgin;           /**< The flag that states if this connection
       
    52 								 should specify the host (not gateway) to
       
    53 								 connect to. */
       
    54 
       
    55 	char *host; /**< The HTTP gateway host. */
       
    56 	GList *queue; /**< The queue of data chunks to write. */
       
    57 
       
    58 	int fd; /**< The connection's file descriptor. */
       
    59 	guint inpa; /**< The connection's input handler. */
       
    60 
       
    61 	char *rx_buf; /**< The receive buffer. */
       
    62 	int rx_len; /**< The receive buffer length. */
       
    63 
       
    64 	PurpleCircBuffer *tx_buf;
       
    65 	guint tx_handler;
       
    66 };
       
    67 
       
    68 /**
       
    69  * Creates a new HTTP connection object.
       
    70  *
       
    71  * @param servconn The connection object.
       
    72  *
       
    73  * @return The new object.
       
    74  */
       
    75 MsnHttpConn *msn_httpconn_new(MsnServConn *servconn);
       
    76 
       
    77 /**
       
    78  * Destroys an HTTP connection object.
       
    79  *
       
    80  * @param httpconn The HTTP connection object.
       
    81  */
       
    82 void msn_httpconn_destroy(MsnHttpConn *httpconn);
       
    83 
       
    84 /**
       
    85  * Writes a chunk of data to the HTTP connection.
       
    86  *
       
    87  * @param servconn    The server connection.
       
    88  * @param data        The data to write.
       
    89  * @param data_len    The size of the data to write.
       
    90  *
       
    91  * @return The number of bytes written.
       
    92  */
       
    93 gssize msn_httpconn_write(MsnHttpConn *httpconn, const char *data, size_t data_len);
       
    94 
       
    95 /**
       
    96  * Connects the HTTP connection object to a host.
       
    97  *
       
    98  * @param httpconn The HTTP connection object.
       
    99  * @param host The host to connect to.
       
   100  * @param port The port to connect to.
       
   101  */
       
   102 gboolean msn_httpconn_connect(MsnHttpConn *httpconn,
       
   103 							  const char *host, int port);
       
   104 
       
   105 /**
       
   106  * Disconnects the HTTP connection object.
       
   107  *
       
   108  * @param httpconn The HTTP connection object.
       
   109  */
       
   110 void msn_httpconn_disconnect(MsnHttpConn *httpconn);
       
   111 
       
   112 #endif /* MSN_HTTPCONN_H */