From 825a3d837a33f226c879cd02ad15c3fba57e8b2c Mon Sep 17 00:00:00 2001 From: David Walter Seikel Date: Mon, 23 Jan 2012 23:30:42 +1000 Subject: Update the EFL to what I'm actually using, coz I'm using some stuff not yet released. --- .../ecore/src/lib/ecore_con/ecore_con_private.h | 101 ++++++++++++++++++--- 1 file changed, 86 insertions(+), 15 deletions(-) (limited to 'libraries/ecore/src/lib/ecore_con/ecore_con_private.h') 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; typedef struct _Ecore_Con_Lookup Ecore_Con_Lookup; typedef struct _Ecore_Con_Info Ecore_Con_Info; - +typedef struct Ecore_Con_Socks_v4 Ecore_Con_Socks_v4; +typedef struct Ecore_Con_Socks_v5 Ecore_Con_Socks_v5; typedef void (*Ecore_Con_Info_Cb)(void *data, Ecore_Con_Info *infos); typedef enum _Ecore_Con_State @@ -82,6 +83,14 @@ typedef enum _Ecore_Con_Ssl_Handshake ECORE_CON_SSL_STATE_INIT } Ecore_Con_Ssl_State; +typedef enum Ecore_Con_Socks_State +{ + ECORE_CON_SOCKS_STATE_DONE = 0, + ECORE_CON_SOCKS_STATE_RESOLVED, + ECORE_CON_SOCKS_STATE_INIT, + ECORE_CON_SOCKS_STATE_READ +} Ecore_Con_Socks_State; + struct _Ecore_Con_Client { ECORE_MAGIC; @@ -107,9 +116,8 @@ struct _Ecore_Con_Client #endif Ecore_Con_Ssl_State ssl_state; Eina_Bool handshaking : 1; - Eina_Bool upgrade : 1; - Eina_Bool dead : 1; - Eina_Bool delete_me : 1; + Eina_Bool upgrade : 1; /* STARTTLS queued */ + Eina_Bool delete_me : 1; /* del event has been queued */ }; struct _Ecore_Con_Server @@ -130,6 +138,18 @@ struct _Ecore_Con_Server Eina_List *event_count; int client_limit; pid_t ppid; + /* socks */ + Ecore_Con_Socks *ecs; + Ecore_Con_Socks_State ecs_state; + int ecs_addrlen; + unsigned char ecs_addr[16]; + unsigned int ecs_buf_offset; + Eina_Binbuf *ecs_buf; + Eina_Binbuf *ecs_recvbuf; + const char *proxyip; + int proxyport; + /* endsocks */ + const char *verify_name; #if USE_GNUTLS gnutls_session_t session; gnutls_anon_client_credentials_t anoncred_c; @@ -149,18 +169,17 @@ struct _Ecore_Con_Server double disconnect_time; double client_disconnect_time; const char *ip; - Eina_Bool dead : 1; Eina_Bool created : 1; /* EINA_TRUE if server is our listening server */ Eina_Bool connecting : 1; /* EINA_FALSE if just initialized or connected */ Eina_Bool handshaking : 1; /* EINA_TRUE if server is ssl handshaking */ - Eina_Bool upgrade : 1; + Eina_Bool upgrade : 1; /* STARTTLS queued */ Eina_Bool ssl_prepared : 1; Eina_Bool use_cert : 1; /* EINA_TRUE if using certificate auth */ Ecore_Con_Ssl_State ssl_state; /* current state of ssl handshake on the server */ Eina_Bool verify : 1; /* EINA_TRUE if certificates will be verified */ Eina_Bool verify_basic : 1; /* EINA_TRUE if certificates will be verified only against the hostname */ Eina_Bool reject_excess_clients : 1; - Eina_Bool delete_me : 1; + Eina_Bool delete_me : 1; /* del event has been queued */ #ifdef _WIN32 Eina_Bool want_write : 1; Eina_Bool read_stop : 1; @@ -182,19 +201,18 @@ struct _Ecore_Con_Url Eina_List *additional_headers; Eina_List *response_headers; const char *url; + long proxy_type; + + Ecore_Timer *timer; Ecore_Con_Url_Time time_condition; double timestamp; void *data; - - Ecore_Fd_Handler *fd_handler; - int fd; - int flags; + + void *post_data; int received; int write_fd; - - Eina_Bool active : 1; }; #endif @@ -212,16 +230,68 @@ struct _Ecore_Con_Lookup const void *data; }; +#define ECORE_CON_SOCKS_CAST_ELSE(X) \ + Ecore_Con_Socks_v4 *v4 = NULL; \ + Ecore_Con_Socks_v5 *v5 = NULL; \ + if ((X) && ((X)->version == 4)) \ + v4 = (Ecore_Con_Socks_v4*)(X); \ + else if ((X) && ((X)->version == 5)) \ + v5 = (Ecore_Con_Socks_v5*)(X); \ + else + +struct Ecore_Con_Socks +{ + unsigned char version; + + const char *ip; + int port; + const char *username; + Eina_Bool lookup : 1; + Eina_Bool bind : 1; +}; + +struct Ecore_Con_Socks_v4 +{ + unsigned char version; + + const char *ip; + int port; + const char *username; + Eina_Bool lookup : 1; + Eina_Bool bind : 1; +}; + +struct Ecore_Con_Socks_v5 +{ + unsigned char version; + + const char *ip; + int port; + const char *username; + Eina_Bool lookup : 1; + Eina_Bool bind : 1; +}; + +extern Ecore_Con_Socks *_ecore_con_proxy_once; +extern Ecore_Con_Socks *_ecore_con_proxy_global; +void ecore_con_socks_init(void); +void ecore_con_socks_shutdown(void); +Eina_Bool ecore_con_socks_svr_init(Ecore_Con_Server *svr); +void ecore_con_socks_read(Ecore_Con_Server *svr, unsigned char *buf, int num); +void ecore_con_socks_dns_cb(const char *canonname, const char *ip, struct sockaddr *addr, int addrlen, Ecore_Con_Server *svr); /* from ecore_con.c */ void ecore_con_server_infos_del(Ecore_Con_Server *svr, void *info); +void ecore_con_event_proxy_bind(Ecore_Con_Server *svr); void ecore_con_event_server_data(Ecore_Con_Server *svr, unsigned char *buf, int num, Eina_Bool duplicate); void ecore_con_event_server_del(Ecore_Con_Server *svr); -void ecore_con_event_server_error(Ecore_Con_Server *svr, const char *error); +#define ecore_con_event_server_error(svr, error) _ecore_con_event_server_error((svr), (char*)(error), EINA_TRUE) +void _ecore_con_event_server_error(Ecore_Con_Server *svr, char *error, Eina_Bool duplicate); void ecore_con_event_client_add(Ecore_Con_Client *cl); void ecore_con_event_client_data(Ecore_Con_Client *cl, unsigned char *buf, int num, Eina_Bool duplicate); void ecore_con_event_client_del(Ecore_Con_Client *cl); void ecore_con_event_client_error(Ecore_Con_Client *cl, const char *error); - +void _ecore_con_server_kill(Ecore_Con_Server *svr); +void _ecore_con_client_kill(Ecore_Con_Client *cl); /* from ecore_local_win32.c */ #ifdef _WIN32 Eina_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 GENERIC_ALLOC_FREE_HEADER(Ecore_Con_Event_Server_Del, ecore_con_event_server_del); GENERIC_ALLOC_FREE_HEADER(Ecore_Con_Event_Server_Write, ecore_con_event_server_write); GENERIC_ALLOC_FREE_HEADER(Ecore_Con_Event_Server_Data, ecore_con_event_server_data); +GENERIC_ALLOC_FREE_HEADER(Ecore_Con_Event_Proxy_Bind, ecore_con_event_proxy_bind); void ecore_con_mempool_init(void); void ecore_con_mempool_shutdown(void); -- cgit v1.1