Mercurial > pidgin.yaz
comparison src/protocols/msn/servconn.h @ 10463:9bed28273ec7
[gaim-migrate @ 11737]
Felipe Contreras fixed the MSN HTTP Method. Yay! Thanks Felipe.
committer: Tailor Script <tailor@pidgin.im>
author | Stu Tomlinson <stu@nosnilmot.com> |
---|---|
date | Fri, 31 Dec 2004 16:34:22 +0000 |
parents | ecf3ce2e2ab1 |
children | bcfea6c3d5c9 |
comparison
equal
deleted
inserted
replaced
10462:f7b32dd67bdf | 10463:9bed28273ec7 |
---|---|
28 | 28 |
29 #include "session.h" | 29 #include "session.h" |
30 #include "cmdproc.h" | 30 #include "cmdproc.h" |
31 | 31 |
32 #include "proxy.h" | 32 #include "proxy.h" |
33 #include "httpmethod.h" | 33 #include "httpconn.h" |
34 | 34 |
35 /* | 35 /* |
36 #include "msg.h" | 36 * Connection types |
37 #include "history.h" | 37 */ |
38 */ | |
39 | |
40 typedef enum | 38 typedef enum |
41 { | 39 { |
42 MSN_SERVER_NS, | 40 MSN_SERVER_NS, |
43 MSN_SERVER_SB, | 41 MSN_SERVER_SB, |
44 MSN_SERVER_NX, | 42 MSN_SERVER_NX, |
45 MSN_SERVER_DC, | 43 MSN_SERVER_DC, |
46 MSN_SERVER_HT | 44 MSN_SERVER_HT |
47 | 45 |
48 } MsnServConnType; | 46 } MsnServConnType; |
49 | 47 |
48 /* | |
49 * A Connection | |
50 */ | |
50 struct _MsnServConn | 51 struct _MsnServConn |
51 { | 52 { |
52 MsnServConnType type; | 53 MsnServConnType type; /**< The type of this connection. */ |
53 MsnSession *session; | 54 MsnSession *session; /**< The MSN session of this connection. */ |
54 MsnCmdProc *cmdproc; | 55 MsnCmdProc *cmdproc; /**< The command processor of this connection. */ |
55 | 56 |
56 gboolean connected; | 57 gboolean connected; /**< A flag that states if it's connected. */ |
57 gboolean processing; | 58 gboolean processing; /**< A flag that states if something is working |
58 gboolean wasted; | 59 with this connection. */ |
60 gboolean wasted; /**< A flag that states if it should be destroyed. */ | |
61 gboolean destroying; /**< A flag that states if the connection is on | |
62 the process of being destroyed. */ | |
59 | 63 |
60 int num; | 64 char *host; /**< The host this connection is connected or should be |
65 connected to. */ | |
66 int num; /**< A number id of this connection. */ | |
61 | 67 |
62 MsnHttpMethodData *http_data; | 68 MsnHttpConn *httpconn; /**< The HTTP connection this connection should use. */ |
63 | 69 |
64 int fd; | 70 int fd; /**< The connection's file descriptor. */ |
65 int inpa; | 71 int inpa; /**< The connection's input handler. */ |
66 | 72 |
67 char *rx_buf; | 73 char *rx_buf; /**< The receive buffer. */ |
68 int rx_len; | 74 int rx_len; /**< The receive buffer lenght. */ |
69 | 75 |
70 size_t payload_len; | 76 size_t payload_len; /**< The length of the payload. |
77 It's only set when we've received a command that | |
78 has a payload. */ | |
71 | 79 |
72 void (*connect_cb)(MsnServConn *); | 80 void (*connect_cb)(MsnServConn *); /**< The callback to call when connecting. */ |
73 void (*disconnect_cb)(MsnServConn *); | 81 void (*disconnect_cb)(MsnServConn *); /**< The callback to call when disconnecting. */ |
74 void (*data_free_cb)(void *data); | 82 void (*destroy_cb)(MsnServConn *); /**< The callback to call when destroying. */ |
75 void *data; | |
76 }; | 83 }; |
77 | 84 |
85 /** | |
86 * Creates a new connection object. | |
87 * | |
88 * @param session The session. | |
89 * @param type The type of the connection. | |
90 */ | |
78 MsnServConn *msn_servconn_new(MsnSession *session, MsnServConnType type); | 91 MsnServConn *msn_servconn_new(MsnSession *session, MsnServConnType type); |
92 | |
93 /** | |
94 * Destroys a connection object. | |
95 * | |
96 * @param servconn The connection. | |
97 */ | |
79 void msn_servconn_destroy(MsnServConn *servconn); | 98 void msn_servconn_destroy(MsnServConn *servconn); |
80 | 99 |
100 /** | |
101 * Connects to a host. | |
102 * | |
103 * @param servconn The connection. | |
104 * @param host The host. | |
105 * @param port The port. | |
106 */ | |
81 gboolean msn_servconn_connect(MsnServConn *servconn, const char *host, int port); | 107 gboolean msn_servconn_connect(MsnServConn *servconn, const char *host, int port); |
108 | |
109 /** | |
110 * Disconnects. | |
111 * | |
112 * @param servconn The connection. | |
113 */ | |
82 void msn_servconn_disconnect(MsnServConn *servconn); | 114 void msn_servconn_disconnect(MsnServConn *servconn); |
83 | 115 |
116 /** | |
117 * Sets the connect callback. | |
118 * | |
119 * @param servconn The servconn. | |
120 * @param connect_cb The connect callback. | |
121 */ | |
84 void msn_servconn_set_connect_cb(MsnServConn *servconn, | 122 void msn_servconn_set_connect_cb(MsnServConn *servconn, |
85 void (*connect_cb)(MsnServConn *)); | 123 void (*connect_cb)(MsnServConn *)); |
124 /** | |
125 * Sets the disconnect callback. | |
126 * | |
127 * @param servconn The servconn. | |
128 * @param disconnect_cb The disconnect callback. | |
129 */ | |
86 void msn_servconn_set_disconnect_cb(MsnServConn *servconn, | 130 void msn_servconn_set_disconnect_cb(MsnServConn *servconn, |
87 void (*disconnect_cb)(MsnServConn *)); | 131 void (*disconnect_cb)(MsnServConn *)); |
88 size_t msn_servconn_write(MsnServConn *servconn, const char *buf, size_t size); | 132 /** |
133 * Sets the destroy callback. | |
134 * | |
135 * @param servconn The servconn that's being destroyed. | |
136 * @param destroy_cb The destroy callback. | |
137 */ | |
138 void msn_servconn_set_destroy_cb(MsnServConn *servconn, | |
139 void (*destroy_cb)(MsnServConn *)); | |
140 | |
141 /** | |
142 * Writes a chunck of data to the servconn. | |
143 * | |
144 * @param servconn The servconn. | |
145 * @param buf The data to write. | |
146 * @param size The size of the data. | |
147 */ | |
148 size_t msn_servconn_write(MsnServConn *servconn, const char *buf, | |
149 size_t size); | |
89 | 150 |
90 #endif /* _MSN_SERVCONN_H_ */ | 151 #endif /* _MSN_SERVCONN_H_ */ |