aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/libraries/ecore/src/lib/ecore_con/ecore_con_private.h
diff options
context:
space:
mode:
Diffstat (limited to 'libraries/ecore/src/lib/ecore_con/ecore_con_private.h')
-rw-r--r--libraries/ecore/src/lib/ecore_con/ecore_con_private.h101
1 files changed, 86 insertions, 15 deletions
diff --git a/libraries/ecore/src/lib/ecore_con/ecore_con_private.h b/libraries/ecore/src/lib/ecore_con/ecore_con_private.h
index f601465..35f2310 100644
--- a/libraries/ecore/src/lib/ecore_con/ecore_con_private.h
+++ b/libraries/ecore/src/lib/ecore_con/ecore_con_private.h
@@ -56,7 +56,8 @@ extern int _ecore_con_log_dom;
56 56
57typedef struct _Ecore_Con_Lookup Ecore_Con_Lookup; 57typedef struct _Ecore_Con_Lookup Ecore_Con_Lookup;
58typedef struct _Ecore_Con_Info Ecore_Con_Info; 58typedef struct _Ecore_Con_Info Ecore_Con_Info;
59 59typedef struct Ecore_Con_Socks_v4 Ecore_Con_Socks_v4;
60typedef struct Ecore_Con_Socks_v5 Ecore_Con_Socks_v5;
60typedef void (*Ecore_Con_Info_Cb)(void *data, Ecore_Con_Info *infos); 61typedef void (*Ecore_Con_Info_Cb)(void *data, Ecore_Con_Info *infos);
61 62
62typedef enum _Ecore_Con_State 63typedef enum _Ecore_Con_State
@@ -82,6 +83,14 @@ typedef enum _Ecore_Con_Ssl_Handshake
82 ECORE_CON_SSL_STATE_INIT 83 ECORE_CON_SSL_STATE_INIT
83} Ecore_Con_Ssl_State; 84} Ecore_Con_Ssl_State;
84 85
86typedef enum Ecore_Con_Socks_State
87{
88 ECORE_CON_SOCKS_STATE_DONE = 0,
89 ECORE_CON_SOCKS_STATE_RESOLVED,
90 ECORE_CON_SOCKS_STATE_INIT,
91 ECORE_CON_SOCKS_STATE_READ
92} Ecore_Con_Socks_State;
93
85struct _Ecore_Con_Client 94struct _Ecore_Con_Client
86{ 95{
87 ECORE_MAGIC; 96 ECORE_MAGIC;
@@ -107,9 +116,8 @@ struct _Ecore_Con_Client
107#endif 116#endif
108 Ecore_Con_Ssl_State ssl_state; 117 Ecore_Con_Ssl_State ssl_state;
109 Eina_Bool handshaking : 1; 118 Eina_Bool handshaking : 1;
110 Eina_Bool upgrade : 1; 119 Eina_Bool upgrade : 1; /* STARTTLS queued */
111 Eina_Bool dead : 1; 120 Eina_Bool delete_me : 1; /* del event has been queued */
112 Eina_Bool delete_me : 1;
113}; 121};
114 122
115struct _Ecore_Con_Server 123struct _Ecore_Con_Server
@@ -130,6 +138,18 @@ struct _Ecore_Con_Server
130 Eina_List *event_count; 138 Eina_List *event_count;
131 int client_limit; 139 int client_limit;
132 pid_t ppid; 140 pid_t ppid;
141 /* socks */
142 Ecore_Con_Socks *ecs;
143 Ecore_Con_Socks_State ecs_state;
144 int ecs_addrlen;
145 unsigned char ecs_addr[16];
146 unsigned int ecs_buf_offset;
147 Eina_Binbuf *ecs_buf;
148 Eina_Binbuf *ecs_recvbuf;
149 const char *proxyip;
150 int proxyport;
151 /* endsocks */
152 const char *verify_name;
133#if USE_GNUTLS 153#if USE_GNUTLS
134 gnutls_session_t session; 154 gnutls_session_t session;
135 gnutls_anon_client_credentials_t anoncred_c; 155 gnutls_anon_client_credentials_t anoncred_c;
@@ -149,18 +169,17 @@ struct _Ecore_Con_Server
149 double disconnect_time; 169 double disconnect_time;
150 double client_disconnect_time; 170 double client_disconnect_time;
151 const char *ip; 171 const char *ip;
152 Eina_Bool dead : 1;
153 Eina_Bool created : 1; /* EINA_TRUE if server is our listening server */ 172 Eina_Bool created : 1; /* EINA_TRUE if server is our listening server */
154 Eina_Bool connecting : 1; /* EINA_FALSE if just initialized or connected */ 173 Eina_Bool connecting : 1; /* EINA_FALSE if just initialized or connected */
155 Eina_Bool handshaking : 1; /* EINA_TRUE if server is ssl handshaking */ 174 Eina_Bool handshaking : 1; /* EINA_TRUE if server is ssl handshaking */
156 Eina_Bool upgrade : 1; 175 Eina_Bool upgrade : 1; /* STARTTLS queued */
157 Eina_Bool ssl_prepared : 1; 176 Eina_Bool ssl_prepared : 1;
158 Eina_Bool use_cert : 1; /* EINA_TRUE if using certificate auth */ 177 Eina_Bool use_cert : 1; /* EINA_TRUE if using certificate auth */
159 Ecore_Con_Ssl_State ssl_state; /* current state of ssl handshake on the server */ 178 Ecore_Con_Ssl_State ssl_state; /* current state of ssl handshake on the server */
160 Eina_Bool verify : 1; /* EINA_TRUE if certificates will be verified */ 179 Eina_Bool verify : 1; /* EINA_TRUE if certificates will be verified */
161 Eina_Bool verify_basic : 1; /* EINA_TRUE if certificates will be verified only against the hostname */ 180 Eina_Bool verify_basic : 1; /* EINA_TRUE if certificates will be verified only against the hostname */
162 Eina_Bool reject_excess_clients : 1; 181 Eina_Bool reject_excess_clients : 1;
163 Eina_Bool delete_me : 1; 182 Eina_Bool delete_me : 1; /* del event has been queued */
164#ifdef _WIN32 183#ifdef _WIN32
165 Eina_Bool want_write : 1; 184 Eina_Bool want_write : 1;
166 Eina_Bool read_stop : 1; 185 Eina_Bool read_stop : 1;
@@ -182,19 +201,18 @@ struct _Ecore_Con_Url
182 Eina_List *additional_headers; 201 Eina_List *additional_headers;
183 Eina_List *response_headers; 202 Eina_List *response_headers;
184 const char *url; 203 const char *url;
204 long proxy_type;
205
206 Ecore_Timer *timer;
185 207
186 Ecore_Con_Url_Time time_condition; 208 Ecore_Con_Url_Time time_condition;
187 double timestamp; 209 double timestamp;
188 void *data; 210 void *data;
189 211
190 Ecore_Fd_Handler *fd_handler; 212 void *post_data;
191 int fd;
192 int flags;
193 213
194 int received; 214 int received;
195 int write_fd; 215 int write_fd;
196
197 Eina_Bool active : 1;
198}; 216};
199#endif 217#endif
200 218
@@ -212,16 +230,68 @@ struct _Ecore_Con_Lookup
212 const void *data; 230 const void *data;
213}; 231};
214 232
233#define ECORE_CON_SOCKS_CAST_ELSE(X) \
234 Ecore_Con_Socks_v4 *v4 = NULL; \
235 Ecore_Con_Socks_v5 *v5 = NULL; \
236 if ((X) && ((X)->version == 4)) \
237 v4 = (Ecore_Con_Socks_v4*)(X); \
238 else if ((X) && ((X)->version == 5)) \
239 v5 = (Ecore_Con_Socks_v5*)(X); \
240 else
241
242struct Ecore_Con_Socks
243{
244 unsigned char version;
245
246 const char *ip;
247 int port;
248 const char *username;
249 Eina_Bool lookup : 1;
250 Eina_Bool bind : 1;
251};
252
253struct Ecore_Con_Socks_v4
254{
255 unsigned char version;
256
257 const char *ip;
258 int port;
259 const char *username;
260 Eina_Bool lookup : 1;
261 Eina_Bool bind : 1;
262};
263
264struct Ecore_Con_Socks_v5
265{
266 unsigned char version;
267
268 const char *ip;
269 int port;
270 const char *username;
271 Eina_Bool lookup : 1;
272 Eina_Bool bind : 1;
273};
274
275extern Ecore_Con_Socks *_ecore_con_proxy_once;
276extern Ecore_Con_Socks *_ecore_con_proxy_global;
277void ecore_con_socks_init(void);
278void ecore_con_socks_shutdown(void);
279Eina_Bool ecore_con_socks_svr_init(Ecore_Con_Server *svr);
280void ecore_con_socks_read(Ecore_Con_Server *svr, unsigned char *buf, int num);
281void ecore_con_socks_dns_cb(const char *canonname, const char *ip, struct sockaddr *addr, int addrlen, Ecore_Con_Server *svr);
215/* from ecore_con.c */ 282/* from ecore_con.c */
216void ecore_con_server_infos_del(Ecore_Con_Server *svr, void *info); 283void ecore_con_server_infos_del(Ecore_Con_Server *svr, void *info);
284void ecore_con_event_proxy_bind(Ecore_Con_Server *svr);
217void ecore_con_event_server_data(Ecore_Con_Server *svr, unsigned char *buf, int num, Eina_Bool duplicate); 285void ecore_con_event_server_data(Ecore_Con_Server *svr, unsigned char *buf, int num, Eina_Bool duplicate);
218void ecore_con_event_server_del(Ecore_Con_Server *svr); 286void ecore_con_event_server_del(Ecore_Con_Server *svr);
219void ecore_con_event_server_error(Ecore_Con_Server *svr, const char *error); 287#define ecore_con_event_server_error(svr, error) _ecore_con_event_server_error((svr), (char*)(error), EINA_TRUE)
288void _ecore_con_event_server_error(Ecore_Con_Server *svr, char *error, Eina_Bool duplicate);
220void ecore_con_event_client_add(Ecore_Con_Client *cl); 289void ecore_con_event_client_add(Ecore_Con_Client *cl);
221void ecore_con_event_client_data(Ecore_Con_Client *cl, unsigned char *buf, int num, Eina_Bool duplicate); 290void ecore_con_event_client_data(Ecore_Con_Client *cl, unsigned char *buf, int num, Eina_Bool duplicate);
222void ecore_con_event_client_del(Ecore_Con_Client *cl); 291void ecore_con_event_client_del(Ecore_Con_Client *cl);
223void ecore_con_event_client_error(Ecore_Con_Client *cl, const char *error); 292void ecore_con_event_client_error(Ecore_Con_Client *cl, const char *error);
224 293void _ecore_con_server_kill(Ecore_Con_Server *svr);
294void _ecore_con_client_kill(Ecore_Con_Client *cl);
225/* from ecore_local_win32.c */ 295/* from ecore_local_win32.c */
226#ifdef _WIN32 296#ifdef _WIN32
227Eina_Bool ecore_con_local_listen(Ecore_Con_Server *svr); 297Eina_Bool ecore_con_local_listen(Ecore_Con_Server *svr);
@@ -312,6 +382,7 @@ GENERIC_ALLOC_FREE_HEADER(Ecore_Con_Event_Server_Add, ecore_con_event_server_add
312GENERIC_ALLOC_FREE_HEADER(Ecore_Con_Event_Server_Del, ecore_con_event_server_del); 382GENERIC_ALLOC_FREE_HEADER(Ecore_Con_Event_Server_Del, ecore_con_event_server_del);
313GENERIC_ALLOC_FREE_HEADER(Ecore_Con_Event_Server_Write, ecore_con_event_server_write); 383GENERIC_ALLOC_FREE_HEADER(Ecore_Con_Event_Server_Write, ecore_con_event_server_write);
314GENERIC_ALLOC_FREE_HEADER(Ecore_Con_Event_Server_Data, ecore_con_event_server_data); 384GENERIC_ALLOC_FREE_HEADER(Ecore_Con_Event_Server_Data, ecore_con_event_server_data);
385GENERIC_ALLOC_FREE_HEADER(Ecore_Con_Event_Proxy_Bind, ecore_con_event_proxy_bind);
315 386
316void ecore_con_mempool_init(void); 387void ecore_con_mempool_init(void);
317void ecore_con_mempool_shutdown(void); 388void ecore_con_mempool_shutdown(void);