source: roaraudio/roarclients/roarctl.c @ 5065:18cdc8c3a1ab

Last change on this file since 5065:18cdc8c3a1ab was 5065:18cdc8c3a1ab, checked in by phi, 13 years ago

added roar_clock_gettime()

File size: 36.4 KB
Line 
1//roarctl.c:
2
3/*
4 *      Copyright (C) Philipp 'ph3-der-loewe' Schafft - 2008-2011
5 *
6 *  This file is part of roarclients a part of RoarAudio,
7 *  a cross-platform sound system for both, home and professional use.
8 *  See README for details.
9 *
10 *  This file is free software; you can redistribute it and/or modify
11 *  it under the terms of the GNU General Public License version 3
12 *  as published by the Free Software Foundation.
13 *
14 *  RoarAudio is distributed in the hope that it will be useful,
15 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
16 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17 *  GNU General Public License for more details.
18 *
19 *  You should have received a copy of the GNU General Public License
20 *  along with this software; see the file COPYING.  If not, write to
21 *  the Free Software Foundation, 51 Franklin Street, Fifth Floor,
22 *  Boston, MA 02110-1301, USA.
23 *
24 */
25
26/* ckport options:
27 * ckport: ignore-symbol: roar_req of target libroar0 -- Used within ping command.
28 */
29
30#define _UNITS_T_BASE_USEC
31
32#include <roaraudio.h>
33#include <roaraudio/units.h>
34#include <libroardsp/libroardsp.h>
35
36#if defined(ROAR_HAVE_SETGID) && defined(ROAR_HAVE_SETUID)
37#define _POSIX_USERS
38#endif
39
40#ifdef _POSIX_USERS
41#include <pwd.h>
42#include <grp.h>
43#endif
44
45#include <sys/time.h>
46#include <time.h>
47
48#ifdef ROAR_HAVE_LIBM
49#include <math.h>
50#endif
51
52int g_verbose = 0;
53
54void display_client (struct roar_connection * con, int id);
55void display_stream (struct roar_connection * con, int id);
56int display_mixer (struct roar_connection * con, int stream);
57int show_meta_all (struct roar_connection * con, int id);
58
59void usage (void) {
60 printf("roarctl [OPTIONS]... COMMAND [OPTS] [COMMAND [OPTS] [COMMAND [OPTS] [...]]]\n");
61
62 printf("\nOptions:\n\n");
63
64 printf("  --server SERVER         - Set server hostname\n"
65        "  --help                  - Show this help\n"
66        "  --verbose   -v          - Show verbose output\n"
67        "  --list-aiprofiles       - Show audio info profiles and exit\n"
68        "  --enum-servers          - Show a list of possible servers\n"
69       );
70
71 printf("\nCommands:\n\n");
72 printf(
73        "  help                    - Show this help\n"
74        "  sleep TIME              - Sleeps for TIME seconds\n"
75#ifdef ROAR_HAVE_GETTIMEOFDAY
76        "  ping  NUM               - Do NUM pings using NOOP commands\n"
77#endif
78        "  whoami                  - Get own client ID\n"
79        "\n"
80        "  listaiprofiles          - list audio info profiles\n"
81        "  aiprofileget PROFILE    - show audio info profile PROFILE\n"
82        "\n"
83        "  standby, off            - Go into standby mode\n"
84        "  resume, on              - Go into active mode\n"
85        "  standbymode             - Show current standby mode\n"
86        "  exit                    - Quits the roard (must be used as last command)\n"
87        "  terminate               - Like exit but let the server up to serve still connected clients,\n"
88        "                            new clients cann't connect and the server terminates after the last\n"
89        "                            client disconnected\n"
90        "\n"
91        "  volume ID CHAN [scale S] V0 V1...\n"
92        "                          - Sets volume for stream ID\n"
93        "                            CHAN is the number of channels or 'mono' or 'stereo'\n"
94        "                            if mono or stereo is chosen roarctl trys to set\n"
95        "                            sensfull values for all channels even if the output\n"
96        "                            is has more channels.\n"
97        "                            An optional scale can be given using S.\n"
98        "                            all other args are the volumes of the channels\n"
99        "                            you may use integer or percent values.\n"
100        "                            percent values can floating points.\n"
101        "\n"
102        "  flag   ID FLAGS         - Sets flags FLAGS on stream ID. FLAGS may be a comma\n"
103        "                            separated list of flags.\n"
104        "  unflag ID FLAGS         - Unsets flags on a stream. See flag.\n"
105        "  toogleflag ID FLAGS     - Toggels flags on a stream. See flag.\n"
106        "  protectflag ID FLAGS    - Protects flags on a stream. Those flags can not be\n"
107        "                            changed anymore after the they got protected. See flag.\n"
108        "\n"
109        "  role ID ROLE            - Set role ROLE on stream ID.\n"
110        "\n"
111        "  kick TYPE ID            - Kicks object of TYPE with id ID\n"
112        "                            Types: client stream sample source\n"
113        "  newvirtual P D E R B C  - Adds a new virtual (child) stream\n"
114        "                            Parameters:\n"
115        "                             P: Parent stream ID, D: Direction,\n"
116        "                             E: codEc, R: sample Rate,\n"
117        "                             B: bits per sample, C: nummer of channels\n"
118        "\n"
119        "  metaget  ID TYPE        - Read meta date of type TYPE from stream ID\n"
120// TODO: document metaset here.
121        "  metasave ID FILE        - Saves meta data of stream ID to file FILE\n"
122        "  metaload ID FILE        - Loads meta data from file FILE and set it on stream ID\n"
123        "\n"
124        "  serverinfo              - Gets general information about the server\n"
125        "  servertime              - Gets server's time\n"
126        "  serveroinfo             - Gets Information about server output\n"
127        "  serveroinfo2 DIR        - Gets Information about server output for stream direction dir\n"
128        "\n"
129        "  serverstandards         - Gets list of server supported standards\n"
130        "\n"
131        "  listclients             - Gets Information about clients\n"
132        "  clientinfo ID           - Gets Information about client ID\n"
133        "  liststreams             - Gets Information about streams\n"
134        "  streaminfo ID           - Gets Information about stream ID\n"
135        "  allinfo                 - Get all infos\n"
136       );
137}
138
139int enum_servers (void) {
140 struct roar_server * list;
141 struct roar_server * c;
142 int flags    = ROAR_ENUM_FLAG_DESC|ROAR_ENUM_FLAG_LOCATION;
143 int dir      = -1;
144 int socktype = -1;
145 int i;
146
147 if ( (list = roar_enum_servers(flags, dir, socktype)) == NULL )
148  return -1;
149
150 printf("Server           Location         Description\n");
151 printf("----------------------------------------------------------------------\n");
152
153 for (i = 0; ; i++) {
154  c = &(list[i]);
155  printf("%-16s %-16s %s\n",
156             c->server      == NULL ? "(default)" : c->server,
157             c->location    == NULL ? ""          : c->location,
158             c->description == NULL ? ""          : c->description
159        );
160  if ( c->server == NULL )
161   break;
162 }
163
164 roar_enum_servers_free(list);
165
166 return 0;
167}
168
169#ifdef ROAR_HAVE_GETTIMEOFDAY
170int ping (struct roar_connection * con, int num) {
171 struct timeval         try, ans;
172 struct roar_message    m;
173 register int           ret;
174 int                    i;
175 double                 cur, min = 3600*1000, max = 0, sum = 0;
176
177 if ( num == 0 )
178  return 0;
179
180 for (i = 0; i < num; i++) {
181  memset(&m, 0, sizeof(m));
182
183  m.cmd = ROAR_CMD_NOOP;
184  m.datalen = 0;
185
186  // we use roar_req() directly here because of speed.
187  // roar_noop() does basicly the same but is a bit slower.
188
189  gettimeofday(&try, NULL);
190  ret = roar_req(con, &m, NULL);
191  gettimeofday(&ans, NULL);
192
193  if ( ret == -1 )
194   return -1;
195
196  while (ans.tv_sec > try.tv_sec) {
197   ans.tv_sec--;
198   ans.tv_usec += 1000000;
199  }
200  ans.tv_usec -= try.tv_usec;
201
202  printf("Pong from server: seq=%i time=%.3fms\n", i, (cur = ans.tv_usec/1000.0));
203
204  sum += cur;
205  if ( min > cur )
206   min = cur;
207  if ( cur > max )
208   max = cur;
209
210  if ( i != (num - 1) )
211   roar_sleep(1);
212 }
213
214 printf("\n--- ping statistics ---\n");
215 printf("%i packets transmitted\n", i);
216 printf("rtt min/avg/max = %.3f/%.3f/%.3f ms\n", min, sum/(double)i, max);
217
218 return 0;
219}
220#endif
221
222#define _pm(m,n) if ( info->m != NULL ) printf("Server %-15s: %s\n", (n), (info->m));
223void server_info (struct roar_connection * con) {
224 struct roar_server_info * info = roar_server_info(con);
225
226 if ( info == NULL ) {
227  fprintf(stderr, "Error: can not get server info\n");
228  return;
229 }
230
231 _pm(version, "version");
232 _pm(location, "location");
233 _pm(description, "description");
234 _pm(contact, "contact");
235 _pm(serial, "serial");
236 _pm(address, "address");
237 _pm(uiurl, "UI URL");
238 _pm(un.sysname, "System sysname");
239 _pm(un.release, "System release");
240 _pm(un.nodename, "System nodename");
241 _pm(un.machine, "System machine");
242
243 roar_server_info_free(info);
244}
245#undef _pm
246
247void server_time (struct roar_connection * con) {
248 struct roar_time time;
249
250 if ( roar_get_time(con, &time) == -1 ) {
251  fprintf(stderr, "Error: can not get server time: %s\n", roar_error2str(roar_error));
252  return;
253 }
254
255 if ( g_verbose ) {
256  printf("Server time           : %llu.%06llu [+%llu/2^64] sec\n",
257         (long long unsigned int)time.t_sec,
258         (long long unsigned int) time.t_ssec / 18446744073709LLU,
259         (long long unsigned int) time.t_ssec);
260 } else {
261  printf("Server time           : %llu.%06llu sec\n",
262         (long long unsigned int)time.t_sec,
263         (long long unsigned int) time.t_ssec / 18446744073709LLU);
264 }
265 if ( time.c_freq )
266  printf("Server clock frequency: %f Hz\n", (float)time.c_freq / 1000000000.f);
267 if ( time.c_drift )
268  printf("Server clock drift    : %llu:2^64 (~10^%f)\n",
269         (long long unsigned int)time.c_drift, logf((float)time.c_drift)/2.302585f);
270}
271
272void server_oinfo (struct roar_connection * con, int dir) {
273 struct roar_stream s;
274
275 if ( roar_server_oinfo2(con, &s, dir) == -1 ) {
276  fprintf(stderr, "Error: can not get server output info\n");
277  return;
278 }
279
280 printf("Stream direction      : %s\n", roar_dir2str(s.dir));
281 printf("Server Output rate    : %i Hz\n", s.info.rate);
282 printf("Server Output bits    : %i\n", s.info.bits);
283 printf("Server Output channels: %i\n", s.info.channels);
284 printf("Server Output codec   : %i (%s%s)\n", s.info.codec, roar_codec2str(s.info.codec),
285                                     s.info.codec == ROAR_CODEC_DEFAULT ? " native" : "");
286// printf("Server Output rate: %i", s.info.rate);
287  if ( g_verbose > 1 && s.pos != (uint32_t)-1 )
288   printf("Server Position       : %lu S (%.3fs)\n", (unsigned long int) s.pos, (float)s.pos/(s.info.rate*s.info.channels));
289}
290
291void server_standards (struct roar_connection * con) {
292 struct roar_stds * stds;
293 size_t i;
294 int vendor, standard, version;
295 char numbuf[2][8];
296 const char * vendor_name;
297
298 if ( roar_caps_stds(con, &stds, NULL, -1) == -1 ) {
299  fprintf(stderr, "Error: can not get server standards\n");
300  return;
301 }
302
303 for (i = 0; i < stds->stds_len; i++) {
304  vendor   = ROAR_STD_VENDOR(stds->stds[i]);
305  standard = ROAR_STD_STD(stds->stds[i]);
306  version  = ROAR_STD_VERSION(stds->stds[i]);
307
308  if ( (vendor_name = roar_stds_vendor2str(vendor)) == NULL ) {
309   snprintf(numbuf[0], sizeof(numbuf[0]), "%i", vendor);
310   numbuf[0][sizeof(numbuf[0])-1] = 0;
311   vendor_name = numbuf[0];
312  }
313
314  if ( version == 0 ) {
315   numbuf[1][0] = 0;
316  } else {
317   snprintf(numbuf[1], sizeof(numbuf[1]), "-%i", version);
318   numbuf[1][sizeof(numbuf[1])-1] = 0;
319  }
320
321  printf("Server standard       : %s-%i%s\n", vendor_name, standard, numbuf[1]);
322 }
323}
324
325const char * proc_name (pid_t pid) {
326 static char ret[80] = "?";
327#ifdef __linux__
328 char file[80], buf[80], *r;
329 int  i;
330
331 snprintf(file, sizeof(file)-1, "/proc/%i/exe", pid);
332 file[sizeof(file)-1] = 0;
333
334 ret[0] = '?';
335 ret[1] = 0;
336
337 if ( (i = readlink(file, buf, sizeof(buf)-1)) != -1 ) {
338  buf[i] = 0;
339  if ( (r = strrchr(buf, '/')) != NULL ) {
340   r++;
341   if ( *r != 0 ) {
342    strncpy(ret, r, sizeof(ret)-1);
343    ret[sizeof(ret)-1] = 0;
344   }
345  }
346 }
347#else
348 (void)pid;
349#endif
350
351 return ret;
352}
353
354void list_clients (struct roar_connection * con) {
355 int i;
356 int num;
357 int id[ROAR_CLIENTS_MAX];
358
359 if ( (num = roar_list_clients(con, id, ROAR_CLIENTS_MAX)) == -1 ) {
360  fprintf(stderr, "Error: can not get client list\n");
361  return;
362 }
363
364 for (i = 0; i < num; i++) {
365  display_client(con, id[i]);
366 }
367}
368
369void display_client (struct roar_connection * con, int id) {
370 static int self_id = -1;
371 static struct roar_client   self_client_store;
372 static struct roar_client * self_client = NULL;
373 struct roar_client c;
374 char tmp[80];
375 int h;
376#ifdef _POSIX_USERS
377 struct group  * grp = NULL;
378 struct passwd * pwd = NULL;
379#endif
380
381 if ( self_id == -1 ) {
382  if ( (self_id = roar_get_clientid(con)) != -1 ) {
383   if ( roar_get_client(con, &self_client_store, self_id) == -1 ) {
384    self_id = -1;
385   } else {
386    self_client = &self_client_store;
387   }
388  }
389 }
390
391 printf("client %i:\n", id);
392 if ( roar_get_client(con, &c, id) == -1 ) {
393  fprintf(stderr, "Error: can not get client info\n");
394  return;
395 }
396
397 if ( c.name[0] != '\0' )
398  printf("Client name           : %s\n", c.name);
399  if ( roar_nnode_get_socktype(&(c.nnode)) != ROAR_SOCKET_TYPE_UNKNOWN ) {
400  if ( roar_nnode_to_str(&(c.nnode), tmp, sizeof(tmp)) == 0 ) {
401   printf("Client network node   : %s\n", tmp);
402  }
403 }
404
405 if ( c.pid != -1 ) {
406  if ( self_id != -1 && roar_nnode_cmp(&(self_client->nnode), &(c.nnode)) == 0 ) {
407   printf("Client PID            : %i(%s)\n", c.pid, proc_name(c.pid));
408  } else {
409   printf("Client PID            : %i\n", c.pid);
410  }
411 }
412 if ( c.uid != -1 ) {
413#ifdef _POSIX_USERS
414  if ( self_id != -1 && roar_nnode_cmp(&(self_client->nnode), &(c.nnode)) == 0 ) {
415   pwd = getpwuid(c.uid);
416   grp = getgrgid(c.gid);
417   printf("Client UID/GID        : %i(%s)/%i(%s)\n", c.uid, pwd ? pwd->pw_name : "?", c.gid, grp ? grp->gr_name : "?");
418  } else {
419#else
420  if ( 1 ) {
421#endif
422   printf("Client UID/GID        : %i/%i\n", c.uid, c.gid);
423  }
424 }
425
426 if ( g_verbose && c.proto != ROAR_PROTO_NONE ) {
427  printf("Client Protocol       : %s\n", roar_proto2str(c.proto));
428 }
429
430 if ( g_verbose && c.byteorder != ROAR_BYTEORDER_UNKNOWN ) {
431  if ( c.byteorder == ROAR_BYTEORDER_NETWORK ) {
432   roar_mm_strscpy(tmp, " (network byteorder");
433  } else {
434   *tmp = 0;
435  }
436
437  if ( c.byteorder == ROAR_BYTEORDER_NATIVE ) {
438   if ( *tmp ) {
439    roar_mm_strscat(tmp, ", native");
440   } else {
441    roar_mm_strscpy(tmp, " (native");
442   }
443  }
444
445  if ( *tmp )
446   roar_mm_strscat(tmp, ")");
447
448  printf("Client Byteorder      : %s%s\n", roar_byteorder2str(c.byteorder), tmp);
449 }
450
451 if ( c.execed != -1 )
452  printf("Execed stream         : %i\n", c.execed);
453
454 for (h = 0; h < ROAR_CLIENTS_MAX_STREAMS_PER_CLIENT; h++)
455  if ( c.streams[h] != -1 )
456   printf("stream                : %i\n", c.streams[h]);
457}
458
459void list_streams (struct roar_connection * con) {
460 int i;
461 int num;
462 int id[ROAR_STREAMS_MAX];
463
464 if ( (num = roar_list_streams(con, id, ROAR_STREAMS_MAX)) == -1 ) {
465  fprintf(stderr, "Error: can not get stream list\n");
466  return;
467 }
468
469 for (i = 0; i < num; i++) {
470  display_stream(con, id[i]);
471 }
472}
473
474void display_stream (struct roar_connection * con, int id) {
475 char chanmap[ROAR_MAX_CHANNELS];
476 struct roar_stream s;
477 struct roar_stream_info info;
478 char buffer[1024];
479 char * flags = buffer;
480 char * name  = buffer;
481 char * infotext;
482 const char * mime;
483 size_t len;
484
485 printf("stream %i:\n", id);
486 if ( roar_get_stream(con, &s, id) == -1 ) {
487  fprintf(stderr, "Error: can not get stream info\n");
488  return;
489 }
490 printf("Stream direction      : %s\n", roar_dir2str(s.dir));
491
492 if ( roar_stream_get_name(con, &s, name, sizeof(buffer)) == 0 )
493  printf("Stream name           : %s\n", name);
494
495 if ( (int)s.pos_rel_id == -1 ) {
496  printf("Relativ position id   : none (stream not synchronized)\n");
497 } else if ( (int)s.pos_rel_id == id ) {
498  printf("Relativ position id   : %i (self synchronized)\n", s.pos_rel_id);
499 } else {
500  printf("Relativ position id   : %i (synchronized)\n", s.pos_rel_id);
501 }
502 if ( g_verbose > 1 && s.pos != (uint32_t)-1 ) {
503  if ( s.info.rate && s.info.channels ) {
504   printf("Position              : %lu S (%.3fs)\n", (unsigned long int) s.pos,
505                                   (float)s.pos/(s.info.rate*s.info.channels));
506  } else {
507   printf("Position              : %lu S\n", (unsigned long int) s.pos);
508  }
509 }
510
511 switch (s.dir) {
512  case ROAR_DIR_MIDI_IN:
513  case ROAR_DIR_MIDI_OUT:
514    infotext = " ticks/s";
515   break;
516  case ROAR_DIR_LIGHT_IN:
517  case ROAR_DIR_LIGHT_OUT:
518    infotext = " updates/s";
519   break;
520  default:
521    infotext = " Hz";
522 }
523 if ( s.info.rate )
524  printf("Stream sample rate    : %i%s\n", s.info.rate, infotext);
525 if ( s.info.bits )
526  printf("Stream bits           : %i\n", s.info.bits);
527 if ( s.info.channels )
528  printf("Stream channels       : %i\n", s.info.channels);
529
530 mime = roar_codec2mime(s.info.codec);
531 printf("Stream codec          : %2i (%s%s%s%s)\n", s.info.codec, roar_codec2str(s.info.codec),
532                                      s.info.codec == ROAR_CODEC_DEFAULT ? " native" : "",
533                                      mime == NULL ? "" : " mimetype:",
534                                      mime == NULL ? "" : mime
535                                     );
536 if ( roar_stream_get_info(con, &s, &info) != -1 ) {
537  if ( info.codec != s.info.codec ) {
538   mime = roar_codec2mime(info.codec);
539   printf("Streamed codec        : %2i (%s%s%s%s)\n", info.codec, roar_codec2str(info.codec),
540                                      info.codec == ROAR_CODEC_DEFAULT ? " native" : "",
541                                      mime == NULL ? "" : " mimetype:",
542                                      mime == NULL ? "" : mime
543                                     );
544  }
545
546  if ( g_verbose ) {
547   if ( info.block_size )
548    printf("Stream block size     : %i Byte\n", info.block_size);
549
550   printf("Underruns pre/post    : %i/%i\n",   info.pre_underruns, info.post_underruns);
551   if ( g_verbose > 1 )
552    printf("Stream delay          : %ims (%.2fm)\n",   (int)info.delay/1000, (info.delay*(float)_SPEED_OF_SOUND));
553
554   if ( g_verbose > 1 )
555    printf("Stream mixer          : %i\n",   info.mixer);
556
557   if ( g_verbose > 1 )
558    printf("Stream state          : %s\n",   roar_streamstate2str(info.state));
559
560   if ( g_verbose > 1 )
561    printf("Stream role           : %s\n",   roar_role2str(info.role));
562
563   *flags = 0;
564#define _strcat(dst,src) roar_mm_strlcat((dst),(src), sizeof(buffer))
565   if ( info.flags & ROAR_FLAG_PRIMARY )
566    _strcat(flags, "primary ");
567   if ( info.flags & ROAR_FLAG_SYNC )
568    _strcat(flags, "sync ");
569   if ( info.flags & ROAR_FLAG_OUTPUT )
570    _strcat(flags, "output ");
571   if ( info.flags & ROAR_FLAG_SOURCE )
572    _strcat(flags, "source ");
573   if ( info.flags & ROAR_FLAG_META )
574    _strcat(flags, "meta ");
575   if ( info.flags & ROAR_FLAG_AUTOCONF )
576    _strcat(flags, "autoconf ");
577   if ( info.flags & ROAR_FLAG_CLEANMETA )
578    _strcat(flags, "cleanmeta ");
579   if ( info.flags & ROAR_FLAG_HWMIXER )
580    _strcat(flags, "hwmixer ");
581   if ( info.flags & ROAR_FLAG_PAUSE )
582    _strcat(flags, "pause ");
583   if ( info.flags & ROAR_FLAG_MUTE )
584    _strcat(flags, "mute ");
585   if ( info.flags & ROAR_FLAG_MMAP )
586    _strcat(flags, "mmap ");
587   if ( info.flags & ROAR_FLAG_ANTIECHO )
588    _strcat(flags, "antiecho ");
589   if ( info.flags & ROAR_FLAG_VIRTUAL )
590    _strcat(flags, "virtual ");
591   if ( info.flags & ROAR_FLAG_RECSOURCE )
592    _strcat(flags, "recsource ");
593   if ( info.flags & ROAR_FLAG_PASSMIXER )
594    _strcat(flags, "passmixer ");
595   if ( info.flags & ROAR_FLAG_PRETHRU )
596    _strcat(flags, "prethru ");
597   if ( info.flags & ROAR_FLAG_IMMUTABLE )
598    _strcat(flags, "immutable ");
599   if ( info.flags & ROAR_FLAG_ENHANCE )
600    _strcat(flags, "enhance ");
601   if ( info.flags & ROAR_FLAG_SINGLESINK )
602    _strcat(flags, "singlesink ");
603#undef _strcat
604
605   printf("Flags                 : %s\n", flags);
606  }
607 }
608
609 if ( g_verbose ) {
610  len = ROAR_MAX_CHANNELS;
611  if ( roar_stream_get_chanmap(con, &s, chanmap, &len) == -1 ) {
612   fprintf(stderr, "Error: can not get stream channel map\n");
613  } else {
614   if ( roardsp_chanlist2str(chanmap, len, buffer, 1024) == -1 ) {
615    fprintf(stderr, "Error: can not convert channel map into string\n");
616   } else {
617    printf("Channel Map           : %s\n", buffer);
618   }
619  }
620 }
621
622 if ( s.dir != ROAR_DIR_THRU ) {
623  display_mixer(con, id);
624  show_meta_all(con, id);
625 }
626}
627
628int display_mixer (struct roar_connection * con, int stream) {
629 struct roar_mixer_settings mixer;
630 int channels;
631 int i;
632 float fs;
633
634 if ( roar_get_vol(con, stream, &mixer, &channels) == -1 ) {
635  fprintf(stderr, "Error: can not get stream mixer info for stream %i\n", stream);
636  return -1;
637 }
638
639#ifdef ROAR_HAVE_LIBM
640#define _DB ", %.2fdB"
641#else
642#define _DB ""
643#endif
644
645 fs = (float)mixer.scale / 100.;
646
647 if ( channels ) { // we hide RPG info for zero-channel streams
648  printf("Mixer ReplayGain      : %i/%i (%.2f%%" _DB ")\n", mixer.rpg_mul, mixer.rpg_div,
649                                                          100.*(float)mixer.rpg_mul/((float)mixer.rpg_div)
650#ifdef ROAR_HAVE_LIBM
651                           , 20*log10f((float)mixer.rpg_mul/(float)mixer.rpg_div)
652#endif
653        );
654 }
655
656 for (i = 0; i < channels; i++)
657  printf("Mixer volume chan %2i  : %i/%i (%.2f%%" _DB ")\n", i, mixer.mixer[i], mixer.scale,
658                           (float)mixer.mixer[i]/fs
659#ifdef ROAR_HAVE_LIBM
660                          , 20*log10f((float)mixer.mixer[i]/(float)mixer.scale)
661#endif
662        );
663
664 return 0;
665}
666
667static unsigned int set_mixer_parse_volume (char * k, int len, uint16_t scale) {
668 float fs = scale;
669
670 switch (k[len - 1]) {
671  case '%':
672    k[len - 1] = 0;
673    return (atof(k)*fs)/100.;
674   break;
675#ifdef ROAR_HAVE_LIBM
676  case 'b':
677  case 'B':
678    // TODO: can we hanle the error better?
679    if ( len < 2 )
680     return 0;
681
682    k[len - 2] = 0;
683    return powf(10, atof(k)/20.f)*fs;
684   break;
685#endif
686 }
687
688 return atoi(k);
689}
690
691int set_mixer (struct roar_connection * con, int * cur, int max, char * arg[]) {
692 uint16_t scale = 65535;
693 int chans = 0;
694 int id;
695 int i;
696 int len;
697 int old_chans;
698 char * k;
699 struct roar_mixer_settings mixer;
700 struct roar_mixer_settings old_mixer;
701 int mode = ROAR_SET_VOL_ALL;
702
703 if (*cur + 2 > max)
704  return -1;
705
706 id = atoi(arg[++(*cur)]);
707
708 k = arg[++(*cur)];
709
710 if ( !strcmp(arg[*cur + 1], "scale") ) {
711  (*cur)++; // 'scale'
712  (*cur)++;
713  scale = set_mixer_parse_volume(arg[*cur], strlen(arg[*cur]), 65535);
714 }
715
716 mixer.scale = scale;
717
718 if ( roar_get_vol(con, id, &old_mixer, &old_chans) == -1 ) {
719  fprintf(stderr, "Error: can not get stream mixer info for stream %i\n", id);
720  return -1;
721 }
722
723 if ( strcmp(k, "mono") == 0 ) {
724  chans = 1;
725  mode  = ROAR_SET_VOL_UNMAPPED;
726 } else if ( strcmp(k, "stereo") == 0 ) {
727  chans = 2;
728  mode  = ROAR_SET_VOL_UNMAPPED;
729 } else {
730  chans = atoi(k);
731 }
732
733 // ensure most simple mode:
734 if ( old_chans == chans && mode == ROAR_SET_VOL_UNMAPPED )
735  mode = ROAR_SET_VOL_ALL;
736
737 if ( *cur + chans > max )
738  return -1;
739
740 for (i = 0; i < chans; i++) {
741  k   = arg[++(*cur)];
742  len = strlen(k);
743
744  mixer.mixer[i] = set_mixer_parse_volume(k, len, scale);
745 }
746
747 if ( roar_set_vol2(con, id, &mixer, chans, mode) == 0 )
748  return 0;
749
750 // no fallback if already using ROAR_SET_VOL_ALL:
751 if ( mode == ROAR_SET_VOL_ALL )
752  return -1;
753
754 if ( roar_conv_volume(&mixer, &mixer, old_chans, chans) == -1 )
755  return -1;
756
757 chans = old_chans;
758 mode  = ROAR_SET_VOL_ALL;
759
760 if ( roar_set_vol2(con, id, &mixer, chans, mode) == 0 )
761  return 0;
762
763 return -1;
764}
765
766
767int newvirtual (struct roar_connection * con, char *p_s, char *d_s, char *e_s, char *r_s, char *b_s, char *c_s) {
768 struct roar_stream s;
769 int dir    = roar_str2dir(d_s);
770 int parent = atoi(p_s);
771
772 ROAR_DBG("newvirtual(*): dir=%i, parent=%i", dir, parent);
773
774 if ( roar_stream_new(&s, atoi(r_s), atoi(c_s), atoi(b_s), roar_str2codec(e_s)) == -1 )
775  return -1;
776
777 return roar_simple_connect_virtual(con, &s, parent, dir);
778}
779
780int set_meta (struct roar_connection * con, int id, char * mode, char * type, char * val) {
781 struct roar_meta   meta;
782 struct roar_stream s;
783 int mode_i = ROAR_META_MODE_SET;
784
785 if ( roar_stream_new_by_id(&s, id) == -1 )
786  return -1;
787
788// printf("set_meta(*): mode='%s', type='%s', val='%s'\n", mode, type, val);
789
790 if ( strcmp(mode, "add") == 0 ) {
791  mode_i = ROAR_META_MODE_ADD;
792 }
793
794 meta.type   = roar_meta_inttype(type);
795 meta.value  = val;
796 meta.key[0] = 0;
797
798 if ( meta.type == -1 ) {
799  fprintf(stderr, "Error: unknown type: %s\n", type);
800  return -1;
801 }
802
803// printf("D: type=%i, mode=%i\n", meta.type, mode_i);
804
805 if ( roar_stream_meta_set(con, &s, mode_i, &meta) == -1 )
806  return -1;
807
808 meta.type  = ROAR_META_TYPE_NONE;
809 meta.value = NULL;
810
811 return roar_stream_meta_set(con, &s, ROAR_META_MODE_FINALIZE, &meta);
812}
813
814int load_meta (struct roar_connection * con, int id, char * file) {
815 struct roar_meta   meta;
816 struct roar_stream s;
817 int mode_i = ROAR_META_MODE_SET;
818 FILE * in;
819 char lion[1024];
820 char * v;
821
822 if ( roar_stream_new_by_id(&s, id) == -1 )
823  return -1;
824
825 if ( (in = fopen(file, "r")) == NULL )
826  return -1;
827
828 while (fgets(lion, 1024, in) != NULL) {
829  if ( (v = strtok(lion, "\r\n")) != NULL )
830   if ( (v = strtok(NULL, "\r\n")) != NULL )
831    *(v-1) = 0;
832
833  if ( (v = strstr(lion, "=")) == NULL ) {
834   fprintf(stderr, "Error: can not parse meta data lion: %s\n", lion);
835   continue;
836  }
837
838  *v++ = 0;
839
840  meta.type   = roar_meta_inttype(lion);
841  meta.value  = v;
842  meta.key[0] = 0;
843
844  if ( meta.type == -1 ) {
845   fprintf(stderr, "Error: unknown type: %s\n", lion);
846   continue;
847  }
848
849  if ( roar_stream_meta_set(con, &s, mode_i, &meta) == -1 ) {
850   fclose(in);
851   return -1;
852  }
853 }
854
855 fclose(in);
856
857 meta.type  = ROAR_META_TYPE_NONE;
858 meta.value = NULL;
859
860 return roar_stream_meta_set(con, &s, ROAR_META_MODE_FINALIZE, &meta);
861}
862
863int show_meta_type (struct roar_connection * con, int id, char * type) {
864 struct roar_meta   meta;
865 struct roar_stream s;
866
867 if ( roar_stream_new_by_id(&s, id) == -1 )
868  return -1;
869
870 meta.type  = roar_meta_inttype(type);
871
872 if ( meta.type == -1 ) {
873  fprintf(stderr, "Error: unknown type: %s\n", type);
874  return -1;
875 }
876
877 if ( roar_stream_meta_get(con, &s, &meta) == -1 )
878  return -1;
879
880 printf("Meta %-17s: %s\n", roar_meta_strtype(meta.type), meta.value);
881
882 roar_meta_free(&meta);
883
884 return 0;
885}
886
887int show_meta_all (struct roar_connection * con, int id) {
888 struct roar_stream s;
889 int types[ROAR_META_MAX_PER_STREAM];
890 int i;
891 int len;
892
893 if ( roar_stream_new_by_id(&s, id) == -1 )
894  return -1;
895
896 if ( (len = roar_stream_meta_list(con, &s, types, ROAR_META_MAX_PER_STREAM)) == -1 )
897  return -1;
898
899 for (i = 0; i < len; i++)
900  show_meta_type(con, id, roar_meta_strtype(types[i]));
901
902 return 0;
903}
904
905int save_meta (struct roar_connection * con, int id, char * file) {
906 struct roar_stream s;
907 struct roar_meta   meta;
908 int types[ROAR_META_MAX_PER_STREAM];
909 int i;
910 int len;
911 FILE * out;
912
913 if ( roar_stream_new_by_id(&s, id) == -1 )
914  return -1;
915
916 if ( (len = roar_stream_meta_list(con, &s, types, ROAR_META_MAX_PER_STREAM)) == -1 )
917  return -1;
918
919 if ( (out = fopen(file, "w")) == NULL )
920  return -1;
921
922 for (i = 0; i < len; i++) {
923/*
924  show_meta_type(con, id, roar_meta_strtype(types[i]));
925*/
926  meta.type  = types[i];
927
928  if ( roar_stream_meta_get(con, &s, &meta) == -1 )
929   continue;
930
931//  printf("Meta %-17s: %s\n", roar_meta_strtype(meta.type), meta.value);
932
933  fprintf(out, "%s=%s\n", roar_meta_strtype(meta.type), meta.value);
934
935  roar_meta_free(&meta);
936 }
937
938 fclose(out);
939
940 return 0;
941}
942
943int set_flags (struct roar_connection * con, int id, int action, char * flags) {
944 uint32_t f = ROAR_FLAG_NONE;
945 char * c;
946 struct roar_stream s[1];
947
948 if ( roar_stream_new_by_id(s, id) == -1 )
949  return -1;
950
951 c = strtok(flags, ",");
952 while (c != NULL) {
953  if ( !strcmp(c, "meta") ) {
954   f |= ROAR_FLAG_META;
955  } else if ( !strcmp(c, "primary") ) {
956   f |= ROAR_FLAG_PRIMARY;
957  } else if ( !strcmp(c, "sync") ) {
958   f |= ROAR_FLAG_SYNC;
959  } else if ( !strcmp(c, "cleanmeta") ) {
960   f |= ROAR_FLAG_CLEANMETA;
961  } else if ( !strcmp(c, "hwmixer") ) {
962   f |= ROAR_FLAG_HWMIXER;
963  } else if ( !strcmp(c, "pause") ) {
964   f |= ROAR_FLAG_PAUSE;
965  } else if ( !strcmp(c, "mute") ) {
966   f |= ROAR_FLAG_MUTE;
967  } else if ( !strcmp(c, "mmap") ) {
968   f |= ROAR_FLAG_MMAP;
969  } else if ( !strcmp(c, "antiecho") ) {
970   f |= ROAR_FLAG_ANTIECHO;
971  } else if ( !strcmp(c, "recsource") ) {
972   f |= ROAR_FLAG_RECSOURCE;
973  } else if ( !strcmp(c, "passmixer") ) {
974   f |= ROAR_FLAG_PASSMIXER;
975  } else if ( !strcmp(c, "virtual") ) {
976   f |= ROAR_FLAG_VIRTUAL;
977  } else if ( !strcmp(c, "prethru") ) {
978   f |= ROAR_FLAG_PRETHRU;
979  } else if ( !strcmp(c, "immutable") ) {
980   f |= ROAR_FLAG_IMMUTABLE;
981  } else if ( !strcmp(c, "enhance") ) {
982   f |= ROAR_FLAG_ENHANCE;
983  } else if ( !strcmp(c, "singlesink") ) {
984   f |= ROAR_FLAG_SINGLESINK;
985  } else {
986   fprintf(stderr, "Error: unknown flag: %s\n", c);
987   return -1;
988  }
989
990  c = strtok(NULL, ",");
991 }
992
993 return roar_stream_set_flags2(con, s, f, action);
994}
995
996int set_role (struct roar_connection * con, int id, int role) {
997 struct roar_stream s;
998
999 if ( id == -1 )
1000  return -1;
1001
1002 if ( roar_stream_new_by_id(&s, id) == -1 )
1003  return -1;
1004
1005 if ( roar_stream_set_role(con, &s, role) == -1 )
1006  return -1;
1007
1008 return 0;
1009}
1010
1011int show_aiprofile (const char * profile) {
1012 struct roar_audio_info info;
1013 const char * mime;
1014
1015 if ( roar_profile2info(&info, profile) == -1 ) {
1016  fprintf(stderr, "Error: unknown profile: %s\n", profile);
1017  return -1;
1018 }
1019
1020 mime = roar_codec2mime(info.codec);
1021
1022 printf("Profile Name          : %s\n", profile);
1023
1024 if ( info.rate )
1025  printf("Profile sample rate   : %i\n", info.rate);
1026 if ( info.bits )
1027  printf("Profile bits          : %i\n", info.bits);
1028 if ( info.channels )
1029  printf("Profile channels      : %i\n", info.channels);
1030
1031 printf("Profile codec         : %2i (%s%s%s%s)\n", info.codec, roar_codec2str(info.codec),
1032                                       info.codec == ROAR_CODEC_DEFAULT ? " native" : "",
1033                                       mime == NULL ? "" : " mimetype:",
1034                                       mime == NULL ? "" : mime);
1035
1036 return 0;
1037}
1038
1039int list_aiprofiles (void) {
1040 const char * list[1024];
1041 ssize_t ret;
1042 ssize_t i;
1043
1044 ret = roar_profiles_list(list, 1024, 0);
1045
1046 if ( ret == -1 ) {
1047  fprintf(stderr, "Error: can not read list of profiles\n");
1048  return -1;
1049 }
1050
1051 for (i = 0; i < ret; i++) {
1052  printf("profile %lli:\n", (long long signed int)i);
1053  show_aiprofile(list[i]);
1054 }
1055
1056 return 0;
1057}
1058
1059int main (int argc, char * argv[]) {
1060 struct roar_connection con;
1061 char * server   = NULL;
1062 char * k = NULL;
1063 int    i;
1064 int    t = 0;
1065
1066 for (i = 1; i < argc; i++) {
1067  k = argv[i];
1068
1069  if ( strcmp(k, "--server") == 0 ) {
1070   server = argv[++i];
1071  } else if ( strcmp(k, "-v") == 0 || strcmp(k, "--verbose") == 0 ) {
1072   g_verbose++;
1073  } else if ( strcmp(k, "--help") == 0 ) {
1074   usage();
1075   return 0;
1076  } else if ( strcmp(k, "--list-aiprofiles") == 0 ) {
1077   list_aiprofiles();
1078   return 0;
1079  } else if ( strcmp(k, "--enum-servers") == 0 ) {
1080   enum_servers();
1081   return 0;
1082  } else if ( *k == '-' ) {
1083   fprintf(stderr, "Error: unknown argument: %s\n", k);
1084   usage();
1085   return 1;
1086  } else {
1087   break;
1088  }
1089 }
1090
1091 // connect
1092
1093 if ( roar_simple_connect(&con, server, "roarctl") == -1 ) {
1094  fprintf(stderr, "Error: Can not connect to server\n");
1095  return 1;
1096 }
1097
1098 if ( i == argc ) {
1099  fprintf(stderr, "Error: No Commands given\n");
1100  return 0; // this is not a fatal error...
1101 }
1102
1103 for (; i < argc; i++) {
1104  k = argv[i];
1105  // cmd is in k
1106
1107  printf("--- [ %s ] ---\n", k);
1108
1109  if ( !strcmp(k, "help") ) {
1110   usage();
1111
1112  } else if ( !strcmp(k, "sleep") ) {
1113   roar_sleep(atoi(argv[++i]));
1114
1115  } else if ( !strcmp(k, "ping") ) {
1116#ifdef ROAR_HAVE_GETTIMEOFDAY
1117   if ( ping(&con, atoi(argv[++i])) == -1 ) {
1118    fprintf(stderr, "Error: can not ping\n");
1119   }
1120#else
1121    fprintf(stderr, "Error: ping not supported.\n");
1122    i++;
1123#endif
1124
1125  } else if ( !strcmp(k, "standby") || !strcmp(k, "off") ) {
1126   if ( roar_set_standby(&con, ROAR_STANDBY_ACTIVE) == -1 ) {
1127    fprintf(stderr, "Error: can not set mode to standby\n");
1128   } else {
1129    printf("going into standby\n");
1130   }
1131  } else if ( !strcmp(k, "resume") || !strcmp(k, "on") ) {
1132   if ( roar_set_standby(&con, ROAR_STANDBY_INACTIVE) == -1 ) {
1133    fprintf(stderr, "Error: can not set mode to active\n");
1134   } else {
1135    printf("going into active mode\n");
1136   }
1137
1138  } else if ( !strcmp(k, "exit") ) {
1139   if ( roar_terminate(&con, 0) == -1 ) {
1140    fprintf(stderr, "Error: can not quit server\n");
1141   } else {
1142    printf("Server quited\n");
1143    break;
1144   }
1145  } else if ( !strcmp(k, "terminate") ) {
1146   if ( roar_terminate(&con, 1) == -1 ) {
1147    fprintf(stderr, "Error: can not terminate server\n");
1148   } else {
1149    printf("Server got asked to quited\n");
1150    break;
1151   }
1152
1153  } else if ( !strcmp(k, "standbymode") ) {
1154   t = roar_get_standby(&con);
1155   if ( t == -1 ) {
1156    fprintf(stderr, "Error: can not get stanby mode\n");
1157   } else if ( t == ROAR_STANDBY_ACTIVE ) {
1158    printf("Server is in standby\n");
1159   } else if ( t == ROAR_STANDBY_INACTIVE ) {
1160    printf("Server is active\n");
1161   } else {
1162    fprintf(stderr, "Error: unknown standby mode: %i\n", t);
1163   }
1164
1165  } else if ( !strcmp(k, "whoami") ) {
1166   printf("My client ID is: %i\n", roar_get_clientid(&con));
1167  } else if ( !strcmp(k, "serverinfo") ) {
1168   server_info(&con);
1169  } else if ( !strcmp(k, "servertime") ) {
1170   server_time(&con);
1171  } else if ( !strcmp(k, "serveroinfo") ) {
1172   server_oinfo(&con, -1);
1173  } else if ( !strcmp(k, "serveroinfo2") ) {
1174   t = roar_str2dir(argv[++i]);
1175   if ( t == -1 ) {
1176    fprintf(stderr, "Error: unknown stream direction: %s\n", argv[i]);
1177   } else {
1178    server_oinfo(&con, t);
1179   }
1180  } else if ( !strcmp(k, "serverstandards") ) {
1181   server_standards(&con);
1182  } else if ( !strcmp(k, "listclients") ) {
1183   list_clients(&con);
1184  } else if ( !strcmp(k, "clientinfo") ) {
1185   display_client(&con, atoi(argv[++i]));
1186  } else if ( !strcmp(k, "liststreams") ) {
1187   list_streams(&con);
1188  } else if ( !strcmp(k, "streaminfo") ) {
1189   display_stream(&con, atoi(argv[++i]));
1190  } else if ( !strcmp(k, "allinfo") ) {
1191   server_oinfo(&con, -1);
1192   printf("\n");
1193   list_clients(&con);
1194   printf("\n");
1195   list_streams(&con);
1196
1197  } else if ( !strcmp(k, "kick") ) {
1198   t = roar_str2ot((k = argv[++i]));
1199   if ( t == -1 ) {
1200    fprintf(stderr, "Error: unknown type: %s\n", k);
1201    continue;
1202   }
1203   //t = atoi(argv[i++]);
1204   if ( roar_kick(&con, t, atoi(argv[++i])) == -1 ) {
1205    fprintf(stderr, "Error: can not kick %s\n", k);
1206   } else {
1207    printf("%s kicked\n", k);
1208   }
1209
1210  } else if ( !strcmp(k, "newvirtual") ) {
1211   if ( newvirtual(&con, argv[i+1], argv[i+2], argv[i+3], argv[i+4], argv[i+5], argv[i+6]) == -1 ) {
1212    fprintf(stderr, "Error: can not create new virtual stream\n");
1213   } else {
1214    printf("virtual stream created\n");
1215   }
1216   i += 6;
1217
1218  } else if ( !strcmp(k, "volume") ) {
1219   if ( set_mixer(&con, &i, argc, argv) == -1 ) {
1220    fprintf(stderr, "Error: can not set volume\n");
1221   } else {
1222    printf("volume changed\n");
1223   }
1224
1225  } else if ( !strcmp(k, "flag") ) {
1226   i++;
1227   if ( set_flags(&con, atoi(argv[i]), ROAR_SET_FLAG, argv[i+1]) == -1 ) {
1228    fprintf(stderr, "Error: can not set flags\n");
1229   } else {
1230    printf("flags changed\n");
1231   }
1232   i++;
1233  } else if ( !strcmp(k, "unflag") ) {
1234   i++;
1235   if ( set_flags(&con, atoi(argv[i]), ROAR_RESET_FLAG, argv[i+1]) == -1 ) {
1236    fprintf(stderr, "Error: can not reset flags\n");
1237   } else {
1238    printf("flags changed\n");
1239   }
1240   i++;
1241  } else if ( !strcmp(k, "toggleflag") ) {
1242   i++;
1243   if ( set_flags(&con, atoi(argv[i]), ROAR_TOGGLE_FLAG, argv[i+1]) == -1 ) {
1244    fprintf(stderr, "Error: can not toggle flags\n");
1245   } else {
1246    printf("flags changed\n");
1247   }
1248   i++;
1249  } else if ( !strcmp(k, "protectflag") ) {
1250   i++;
1251   if ( set_flags(&con, atoi(argv[i]), ROAR_NOOP_FLAG|ROAR_PROTECT_FLAG, argv[i+1]) == -1 ) {
1252    fprintf(stderr, "Error: can not protect flags\n");
1253   } else {
1254    printf("flags protected\n");
1255   }
1256   i++;
1257
1258  } else if ( !strcmp(k, "role") ) {
1259   i++;
1260   if ( set_role(&con, atoi(argv[i]), roar_str2role(argv[i+1])) == -1 ) {
1261    fprintf(stderr, "Error: can not set stream role\n");
1262   } else {
1263    printf("stream role set\n");
1264   }
1265   i++;
1266
1267  } else if ( !strcmp(k, "metaset") ) {
1268   i++;
1269   if ( set_meta(&con, atoi(argv[i]), argv[i+1], argv[i+2], argv[i+3]) == -1 ) {
1270    fprintf(stderr, "Error: can not set meta data\n");
1271   } else {
1272    printf("meta data changed\n");
1273   }
1274   i += 3;
1275  } else if ( !strcmp(k, "metaget") ) {
1276   i++;
1277   if ( show_meta_type(&con, atoi(argv[i]), argv[i+1]) == -1 ) {
1278    fprintf(stderr, "Error: can not get meta data\n");
1279   }
1280   i++;
1281  } else if ( !strcmp(k, "metasave") ) {
1282   i++;
1283   if ( save_meta(&con, atoi(argv[i]), argv[i+1]) == -1 ) {
1284    fprintf(stderr, "Error: can not get meta data\n");
1285   } else {
1286    printf("meta data saved\n");
1287   }
1288   i++;
1289  } else if ( !strcmp(k, "metaload") ) {
1290   i++;
1291   if ( load_meta(&con, atoi(argv[i]), argv[i+1]) == -1 ) {
1292    fprintf(stderr, "Error: can not set meta data\n");
1293   } else {
1294    printf("meta data saved\n");
1295   }
1296   i++;
1297
1298
1299  } else if ( !strcmp(k, "listaiprofiles") || !strcmp(k, "listprofiles") ) {
1300   if ( list_aiprofiles() == -1 ) {
1301    fprintf(stderr, "Error: can not list profiles\n");
1302   }
1303  } else if ( !strcmp(k, "aiprofileget") || !strcmp(k, "profileget") ) {
1304   i++;
1305   if ( show_aiprofile(argv[i]) == -1 ) {
1306    fprintf(stderr, "Error: can not get profile data\n");
1307   }
1308  } else {
1309   fprintf(stderr, "Error: invalid command: %s\n", k);
1310  }
1311
1312 }
1313
1314 roar_disconnect(&con);
1315
1316 return 0;
1317}
1318
1319//ll
Note: See TracBrowser for help on using the repository browser.