Changeset 5373:8da157c10483 in roaraudio for libroar/config.c


Ignore:
Timestamp:
12/21/11 19:02:52 (12 years ago)
Author:
phi
Branch:
default
Phase:
public
Message:
  • Updated config structure
  • Added a flag to ask libroar to only connect to local servers
  • Added a way to override fork()
  • added support for +internal
File:
1 edited

Legend:

Unmodified
Added
Removed
  • libroar/config.c

    r5357 r5373  
    5050 
    5151#ifdef ROAR_SUPPORT_TRAP 
    52   config.trap_policy = ROAR_TRAP_IGNORE; 
     52  config.trap_policy      = ROAR_TRAP_IGNORE; 
    5353#endif 
    54   config.opmode      = ROAR_LIBROAR_CONFIG_OPMODE_NORMAL; 
    55   config.server   = NULL; 
    56   config.authfile = NULL; 
     54  config.opmode           = ROAR_LIBROAR_CONFIG_OPMODE_NORMAL; 
     55  config.server           = NULL; 
     56  config.authfile         = NULL; 
     57  config.forkapi          = NULL; 
     58  config.connect_internal = NULL; 
     59  config.daemonimage      = NULL; 
    5760 
    5861  if ( home != NULL ) { 
    59    snprintf(authfile, 1023, "%s/.roarauth", home); 
    60    authfile[1023]    = 0; 
     62   snprintf(authfile, sizeof(authfile)-1, "%s/.roarauth", home); 
     63   authfile[sizeof(authfile)-1] = 0; 
    6164   config.authfile    = authfile; 
    6265   config.serversfile = NULL; 
     
    304307  } else if ( !strcmp(k, "x11-display") ) { 
    305308   config->x11.display = v; 
     309  } else if ( !strcmp(k, "daemonimage") ) { 
     310   config->daemonimage = v; 
     311  } else if ( !strcmp(k, "serverflags") ) { 
     312   if ( !strcmp(v, "nonblock") ) { 
     313    config->serverflags |= ROAR_ENUM_FLAG_NONBLOCK; 
     314   } else if ( !strcmp(v, "hardnonblock") ) { 
     315    config->serverflags |= ROAR_ENUM_FLAG_HARDNONBLOCK; 
     316   } else if ( !strcmp(v, "localonly") ) { 
     317    config->serverflags |= ROAR_ENUM_FLAG_LOCALONLY; 
     318   } else { 
     319    ROAR_WARN("roar_libroar_config_parse(*): Unknown serverflag: %s", v); 
     320   } 
    306321  } else { 
    307322   ROAR_WARN("roar_libroar_config_parse(*): Unknown option: %s", k); 
     
    389404} 
    390405 
     406int    roar_libroar_set_forkapi(struct roar_libroar_forkapi * api) { 
     407 roar_libroar_get_config_ptr()->forkapi = api; 
     408 return 0; 
     409} 
     410 
     411int    roar_libroar_set_connect_internal(struct roar_vio_calls * (*func)(struct roar_connection * con, const char * server, int type, int flags, uint_least32_t timeout)) { 
     412 roar_libroar_get_config_ptr()->connect_internal = func; 
     413 return 0; 
     414} 
     415 
    391416void   roar_libroar_nowarn(void) { 
    392417 roar_libroar_get_config_ptr()->nowarncounter++; 
Note: See TracChangeset for help on using the changeset viewer.