Index: ChangeLog
===================================================================
--- ChangeLog	(revision 5639)
+++ ChangeLog	(revision 5640)
@@ -7,4 +7,6 @@
 	* Disabled building with libFLAC when using --without-beta (See: #306)
 	* Removed roard's sched support (Closes: #277)
+	* Removed support for roard's proto support
+	  (replaced by CPI) (Closes: #278)
 
 v. 1.0beta5 - Mon Aug 20 2012 23:52 CEST
Index: plugins/roard/protocol-esound.c
===================================================================
--- plugins/roard/protocol-esound.c	(revision 5381)
+++ plugins/roard/protocol-esound.c	(revision 5640)
@@ -132,5 +132,5 @@
 }
 
-int emul_esd_check_client(int client, struct roar_vio_calls * vio) {
+int emul_esd_check_client(int client, struct roar_vio_calls * vio, struct roar_buffer ** obuffer, void ** userdata, const struct roar_keyval * protopara, ssize_t protoparalen, struct roar_dl_librarypara * pluginpara) {
  struct roar_vio_calls calls;
  _cmd_t cmd;
Index: plugins/roard/protocol-gopher.c
===================================================================
--- plugins/roard/protocol-gopher.c	(revision 5602)
+++ plugins/roard/protocol-gopher.c	(revision 5640)
@@ -631,5 +631,5 @@
 }
 
-int emul_gopher_check_client(int client, struct roar_vio_calls * vio) {
+int emul_gopher_check_client(int client, struct roar_vio_calls * vio, struct roar_buffer ** obuffer, void ** userdata, const struct roar_keyval * protopara, ssize_t protoparalen, struct roar_dl_librarypara * pluginpara) {
  struct roar_client_server * cs;
  struct roar_vio_calls     rvio;
@@ -762,5 +762,5 @@
 }
 
-int emul_gopher_flushed_client(int client, struct roar_vio_calls * vio) {
+int emul_gopher_flushed_client(int client, struct roar_vio_calls * vio, struct roar_buffer ** obuffer, void ** userdata, const struct roar_keyval * protopara, ssize_t protoparalen, struct roar_dl_librarypara * pluginpara) {
  ROAR_DBG("emul_gopher_flushed_client(client=%i, vio=%p) = ?", client, vio);
 
Index: plugins/roard/protocol-rplay.c
===================================================================
--- plugins/roard/protocol-rplay.c	(revision 5381)
+++ plugins/roard/protocol-rplay.c	(revision 5640)
@@ -111,5 +111,5 @@
 }
 
-int emul_rplay_check_client  (int client, struct roar_vio_calls * vio) {
+int emul_rplay_check_client  (int client, struct roar_vio_calls * vio, struct roar_buffer ** obuffer, void ** userdata, const struct roar_keyval * protopara, ssize_t protoparalen, struct roar_dl_librarypara * pluginpara) {
  struct roar_vio_calls calls;
  char buf[1024];
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:
Index: roard/include/client.h
===================================================================
--- roard/include/client.h	(revision 5607)
+++ roard/include/client.h	(revision 5640)
@@ -89,5 +89,5 @@
 enum roard_proto_type {
  ROARD_PROTO_TYPE_BUILDIN = 0,
- ROARD_PROTO_TYPE_ROARDPROTO = 1,
+// ROARD_PROTO_TYPE_ROARDPROTO = 1, // old. Removed in 1.0beta6.
  ROARD_PROTO_TYPE_COMMON = 2
 };
@@ -101,6 +101,4 @@
  union {
   int buildin; // dummy
-  struct roard_proto roardproto;
-  // add common here when ready.
   const struct roar_dl_proto * common;
  } impl;
@@ -143,5 +141,4 @@
 const struct roard_proto_handle * clients_get_protohandle(const int proto);
 int clients_register_proto_common(const struct roar_dl_proto * proto, struct roar_dl_lhandle * lhandle);
-int clients_register_proto  (struct roard_proto * proto, struct roar_dl_lhandle * lhandle);
 int clients_unregister_proto(int proto);
 void print_protolist        (enum output_format format);
Index: roard/include/emul_esd.h.OLD
===================================================================
--- roard/include/emul_esd.h.OLD	(revision 5381)
+++ roard/include/emul_esd.h.OLD	(revision 5640)
@@ -48,5 +48,5 @@
 
 int emul_esd_exec_command  (int client, int cmd, struct roar_vio_calls * vio);
-int emul_esd_check_client  (int client, struct roar_vio_calls * vio);
+int emul_esd_check_client  (int client, struct roar_vio_calls * vio, struct roar_buffer ** obuffer, void ** userdata, const struct roar_keyval * protopara, ssize_t protoparalen, struct roar_dl_librarypara * pluginpara);
 
 int emul_esd_int_read_buf  (int client, int * data, void * buf);
Index: roard/include/emul_gopher.h.OLD
===================================================================
--- roard/include/emul_gopher.h.OLD	(revision 5381)
+++ roard/include/emul_gopher.h.OLD	(revision 5640)
@@ -29,6 +29,6 @@
 #include <roaraudio.h>
 
-int emul_gopher_check_client(int client, struct roar_vio_calls * vio);
-int emul_gopher_flushed_client(int client, struct roar_vio_calls * vio);
+int emul_gopher_check_client(int client, struct roar_vio_calls * vio, struct roar_buffer ** obuffer, void ** userdata, const struct roar_keyval * protopara, ssize_t protoparalen, struct roar_dl_librarypara * pluginpara);
+int emul_gopher_flushed_client(int client, struct roar_vio_calls * vio, struct roar_buffer ** obuffer, void ** userdata, const struct roar_keyval * protopara, ssize_t protoparalen, struct roar_dl_librarypara * pluginpara);
 
 #endif
Index: roard/include/emul_rplay.h.OLD
===================================================================
--- roard/include/emul_rplay.h.OLD	(revision 5381)
+++ roard/include/emul_rplay.h.OLD	(revision 5640)
@@ -39,5 +39,5 @@
 };
 
-int emul_rplay_check_client  (int client, struct roar_vio_calls * vio);
+int emul_rplay_check_client  (int client, struct roar_vio_calls * vio, struct roar_buffer ** obuffer, void ** userdata, const struct roar_keyval * protopara, ssize_t protoparalen, struct roar_dl_librarypara * pluginpara);
 
 int emul_rplay_exec_command  (int client, struct roar_vio_calls * vio, char * command);
Index: roard/include/plugins.h
===================================================================
--- roard/include/plugins.h	(revision 5639)
+++ roard/include/plugins.h	(revision 5640)
@@ -41,26 +41,4 @@
 void print_pluginlist(enum output_format format);
 
-int plugins_reg_proto(struct roard_proto         * proto);
-
-#define ROARD_DL_REG__UNI_PRE(name) \
- static int __reg_ ## name(struct roar_dl_librarypara * para, struct roar_dl_libraryinst * lib) { \
-  size_t i; \
- \
-  (void)para, (void)lib;
-
-#define ROARD_DL_REG__UNI_POST \
- \
-  return 0; \
- }
-
-#define ROARD_DL_REG_PROTO(proto) \
- ROARD_DL_REG__UNI_PRE(proto) \
-  for (i = 0; i < (sizeof((proto))/sizeof(*(proto))); i++) \
-   plugins_reg_proto(&((proto)[i])); \
- ROARD_DL_REG__UNI_POST
-
-// Register Protocol callbacks:
-#define ROARD_DL_REGFN_PROTO() ROAR_DL_PLUGIN_REG(ROAR_DL_FN_PROTO, __reg_proto)
-
 // Check version:
 #define ROARD_DL_CHECK_VERSIONS() ROAR_DL_PLUGIN_CHECK_VERSIONS(ROARD_DL_APPNAME, ROARD_DL_ABIVERSION)
Index: roard/plugins.c
===================================================================
--- roard/plugins.c	(revision 5639)
+++ roard/plugins.c	(revision 5640)
@@ -30,5 +30,4 @@
 static struct _roard_plugin {
  struct roar_dl_lhandle     * lhandle;
- int protocols[MAX_PROTOS];
 } g_plugins[MAX_PLUGINS];
 static struct _roard_plugin * _pp = NULL;
@@ -76,15 +75,7 @@
 
 static inline void plugins_delete(struct _roard_plugin * plugin) {
- int i;
-
  ROAR_DBG("plugins_delete(plugin=%p) = ?", plugin);
 
  roar_dl_appsched_trigger(plugin->lhandle, ROAR_DL_APPSCHED_FREE);
-
- for (i = 0; i < MAX_PROTOS; i++) {
-  if ( plugin->protocols[i] != -1 ) {
-   clients_unregister_proto(plugin->protocols[i]);
-  }
- }
 
  roar_dl_close(plugin->lhandle);
@@ -179,5 +170,4 @@
  struct _roard_plugin * next = _find_free();
  struct roar_dl_librarypara * para;
- int i;
 
  ROAR_DBG("plugins_load(filename=\"%s\", args=\"%s\") = ?", filename, args);
@@ -185,7 +175,4 @@
  if ( next == NULL )
   return -1;
-
- for (i = 0; i < MAX_PLUGINS; i++)
-  next->protocols[i] = -1;
 
  if ( (para = roar_dl_para_new(args, NULL, ROARD_DL_APPNAME, ROARD_DL_ABIVERSION)) == NULL ) {
@@ -244,25 +231,4 @@
 }
 
-int plugins_reg_proto(struct roard_proto         * proto) {
- int i;
-
- if ( _pp == NULL )
-  return -1;
-
- for (i = 0; i < MAX_PROTOS; i++) {
-  if ( _pp->protocols[i] == -1 ) {
-   _pp->protocols[i] = proto->proto;
-   break;
-  }
- }
-
- if ( i == MAX_PROTOS ) {
-  roar_err_set(ROAR_ERROR_NOMEM);
-  return -1;
- }
-
- return clients_register_proto(proto, _pp->lhandle);
-}
-
 static int plugin_callback(enum roar_dl_fnreg_action action, int fn, int subtype, const void * object, size_t objectlen, int version, int options, void * userdata, struct roar_dl_lhandle * lhandle) {
 
