[Spice-devel] [PATCH spice-server 01/15] Use standard "Red" namespace

Christophe de Dinechin dinechin at redhat.com
Wed Nov 1 13:24:12 UTC 2017


Jonathon Jongsma writes:

> The objects RedsStream and RedsSASL are currently using the namespace
> "Reds" rather than the standard "Red" namespace used throughout the rest
> of the project. Change these to be consistent. This also means changing
> method names and some related enumeration types.

>From the protocol documentation, I was under the impression that at some
point, the convention was:

RED for general stuff
REDC for client-side
REDS for server-side

But re-reading, it looks like it was really red and redc, no reds.
And "reds" was not a great prefix anyway.

>
> The files were also renamed to reflect the change:
>   reds-stream.[ch] -> red-stream.[ch]
>
> Signed-off-by: Jonathon Jongsma <jjongsma at redhat.com>
> ---
>  server/Makefile.am                     |   4 +-
>  server/common-graphics-channel.c       |   4 +-
>  server/cursor-channel-client.c         |   2 +-
>  server/cursor-channel-client.h         |   4 +-
>  server/cursor-channel.c                |   2 +-
>  server/cursor-channel.h                |   2 +-
>  server/dcc-send.c                      |   2 +-
>  server/dcc.c                           |   8 +-
>  server/dcc.h                           |   2 +-
>  server/display-channel.h               |   2 +-
>  server/inputs-channel-client.c         |   2 +-
>  server/inputs-channel-client.h         |   2 +-
>  server/inputs-channel.c                |   6 +-
>  server/main-channel-client.c           |   2 +-
>  server/main-channel-client.h           |   2 +-
>  server/main-channel.c                  |   2 +-
>  server/main-channel.h                  |   2 +-
>  server/red-channel-client.c            |  28 ++--
>  server/red-channel-client.h            |   4 +-
>  server/red-channel.c                   |   6 +-
>  server/red-channel.h                   |   6 +-
>  server/red-qxl.c                       |   4 +-
>  server/{reds-stream.c => red-stream.c} | 284 ++++++++++++++++-----------------
>  server/red-stream.h                    |  93 +++++++++++
>  server/red-worker.h                    |   4 +-
>  server/reds-private.h                  |   2 +-
>  server/reds-stream.h                   |  93 -----------
>  server/reds.c                          | 158 +++++++++---------
>  server/smartcard-channel-client.c      |   2 +-
>  server/smartcard-channel-client.h      |   2 +-
>  server/smartcard.c                     |   2 +-
>  server/sound.c                         |  10 +-
>  server/spicevmc.c                      |  12 +-
>  server/stream-channel.c                |   4 +-
>  server/tests/test-channel.c            |   6 +-
>  server/tests/test-stream.c             |  24 +--
>  36 files changed, 397 insertions(+), 397 deletions(-)
>  rename server/{reds-stream.c => red-stream.c} (74%)
>  create mode 100644 server/red-stream.h
>  delete mode 100644 server/reds-stream.h
>
> diff --git a/server/Makefile.am b/server/Makefile.am
> index e2e3ce861..20f0f1925 100644
> --- a/server/Makefile.am
> +++ b/server/Makefile.am
> @@ -152,8 +152,8 @@ libserver_la_SOURCES =				\
>  	reds.c					\
>  	reds.h					\
>  	reds-private.h				\
> -	reds-stream.c				\
> -	reds-stream.h				\
> +	red-stream.c				\
> +	red-stream.h				\
>  	red-worker.c				\
>  	red-worker.h				\
>  	sound.c					\
> diff --git a/server/common-graphics-channel.c b/server/common-graphics-channel.c
> index 0cbc2762c..ce6b5e57c 100644
> --- a/server/common-graphics-channel.c
> +++ b/server/common-graphics-channel.c
> @@ -78,7 +78,7 @@ bool common_channel_client_config_socket(RedChannelClient *rcc)
>  {
>      RedClient *client = red_channel_client_get_client(rcc);
>      MainChannelClient *mcc = red_client_get_main(client);
> -    RedsStream *stream = red_channel_client_get_stream(rcc);
> +    RedStream *stream = red_channel_client_get_stream(rcc);
>      gboolean is_low_bandwidth;
>
>      // TODO - this should be dynamic, not one time at channel creation
> @@ -89,7 +89,7 @@ bool common_channel_client_config_socket(RedChannelClient *rcc)
>       * the application level.
>       * see: http://www.stuartcheshire.org/papers/NagleDelayedAck/
>       */
> -    reds_stream_set_no_delay(stream, !is_low_bandwidth);
> +    red_stream_set_no_delay(stream, !is_low_bandwidth);
>
>      // TODO: move wide/narrow ack setting to red_channel.
>      red_channel_client_ack_set_client_window(rcc,
> diff --git a/server/cursor-channel-client.c b/server/cursor-channel-client.c
> index 42ab5d763..6d39e24ed 100644
> --- a/server/cursor-channel-client.c
> +++ b/server/cursor-channel-client.c
> @@ -97,7 +97,7 @@ void cursor_channel_client_migrate(RedChannelClient *rcc)
>      red_channel_client_default_migrate(rcc);
>  }
>
> -CursorChannelClient* cursor_channel_client_new(CursorChannel *cursor, RedClient *client, RedsStream *stream,
> +CursorChannelClient* cursor_channel_client_new(CursorChannel *cursor, RedClient *client, RedStream *stream,
>                                                 int mig_target,
>                                                 RedChannelCapabilities *caps)
>  {
> diff --git a/server/cursor-channel-client.h b/server/cursor-channel-client.h
> index dc69369f5..56b3b312e 100644
> --- a/server/cursor-channel-client.h
> +++ b/server/cursor-channel-client.h
> @@ -24,7 +24,7 @@
>  #include "cache-item.h"
>  #include "red-common.h"
>  #include "red-channel-client.h"
> -#include "reds-stream.h"
> +#include "red-stream.h"
>  #include "cursor-channel.h"
>
>  G_BEGIN_DECLS
> @@ -61,7 +61,7 @@ GType cursor_channel_client_get_type(void) G_GNUC_CONST;
>
>  CursorChannelClient* cursor_channel_client_new(CursorChannel *cursor,
>                                                 RedClient *client,
> -                                               RedsStream *stream,
> +                                               RedStream *stream,
>                                                 int mig_target,
>                                                 RedChannelCapabilities *caps);
>
> diff --git a/server/cursor-channel.c b/server/cursor-channel.c
> index 9ae76090f..522261e3f 100644
> --- a/server/cursor-channel.c
> +++ b/server/cursor-channel.c
> @@ -338,7 +338,7 @@ void cursor_channel_set_mouse_mode(CursorChannel *cursor, uint32_t mode)
>      cursor->mouse_mode = mode;
>  }
>
> -void cursor_channel_connect(CursorChannel *cursor, RedClient *client, RedsStream *stream,
> +void cursor_channel_connect(CursorChannel *cursor, RedClient *client, RedStream *stream,
>                              int migrate,
>                              RedChannelCapabilities *caps)
>  {
> diff --git a/server/cursor-channel.h b/server/cursor-channel.h
> index 50cf71f16..603c2c0ac 100644
> --- a/server/cursor-channel.h
> +++ b/server/cursor-channel.h
> @@ -70,7 +70,7 @@ void                 cursor_channel_set_mouse_mode(CursorChannel *cursor, uint32
>   * See comment on cursor_channel_new.
>   */
>  void                 cursor_channel_connect     (CursorChannel *cursor, RedClient *client,
> -                                                 RedsStream *stream,
> +                                                 RedStream *stream,
>                                                   int migrate,
>                                                   RedChannelCapabilities *caps);
>
> diff --git a/server/dcc-send.c b/server/dcc-send.c
> index 8692cff2c..84c109680 100644
> --- a/server/dcc-send.c
> +++ b/server/dcc-send.c
> @@ -438,7 +438,7 @@ static FillBitsType fill_bits(DisplayChannelClient *dcc, SpiceMarshaller *m,
>          /* Images must be added to the cache only after they are compressed
>             in order to prevent starvation in the client between pixmap_cache and
>             global dictionary (in cases of multiple monitors) */
> -        if (reds_stream_get_family(red_channel_client_get_stream(rcc)) == AF_UNIX ||
> +        if (red_stream_get_family(red_channel_client_get_stream(rcc)) == AF_UNIX ||
>              !dcc_compress_image(dcc, &image, &simage->u.bitmap,
>                                  drawable, can_lossy, &comp_send_data)) {
>              SpicePalette *palette;
> diff --git a/server/dcc.c b/server/dcc.c
> index 90684e17c..c2fdd8c21 100644
> --- a/server/dcc.c
> +++ b/server/dcc.c
> @@ -495,7 +495,7 @@ static void dcc_init_stream_agents(DisplayChannelClient *dcc)
>  }
>
>  DisplayChannelClient *dcc_new(DisplayChannel *display,
> -                              RedClient *client, RedsStream *stream,
> +                              RedClient *client, RedStream *stream,
>                                int mig_target,
>                                RedChannelCapabilities *caps,
>                                SpiceImageCompression image_compression,
> @@ -589,7 +589,7 @@ void dcc_start(DisplayChannelClient *dcc)
>          dcc_create_all_streams(dcc);
>      }
>
> -    if (reds_stream_is_plain_unix(red_channel_client_get_stream(rcc)) &&
> +    if (red_stream_is_plain_unix(red_channel_client_get_stream(rcc)) &&
>          red_channel_client_test_remote_cap(rcc, SPICE_DISPLAY_CAP_GL_SCANOUT)) {
>          red_channel_client_pipe_add(rcc, dcc_gl_scanout_item_new(rcc, NULL, 0));
>          dcc_push_monitors_config(dcc);
> @@ -701,7 +701,7 @@ RedPipeItem *dcc_gl_scanout_item_new(RedChannelClient *rcc, void *data, int num)
>      RedGlScanoutUnixItem *item;
>
>      /* FIXME: on !unix peer, start streaming with a video codec */
> -    if (!reds_stream_is_plain_unix(red_channel_client_get_stream(rcc)) ||
> +    if (!red_stream_is_plain_unix(red_channel_client_get_stream(rcc)) ||
>          !red_channel_client_test_remote_cap(rcc, SPICE_DISPLAY_CAP_GL_SCANOUT)) {
>          spice_printerr("FIXME: client does not support GL scanout");
>          red_channel_client_disconnect(rcc);
> @@ -720,7 +720,7 @@ RedPipeItem *dcc_gl_draw_item_new(RedChannelClient *rcc, void *data, int num)
>      const SpiceMsgDisplayGlDraw *draw = data;
>      RedGlDrawItem *item;
>
> -    if (!reds_stream_is_plain_unix(red_channel_client_get_stream(rcc)) ||
> +    if (!red_stream_is_plain_unix(red_channel_client_get_stream(rcc)) ||
>          !red_channel_client_test_remote_cap(rcc, SPICE_DISPLAY_CAP_GL_SCANOUT)) {
>          spice_printerr("FIXME: client does not support GL scanout");
>          red_channel_client_disconnect(rcc);
> diff --git a/server/dcc.h b/server/dcc.h
> index e0cfaecfa..4de494571 100644
> --- a/server/dcc.h
> +++ b/server/dcc.h
> @@ -131,7 +131,7 @@ typedef struct RedDrawablePipeItem {
>
>  DisplayChannelClient*      dcc_new                                   (DisplayChannel *display,
>                                                                        RedClient *client,
> -                                                                      RedsStream *stream,
> +                                                                      RedStream *stream,
>                                                                        int mig_target,
>                                                                        RedChannelCapabilities *caps,
>                                                                        SpiceImageCompression image_compression,
> diff --git a/server/display-channel.h b/server/display-channel.h
> index d3fc41dd2..5e3d9eb7f 100644
> --- a/server/display-channel.h
> +++ b/server/display-channel.h
> @@ -22,7 +22,7 @@
>  #include <setjmp.h>
>  #include <common/rect.h>
>
> -#include "reds-stream.h"
> +#include "red-stream.h"
>  #include "cache-item.h"
>  #include "pixmap-cache.h"
>  #include "stat.h"
> diff --git a/server/inputs-channel-client.c b/server/inputs-channel-client.c
> index c9c88da23..25ad64a62 100644
> --- a/server/inputs-channel-client.c
> +++ b/server/inputs-channel-client.c
> @@ -91,7 +91,7 @@ inputs_channel_client_init(InputsChannelClient *self)
>
>  RedChannelClient* inputs_channel_client_create(RedChannel *channel,
>                                                 RedClient *client,
> -                                               RedsStream *stream,
> +                                               RedStream *stream,
>                                                 RedChannelCapabilities *caps)
>  {
>      RedChannelClient *rcc;
> diff --git a/server/inputs-channel-client.h b/server/inputs-channel-client.h
> index b57a7a798..c22288980 100644
> --- a/server/inputs-channel-client.h
> +++ b/server/inputs-channel-client.h
> @@ -58,7 +58,7 @@ GType inputs_channel_client_get_type(void) G_GNUC_CONST;
>
>  RedChannelClient* inputs_channel_client_create(RedChannel *channel,
>                                                 RedClient *client,
> -                                               RedsStream *stream,
> +                                               RedStream *stream,
>                                                 RedChannelCapabilities *caps);
>
>  uint16_t inputs_channel_client_get_motion_count(InputsChannelClient* self);
> diff --git a/server/inputs-channel.c b/server/inputs-channel.c
> index 9becb4356..f6ad27ecd 100644
> --- a/server/inputs-channel.c
> +++ b/server/inputs-channel.c
> @@ -32,7 +32,7 @@
>  #include "spice.h"
>  #include "red-common.h"
>  #include "reds.h"
> -#include "reds-stream.h"
> +#include "red-stream.h"
>  #include "red-channel.h"
>  #include "red-channel-client.h"
>  #include "red-client.h"
> @@ -444,12 +444,12 @@ static void inputs_pipe_add_init(RedChannelClient *rcc)
>  }
>
>  static void inputs_connect(RedChannel *channel, RedClient *client,
> -                           RedsStream *stream, int migration,
> +                           RedStream *stream, int migration,
>                             RedChannelCapabilities *caps)
>  {
>      RedChannelClient *rcc;
>
> -    if (!reds_stream_is_ssl(stream) && !red_client_during_migrate_at_target(client)) {
> +    if (!red_stream_is_ssl(stream) && !red_client_during_migrate_at_target(client)) {
>          main_channel_client_push_notify(red_client_get_main(client),
>                                          "keyboard channel is insecure");
>      }
> diff --git a/server/main-channel-client.c b/server/main-channel-client.c
> index 386250e2e..07435073e 100644
> --- a/server/main-channel-client.c
> +++ b/server/main-channel-client.c
> @@ -638,7 +638,7 @@ gboolean main_channel_client_migrate_src_complete(MainChannelClient *mcc,
>  }
>
>  MainChannelClient *main_channel_client_create(MainChannel *main_chan, RedClient *client,
> -                                              RedsStream *stream, uint32_t connection_id,
> +                                              RedStream *stream, uint32_t connection_id,
>                                                RedChannelCapabilities *caps)
>  {
>      MainChannelClient *mcc;
> diff --git a/server/main-channel-client.h b/server/main-channel-client.h
> index 2cf2e3424..bd1dba498 100644
> --- a/server/main-channel-client.h
> +++ b/server/main-channel-client.h
> @@ -58,7 +58,7 @@ struct MainChannelClientClass
>  GType main_channel_client_get_type(void) G_GNUC_CONST;
>
>  MainChannelClient *main_channel_client_create(MainChannel *main_chan, RedClient *client,
> -                                              RedsStream *stream, uint32_t connection_id,
> +                                              RedStream *stream, uint32_t connection_id,
>                                                RedChannelCapabilities *caps);
>
>  void main_channel_client_push_agent_tokens(MainChannelClient *mcc, uint32_t num_tokens);
> diff --git a/server/main-channel.c b/server/main-channel.c
> index 4dc130e40..43ab39ae7 100644
> --- a/server/main-channel.c
> +++ b/server/main-channel.c
> @@ -239,7 +239,7 @@ static bool main_channel_handle_migrate_flush_mark(RedChannelClient *rcc)
>  }
>
>  MainChannelClient *main_channel_link(MainChannel *channel, RedClient *client,
> -                                     RedsStream *stream, uint32_t connection_id, int migration,
> +                                     RedStream *stream, uint32_t connection_id, int migration,
>                                       RedChannelCapabilities *caps)
>  {
>      MainChannelClient *mcc;
> diff --git a/server/main-channel.h b/server/main-channel.h
> index 0cb5be728..193be4b6a 100644
> --- a/server/main-channel.h
> +++ b/server/main-channel.h
> @@ -59,7 +59,7 @@ MainChannel *main_channel_new(RedsState *reds);
>  RedClient *main_channel_get_client_by_link_id(MainChannel *main_chan, uint32_t link_id);
>  /* This is a 'clone' from the reds.h Channel.link callback to allow passing link_id */
>  MainChannelClient *main_channel_link(MainChannel *, RedClient *client,
> -     RedsStream *stream, uint32_t link_id, int migration,
> +     RedStream *stream, uint32_t link_id, int migration,
>       RedChannelCapabilities *caps);
>  void main_channel_push_mouse_mode(MainChannel *main_chan, SpiceMouseMode current_mode,
>                                    int is_client_mouse_allowed);
> diff --git a/server/red-channel-client.c b/server/red-channel-client.c
> index bd14be32a..54a6223b8 100644
> --- a/server/red-channel-client.c
> +++ b/server/red-channel-client.c
> @@ -119,7 +119,7 @@ struct RedChannelClientPrivate
>  {
>      RedChannel *channel;
>      RedClient  *client;
> -    RedsStream *stream;
> +    RedStream *stream;
>      gboolean monitor_latency;
>
>      struct {
> @@ -349,7 +349,7 @@ red_channel_client_finalize(GObject *object)
>          self->priv->connectivity_monitor.timer = NULL;
>      }
>
> -    reds_stream_free(self->priv->stream);
> +    red_stream_free(self->priv->stream);
>      self->priv->stream = NULL;
>
>      if (self->priv->send_data.main.marshaller) {
> @@ -571,11 +571,11 @@ static void red_channel_client_send_ping(RedChannelClient *rcc)
>           * roundtrip measurement is less accurate (bigger).
>           */
>          rcc->priv->latency_monitor.tcp_nodelay = true;
> -        delay_val = reds_stream_get_no_delay(rcc->priv->stream);
> +        delay_val = red_stream_get_no_delay(rcc->priv->stream);
>          if (delay_val != -1) {
>              rcc->priv->latency_monitor.tcp_nodelay = delay_val;
>              if (!delay_val) {
> -                reds_stream_set_no_delay(rcc->priv->stream, TRUE);
> +                red_stream_set_no_delay(rcc->priv->stream, TRUE);
>              }
>          }
>      }
> @@ -632,7 +632,7 @@ static void red_channel_client_msg_sent(RedChannelClient *rcc)
>      int fd;
>
>      if (spice_marshaller_get_fd(rcc->priv->send_data.marshaller, &fd)) {
> -        if (reds_stream_send_msgfd(rcc->priv->stream, fd) < 0) {
> +        if (red_stream_send_msgfd(rcc->priv->stream, fd) < 0) {
>              perror("sendfd");
>              red_channel_client_disconnect(rcc);
>              if (fd != -1)
> @@ -939,7 +939,7 @@ static gboolean red_channel_client_initable_init(GInitable *initable,
>      }
>
>      core = red_channel_get_core_interface(self->priv->channel);
> -    reds_stream_set_core_interface(self->priv->stream, core);
> +    red_stream_set_core_interface(self->priv->stream, core);
>      self->priv->stream->watch =
>          core->watch_add(core, self->priv->stream->socket,
>                          SPICE_WATCH_EVENT_READ,
> @@ -947,7 +947,7 @@ static gboolean red_channel_client_initable_init(GInitable *initable,
>                          self);
>
>      if (self->priv->monitor_latency
> -        && reds_stream_get_family(self->priv->stream) != AF_UNIX) {
> +        && red_stream_get_family(self->priv->stream) != AF_UNIX) {
>          self->priv->latency_monitor.timer =
>              core->timer_add(core, red_channel_client_ping_timer, self);
>
> @@ -1071,7 +1071,7 @@ static void red_channel_client_release_msg_buf(RedChannelClient *rcc,
>
>  static void red_channel_client_handle_outgoing(RedChannelClient *rcc)
>  {
> -    RedsStream *stream = rcc->priv->stream;
> +    RedStream *stream = rcc->priv->stream;
>      OutgoingMessageBuffer *buffer = &rcc->priv->outgoing;
>      ssize_t n;
>
> @@ -1090,7 +1090,7 @@ static void red_channel_client_handle_outgoing(RedChannelClient *rcc)
>          buffer->vec_size =
>              red_channel_client_prepare_out_msg(rcc, buffer->vec, G_N_ELEMENTS(buffer->vec),
>                                                 buffer->pos);
> -        n = reds_stream_writev(stream, buffer->vec, buffer->vec_size);
> +        n = red_stream_writev(stream, buffer->vec, buffer->vec_size);
>          if (n == -1) {
>              switch (errno) {
>              case EAGAIN:
> @@ -1123,7 +1123,7 @@ static void red_channel_client_handle_outgoing(RedChannelClient *rcc)
>  }
>
>  /* return the number of bytes read. -1 in case of error */
> -static int red_peer_receive(RedsStream *stream, uint8_t *buf, uint32_t size)
> +static int red_peer_receive(RedStream *stream, uint8_t *buf, uint32_t size)
>  {
>      uint8_t *pos = buf;
>      while (size) {
> @@ -1135,7 +1135,7 @@ static int red_peer_receive(RedsStream *stream, uint8_t *buf, uint32_t size)
>          if (!stream->watch) {
>              return -1;
>          }
> -        now = reds_stream_read(stream, pos, size);
> +        now = red_stream_read(stream, pos, size);
>          if (now <= 0) {
>              if (now == 0) {
>                  return -1;
> @@ -1185,7 +1185,7 @@ static uint8_t *red_channel_client_parse(RedChannelClient *rcc, uint8_t *message
>  // this is suboptimal potentially. Profile and consider fixing.
>  static void red_channel_client_handle_incoming(RedChannelClient *rcc)
>  {
> -    RedsStream *stream = rcc->priv->stream;
> +    RedStream *stream = rcc->priv->stream;
>      IncomingMessageBuffer *buffer = &rcc->priv->incoming;
>      int bytes_read;
>      uint16_t msg_type;
> @@ -1377,7 +1377,7 @@ static void red_channel_client_handle_pong(RedChannelClient *rcc, SpiceMsgPing *
>
>      /* set TCP_NODELAY=0, in case we reverted it for the test*/
>      if (!rcc->priv->latency_monitor.tcp_nodelay) {
> -        reds_stream_set_no_delay(rcc->priv->stream, FALSE);
> +        red_stream_set_no_delay(rcc->priv->stream, FALSE);
>      }
>
>      /*
> @@ -1749,7 +1749,7 @@ SpiceMarshaller *red_channel_client_get_marshaller(RedChannelClient *rcc)
>      return rcc->priv->send_data.marshaller;
>  }
>
> -RedsStream *red_channel_client_get_stream(RedChannelClient *rcc)
> +RedStream *red_channel_client_get_stream(RedChannelClient *rcc)
>  {
>      return rcc->priv->stream;
>  }
> diff --git a/server/red-channel-client.h b/server/red-channel-client.h
> index 56503c44b..cebdc0721 100644
> --- a/server/red-channel-client.h
> +++ b/server/red-channel-client.h
> @@ -23,7 +23,7 @@
>  #include <common/marshaller.h>
>
>  #include "red-pipe-item.h"
> -#include "reds-stream.h"
> +#include "red-stream.h"
>  #include "red-channel.h"
>
>  G_BEGIN_DECLS
> @@ -122,7 +122,7 @@ void red_channel_client_disconnect(RedChannelClient *rcc);
>
>  /* Note: the valid times to call red_channel_get_marshaller are just during send_item callback. */
>  SpiceMarshaller *red_channel_client_get_marshaller(RedChannelClient *rcc);
> -RedsStream *red_channel_client_get_stream(RedChannelClient *rcc);
> +RedStream *red_channel_client_get_stream(RedChannelClient *rcc);
>  RedClient *red_channel_client_get_client(RedChannelClient *rcc);
>
>  /* Note that the header is valid only between red_channel_reset_send_data and
> diff --git a/server/red-channel.c b/server/red-channel.c
> index a943023d4..27cf9ac19 100644
> --- a/server/red-channel.c
> +++ b/server/red-channel.c
> @@ -27,7 +27,7 @@
>  #include "red-channel.h"
>  #include "red-channel-client.h"
>  #include "reds.h"
> -#include "reds-stream.h"
> +#include "red-stream.h"
>  #include "main-dispatcher.h"
>  #include "utils.h"
>
> @@ -203,7 +203,7 @@ red_channel_constructed(GObject *object)
>  }
>
>  static void red_channel_client_default_connect(RedChannel *channel, RedClient *client,
> -                                               RedsStream *stream,
> +                                               RedStream *stream,
>                                                 int migration,
>                                                 RedChannelCapabilities *caps)
>  {
> @@ -479,7 +479,7 @@ void red_channel_disconnect(RedChannel *channel)
>  }
>
>  void red_channel_connect(RedChannel *channel, RedClient *client,
> -                         RedsStream *stream, int migration,
> +                         RedStream *stream, int migration,
>                           RedChannelCapabilities *caps)
>  {
>      channel->priv->client_cbs.connect(channel, client, stream, migration, caps);
> diff --git a/server/red-channel.h b/server/red-channel.h
> index 281ed0c9e..573ddfd3b 100644
> --- a/server/red-channel.h
> +++ b/server/red-channel.h
> @@ -31,7 +31,7 @@
>  #include "demarshallers.h"
>  #include "spice.h"
>  #include "red-common.h"
> -#include "reds-stream.h"
> +#include "red-stream.h"
>  #include "stat.h"
>  #include "red-pipe-item.h"
>  #include "red-channel-capabilities.h"
> @@ -55,7 +55,7 @@ typedef uint64_t (*channel_handle_migrate_data_get_serial_proc)(RedChannelClient
>                                              uint32_t size, void *message);
>
>
> -typedef void (*channel_client_connect_proc)(RedChannel *channel, RedClient *client, RedsStream *stream,
> +typedef void (*channel_client_connect_proc)(RedChannel *channel, RedClient *client, RedStream *stream,
>                                              int migration, RedChannelCapabilities *caps);
>  typedef void (*channel_client_disconnect_proc)(RedChannelClient *base);
>  typedef void (*channel_client_migrate_proc)(RedChannelClient *base);
> @@ -192,7 +192,7 @@ void red_channel_send(RedChannel *channel);
>  // For red_worker
>  void red_channel_disconnect(RedChannel *channel);
>  void red_channel_connect(RedChannel *channel, RedClient *client,
> -                         RedsStream *stream, int migration,
> +                         RedStream *stream, int migration,
>                           RedChannelCapabilities *caps);
>
>  /* return the sum of all the rcc pipe size */
> diff --git a/server/red-qxl.c b/server/red-qxl.c
> index 8cf09d9a8..ad33b1b43 100644
> --- a/server/red-qxl.c
> +++ b/server/red-qxl.c
> @@ -71,7 +71,7 @@ int red_qxl_check_qxl_version(QXLInstance *qxl, int major, int minor)
>  }
>
>  static void red_qxl_set_display_peer(RedChannel *channel, RedClient *client,
> -                                     RedsStream *stream, int migration,
> +                                     RedStream *stream, int migration,
>                                       RedChannelCapabilities *caps)
>  {
>      RedWorkerMessageDisplayConnect payload = {0,};
> @@ -125,7 +125,7 @@ static void red_qxl_display_migrate(RedChannelClient *rcc)
>                              &payload);
>  }
>
> -static void red_qxl_set_cursor_peer(RedChannel *channel, RedClient *client, RedsStream *stream,
> +static void red_qxl_set_cursor_peer(RedChannel *channel, RedClient *client, RedStream *stream,
>                                      int migration,
>                                      RedChannelCapabilities *caps)
>  {
> diff --git a/server/reds-stream.c b/server/red-stream.c
> similarity index 74%
> rename from server/reds-stream.c
> rename to server/red-stream.c
> index 0ba464654..6fdf1779f 100644
> --- a/server/reds-stream.c
> +++ b/server/red-stream.c
> @@ -34,11 +34,11 @@
>  #include "main-dispatcher.h"
>  #include "net-utils.h"
>  #include "red-common.h"
> -#include "reds-stream.h"
> +#include "red-stream.h"
>  #include "reds.h"
>
>  struct AsyncRead {
> -    RedsStream *stream;
> +    RedStream *stream;
>      void *opaque;
>      uint8_t *now;
>      uint8_t *end;
> @@ -50,7 +50,7 @@ typedef struct AsyncRead AsyncRead;
>  #if HAVE_SASL
>  #include <sasl/sasl.h>
>
> -typedef struct RedsSASL {
> +typedef struct RedSASL {
>      sasl_conn_t *conn;
>
>      /* If we want to negotiate an SSF layer with client */
> @@ -74,38 +74,38 @@ typedef struct RedsSASL {
>      /* temporary data during authentication */
>      unsigned int len;
>      char *data;
> -} RedsSASL;
> +} RedSASL;
>  #endif
>
> -struct RedsStreamPrivate {
> +struct RedStreamPrivate {
>      SSL *ssl;
>
>  #if HAVE_SASL
> -    RedsSASL sasl;
> +    RedSASL sasl;
>  #endif
>
>      AsyncRead async_read;
>
>      /* life time of info:
> -     * allocated when creating RedsStream.
> +     * allocated when creating RedStream.
>       * deallocated when main_dispatcher handles the SPICE_CHANNEL_EVENT_DISCONNECTED
>       * event, either from same thread or by call back from main thread. */
>      SpiceChannelEventInfo* info;
>
> -    ssize_t (*read)(RedsStream *s, void *buf, size_t nbyte);
> -    ssize_t (*write)(RedsStream *s, const void *buf, size_t nbyte);
> -    ssize_t (*writev)(RedsStream *s, const struct iovec *iov, int iovcnt);
> +    ssize_t (*read)(RedStream *s, void *buf, size_t nbyte);
> +    ssize_t (*write)(RedStream *s, const void *buf, size_t nbyte);
> +    ssize_t (*writev)(RedStream *s, const struct iovec *iov, int iovcnt);
>
>      RedsState *reds;
>      SpiceCoreInterfaceInternal *core;
>  };
>
> -static ssize_t stream_write_cb(RedsStream *s, const void *buf, size_t size)
> +static ssize_t stream_write_cb(RedStream *s, const void *buf, size_t size)
>  {
>      return write(s->socket, buf, size);
>  }
>
> -static ssize_t stream_writev_cb(RedsStream *s, const struct iovec *iov, int iovcnt)
> +static ssize_t stream_writev_cb(RedStream *s, const struct iovec *iov, int iovcnt)
>  {
>      ssize_t ret = 0;
>      do {
> @@ -134,12 +134,12 @@ static ssize_t stream_writev_cb(RedsStream *s, const struct iovec *iov, int iovc
>      return ret;
>  }
>
> -static ssize_t stream_read_cb(RedsStream *s, void *buf, size_t size)
> +static ssize_t stream_read_cb(RedStream *s, void *buf, size_t size)
>  {
>      return read(s->socket, buf, size);
>  }
>
> -static ssize_t stream_ssl_write_cb(RedsStream *s, const void *buf, size_t size)
> +static ssize_t stream_ssl_write_cb(RedStream *s, const void *buf, size_t size)
>  {
>      int return_code;
>      SPICE_GNUC_UNUSED int ssl_error;
> @@ -153,7 +153,7 @@ static ssize_t stream_ssl_write_cb(RedsStream *s, const void *buf, size_t size)
>      return return_code;
>  }
>
> -static ssize_t stream_ssl_read_cb(RedsStream *s, void *buf, size_t size)
> +static ssize_t stream_ssl_read_cb(RedStream *s, void *buf, size_t size)
>  {
>      int return_code;
>      SPICE_GNUC_UNUSED int ssl_error;
> @@ -167,7 +167,7 @@ static ssize_t stream_ssl_read_cb(RedsStream *s, void *buf, size_t size)
>      return return_code;
>  }
>
> -void reds_stream_remove_watch(RedsStream* s)
> +void red_stream_remove_watch(RedStream* s)
>  {
>      if (s->watch) {
>          s->priv->core->watch_remove(s->priv->core, s->watch);
> @@ -176,16 +176,16 @@ void reds_stream_remove_watch(RedsStream* s)
>  }
>
>  #if HAVE_SASL
> -static ssize_t reds_stream_sasl_read(RedsStream *s, uint8_t *buf, size_t nbyte);
> +static ssize_t red_stream_sasl_read(RedStream *s, uint8_t *buf, size_t nbyte);
>  #endif
>
> -ssize_t reds_stream_read(RedsStream *s, void *buf, size_t nbyte)
> +ssize_t red_stream_read(RedStream *s, void *buf, size_t nbyte)
>  {
>      ssize_t ret;
>
>  #if HAVE_SASL
>      if (s->priv->sasl.conn && s->priv->sasl.runSSF) {
> -        ret = reds_stream_sasl_read(s, buf, nbyte);
> +        ret = red_stream_sasl_read(s, buf, nbyte);
>      } else
>  #endif
>          ret = s->priv->read(s, buf, nbyte);
> @@ -193,12 +193,12 @@ ssize_t reds_stream_read(RedsStream *s, void *buf, size_t nbyte)
>      return ret;
>  }
>
> -bool reds_stream_write_all(RedsStream *stream, const void *in_buf, size_t n)
> +bool red_stream_write_all(RedStream *stream, const void *in_buf, size_t n)
>  {
>      const uint8_t *buf = (uint8_t *)in_buf;
>
>      while (n) {
> -        int now = reds_stream_write(stream, buf, n);
> +        int now = red_stream_write(stream, buf, n);
>          if (now <= 0) {
>              if (now == -1 && (errno == EINTR || errno == EAGAIN)) {
>                  continue;
> @@ -212,16 +212,16 @@ bool reds_stream_write_all(RedsStream *stream, const void *in_buf, size_t n)
>  }
>
>  #if HAVE_SASL
> -static ssize_t reds_stream_sasl_write(RedsStream *s, const void *buf, size_t nbyte);
> +static ssize_t red_stream_sasl_write(RedStream *s, const void *buf, size_t nbyte);
>  #endif
>
> -ssize_t reds_stream_write(RedsStream *s, const void *buf, size_t nbyte)
> +ssize_t red_stream_write(RedStream *s, const void *buf, size_t nbyte)
>  {
>      ssize_t ret;
>
>  #if HAVE_SASL
>      if (s->priv->sasl.conn && s->priv->sasl.runSSF) {
> -        ret = reds_stream_sasl_write(s, buf, nbyte);
> +        ret = red_stream_sasl_write(s, buf, nbyte);
>      } else
>  #endif
>          ret = s->priv->write(s, buf, nbyte);
> @@ -229,7 +229,7 @@ ssize_t reds_stream_write(RedsStream *s, const void *buf, size_t nbyte)
>      return ret;
>  }
>
> -int reds_stream_get_family(const RedsStream *s)
> +int red_stream_get_family(const RedStream *s)
>  {
>      spice_return_val_if_fail(s != NULL, -1);
>
> @@ -239,11 +239,11 @@ int reds_stream_get_family(const RedsStream *s)
>      return s->priv->info->laddr_ext.ss_family;
>  }
>
> -bool reds_stream_is_plain_unix(const RedsStream *s)
> +bool red_stream_is_plain_unix(const RedStream *s)
>  {
>      spice_return_val_if_fail(s != NULL, false);
>
> -    if (reds_stream_get_family(s) != AF_UNIX) {
> +    if (red_stream_get_family(s) != AF_UNIX) {
>          return false;
>      }
>
> @@ -261,23 +261,23 @@ bool reds_stream_is_plain_unix(const RedsStream *s)
>  }
>
>  /**
> - * reds_stream_set_no_delay:
> - * @stream: a #RedsStream
> + * red_stream_set_no_delay:
> + * @stream: a #RedStream
>   * @no_delay: whether to enable TCP_NODELAY on @@stream
>   *
>   * Returns: #true if the operation succeeded, #false otherwise.
>   */
> -bool reds_stream_set_no_delay(RedsStream *stream, bool no_delay)
> +bool red_stream_set_no_delay(RedStream *stream, bool no_delay)
>  {
>      return red_socket_set_no_delay(stream->socket, no_delay);
>  }
>
> -int reds_stream_get_no_delay(RedsStream *stream)
> +int red_stream_get_no_delay(RedStream *stream)
>  {
>      return red_socket_get_no_delay(stream->socket);
>  }
>
> -int reds_stream_send_msgfd(RedsStream *stream, int fd)
> +int red_stream_send_msgfd(RedStream *stream, int fd)
>  {
>      struct msghdr msgh = { 0, };
>      struct iovec iov;
> @@ -290,7 +290,7 @@ int reds_stream_send_msgfd(RedsStream *stream, int fd)
>          char data[CMSG_SPACE(fd_size)];
>      } control;
>
> -    spice_return_val_if_fail(reds_stream_is_plain_unix(stream), -1);
> +    spice_return_val_if_fail(red_stream_is_plain_unix(stream), -1);
>
>      /* set the payload */
>      iov.iov_base = (char*)"@";
> @@ -320,7 +320,7 @@ int reds_stream_send_msgfd(RedsStream *stream, int fd)
>      return r;
>  }
>
> -ssize_t reds_stream_writev(RedsStream *s, const struct iovec *iov, int iovcnt)
> +ssize_t red_stream_writev(RedStream *s, const struct iovec *iov, int iovcnt)
>  {
>      int i;
>      int n;
> @@ -331,7 +331,7 @@ ssize_t reds_stream_writev(RedsStream *s, const struct iovec *iov, int iovcnt)
>      }
>
>      for (i = 0; i < iovcnt; ++i) {
> -        n = reds_stream_write(s, iov[i].iov_base, iov[i].iov_len);
> +        n = red_stream_write(s, iov[i].iov_base, iov[i].iov_len);
>          if (n <= 0)
>              return ret == 0 ? n : ret;
>          ret += n;
> @@ -340,13 +340,13 @@ ssize_t reds_stream_writev(RedsStream *s, const struct iovec *iov, int iovcnt)
>      return ret;
>  }
>
> -void reds_stream_free(RedsStream *s)
> +void red_stream_free(RedStream *s)
>  {
>      if (!s) {
>          return;
>      }
>
> -    reds_stream_push_channel_event(s, SPICE_CHANNEL_EVENT_DISCONNECTED);
> +    red_stream_push_channel_event(s, SPICE_CHANNEL_EVENT_DISCONNECTED);
>
>  #if HAVE_SASL
>      if (s->priv->sasl.conn) {
> @@ -366,20 +366,20 @@ void reds_stream_free(RedsStream *s)
>          SSL_free(s->priv->ssl);
>      }
>
> -    reds_stream_remove_watch(s);
> +    red_stream_remove_watch(s);
>      close(s->socket);
>
>      g_free(s);
>  }
>
> -void reds_stream_push_channel_event(RedsStream *s, int event)
> +void red_stream_push_channel_event(RedStream *s, int event)
>  {
>      RedsState *reds = s->priv->reds;
>      MainDispatcher *md = reds_get_main_dispatcher(reds);
>      main_dispatcher_channel_event(md, event, s->priv->info);
>  }
>
> -static void reds_stream_set_socket(RedsStream *stream, int socket)
> +static void red_stream_set_socket(RedStream *stream, int socket)
>  {
>      stream->socket = socket;
>      /* deprecated fields. Filling them for backward compatibility */
> @@ -398,27 +398,27 @@ static void reds_stream_set_socket(RedsStream *stream, int socket)
>  }
>
>
> -void reds_stream_set_channel(RedsStream *stream, int connection_id,
> -                             int channel_type, int channel_id)
> +void red_stream_set_channel(RedStream *stream, int connection_id,
> +                            int channel_type, int channel_id)
>  {
>      stream->priv->info->connection_id = connection_id;
>      stream->priv->info->type = channel_type;
>      stream->priv->info->id   = channel_id;
> -    if (reds_stream_is_ssl(stream)) {
> +    if (red_stream_is_ssl(stream)) {
>          stream->priv->info->flags |= SPICE_CHANNEL_EVENT_FLAG_TLS;
>      }
>  }
>
> -RedsStream *reds_stream_new(RedsState *reds, int socket)
> +RedStream *red_stream_new(RedsState *reds, int socket)
>  {
> -    RedsStream *stream;
> +    RedStream *stream;
>
> -    stream = g_malloc0(sizeof(RedsStream) + sizeof(RedsStreamPrivate));
> -    stream->priv = (RedsStreamPrivate *)(stream+1);
> +    stream = g_malloc0(sizeof(RedStream) + sizeof(RedStreamPrivate));
> +    stream->priv = (RedStreamPrivate *)(stream+1);
>      stream->priv->info = g_new0(SpiceChannelEventInfo, 1);
>      stream->priv->reds = reds;
>      stream->priv->core = reds_get_core_interface(reds);
> -    reds_stream_set_socket(stream, socket);
> +    red_stream_set_socket(stream, socket);
>
>      stream->priv->read = stream_read_cb;
>      stream->priv->write = stream_write_cb;
> @@ -427,39 +427,39 @@ RedsStream *reds_stream_new(RedsState *reds, int socket)
>      return stream;
>  }
>
> -void reds_stream_set_core_interface(RedsStream *stream, SpiceCoreInterfaceInternal *core)
> +void red_stream_set_core_interface(RedStream *stream, SpiceCoreInterfaceInternal *core)
>  {
> -    reds_stream_remove_watch(stream);
> +    red_stream_remove_watch(stream);
>      stream->priv->core = core;
>  }
>
> -bool reds_stream_is_ssl(RedsStream *stream)
> +bool red_stream_is_ssl(RedStream *stream)
>  {
>      return (stream->priv->ssl != NULL);
>  }
>
> -void reds_stream_disable_writev(RedsStream *stream)
> +void red_stream_disable_writev(RedStream *stream)
>  {
>      stream->priv->writev = NULL;
>  }
>
> -RedsStreamSslStatus reds_stream_ssl_accept(RedsStream *stream)
> +RedStreamSslStatus red_stream_ssl_accept(RedStream *stream)
>  {
>      int ssl_error;
>      int return_code;
>
>      return_code = SSL_accept(stream->priv->ssl);
>      if (return_code == 1) {
> -        return REDS_STREAM_SSL_STATUS_OK;
> +        return RED_STREAM_SSL_STATUS_OK;
>      }
>
>      ssl_error = SSL_get_error(stream->priv->ssl, return_code);
>      if (return_code == -1 && (ssl_error == SSL_ERROR_WANT_READ ||
>                                ssl_error == SSL_ERROR_WANT_WRITE)) {
>          if (ssl_error == SSL_ERROR_WANT_READ) {
> -            return REDS_STREAM_SSL_STATUS_WAIT_FOR_READ;
> +            return RED_STREAM_SSL_STATUS_WAIT_FOR_READ;
>          } else {
> -            return REDS_STREAM_SSL_STATUS_WAIT_FOR_WRITE;
> +            return RED_STREAM_SSL_STATUS_WAIT_FOR_WRITE;
>          }
>      }
>
> @@ -468,24 +468,24 @@ RedsStreamSslStatus reds_stream_ssl_accept(RedsStream *stream)
>      SSL_free(stream->priv->ssl);
>      stream->priv->ssl = NULL;
>
> -    return REDS_STREAM_SSL_STATUS_ERROR;
> +    return RED_STREAM_SSL_STATUS_ERROR;
>  }
>
> -int reds_stream_enable_ssl(RedsStream *stream, SSL_CTX *ctx)
> +int red_stream_enable_ssl(RedStream *stream, SSL_CTX *ctx)
>  {
>      BIO *sbio;
>
>      // Handle SSL handshaking
>      if (!(sbio = BIO_new_socket(stream->socket, BIO_NOCLOSE))) {
>          spice_warning("could not allocate ssl bio socket");
> -        return REDS_STREAM_SSL_STATUS_ERROR;
> +        return RED_STREAM_SSL_STATUS_ERROR;
>      }
>
>      stream->priv->ssl = SSL_new(ctx);
>      if (!stream->priv->ssl) {
>          spice_warning("could not allocate ssl context");
>          BIO_free(sbio);
> -        return REDS_STREAM_SSL_STATUS_ERROR;
> +        return RED_STREAM_SSL_STATUS_ERROR;
>      }
>
>      SSL_set_bio(stream->priv->ssl, sbio, sbio);
> @@ -494,11 +494,11 @@ int reds_stream_enable_ssl(RedsStream *stream, SSL_CTX *ctx)
>      stream->priv->read = stream_ssl_read_cb;
>      stream->priv->writev = NULL;
>
> -    return reds_stream_ssl_accept(stream);
> +    return red_stream_ssl_accept(stream);
>  }
>
> -void reds_stream_set_async_error_handler(RedsStream *stream,
> -                                         AsyncReadError error_handler)
> +void red_stream_set_async_error_handler(RedStream *stream,
> +                                        AsyncReadError error_handler)
>  {
>      stream->priv->async_read.error = error_handler;
>  }
> @@ -506,7 +506,7 @@ void reds_stream_set_async_error_handler(RedsStream *stream,
>  static inline void async_read_clear_handlers(AsyncRead *async)
>  {
>      if (async->stream->watch) {
> -        reds_stream_remove_watch(async->stream);
> +        red_stream_remove_watch(async->stream);
>      }
>      async->stream = NULL;
>  }
> @@ -516,14 +516,14 @@ static void async_read_handler(G_GNUC_UNUSED int fd,
>                                 void *data)
>  {
>      AsyncRead *async = (AsyncRead *)data;
> -    RedsStream *stream = async->stream;
> +    RedStream *stream = async->stream;
>      SpiceCoreInterfaceInternal *core = stream->priv->core;
>
>      for (;;) {
>          int n = async->end - async->now;
>
>          spice_assert(n > 0);
> -        n = reds_stream_read(stream, async->now, n);
> +        n = red_stream_read(stream, async->now, n);
>          if (n <= 0) {
>              int err = n < 0 ? errno: 0;
>              switch (err) {
> @@ -554,10 +554,10 @@ static void async_read_handler(G_GNUC_UNUSED int fd,
>      }
>  }
>
> -void reds_stream_async_read(RedsStream *stream,
> -                            uint8_t *data, size_t size,
> -                            AsyncReadDone read_done_cb,
> -                            void *opaque)
> +void red_stream_async_read(RedStream *stream,
> +                           uint8_t *data, size_t size,
> +                           AsyncReadDone read_done_cb,
> +                           void *opaque)
>  {
>      AsyncRead *async = &stream->priv->async_read;
>
> @@ -572,17 +572,17 @@ void reds_stream_async_read(RedsStream *stream,
>  }
>
>  #if HAVE_SASL
> -bool reds_stream_write_u8(RedsStream *s, uint8_t n)
> +bool red_stream_write_u8(RedStream *s, uint8_t n)
>  {
> -    return reds_stream_write_all(s, &n, sizeof(uint8_t));
> +    return red_stream_write_all(s, &n, sizeof(uint8_t));
>  }
>
> -bool reds_stream_write_u32(RedsStream *s, uint32_t n)
> +bool red_stream_write_u32(RedStream *s, uint32_t n)
>  {
> -    return reds_stream_write_all(s, &n, sizeof(uint32_t));
> +    return red_stream_write_all(s, &n, sizeof(uint32_t));
>  }
>
> -static ssize_t reds_stream_sasl_write(RedsStream *s, const void *buf, size_t nbyte)
> +static ssize_t red_stream_sasl_write(RedStream *s, const void *buf, size_t nbyte)
>  {
>      ssize_t ret;
>
> @@ -627,7 +627,7 @@ static ssize_t reds_stream_sasl_write(RedsStream *s, const void *buf, size_t nby
>      return -1;
>  }
>
> -static ssize_t reds_stream_sasl_read(RedsStream *s, uint8_t *buf, size_t nbyte)
> +static ssize_t red_stream_sasl_read(RedStream *s, uint8_t *buf, size_t nbyte)
>  {
>      uint8_t encoded[4096];
>      const char *decoded;
> @@ -688,19 +688,19 @@ static char *addr_to_string(const char *format,
>      return g_strdup_printf(format, host, serv);
>  }
>
> -static char *reds_stream_get_local_address(RedsStream *stream)
> +static char *red_stream_get_local_address(RedStream *stream)
>  {
>      return addr_to_string("%s;%s", &stream->priv->info->laddr_ext,
>                            stream->priv->info->llen_ext);
>  }
>
> -static char *reds_stream_get_remote_address(RedsStream *stream)
> +static char *red_stream_get_remote_address(RedStream *stream)
>  {
>      return addr_to_string("%s;%s", &stream->priv->info->paddr_ext,
>                            stream->priv->info->plen_ext);
>  }
>
> -static int auth_sasl_check_ssf(RedsSASL *sasl, int *runSSF)
> +static int auth_sasl_check_ssf(RedSASL *sasl, int *runSSF)
>  {
>      const void *val;
>      int err, ssf;
> @@ -743,13 +743,13 @@ static int auth_sasl_check_ssf(RedsSASL *sasl, int *runSSF)
>   */
>  #define SASL_DATA_MAX_LEN (1024 * 1024)
>
> -RedsSaslError reds_sasl_handle_auth_step(RedsStream *stream, AsyncReadDone read_cb, void *opaque)
> +RedSaslError red_sasl_handle_auth_step(RedStream *stream, AsyncReadDone read_cb, void *opaque)
>  {
>      const char *serverout;
>      unsigned int serveroutlen;
>      int err;
>      char *clientdata = NULL;
> -    RedsSASL *sasl = &stream->priv->sasl;
> +    RedSASL *sasl = &stream->priv->sasl;
>      uint32_t datalen = sasl->len;
>
>      /* NB, distinction of NULL vs "" is *critical* in SASL */
> @@ -770,34 +770,34 @@ RedsSaslError reds_sasl_handle_auth_step(RedsStream *stream, AsyncReadDone read_
>          err != SASL_CONTINUE) {
>          spice_warning("sasl step failed %d (%s)",
>                        err, sasl_errdetail(sasl->conn));
> -        return REDS_SASL_ERROR_GENERIC;
> +        return RED_SASL_ERROR_GENERIC;
>      }
>
>      if (serveroutlen > SASL_DATA_MAX_LEN) {
>          spice_warning("sasl step reply data too long %d",
>                        serveroutlen);
> -        return REDS_SASL_ERROR_INVALID_DATA;
> +        return RED_SASL_ERROR_INVALID_DATA;
>      }
>
>      spice_debug("SASL return data %d bytes, %p", serveroutlen, serverout);
>
>      if (serveroutlen) {
>          serveroutlen += 1;
> -        reds_stream_write_all(stream, &serveroutlen, sizeof(uint32_t));
> -        reds_stream_write_all(stream, serverout, serveroutlen);
> +        red_stream_write_all(stream, &serveroutlen, sizeof(uint32_t));
> +        red_stream_write_all(stream, serverout, serveroutlen);
>      } else {
> -        reds_stream_write_all(stream, &serveroutlen, sizeof(uint32_t));
> +        red_stream_write_all(stream, &serveroutlen, sizeof(uint32_t));
>      }
>
>      /* Whether auth is complete */
> -    reds_stream_write_u8(stream, err == SASL_CONTINUE ? 0 : 1);
> +    red_stream_write_u8(stream, err == SASL_CONTINUE ? 0 : 1);
>
>      if (err == SASL_CONTINUE) {
>          spice_debug("%s", "Authentication must continue (step)");
>          /* Wait for step length */
> -        reds_stream_async_read(stream, (uint8_t *)&sasl->len, sizeof(uint32_t),
> +        red_stream_async_read(stream, (uint8_t *)&sasl->len, sizeof(uint32_t),
>                                 read_cb, opaque);
> -        return REDS_SASL_ERROR_CONTINUE;
> +        return RED_SASL_ERROR_CONTINUE;
>      } else {
>          int ssf;
>
> @@ -807,33 +807,33 @@ RedsSaslError reds_sasl_handle_auth_step(RedsStream *stream, AsyncReadDone read_
>          }
>
>          spice_debug("Authentication successful");
> -        reds_stream_write_u32(stream, SPICE_LINK_ERR_OK); /* Accept auth */
> +        red_stream_write_u32(stream, SPICE_LINK_ERR_OK); /* Accept auth */
>
>          /*
>           * Delay writing in SSF encoded until now
>           */
>          sasl->runSSF = ssf;
> -        reds_stream_disable_writev(stream); /* make sure writev isn't called directly anymore */
> +        red_stream_disable_writev(stream); /* make sure writev isn't called directly anymore */
>
> -        return REDS_SASL_ERROR_OK;
> +        return RED_SASL_ERROR_OK;
>      }
>
>  authreject:
> -    reds_stream_write_u32(stream, 1); /* Reject auth */
> -    reds_stream_write_u32(stream, sizeof("Authentication failed"));
> -    reds_stream_write_all(stream, "Authentication failed", sizeof("Authentication failed"));
> +    red_stream_write_u32(stream, 1); /* Reject auth */
> +    red_stream_write_u32(stream, sizeof("Authentication failed"));
> +    red_stream_write_all(stream, "Authentication failed", sizeof("Authentication failed"));
>
> -    return REDS_SASL_ERROR_AUTH_FAILED;
> +    return RED_SASL_ERROR_AUTH_FAILED;
>  }
>
> -RedsSaslError reds_sasl_handle_auth_steplen(RedsStream *stream, AsyncReadDone read_cb, void *opaque)
> +RedSaslError red_sasl_handle_auth_steplen(RedStream *stream, AsyncReadDone read_cb, void *opaque)
>  {
> -    RedsSASL *sasl = &stream->priv->sasl;
> +    RedSASL *sasl = &stream->priv->sasl;
>
>      spice_debug("Got steplen %d", sasl->len);
>      if (sasl->len > SASL_DATA_MAX_LEN) {
>          spice_warning("Too much SASL data %d", sasl->len);
> -        return REDS_SASL_ERROR_INVALID_DATA;
> +        return RED_SASL_ERROR_INVALID_DATA;
>      }
>
>      if (sasl->len == 0) {
> @@ -842,12 +842,12 @@ RedsSaslError reds_sasl_handle_auth_steplen(RedsStream *stream, AsyncReadDone re
>           * but read_cb() will have done the needed RedLinkInfo cleanups
>           * if an error occurs, so the caller should not need to do more
>           * treatment */
> -        return REDS_SASL_ERROR_OK;
> +        return RED_SASL_ERROR_OK;
>      } else {
>          sasl->data = g_realloc(sasl->data, sasl->len);
> -        reds_stream_async_read(stream, (uint8_t *)sasl->data, sasl->len,
> +        red_stream_async_read(stream, (uint8_t *)sasl->data, sasl->len,
>                                 read_cb, opaque);
> -        return REDS_SASL_ERROR_OK;
> +        return RED_SASL_ERROR_OK;
>      }
>  }
>
> @@ -866,13 +866,13 @@ RedsSaslError reds_sasl_handle_auth_steplen(RedsStream *stream, AsyncReadDone re
>   * u8 continue
>   */
>
> -RedsSaslError reds_sasl_handle_auth_start(RedsStream *stream, AsyncReadDone read_cb, void *opaque)
> +RedSaslError red_sasl_handle_auth_start(RedStream *stream, AsyncReadDone read_cb, void *opaque)
>  {
>      const char *serverout;
>      unsigned int serveroutlen;
>      int err;
>      char *clientdata = NULL;
> -    RedsSASL *sasl = &stream->priv->sasl;
> +    RedSASL *sasl = &stream->priv->sasl;
>      uint32_t datalen = sasl->len;
>
>      /* NB, distinction of NULL vs "" is *critical* in SASL */
> @@ -894,34 +894,34 @@ RedsSaslError reds_sasl_handle_auth_start(RedsStream *stream, AsyncReadDone read
>          err != SASL_CONTINUE) {
>          spice_warning("sasl start failed %d (%s)",
>                      err, sasl_errdetail(sasl->conn));
> -        return REDS_SASL_ERROR_INVALID_DATA;
> +        return RED_SASL_ERROR_INVALID_DATA;
>      }
>
>      if (serveroutlen > SASL_DATA_MAX_LEN) {
>          spice_warning("sasl start reply data too long %d",
>                      serveroutlen);
> -        return REDS_SASL_ERROR_INVALID_DATA;
> +        return RED_SASL_ERROR_INVALID_DATA;
>      }
>
>      spice_debug("SASL return data %d bytes, %p", serveroutlen, serverout);
>
>      if (serveroutlen) {
>          serveroutlen += 1;
> -        reds_stream_write_all(stream, &serveroutlen, sizeof(uint32_t));
> -        reds_stream_write_all(stream, serverout, serveroutlen);
> +        red_stream_write_all(stream, &serveroutlen, sizeof(uint32_t));
> +        red_stream_write_all(stream, serverout, serveroutlen);
>      } else {
> -        reds_stream_write_all(stream, &serveroutlen, sizeof(uint32_t));
> +        red_stream_write_all(stream, &serveroutlen, sizeof(uint32_t));
>      }
>
>      /* Whether auth is complete */
> -    reds_stream_write_u8(stream, err == SASL_CONTINUE ? 0 : 1);
> +    red_stream_write_u8(stream, err == SASL_CONTINUE ? 0 : 1);
>
>      if (err == SASL_CONTINUE) {
>          spice_debug("%s", "Authentication must continue (start)");
>          /* Wait for step length */
> -        reds_stream_async_read(stream, (uint8_t *)&sasl->len, sizeof(uint32_t),
> +        red_stream_async_read(stream, (uint8_t *)&sasl->len, sizeof(uint32_t),
>                                 read_cb, opaque);
> -        return REDS_SASL_ERROR_CONTINUE;
> +        return RED_SASL_ERROR_CONTINUE;
>      } else {
>          int ssf;
>
> @@ -931,48 +931,48 @@ RedsSaslError reds_sasl_handle_auth_start(RedsStream *stream, AsyncReadDone read
>          }
>
>          spice_debug("Authentication successful");
> -        reds_stream_write_u32(stream, SPICE_LINK_ERR_OK); /* Accept auth */
> +        red_stream_write_u32(stream, SPICE_LINK_ERR_OK); /* Accept auth */
>
>          /*
>           * Delay writing in SSF encoded until now
>           */
>          sasl->runSSF = ssf;
> -        reds_stream_disable_writev(stream); /* make sure writev isn't called directly anymore */
> -        return REDS_SASL_ERROR_OK;
> +        red_stream_disable_writev(stream); /* make sure writev isn't called directly anymore */
> +        return RED_SASL_ERROR_OK;
>      }
>
>  authreject:
> -    reds_stream_write_u32(stream, 1); /* Reject auth */
> -    reds_stream_write_u32(stream, sizeof("Authentication failed"));
> -    reds_stream_write_all(stream, "Authentication failed", sizeof("Authentication failed"));
> +    red_stream_write_u32(stream, 1); /* Reject auth */
> +    red_stream_write_u32(stream, sizeof("Authentication failed"));
> +    red_stream_write_all(stream, "Authentication failed", sizeof("Authentication failed"));
>
> -    return REDS_SASL_ERROR_AUTH_FAILED;
> +    return RED_SASL_ERROR_AUTH_FAILED;
>  }
>
> -RedsSaslError reds_sasl_handle_auth_startlen(RedsStream *stream, AsyncReadDone read_cb, void *opaque)
> +RedSaslError red_sasl_handle_auth_startlen(RedStream *stream, AsyncReadDone read_cb, void *opaque)
>  {
> -    RedsSASL *sasl = &stream->priv->sasl;
> +    RedSASL *sasl = &stream->priv->sasl;
>
>      spice_debug("Got client start len %d", sasl->len);
>      if (sasl->len > SASL_DATA_MAX_LEN) {
>          spice_warning("Too much SASL data %d", sasl->len);
> -        return REDS_SASL_ERROR_INVALID_DATA;
> +        return RED_SASL_ERROR_INVALID_DATA;
>      }
>
>      if (sasl->len == 0) {
> -        return REDS_SASL_ERROR_RETRY;
> +        return RED_SASL_ERROR_RETRY;
>      }
>
>      sasl->data = g_realloc(sasl->data, sasl->len);
> -    reds_stream_async_read(stream, (uint8_t *)sasl->data, sasl->len,
> -                           read_cb, opaque);
> +    red_stream_async_read(stream, (uint8_t *)sasl->data, sasl->len,
> +                          read_cb, opaque);
>
> -    return REDS_SASL_ERROR_OK;
> +    return RED_SASL_ERROR_OK;
>  }
>
> -bool reds_sasl_handle_auth_mechname(RedsStream *stream, AsyncReadDone read_cb, void *opaque)
> +bool red_sasl_handle_auth_mechname(RedStream *stream, AsyncReadDone read_cb, void *opaque)
>  {
> -    RedsSASL *sasl = &stream->priv->sasl;
> +    RedSASL *sasl = &stream->priv->sasl;
>
>      sasl->mechname[sasl->len] = '\0';
>      spice_debug("Got client mechname '%s' check against '%s'",
> @@ -1003,15 +1003,15 @@ bool reds_sasl_handle_auth_mechname(RedsStream *stream, AsyncReadDone read_cb, v
>
>      spice_debug("Validated mechname '%s'", sasl->mechname);
>
> -    reds_stream_async_read(stream, (uint8_t *)&sasl->len, sizeof(uint32_t),
> -                           read_cb, opaque);
> +    red_stream_async_read(stream, (uint8_t *)&sasl->len, sizeof(uint32_t),
> +                          read_cb, opaque);
>
>      return true;
>  }
>
> -bool reds_sasl_handle_auth_mechlen(RedsStream *stream, AsyncReadDone read_cb, void *opaque)
> +bool red_sasl_handle_auth_mechlen(RedStream *stream, AsyncReadDone read_cb, void *opaque)
>  {
> -    RedsSASL *sasl = &stream->priv->sasl;
> +    RedSASL *sasl = &stream->priv->sasl;
>
>      if (sasl->len < 1 || sasl->len > 100) {
>          spice_warning("Got bad client mechname len %d", sasl->len);
> @@ -1021,26 +1021,26 @@ bool reds_sasl_handle_auth_mechlen(RedsStream *stream, AsyncReadDone read_cb, vo
>      sasl->mechname = g_malloc(sasl->len + 1);
>
>      spice_debug("Wait for client mechname");
> -    reds_stream_async_read(stream, (uint8_t *)sasl->mechname, sasl->len,
> -                           read_cb, opaque);
> +    red_stream_async_read(stream, (uint8_t *)sasl->mechname, sasl->len,
> +                          read_cb, opaque);
>
>      return true;
>  }
>
> -bool reds_sasl_start_auth(RedsStream *stream, AsyncReadDone read_cb, void *opaque)
> +bool red_sasl_start_auth(RedStream *stream, AsyncReadDone read_cb, void *opaque)
>  {
>      const char *mechlist = NULL;
>      sasl_security_properties_t secprops;
>      int err;
>      char *localAddr, *remoteAddr;
>      int mechlistlen;
> -    RedsSASL *sasl = &stream->priv->sasl;
> +    RedSASL *sasl = &stream->priv->sasl;
>
> -    if (!(localAddr = reds_stream_get_local_address(stream))) {
> +    if (!(localAddr = red_stream_get_local_address(stream))) {
>          goto error;
>      }
>
> -    if (!(remoteAddr = reds_stream_get_remote_address(stream))) {
> +    if (!(remoteAddr = red_stream_get_remote_address(stream))) {
>          g_free(localAddr);
>          goto error;
>      }
> @@ -1123,15 +1123,15 @@ bool reds_sasl_start_auth(RedsStream *stream, AsyncReadDone read_cb, void *opaqu
>      sasl->mechlist = g_strdup(mechlist);
>
>      mechlistlen = strlen(mechlist);
> -    if (!reds_stream_write_all(stream, &mechlistlen, sizeof(uint32_t))
> -        || !reds_stream_write_all(stream, sasl->mechlist, mechlistlen)) {
> +    if (!red_stream_write_all(stream, &mechlistlen, sizeof(uint32_t))
> +        || !red_stream_write_all(stream, sasl->mechlist, mechlistlen)) {
>          spice_warning("SASL mechanisms write error");
>          goto error;
>      }
>
>      spice_debug("Wait for client mechname length");
> -    reds_stream_async_read(stream, (uint8_t *)&sasl->len, sizeof(uint32_t),
> -                           read_cb, opaque);
> +    red_stream_async_read(stream, (uint8_t *)&sasl->len, sizeof(uint32_t),
> +                          read_cb, opaque);
>
>      return true;
>
> diff --git a/server/red-stream.h b/server/red-stream.h
> new file mode 100644
> index 000000000..e6e37e3e7
> --- /dev/null
> +++ b/server/red-stream.h
> @@ -0,0 +1,93 @@
> +/*
> +   Copyright (C) 2009, 2013 Red Hat, Inc.
> +
> +   This library is free software; you can redistribute it and/or
> +   modify it under the terms of the GNU Lesser General Public
> +   License as published by the Free Software Foundation; either
> +   version 2.1 of the License, or (at your option) any later version.
> +
> +   This library is distributed in the hope that it will be useful,
> +   but WITHOUT ANY WARRANTY; without even the implied warranty of
> +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> +   Lesser General Public License for more details.
> +
> +   You should have received a copy of the GNU Lesser General Public
> +   License along with this library; if not, see <http://www.gnu.org/licenses/>.
> +*/
> +
> +#ifndef RED_STREAM_H_
> +#define RED_STREAM_H_
> +
> +#include <openssl/ssl.h>
> +#include <common/mem.h>
> +
> +#include "spice.h"
> +#include "red-common.h"
> +
> +typedef void (*AsyncReadDone)(void *opaque);
> +typedef void (*AsyncReadError)(void *opaque, int err);
> +
> +typedef struct RedStream RedStream;
> +typedef struct RedStreamPrivate RedStreamPrivate;
> +
> +struct RedStream {
> +    int socket;
> +    SpiceWatch *watch;
> +
> +    RedStreamPrivate *priv;
> +};
> +
> +typedef enum {
> +    RED_STREAM_SSL_STATUS_OK,
> +    RED_STREAM_SSL_STATUS_ERROR,
> +    RED_STREAM_SSL_STATUS_WAIT_FOR_READ,
> +    RED_STREAM_SSL_STATUS_WAIT_FOR_WRITE
> +} RedStreamSslStatus;
> +
> +/* any thread */
> +ssize_t red_stream_read(RedStream *s, void *buf, size_t nbyte);
> +void red_stream_async_read(RedStream *stream, uint8_t *data, size_t size,
> +                            AsyncReadDone read_done_cb, void *opaque);
> +void red_stream_set_async_error_handler(RedStream *stream,
> +                                         AsyncReadError error_handler);
> +ssize_t red_stream_write(RedStream *s, const void *buf, size_t nbyte);
> +ssize_t red_stream_writev(RedStream *s, const struct iovec *iov, int iovcnt);
> +bool red_stream_write_all(RedStream *stream, const void *in_buf, size_t n);
> +bool red_stream_write_u8(RedStream *s, uint8_t n);
> +bool red_stream_write_u32(RedStream *s, uint32_t n);
> +void red_stream_disable_writev(RedStream *stream);
> +void red_stream_free(RedStream *s);
> +
> +void red_stream_push_channel_event(RedStream *s, int event);
> +void red_stream_remove_watch(RedStream* s);
> +void red_stream_set_channel(RedStream *stream, int connection_id,
> +                             int channel_type, int channel_id);
> +RedStream *red_stream_new(RedsState *reds, int socket);
> +void red_stream_set_core_interface(RedStream *stream, SpiceCoreInterfaceInternal *core);
> +bool red_stream_is_ssl(RedStream *stream);
> +RedStreamSslStatus red_stream_ssl_accept(RedStream *stream);
> +int red_stream_enable_ssl(RedStream *stream, SSL_CTX *ctx);
> +int red_stream_get_family(const RedStream *stream);
> +bool red_stream_is_plain_unix(const RedStream *stream);
> +bool red_stream_set_no_delay(RedStream *stream, bool no_delay);
> +int red_stream_get_no_delay(RedStream *stream);
> +int red_stream_send_msgfd(RedStream *stream, int fd);
> +
> +typedef enum {
> +    RED_SASL_ERROR_OK,
> +    RED_SASL_ERROR_GENERIC,
> +    RED_SASL_ERROR_INVALID_DATA,
> +    RED_SASL_ERROR_RETRY,
> +    RED_SASL_ERROR_CONTINUE,
> +    RED_SASL_ERROR_AUTH_FAILED
> +} RedSaslError;
> +
> +RedSaslError red_sasl_handle_auth_step(RedStream *stream, AsyncReadDone read_cb, void *opaque);
> +RedSaslError red_sasl_handle_auth_steplen(RedStream *stream, AsyncReadDone read_cb, void *opaque);
> +RedSaslError red_sasl_handle_auth_start(RedStream *stream, AsyncReadDone read_cb, void *opaque);
> +RedSaslError red_sasl_handle_auth_startlen(RedStream *stream, AsyncReadDone read_cb, void *opaque);
> +bool red_sasl_handle_auth_mechname(RedStream *stream, AsyncReadDone read_cb, void *opaque);
> +bool red_sasl_handle_auth_mechlen(RedStream *stream, AsyncReadDone read_cb, void *opaque);
> +bool red_sasl_start_auth(RedStream *stream, AsyncReadDone read_cb, void *opaque);
> +
> +#endif /* RED_STREAM_H_ */
> diff --git a/server/red-worker.h b/server/red-worker.h
> index d8a34b339..3c447f128 100644
> --- a/server/red-worker.h
> +++ b/server/red-worker.h
> @@ -101,7 +101,7 @@ enum {
>
>  typedef struct RedWorkerMessageDisplayConnect {
>      RedClient * client;
> -    RedsStream * stream;
> +    RedStream * stream;
>      RedChannelCapabilities caps;   // red_worker should reset
>      int migration;
>  } RedWorkerMessageDisplayConnect;
> @@ -116,7 +116,7 @@ typedef struct RedWorkerMessageDisplayMigrate {
>
>  typedef struct RedWorkerMessageCursorConnect {
>      RedClient *client;
> -    RedsStream *stream;
> +    RedStream *stream;
>      int migration;
>      RedChannelCapabilities caps;   // red_worker should reset
>  } RedWorkerMessageCursorConnect;
> diff --git a/server/reds-private.h b/server/reds-private.h
> index 259496c64..adc48ba53 100644
> --- a/server/reds-private.h
> +++ b/server/reds-private.h
> @@ -50,7 +50,7 @@ typedef struct MonitorMode {
>
>  typedef struct RedsMigPendingLink {
>      SpiceLinkMess *link_msg;
> -    RedsStream *stream;
> +    RedStream *stream;
>  } RedsMigPendingLink;
>
>  typedef struct RedsMigTargetClient {
> diff --git a/server/reds-stream.h b/server/reds-stream.h
> deleted file mode 100644
> index 10ec50b38..000000000
> --- a/server/reds-stream.h
> +++ /dev/null
> @@ -1,93 +0,0 @@
> -/*
> -   Copyright (C) 2009, 2013 Red Hat, Inc.
> -
> -   This library is free software; you can redistribute it and/or
> -   modify it under the terms of the GNU Lesser General Public
> -   License as published by the Free Software Foundation; either
> -   version 2.1 of the License, or (at your option) any later version.
> -
> -   This library is distributed in the hope that it will be useful,
> -   but WITHOUT ANY WARRANTY; without even the implied warranty of
> -   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> -   Lesser General Public License for more details.
> -
> -   You should have received a copy of the GNU Lesser General Public
> -   License along with this library; if not, see <http://www.gnu.org/licenses/>.
> -*/
> -
> -#ifndef REDS_STREAM_H_
> -#define REDS_STREAM_H_
> -
> -#include <openssl/ssl.h>
> -#include <common/mem.h>
> -
> -#include "spice.h"
> -#include "red-common.h"
> -
> -typedef void (*AsyncReadDone)(void *opaque);
> -typedef void (*AsyncReadError)(void *opaque, int err);
> -
> -typedef struct RedsStream RedsStream;
> -typedef struct RedsStreamPrivate RedsStreamPrivate;
> -
> -struct RedsStream {
> -    int socket;
> -    SpiceWatch *watch;
> -
> -    RedsStreamPrivate *priv;
> -};
> -
> -typedef enum {
> -    REDS_STREAM_SSL_STATUS_OK,
> -    REDS_STREAM_SSL_STATUS_ERROR,
> -    REDS_STREAM_SSL_STATUS_WAIT_FOR_READ,
> -    REDS_STREAM_SSL_STATUS_WAIT_FOR_WRITE
> -} RedsStreamSslStatus;
> -
> -/* any thread */
> -ssize_t reds_stream_read(RedsStream *s, void *buf, size_t nbyte);
> -void reds_stream_async_read(RedsStream *stream, uint8_t *data, size_t size,
> -                            AsyncReadDone read_done_cb, void *opaque);
> -void reds_stream_set_async_error_handler(RedsStream *stream,
> -                                         AsyncReadError error_handler);
> -ssize_t reds_stream_write(RedsStream *s, const void *buf, size_t nbyte);
> -ssize_t reds_stream_writev(RedsStream *s, const struct iovec *iov, int iovcnt);
> -bool reds_stream_write_all(RedsStream *stream, const void *in_buf, size_t n);
> -bool reds_stream_write_u8(RedsStream *s, uint8_t n);
> -bool reds_stream_write_u32(RedsStream *s, uint32_t n);
> -void reds_stream_disable_writev(RedsStream *stream);
> -void reds_stream_free(RedsStream *s);
> -
> -void reds_stream_push_channel_event(RedsStream *s, int event);
> -void reds_stream_remove_watch(RedsStream* s);
> -void reds_stream_set_channel(RedsStream *stream, int connection_id,
> -                             int channel_type, int channel_id);
> -RedsStream *reds_stream_new(RedsState *reds, int socket);
> -void reds_stream_set_core_interface(RedsStream *stream, SpiceCoreInterfaceInternal *core);
> -bool reds_stream_is_ssl(RedsStream *stream);
> -RedsStreamSslStatus reds_stream_ssl_accept(RedsStream *stream);
> -int reds_stream_enable_ssl(RedsStream *stream, SSL_CTX *ctx);
> -int reds_stream_get_family(const RedsStream *stream);
> -bool reds_stream_is_plain_unix(const RedsStream *stream);
> -bool reds_stream_set_no_delay(RedsStream *stream, bool no_delay);
> -int reds_stream_get_no_delay(RedsStream *stream);
> -int reds_stream_send_msgfd(RedsStream *stream, int fd);
> -
> -typedef enum {
> -    REDS_SASL_ERROR_OK,
> -    REDS_SASL_ERROR_GENERIC,
> -    REDS_SASL_ERROR_INVALID_DATA,
> -    REDS_SASL_ERROR_RETRY,
> -    REDS_SASL_ERROR_CONTINUE,
> -    REDS_SASL_ERROR_AUTH_FAILED
> -} RedsSaslError;
> -
> -RedsSaslError reds_sasl_handle_auth_step(RedsStream *stream, AsyncReadDone read_cb, void *opaque);
> -RedsSaslError reds_sasl_handle_auth_steplen(RedsStream *stream, AsyncReadDone read_cb, void *opaque);
> -RedsSaslError reds_sasl_handle_auth_start(RedsStream *stream, AsyncReadDone read_cb, void *opaque);
> -RedsSaslError reds_sasl_handle_auth_startlen(RedsStream *stream, AsyncReadDone read_cb, void *opaque);
> -bool reds_sasl_handle_auth_mechname(RedsStream *stream, AsyncReadDone read_cb, void *opaque);
> -bool reds_sasl_handle_auth_mechlen(RedsStream *stream, AsyncReadDone read_cb, void *opaque);
> -bool reds_sasl_start_auth(RedsStream *stream, AsyncReadDone read_cb, void *opaque);
> -
> -#endif /* REDS_STREAM_H_ */
> diff --git a/server/reds.c b/server/reds.c
> index 4af804065..816d0e699 100644
> --- a/server/reds.c
> +++ b/server/reds.c
> @@ -64,7 +64,7 @@
>  #ifdef USE_SMARTCARD
>  #include "smartcard.h"
>  #endif
> -#include "reds-stream.h"
> +#include "red-stream.h"
>  #include "red-client.h"
>
>  #include "reds-private.h"
> @@ -197,7 +197,7 @@ struct RedServerConfig {
>
>  typedef struct RedLinkInfo {
>      RedsState *reds;
> -    RedsStream *stream;
> +    RedStream *stream;
>      SpiceLinkHeader link_header;
>      SpiceLinkMess *link_mess;
>      int mess_pos;
> @@ -331,7 +331,7 @@ void reds_handle_channel_event(RedsState *reds, int event, SpiceChannelEventInfo
>
>  static void reds_link_free(RedLinkInfo *link)
>  {
> -    reds_stream_free(link->stream);
> +    red_stream_free(link->stream);
>      link->stream = NULL;
>
>      g_free(link->link_mess);
> @@ -1608,16 +1608,16 @@ static bool reds_send_link_ack(RedsState *reds, RedLinkInfo *link)
>          memset(msg.ack.pub_key, '\0', sizeof(msg.ack.pub_key));
>      }
>
> -    if (!reds_stream_write_all(link->stream, &msg, sizeof(msg)))
> +    if (!red_stream_write_all(link->stream, &msg, sizeof(msg)))
>          goto end;
>      for (unsigned int i = 0; i < channel_caps->num_common_caps; i++) {
>          guint32 cap = GUINT32_TO_LE(channel_caps->common_caps[i]);
> -        if (!reds_stream_write_all(link->stream, &cap, sizeof(cap)))
> +        if (!red_stream_write_all(link->stream, &cap, sizeof(cap)))
>              goto end;
>      }
>      for (unsigned int i = 0; i < channel_caps->num_caps; i++) {
>          guint32 cap = GUINT32_TO_LE(channel_caps->caps[i]);
> -        if (!reds_stream_write_all(link->stream, &cap, sizeof(cap)))
> +        if (!red_stream_write_all(link->stream, &cap, sizeof(cap)))
>              goto end;
>      }
>
> @@ -1643,7 +1643,7 @@ static bool reds_send_link_error(RedLinkInfo *link, uint32_t error)
>      msg.header.minor_version = GUINT32_TO_LE(SPICE_VERSION_MINOR);
>      memset(&msg.reply, 0, sizeof(msg.reply));
>      msg.reply.error = GUINT32_TO_LE(error);
> -    return reds_stream_write_all(link->stream, &msg, sizeof(msg));
> +    return red_stream_write_all(link->stream, &msg, sizeof(msg));
>  }
>
>  static void reds_info_new_channel(RedLinkInfo *link, int connection_id)
> @@ -1651,18 +1651,18 @@ static void reds_info_new_channel(RedLinkInfo *link, int connection_id)
>      spice_debug("channel %d:%d, connected successfully, over %s link",
>                  link->link_mess->channel_type,
>                  link->link_mess->channel_id,
> -                reds_stream_is_ssl(link->stream) ? "Secure" : "Non Secure");
> +                red_stream_is_ssl(link->stream) ? "Secure" : "Non Secure");
>      /* add info + send event */
> -    reds_stream_set_channel(link->stream, connection_id,
> -                            link->link_mess->channel_type,
> -                            link->link_mess->channel_id);
> -    reds_stream_push_channel_event(link->stream, SPICE_CHANNEL_EVENT_INITIALIZED);
> +    red_stream_set_channel(link->stream, connection_id,
> +                           link->link_mess->channel_type,
> +                           link->link_mess->channel_id);
> +    red_stream_push_channel_event(link->stream, SPICE_CHANNEL_EVENT_INITIALIZED);
>  }
>
>  static void reds_send_link_result(RedLinkInfo *link, uint32_t error)
>  {
>      error = GUINT32_TO_LE(error);
> -    reds_stream_write_all(link->stream, &error, sizeof(error));
> +    red_stream_write_all(link->stream, &error, sizeof(error));
>  }
>
>  static void reds_mig_target_client_add(RedsState *reds, RedClient *client)
> @@ -1693,7 +1693,7 @@ static RedsMigTargetClient* reds_mig_target_client_find(RedsState *reds, RedClie
>
>  static void reds_mig_target_client_add_pending_link(RedsMigTargetClient *client,
>                                                      SpiceLinkMess *link_msg,
> -                                                    RedsStream *stream)
> +                                                    RedStream *stream)
>  {
>      RedsMigPendingLink *mig_link;
>
> @@ -1771,7 +1771,7 @@ red_channel_capabilities_init_from_link_message(RedChannelCapabilities *caps,
>  static void reds_handle_main_link(RedsState *reds, RedLinkInfo *link)
>  {
>      RedClient *client;
> -    RedsStream *stream;
> +    RedStream *stream;
>      SpiceLinkMess *link_mess;
>      uint32_t connection_id;
>      MainChannelClient *mcc;
> @@ -1804,7 +1804,7 @@ static void reds_handle_main_link(RedsState *reds, RedLinkInfo *link)
>
>      reds_info_new_channel(link, connection_id);
>      stream = link->stream;
> -    reds_stream_remove_watch(stream);
> +    red_stream_remove_watch(stream);
>      link->stream = NULL;
>      link->link_mess = NULL;
>      reds_link_free(link);
> @@ -1845,7 +1845,7 @@ static void reds_handle_main_link(RedsState *reds, RedLinkInfo *link)
>          reds_mig_target_client_add(reds, client);
>      }
>
> -    if (reds_stream_get_family(stream) != AF_UNIX)
> +    if (red_stream_get_family(stream) != AF_UNIX)
>          main_channel_client_start_net_test(mcc, !mig_target);
>  }
>
> @@ -1873,7 +1873,7 @@ static void openssl_init(RedLinkInfo *link)
>
>  static void reds_channel_do_link(RedChannel *channel, RedClient *client,
>                                   SpiceLinkMess *link_msg,
> -                                 RedsStream *stream)
> +                                 RedStream *stream)
>  {
>      RedChannelCapabilities caps;
>
> @@ -2006,7 +2006,7 @@ static void reds_handle_other_links(RedsState *reds, RedLinkInfo *link)
>
>      reds_send_link_result(link, SPICE_LINK_ERR_OK);
>      reds_info_new_channel(link, link_mess->connection_id);
> -    reds_stream_remove_watch(link->stream);
> +    red_stream_remove_watch(link->stream);
>
>      mig_client = reds_mig_target_client_find(reds, client);
>      /*
> @@ -2103,9 +2103,9 @@ end:
>
>  static void reds_get_spice_ticket(RedLinkInfo *link)
>  {
> -    reds_stream_async_read(link->stream,
> -                           (uint8_t *)&link->tiTicketing.encrypted_ticket.encrypted_data,
> -                           link->tiTicketing.rsa_size, reds_handle_ticket, link);
> +    red_stream_async_read(link->stream,
> +                          (uint8_t *)&link->tiTicketing.encrypted_ticket.encrypted_data,
> +                          link->tiTicketing.rsa_size, reds_handle_ticket, link);
>  }
>
>  #if HAVE_SASL
> @@ -2131,12 +2131,12 @@ static void reds_handle_auth_sasl_step(void *opaque)
>  {
>      RedLinkInfo *link = (RedLinkInfo *)opaque;
>      RedsState *reds = link->reds;
> -    RedsSaslError status;
> +    RedSaslError status;
>
> -    status = reds_sasl_handle_auth_step(link->stream, reds_handle_auth_sasl_steplen, link);
> -    if (status == REDS_SASL_ERROR_OK) {
> +    status = red_sasl_handle_auth_step(link->stream, reds_handle_auth_sasl_steplen, link);
> +    if (status == RED_SASL_ERROR_OK) {
>          reds_handle_link(reds, link);
> -    } else if (status != REDS_SASL_ERROR_CONTINUE) {
> +    } else if (status != RED_SASL_ERROR_CONTINUE) {
>          reds_link_free(link);
>      }
>  }
> @@ -2144,10 +2144,10 @@ static void reds_handle_auth_sasl_step(void *opaque)
>  static void reds_handle_auth_sasl_steplen(void *opaque)
>  {
>      RedLinkInfo *link = (RedLinkInfo *)opaque;
> -    RedsSaslError status;
> +    RedSaslError status;
>
> -    status = reds_sasl_handle_auth_steplen(link->stream, reds_handle_auth_sasl_step, link);
> -    if (status != REDS_SASL_ERROR_OK) {
> +    status = red_sasl_handle_auth_steplen(link->stream, reds_handle_auth_sasl_step, link);
> +    if (status != RED_SASL_ERROR_OK) {
>          reds_link_free(link);
>      }
>  }
> @@ -2172,12 +2172,12 @@ static void reds_handle_auth_sasl_start(void *opaque)
>  {
>      RedLinkInfo *link = (RedLinkInfo *)opaque;
>      RedsState *reds = link->reds;
> -    RedsSaslError status;
> +    RedSaslError status;
>
> -    status = reds_sasl_handle_auth_start(link->stream, reds_handle_auth_sasl_steplen, link);
> -    if (status == REDS_SASL_ERROR_OK) {
> +    status = red_sasl_handle_auth_start(link->stream, reds_handle_auth_sasl_steplen, link);
> +    if (status == RED_SASL_ERROR_OK) {
>          reds_handle_link(reds, link);
> -    } else if (status != REDS_SASL_ERROR_CONTINUE) {
> +    } else if (status != RED_SASL_ERROR_CONTINUE) {
>          reds_link_free(link);
>      }
>  }
> @@ -2185,17 +2185,17 @@ static void reds_handle_auth_sasl_start(void *opaque)
>  static void reds_handle_auth_startlen(void *opaque)
>  {
>      RedLinkInfo *link = (RedLinkInfo *)opaque;
> -    RedsSaslError status;
> +    RedSaslError status;
>
> -    status = reds_sasl_handle_auth_startlen(link->stream, reds_handle_auth_sasl_start, link);
> +    status = red_sasl_handle_auth_startlen(link->stream, reds_handle_auth_sasl_start, link);
>      switch (status) {
> -        case REDS_SASL_ERROR_OK:
> +        case RED_SASL_ERROR_OK:
>              break;
> -        case REDS_SASL_ERROR_RETRY:
> +        case RED_SASL_ERROR_RETRY:
>              reds_handle_auth_sasl_start(opaque);
>              break;
> -        case REDS_SASL_ERROR_GENERIC:
> -        case REDS_SASL_ERROR_INVALID_DATA:
> +        case RED_SASL_ERROR_GENERIC:
> +        case RED_SASL_ERROR_INVALID_DATA:
>              reds_send_link_error(link, SPICE_LINK_ERR_INVALID_DATA);
>              reds_link_free(link);
>              break;
> @@ -2211,7 +2211,7 @@ static void reds_handle_auth_mechname(void *opaque)
>  {
>      RedLinkInfo *link = (RedLinkInfo *)opaque;
>
> -    if (!reds_sasl_handle_auth_mechname(link->stream, reds_handle_auth_startlen, link)) {
> +    if (!red_sasl_handle_auth_mechname(link->stream, reds_handle_auth_startlen, link)) {
>              reds_send_link_error(link, SPICE_LINK_ERR_INVALID_DATA);
>      }
>  }
> @@ -2220,14 +2220,14 @@ static void reds_handle_auth_mechlen(void *opaque)
>  {
>      RedLinkInfo *link = (RedLinkInfo *)opaque;
>
> -    if (!reds_sasl_handle_auth_mechlen(link->stream, reds_handle_auth_mechname, link)) {
> +    if (!red_sasl_handle_auth_mechlen(link->stream, reds_handle_auth_mechname, link)) {
>          reds_link_free(link);
>      }
>  }
>
>  static void reds_start_auth_sasl(RedLinkInfo *link)
>  {
> -    if (!reds_sasl_start_auth(link->stream, reds_handle_auth_mechlen, link)) {
> +    if (!red_sasl_start_auth(link->stream, reds_handle_auth_mechlen, link)) {
>          reds_link_free(link);
>      }
>  }
> @@ -2265,8 +2265,8 @@ static int reds_security_check(RedLinkInfo *link)
>      RedsState *reds = link->reds;
>      ChannelSecurityOptions *security_option = reds_find_channel_security(reds, link->link_mess->channel_type);
>      uint32_t security = security_option ? security_option->options : reds->config->default_channel_security;
> -    return (reds_stream_is_ssl(link->stream) && (security & SPICE_CHANNEL_SECURITY_SSL)) ||
> -        (!reds_stream_is_ssl(link->stream) && (security & SPICE_CHANNEL_SECURITY_NONE));
> +    return (red_stream_is_ssl(link->stream) && (security & SPICE_CHANNEL_SECURITY_SSL)) ||
> +        (!red_stream_is_ssl(link->stream) && (security & SPICE_CHANNEL_SECURITY_NONE));
>  }
>
>  static void reds_handle_read_link_done(void *opaque)
> @@ -2310,7 +2310,7 @@ static void reds_handle_read_link_done(void *opaque)
>                                                     SPICE_COMMON_CAP_PROTOCOL_AUTH_SELECTION);
>
>      if (!reds_security_check(link)) {
> -        if (reds_stream_is_ssl(link->stream)) {
> +        if (red_stream_is_ssl(link->stream)) {
>              spice_warning("spice channels %d should not be encrypted", link_mess->channel_type);
>              reds_send_link_error(link, SPICE_LINK_ERR_NEED_UNSECURED);
>          } else {
> @@ -2335,11 +2335,11 @@ static void reds_handle_read_link_done(void *opaque)
>          spice_warning("Peer doesn't support AUTH selection");
>          reds_get_spice_ticket(link);
>      } else {
> -        reds_stream_async_read(link->stream,
> -                               (uint8_t *)&link->auth_mechanism,
> -                               sizeof(SpiceLinkAuthMechanism),
> -                               reds_handle_auth_mechanism,
> -                               link);
> +        red_stream_async_read(link->stream,
> +                              (uint8_t *)&link->auth_mechanism,
> +                              sizeof(SpiceLinkAuthMechanism),
> +                              reds_handle_auth_mechanism,
> +                              link);
>      }
>  }
>
> @@ -2386,11 +2386,11 @@ static void reds_handle_read_header_done(void *opaque)
>
>      link->link_mess = g_malloc(header->size);
>
> -    reds_stream_async_read(link->stream,
> -                           (uint8_t *)link->link_mess,
> -                           header->size,
> -                           reds_handle_read_link_done,
> -                           link);
> +    red_stream_async_read(link->stream,
> +                          (uint8_t *)link->link_mess,
> +                          header->size,
> +                          reds_handle_read_link_done,
> +                          link);
>  }
>
>  static void reds_handle_read_magic_done(void *opaque)
> @@ -2404,43 +2404,43 @@ static void reds_handle_read_magic_done(void *opaque)
>          return;
>      }
>
> -    reds_stream_async_read(link->stream,
> -                           ((uint8_t *)&link->link_header) + sizeof(header->magic),
> -                           sizeof(SpiceLinkHeader) - sizeof(header->magic),
> -                           reds_handle_read_header_done,
> -                           link);
> +    red_stream_async_read(link->stream,
> +                          ((uint8_t *)&link->link_header) + sizeof(header->magic),
> +                          sizeof(SpiceLinkHeader) - sizeof(header->magic),
> +                          reds_handle_read_header_done,
> +                          link);
>  }
>
>  static void reds_handle_new_link(RedLinkInfo *link)
>  {
> -    reds_stream_set_async_error_handler(link->stream, reds_handle_link_error);
> -    reds_stream_async_read(link->stream,
> -                           (uint8_t *)&link->link_header,
> -                           sizeof(link->link_header.magic),
> -                           reds_handle_read_magic_done,
> -                           link);
> +    red_stream_set_async_error_handler(link->stream, reds_handle_link_error);
> +    red_stream_async_read(link->stream,
> +                          (uint8_t *)&link->link_header,
> +                          sizeof(link->link_header.magic),
> +                          reds_handle_read_magic_done,
> +                          link);
>  }
>
>  static void reds_handle_ssl_accept(int fd, int event, void *data)
>  {
>      RedLinkInfo *link = (RedLinkInfo *)data;
>      RedsState *reds = link->reds;
> -    int return_code = reds_stream_ssl_accept(link->stream);
> +    int return_code = red_stream_ssl_accept(link->stream);
>
>      switch (return_code) {
> -        case REDS_STREAM_SSL_STATUS_ERROR:
> +        case RED_STREAM_SSL_STATUS_ERROR:
>              reds_link_free(link);
>              return;
> -        case REDS_STREAM_SSL_STATUS_WAIT_FOR_READ:
> +        case RED_STREAM_SSL_STATUS_WAIT_FOR_READ:
>              reds_core_watch_update_mask(reds, link->stream->watch,
>                                          SPICE_WATCH_EVENT_READ);
>              return;
> -        case REDS_STREAM_SSL_STATUS_WAIT_FOR_WRITE:
> +        case RED_STREAM_SSL_STATUS_WAIT_FOR_WRITE:
>              reds_core_watch_update_mask(reds, link->stream->watch,
>                                          SPICE_WATCH_EVENT_WRITE);
>              return;
> -        case REDS_STREAM_SSL_STATUS_OK:
> -            reds_stream_remove_watch(link->stream);
> +        case RED_STREAM_SSL_STATUS_OK:
> +            red_stream_remove_watch(link->stream);
>              reds_handle_new_link(link);
>      }
>  }
> @@ -2463,11 +2463,11 @@ static RedLinkInfo *reds_init_client_connection(RedsState *reds, int socket)
>
>      link = g_new0(RedLinkInfo, 1);
>      link->reds = reds;
> -    link->stream = reds_stream_new(reds, socket);
> +    link->stream = red_stream_new(reds, socket);
>
>      /* gather info + send event */
>
> -    reds_stream_push_channel_event(link->stream, SPICE_CHANNEL_EVENT_CONNECTED);
> +    red_stream_push_channel_event(link->stream, SPICE_CHANNEL_EVENT_CONNECTED);
>
>      openssl_init(link);
>
> @@ -2488,19 +2488,19 @@ static RedLinkInfo *reds_init_client_ssl_connection(RedsState *reds, int socket)
>          return NULL;
>      }
>
> -    ssl_status = reds_stream_enable_ssl(link->stream, reds->ctx);
> +    ssl_status = red_stream_enable_ssl(link->stream, reds->ctx);
>      switch (ssl_status) {
> -        case REDS_STREAM_SSL_STATUS_OK:
> +        case RED_STREAM_SSL_STATUS_OK:
>              reds_handle_new_link(link);
>              return link;
> -        case REDS_STREAM_SSL_STATUS_ERROR:
> +        case RED_STREAM_SSL_STATUS_ERROR:
>              goto error;
> -        case REDS_STREAM_SSL_STATUS_WAIT_FOR_READ:
> +        case RED_STREAM_SSL_STATUS_WAIT_FOR_READ:
>              link->stream->watch = reds_core_watch_add(reds, link->stream->socket,
>                                                        SPICE_WATCH_EVENT_READ,
>                                                        reds_handle_ssl_accept, link);
>              break;
> -        case REDS_STREAM_SSL_STATUS_WAIT_FOR_WRITE:
> +        case RED_STREAM_SSL_STATUS_WAIT_FOR_WRITE:
>              link->stream->watch = reds_core_watch_add(reds, link->stream->socket,
>                                                        SPICE_WATCH_EVENT_WRITE,
>                                                        reds_handle_ssl_accept, link);
> diff --git a/server/smartcard-channel-client.c b/server/smartcard-channel-client.c
> index b1652e769..a0c1d8aa6 100644
> --- a/server/smartcard-channel-client.c
> +++ b/server/smartcard-channel-client.c
> @@ -107,7 +107,7 @@ smart_card_channel_client_init(SmartCardChannelClient *self)
>  }
>
>  SmartCardChannelClient* smartcard_channel_client_create(RedChannel *channel,
> -                                                        RedClient *client, RedsStream *stream,
> +                                                        RedClient *client, RedStream *stream,
>                                                          RedChannelCapabilities *caps)
>  {
>      SmartCardChannelClient *rcc;
> diff --git a/server/smartcard-channel-client.h b/server/smartcard-channel-client.h
> index fffad2313..9e3a0d44e 100644
> --- a/server/smartcard-channel-client.h
> +++ b/server/smartcard-channel-client.h
> @@ -56,7 +56,7 @@ struct SmartCardChannelClientClass
>  GType smart_card_channel_client_get_type(void) G_GNUC_CONST;
>
>  SmartCardChannelClient* smartcard_channel_client_create(RedChannel *channel,
> -                                                        RedClient *client, RedsStream *stream,
> +                                                        RedClient *client, RedStream *stream,
>                                                          RedChannelCapabilities *caps);
>
>  bool smartcard_channel_client_handle_migrate_flush_mark(RedChannelClient *rcc);
> diff --git a/server/smartcard.c b/server/smartcard.c
> index 5410720a8..10a8b9400 100644
> --- a/server/smartcard.c
> +++ b/server/smartcard.c
> @@ -527,7 +527,7 @@ int smartcard_char_device_handle_migrate_data(RedCharDeviceSmartcard *smartcard,
>  }
>
>  static void smartcard_connect_client(RedChannel *channel, RedClient *client,
> -                                     RedsStream *stream, int migration,
> +                                     RedStream *stream, int migration,
>                                       RedChannelCapabilities *caps)
>  {
>      SpiceCharDeviceInstance *char_device =
> diff --git a/server/sound.c b/server/sound.c
> index 9073626cd..b1bfaaaa9 100644
> --- a/server/sound.c
> +++ b/server/sound.c
> @@ -763,7 +763,7 @@ static bool snd_channel_client_config_socket(RedChannelClient *rcc)
>      int priority;
>  #endif
>      int tos;
> -    RedsStream *stream = red_channel_client_get_stream(rcc);
> +    RedStream *stream = red_channel_client_get_stream(rcc);
>      RedClient *red_client = red_channel_client_get_client(rcc);
>      MainChannelClient *mcc = red_client_get_main(red_client);
>
> @@ -784,7 +784,7 @@ static bool snd_channel_client_config_socket(RedChannelClient *rcc)
>          }
>      }
>
> -    reds_stream_set_no_delay(stream, !main_channel_client_is_low_bandwidth(mcc));
> +    red_stream_set_no_delay(stream, !main_channel_client_is_low_bandwidth(mcc));
>
>      return true;
>  }
> @@ -1084,7 +1084,7 @@ playback_channel_client_constructed(GObject *object)
>      snd_send(scc);
>  }
>
> -static void snd_set_peer(RedChannel *red_channel, RedClient *client, RedsStream *stream,
> +static void snd_set_peer(RedChannel *red_channel, RedClient *client, RedStream *stream,
>                           RedChannelCapabilities *caps, GType type)
>  {
>      SndChannel *channel = SND_CHANNEL(red_channel);
> @@ -1105,7 +1105,7 @@ static void snd_set_peer(RedChannel *red_channel, RedClient *client, RedsStream
>      g_warn_if_fail(snd_client != NULL);
>  }
>
> -static void snd_set_playback_peer(RedChannel *red_channel, RedClient *client, RedsStream *stream,
> +static void snd_set_playback_peer(RedChannel *red_channel, RedClient *client, RedStream *stream,
>                                    G_GNUC_UNUSED int migration,
>                                    RedChannelCapabilities *caps)
>  {
> @@ -1271,7 +1271,7 @@ record_channel_client_constructed(GObject *object)
>  }
>
>
> -static void snd_set_record_peer(RedChannel *red_channel, RedClient *client, RedsStream *stream,
> +static void snd_set_record_peer(RedChannel *red_channel, RedClient *client, RedStream *stream,
>                                  G_GNUC_UNUSED int migration,
>                                  RedChannelCapabilities *caps)
>  {
> diff --git a/server/spicevmc.c b/server/spicevmc.c
> index 9daf92b5b..42ed2eb38 100644
> --- a/server/spicevmc.c
> +++ b/server/spicevmc.c
> @@ -213,12 +213,12 @@ G_DEFINE_TYPE(VmcChannelClient, vmc_channel_client, RED_TYPE_CHANNEL_CLIENT)
>
>  static RedChannelClient *
>  vmc_channel_client_create(RedChannel *channel, RedClient *client,
> -                          RedsStream *stream,
> +                          RedStream *stream,
>                            RedChannelCapabilities *caps);
>
>
>  static void spicevmc_connect(RedChannel *channel, RedClient *client,
> -                             RedsStream *stream, int migration,
> +                             RedStream *stream, int migration,
>                               RedChannelCapabilities *caps);
>
>  static void
> @@ -337,7 +337,7 @@ static RedVmcPipeItem* try_compress_lz4(RedVmcChannel *channel, int n, RedVmcPip
>      RedVmcPipeItem *msg_item_compressed;
>      int compressed_data_count;
>
> -    if (reds_stream_get_family(red_channel_client_get_stream(channel->rcc)) == AF_UNIX) {
> +    if (red_stream_get_family(red_channel_client_get_stream(channel->rcc)) == AF_UNIX) {
>          /* AF_LOCAL - data will not be compressed */
>          return NULL;
>      }
> @@ -797,7 +797,7 @@ red_vmc_channel_port_class_init(RedVmcChannelPortClass *klass)
>  }
>
>  static void spicevmc_connect(RedChannel *channel, RedClient *client,
> -    RedsStream *stream, int migration,
> +    RedStream *stream, int migration,
>      RedChannelCapabilities *caps)
>  {
>      RedChannelClient *rcc;
> @@ -815,7 +815,7 @@ static void spicevmc_connect(RedChannel *channel, RedClient *client,
>                         type, id, vmc_channel->rcc);
>          // TODO: notify client in advance about the in use channel using
>          // SPICE_MSG_MAIN_CHANNEL_IN_USE (for example)
> -        reds_stream_free(stream);
> +        red_stream_free(stream);
>          return;
>      }
>
> @@ -994,7 +994,7 @@ vmc_channel_client_class_init(VmcChannelClientClass *klass)
>
>  static RedChannelClient *
>  vmc_channel_client_create(RedChannel *channel, RedClient *client,
> -                          RedsStream *stream,
> +                          RedStream *stream,
>                            RedChannelCapabilities *caps)
>  {
>      RedChannelClient *rcc;
> diff --git a/server/stream-channel.c b/server/stream-channel.c
> index 7e15dd363..c7ca02062 100644
> --- a/server/stream-channel.c
> +++ b/server/stream-channel.c
> @@ -159,7 +159,7 @@ stream_channel_client_on_disconnect(RedChannelClient *rcc)
>  }
>
>  static StreamChannelClient*
> -stream_channel_client_new(StreamChannel *channel, RedClient *client, RedsStream *stream,
> +stream_channel_client_new(StreamChannel *channel, RedClient *client, RedStream *stream,
>                            int mig_target, RedChannelCapabilities *caps)
>  {
>      StreamChannelClient *rcc;
> @@ -351,7 +351,7 @@ stream_channel_get_supported_codecs(StreamChannel *channel, uint8_t *out_codecs)
>  }
>
>  static void
> -stream_channel_connect(RedChannel *red_channel, RedClient *red_client, RedsStream *stream,
> +stream_channel_connect(RedChannel *red_channel, RedClient *red_client, RedStream *stream,
>                         int migration, RedChannelCapabilities *caps)
>  {
>      StreamChannel *channel = STREAM_CHANNEL(red_channel);
> diff --git a/server/tests/test-channel.c b/server/tests/test-channel.c
> index 3f96dcd3f..fb3db3895 100644
> --- a/server/tests/test-channel.c
> +++ b/server/tests/test-channel.c
> @@ -78,7 +78,7 @@ test_channel_send_item(RedChannelClient *rcc, RedPipeItem *item)
>  }
>
>  static void
> -test_connect_client(RedChannel *channel, RedClient *client, RedsStream *stream,
> +test_connect_client(RedChannel *channel, RedClient *client, RedStream *stream,
>                      int migration, RedChannelCapabilities *caps)
>  {
>      RedChannelClient *rcc;
> @@ -244,7 +244,7 @@ static void timeout_watch_count(void *opaque)
>      // TODO watch
>  }
>
> -static RedsStream *create_dummy_stream(SpiceServer *server, int *p_socket)
> +static RedStream *create_dummy_stream(SpiceServer *server, int *p_socket)
>  {
>      int sv[2];
>      g_assert_cmpint(socketpair(AF_LOCAL, SOCK_STREAM, 0, sv), ==, 0);
> @@ -254,7 +254,7 @@ static RedsStream *create_dummy_stream(SpiceServer *server, int *p_socket)
>      red_socket_set_non_blocking(sv[0], true);
>      red_socket_set_non_blocking(sv[1], true);
>
> -    RedsStream * stream = reds_stream_new(server, sv[0]);
> +    RedStream * stream = red_stream_new(server, sv[0]);
>      g_assert_nonnull(stream);
>
>      return stream;
> diff --git a/server/tests/test-stream.c b/server/tests/test-stream.c
> index 8f653b253..ef5d607e6 100644
> --- a/server/tests/test-stream.c
> +++ b/server/tests/test-stream.c
> @@ -25,7 +25,7 @@
>  #include <unistd.h>
>
>  #include <common/log.h>
> -#include "reds-stream.h"
> +#include "red-stream.h"
>  #include "basic-event-loop.h"
>
>  static SpiceServer *server = NULL;
> @@ -100,7 +100,7 @@ sock_fd_read(int sock, void *buf, ssize_t bufsize, int *fd)
>
>  int main(int argc, char *argv[])
>  {
> -    RedsStream *st[2];
> +    RedStream *st[2];
>      int sv[2];
>      int ret, fd = -1;
>      char c;
> @@ -112,13 +112,13 @@ int main(int argc, char *argv[])
>          return -1;
>      }
>
> -    st[0] = reds_stream_new(server, sv[0]);
> -    spice_assert(reds_stream_is_plain_unix(st[0]));
> -    st[1] = reds_stream_new(server, sv[1]);
> -    spice_assert(reds_stream_is_plain_unix(st[1]));
> +    st[0] = red_stream_new(server, sv[0]);
> +    spice_assert(red_stream_is_plain_unix(st[0]));
> +    st[1] = red_stream_new(server, sv[1]);
> +    spice_assert(red_stream_is_plain_unix(st[1]));
>
>      /* send stdin, for the fun of it */
> -    ret = reds_stream_send_msgfd(st[0], 0);
> +    ret = red_stream_send_msgfd(st[0], 0);
>      spice_assert(ret == 1);
>      ret = sock_fd_read(sv[1], &c, 1, &fd);
>      spice_assert(c == '@');
> @@ -127,7 +127,7 @@ int main(int argc, char *argv[])
>      close(fd);
>
>      /* send invalid fd behaviour */
> -    ret = reds_stream_send_msgfd(st[0], -1);
> +    ret = red_stream_send_msgfd(st[0], -1);
>      spice_assert(ret == 1);
>      ret = sock_fd_read(sv[1], &c, 1, &fd);
>      spice_assert(c == '@');
> @@ -135,9 +135,9 @@ int main(int argc, char *argv[])
>      spice_assert(fd == -1);
>
>      /* batch test */
> -    ret = reds_stream_send_msgfd(st[0], 0);
> +    ret = red_stream_send_msgfd(st[0], 0);
>      spice_assert(ret == 1);
> -    ret = reds_stream_send_msgfd(st[0], 0);
> +    ret = red_stream_send_msgfd(st[0], 0);
>      spice_assert(ret == 1);
>      ret = sock_fd_read(sv[1], &c, 1, &fd);
>      spice_assert(c == '@');
> @@ -150,8 +150,8 @@ int main(int argc, char *argv[])
>      spice_assert(fd != -1);
>      close(fd);
>
> -    reds_stream_free(st[0]);
> -    reds_stream_free(st[1]);
> +    red_stream_free(st[0]);
> +    red_stream_free(st[1]);
>
>      return 0;
>  }


--
Cheers,
Christophe de Dinechin (c3d)


More information about the Spice-devel mailing list