Changeset 4678:8480af30c884 in roaraudio


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

convert select(){} into array looked up with for(){} for protocol in client check rutine

Location:
roard
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • roard/clients.c

    r4480 r4678  
    2626#include "roard.h" 
    2727 
     28struct roard_proto g_proto[] = { 
     29#ifndef ROAR_WITHOUT_DCOMP_EMUL_ESD 
     30#ifdef ROAR_HAVE_H_ESD 
     31 {ROAR_PROTO_ESOUND, emul_esd_check_client}, 
     32#endif 
     33#endif 
     34#ifndef ROAR_WITHOUT_DCOMP_EMUL_RPLAY 
     35 {ROAR_PROTO_RPLAY, emul_rplay_check_client}, 
     36#endif 
     37 {-1, NULL} 
     38}; 
     39 
    2840#define _CHECK_CID_RET(id,ret) if ( (id) < 0 || (id) > ROAR_CLIENTS_MAX || g_clients[(id)] == NULL ) return (ret) 
    2941#define _CHECK_CID(id)         _CHECK_CID_RET((id), -1) 
     
    490502 uint32_t flags[2] = {COMMAND_FLAG_NONE, COMMAND_FLAG_NONE}; 
    491503 uint32_t event; 
     504 size_t i; 
    492505 
    493506 _CHECK_CID(id); 
     
    541554 
    542555   break; 
    543 #ifndef ROAR_WITHOUT_DCOMP_EMUL_ESD 
    544 #ifdef ROAR_HAVE_H_ESD 
    545   case ROAR_PROTO_ESOUND: 
    546     rv = emul_esd_check_client(id, NULL); 
    547    break; 
    548 #endif 
    549 #endif 
    550 #ifndef ROAR_WITHOUT_DCOMP_EMUL_RPLAY 
    551   case ROAR_PROTO_RPLAY: 
    552     rv = emul_rplay_check_client(id, NULL); 
    553    break; 
    554 #endif 
    555556#ifndef ROAR_WITHOUT_DCOMP_EMUL_RSOUND 
    556557  case ROAR_PROTO_RSOUND: 
     
    581582  default: 
    582583    rv = -1; 
     584    for (i = 0; i < (sizeof(g_proto)/sizeof(*g_proto)); i++) { 
     585     if ( g_proto[i].proto == c->proto ) { 
     586      rv = g_proto[i].check_client(id, NULL); 
     587     } 
     588    } 
    583589 } 
    584590 
  • roard/include/client.h

    r4480 r4678  
    6969} * g_clients[ROAR_CLIENTS_MAX]; 
    7070 
     71struct roard_proto { 
     72 int proto; 
     73 int (*check_client)(int client, struct roar_vio_calls * vio); 
     74}; 
    7175 
    7276// basic functions 
  • roard/include/roard.h

    r4504 r4678  
    155155#ifdef ROAR_SUPPORT_LISTEN 
    156156int get_listen(struct roard_listen ** sock, char *** sockname); 
     157int add_listen (char * addr, int port, int sock_type, char * user, char * group, int proto, int dir, struct roar_audio_info * info); 
    157158#endif 
    158159 
Note: See TracChangeset for help on using the changeset viewer.