Changeset 5640:00dd1147ce70 in roaraudio for roard


Ignore:
Timestamp:
09/10/12 16:18:22 (7 years ago)
Author:
phi
Branch:
default
Message:

Removed support for roard's proto support (replaced by CPI) (Closes: #278)

Location:
roard
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • roard/clients.c

    r5608 r5640  
    3333struct roar_client_server * g_clients[ROAR_CLIENTS_MAX]; 
    3434 
     35static struct roar_dl_proto 
     36__proto_common_esd = { 
     37 .proto = ROAR_PROTO_ESOUND, 
     38 .description = "EsounD emulation", 
     39 .flags = ROAR_DL_PROTO_FLAGS_NONE, 
     40 .handle = emul_esd_check_client 
     41}, __proto_common_rplay = { 
     42 .proto = ROAR_PROTO_RPLAY, 
     43 .description = "RPlay emulation", 
     44 .flags = ROAR_DL_PROTO_FLAGS_NONE, 
     45 .handle = emul_rplay_check_client 
     46}, __proto_common_gopher = { 
     47 .proto = ROAR_PROTO_GOPHER, 
     48 .description = "The Internet Gopher Protocol", 
     49 .flags = ROAR_DL_PROTO_FLAGS_NONE, 
     50 .handle = emul_gopher_check_client, 
     51 .flushed = emul_gopher_flushed_client 
     52}; 
     53 
    3554static struct roard_proto_handle __protos[MAX_PROTOS] = { 
    3655 {.proto = ROAR_PROTO_ROARAUDIO, .lhandle = NULL, .type = ROARD_PROTO_TYPE_BUILDIN, 
    3756 .impl = {.buildin = 0}}, 
    3857#if !defined(ROAR_WITHOUT_DCOMP_EMUL_ESD) && defined(ROAR_HAVE_H_ESD) 
    39  {.proto = ROAR_PROTO_ESOUND, .lhandle = NULL, .type = ROARD_PROTO_TYPE_ROARDPROTO, 
    40  .impl = {.roardproto = {ROAR_PROTO_ESOUND, ROAR_SUBSYS_WAVEFORM, "EsounD emulation", NULL, NULL, NULL, emul_esd_check_client, NULL, NULL}}}, 
     58 {.proto = ROAR_PROTO_ESOUND, .lhandle = NULL, .type = ROARD_PROTO_TYPE_COMMON, 
     59 .impl = {.common = &__proto_common_esd}}, 
    4160#endif 
    4261#ifndef ROAR_WITHOUT_DCOMP_EMUL_RPLAY 
    43  {.proto = ROAR_PROTO_RPLAY, .lhandle = NULL, .type = ROARD_PROTO_TYPE_ROARDPROTO, 
    44  .impl = {.roardproto = {ROAR_PROTO_RPLAY, ROAR_SUBSYS_WAVEFORM, "RPlay emulation", NULL, NULL, NULL, emul_rplay_check_client, NULL, NULL}}}, 
     62 {.proto = ROAR_PROTO_RPLAY, .lhandle = NULL, .type = ROARD_PROTO_TYPE_COMMON, 
     63 .impl = {.common = &__proto_common_rplay}}, 
    4564#endif 
    4665#ifndef ROAR_WITHOUT_DCOMP_EMUL_GOPHER 
    47  {.proto = ROAR_PROTO_GOPHER, .lhandle = NULL, .type = ROARD_PROTO_TYPE_ROARDPROTO, 
    48  .impl = {.roardproto = {ROAR_PROTO_GOPHER, ROAR_SUBSYS_WAVEFORM, "The Internet Gopher Protocol", NULL, NULL, NULL, emul_gopher_check_client, NULL, 
    49  emul_gopher_flushed_client}}}, 
     66 {.proto = ROAR_PROTO_GOPHER, .lhandle = NULL, .type = ROARD_PROTO_TYPE_COMMON, 
     67 .impl = {.common = &__proto_common_gopher}}, 
    5068#endif 
    5169 {.proto = -1} 
     
    276294        ROAR_WARN("net_get_new_client(lsock=%p): proto(%i) marked as buildin but isn't. BAD.", lsock, proto); 
    277295        supported = 0; 
    278        break; 
    279       case ROARD_PROTO_TYPE_ROARDPROTO: 
    280         supported = 1; 
    281         if ( protohandle->impl.roardproto.new_client != NULL ) { 
    282          if ( protohandle->impl.roardproto.new_client(client, &vio, lsock) == -1 ) { 
    283           supported = 0; 
    284          } 
    285         } 
    286296       break; 
    287297      case ROARD_PROTO_TYPE_COMMON: 
     
    334344   case ROARD_PROTO_TYPE_BUILDIN: 
    335345     /* noop */ 
    336     break; 
    337    case ROARD_PROTO_TYPE_ROARDPROTO: 
    338      if ( proto->impl.roardproto.delete_client != NULL ) 
    339       proto->impl.roardproto.delete_client(id); 
    340346    break; 
    341347   case ROARD_PROTO_TYPE_COMMON: 
     
    854860        ROAR_WARN("clients_check(id=%i): proto(%i) marked as buildin but isn't. BAD.", id, proto->proto); 
    855861       break; 
    856       case ROARD_PROTO_TYPE_ROARDPROTO: 
    857         if ( proto->impl.roardproto.check_client != NULL ) 
    858          rv = proto->impl.roardproto.check_client(id, &vio); 
    859        break; 
    860862      case ROARD_PROTO_TYPE_COMMON: 
    861863        if ( proto->impl.common->handle != NULL ) { 
     
    907909  case ROARD_PROTO_TYPE_BUILDIN: 
    908910    /* noop */ 
    909    break; 
    910   case ROARD_PROTO_TYPE_ROARDPROTO: 
    911     if ( p->impl.roardproto.flush_client != NULL ) { 
    912      if ( p->lhandle != NULL ) 
    913       roar_dl_context_restore(p->lhandle); 
    914      rv = p->impl.roardproto.flush_client(id, &vio); 
    915      if ( p->lhandle != NULL ) 
    916       roar_dl_context_store(p->lhandle); 
    917      return rv; 
    918     } 
    919911   break; 
    920912  case ROARD_PROTO_TYPE_COMMON: 
     
    964956   case ROARD_PROTO_TYPE_BUILDIN: 
    965957     /* noop */ 
    966     break; 
    967    case ROARD_PROTO_TYPE_ROARDPROTO: 
    968      if ( p->impl.roardproto.flushed_client != NULL ) { 
    969       if ( p->lhandle != NULL ) 
    970        roar_dl_context_restore(p->lhandle); 
    971       rv = p->impl.roardproto.flushed_client(id, &vio); 
    972       if ( p->lhandle != NULL ) 
    973        roar_dl_context_store(p->lhandle); 
    974       return rv; 
    975      } 
    976958    break; 
    977959   case ROARD_PROTO_TYPE_COMMON: 
     
    11021084} 
    11031085 
    1104 int clients_register_proto(struct roard_proto * proto, struct roar_dl_lhandle * lhandle) { 
    1105  const size_t len = sizeof(__protos)/sizeof(*__protos); 
    1106  size_t i; 
    1107  
    1108  if ( proto == NULL ) 
    1109   return -1; 
    1110  
    1111  for (i = 0; __protos[i].proto != -1; i++); 
    1112  
    1113  // i is now at pos of current EOS entry. 
    1114  
    1115  // test if we have space for one more entry: 
    1116  if ( (i+1) >= len ) 
    1117   return -1; 
    1118  
    1119  memcpy(&(__protos[i].impl.roardproto), proto, sizeof(__protos[i].impl.roardproto)); 
    1120  
    1121  __protos[i].impl.roardproto.lhandle = lhandle; 
    1122  
    1123  __protos[i].proto   = proto->proto; 
    1124  __protos[i].type    = ROARD_PROTO_TYPE_ROARDPROTO; 
    1125  __protos[i].lhandle = lhandle; 
    1126  
    1127  return 0; 
    1128 } 
    1129  
    11301086int clients_register_proto_common(const struct roar_dl_proto * proto, struct roar_dl_lhandle * lhandle) { 
    11311087 const size_t len = sizeof(__protos)/sizeof(*__protos); 
     
    12361192   case ROARD_PROTO_TYPE_BUILDIN: 
    12371193     continue; 
    1238     break; 
    1239    case ROARD_PROTO_TYPE_ROARDPROTO: 
    1240      flags[1] = 'R'; 
    1241  
    1242      if ( p->impl.roardproto.subsystems & ROAR_SUBSYS_WAVEFORM ) 
    1243       subsys[0] = 'W'; 
    1244      if ( p->impl.roardproto.subsystems & ROAR_SUBSYS_MIDI ) 
    1245       subsys[1] = 'M'; 
    1246      if ( p->impl.roardproto.subsystems & ROAR_SUBSYS_CB ) 
    1247       subsys[2] = 'C'; 
    1248      if ( p->impl.roardproto.subsystems & ROAR_SUBSYS_LIGHT ) 
    1249       subsys[3] = 'L'; 
    1250      if ( p->impl.roardproto.subsystems & ROAR_SUBSYS_RAW ) 
    1251       subsys[4] = 'R'; 
    1252      if ( p->impl.roardproto.subsystems & ROAR_SUBSYS_COMPLEX ) 
    1253       subsys[5] = 'X'; 
    1254  
    1255      description = p->impl.roardproto.description; 
    12561194    break; 
    12571195   case ROARD_PROTO_TYPE_COMMON: 
  • roard/include/client.h

    r5607 r5640  
    8989enum roard_proto_type { 
    9090 ROARD_PROTO_TYPE_BUILDIN = 0, 
    91  ROARD_PROTO_TYPE_ROARDPROTO = 1, 
     91// ROARD_PROTO_TYPE_ROARDPROTO = 1, // old. Removed in 1.0beta6. 
    9292 ROARD_PROTO_TYPE_COMMON = 2 
    9393}; 
     
    101101 union { 
    102102  int buildin; // dummy 
    103   struct roard_proto roardproto; 
    104   // add common here when ready. 
    105103  const struct roar_dl_proto * common; 
    106104 } impl; 
     
    143141const struct roard_proto_handle * clients_get_protohandle(const int proto); 
    144142int clients_register_proto_common(const struct roar_dl_proto * proto, struct roar_dl_lhandle * lhandle); 
    145 int clients_register_proto  (struct roard_proto * proto, struct roar_dl_lhandle * lhandle); 
    146143int clients_unregister_proto(int proto); 
    147144void print_protolist        (enum output_format format); 
  • roard/include/emul_esd.h.OLD

    r5381 r5640  
    4848 
    4949int emul_esd_exec_command  (int client, int cmd, struct roar_vio_calls * vio); 
    50 int emul_esd_check_client  (int client, struct roar_vio_calls * vio); 
     50int 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); 
    5151 
    5252int emul_esd_int_read_buf  (int client, int * data, void * buf); 
  • roard/include/emul_gopher.h.OLD

    r5381 r5640  
    2929#include <roaraudio.h> 
    3030 
    31 int emul_gopher_check_client(int client, struct roar_vio_calls * vio); 
    32 int emul_gopher_flushed_client(int client, struct roar_vio_calls * vio); 
     31int 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); 
     32int 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); 
    3333 
    3434#endif 
  • roard/include/emul_rplay.h.OLD

    r5381 r5640  
    3939}; 
    4040 
    41 int emul_rplay_check_client  (int client, struct roar_vio_calls * vio); 
     41int 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); 
    4242 
    4343int emul_rplay_exec_command  (int client, struct roar_vio_calls * vio, char * command); 
  • roard/include/plugins.h

    r5639 r5640  
    4141void print_pluginlist(enum output_format format); 
    4242 
    43 int plugins_reg_proto(struct roard_proto         * proto); 
    44  
    45 #define ROARD_DL_REG__UNI_PRE(name) \ 
    46  static int __reg_ ## name(struct roar_dl_librarypara * para, struct roar_dl_libraryinst * lib) { \ 
    47   size_t i; \ 
    48  \ 
    49   (void)para, (void)lib; 
    50  
    51 #define ROARD_DL_REG__UNI_POST \ 
    52  \ 
    53   return 0; \ 
    54  } 
    55  
    56 #define ROARD_DL_REG_PROTO(proto) \ 
    57  ROARD_DL_REG__UNI_PRE(proto) \ 
    58   for (i = 0; i < (sizeof((proto))/sizeof(*(proto))); i++) \ 
    59    plugins_reg_proto(&((proto)[i])); \ 
    60  ROARD_DL_REG__UNI_POST 
    61  
    62 // Register Protocol callbacks: 
    63 #define ROARD_DL_REGFN_PROTO() ROAR_DL_PLUGIN_REG(ROAR_DL_FN_PROTO, __reg_proto) 
    64  
    6543// Check version: 
    6644#define ROARD_DL_CHECK_VERSIONS() ROAR_DL_PLUGIN_CHECK_VERSIONS(ROARD_DL_APPNAME, ROARD_DL_ABIVERSION) 
  • roard/plugins.c

    r5639 r5640  
    3030static struct _roard_plugin { 
    3131 struct roar_dl_lhandle     * lhandle; 
    32  int protocols[MAX_PROTOS]; 
    3332} g_plugins[MAX_PLUGINS]; 
    3433static struct _roard_plugin * _pp = NULL; 
     
    7675 
    7776static inline void plugins_delete(struct _roard_plugin * plugin) { 
    78  int i; 
    79  
    8077 ROAR_DBG("plugins_delete(plugin=%p) = ?", plugin); 
    8178 
    8279 roar_dl_appsched_trigger(plugin->lhandle, ROAR_DL_APPSCHED_FREE); 
    83  
    84  for (i = 0; i < MAX_PROTOS; i++) { 
    85   if ( plugin->protocols[i] != -1 ) { 
    86    clients_unregister_proto(plugin->protocols[i]); 
    87   } 
    88  } 
    8980 
    9081 roar_dl_close(plugin->lhandle); 
     
    179170 struct _roard_plugin * next = _find_free(); 
    180171 struct roar_dl_librarypara * para; 
    181  int i; 
    182172 
    183173 ROAR_DBG("plugins_load(filename=\"%s\", args=\"%s\") = ?", filename, args); 
     
    185175 if ( next == NULL ) 
    186176  return -1; 
    187  
    188  for (i = 0; i < MAX_PLUGINS; i++) 
    189   next->protocols[i] = -1; 
    190177 
    191178 if ( (para = roar_dl_para_new(args, NULL, ROARD_DL_APPNAME, ROARD_DL_ABIVERSION)) == NULL ) { 
     
    244231} 
    245232 
    246 int plugins_reg_proto(struct roard_proto         * proto) { 
    247  int i; 
    248  
    249  if ( _pp == NULL ) 
    250   return -1; 
    251  
    252  for (i = 0; i < MAX_PROTOS; i++) { 
    253   if ( _pp->protocols[i] == -1 ) { 
    254    _pp->protocols[i] = proto->proto; 
    255    break; 
    256   } 
    257  } 
    258  
    259  if ( i == MAX_PROTOS ) { 
    260   roar_err_set(ROAR_ERROR_NOMEM); 
    261   return -1; 
    262  } 
    263  
    264  return clients_register_proto(proto, _pp->lhandle); 
    265 } 
    266  
    267233static 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) { 
    268234 
Note: See TracChangeset for help on using the changeset viewer.