Changeset 5279:bb3ff1f2be28 in roaraudio


Ignore:
Timestamp:
11/21/11 18:28:31 (12 years ago)
Author:
phi
Branch:
default
Phase:
public
Message:

added support to hostid and license to server info struct, added support for contact, serial and uiurl ITST to roard.

Files:
8 edited

Legend:

Unmodified
Added
Removed
  • configure

    r5277 r5279  
    16801680test_func_defmake ROAR_HAVE_STRLCAT   strlcat   'strlcat((char*)0, "", 0)'   -- string.h 
    16811681test_func_defmake ROAR_HAVE_NICE      nice      'nice(0)'                    -- unistd.h 
     1682test_func_defmake ROAR_HAVE_GETHOSTID gethostid 'gethostid()'                -- unistd.h 
    16821683test_func_defmake ROAR_HAVE_GETGID    getgid    'getgid()'                   -- sys/types.h unistd.h 
    16831684test_func_defmake ROAR_HAVE_GETUID    getuid    'getuid()'                   -- sys/types.h unistd.h 
  • include/libroar/serverinfo.h

    r4708 r5279  
    4040 
    4141struct roar_server_info { 
    42  char * version; 
    43  char * location; 
    44  char * description; 
    45  char * contact; 
    46  char * serial; 
    47  char * address; 
    48  char * uiurl; 
     42 const char * version; 
     43 const char * location; 
     44 const char * description; 
     45 const char * contact; 
     46 const char * serial; 
     47 const char * address; 
     48 const char * uiurl; 
     49 const char * hostid; 
     50 const char * license; 
    4951 struct { 
    50   char * sysname; 
    51   char * release; 
    52   char * nodename; 
    53   char * machine; 
     52  const char * sysname; 
     53  const char * release; 
     54  const char * nodename; 
     55  const char * machine; 
    5456 } un; 
    5557}; 
  • include/roaraudio/proto.h

    r5093 r5279  
    199199#define ROAR_ITST_UIURL             10 
    200200#define ROAR_ITST_HOSTID            11 
     201#define ROAR_ITST_LICENSE           12 
    201202 
    202203// IDs for diffrent clocks: 
  • libroar/serverinfo.c

    r5270 r5279  
    3939 int type; 
    4040 size_t len; 
    41  char * buf; 
     41 const char * buf; 
    4242}; 
    4343 
     
    102102 _add(ROAR_ITST_ADDRESS, address); 
    103103 _add(ROAR_ITST_UIURL, uiurl); 
     104 _add(ROAR_ITST_LICENSE, license); 
     105 _add(ROAR_ITST_HOSTID, hostid); 
    104106 _add(ROAR_ITST_UN_SYSNAME, un.sysname); 
    105107 _add(ROAR_ITST_UN_RELEASE, un.release); 
     
    160162 char * textpart; 
    161163 char * textbuf; 
    162  char ** tptr; 
     164 const char ** tptr; 
    163165 char * mesdata; 
    164166 
     
    272274   _ck(ROAR_ITST_ADDRESS, address); 
    273275   _ck(ROAR_ITST_UIURL, uiurl); 
     276   _ck(ROAR_ITST_HOSTID, hostid); 
     277   _ck(ROAR_ITST_LICENSE, license); 
    274278   _ck(ROAR_ITST_UN_SYSNAME, un.sysname); 
    275279   _ck(ROAR_ITST_UN_RELEASE, un.release); 
  • roarclients/roarctl.c

    r5238 r5279  
    269269void server_info (struct roar_connection * con) { 
    270270 struct roar_server_info * info = roar_server_info(con); 
     271 long hostid; 
    271272 
    272273 if ( info == NULL ) { 
     
    275276 } 
    276277 
    277  _pm(version, "version"); 
    278  _pm(location, "location"); 
    279  _pm(description, "description"); 
    280  _pm(contact, "contact"); 
    281  _pm(serial, "serial"); 
    282  _pm(address, "address"); 
     278 _pm(version, "Version"); 
     279 _pm(location, "Location"); 
     280 _pm(description, "Description"); 
     281 _pm(contact, "Contact"); 
     282 _pm(serial, "Serial"); 
     283 _pm(address, "Address"); 
    283284 _pm(uiurl, "UI URL"); 
     285 _pm(license, "License"); 
     286// _pm(hostid, "HostID"); 
     287 if ( info->hostid != NULL ) { 
     288  if ( sscanf(info->hostid, "0x%lx", &hostid) != 1 ) 
     289   hostid = 0; 
     290 
     291  if ( hostid ) { 
     292   printf("Server %-15s: %s (%li.%li.%li.%li)\n", "HostID", info->hostid, 
     293           ((hostid & 0x00FF0000UL) >> 16UL), 
     294           ((hostid & 0xFF000000UL) >> 24UL), 
     295           ((hostid & 0x000000FFUL) >>  0UL), 
     296           ((hostid & 0x0000FF00UL) >>  8UL) 
     297         ); 
     298  } else { 
     299   printf("Server %-15s: %s\n", "HostID", info->hostid); 
     300  } 
     301 } 
    284302 _pm(un.sysname, "System sysname"); 
    285303 _pm(un.release, "System release"); 
  • roard/include/roard.h

    r5194 r5279  
    202202 char * location; 
    203203 char * description; 
     204 char * contact; 
     205 char * serial; 
     206 char * uiurl; 
    204207 size_t jumbo_mtu; 
    205208 int memlock_level; 
  • roard/req.c

    r5216 r5279  
    750750 struct roar_server_info info; 
    751751 uint16_t * d16; 
     752#ifdef ROAR_HAVE_GETHOSTID 
     753 long hostid; 
     754 char hostidbuf[64]; 
     755#endif 
    752756 
    753757 if ( mes->datalen != 4 ) 
     
    771775   } 
    772776 
     777   info.license = "GPL-3.0"; 
     778 
     779#ifdef ROAR_HAVE_GETHOSTID 
     780   hostid = gethostid(); 
     781   snprintf(hostidbuf, sizeof(hostidbuf), sizeof(long) == 8 ? "0x%.16lx" : "0x%.8lx", hostid); 
     782   info.hostid = hostidbuf; 
     783#endif 
     784 
    773785   if ( !!strcmp(g_config->location, CONF_DEF_STRING) ) 
    774786    info.location = g_config->location; 
    775787 
    776788   if ( !!strcmp(g_config->description, CONF_DEF_STRING) ) 
    777    info.description = g_config->description; 
     789    info.description = g_config->description; 
     790 
     791   info.contact = g_config->contact; 
     792   info.serial  = g_config->serial; 
     793   info.uiurl   = g_config->uiurl; 
    778794 
    779795#ifdef ROAR_HAVE_UNAME 
  • roard/roard.c

    r5275 r5279  
    230230        " --location  LOC       - Set lion readable location of server\n" 
    231231        " --description  DESC   - Set lion readable description of server\n" 
     232        " --contact CONTACT     - Set contact for this server\n" 
     233        " --serial SERIAL       - Set serial for this device or server\n" 
     234        "                         (for embedded devices only)\n" 
     235        " --uiurl UIURL         - Set URL for userinterface of this device or server\n" 
     236        "                         (for embedded devices only)\n" 
    232237#ifdef SUPPORT_PIDFILE 
    233238        " --pidfile PIDFILE     - Write a pidfile at PIDFILE\n" 
     
    513518 g_config->location    = CONF_DEF_STRING; 
    514519 g_config->description = CONF_DEF_STRING; 
     520 g_config->contact     = NULL; 
     521 g_config->serial      = NULL; 
     522 g_config->uiurl       = NULL; 
    515523 
    516524 g_config->memlock_level = -1; 
     
    16571665   _CKHAVEARGS(1); 
    16581666   g_config->description = argv[++i]; 
     1667  } else if ( strcmp(k, "--contact") == 0 ) { 
     1668   _CKHAVEARGS(1); 
     1669   g_config->contact = argv[++i]; 
     1670  } else if ( strcmp(k, "--serial") == 0 ) { 
     1671   _CKHAVEARGS(1); 
     1672   g_config->serial = argv[++i]; 
     1673  } else if ( strcmp(k, "--uiurl") == 0 ) { 
     1674   _CKHAVEARGS(1); 
     1675   g_config->uiurl = argv[++i]; 
    16591676  } else if ( strcmp(k, "--pidfile") == 0 ) { 
    16601677   _CKHAVEARGS(1); 
Note: See TracChangeset for help on using the changeset viewer.