Changeset 5640:00dd1147ce70 in roaraudio for roard/clients.c
- Timestamp:
- 09/10/12 16:18:22 (12 years ago)
- Branch:
- default
- Phase:
- public
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
roard/clients.c
r5608 r5640 33 33 struct roar_client_server * g_clients[ROAR_CLIENTS_MAX]; 34 34 35 static 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 35 54 static struct roard_proto_handle __protos[MAX_PROTOS] = { 36 55 {.proto = ROAR_PROTO_ROARAUDIO, .lhandle = NULL, .type = ROARD_PROTO_TYPE_BUILDIN, 37 56 .impl = {.buildin = 0}}, 38 57 #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}}, 41 60 #endif 42 61 #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}}, 45 64 #endif 46 65 #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}}, 50 68 #endif 51 69 {.proto = -1} … … 276 294 ROAR_WARN("net_get_new_client(lsock=%p): proto(%i) marked as buildin but isn't. BAD.", lsock, proto); 277 295 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 }286 296 break; 287 297 case ROARD_PROTO_TYPE_COMMON: … … 334 344 case ROARD_PROTO_TYPE_BUILDIN: 335 345 /* noop */ 336 break;337 case ROARD_PROTO_TYPE_ROARDPROTO:338 if ( proto->impl.roardproto.delete_client != NULL )339 proto->impl.roardproto.delete_client(id);340 346 break; 341 347 case ROARD_PROTO_TYPE_COMMON: … … 854 860 ROAR_WARN("clients_check(id=%i): proto(%i) marked as buildin but isn't. BAD.", id, proto->proto); 855 861 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;860 862 case ROARD_PROTO_TYPE_COMMON: 861 863 if ( proto->impl.common->handle != NULL ) { … … 907 909 case ROARD_PROTO_TYPE_BUILDIN: 908 910 /* 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 }919 911 break; 920 912 case ROARD_PROTO_TYPE_COMMON: … … 964 956 case ROARD_PROTO_TYPE_BUILDIN: 965 957 /* 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 }976 958 break; 977 959 case ROARD_PROTO_TYPE_COMMON: … … 1102 1084 } 1103 1085 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 1130 1086 int clients_register_proto_common(const struct roar_dl_proto * proto, struct roar_dl_lhandle * lhandle) { 1131 1087 const size_t len = sizeof(__protos)/sizeof(*__protos); … … 1236 1192 case ROARD_PROTO_TYPE_BUILDIN: 1237 1193 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;1256 1194 break; 1257 1195 case ROARD_PROTO_TYPE_COMMON:
Note: See TracChangeset
for help on using the changeset viewer.