Changeset 5739:2a1671d592b9 in roaraudio for roard


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

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

Location:
roard
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • 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.