Changeset 5739:2a1671d592b9 in roaraudio


Ignore:
Timestamp:
11/09/12 01:09:22 (11 years ago)
Author:
phi
Branch:
default
Phase:
public
Message:

commit 0: make protocol emulations for esd, gopher and rplay more independed so they can be moved into plugins easily (See: #311)

Files:
7 edited

Legend:

Unmodified
Added
Removed
  • plugins/roard/protocol-esound.c

    r5640 r5739  
    2828#ifndef ROAR_WITHOUT_DCOMP_EMUL_ESD 
    2929#ifdef ROAR_HAVE_H_ESD 
     30#include <esd.h> 
     31 
     32 
     33struct emul_esd_command { 
     34 int    cmd; 
     35 size_t datalen; 
     36#if !defined(ROAR_TARGET_MICROCONTROLLER) && !defined(ROAR_MINIMAL) 
     37 char name[COMMAND_MAX_NAMELEN]; 
     38#else 
     39 char * name; 
     40#endif 
     41 int (*handler)(int client, struct emul_esd_command * cmd, void * data, struct roar_vio_calls * vio); 
     42}; 
     43 
     44static int emul_esd_exec_command  (int client, int cmd, struct roar_vio_calls * vio); 
     45static 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); 
     46 
     47static int emul_esd_int_read_buf  (int client, int * data, void * buf); 
     48static int emul_esd_int_read      (int client, int * data, struct roar_vio_calls * vio); 
     49static int emul_esd_int_write     (int client, int   data, struct roar_vio_calls * vio); 
     50static int emul_esd_test_auth     (int client, void * data, struct roar_vio_calls * vio); 
     51static int emul_esd_test_byteorder(int client, void * data); 
     52 
     53static int emul_esd_on_connect    (int client, struct emul_esd_command * cmd, void * data, struct roar_vio_calls * vio); 
     54static int emul_esd_on_stream     (int client, struct emul_esd_command * cmd, void * data, struct roar_vio_calls * vio); 
     55static int emul_esd_on_latency    (int client, struct emul_esd_command * cmd, void * data, struct roar_vio_calls * vio); 
     56static int emul_esd_on_standby    (int client, struct emul_esd_command * cmd, void * data, struct roar_vio_calls * vio); 
     57static int emul_esd_on_standbymode(int client, struct emul_esd_command * cmd, void * data, struct roar_vio_calls * vio); 
     58 
     59static int emul_esd_on_stream_pan (int client, struct emul_esd_command * cmd, void * data, struct roar_vio_calls * vio); 
     60 
     61static int emul_esd_on_server_info(int client, struct emul_esd_command * cmd, void * data, struct roar_vio_calls * vio); 
     62 
     63static int emul_esd_on_all_info   (int client, struct emul_esd_command * cmd, void * data, struct roar_vio_calls * vio); 
     64 
     65 
    3066 
    3167#if !defined(ROAR_TARGET_MICROCONTROLLER) && !defined(ROAR_MINIMAL) 
     
    4581#define _ESD2ROAR(x) ((x)-1) 
    4682 
    47 struct emul_esd_command g_emul_esd_commands[] = { 
     83static struct emul_esd_command g_emul_esd_commands[] = { 
    4884 {ESD_PROTO_CONNECT,      ESD_KEY_LEN  +     _INTSIZE, _NAME("CONNECT"),      emul_esd_on_connect}, 
    4985 {ESD_PROTO_LOCK,         ESD_KEY_LEN  +     _INTSIZE, _NAME("LOCK"),         NULL}, 
     
    75111 
    76112// command handling: 
    77 int emul_esd_exec_command(int client, int cmd, struct roar_vio_calls * vio) { 
     113static int emul_esd_exec_command(int client, int cmd, struct roar_vio_calls * vio) { 
    78114 struct emul_esd_command * cur; 
    79115 void * data = NULL; 
     
    95131    if ( (data = roar_mm_malloc(cur->datalen)) == NULL ) { 
    96132     // we will do a protocol error in case we do not drop the client 
    97      clients_delete(client); 
    98133     return -1; 
    99134    } 
     
    104139     if ( ret < 1 ) { 
    105140      roar_mm_free(data); 
    106       clients_delete(client); 
    107141      return -1; 
    108142     } else { 
     
    116150               client, cur->name, cmd, vio 
    117151             ); 
    118     clients_delete(client); 
    119152    r = -1; 
    120153   } else { 
     
    132165} 
    133166 
    134 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) { 
    135  struct roar_vio_calls calls; 
     167static int emul_esd_set_proto(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) { 
     168 if ( emul_esd_exec_command(client, ESD_PROTO_CONNECT, vio) == -1 ) 
     169  return -1; 
     170 
     171 return 0; 
     172} 
     173 
     174static 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) { 
    136175 _cmd_t cmd; 
    137176 
    138177 if ( client == -1 ) 
    139178  return -1; 
    140  
    141  if ( vio == NULL ) { 
    142   vio = &calls; 
    143   if ( roar_vio_open_fh_socket(vio, clients_get_fh(client)) == -1 ) 
    144    return -1; 
    145  } 
    146179 
    147180 if ( roar_vio_read(vio, &cmd, _INTSIZE) != _INTSIZE ) { 
    148181  // really bad protocol error 
    149   clients_delete(client); 
    150182  return -1; 
    151183 } 
     
    167199 return 0; 
    168200} 
    169 int emul_esd_int_read      (int client, int * data, struct roar_vio_calls * vio) { 
     201static int emul_esd_int_read      (int client, int * data, struct roar_vio_calls * vio) { 
    170202 _cmd_t d; 
    171203 
     
    181213} 
    182214 
    183 int emul_esd_int_write     (int client, int   data, struct roar_vio_calls * vio) { 
     215static int emul_esd_int_write     (int client, int   data, struct roar_vio_calls * vio) { 
    184216 _cmd_t d = data; 
    185217 
     
    187219} 
    188220 
    189 int emul_esd_test_auth     (int client, void * data, struct roar_vio_calls * vio) { 
     221static int emul_esd_test_auth     (int client, void * data, struct roar_vio_calls * vio) { 
    190222 // accept all clients for the moment. 
    191223 return emul_esd_int_write(client, 1, vio); 
    192224} 
    193225 
    194 int emul_esd_test_byteorder(int client, void * data) { 
     226static int emul_esd_test_byteorder(int client, void * data) { 
    195227 struct roar_client * c; 
    196228 
     
    214246 
    215247// handler: 
    216 int emul_esd_on_connect    (int client, struct emul_esd_command * cmd, void * data, struct roar_vio_calls * vio) { 
     248static int emul_esd_on_connect    (int client, struct emul_esd_command * cmd, void * data, struct roar_vio_calls * vio) { 
    217249 
    218250 ROAR_DBG("emul_esd_on_connect(client=%i, cmd=%p, data=%p, vio=%p) = ?", client, cmd, data, vio); 
     
    236268} 
    237269 
    238 int emul_esd_on_stream     (int client, struct emul_esd_command * cmd, void * data, struct roar_vio_calls * vio) { 
     270static int emul_esd_on_stream     (int client, struct emul_esd_command * cmd, void * data, struct roar_vio_calls * vio) { 
    239271 struct roar_stream_server * ss; 
    240272 struct roar_stream        *  s; 
     
    254286  case ESD_PROTO_STREAM_FILT: dir = ROAR_DIR_FILTER;  break; 
    255287  default: 
    256     clients_delete(client); 
    257288    return -1; 
    258289 } 
     
    264295 ROAR_DBG("emul_esd_on_stream(client=%i, ...): creating stream...", client); 
    265296 if ((stream = streams_new()) == -1 ) { 
    266   clients_delete(client); 
    267297  return -1; 
    268298 } 
     
    271301 if ( streams_get(stream, &ss) == -1 ) { 
    272302  streams_delete(stream); 
    273   clients_delete(client); 
    274303  return -1; 
    275304 } 
     
    280309 if ( client_stream_add(client, stream) == -1 ) { 
    281310  streams_delete(stream); 
    282   clients_delete(client); 
    283311  return -1; 
    284312 } 
     
    299327  default: 
    300328    streams_delete(stream); 
    301     clients_delete(client); 
    302329    return -1; 
    303330 } 
     
    308335  default: 
    309336    streams_delete(stream); 
    310     clients_delete(client); 
    311337    return -1; 
    312338 } 
     
    317343 
    318344 if ( streams_set_dir(stream, dir, 1) == -1 ) { 
    319   clients_delete(client); 
    320345  return -1; 
    321346 } 
    322347 
    323348 if ( client_stream_exec(client, stream) == -1 ) { 
    324   clients_delete(client); 
    325   return -1; 
    326  } 
    327  
    328  return 0; 
    329 } 
    330  
    331 int emul_esd_on_latency    (int client, struct emul_esd_command * cmd, void * data, struct roar_vio_calls * vio) { 
     349  return -1; 
     350 } 
     351 
     352 return 0; 
     353} 
     354 
     355static int emul_esd_on_latency    (int client, struct emul_esd_command * cmd, void * data, struct roar_vio_calls * vio) { 
    332356 int lag = ROAR_OUTPUT_CFREQ; 
    333357 
     
    337361} 
    338362 
    339 int emul_esd_on_standby    (int client, struct emul_esd_command * cmd, void * data, struct roar_vio_calls * vio) { 
     363static int emul_esd_on_standby    (int client, struct emul_esd_command * cmd, void * data, struct roar_vio_calls * vio) { 
    340364 int ok = 0; 
    341365 
     
    356380} 
    357381 
    358 int emul_esd_on_standbymode(int client, struct emul_esd_command * cmd, void * data, struct roar_vio_calls * vio) { 
     382static int emul_esd_on_standbymode(int client, struct emul_esd_command * cmd, void * data, struct roar_vio_calls * vio) { 
    359383 int mode = ESM_ERROR; 
    360384 
     
    372396} 
    373397 
    374 int emul_esd_on_stream_pan (int client, struct emul_esd_command * cmd, void * data, struct roar_vio_calls * vio) { 
     398static int emul_esd_on_stream_pan (int client, struct emul_esd_command * cmd, void * data, struct roar_vio_calls * vio) { 
    375399 struct roar_stream_server * ss; 
    376400 int stream = -1; 
     
    395419} 
    396420 
    397 int emul_esd_on_server_info(int client, struct emul_esd_command * cmd, void * data, struct roar_vio_calls * vio) { 
     421static int emul_esd_on_server_info(int client, struct emul_esd_command * cmd, void * data, struct roar_vio_calls * vio) { 
    398422 int version = 0; 
    399423 int rate    = g_sa->rate; 
     
    422446} 
    423447 
    424 int emul_esd_on_all_info   (int client, struct emul_esd_command * cmd, void * data, struct roar_vio_calls * vio) { 
     448static int emul_esd_on_all_info   (int client, struct emul_esd_command * cmd, void * data, struct roar_vio_calls * vio) { 
    425449 struct roar_stream_server *   ss; 
    426450 struct roar_audio_info    * info; 
     
    532556} 
    533557 
     558struct roar_dl_proto __proto_common_esd = { 
     559 .proto = ROAR_PROTO_ESOUND, 
     560 .description = "EsounD emulation", 
     561 .flags = ROAR_DL_PROTO_FLAGS_NONE, 
     562 .set_proto = emul_esd_set_proto, 
     563 .handle = emul_esd_check_client 
     564}; 
     565 
    534566#endif 
    535567#endif 
  • plugins/roard/protocol-gopher.c

    r5640 r5739  
    631631} 
    632632 
    633 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) { 
     633static 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) { 
    634634 struct roar_client_server * cs; 
    635  struct roar_vio_calls     rvio; 
    636635 struct item * c = NULL; 
    637636 char inbuf[1024]; 
     
    646645 
    647646 if ( clients_get_server(client, &cs) == -1 ) { 
    648   clients_delete(client); 
    649647  return -1; 
    650648 } 
    651649 
    652650 ROAR_DBG("emul_gopher_check_client(client=%i, vio=%p) = ?", client, vio); 
    653  
    654  if ( vio == NULL ) { 
    655   vio = &rvio; 
    656   roar_vio_open_fh_socket(vio, clients_get_fh(client)); 
    657  } 
    658651 
    659652 ROAR_DBG("emul_gopher_check_client(client=%i, vio=%p) = ?", client, vio); 
     
    662655  len = sizeof(inbuf)-1; 
    663656  if ( roar_buffer_shift_out(&(cs->inbuf), inbuf, &len) == -1 ) { 
    664    clients_delete(client); 
    665657   return -1; 
    666658  } 
     
    668660  if ( cs->inbuf != NULL ) { 
    669661   roar_buffer_free(cs->inbuf); 
    670    clients_delete(client); 
    671662   return -1; 
    672663  } 
     
    674665  // test if we have still buffer space left. 
    675666  if ( len == (sizeof(inbuf)-1) ) { 
    676    clients_delete(client); 
    677667   return -1; 
    678668  } 
     
    683673 ret = roar_vio_read(vio, inbuf+len, sizeof(inbuf)-len-1); 
    684674 if ( ret < 1 ) { 
    685   clients_delete(client); 
    686675  ROAR_DBG("emul_gopher_check_client(client=%i, vio=%p) = -1", client, vio); 
    687676  return -1; 
     
    696685 if ( !strip_nl(inbuf) ) { 
    697686  if ( roar_buffer_new_data(&(cs->inbuf), ret, &data) == -1 ) { 
    698    clients_delete(client); 
    699687   ROAR_DBG("emul_gopher_check_client(client=%i, vio=%p) = -1", client, vio); 
    700688   return -1; 
     
    719707 
    720708 if ( c == NULL ) { 
    721   clients_delete(client); 
    722709  ROAR_DBG("emul_gopher_check_client(client=%i, vio=%p) = -1", client, vio); 
    723710  return -1; 
     
    752739 
    753740 if ( funcret == -1 ) { 
    754   clients_delete(client); 
    755741  ROAR_DBG("emul_gopher_check_client(client=%i, vio=%p) = -1", client, vio); 
    756742  return -1; 
     
    762748} 
    763749 
    764 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) { 
     750static 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) { 
    765751 ROAR_DBG("emul_gopher_flushed_client(client=%i, vio=%p) = ?", client, vio); 
    766752 
    767  return clients_delete(client); 
    768 } 
     753 return -1; 
     754} 
     755 
     756struct roar_dl_proto __proto_common_gopher = { 
     757 .proto = ROAR_PROTO_GOPHER, 
     758 .description = "The Internet Gopher Protocol", 
     759 .flags = ROAR_DL_PROTO_FLAGS_NONE, 
     760 .handle = emul_gopher_check_client, 
     761 .flushed = emul_gopher_flushed_client 
     762}; 
    769763 
    770764#endif 
  • plugins/roard/protocol-rplay.c

    r5640 r5739  
    2828#ifndef ROAR_WITHOUT_DCOMP_EMUL_RPLAY 
    2929 
    30 struct emul_rplay_command emul_rplay_commands[] = { 
     30struct emul_rplay_command { 
     31 const char * name; 
     32 const char * usage; 
     33 ssize_t      min_args; 
     34 ssize_t      max_args; 
     35 int (*handler)(int client, struct emul_rplay_command * cmd, struct roar_vio_calls * vio, struct roar_keyval * kv, size_t kvlen); 
     36}; 
     37 
     38static int emul_rplay_exec_command  (int client, struct roar_vio_calls * vio, char * command); 
     39 
     40static int emul_rplay_send_error    (int client, struct emul_rplay_command * cmd, struct roar_vio_calls * vio, struct roar_keyval * kv, size_t kvlen, const char * msg); 
     41 
     42static int emul_rplay_on_status(int client, struct emul_rplay_command * cmd, struct roar_vio_calls * vio, struct roar_keyval * kv, size_t kvlen); 
     43static int emul_rplay_on_quit(int client, struct emul_rplay_command * cmd, struct roar_vio_calls * vio, struct roar_keyval * kv, size_t kvlen); 
     44static int emul_rplay_on_help(int client, struct emul_rplay_command * cmd, struct roar_vio_calls * vio, struct roar_keyval * kv, size_t kvlen); 
     45 
     46// things we need to implent soon: 
     47static int emul_rplay_on_play(int client, struct emul_rplay_command * cmd, struct roar_vio_calls * vio, struct roar_keyval * kv, size_t kvlen); 
     48static int emul_rplay_on_put(int client, struct emul_rplay_command * cmd, struct roar_vio_calls * vio, struct roar_keyval * kv, size_t kvlen); 
     49//static int emul_rplay_on_set(int client, struct emul_rplay_command * cmd, struct roar_vio_calls * vio, struct roar_keyval * kv, size_t kvlen); 
     50//static int emul_rplay_on_modify(int client, struct emul_rplay_command * cmd, struct roar_vio_calls * vio, struct roar_keyval * kv, size_t kvlen); 
     51static int emul_rplay_on_pause(int client, struct emul_rplay_command * cmd, struct roar_vio_calls * vio, struct roar_keyval * kv, size_t kvlen); 
     52static int emul_rplay_on_continue(int client, struct emul_rplay_command * cmd, struct roar_vio_calls * vio, struct roar_keyval * kv, size_t kvlen); 
     53//static int emul_rplay_on_stop(int client, struct emul_rplay_command * cmd, struct roar_vio_calls * vio, struct roar_keyval * kv, size_t kvlen); 
     54 
     55static struct emul_rplay_command emul_rplay_commands[] = { 
    3156 {"access",      NULL, -1, -1, NULL}, 
    3257 {"application", NULL,  1, -1, NULL}, 
     
    111136} 
    112137 
    113 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) { 
    114  struct roar_vio_calls calls; 
     138static int emul_rplay_set_proto  (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) { 
     139 if ( emul_rplay_on_status(client, NULL, vio, NULL, 0) == -1 ) 
     140  return -1; 
     141 
     142 return 0; 
     143} 
     144 
     145static 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) { 
    115146 char buf[1024]; 
    116147 ssize_t len; 
     
    119150  return -1; 
    120151 
    121  if ( vio == NULL ) { 
    122   vio = &calls; 
    123   if ( roar_vio_open_fh_socket(vio, clients_get_fh(client)) == -1 ) 
    124    return -1; 
    125  } 
    126  
    127152 if ( (len = roar_vio_read(vio, buf, sizeof(buf)-1)) <= 0 ) { 
    128153  // really bad protocol error 
    129   clients_delete(client); 
    130154  return -1; 
    131155 } 
     
    256280 
    257281 
    258 int emul_rplay_on_quit(int client, struct emul_rplay_command * cmd, struct roar_vio_calls * vio, struct roar_keyval * kv, size_t kvlen) { 
    259  clients_delete(client); 
     282static int emul_rplay_on_quit(int client, struct emul_rplay_command * cmd, struct roar_vio_calls * vio, struct roar_keyval * kv, size_t kvlen) { 
    260283 return -1; 
    261284} 
    262285 
    263 int emul_rplay_on_help(int client, struct emul_rplay_command * cmd, struct roar_vio_calls * vio, struct roar_keyval * kv, size_t kvlen) { 
     286static int emul_rplay_on_help(int client, struct emul_rplay_command * cmd, struct roar_vio_calls * vio, struct roar_keyval * kv, size_t kvlen) { 
    264287 struct emul_rplay_command * c; 
    265288 
     
    276299 
    277300 
    278 int emul_rplay_on_play(int client, struct emul_rplay_command * cmd, struct roar_vio_calls * vio, struct roar_keyval * kv, size_t kvlen) { 
     301static int emul_rplay_on_play(int client, struct emul_rplay_command * cmd, struct roar_vio_calls * vio, struct roar_keyval * kv, size_t kvlen) { 
    279302 struct roar_keyval        * kvr, * rate, * bits, * channels, * format, * byteorder; 
    280303 struct roar_audio_info      info; 
     
    370393} 
    371394 
    372 int emul_rplay_on_put(int client, struct emul_rplay_command * cmd, struct roar_vio_calls * vio, struct roar_keyval * kv, size_t kvlen) { 
     395static int emul_rplay_on_put(int client, struct emul_rplay_command * cmd, struct roar_vio_calls * vio, struct roar_keyval * kv, size_t kvlen) { 
    373396 struct roar_keyval * kvr; 
    374397 int stream; 
     
    418441} 
    419442 
    420 int emul_rplay_on_set(int client, struct emul_rplay_command * cmd, struct roar_vio_calls * vio, struct roar_keyval * kv, size_t kvlen); 
    421 int emul_rplay_on_modify(int client, struct emul_rplay_command * cmd, struct roar_vio_calls * vio, struct roar_keyval * kv, size_t kvlen); 
    422  
    423 int emul_rplay_on_pause(int client, struct emul_rplay_command * cmd, struct roar_vio_calls * vio, struct roar_keyval * kv, size_t kvlen) { 
     443//static int emul_rplay_on_set(int client, struct emul_rplay_command * cmd, struct roar_vio_calls * vio, struct roar_keyval * kv, size_t kvlen); 
     444//static int emul_rplay_on_modify(int client, struct emul_rplay_command * cmd, struct roar_vio_calls * vio, struct roar_keyval * kv, size_t kvlen); 
     445 
     446static int emul_rplay_on_pause(int client, struct emul_rplay_command * cmd, struct roar_vio_calls * vio, struct roar_keyval * kv, size_t kvlen) { 
    424447 struct roar_keyval * kvr; 
    425448 int stream; 
     
    450473} 
    451474 
    452 int emul_rplay_on_continue(int client, struct emul_rplay_command * cmd, struct roar_vio_calls * vio, struct roar_keyval * kv, size_t kvlen) { 
     475static int emul_rplay_on_continue(int client, struct emul_rplay_command * cmd, struct roar_vio_calls * vio, struct roar_keyval * kv, size_t kvlen) { 
    453476 struct roar_keyval * kvr; 
    454477 int stream; 
     
    479502} 
    480503 
    481 int emul_rplay_on_stop(int client, struct emul_rplay_command * cmd, struct roar_vio_calls * vio, struct roar_keyval * kv, size_t kvlen); 
     504//static int emul_rplay_on_stop(int client, struct emul_rplay_command * cmd, struct roar_vio_calls * vio, struct roar_keyval * kv, size_t kvlen); 
     505 
     506struct roar_dl_proto __proto_common_rplay = { 
     507 .proto = ROAR_PROTO_RPLAY, 
     508 .description = "RPlay emulation", 
     509 .flags = ROAR_DL_PROTO_FLAGS_NONE, 
     510 .set_proto = emul_rplay_set_proto, 
     511 .handle = emul_rplay_check_client 
     512}; 
    482513 
    483514#endif 
  • roard/clients.c

    r5654 r5739  
    3333struct roar_client_server * g_clients[ROAR_CLIENTS_MAX]; 
    3434 
    35 static struct roar_dl_proto 
    36 #if !defined(ROAR_WITHOUT_DCOMP_EMUL_ESD) && defined(ROAR_HAVE_H_ESD) 
    37 __proto_common_esd = { 
    38  .proto = ROAR_PROTO_ESOUND, 
    39  .description = "EsounD emulation", 
    40  .flags = ROAR_DL_PROTO_FLAGS_NONE, 
    41  .handle = emul_esd_check_client 
    42 }, 
    43 #endif 
    44 #ifndef ROAR_WITHOUT_DCOMP_EMUL_RPLAY 
    45 __proto_common_rplay = { 
    46  .proto = ROAR_PROTO_RPLAY, 
    47  .description = "RPlay emulation", 
    48  .flags = ROAR_DL_PROTO_FLAGS_NONE, 
    49  .handle = emul_rplay_check_client 
    50 }, 
    51 #endif 
    52 #ifndef ROAR_WITHOUT_DCOMP_EMUL_GOPHER 
    53 __proto_common_gopher = { 
    54  .proto = ROAR_PROTO_GOPHER, 
    55  .description = "The Internet Gopher Protocol", 
    56  .flags = ROAR_DL_PROTO_FLAGS_NONE, 
    57  .handle = emul_gopher_check_client, 
    58  .flushed = emul_gopher_flushed_client 
    59 } 
    60 #endif 
    61 ; 
     35extern struct roar_dl_proto __proto_common_rplay; 
     36extern struct roar_dl_proto __proto_common_gopher; 
     37extern struct roar_dl_proto __proto_common_esd; 
    6238 
    6339static struct roard_proto_handle __protos[MAX_PROTOS] = { 
     
    252228    // nothing needed to be done here 
    253229   break; 
    254 #ifndef ROAR_WITHOUT_DCOMP_EMUL_ESD 
    255 #ifdef ROAR_HAVE_H_ESD 
    256   case ROAR_PROTO_ESOUND: 
    257     ROAR_DBG("net_get_new_client(*): execing ESD CONNECT command"); 
    258  
    259     if ( roar_vio_open_fh_socket(&vio, fh) == -1 ) 
    260      return -1; 
    261  
    262     ROAR_DBG("net_get_new_client(*): creating VIO OK"); 
    263  
    264     if ( emul_esd_exec_command(client, ESD_PROTO_CONNECT, &vio) == -1 ) 
    265      return -1; 
    266  
    267     ROAR_DBG("net_get_new_client(*): CONNECT execed sucessfully"); 
    268    break; 
    269 #endif 
    270 #endif 
    271230#ifndef ROAR_WITHOUT_DCOMP_EMUL_SIMPLE 
    272231  case ROAR_PROTO_SIMPLE: 
     
    277236#ifndef ROAR_WITHOUT_DCOMP_EMUL_RSOUND 
    278237  case ROAR_PROTO_RSOUND: // nothing to do here. 
    279    break; 
    280 #endif 
    281 #ifndef ROAR_WITHOUT_DCOMP_EMUL_RPLAY 
    282   case ROAR_PROTO_RPLAY: 
    283     if ( roar_vio_open_fh_socket(&vio, fh) == -1 ) 
    284      return -1; 
    285  
    286     if ( emul_rplay_on_status(client, NULL, &vio, NULL, 0) == -1 ) 
    287      return -1; 
    288238   break; 
    289239#endif 
  • roard/include/emul_esd.h.OLD

    r5640 r5739  
    3232#ifdef ROAR_HAVE_H_ESD 
    3333 
    34 // in case it is not allready included, 
    35 // only needed in the case we have no libesd.* but a esd.h 
    36 #include <esd.h> 
    37  
    38 struct emul_esd_command { 
    39  int    cmd; 
    40  size_t datalen; 
    41 #if !defined(ROAR_TARGET_MICROCONTROLLER) && !defined(ROAR_MINIMAL) 
    42  char name[COMMAND_MAX_NAMELEN]; 
    43 #else 
    44  char * name; 
    45 #endif 
    46  int (*handler)(int client, struct emul_esd_command * cmd, void * data, struct roar_vio_calls * vio); 
    47 }; 
    48  
    49 int 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, struct roar_buffer ** obuffer, void ** userdata, const struct roar_keyval * protopara, ssize_t protoparalen, struct roar_dl_librarypara * pluginpara); 
    51  
    52 int emul_esd_int_read_buf  (int client, int * data, void * buf); 
    53 int emul_esd_int_read      (int client, int * data, struct roar_vio_calls * vio); 
    54 int emul_esd_int_write     (int client, int   data, struct roar_vio_calls * vio); 
    55 int emul_esd_test_auth     (int client, void * data, struct roar_vio_calls * vio); 
    56 int emul_esd_test_byteorder(int client, void * data); 
    57  
    58 int emul_esd_on_connect    (int client, struct emul_esd_command * cmd, void * data, struct roar_vio_calls * vio); 
    59 int emul_esd_on_stream     (int client, struct emul_esd_command * cmd, void * data, struct roar_vio_calls * vio); 
    60 int emul_esd_on_latency    (int client, struct emul_esd_command * cmd, void * data, struct roar_vio_calls * vio); 
    61 int emul_esd_on_standby    (int client, struct emul_esd_command * cmd, void * data, struct roar_vio_calls * vio); 
    62 int emul_esd_on_standbymode(int client, struct emul_esd_command * cmd, void * data, struct roar_vio_calls * vio); 
    63  
    64 int emul_esd_on_stream_pan (int client, struct emul_esd_command * cmd, void * data, struct roar_vio_calls * vio); 
    65  
    66 int emul_esd_on_server_info(int client, struct emul_esd_command * cmd, void * data, struct roar_vio_calls * vio); 
    67  
    68 int emul_esd_on_all_info   (int client, struct emul_esd_command * cmd, void * data, struct roar_vio_calls * vio); 
     34extern struct roar_dl_proto __proto_common_esd; 
    6935 
    7036#endif 
  • roard/include/emul_gopher.h.OLD

    r5640 r5739  
    2929#include <roaraudio.h> 
    3030 
    31 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); 
    32 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); 
     31extern struct roar_dl_proto __proto_common_gopher; 
    3332 
    3433#endif 
  • roard/include/emul_rplay.h.OLD

    r5640 r5739  
    2929#include <roaraudio.h> 
    3030 
    31 #ifndef ROAR_WITHOUT_DCOMP_EMUL_RPLAY 
    32  
    33 struct emul_rplay_command { 
    34  const char * name; 
    35  const char * usage; 
    36  ssize_t      min_args; 
    37  ssize_t      max_args; 
    38  int (*handler)(int client, struct emul_rplay_command * cmd, struct roar_vio_calls * vio, struct roar_keyval * kv, size_t kvlen); 
    39 }; 
    40  
    41 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); 
    42  
    43 int emul_rplay_exec_command  (int client, struct roar_vio_calls * vio, char * command); 
    44  
    45 int emul_rplay_send_error    (int client, struct emul_rplay_command * cmd, struct roar_vio_calls * vio, struct roar_keyval * kv, size_t kvlen, const char * msg); 
    46  
    47 int emul_rplay_on_status(int client, struct emul_rplay_command * cmd, struct roar_vio_calls * vio, struct roar_keyval * kv, size_t kvlen); 
    48 int emul_rplay_on_quit(int client, struct emul_rplay_command * cmd, struct roar_vio_calls * vio, struct roar_keyval * kv, size_t kvlen); 
    49 int emul_rplay_on_help(int client, struct emul_rplay_command * cmd, struct roar_vio_calls * vio, struct roar_keyval * kv, size_t kvlen); 
    50  
    51 // things we need to implent soon: 
    52 int emul_rplay_on_play(int client, struct emul_rplay_command * cmd, struct roar_vio_calls * vio, struct roar_keyval * kv, size_t kvlen); 
    53 int emul_rplay_on_put(int client, struct emul_rplay_command * cmd, struct roar_vio_calls * vio, struct roar_keyval * kv, size_t kvlen); 
    54 int emul_rplay_on_set(int client, struct emul_rplay_command * cmd, struct roar_vio_calls * vio, struct roar_keyval * kv, size_t kvlen); 
    55 int emul_rplay_on_modify(int client, struct emul_rplay_command * cmd, struct roar_vio_calls * vio, struct roar_keyval * kv, size_t kvlen); 
    56 int emul_rplay_on_pause(int client, struct emul_rplay_command * cmd, struct roar_vio_calls * vio, struct roar_keyval * kv, size_t kvlen); 
    57 int emul_rplay_on_continue(int client, struct emul_rplay_command * cmd, struct roar_vio_calls * vio, struct roar_keyval * kv, size_t kvlen); 
    58 int emul_rplay_on_stop(int client, struct emul_rplay_command * cmd, struct roar_vio_calls * vio, struct roar_keyval * kv, size_t kvlen); 
    59 #endif 
     31extern struct roar_dl_proto __proto_common_rplay; 
    6032 
    6133#endif 
Note: See TracChangeset for help on using the changeset viewer.