Index: roard/clients.c
===================================================================
--- roard/clients.c	(revision 5608)
+++ roard/clients.c	(revision 5640)
@@ -33,19 +33,37 @@
 struct roar_client_server * g_clients[ROAR_CLIENTS_MAX];
 
+static struct roar_dl_proto
+__proto_common_esd = {
+ .proto = ROAR_PROTO_ESOUND,
+ .description = "EsounD emulation",
+ .flags = ROAR_DL_PROTO_FLAGS_NONE,
+ .handle = emul_esd_check_client
+}, __proto_common_rplay = {
+ .proto = ROAR_PROTO_RPLAY,
+ .description = "RPlay emulation",
+ .flags = ROAR_DL_PROTO_FLAGS_NONE,
+ .handle = emul_rplay_check_client
+}, __proto_common_gopher = {
+ .proto = ROAR_PROTO_GOPHER,
+ .description = "The Internet Gopher Protocol",
+ .flags = ROAR_DL_PROTO_FLAGS_NONE,
+ .handle = emul_gopher_check_client,
+ .flushed = emul_gopher_flushed_client
+};
+
 static struct roard_proto_handle __protos[MAX_PROTOS] = {
  {.proto = ROAR_PROTO_ROARAUDIO, .lhandle = NULL, .type = ROARD_PROTO_TYPE_BUILDIN,
  .impl = {.buildin = 0}},
 #if !defined(ROAR_WITHOUT_DCOMP_EMUL_ESD) && defined(ROAR_HAVE_H_ESD)
- {.proto = ROAR_PROTO_ESOUND, .lhandle = NULL, .type = ROARD_PROTO_TYPE_ROARDPROTO,
- .impl = {.roardproto = {ROAR_PROTO_ESOUND, ROAR_SUBSYS_WAVEFORM, "EsounD emulation", NULL, NULL, NULL, emul_esd_check_client, NULL, NULL}}},
+ {.proto = ROAR_PROTO_ESOUND, .lhandle = NULL, .type = ROARD_PROTO_TYPE_COMMON,
+ .impl = {.common = &__proto_common_esd}},
 #endif
 #ifndef ROAR_WITHOUT_DCOMP_EMUL_RPLAY
- {.proto = ROAR_PROTO_RPLAY, .lhandle = NULL, .type = ROARD_PROTO_TYPE_ROARDPROTO,
- .impl = {.roardproto = {ROAR_PROTO_RPLAY, ROAR_SUBSYS_WAVEFORM, "RPlay emulation", NULL, NULL, NULL, emul_rplay_check_client, NULL, NULL}}},
+ {.proto = ROAR_PROTO_RPLAY, .lhandle = NULL, .type = ROARD_PROTO_TYPE_COMMON,
+ .impl = {.common = &__proto_common_rplay}},
 #endif
 #ifndef ROAR_WITHOUT_DCOMP_EMUL_GOPHER
- {.proto = ROAR_PROTO_GOPHER, .lhandle = NULL, .type = ROARD_PROTO_TYPE_ROARDPROTO,
- .impl = {.roardproto = {ROAR_PROTO_GOPHER, ROAR_SUBSYS_WAVEFORM, "The Internet Gopher Protocol", NULL, NULL, NULL, emul_gopher_check_client, NULL,
- emul_gopher_flushed_client}}},
+ {.proto = ROAR_PROTO_GOPHER, .lhandle = NULL, .type = ROARD_PROTO_TYPE_COMMON,
+ .impl = {.common = &__proto_common_gopher}},
 #endif
  {.proto = -1}
@@ -276,12 +294,4 @@
         ROAR_WARN("net_get_new_client(lsock=%p): proto(%i) marked as buildin but isn't. BAD.", lsock, proto);
         supported = 0;
-       break;
-      case ROARD_PROTO_TYPE_ROARDPROTO:
-        supported = 1;
-        if ( protohandle->impl.roardproto.new_client != NULL ) {
-         if ( protohandle->impl.roardproto.new_client(client, &vio, lsock) == -1 ) {
-          supported = 0;
-         }
-        }
        break;
       case ROARD_PROTO_TYPE_COMMON:
@@ -334,8 +344,4 @@
    case ROARD_PROTO_TYPE_BUILDIN:
      /* noop */
-    break;
-   case ROARD_PROTO_TYPE_ROARDPROTO:
-     if ( proto->impl.roardproto.delete_client != NULL )
-      proto->impl.roardproto.delete_client(id);
     break;
    case ROARD_PROTO_TYPE_COMMON:
@@ -854,8 +860,4 @@
         ROAR_WARN("clients_check(id=%i): proto(%i) marked as buildin but isn't. BAD.", id, proto->proto);
        break;
-      case ROARD_PROTO_TYPE_ROARDPROTO:
-        if ( proto->impl.roardproto.check_client != NULL )
-         rv = proto->impl.roardproto.check_client(id, &vio);
-       break;
       case ROARD_PROTO_TYPE_COMMON:
         if ( proto->impl.common->handle != NULL ) {
@@ -907,14 +909,4 @@
   case ROARD_PROTO_TYPE_BUILDIN:
     /* noop */
-   break;
-  case ROARD_PROTO_TYPE_ROARDPROTO:
-    if ( p->impl.roardproto.flush_client != NULL ) {
-     if ( p->lhandle != NULL )
-      roar_dl_context_restore(p->lhandle);
-     rv = p->impl.roardproto.flush_client(id, &vio);
-     if ( p->lhandle != NULL )
-      roar_dl_context_store(p->lhandle);
-     return rv;
-    }
    break;
   case ROARD_PROTO_TYPE_COMMON:
@@ -964,14 +956,4 @@
    case ROARD_PROTO_TYPE_BUILDIN:
      /* noop */
-    break;
-   case ROARD_PROTO_TYPE_ROARDPROTO:
-     if ( p->impl.roardproto.flushed_client != NULL ) {
-      if ( p->lhandle != NULL )
-       roar_dl_context_restore(p->lhandle);
-      rv = p->impl.roardproto.flushed_client(id, &vio);
-      if ( p->lhandle != NULL )
-       roar_dl_context_store(p->lhandle);
-      return rv;
-     }
     break;
    case ROARD_PROTO_TYPE_COMMON:
@@ -1102,30 +1084,4 @@
 }
 
-int clients_register_proto(struct roard_proto * proto, struct roar_dl_lhandle * lhandle) {
- const size_t len = sizeof(__protos)/sizeof(*__protos);
- size_t i;
-
- if ( proto == NULL )
-  return -1;
-
- for (i = 0; __protos[i].proto != -1; i++);
-
- // i is now at pos of current EOS entry.
-
- // test if we have space for one more entry:
- if ( (i+1) >= len )
-  return -1;
-
- memcpy(&(__protos[i].impl.roardproto), proto, sizeof(__protos[i].impl.roardproto));
-
- __protos[i].impl.roardproto.lhandle = lhandle;
-
- __protos[i].proto   = proto->proto;
- __protos[i].type    = ROARD_PROTO_TYPE_ROARDPROTO;
- __protos[i].lhandle = lhandle;
-
- return 0;
-}
-
 int clients_register_proto_common(const struct roar_dl_proto * proto, struct roar_dl_lhandle * lhandle) {
  const size_t len = sizeof(__protos)/sizeof(*__protos);
@@ -1236,22 +1192,4 @@
    case ROARD_PROTO_TYPE_BUILDIN:
      continue;
-    break;
-   case ROARD_PROTO_TYPE_ROARDPROTO:
-     flags[1] = 'R';
-
-     if ( p->impl.roardproto.subsystems & ROAR_SUBSYS_WAVEFORM )
-      subsys[0] = 'W';
-     if ( p->impl.roardproto.subsystems & ROAR_SUBSYS_MIDI )
-      subsys[1] = 'M';
-     if ( p->impl.roardproto.subsystems & ROAR_SUBSYS_CB )
-      subsys[2] = 'C';
-     if ( p->impl.roardproto.subsystems & ROAR_SUBSYS_LIGHT )
-      subsys[3] = 'L';
-     if ( p->impl.roardproto.subsystems & ROAR_SUBSYS_RAW )
-      subsys[4] = 'R';
-     if ( p->impl.roardproto.subsystems & ROAR_SUBSYS_COMPLEX )
-      subsys[5] = 'X';
-
-     description = p->impl.roardproto.description;
     break;
    case ROARD_PROTO_TYPE_COMMON:
