[Spice-devel] [PATCHv2 2/3] reds-stream: add reds_stream_get_family() function

Marc-André Lureau marcandre.lureau at gmail.com
Mon Jan 12 08:35:29 PST 2015


---
 server/reds_stream.c | 10 ++++++++++
 server/reds_stream.h |  1 +
 2 files changed, 11 insertions(+)

diff --git a/server/reds_stream.c b/server/reds_stream.c
index 4b61e31..e0b6f43 100644
--- a/server/reds_stream.c
+++ b/server/reds_stream.c
@@ -226,6 +226,16 @@ ssize_t reds_stream_write(RedsStream *s, const void *buf, size_t nbyte)
     return ret;
 }
 
+int reds_stream_get_family(RedsStream *s)
+{
+    spice_return_val_if_fail(s != NULL, -1);
+
+    if (s->socket == -1)
+        return -1;
+
+    return s->priv->info->laddr.sa_family;
+}
+
 ssize_t reds_stream_writev(RedsStream *s, const struct iovec *iov, int iovcnt)
 {
     int i;
diff --git a/server/reds_stream.h b/server/reds_stream.h
index 6cbbbbb..b5889e3 100644
--- a/server/reds_stream.h
+++ b/server/reds_stream.h
@@ -72,6 +72,7 @@ bool reds_stream_is_ssl(RedsStream *stream);
 RedsStreamSslStatus reds_stream_ssl_accept(RedsStream *stream);
 int reds_stream_enable_ssl(RedsStream *stream, SSL_CTX *ctx);
 void reds_stream_set_info_flag(RedsStream *stream, unsigned int flag);
+int reds_stream_get_family(RedsStream *stream);
 
 typedef enum {
     REDS_SASL_ERROR_OK,
-- 
2.1.0



More information about the Spice-devel mailing list