Alternatively, use the --afs_socket Option to specify a different
location for the afs command socket.
-For this first try, we'll use a debug level of two to make the
-output of para_server more verbose.
+For this first try, we'll use the info loglevel to make the output
+of para_server more verbose.
- para_server -l 2
+ para_server -l info
Now you can use para_client to connect to the server and issue
commands. Open a new shell (as "bar" on "client_host" in the above
will be described next. Try the following on client_host (assuming
Linux/ALSA and an mp3 stream):
- para_recv -l 2 -r 'http -i server_host' > file.mp3
+ para_recv -l info -r 'http -i server_host' > file.mp3
# (interrupt with CTRL+C after a few seconds)
ls -l file.mp3 # should not be empty
para_filter -f mp3dec -f wav < file.mp3 > file.wav
for help. Usually you have to specify only server_host as the receiver
specifier for each supported audio format, like this:
- para_audiod -l 2 -r 'mp3:http -i server_host'
+ para_audiod -l info -r 'mp3:http -i server_host'
The preferred way to use para_audiod is to run it once at system start
as an unprivileged user. para_audiod needs to create a "well-known"
man_binaries := $(BINARIES)
man_pages := $(patsubst %, man/man1/%.1, $(man_binaries))
man_pages_in := $(patsubst %, web/%.man.in.html, $(man_binaries))
+
ggo_dir := ggo
-gengetopts := $(wildcard $(ggo_dir)/*.ggo)
-gengetopts_c := $(patsubst %/,, $(gengetopts:.ggo=.cmdline.c))
-gengetopts_h := $(patsubst %/,, $(gengetopts:.ggo=.cmdline.h))
+
+m4_ggos := afh audioc audiod client filter fsck gui recv server write
+all_ggos := $(m4_ggos) dccp_recv oggdec_filter alsa_write fade http_recv \
+ osx_write udp_recv amp_filter compress_filter file_write \
+ grab_client mp3dec_filter
+ggo_generated := $(addsuffix .cmdline.c, $(all_ggos)) $(addsuffix .cmdline.h, $(all_ggos)) \
+ $(addsuffix .ggo, $(addprefix $(ggo_dir)/,$(m4_ggos)))
+
autocrap := config.h.in configure
tarball_pfx := @PACKAGE_TARNAME@-$(PACKAGE_VERSION)
tarball_delete = web versions pics .changelog_before_cvs .changelog_cvs .gitignore
tarball_delete := $(patsubst %,$(tarball_pfx)/%,$(tarball_delete))
-tarball_add := $(gengetopts_c) $(gengetopts_h) $(autocrap)
+tarball_add := $(ggo_generated) $(autocrap)
tarball := @PACKAGE_TARNAME@-$(PACKAGE_VERSION).tar.bz2
.PHONY: clean distclean maintainer-clean install man tarball
*.o: para.h config.h gcc-compat.h
include Makefile.deps
-include $(ggo_dir)/Makefile.ggo
+include $(ggo_dir)/makefile
%_command_list.c %_command_list.h: %.cmd
./command_util.sh c < $< >$@
mkdir -p man/man1
help2man -h --detailed-help -N -i audiod_command_list.man ./para_audiod > $@
-man/man1/para_filter.1: para_filter
- mkdir -p man/man1
- help2man -h --detailed-help -N ./$< > $@
-
-man/man1/para_write.1: para_write
- mkdir -p man/man1
- help2man -h --detailed-help -N ./$< > $@
-
-man/man1/para_recv.1: para_recv
- mkdir -p man/man1
- help2man -h --detailed-help -N ./$< > $@
-
man/man1/%.1: %
mkdir -p man/man1
- help2man -N ./$< > $@
+ help2man -h --detailed-help -N ./$< > $@
man/html/%.html: man/man1/%.1
mkdir -p man/html
rm -f GPATH GRTAGS GSYMS GTAGS
maintainer-clean: distclean
- rm -f $(gengetopts_c) $(gengetopts_h) *.tar.bz2 \
+ rm -f $(ggo_generated) *.tar.bz2 \
config.h configure \
config.h.in skencil/*.pdf skencil/*.ps
rm -f *_command_list.* *.man man/man1/*
0.3.4 (to be announced) "elliptic inheritance"
----------------------------------------------
-The new udp sender and various other improvements.
+The new udp sender, colored logs and various other improvements.
- The udp sender replaces the ortp sender. The new code is
both smaller and cleaner than the old ortp sender/receiver
libraries, it is built unconditionally. The default port
for udp streaming now defaults to 8000, like for the http
and the dccp senders/receivers.
+ - Loglevels are now specified as symbolic names, e.g.
+ "--loglevel info".
- para_server/para_audiod: Color support for log messages.
- new options for mp3dec: --ignore-crc, --bufsize
- new audiod option: --config-file.
+ - gengetopt cleanups.
- Improved help/man pages: The documentation of para_audiod,
para_recv, para_filter and para_write now also contains
all options of the available receivers/filters/writers. The
Troubles?
---------
-Use the debug loglevel (option -l 0 for most commands) to show
+Use the debug loglevel (option -l debug for most commands) to show
debugging info. Almost all paraslash executables have a brief online
help which is displayed by using the -h switch. The --detailed-help
option prints the full help text.
- grutatxt http://www.triptico.com/software/grutatxt.html
- doxygen http://www.stack.nl/~dimitri/doxygen/
- global ftp://ftp.gnu.org/pub/gnu/global
+ - m4: ftp://ftp.gnu.org/pub/gnu/m4/
const char *status_item_list[] = {STATUS_ITEM_ARRAY};
INIT_AFH_ERRLISTS;
-INIT_STDERR_LOGGING(conf.loglevel_arg)
+
+static int loglevel;
+INIT_STDERR_LOGGING(loglevel)
static void print_info(int audio_format_num, struct afh_info *afhi)
{
afh_cmdline_parser(argc, argv, &conf);
HANDLE_VERSION_FLAG("afh", conf);
+ loglevel = get_loglevel_by_name(conf.loglevel_arg);
ret = -E_AFH_SYNTAX;
if (conf.inputs_num == 0)
goto out;
/** the gengetopt structure containing command line args */
struct audioc_args_info conf;
-INIT_STDERR_LOGGING(conf.loglevel_arg);
+static int loglevel;
+INIT_STDERR_LOGGING(loglevel);
static char *concat_args(unsigned argc, char * const *argv)
{
exit(EXIT_FAILURE);
}
}
+ loglevel = get_loglevel_by_name(conf.loglevel_arg);
args = conf.inputs_num?
concat_args(conf.inputs_num, conf.inputs) :
para_strdup("stat");
PARA_EMERG_LOG("init stream io error: %s\n", para_strerror(-i));
exit(EXIT_FAILURE);
}
- log_welcome("para_audiod", conf.loglevel_arg);
+ log_welcome("para_audiod");
server_uptime(UPTIME_SET);
set_initial_status();
FOR_EACH_SLOT(i)
#
# Licensed under the GPL v2. For licencing details see COPYING.
-PC="para_client -l 5 -- "
+PC="para_client -l error -- "
__para_commandlist=
__para_sender_list=
.status = "supervisor task"
};
-INIT_STDERR_LOGGING(ct->conf.loglevel_arg);
+static int client_loglevel; /* loglevel */
+INIT_STDERR_LOGGING(client_loglevel);
/**
ret = client_open(argc, argv, &ct);
if (ret < 0) /* can not use PARA_LOG here because ct is NULL */
exit(EXIT_FAILURE);
+ client_loglevel = get_loglevel_by_name(ct->conf.loglevel_arg);
register_task(&svt);
ret = schedule(&s);
if (ret < 0)
goto out;
}
ret = 1;
- PARA_INFO_LOG("loglevel: %d\n", ct->conf.loglevel_arg);
+ PARA_INFO_LOG("loglevel: %s\n", ct->conf.loglevel_arg);
PARA_INFO_LOG("config_file: %s\n", ct->config_file);
PARA_INFO_LOG("key_file: %s\n", ct->key_file);
PARA_NOTICE_LOG("connecting %s:%d\n", ct->conf.hostname_arg,
"server_pid: %d\n"
"afs_pid: %d\n"
"connections (active/accepted/total): %u/%u/%u\n"
- "current loglevel: %i\n"
+ "current loglevel: %s\n"
"supported audio formats: %s\n"
"supported senders: %s\n"
"%s",
}
}
-static int get_loglevel_by_name(const char *txt, size_t n)
-{
- if (!strncasecmp(txt, "debug", n))
- return LL_DEBUG;
- if (!strncasecmp(txt, "info", n))
- return LL_INFO;
- if (!strncasecmp(txt, "notice", n))
- return LL_NOTICE;
- if (!strncasecmp(txt, "warning", n))
- return LL_WARNING;
- if (!strncasecmp(txt, "error", n))
- return LL_ERROR;
- if (!strncasecmp(txt, "crit", n))
- return LL_CRIT;
- if (!strncasecmp(txt, "emerg", n))
- return LL_EMERG;
- return -1;
-}
-
/**
* Set the color for one loglevel.
*
if (!p)
goto err;
- ret = get_loglevel_by_name(arg, p - arg);
+ ret = get_loglevel_by_name(arg);
if (ret < 0)
goto err;
ll = ret;
*
* \param loglevel The smallest level that should be logged.
*/
-void daemon_set_loglevel(int loglevel)
+void daemon_set_loglevel(char *loglevel)
{
- me->loglevel = loglevel;
+ int ret = get_loglevel_by_name(loglevel);
+
+ assert(ret >= 0);
+ me->loglevel = ret;
}
/**
/**
* Log the startup message containing the paraslash version.
*/
-void log_welcome(const char *whoami, int loglevel)
+void log_welcome(const char *whoami)
{
PARA_INFO_LOG("welcome to %s " PACKAGE_VERSION " ("BUILD_DATE")\n",
whoami);
- PARA_DEBUG_LOG("using loglevel %d\n", loglevel);
}
/**
void daemonize(void);
void daemon_open_log_or_die(void);
void daemon_close_log(void);
-void log_welcome(const char *whoami, int loglevel);
+void log_welcome(const char *whoami);
void drop_privileges_or_die(const char *username, const char *groupname);
/** used for server_uptime() */
enum uptime {UPTIME_SET, UPTIME_GET};
void daemon_set_logfile(char *logfile_name);
void daemon_set_flag(unsigned flag);
void daemon_clear_flag(unsigned flag);
-void daemon_set_loglevel(int loglevel);
+void daemon_set_loglevel(char *loglevel);
void daemon_set_default_log_colors(void);
int daemon_set_log_color(char const *arg);
/** Gengetopt struct that holds the command line args. */
static struct filter_args_info conf;
-INIT_STDERR_LOGGING(conf.loglevel_arg);
+static int loglevel;
+INIT_STDERR_LOGGING(loglevel);
static void open_filters(void)
{
ret = parse_config(argc, argv);
if (ret < 0)
goto out;
+ loglevel = get_loglevel_by_name(conf.loglevel_arg);
ret = init_filter_chain();
if (ret < 0)
goto out;
static struct fsck_args_info conf;
INIT_FSCK_ERRLISTS;
-INIT_STDERR_LOGGING(conf.loglevel_arg);
+
+static int loglevel;
+INIT_STDERR_LOGGING(loglevel);
/* taken from git */
signed char hexval_table[256] = {
goto out;
}
HANDLE_VERSION_FLAG("fsck", conf);
+ loglevel = get_loglevel_by_name(conf.loglevel_arg);
if (conf.base_dir_given)
base_dir = para_strdup(conf.base_dir_arg);
else {
base_dir? base_dir : "",
para_strerror(-ret)
);
- if (conf.loglevel_arg > 1)
- PARA_EMERG_LOG("re-run with \"--loglevel %d\" to increase verbosity\n",
- conf.loglevel_arg - 1);
} else
PARA_NOTICE_LOG("success\n");
if (base_dir)
+++ /dev/null
-module_ggo_opts := --set-version="($(PACKAGE_STRING), $(codename))"
-
-grab_client.cmdline.h grab_client.cmdline.c: $(ggo_dir)/grab_client.ggo
- gengetopt $(module_ggo_opts) \
- -S \
- --set-package=grab \
- --no-handle-help \
- --no-handle-error \
- --no-handle-version \
- --arg-struct-name=grab_client_args_info \
- --file-name=$(subst .ggo,,$(<F)).cmdline \
- --func-name $(subst .ggo,,$(<F))_cmdline_parser < $<
-
-%_recv.cmdline.h %_recv.cmdline.c: $(ggo_dir)/%_recv.ggo
- gengetopt $(module_ggo_opts) \
- --set-package=$(subst .ggo,,$(<F)) \
- --arg-struct-name=$(subst .ggo,,$(<F))_args_info \
- --file-name=$(subst .ggo,,$(<F)).cmdline \
- --func-name $(subst .ggo,,$(<F))_cmdline_parser < $<
-
-%_filter.cmdline.h %_filter.cmdline.c: $(ggo_dir)/%_filter.ggo
- gengetopt $(module_ggo_opts) \
- --set-package=$(subst .ggo,,$(<F)) \
- --arg-struct-name=$(subst .ggo,,$(<F))_args_info \
- --file-name=$(subst .ggo,,$(<F)).cmdline \
- --func-name $(subst _filter.ggo,,$(<F))_cmdline_parser < $<
-%_write.cmdline.h %_write.cmdline.c: $(ggo_dir)/%_write.ggo
- gengetopt -S $(module_ggo_opts) \
- --set-package=$(subst .ggo,,$(<F)) \
- --arg-struct-name=$(subst .ggo,,$(<F))_args_info \
- --file-name=$(subst .ggo,,$(<F)).cmdline \
- --func-name $(subst _write.ggo,,$(<F))_cmdline_parser < $<
-
-%.cmdline.h %.cmdline.c: $(ggo_dir)/%.ggo
- case $(<F) in client.ggo) O="--unamed-opts=command";; \
- audioc.ggo) O="--unamed-opts=command";; \
- fsck.ggo) O="--unamed-opts=table";; \
- afh.ggo) O="--unamed-opts=audio_file";; \
- recv.ggo) O="--no-handle-help";; \
- filter.ggo) O="--no-handle-help";; \
- write.ggo) O="--no-handle-help";; \
- audiod.ggo) O="--no-handle-help";; \
- esac; \
- if test $(<F) != fsck.ggo; then O="$$O --conf-parser "; fi; \
- gengetopt $$O \
- --no-handle-version \
- --file-name=$(*F).cmdline \
- --func-name $(*F)_cmdline_parser \
- --arg-struct-name=$(*F)_args_info \
- --set-package="para_$(subst .cmdline,,$(*F))" \
- --set-version="$(PACKAGE_VERSION)" < $<
-
+++ /dev/null
-text "
-para_afh, the audio format handler tool, is a stand-alone program
-contained in the paraslash package for analyzing and streaming audio
-files. It can be used to
-
- - print tech info about the given audio file to stdout.
- In particular, the 'chunk table' of the audio file, an array
- of offsets within the audio file, may be printed. This table
- can be used by other programs unaware of the particular audio
- format to stream the audio file.
-
- - write selected parts of the given audio file in complete
- chunks without decoding. Thus para_afh can be used to 'cut'
- an audio file.
-
- - write selected parts of the given audio files 'just in time'
- to sdout. This may be useful for third-party software that
- is capable of reading from stdin.
-"
-
-option "loglevel" l
-#~~~~~~~~~~~~~~~~~~
-"set loglevel (0-6)"
-int typestr="level"
-default="4"
-optional
-
-defgroup "mode"
-#--------------
-groupdesc="
- There are two modes of operation: Info mode and stream mode,
- one of which must be selected by the corresponding option.
- See below.
-"
-required
-
-groupoption "info" i
-#~~~~~~~~~~~~~~~~~~~
-"select info mode"
-group="mode"
-details="
- In this mode, the program prints technical information about
- the given audio file to stdout.
-"
-
-groupoption "stream" s
-#~~~~~~~~~~~~~~~~~~~~~
-"select stream mode"
-group="mode"
-details="
- If this mode is selected, the selected parts of the content
- of the audio file are written to stdout. Only complete chunks
- with respect of the underlying audio format are written.
- For example, only complete frames in case of mp3 files.
-"
-
-section "Options for info mode"
-#==============================
-
-option "chunk_table" c
-#~~~~~~~~~~~~~~~~~~~~~
-"print also the chunk table"
-flag off
-dependon="info"
-
-section "Options for stream mode"
-#================================
-
-
-option "begin_chunk" b
-#~~~~~~~~~~~~~~~~~~~~~
-"skip a number of chunks"
-int typestr="chunk_num"
-default="0"
-dependon="stream"
-optional
-details="
- The chunk_num argument must be between -num_chunks and
- num_chunks - 1 inclusively where num_chunks is the total number
- of chunks which is printed when using the --info option. If
- chunk_num is negative, the given number of chunks are counted
- backwards from the end of the file. For example --begin_chunk
- -100 instructs para_afh to start output at chunk num_chunks
- - 100. This is mainly useful for cutting off the end of an
- audio file.
-"
-
-option "end_chunk" e
-#~~~~~~~~~~~~~~~~~~~
-"only write up to chunk chunk_num"
-int typestr="chunk_num"
-dependon="stream"
-optional
-details="
- For the chunk_num argument the same rules as for --begin_chunk
- apply. The default is to write up to the last chunk.
-"
-
-option "just_in_time" j
-#~~~~~~~~~~~~~~~~~~~~~~
-"use timed writes"
-flag off
-dependon="stream"
-details="
- Write the specified chunks of data 'just in time', i.e. the
- write of each chunk is delayed until the time it is needed
- by the decoder/player in order to guarantee an uninterupted
- audio stream.
-"
-
-option "no_header" H
-#~~~~~~~~~~~~~~~~~~~
-"do not write an audio file header"
-flag off
-dependon="stream"
-details="
- If an audio format needs information about the audio file
- in a format-specific header in order to be understood by
- the decoding software, a suitable header is automatically
- send. This option changes the default behaviour, i.e. no
- header is written.
-"
--- /dev/null
+include(header.m4)
+<qu>
+text "
+para_afh, the audio format handler tool, is a stand-alone program
+contained in the paraslash package for analyzing and streaming audio
+files. It can be used to
+
+ - print tech info about the given audio file to stdout.
+ In particular, the 'chunk table' of the audio file, an array
+ of offsets within the audio file, may be printed. This table
+ can be used by other programs unaware of the particular audio
+ format to stream the audio file.
+
+ - write selected parts of the given audio file in complete
+ chunks without decoding. Thus para_afh can be used to 'cut'
+ an audio file.
+
+ - write selected parts of the given audio files 'just in time'
+ to sdout. This may be useful for third-party software that
+ is capable of reading from stdin.
+"
+</qu>
+
+include(loglevel.m4)
+
+<qu>
+defgroup "mode"
+#--------------
+groupdesc="
+ There are two modes of operation: Info mode and stream mode,
+ one of which must be selected by the corresponding option.
+ See below.
+"
+required
+
+groupoption "info" i
+#~~~~~~~~~~~~~~~~~~~
+"select info mode"
+group="mode"
+details="
+ In this mode, the program prints technical information about
+ the given audio file to stdout.
+"
+
+groupoption "stream" s
+#~~~~~~~~~~~~~~~~~~~~~
+"select stream mode"
+group="mode"
+details="
+ If this mode is selected, the selected parts of the content
+ of the audio file are written to stdout. Only complete chunks
+ with respect of the underlying audio format are written.
+ For example, only complete frames in case of mp3 files.
+"
+
+section "Options for info mode"
+#==============================
+
+option "chunk_table" c
+#~~~~~~~~~~~~~~~~~~~~~
+"print also the chunk table"
+flag off
+dependon="info"
+
+section "Options for stream mode"
+#================================
+
+
+option "begin_chunk" b
+#~~~~~~~~~~~~~~~~~~~~~
+"skip a number of chunks"
+int typestr="chunk_num"
+default="0"
+dependon="stream"
+optional
+details="
+ The chunk_num argument must be between -num_chunks and
+ num_chunks - 1 inclusively where num_chunks is the total number
+ of chunks which is printed when using the --info option. If
+ chunk_num is negative, the given number of chunks are counted
+ backwards from the end of the file. For example --begin_chunk
+ -100 instructs para_afh to start output at chunk num_chunks
+ - 100. This is mainly useful for cutting off the end of an
+ audio file.
+"
+
+option "end_chunk" e
+#~~~~~~~~~~~~~~~~~~~
+"only write up to chunk chunk_num"
+int typestr="chunk_num"
+dependon="stream"
+optional
+details="
+ For the chunk_num argument the same rules as for --begin_chunk
+ apply. The default is to write up to the last chunk.
+"
+
+option "just_in_time" j
+#~~~~~~~~~~~~~~~~~~~~~~
+"use timed writes"
+flag off
+dependon="stream"
+details="
+ Write the specified chunks of data 'just in time', i.e. the
+ write of each chunk is delayed until the time it is needed
+ by the decoder/player in order to guarantee an uninterupted
+ audio stream.
+"
+
+option "no_header" H
+#~~~~~~~~~~~~~~~~~~~
+"do not write an audio file header"
+flag off
+dependon="stream"
+details="
+ If an audio format needs information about the audio file
+ in a format-specific header in order to be understood by
+ the decoding software, a suitable header is automatically
+ send. This option changes the default behaviour, i.e. no
+ header is written.
+"
+</qu>
+++ /dev/null
-option "loglevel" l
-#~~~~~~~~~~~~~~~~~~
-"set loglevel (0-6)"
- int typestr="level"
- default="4"
- optional
-
-
-option "socket" s
-#~~~~~~~~~~~~~~~~
-"well-known socket (default=/var/paraslash/audiod.socket.$HOSTNAME)"
- string typestr="filename"
- optional
-
-
-option "bufsize" b
-#~~~~~~~~~~~~~~~~~
-"size of internal buffer"
- int typestr="bytes"
- default="8192"
- optional
--- /dev/null
+include(header.m4)
+include(loglevel.m4)
+option "socket" s
+#~~~~~~~~~~~~~~~~
+"well-known socket (default=/var/paraslash/audiod.socket.$HOSTNAME)"
+ string typestr="filename"
+ optional
+
+
+option "bufsize" b
+#~~~~~~~~~~~~~~~~~
+"size of internal buffer"
+ int typestr="bytes"
+ default="8192"
+ optional
+++ /dev/null
-#########################
-section "General options"
-#########################
-
-text "
- These options are identical to their counterparts in para_server
- and are discussed in detail there.
-"
-
-option "loglevel" l
-#~~~~~~~~~~~~~~~~~~
-"set loglevel (0-6)"
-int typestr="level"
-default="3"
-optional
-
-option "color" C
-#~~~~~~~~~~~~~~~
-"activate color output"
-enum typestr="when"
-values = "yes","no","auto"
-default = "auto"
-optional
-
-option "log_color" -
-#~~~~~~~~~~~~~~~~~~~
-"select a color for one type of log message"
-string typestr="color_spec"
-multiple
-optional
-details="
- Example: --log_color \"INFO:yellow black bold\"
-"
-
-option "config_file" c
-#~~~~~~~~~~~~~~~~~~~~~
-"(default='~/.paraslash/audiod.conf'"
-string typestr="filename"
-optional
-
-option "logfile" L
-#~~~~~~~~~~~~~~~~~
-"where to write log output"
-string typestr="filename"
-optional
-
-option "daemon" d
-#~~~~~~~~~~~~~~~~
-"run as background daemon"
-flag off
-dependon="logfile"
-
-option "user" u
-#~~~~~~~~~~~~~~
-"run as the given user"
-string typestr="name"
-optional
-
-option "group" g
-#~~~~~~~~~~~~~~~
-"set group id"
-string typestr="group"
-optional
-
-########################
-section "Audiod options"
-########################
-
-option "force" F
-#~~~~~~~~~~~~~~~
-"force startup"
-flag off
-details="
- If this flag is not given, para_audiod refuses to start if the
- well-known socket file (see the --socket option) already exists
- because this usually means that para_audiod is already running
- and listening on that socket. After a crash or if para_audiod
- received a SIGKILL signal, a stale socket file might remain and
- you have to use --force once to force startup of para_audiod.
-"
-
-option "mode" m
-#~~~~~~~~~~~~~~
-"startup mode"
-string typestr="mode"
-default="on"
-optional
-details="
- Para_audiod supports three modes of operation: On, off and
- standby (sb). This option selects the mode that should be
- used on startup. If para_audiod operates in \"on\" mode, it
- will connect to para_server in order to receive its status
- information. If para_server announces the availability of an
- audio stream, para_audiod will automatically download, decode
- and play the audio stream according to the given stream I/O
- options, see below.
-
- In \"standby\" mode, para_audiod will only receive the
- status information from para_server but will not download
- the audio stream.
-
- In \"off\" mode, para_audiod does not connect para_server at
- all, but still listens on the local socket for connections.
-"
-
-option "socket" s
-#~~~~~~~~~~~~~~~~
-"well-known socket"
-string typestr="filename"
-optional
-details="
- Para_audiod uses a \"well-known\" socket to listen
- on for connections from para_audioc. This socket is a
- special file in the file system; its location defaults to
- /var/paraslash/audiod_sock.<host_name>.
-
- para_audioc, the client program used to connect to para_audiod,
- opens this socket in order to talk to para_audiod. If the
- default value for para_audiod is changed, para_audioc must be
- instructed to use also \"filename\" for connecting para_audiod.
-"
-
-option "user_allow" -
-#~~~~~~~~~~~~~~~~~~~~
-"allow this uid"
-int typestr="uid"
-default="-1"
-optional
-multiple
-details="
- Allow the user identified by \"uid\" to connect to para_audiod.
- May be specified multiple times. If not specified at all,
- all users are allowed to connect.
-
- This feature requires unix socket credentials and is currently
- only supported on Linux systems. On other operating systems,
- the option is silently ignored and all local users are allowed
- to connect to para_audiod.
-"
-
-option "clock_diff_count" -
-#~~~~~~~~~~~~~~~~~~~~~~~~~~
-"sync clock on startup"
-int typestr="count"
-default="0"
-optional
-details="
- Check the clock difference between the host running para_server
- and the local host running para_audiod that many times before
- starting any stream I/0. Set this to non-zero for non-local
- setups if the clocks of these two hosts are not syncronized
- by ntp or similar.
-"
-
-#############################
-section "Stream I/O options"
-#############################
-
-option "receiver" r
-#~~~~~~~~~~~~~~~~~~
-"select receiver"
-string typestr="receiver_spec"
-default="http"
-optional
-multiple
-details="
- This option may be given multiple times, once for each
- supported audio format. The \"receiver_spec\" consists of
- an audio format and the receiver name, separated by a colon,
- and any options for that receiver, seperated by whitespace.
- If any receiver options are present, the whole receiver
- argument must be quoted.
-
- Example:
-
- -r 'mp3:http -i my.host.org -p 8009'
-"
-
-
-option "no_default_filters" D
-#~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-"Configure filters manually"
-flag off
-details="
- If (and only if) this option is set, the --filter options
- (see below) take effect. Otherwise, the compiled-in default
- filters mp3dec, oggdec and aacdec are activated for mp3, ogg,
- aac streams respectively.
-"
-
-option "filter" f
-#~~~~~~~~~~~~~~~~
-"Use non-default filters"
-string typestr="filter_spec"
-optional
-multiple
-dependon="no_default_filters"
-details="
- This option may be given multiple times. The \"filter_spec\"
- consists of an audio format, the name of the filter, and any
- options for that filter. Mote that order matters.
-
- Examples:
-
- --filter 'mp3:mp3dec'
-
- --filter 'mp3:compress --inertia 5 --damp 2'
-
-"
-
-option "writer" w
-#~~~~~~~~~~~~~~~~
-"Specify stream writer."
-string typestr="writer_spec"
-optional
-multiple
-details="
- May be given multiple times, even multiple times for the same
- audio format. Default value is \"alsa\" for all supported
- audio formats. Example:
-
- --writer 'aac:osx'
-
-"
-
-option "stream_delay" -
-#~~~~~~~~~~~~~~~~~~~~~~
-"time for client sync"
-int typestr="milliseconds"
-default="200"
-optional
-details="
- Add the given amount of milliseconds to the stream start time
- announced by para_server and do not send data to the writer
- before that time (modulo clock difference).
-
- This is useful mainly for syncronizing the audio output of
- different clients.
-"
--- /dev/null
+include(header.m4)
+define(CURRENT_PROGRAM,para_audiod)
+define(DEFAULT_CONFIG_FILE,~/.paraslash/audiod.conf)
+
+<qu>
+#########################
+section "General options"
+#########################
+</qu>
+
+include(loglevel.m4)
+include(color.m4)
+include(config_file.m4)
+include(logfile.m4)
+include(daemon.m4)
+include(user.m4)
+include(group.m4)
+
+<qu>
+########################
+section "Audiod options"
+########################
+
+option "force" F
+#~~~~~~~~~~~~~~~
+"force startup"
+flag off
+details="
+ If this flag is not given, para_audiod refuses to start if the
+ well-known socket file (see the --socket option) already exists
+ because this usually means that para_audiod is already running
+ and listening on that socket. After a crash or if para_audiod
+ received a SIGKILL signal, a stale socket file might remain and
+ you have to use --force once to force startup of para_audiod.
+"
+
+option "mode" m
+#~~~~~~~~~~~~~~
+"startup mode"
+string typestr="mode"
+default="on"
+optional
+details="
+ Para_audiod supports three modes of operation: On, off and
+ standby (sb). This option selects the mode that should be
+ used on startup. If para_audiod operates in \"on\" mode, it
+ will connect to para_server in order to receive its status
+ information. If para_server announces the availability of an
+ audio stream, para_audiod will automatically download, decode
+ and play the audio stream according to the given stream I/O
+ options, see below.
+
+ In \"standby\" mode, para_audiod will only receive the
+ status information from para_server but will not download
+ the audio stream.
+
+ In \"off\" mode, para_audiod does not connect para_server at
+ all, but still listens on the local socket for connections.
+"
+
+option "socket" s
+#~~~~~~~~~~~~~~~~
+"well-known socket"
+string typestr="filename"
+optional
+details="
+ Para_audiod uses a \"well-known\" socket to listen
+ on for connections from para_audioc. This socket is a
+ special file in the file system; its location defaults to
+ /var/paraslash/audiod_sock.<host_name>.
+
+ para_audioc, the client program used to connect to para_audiod,
+ opens this socket in order to talk to para_audiod. If the
+ default value for para_audiod is changed, para_audioc must be
+ instructed to use also \"filename\" for connecting para_audiod.
+"
+
+option "user_allow" -
+#~~~~~~~~~~~~~~~~~~~~
+"allow this uid"
+int typestr="uid"
+default="-1"
+optional
+multiple
+details="
+ Allow the user identified by \"uid\" to connect to para_audiod.
+ May be specified multiple times. If not specified at all,
+ all users are allowed to connect.
+
+ This feature requires unix socket credentials and is currently
+ only supported on Linux systems. On other operating systems,
+ the option is silently ignored and all local users are allowed
+ to connect to para_audiod.
+"
+
+option "clock_diff_count" -
+#~~~~~~~~~~~~~~~~~~~~~~~~~~
+"sync clock on startup"
+int typestr="count"
+default="0"
+optional
+details="
+ Check the clock difference between the host running para_server
+ and the local host running para_audiod that many times before
+ starting any stream I/0. Set this to non-zero for non-local
+ setups if the clocks of these two hosts are not syncronized
+ by ntp or similar.
+"
+
+#############################
+section "Stream I/O options"
+#############################
+
+option "receiver" r
+#~~~~~~~~~~~~~~~~~~
+"select receiver"
+string typestr="receiver_spec"
+default="http"
+optional
+multiple
+details="
+ This option may be given multiple times, once for each
+ supported audio format. The \"receiver_spec\" consists of
+ an audio format and the receiver name, separated by a colon,
+ and any options for that receiver, seperated by whitespace.
+ If any receiver options are present, the whole receiver
+ argument must be quoted.
+
+ Example:
+
+ -r 'mp3:http -i my.host.org -p 8009'
+"
+
+
+option "no_default_filters" D
+#~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+"Configure filters manually"
+flag off
+details="
+ If (and only if) this option is set, the --filter options
+ (see below) take effect. Otherwise, the compiled-in default
+ filters mp3dec, oggdec and aacdec are activated for mp3, ogg,
+ aac streams respectively.
+"
+
+option "filter" f
+#~~~~~~~~~~~~~~~~
+"Use non-default filters"
+string typestr="filter_spec"
+optional
+multiple
+dependon="no_default_filters"
+details="
+ This option may be given multiple times. The \"filter_spec\"
+ consists of an audio format, the name of the filter, and any
+ options for that filter. Mote that order matters.
+
+ Examples:
+
+ --filter 'mp3:mp3dec'
+
+ --filter 'mp3:compress --inertia 5 --damp 2'
+
+"
+
+option "writer" w
+#~~~~~~~~~~~~~~~~
+"Specify stream writer."
+string typestr="writer_spec"
+optional
+multiple
+details="
+ May be given multiple times, even multiple times for the same
+ audio format. Default value is \"alsa\" for all supported
+ audio formats. Example:
+
+ --writer 'aac:osx'
+
+"
+
+option "stream_delay" -
+#~~~~~~~~~~~~~~~~~~~~~~
+"time for client sync"
+int typestr="milliseconds"
+default="200"
+optional
+details="
+ Add the given amount of milliseconds to the stream start time
+ announced by para_server and do not send data to the writer
+ before that time (modulo clock difference).
+
+ This is useful mainly for syncronizing the audio output of
+ different clients.
+"
+</qu>
+++ /dev/null
-# file client.conf
-args "--no-handle-error"
-option "hostname" i "ip or host to connect" string typestr="host" default="localhost" optional
-option "user" u "paraslash username" string typestr="username" default="<current user>" optional
-option "server_port" p "port to connect" int typestr="port" default="2990" optional
-option "key_file" k "(default='~/.paraslash/key.<user>')" string typestr="filename" optional
-option "loglevel" l "set loglevel (0-6)" int typestr="number" default="5" optional
-option "config_file" c "(default='~/.paraslash/client.conf')" string typestr="filename" optional
-option "plain" - "request an uncrypted session" flag off
--- /dev/null
+include(header.m4)
+define(CURRENT_PROGRAM,para_client)
+define(DEFAULT_CONFIG_FILE,~/.paraslash/client.conf)
+<qu>
+args "--no-handle-error"
+option "hostname" i "ip or host to connect" string typestr="host" default="localhost" optional
+option "user" u "paraslash username" string typestr="username" default="<current user>" optional
+option "server_port" p "port to connect" int typestr="port" default="2990" optional
+option "key_file" k "(default='~/.paraslash/key.<user>')" string typestr="filename" optional
+</qu>
+
+include(loglevel.m4)
+include(config_file.m4)
+
+<qu>
+option "plain" - "request an uncrypted session" flag off
+</qu>
--- /dev/null
+<qu>
+
+option "color" C
+#~~~~~~~~~~~~~~~
+"activate color output"
+enum typestr="when"
+values = "yes","no","auto"
+default = "auto"
+optional
+
+option "log_color" -
+#~~~~~~~~~~~~~~~~~~~
+"select a color for one type of log message"
+string typestr="color_spec"
+multiple
+optional
+details="
+ The format of \"color_spec\" is [fg [bg]] [attr].
+
+ Valid colors for \"fg\" and \"bg\" are \"normal\", \"black\",
+ \"red\", \"green\", \"yellow\", \"blue\", \"magenta\",
+ \"cyan\", and \"white\".
+
+ The \"attr\" value must be one of \"bold\", \"dim\", \"ul\",
+ \"blink\", \"reverse\".
+
+ Examples:
+
+ --log_color \"debug:green\"
+ --log_color \"info:yellow bold\"
+ --log_color \"notice:white red bold\"
+"
+
+</qu>
--- /dev/null
+<qu>
+option "config_file" c
+#~~~~~~~~~~~~~~~~~~~~~
+"(default='</qu>DEFAULT_CONFIG_FILE<qu>'"
+string typestr="filename"
+optional
+details="
+ </qu>CURRENT_PROGRAM<qu> reads its config file right after parsing
+ the options that were given at the command line. If an
+ option is given both at the command line and in the
+ config file, the value that was specified at the command line
+ takes precedence.
+"
+</qu>
--- /dev/null
+<qu>
+option "daemon" d
+#~~~~~~~~~~~~~~~~
+"run as background daemon"
+flag off
+dependon="logfile"
+details="
+ Note that </qu>CURRENT_PROGRAM<qu> refuses to start in daemon mode if no
+ logfile was specified.
+"
+</qu>
+++ /dev/null
-option "loglevel" l
-#~~~~~~~~~~~~~~~~~~
- "set loglevel (0-6)"
-int typestr="level"
-default="3"
-optional
-
-option "filter" f
-#~~~~~~~~~~~~~~~~
-"Specify filter."
-string typestr="filter_spec"
-optional
-multiple
-details="
- May be given multiple times to 'pipe' the stream through
- arbitrary many filters in an efficient way. The same filter
- may appear more than once, order matters.
-
- Filter options may be specified for each '-f' option
- separately. Note that you will have to quote these options
- like this:
-
- -f 'compress --inertia 5 --damp 2'
-"
--- /dev/null
+include(header.m4)
+include(loglevel.m4)
+<qu>
+option "filter" f
+#~~~~~~~~~~~~~~~~
+"Specify filter."
+string typestr="filter_spec"
+optional
+multiple
+details="
+ May be given multiple times to 'pipe' the stream through
+ arbitrary many filters in an efficient way. The same filter
+ may appear more than once, order matters.
+
+ Filter options may be specified for each '-f' option
+ separately. Note that you will have to quote these options
+ like this:
+
+ -f 'compress --inertia 5 --damp 2'
+"
+</qu>
+++ /dev/null
-option "loglevel" l
-#~~~~~~~~~~~~~~~~~~
-
-"set loglevel (0-6)"
-
- int typestr="level"
- default="2"
- optional
-
-option "base_dir" b
-#~~~~~~~~~~~~~~~~~~
-"Full path to the database directory
-containing the table(s) to be checked.
-(default='~/.paraslash/afs_database'"
-
- string typestr="path"
- optional
-
-option "dump_dir" d
-#~~~~~~~~~~~~~~~~~~
-"If path is non-empty, para_fsck will write a
-dump of all given tables to the specified
-path."
-
- string typestr="path"
- optional
- default=""
-
-option "no_fsck" n
-#~~~~~~~~~~~~~~~~~
-"Disable fsck mode."
-
- flag off
-
-option "force" f
-#~~~~~~~~~~~~~~~
-"Force fsck even if the table is dirty.
-Ignored if -n is given."
-
- flag off
-
-option "dry_run" -
-#~~~~~~~~~~~~~~~~~
-"Only report problems, don't try to fix them."
-
- flag off
-
--- /dev/null
+include(header.m4)
+include(loglevel.m4)
+
+<qu>
+option "base_dir" b
+#~~~~~~~~~~~~~~~~~~
+"Full path to the database directory
+containing the table(s) to be checked.
+(default='~/.paraslash/afs_database'"
+
+ string typestr="path"
+ optional
+
+option "dump_dir" d
+#~~~~~~~~~~~~~~~~~~
+"If path is non-empty, para_fsck will write a
+dump of all given tables to the specified
+path."
+
+ string typestr="path"
+ optional
+ default=""
+
+option "no_fsck" n
+#~~~~~~~~~~~~~~~~~
+"Disable fsck mode."
+
+ flag off
+
+option "force" f
+#~~~~~~~~~~~~~~~
+"Force fsck even if the table is dirty.
+Ignored if -n is given."
+
+ flag off
+
+option "dry_run" -
+#~~~~~~~~~~~~~~~~~
+"Only report problems, don't try to fix them."
+
+ flag off
+
+</qu>
--- /dev/null
+option "group" g
+#~~~~~~~~~~~~~~~
+"set group id"
+string typestr="group"
+optional
+details="
+ This option sets the group id according to 'group'. This option
+ is silently ignored if EUID != 0. Otherwise, real/effective
+ GID and the saved set-group ID are all set to the GID given by
+ 'group'. Must not be given in the config file.
+"
+
+++ /dev/null
-#------------------------
-section "general options"
-#------------------------
-
-option "config_file" c
-#~~~~~~~~~~~~~~~~~~~~~~
-"(default='~/.paraslash/gui.conf')"
-
- string typestr="filename"
- optional
-
-option "loglevel" l
-#~~~~~~~~~~~~~~~~~~
- "set loglevel (0-6)"
-int typestr="level"
-default="3"
-optional
-details="
- See \"para_server --detailed-help\" for the discussion of
- loglevels.
-"
-
-option "timeout" t
-#~~~~~~~~~~~~~~~~~
-"set timeout"
-
- int typestr="milliseconds"
- default="30"
- optional
-
-option "stat_cmd" s
-#~~~~~~~~~~~~~~~~~~
-"command to read server and audiod status
-data from"
-
- string typestr="command"
- default="para_audioc stat"
- optional
-
-#---------------------------------
-section "mapping keys to commands"
-#---------------------------------
-
-option "key_map" k
-#~~~~~~~~~~~~~~~~~
-
-"Map key k to command c using mode m. Mode
-may be d, x or p for display, external and
-paraslash commands, respectively. Of course,
-this option may be given multiple times, one
-for each key mapping."
-
- string typestr="k:m:c"
- optional
- multiple
--- /dev/null
+include(header.m4)
+define(CURRENT_PROGRAM,para_gui)
+
+<qu>
+#########################
+section "general options"
+#########################
+</qu>
+
+include(config_file.m4)
+include(loglevel.m4)
+
+<qu>
+option "timeout" t
+#~~~~~~~~~~~~~~~~~
+"set timeout"
+
+ int typestr="milliseconds"
+ default="30"
+ optional
+
+option "stat_cmd" s
+#~~~~~~~~~~~~~~~~~~
+"command to read server and audiod status
+data from"
+
+ string typestr="command"
+ default="para_audioc stat"
+ optional
+
+#---------------------------------
+section "mapping keys to commands"
+#---------------------------------
+
+option "key_map" k
+#~~~~~~~~~~~~~~~~~
+
+"Map key k to command c using mode m. Mode
+may be d, x or p for display, external and
+paraslash commands, respectively. Of course,
+this option may be given multiple times, one
+for each key mapping."
+
+ string typestr="k:m:c"
+ optional
+ multiple
+</qu>
--- /dev/null
+changequote(<qu>,</qu>)
--- /dev/null
+<qu>
+option "logfile" L
+#~~~~~~~~~~~~~~~~~
+"where to write log output"
+string typestr="filename"
+optional
+details="
+ If this option is not given, </qu>CURRENT_PROGRAM<qu> writes the log
+ messages to to stderr
+"
+</qu>
--- /dev/null
+<qu>
+option "loglevel" l
+#~~~~~~~~~~~~~~~~~~
+"set loglevel"
+string typestr="level"
+values = "debug","info","notice","warning","error","crit","emerg"
+default="warning"
+optional
+details="
+ Log only messages with severity greater or equal the given
+ value.
+
+ debug: Produces really noisy output.
+ info: Still noisy, but won't fill up the disk quicky.
+ notice: Indicates normal, but significant event.
+ warning: Unexpected events that can be handled.
+ error: Unhandled error condition.
+ crit: System might be unreliable.
+ emerg: Last message before exit.
+"
+
+</qu>
--- /dev/null
+module_ggo_opts := --set-version="($(PACKAGE_STRING), $(codename))"
+
+grab_client.cmdline.h grab_client.cmdline.c: $(ggo_dir)/grab_client.ggo
+ gengetopt $(module_ggo_opts) \
+ -S \
+ --set-package=grab \
+ --no-handle-help \
+ --no-handle-error \
+ --no-handle-version \
+ --arg-struct-name=grab_client_args_info \
+ --file-name=$(subst .ggo,,$(<F)).cmdline \
+ --func-name $(subst .ggo,,$(<F))_cmdline_parser < $<
+
+%_recv.cmdline.h %_recv.cmdline.c: $(ggo_dir)/%_recv.ggo
+ gengetopt $(module_ggo_opts) \
+ --set-package=$(subst .ggo,,$(<F)) \
+ --arg-struct-name=$(subst .ggo,,$(<F))_args_info \
+ --file-name=$(subst .ggo,,$(<F)).cmdline \
+ --func-name $(subst .ggo,,$(<F))_cmdline_parser < $<
+
+%_filter.cmdline.h %_filter.cmdline.c: $(ggo_dir)/%_filter.ggo
+ gengetopt $(module_ggo_opts) \
+ --set-package=$(subst .ggo,,$(<F)) \
+ --arg-struct-name=$(subst .ggo,,$(<F))_args_info \
+ --file-name=$(subst .ggo,,$(<F)).cmdline \
+ --func-name $(subst _filter.ggo,,$(<F))_cmdline_parser < $<
+%_write.cmdline.h %_write.cmdline.c: $(ggo_dir)/%_write.ggo
+ gengetopt -S $(module_ggo_opts) \
+ --set-package=$(subst .ggo,,$(<F)) \
+ --arg-struct-name=$(subst .ggo,,$(<F))_args_info \
+ --file-name=$(subst .ggo,,$(<F)).cmdline \
+ --func-name $(subst _write.ggo,,$(<F))_cmdline_parser < $<
+
+%.cmdline.h %.cmdline.c: $(ggo_dir)/%.ggo
+ case $(<F) in client.ggo) O="--unamed-opts=command";; \
+ audioc.ggo) O="--unamed-opts=command";; \
+ fsck.ggo) O="--unamed-opts=table";; \
+ afh.ggo) O="--unamed-opts=audio_file";; \
+ recv.ggo) O="--no-handle-help";; \
+ filter.ggo) O="--no-handle-help";; \
+ write.ggo) O="--no-handle-help";; \
+ audiod.ggo) O="--no-handle-help";; \
+ esac; \
+ if test $(<F) != fsck.ggo; then O="$$O --conf-parser "; fi; \
+ gengetopt $$O \
+ --no-handle-version \
+ --file-name=$(*F).cmdline \
+ --func-name $(*F)_cmdline_parser \
+ --arg-struct-name=$(*F)_args_info \
+ --set-package="para_$(subst .cmdline,,$(*F))" \
+ --set-version="$(PACKAGE_VERSION)" < $<
+
+$(ggo_dir)/server.ggo $(ggo_dir)/audiod.ggo: \
+ $(ggo_dir)/loglevel.m4 $(ggo_dir)/color.m4 \
+ $(ggo_dir)/config_file.m4 $(ggo_dir)/logfile.m4 \
+ $(ggo_dir)/daemon.m4 $(ggo_dir)/user.m4 \
+ $(ggo_dir)/group.m4
+
+$(ggo_dir)/afh.ggo: $(ggo_dir)/loglevel.m4
+$(ggo_dir)/audioc.ggo: $(ggo_dir)/loglevel.m4
+$(ggo_dir)/filter.ggo: $(ggo_dir)/loglevel.m4
+$(ggo_dir)/fsck.ggo: $(ggo_dir)/loglevel.m4
+$(ggo_dir)/gui.ggo: $(ggo_dir)/loglevel.m4
+$(ggo_dir)/recv.ggo: $(ggo_dir)/loglevel.m4
+$(ggo_dir)/write.ggo: $(ggo_dir)/loglevel.m4
+$(ggo_dir)/client.ggo: $(ggo_dir)/loglevel.m4 $(ggo_dir)/config_file.m4
+
+$(ggo_dir)/%.ggo: $(ggo_dir)/%.m4 $(ggo_dir)/header.m4
+ (cd $(ggo_dir) && m4 $(<F)) > $@
+++ /dev/null
-option "loglevel" l
-#~~~~~~~~~~~~~~~~~~
-"set loglevel (0-6)"
-int typestr="level"
-default="3"
-optional
-
-option "receiver" r
-"Select receiver"
-string typestr="receiver_spec"
-default="http"
-optional
-details="
- Any options for the selected receiver must
- be quoted. Example:
-
- -r 'http -i www.paraslash.org -p 8009'
-"
-
--- /dev/null
+include(header.m4)
+include(loglevel.m4)
+
+<qu>
+option "receiver" r
+"Select receiver"
+string typestr="receiver_spec"
+default="http"
+optional
+details="
+ Any options for the selected receiver must
+ be quoted. Example:
+
+ -r 'http -i www.paraslash.org -p 8009'
+"
+</qu>
+++ /dev/null
-#########################
-section "General options"
-#########################
-
-option "loglevel" l
-#~~~~~~~~~~~~~~~~~~
-"set loglevel (0-6)"
-int typestr="level"
-default="3"
-optional
-details="
- Larger values mean less verbose output. Loglevel 0 (debug) gets
- really noisy; a value of 1 (info) produces still noisy output,
- but this won't fill up the disk quicky. Messaged logged with
- loglevel 2 (notice) indicate normal but significant events
- while level 3 (warning) logs unexpected events that can be
- handled. Unhandled error conditions are logged with loglevel
- 4 (error) and crititcal errors are logged using loglevel 5
- (crit). Finally, loglevel 6 (emerg) is reserved for messages
- that cause para_server to terminate immediately.
-"
-
-option "color" C
-#~~~~~~~~~~~~~~~
-"activate color output"
-enum typestr="when"
-values = "yes","no","auto"
-default = "auto"
-optional
-
-option "log_color" -
-#~~~~~~~~~~~~~~~~~~~
-"select a color for one type of log message"
-string typestr="color_spec"
-multiple
-optional
-details="
- The format of \"color_spec\" is [fg [bg]] [attr].
-
- Valid colors for \"fg\" and \"bg\" are \"normal\", \"black\",
- \"red\", \"green\", \"yellow\", \"blue\", \"magenta\",
- \"cyan\", and \"white\".
-
- The \"attr\" value must be one of \"bold\", \"dim\", \"ul\",
- \"blink\", \"reverse\".
-
- Examples:
-
- --log_color \"debug:green\"
- --log_color \"info:yellow bold\"
- --log_color \"notice:white red bold\"
-"
-
-option "port" p
-#~~~~~~~~~~~~~~
-"listening port"
-int typestr="portnumber"
-default="2990"
-optional
-details="
- para_server listens on this tcp port for incoming connections
- from clients such as para_client. If the default port is
- changed, the corresponding option of para_client must be used
- to connect to para_server.
-"
-
-option "daemon" d
-#~~~~~~~~~~~~~~~~
-"run as background daemon"
-flag off
-dependon="logfile"
-details="
- Note that para_server refuses to start in daemon mode if no
- logfile was specified.
-"
-
-option "user" u
-#~~~~~~~~~~~~~~
-"run as the given user"
-string typestr="name"
-optional
-details="
- para_server does not need any special privileges. If started
- as root (EUID == 0) this option must be given at the command
- line (not in the configuration file) so that para_server
- can drop the root privileges right after parsing the command
- line options, but before parsing the configuration file. In
- this case, real/effective/saved UID are all set to the UID
- of 'name'. As the configuration file is read afterwards,
- those options that have a default value depending on the UID
- (e.g. the directory for the configuration file) are computed
- by using the uid of 'name'. This option has no effect if
- para_server is started as a non-root user (i.e. EUID != 0)
-"
-
-
-option "group" g
-#~~~~~~~~~~~~~~~
-"set group id"
-string typestr="group"
-optional
-details="
- This option sets the group id according to 'group'. This option
- is silently ignored if EUID != 0. Otherwise, real/effective
- GID and the saved set-group ID are all set to the GID given by
- 'group'. Must not be given in the config file.
-"
-
-#############################
-section "Configuration files"
-#############################
-
-
-option "logfile" L
-#~~~~~~~~~~~~~~~~~
-"where to write log output"
-string typestr="filename"
-optional
-details="
- If this option is not given, para_server writes the log
- messages to to stderr
-"
-
-option "config_file" c
-#~~~~~~~~~~~~~~~~~~~~~
-"(default='~/.paraslash/server.conf'"
-string typestr="filename"
-optional
-details="
- para_server reads its config file right after parsing
- the options that were given at the command line. If an
- option is given both at the command line and in the
- config file, the value that was specified at the command line
- takes precedence.
-"
-
-option "user_list" -
-#~~~~~~~~~~~~~~~~~~~
-"(default='~/.paraslash/server.users')"
-
-string typestr="filename"
-optional
-
-
-##################################
-section "virtual streaming system"
-##################################
-
-
-option "autoplay" a
-#~~~~~~~~~~~~~~~~~~
-"start playing on startup"
-flag off
-
-option "autoplay_delay" -
-#~~~~~~~~~~~~~~~~~~~~~~~~
-"time to wait before streaming"
-int typestr="ms"
-default="0"
-optional
-dependon="autoplay"
-details="
- If para_server is started with the autoplay option, this option
- may be used to set up a delay before para_server streams its
- first audio file. This is useful for example if para_server
- and para_audiod are started during system startup. The delay
- time should be choosen large enough so that para_audiod is
- already up when para_server starts to stream. Of course, this
- option depends on the autoplay option.
-"
-option "announce_time" A
-#~~~~~~~~~~~~~~~~~~~~~~~
-"grace time for clients"
-
-int typestr="ms"
-default="300"
-optional
-details="
- Clients such as para_audiod connect to para_server and execute
- the stat command to find out whether an audio stream is
- currently available. This sets the delay betweeen announcing
- the stream via the output of the stat command and sending
- the first chunk of data.
-"
-
-#############################
-section "audio file selector"
-#############################
-
-option "afs_database_dir" D
-#~~~~~~~~~~~~~~~~~~~~~~~~~~
-"location of the database"
-string typestr="path"
-optional
-details="
- Where para_server should look for the osl database of the audio
- file selector. The default is '~/.paraslash/afs_database'.
-"
-
-option "afs_socket" s
-#~~~~~~~~~~~~~~~~~~~~
-"Command socket for afs"
-string typestr="path"
-default="/var/paraslash/afs_command_socket"
-optional
-details="
- For each server command that is handled by the audio file
- selector, the child process of para_server connects to the
- audio file selector via a local socket. This option specifies
- the location of that socket in the file system.
-"
-option "afs_initial_mode" i
-#~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-"Mood or playlist to load on startup."
-string typestr="<specifier>/<name>"
-optional
-
-details="
- The argument of this option must be prefixed with either 'p/'
- or 'm/' to indicate whether a playlist or a mood should be
- loaded. Example:
- --afs_initial_mode p/foo
- loads the playlist named 'foo'.
-"
-
-#####################
-section "http sender"
-#####################
-
-
-option "http_port" -
-#~~~~~~~~~~~~~~~~~~~
-"tcp port for http streaming"
-int typestr="portnumber"
-default="8000"
-optional
-details="
- The http sender of para_server listens on this port for
- incoming connections. Clients are expected to send the usual
- http request message such as 'GET / HTTP/'.
-"
-
-option "http_default_deny" -
-#~~~~~~~~~~~~~~~~~~~~~~~~~~~
-"make the http ACL a whitelist"
-flag off
-details="
- The default is to use blacklists instead, i.e. connections
- to the http sender are allowed unless the connecting host
- matches a pattern given by a http_access option. This allows
- to use access control the other way round: Connections are
- denied from hosts which are not explicitly allowed by one or
- more http_access options.
-"
-
-option "http_access" -
-#~~~~~~~~~~~~~~~~~~~~~
-"add an entry to the http ACL"
-string typestr="a.b.c.d/n"
-optional
-multiple
-details="
- Add given host/network to access control list (whitelist if
- http_default_deny was given, blacklist otherwise) before
- opening the tcp port. This option can be given multiple
- times. Example: '192.168.0.0/24' whitelists/blacklists the
- 256 hosts 192.168.0.x
-"
-
-option "http_no_autostart" -
-#~~~~~~~~~~~~~~~~~~~~~~~~~~~
-"do not open tcp port on startup"
-flag off
-details="
- If this option is given, the http sender does not listen on
- its tcp port. It may be instructed to open this port at a
- later time by using the sender command.
-"
-
-option "http_max_clients" -
-#~~~~~~~~~~~~~~~~~~~~~~~~~~
-"maximal number of connections"
-int typestr="number"
-default="-1"
-optional
-details="
- The http sender will refuse connections if already that number
- of clients are currently connected. A non-positive value
- (the default) allows an unlimited number of simultaneous
- connections.
-"
-
-#####################
-section "dccp sender"
-#####################
-
-
-option "dccp_port" -
-#~~~~~~~~~~~~~~~~~~~
-"port for dccp streaming"
-int typestr="portnumber"
-default="8000"
-optional
-details="
- See http_port for details.
-"
-
-option "dccp_default_deny" -
-#~~~~~~~~~~~~~~~~~~~~~~~~~~~
-"make the dccp ACL a whitelist"
-flag off
-details="
- See http_default_deny for details.
-"
-
-option "dccp_access" -
-#~~~~~~~~~~~~~~~~~~~~~
-"add an entry to the dccp ACL"
-string typestr="a.b.c.d/n"
-optional
-multiple
-details="
- See http_access for details.
-"
-
-option "dccp_max_clients" -
-#~~~~~~~~~~~~~~~~~~~~~~~~~~
-"maximal number of connections"
-int typestr="number"
-default="-1"
-optional
-details="
- See http_max_clients for details.
-"
-
-####################
-section "udp sender"
-####################
-
-option "udp_target" -
-#~~~~~~~~~~~~~~~~~~~~
-"add udp target"
-string typestr="a.b.c.d:p"
-optional
-multiple
-details="
- Add given host/port to the list of targets. This option
- can be given multiple times. Example: '224.0.1.38:1500'
- instructs the udp sender to send to udp port 1500 on host
- 224.0.1.38 (unassigned ip in the Local Network Control Block
- 224.0.0/24). This is useful for multicast streaming.
-"
-
-option "udp_no_autostart" -
-#~~~~~~~~~~~~~~~~~~~~~~~~~~
-"do not start sending"
-flag off
-details="
- If this option is given, udp streaming may be activated at
- a later time by using the sender command.
-"
-
-option "udp_default_port" -
-#~~~~~~~~~~~~~~~~~~~~~~~~~~
-"udp port to send to"
-int typestr="port"
-default="8000"
-optional
-
-option "udp_header_interval" H
-#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-"duration for sending header"
-int typestr="ms"
-default="2000"
-optional
-details="
- As the udp sender has no idea about connected clients it
- sends the audio file header periodically if necessary. This
- option is used to specify the duration of the interval between
- sending the header. Shorter values decrease the average time
- clients have to wait before being able to start playback,
- but this also increases the amount network traffic. Note
- that this affects only ogg vorbis streams as this is the only
- audio format that needs an audio file header.
-"
-
-option "udp_ttl" t
-#~~~~~~~~~~~~~~~~~
-"set time to live value"
-int typestr="num"
-default="10"
-optional
-details="
- This option instructs the udp sender to set the time to live to
- \"num\" for the sending udp socket. Only useful for multicast
- udp streaming.
-"
--- /dev/null
+include(header.m4)
+define(CURRENT_PROGRAM,para_server)
+define(DEFAULT_CONFIG_FILE,~/.paraslash/server.conf)
+
+<qu>
+#########################
+section "General options"
+#########################
+</qu>
+
+include(loglevel.m4)
+include(color.m4)
+include(daemon.m4)
+include(user.m4)
+include(group.m4)
+
+<qu>
+option "port" p
+#~~~~~~~~~~~~~~
+"listening port"
+int typestr="portnumber"
+default="2990"
+optional
+details="
+ para_server listens on this tcp port for incoming connections
+ from clients such as para_client. If the default port is
+ changed, the corresponding option of para_client must be used
+ to connect to para_server.
+"
+
+#############################
+section "Configuration files"
+#############################
+</qu>
+
+include(logfile.m4)
+include(config_file.m4)
+
+<qu>
+option "user_list" -
+#~~~~~~~~~~~~~~~~~~~
+"(default='~/.paraslash/server.users')"
+
+string typestr="filename"
+optional
+
+
+##################################
+section "virtual streaming system"
+##################################
+
+
+option "autoplay" a
+#~~~~~~~~~~~~~~~~~~
+"start playing on startup"
+flag off
+
+option "autoplay_delay" -
+#~~~~~~~~~~~~~~~~~~~~~~~~
+"time to wait before streaming"
+int typestr="ms"
+default="0"
+optional
+dependon="autoplay"
+details="
+ If para_server is started with the autoplay option, this option
+ may be used to set up a delay before para_server streams its
+ first audio file. This is useful for example if para_server
+ and para_audiod are started during system startup. The delay
+ time should be choosen large enough so that para_audiod is
+ already up when para_server starts to stream. Of course, this
+ option depends on the autoplay option.
+"
+option "announce_time" A
+#~~~~~~~~~~~~~~~~~~~~~~~
+"grace time for clients"
+
+int typestr="ms"
+default="300"
+optional
+details="
+ Clients such as para_audiod connect to para_server and execute
+ the stat command to find out whether an audio stream is
+ currently available. This sets the delay betweeen announcing
+ the stream via the output of the stat command and sending
+ the first chunk of data.
+"
+
+#############################
+section "audio file selector"
+#############################
+
+option "afs_database_dir" D
+#~~~~~~~~~~~~~~~~~~~~~~~~~~
+"location of the database"
+string typestr="path"
+optional
+details="
+ Where para_server should look for the osl database of the audio
+ file selector. The default is '~/.paraslash/afs_database'.
+"
+
+option "afs_socket" s
+#~~~~~~~~~~~~~~~~~~~~
+"Command socket for afs"
+string typestr="path"
+default="/var/paraslash/afs_command_socket"
+optional
+details="
+ For each server command that is handled by the audio file
+ selector, the child process of para_server connects to the
+ audio file selector via a local socket. This option specifies
+ the location of that socket in the file system.
+"
+option "afs_initial_mode" i
+#~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+"Mood or playlist to load on startup."
+string typestr="<specifier>/<name>"
+optional
+
+details="
+ The argument of this option must be prefixed with either 'p/'
+ or 'm/' to indicate whether a playlist or a mood should be
+ loaded. Example:
+ --afs_initial_mode p/foo
+ loads the playlist named 'foo'.
+"
+
+#####################
+section "http sender"
+#####################
+
+
+option "http_port" -
+#~~~~~~~~~~~~~~~~~~~
+"tcp port for http streaming"
+int typestr="portnumber"
+default="8000"
+optional
+details="
+ The http sender of para_server listens on this port for
+ incoming connections. Clients are expected to send the usual
+ http request message such as 'GET / HTTP/'.
+"
+
+option "http_default_deny" -
+#~~~~~~~~~~~~~~~~~~~~~~~~~~~
+"make the http ACL a whitelist"
+flag off
+details="
+ The default is to use blacklists instead, i.e. connections
+ to the http sender are allowed unless the connecting host
+ matches a pattern given by a http_access option. This allows
+ to use access control the other way round: Connections are
+ denied from hosts which are not explicitly allowed by one or
+ more http_access options.
+"
+
+option "http_access" -
+#~~~~~~~~~~~~~~~~~~~~~
+"add an entry to the http ACL"
+string typestr="a.b.c.d/n"
+optional
+multiple
+details="
+ Add given host/network to access control list (whitelist if
+ http_default_deny was given, blacklist otherwise) before
+ opening the tcp port. This option can be given multiple
+ times. Example: '192.168.0.0/24' whitelists/blacklists the
+ 256 hosts 192.168.0.x
+"
+
+option "http_no_autostart" -
+#~~~~~~~~~~~~~~~~~~~~~~~~~~~
+"do not open tcp port on startup"
+flag off
+details="
+ If this option is given, the http sender does not listen on
+ its tcp port. It may be instructed to open this port at a
+ later time by using the sender command.
+"
+
+option "http_max_clients" -
+#~~~~~~~~~~~~~~~~~~~~~~~~~~
+"maximal number of connections"
+int typestr="number"
+default="-1"
+optional
+details="
+ The http sender will refuse connections if already that number
+ of clients are currently connected. A non-positive value
+ (the default) allows an unlimited number of simultaneous
+ connections.
+"
+
+#####################
+section "dccp sender"
+#####################
+
+
+option "dccp_port" -
+#~~~~~~~~~~~~~~~~~~~
+"port for dccp streaming"
+int typestr="portnumber"
+default="8000"
+optional
+details="
+ See http_port for details.
+"
+
+option "dccp_default_deny" -
+#~~~~~~~~~~~~~~~~~~~~~~~~~~~
+"make the dccp ACL a whitelist"
+flag off
+details="
+ See http_default_deny for details.
+"
+
+option "dccp_access" -
+#~~~~~~~~~~~~~~~~~~~~~
+"add an entry to the dccp ACL"
+string typestr="a.b.c.d/n"
+optional
+multiple
+details="
+ See http_access for details.
+"
+
+option "dccp_max_clients" -
+#~~~~~~~~~~~~~~~~~~~~~~~~~~
+"maximal number of connections"
+int typestr="number"
+default="-1"
+optional
+details="
+ See http_max_clients for details.
+"
+
+####################
+section "udp sender"
+####################
+
+option "udp_target" -
+#~~~~~~~~~~~~~~~~~~~~
+"add udp target"
+string typestr="a.b.c.d:p"
+optional
+multiple
+details="
+ Add given host/port to the list of targets. This option
+ can be given multiple times. Example: '224.0.1.38:1500'
+ instructs the udp sender to send to udp port 1500 on host
+ 224.0.1.38 (unassigned ip in the Local Network Control Block
+ 224.0.0/24). This is useful for multicast streaming.
+"
+
+option "udp_no_autostart" -
+#~~~~~~~~~~~~~~~~~~~~~~~~~~
+"do not start sending"
+flag off
+details="
+ If this option is given, udp streaming may be activated at
+ a later time by using the sender command.
+"
+
+option "udp_default_port" -
+#~~~~~~~~~~~~~~~~~~~~~~~~~~
+"udp port to send to"
+int typestr="port"
+default="8000"
+optional
+
+option "udp_header_interval" H
+#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+"duration for sending header"
+int typestr="ms"
+default="2000"
+optional
+details="
+ As the udp sender has no idea about connected clients it
+ sends the audio file header periodically if necessary. This
+ option is used to specify the duration of the interval between
+ sending the header. Shorter values decrease the average time
+ clients have to wait before being able to start playback,
+ but this also increases the amount network traffic. Note
+ that this affects only ogg vorbis streams as this is the only
+ audio format that needs an audio file header.
+"
+
+option "udp_ttl" t
+#~~~~~~~~~~~~~~~~~
+"set time to live value"
+int typestr="num"
+default="10"
+optional
+details="
+ This option instructs the udp sender to set the time to live to
+ \"num\" for the sending udp socket. Only useful for multicast
+ udp streaming.
+"
+</qu>
--- /dev/null
+<qu>
+option "user" u
+#~~~~~~~~~~~~~~
+"run as the given user"
+string typestr="name"
+optional
+details="
+ </qu>CURRENT_PROGRAM<qu> does not need any special privileges.
+
+ If started as root (EUID == 0) this option must
+ be given at the command line (not in the configuration
+ file) so that </qu>CURRENT_PROGRAM<qu> can drop the root
+ privileges right after parsing the command line options,
+ but before parsing the configuration file. In this case,
+ real/effective/saved UID are all set to the UID of 'name'. As
+ the configuration file is read afterwards, those options that
+ have a default value depending on the UID (e.g. the directory
+ for the configuration file) are computed by using the uid of
+ 'name'. This option has no effect if </qu>CURRENT_PROGRAM<qu>
+ is started as a non-root user (i.e. EUID != 0).
+" </qu>
+++ /dev/null
-option "loglevel" l
-#~~~~~~~~~~~~~~~~~~
-"set loglevel (0-6)"
-int typestr="level"
-default="4"
-optional
-
-option "bufsize" b
-#~~~~~~~~~~~~~~~~~
-"input buffer size"
-int typestr="kilobytes"
-default="64"
-optional
-
-option "writer" w
-#~~~~~~~~~~~~~~~~
-"select stream writer"
-string typestr="name"
-default="alsa (file if alsa is unsupported)"
-optional
-multiple
-details="
- May be give multiple times. The same writer may be specified
- more than once.
-"
-
-option "start_time" t
-#~~~~~~~~~~~~~~~~~~~~
-"defer playback"
-string typestr="timeval"
-optional
-details="
- Start playback at given time which must be in a:b format where
- a denotes seconds and b denotes microseconds since the epoch.
-"
--- /dev/null
+include(header.m4)
+include(loglevel.m4)
+
+option "bufsize" b
+#~~~~~~~~~~~~~~~~~
+"input buffer size"
+int typestr="kilobytes"
+default="64"
+optional
+
+option "writer" w
+#~~~~~~~~~~~~~~~~
+"select stream writer"
+string typestr="name"
+default="alsa (file if alsa is unsupported)"
+optional
+multiple
+details="
+ May be give multiple times. The same writer may be specified
+ more than once.
+"
+
+option "start_time" t
+#~~~~~~~~~~~~~~~~~~~~
+"defer playback"
+string typestr="timeval"
+optional
+details="
+ Start playback at given time which must be in a:b format where
+ a denotes seconds and b denotes microseconds since the epoch.
+"
return 1;
}
+static int loglevel;
+
__printf_2_3 void para_log(int ll, const char *fmt,...)
{
int color;
char *msg;
- if (ll < conf.loglevel_arg || !curses_active)
+ if (ll < loglevel || !curses_active)
return;
switch (ll) {
case LL_DEBUG:
static void print_welcome(void)
{
- int ll = conf.loglevel_arg;
- if (ll > LL_NOTICE)
+ if (loglevel > LL_NOTICE)
return;
outputf(COLOR_WELCOME, "Welcome to para_gui " PACKAGE_VERSION
" \"" CODENAME "\". Theme: %s", theme.name);
static void com_ll_decr(void)
{
- if (conf.loglevel_arg <= LL_DEBUG) {
+ if (loglevel <= LL_DEBUG) {
print_in_bar(COLOR_ERRMSG,
"loglevel already at maximal verbosity\n");
return;
}
- conf.loglevel_arg--;
- print_in_bar(COLOR_MSG, "loglevel set to %d\n", conf.loglevel_arg);
+ loglevel--;
+ print_in_bar(COLOR_MSG, "loglevel set to %d\n", loglevel);
}
static void com_ll_incr(void)
{
- if (conf.loglevel_arg >= LL_EMERG) {
+ if (loglevel >= LL_EMERG) {
print_in_bar(COLOR_ERRMSG,
"loglevel already at miminal verbosity\n");
return;
}
- conf.loglevel_arg++;
- print_in_bar(COLOR_MSG, "loglevel set to %d\n", conf.loglevel_arg);
+ loglevel++;
+ print_in_bar(COLOR_MSG, "loglevel set to %d\n", loglevel);
}
/*
};
gui_cmdline_parser_config_file(cf, &conf, ¶ms);
}
+ loglevel = get_loglevel_by_name(conf.loglevel_arg);
if (check_key_map_args() < 0) {
fprintf(stderr, "invalid key map in config file\n");
exit(EXIT_FAILURE);
#include "recv.h"
#include "recv.cmdline.h"
#include "fd.h"
+#include "string.h"
#include "error.h"
#include "stdout.h"
/** the gengetopt args info struct */
struct recv_args_info conf;
-/** always log to stderr */
-INIT_STDERR_LOGGING(conf.loglevel_arg);
+static int loglevel;
+/** Always log to stderr. */
+INIT_STDERR_LOGGING(loglevel);
/** init array of error codes used by para_recv */
INIT_RECV_ERRLISTS;
PARA_EMERG_LOG("parse failed\n");
goto out;
}
+ loglevel = get_loglevel_by_name(conf.loglevel_arg);
r = &receivers[receiver_num];
rn.receiver = r;
ret = r->open(&rn);
void parse_config_or_die(int override)
{
char *home = para_homedir();
- int ret, ll = conf.loglevel_arg;
+ int ret;
char *cf;
daemon_close_log();
daemon_set_logfile(conf.logfile_arg);
daemon_open_log_or_die();
}
- daemon_set_loglevel(ll);
+ daemon_set_loglevel(conf.loglevel_arg);
init_colors_or_die();
daemon_set_flag(DF_LOG_PID);
daemon_set_flag(DF_LOG_LL);
drop_privileges_or_die(conf.user_arg, conf.group_arg);
/* parse config file, open log and set defaults */
parse_config_or_die(0);
- log_welcome("para_server", conf.loglevel_arg);
+ log_welcome("para_server");
init_ipc_or_die(); /* init mmd struct and mmd->lock */
/* make sure, the global now pointer is uptodate */
gettimeofday(now, NULL);
*value = tmp;
return 1;
}
+
+int get_loglevel_by_name(const char *txt)
+{
+ if (!strcasecmp(txt, "debug"))
+ return LL_DEBUG;
+ if (!strcasecmp(txt, "info"))
+ return LL_INFO;
+ if (!strcasecmp(txt, "notice"))
+ return LL_NOTICE;
+ if (!strcasecmp(txt, "warning"))
+ return LL_WARNING;
+ if (!strcasecmp(txt, "error"))
+ return LL_ERROR;
+ if (!strcasecmp(txt, "crit"))
+ return LL_CRIT;
+ if (!strcasecmp(txt, "emerg"))
+ return LL_EMERG;
+ return -1;
+}
void *private_data);
int para_atoi64(const char *str, int64_t *result);
int para_atoi32(const char *str, int32_t *value);
+int get_loglevel_by_name(const char *txt);
s->timeout.tv_usec = 1;
}
-INIT_STDERR_LOGGING(conf.loglevel_arg)
+static int loglevel;
+INIT_STDERR_LOGGING(loglevel)
static struct writer_node_group *check_args(void)
{
struct writer_node_group *g = NULL;
struct initial_delay_task *idt = &the_initial_delay_task;
+ loglevel = get_loglevel_by_name(conf.loglevel_arg);
if (conf.start_time_given) {
long unsigned sec, usec;
if (sscanf(conf.start_time_arg, "%lu:%lu",