Changeset 3717:29a6203feedc in roaraudio


Ignore:
Timestamp:
04/25/10 04:58:25 (14 years ago)
Author:
phi
Branch:
default
Phase:
public
Message:

added some basic client handling functions

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libroar/client.c

    r3715 r3717  
    3636#include "libroar.h" 
    3737 
     38int roar_client_new      (struct roar_client * client) { 
     39 int i; 
     40 
     41 if ( client == NULL ) 
     42  return -1; 
     43 
     44 memset(client, 0, sizeof(struct roar_client)); 
     45 
     46 client->fh          = -1; 
     47 client->pid         = -1; 
     48 client->uid         = -1; 
     49 client->gid         = -1; 
     50 client->proto       = ROAR_PROTO_ROARAUDIO; 
     51 client->byteorder   = ROAR_BYTEORDER_NETWORK; 
     52 
     53 for (i = 0; i < ROAR_CLIENTS_MAX_STREAMS_PER_CLIENT; i++) 
     54  client->streams[i] = -1; 
     55 
     56 return 0; 
     57} 
     58 
     59int roar_client_set_fh   (struct roar_client * client, int fh) { 
     60 if ( client == NULL ) 
     61  return -1; 
     62 
     63 client->fh = fh; 
     64 
     65 return 0; 
     66} 
     67 
     68int roar_client_set_proto(struct roar_client * client, int proto, int byteorder) { 
     69 if ( client == NULL ) 
     70  return -1; 
     71 
     72 client->proto = proto; 
     73 
     74 if ( byteorder != -1 ) { 
     75  client->byteorder = byteorder; 
     76 } else { 
     77  switch (proto) { 
     78   case ROAR_PROTO_ROARAUDIO: 
     79     client->byteorder = ROAR_BYTEORDER_NETWORK; 
     80    break; 
     81   default: 
     82     return -1; 
     83    break; 
     84  } 
     85 } 
     86 
     87 return 0; 
     88} 
     89 
     90int roar_client_pass     (struct roar_connection * con, struct roar_client * client); 
     91 
    3892//ll 
Note: See TracChangeset for help on using the changeset viewer.