summaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
authorJay Sorg <jay.sorg@gmail.com>2017-11-06 16:06:36 -0800
committerjsorg71 <jay.sorg@gmail.com>2017-11-07 18:20:45 -0800
commit26507644e38906dee9095de29c92d0170c6da92f (patch)
tree9253309324433dc08ce71c928456e1de2aa5cd16 /common
parent50bd624cc49d7409f6f73b65aeae4cabdec3e7ee (diff)
downloadxrdp-proprietary-26507644e38906dee9095de29c92d0170c6da92f.tar.gz
xrdp-proprietary-26507644e38906dee9095de29c92d0170c6da92f.zip
vsock, move some defines
Diffstat (limited to 'common')
-rw-r--r--common/os_calls.c16
-rw-r--r--common/os_calls.h9
-rw-r--r--common/trans.c6
-rw-r--r--common/trans.h3
4 files changed, 8 insertions, 26 deletions
diff --git a/common/os_calls.c b/common/os_calls.c
index fb55376a..7bd3e68f 100644
--- a/common/os_calls.c
+++ b/common/os_calls.c
@@ -586,17 +586,15 @@ g_sck_local_socket(void)
}
/*****************************************************************************/
-#if defined(XRDP_ENABLE_VSOCK)
int
g_sck_vsock_socket(void)
{
-#if defined(_WIN32)
- return 0;
-#else
+#if defined(XRDP_ENABLE_VSOCK)
return socket(PF_VSOCK, SOCK_STREAM, 0);
+#else
+ return 0;
#endif
}
-#endif
/*****************************************************************************/
/* returns error */
@@ -1007,13 +1005,10 @@ g_sck_local_bind(int sck, const char *port)
}
/*****************************************************************************/
-#if defined(XRDP_ENABLE_VSOCK)
int
g_sck_vsock_bind(int sck, const char *port)
{
-#if defined(_WIN32)
- return -1;
-#else
+#if defined(XRDP_ENABLE_VSOCK)
struct sockaddr_vm s;
memset(&s, 0, sizeof(struct sockaddr_vm));
@@ -1022,9 +1017,10 @@ g_sck_vsock_bind(int sck, const char *port)
s.svm_cid = VMADDR_CID_ANY;
return bind(sck, (struct sockaddr *)&s, sizeof(struct sockaddr_vm));
+#else
+ return -1;
#endif
}
-#endif
#if defined(XRDP_ENABLE_IPV6)
/*****************************************************************************/
diff --git a/common/os_calls.h b/common/os_calls.h
index d21b4d9c..e42e95bd 100644
--- a/common/os_calls.h
+++ b/common/os_calls.h
@@ -37,11 +37,6 @@
#define g_tcp_select g_sck_select
#define g_close_wait_obj g_delete_wait_obj
-#if defined(XRDP_ENABLE_VSOCK)
-#define g_vsock_socket g_sck_vsock_socket
-#define g_vsock_bind g_sck_vsock_bind
-#endif
-
int g_rm_temp_dir(void);
int g_mk_socket_path(const char* app_name);
void g_init(const char* app_name);
@@ -67,9 +62,7 @@ int g_sck_get_send_buffer_bytes(int sck, int *bytes);
int g_sck_set_recv_buffer_bytes(int sck, int bytes);
int g_sck_get_recv_buffer_bytes(int sck, int *bytes);
int g_sck_local_socket(void);
-#if defined(XRDP_ENABLE_VSOCK)
int g_sck_vsock_socket(void);
-#endif
int g_sck_get_peer_cred(int sck, int *pid, int *uid, int *gid);
void g_sck_close(int sck);
int g_tcp_connect(int sck, const char* address, const char* port);
@@ -77,9 +70,7 @@ int g_sck_local_connect(int sck, const char* port);
int g_sck_set_non_blocking(int sck);
int g_tcp_bind(int sck, const char *port);
int g_sck_local_bind(int sck, const char* port);
-#if defined(XRDP_ENABLE_VSOCK)
int g_sck_vsock_bind(int sck, const char* port);
-#endif
int g_tcp_bind_address(int sck, const char* port, const char* address);
int g_sck_listen(int sck);
int g_tcp_accept(int sck);
diff --git a/common/trans.c b/common/trans.c
index 8a271722..24004dbf 100644
--- a/common/trans.c
+++ b/common/trans.c
@@ -831,16 +831,15 @@ trans_listen_address(struct trans *self, char *port, const char *address)
}
}
}
-#if defined(XRDP_ENABLE_VSOCK)
else if (self->mode == TRANS_MODE_VSOCK) /* vsock socket */
{
- self->sck = g_vsock_socket();
+ self->sck = g_sck_vsock_socket();
if (self->sck < 0)
return 1;
g_tcp_set_non_blocking(self->sck);
- if (g_vsock_bind(self->sck, port) == 0)
+ if (g_sck_vsock_bind(self->sck, port) == 0)
{
if (g_tcp_listen(self->sck) == 0)
{
@@ -850,7 +849,6 @@ trans_listen_address(struct trans *self, char *port, const char *address)
}
}
}
-#endif
return 1;
}
diff --git a/common/trans.h b/common/trans.h
index 8b0b5a70..57a0fd6a 100644
--- a/common/trans.h
+++ b/common/trans.h
@@ -26,10 +26,7 @@
#define TRANS_MODE_TCP 1
#define TRANS_MODE_UNIX 2
-
-#if defined(XRDP_ENABLE_VSOCK)
#define TRANS_MODE_VSOCK 3
-#endif
#define TRANS_TYPE_LISTENER 1
#define TRANS_TYPE_SERVER 2