summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGustavo Sverzut Barbieri <barbieri@profusion.mobi>2016-11-18 12:17:08 -0200
committerGustavo Sverzut Barbieri <barbieri@profusion.mobi>2016-11-18 12:53:32 -0200
commit5818dc71da2b058e6f38f218785b08660e8b92e6 (patch)
treeb9285c1a753e8d1e075d491d6894c7172b422cf0
parent0f1e7bad92cea4c17b87987d4be9aba107fc3018 (diff)
efl_net: use SOCKET_FMT to format SOCKET so it works on UNIX and Windows.
On Windows SOCKET is unsigned, thus will cause sign errors when formatting with "%d" or comparing with signed values. On UNIX it was quiet and easy to miss, thus a new #define can be used to check for those. It will use 'unsigned long' as SOCKET, thus will complain out loud and not even work correctly when using pointers on 64bits UNIX on mistakes -- which should improve the situation. This helped to fix lots of missing conversions, all fixed. This partially addresses D4357.
-rw-r--r--src/lib/ecore_con/ecore_con.c104
-rw-r--r--src/lib/ecore_con/ecore_con_private.h24
-rw-r--r--src/lib/ecore_con/efl_net_dialer_http.c24
-rw-r--r--src/lib/ecore_con/efl_net_dialer_tcp.c2
-rw-r--r--src/lib/ecore_con/efl_net_dialer_udp.c10
-rw-r--r--src/lib/ecore_con/efl_net_dialer_unix.c4
-rw-r--r--src/lib/ecore_con/efl_net_server_fd.c50
-rw-r--r--src/lib/ecore_con/efl_net_server_tcp.c30
-rw-r--r--src/lib/ecore_con/efl_net_server_udp.c28
-rw-r--r--src/lib/ecore_con/efl_net_server_unix.c26
-rw-r--r--src/lib/ecore_con/efl_net_socket_fd.c18
-rw-r--r--src/lib/ecore_con/efl_net_socket_tcp.c28
-rw-r--r--src/lib/ecore_con/efl_net_socket_udp.c41
-rw-r--r--src/lib/ecore_con/efl_net_socket_unix.c10
14 files changed, 222 insertions, 177 deletions
diff --git a/src/lib/ecore_con/ecore_con.c b/src/lib/ecore_con/ecore_con.c
index 48b1d1c4c7..0812a7c0fb 100644
--- a/src/lib/ecore_con/ecore_con.c
+++ b/src/lib/ecore_con/ecore_con.c
@@ -3045,7 +3045,7 @@ efl_net_unix_fmt(char *buf, size_t buflen, SOCKET fd, const struct sockaddr_un *
3045 3045
3046 if (addrlen == offsetof(struct sockaddr_un, sun_path)) 3046 if (addrlen == offsetof(struct sockaddr_un, sun_path))
3047 { 3047 {
3048 int r = snprintf(buf, buflen, "unnamed:%d", fd); 3048 int r = snprintf(buf, buflen, "unnamed:" SOCKET_FMT, fd);
3049 if (r < 0) 3049 if (r < 0)
3050 { 3050 {
3051 ERR("snprintf(): %s", strerror(errno)); 3051 ERR("snprintf(): %s", strerror(errno));
@@ -3219,7 +3219,7 @@ efl_net_ip_socket_activate_check(const char *address, int family, int type, Eina
3219 r = sd_is_socket_unix(fd, type, 0, sun_path, len); 3219 r = sd_is_socket_unix(fd, type, 0, sun_path, len);
3220 if (r < 0) 3220 if (r < 0)
3221 { 3221 {
3222 ERR("socket %d is not of family=%d, type=%d", fd, family, type); 3222 ERR("socket " SOCKET_FMT " is not of family=%d, type=%d", fd, family, type);
3223 return EINVAL; 3223 return EINVAL;
3224 } 3224 }
3225 if (listening) *listening = (r == 1); 3225 if (listening) *listening = (r == 1);
@@ -3238,7 +3238,7 @@ efl_net_ip_socket_activate_check(const char *address, int family, int type, Eina
3238 r = sd_is_socket(fd, family, type, (type == SOCK_DGRAM) ? -1 : 0); 3238 r = sd_is_socket(fd, family, type, (type == SOCK_DGRAM) ? -1 : 0);
3239 if (r < 0) 3239 if (r < 0)
3240 { 3240 {
3241 ERR("socket %d is not of family=%d, type=%d", fd, family, type); 3241 ERR("socket " SOCKET_FMT " is not of family=%d, type=%d", fd, family, type);
3242 return EINVAL; 3242 return EINVAL;
3243 } 3243 }
3244 if ((type == SOCK_DGRAM) && (listening)) *listening = EINA_FALSE; 3244 if ((type == SOCK_DGRAM) && (listening)) *listening = EINA_FALSE;
@@ -3248,7 +3248,7 @@ efl_net_ip_socket_activate_check(const char *address, int family, int type, Eina
3248 if (getsockname(fd, (struct sockaddr *)&sock_addr, &addrlen) != 0) 3248 if (getsockname(fd, (struct sockaddr *)&sock_addr, &addrlen) != 0)
3249 { 3249 {
3250 err = efl_net_socket_error_get(); 3250 err = efl_net_socket_error_get();
3251 ERR("could not query socket=%d name: %s", fd, eina_error_msg_get(err)); 3251 ERR("could not query socket=" SOCKET_FMT " name: %s", fd, eina_error_msg_get(err));
3252 return err; 3252 return err;
3253 } 3253 }
3254 3254
@@ -3285,7 +3285,7 @@ efl_net_ip_socket_activate_check(const char *address, int family, int type, Eina
3285 want_addr.ss_family = family; 3285 want_addr.ss_family = family;
3286 if (want_addr.ss_family != sock_addr.ss_family) 3286 if (want_addr.ss_family != sock_addr.ss_family)
3287 { 3287 {
3288 ERR("socket %d family=%d differs from wanted %d", fd, sock_addr.ss_family, want_addr.ss_family); 3288 ERR("socket " SOCKET_FMT " family=%d differs from wanted %d", fd, sock_addr.ss_family, want_addr.ss_family);
3289 free(str); 3289 free(str);
3290 return EINVAL; 3290 return EINVAL;
3291 } 3291 }
@@ -3324,7 +3324,7 @@ efl_net_ip_socket_activate_check(const char *address, int family, int type, Eina
3324 char buf[INET6_ADDRSTRLEN + sizeof("[]:65536")] = ""; 3324 char buf[INET6_ADDRSTRLEN + sizeof("[]:65536")] = "";
3325 3325
3326 efl_net_ip_port_fmt(buf, sizeof(buf), (struct sockaddr *)&sock_addr); 3326 efl_net_ip_port_fmt(buf, sizeof(buf), (struct sockaddr *)&sock_addr);
3327 ERR("socket %d address %s differs from wanted %s", fd, buf, address); 3327 ERR("socket " SOCKET_FMT " address %s differs from wanted %s", fd, buf, address);
3328 free(str); 3328 free(str);
3329 return EINVAL; 3329 return EINVAL;
3330 } 3330 }
@@ -3601,7 +3601,7 @@ _efl_net_connect_async_run(void *data, Ecore_Thread *thread EINA_UNUSED)
3601 efl_net_ip_port_fmt(buf, sizeof(buf), d->addr); 3601 efl_net_ip_port_fmt(buf, sizeof(buf), d->addr);
3602 } 3602 }
3603 3603
3604 DBG("connecting fd=%d to %s", d->sockfd, buf); 3604 DBG("connecting fd=" SOCKET_FMT " to %s", d->sockfd, buf);
3605 3605
3606 r = connect(d->sockfd, d->addr, d->addrlen); 3606 r = connect(d->sockfd, d->addr, d->addrlen);
3607 if (r != 0) 3607 if (r != 0)
@@ -3614,11 +3614,11 @@ _efl_net_connect_async_run(void *data, Ecore_Thread *thread EINA_UNUSED)
3614 * won't close it again. 3614 * won't close it again.
3615 */ 3615 */
3616 closesocket(fd); 3616 closesocket(fd);
3617 DBG("connect(%d, %s) failed: %s", fd, buf, eina_error_msg_get(d->error)); 3617 DBG("connect(" SOCKET_FMT ", %s) failed: %s", fd, buf, eina_error_msg_get(d->error));
3618 return; 3618 return;
3619 } 3619 }
3620 3620
3621 DBG("connected fd=%d to %s", d->sockfd, buf); 3621 DBG("connected fd=" SOCKET_FMT " to %s", d->sockfd, buf);
3622} 3622}
3623 3623
3624static void 3624static void
@@ -3640,7 +3640,7 @@ _efl_net_connect_async_end(void *data, Ecore_Thread *thread EINA_UNUSED)
3640 if (flags < 0) 3640 if (flags < 0)
3641 { 3641 {
3642 d->error = errno; 3642 d->error = errno;
3643 ERR("fcntl(%d, F_GETFD): %s", d->sockfd, eina_error_msg_get(d->error)); 3643 ERR("fcntl(" SOCKET_FMT ", F_GETFD): %s", d->sockfd, eina_error_msg_get(d->error));
3644 closesocket(d->sockfd); 3644 closesocket(d->sockfd);
3645 d->sockfd = INVALID_SOCKET; 3645 d->sockfd = INVALID_SOCKET;
3646 } 3646 }
@@ -3650,7 +3650,7 @@ _efl_net_connect_async_end(void *data, Ecore_Thread *thread EINA_UNUSED)
3650 if (fcntl(d->sockfd, F_SETFD, flags) < 0) 3650 if (fcntl(d->sockfd, F_SETFD, flags) < 0)
3651 { 3651 {
3652 d->error = errno; 3652 d->error = errno;
3653 ERR("fcntl(%d, F_SETFD, %#x): %s", d->sockfd, flags, eina_error_msg_get(d->error)); 3653 ERR("fcntl(" SOCKET_FMT ", F_SETFD, %#x): %s", d->sockfd, flags, eina_error_msg_get(d->error));
3654 closesocket(d->sockfd); 3654 closesocket(d->sockfd);
3655 d->sockfd = INVALID_SOCKET; 3655 d->sockfd = INVALID_SOCKET;
3656 } 3656 }
@@ -3759,7 +3759,7 @@ typedef struct _Efl_Net_Ip_Connect_Async_Data
3759} Efl_Net_Ip_Connect_Async_Data; 3759} Efl_Net_Ip_Connect_Async_Data;
3760 3760
3761static Eina_Error 3761static Eina_Error
3762_efl_net_ip_connect(const struct addrinfo *addr, int *sockfd) 3762_efl_net_ip_connect(const struct addrinfo *addr, SOCKET *sockfd)
3763{ 3763{
3764 SOCKET fd = INVALID_SOCKET; 3764 SOCKET fd = INVALID_SOCKET;
3765 Eina_Error ret = 0; 3765 Eina_Error ret = 0;
@@ -3778,19 +3778,19 @@ _efl_net_ip_connect(const struct addrinfo *addr, int *sockfd)
3778 if (eina_log_domain_level_check(_ecore_con_log_dom, EINA_LOG_LEVEL_DBG)) 3778 if (eina_log_domain_level_check(_ecore_con_log_dom, EINA_LOG_LEVEL_DBG))
3779 { 3779 {
3780 if (efl_net_ip_port_fmt(buf, sizeof(buf), addr->ai_addr)) 3780 if (efl_net_ip_port_fmt(buf, sizeof(buf), addr->ai_addr))
3781 DBG("connect fd=%d to %s", fd, buf); 3781 DBG("connect fd=" SOCKET_FMT " to %s", fd, buf);
3782 } 3782 }
3783 3783
3784 r = connect(fd, addr->ai_addr, addr->ai_addrlen); 3784 r = connect(fd, addr->ai_addr, addr->ai_addrlen);
3785 if (r == 0) 3785 if (r == 0)
3786 { 3786 {
3787 DBG("connected fd=%d to %s", fd, buf); 3787 DBG("connected fd=" SOCKET_FMT " to %s", fd, buf);
3788 *sockfd = fd; 3788 *sockfd = fd;
3789 } 3789 }
3790 else 3790 else
3791 { 3791 {
3792 ret = efl_net_socket_error_get(); 3792 ret = efl_net_socket_error_get();
3793 DBG("couldn't connect fd=%d to %s: %s", fd, buf, eina_error_msg_get(ret)); 3793 DBG("couldn't connect fd=" SOCKET_FMT " to %s: %s", fd, buf, eina_error_msg_get(ret));
3794 closesocket(fd); 3794 closesocket(fd);
3795 } 3795 }
3796 EINA_THREAD_CLEANUP_POP(EINA_FALSE); /* we need sockfd on success */ 3796 EINA_THREAD_CLEANUP_POP(EINA_FALSE); /* we need sockfd on success */
@@ -3799,7 +3799,7 @@ _efl_net_ip_connect(const struct addrinfo *addr, int *sockfd)
3799} 3799}
3800 3800
3801static Eina_Error 3801static Eina_Error
3802_efl_net_ip_resolve_and_connect(const char *host, const char *port, int type, int protocol, int *sockfd, struct sockaddr *addr, socklen_t *p_addrlen) 3802_efl_net_ip_resolve_and_connect(const char *host, const char *port, int type, int protocol, SOCKET *sockfd, struct sockaddr *addr, socklen_t *p_addrlen)
3803{ 3803{
3804 struct addrinfo *results = NULL; 3804 struct addrinfo *results = NULL;
3805 struct addrinfo hints = { 3805 struct addrinfo hints = {
@@ -3939,7 +3939,7 @@ _efl_net_ip_connect_async_run_socks4_try(Efl_Net_Ip_Connect_Async_Data *d, const
3939 if (eina_log_domain_level_check(_ecore_con_log_dom, EINA_LOG_LEVEL_DBG)) 3939 if (eina_log_domain_level_check(_ecore_con_log_dom, EINA_LOG_LEVEL_DBG))
3940 { 3940 {
3941 if (efl_net_ip_port_fmt(buf, sizeof(buf), addrinfo->ai_addr)) 3941 if (efl_net_ip_port_fmt(buf, sizeof(buf), addrinfo->ai_addr))
3942 DBG("resolved address='%s' to %s. Connect using fd=%d socks4://%s:%s", d->address, buf, fd, proxy_host, proxy_port); 3942 DBG("resolved address='%s' to %s. Connect using fd=" SOCKET_FMT " socks4://%s:%s", d->address, buf, fd, proxy_host, proxy_port);
3943 } 3943 }
3944 3944
3945 request->port = a->sin_port; 3945 request->port = a->sin_port;
@@ -3949,7 +3949,7 @@ _efl_net_ip_connect_async_run_socks4_try(Efl_Net_Ip_Connect_Async_Data *d, const
3949 if (s != (ssize_t)request_len) 3949 if (s != (ssize_t)request_len)
3950 { 3950 {
3951 if (s == SOCKET_ERROR) 3951 if (s == SOCKET_ERROR)
3952 DBG("couldn't request connection to host=%s fd=%d socks4://%s:%s: %s", buf, fd, proxy_host, proxy_port, eina_error_msg_get(efl_net_socket_error_get())); 3952 DBG("couldn't request connection to host=%s fd=" SOCKET_FMT " socks4://%s:%s: %s", buf, fd, proxy_host, proxy_port, eina_error_msg_get(efl_net_socket_error_get()));
3953 else 3953 else
3954 DBG("couldn't send proxy request: need %zu, did %zd", request_len, s); 3954 DBG("couldn't send proxy request: need %zu, did %zd", request_len, s);
3955 } 3955 }
@@ -3960,14 +3960,14 @@ _efl_net_ip_connect_async_run_socks4_try(Efl_Net_Ip_Connect_Async_Data *d, const
3960 if (s != sizeof(reply)) 3960 if (s != sizeof(reply))
3961 { 3961 {
3962 if (s == SOCKET_ERROR) 3962 if (s == SOCKET_ERROR)
3963 DBG("couldn't recv reply of connection to host=%s fd=%d socks4://%s:%s: %s", buf, fd, proxy_host, proxy_port, eina_error_msg_get(efl_net_socket_error_get())); 3963 DBG("couldn't recv reply of connection to host=%s fd=" SOCKET_FMT " socks4://%s:%s: %s", buf, fd, proxy_host, proxy_port, eina_error_msg_get(efl_net_socket_error_get()));
3964 else 3964 else
3965 DBG("couldn't recv proxy reply: need %zu, did %zd", sizeof(reply), s); 3965 DBG("couldn't recv proxy reply: need %zu, did %zd", sizeof(reply), s);
3966 } 3966 }
3967 else 3967 else
3968 { 3968 {
3969 if (reply.status != EFL_NET_SOCKS4_REPLY_STATUS_GRANTED) 3969 if (reply.status != EFL_NET_SOCKS4_REPLY_STATUS_GRANTED)
3970 DBG("rejected connection to host=%s fd=%d socks4://%s:%s: reason=%#x", buf, fd, proxy_host, proxy_port, reply.status); 3970 DBG("rejected connection to host=%s fd=" SOCKET_FMT " socks4://%s:%s: reason=%#x", buf, fd, proxy_host, proxy_port, reply.status);
3971 else 3971 else
3972 { 3972 {
3973 memcpy(&d->addr, addrinfo->ai_addr, addrinfo->ai_addrlen); 3973 memcpy(&d->addr, addrinfo->ai_addr, addrinfo->ai_addrlen);
@@ -3975,7 +3975,7 @@ _efl_net_ip_connect_async_run_socks4_try(Efl_Net_Ip_Connect_Async_Data *d, const
3975 d->sockfd = fd; 3975 d->sockfd = fd;
3976 d->error = 0; 3976 d->error = 0;
3977 ret = EINA_TRUE; 3977 ret = EINA_TRUE;
3978 DBG("connected to host=%s fd=%d socks4://%s:%s", buf, fd, proxy_host, proxy_port); 3978 DBG("connected to host=%s fd=" SOCKET_FMT " socks4://%s:%s", buf, fd, proxy_host, proxy_port);
3979 } 3979 }
3980 } 3980 }
3981 } 3981 }
@@ -4121,7 +4121,7 @@ _efl_net_ip_connect_async_run_socks4a(Efl_Net_Ip_Connect_Async_Data *d, const ch
4121 goto end; 4121 goto end;
4122 } 4122 }
4123 4123
4124 DBG("connected fd=%d to socks4a://%s", fd, proxy); 4124 DBG("connected fd=" SOCKET_FMT " to socks4a://%s", fd, proxy);
4125 EINA_THREAD_CLEANUP_PUSH(_cleanup_close, &fd); 4125 EINA_THREAD_CLEANUP_PUSH(_cleanup_close, &fd);
4126 4126
4127 /* we just resolve the port number here */ 4127 /* we just resolve the port number here */
@@ -4206,7 +4206,7 @@ _efl_net_ip_connect_async_run_socks4a(Efl_Net_Ip_Connect_Async_Data *d, const ch
4206 } 4206 }
4207 EINA_THREAD_CLEANUP_POP(EINA_TRUE); /* freeaddrinfo(results) */ 4207 EINA_THREAD_CLEANUP_POP(EINA_TRUE); /* freeaddrinfo(results) */
4208 } 4208 }
4209 EINA_THREAD_CLEANUP_POP(d->sockfd == -1); /* we need fd only on success */ 4209 EINA_THREAD_CLEANUP_POP(d->sockfd == INVALID_SOCKET); /* we need fd only on success */
4210 end: 4210 end:
4211 EINA_THREAD_CLEANUP_POP(EINA_TRUE); /* free(str) */ 4211 EINA_THREAD_CLEANUP_POP(EINA_TRUE); /* free(str) */
4212} 4212}
@@ -4400,7 +4400,7 @@ _efl_net_ip_connect_async_run_socks5_auth_user_pass(SOCKET fd, const char *user,
4400 if (s != (ssize_t)len) 4400 if (s != (ssize_t)len)
4401 { 4401 {
4402 if (s == SOCKET_ERROR) 4402 if (s == SOCKET_ERROR)
4403 DBG("couldn't send user-password authentication to fd=%d %s://%s:%s: %s", fd, proxy_protocol, proxy_host, proxy_port, eina_error_msg_get(efl_net_socket_error_get())); 4403 DBG("couldn't send user-password authentication to fd=" SOCKET_FMT " %s://%s:%s: %s", fd, proxy_protocol, proxy_host, proxy_port, eina_error_msg_get(efl_net_socket_error_get()));
4404 else 4404 else
4405 DBG("couldn't send user-password authentication: need %zu, did %zd", len, s); 4405 DBG("couldn't send user-password authentication: need %zu, did %zd", len, s);
4406 } 4406 }
@@ -4412,7 +4412,7 @@ _efl_net_ip_connect_async_run_socks5_auth_user_pass(SOCKET fd, const char *user,
4412 if (s != (ssize_t)sizeof(reply)) 4412 if (s != (ssize_t)sizeof(reply))
4413 { 4413 {
4414 if (s == SOCKET_ERROR) 4414 if (s == SOCKET_ERROR)
4415 DBG("couldn't recv user-password authentication reply from fd=%d %s://%s:%s: %s", fd, proxy_protocol, proxy_host, proxy_port, eina_error_msg_get(efl_net_socket_error_get())); 4415 DBG("couldn't recv user-password authentication reply from fd=" SOCKET_FMT " %s://%s:%s: %s", fd, proxy_protocol, proxy_host, proxy_port, eina_error_msg_get(efl_net_socket_error_get()));
4416 else 4416 else
4417 DBG("couldn't recv user-password authentication reply: need %zu, did %zd", len, s); 4417 DBG("couldn't recv user-password authentication reply: need %zu, did %zd", len, s);
4418 } 4418 }
@@ -4422,7 +4422,7 @@ _efl_net_ip_connect_async_run_socks5_auth_user_pass(SOCKET fd, const char *user,
4422 DBG("proxy authentication failed user='%s' pass=%hhu (bytes) to proxy %s://%s:%s: reason=%#x", user, pass_len, proxy_protocol, proxy_host, proxy_port, reply[1]); 4422 DBG("proxy authentication failed user='%s' pass=%hhu (bytes) to proxy %s://%s:%s: reason=%#x", user, pass_len, proxy_protocol, proxy_host, proxy_port, reply[1]);
4423 else 4423 else
4424 { 4424 {
4425 DBG("successfully authenticated user=%s with proxy fd=%d %s://%s:%s", user, fd, proxy_protocol, proxy_host, proxy_port); 4425 DBG("successfully authenticated user=%s with proxy fd=" SOCKET_FMT " %s://%s:%s", user, fd, proxy_protocol, proxy_host, proxy_port);
4426 ret = EINA_TRUE; 4426 ret = EINA_TRUE;
4427 } 4427 }
4428 } 4428 }
@@ -4461,14 +4461,14 @@ _efl_net_ip_connect_async_run_socks5_try(Efl_Net_Ip_Connect_Async_Data *d, const
4461 if (eina_log_domain_level_check(_ecore_con_log_dom, EINA_LOG_LEVEL_DBG)) 4461 if (eina_log_domain_level_check(_ecore_con_log_dom, EINA_LOG_LEVEL_DBG))
4462 { 4462 {
4463 if (efl_net_ip_port_fmt(buf, sizeof(buf), addrinfo->ai_addr)) 4463 if (efl_net_ip_port_fmt(buf, sizeof(buf), addrinfo->ai_addr))
4464 DBG("resolved address='%s' to %s. Connect using fd=%d socks5://%s:%s", d->address, buf, fd, proxy_host, proxy_port); 4464 DBG("resolved address='%s' to %s. Connect using fd=" SOCKET_FMT " socks5://%s:%s", d->address, buf, fd, proxy_host, proxy_port);
4465 } 4465 }
4466 4466
4467 s = send(fd, &greeting, sizeof(greeting), MSG_NOSIGNAL); 4467 s = send(fd, &greeting, sizeof(greeting), MSG_NOSIGNAL);
4468 if (s != (ssize_t)sizeof(greeting)) 4468 if (s != (ssize_t)sizeof(greeting))
4469 { 4469 {
4470 if (s == SOCKET_ERROR) 4470 if (s == SOCKET_ERROR)
4471 DBG("couldn't request connection to host=%s fd=%d socks5://%s:%s: %s", buf, fd, proxy_host, proxy_port, eina_error_msg_get(efl_net_socket_error_get())); 4471 DBG("couldn't request connection to host=%s fd=" SOCKET_FMT " socks5://%s:%s: %s", buf, fd, proxy_host, proxy_port, eina_error_msg_get(efl_net_socket_error_get()));
4472 else 4472 else
4473 DBG("couldn't send proxy request: need %zu, did %zd", sizeof(greeting), s); 4473 DBG("couldn't send proxy request: need %zu, did %zd", sizeof(greeting), s);
4474 } 4474 }
@@ -4479,14 +4479,14 @@ _efl_net_ip_connect_async_run_socks5_try(Efl_Net_Ip_Connect_Async_Data *d, const
4479 if (s != sizeof(greeting_reply)) 4479 if (s != sizeof(greeting_reply))
4480 { 4480 {
4481 if (s == SOCKET_ERROR) 4481 if (s == SOCKET_ERROR)
4482 DBG("couldn't recv greeting reply of connection to host=%s fd=%d socks5://%s:%s: %s", buf, fd, proxy_host, proxy_port, eina_error_msg_get(efl_net_socket_error_get())); 4482 DBG("couldn't recv greeting reply of connection to host=%s fd=" SOCKET_FMT " socks5://%s:%s: %s", buf, fd, proxy_host, proxy_port, eina_error_msg_get(efl_net_socket_error_get()));
4483 else 4483 else
4484 DBG("couldn't recv proxy reply: need %zu, did %zd", sizeof(greeting_reply), s); 4484 DBG("couldn't recv proxy reply: need %zu, did %zd", sizeof(greeting_reply), s);
4485 } 4485 }
4486 else 4486 else
4487 { 4487 {
4488 if (greeting_reply.auth != greeting.auths[0]) 4488 if (greeting_reply.auth != greeting.auths[0])
4489 DBG("proxy server rejected authentication %#x trying connection to host=%s fd=%d socks5://%s:%s", greeting.auths[0], buf, fd, proxy_host, proxy_port); 4489 DBG("proxy server rejected authentication %#x trying connection to host=%s fd=" SOCKET_FMT " socks5://%s:%s", greeting.auths[0], buf, fd, proxy_host, proxy_port);
4490 else 4490 else
4491 { 4491 {
4492 if ((greeting_reply.auth == EFL_NET_SOCKS5_AUTH_USER_PASS) && 4492 if ((greeting_reply.auth == EFL_NET_SOCKS5_AUTH_USER_PASS) &&
@@ -4508,7 +4508,7 @@ _efl_net_ip_connect_async_run_socks5_try(Efl_Net_Ip_Connect_Async_Data *d, const
4508 if (s != (ssize_t)request_len) 4508 if (s != (ssize_t)request_len)
4509 { 4509 {
4510 if (s == SOCKET_ERROR) 4510 if (s == SOCKET_ERROR)
4511 DBG("couldn't request connection to host=%s fd=%d socks5://%s:%s: %s", buf, fd, proxy_host, proxy_port, eina_error_msg_get(efl_net_socket_error_get())); 4511 DBG("couldn't request connection to host=%s fd=" SOCKET_FMT " socks5://%s:%s: %s", buf, fd, proxy_host, proxy_port, eina_error_msg_get(efl_net_socket_error_get()));
4512 else 4512 else
4513 DBG("couldn't send proxy request: need %zu, did %zd", request_len, s); 4513 DBG("couldn't send proxy request: need %zu, did %zd", request_len, s);
4514 } 4514 }
@@ -4519,14 +4519,14 @@ _efl_net_ip_connect_async_run_socks5_try(Efl_Net_Ip_Connect_Async_Data *d, const
4519 if (s != sizeof(reply)) 4519 if (s != sizeof(reply))
4520 { 4520 {
4521 if (s == SOCKET_ERROR) 4521 if (s == SOCKET_ERROR)
4522 DBG("couldn't recv reply of connection to host=%s fd=%d socks5://%s:%s: %s", buf, fd, proxy_host, proxy_port, eina_error_msg_get(efl_net_socket_error_get())); 4522 DBG("couldn't recv reply of connection to host=%s fd=" SOCKET_FMT " socks5://%s:%s: %s", buf, fd, proxy_host, proxy_port, eina_error_msg_get(efl_net_socket_error_get()));
4523 else 4523 else
4524 DBG("couldn't recv proxy reply: need %zu, did %zd", sizeof(reply), s); 4524 DBG("couldn't recv proxy reply: need %zu, did %zd", sizeof(reply), s);
4525 } 4525 }
4526 else 4526 else
4527 { 4527 {
4528 if (reply.base.status != EFL_NET_SOCKS5_REPLY_STATUS_GRANTED) 4528 if (reply.base.status != EFL_NET_SOCKS5_REPLY_STATUS_GRANTED)
4529 DBG("rejected IPv4 connection to host=%s fd=%d socks5://%s:%s: reason=%#x", buf, fd, proxy_host, proxy_port, reply.base.status); 4529 DBG("rejected IPv4 connection to host=%s fd=" SOCKET_FMT " socks5://%s:%s: reason=%#x", buf, fd, proxy_host, proxy_port, reply.base.status);
4530 else 4530 else
4531 { 4531 {
4532 memcpy(&d->addr, addrinfo->ai_addr, addrinfo->ai_addrlen); 4532 memcpy(&d->addr, addrinfo->ai_addr, addrinfo->ai_addrlen);
@@ -4534,7 +4534,7 @@ _efl_net_ip_connect_async_run_socks5_try(Efl_Net_Ip_Connect_Async_Data *d, const
4534 d->sockfd = fd; 4534 d->sockfd = fd;
4535 d->error = 0; 4535 d->error = 0;
4536 ret = EINA_TRUE; 4536 ret = EINA_TRUE;
4537 DBG("connected IPv4 to host=%s fd=%d socks5://%s:%s", buf, fd, proxy_host, proxy_port); 4537 DBG("connected IPv4 to host=%s fd=" SOCKET_FMT " socks5://%s:%s", buf, fd, proxy_host, proxy_port);
4538 } 4538 }
4539 } 4539 }
4540 } 4540 }
@@ -4545,14 +4545,14 @@ _efl_net_ip_connect_async_run_socks5_try(Efl_Net_Ip_Connect_Async_Data *d, const
4545 if (s != sizeof(reply)) 4545 if (s != sizeof(reply))
4546 { 4546 {
4547 if (s == SOCKET_ERROR) 4547 if (s == SOCKET_ERROR)
4548 DBG("couldn't recv reply of connection to host=%s fd=%d socks5://%s:%s: %s", buf, fd, proxy_host, proxy_port, eina_error_msg_get(efl_net_socket_error_get())); 4548 DBG("couldn't recv reply of connection to host=%s fd=" SOCKET_FMT " socks5://%s:%s: %s", buf, fd, proxy_host, proxy_port, eina_error_msg_get(efl_net_socket_error_get()));
4549 else 4549 else
4550 DBG("couldn't recv proxy reply: need %zu, did %zd", sizeof(reply), s); 4550 DBG("couldn't recv proxy reply: need %zu, did %zd", sizeof(reply), s);
4551 } 4551 }
4552 else 4552 else
4553 { 4553 {
4554 if (reply.base.status != EFL_NET_SOCKS5_REPLY_STATUS_GRANTED) 4554 if (reply.base.status != EFL_NET_SOCKS5_REPLY_STATUS_GRANTED)
4555 DBG("rejected IPv6 connection to host=%s fd=%d socks5://%s:%s: reason=%#x", buf, fd, proxy_host, proxy_port, reply.base.status); 4555 DBG("rejected IPv6 connection to host=%s fd=" SOCKET_FMT " socks5://%s:%s: reason=%#x", buf, fd, proxy_host, proxy_port, reply.base.status);
4556 else 4556 else
4557 { 4557 {
4558 memcpy(&d->addr, addrinfo->ai_addr, addrinfo->ai_addrlen); 4558 memcpy(&d->addr, addrinfo->ai_addr, addrinfo->ai_addrlen);
@@ -4560,7 +4560,7 @@ _efl_net_ip_connect_async_run_socks5_try(Efl_Net_Ip_Connect_Async_Data *d, const
4560 d->sockfd = fd; 4560 d->sockfd = fd;
4561 d->error = 0; 4561 d->error = 0;
4562 ret = EINA_TRUE; 4562 ret = EINA_TRUE;
4563 DBG("connected IPv6 to host=%s fd=%d socks5://%s:%s", buf, fd, proxy_host, proxy_port); 4563 DBG("connected IPv6 to host=%s fd=" SOCKET_FMT " socks5://%s:%s", buf, fd, proxy_host, proxy_port);
4564 } 4564 }
4565 } 4565 }
4566 } 4566 }
@@ -4690,14 +4690,14 @@ _efl_net_ip_connect_async_run_socks5h(Efl_Net_Ip_Connect_Async_Data *d, const ch
4690 goto end; 4690 goto end;
4691 } 4691 }
4692 4692
4693 DBG("connected fd=%d to socks5h://%s", fd, proxy); 4693 DBG("connected fd=" SOCKET_FMT " to socks5h://%s", fd, proxy);
4694 EINA_THREAD_CLEANUP_PUSH(_cleanup_close, &fd); 4694 EINA_THREAD_CLEANUP_PUSH(_cleanup_close, &fd);
4695 4695
4696 s = send(fd, &greeting, sizeof(greeting), MSG_NOSIGNAL); 4696 s = send(fd, &greeting, sizeof(greeting), MSG_NOSIGNAL);
4697 if (s != (ssize_t)sizeof(greeting)) 4697 if (s != (ssize_t)sizeof(greeting))
4698 { 4698 {
4699 if (s == SOCKET_ERROR) 4699 if (s == SOCKET_ERROR)
4700 DBG("couldn't request connection to host=%s:%s fd=%d socks5h://%s:%s: %s", host, port, fd, proxy_host, proxy_port, eina_error_msg_get(efl_net_socket_error_get())); 4700 DBG("couldn't request connection to host=%s:%s fd=" SOCKET_FMT " socks5h://%s:%s: %s", host, port, fd, proxy_host, proxy_port, eina_error_msg_get(efl_net_socket_error_get()));
4701 else 4701 else
4702 DBG("couldn't send proxy request: need %zu, did %zd", sizeof(greeting), s); 4702 DBG("couldn't send proxy request: need %zu, did %zd", sizeof(greeting), s);
4703 } 4703 }
@@ -4708,14 +4708,14 @@ _efl_net_ip_connect_async_run_socks5h(Efl_Net_Ip_Connect_Async_Data *d, const ch
4708 if (s != sizeof(greeting_reply)) 4708 if (s != sizeof(greeting_reply))
4709 { 4709 {
4710 if (s == SOCKET_ERROR) 4710 if (s == SOCKET_ERROR)
4711 DBG("couldn't recv greeting reply of connection to host=%s:%s fd=%d socks5h://%s:%s: %s", host, port, fd, proxy_host, proxy_port, eina_error_msg_get(efl_net_socket_error_get())); 4711 DBG("couldn't recv greeting reply of connection to host=%s:%s fd=" SOCKET_FMT " socks5h://%s:%s: %s", host, port, fd, proxy_host, proxy_port, eina_error_msg_get(efl_net_socket_error_get()));
4712 else 4712 else
4713 DBG("couldn't recv proxy reply: need %zu, did %zd", sizeof(greeting_reply), s); 4713 DBG("couldn't recv proxy reply: need %zu, did %zd", sizeof(greeting_reply), s);
4714 } 4714 }
4715 else 4715 else
4716 { 4716 {
4717 if (greeting_reply.auth != greeting.auths[0]) 4717 if (greeting_reply.auth != greeting.auths[0])
4718 DBG("proxy server rejected authentication %#x trying connection to host=%s:%s fd=%d socks5h://%s:%s", greeting.auths[0], host, port, fd, proxy_host, proxy_port); 4718 DBG("proxy server rejected authentication %#x trying connection to host=%s:%s fd=" SOCKET_FMT " socks5h://%s:%s", greeting.auths[0], host, port, fd, proxy_host, proxy_port);
4719 else 4719 else
4720 { 4720 {
4721 if ((greeting_reply.auth == EFL_NET_SOCKS5_AUTH_USER_PASS) && 4721 if ((greeting_reply.auth == EFL_NET_SOCKS5_AUTH_USER_PASS) &&
@@ -4773,7 +4773,7 @@ _efl_net_ip_connect_async_run_socks5h(Efl_Net_Ip_Connect_Async_Data *d, const ch
4773 if (s != (ssize_t)request_len) 4773 if (s != (ssize_t)request_len)
4774 { 4774 {
4775 if (s == SOCKET_ERROR) 4775 if (s == SOCKET_ERROR)
4776 DBG("couldn't request connection to host=%s:%s fd=%d socks5h://%s:%s: %s", host, port, fd, proxy_host, proxy_port, eina_error_msg_get(efl_net_socket_error_get())); 4776 DBG("couldn't request connection to host=%s:%s fd=" SOCKET_FMT " socks5h://%s:%s: %s", host, port, fd, proxy_host, proxy_port, eina_error_msg_get(efl_net_socket_error_get()));
4777 else 4777 else
4778 DBG("couldn't send proxy request: need %zu, did %zd", request_len, s); 4778 DBG("couldn't send proxy request: need %zu, did %zd", request_len, s);
4779 } 4779 }
@@ -4785,14 +4785,14 @@ _efl_net_ip_connect_async_run_socks5h(Efl_Net_Ip_Connect_Async_Data *d, const ch
4785 if (s != sizeof(reply)) 4785 if (s != sizeof(reply))
4786 { 4786 {
4787 if (s == SOCKET_ERROR) 4787 if (s == SOCKET_ERROR)
4788 DBG("couldn't recv reply of connection to host=%s:%s fd=%d socks5h://%s:%s: %s", host, port, fd, proxy_host, proxy_port, eina_error_msg_get(efl_net_socket_error_get())); 4788 DBG("couldn't recv reply of connection to host=%s:%s fd=" SOCKET_FMT " socks5h://%s:%s: %s", host, port, fd, proxy_host, proxy_port, eina_error_msg_get(efl_net_socket_error_get()));
4789 else 4789 else
4790 DBG("couldn't recv proxy reply: need %zu, did %zd", sizeof(reply), s); 4790 DBG("couldn't recv proxy reply: need %zu, did %zd", sizeof(reply), s);
4791 } 4791 }
4792 else 4792 else
4793 { 4793 {
4794 if (reply.status != EFL_NET_SOCKS5_REPLY_STATUS_GRANTED) 4794 if (reply.status != EFL_NET_SOCKS5_REPLY_STATUS_GRANTED)
4795 DBG("rejected connection to host=%s:%s fd=%d socks5h://%s:%s: reason=%#x", host, port, fd, proxy_host, proxy_port, reply.status); 4795 DBG("rejected connection to host=%s:%s fd=" SOCKET_FMT " socks5h://%s:%s: reason=%#x", host, port, fd, proxy_host, proxy_port, reply.status);
4796 else if (reply.address_type == EFL_NET_SOCKS5_ADDRESS_TYPE_IPV4) 4796 else if (reply.address_type == EFL_NET_SOCKS5_ADDRESS_TYPE_IPV4)
4797 { 4797 {
4798 Efl_Net_Socks5_Address_Ipv4 ipv4; 4798 Efl_Net_Socks5_Address_Ipv4 ipv4;
@@ -4801,7 +4801,7 @@ _efl_net_ip_connect_async_run_socks5h(Efl_Net_Ip_Connect_Async_Data *d, const ch
4801 if (s != sizeof(ipv4)) 4801 if (s != sizeof(ipv4))
4802 { 4802 {
4803 if (s == SOCKET_ERROR) 4803 if (s == SOCKET_ERROR)
4804 DBG("couldn't recv ipv4 of connection to host=%s:%s fd=%d socks5h://%s:%s: %s", host, port, fd, proxy_host, proxy_port, eina_error_msg_get(efl_net_socket_error_get())); 4804 DBG("couldn't recv ipv4 of connection to host=%s:%s fd=" SOCKET_FMT " socks5h://%s:%s: %s", host, port, fd, proxy_host, proxy_port, eina_error_msg_get(efl_net_socket_error_get()));
4805 else 4805 else
4806 DBG("couldn't recv proxy ipv4: need %zu, did %zd", sizeof(ipv4), s); 4806 DBG("couldn't recv proxy ipv4: need %zu, did %zd", sizeof(ipv4), s);
4807 } 4807 }
@@ -4813,7 +4813,7 @@ _efl_net_ip_connect_async_run_socks5h(Efl_Net_Ip_Connect_Async_Data *d, const ch
4813 d->addrlen = sizeof(struct sockaddr_in); 4813 d->addrlen = sizeof(struct sockaddr_in);
4814 d->sockfd = fd; 4814 d->sockfd = fd;
4815 d->error = 0; 4815 d->error = 0;
4816 DBG("connected IPv4 to host=%s:%s fd=%d socks5h://%s:%s", host, port, fd, proxy_host, proxy_port); 4816 DBG("connected IPv4 to host=%s:%s fd=" SOCKET_FMT " socks5h://%s:%s", host, port, fd, proxy_host, proxy_port);
4817 } 4817 }
4818 } 4818 }
4819 else if (reply.address_type == EFL_NET_SOCKS5_ADDRESS_TYPE_IPV6) 4819 else if (reply.address_type == EFL_NET_SOCKS5_ADDRESS_TYPE_IPV6)
@@ -4824,7 +4824,7 @@ _efl_net_ip_connect_async_run_socks5h(Efl_Net_Ip_Connect_Async_Data *d, const ch
4824 if (s != sizeof(ipv6)) 4824 if (s != sizeof(ipv6))
4825 { 4825 {
4826 if (s == SOCKET_ERROR) 4826 if (s == SOCKET_ERROR)
4827 DBG("couldn't recv ipv6 of connection to host=%s:%s fd=%d socks5h://%s:%s: %s", host, port, fd, proxy_host, proxy_port, eina_error_msg_get(efl_net_socket_error_get())); 4827 DBG("couldn't recv ipv6 of connection to host=%s:%s fd=" SOCKET_FMT " socks5h://%s:%s: %s", host, port, fd, proxy_host, proxy_port, eina_error_msg_get(efl_net_socket_error_get()));
4828 else 4828 else
4829 DBG("couldn't recv proxy ipv6: need %zu, did %zd", sizeof(ipv6), s); 4829 DBG("couldn't recv proxy ipv6: need %zu, did %zd", sizeof(ipv6), s);
4830 } 4830 }
@@ -4836,13 +4836,13 @@ _efl_net_ip_connect_async_run_socks5h(Efl_Net_Ip_Connect_Async_Data *d, const ch
4836 d->addrlen = sizeof(struct sockaddr_in); 4836 d->addrlen = sizeof(struct sockaddr_in);
4837 d->sockfd = fd; 4837 d->sockfd = fd;
4838 d->error = 0; 4838 d->error = 0;
4839 DBG("connected IPv6 to host=%s:%s fd=%d socks5h://%s:%s", host, port, fd, proxy_host, proxy_port); 4839 DBG("connected IPv6 to host=%s:%s fd=" SOCKET_FMT " socks5h://%s:%s", host, port, fd, proxy_host, proxy_port);
4840 } 4840 }
4841 } 4841 }
4842 else 4842 else
4843 { 4843 {
4844 /* most proxy servers will return a failure instead of this, but let's guard and log */ 4844 /* most proxy servers will return a failure instead of this, but let's guard and log */
4845 DBG("couldn't resolve host %s:%s fd=%d socks5h://%s:%s", host, port, fd, proxy_host, proxy_port); 4845 DBG("couldn't resolve host %s:%s fd=" SOCKET_FMT " socks5h://%s:%s", host, port, fd, proxy_host, proxy_port);
4846 } 4846 }
4847 } 4847 }
4848 } 4848 }
@@ -4857,7 +4857,7 @@ _efl_net_ip_connect_async_run_socks5h(Efl_Net_Ip_Connect_Async_Data *d, const ch
4857 } 4857 }
4858 } 4858 }
4859 } 4859 }
4860 EINA_THREAD_CLEANUP_POP(d->sockfd == -1); /* we need fd only on success */ 4860 EINA_THREAD_CLEANUP_POP(d->sockfd == INVALID_SOCKET); /* we need fd only on success */
4861 end: 4861 end:
4862 EINA_THREAD_CLEANUP_POP(EINA_TRUE); /* free(str) */ 4862 EINA_THREAD_CLEANUP_POP(EINA_TRUE); /* free(str) */
4863} 4863}
@@ -5044,7 +5044,7 @@ _efl_net_ip_connect_async_end(void *data, Ecore_Thread *thread EINA_UNUSED)
5044 if (flags < 0) 5044 if (flags < 0)
5045 { 5045 {
5046 d->error = errno; 5046 d->error = errno;
5047 ERR("fcntl(%d, F_GETFD): %s", d->sockfd, strerror(errno)); 5047 ERR("fcntl(" SOCKET_FMT ", F_GETFD): %s", d->sockfd, strerror(errno));
5048 closesocket(d->sockfd); 5048 closesocket(d->sockfd);
5049 d->sockfd = INVALID_SOCKET; 5049 d->sockfd = INVALID_SOCKET;
5050 } 5050 }
@@ -5054,7 +5054,7 @@ _efl_net_ip_connect_async_end(void *data, Ecore_Thread *thread EINA_UNUSED)
5054 if (fcntl(d->sockfd, F_SETFD, flags) < 0) 5054 if (fcntl(d->sockfd, F_SETFD, flags) < 0)
5055 { 5055 {
5056 d->error = errno; 5056 d->error = errno;
5057 ERR("fcntl(%d, F_SETFD, %#x): %s", d->sockfd, flags, strerror(errno)); 5057 ERR("fcntl(" SOCKET_FMT ", F_SETFD, %#x): %s", d->sockfd, flags, strerror(errno));
5058 closesocket(d->sockfd); 5058 closesocket(d->sockfd);
5059 d->sockfd = INVALID_SOCKET; 5059 d->sockfd = INVALID_SOCKET;
5060 } 5060 }
diff --git a/src/lib/ecore_con/ecore_con_private.h b/src/lib/ecore_con/ecore_con_private.h
index f222656ee2..aa1b81925c 100644
--- a/src/lib/ecore_con/ecore_con_private.h
+++ b/src/lib/ecore_con/ecore_con_private.h
@@ -391,9 +391,31 @@ void ecore_con_mempool_shutdown(void);
391#ifndef INVALID_SOCKET 391#ifndef INVALID_SOCKET
392#define INVALID_SOCKET -1 392#define INVALID_SOCKET -1
393#endif 393#endif
394#ifndef SOCKET_TO_LOOP_FD
395#define SOCKET_TO_LOOP_FD(sock) ((int)sock)
396#endif
394#ifndef _WIN32 397#ifndef _WIN32
395#define closesocket(fd) close(fd) 398#define closesocket(fd) close(fd)
396#define SOCKET int 399#define SOCKET int
400#define SOCKET_FMT "%d"
401#else
402#define SOCKET_FMT "%u"
403#endif
404
405
406/*
407 * This define will force SOCKET to be 'unsigned long', this will
408 * force compile to emit errors when assuming "int"/"%d", which is the
409 * case on UNIX but not on Windows.
410 */
411//#define EFL_NET_CHECK_SOCKET_TYPE 1
412#if EFL_NET_CHECK_SOCKET_TYPE
413#undef SOCKET
414#undef SOCKET_FMT
415#undef INVALID_SOCKET
416#define SOCKET unsigned long
417#define SOCKET_FMT "%lu"
418#define INVALID_SOCKET ((SOCKET)-1)
397#endif 419#endif
398 420
399/* some platforms do not have AI_V4MAPPED, then define to 0 so bitwise OR won't be changed */ 421/* some platforms do not have AI_V4MAPPED, then define to 0 so bitwise OR won't be changed */
@@ -486,7 +508,7 @@ Ecore_Thread *efl_net_ip_resolve_async_new(const char *host, const char *port, c
486 * 508 *
487 * @internal 509 * @internal
488 */ 510 */
489typedef void (*Efl_Net_Connect_Async_Cb)(void *data, const struct sockaddr *addr, socklen_t addrlen, int sockfd, Eina_Error error); 511typedef void (*Efl_Net_Connect_Async_Cb)(void *data, const struct sockaddr *addr, socklen_t addrlen, SOCKET sockfd, Eina_Error error);
490 512
491/** 513/**
492 * @brief asynchronously create a socket and connect to the address. 514 * @brief asynchronously create a socket and connect to the address.
diff --git a/src/lib/ecore_con/efl_net_dialer_http.c b/src/lib/ecore_con/efl_net_dialer_http.c
index 4c3fdad554..36409dff25 100644
--- a/src/lib/ecore_con/efl_net_dialer_http.c
+++ b/src/lib/ecore_con/efl_net_dialer_http.c
@@ -377,10 +377,10 @@ _efl_net_dialer_http_curlm_event_fd_read(void *data, const Efl_Event *event)
377 SOCKET fd = efl_loop_fd_get(event->object); 377 SOCKET fd = efl_loop_fd_get(event->object);
378 CURLMcode r; 378 CURLMcode r;
379 379
380 ERR("XXX socket=%d CURL_CSELECT_IN", fd); 380 ERR("XXX socket=" SOCKET_FMT " CURL_CSELECT_IN", fd);
381 r = curl_multi_socket_action(cm->multi, fd, CURL_CSELECT_IN, &cm->running); 381 r = curl_multi_socket_action(cm->multi, fd, CURL_CSELECT_IN, &cm->running);
382 if (r != CURLM_OK) 382 if (r != CURLM_OK)
383 ERR("socket action CURL_CSELECT_IN fd=%d failed: %s", fd, curl_multi_strerror(r)); 383 ERR("socket action CURL_CSELECT_IN fd=" SOCKET_FMT " failed: %s", fd, curl_multi_strerror(r));
384 384
385 _efl_net_dialer_http_curlm_check(cm); 385 _efl_net_dialer_http_curlm_check(cm);
386} 386}
@@ -392,10 +392,10 @@ _efl_net_dialer_http_curlm_event_fd_write(void *data, const Efl_Event *event)
392 SOCKET fd = efl_loop_fd_get(event->object); 392 SOCKET fd = efl_loop_fd_get(event->object);
393 CURLMcode r; 393 CURLMcode r;
394 394
395 ERR("XXX socket=%d CURL_CSELECT_OUT", fd); 395 ERR("XXX socket=" SOCKET_FMT " CURL_CSELECT_OUT", fd);
396 r = curl_multi_socket_action(cm->multi, fd, CURL_CSELECT_OUT, &cm->running); 396 r = curl_multi_socket_action(cm->multi, fd, CURL_CSELECT_OUT, &cm->running);
397 if (r != CURLM_OK) 397 if (r != CURLM_OK)
398 ERR("socket action CURL_CSELECT_OUT fd=%d failed: %s", fd, curl_multi_strerror(r)); 398 ERR("socket action CURL_CSELECT_OUT fd=" SOCKET_FMT " failed: %s", fd, curl_multi_strerror(r));
399 399
400 _efl_net_dialer_http_curlm_check(cm); 400 _efl_net_dialer_http_curlm_check(cm);
401} 401}
@@ -472,7 +472,7 @@ _efl_net_dialer_http_curlm_socket_manage(CURL *e, curl_socket_t fd, int what, vo
472 efl_key_data_set(fdhandler, "curl_flags", (void *)(intptr_t)what); 472 efl_key_data_set(fdhandler, "curl_flags", (void *)(intptr_t)what);
473 } 473 }
474 474
475 ERR("XXX finished manage fd=%d, what=%#x, cm=%p, fdhandler=%p", fd, what, cm, fdhandler); 475 ERR("XXX finished manage fd=" SOCKET_FMT ", what=%#x, cm=%p, fdhandler=%p", fd, what, cm, fdhandler);
476 476
477 return 0; 477 return 0;
478} 478}
@@ -494,7 +494,7 @@ _efl_net_dialer_http_curlm_event_fd(void *data, Ecore_Fd_Handler *fdhandler)
494 fd = ecore_main_fd_handler_fd_get(fdhandler); 494 fd = ecore_main_fd_handler_fd_get(fdhandler);
495 r = curl_multi_socket_action(cm->multi, fd, flags, &cm->running); 495 r = curl_multi_socket_action(cm->multi, fd, flags, &cm->running);
496 if (r != CURLM_OK) 496 if (r != CURLM_OK)
497 ERR("socket action %#x fd=%d failed: %s", flags, fd, curl_multi_strerror(r)); 497 ERR("socket action %#x fd=" SOCKET_FMT " failed: %s", flags, fd, curl_multi_strerror(r));
498 498
499 _efl_net_dialer_http_curlm_check(cm); 499 _efl_net_dialer_http_curlm_check(cm);
500 500
@@ -540,8 +540,8 @@ _efl_net_dialer_http_curlm_socket_manage(CURL *e, curl_socket_t fd, int what, vo
540 } 540 }
541 } 541 }
542 542
543 DBG("dialer=%p fdhandler=%p, fd=%d, curl_easy=%p, flags=%#x", 543 DBG("dialer=%p fdhandler=%p, fd=" SOCKET_FMT ", curl_easy=%p, flags=%#x",
544 dialer, pd->fdhandler, fd, e, what); 544 dialer, pd->fdhandler, (SOCKET)fd, e, what);
545 545
546 return 0; 546 return 0;
547} 547}
@@ -1113,7 +1113,7 @@ _efl_net_dialer_http_socket_open(void *data, curlsocktype purpose EINA_UNUSED, s
1113 ERR("could not create curl socket family=%d, type=%d, protocol=%d", 1113 ERR("could not create curl socket family=%d, type=%d, protocol=%d",
1114 addr->family, addr->socktype, addr->protocol); 1114 addr->family, addr->socktype, addr->protocol);
1115 else 1115 else
1116 DBG("socket(%d, %d, %d) = %d", 1116 DBG("socket(%d, %d, %d) = " SOCKET_FMT,
1117 addr->family, addr->socktype, addr->protocol, pd->fd); 1117 addr->family, addr->socktype, addr->protocol, pd->fd);
1118 1118
1119 return pd->fd; 1119 return pd->fd;
@@ -1641,7 +1641,7 @@ _efl_net_dialer_http_efl_io_writer_write(Eo *o, Efl_Net_Dialer_Http_Data *pd, Ei
1641 if (rm != CURLM_OK) 1641 if (rm != CURLM_OK)
1642 { 1642 {
1643 err = _curlcode_to_eina_error(rm); 1643 err = _curlcode_to_eina_error(rm);
1644 ERR("dialer=%p could not trigger socket=%d (fdhandler=%p) action: %s", 1644 ERR("dialer=%p could not trigger socket=" SOCKET_FMT " (fdhandler=%p) action: %s",
1645 o, pd->fd, pd->fdhandler, eina_error_msg_get(err)); 1645 o, pd->fd, pd->fdhandler, eina_error_msg_get(err));
1646 goto error; 1646 goto error;
1647 } 1647 }
@@ -1763,7 +1763,7 @@ _efl_net_dialer_http_efl_io_closer_close_on_exec_set(Eo *o EINA_UNUSED, Efl_Net_
1763 flags = fcntl(pd->fd, F_GETFD); 1763 flags = fcntl(pd->fd, F_GETFD);
1764 if (flags < 0) 1764 if (flags < 0)
1765 { 1765 {
1766 ERR("fcntl(%d, F_GETFD): %s", pd->fd, strerror(errno)); 1766 ERR("fcntl(" SOCKET_FMT ", F_GETFD): %s", pd->fd, strerror(errno));
1767 pd->close_on_exec = old; 1767 pd->close_on_exec = old;
1768 return EINA_FALSE; 1768 return EINA_FALSE;
1769 } 1769 }
@@ -1773,7 +1773,7 @@ _efl_net_dialer_http_efl_io_closer_close_on_exec_set(Eo *o EINA_UNUSED, Efl_Net_
1773 flags &= (~FD_CLOEXEC); 1773 flags &= (~FD_CLOEXEC);
1774 if (fcntl(pd->fd, F_SETFD, flags) < 0) 1774 if (fcntl(pd->fd, F_SETFD, flags) < 0)
1775 { 1775 {
1776 ERR("fcntl(%d, F_SETFD, %#x): %s", pd->fd, flags, strerror(errno)); 1776 ERR("fcntl(" SOCKET_FMT ", F_SETFD, %#x): %s", pd->fd, flags, strerror(errno));
1777 pd->close_on_exec = old; 1777 pd->close_on_exec = old;
1778 return EINA_FALSE; 1778 return EINA_FALSE;
1779 } 1779 }
diff --git a/src/lib/ecore_con/efl_net_dialer_tcp.c b/src/lib/ecore_con/efl_net_dialer_tcp.c
index 07b1ed4367..e04707412d 100644
--- a/src/lib/ecore_con/efl_net_dialer_tcp.c
+++ b/src/lib/ecore_con/efl_net_dialer_tcp.c
@@ -112,7 +112,7 @@ _efl_net_dialer_tcp_connected(void *data, const struct sockaddr *addr, socklen_t
112 else 112 else
113 { 113 {
114 err = EFL_NET_DIALER_ERROR_COULDNT_CONNECT; 114 err = EFL_NET_DIALER_ERROR_COULDNT_CONNECT;
115 efl_loop_fd_set(o, INVALID_SOCKET); 115 efl_loop_fd_set(o, SOCKET_TO_LOOP_FD(INVALID_SOCKET));
116 closesocket(sockfd); 116 closesocket(sockfd);
117 goto error; 117 goto error;
118 } 118 }
diff --git a/src/lib/ecore_con/efl_net_dialer_udp.c b/src/lib/ecore_con/efl_net_dialer_udp.c
index 97dffbe0a0..5a1a331878 100644
--- a/src/lib/ecore_con/efl_net_dialer_udp.c
+++ b/src/lib/ecore_con/efl_net_dialer_udp.c
@@ -132,9 +132,9 @@ _efl_net_dialer_udp_resolved_bind(Eo *o, Efl_Net_Dialer_Udp_Data *pd EINA_UNUSED
132 int enable = 1; 132 int enable = 1;
133#endif 133#endif
134 if (setsockopt(fd, SOL_SOCKET, SO_BROADCAST, &enable, sizeof(enable)) == 0) 134 if (setsockopt(fd, SOL_SOCKET, SO_BROADCAST, &enable, sizeof(enable)) == 0)
135 DBG("enabled SO_BROADCAST for socket=%d", fd); 135 DBG("enabled SO_BROADCAST for socket=" SOCKET_FMT, fd);
136 else 136 else
137 WRN("could not enable SO_BROADCAST for socket=%d: %s", fd, eina_error_msg_get(efl_net_socket_error_get())); 137 WRN("could not enable SO_BROADCAST for socket=" SOCKET_FMT ": %s", fd, eina_error_msg_get(efl_net_socket_error_get()));
138 } 138 }
139 } 139 }
140 else if (family == AF_INET6) 140 else if (family == AF_INET6)
@@ -148,13 +148,13 @@ _efl_net_dialer_udp_resolved_bind(Eo *o, Efl_Net_Dialer_Udp_Data *pd EINA_UNUSED
148 if (setsockopt(fd, IPPROTO_IPV6, IPV6_JOIN_GROUP, &mreq, sizeof(mreq)) == 0) 148 if (setsockopt(fd, IPPROTO_IPV6, IPV6_JOIN_GROUP, &mreq, sizeof(mreq)) == 0)
149 { 149 {
150 efl_net_ip_port_fmt(buf, sizeof(buf), addr->ai_addr); 150 efl_net_ip_port_fmt(buf, sizeof(buf), addr->ai_addr);
151 DBG("joined multicast group %s socket=%d", buf, fd); 151 DBG("joined multicast group %s socket=" SOCKET_FMT, buf, fd);
152 } 152 }
153 else 153 else
154 { 154 {
155 err = efl_net_socket_error_get(); 155 err = efl_net_socket_error_get();
156 efl_net_ip_port_fmt(buf, sizeof(buf), addr->ai_addr); 156 efl_net_ip_port_fmt(buf, sizeof(buf), addr->ai_addr);
157 ERR("could not join multicast group %s socket=%d: %s", buf, fd, eina_error_msg_get(err)); 157 ERR("could not join multicast group %s socket=" SOCKET_FMT ": %s", buf, fd, eina_error_msg_get(err));
158 goto error; 158 goto error;
159 } 159 }
160 } 160 }
@@ -170,7 +170,7 @@ _efl_net_dialer_udp_resolved_bind(Eo *o, Efl_Net_Dialer_Udp_Data *pd EINA_UNUSED
170 170
171 error: 171 error:
172 efl_net_socket_fd_family_set(o, AF_UNSPEC); 172 efl_net_socket_fd_family_set(o, AF_UNSPEC);
173 efl_loop_fd_set(o, INVALID_SOCKET); 173 efl_loop_fd_set(o, SOCKET_TO_LOOP_FD(INVALID_SOCKET));
174 closesocket(fd); 174 closesocket(fd);
175 return err; 175 return err;
176} 176}
diff --git a/src/lib/ecore_con/efl_net_dialer_unix.c b/src/lib/ecore_con/efl_net_dialer_unix.c
index d5ead1ba5c..e3e3619045 100644
--- a/src/lib/ecore_con/efl_net_dialer_unix.c
+++ b/src/lib/ecore_con/efl_net_dialer_unix.c
@@ -81,7 +81,7 @@ _efl_net_dialer_unix_connect_timeout(void *data, const Efl_Event *ev EINA_UNUSED
81} 81}
82 82
83static void 83static void
84_efl_net_dialer_unix_connected(void *data, const struct sockaddr *addr, socklen_t addrlen EINA_UNUSED, int sockfd, Eina_Error err) 84_efl_net_dialer_unix_connected(void *data, const struct sockaddr *addr, socklen_t addrlen EINA_UNUSED, SOCKET sockfd, Eina_Error err)
85{ 85{
86 Eo *o = data; 86 Eo *o = data;
87 Efl_Net_Dialer_Unix_Data *pd = efl_data_scope_get(o, MY_CLASS); 87 Efl_Net_Dialer_Unix_Data *pd = efl_data_scope_get(o, MY_CLASS);
@@ -102,7 +102,7 @@ _efl_net_dialer_unix_connected(void *data, const struct sockaddr *addr, socklen_
102 else 102 else
103 { 103 {
104 err = EFL_NET_DIALER_ERROR_COULDNT_CONNECT; 104 err = EFL_NET_DIALER_ERROR_COULDNT_CONNECT;
105 efl_loop_fd_set(o, INVALID_SOCKET); 105 efl_loop_fd_set(o, SOCKET_TO_LOOP_FD(INVALID_SOCKET));
106 closesocket(sockfd); 106 closesocket(sockfd);
107 goto error; 107 goto error;
108 } 108 }
diff --git a/src/lib/ecore_con/efl_net_server_fd.c b/src/lib/ecore_con/efl_net_server_fd.c
index bb3c7cc8b5..418dd34852 100644
--- a/src/lib/ecore_con/efl_net_server_fd.c
+++ b/src/lib/ecore_con/efl_net_server_fd.c
@@ -107,7 +107,7 @@ _efl_net_server_fd_efl_object_destructor(Eo *o, Efl_Net_Server_Fd_Data *pd)
107 107
108 if (fd != INVALID_SOCKET) 108 if (fd != INVALID_SOCKET)
109 { 109 {
110 efl_loop_fd_set(o, INVALID_SOCKET); 110 efl_loop_fd_set(o, SOCKET_TO_LOOP_FD(INVALID_SOCKET));
111 closesocket(fd); 111 closesocket(fd);
112 } 112 }
113 113
@@ -117,9 +117,11 @@ _efl_net_server_fd_efl_object_destructor(Eo *o, Efl_Net_Server_Fd_Data *pd)
117} 117}
118 118
119EOLIAN static void 119EOLIAN static void
120_efl_net_server_fd_efl_loop_fd_fd_set(Eo *o, Efl_Net_Server_Fd_Data *pd, int fd) 120_efl_net_server_fd_efl_loop_fd_fd_set(Eo *o, Efl_Net_Server_Fd_Data *pd, int pfd)
121{ 121{
122 efl_loop_fd_set(efl_super(o, MY_CLASS), fd); 122 SOCKET fd = (SOCKET)pfd;
123
124 efl_loop_fd_set(efl_super(o, MY_CLASS), pfd);
123 125
124 if (fd != INVALID_SOCKET) 126 if (fd != INVALID_SOCKET)
125 { 127 {
@@ -203,7 +205,7 @@ _efl_net_server_fd_efl_net_server_serving_get(Eo *o EINA_UNUSED, Efl_Net_Server_
203EOLIAN static Eina_Error 205EOLIAN static Eina_Error
204_efl_net_server_fd_socket_activate(Eo *o, Efl_Net_Server_Fd_Data *pd EINA_UNUSED, const char *address) 206_efl_net_server_fd_socket_activate(Eo *o, Efl_Net_Server_Fd_Data *pd EINA_UNUSED, const char *address)
205{ 207{
206 EINA_SAFETY_ON_TRUE_RETURN_VAL(efl_loop_fd_get(o) != INVALID_SOCKET, EALREADY); 208 EINA_SAFETY_ON_TRUE_RETURN_VAL((SOCKET)efl_loop_fd_get(o) != INVALID_SOCKET, EALREADY);
207 EINA_SAFETY_ON_NULL_RETURN_VAL(address, EINVAL); 209 EINA_SAFETY_ON_NULL_RETURN_VAL(address, EINVAL);
208 210
209#ifndef HAVE_SYSTEMD 211#ifndef HAVE_SYSTEMD
@@ -228,17 +230,17 @@ _efl_net_server_fd_socket_activate(Eo *o, Efl_Net_Server_Fd_Data *pd EINA_UNUSED
228 230
229 if (getsockopt(fd, SOL_SOCKET, SO_DOMAIN, &family, &len) != 0) 231 if (getsockopt(fd, SOL_SOCKET, SO_DOMAIN, &family, &len) != 0)
230 { 232 {
231 WRN("socket %d failed to return family: %s", fd, eina_error_msg_get(efl_net_socket_error_get())); 233 WRN("socket " SOCKET_FMT " failed to return family: %s", fd, eina_error_msg_get(efl_net_socket_error_get()));
232 return EINVAL; 234 return EINVAL;
233 } 235 }
234 236
235 sd_fd_index++; 237 sd_fd_index++;
236 efl_net_server_fd_family_set(o, family); 238 efl_net_server_fd_family_set(o, family);
237 efl_loop_fd_set(o, fd); 239 efl_loop_fd_set(o, fd);
238 if (efl_loop_fd_get(o) == INVALID_SOCKET) 240 if ((SOCKET)efl_loop_fd_get(o) == INVALID_SOCKET)
239 { 241 {
240 sd_fd_index--; 242 sd_fd_index--;
241 WRN("socket %d could not be used by %p (%s)", 243 WRN("socket " SOCKET_FMT " could not be used by %p (%s)",
242 fd, o, efl_class_name_get(efl_class_get(o))); 244 fd, o, efl_class_name_get(efl_class_get(o)));
243 return EINVAL; 245 return EINVAL;
244 } 246 }
@@ -256,7 +258,8 @@ EOLIAN static Eina_Bool
256_efl_net_server_fd_close_on_exec_set(Eo *o, Efl_Net_Server_Fd_Data *pd, Eina_Bool close_on_exec) 258_efl_net_server_fd_close_on_exec_set(Eo *o, Efl_Net_Server_Fd_Data *pd, Eina_Bool close_on_exec)
257{ 259{
258#ifdef FD_CLOEXEC 260#ifdef FD_CLOEXEC
259 int flags, fd; 261 SOCKET fd;
262 int flags;
260 Eina_Bool old = pd->close_on_exec; 263 Eina_Bool old = pd->close_on_exec;
261#endif 264#endif
262 265
@@ -269,7 +272,7 @@ _efl_net_server_fd_close_on_exec_set(Eo *o, Efl_Net_Server_Fd_Data *pd, Eina_Boo
269 flags = fcntl(fd, F_GETFD); 272 flags = fcntl(fd, F_GETFD);
270 if (flags < 0) 273 if (flags < 0)
271 { 274 {
272 ERR("fcntl(%d, F_GETFD): %s", fd, strerror(errno)); 275 ERR("fcntl(" SOCKET_FMT ", F_GETFD): %s", fd, strerror(errno));
273 pd->close_on_exec = old; 276 pd->close_on_exec = old;
274 return EINA_FALSE; 277 return EINA_FALSE;
275 } 278 }
@@ -279,7 +282,7 @@ _efl_net_server_fd_close_on_exec_set(Eo *o, Efl_Net_Server_Fd_Data *pd, Eina_Boo
279 flags &= (~FD_CLOEXEC); 282 flags &= (~FD_CLOEXEC);
280 if (fcntl(fd, F_SETFD, flags) < 0) 283 if (fcntl(fd, F_SETFD, flags) < 0)
281 { 284 {
282 ERR("fcntl(%d, F_SETFD, %#x): %s", fd, flags, strerror(errno)); 285 ERR("fcntl(" SOCKET_FMT ", F_SETFD, %#x): %s", fd, flags, strerror(errno));
283 pd->close_on_exec = old; 286 pd->close_on_exec = old;
284 return EINA_FALSE; 287 return EINA_FALSE;
285 } 288 }
@@ -292,7 +295,8 @@ EOLIAN static Eina_Bool
292_efl_net_server_fd_close_on_exec_get(Eo *o, Efl_Net_Server_Fd_Data *pd) 295_efl_net_server_fd_close_on_exec_get(Eo *o, Efl_Net_Server_Fd_Data *pd)
293{ 296{
294#ifdef FD_CLOEXEC 297#ifdef FD_CLOEXEC
295 int flags, fd; 298 SOCKET fd;
299 int flags;
296 300
297 fd = efl_loop_fd_get(o); 301 fd = efl_loop_fd_get(o);
298 if (fd == INVALID_SOCKET) return pd->close_on_exec; 302 if (fd == INVALID_SOCKET) return pd->close_on_exec;
@@ -303,7 +307,7 @@ _efl_net_server_fd_close_on_exec_get(Eo *o, Efl_Net_Server_Fd_Data *pd)
303 flags = fcntl(fd, F_GETFD); 307 flags = fcntl(fd, F_GETFD);
304 if (flags < 0) 308 if (flags < 0)
305 { 309 {
306 ERR("fcntl(%d, F_GETFD): %s", fd, strerror(errno)); 310 ERR("fcntl(" SOCKET_FMT ", F_GETFD): %s", fd, strerror(errno));
307 return EINA_FALSE; 311 return EINA_FALSE;
308 } 312 }
309 313
@@ -315,7 +319,8 @@ _efl_net_server_fd_close_on_exec_get(Eo *o, Efl_Net_Server_Fd_Data *pd)
315EOLIAN static Eina_Bool 319EOLIAN static Eina_Bool
316_efl_net_server_fd_reuse_address_set(Eo *o, Efl_Net_Server_Fd_Data *pd, Eina_Bool reuse_address) 320_efl_net_server_fd_reuse_address_set(Eo *o, Efl_Net_Server_Fd_Data *pd, Eina_Bool reuse_address)
317{ 321{
318 int value, fd; 322 SOCKET fd;
323 int value;
319 Eina_Bool old = pd->reuse_address; 324 Eina_Bool old = pd->reuse_address;
320 325
321 pd->reuse_address = reuse_address; 326 pd->reuse_address = reuse_address;
@@ -326,7 +331,7 @@ _efl_net_server_fd_reuse_address_set(Eo *o, Efl_Net_Server_Fd_Data *pd, Eina_Boo
326 value = reuse_address; 331 value = reuse_address;
327 if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &value, sizeof(value)) != 0) 332 if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &value, sizeof(value)) != 0)
328 { 333 {
329 ERR("setsockopt(%d, SOL_SOCKET, SO_REUSEADDR, %d): %s", 334 ERR("setsockopt(" SOCKET_FMT ", SOL_SOCKET, SO_REUSEADDR, %d): %s",
330 fd, value, eina_error_msg_get(efl_net_socket_error_get())); 335 fd, value, eina_error_msg_get(efl_net_socket_error_get()));
331 pd->reuse_address = old; 336 pd->reuse_address = old;
332 return EINA_FALSE; 337 return EINA_FALSE;
@@ -338,7 +343,8 @@ _efl_net_server_fd_reuse_address_set(Eo *o, Efl_Net_Server_Fd_Data *pd, Eina_Boo
338EOLIAN static Eina_Bool 343EOLIAN static Eina_Bool
339_efl_net_server_fd_reuse_address_get(Eo *o, Efl_Net_Server_Fd_Data *pd) 344_efl_net_server_fd_reuse_address_get(Eo *o, Efl_Net_Server_Fd_Data *pd)
340{ 345{
341 int value = 0, fd; 346 SOCKET fd;
347 int value = 0;
342 socklen_t valuelen; 348 socklen_t valuelen;
343 349
344 fd = efl_loop_fd_get(o); 350 fd = efl_loop_fd_get(o);
@@ -350,7 +356,7 @@ _efl_net_server_fd_reuse_address_get(Eo *o, Efl_Net_Server_Fd_Data *pd)
350 valuelen = sizeof(value); 356 valuelen = sizeof(value);
351 if (getsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &value, &valuelen) != 0) 357 if (getsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &value, &valuelen) != 0)
352 { 358 {
353 ERR("getsockopt(%d, SOL_SOCKET, SO_REUSEADDR): %s", 359 ERR("getsockopt(" SOCKET_FMT ", SOL_SOCKET, SO_REUSEADDR): %s",
354 fd, eina_error_msg_get(efl_net_socket_error_get())); 360 fd, eina_error_msg_get(efl_net_socket_error_get()));
355 return EINA_FALSE; 361 return EINA_FALSE;
356 } 362 }
@@ -363,7 +369,8 @@ EOLIAN static Eina_Bool
363_efl_net_server_fd_reuse_port_set(Eo *o, Efl_Net_Server_Fd_Data *pd, Eina_Bool reuse_port) 369_efl_net_server_fd_reuse_port_set(Eo *o, Efl_Net_Server_Fd_Data *pd, Eina_Bool reuse_port)
364{ 370{
365#ifdef SO_REUSEPORT 371#ifdef SO_REUSEPORT
366 int value, fd; 372 SOCKET fd;
373 int value;
367 Eina_Bool old = pd->reuse_port; 374 Eina_Bool old = pd->reuse_port;
368#endif 375#endif
369 376
@@ -376,7 +383,7 @@ _efl_net_server_fd_reuse_port_set(Eo *o, Efl_Net_Server_Fd_Data *pd, Eina_Bool r
376 value = reuse_port; 383 value = reuse_port;
377 if (setsockopt(fd, SOL_SOCKET, SO_REUSEPORT, &value, sizeof(value)) != 0) 384 if (setsockopt(fd, SOL_SOCKET, SO_REUSEPORT, &value, sizeof(value)) != 0)
378 { 385 {
379 ERR("setsockopt(%d, SOL_SOCKET, SO_REUSEPORT, %d): %s", 386 ERR("setsockopt(" SOCKET_FMT ", SOL_SOCKET, SO_REUSEPORT, %d): %s",
380 fd, value, eina_error_msg_get(efl_net_socket_error_get())); 387 fd, value, eina_error_msg_get(efl_net_socket_error_get()));
381 pd->reuse_port = old; 388 pd->reuse_port = old;
382 return EINA_FALSE; 389 return EINA_FALSE;
@@ -390,7 +397,8 @@ EOLIAN static Eina_Bool
390_efl_net_server_fd_reuse_port_get(Eo *o, Efl_Net_Server_Fd_Data *pd) 397_efl_net_server_fd_reuse_port_get(Eo *o, Efl_Net_Server_Fd_Data *pd)
391{ 398{
392#ifdef SO_REUSEPORT 399#ifdef SO_REUSEPORT
393 int value = 0, fd; 400 SOCKET fd;
401 int value = 0;
394 socklen_t valuelen; 402 socklen_t valuelen;
395 403
396 fd = efl_loop_fd_get(o); 404 fd = efl_loop_fd_get(o);
@@ -402,7 +410,7 @@ _efl_net_server_fd_reuse_port_get(Eo *o, Efl_Net_Server_Fd_Data *pd)
402 valuelen = sizeof(value); 410 valuelen = sizeof(value);
403 if (getsockopt(fd, SOL_SOCKET, SO_REUSEPORT, &value, &valuelen) != 0) 411 if (getsockopt(fd, SOL_SOCKET, SO_REUSEPORT, &value, &valuelen) != 0)
404 { 412 {
405 ERR("getsockopt(%d, SOL_SOCKET, SO_REUSEPORT): %s", 413 ERR("getsockopt(" SOCKET_FMT ", SOL_SOCKET, SO_REUSEPORT): %s",
406 fd, eina_error_msg_get(efl_net_socket_error_get())); 414 fd, eina_error_msg_get(efl_net_socket_error_get()));
407 return EINA_FALSE; 415 return EINA_FALSE;
408 } 416 }
@@ -451,7 +459,7 @@ _efl_net_server_fd_process_incoming_data(Eo *o, Efl_Net_Server_Fd_Data *pd)
451 if (client == INVALID_SOCKET) 459 if (client == INVALID_SOCKET)
452 { 460 {
453 Eina_Error err = efl_net_socket_error_get(); 461 Eina_Error err = efl_net_socket_error_get();
454 ERR("accept(%d): %s", fd, eina_error_msg_get(err)); 462 ERR("accept(" SOCKET_FMT "): %s", fd, eina_error_msg_get(err));
455 efl_event_callback_call(o, EFL_NET_SERVER_EVENT_ERROR, &err); 463 efl_event_callback_call(o, EFL_NET_SERVER_EVENT_ERROR, &err);
456 return; 464 return;
457 } 465 }
diff --git a/src/lib/ecore_con/efl_net_server_tcp.c b/src/lib/ecore_con/efl_net_server_tcp.c
index 4d215d5e0e..abefc74f75 100644
--- a/src/lib/ecore_con/efl_net_server_tcp.c
+++ b/src/lib/ecore_con/efl_net_server_tcp.c
@@ -91,7 +91,7 @@ _efl_net_server_tcp_resolved_bind(Eo *o, Efl_Net_Server_Tcp_Data *pd, const stru
91 { 91 {
92 err = efl_net_socket_error_get(); 92 err = efl_net_socket_error_get();
93 efl_net_ip_port_fmt(buf, sizeof(buf), addr->ai_addr); 93 efl_net_ip_port_fmt(buf, sizeof(buf), addr->ai_addr);
94 DBG("bind(%d, %s): %s", fd, buf, eina_error_msg_get(err)); 94 DBG("bind(" SOCKET_FMT ", %s): %s", fd, buf, eina_error_msg_get(err));
95 goto error; 95 goto error;
96 } 96 }
97 97
@@ -99,26 +99,26 @@ _efl_net_server_tcp_resolved_bind(Eo *o, Efl_Net_Server_Tcp_Data *pd, const stru
99 if (r != 0) 99 if (r != 0)
100 { 100 {
101 err = efl_net_socket_error_get(); 101 err = efl_net_socket_error_get();
102 DBG("listen(%d): %s", fd, eina_error_msg_get(err)); 102 DBG("listen(" SOCKET_FMT "): %s", fd, eina_error_msg_get(err));
103 goto error; 103 goto error;
104 } 104 }
105 105
106 if (getsockname(fd, addr->ai_addr, &addrlen) != 0) 106 if (getsockname(fd, addr->ai_addr, &addrlen) != 0)
107 { 107 {
108 err = efl_net_socket_error_get(); 108 err = efl_net_socket_error_get();
109 ERR("getsockname(%d): %s", fd, eina_error_msg_get(err)); 109 ERR("getsockname(" SOCKET_FMT "): %s", fd, eina_error_msg_get(err));
110 goto error; 110 goto error;
111 } 111 }
112 else if (efl_net_ip_port_fmt(buf, sizeof(buf), addr->ai_addr)) 112 else if (efl_net_ip_port_fmt(buf, sizeof(buf), addr->ai_addr))
113 efl_net_server_address_set(o, buf); 113 efl_net_server_address_set(o, buf);
114 114
115 DBG("fd=%d serving at %s", fd, buf); 115 DBG("fd=" SOCKET_FMT " serving at %s", fd, buf);
116 efl_net_server_serving_set(o, EINA_TRUE); 116 efl_net_server_serving_set(o, EINA_TRUE);
117 return 0; 117 return 0;
118 118
119 error: 119 error:
120 efl_net_server_fd_family_set(o, AF_UNSPEC); 120 efl_net_server_fd_family_set(o, AF_UNSPEC);
121 efl_loop_fd_set(o, INVALID_SOCKET); 121 efl_loop_fd_set(o, SOCKET_TO_LOOP_FD(INVALID_SOCKET));
122 closesocket(fd); 122 closesocket(fd);
123 return err; 123 return err;
124} 124}
@@ -157,7 +157,7 @@ _efl_net_server_tcp_resolved(void *data, const char *host EINA_UNUSED, const cha
157EOLIAN static Eina_Error 157EOLIAN static Eina_Error
158_efl_net_server_tcp_efl_net_server_fd_socket_activate(Eo *o, Efl_Net_Server_Tcp_Data *pd EINA_UNUSED, const char *address) 158_efl_net_server_tcp_efl_net_server_fd_socket_activate(Eo *o, Efl_Net_Server_Tcp_Data *pd EINA_UNUSED, const char *address)
159{ 159{
160 EINA_SAFETY_ON_TRUE_RETURN_VAL(efl_loop_fd_get(o) != INVALID_SOCKET, EALREADY); 160 EINA_SAFETY_ON_TRUE_RETURN_VAL((SOCKET)efl_loop_fd_get(o) != INVALID_SOCKET, EALREADY);
161 EINA_SAFETY_ON_NULL_RETURN_VAL(address, EINVAL); 161 EINA_SAFETY_ON_NULL_RETURN_VAL(address, EINVAL);
162 162
163#ifndef HAVE_SYSTEMD 163#ifndef HAVE_SYSTEMD
@@ -169,7 +169,7 @@ _efl_net_server_tcp_efl_net_server_fd_socket_activate(Eo *o, Efl_Net_Server_Tcp_
169 Eina_Error err; 169 Eina_Error err;
170 struct sockaddr_storage *addr; 170 struct sockaddr_storage *addr;
171 socklen_t addrlen; 171 socklen_t addrlen;
172 int fd; 172 SOCKET fd;
173 173
174 err = efl_net_ip_socket_activate_check(address, AF_UNSPEC, SOCK_STREAM, &listening); 174 err = efl_net_ip_socket_activate_check(address, AF_UNSPEC, SOCK_STREAM, &listening);
175 if (err) return err; 175 if (err) return err;
@@ -184,7 +184,7 @@ _efl_net_server_tcp_efl_net_server_fd_socket_activate(Eo *o, Efl_Net_Server_Tcp_
184 if (listen(fd, 0) != 0) 184 if (listen(fd, 0) != 0)
185 { 185 {
186 err = efl_net_socket_error_get(); 186 err = efl_net_socket_error_get();
187 DBG("listen(%d): %s", fd, eina_error_msg_get(err)); 187 DBG("listen(" SOCKET_FMT "): %s", fd, eina_error_msg_get(err));
188 goto error; 188 goto error;
189 } 189 }
190 } 190 }
@@ -193,19 +193,19 @@ _efl_net_server_tcp_efl_net_server_fd_socket_activate(Eo *o, Efl_Net_Server_Tcp_
193 if (getsockname(fd, (struct sockaddr *)&addr, &addrlen) != 0) 193 if (getsockname(fd, (struct sockaddr *)&addr, &addrlen) != 0)
194 { 194 {
195 err = efl_net_socket_error_get(); 195 err = efl_net_socket_error_get();
196 ERR("getsockname(%d): %s", fd, eina_error_msg_get(err)); 196 ERR("getsockname(" SOCKET_FMT "): %s", fd, eina_error_msg_get(err));
197 goto error; 197 goto error;
198 } 198 }
199 else if (efl_net_ip_port_fmt(buf, sizeof(buf), (struct sockaddr *)&addr)) 199 else if (efl_net_ip_port_fmt(buf, sizeof(buf), (struct sockaddr *)&addr))
200 efl_net_server_address_set(o, buf); 200 efl_net_server_address_set(o, buf);
201 201
202 DBG("fd=%d serving at %s", fd, address); 202 DBG("fd=" SOCKET_FMT " serving at %s", fd, address);
203 efl_net_server_serving_set(o, EINA_TRUE); 203 efl_net_server_serving_set(o, EINA_TRUE);
204 return 0; 204 return 0;
205 205
206 error: 206 error:
207 efl_net_server_fd_family_set(o, AF_UNSPEC); 207 efl_net_server_fd_family_set(o, AF_UNSPEC);
208 efl_loop_fd_set(o, INVALID_SOCKET); 208 efl_loop_fd_set(o, SOCKET_TO_LOOP_FD(INVALID_SOCKET));
209 closesocket(fd); 209 closesocket(fd);
210 return err; 210 return err;
211 } 211 }
@@ -270,7 +270,7 @@ _efl_net_server_tcp_efl_net_server_fd_client_add(Eo *o, Efl_Net_Server_Tcp_Data
270 efl_loop_fd_set(efl_added, client_fd)); 270 efl_loop_fd_set(efl_added, client_fd));
271 if (!client) 271 if (!client)
272 { 272 {
273 ERR("could not create client object fd=%d", client_fd); 273 ERR("could not create client object fd=" SOCKET_FMT, (SOCKET)client_fd);
274 closesocket(client_fd); 274 closesocket(client_fd);
275 return; 275 return;
276 } 276 }
@@ -295,7 +295,7 @@ _efl_net_server_tcp_efl_net_server_fd_client_reject(Eo *o, Efl_Net_Server_Tcp_Da
295 295
296 addrlen = sizeof(addr); 296 addrlen = sizeof(addr);
297 if (getpeername(client_fd, (struct sockaddr *)&addr, &addrlen) != 0) 297 if (getpeername(client_fd, (struct sockaddr *)&addr, &addrlen) != 0)
298 ERR("getpeername(%d): %s", client_fd, eina_error_msg_get(efl_net_socket_error_get())); 298 ERR("getpeername(" SOCKET_FMT "): %s", (SOCKET)client_fd, eina_error_msg_get(efl_net_socket_error_get()));
299 else 299 else
300 efl_net_ip_port_fmt(str, sizeof(str), (struct sockaddr *)&addr); 300 efl_net_ip_port_fmt(str, sizeof(str), (struct sockaddr *)&addr);
301 301
@@ -324,7 +324,7 @@ _efl_net_server_tcp_ipv6_only_set(Eo *o, Efl_Net_Server_Tcp_Data *pd, Eina_Bool
324 324
325 if (setsockopt(fd, IPPROTO_IPV6, IPV6_V6ONLY, &value, sizeof(value)) != 0) 325 if (setsockopt(fd, IPPROTO_IPV6, IPV6_V6ONLY, &value, sizeof(value)) != 0)
326 { 326 {
327 ERR("could not set socket=%d IPV6_V6ONLY=%d: %s", fd, value, eina_error_msg_get(efl_net_socket_error_get())); 327 ERR("could not set socket=" SOCKET_FMT " IPV6_V6ONLY=%d: %s", fd, value, eina_error_msg_get(efl_net_socket_error_get()));
328 pd->ipv6_only = old; 328 pd->ipv6_only = old;
329 } 329 }
330#endif 330#endif
@@ -349,7 +349,7 @@ _efl_net_server_tcp_ipv6_only_get(Eo *o EINA_UNUSED, Efl_Net_Server_Tcp_Data *pd
349 valuelen = sizeof(value); 349 valuelen = sizeof(value);
350 if (getsockopt(fd, IPPROTO_IPV6, IPV6_V6ONLY, &value, &valuelen) != 0) 350 if (getsockopt(fd, IPPROTO_IPV6, IPV6_V6ONLY, &value, &valuelen) != 0)
351 { 351 {
352 WRN("getsockopt(%d, IPPROTO_IPV6, IPV6_V6ONLY): %s", fd, eina_error_msg_get(efl_net_socket_error_get())); 352 WRN("getsockopt(" SOCKET_FMT ", IPPROTO_IPV6, IPV6_V6ONLY): %s", fd, eina_error_msg_get(efl_net_socket_error_get()));
353 goto end; 353 goto end;
354 } 354 }
355 pd->ipv6_only = !!value; 355 pd->ipv6_only = !!value;
diff --git a/src/lib/ecore_con/efl_net_server_udp.c b/src/lib/ecore_con/efl_net_server_udp.c
index 051db7fab9..1bf1d0e4fc 100644
--- a/src/lib/ecore_con/efl_net_server_udp.c
+++ b/src/lib/ecore_con/efl_net_server_udp.c
@@ -124,20 +124,20 @@ _efl_net_server_udp_resolved_bind(Eo *o, Efl_Net_Server_Udp_Data *pd, const stru
124 { 124 {
125 err = efl_net_socket_error_get(); 125 err = efl_net_socket_error_get();
126 efl_net_ip_port_fmt(buf, sizeof(buf), addr->ai_addr); 126 efl_net_ip_port_fmt(buf, sizeof(buf), addr->ai_addr);
127 DBG("bind(%d, %s): %s", fd, buf, eina_error_msg_get(err)); 127 DBG("bind(" SOCKET_FMT ", %s): %s", fd, buf, eina_error_msg_get(err));
128 goto error; 128 goto error;
129 } 129 }
130 130
131 if (getsockname(fd, addr->ai_addr, &addrlen) != 0) 131 if (getsockname(fd, addr->ai_addr, &addrlen) != 0)
132 { 132 {
133 err = efl_net_socket_error_get(); 133 err = efl_net_socket_error_get();
134 ERR("getsockname(%d): %s", fd, eina_error_msg_get(err)); 134 ERR("getsockname(" SOCKET_FMT "): %s", fd, eina_error_msg_get(err));
135 goto error; 135 goto error;
136 } 136 }
137 else if (efl_net_ip_port_fmt(buf, sizeof(buf), addr->ai_addr)) 137 else if (efl_net_ip_port_fmt(buf, sizeof(buf), addr->ai_addr))
138 efl_net_server_address_set(o, buf); 138 efl_net_server_address_set(o, buf);
139 139
140 DBG("fd=%d serving at %s", fd, buf); 140 DBG("fd=" SOCKET_FMT " serving at %s", fd, buf);
141 efl_net_server_serving_set(o, EINA_TRUE); 141 efl_net_server_serving_set(o, EINA_TRUE);
142 142
143 EINA_LIST_FREE(pd->multicast.pending, node) 143 EINA_LIST_FREE(pd->multicast.pending, node)
@@ -165,7 +165,7 @@ _efl_net_server_udp_resolved_bind(Eo *o, Efl_Net_Server_Udp_Data *pd, const stru
165 165
166 error: 166 error:
167 efl_net_server_fd_family_set(o, AF_UNSPEC); 167 efl_net_server_fd_family_set(o, AF_UNSPEC);
168 efl_loop_fd_set(o, INVALID_SOCKET); 168 efl_loop_fd_set(o, SOCKET_TO_LOOP_FD(INVALID_SOCKET));
169 closesocket(fd); 169 closesocket(fd);
170 return err; 170 return err;
171} 171}
@@ -204,7 +204,7 @@ _efl_net_server_udp_resolved(void *data, const char *host EINA_UNUSED, const cha
204EOLIAN static Eina_Error 204EOLIAN static Eina_Error
205_efl_net_server_udp_efl_net_server_fd_socket_activate(Eo *o, Efl_Net_Server_Udp_Data *pd EINA_UNUSED, const char *address) 205_efl_net_server_udp_efl_net_server_fd_socket_activate(Eo *o, Efl_Net_Server_Udp_Data *pd EINA_UNUSED, const char *address)
206{ 206{
207 EINA_SAFETY_ON_TRUE_RETURN_VAL(efl_loop_fd_get(o) != INVALID_SOCKET, EALREADY); 207 EINA_SAFETY_ON_TRUE_RETURN_VAL((SOCKET)efl_loop_fd_get(o) != INVALID_SOCKET, EALREADY);
208 EINA_SAFETY_ON_NULL_RETURN_VAL(address, EINVAL); 208 EINA_SAFETY_ON_NULL_RETURN_VAL(address, EINVAL);
209 209
210#ifndef HAVE_SYSTEMD 210#ifndef HAVE_SYSTEMD
@@ -215,7 +215,7 @@ _efl_net_server_udp_efl_net_server_fd_socket_activate(Eo *o, Efl_Net_Server_Udp_
215 Eina_Error err; 215 Eina_Error err;
216 struct sockaddr_storage *addr; 216 struct sockaddr_storage *addr;
217 socklen_t addrlen; 217 socklen_t addrlen;
218 int fd; 218 SOCKET fd;
219 219
220 err = efl_net_ip_socket_activate_check(address, AF_UNSPEC, SOCK_DGRAM, NULL); 220 err = efl_net_ip_socket_activate_check(address, AF_UNSPEC, SOCK_DGRAM, NULL);
221 if (err) return err; 221 if (err) return err;
@@ -229,19 +229,19 @@ _efl_net_server_udp_efl_net_server_fd_socket_activate(Eo *o, Efl_Net_Server_Udp_
229 if (getsockname(fd, (struct sockaddr *)&addr, &addrlen) != 0) 229 if (getsockname(fd, (struct sockaddr *)&addr, &addrlen) != 0)
230 { 230 {
231 err = efl_net_socket_error_get(); 231 err = efl_net_socket_error_get();
232 ERR("getsockname(%d): %s", fd, eina_error_msg_get(err)); 232 ERR("getsockname(" SOCKET_FMT "): %s", fd, eina_error_msg_get(err));
233 goto error; 233 goto error;
234 } 234 }
235 else if (efl_net_ip_port_fmt(buf, sizeof(buf), (struct sockaddr *)&addr)) 235 else if (efl_net_ip_port_fmt(buf, sizeof(buf), (struct sockaddr *)&addr))
236 efl_net_server_address_set(o, buf); 236 efl_net_server_address_set(o, buf);
237 237
238 DBG("fd=%d serving at %s", fd, address); 238 DBG("fd=" SOCKET_FMT " serving at %s", fd, address);
239 efl_net_server_serving_set(o, EINA_TRUE); 239 efl_net_server_serving_set(o, EINA_TRUE);
240 return 0; 240 return 0;
241 241
242 error: 242 error:
243 efl_net_server_fd_family_set(o, AF_UNSPEC); 243 efl_net_server_fd_family_set(o, AF_UNSPEC);
244 efl_loop_fd_set(o, INVALID_SOCKET); 244 efl_loop_fd_set(o, SOCKET_TO_LOOP_FD(INVALID_SOCKET));
245 closesocket(fd); 245 closesocket(fd);
246 return err; 246 return err;
247 } 247 }
@@ -322,7 +322,7 @@ _efl_net_server_udp_efl_net_server_fd_process_incoming_data(Eo *o, Efl_Net_Serve
322 if (r < 0) 322 if (r < 0)
323 { 323 {
324 Eina_Error err = efl_net_socket_error_get(); 324 Eina_Error err = efl_net_socket_error_get();
325 ERR("recvfrom(%d, %p, %zu, 0, %p, %d): %s", fd, buf, buflen, &addr, addrlen, eina_error_msg_get(err)); 325 ERR("recvfrom(" SOCKET_FMT ", %p, %zu, 0, %p, %d): %s", fd, buf, buflen, &addr, addrlen, eina_error_msg_get(err));
326 free(buf); 326 free(buf);
327 efl_event_callback_call(o, EFL_NET_SERVER_EVENT_ERROR, &err); 327 efl_event_callback_call(o, EFL_NET_SERVER_EVENT_ERROR, &err);
328 return; 328 return;
@@ -415,7 +415,7 @@ _efl_net_server_udp_ipv6_only_set(Eo *o, Efl_Net_Server_Udp_Data *pd, Eina_Bool
415 415
416 if (setsockopt(fd, IPPROTO_IPV6, IPV6_V6ONLY, &value, sizeof(value)) != 0) 416 if (setsockopt(fd, IPPROTO_IPV6, IPV6_V6ONLY, &value, sizeof(value)) != 0)
417 { 417 {
418 ERR("could not set socket=%d IPV6_V6ONLY=%d: %s", fd, value, eina_error_msg_get(efl_net_socket_error_get())); 418 ERR("could not set socket=" SOCKET_FMT " IPV6_V6ONLY=%d: %s", fd, value, eina_error_msg_get(efl_net_socket_error_get()));
419 pd->ipv6_only = old; 419 pd->ipv6_only = old;
420 } 420 }
421#endif 421#endif
@@ -440,7 +440,7 @@ _efl_net_server_udp_ipv6_only_get(Eo *o EINA_UNUSED, Efl_Net_Server_Udp_Data *pd
440 valuelen = sizeof(value); 440 valuelen = sizeof(value);
441 if (getsockopt(fd, IPPROTO_IPV6, IPV6_V6ONLY, &value, &valuelen) != 0) 441 if (getsockopt(fd, IPPROTO_IPV6, IPV6_V6ONLY, &value, &valuelen) != 0)
442 { 442 {
443 WRN("getsockopt(%d, IPPROTO_IPV6, IPV6_V6ONLY): %s", fd, eina_error_msg_get(efl_net_socket_error_get())); 443 WRN("getsockopt(" SOCKET_FMT ", IPPROTO_IPV6, IPV6_V6ONLY): %s", fd, eina_error_msg_get(efl_net_socket_error_get()));
444 goto end; 444 goto end;
445 } 445 }
446 pd->ipv6_only = !!value; 446 pd->ipv6_only = !!value;
@@ -468,7 +468,7 @@ _efl_net_server_udp_dont_route_set(Eo *o, Efl_Net_Server_Udp_Data *pd, Eina_Bool
468 if (setsockopt(fd, SOL_SOCKET, SO_DONTROUTE, &value, sizeof(value)) != 0) 468 if (setsockopt(fd, SOL_SOCKET, SO_DONTROUTE, &value, sizeof(value)) != 0)
469 { 469 {
470 Eina_Error err = efl_net_socket_error_get(); 470 Eina_Error err = efl_net_socket_error_get();
471 ERR("setsockopt(%d, SOL_SOCKET, SO_DONTROUTE, %u): %s", fd, dont_route, eina_error_msg_get(err)); 471 ERR("setsockopt(" SOCKET_FMT ", SOL_SOCKET, SO_DONTROUTE, %u): %s", fd, dont_route, eina_error_msg_get(err));
472 pd->dont_route = old; 472 pd->dont_route = old;
473 return EINA_FALSE; 473 return EINA_FALSE;
474 } 474 }
@@ -496,7 +496,7 @@ _efl_net_server_udp_dont_route_get(Eo *o, Efl_Net_Server_Udp_Data *pd)
496 if (getsockopt(fd, SOL_SOCKET, SO_DONTROUTE, &value, &valuelen) != 0) 496 if (getsockopt(fd, SOL_SOCKET, SO_DONTROUTE, &value, &valuelen) != 0)
497 { 497 {
498 Eina_Error err = efl_net_socket_error_get(); 498 Eina_Error err = efl_net_socket_error_get();
499 ERR("getsockopt(%d, SOL_SOCKET, SO_DONTROUTE): %s", fd, eina_error_msg_get(err)); 499 ERR("getsockopt(" SOCKET_FMT ", SOL_SOCKET, SO_DONTROUTE): %s", fd, eina_error_msg_get(err));
500 return EINA_FALSE; 500 return EINA_FALSE;
501 } 501 }
502 502
diff --git a/src/lib/ecore_con/efl_net_server_unix.c b/src/lib/ecore_con/efl_net_server_unix.c
index 70ca83aeb7..7e90bb8cd8 100644
--- a/src/lib/ecore_con/efl_net_server_unix.c
+++ b/src/lib/ecore_con/efl_net_server_unix.c
@@ -112,7 +112,7 @@ _efl_net_server_unix_bind_job(void *data, const Efl_Event *event EINA_UNUSED)
112 err = 0; 112 err = 0;
113 continue; 113 continue;
114 } 114 }
115 DBG("bind(%d, %s): %s", fd, address, eina_error_msg_get(err)); 115 DBG("bind(" SOCKET_FMT ", %s): %s", fd, address, eina_error_msg_get(err));
116 goto error; 116 goto error;
117 } 117 }
118 break; 118 break;
@@ -125,7 +125,7 @@ _efl_net_server_unix_bind_job(void *data, const Efl_Event *event EINA_UNUSED)
125 if (r != 0) 125 if (r != 0)
126 { 126 {
127 err = efl_net_socket_error_get(); 127 err = efl_net_socket_error_get();
128 DBG("listen(%d): %s", fd, eina_error_msg_get(err)); 128 DBG("listen(" SOCKET_FMT "): %s", fd, eina_error_msg_get(err));
129 goto error; 129 goto error;
130 } 130 }
131 131
@@ -133,7 +133,7 @@ _efl_net_server_unix_bind_job(void *data, const Efl_Event *event EINA_UNUSED)
133 if (getsockname(fd, (struct sockaddr *)&addr, &addrlen) != 0) 133 if (getsockname(fd, (struct sockaddr *)&addr, &addrlen) != 0)
134 { 134 {
135 err = efl_net_socket_error_get(); 135 err = efl_net_socket_error_get();
136 ERR("getsockname(%d): %s", fd, eina_error_msg_get(err)); 136 ERR("getsockname(" SOCKET_FMT "): %s", fd, eina_error_msg_get(err));
137 goto error; 137 goto error;
138 } 138 }
139 else 139 else
@@ -148,7 +148,7 @@ _efl_net_server_unix_bind_job(void *data, const Efl_Event *event EINA_UNUSED)
148 } 148 }
149 } 149 }
150 150
151 DBG("fd=%d serving at %s", fd, address); 151 DBG("fd=" SOCKET_FMT " serving at %s", fd, address);
152 efl_net_server_serving_set(o, EINA_TRUE); 152 efl_net_server_serving_set(o, EINA_TRUE);
153 153
154 error: 154 error:
@@ -156,7 +156,7 @@ _efl_net_server_unix_bind_job(void *data, const Efl_Event *event EINA_UNUSED)
156 { 156 {
157 efl_event_callback_call(o, EFL_NET_SERVER_EVENT_ERROR, &err); 157 efl_event_callback_call(o, EFL_NET_SERVER_EVENT_ERROR, &err);
158 if (fd != INVALID_SOCKET) closesocket(fd); 158 if (fd != INVALID_SOCKET) closesocket(fd);
159 efl_loop_fd_set(o, INVALID_SOCKET); 159 efl_loop_fd_set(o, SOCKET_TO_LOOP_FD(INVALID_SOCKET));
160 } 160 }
161 161
162 efl_unref(o); 162 efl_unref(o);
@@ -165,7 +165,7 @@ _efl_net_server_unix_bind_job(void *data, const Efl_Event *event EINA_UNUSED)
165EOLIAN static Eina_Error 165EOLIAN static Eina_Error
166_efl_net_server_unix_efl_net_server_fd_socket_activate(Eo *o, Efl_Net_Server_Unix_Data *pd EINA_UNUSED, const char *address) 166_efl_net_server_unix_efl_net_server_fd_socket_activate(Eo *o, Efl_Net_Server_Unix_Data *pd EINA_UNUSED, const char *address)
167{ 167{
168 EINA_SAFETY_ON_TRUE_RETURN_VAL(efl_loop_fd_get(o) != INVALID_SOCKET, EALREADY); 168 EINA_SAFETY_ON_TRUE_RETURN_VAL((SOCKET)efl_loop_fd_get(o) != INVALID_SOCKET, EALREADY);
169 EINA_SAFETY_ON_NULL_RETURN_VAL(address, EINVAL); 169 EINA_SAFETY_ON_NULL_RETURN_VAL(address, EINVAL);
170 170
171#ifndef HAVE_SYSTEMD 171#ifndef HAVE_SYSTEMD
@@ -177,7 +177,7 @@ _efl_net_server_unix_efl_net_server_fd_socket_activate(Eo *o, Efl_Net_Server_Uni
177 Eina_Error err; 177 Eina_Error err;
178 struct sockaddr_storage *addr; 178 struct sockaddr_storage *addr;
179 socklen_t addrlen; 179 socklen_t addrlen;
180 int fd; 180 SOCKET fd;
181 181
182 err = efl_net_ip_socket_activate_check(address, AF_UNIX, SOCK_STREAM, &listening); 182 err = efl_net_ip_socket_activate_check(address, AF_UNIX, SOCK_STREAM, &listening);
183 if (err) return err; 183 if (err) return err;
@@ -192,7 +192,7 @@ _efl_net_server_unix_efl_net_server_fd_socket_activate(Eo *o, Efl_Net_Server_Uni
192 if (listen(fd, 0) != 0) 192 if (listen(fd, 0) != 0)
193 { 193 {
194 err = efl_net_socket_error_get(); 194 err = efl_net_socket_error_get();
195 DBG("listen(%d): %s", fd, eina_error_msg_get(err)); 195 DBG("listen(" SOCKET_FMT "): %s", fd, eina_error_msg_get(err));
196 goto error; 196 goto error;
197 } 197 }
198 } 198 }
@@ -201,19 +201,19 @@ _efl_net_server_unix_efl_net_server_fd_socket_activate(Eo *o, Efl_Net_Server_Uni
201 if (getsockname(fd, (struct sockaddr *)&addr, &addrlen) != 0) 201 if (getsockname(fd, (struct sockaddr *)&addr, &addrlen) != 0)
202 { 202 {
203 err = efl_net_socket_error_get(); 203 err = efl_net_socket_error_get();
204 ERR("getsockname(%d): %s", fd, eina_error_msg_get(err)); 204 ERR("getsockname(" SOCKET_FMT "): %s", fd, eina_error_msg_get(err));
205 goto error; 205 goto error;
206 } 206 }
207 else if (efl_net_ip_port_fmt(buf, sizeof(buf), (struct sockaddr *)&addr)) 207 else if (efl_net_ip_port_fmt(buf, sizeof(buf), (struct sockaddr *)&addr))
208 efl_net_server_address_set(o, buf); 208 efl_net_server_address_set(o, buf);
209 209
210 DBG("fd=%d serving at %s", fd, address); 210 DBG("fd=" SOCKET_FMT " serving at %s", fd, address);
211 efl_net_server_serving_set(o, EINA_TRUE); 211 efl_net_server_serving_set(o, EINA_TRUE);
212 return 0; 212 return 0;
213 213
214 error: 214 error:
215 efl_net_server_fd_family_set(o, AF_UNSPEC); 215 efl_net_server_fd_family_set(o, AF_UNSPEC);
216 efl_loop_fd_set(o, INVALID_SOCKET); 216 efl_loop_fd_set(o, SOCKET_TO_LOOP_FD(INVALID_SOCKET));
217 closesocket(fd); 217 closesocket(fd);
218 return err; 218 return err;
219 } 219 }
@@ -266,7 +266,7 @@ _efl_net_server_unix_efl_net_server_fd_client_add(Eo *o, Efl_Net_Server_Unix_Dat
266 efl_loop_fd_set(efl_added, client_fd)); 266 efl_loop_fd_set(efl_added, client_fd));
267 if (!client) 267 if (!client)
268 { 268 {
269 ERR("could not create client object fd=%d", client_fd); 269 ERR("could not create client object fd=" SOCKET_FMT, (SOCKET)client_fd);
270 closesocket(client_fd); 270 closesocket(client_fd);
271 return; 271 return;
272 } 272 }
@@ -295,7 +295,7 @@ _efl_net_server_unix_efl_net_server_fd_client_reject(Eo *o, Efl_Net_Server_Unix_
295 else 295 else
296 { 296 {
297 if (!efl_net_unix_fmt(str, sizeof(str), client_fd, &addr, addrlen)) 297 if (!efl_net_unix_fmt(str, sizeof(str), client_fd, &addr, addrlen))
298 ERR("could not format rejected client unix address fd=%d", client_fd); 298 ERR("could not format rejected client unix address fd=" SOCKET_FMT, (SOCKET)client_fd);
299 } 299 }
300 300
301 closesocket(client_fd); 301 closesocket(client_fd);
diff --git a/src/lib/ecore_con/efl_net_socket_fd.c b/src/lib/ecore_con/efl_net_socket_fd.c
index 5f3fd03877..9ce046f8d8 100644
--- a/src/lib/ecore_con/efl_net_socket_fd.c
+++ b/src/lib/ecore_con/efl_net_socket_fd.c
@@ -118,23 +118,25 @@ _efl_net_socket_fd_set(Eo *o, Efl_Net_Socket_Fd_Data *pd, SOCKET fd)
118static void 118static void
119_efl_net_socket_fd_unset(Eo *o) 119_efl_net_socket_fd_unset(Eo *o)
120{ 120{
121 efl_io_reader_fd_reader_fd_set(o, INVALID_SOCKET); 121 efl_io_reader_fd_reader_fd_set(o, SOCKET_TO_LOOP_FD(INVALID_SOCKET));
122 efl_io_writer_fd_writer_fd_set(o, INVALID_SOCKET); 122 efl_io_writer_fd_writer_fd_set(o, SOCKET_TO_LOOP_FD(INVALID_SOCKET));
123 efl_io_closer_fd_closer_fd_set(o, INVALID_SOCKET); 123 efl_io_closer_fd_closer_fd_set(o, SOCKET_TO_LOOP_FD(INVALID_SOCKET));
124 124
125 efl_net_socket_address_local_set(o, NULL); 125 efl_net_socket_address_local_set(o, NULL);
126 efl_net_socket_address_remote_set(o, NULL); 126 efl_net_socket_address_remote_set(o, NULL);
127} 127}
128 128
129EOLIAN static void 129EOLIAN static void
130_efl_net_socket_fd_efl_loop_fd_fd_set(Eo *o, Efl_Net_Socket_Fd_Data *pd, int fd) 130_efl_net_socket_fd_efl_loop_fd_fd_set(Eo *o, Efl_Net_Socket_Fd_Data *pd, int pfd)
131{ 131{
132 SOCKET fd = (SOCKET)pfd;
133
132 if ((pd->family == AF_UNSPEC) && (fd != INVALID_SOCKET)) 134 if ((pd->family == AF_UNSPEC) && (fd != INVALID_SOCKET))
133 { 135 {
134 struct sockaddr_storage addr; 136 struct sockaddr_storage addr;
135 socklen_t addrlen = sizeof(addr); 137 socklen_t addrlen = sizeof(addr);
136 if (getsockname(fd, (struct sockaddr *)&addr, &addrlen) != 0) 138 if (getsockname(fd, (struct sockaddr *)&addr, &addrlen) != 0)
137 ERR("getsockname(%d): %s", fd, eina_error_msg_get(efl_net_socket_error_get())); 139 ERR("getsockname(" SOCKET_FMT "): %s", fd, eina_error_msg_get(efl_net_socket_error_get()));
138 else 140 else
139 efl_net_socket_fd_family_set(o, addr.ss_family); 141 efl_net_socket_fd_family_set(o, addr.ss_family);
140 } 142 }
@@ -161,9 +163,9 @@ _efl_net_socket_fd_efl_io_closer_close(Eo *o, Efl_Net_Socket_Fd_Data *pd EINA_UN
161 * retain efl_io_closer_fd_closer_fd_get() so close(super()) works 163 * retain efl_io_closer_fd_closer_fd_get() so close(super()) works
162 * and we emit the events with proper addresses. 164 * and we emit the events with proper addresses.
163 */ 165 */
164 efl_loop_fd_set(efl_super(o, MY_CLASS), INVALID_SOCKET); 166 efl_loop_fd_set(efl_super(o, MY_CLASS), SOCKET_TO_LOOP_FD(INVALID_SOCKET));
165 167
166 efl_io_closer_fd_closer_fd_set(o, INVALID_SOCKET); 168 efl_io_closer_fd_closer_fd_set(o, SOCKET_TO_LOOP_FD(INVALID_SOCKET));
167 if (closesocket(fd) != 0) ret = efl_net_socket_error_get(); 169 if (closesocket(fd) != 0) ret = efl_net_socket_error_get();
168 efl_event_callback_call(o, EFL_IO_CLOSER_EVENT_CLOSED, NULL); 170 efl_event_callback_call(o, EFL_IO_CLOSER_EVENT_CLOSED, NULL);
169 171
@@ -176,7 +178,7 @@ _efl_net_socket_fd_efl_io_closer_close(Eo *o, Efl_Net_Socket_Fd_Data *pd EINA_UN
176EOLIAN static Eina_Bool 178EOLIAN static Eina_Bool
177_efl_net_socket_fd_efl_io_closer_closed_get(Eo *o, Efl_Net_Socket_Fd_Data *pd EINA_UNUSED) 179_efl_net_socket_fd_efl_io_closer_closed_get(Eo *o, Efl_Net_Socket_Fd_Data *pd EINA_UNUSED)
178{ 180{
179 return efl_io_closer_fd_closer_fd_get(o) == INVALID_SOCKET; 181 return (SOCKET)efl_io_closer_fd_closer_fd_get(o) == INVALID_SOCKET;
180} 182}
181 183
182EOLIAN static Eina_Error 184EOLIAN static Eina_Error
diff --git a/src/lib/ecore_con/efl_net_socket_tcp.c b/src/lib/ecore_con/efl_net_socket_tcp.c
index 24e4aaf6b1..3a75e39d09 100644
--- a/src/lib/ecore_con/efl_net_socket_tcp.c
+++ b/src/lib/ecore_con/efl_net_socket_tcp.c
@@ -43,9 +43,11 @@ typedef struct _Efl_Net_Socket_Tcp_Data
43} Efl_Net_Socket_Tcp_Data; 43} Efl_Net_Socket_Tcp_Data;
44 44
45EOLIAN static void 45EOLIAN static void
46_efl_net_socket_tcp_efl_loop_fd_fd_set(Eo *o, Efl_Net_Socket_Tcp_Data *pd, int fd) 46_efl_net_socket_tcp_efl_loop_fd_fd_set(Eo *o, Efl_Net_Socket_Tcp_Data *pd, int pfd)
47{ 47{
48 efl_loop_fd_set(efl_super(o, MY_CLASS), fd); 48 SOCKET fd = (SOCKET)pfd;
49
50 efl_loop_fd_set(efl_super(o, MY_CLASS), pfd);
49 51
50 if (fd != INVALID_SOCKET) 52 if (fd != INVALID_SOCKET)
51 { 53 {
@@ -63,7 +65,7 @@ _efl_net_socket_tcp_efl_loop_fd_fd_set(Eo *o, Efl_Net_Socket_Tcp_Data *pd, int f
63 65
64 addrlen = sizeof(addr); 66 addrlen = sizeof(addr);
65 if (getsockname(fd, (struct sockaddr *)&addr, &addrlen) != 0) 67 if (getsockname(fd, (struct sockaddr *)&addr, &addrlen) != 0)
66 ERR("getsockname(%d): %s", fd, eina_error_msg_get(efl_net_socket_error_get())); 68 ERR("getsockname(" SOCKET_FMT "): %s", fd, eina_error_msg_get(efl_net_socket_error_get()));
67 else 69 else
68 { 70 {
69 char str[INET6_ADDRSTRLEN + sizeof("[]:65536")]; 71 char str[INET6_ADDRSTRLEN + sizeof("[]:65536")];
@@ -73,7 +75,7 @@ _efl_net_socket_tcp_efl_loop_fd_fd_set(Eo *o, Efl_Net_Socket_Tcp_Data *pd, int f
73 75
74 addrlen = sizeof(addr); 76 addrlen = sizeof(addr);
75 if (getpeername(fd, (struct sockaddr *)&addr, &addrlen) != 0) 77 if (getpeername(fd, (struct sockaddr *)&addr, &addrlen) != 0)
76 ERR("getpeername(%d): %s", fd, eina_error_msg_get(efl_net_socket_error_get())); 78 ERR("getpeername(" SOCKET_FMT "): %s", fd, eina_error_msg_get(efl_net_socket_error_get()));
77 else 79 else
78 { 80 {
79 char str[INET6_ADDRSTRLEN + sizeof("[]:65536")]; 81 char str[INET6_ADDRSTRLEN + sizeof("[]:65536")];
@@ -102,7 +104,7 @@ _efl_net_socket_tcp_keep_alive_set(Eo *o, Efl_Net_Socket_Tcp_Data *pd, Eina_Bool
102 value = keep_alive; 104 value = keep_alive;
103 if (setsockopt(fd, SOL_SOCKET, SO_KEEPALIVE, &value, sizeof(value)) != 0) 105 if (setsockopt(fd, SOL_SOCKET, SO_KEEPALIVE, &value, sizeof(value)) != 0)
104 { 106 {
105 ERR("setsockopt(%d, SOL_SOCKET, SO_KEEPALIVE, %d): %s", 107 ERR("setsockopt(" SOCKET_FMT ", SOL_SOCKET, SO_KEEPALIVE, %d): %s",
106 fd, value, eina_error_msg_get(efl_net_socket_error_get())); 108 fd, value, eina_error_msg_get(efl_net_socket_error_get()));
107 pd->keep_alive = old; 109 pd->keep_alive = old;
108 return EINA_FALSE; 110 return EINA_FALSE;
@@ -132,7 +134,7 @@ _efl_net_socket_tcp_keep_alive_get(Eo *o, Efl_Net_Socket_Tcp_Data *pd)
132 valuelen = sizeof(value); 134 valuelen = sizeof(value);
133 if (getsockopt(fd, SOL_SOCKET, SO_KEEPALIVE, &value, &valuelen) != 0) 135 if (getsockopt(fd, SOL_SOCKET, SO_KEEPALIVE, &value, &valuelen) != 0)
134 { 136 {
135 ERR("getsockopt(%d, SOL_SOCKET, SO_KEEPALIVE): %s", 137 ERR("getsockopt(" SOCKET_FMT ", SOL_SOCKET, SO_KEEPALIVE): %s",
136 fd, eina_error_msg_get(efl_net_socket_error_get())); 138 fd, eina_error_msg_get(efl_net_socket_error_get()));
137 return EINA_FALSE; 139 return EINA_FALSE;
138 } 140 }
@@ -160,7 +162,7 @@ _efl_net_socket_tcp_no_delay_set(Eo *o, Efl_Net_Socket_Tcp_Data *pd, Eina_Bool n
160 value = no_delay; 162 value = no_delay;
161 if (setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, &value, sizeof(value)) != 0) 163 if (setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, &value, sizeof(value)) != 0)
162 { 164 {
163 ERR("setsockopt(%d, IPPROTO_TCP, TCP_NODELAY, %d): %s", 165 ERR("setsockopt(" SOCKET_FMT ", IPPROTO_TCP, TCP_NODELAY, %d): %s",
164 fd, value, eina_error_msg_get(efl_net_socket_error_get())); 166 fd, value, eina_error_msg_get(efl_net_socket_error_get()));
165 pd->no_delay = old; 167 pd->no_delay = old;
166 return EINA_FALSE; 168 return EINA_FALSE;
@@ -190,7 +192,7 @@ _efl_net_socket_tcp_no_delay_get(Eo *o, Efl_Net_Socket_Tcp_Data *pd)
190 valuelen = sizeof(value); 192 valuelen = sizeof(value);
191 if (getsockopt(fd, IPPROTO_TCP, TCP_NODELAY, &value, &valuelen) != 0) 193 if (getsockopt(fd, IPPROTO_TCP, TCP_NODELAY, &value, &valuelen) != 0)
192 { 194 {
193 ERR("getsockopt(%d, IPPROTO_TCP, TCP_NODELAY): %s", 195 ERR("getsockopt(" SOCKET_FMT ", IPPROTO_TCP, TCP_NODELAY): %s",
194 fd, eina_error_msg_get(efl_net_socket_error_get())); 196 fd, eina_error_msg_get(efl_net_socket_error_get()));
195 return EINA_FALSE; 197 return EINA_FALSE;
196 } 198 }
@@ -214,7 +216,8 @@ _cork_option_get(void)
214EOLIAN static Eina_Bool 216EOLIAN static Eina_Bool
215_efl_net_socket_tcp_cork_set(Eo *o, Efl_Net_Socket_Tcp_Data *pd, Eina_Bool cork) 217_efl_net_socket_tcp_cork_set(Eo *o, Efl_Net_Socket_Tcp_Data *pd, Eina_Bool cork)
216{ 218{
217 int value, fd, option; 219 SOCKET fd;
220 int value, option;
218 Eina_Bool old = pd->cork; 221 Eina_Bool old = pd->cork;
219 222
220 option = _cork_option_get(); 223 option = _cork_option_get();
@@ -233,7 +236,7 @@ _efl_net_socket_tcp_cork_set(Eo *o, Efl_Net_Socket_Tcp_Data *pd, Eina_Bool cork)
233 value = cork; 236 value = cork;
234 if (setsockopt(fd, IPPROTO_TCP, option, &value, sizeof(value)) != 0) 237 if (setsockopt(fd, IPPROTO_TCP, option, &value, sizeof(value)) != 0)
235 { 238 {
236 ERR("setsockopt(%d, IPPROTO_TCP, 0x%x, %d): %s", 239 ERR("setsockopt(" SOCKET_FMT ", IPPROTO_TCP, 0x%x, %d): %s",
237 fd, option, value, eina_error_msg_get(efl_net_socket_error_get())); 240 fd, option, value, eina_error_msg_get(efl_net_socket_error_get()));
238 pd->cork = old; 241 pd->cork = old;
239 return EINA_FALSE; 242 return EINA_FALSE;
@@ -245,7 +248,8 @@ _efl_net_socket_tcp_cork_set(Eo *o, Efl_Net_Socket_Tcp_Data *pd, Eina_Bool cork)
245EOLIAN static Eina_Bool 248EOLIAN static Eina_Bool
246_efl_net_socket_tcp_cork_get(Eo *o, Efl_Net_Socket_Tcp_Data *pd) 249_efl_net_socket_tcp_cork_get(Eo *o, Efl_Net_Socket_Tcp_Data *pd)
247{ 250{
248 int value = 0, fd; 251 SOCKET fd;
252 int value = 0;
249 socklen_t valuelen; 253 socklen_t valuelen;
250 int option; 254 int option;
251 255
@@ -265,7 +269,7 @@ _efl_net_socket_tcp_cork_get(Eo *o, Efl_Net_Socket_Tcp_Data *pd)
265 valuelen = sizeof(value); 269 valuelen = sizeof(value);
266 if (getsockopt(fd, IPPROTO_TCP, option, &value, &valuelen) != 0) 270 if (getsockopt(fd, IPPROTO_TCP, option, &value, &valuelen) != 0)
267 { 271 {
268 ERR("getsockopt(%d, IPPROTO_TCP, 0x%x): %s", 272 ERR("getsockopt(" SOCKET_FMT ", IPPROTO_TCP, 0x%x): %s",
269 fd, option, eina_error_msg_get(efl_net_socket_error_get())); 273 fd, option, eina_error_msg_get(efl_net_socket_error_get()));
270 return EINA_FALSE; 274 return EINA_FALSE;
271 } 275 }
diff --git a/src/lib/ecore_con/efl_net_socket_udp.c b/src/lib/ecore_con/efl_net_socket_udp.c
index 3cfbd56750..e744717291 100644
--- a/src/lib/ecore_con/efl_net_socket_udp.c
+++ b/src/lib/ecore_con/efl_net_socket_udp.c
@@ -140,14 +140,15 @@ _efl_net_socket_udp_bind(Eo *o, Efl_Net_Socket_Udp_Data *pd)
140} 140}
141 141
142EOLIAN static void 142EOLIAN static void
143_efl_net_socket_udp_efl_loop_fd_fd_set(Eo *o, Efl_Net_Socket_Udp_Data *pd, int fd) 143_efl_net_socket_udp_efl_loop_fd_fd_set(Eo *o, Efl_Net_Socket_Udp_Data *pd, int pfd)
144{ 144{
145 SOCKET fd = (SOCKET)pfd;
145 Eina_List *node; 146 Eina_List *node;
146 struct sockaddr_storage addr; 147 struct sockaddr_storage addr;
147 socklen_t addrlen; 148 socklen_t addrlen;
148 int family; 149 int family;
149 150
150 efl_loop_fd_set(efl_super(o, MY_CLASS), fd); 151 efl_loop_fd_set(efl_super(o, MY_CLASS), pfd);
151 152
152 if (fd == INVALID_SOCKET) return; 153 if (fd == INVALID_SOCKET) return;
153 154
@@ -197,7 +198,7 @@ _efl_net_socket_udp_efl_loop_fd_fd_set(Eo *o, Efl_Net_Socket_Udp_Data *pd, int f
197 198
198 addrlen = sizeof(addr); 199 addrlen = sizeof(addr);
199 if (getsockname(fd, (struct sockaddr *)&addr, &addrlen) != 0) 200 if (getsockname(fd, (struct sockaddr *)&addr, &addrlen) != 0)
200 ERR("getsockname(%d): %s", fd, eina_error_msg_get(efl_net_socket_error_get())); 201 ERR("getsockname(" SOCKET_FMT "): %s", fd, eina_error_msg_get(efl_net_socket_error_get()));
201 else 202 else
202 { 203 {
203 char str[INET6_ADDRSTRLEN + sizeof("[]:65536")]; 204 char str[INET6_ADDRSTRLEN + sizeof("[]:65536")];
@@ -227,7 +228,8 @@ _cork_option_get(void)
227EOLIAN static Eina_Bool 228EOLIAN static Eina_Bool
228_efl_net_socket_udp_cork_set(Eo *o, Efl_Net_Socket_Udp_Data *pd, Eina_Bool cork) 229_efl_net_socket_udp_cork_set(Eo *o, Efl_Net_Socket_Udp_Data *pd, Eina_Bool cork)
229{ 230{
230 int value, fd, option; 231 SOCKET fd;
232 int value, option;
231 Eina_Bool old = pd->cork; 233 Eina_Bool old = pd->cork;
232 234
233 option = _cork_option_get(); 235 option = _cork_option_get();
@@ -246,7 +248,7 @@ _efl_net_socket_udp_cork_set(Eo *o, Efl_Net_Socket_Udp_Data *pd, Eina_Bool cork)
246 value = cork; 248 value = cork;
247 if (setsockopt(fd, IPPROTO_UDP, option, &value, sizeof(value)) != 0) 249 if (setsockopt(fd, IPPROTO_UDP, option, &value, sizeof(value)) != 0)
248 { 250 {
249 ERR("setsockopt(%d, IPPROTO_UDP, 0x%x, %d): %s", 251 ERR("setsockopt(" SOCKET_FMT ", IPPROTO_UDP, 0x%x, %d): %s",
250 fd, option, value, eina_error_msg_get(efl_net_socket_error_get())); 252 fd, option, value, eina_error_msg_get(efl_net_socket_error_get()));
251 pd->cork = old; 253 pd->cork = old;
252 return EINA_FALSE; 254 return EINA_FALSE;
@@ -258,7 +260,8 @@ _efl_net_socket_udp_cork_set(Eo *o, Efl_Net_Socket_Udp_Data *pd, Eina_Bool cork)
258EOLIAN static Eina_Bool 260EOLIAN static Eina_Bool
259_efl_net_socket_udp_cork_get(Eo *o, Efl_Net_Socket_Udp_Data *pd) 261_efl_net_socket_udp_cork_get(Eo *o, Efl_Net_Socket_Udp_Data *pd)
260{ 262{
261 int value = 0, fd; 263 SOCKET fd;
264 int value = 0;
262 socklen_t valuelen; 265 socklen_t valuelen;
263 int option; 266 int option;
264 267
@@ -278,7 +281,7 @@ _efl_net_socket_udp_cork_get(Eo *o, Efl_Net_Socket_Udp_Data *pd)
278 valuelen = sizeof(value); 281 valuelen = sizeof(value);
279 if (getsockopt(fd, IPPROTO_UDP, option, &value, &valuelen) != 0) 282 if (getsockopt(fd, IPPROTO_UDP, option, &value, &valuelen) != 0)
280 { 283 {
281 ERR("getsockopt(%d, IPPROTO_UDP, 0x%x): %s", 284 ERR("getsockopt(" SOCKET_FMT ", IPPROTO_UDP, 0x%x): %s",
282 fd, option, eina_error_msg_get(efl_net_socket_error_get())); 285 fd, option, eina_error_msg_get(efl_net_socket_error_get()));
283 return EINA_FALSE; 286 return EINA_FALSE;
284 } 287 }
@@ -305,7 +308,7 @@ _efl_net_socket_udp_dont_route_set(Eo *o, Efl_Net_Socket_Udp_Data *pd, Eina_Bool
305 if (setsockopt(fd, SOL_SOCKET, SO_DONTROUTE, &value, sizeof(value)) != 0) 308 if (setsockopt(fd, SOL_SOCKET, SO_DONTROUTE, &value, sizeof(value)) != 0)
306 { 309 {
307 Eina_Error err = efl_net_socket_error_get(); 310 Eina_Error err = efl_net_socket_error_get();
308 ERR("setsockopt(%d, SOL_SOCKET, SO_DONTROUTE, %u): %s", fd, dont_route, eina_error_msg_get(err)); 311 ERR("setsockopt(" SOCKET_FMT ", SOL_SOCKET, SO_DONTROUTE, %u): %s", fd, dont_route, eina_error_msg_get(err));
309 pd->dont_route = old; 312 pd->dont_route = old;
310 return EINA_FALSE; 313 return EINA_FALSE;
311 } 314 }
@@ -333,7 +336,7 @@ _efl_net_socket_udp_dont_route_get(Eo *o, Efl_Net_Socket_Udp_Data *pd)
333 if (getsockopt(fd, SOL_SOCKET, SO_DONTROUTE, &value, &valuelen) != 0) 336 if (getsockopt(fd, SOL_SOCKET, SO_DONTROUTE, &value, &valuelen) != 0)
334 { 337 {
335 Eina_Error err = efl_net_socket_error_get(); 338 Eina_Error err = efl_net_socket_error_get();
336 ERR("getsockopt(%d, SOL_SOCKET, SO_DONTROUTE): %s", fd, eina_error_msg_get(err)); 339 ERR("getsockopt(" SOCKET_FMT ", SOL_SOCKET, SO_DONTROUTE): %s", fd, eina_error_msg_get(err));
337 return EINA_FALSE; 340 return EINA_FALSE;
338 } 341 }
339 342
@@ -345,7 +348,8 @@ _efl_net_socket_udp_dont_route_get(Eo *o, Efl_Net_Socket_Udp_Data *pd)
345EOLIAN static Eina_Bool 348EOLIAN static Eina_Bool
346_efl_net_socket_udp_reuse_address_set(Eo *o, Efl_Net_Socket_Udp_Data *pd, Eina_Bool reuse_address) 349_efl_net_socket_udp_reuse_address_set(Eo *o, Efl_Net_Socket_Udp_Data *pd, Eina_Bool reuse_address)
347{ 350{
348 int value, fd; 351 SOCKET fd;
352 int value;
349 Eina_Bool old = pd->reuse_address; 353 Eina_Bool old = pd->reuse_address;
350 354
351 pd->reuse_address = reuse_address; 355 pd->reuse_address = reuse_address;
@@ -356,7 +360,7 @@ _efl_net_socket_udp_reuse_address_set(Eo *o, Efl_Net_Socket_Udp_Data *pd, Eina_B
356 value = reuse_address; 360 value = reuse_address;
357 if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &value, sizeof(value)) != 0) 361 if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &value, sizeof(value)) != 0)
358 { 362 {
359 ERR("setsockopt(%d, SOL_SOCKET, SO_REUSEADDR, %d): %s", 363 ERR("setsockopt(" SOCKET_FMT ", SOL_SOCKET, SO_REUSEADDR, %d): %s",
360 fd, value, eina_error_msg_get(efl_net_socket_error_get())); 364 fd, value, eina_error_msg_get(efl_net_socket_error_get()));
361 pd->reuse_address = old; 365 pd->reuse_address = old;
362 return EINA_FALSE; 366 return EINA_FALSE;
@@ -368,7 +372,8 @@ _efl_net_socket_udp_reuse_address_set(Eo *o, Efl_Net_Socket_Udp_Data *pd, Eina_B
368EOLIAN static Eina_Bool 372EOLIAN static Eina_Bool
369_efl_net_socket_udp_reuse_address_get(Eo *o, Efl_Net_Socket_Udp_Data *pd) 373_efl_net_socket_udp_reuse_address_get(Eo *o, Efl_Net_Socket_Udp_Data *pd)
370{ 374{
371 int value = 0, fd; 375 SOCKET fd;
376 int value = 0;
372 socklen_t valuelen; 377 socklen_t valuelen;
373 378
374 fd = efl_loop_fd_get(o); 379 fd = efl_loop_fd_get(o);
@@ -380,7 +385,7 @@ _efl_net_socket_udp_reuse_address_get(Eo *o, Efl_Net_Socket_Udp_Data *pd)
380 valuelen = sizeof(value); 385 valuelen = sizeof(value);
381 if (getsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &value, &valuelen) != 0) 386 if (getsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &value, &valuelen) != 0)
382 { 387 {
383 ERR("getsockopt(%d, SOL_SOCKET, SO_REUSEADDR): %s", 388 ERR("getsockopt(" SOCKET_FMT ", SOL_SOCKET, SO_REUSEADDR): %s",
384 fd, eina_error_msg_get(efl_net_socket_error_get())); 389 fd, eina_error_msg_get(efl_net_socket_error_get()));
385 return EINA_FALSE; 390 return EINA_FALSE;
386 } 391 }
@@ -393,7 +398,8 @@ EOLIAN static Eina_Bool
393_efl_net_socket_udp_reuse_port_set(Eo *o, Efl_Net_Socket_Udp_Data *pd, Eina_Bool reuse_port) 398_efl_net_socket_udp_reuse_port_set(Eo *o, Efl_Net_Socket_Udp_Data *pd, Eina_Bool reuse_port)
394{ 399{
395#ifdef SO_REUSEPORT 400#ifdef SO_REUSEPORT
396 int value, fd; 401 SOCKET fd;
402 int value;
397 Eina_Bool old = pd->reuse_port; 403 Eina_Bool old = pd->reuse_port;
398#endif 404#endif
399 405
@@ -406,7 +412,7 @@ _efl_net_socket_udp_reuse_port_set(Eo *o, Efl_Net_Socket_Udp_Data *pd, Eina_Bool
406 value = reuse_port; 412 value = reuse_port;
407 if (setsockopt(fd, SOL_SOCKET, SO_REUSEPORT, &value, sizeof(value)) != 0) 413 if (setsockopt(fd, SOL_SOCKET, SO_REUSEPORT, &value, sizeof(value)) != 0)
408 { 414 {
409 ERR("setsockopt(%d, SOL_SOCKET, SO_REUSEPORT, %d): %s", 415 ERR("setsockopt(" SOCKET_FMT ", SOL_SOCKET, SO_REUSEPORT, %d): %s",
410 fd, value, eina_error_msg_get(efl_net_socket_error_get())); 416 fd, value, eina_error_msg_get(efl_net_socket_error_get()));
411 pd->reuse_port = old; 417 pd->reuse_port = old;
412 return EINA_FALSE; 418 return EINA_FALSE;
@@ -420,7 +426,8 @@ EOLIAN static Eina_Bool
420_efl_net_socket_udp_reuse_port_get(Eo *o, Efl_Net_Socket_Udp_Data *pd) 426_efl_net_socket_udp_reuse_port_get(Eo *o, Efl_Net_Socket_Udp_Data *pd)
421{ 427{
422#ifdef SO_REUSEPORT 428#ifdef SO_REUSEPORT
423 int value = 0, fd; 429 SOCKET fd;
430 int value = 0;
424 socklen_t valuelen; 431 socklen_t valuelen;
425 432
426 fd = efl_loop_fd_get(o); 433 fd = efl_loop_fd_get(o);
@@ -432,7 +439,7 @@ _efl_net_socket_udp_reuse_port_get(Eo *o, Efl_Net_Socket_Udp_Data *pd)
432 valuelen = sizeof(value); 439 valuelen = sizeof(value);
433 if (getsockopt(fd, SOL_SOCKET, SO_REUSEPORT, &value, &valuelen) != 0) 440 if (getsockopt(fd, SOL_SOCKET, SO_REUSEPORT, &value, &valuelen) != 0)
434 { 441 {
435 ERR("getsockopt(%d, SOL_SOCKET, SO_REUSEPORT): %s", 442 ERR("getsockopt(" SOCKET_FMT ", SOL_SOCKET, SO_REUSEPORT): %s",
436 fd, eina_error_msg_get(efl_net_socket_error_get())); 443 fd, eina_error_msg_get(efl_net_socket_error_get()));
437 return EINA_FALSE; 444 return EINA_FALSE;
438 } 445 }
diff --git a/src/lib/ecore_con/efl_net_socket_unix.c b/src/lib/ecore_con/efl_net_socket_unix.c
index 2647a4e020..ae88f4f79e 100644
--- a/src/lib/ecore_con/efl_net_socket_unix.c
+++ b/src/lib/ecore_con/efl_net_socket_unix.c
@@ -33,9 +33,11 @@ typedef struct _Efl_Net_Socket_Unix_Data
33} Efl_Net_Socket_Unix_Data; 33} Efl_Net_Socket_Unix_Data;
34 34
35EOLIAN static void 35EOLIAN static void
36_efl_net_socket_unix_efl_loop_fd_fd_set(Eo *o, Efl_Net_Socket_Unix_Data *pd EINA_UNUSED, int fd) 36_efl_net_socket_unix_efl_loop_fd_fd_set(Eo *o, Efl_Net_Socket_Unix_Data *pd EINA_UNUSED, int pfd)
37{ 37{
38 efl_loop_fd_set(efl_super(o, MY_CLASS), fd); 38 SOCKET fd = (SOCKET)pfd;
39
40 efl_loop_fd_set(efl_super(o, MY_CLASS), pfd);
39 41
40 if (fd != INVALID_SOCKET) 42 if (fd != INVALID_SOCKET)
41 { 43 {
@@ -49,7 +51,7 @@ _efl_net_socket_unix_efl_loop_fd_fd_set(Eo *o, Efl_Net_Socket_Unix_Data *pd EINA
49 51
50 addrlen = sizeof(addr); 52 addrlen = sizeof(addr);
51 if (getsockname(fd, (struct sockaddr *)&addr, &addrlen) != 0) 53 if (getsockname(fd, (struct sockaddr *)&addr, &addrlen) != 0)
52 ERR("getsockname(%d): %s", fd, eina_error_msg_get(efl_net_socket_error_get())); 54 ERR("getsockname(" SOCKET_FMT "): %s", fd, eina_error_msg_get(efl_net_socket_error_get()));
53 else 55 else
54 { 56 {
55 char str[sizeof(addr) + sizeof("abstract:")]; 57 char str[sizeof(addr) + sizeof("abstract:")];
@@ -62,7 +64,7 @@ _efl_net_socket_unix_efl_loop_fd_fd_set(Eo *o, Efl_Net_Socket_Unix_Data *pd EINA
62 64
63 addrlen = sizeof(addr); 65 addrlen = sizeof(addr);
64 if (getpeername(fd, (struct sockaddr *)&addr, &addrlen) != 0) 66 if (getpeername(fd, (struct sockaddr *)&addr, &addrlen) != 0)
65 ERR("getpeername(%d): %s", fd, eina_error_msg_get(efl_net_socket_error_get())); 67 ERR("getpeername(" SOCKET_FMT "): %s", fd, eina_error_msg_get(efl_net_socket_error_get()));
66 else 68 else
67 { 69 {
68 char str[sizeof(addr) + sizeof("abstract:")]; 70 char str[sizeof(addr) + sizeof("abstract:")];