aboutsummaryrefslogtreecommitdiffstats
path: root/sockets.c
diff options
context:
space:
mode:
authorThe Android Open Source Project <initial-contribution@android.com>2009-02-10 15:43:59 -0800
committerThe Android Open Source Project <initial-contribution@android.com>2009-02-10 15:43:59 -0800
commitc27f813900a3c114562efbb8df1065e94766fc48 (patch)
treed95919283707dcab61009e27007374a745c9541e /sockets.c
parent0852ad57fa372f9b2854e4df685eaba8d8ef6790 (diff)
downloadexternal_qemu-c27f813900a3c114562efbb8df1065e94766fc48.zip
external_qemu-c27f813900a3c114562efbb8df1065e94766fc48.tar.gz
external_qemu-c27f813900a3c114562efbb8df1065e94766fc48.tar.bz2
auto import from //branches/cupcake/...@130745
Diffstat (limited to 'sockets.c')
-rw-r--r--sockets.c34
1 files changed, 30 insertions, 4 deletions
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 <fcntl.h>
-#include "android_debug.h"
+#include <stddef.h>
+#include "qemu_debug.h"
#include <stdlib.h>
#include <string.h>
-#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);
}