Features
========
---------------------------------------
-configurable audio streaming software:
---------------------------------------
-
-para_server streams binary audio data (mp3/ogg/m4a files) over local
-and/or remote networks. It supports three builtin streaming methods
-(senders): http, dccp, or rtp.
-
-para_audiod runs on the client side and connects to para_server. The audio
-stream is read from the network and sent through any of paraslash's filters
-(decoder, volume normalizer,...). The resulting stream is written to an output
-plugin (writer), e.g. the alsa writer on linux systems. It is possible to
-capture the stream at any position in the filter chain.
-
-The receiving/filtering/playing software is also available as standalone
-command line tools: para_recv, para_filter, and para_write.
-
-----------------------------------
-configurable audio file selectors:
-----------------------------------
-
-There are three audio file selectors available: random, playlist
-and mysql
-
-The first two of these are rather simple, and they are always
-supported. They allow streaming of randomly selected files or files
-given by a playlist respectively.
-
-The (optional) mysql selector is more involved. It manages
-statistics on your audio files, and audio file selection works by
-sending a user-defined sql-query to the mysql server. This allows
-rather sophisticated configurations and is explained in detail in
-README.mysql.
-
-It is possible to switch between all supported selectors at any time.
-
------------------------
-small memory footprint:
------------------------
-
-paraslash is lightweight. The stripped binary of para_server with
-all its features compiled in (mysql/random/playlist selector,
-mp3/ogg/aac support, http/dccp/ortp support) is about 120K on i386
-under Linux. para_audiod is even smaller.
-
------------------------
-command line interface:
------------------------
-
-paraslash commands are sent to para_server and the response is
-dumped to stdout. This can be used by any scripting language
-to produce user interfaces with little programming effort.
-
---------------------------------------
-authentication/encryption via openssl:
---------------------------------------
-
-All connections between para_server and para_client are encrypted by
-default. For each user of paraslash you must create a public/secret
-key pair for authentication. The (authenticated) connection is crypted
-with a symmetric rc4 session key.
-
---------------------------------------
-various user interfaces and utilities:
---------------------------------------
-
- * para_gui. Curses based interface, displays information in a
- curses window and can be used to easily control para_server
- and para_audiod.
- * para_sdl_gui. Shows pictures (on a per song basis) and
- other information about the current audio file. Can be used
- as a screen saver.
- * para_krell. A gkrellm2 plugin that shows small pics and is
- able to launch 27 different commands by clicking on the image.
- * para_slider. User-friendly stream creator for people who
- don't like their keyboard.
- * para_dbadm. Simple curses interface for changing attributes.
- * para_fade. Simple volume fader and alarm clock.
+------------------------------------------------------------------------------
+
+ * Linux and Mac OS support
+ * mp3, oggvorbis, aac(m4a) support
+ * local or remote http, dccp, and ortp network streaming
+ * volume normalizer
+ * stream grabbing at any point in the filter chain
+ * stand-alone command line receiver/decoder/normalizer/player
+ * sophisticated audio file selectors (mysql, random, playlist)
+ * small memory footprint
+ * command line interface for easy scripting in high-level languages
+ * RSA user authentication
+ * encrypted communications
+ * GPL licensed
+ * written in C
+ * well documented
+ * complete API-Reference
+ * easily extendable due to the modular design
+ * various user interfaces and utilities:
+ * para_gui. Curses based interface to easily control server and
+ client
+ * para_sdl_gui. Shows images on a per song basis and can be used
+ as a screen saver.
+ * para_krell. A gkrellm2 plugin
+ * para_slider. User-friendly stream creator
+ * para_dbadm. Simple curses interface for changing attributes.
+ * para_fade. volume fader and alarm clock.
para_server (obligatory)
-----------------------
-This server supports audio streaming of mp3, ogg vorbis and aac files.
-It listens on a tcp port and accepts commands such as play, stop,
-pause, next from authenticated clients.
+para_server streams binary audio data (mp3/ogg/m4a files) over local
+and/or remote networks. It listens on a tcp port and accepts commands
+such as play, stop, pause, next from authenticated clients. However,
+there are many more commands.
+
+It supports three builtin streaming methods (senders): http, dccp,
+or rtp.
The audio stream may be sent over the network by three different
senders:
-The http sender is recommended for public streams that can be played
-by any player like mpg123, xmms, winamp...
+ * The http sender is recommended for public streams that can be played
+ by any player like mpg123, xmms, itunes, winamp...
-The dccp sender is experimental and requires kernel support for the
-rather new datagram congestion control protocol.
+ * The dccp sender is experimental and requires kernel support for the
+ rather new datagram congestion control protocol.
-The ortp sender is recommended for LAN streaming and for private
-streams that require authentication.
+ * The ortp sender is recommended for LAN streaming and for private
+ streams that require authentication.
It is possible to activate more than one sender simultaneously.
-para_server needs an "audio file selector" to work, mainly to determine
-which song to stream next. There are three selectors available:
-random, playlist and mysql. The former chooses audio files randomly
-and playlist can handle, well, playlists. Both are always supported.
+para_server needs an audio file selector to work, mainly to determine
+which audio file to stream next. The following three selectors are
+built in:
+
+ * The random selector chooses audio files out of a given directory
+ by random
+
+ * The playlist selector chooses files from a specified playlist
+
+ * The (optional) mysql selector is more involved. It connects
+ to a mysql server which holds information on your audio files
+ and maintains statistics on the available audio files. Audio
+ file selection works by sending a user-defined sql-query
+ to the mysql server. This allows rather sophisticated
+ configurations and is explained in detail in README.mysql.
-The optional mysql selector connects to a mysql server which holds
-information on your audio files. It has several unusual features,
-see README.mysql for details.
+It is possible to switch between all supported selectors at any time.
+
+Despite of all these features, paraslash is lightweight. The
+stripped binary of para_server with all its features compiled in
+(mysql/random/playlist selector, mp3/ogg/aac support, http/dccp/ortp
+support) is about 120K on i386 under Linux. para_audiod (see below)
+is even smaller.
------------------------
para_client (obligatory)
-----------------------
-The client program to connect to para_server.
+The client program to connect to para_server. paraslash commands
+are sent to para_server and the response is dumped to stdout. This
+can be used by any scripting language to produce user interfaces with
+little programming effort.
+
+All connections between para_server and para_client are encrypted by
+default. For each user of paraslash you must create a public/secret
+key pair for authentication. The (authenticated) connection is crypted
+with a symmetric rc4 session key.
-------------------
para_recv (optional)
-------------------
-A command line http/dccp/rtp stream grabber.
+A command line http/dccp/rtp stream grabber. The http mode of this tool
+can be used to receive date from any http streaming source.
---------------------
para_filter (optional)
---------------------
-A filter program that converts from stdin and writes to stdout. This
-one is independent from the rest of paraslash, so it might be useful
-also for different purposes.
+A filter program that converts from stdin and writes to stdout. It
+is completely independent from the rest of paraslash, so it might be
+useful also for different purposes.
para_filter combines several decoders (mp3, oggvorbis, aac) and a
volume normalzer. New filters can be added easily due to the modular
para_write (obligatory)
----------------------
-A modular audio stream writer. It supports a simple file writer output plugin
-and optional wav/raw players for alsa (linux-only, Debian package:
-libasound2-dev) and Mac OS.
+A modular audio stream writer. It supports a simple file writer
+output plugin and optional wav/raw players for alsa (linux-only,
+Debian package: libasound2-dev) and Mac OS. para_write can also be
+used as a stand-alone wav or raw audio player.
---------------------------------------
para_audiod (optional, but recommended)
---------------------------------------
-The local daemon that collects information from para_server. It
-starts an appropriate receiver, filter and player as soon as
-para_server announces the availability (and the type) of an audio
-stream. para_audiod listens on a local socket and sends status
-information about para_server and para_audiod to local clients
-on request.
+The local daemon that collects information from para_server.
+
+It runs on the client side and connects to para_server. The audio
+stream is read from the network and sent through any of paraslash's
+filters (decoder, volume normalizer,...). The resulting stream is
+written to an output plugin (writer), e.g. the alsa writer on linux
+systems. It is possible to capture the stream at any position in the
+filter chain.
+
+para_audiod starts an appropriate receiver, filter and player as soon as
+para_server announces the availability (and the type) of an audio stream.
+Moreover, it listens on a local socket and sends status information about
+para_server and para_audiod to local clients on request.
--------------------------------------
para_audioc (optional, but recommended)
#include "db.h"
#include <mysql/mysql.h>
#include <mysql/mysql_version.h>
+#include <regex.h>
#include "error.h"
#include "net.h"
#include "string.h"
static void *mysql_ptr = NULL;
+/**
+ * contains name/replacement pairs used by s_a_r_list()
+ *
+ * \sa s_a_r()
+ */
+struct para_macro {
+ /** the name of the macro */
+ const char *name;
+ /** the replacement text */
+ const char *replacement;
+};
+
static struct para_macro macro_list[] = {
{ .name = "IS_N_SET",
.replacement = "(data.%s != '1')"
}
};
+/**
+ * simple search and replace routine
+ *
+ * \param src source string
+ * \param macro_name the name of the macro
+ * \param replacement the replacement format string
+ *
+ * In \p src, replace each occurence of \p macro_name(arg) by the string
+ * determined by the \p replacement format string. \p replacement may (but
+ * needs not) contain a single string conversion specifier (%s) which gets
+ * replaced by \p arg.
+ *
+ * \return A string in which all matches in \p src are replaced, or \p NULL if
+ * an syntax error was encountered. Caller must free the result.
+ *
+ * \sa regcomp(3)
+ */
+__must_check __malloc static char *s_a_r(const char *src, const char* macro_name,
+ const char *replacement)
+{
+ regex_t preg;
+ size_t nmatch = 1;
+ regmatch_t pmatch[1];
+ int eflags = 0;
+ char *dest = NULL;
+ const char *bufptr = src;
+
+ if (!macro_name || !replacement || !src)
+ return para_strdup(src);
+ regcomp(&preg, macro_name, 0);
+ while (regexec(&preg, bufptr, nmatch, pmatch, eflags)
+ != REG_NOMATCH) {
+ char *tmp, *arg, *o_bracket, *c_bracket;
+
+ o_bracket = strchr(bufptr + pmatch[0].rm_so, '(');
+ c_bracket = o_bracket? strchr(o_bracket, ')') : NULL;
+ if (!c_bracket)
+ goto out;
+ tmp = para_strdup(bufptr);
+ tmp[pmatch[0].rm_so] = '\0';
+ dest = para_strcat(dest, tmp);
+ free(tmp);
+
+ arg = para_strdup(o_bracket + 1);
+ arg[c_bracket - o_bracket - 1] = '\0';
+ tmp = make_message(replacement, arg);
+ free(arg);
+ dest = para_strcat(dest, tmp);
+ free(tmp);
+ bufptr = c_bracket;
+ bufptr++;
+ }
+ dest = para_strcat(dest, bufptr);
+// PARA_DEBUG_LOG("%s: returning %s\n", __func__, dest);
+out:
+ regfree(&preg);
+ return dest;
+}
+
+/**
+ * replace a string according to a list of macros
+ *
+ * \param macro_list the array containing a macro/replacement pairs.
+ * \param src the source string
+ *
+ * This function just calls s_a_r() for each element of \p macro_list.
+ *
+ * \return \p NULL if one of the underlying calls to \p s_a_r returned \p NULL.
+ * Otherwise the completely expanded version of \p src is returned.
+ */
+__must_check __malloc static char *s_a_r_list(struct para_macro *macro_list, char *src)
+{
+ struct para_macro *mp = macro_list;
+ char *ret = NULL, *tmp = para_strdup(src);
+
+ while (mp->name) {
+ ret = s_a_r(tmp, mp->name, mp->replacement);
+ free(tmp);
+ if (!ret) /* syntax error */
+ return NULL;
+ tmp = ret;
+ mp++;
+ }
+ //PARA_DEBUG_LOG("%s: returning %s\n", __func__, dest);
+ return ret;
+}
+
static int real_query(const char *query)
{
if (!mysql_ptr)
+++ /dev/null
-Jul 28 08:05:15 1: (29586) afs_send_chunk: Song finished (flags:8)
-Jul 28 08:05:15 1: (29586) get_song: Getting next song
-Jul 28 08:05:16 1: (29586) get_song: Opening /home/mp3/checked/cd_37/Rodgau_Monotones__Is_Mir_Egal.mp3
-Jul 28 08:05:16 1: (29586) update_mmd: initialising mmd struct
-Jul 28 08:05:16 4: (29586) update_mmd: Next song: /home/mp3/checked/cd_37/Rodgau_Monotones__Is_Mir_Egal.mp3
-Jul 28 08:05:16 3: (29586) update_mmd: size: 4664869, mtime: Tue Jul 13 18:50:40 2004
-Jul 28 08:05:16 3: (29586) update_mmd: current stream: wake, num_played: 35
-Jul 28 08:05:16 3: (29586) update_mmd: length: 3:53, 160 KBit/s, 44100 KHz (joint stereo)
-Jul 28 08:05:16 1: (29586) update_mmd: mmd.length=233, mmd.size=4664869
-Jul 28 08:05:16 1: (29586) update_dbinfo: getting dbtool info /home/mp3/checked/cd_37/Rodgau_Monotones__Is_Mir_Egal.mp3
-Jul 28 08:05:16 3: (29586) update_dbinfo: dir: /home/mp3/checked/cd_37
-Jul 28 08:05:16 3: (29586) update_dbinfo: last played: 4 day(s) ago. Numplayed: 5, Pic_Id: 314
-Jul 28 08:05:16 3: (29586) update_dbinfo: attributes: fast fun deutsch rock
-Jul 28 08:05:16 1: (29586) update_dbinfo: Read 116 byte of info and put 140 byte into mmd->dbinfo
-Jul 28 08:05:16 1: (29586) update_mmd: calling dbtool to update song
-Jul 28 08:05:16 1: (29586) main: Caught signal 17
-Jul 28 08:05:16 1: (29586) handle_sigchld: child 3956 exited. Exit status: 0
-Jul 28 08:05:16 1: (29586) handle_sigchld: child 3959 exited. Exit status: 0
-Jul 28 08:05:16 1: (29586) main: Caught signal 17
-Jul 28 08:05:16 1: (29586) main: Caught signal 17
-Jul 28 08:05:16 1: (29586) handle_sigchld: child 3961 exited. Exit status: 0
-Jul 28 08:05:16 4: (29586) main: Got connection from 192.168.0.7
-Jul 28 08:05:16 1: (3963) handle_connect: Received auth request for user maan
-Jul 28 08:05:16 1: (3963) open_user_list: Opening config file /home/maan/.paraslash/server.users
-Jul 28 08:05:16 1: (3963) get_user: found entry for maan
-Jul 28 08:05:16 1: (3963) get_user: found 4 perm entries
-Jul 28 08:05:16 1: (3963) get_user: tmp[3]=AFS_WRITE
-Jul 28 08:05:16 1: (3963) get_user: tmp[2]=AFS_READ
-Jul 28 08:05:16 1: (3963) get_user: tmp[1]=DB_WRITE
-Jul 28 08:05:16 1: (3963) get_user: tmp[0]=DB_READ
-Jul 28 08:05:16 1: (3964) encrypt: dup2ing stdin
-Jul 28 08:05:16 1: (3964) encrypt: dup2ing stdout
-Jul 28 08:05:16 1: (3963) encrypt: Writing challenge to pipe (11 bytes)
-Jul 28 08:05:16 1: (3963) encrypt: Reading line from pipe
-Jul 28 08:05:16 1: (3963) encrypt: Read 64 byte from pipe
-Jul 28 08:05:16 1: (3963) handle_connect: Sending 64 byte challenge for maan
-Jul 28 08:05:16 3: (3963) handle_connect: Good auth for maan (1894092672)
-Jul 28 08:05:16 1: (3963) parse_cmd: Found command pic. Perms: 1
-Jul 28 08:05:16 1: (3963) check_perms: check_perms
-Jul 28 08:05:16 4: (3963) handle_connect: executing command handler for command "pic"
-Jul 28 08:05:16 1: (29586) main: Caught signal 17
-Jul 28 08:05:16 1: (29586) handle_sigchld: child 3963 exited. Exit status: 0
-
+++ /dev/null
-Mar 23 20:47:26 3: (19185) do_inits: welcome to para_server 0.1.6-dev (Wed Mar 23 20:39:23 MET 2005)
-Mar 23 20:47:26 3: (19185)
-Mar 23 20:47:26 1: (19185) do_inits: using loglevel 1
-Mar 23 20:47:26 4: (19185) init_dbtool: initializing database tool
-Mar 23 20:47:26 1: (19185) init_mysql_server: connecting: maan@localhost:3306
-Mar 23 20:47:26 3: (19185) init_mysql_server: successfully connected to mysql server
-Mar 23 20:47:26 3: (19185) init_dbtool: initialized mysql
-Mar 23 20:47:26 4: (19185) do_inits: initializing audio file sender
-Mar 23 20:47:26 3: (19185) afs_init: checking audio formats
-Mar 23 20:47:26 1: (19185) afs_init: supported audio format: mp3
-Mar 23 20:47:26 1: (19185) setup_stream_command: 1 stream write command given, checking for mp3
-Mar 23 20:47:26 3: (19185) setup_stream_command: using "poc-fec -q -" for files of type mp3 (default)
-Mar 23 20:47:26 1: (19185) afs_init: supported audio format: ogg
-Mar 23 20:47:26 1: (19185) setup_stream_command: 1 stream write command given, checking for ogg
-Mar 23 20:47:26 3: (19185) setup_stream_command: using "/home/maan/para/para_ovsend -r /home/maan/.paraslash/ogg_fifo.p133" for files of type ogg
-Mar 23 20:47:26 1: (19185) afs_init: supported audio formats: mp3 ogg
-Mar 23 20:47:26 4: (19185) setup_signal_handling: setting up signal handlers
-Mar 23 20:47:26 1: (19185) para_install_sighandler: catching signal 2
-Mar 23 20:47:26 1: (19185) para_install_sighandler: catching signal 15
-Mar 23 20:47:26 1: (19185) para_install_sighandler: catching signal 1
-Mar 23 20:47:26 1: (19185) para_install_sighandler: catching signal 17
-Mar 23 20:47:26 4: (19185) do_inits: initializing networking
-Mar 23 20:47:26 3: (19185) init_network: init network socket
-Mar 23 20:47:26 4: (19185) do_inits: init complete
-Mar 23 20:47:26 1: (19185) afs_mainloop: not playing
-Mar 23 20:47:29 4: (19185) main: got connection from 192.168.0.8, forking
-Mar 23 20:47:29 1: (19185) afs_mainloop: not playing
-Mar 23 20:47:29 1: (19187) handle_connect: Received auth request for user maan
-Mar 23 20:47:29 1: (19187) open_user_list: Opening user list /home/maan/.paraslash/server.users
-Mar 23 20:47:29 1: (19187) get_user: found entry for maan
-Mar 23 20:47:29 1: (19187) get_user: found 4 perm entries
-Mar 23 20:47:29 3: (19187) encrypt: writing challenge to pipe (11 bytes)
-Mar 23 20:47:29 1: (19187) encrypt: reading response
-Mar 23 20:47:29 1: (19187) encrypt: read 64 byte from pipe
-Mar 23 20:47:29 1: (19187) handle_connect: sending 64 byte challenge
-Mar 23 20:47:29 3: (19187) handle_connect: good auth for maan (3859497713)
-Mar 23 20:47:29 1: (19187) parse_cmd: found command play.
-Mar 23 20:47:29 1: (19187) check_perms: checking permissions
-Mar 23 20:47:29 4: (19187) handle_connect: executing command handler for command "play"
-Mar 23 20:47:29 3: (19187) handle_connect: command handler returned success
-Mar 23 20:47:29 1: (19185) afs_mainloop: no audio file
-Mar 23 20:47:29 1: (19185) real_query: select def from streams where name = 'current_stream'
-Mar 23 20:47:29 1: (19185) real_query: select def from streams where name='gulp'
-Mar 23 20:47:29 1: (19185) real_query: select concat(dir.dir, '/', dir.name) from data,dir where dir.name = data.name and ( (dir.name like '%G.U.L.P%')) order by -((FLOOR((UNIX_TIMESTAMP(now())-UNIX_TIMESTAMP(data.Lastplayed))/60) / 1440 - sqrt(data.Numplayed)))
-Mar 23 20:47:29 3: (19185) get_song: trying /home/mp3/checked/cd_20/The_G.U.L.P.__U-Bahn.mp3
-Mar 23 20:47:29 1: (19185) guess_audio_format: might be mp3
-Mar 23 20:47:29 3: (19185) get_file_info: valid mp3 file
-Mar 23 20:47:29 4: (19185) update_mmd: next audio file: /home/mp3/checked/cd_20/The_G.U.L.P.__U-Bahn.mp3
-Mar 23 20:47:29 1: (19185) real_query: select def from streams where name = 'current_stream'
-Mar 23 20:47:29 1: (19185) real_query: select concat('lastplayed: ', (to_days(now()) - to_days(lastplayed)),' day(s). numplayed: ', numplayed, ', pic: ', pic_id) from data where name = 'The_G.U.L.P.__U-Bahn.mp3'
-Mar 23 20:47:29 1: (19185) real_query: desc data
-Mar 23 20:47:29 1: (19185) real_query: select * from data where name='The_G.U.L.P.__U-Bahn.mp3'
-Mar 23 20:47:29 1: (19185) real_query: select dir from dir where name = 'The_G.U.L.P.__U-Bahn.mp3'
-Mar 23 20:47:29 1: (19185) real_query: select def from streams where name='gulp'
-Mar 23 20:47:29 1: (19185) real_query: select (FLOOR((UNIX_TIMESTAMP(now())-UNIX_TIMESTAMP(data.Lastplayed))/60) / 1440 - sqrt(data.Numplayed)) from data where name = 'The_G.U.L.P.__U-Bahn.mp3'
-Mar 23 20:47:29 1: (19185) update_mmd: updating shared memory area
-Mar 23 20:47:29 1: (19185) real_query: update data set lastplayed = now() where name='The_G.U.L.P.__U-Bahn.mp3'
-Mar 23 20:47:29 1: (19185) real_query: select numplayed from data where name = 'The_G.U.L.P.__U-Bahn.mp3'
-Mar 23 20:47:29 1: (19185) real_query: update data set numplayed=38 where name='The_G.U.L.P.__U-Bahn.mp3'
-Mar 23 20:47:29 1: (19185) get_song: success
-Mar 23 20:47:29 1: (19185) afs_mainloop: open stream
-Mar 23 20:47:29 3: (19185) afs_open_stream_writer: opening mp3 stream_writer (poc-fec -q -)
-Mar 23 20:47:29 1: (19185) afs_open_stream_writer: mp3 stream writer pid: 19189, fd: 10
-Mar 23 20:47:29 1: (19185) para_next_signal: next signal: 17
-Mar 23 20:47:29 1: (19185) para_reap_child: child 19187 exited. Exit status: 0
-Jan 22 03:17:31 meins 2 log_welcome: welcome to para_audiod cvs (Sun Jan 22 02:51:13 MET 2006)
-Jan 22 03:17:31 meins 2 init_stream_io: initializing http receiver
-Jan 22 03:17:31 meins 2 init_stream_io: initializing ortp receiver
-Jan 22 03:17:31 meins 2 init_stream_io: initializing wav filter
-Jan 22 03:17:31 meins 2 init_stream_io: initializing compress filter
-Jan 22 03:17:31 meins 2 init_stream_io: initializing mp3dec filter
-Jan 22 03:17:31 meins 2 init_stream_io: initializing oggdec filter
-Jan 22 03:17:31 meins 2 add_filter: mp3 filter 1: mp3dec
-Jan 22 03:17:31 meins 2 add_filter: mp3 filter 2: compress
-Jan 22 03:17:31 meins 2 add_filter: mp3 filter 3: wav
-Jan 22 03:17:31 meins 2 add_filter: ogg filter 1: oggdec
-Jan 22 03:17:31 meins 2 add_filter: ogg filter 2: compress
-Jan 22 03:17:31 meins 2 add_filter: ogg filter 3: wav
-Jan 22 03:17:31 meins 2 clear_slot: clearing slot 0
-Jan 22 03:17:31 meins 2 clear_slot: clearing slot 1
-Jan 22 03:17:31 meins 2 clear_slot: clearing slot 2
-Jan 22 03:17:31 meins 2 clear_slot: clearing slot 3
-Jan 22 03:17:31 meins 2 clear_slot: clearing slot 4
-Jan 22 03:17:31 meins 2 init_grabbing: grab init
-Jan 22 03:17:31 meins 2 setup_signal_handling: signal pipe: fd 4
-Jan 22 03:17:31 meins 2 daemon_init: daemonizing
-Jan 22 03:17:31 meins 3 open_stat_pipe: stat pipe opened, fd 6
-Jan 22 03:17:31 meins 3 audiod_get_socket: connecting to local socket /var/paraslash/audiod_socket.meins
-Jan 22 03:17:32 meins 2 handle_connect: pid: 8807, uid: 409, gid: 100, ret: 254, buf: stat
-Jan 22 03:17:32 meins 2 handle_connect: argv[0]: stat
-Jan 22 03:17:32 meins 2 stat_client_add: adding client on fd 8
-Jan 22 03:17:32 meins 2 dump_stat_client_list: stat client on fd 8
-Jan 22 03:17:32 meins 2 handle_connect: pid: 8806, uid: 409, gid: 100, ret: 254, buf: stat
-Jan 22 03:17:32 meins 2 handle_connect: argv[0]: stat
-Jan 22 03:17:32 meins 2 stat_client_add: adding client on fd 9
-Jan 22 03:17:32 meins 2 dump_stat_client_list: stat client on fd 9
-Jan 22 03:17:32 meins 2 dump_stat_client_list: stat client on fd 8
-Jan 22 03:17:46 meins 2 compute_time_diff: time diff (cur/avg): 0:1/0:0
+Feb 01 18:28:47 meins 2 log_welcome: welcome to para_audiod git (Tue Jan 30 21:47:04 MET 2007)
+Feb 01 18:28:47 meins 2 init_writers: maximal number of writers: 3
+Feb 01 18:28:47 meins 2 check_writer_arg: checking alsa -d plug:swmix
+Feb 01 18:28:47 meins 2 alsa_parse_config: options: -d plug:swmix, 2
+Feb 01 18:28:47 meins 2 alsa_parse_config: help given: 0
+Feb 01 18:28:47 meins 2 init_writers: mp3 writer #0: alsa
+Feb 01 18:28:47 meins 2 check_writer_arg: checking alsa -d plug:swmix
+Feb 01 18:28:47 meins 2 alsa_parse_config: options: -d plug:swmix, 2
+Feb 01 18:28:47 meins 2 alsa_parse_config: help given: 0
+Feb 01 18:28:47 meins 2 init_writers: ogg writer #0: alsa
+Feb 01 18:28:47 meins 2 check_writer_arg: checking alsa -d plug:swmix
+Feb 01 18:28:47 meins 2 alsa_parse_config: options: -d plug:swmix, 2
+Feb 01 18:28:47 meins 2 alsa_parse_config: help given: 0
+Feb 01 18:28:47 meins 2 init_writers: aac writer #0: alsa
+Feb 01 18:28:47 meins 2 init_receivers: initializing http receiver
+Feb 01 18:28:47 meins 2 init_receivers: initializing dccp receiver
+Feb 01 18:28:47 meins 2 init_receivers: initializing ortp receiver
+Feb 01 18:28:47 meins 2 init_filters: maximal number of filters: 6
+Feb 01 18:28:47 meins 2 add_filter: mp3 filter 1: mp3dec
+Feb 01 18:28:47 meins 2 add_filter: mp3 filter 2: compress
+Feb 01 18:28:47 meins 2 add_filter: ogg filter 1: oggdec
+Feb 01 18:28:47 meins 2 add_filter: ogg filter 2: compress
+Feb 01 18:28:47 meins 2 add_filter: aac filter 1: aacdec
+Feb 01 18:28:47 meins 2 add_filter: aac filter 2: compress
+Feb 01 18:28:47 meins 2 clear_slot: clearing slot 0
+Feb 01 18:28:47 meins 2 clear_slot: clearing slot 1
+Feb 01 18:28:47 meins 2 clear_slot: clearing slot 2
+Feb 01 18:28:47 meins 2 clear_slot: clearing slot 3
+Feb 01 18:28:47 meins 2 clear_slot: clearing slot 4
+Feb 01 18:28:47 meins 2 init_grabbing: grab init
+Feb 01 18:28:47 meins 2 setup_signal_handling: signal pipe: fd 4
+Feb 01 18:28:47 meins 3 audiod_get_socket: local socket: /var/paraslash/audiod_socket.meins
+Feb 01 18:28:47 meins 2 daemon_init: daemonizing
+Feb 01 18:28:47 meins 2 init_sched: initializing scheduler
+Feb 01 18:28:47 meins 2 register_task: registering signal task (0x8061548)
+Feb 01 18:28:47 meins 2 register_task: registering command task (0xbffb3d18)
+Feb 01 18:28:47 meins 2 register_task: registering status task (0x8061680)
+Feb 01 18:28:47 meins 2 register_task: registering audiod task (0xbffb3e3c)
+Feb 01 18:28:47 meins 2 status_pre_select: clock diff count: 5
+Feb 01 18:28:47 meins 2 client_parse_config: loglevel: 5
+Feb 01 18:28:47 meins 2 client_parse_config: config_file: /home/maan/.paraslash/client.conf
+Feb 01 18:28:47 meins 2 client_parse_config: key_file: /home/maan/.paraslash/key.maan
+Feb 01 18:28:47 meins 3 client_parse_config: connecting localhost:2990
+Feb 01 18:28:47 meins 2 get_host_info: getting host info of localhost
+Feb 01 18:28:47 meins 2 register_task: registering client (0x8065910)
+Feb 01 18:28:47 meins 2 client_post_select: --> auth rc4 maan
+Feb 01 18:28:47 meins 2 client_post_select: <-- [challenge]
+Feb 01 18:28:47 meins 2 client_post_select: --> 2016213580
+Feb 01 18:28:47 meins 2 client_post_select: decrypting session key
+Feb 01 18:28:47 meins 2 enable_crypt: rc4 encryption activated for fd 7
+
-Jan 22 03:08:46 2: (27321) log_welcome: welcome to para_server cvs (Sun Jan 22 02:51:13 MET 2006)
-Jan 22 03:08:46 1: (27321) log_welcome: using loglevel 1
-Jan 22 03:08:46 2: (27321) daemon_init: daemonizing
-Jan 22 03:08:46 3: (27322) init_dbtool: initializing mysql database tool
-Jan 22 03:08:46 1: (27322) init_mysql_server: connecting: maan@localhost:3306
-Jan 22 03:08:46 2: (27322) init_mysql_server: successfully connected to mysql server
-Jan 22 03:08:46 2: (27322) init_dbtool: initialized mysql
-Jan 22 03:08:46 3: (27322) do_inits: initializing audio file sender
-Jan 22 03:08:46 1: (27322) afs_init: supported audio formats: mp3 ogg
-Jan 22 03:08:46 3: (27322) afs_init: initializing mp3 handler
-Jan 22 03:08:46 3: (27322) afs_init: initializing ogg handler
-Jan 22 03:08:46 2: (27322) afs_init: announce timeval: 0:300000
-Jan 22 03:08:46 3: (27322) afs_init: initializing http sender
-Jan 22 03:08:46 2: (27322) add_perm_list_entry: adding 192.168.0.1/32 to access list
-Jan 22 03:08:46 2: (27322) add_perm_list_entry: adding 192.168.0.4/32 to access list
-Jan 22 03:08:46 2: (27322) add_perm_list_entry: adding 192.168.0.8/32 to access list
-Jan 22 03:08:46 2: (27322) init_tcp_socket: listening on port 8000, fd 5
-Jan 22 03:08:46 1: (27322) para_http_init: http sender init complete
-Jan 22 03:08:46 3: (27322) afs_init: initializing ortp sender
-Jan 22 03:08:46 2: (27322) ortp_add_target: adding to target list (224.0.1.38:1500)
-Jan 22 03:08:46 1: (27322) para_ortp_init: ortp sender init complete
-Jan 22 03:08:46 3: (27322) setup_signal_handling: setting up signal handlers
-Jan 22 03:08:46 1: (27322) para_install_sighandler: catching signal 2
-Jan 22 03:08:46 1: (27322) para_install_sighandler: catching signal 15
-Jan 22 03:08:46 1: (27322) para_install_sighandler: catching signal 1
-Jan 22 03:08:46 1: (27322) para_install_sighandler: catching signal 17
-Jan 22 03:08:46 3: (27322) do_inits: initializing tcp command socket
-Jan 22 03:08:46 2: (27322) init_tcp_socket: listening on port 2990, fd 8
-Jan 22 03:08:46 3: (27322) do_inits: init complete
-Jan 22 03:08:46 1: (27322) status_refresh: 0 events, forcing status update, af = -1
-Jan 22 03:08:47 2: (27322) main: got connection from 192.168.0.8, forking
-Jan 22 03:08:47 1: (27328) close_listed_fds: closing fd 5
-Jan 22 03:08:47 1: (27328) handle_connect: received rc4 request for user maan
-Jan 22 03:08:47 1: (27328) open_user_list: opening user list /home/maan/.paraslash/server.users
-Jan 22 03:08:47 1: (27328) get_user: found entry for maan
-Jan 22 03:08:47 1: (27328) get_user: found 4 perm entries
-Jan 22 03:08:47 1: (27328) handle_connect: sending 64 byte challenge
-Jan 22 03:08:47 2: (27328) handle_connect: good auth for maan (1359837743)
-Jan 22 03:08:47 1: (27328) init_rc4_keys: rc4 keys initialized (198:20)
-Jan 22 03:08:47 2: (27328) handle_connect: rc4 encrytion activated
-Jan 22 03:08:47 1: (27328) parse_cmd: found command stat
-Jan 22 03:08:47 1: (27328) check_perms: checking permissions
-Jan 22 03:08:47 3: (27328) handle_connect: calling com_stat() for maan@192.168.0.8
-Jan 22 03:08:47 2: (27322) main: got connection from 192.168.0.4, forking
-Jan 22 03:08:47 1: (27329) close_listed_fds: closing fd 5
-Jan 22 03:08:47 1: (27329) handle_connect: received rc4 request for user maan
-Jan 22 03:08:47 1: (27329) open_user_list: opening user list /home/maan/.paraslash/server.users
-Jan 22 03:08:47 1: (27329) get_user: found entry for maan
-Jan 22 03:08:47 1: (27329) get_user: found 4 perm entries
-Jan 22 03:08:47 1: (27329) handle_connect: sending 64 byte challenge
-Jan 22 03:08:47 2: (27329) handle_connect: good auth for maan (1661875263)
-Jan 22 03:08:47 1: (27329) init_rc4_keys: rc4 keys initialized (246:109)
-Jan 22 03:08:47 2: (27329) handle_connect: rc4 encrytion activated
-Jan 22 03:08:47 1: (27329) parse_cmd: found command stat
-Jan 22 03:08:47 1: (27329) check_perms: checking permissions
-Jan 22 03:08:47 3: (27329) handle_connect: calling com_stat() for maan@192.168.0.4
+Feb 01 18:28:47 2: (1106) log_welcome: welcome to para_server git (Tue Jan 30 21:47:04 MET 2007)
+Feb 01 18:28:47 1: (1106) log_welcome: using loglevel 1
+Feb 01 18:28:47 1: (1106) populate_user_list: found entry for maan
+Feb 01 18:28:47 1: (1106) populate_user_list: found 4 perm entries
+Feb 01 18:28:47 1: (1106) populate_user_list: found entry for install
+Feb 01 18:28:47 1: (1106) populate_user_list: found 4 perm entries
+Feb 01 18:28:47 1: (1106) populate_user_list: found entry for www
+Feb 01 18:28:47 1: (1106) populate_user_list: found 4 perm entries
+Feb 01 18:28:47 2: (1106) daemon_init: daemonizing
+Feb 01 18:28:47 3: (1112) init_selector: initializing mysql audio file selector
+Feb 01 18:28:47 1: (1112) init_mysql_server: connecting: maan@localhost:3306
+Feb 01 18:28:47 2: (1112) init_mysql_server: success
+Feb 01 18:28:47 3: (1112) do_inits: initializing virtual streaming system
+Feb 01 18:28:47 1: (1112) vss_init: supported audio formats: mp3 ogg aac
+Feb 01 18:28:47 3: (1112) vss_init: initializing mp3 handler
+Feb 01 18:28:47 3: (1112) vss_init: initializing ogg handler
+Feb 01 18:28:47 3: (1112) vss_init: initializing aac handler
+Feb 01 18:28:47 2: (1112) vss_init: announce timeval: 300ms
+Feb 01 18:28:47 3: (1112) vss_init: initializing http sender
+Feb 01 18:28:47 2: (1112) add_perm_list_entry: adding 192.168.0.1/32 to access list
+Feb 01 18:28:47 2: (1112) add_perm_list_entry: adding 192.168.0.4/32 to access list
+Feb 01 18:28:47 2: (1112) add_perm_list_entry: adding 192.168.0.8/32 to access list
+Feb 01 18:28:47 2: (1112) add_perm_list_entry: adding 192.168.0.3/32 to access list
+Feb 01 18:28:47 2: (1112) add_perm_list_entry: adding 127.0.0.1/32 to access list
+Feb 01 18:28:47 2: (1112) init_tcp_socket: listening on port 8000, fd 5
+Feb 01 18:28:47 1: (1112) http_send_init: http sender init complete
+Feb 01 18:28:47 3: (1112) vss_init: initializing dccp sender
+Feb 01 18:28:47 1: (1112) dccp_open: listening on fd 6
+Feb 01 18:28:47 3: (1112) vss_init: initializing ortp sender
+Feb 01 18:28:47 2: (1112) ortp_add_target: adding to target list (224.0.1.38:1500)
+Feb 01 18:28:47 1: (1112) ortp_send_init: ortp sender init complete
+Feb 01 18:28:47 3: (1112) setup_signal_handling: setting up signal handlers
+Feb 01 18:28:47 1: (1112) para_install_sighandler: catching signal 2
+Feb 01 18:28:47 1: (1112) para_install_sighandler: catching signal 15
+Feb 01 18:28:47 1: (1112) para_install_sighandler: catching signal 1
+Feb 01 18:28:47 1: (1112) para_install_sighandler: catching signal 17
+Feb 01 18:28:47 1: (1112) para_install_sighandler: catching signal 10
+Feb 01 18:28:47 3: (1112) do_inits: initializing tcp command socket
+Feb 01 18:28:47 2: (1112) init_tcp_socket: listening on port 2990, fd 9
+Feb 01 18:28:47 3: (1112) do_inits: init complete
+Feb 01 18:28:47 1: (1112) chk_barrier: autoplay_delay barrier: 15000ms left
+Feb 01 18:28:47 1: (1112) status_refresh: 0 events, forcing status update, af = -1
+Feb 01 18:28:47 1: (1112) para_next_signal: next signal: 10
+Feb 01 18:28:47 1: (1112) chk_barrier: autoplay_delay barrier: 14999ms left
+Feb 01 18:28:47 2: (1112) main: got connection from 127.0.0.1, forking
+Feb 01 18:28:47 1: (1120) close_listed_fds: closing fd 6
+Feb 01 18:28:47 1: (1120) close_listed_fds: closing fd 5
+Feb 01 18:28:47 1: (1112) chk_barrier: autoplay_delay barrier: 14736ms left
+Feb 01 18:28:47 1: (1120) handle_connect: received rc4 request for user maan
+Feb 01 18:28:47 1: (1120) handle_connect: sending 64 byte challenge
+Feb 01 18:28:47 2: (1120) handle_connect: good auth for maan (2016213580)
+Feb 01 18:28:47 1: (1120) init_rc4_keys: rc4 keys initialized (187:41)
+Feb 01 18:28:47 2: (1120) enable_crypt: rc4 encryption activated for fd 10
+Feb 01 18:28:47 1: (1120) check_perms: checking permissions
+Feb 01 18:28:47 3: (1120) handle_connect: calling com_stat() for maan@127.0.0.1
lw(1)
Fn('Times-Roman')
Fs(14)
-txt('SQL query',(3.06152e-16,1,-1,3.06152e-16,73.5128,678.229))
+txt('SQL query',(3.06152e-16,1,-1,3.06152e-16,50.9527,678.229))
lw(0.992126)
la2(([(-6.0, 3.0), (1.0, 0.0), (-6.0, -3.0)], 0))
b()
-bs(76.5508,667.712,0)
-bs(76.5508,750.57,0)
+bs(53.9907,667.712,0)
+bs(53.9907,750.57,0)
G_()
G()
lw(1)
la2(([(-6.0, 3.0), (1.0, 0.0), (-6.0, -3.0)], 0))
b()
-bs(205.995,666.16,0)
-bs(205.995,744.222,0)
+bs(205.995,672.508,0)
+bs(205.995,750.57,0)
fp((0,0,0))
le()
lw(1)
Fn('Times-Roman')
Fs(14)
-txt('open file',(1.19433e-15,1,-1,1.19433e-15,202.957,680.502))
+txt('open file',(1.19433e-15,1,-1,1.19433e-15,202.957,686.85))
G_()
G()
fp((0,0,0))
lw(1)
Fn('Times-Roman')
Fs(14)
-txt('mp3 data',(-1.83691e-16,-1,1,-1.83691e-16,241.524,730.112))
+txt('mp3 data',(-1.83691e-16,-1,1,-1.83691e-16,241.524,740.889))
lw(0.992126)
la2(([(-6.0, 3.0), (1.0, 0.0), (-6.0, -3.0)], 0))
b()
-bs(238.486,739.793,0)
-bs(238.486,668.714,0)
-G_()
-G()
-fp((0,0,0))
-le()
-lw(1)
-Fn('Times-Roman')
-Fs(14)
-txt('fork & exec',(1.19433e-15,1,-1,1.19433e-15,215.967,398.919))
-lw(0.992126)
-la2(([(-6.0, 3.0), (1.0, 0.0), (-6.0, -3.0)], 0))
-b()
-bs(219.005,388.674,0)
-bs(219.005,476.027,0)
-G_()
-G()
-lw(0.992126)
-la2(([(-6.0, 3.0), (1.0, 0.0), (-6.0, -3.0)], 0))
-b()
-bs(238.331,474.579,0)
-bs(238.331,392.999,0)
-fp((0,0,0))
-le()
-lw(1)
-Fn('Times-Roman')
-Fs(14)
-txt('server status',(-1.83691e-16,-1,1,-1.83691e-16,241.369,468.586))
+bs(238.486,750.57,0)
+bs(238.486,679.491,0)
G_()
lw(0.992126)
la2(([(-6.0, 3.0), (1.0, 0.0), (-6.0, -3.0)], 0))
le()
lw(1)
Fn('Times-Italic')
-txt('client',(355.816,498))
+txt('client',(526.555,395.967))
G()
lw(0.992126)
la2(([(-6.0, 3.0), (1.0, 0.0), (-6.0, -3.0)], 0))
b()
-bs(105.06,750.094,0)
-bs(105.06,667.236,0)
+bs(83.5254,750.57,0)
+bs(83.5254,667.712,0)
fp((0,0,0))
le()
lw(1)
Fn('Times-Roman')
Fs(14)
-txt('mysql result',(-1.83691e-16,-1,1,-1.83691e-16,108.098,743.084))
+txt('mysql result',(-1.83691e-16,-1,1,-1.83691e-16,86.5634,743.56))
G_()
G()
lw(1)
Fs(24)
txt('para_client',(45.2504,355.601))
G_()
-lw(1)
-r(119.09,0,0,-28.2587,180.229,509.717)
-fp((0,0,0))
-le()
-lw(1)
-Fn('Times-Roman')
-Fs(24)
-txt('para_client',(186.458,489.996))
G()
lw(1)
r(143.312,0,0,-28.2587,408.597,189.57)
Fs(24)
txt('para_gui',(40.4306,169.678))
G_()
-G()
-G()
-lw(0.992126)
-la2(([(-6.0, 3.0), (1.0, 0.0), (-6.0, -3.0)], 0))
-b()
-bs(216.8,522.254,0)
-bs(216.8,603.141,0)
-fp((0,0,0))
-le()
-lw(1)
-Fn('Times-Roman')
-Fs(14)
-txt('connect tcp',(1.19433e-15,1,-1,1.19433e-15,213.762,530.624))
-G_()
-G()
-fp((0,0,0))
-le()
-lw(1)
-Fn('Times-Roman')
-Fs(14)
-txt('server status',(-1.83691e-16,-1,1,-1.83691e-16,249.561,597.495))
-lw(0.992126)
-la2(([(-6.0, 3.0), (1.0, 0.0), (-6.0, -3.0)], 0))
-b()
-bs(246.523,603.141,0)
-bs(246.523,522.254,0)
-G_()
-G_()
fp((0.9,0.9,0.9))
lw(1)
r(177.037,0,0,-89.6831,384.699,788.574)
lw(1)
Fn('Times-Bold')
Fs(36)
-txt('0.2.13',(425.134,712.433))
+txt('0.2.15',(425.134,712.433))
G()
lw(1)
r(517.739,0,0,-28.2587,33.4706,653.823)
txt('para_server',(236.372,634.102))
G_()
G()
-lw(1)
-r(360.298,0,0,-28.2587,199.586,375.322)
-fp((0,0,0))
-le()
-lw(1)
-Fn('Times-Roman')
-Fs(24)
-txt('para_audiod',(320.419,355.601))
-G_()
-G()
fp((0,0,0))
le()
lw(1)
Fs(14)
txt('cmd output',(-1.83691e-16,-1,1,-1.83691e-16,106.577,297.647))
G_()
+lw(0.992126)
+ld((0.10000000000000001, 1.0))
+b()
+bs(29.1803,415.392,0)
+bs(570.132,415.357,0)
+bs(570.132,26.3198,0)
+bs(27.1619,26.3198,0)
+bs(27.1619,413.359,0)
G()
+fp((0,0,0))
+le()
lw(1)
+Fn('Times-Roman')
+Fs(14)
+txt('connect tcp, send cmd',(2.57235e-15,1,-1,2.57235e-15,75.3426,450.57))
+lw(0.992126)
+la2(([(-6.0, 3.0), (1.0, 0.0), (-6.0, -3.0)], 0))
+b()
+bs(85.3742,430.67,0)
+bs(85.3742,594.889,0)
+G_()
+G()
+lw(0.992126)
la2(([(-6.0, 3.0), (1.0, 0.0), (-6.0, -3.0)], 0))
b()
-bs(505.839,595.876,0)
-bs(505.839,400.592,0)
+bs(116.37,594.889,0)
+bs(116.37,430.67,0)
fp((0,0,0))
le()
lw(1)
Fn('Times-Roman')
Fs(14)
-txt('mp3 data ',(-1.83691e-16,-1,1,-1.83691e-16,508.877,525.842))
+txt('cmd output',(-1.83691e-16,-1,1,-1.83691e-16,125.048,544.475))
G_()
G()
-G()
fp((0,0,0))
le()
lw(1)
Fn('Times-Roman')
Fs(14)
-txt('connect tcp, send cmd',(2.57235e-15,1,-1,2.57235e-15,64.0626,431.071))
+txt('connect tcp',(1.19433e-15,1,-1,1.19433e-15,269.137,480.705))
lw(0.992126)
la2(([(-6.0, 3.0), (1.0, 0.0), (-6.0, -3.0)], 0))
b()
-bs(67.1006,390.148,0)
-bs(67.1006,596.411,0)
+bs(278.425,430.67,0)
+bs(278.425,594.889,0)
G_()
G()
+fp((0,0,0))
+le()
+lw(1)
+Fn('Times-Roman')
+Fs(14)
+txt('server status',(-1.83691e-16,-1,1,-1.83691e-16,311.089,546.551))
lw(0.992126)
la2(([(-6.0, 3.0), (1.0, 0.0), (-6.0, -3.0)], 0))
b()
-bs(101.501,596.411,0)
-bs(101.501,390.148,0)
+bs(302.755,594.889,0)
+bs(302.755,430.67,0)
+G_()
+G()
fp((0,0,0))
le()
lw(1)
Fn('Times-Roman')
Fs(14)
-txt('cmd output',(-1.83691e-16,-1,1,-1.83691e-16,104.539,524.976))
-G_()
-G_()
+txt('mp3 data ',(-1.83691e-16,-1,1,-1.83691e-16,479.651,540.387))
lw(0.992126)
-ld((0.10000000000000001, 1.0))
+la2(([(-6.0, 3.0), (1.0, 0.0), (-6.0, -3.0)], 0))
b()
-bs(29.1803,383.603,0)
-bs(164.433,383.603,0)
-bs(164.433,513.811,0)
-bs(396.545,513.811,0)
-bs(396.545,383.568,0)
-bs(570.132,383.568,0)
-bs(570.132,26.3198,0)
-bs(27.1619,26.3198,0)
-bs(27.1619,382.595,0)
+bs(473.246,594.889,0)
+bs(473.246,430.67,0)
+G_()
+G()
+lw(1)
+r(301.847,0,0,-28.2587,220.095,375.322)
+fp((0,0,0))
+le()
+lw(1)
+Fn('Times-Roman')
+Fs(24)
+txt('para_audiod',(311.703,355.601))
+G_()
guidelayer('Guide Lines',1,0,0,1,(0,0,1))
guide(-307.905,0)
grid((0,0,20,20),0,(0,0,1),'Grid')
/*
- * Copyright (C) 2004-2006 Andre Noll <maan@systemlinux.org>
+ * Copyright (C) 2004-2007 Andre Noll <maan@systemlinux.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
#include "string.h"
#include <sys/time.h> /* gettimeofday */
-#include <regex.h>
#include <pwd.h>
#include <sys/utsname.h> /* uname() */
#include <string.h>
*
* A wrapper for realloc(3). It calls \p exit(\p EXIT_FAILURE) on errors,
* i.e. there is no need to check the return value in the caller.
+ *
+ * \return A pointer to the newly allocated memory, which is suitably aligned
+ * for any kind of variable and may be different from \p p.
+ *
* \sa realloc(3)
*/
__must_check __malloc void *para_realloc(void *p, size_t size)
* \param size desired new size
*
* A wrapper for malloc(3) which exits on errors.
+ *
+ * \return A pointer to the allocated memory, which is suitably aligned for any
+ * kind of variable.
+ *
* \sa malloc(3)
*/
__must_check __malloc void *para_malloc(size_t size)
* \param size desired new size
*
* A wrapper for calloc(3) which exits on errors.
+ *
+ * \return A pointer to the allocated and zeroed-out memory, which is suitably
+ * aligned for any kind of variable.
+ *
* \sa calloc(3)
*/
__must_check __malloc void *para_calloc(size_t size)
/**
* paraslash's version of strdup()
*
- * \param s: string to be duplicated
+ * \param s string to be duplicated
+ *
+ * A wrapper for strdup(3). It calls \p exit(EXIT_FAILURE) on errors, i.e.
+ * there is no need to check the return value in the caller.
*
- * A wrapper for strdup(3). It calls exit(EXIT_FAILURE) on
- * errors, i.e. there is no need to check the return value in the caller.
- * Moreover, this wrapper checks for \a s being NULL and returns an empty
- * string in this case.
+ * \return A pointer to the duplicated string. If \p s was the NULL pointer,
+ * an pointer to an empty string is returned.
*
* \sa strdup(3)
*/
*
* \param fmt usual format string
*
- * Produce output according to \a fmt. No artificial bound on the length of the
- * resulting string is imposed. This function either returns a pointer to a
- * string that must be freed by the caller or aborts without returning.
+ * Produce output according to \p fmt. No artificial bound on the length of the
+ * resulting string is imposed.
+ *
+ * \return This function either returns a pointer to a string that must be
+ * freed by the caller or aborts without returning.
*
* \sa printf(3)
*/
* \param a string to be appended to
* \param b string to append
*
- * Append \a b to \a a. If \a a is NULL, return a copy of \a b, i.e.
- * para_strcat(NULL, b) is equivalent to para_strdup(b). If \a b is NULL,
- * return \a a without making a copy of \a a. Otherwise, construct the
- * concatenation \a c, free \a a (but not \a b) and return \a c.
+ * Append \p b to \p a.
+ *
+ * \return If \p a is NULL, return a pointer to a copy of \p b, i.e.
+ * para_strcat(NULL, b) is equivalent to para_strdup(b). If \p b is NULL,
+ * return \p a without making a copy of \p a. Otherwise, construct the
+ * concatenation \p c, free \p a (but not \p b) and return \p c.
*
* \sa strcat(3)
*/
/**
* paraslash's version of dirname()
*
- * \param name pointer to The full path
+ * \param name pointer to the full path
+ *
+ * Compute the directory component of \p name
*
- * If \a name is \þ NULL or the empty string, return \p NULL, Otherwise, Make a
- * copy of \a name and return its directory component. Caller is responsible to
- * free the result.
+ * \return If \p name is \þ NULL or the empty string, return \p NULL.
+ * Otherwise, Make a copy of \p name and return its directory component. Caller
+ * is responsible to free the result.
*/
__must_check __malloc char *para_dirname(const char *name)
{
*
* \param name Pointer to the full path
*
- * If \a name is \p NULL or the empty string, return \p NULL, Otherwise, make a
- * copy of \a name and return its filename component. Caller is responsible to
- * free the result.
+ * Compute the filename component of \p name
+ *
+ * \return If \p name is \p NULL or the empty string, return \p NULL,
+ * Otherwise, make a copy of \p name and return its filename component. Caller
+ * is responsible to free the result.
*/
__must_check __malloc char *para_basename(const char *name)
{
return para_strdup(p);
}
-/**
- * simple search and replace routine
- *
- * \param src source string
- * \param macro_name the name of the macro
- * \param replacement the replacement format string
- *
- * Replace \a macro_name(arg) by \a replacement. \a replacement is a format
- * string which may contain a single string conversion specifier which gets
- * replaced by 'arg'.
- *
- * \return A string in which all matches in \a src are replaced, or NULL if an
- * syntax error was encountered. Caller must free the result.
- *
- * \sa regcomp(3)
- */
-__must_check __malloc char *s_a_r(const char *src, const char* macro_name,
- const char *replacement)
-{
- regex_t preg;
- size_t nmatch = 1;
- regmatch_t pmatch[1];
- int eflags = 0;
- char *dest = NULL;
- const char *bufptr = src;
-
- if (!macro_name || !replacement || !src)
- return para_strdup(src);
- regcomp(&preg, macro_name, 0);
- while (regexec(&preg, bufptr, nmatch, pmatch, eflags)
- != REG_NOMATCH) {
- char *tmp, *arg, *o_bracket, *c_bracket;
-
- o_bracket = strchr(bufptr + pmatch[0].rm_so, '(');
- c_bracket = o_bracket? strchr(o_bracket, ')') : NULL;
- if (!c_bracket)
- goto out;
- tmp = para_strdup(bufptr);
- tmp[pmatch[0].rm_so] = '\0';
- dest = para_strcat(dest, tmp);
- free(tmp);
-
- arg = para_strdup(o_bracket + 1);
- arg[c_bracket - o_bracket - 1] = '\0';
- tmp = make_message(replacement, arg);
- free(arg);
- dest = para_strcat(dest, tmp);
- free(tmp);
- bufptr = c_bracket;
- bufptr++;
- }
- dest = para_strcat(dest, bufptr);
-// PARA_DEBUG_LOG("%s: returning %s\n", __func__, dest);
-out:
- regfree(&preg);
- return dest;
-}
-
-/**
- * replace a string according to a list of macros
- *
- * \param macro_list the array containing a macro/replacement pairs.
- * \param src the source string
- *
- * This function just calls s_a_r() for each element of \a macro_list.
- */
-__must_check __malloc char *s_a_r_list(struct para_macro *macro_list, char *src)
-{
- struct para_macro *mp = macro_list;
- char *ret = NULL, *tmp = para_strdup(src);
-
- while (mp->name) {
- ret = s_a_r(tmp, mp->name, mp->replacement);
- free(tmp);
- if (!ret) /* syntax error */
- return NULL;
- tmp = ret;
- mp++;
- }
- //PARA_DEBUG_LOG("%s: returning %s\n", __func__, dest);
- return ret;
-}
-
/**
* cut trailing newline
*
* \param buf the string to be chopped.
*
- * Replace the last character in \a buf by zero if it is euqal to
+ * Replace the last character in \p buf by zero if it is euqal to
* the newline character.
*/
void chop(char *buf)
* get a random filename
*
* This is by no means a secure way to create temporary files in a hostile
- * direcory like /tmp. However, it is OK to use for temp files, fifos, sockets
- * that are created in ~/.paraslash. Result must be freed by the caller.
+ * direcory like \p /tmp. However, it is OK to use for temp files, fifos,
+ * sockets that are created in ~/.paraslash. Result must be freed by the
+ * caller.
+ *
+ * \return a pointer to a random filename.
*/
__must_check __malloc char *para_tmpname(void)
{
*
* This wrapper for mkstemp additionally uses fchmod() to
* set the given mode of the tempfile if mkstemp() returned success.
- * Return value: The file descriptor of the temp file just created on success.
+ *
+ * \return The file descriptor of the temp file just created on success.
* On errors, -E_MKSTEMP or -E_FCHMOD is returned.
*/
__must_check int para_mkstemp(char *template, mode_t mode)
* \return A dynammically allocated string that must be freed by the caller. On
* errors, the string "unknown user" is returned, i.e. this function never
* returns NULL.
+ *
+ * \sa getpwuid(3)
*/
__must_check __malloc char *para_logname(void)
{
* \param argv_ptr pointer to the list of substrings
* \param delim delimiter
*
- * This function modifies \a args by replacing each occurance of \a delim by
+ * This function modifies \p args by replacing each occurance of \p delim by
* zero. A NULL-terminated array of pointers to char* is allocated dynamically
* and these pointers are initialized to point to the broken-up substrings
- * within \a args. A pointer to this array is returned via \a argv_ptr. It's OK
- * to call this function with \a args == NULL.
+ * within \p args. A pointer to this array is returned via \p argv_ptr. It's OK
+ * to call this function with \p args \p == \p NULL.
*
- * \return The number of substrings found in \a args.
+ * \return The number of substrings found in \p args.
*/
-
__must_check unsigned split_args(char *args, char ***argv_ptr, const char *delim)
{
char *p = args;
/*
- * Copyright (C) 2006 Andre Noll <maan@systemlinux.org>
+ * Copyright (C) 2006-2007 Andre Noll <maan@systemlinux.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
/** \file string.h exported sybmols from string.c */
-/** contains name/replacement pairs used by s_a_r_list()
- *
- * \sa s_a_r()
- */
-struct para_macro {
- /** the name of the macro */
- const char *name;
- /** the replacement text */
- const char *replacement;
-};
__must_check __malloc void *para_realloc(void *p, size_t size);
__must_check __malloc void *para_malloc(size_t size);
__must_check __malloc void *para_calloc(size_t size);
__must_check __malloc char *para_strcat(char *a, const char *b);
__must_check __malloc char *para_dirname(const char *name);
__must_check __malloc char *para_basename(const char *name);
-__must_check __malloc char *s_a_r(const char *src, const char* regex, const char *replacement);
-__must_check __malloc char *s_a_r_list(struct para_macro *pm, char *src);
void chop(char* buf);
__must_check __malloc char *para_tmpname(void);
__must_check int para_mkstemp(char *template, mode_t mode);