paraslash.git
7 years agomanual: Do not mention gengetopt and help2man any more.
Andre Noll [Sun, 26 Jun 2016 10:44:56 +0000 (12:44 +0200)]
manual: Do not mention gengetopt and help2man any more.

Both tools are no longer required to build the paraslash tree, so
there is no point to list them in the set of packages to install. The
patch also removes the links to the source code from the user manual.

7 years agoConvert para_server to lopsub.
Andre Noll [Fri, 24 Jun 2016 19:38:24 +0000 (21:38 +0200)]
Convert para_server to lopsub.

This is the last executable to be converted to lopsub.

acl_init() is removed from acl.c, and the initialization of the access
control list is moved to init_sender_status() of send_common.c. It
now takes an lls_opt_result argument and calls acl_add_entry() for
each argument given. The latter function needs to be made public.

In dccp_send.c we check the FEC parameters and change the gengetopt
config structure to contain the default values if invalid FEC
parameters were given. With lopsub this is no longer possible as
the lls_parse_result structure is opaque. We copy the FEC parameters
to a dccp_fec_client structure anyway, so is it easiest to move the
check there.

The patch removes the unused gengetopt option files but leaves the
gengetopt infrastructure of the build system in place. The build
system will be cleaned up in subsequent patches.

7 years agoConvert para_audiod to lopsub.
Andre Noll [Sat, 27 Aug 2016 13:05:13 +0000 (15:05 +0200)]
Convert para_audiod to lopsub.

This commit replaces the gengetopt file for para_audiod by a lopsub
suite, introducing several new files in m/lls/include which correspond
to options also needed by para_server (which has not been converted
to lopsub yet).

The audiod_status_info enumeration is now provided by lopsub and can
be removed from audiod.h.

The patch also  adds a new description section to the manual page
para_audiod(1).

7 years agoaudiod: Remove unused --stream-delay.
Andre Noll [Mon, 20 Jun 2016 20:35:04 +0000 (22:35 +0200)]
audiod: Remove unused --stream-delay.

This option is a no-op since six years: Commit 25c11569 removed the
only user of this option.

7 years agoConvert para_afh to lopsub.
Andre Noll [Sat, 18 Jun 2016 16:06:55 +0000 (18:06 +0200)]
Convert para_afh to lopsub.

This commit replaces the gengetopt file for para_afh by the lopsub
suite afh.suite and links the executable with --llopsub.

The patch also adds a short description of the two operating modes
of para_afh (print or modify) to the manual page para_afh(1).

7 years agoConvert para_gui to lopsub.
Andre Noll [Sat, 18 Jun 2016 14:57:39 +0000 (16:57 +0200)]
Convert para_gui to lopsub.

This replaces the gengetopt file for para_gui by a lopsub suite and
links para_gui with -llopsub.

The new FOR_EACH_KEY_MAP() macro is introduced for iterating over
all key bindings given at the command line or in the config file.

The bulk of the change is parse_config_file_or_die() where we get rid
of the gengetopt specific hack which removed all key bindings due to
gengetopt appending the options when the config parser is called a
second time.

The patch also adds a description section to the man page of para_gui.

7 years agogui: Remove --timeout.
Andre Noll [Sun, 25 May 2014 22:02:40 +0000 (00:02 +0200)]
gui: Remove --timeout.

para_gui should work well regardless of the scheduler timeout setting.
This commit removes the timeout options and changes gui.c to use a
fixed timeout of one second.

7 years agoConvert para_filter to lopsub.
Andre Noll [Sun, 12 Jun 2016 18:46:10 +0000 (20:46 +0200)]
Convert para_filter to lopsub.

Changes the semantics in case --filter is not given. We used to
print an error, but it makes more sense to show the list of supported
filters in this case.

If no filters are given, we now print the list of available filters. A
new function in filter_common.c, print_filter_list(), is introduced
for this purpose.

The manual page of para_filter has been extended to include an overall
description of the command.

The only error code of filter.c, E_NO_FILTERS, becomes unused and is
removed.

7 years agoConvert para_write to lopsub.
Andre Noll [Fri, 26 Aug 2016 18:12:01 +0000 (20:12 +0200)]
Convert para_write to lopsub.

This replaces the gengetopt file write.m4 by write.suite.m4, making use
of the shared macros in m4/lls/include for --channels, --sample-format
and --sample-rate.

The gengetopt files for these options are not needed for the unconverted
executables which still rely on gengetopt, so they can be removed.

In write.c we now use LLS_COPY_WAV_PARMS() rather than
COPY_WAV_PARMS(). The latter macro becomes unused and is removed
as well.

7 years agoConvert para_recv to lopsub.
Andre Noll [Fri, 26 Aug 2016 13:28:24 +0000 (15:28 +0200)]
Convert para_recv to lopsub.

This converts the gengetopt parser for para_recv to lopsub format,
replacing the ggo file by a lopsub suite.

The conversion is rather simple because para_recv does not have
a config file parser and because changes to the build system are
small because we already link para_recv with -llopsub due to the
recv_cmd suite.

7 years agoConvert writers to lopsub.
Andre Noll [Sun, 10 Apr 2016 20:50:17 +0000 (22:50 +0200)]
Convert writers to lopsub.

Similar to the previous commits for receivers and filters, this
commit replaces the five gengetopt parsers for the alsa, ao, file,
oss, osx writers by a lopsub suite and links para_write with -llopsub.

This allows to get rid of the WRITER_ENUM and the writers array as a
reference to each writer structure are stored in the lopsub user_data
pointer. Moreover, ->init(), ->parse_config(), ->free_config()
and ->ggo_help() of struct writer are not needed any more and can
be removed.

The patch also removes write_common.h and moves the few prototypes
write.h.

Now that receivers, filters and writers have all been converted, we
may also stop to include ggo.h from audiod_command.c and play.c.

As for the receivers and filters, t0005 needs slight adjustments due
to the new section header in the man page.

7 years agomake converter_arg in resamplefilter an enum option
Andre Noll [Tue, 27 Dec 2016 17:54:37 +0000 (18:54 +0100)]
make converter_arg in resamplefilter an enum option

7 years agoConvert filters to lopsub.
Andre Noll [Sun, 10 Apr 2016 20:44:30 +0000 (22:44 +0200)]
Convert filters to lopsub.

This replaces the *_filter.m4 gengetopt files by the filter_cmd
lopsub suite, where each filter is realized as a subcommand. Due to
this change, para_filter needs to be linked with -llopsub.

The filter structure is now stored in the user_data pointer provided
by lopsub, allowing to get rid of the global filters[] array, the
FILTER_ENUM macro and the corresponding enumeration constants.

The removal of the ->goo_help member of struct filter makes this
structure constant. Hence ->init() of struct filter can also go
away. We still can tell whether a filter is supported by checking
the user_data pointer: if it is NULL, the filter is unsupported. The
new filter_supported() helper in filter_common.c is provided for
convenience.

Parsing of the filter command line options is now performed
generically, and the ->parse_config() method is renamed to ->setup(),
an optional function which is supposed to perform semantic checks
and the one-time setup of the filter, if any. It is accompanied by
->teardown() which replaces ->free_config().

The conversion of the individual filters is easy since most filters
have a simple syntax or take no arguments at all. The resample_filter,
however, needs a different way to copy the wav parameters from the
lopsub parse result to the wav parms structure. A suitable macro,
LLS_COPY_WAV_PARMS is added to check_wav.h for this purpose. The old
COPY_WAV_PARMS needs to stay until para_write, the only other user
of the macro, has been converted as well.

The section heading of the manual page has changed slightly, causing
t0005 to fail. Hence this test needs a slight adjustment.

7 years agoConvert para_play to lopsub.
Andre Noll [Tue, 23 Aug 2016 10:04:19 +0000 (12:04 +0200)]
Convert para_play to lopsub.

This changes para_play to use the lopsub library rather than gengetopt
for parsing the command line and the config file.

The old approach of permuting argv[] no longer works with lopsub
because direct access to the array of non-option arguments is no
longer possible. Therefore we introduce shuffle_map[], an array of
indices which defaults to 1..n if --randomize is not given, and a
random permutation of 1..n otherwise. The new get_playlist_file()
helper returns the path to the input file determined by permuting
the given index.

The overall description for the manual page has also been improved
slightly.

Since m4/gengetopt/history_file.m4 has become unused, this file can
be removed.

7 years agoConvert para_fade to lopsub.
Andre Noll [Sun, 10 Apr 2016 20:31:11 +0000 (22:31 +0200)]
Convert para_fade to lopsub.

This replaces the ggo file for the command line and config file parser
of para_fade by a lopsub suite file and links para_fade against the
lopsub library.

As there are no subcommands, the conversion is straight forward and
the bulk of the patch are simple changes which replace access to the
gengetopt structure by equivalent lopsub constructs.

7 years agoConvert para_client to lopsub.
Andre Noll [Sun, 10 Apr 2016 20:29:29 +0000 (22:29 +0200)]
Convert para_client to lopsub.

This replaces the gengetopt command line parser for para_client by a
lopsub suite and links para_client against the lopsub library. The ggo
file for para_client was the last user of m4/gengetopt/complete.m4,
so this file can be removed.

The tricky part is create_merged_lpr(), which replaces
make_client_argv(). It is called from the i9e line handler and from
the completers. The new function merges the original parse result
with the arguments given at the command line to produce the parse
result stored in the client task structure.

The completers no longer duplicate the possible options each server
subcommand because the header file generated by lopsubgen exposes
an array of string literals which is suitable as the opts argument
of i9e_complete_option().

7 years agoConvert receivers to lopsub.
Andre Noll [Mon, 22 Aug 2016 13:13:40 +0000 (15:13 +0200)]
Convert receivers to lopsub.

This converts the four receivers (afh, http, dccp, udp) to use the
lopsub library instead of gengetopt.

The command line options of the receivers are implemented as
subcommands of the new recv_cmd lopsub suite. Hence the four gengetopt
command line parsers and ->ggo_help of struct receiver can be removed.

This change allows to get rid of the receiver array which was defined
through the DEFINE_RECEIVER_ARRAY macro.  We now store each receiver
structure in the user_data pointer provided by lopsub.

Since this structure is initialized at compile time (and constant since
->ggo_help is gone), ->init() of struct receiver is no longer needed to
initialize the various function pointers. The function is now optional
and does not take an argument any more. At the moment, only the afh
receiver needs ->init() to initialize all supported audio format handlers.

t0005 needs slight adjustment since the section headers of the help text
have changed a bit.

7 years agoConvert audioc to lopsub.
Andre Noll [Sun, 7 Aug 2016 22:01:19 +0000 (00:01 +0200)]
Convert audioc to lopsub.

This changes para_audioc to use the lopsub library rather than
gengetopt for parsing the command line options. The gengetopt input
file m4/gengetopt/audioc.m4 is replaced by an equivalent suite file,
audioc.c is adjusted to call the lopsub primitives instead if the
gengetopt parsers, and para_audioc is linked against lopsub. Moreover,
the manual page of audioc is now generated with lopsubgen.

Since this is the first executable which is converted, the commit
introduces a fair amount of infrastructure which will also be used
by other executables. Specifically:

* Common command line options (--help, --detailed-help, --version,
--loglevel, --history_file, --complete) are stored in per-option
files below m4/lls/include. Each of these files is included from
audioc.suite.m4. To tell make which files audioc.suite depends on,
we use the line synchronization feature of m4 and a simple awk script
to create a .m4d file which contains these dependencies, similar to
the .d files which describe dependencies of .c and .h files. The new
m4_lls_deps make variable contains the set of .m4d files.

* A generic copyright section for the man page which refers to the
COPYRIGHT_YEAR macro, defined from the make variable in Makefile.real.

* The new make variable LOGLEVELS. We need to know the set of loglevels
in the suite files as well as in the C code, so the variable avoids
to duplicate this information.

7 years agoRemove *.cmd and command_util.bash.
Andre Noll [Sat, 31 Dec 2016 19:07:33 +0000 (20:07 +0100)]
Remove *.cmd and command_util.bash.

The four *.cmd files are no longer needed and can be removed,
along with the script which transformed these files into C code. The
directory for the generated files, $(build_dir)/cmdlist, can go away
as well.

With command_util.bash gone, the Makefile can also be cleaned up
considerably. In particular, the ugly TOUPPER make function can be
removed because it was only used by the command_util recipe. Moreover,
The dependencies for the *.command_list.* files are no longer needed.

Finally, the sed command which fixed up the dependencies in the *.d
files can be simplified.

7 years agoplay: Remove support for non-lopsub commands.
Andre Noll [Mon, 7 Sep 2015 21:40:58 +0000 (23:40 +0200)]
play: Remove support for non-lopsub commands.

This cleans up play.c to get rid of struct pp_command, the array of
command handlers and the compatibility code for non-lopsub commands
in run_command() and com_help().

Also the FOR_EACH_COMMAND() macro to iterate over all non-lopsub
commands can go away and we no longer need to include the
play.command_list.h header generated by command_util.bash.

7 years agoplay: Convert com_quit() to lopsub.
Andre Noll [Mon, 28 Mar 2016 03:52:25 +0000 (03:52 +0000)]
play: Convert com_quit() to lopsub.

This converts the last subcommand of para_play. Cleanups are done in
subsequent patches although the declarations of the command handlers
are removed here because they have become unused and triggered
compiler warnings.

7 years agoplay: Convert com_tasks() to lopsub.
Andre Noll [Mon, 28 Mar 2016 03:51:23 +0000 (03:51 +0000)]
play: Convert com_tasks() to lopsub.

Nothing to see here: only the usual changes to the command handler,
and no changes to the help text.

7 years agoplay: Convert com_pause() to lopsub.
Andre Noll [Mon, 28 Mar 2016 03:50:36 +0000 (03:50 +0000)]
play: Convert com_pause() to lopsub.

The argc check can be removed from the command handler of this
subcommand. Other than that no changes to (the body of) com_pause()
are necessary.

7 years agoplay: Convert com_play() to lopsub.
Andre Noll [Mon, 28 Mar 2016 03:49:45 +0000 (03:49 +0000)]
play: Convert com_play() to lopsub.

Straight forward conversion, slight improvement of the help text.

7 years agoplay: Convert com_info() to lopsub.
Andre Noll [Mon, 28 Mar 2016 03:48:50 +0000 (03:48 +0000)]
play: Convert com_info() to lopsub.

This also improves the help text slightly to be more specific about
the output of the subcommand.

7 years agoplay: Convert com_ls() to lopsub.
Andre Noll [Mon, 28 Mar 2016 03:47:55 +0000 (03:47 +0000)]
play: Convert com_ls() to lopsub.

This also gets rid of the undocumented pattern matching. The command
now takes no arguments and always lists all files.

7 years agoplay: Convert com_ff() to lopsub.
Andre Noll [Mon, 28 Mar 2016 03:47:07 +0000 (03:47 +0000)]
play: Convert com_ff() to lopsub.

Converting com_ff() is analogous to com_jmp() since both subcommands
take a single integer argument. See the commit message of the previous
commit which converted com_jmp() for more information.

7 years agoplay: Convert com_jmp() to lopsub.
Andre Noll [Mon, 28 Mar 2016 16:55:58 +0000 (16:55 +0000)]
play: Convert com_jmp() to lopsub.

The command handler needs to check that there is a single argument
which is an integer between 0 and 100. This check needs to be modified
to use the lopsub primitives rather than accessing the argument
vector directly.

Unfortunately we can not perform the conversion of the string argument
into an int value with lopsub since the given percentage is an unnamed
option rather than an argument of an option.

The patch also rewords the summary and the help text of the jmp
subcommand slightly to be more clear.

7 years agoplay: Convert com_bg() to lopsub.
Andre Noll [Mon, 28 Mar 2016 16:55:42 +0000 (16:55 +0000)]
play: Convert com_bg() to lopsub.

There is not much to convert since the command takes no arguments,
and thus lpr is unused. The commit gets rid of the argc check which
is performed by lopsub and fixes a typo in the command summary:
s/input/insert.

7 years agoplay: Convert com_prev() to lopsub.
Andre Noll [Mon, 7 Sep 2015 20:30:31 +0000 (22:30 +0200)]
play: Convert com_prev() to lopsub.

The arg count check can be removed from the command handler, and the
pointless help text of the commit has been removed because it said
more or less the same as the summary text.

7 years agoplay: Convert com_next() to lopsub.
Andre Noll [Mon, 28 Mar 2016 04:05:14 +0000 (04:05 +0000)]
play: Convert com_next() to lopsub.

com_next() is also called from com_jmp(), where we needed to pass
a fake argv. This is no longer necessary as com_next() now takes
a parse result pointer which is unused. So we may just pass NULL
from com_jmp().

7 years agoplay: Convert com_fg() to lopsub.
Andre Noll [Mon, 28 Mar 2016 04:04:56 +0000 (04:04 +0000)]
play: Convert com_fg() to lopsub.

Lopsub fails to parse the command line if one or more arguments are
given, allowing to remove the check from the command handler.

The commit also extends the help text of the subcommand to mention
that the colon key can also be used to return to input mode.

7 years agoplay: Link against lopsub and convert com_help() to lopsub.
Andre Noll [Sun, 10 Apr 2016 20:02:10 +0000 (22:02 +0200)]
play: Link against lopsub and convert com_help() to lopsub.

This introduces the play_cmd suite for the subcommands of para_play,
like play, pause, fg, bg, etc. The new suite contains only the
"help" subcommand so far. Other commands will be converted one by one
in subsequent patches.

We make use of the lopsub user_data feature to store a pointer to the
command handler in the lls_command structure generated by lopsubgen.
This pointer is initialized by the new EXPORT_PLAY_CMD_HANDLER macro
in play.c.

The suite has no supercommand, therefore lopsubgen adds a special
"unavailable" identifier to play.lsg.h. We must therefore provide a
dummy completer for the fake supercommand.

Until all subcommands are converted, the run_command() and com_help()
subcommand need to iterate over two command lists. Afterwards, this
compatibility code can be removed.

7 years agoafs.c: Remove compatibility code in action_if_pattern_matches().
Andre Noll [Fri, 2 Oct 2015 02:34:53 +0000 (02:34 +0000)]
afs.c: Remove compatibility code in action_if_pattern_matches().

This is no longer needed as there are no more non-lopsub
commands left. Now pmd->lpr is non-NULL for all commands which
call action_if_pattern_matches(), which allows to simplify the
function. Moreover, ->patterns of struct pattern_match_data is unused
and can be dropped.

7 years agoserver: Remove ->argc, ->argv from struct command_context.
Andre Noll [Sun, 22 May 2016 11:37:48 +0000 (13:37 +0200)]
server: Remove ->argc, ->argv from struct command_context.

Command handlers should not look at the argv[] vector directly
but only use the lopsub library functions to access the parsed
command line.

In fact, the only function which accesses the argv vector is
run_command(). Defining argc and argv as local variables in this
function allows to drop the two members from the command context
structure.

7 years agoserver: Remove support for non-lopsub commands.
Andre Noll [Sun, 31 Jul 2016 08:32:57 +0000 (10:32 +0200)]
server: Remove support for non-lopsub commands.

Now that all commands have been converted to lopsub, struct
server_command is no longer needed and can be removed, along with
the helper functions for lookup and permission checking.

7 years agoafs: Remove unused call_callback helpers.
Andre Noll [Sun, 6 Sep 2015 19:01:41 +0000 (21:01 +0200)]
afs: Remove unused call_callback helpers.

send_option_arg_callback_request() and send_standard_callback_request()
have both become unused now that all server commands have been
converted to lopsub. This patch gets rid of these functions and
removes their declarations from afs.h.

7 years agoEnable partial matching for server commands.
Andre Noll [Mon, 5 Sep 2016 15:34:53 +0000 (17:34 +0200)]
Enable partial matching for server commands.

The feature was deactivated in an earlier commit which converted the
lsatt command to lopsub. The problem was that "ls" would have been
interpreted as lsatt because lsatt was the only converted command
that started with ls.

Now that all server commands are converted, the lopsub library function
lls_lookup_subcmd() does the right thing, so this patch removes the
additional test for an exact match.

7 years agols conversion cleanup
Andre Noll [Mon, 26 Dec 2016 14:04:18 +0000 (15:04 +0100)]
ls conversion cleanup

7 years agoserver: Convert com_ls() to lopsub.
Andre Noll [Sun, 27 Dec 2015 22:04:29 +0000 (22:04 +0000)]
server: Convert com_ls() to lopsub.

This is the final server command to be converted to the lopsub API.
Besides the conversion to lopsub, the patch changes the semantics
of the ls command in two ways: The deprecated -p option is removed,
and the -F option is made the default so that full paths are printed
if -b is not given.

Regarding the conversion, the patch removes enum ls_flags which used to
contain the various flags of the ls command. This information can now
be extracted in the callback from the deserialized parse result. Also
write_score() is kind of pointless and is replaced by inlining it.

Note that make_status_items() is also affected by this patch because
it makes use of the infrastructure of the ls command. This function
is called from the event handler of the audio file table for events
of type AFSI_CHANGE and AFHI_CHANGE.

Since no more non-lopsub server commands are left after this patch,
several cleanups are possible. These are dealt with in subsequent
patches.

7 years agoserver: Convert blob commands to lopsub.
Andre Noll [Sun, 20 Mar 2016 18:41:25 +0000 (18:41 +0000)]
server: Convert blob commands to lopsub.

This converts all blob commands (ls, cat rm, mv) in one go to lopsub,
making the patch rather large.

The addblob commands are special in that we must pass not only the
blob name given at the command line to the callback but also the
blob data which was read from stdin. The command handler does not
serialize the parse result like most other commands do, but constructs
a query object containing name and data for the callback. Therefore
the command handler does not call send_lls_callback_request() but
send_callback_request(). We continue to follow this scheme.

blob.c contains a few macros which expand to a set of functions,
one for each type of bloc (mood, playlist, image, lyrics). These
macros have to be adjusted to take another argument because we need
the prefixes (e.g., lyr for lyrics) in both upper and lower case and
there is no preprocessor toupper().

7 years agoserver: Convert com_addatt() to lopsub.
Andre Noll [Fri, 2 Oct 2015 21:13:33 +0000 (21:13 +0000)]
server: Convert com_addatt() to lopsub.

Another simple command without options which is easy to convert. The
only thing worth noting is that we now fail the command early if more
than 64 arguments are given when previously we only checked that at
least one argument is given.

7 years agoserver: Convert com_touch() to lopsub.
Andre Noll [Fri, 2 Oct 2015 21:10:36 +0000 (21:10 +0000)]
server: Convert com_touch() to lopsub.

Another open-coded option parser bites the dust.

This also gets rid of struct com_touch_options, along with the ugly
convention of passing -1 to the action handler to indicate that the
option was not given.

The documentation was enhanced slightly and now explains in the
[description] section the general concept of the touch command.

7 years agoserver: Convert com_select() to lopsub.
Andre Noll [Fri, 2 Oct 2015 21:15:06 +0000 (21:15 +0000)]
server: Convert com_select() to lopsub.

Pretty straight-forward conversion since the command does not have
any arguments. In the callback handler, we we can't return directly
any more since we need to free the serialized parse result.

7 years agoserver: Convert com_rm() to lopsub.
Andre Noll [Sun, 11 Oct 2015 00:17:55 +0000 (00:17 +0000)]
server: Convert com_rm() to lopsub.

This gets rid of the open-coded command line parser in com_rm() and
of enum rm_flags. Patterns are now passed to for_each_matching_row()
and from there to the action handler remove_audio_file() via ->lpr
of struct pattern_match_data.

7 years agoserver: Convert com_rmatt() to lopsub.
Andre Noll [Fri, 2 Oct 2015 21:18:42 +0000 (21:18 +0000)]
server: Convert com_rmatt() to lopsub.

No change to the action handler, remove_attribute(), necessary.

7 years agoserver: Convert com_cpsi() to lopsub.
Andre Noll [Fri, 2 Oct 2015 21:17:09 +0000 (21:17 +0000)]
server: Convert com_cpsi() to lopsub.

Allows to get rid of enum cpsi_flags as we pass the flags via the
serialized parse result to the callback and the action handler
(copy_selector_info()).

Also the open-coded command line parser in com_cpsi() can be removed.

7 years agoserver: Convert com_check() to lopsub.
Andre Noll [Sun, 20 Mar 2016 18:40:50 +0000 (18:40 +0000)]
server: Convert com_check() to lopsub.

Gets rid of enum com_check_flags and the open-coded option parser
of com_check().

Also streamlines the help text of the options a bit.

7 years agoserver: Convert com_mvatt() to lopsub.
Andre Noll [Fri, 2 Oct 2015 21:21:11 +0000 (21:21 +0000)]
server: Convert com_mvatt() to lopsub.

We need to cast the obj->data pointer to a non-constant type because
the osl library functions expect void *, which results in a warning
without the cast.

7 years agoserver: Convert com_setatt() to lopsub.
Andre Noll [Fri, 2 Oct 2015 21:22:01 +0000 (21:22 +0000)]
server: Convert com_setatt() to lopsub.

Introduces ->input_skip for struct pattern_match data. The setatt
command uses this to strip the attribute modifies off the unnamed
arguments in the lopsub parse result. The remaining arguments are
the patterns which are to be matched against each file in the audio
file table.

7 years agoserver: Convert com_lsatt() to lopsub.
Andre Noll [Sun, 20 Mar 2016 18:40:19 +0000 (18:40 +0000)]
server: Convert com_lsatt() to lopsub.

This is the first afs subcommand which needs to pass a pattern list
to its callback. The new send_lls_callback_request() provides this
functionality. It serializes the parse result into a buffer and passes
this buffer to the callback.

Since there are non-lopsub commands which also pass a pattern list,
action_if_pattern_matches() is patched to receive the pattern
list either from the serialized parse result or in the old way via
pmd->data. To achieve this, a parse result pointer is added to struct
pattern_match_data. If this pointer is not NULL, we are dealing with
a subcommand that has been converted.

Since the ls subcommand has not been converted yet, lopsub will
regard "ls" as a uniqe abbreviation of the lsatt command, which
breaks t0004. To work around this, we deactivate prefix matching by
only accepting exact matches in run_command(). This workaround can
be removed after com_ls() has been converted.

7 years agoserver: Convert com_init() to lopsub.
Andre Noll [Fri, 2 Oct 2015 21:23:54 +0000 (21:23 +0000)]
server: Convert com_init() to lopsub.

No change necessary for the callback as the init command does
not have any options. The only information that must travel from the
command handler to the callback is the set of tables to create. The
corresponding bitmask is passed without serializing the parse result.

7 years agoserver: Convert com_add() to lopsub.
Andre Noll [Sun, 15 May 2016 16:53:50 +0000 (18:53 +0200)]
server: Convert com_add() to lopsub.

In the callback structure for the add command, replace the flags
field by the serialized callback result. This way the callback
has access to the full parse result structure.

7 years agoserver: Convert non-afs commands to lopsub.
Andre Noll [Sun, 12 Jun 2016 13:36:21 +0000 (15:36 +0200)]
server: Convert non-afs commands to lopsub.

Currently the server commands are divided into two group: those
commands which are handled by the server process and those which
communicate with the afs process. This commit converts the commands of
the former group and the corresponding completers for para_client to
the lopsub suite format while the afs commands will be converted in
subsequent commits. After this change para_server needs to be linked
with -llopsub.

To this aim the options and help texts of of the server commands are
transferred from server.cmd to the new server_cmd.suite.m4, enabling
long-style options in the progress. Moreover, an introduction is added
at the beginning of the list of server commands which describes how
server commands are executed.

Command permissions are now handled by making use of the aux_info
feature of lopsub. To keep those commands working which do not
have any permission bit set, we need to add a new identifier
NO_PERMISSION_REQUIRED to enum server_command_permissions of
user_list.h. The value of this identifier is zero of course.

Naturally the bulk of the change takes place in command.c where all
server commands are implemented. The command handlers are modified
to take a pointer to a struct lls_parse result as an additional
argument. A new helper, send_errctx(), is introduced to avoid code
duplication.

Since command.h now refers to a lopsub parse result, all files which
include command.h, including those which implement only afs commands,
need to include the system header lopsub.h.

To keep afs commands working, some compatibility code in run_command()
is added. This will go away after all commands have been converted.

A couple of macros in command.h ease the handling of the long symbolic
constants exposed by the generated lopsub header file.

Although only the non-afs commands are converted, the change allows
for a couple of cleanups:

* The E_BAD_COMMAND error code is no longer needed and has been
removed.

* cmd_perms_itohuman() has become unused and is removed.

* The server_cmds[] array is empty and can be removed, along
with the loop in send_list_of_commands() which iterated over
the array.

The patch also adjusts tests t0004 and t0005 since the help output
format changed slightly, breaking the expectations of these tests.

7 years agoConvert audiod commands to lopsub.
Andre Noll [Sat, 7 May 2016 08:59:01 +0000 (10:59 +0200)]
Convert audiod commands to lopsub.

The four command lists (server, afs, audiod, play) and all executables
will be converted to the long option parser library (lopsub). This
first patch converts the audiod commands (on, off, cycle...) and adds
the necessary infrastructure to the build system. The option parser
for para_audiod is still generated by gengetopt and will be converted
in a subsequent patch.

The build system is updated to include an autoconf test which
checks for the lopsub library and the lopsubgen executable. If the
check fails, it prints instructions on how to download the lopsub
package. Moreover, a section on lopsub is added to the INSTALL file
and the library is listed as a required tool in the manual.

The options and help texts of all audiod commands are moved from
audiod.cmd to the new file audiod_cmd.suite.m4. Until all command
lists are converted, man_util.bash needs an ugly hack to deal with
the two kinds of files.

The help texts have been reworked slightly, but no syntactical
changes were performed. However, one side effect of the change is
that options to audiod commands now accept short and long options,
and that short options may be combined in the usual way.

The error subsystem of paraslash is extended to treat lopsub errors
analogous to errors from the osl libary: we reserve a new bit for
error codes returned from lopsub library functions and a lls() wrapper
function that must be used for all lopsub functions which return a
lopsub error code on failure. The E_INVALID_AUDIOD_CMD error code
can be removed since invalid commands are now detected by the lopsub
library, which returns its own error code in this case.

As a result of the conversion, struct audiod_command can be removed.
Command handlers now take a pointer to a lopsub parse result instead
of the (argc, argv) pair.

The patch also changes the completers for audiod commands in
audioc.c. to use the information in the generated audioc_cmd.lsg.h
header file instead of duplicating this information.

With the patch applied, para_audiod and para_audioc need to be linked
with -llopsub.

We still need to include ggo.h from audiod_command.c until receivers,
filters and writers have been converted as well.

7 years agowmadec: Use read_u32_be().
Andre Noll [Sat, 28 Jan 2017 17:02:33 +0000 (18:02 +0100)]
wmadec: Use read_u32_be().

The shift operation in show_bits() was buggy because p[0] is promoted
to int, and the shift p[0] << 24 results in undefined behavior,
causing the sanitizer of gcc to complain:

bitstream.h:40:21: runtime error: left shift of 230 by 24 places cannot be represented in type 'int'

read_u32_be() gets this right.

7 years agowma_afh.c: Remove condition which is always true.
Andre Noll [Sun, 8 Jan 2017 17:05:31 +0000 (18:05 +0100)]
wma_afh.c: Remove condition which is always true.

The single caller of count_frames() never passes a NULL pointer.

7 years agoimdct.c: Replace pointless macro PASS.
Andre Noll [Sat, 7 Jan 2017 15:12:05 +0000 (16:12 +0100)]
imdct.c: Replace pointless macro PASS.

The macro defines pass(), a function with only a single caller. We
may as well define the function directly, improving readability and
enabling proper syntax colors.

7 years agowma_common.c: Remove pointless assignment.
Andre Noll [Fri, 6 Jan 2017 00:04:23 +0000 (01:04 +0100)]
wma_common.c: Remove pointless assignment.

7 years agowma_afh.c: Use DIV_ROUND_UP().
Andre Noll [Fri, 6 Jan 2017 00:03:29 +0000 (01:03 +0100)]
wma_afh.c: Use DIV_ROUND_UP().

This kills another open-coded instance of DIV_ROUND_UP().

7 years agoaacdec: Decode only one frame per iteration.
Andre Noll [Fri, 18 Apr 2014 00:13:08 +0000 (00:13 +0000)]
aacdec: Decode only one frame per iteration.

This improves latency and helps to avoid buffer underruns on slow
machines.

7 years agoaacdec: Combine aac_open() and aacdec_open().
Andre Noll [Fri, 18 Apr 2014 00:12:40 +0000 (00:12 +0000)]
aacdec: Combine aac_open() and aacdec_open().

Both functions are short, and they are only called once at
startup. Thus, there is no reason to spread out the initialization
over two functions, so let's combine them.

7 years agoaacdec: Make "initialized" a boolean.
Andre Noll [Thu, 17 Apr 2014 23:53:17 +0000 (23:53 +0000)]
aacdec: Make "initialized" a boolean.

It improves code readability, they say.

7 years agoaacdec: Make frame_info local to ->post_select().
Andre Noll [Thu, 17 Apr 2014 23:52:14 +0000 (23:52 +0000)]
aacdec: Make frame_info local to ->post_select().

We don't need to preserve this value across multiple calls to
->post_select().

7 years agoaacdec: Remove pointless assignment.
Andre Noll [Thu, 17 Apr 2014 23:45:19 +0000 (23:45 +0000)]
aacdec: Remove pointless assignment.

No need to set "ret" here as the jump to "next_buffer" overwrites
its content anyway.

7 years agoaacdec: Remove pointless check and improve comment.
Andre Noll [Thu, 17 Apr 2014 23:38:19 +0000 (23:38 +0000)]
aacdec: Remove pointless check and improve comment.

"consumed" is always less than "len" here because of the check a few
lines earlier.

7 years agoaacdec: Rename buffer variables.
Andre Noll [Thu, 17 Apr 2014 23:35:58 +0000 (23:35 +0000)]
aacdec: Rename buffer variables.

The naming of the three buffers was inconsistent. This patch unifies
the names.

7 years agoaacdec: Remove pointless variable p.
Andre Noll [Thu, 17 Apr 2014 23:34:04 +0000 (23:34 +0000)]
aacdec: Remove pointless variable p.

7 years agoaacdec: Remove check which is always true.
Andre Noll [Thu, 17 Apr 2014 23:11:05 +0000 (23:11 +0000)]
aacdec: Remove check which is always true.

Just prior to the test we set ret to consumed, so it is known to
be non-negative.

7 years agoaacdec: Kill pointless label.
Andre Noll [Thu, 17 Apr 2014 23:10:21 +0000 (23:10 +0000)]
aacdec: Kill pointless label.

The "out" and "err" labels are equivalent if ret is negative, which
is the case for the only jump to "out".

7 years agoaacdec: Remove superfluous assignment.
Andre Noll [Thu, 17 Apr 2014 23:06:37 +0000 (23:06 +0000)]
aacdec: Remove superfluous assignment.

Jumping to the success label sets ret to consumed. ret is not used if
there are samples available, so this is safe.

7 years agoaacdec: Improve and silence error message.
Andre Noll [Sat, 24 Dec 2016 16:41:00 +0000 (17:41 +0100)]
aacdec: Improve and silence error message.

Most errors from NeAACDecDecode() can be handled gracefully. This
patch downgrades the severity level of the corresponding log messages
from ERROR to NOTICE and explains the meaning of the three numbers
of the second log message.

7 years agoaacdec: Prefer NeAACDecInit() over NeAACDecInit2().
Andre Noll [Sat, 31 Dec 2016 01:39:16 +0000 (02:39 +0100)]
aacdec: Prefer NeAACDecInit() over NeAACDecInit2().

The aac decoder tries to parse the length of the decoder configuration
from the esds atom and passes this information to NeAACDecInit2(). If
we can not figure out the length, we fall back to NeAACDecInit(),
which does not receive the decoder length as a parameter. This is
unnecessary because NeAACDecInit2() is only necessary for decoding
mp4 files, while both para_afh and para_server feed demultiplexed
aac frames to the decoder.

Calling NeAACDecInit() unconditionally allows to get rid of the
code which detects and parses the esds atom.

7 years agoaacdec: Don't eat full buffer on errors.
Andre Noll [Sun, 6 Apr 2014 10:13:10 +0000 (12:13 +0200)]
aacdec: Don't eat full buffer on errors.

On decoding errors, if the call to NeAACDecDecode() did not consume
anything from the input buffer, we currently throw away the full
buffer. This does not necessarily improve matters, so let's just eat
one byte and hope that subsequent calls succeed.

7 years agoCombine aacdec and aac_common.
Andre Noll [Thu, 17 Mar 2016 20:59:52 +0000 (21:59 +0100)]
Combine aacdec and aac_common.

With the server side switched to libmp4ff, only the aac decoder needs
the public functions in aac_common. This patch moves this file into
aacdec_filter.c, makes the functions static and removes the aac.h
header file which only contained the prototypes of the previously
public functions.

Makefile.real, configure.ac and error.h need small adjustments due
to the removal of aac_common.c.

7 years agoConvert the aac audio format handler to libmp4ff.
Andre Noll [Sat, 24 Dec 2016 15:02:44 +0000 (16:02 +0100)]
Convert the aac audio format handler to libmp4ff.

This changes the aac audio format handler to call the primitives
provided by the mp4ff library. This allows to remove the atom parsing
code from aac_afh.c.

After this change para_server, para_afh, and para_recv no longer
depend on aac_common.c and on the mp4v2 library.  The autoconf tests
for libmp4v2 are removed from configure.ac. A subsequent commit will
deal with aac_common.c.

7 years agoaac_afh: Don't create chunk tables any more.
Andre Noll [Sat, 24 Dec 2016 15:02:36 +0000 (16:02 +0100)]
aac_afh: Don't create chunk tables any more.

A previous commit activated dynamic chunks for the aac audio format
handler, so the virtual streaming system no longer consults the chunk
table stored in the audio file table of the osl database.

However, the code to open or add an audio file still assumes that
there is a chunk table and bails out if it can't find it. This patch
changes aft.c to do without a chunk table if the audio format handler
supports dynamic chunks. The afh_supports_dynamic_chunks() helper
needs to be made public because of this.

With chunk tables being optional, the ->get_file_info method of the
audio format handler can safely set ->chunk_table to NULL. It still
needs to compute the maximum chunk size though.

7 years agoafh: Dynamic chunks.
Andre Noll [Wed, 21 Dec 2016 23:57:15 +0000 (00:57 +0100)]
afh: Dynamic chunks.

paraslash chunk tables were designed long ago with the idea that the
full audio file, with the exception of a potential header, is going
to be sent to the client. This allows to store a sequence of offsets
as the chunk table. Each chunk is defined as the contiguous region
of the file given by two consecutive offsets.

For most audio formats, however, not every part of the file corresponds
to encoded audio. We work around this on the client side by letting
the filters detect and skip those parts which can not be fed to
the decoder.

This works generally well, but for the aac decoder we have a rather
ugly hack that skips over any non aac decoded data of its input. This
hack was never very reliable, and the concept of dynamic chunks
finally allows to get rid of it.

Dynamic chunks work as follows. Each audio format handler signifies
support by defining the new ->get_chunk method. In this case
afh_get_chunk() no longer consults the chunk table at all but calls
the new method instead in order to obtain a reference to the chunk.

This comes with a certain overhead at runtime because we need to call
into the functions of the mp4ff library (ships together with faad)
rather looking up the offset in the chunk table.

Only the aac audio format handler supports dynamic chunks per this
commit. To keep the patch size relatively small, this commit does not
touch ->get_file_info() of the aac audio format handler. Therefore,
when a new m4a file is added to the database, the aac audio format
handler still creates the chunk table. A subsequent commit will turn
off this unnecessary operation.

The documentation is updated to mention that mp4ff is now required
for the aac audio format handler. The configure script now checks
for the mp4ff header and the library and deactivates aac support if
it was not found.

7 years agoserver: Store max chunk size in database.
Andre Noll [Fri, 23 Dec 2016 16:18:21 +0000 (17:18 +0100)]
server: Store max chunk size in database.

This number is needed up-front for the initialization of the fec data
structures.  Currently we recompute it from the chunk table each time
the file is opened for streaming.

We can only get rid of the chunk table concept if we tell the VSS by
other means how to obtain this information.

Fortunately there is an unused 4-byte field in the on-disk afhi
structure, which is always zero at the moment. This patch starts to
use this field to store the maximal chunk size.

For backwards compatibility, when the afhi structure is loaded from
disk at stream time, we check if the field is zero and recompute the
max chunk size as before in this case.

Although the maximal chunk size is generally only needed on the
server side, for consistence we expose it though a new status item
along with chunk_tv and friends.

7 years agoserver: Move ->size from mmd to struct vss_task.
Andre Noll [Wed, 21 Dec 2016 12:58:28 +0000 (13:58 +0100)]
server: Move ->size from mmd to struct vss_task.

This field stores the size of the memory mapping of the current audio
file, if any. No command handler ever changes the value, and the
value is not read from com_stat(), so there is no reason for ->size
to be part of the mmd shared memory area.

Unlike ->size, the pointer to the mapping is stored in struct vss_task.
Given that vss.c is the only file which reads ->map or ->size, it
makes sense to store both values together in the vss task struct.

7 years agoaac_afh.c: Remove duplicate check for samplingFrequency.
Andre Noll [Thu, 22 Dec 2016 14:50:54 +0000 (15:50 +0100)]
aac_afh.c: Remove duplicate check for samplingFrequency.

aac_set_chunk_tv() is called after we checked that the sampling
frequency is non-zero. No need to check it again.

7 years agoload_chunk_table(): Don't trust afhi->chunks_total.
Andre Noll [Mon, 26 Dec 2016 22:50:34 +0000 (23:50 +0100)]
load_chunk_table(): Don't trust afhi->chunks_total.

Both callers pass a buffer to load_chunk_table() to initialize
afhi->chunk_table. The function does not check the size of the passed
buffer but relies on afhi->chunks_total to tell how many values to
copy from the buffer.

In other words, the buffer size gives an upper bound for the number of
chunks in the chunk table, but this bould is not checked. This patch
makes the code more robust by adding a suitable check. To this aim,
load_chunk_table() is changed to receive a pointer to an osl object
(which contains the buffer size) rather than only the buffer.

One caller, load_afd(), initializes the chunk table from a shared
memory area buffer. It does not know or care about the buffer size
so far. We introduce the the new IPC helper shm_size() to let it tell
the size of the area and pass it to load_chunk_table().

7 years agopara_server: Never read past the end of the chunk table.
Andre Noll [Thu, 22 Dec 2016 01:38:05 +0000 (02:38 +0100)]
para_server: Never read past the end of the chunk table.

If the server command "ls" is executed with the -c option to print
the chunk table, we assume that afhi->chunks_total many chunks are
stored in the osl disk object that represents the chunk table.

This should be true in general, but since we also know the size of
the osl object, it does not hurt to check this bound as well and
break out of the loop if the next read would access memory beyond
the end of the object.

7 years agot0001: Prefer shasum over sha1sum.
Andre Noll [Sun, 8 Jan 2017 16:21:04 +0000 (17:21 +0100)]
t0001: Prefer shasum over sha1sum.

Both programs reliably find mismatches, and the latter is not installed
on FreeBSD.

7 years agoMerge branch 'maint'
Andre Noll [Sun, 19 Mar 2017 15:30:33 +0000 (16:30 +0100)]
Merge branch 'maint'

Two fixes that have been cooking in for-maint for a while.

* maint:
  i9e: Restore file status flags on exit.
  NEWS,md: Add introductory text for v0.5.7.

7 years agoi9e: Restore file status flags on exit.
Andre Noll [Sat, 28 Jan 2017 18:33:26 +0000 (19:33 +0100)]
i9e: Restore file status flags on exit.

The i9e subsystem sets the stdin and stdout fds passed to i9e_open()
to nonblocking mode but misses to restore the original flags in
i9e_close(). This causes terminal applications like dialog to fail
if they are started in the same terminal after e.g. para_play was
executed.

This commit modifies i9e_open() to fetch and save the file status
flags before setting the O_NONBLOCK flag, and i9e_close() to restore
the original value. STDERR is not affected.

7 years agoNEWS,md: Add introductory text for v0.5.7.
Andre Noll [Sun, 22 Jan 2017 22:01:43 +0000 (23:01 +0100)]
NEWS,md: Add introductory text for v0.5.7.

Of course this text should have been added before v0.5.7 was released,
but somehow it got lost.

7 years agoafh.h: Fix typo in prototype of ->get_file_info().
Andre Noll [Wed, 21 Dec 2016 13:27:27 +0000 (14:27 +0100)]
afh.h: Fix typo in prototype of ->get_file_info().

The structure is called afhi throughout the tree.

7 years agoogg_afh_common.c: Remove pointless variable.
Andre Noll [Sun, 25 Dec 2016 23:55:02 +0000 (00:55 +0100)]
ogg_afh_common.c: Remove pointless variable.

The "len" variable is initialized once and never changes.

7 years agoRemove compatibility code for abstract unix domain sockets.
Andre Noll [Mon, 18 Jul 2016 21:35:48 +0000 (23:35 +0200)]
Remove compatibility code for abstract unix domain sockets.

Abstract sockets were introduced in paraslash-0.5.5 (2015-09-20). For
backwards compatibility, create_local_socket() was modified to create
an abtract socket *and* an ordinary pathname socket so that old audiod
clients (which connect to the pathname socket) would still work.

This patch breaks compatibility by going back to a single socket,
either abstract (Linux) or pathname (all other systems), as determined
in the first call to create_local_socket(). This allows to drop the
"abstract" argument of init_unix_addr() and the "mode" argument of
create_local_socket().

The code in net.c and the callers get quite a bit shorter since it
has to deal with only a single file descriptor and one type of socket.

7 years agoRemove unused E_PUBLIC_KEY.
Andre Noll [Sun, 8 Jan 2017 20:45:15 +0000 (21:45 +0100)]
Remove unused E_PUBLIC_KEY.

This should have been done in commit d9f54f43, which removed the
last user of this error code.

7 years agobuild: Add target "check" as a synonym for "test".
Andre Noll [Mon, 22 Aug 2016 15:36:05 +0000 (17:36 +0200)]
build: Add target "check" as a synonym for "test".

make check seems to be more common than make test, and "check" is the
recommended name according to the GNU standards. This patch teaches
the build system to support both targets. It also marks the test-clean,
check and test targets as phony.

7 years agobuild: Rename target "tarball" to "dist".
Andre Noll [Mon, 18 Jul 2016 18:02:49 +0000 (20:02 +0200)]
build: Rename target "tarball" to "dist".

This is the name suggested in the make manual.  We keep "tarball"
target for a while though to not break existing scripts.

7 years agobuild: Do not strip installed executables by default.
Andre Noll [Mon, 18 Jul 2016 16:49:31 +0000 (18:49 +0200)]
build: Do not strip installed executables by default.

The "install" target currently strips all executables while installing
them, which is not recommended according to GNU conventions. Instead,
there should exist the "install-strip" target for this purpose.

Moreover, the current install target assumes the GNU variant of
the install utility because we call install with --strip-program,
an option which is not available on *BSD.

This patch addresses both issues. It removes the autoconf check and
lets the user directly define the path to the install executable by
setting INSTALL, INSTALL_PROGRAM, INSTALL_DATA, as recommended by the
GNU project. These variables are used in the commands to be executed
when the install target is made. They have reasonable and portable
defaults, so not setting them at all should be fine on all supported
platforms, addressing the issue with --strip-program.

The new phony target install-strip runs install -s but does not try
to be smart about how to tell the install implementation which strip
program to use.

The cross compiling example can be simplified to reflect the fact
that CROSS_COMPILE is no longer used in the Makefile.

7 years agobuild: Support $(DESTDIR).
Andre Noll [Sun, 17 Jul 2016 19:27:12 +0000 (21:27 +0200)]
build: Support $(DESTDIR).

The DESTDIR feature is orthogonal to the existing --prefix option
to configure, and the GNU make manual strongly recommends to support
the feature, so this patch implements it.

The feature works as follows. The content of the DESTDIR make variable
is prepended to each installed target file. It is not set at all in
the Makefile, so files are installed into their expected locations by
default. For example, with the patch applied, one may say

make DESTDIR=/tmp/stage install

to install in /tmp/stage/usr/local.

Other than that, specifying DESTDIR has no effect and the value is
not included in any file contents.

7 years agobuild: Rename clean targets.
Andre Noll [Tue, 12 Jul 2016 19:56:13 +0000 (21:56 +0200)]
build: Rename clean targets.

The documentation of gnu make recommends to have targets called
mostlyclean, clean, distclean and maintainer-clean while we have clean,
clean2, distclean and maintainer clean.

This patch adds mostlyclean and removes clean2. The former target
removes the executables and all object files, clean additionally
removes the whole build directory and distclean removes, on top of
that, all files created by autoconf. Finally, maintainer-clean removes
the tarball and the files created by doxygen and global.

7 years agocrypt: Remove RC4 support.
Andre Noll [Wed, 24 Aug 2016 13:12:53 +0000 (15:12 +0200)]
crypt: Remove RC4 support.

Multiple vulnerabilities have been discovered in the RC4 stream cipher,
rendering it insecure. paraslash stopped using RC4 as the default
stream cipher since version 0.5.2 (2014-04-11), but server and client
still supported the broken cipher for backward compatibility. This
commit removes the compatibility code from both the openssl and
the libgcrypt code base, leaving aes_ctr128 as the only remaining
stream cipher.

The server still announces the aes_ctr128 feature, although it is now
mandatory because the server will enable aes_ctr128 unconditionally,
no matter whether it was requested by the client or not. The client,
on the other hand, still requests this feature, regardless of whether
it was announced by the server or not. This keeps unpatched clients =>
0.5.2 working with new servers and vice versa.

Regarding the public crypto API, sc_new() loses its boolean use_aes
parameter. Otherwise the API remains the same.

The patch also rewrites the crypto section of the manual to not
mention RC4 any more.

7 years agogcrypt: Simplify init_random_seed_or_die().
Andre Noll [Sun, 10 Jul 2016 14:43:02 +0000 (16:43 +0200)]
gcrypt: Simplify init_random_seed_or_die().

Trivial equivalent transformation which gets rid of a local variable and
one level of indentation.

7 years agogcrypt: Rename E_OEAP to E_RSA_DECODE.
Andre Noll [Sun, 10 Jul 2016 14:32:39 +0000 (16:32 +0200)]
gcrypt: Rename E_OEAP to E_RSA_DECODE.

This error code was misleading since gcry_sexp_nth_data() can fail
for other reasons as well. The patch also removes a pointless error
message.

7 years agogcrypt: Remove open-coded OAEP padding.
Andre Noll [Sun, 10 Jul 2016 14:15:37 +0000 (16:15 +0200)]
gcrypt: Remove open-coded OAEP padding.

The open-coded OAEP padding implementaton of gcrypt.c was necessary to
support old libgcrypt versions which do not have the oaep flag. These
days, everybody ought to have moved on to 1.5.0 (released 2011)
or later, so lets require this version from now on.

decode_rsa() used its key_size parameter only for old gcrypt versions,
so the parameter can be removed. Also, the E_MPI_PRINT error code
has become unused and can be removed from error.h.

Since rsa_decrypt_sexp is now constant, there is no need to have a
variable for this, so we can make it a preprocessor definition instead.