[Spice-devel] [PATCH spice 4/9] reds-stream: add reds_stream_is_plain_unix()
Frediano Ziglio
fziglio at redhat.com
Thu Dec 10 10:39:58 PST 2015
>
> From: Marc-André Lureau <mlureau at redhat.com>
>
> Utility function used in follow-up code.
>
> Signed-off-by: Marc-André Lureau <marcandre.lureau at gmail.com>
> ---
> server/reds-stream.c | 20 +++++++++++++++++++-
> server/reds-stream.h | 3 ++-
> 2 files changed, 21 insertions(+), 2 deletions(-)
>
> diff --git a/server/reds-stream.c b/server/reds-stream.c
> index f5244e2..d87cb23 100644
> --- a/server/reds-stream.c
> +++ b/server/reds-stream.c
> @@ -226,7 +226,7 @@ ssize_t reds_stream_write(RedsStream *s, const void *buf,
> size_t nbyte)
> return ret;
> }
>
> -int reds_stream_get_family(RedsStream *s)
> +int reds_stream_get_family(const RedsStream *s)
> {
> spice_return_val_if_fail(s != NULL, -1);
>
This has nothing to do with the subject, should be moved in constify patch
> @@ -236,6 +236,24 @@ int reds_stream_get_family(RedsStream *s)
> return s->priv->info->laddr_ext.ss_family;
> }
>
> +int reds_stream_is_plain_unix(const RedsStream *s)
> +{
> + spice_return_val_if_fail(s != NULL, FALSE);
> +
> + if (reds_stream_get_family(s) != AF_UNIX)
> + return FALSE;
> +
> +#if HAVE_SASL
> + if (s->priv->sasl.conn)
> + return FALSE;
> +#endif
> + if (s->priv->ssl)
> + return FALSE;
> +
> + return TRUE;
> +
> +}
> +
> 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 b5889e3..9e53b22 100644
> --- a/server/reds-stream.h
> +++ b/server/reds-stream.h
> @@ -72,7 +72,8 @@ 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);
> +int reds_stream_get_family(const RedsStream *stream);
> +int reds_stream_is_plain_unix(const RedsStream *stream);
>
> typedef enum {
> REDS_SASL_ERROR_OK,
> --
> 2.5.0
>
Frediano
More information about the Spice-devel
mailing list