diff options
author | Gerd Hoffmann <kraxel@redhat.com> | 2010-03-11 12:14:45 +0100 |
---|---|---|
committer | Uri Lublin <uril@redhat.com> | 2010-03-17 11:06:33 +0200 |
commit | 38add29e24e9923f76cdae4b1710bb754674a482 (patch) | |
tree | cf033c3e93d88322412c9a7ff4383ce2b508f2dc | |
parent | f2a8cb698ca44daa66a8ea6e627c5a0ea14be731 (diff) |
new libspice api: spice_server_add_get_{sock, peer}_info() #571286spice-server-0.4.2-4.el6
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
-rw-r--r-- | server/reds.c | 20 | ||||
-rw-r--r-- | server/spice.h | 4 |
2 files changed, 24 insertions, 0 deletions
diff --git a/server/reds.c b/server/reds.c index 108ade3e..a75aa555 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 651fa69b..88cea70b 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 |