From c27f813900a3c114562efbb8df1065e94766fc48 Mon Sep 17 00:00:00 2001 From: The Android Open Source Project Date: Tue, 10 Feb 2009 15:43:59 -0800 Subject: auto import from //branches/cupcake/...@130745 --- sockets.c | 34 ++++++++++++++++++++++++++++++---- 1 file changed, 30 insertions(+), 4 deletions(-) (limited to 'sockets.c') diff --git a/sockets.c b/sockets.c index 5c841ba..62c1ee3 100644 --- a/sockets.c +++ b/sockets.c @@ -10,12 +10,13 @@ ** GNU General Public License for more details. */ #include "sockets.h" -#include "vl.h" +#include "qemu-common.h" #include -#include "android_debug.h" +#include +#include "qemu_debug.h" #include #include -#include "android_utils.h" +#include "android/utils/path.h" #ifdef _WIN32 # define xxWIN32_LEAN_AND_MEAN @@ -60,6 +61,7 @@ static int winsock_error; EE(WSA_NOT_ENOUGH_MEMORY,ENOMEM,"not enough memory") \ EE(WSA_INVALID_PARAMETER,EINVAL,"invalid parameter") \ EE(WSAEINTR,EINTR,"interrupted function call") \ + EE(WSAEALREADY,EALREADY,"operation already in progress") \ EE(WSAEBADF,EBADF,"bad file descriptor") \ EE(WSAEACCES,EACCES,"permission denied") \ EE(WSAEFAULT,EFAULT,"bad address") \ @@ -404,6 +406,30 @@ sock_address_get_port( const SockAddress* a ) } } +void +sock_address_set_port( SockAddress* a, uint16_t port ) +{ + switch (a->family) { + case SOCKET_INET: + a->u.inet.port = port; + break; + case SOCKET_IN6: + a->u.in6.port = port; + break; + default: + ; + } +} + +const char* +sock_address_get_path( const SockAddress* a ) +{ + if (a->family == SOCKET_UNIX) + return a->u._unix.path; + else + return NULL; +} + int sock_address_get_ip( const SockAddress* a ) { @@ -858,7 +884,7 @@ int socket_set_oobinline(int fd) } -int socket_set_lowlatency(int fd) +int socket_set_nodelay(int fd) { return socket_setoption(fd, IPPROTO_TCP, TCP_NODELAY, 1); } -- cgit v1.1