Changeset 2814:40065eb210bc in roaraudio


Ignore:
Timestamp:
09/29/09 18:00:35 (15 years ago)
Author:
phi
Branch:
default
Phase:
public
Message:

added support for nnode and prethru

File:
1 edited

Legend:

Unmodified
Added
Removed
  • roarclients/roarctl.c

    r2739 r2814  
    200200 int id[ROAR_CLIENTS_MAX]; 
    201201 char tmp[80]; 
     202 int self_id; 
     203 struct roar_client self_client; 
    202204 struct roar_client c; 
    203205#ifdef _POSIX_USERS 
     
    206208#endif 
    207209 
     210 if ( (self_id = roar_get_clientid(con)) != -1 ) { 
     211  if ( roar_get_client(con, &self_client, self_id) == -1 ) 
     212   self_id = -1; 
     213 } 
     214 
    208215 if ( (num = roar_list_clients(con, id, ROAR_CLIENTS_MAX)) == -1 ) { 
    209216  fprintf(stderr, "Error: can not get client list\n"); 
     
    218225  } 
    219226  printf("Client name           : %s\n", c.name); 
    220   printf("Client PID            : %i(%s)\n", c.pid, proc_name(c.pid)); 
     227 
     228  if ( roar_nnode_get_socktype(&(c.nnode)) != ROAR_SOCKET_TYPE_UNKNOWN ) { 
     229   if ( roar_nnode_to_str(&(c.nnode), tmp, 80) == 0 ) { 
     230    printf("Client network node   : %s\n", tmp); 
     231   } 
     232  } 
     233 
     234  if ( self_id != -1 && roar_nnode_cmp(&(self_client.nnode), &(c.nnode)) == 0 ) { 
     235   printf("Client PID            : %i(%s)\n", c.pid, proc_name(c.pid)); 
     236  } else {  
     237   printf("Client PID            : %i\n", c.pid); 
     238  } 
    221239  if ( c.uid != -1 ) { 
    222240#ifdef _POSIX_USERS 
    223    pwd = getpwuid(c.uid); 
    224    grp = getgrgid(c.gid); 
    225    printf("Client UID/GID        : %i(%s)/%i(%s)\n", c.uid, pwd ? pwd->pw_name : "?", c.gid, grp ? grp->gr_name : "?"); 
     241   if ( self_id != -1 && roar_nnode_cmp(&(self_client.nnode), &(c.nnode)) == 0 ) { 
     242    pwd = getpwuid(c.uid); 
     243    grp = getgrgid(c.gid); 
     244    printf("Client UID/GID        : %i(%s)/%i(%s)\n", c.uid, pwd ? pwd->pw_name : "?", c.gid, grp ? grp->gr_name : "?"); 
     245   } else { 
    226246#else 
    227    printf("Client UID/GID        : %i/%i\n", c.uid, c.gid); 
     247   if ( 1 ) { 
    228248#endif 
     249    printf("Client UID/GID        : %i/%i\n", c.uid, c.gid); 
     250   } 
    229251  } 
    230252 
     
    376398    if ( info.flags & ROAR_FLAG_PASSMIXER ) 
    377399     strcat(flags, "passmixer "); 
     400    if ( info.flags & ROAR_FLAG_PRETHRU ) 
     401     strcat(flags, "prethru "); 
    378402 
    379403    printf("Flags                 : %s\n", flags); 
     
    759783  } else if ( !strcmp(c, "virtual") ) { 
    760784   f |= ROAR_FLAG_VIRTUAL; 
     785  } else if ( !strcmp(c, "prethru") ) { 
     786   f |= ROAR_FLAG_PRETHRU; 
    761787  } else { 
    762788   fprintf(stderr, "Error: unknown flag: %s\n", c); 
Note: See TracChangeset for help on using the changeset viewer.