Index: include/libroar/socket.h
===================================================================
--- include/libroar/socket.h	(revision 5369)
+++ include/libroar/socket.h	(revision 5375)
@@ -51,5 +51,5 @@
 
 int roar_socket_listen  (int type, const char * host, int port);
-int roar_socket_connect (const char * host, int port);
+int roar_socket_connect (int type, const char * host, int port);
 
 // TODO: those function should be made /static/.
@@ -62,6 +62,4 @@
 
 int roar_socket_open       (int mode, int type, const char * host, int port);
-int roar_socket_open_file  (int mode, const char * host, int port) _LIBROAR_ATTR_TO_STATIC;
-int roar_socket_open_proxy (int mode, int type, const char * host, int port, const char * proxy_type) _LIBROAR_ATTR_TO_STATIC;
 
 int roar_socket_listen_decnet (const char * object, int num);
@@ -70,7 +68,5 @@
 
 int roar_socket_nonblock(int fh, int state);
-int roar_socket_decnet_set_timeout (int fh, time_t sec, int usec);
-int roar_socket_recvbuf(int fh, int len);
-int roar_socket_set_tos(int fh);
+int roar_socket_decnet_set_timeout (int fh, time_t sec, int_least32_t usec);
 
 int roar_socket_dup_udp_local_end (int fh);
@@ -79,13 +75,4 @@
 int roar_socket_recv_fh (int sock,         char * mes, size_t * len);
 
-int roar_socket_open_socks4 (int mode, int fh, const char * host, int port, const char * user, const char * pw, const char * opts) _LIBROAR_ATTR_TO_STATIC;
-int roar_socket_open_socks4a(int mode, int fh, const char * host, int port, const char * user, const char * pw, const char * opts) _LIBROAR_ATTR_TO_STATIC;
-int roar_socket_open_socks4d(int mode, int fh, const char * host, int port, const char * user, const char * pw, const char * opts) _LIBROAR_ATTR_TO_STATIC;
-int roar_socket_open_socks4x(int mode, int fh, char host[4], int port, const char * app, size_t app_len, const char * user) _LIBROAR_ATTR_TO_STATIC;
-
-int roar_socket_open_http   (int mode, int fh, const char * host, int port, const char * user, const char * pw, const char * opts) _LIBROAR_ATTR_TO_STATIC;
-
-int roar_socket_open_ssh    (int mode, int fh, const char * host, int port, const char * user, const char * pw, const char * opts) _LIBROAR_ATTR_TO_STATIC;
-
 #endif
 
Index: libroar/basic.c
===================================================================
--- libroar/basic.c	(revision 5373)
+++ libroar/basic.c	(revision 5375)
@@ -226,5 +226,5 @@
 
  if ( port || is_decnet ) {
-  fh = roar_socket_connect(user_sock, port);
+  fh = roar_socket_connect(type, user_sock, port);
   // restore the original string
   user_sock[i] = ':';
@@ -239,5 +239,5 @@
   }
 #endif
-  fh = roar_socket_connect(user_sock, ROAR_DEFAULT_PORT);
+  fh = roar_socket_connect(type, user_sock, ROAR_DEFAULT_PORT);
  }
 
@@ -368,5 +368,5 @@
 #endif
 
-  if ( _connect_server(con, "+abstract", -1, flags, timeout) == 0 )
+  if ( _connect_server(con, "+abstract", ROAR_SOCKET_TYPE_UNKNOWN, flags, timeout) == 0 )
    return 0;
 
@@ -377,5 +377,5 @@
     ) {
   if ( (server = roar_slp_find_roard(0)) != NULL ) {
-   if ( _connect_server(con, server, -1, 0, 0) == 0 )
+   if ( _connect_server(con, server, ROAR_SOCKET_TYPE_UNKNOWN, 0, 0) == 0 )
     return 0;
 
@@ -384,5 +384,5 @@
    ROAR_WARN("roar_connect_raw(*): Can not connect to SLP located server, disabling cache");
    if ( (server = roar_slp_find_roard(1)) != NULL )
-    if ( _connect_server(con, server, -1, 0, 0) == 0 )
+    if ( _connect_server(con, server, ROAR_SOCKET_TYPE_UNKNOWN, 0, 0) == 0 )
      return 0;
   }
@@ -395,5 +395,5 @@
  if ( list != NULL ) {
   for (i = 0; list[i].server != NULL; i++) {
-   if ( _connect_server(con, list[i].server, -1, 0, 0) == 0 ) {
+   if ( _connect_server(con, list[i].server, ROAR_SOCKET_TYPE_UNKNOWN, 0, 0) == 0 ) {
     roar_enum_servers_free(list);
     return 0;
@@ -408,5 +408,5 @@
  } else {
   /* connect via (char*)server */
-  if ( _connect_server(con, server, -1, flags, timeout) != 0 )
+  if ( _connect_server(con, server, ROAR_SOCKET_TYPE_UNKNOWN, flags, timeout) != 0 )
    return -1;
   return 0;
Index: libroar/socket.c
===================================================================
--- libroar/socket.c	(revision 5373)
+++ libroar/socket.c	(revision 5375)
@@ -40,4 +40,17 @@
 #define MODE_CONNECT ROAR_SOCKET_MODE_CONNECT
 
+static int roar_socket_open_file  (int mode, const char * host, int port);
+static int roar_socket_open_proxy (int mode, int type, const char * host, int port, const char * proxy_type);
+
+static int roar_socket_open_socks4 (int mode, int fh, const char * host, int port, const char * user, const char * pw, const char * opts);
+static int roar_socket_open_socks4a(int mode, int fh, const char * host, int port, const char * user, const char * pw, const char * opts);
+static int roar_socket_open_socks4d(int mode, int fh, const char * host, int port, const char * user, const char * pw, const char * opts);
+static int roar_socket_open_socks4x(int mode, int fh, char host[4], int port, const char * app, size_t app_len, const char * user);
+
+static int roar_socket_open_http   (int mode, int fh, const char * host, int port, const char * user, const char * pw, const char * opts);
+
+static int roar_socket_open_ssh    (int mode, int fh, const char * host, int port, const char * user, const char * pw, const char * opts);
+
+
 #ifdef ROAR_TARGET_WIN32
 void roar_socket_win32_init (void) {
@@ -54,5 +67,5 @@
 #endif
 
-int roar_socket_decnet_set_timeout (int fh, time_t sec, int usec) {
+int roar_socket_decnet_set_timeout (int fh, time_t sec, int_least32_t usec) {
 #ifdef ROAR_HAVE_LIBDNET
  struct timeval timeout = {sec, usec};
@@ -64,15 +77,5 @@
 }
 
-int roar_socket_recvbuf(int fh, int len) {
-#ifdef ROAR_HAVE_BSDSOCKETS
- if ( len < 256 ) len = 256;
-
- return setsockopt(fh, SOL_SOCKET, SO_RCVBUF, (void *)&len, sizeof(len));
-#else
- return -1;
-#endif
-}
-
-int roar_socket_set_tos(int fh) {
+static int roar_socket_set_tos(int fh) {
 #if defined(ROAR_HAVE_BSDSOCKETS) && !defined(ROAR_TARGET_WIN32)
  int opt = IPTOS_LOWDELAY;
@@ -86,4 +89,5 @@
  return ret;
 #else
+ roar_err_set(ROAR_ERROR_NOSYS);
  return -1;
 #endif
@@ -387,5 +391,5 @@
 }
 
-int roar_socket_connect (const char * host, int port) {
+int roar_socket_connect (int type, const char * host, int port) {
  char * proxy_type = getenv("ROAR_PROXY");
 
@@ -393,8 +397,8 @@
 
  if ( proxy_type == NULL || strcmp(proxy_type, "") == 0 ) {
-  return roar_socket_open(MODE_CONNECT, ROAR_SOCKET_TYPE_UNKNOWN, host, port);
+  return roar_socket_open(MODE_CONNECT, type, host, port);
  } else {
 #ifdef ROAR_SUPPORT_PROXY
-  return roar_socket_open_proxy(MODE_CONNECT, ROAR_SOCKET_TYPE_UNKNOWN, host, port, proxy_type);
+  return roar_socket_open_proxy(MODE_CONNECT, type, host, port, proxy_type);
 #else
   ROAR_ERR("roar_socket_connect(host='%s', port=%i): no support for proxy code (proxy_type=%s)", host, port, proxy_type);
@@ -820,5 +824,5 @@
 }
 
-int roar_socket_open_file  (int mode, const char * host, int port) {
+static int roar_socket_open_file  (int mode, const char * host, int port) {
 #ifdef ROAR_HAVE_IO_POSIX
  int fh;
@@ -848,5 +852,5 @@
 
 #ifdef ROAR_SUPPORT_PROXY
-int roar_socket_open_proxy (int mode, int type, const char * host, int port, const char * proxy_type) {
+static int roar_socket_open_proxy (int mode, int type, const char * host, int port, const char * proxy_type) {
  int    proxy_port = -1;
  char   proxy_host[ROAR_SOCKET_MAX_HOSTNAMELEN];
@@ -975,5 +979,5 @@
 // protocoll dependet proxy code:
 
-int roar_socket_open_socks4 (int mode, int fh, const char * host, int port, const char * user, const char * pw, const char * opts) {
+static int roar_socket_open_socks4 (int mode, int fh, const char * host, int port, const char * user, const char * pw, const char * opts) {
 #ifndef ROAR_TARGET_MICROCONTROLLER
  struct hostent     * he;
@@ -990,9 +994,9 @@
 }
 
-int roar_socket_open_socks4a(int mode, int fh, const char * host, int port, const char * user, const char * pw, const char * opts) {
+static int roar_socket_open_socks4a(int mode, int fh, const char * host, int port, const char * user, const char * pw, const char * opts) {
  return roar_socket_open_socks4x(mode, fh, "\0\0\0\1", port, host, strlen(host)+1, user);
 }
 
-int roar_socket_open_socks4d(int mode, int fh, const char * host, int port, const char * user, const char * pw, const char * opts) {
+static int roar_socket_open_socks4d(int mode, int fh, const char * host, int port, const char * user, const char * pw, const char * opts) {
  size_t len = strlen(host)+1;
  char * dp;
@@ -1010,5 +1014,5 @@
 }
 
-int roar_socket_open_socks4x(int mode, int fh, char host[4], int port, const char * app, size_t app_len, const char * user) {
+static int roar_socket_open_socks4x(int mode, int fh, char host[4], int port, const char * app, size_t app_len, const char * user) {
  char buf[9];
  int len;
@@ -1048,5 +1052,5 @@
 }
 
-int roar_socket_open_http   (int mode, int fh, const char * host, int port, const char * user, const char * pw, const char * opts) {
+static int roar_socket_open_http   (int mode, int fh, const char * host, int port, const char * user, const char * pw, const char * opts) {
  char buf[1024];
  int len;
@@ -1081,5 +1085,5 @@
 
 #ifdef ROAR_HAVE_BIN_SSH
-int roar_socket_open_ssh    (int mode, int fh, const char * host, int port, const char * user, const char * pw, const char * opts) {
+static int roar_socket_open_ssh    (int mode, int fh, const char * host, int port, const char * user, const char * pw, const char * opts) {
  char * proxy_addr = getenv("ssh_proxy");
  char * sep;
Index: libroar/vio.c
===================================================================
--- libroar/vio.c	(revision 5278)
+++ libroar/vio.c	(revision 5375)
@@ -346,5 +346,5 @@
  }
 
- if ( (fh = roar_socket_connect(host, port)) == -1 )
+ if ( (fh = roar_socket_connect(ROAR_SOCKET_TYPE_UNKNOWN, host, port)) == -1 )
   return -1;
 
Index: roarclients/roarradio.c
===================================================================
--- roarclients/roarradio.c	(revision 5238)
+++ roarclients/roarradio.c	(revision 5375)
@@ -125,5 +125,5 @@
     file = "/";
 
-    if ( (in = roar_socket_connect(host, port)) == -1 ) {
+    if ( (in = roar_socket_connect(ROAR_SOCKET_TYPE_UNKNOWN, host, port)) == -1 ) {
      ROAR_ERR("can not connect to remote server %s (port %i): %s", host, port, strerror(errno));
      return 0;
@@ -132,5 +132,5 @@
     *file = 0;
 
-    if ( (in = roar_socket_connect(host, port)) == -1 ) {
+    if ( (in = roar_socket_connect(ROAR_SOCKET_TYPE_UNKNOWN, host, port)) == -1 ) {
      ROAR_ERR("can not connect to remote server %s (port %i): %s", host, port, strerror(errno));
      return 0;
Index: roarclients/roarsockconnect.c
===================================================================
--- roarclients/roarsockconnect.c	(revision 4708)
+++ roarclients/roarsockconnect.c	(revision 5375)
@@ -45,5 +45,5 @@
  port     = atoi(argv[2]);
 
- if ( (fh = roar_socket_connect(argv[1], port)) == -1 ) {
+ if ( (fh = roar_socket_connect(ROAR_SOCKET_TYPE_UNKNOWN, argv[1], port)) == -1 ) {
   ROAR_ERR("Error: can not connect!");
   return 1;
Index: roard/roard.c
===================================================================
--- roard/roard.c	(revision 5350)
+++ roard/roard.c	(revision 5375)
@@ -855,5 +855,5 @@
      unsetenv("ROAR_PROXY");
     }
-    if ( (sock = roar_socket_connect(addr, port)) != -1 ) {
+    if ( (sock = roar_socket_connect(ROAR_SOCKET_TYPE_UNKNOWN, addr, port)) != -1 ) {
      close(sock);
      ROAR_ERR("Can not open listen socket: Socket allready in use");
