Mercurial > pidgin
comparison 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 |
comparison
equal
deleted
inserted
replaced
10480:8e0a91d11362 | 10481:bcfea6c3d5c9 |
---|---|
26 | 26 |
27 typedef struct _MsnHttpConn MsnHttpConn; | 27 typedef struct _MsnHttpConn MsnHttpConn; |
28 | 28 |
29 #include "servconn.h" | 29 #include "servconn.h" |
30 | 30 |
31 /** | |
32 * An HTTP Connection. | |
33 */ | |
31 struct _MsnHttpConn | 34 struct _MsnHttpConn |
32 { | 35 { |
33 MsnSession *session; | 36 MsnSession *session; /**< The MSN Session. */ |
34 MsnServConn *servconn; | 37 MsnServConn *servconn; /**< The connection object. */ |
35 | 38 |
36 char *full_session_id; | 39 char *full_session_id; /**< The full session id. */ |
37 char *session_id; | 40 char *session_id; /**< The trimmed session id. */ |
38 | 41 |
39 int timer; | 42 int timer; /**< The timer for polling. */ |
40 | 43 |
41 gboolean waiting_response; | 44 gboolean waiting_response; /**< The flag that states if we are waiting |
42 gboolean dirty; /**< The flag that states if we should poll. */ | 45 a response from the server. */ |
43 gboolean connected; | 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. */ | |
44 | 51 |
45 char *host; | 52 char *host; /**< The HTTP gateway host. */ |
46 GList *queue; | 53 GList *queue; /**< The queue of data chunks to write. */ |
47 | 54 |
48 int fd; | 55 int fd; /**< The connection's file descriptor. */ |
49 int inpa; | 56 int inpa; /**< The connection's input handler. */ |
50 | 57 |
51 char *rx_buf; | 58 char *rx_buf; /**< The receive buffer. */ |
52 int rx_len; | 59 int rx_len; /**< The receive buffer lenght. */ |
53 | |
54 #if 0 | |
55 GQueue *servconn_queue; | |
56 #endif | |
57 | |
58 gboolean virgin; | |
59 }; | 60 }; |
60 | 61 |
62 /** | |
63 * Creates a new HTTP connection object. | |
64 * | |
65 * @param servconn The connection object. | |
66 * | |
67 * @return The new object. | |
68 */ | |
61 MsnHttpConn *msn_httpconn_new(MsnServConn *servconn); | 69 MsnHttpConn *msn_httpconn_new(MsnServConn *servconn); |
62 void msn_httpconn_destroy(MsnHttpConn *httpconn); | |
63 size_t msn_httpconn_write(MsnHttpConn *httpconn, const char *buf, size_t size); | |
64 | |
65 gboolean msn_httpconn_connect(MsnHttpConn *httpconn, | |
66 const char *host, int port); | |
67 void msn_httpconn_disconnect(MsnHttpConn *httpconn); | |
68 | |
69 #if 0 | |
70 void msn_httpconn_queue_servconn(MsnHttpConn *httpconn, MsnServConn *servconn); | |
71 #endif | |
72 | |
73 #if 0 | |
74 /** | |
75 * Initializes the HTTP data for a session. | |
76 * | |
77 * @param session The session. | |
78 */ | |
79 void msn_http_session_init(MsnSession *session); | |
80 | 70 |
81 /** | 71 /** |
82 * Uninitializes the HTTP data for a session. | 72 * Destroys an HTTP connection object. |
83 * | 73 * |
84 * @param session The session. | 74 * @param httpconn The HTTP connection object. |
85 */ | 75 */ |
86 void msn_http_session_uninit(MsnSession *session); | 76 void msn_httpconn_destroy(MsnHttpConn *httpconn); |
87 | 77 |
88 /** | 78 /** |
89 * Writes data to the server using the HTTP connection method. | 79 * Writes a chunk of data to the HTTP connection. |
90 * | 80 * |
91 * @param servconn The server connection. | 81 * @param servconn The server connection. |
92 * @param buf The data to write. | 82 * @param data The data to write. |
93 * @param size The size of the data to write. | 83 * @param size The size of the data to write. |
94 * @param server_type The optional server type. | |
95 * | 84 * |
96 * @return The number of bytes written. | 85 * @return The number of bytes written. |
97 */ | 86 */ |
98 size_t msn_http_servconn_write(MsnServConn *servconn, const char *buf, | 87 size_t msn_httpconn_write(MsnHttpConn *httpconn, const char *data, size_t size); |
99 size_t size, const char *server_type); | |
100 | 88 |
101 /** | 89 /** |
102 * Polls the server for data. | 90 * Connects the HTTP connection object to a host. |
103 * | 91 * |
104 * @param servconn The server connection. | 92 * @param httpconn The HTTP connection object. |
93 * @param host The host to connect to. | |
94 * @param port The port to connect to. | |
105 */ | 95 */ |
106 void msn_http_servconn_poll(MsnServConn *servconn); | 96 gboolean msn_httpconn_connect(MsnHttpConn *httpconn, |
97 const char *host, int port); | |
107 | 98 |
108 /** | 99 /** |
109 * Processes an incoming message and returns a string the rest of MSN | 100 * Disconnects the HTTP connection object. |
110 * can deal with. | |
111 * | 101 * |
112 * @param servconn The server connection. | 102 * @param httpconn The HTTP connection object. |
113 * @param buf The incoming buffer. | |
114 * @param size The incoming size. | |
115 * @param ret_buf The returned buffer. | |
116 * @param ret_len The returned length. | |
117 * @param error TRUE if there was an HTTP error. | |
118 * | |
119 * @return TRUE if the returned buffer is ready to be processed. | |
120 * FALSE otherwise. | |
121 */ | 103 */ |
122 gboolean msn_http_servconn_parse_data(MsnServConn *servconn, | 104 void msn_httpconn_disconnect(MsnHttpConn *httpconn); |
123 const char *buf, size_t size, | |
124 char **ret_buf, size_t *ret_size, | |
125 gboolean *error); | |
126 #endif | |
127 | 105 |
128 #endif /* _MSN_HTTPCONN_H_ */ | 106 #endif /* _MSN_HTTPCONN_H_ */ |