Changeset 4679:7a1dfd0bebba in roaraudio


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

added support to register protocols

Location:
roard
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • roard/clients.c

    r4678 r4679  
    2626#include "roard.h" 
    2727 
    28 struct roard_proto g_proto[] = { 
     28struct roard_proto g_proto[8] = { 
    2929#ifndef ROAR_WITHOUT_DCOMP_EMUL_ESD 
    3030#ifdef ROAR_HAVE_H_ESD 
     
    582582  default: 
    583583    rv = -1; 
    584     for (i = 0; i < (sizeof(g_proto)/sizeof(*g_proto)); i++) { 
     584    for (i = 0; g_proto[i].proto != -1; i++) { 
    585585     if ( g_proto[i].proto == c->proto ) { 
    586586      rv = g_proto[i].check_client(id, NULL); 
     
    669669 return -1; 
    670670} 
     671 
     672// proto support 
     673int clients_register_proto(struct roard_proto * proto) { 
     674 const size_t len = sizeof(g_proto)/sizeof(*g_proto); 
     675 size_t i; 
     676 
     677 if ( proto == NULL ) 
     678  return -1; 
     679 
     680 for (i = 0; g_proto[i].proto != -1; i++); 
     681 
     682 // i is now at pos of current EOS entry. 
     683 
     684 // test if we have space for one more entry: 
     685 if ( (i+1) >= len ) 
     686  return -1; 
     687 
     688 memcpy(&(g_proto[i]), proto, sizeof(*g_proto)); 
     689 
     690 i++; 
     691 
     692 memset(&(g_proto[i]), 0, sizeof(*g_proto)); 
     693 g_proto[i].proto = -1; 
     694 
     695 return 0; 
     696} 
     697 
    671698 
    672699int client_stream_exec   (int client, int stream) { 
  • roard/include/client.h

    r4678 r4679  
    9999int clients_send_filter(struct roar_audio_info * sa, uint32_t pos); 
    100100 
     101// proto support 
     102int clients_register_proto(struct roard_proto * proto); 
     103 
    101104// stream functions 
    102105int client_stream_exec   (int client, int stream); 
Note: See TracChangeset for help on using the changeset viewer.