paraslash.git
11 years agoMove gengetopt input files to m4 directory.
Andre Noll [Sun, 22 Jul 2012 14:11:11 +0000 (16:11 +0200)]
Move gengetopt input files to m4 directory.

This separates the gengetopt input directory from its output directory.
All gengetopt m4 file are moved to the new m4/gengetopt directory.

As a consequence of this cleanup, we may get rid of the .gitignore
file for the generated ggo files, which is a good thing as it was
hard to keep it up to date.

11 years agoDifferentiate between ggo_dir and m4_ggo dir.
Andre Noll [Sun, 22 Jul 2012 13:39:13 +0000 (15:39 +0200)]
Differentiate between ggo_dir and m4_ggo dir.

The former is the output directory for the generated ggo files
while the latter is the input directory containing the .m4 files.

Separating the two allows to switch to different directories for
input and output files.

11 years agoTreat all ggo files as m4 files.
Andre Noll [Sun, 22 Jul 2012 13:15:52 +0000 (15:15 +0200)]
Treat all ggo files as m4 files.

Most input files for gengetopt are already generated from corresponding
m4 files. This renames the remaining ones, so that all .ggo files
are now generated and can be removed by the make clean variants.
Hence we do not need to track the set of generated ggo files any more.

11 years agoMerge branch 't/releases_branch'
Andre Noll [Sun, 26 Aug 2012 12:26:00 +0000 (14:26 +0200)]
Merge branch 't/releases_branch'

18d2c3 Remove all release tarballs from the master branch.
f82ac2 web: Rename tarball download directory.

Was cooking since 2012-07-28, tested also on athcx.

11 years agosignal: Improve documentation of para_signal_init().
Andre Noll [Tue, 14 Aug 2012 11:09:43 +0000 (13:09 +0200)]
signal: Improve documentation of para_signal_init().

para_signal_init() does not install any signal handlers, so this part of the
documentation is incorrect. The patch fixes this flaw, mentions which end of
the signal pipe is returned to the caller and improves the wording a bit.

11 years agoMerge remote-tracking branch 'boock/master'
Andre Noll [Mon, 13 Aug 2012 08:08:41 +0000 (10:08 +0200)]
Merge remote-tracking branch 'boock/master'

11 years agoMerge branch 'maint'
Andre Noll [Mon, 13 Aug 2012 08:08:28 +0000 (10:08 +0200)]
Merge branch 'maint'

11 years agoexec.c: Remove close_on_fork include.
Andre Noll [Mon, 13 Aug 2012 06:31:13 +0000 (08:31 +0200)]
exec.c: Remove close_on_fork include.

It does not depend on it.

11 years agoMerge branch 'maint'
Andre Noll [Mon, 13 Aug 2012 08:04:40 +0000 (10:04 +0200)]
Merge branch 'maint'

11 years agosideband: Fix SBB_INIT().
Andre Noll [Mon, 13 Aug 2012 06:35:17 +0000 (08:35 +0200)]
sideband: Fix SBB_INIT().

The macro parameter is called "_band" rather than "band". This
only worked by accident because all users called the argument
"band".

11 years agoserver.ggo depends on config_file.m4.
Andre Noll [Tue, 7 Aug 2012 11:27:11 +0000 (13:27 +0200)]
server.ggo depends on config_file.m4.

server.m4 includes config_file.m4 but this dependency was not listed
in the ggo makefile.

11 years agoserver.ggo depends on config_file.m4.
Andre Noll [Tue, 7 Aug 2012 11:27:11 +0000 (13:27 +0200)]
server.ggo depends on config_file.m4.

server.m4 includes config_file.m4 but this dependency was not listed
in the ggo makefile.

11 years agoRemove all release tarballs from the master branch.
Andre Noll [Sun, 22 Jul 2012 10:13:32 +0000 (12:13 +0200)]
Remove all release tarballs from the master branch.

It made downloads of the development snapshots via gitweb very large.
All release tarballs are still available in the separate "releases"
branch.

11 years agoweb: Rename tarball download directory.
Andre Noll [Sun, 22 Jul 2012 10:14:20 +0000 (12:14 +0200)]
web: Rename tarball download directory.

"releases" seems to be a better name than "versions". The web sync
script (in another repo) has been changed accordingly.

11 years agoMakefile: Move up the definition of various directories.
Andre Noll [Sun, 22 Jul 2012 12:49:18 +0000 (14:49 +0200)]
Makefile: Move up the definition of various directories.

This way we have all of them at one place in the Makefile.

11 years agoRemove some stale entries from .gitignore.
Andre Noll [Sun, 22 Jul 2012 15:53:24 +0000 (17:53 +0200)]
Remove some stale entries from .gitignore.

11 years agocommand_util.sh: Remove unnecessary mkdir command.
Andre Noll [Sun, 22 Jul 2012 15:46:06 +0000 (17:46 +0200)]
command_util.sh: Remove unnecessary mkdir command.

This crept in five years ago (commit 4c034f8d) for no good reason.

11 years agoMakefile: Remove targets for html man pages.
Andre Noll [Sun, 22 Jul 2012 14:21:28 +0000 (16:21 +0200)]
Makefile: Remove targets for html man pages.

The html version of the man pages is generated by other means these
days, so the two targets can be removed.

11 years agoMakefile: Remove $all_ggos.
Andre Noll [Sun, 22 Jul 2012 12:40:09 +0000 (14:40 +0200)]
Makefile: Remove $all_ggos.

This variable is unused.

11 years agoserver: Remove "foo" feature.
Andre Noll [Mon, 23 Jul 2012 19:50:40 +0000 (21:50 +0200)]
server: Remove "foo" feature.

Oops, this feature was added only for testing feature negotiation
with multiple features and should have been deleted before 0.4.11 was
released. This was even mentioned in the commit message of e151dbb7,
which introduced the bogus "foo" feature..

11 years agocom_init(): Send error message only for non-sideband connections.
Andre Noll [Tue, 24 Jul 2012 06:42:23 +0000 (08:42 +0200)]
com_init(): Send error message only for non-sideband connections.

If com_init() fails, this non-sideband error message is currently
sent also for sideband connections, which confuses the client. Send
it only for non-sideband connections.

11 years agofade: Fix command for switching moods.
Andre Noll [Mon, 23 Jul 2012 06:41:23 +0000 (08:41 +0200)]
fade: Fix command for switching moods.

It contained a newline, which was not a problem before the sideband
API was introduced. However, with sideband being the default, the
newline character is interpreted as part of the name of the mood or
playlist, causing the mood switch to fail.

The fix is simple: Just remove the trailing newline character.

11 years agoFix typo in t0003.
Andre Noll [Sun, 22 Jul 2012 10:43:32 +0000 (12:43 +0200)]
Fix typo in t0003.

11 years agoNEWS: Whitespace and typo fixes.
Andre Noll [Fri, 20 Jul 2012 20:09:27 +0000 (22:09 +0200)]
NEWS: Whitespace and typo fixes.

paraslash-0.1.0 was released in 2004 rather than 2204.

11 years agonew codename, reset version to git
Andre Noll [Fri, 20 Jul 2012 08:46:02 +0000 (10:46 +0200)]
new codename, reset version to git

11 years agothe paraslash-0.4.11 release tarball
Andre Noll [Fri, 20 Jul 2012 08:41:24 +0000 (10:41 +0200)]
the paraslash-0.4.11 release tarball

11 years agoparaslash 0.4.11 v0.4.11
Andre Noll [Fri, 20 Jul 2012 08:38:07 +0000 (10:38 +0200)]
paraslash 0.4.11

11 years agoMerge branch 't/btr_improvements'
Andre Noll [Thu, 19 Jul 2012 16:46:58 +0000 (18:46 +0200)]
Merge branch 't/btr_improvements'

146316 btr_exec_up(): Also ask given node.
6d9c35 btr: Introduce btr_add_output_dont_free().
4ac313 btr: Remove btr_free_node().

Has been cooking in next for a week.

11 years agofade: Use proper ldflags.
Andre Noll [Sun, 15 Jul 2012 09:35:04 +0000 (11:35 +0200)]
fade: Use proper ldflags.

This cut and paste typo caused para_fade to be linked against
the libraries of para_write on systems with libossaudio (BSD).

11 years agofade: Fix sleep time in snooze mode.
Andre Noll [Mon, 2 Jul 2012 06:38:00 +0000 (08:38 +0200)]
fade: Fix sleep time in snooze mode.

We slept for the wrong amount of seconds.

11 years agoMerge branch 't/wma_improvements'
Andre Noll [Wed, 18 Jul 2012 16:47:33 +0000 (18:47 +0200)]
Merge branch 't/wma_improvements'

a02611 wma: Remove exponent_sizes[] from struct private_wma_data.

Has been cooking long enough.

11 years agogui: Add missing dependency on included m4 file to ggo makefile.
Andre Noll [Sun, 15 Jul 2012 21:22:33 +0000 (23:22 +0200)]
gui: Add missing dependency on included m4 file to ggo makefile.

gui.ggo depends on config_file.m4, but this dependency was not listed
in the makefile.

11 years agoMerge branch 't/old_gcc_fixes'
Andre Noll [Sun, 15 Jul 2012 19:57:33 +0000 (21:57 +0200)]
Merge branch 't/old_gcc_fixes'

82d304 buffer_tree.h: Fix gcc warning.
5535f6 alsa: Fix gcc warning.

Simple enough and well tested with no regressions found.

11 years agoMerge branch 't/clang'
Andre Noll [Wed, 11 Jul 2012 23:53:14 +0000 (01:53 +0200)]
Merge branch 't/clang'

869f0e aft.c: Silence scan-build warning.
4cdf53 mood: Improve readability of get_item_score().
ec5040 mood: Add score value only for admissible files.
76d527 client: Remove pointless assignment.
466c9b gcrypt: Remove pointless assignment.
98c13e gcrypt: Remove dead stores.
d458c2 mp3dec: Remove dead store.

Cooking for quite some time - no problems.

11 years agobtr_exec_up(): Also ask given node.
Andre Noll [Sun, 8 Apr 2012 19:31:10 +0000 (21:31 +0200)]
btr_exec_up(): Also ask given node.

At the moment, the buffer tree walk starts at the parent of the given
node. Users of the btr API can not execute a command for a node unless
it has at least one child.

This unnecessary restriction is removed in this commit by letting
the tree walk start at the given node rather than its parent.
This actually simplifies the code a bit.

11 years agobtr: Introduce btr_add_output_dont_free().
Andre Noll [Tue, 23 Aug 2011 19:04:02 +0000 (21:04 +0200)]
btr: Introduce btr_add_output_dont_free().

At the moment, all buffers which are fed to a buffer tree must be
allocated on the heap since the buffer tree code automatically frees
the buffer once its refcount dropped to zero.

The new afh receiver, however, mmaps the audio file and likes to feed
chunks of this memory map into the buffer tree. This is currently
impossible because such buffers must not be freed.

This patch adds the new public function btr_add_output_dont_free()
which works like btr_add_output() but sets the new dont_free bit
which prevents the buffer from being deallocated.

Also btr_inplace_ok() is changed to return "false" whenever there
exists a buffer in the input queue with the dont_free bit set.

11 years agowrite: Remove ->shutdown.
Andre Noll [Mon, 25 Jun 2012 11:16:51 +0000 (13:16 +0200)]
write: Remove ->shutdown.

No writer implements this method, and nobody even looks at this
pointer. Remove it.

11 years agobtr: Remove btr_free_node().
Andre Noll [Mon, 9 Apr 2012 19:57:54 +0000 (21:57 +0200)]
btr: Remove btr_free_node().

This has turned out to be source for bugs. Deallocate everything
in btr_remove_node() hence making removing the node and freeing
its resources an atomic operation.

To avoid dangling pointers to freed btrn nodes, the argument of
btr_remove_node() is changed to to struct btr_node **btrnp.

11 years agoaudiod: Kill some dead code.
Andre Noll [Sun, 1 Jul 2012 18:55:44 +0000 (20:55 +0200)]
audiod: Kill some dead code.

Both conditions are never true at this point.

11 years agoMerge branch 't/command_util_cleanups'
Andre Noll [Sun, 8 Jul 2012 16:02:54 +0000 (16:02 +0000)]
Merge branch 't/command_util_cleanups'

9f58f7 command_util: grep source files only once.
b4aff8 command_util: Fix make dependencies for *_command_list.h.
289547 Make (most) command handlers static.
ad3864 command_util: Remove code for generating .c files.
c9df5d command_util: Write array definition in header mode.
73ca79 command_util: Output array members with backslashes.
3792a2 command_util: Avoid empty output lines.
a51586 command_util: replace dump_xxx() by make_xxx().
6a4f5e command_util: Kill HC and CC header lines.

11 years agoMerge branch 't/alsa_fix'
Andre Noll [Mon, 2 Jul 2012 06:52:16 +0000 (08:52 +0200)]
Merge branch 't/alsa_fix'

3a56a6 alsa: Do not buffer more than 500ms.

Seems to work fine everywhere.

11 years agocommand_util: grep source files only once.
Andre Noll [Sun, 15 Apr 2012 05:25:22 +0000 (07:25 +0200)]
command_util: grep source files only once.

Currently we grep once for each template member. This patch speeds
up the header mode of command_util.sh by a factor of 3.

11 years agocommand_util: Fix make dependencies for *_command_list.h.
Andre Noll [Mon, 9 Apr 2012 23:43:38 +0000 (01:43 +0200)]
command_util: Fix make dependencies for *_command_list.h.

The *_command_list.h files depend on the .c files listed in the SF
header line of the .cmd command file because command_util.sh gets
the declaration of the command handlers from these files.

Unfortunately, make does not know about these dependencies, so we
have to mention them in the Makefile as well.

11 years agoMake (most) command handlers static.
Andre Noll [Sat, 7 Apr 2012 06:30:27 +0000 (08:30 +0200)]
Make (most) command handlers static.

Now that the array of commands for para_server and para_audiod are
read from a header file, the command handlers can be made static if
they are in the same file that defines the command array.

This patch makes all such handlers static and tweaks command_util.sh
to recognize also static functions.

11 years agocommand_util: Remove code for generating .c files.
Andre Noll [Thu, 28 Jun 2012 02:45:09 +0000 (04:45 +0200)]
command_util: Remove code for generating .c files.

Now that the *_command_list.c files are no longer needed we may remove
this mode from command_util.sh. This makes quite a few headers of
the .cmd files unused, so these can be removed as well.

11 years agocommand_util: Write array definition in header mode.
Andre Noll [Thu, 28 Jun 2012 02:23:32 +0000 (04:23 +0200)]
command_util: Write array definition in header mode.

This modifies command_util.sh so that when it is called in header mode,
it also defines a macro for the array of all commands. command.c and
audiod_command.c are changed to use the new preprocessor macro.

This allows to get rid of the *command_list.c files completely. We may
hence remove these files from the various lists of errlist objects
in configure.ac. and from error.h. A subsequent patch will clean up
the parts that have become unused by this commit.

11 years agocommand_util: Output array members with backslashes.
Andre Noll [Thu, 28 Jun 2012 01:08:00 +0000 (03:08 +0200)]
command_util: Output array members with backslashes.

This makes sure that the generated code for the definition of the
command array has backslashes at the end of each line.  Currently
this does not matter because make_array_member() is only called when
generating C code where new lines don't matter.

However, ending each line with a backslash allows to use the same
output for a cpp #define which can go into the header file.

11 years agocommand_util: Avoid empty output lines.
Andre Noll [Thu, 28 Jun 2012 00:51:28 +0000 (02:51 +0200)]
command_util: Avoid empty output lines.

Additional empty output lines do not matter for the generated C code or
the function declarations in the header files.  However, a subsequent
commit changes command_util.sh to  generate a preprocessor macro for
the header file, and there we can not afford empty lines unless they
end with a backslash to continue the line.

This patch makes sure that no superfluous newlines are printed in
the output.

11 years agocommand_util: replace dump_xxx() by make_xxx().
Andre Noll [Wed, 27 Jun 2012 23:18:23 +0000 (01:18 +0200)]
command_util: replace dump_xxx() by make_xxx().

This replace dump_array_member(), dump_completion() and dump_proto()
by their make_xxx counterpart.

This allows to iterate over all commands twice.

11 years agocommand_util: Kill HC and CC header lines.
Andre Noll [Wed, 27 Jun 2012 22:57:52 +0000 (00:57 +0200)]
command_util: Kill HC and CC header lines.

There is no point in pretty-printing the generated files. Nobody reads
these files anyway and doxygen ignores them as well.

11 years agowma: Remove exponent_sizes[] from struct private_wma_data.
Andre Noll [Fri, 1 Jun 2012 08:56:10 +0000 (10:56 +0200)]
wma: Remove exponent_sizes[] from struct private_wma_data.

This array is only used in compute_scale_factor_band_sizes(), and
even there we need only the current value. So it is enough to have
a single local variable in this function.

11 years agosideband: Fix use after free bug.
Andre Noll [Fri, 29 Jun 2012 14:28:11 +0000 (16:28 +0200)]
sideband: Fix use after free bug.

Commit 32ffc06c (Pass command exit status via sideband to client.)
made para_server's command handler send the exit status of the command
to the client as an RC4-encrypted sideband packet.

However, the encryption key has already been freed when this packet
is sent. This may result in client errors about invalid or unexpected
sideband designators, but these errors occurred rather infrequently,
which makes this bug hard to trigger. Presumably the freed memory is
usually not being reused since the command handler is going to dye
anyway after the packet is sent.

This patch fixes the bug by deferring to free the crypto keys until
the exit code has been sent.

11 years agoMerge branch 't/decoder_fixes'
Andre Noll [Tue, 26 Jun 2012 20:07:55 +0000 (22:07 +0200)]
Merge branch 't/decoder_fixes'

97dbfe wmadec: Only decode one superframe at a time.
d6e017 flacdec: Only process a single flac audio frame.
1e1968 flacdec_close(): Be liberal in what you accept.
3f96f9 oggdec: Fix EOF handling on repositioning.
c7e2f7 oggdec: Realloc buffer to save memory.
634e75 oggdec: Do not decode more than necessary.

These changes are well tested and there are no known problems.

11 years agobuffer_tree.h: Fix gcc warning.
Andre Noll [Mon, 18 Jun 2012 17:44:03 +0000 (19:44 +0200)]
buffer_tree.h: Fix gcc warning.

"loglevel" is declared as a global variable elsewhere, and gcc-3.3.3 complains
beacuse of this:

buffer_tree.h:199: warning: declaration of `loglevel' shadows a global declaration

Just call the thing "ll".

11 years agoalsa: Fix gcc warning.
Andre Noll [Mon, 18 Jun 2012 17:43:34 +0000 (19:43 +0200)]
alsa: Fix gcc warning.

gcc-3.3.3 complains about the local variable "log" in alsa_write.c:

alsa_write.c:75: warning: declaration of `log' shadows a global declaration

Rename this variable to "output_log" to silence the warning.

11 years agoMerge branch 't/sb'
Andre Noll [Sun, 24 Jun 2012 18:53:23 +0000 (20:53 +0200)]
Merge branch 't/sb'

Was cooking in next for several weeks with no problems so far.

fd864c Fix documentation of pass_buffer_as_shm().
32ffc0 Pass command exit status via sideband to client.
7dc1b5 Send command output via sideband.
0229d7 Introduce send_strerror().
d5a9e8 Simplify pass_buffer_as_shm().
3667d7 command.c: Improve get_status().
aa3fe7 Pass command via sideband.
9c2a26 Use sideband also for "proceed" handshake.
4744d9 Use sideband also for challenge response.
fa9e0e Send and receive challenge via sideband.
2830b9 Add sideband implementation.
e151db Implement client-server feature negotiation.
e31d5d afs: Rename sc_send_result() to afs_cb_result_handler().
68cb0a Introduce afs_max_size_handler_data and afs_max_size_handler().
d04b83 client: Improve error diagnostics.

11 years agoFix documentation of pass_buffer_as_shm().
Andre Noll [Mon, 18 Jun 2012 06:15:18 +0000 (08:15 +0200)]
Fix documentation of pass_buffer_as_shm().

Commit d5a9e8 renamed the argument "fd_ptr" to "fd" but missed
to rename this variable also in the long description.

11 years agoalsa: Do not buffer more than 500ms.
Andre Noll [Wed, 13 Jun 2012 15:53:07 +0000 (17:53 +0200)]
alsa: Do not buffer more than 500ms.

In alsa_init() we set the buffer time to the maximum value supported
by the device. However, on some systems this time is more than 10
seconds, which is much too high.

This patch changes alsa_init() to use a buffer time of at most
0.5 seconds.

11 years agowma: Doxify some comments.
Andre Noll [Fri, 1 Jun 2012 09:33:39 +0000 (11:33 +0200)]
wma: Doxify some comments.

struct coef_vlc_table->levels and struct getbit_context had undoxified
comments.

11 years agowma: Trivial whitespace fix.
Andre Noll [Fri, 1 Jun 2012 09:29:41 +0000 (11:29 +0200)]
wma: Trivial whitespace fix.

11 years agoAdd documentation of two more fields of struct private_wmadec_data.
Andre Noll [Fri, 1 Jun 2012 08:48:17 +0000 (10:48 +0200)]
Add documentation of two more fields of struct private_wmadec_data.

11 years agoaft.c: Silence scan-build warning.
Andre Noll [Fri, 1 Jun 2012 08:24:58 +0000 (10:24 +0200)]
aft.c: Silence scan-build warning.

scan-build issues the following warning in prepare_ls_row():

aft.c:1338:3: warning: Assigned value is garbage or undefined
GET_NUM_DIGITS(score, &num_digits);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
aft.c:719:21: note: expanded from:
typeof((x)) _tmp = PARA_ABS(x); \
   ^
./para.h:50:2: note: expanded from:
typeof(x) _x = (x); \
^              ~~~

This is because clang can not prove that the "score" variable is
always initialized at this point. However, I can: The problematic
GET_NUM_DIGITS() statement is only executed if LS_FLAG_ADMISSIBLE_ONLY
is set in options->flags, but in this case "score" will be set by
get_score_and_aft_row() because this function only fails to do so if it
returns negative. In this case we return early from prepare_ls_row().

Let's make it easier for clang and initialize it anyway.

11 years agomood: Improve readability of get_item_score().
Andre Noll [Wed, 13 Jun 2012 14:38:10 +0000 (16:38 +0200)]
mood: Improve readability of get_item_score().

This function returns whether the given item matches, so make
it return bool rather than int. This improves readability of
compute_mood_score(), which calls get_item_score() three times,
quite a bit.

No semantic changes.

11 years agomood: Add score value only for admissible files.
Andre Noll [Tue, 15 May 2012 21:19:29 +0000 (23:19 +0200)]
mood: Add score value only for admissible files.

mood.c:175:3: warning: Value stored to 'ret' is never read
                ret = get_item_score(item, &afsi, &afhi, path, &item_score,
                ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

This time scan-build found a real bug.

11 years agoclient: Remove pointless assignment.
Andre Noll [Tue, 15 May 2012 20:17:18 +0000 (22:17 +0200)]
client: Remove pointless assignment.

client.c:310:2: warning: Value stored to 'ret' is never read
        ret = i9e_extract_completions(ci->word, sl, &cr->matches);
        ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

11 years agogcrypt: Remove pointless assignment.
Andre Noll [Tue, 15 May 2012 20:16:38 +0000 (22:16 +0200)]
gcrypt: Remove pointless assignment.

gcrypt.c:700:6: warning: Assigned value is always the same as the existing value
        ret = key->num_bytes;
        ~~~ ^ ~~~~~~~~~~~~~~

11 years agogcrypt: Remove dead stores.
Andre Noll [Tue, 15 May 2012 20:15:41 +0000 (22:15 +0200)]
gcrypt: Remove dead stores.

gcrypt.c:502:2: warning: Value stored to 'cp' is never read
        cp += ret;
        ^     ~~~
gcrypt.c:577:2: warning: Value stored to 'cp' is never read
        cp += ret;
        ^     ~~~

11 years agomp3dec: Remove dead store.
Andre Noll [Tue, 15 May 2012 20:13:09 +0000 (22:13 +0200)]
mp3dec: Remove dead store.

mp3dec_filter.c:133:3: warning: Value stored to 'ret' is never read
                ret = mad_stream_sync(&pmd->stream);
                ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

11 years agoMakefile: Warn for unused macros only on Linux.
Andre Noll [Mon, 4 Jun 2012 08:29:42 +0000 (10:29 +0200)]
Makefile: Warn for unused macros only on Linux.

We need these macros at several places, but each of them causes
a compilier warning on FreeBSD and NetBSD where these macros are
not used at all.

This patch moves the -Wunused-macros option to the Linux-only
section.

11 years agowmadec: Only decode one superframe at a time.
Andre Noll [Sat, 7 Apr 2012 01:02:33 +0000 (03:02 +0200)]
wmadec: Only decode one superframe at a time.

Similar to the previous commit for the flac decoder, this commit
removes the loop in wmadec_post_select(). This gives other tasks a
chance to run and simplifies the code.

Also, if the buffer was not filled completely, it is truncated to
the proper size to reduce memory usage of the decoder.

11 years agoflacdec: Only process a single flac audio frame.
Andre Noll [Sat, 7 Apr 2012 01:02:02 +0000 (03:02 +0200)]
flacdec: Only process a single flac audio frame.

This removes the loop in flacdec_post_select() which makes the
flac decoder decode as much as possible, but may starve other
tasks. Removing the loop gives other tasks a chance to run, thereby
avoiding buffer underruns. It simplifies the code too.

Also, resetting the number of unconsumed input bytes to zero at
each scheduler iteration has always been a mistake, so remove it.

11 years agoflacdec_close(): Be liberal in what you accept.
Andre Noll [Tue, 10 Apr 2012 05:38:20 +0000 (07:38 +0200)]
flacdec_close(): Be liberal in what you accept.

Functions like close() which terminate an instance of some subsystem
should always be idempotent, i.e. when calling such a function twice
with the same argument, the second call should be a noop.

However, flacdec_close() violates this rule because it dereferences
its private pointer unconditionally. This patch makes the function
idempotent.

11 years agooggdec: Fix EOF handling on repositioning.
Andre Noll [Sun, 3 Jun 2012 09:59:42 +0000 (11:59 +0200)]
oggdec: Fix EOF handling on repositioning.

If playback starts near the end of the file, it might happen that (a)
the read callback consumes all the remaining part in one go (so the
node status is BTR_EOF) and (b) the last ov_read() returned OV_HOLE.

(b) makes the decoder wait for more data which will never arrive due to
(a). Currently we error out without playing the last part of the file.

This patch makes ogg_post_select() return an error only if additionally
fn->min_iqs == 0, which indicates we did not hit OV_HOLE during the
last ov_read().

11 years agooggdec: Realloc buffer to save memory.
Andre Noll [Sun, 13 May 2012 19:54:46 +0000 (21:54 +0200)]
oggdec: Realloc buffer to save memory.

The ogg/vorbis decoder always allocates 32K buffers for the decoded
output data. If the buffer could not be filled completely due to
insufficient input data being available, the partially filled 32K
buffer is added to the output buffer tree.

This patch truncates (reallocates) the buffer if this has happened,
thereby reducing the memory footprint of the decoder.

11 years agoaudiod: Check pointers passed to btr_get_node_start().
Andre Noll [Sat, 7 Apr 2012 22:25:42 +0000 (00:25 +0200)]
audiod: Check pointers passed to btr_get_node_start().

If the receiver or writer buffer tree node pointer is NULL, we'll segfault due
to a a NULL pointer dereference in btr_get_node_start(). Although this might
not be triggerable, it does not hurt to be defensive here.

11 years agooggdec: Do not decode more than necessary.
Andre Noll [Wed, 11 Apr 2012 21:16:00 +0000 (23:16 +0200)]
oggdec: Do not decode more than necessary.

Currently the ogg vorbis decoder decodes at least one buffer per
scheduler iteration and checks only then if its output queue is already
full. This is bad for several reasons, increased memory footprint is
one of them.

This patch adds an additional check at the beginning of
ogg_post_select() that causes the function to return early if the
output queue is full.

11 years agooss: Add proper error message on init.
Andre Noll [Wed, 16 May 2012 13:21:10 +0000 (15:21 +0200)]
oss: Add proper error message on init.

If the device node of the sound device (/dev/dsp) does not exist,
we currently fail with a "no such file or directory" error message
without mentioning the name of the device. This adds a log message
which clarifies what went wrong.

11 years agoPass command exit status via sideband to client.
Andre Noll [Sun, 26 Feb 2012 13:14:18 +0000 (14:14 +0100)]
Pass command exit status via sideband to client.

Currently the only way for the client side to tell whether a command
failed is to parse the command output. This patch changes command.c to
send an empty sideband packet at command termination. If the command
succeeded, the sideband designator is set to SBD_EXIT__SUCCESS,
otherwise it is SBD_EXIT__FAILURE.

The client checks for these sideband packets and terminates with
EXIT_FAILURE if it received the SBD_EXIT__FAILURE packet.

11 years agoSend command output via sideband.
Andre Noll [Sat, 5 May 2012 10:11:54 +0000 (12:11 +0200)]
Send command output via sideband.

The next step towards sideband connections is to send the output of
each command as a sideband packet. To this aim, afs_cb_result_handler(),
pass_buffer_as_shm() and the callback_result_handler typedef are modified
to receive an additional "band" parameter.

For regular command output the value of this parameter is SBD_OUTPUT,
the sideband designator for normal output. The client code is patched
to add the contents of received SBD_OUTPUT sidband packets to the
buffer tree for the normal ouput.

However, log messages, which are only written to the log output
of the server at the moment, may also passed to the client via the
SBD_XXX_LOG designators, where XXX is the name of one of the usual
log levels for para_log().

The patch contains quite a few changes of the form

if (use_sideband)
do_new_stuff()
else
do_it_as_before()

which is a bit ugly, but we may remove the old method in 0.5.0,
which will support only sideband connections.

11 years agoIntroduce send_strerror().
Andre Noll [Sat, 5 May 2012 10:10:08 +0000 (12:10 +0200)]
Introduce send_strerror().

There are many places in various command handlers where the error path
contains code like

sc_send_va_buffer(&cc->scc, "%s\n", para_strerror(-ret));

to send an error message to the client.  This patch simplifies all
these places by introducing the public function send_strerror() which
takes a command context structure and an error code, and executes the
above statement. All places where this was open-coded are changed
to call the new function instead.

11 years agoSimplify pass_buffer_as_shm().
Andre Noll [Sat, 5 May 2012 09:18:58 +0000 (11:18 +0200)]
Simplify pass_buffer_as_shm().

Currently, this function takes a pointer to the file descriptor. For
no good reason, we may as well pass the fd directly.

This patch also adds a comment about the callers of this function.

11 years agocommand.c: Improve get_status().
Andre Noll [Sat, 5 May 2012 09:04:23 +0000 (11:04 +0200)]
command.c: Improve get_status().

We know exactly the number of bytes in the result buffer. By returning
this information, the caller can use sc_send_bin_buffer() instead of
sc_send_buffer(), which safes one strlen() call.

11 years agoPass command via sideband.
Andre Noll [Thu, 5 Jan 2012 16:19:49 +0000 (17:19 +0100)]
Pass command via sideband.

This makes para_cclient pass the paraslash command and its arguments
as a sideband packet to para_server if possible.

For sideband connections the command and its arguments are stored as
NULL-terminated strings. This is better than separating by newlines
(as we do for non-sideband connections) because it allows for arguments
containing newlines.

Suitable helpers for creating and parsing a buffer of NULL-terminated
strings, are provided in client_common.c and command.c, respectively.

No change for non-sideband connections.

11 years agoUse sideband also for "proceed" handshake.
Andre Noll [Thu, 22 Dec 2011 22:24:54 +0000 (23:24 +0100)]
Use sideband also for "proceed" handshake.

This adds sideband-aware code for the next step of the connection
handshake. If sideband connections are supported at both ends,
the server side sends an empty sideband packet with designator
SBD_PROCEED if the client was authenticated successfully.  When the
client receives this packet, it enters the CL_RECEIVED_PROCEED state,
just as with non-sideband connections.

11 years agoUse sideband also for challenge response.
Andre Noll [Wed, 4 Jan 2012 20:47:55 +0000 (21:47 +0100)]
Use sideband also for challenge response.

This changes server and client to exchange the challenge response
as a sideband packet if both ends support sideband connections. The
SBD_CHALLENGE_RESPONSE designator is used for this purpose. On the
client side the changes are less intrusive due to an additional
cleanup of the state handling.

During connection setup the client's idea of the state of
the connection is monitored in the ->status variable of struct
client_task. If the client is in the CL_SENT_AUTH state, it receives
the challenge and sends the hash of the decrypted challenge back to the
server. Either operation may fail, and it seems cleaner to separate
the two. So this patch adds the new state CL_RECEIVED_CHALLENGE. The
clients enters this state once it decrypted the received challenge.

11 years agoSend and receive challenge via sideband.
Andre Noll [Wed, 4 Jan 2012 20:46:11 +0000 (21:46 +0100)]
Send and receive challenge via sideband.

If both server and client support sideband connections, the challenge
is now sent as a sideband packet using the dedicated SBD_CHALLENGE
designator.

11 years agoAdd sideband implementation.
Andre Noll [Sun, 18 Dec 2011 19:18:49 +0000 (20:18 +0100)]
Add sideband implementation.

This adds the new source files sideband.[ch] to the repository and
links the corresponding object file into para_server, para_audiod
and para_client.

The sideband API enables the command handlers of para_server to send a
multiplexed output stream. The client side (para_client or para_audiod)
demultiplex the received stream afterwards.

The design is as simple as it can be: Each data buffer is preceded
by a 5-byte header containing the length and the band designator,
a one-byte number which specifies the type of the data which follows.

The server-side and the client-side implement their own variant of the
send_sb() and recv_sb() functions for sending and receiving sideband
packets. Two implementations are necessary because the underlying
file descriptor is blocking on the server side (command handlers of
para_server) while it is non-blocking on the client side (para_client
and para_audiod).

The sideband API allows to optionally filter all data (including the
sideband header) through an arbitrary transformation. This patch adds
a suitable transformation as a new public function performs RC4 to
the crypto API.

To keep the patch within reasonable size, this commit does not contain
any users of the new sideband API yet. Subsequent commits will teach
the authentication handshake code and the command handlers to send
and receive data as sideband packets.

11 years agoImplement client-server feature negotiation.
Andre Noll [Sat, 3 Dec 2011 13:42:12 +0000 (14:42 +0100)]
Implement client-server feature negotiation.

The server announces a list of supported features and the client may
request any subset of features.

The only supported feature is "sideband". It has no effect at the
moment but this will change in subsequent patches.

TODO: Documentation, remove "foo" feature.

11 years agoafs: Rename sc_send_result() to afs_cb_result_handler().
Andre Noll [Mon, 16 Jan 2012 21:41:06 +0000 (22:41 +0100)]
afs: Rename sc_send_result() to afs_cb_result_handler().

The old name was rather confusing because the "sc" prefix indicates
that this function is part of the stream cipher crypto API, which is
not the case.

11 years agoIntroduce afs_max_size_handler_data and afs_max_size_handler().
Andre Noll [Mon, 16 Jan 2012 21:14:41 +0000 (22:14 +0100)]
Introduce afs_max_size_handler_data and afs_max_size_handler().

Whenever the maximal size of a para buffer is reached, para_printf()
calls the specified max size handler. This handler takes, in addition
to the actual buffer and its size, a void * context pointer.  Currently
all commands simply pass a pointer to the underlying file descriptor
here since this is the only context the handler needs to know about.

However, this is going to change since with sideband connections the
handler needs to know also the sideband designator.

To meet this future need, this patch introduces struct
afs_max_size_handler_data, which consists of the file descriptor only
at the moment, as well as a simple wrapper for pass_buffer_as_shm().

11 years agoclient: Improve error diagnostics.
Andre Noll [Sun, 26 Feb 2012 11:53:43 +0000 (12:53 +0100)]
client: Improve error diagnostics.

If an error occurs in the post_select() method of the client task,
the scheduler removes this task from the task list and then returns
zero to indicate that the task list has become empty.

Currently, client.c looks only at the return value of schedule() and
therefore returns success in this case.  This patch makes client.c
additionally check the task error state of the client task and
prints an error message if it was negative and different from an
EOF condition.

11 years agoMerge branch 't/remove_no_default_filters'
Andre Noll [Sat, 5 May 2012 10:50:37 +0000 (12:50 +0200)]
Merge branch 't/remove_no_default_filters'

We have printed a warning for several month if this option was
still used. This should be enough.

11 years agoRemove --no_default_filters option.
Andre Noll [Sun, 24 Jun 2012 17:26:16 +0000 (19:26 +0200)]
Remove --no_default_filters option.

This option was deprecated in paraslash-0.4.10 and can go away now.

11 years agoMerge branch 't/doc'
Andre Noll [Sat, 5 May 2012 10:48:27 +0000 (12:48 +0200)]
Merge branch 't/doc'

11 years agodaemon.c: daemon_set_default_log_colors() returns void.
Andre Noll [Tue, 24 Apr 2012 06:43:32 +0000 (08:43 +0200)]
daemon.c: daemon_set_default_log_colors() returns void.

Remove the incorrect documentation of the (non existing) return
value.

11 years agoClient: Simplify signal handling.
Andre Noll [Mon, 9 Apr 2012 19:07:23 +0000 (21:07 +0200)]
Client: Simplify signal handling.

There is no point in having a sighandler which just calls another one.
This patch makes i9e_signal_dispatch() the handler for SIGINT and
removes the pointless wrapper.

11 years agorecv.h: Fix typo in documentation.
Andre Noll [Sat, 14 Apr 2012 22:04:29 +0000 (00:04 +0200)]
recv.h: Fix typo in documentation.

The sentence contains the word "the" twice.

11 years agoFix a typo in the documentation of struct ggo_help.
Andre Noll [Sat, 14 Apr 2012 21:59:52 +0000 (23:59 +0200)]
Fix a typo in the documentation of struct ggo_help.

s/exexutables/executables.

11 years agoAdd some more starting points to main page.
Andre Noll [Sat, 14 Apr 2012 21:28:57 +0000 (23:28 +0200)]
Add some more starting points to main page.

This adds links to struct writer_node, the flacdec filter and to
interactive.c to the main doxygen web page. It also fixes a typo.

11 years agoAdd some missing documentation.
Andre Noll [Sat, 14 Apr 2012 21:17:03 +0000 (23:17 +0200)]
Add some missing documentation.

This makes doxygen a bit happier.