Index: libroar/Makefile
===================================================================
--- libroar/Makefile	(revision 3877)
+++ libroar/Makefile	(revision 3882)
@@ -8,5 +8,5 @@
 VIO_BRIDGE=vio_bio.o vio_stdio.o
 VIO=$(VIO_META) $(VIO_BRIDGE) vio_cmd.o vio_magic.o vio_pipe.o vio_socket.o vio_winsock.o vio_stack.o vio_jumbo.o vio_proto.o vio_dstr.o vio_tantalos.o vio_rtp.o
-OBJS=libroar.o config.o debug.o error.o basic.o stream.o client.o simple.o auth.o socket.o ctl.o buffer.o meta.o file.o acl.o cdrom.o pinentry.o sshaskpass.o $(VIO) stack.o slp.o nnode.o roardl.o roarx11.o beep.o
+OBJS=libroar.o config.o debug.o error.o basic.o stream.o client.o simple.o auth.o socket.o ctl.o buffer.o meta.o file.o acl.o cdrom.o pinentry.o sshaskpass.o $(VIO) stack.o slp.o nnode.o roardl.o roarx11.o beep.o proto.o
 
 #DEFINES        = -DDEBUG
Index: libroar/basic.c
===================================================================
--- libroar/basic.c	(revision 3875)
+++ libroar/basic.c	(revision 3882)
@@ -355,161 +355,4 @@
 }
 
-#define _ROAR_MESS_BUF_LEN (1 /* version */ + 1 /* cmd */ + 2 /* stream */ + 4 /* pos */ + 2 /* datalen */)
-int roar_send_message (struct roar_connection * con, struct roar_message * mes, char * data) {
- struct roar_vio_calls * vio;
-
- if ( (vio = roar_get_connection_vio2(con)) == NULL )
-  return -1;
-
- return roar_vsend_message(vio, mes, data);
-}
-
-int roar_vsend_message(struct roar_vio_calls * vio, struct roar_message * mes, char *  data) {
- char buf[_ROAR_MESS_BUF_LEN];
-
- roar_errno = ROAR_ERROR_UNKNOWN;
-
- ROAR_DBG("roar_send_message(*): try to send an request...");
-
- buf[0] = _ROAR_MESSAGE_VERSION;
- buf[1] = (unsigned char) mes->cmd;
- *(uint16_t*)(buf+2) = ROAR_HOST2NET16(mes->stream);
- *(uint32_t*)(buf+4) = ROAR_HOST2NET32(mes->pos);
- *(uint16_t*)(buf+8) = ROAR_HOST2NET16(mes->datalen);
-
- if ( roar_vio_write(vio, buf, _ROAR_MESS_BUF_LEN) != _ROAR_MESS_BUF_LEN ) {
-  roar_errno = ROAR_ERROR_PIPE;
-  return -1;
- }
-
- if ( mes->datalen != 0 ) {
-  if ( roar_vio_write(vio, data == NULL ? mes->data : data, mes->datalen) != mes->datalen ) {
-   roar_errno = ROAR_ERROR_PIPE;
-   return -1;
-  }
- }
-
- roar_errno = ROAR_ERROR_NONE;
-
- ROAR_DBG("roar_send_message(*) = 0");
- return 0;
-}
-
-int roar_recv_message (struct roar_connection * con, struct roar_message * mes, char ** data) {
- struct roar_vio_calls * vio;
-
- if ( (vio = roar_get_connection_vio2(con)) == NULL )
-  return -1;
-
- return roar_vrecv_message(vio, mes, data);
-}
-
-int roar_vrecv_message(struct roar_vio_calls * vio, struct roar_message * mes, char ** data) {
- char buf[_ROAR_MESS_BUF_LEN];
-
- roar_errno = ROAR_ERROR_UNKNOWN;
-
- ROAR_DBG("roar_recv_message(*): try to get a response form the server...");
-
- if ( mes == NULL )
-  return -1;
-
- if ( data != NULL )
-  *data = NULL;
-
- memset(mes, 0, sizeof(struct roar_message));
-
- if ( roar_vio_read(vio, buf, _ROAR_MESS_BUF_LEN) != _ROAR_MESS_BUF_LEN ) {
-  roar_errno = ROAR_ERROR_PROTO;
-  return -1;
- }
-
- ROAR_DBG("roar_recv_message(*): Got a header");
-
- if ( buf[0] != _ROAR_MESSAGE_VERSION ) {
-  roar_errno = ROAR_ERROR_PROTO;
-  return -1;
- }
-
- mes->cmd     = (unsigned char)buf[1];
- mes->stream  = ROAR_NET2HOST16(*(uint16_t*)(buf+2));
- mes->pos     = ROAR_NET2HOST32(*(uint32_t*)(buf+4));
- mes->datalen = ROAR_NET2HOST16(*(uint16_t*)(buf+8));
-
- if ( (int16_t)mes->stream == -1 )
-  mes->stream = -1;
-
- ROAR_DBG("roar_recv_message(*): command=%i(%s)", mes->cmd,
-           mes->cmd == ROAR_CMD_OK ? "OK" : (mes->cmd == ROAR_CMD_ERROR ? "ERROR" : "UNKNOWN"));
-
- if ( mes->datalen == 0 ) {
-  ROAR_DBG("roar_recv_message(*): no data in this pkg");
-  ROAR_DBG("roar_recv_message(*) = 0");
-  roar_errno = ROAR_ERROR_NONE;
-  return 0;
- }
-
- if ( mes->datalen <= LIBROAR_BUFFER_MSGDATA ) {
-  if ( roar_vio_read(vio, mes->data, mes->datalen) == mes->datalen ) {
-   ROAR_DBG("roar_recv_message(*): Got data!");
-   ROAR_DBG("roar_recv_message(*) = 0");
-   roar_errno = ROAR_ERROR_NONE;
-   return 0;
-  }
-
-  roar_errno = ROAR_ERROR_PIPE;
-  return -1;
- } else {
-  if ( data == NULL ) {
-   roar_errno = ROAR_ERROR_MSGSIZE;
-   return -1;
-  }
-
-  if ( (*data = malloc(mes->datalen)) == NULL ) {
-   roar_errno = ROAR_ERROR_NOMEM;
-   return -1;
-  }
-
-  if ( mes->datalen == 0 ) {
-   roar_errno = ROAR_ERROR_NONE;
-   return 0;
-  }
-
-  if ( roar_vio_read(vio, *data, mes->datalen) == mes->datalen ) {
-   ROAR_DBG("roar_recv_message(*): Got data!");
-   ROAR_DBG("roar_recv_message(*) = 0");
-   roar_errno = ROAR_ERROR_NONE;
-   return 0;
-  }
-
-  roar_errno = ROAR_ERROR_PIPE;
-  return -1;
- }
-
- // what happened here?
- return -1;
-}
-
-int roar_req (struct roar_connection * con, struct roar_message * mes, char ** data) {
- struct roar_vio_calls * vio;
-
- if ( (vio = roar_get_connection_vio2(con)) == NULL )
-  return -1;
-
- return roar_vreq(vio, mes, data);
-}
-
-int roar_vreq         (struct roar_vio_calls * vio, struct roar_message * mes, char ** data) {
- if ( roar_vsend_message(vio, mes, data ? *data : NULL) != 0 )
-  return -1;
-
- if ( data )
-  free(*data);
-
- roar_vio_sync(vio); // we need to do this becasue of ssl/compressed links
-
- return roar_vrecv_message(vio, mes, data);
-}
-
 int roar_debug_message_print (struct roar_message * mes) {
  if ( mes == NULL )
Index: libroar/proto.c
===================================================================
--- libroar/proto.c	(revision 3882)
+++ libroar/proto.c	(revision 3882)
@@ -0,0 +1,195 @@
+//proto.c:
+
+/*
+ *      Copyright (C) Philipp 'ph3-der-loewe' Schafft - 2008-2010
+ *
+ *  This file is part of libroar a part of RoarAudio,
+ *  a cross-platform sound system for both, home and professional use.
+ *  See README for details.
+ *
+ *  This file is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License version 3
+ *  as published by the Free Software Foundation.
+ *
+ *  libroar 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 General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this software; see the file COPYING.  If not, write to
+ *  the Free Software Foundation, 51 Franklin Street, Fifth Floor,
+ *  Boston, MA 02110-1301, USA.
+ *
+ *  NOTE for everyone want's to change something and send patches:
+ *  read README and HACKING! There a addition information on
+ *  the license of this document you need to read before you send
+ *  any patches.
+ *
+ *  NOTE for uses of non-GPL (LGPL,...) software using libesd, libartsc
+ *  or libpulse*:
+ *  The libs libroaresd, libroararts and libroarpulse link this lib
+ *  and are therefore GPL. Because of this it may be illigal to use
+ *  them with any software that uses libesd, libartsc or libpulse*.
+ */
+
+#include "libroar.h"
+
+#define _ROAR_MESS_BUF_LEN (1 /* version */ + 1 /* cmd */ + 2 /* stream */ + 4 /* pos */ + 2 /* datalen */)
+int roar_send_message (struct roar_connection * con, struct roar_message * mes, char * data) {
+ struct roar_vio_calls * vio;
+
+ if ( (vio = roar_get_connection_vio2(con)) == NULL )
+  return -1;
+
+ return roar_vsend_message(vio, mes, data);
+}
+
+int roar_vsend_message(struct roar_vio_calls * vio, struct roar_message * mes, char *  data) {
+ char buf[_ROAR_MESS_BUF_LEN];
+
+ roar_errno = ROAR_ERROR_UNKNOWN;
+
+ ROAR_DBG("roar_send_message(*): try to send an request...");
+
+ buf[0] = _ROAR_MESSAGE_VERSION;
+ buf[1] = (unsigned char) mes->cmd;
+ *(uint16_t*)(buf+2) = ROAR_HOST2NET16(mes->stream);
+ *(uint32_t*)(buf+4) = ROAR_HOST2NET32(mes->pos);
+ *(uint16_t*)(buf+8) = ROAR_HOST2NET16(mes->datalen);
+
+ if ( roar_vio_write(vio, buf, _ROAR_MESS_BUF_LEN) != _ROAR_MESS_BUF_LEN ) {
+  roar_errno = ROAR_ERROR_PIPE;
+  return -1;
+ }
+
+ if ( mes->datalen != 0 ) {
+  if ( roar_vio_write(vio, data == NULL ? mes->data : data, mes->datalen) != mes->datalen ) {
+   roar_errno = ROAR_ERROR_PIPE;
+   return -1;
+  }
+ }
+
+ roar_errno = ROAR_ERROR_NONE;
+
+ ROAR_DBG("roar_send_message(*) = 0");
+ return 0;
+}
+
+int roar_recv_message (struct roar_connection * con, struct roar_message * mes, char ** data) {
+ struct roar_vio_calls * vio;
+
+ if ( (vio = roar_get_connection_vio2(con)) == NULL )
+  return -1;
+
+ return roar_vrecv_message(vio, mes, data);
+}
+
+int roar_vrecv_message(struct roar_vio_calls * vio, struct roar_message * mes, char ** data) {
+ char buf[_ROAR_MESS_BUF_LEN];
+
+ roar_errno = ROAR_ERROR_UNKNOWN;
+
+ ROAR_DBG("roar_recv_message(*): try to get a response form the server...");
+
+ if ( mes == NULL )
+  return -1;
+
+ if ( data != NULL )
+  *data = NULL;
+
+ memset(mes, 0, sizeof(struct roar_message));
+
+ if ( roar_vio_read(vio, buf, _ROAR_MESS_BUF_LEN) != _ROAR_MESS_BUF_LEN ) {
+  roar_errno = ROAR_ERROR_PROTO;
+  return -1;
+ }
+
+ ROAR_DBG("roar_recv_message(*): Got a header");
+
+ if ( buf[0] != _ROAR_MESSAGE_VERSION ) {
+  roar_errno = ROAR_ERROR_PROTO;
+  return -1;
+ }
+
+ mes->cmd     = (unsigned char)buf[1];
+ mes->stream  = ROAR_NET2HOST16(*(uint16_t*)(buf+2));
+ mes->pos     = ROAR_NET2HOST32(*(uint32_t*)(buf+4));
+ mes->datalen = ROAR_NET2HOST16(*(uint16_t*)(buf+8));
+
+ if ( (int16_t)mes->stream == -1 )
+  mes->stream = -1;
+
+ ROAR_DBG("roar_recv_message(*): command=%i(%s)", mes->cmd,
+           mes->cmd == ROAR_CMD_OK ? "OK" : (mes->cmd == ROAR_CMD_ERROR ? "ERROR" : "UNKNOWN"));
+
+ if ( mes->datalen == 0 ) {
+  ROAR_DBG("roar_recv_message(*): no data in this pkg");
+  ROAR_DBG("roar_recv_message(*) = 0");
+  roar_errno = ROAR_ERROR_NONE;
+  return 0;
+ }
+
+ if ( mes->datalen <= LIBROAR_BUFFER_MSGDATA ) {
+  if ( roar_vio_read(vio, mes->data, mes->datalen) == mes->datalen ) {
+   ROAR_DBG("roar_recv_message(*): Got data!");
+   ROAR_DBG("roar_recv_message(*) = 0");
+   roar_errno = ROAR_ERROR_NONE;
+   return 0;
+  }
+
+  roar_errno = ROAR_ERROR_PIPE;
+  return -1;
+ } else {
+  if ( data == NULL ) {
+   roar_errno = ROAR_ERROR_MSGSIZE;
+   return -1;
+  }
+
+  if ( (*data = malloc(mes->datalen)) == NULL ) {
+   roar_errno = ROAR_ERROR_NOMEM;
+   return -1;
+  }
+
+  if ( mes->datalen == 0 ) {
+   roar_errno = ROAR_ERROR_NONE;
+   return 0;
+  }
+
+  if ( roar_vio_read(vio, *data, mes->datalen) == mes->datalen ) {
+   ROAR_DBG("roar_recv_message(*): Got data!");
+   ROAR_DBG("roar_recv_message(*) = 0");
+   roar_errno = ROAR_ERROR_NONE;
+   return 0;
+  }
+
+  roar_errno = ROAR_ERROR_PIPE;
+  return -1;
+ }
+
+ // what happened here?
+ return -1;
+}
+
+int roar_req (struct roar_connection * con, struct roar_message * mes, char ** data) {
+ struct roar_vio_calls * vio;
+
+ if ( (vio = roar_get_connection_vio2(con)) == NULL )
+  return -1;
+
+ return roar_vreq(vio, mes, data);
+}
+
+int roar_vreq         (struct roar_vio_calls * vio, struct roar_message * mes, char ** data) {
+ if ( roar_vsend_message(vio, mes, data ? *data : NULL) != 0 )
+  return -1;
+
+ if ( data )
+  free(*data);
+
+ roar_vio_sync(vio); // we need to do this becasue of ssl/compressed links
+
+ return roar_vrecv_message(vio, mes, data);
+}
+
+//ll
