Changeset 5640:00dd1147ce70 in roaraudio for roard/clients.c


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

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

File:
1 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: 
Note: See TracChangeset for help on using the changeset viewer.