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.
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.
server: Add com_tasks(). It is sometimes useful to see the task list of para_server. The infrastructure for obtaining this information is already in sched.c, so this is a rather simple matter.
Add sender subcommand "status". Currently, the si (server info) command prints information about each sender, like the number of connected clients and the access control lists. As this information is related to senders, the sender command seems to be a better fit. This commit introduces the new sender subcommand "status" for this purpose and changes com_si() to not print the sender information any more, making the output of com_si() bounded. It also renames the ->info() function of the senders to ->status() to make it clear that this function is related to the new status subcommand. The Networking paragraph of the manual is adjusted accordingly and now contains an example of the status command.
Overhaul help texts of server and afs commands. Each server command has a brief help text which is printed by para_client help <command> and is also included in the para_server manual page. These texts are defined in server.cmd and afs.cmd and haven't seen much love for a long time. This commit improves most of them and also fixes some formating issues.
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.
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.
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.
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.
server: Fix typo in help text of the stat command. The "=" is necessary.
Replace direct use of RC4 by stream cipher abstraction. This introduces the new struct stream_cipher in crypt.h as well as two functions stream_cipher_new() and stream_cipher_free() which initialize a new stream cipher structure and deallocate such a structure, respectively. The users of RC4 are changed to call the new abstract functions, so they become independent from openssl. Consequently the affected files need no include openssl/rc4.h any more.
Add missing regex include to generated command_list files.
Merge branch 'afh_cleanup' into next. Quite a few conflicts, but no real problem. git rerere rulez! Conflicts: afs.c afs.cmd aft.c attribute.c audiod_command.c blob.c command.c para.h server.c server.cmd stat.c
Revamp status item handling. This patch changes the way the status items are printed and parsed. The new parser-friendly format is used internally and, as a side effect, is also available as an new listing mode for the ls command and for the stat commands of both para_server and para_audiod. With the new format, each status item is prefixed by its size, and the status item identifier is printed as a numerical value. This simplifies the parsing code in para_audiod/para_gui a bit and should make it perform better as the status items do not have to be looked up by name. More importantly, the new format gets rid of the restriction that status items should not contain newline characters because the parser knows in advance how much it has to read to get the complete item. This restriction became a real problem as more and more audio files contain (version 2 id3) tags that contain much more than a single line. For example the linux podcast mp3 files contain the full content of the podcast as text in the command tag.
Make rc4 encryption/decryption more explicit. The old code used a rather fancy way to (de)activate encryption on a per fd basis: In net.c there was an array of rc4 keys, indexed by fd. This is rather wastful because the array size is determined by the highest fd for which encryption is activated. It's also hard to comprehend and it's easy to get strange results if one forgets to deactivate the encryption after the fd is closed. This patch introduces a new structure, rc4_context, which consists of an fd and the needed rc4 keys. Users explicitly call the new rc4 variants of the receving/sending functions which take a pointer to a struct rc4_context instead of a file descriptor but are otherwise identical. Keep crypt simple!
Add osl.h include to generated command C files.
server.cmd: Cosmetics.
Remove com_sb and com_sc. Nobody used com_sb and com_sc was only used by para_krell.
Remove users of the old audio file selector code.
Switch to the new afs. This obsoletes get_audio_file() of vss.c. It is being replaced by a call to the afs layer from vss_post_select() which requests a struct audio_format_data for the next audio file. The afd struct, the chunk table and the path of the new audio file are stored in a shared memory area. The id of that area is sent through the afs-server socket. An open fd for the underlying audio file is send to the server process as well using usual socket magic. The vss task of the server process attaches the shared memory area and mmaps the open fd to start audio streaming. The code is still quite buggy, but let's do bug fixes and removal of the old audio file selectors in susequent patches.