summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--server/reds.c20
-rw-r--r--server/spice.h4
2 files changed, 24 insertions, 0 deletions
diff --git a/server/reds.c b/server/reds.c
index 108ade3..a75aa55 100644
--- a/server/reds.c
+++ b/server/reds.c
@@ -5643,6 +5643,26 @@ int spice_server_set_mouse_absolute(SpiceServer *s, int absolute)
return 0;
}
+int spice_server_get_sock_info(SpiceServer *s, struct sockaddr *sa, socklen_t *salen)
+{
+ ASSERT(reds == s);
+ if (!reds->peer)
+ return -1;
+ if (getsockname(reds->peer->socket, sa, salen) < 0)
+ return -1;
+ return 0;
+}
+
+int spice_server_get_peer_info(SpiceServer *s, struct sockaddr *sa, socklen_t *salen)
+{
+ ASSERT(reds == s);
+ if (!reds->peer)
+ return -1;
+ if (getpeername(reds->peer->socket, sa, salen) < 0)
+ return -1;
+ return 0;
+}
+
int spice_server_add_renderer(SpiceServer *s, const char *name)
{
ASSERT(reds == s);
diff --git a/server/spice.h b/server/spice.h
index 651fa69..88cea70 100644
--- a/server/spice.h
+++ b/server/spice.h
@@ -18,6 +18,7 @@
#ifndef _H_SPICE
#define _H_SPICE
+#include <sys/socket.h>
#include "vd_interface.h"
/* old interface */
@@ -87,4 +88,7 @@ int spice_server_set_mouse_absolute(SpiceServer *s, int absolute);
int spice_server_add_renderer(SpiceServer *s, const char *name);
+int spice_server_get_sock_info(SpiceServer *s, struct sockaddr *sa, socklen_t *salen);
+int spice_server_get_peer_info(SpiceServer *s, struct sockaddr *sa, socklen_t *salen);
+
#endif