]> git.tuebingen.mpg.de Git - paraslash.git/blobdiff - server.c
INSTALL: Add two links to related information.
[paraslash.git] / server.c
index ab88b07fbd60827e56299c2338acc7cb9e3a541d..e3e3eada3513aafe11771474b6255d0a700ecc83 100644 (file)
--- a/server.c
+++ b/server.c
@@ -4,14 +4,60 @@
  * Licensed under the GPL v2. For licencing details see COPYING.
  */
 
-/** \file server.c Paraslash's main server */
+/** \file server.c Paraslash's main server. */
 
 
 /** \mainpage Paraslash API Reference
  *
- *  Good starting points for reading are probably \ref audio_file_selector,
- *  \ref sender, \ref receiver, \ref receiver_node, \ref filter, \ref
- *  filter_node.
+ * Starting points for getting an overview are
+ *
+ * probably:
+ *
+ *     - The main programs: \ref server.c, \ref audiod.c, \ref client.c,
+ *       \ref audioc.c, \ref fsck.c,
+ *     - Server: \ref server_command, \ref sender,
+ *     - Audio file selector: \ref audio_format_handler, \ref mood, \ref afs_table,
+ *     - Client: \ref receiver, \ref receiver_node, \ref filter, \ref filter_node.
+ *
+ *
+ * The gory details, listed by topic:
+ *
+ *     - Audio format handlers: \ref mp3_afh.c, \ref ogg_afh.c \ref aac_afh.c
+ *     - Decoders: \ref mp3dec.c, \ref \ref oggdec.c, \ref aacdec.c
+ *     - Volume normalizer: \ref compress.c
+ *     - Output: \ref alsa_write.c, \ref osx_write.c
+ *     - http: \ref http_recv.c, \ref http_send.c
+ *     - ortp: \ref ortp_recv.c, \ref ortp_send.c
+ *     - dccp: \ref dccp_recv.c, \ref dccp_send.c
+ *     - Audio file selector: \ref afs.c, \ref aft.c, \ref mood.c
+ *     - Afs structures: \ref afs_table, \ref audio_file_data,
+ *       \ref afs_info \ref audio_format_info,
+ *     - Afs tables: \ref aft.c, \ref mood.c, \ref playlist.c,
+ *       \ref attribute.c, \ref score.c.
+ *
+ * Lower levels:
+ *
+ *     - Scheduling: \ref sched.c, \ref sched.h,
+ *     - Networking: \ref net.c,
+ *     - File descriptors: \ref fd.c,
+ *     - Signals: \ref signal.c,
+ *     - Daemons: \ref daemon.c,
+ *     - Strings: \ref string.c, \ref string.h,
+ *     - Time: \ref time.c,
+ *     - Spawning processes: \ref exec.c
+ *     - Inter process communication: \ref ipc.c,
+ *     - The object storage layer: \ref osl.c,
+ *     - Blob tables: \ref blob.c,
+ *     - Queueing chunks of audio data: \ref chunk_queue.c,
+ *     - The error subssystem: \ref error.h.
+ *
+ * Lov-level data structures:
+ *
+ *     - Doubly linked lists: \ref list.h,
+ *     - Red-black trees: \ref rbtree.h, \ref rbtree.c,
+ *     - Ring buffer: \ref ringbuffer.c, \ref ringbuffer.h,
+ *     - Hashing: \ref hash.h, \ref sha1.h, \ref sha1.c,
+ *     - Crypto: \ref crypt.c.
  *
  */
 
@@ -22,7 +68,6 @@
 #include "para.h"
 #include "error.h"
 #include "server.cmdline.h"
-#include "afs_common.h"
 #include "afh.h"
 #include "string.h"
 #include "afs.h"
@@ -47,16 +92,16 @@ INIT_SERVER_ERRLISTS;
 #define ALARM_TIMEOUT 10
 
 /**
- * pointer to shared memory area for communication between para_server
- * and its children. exported to vss.c. command.c and to all selectors.
+ * Pointer to shared memory area for communication between para_server
+ * and its children. Exported to vss.c. command.c and to afs.
  */
 struct misc_meta_data *mmd;
 
 /**
  * the configuration of para_server
  *
- * It also contains the options for all audio file selectors, audio format handler
- * and all supported senders.
+ * It also contains the options for the audio file selector, audio format
+ * handler and all supported senders.
  */
 struct server_args_info conf;
 
@@ -148,14 +193,12 @@ static void shm_init(void)
                goto err_out;
        mmd_mutex = ret;
 
-       mmd->selector_num = 0;
        mmd->num_played = 0;
        mmd->num_commands = 0;
        mmd->events = 0;
        mmd->num_connects = 0;
        mmd->active_connections = 0;
-       strcpy(mmd->filename, "(none)");
-       mmd->audio_format = -1;
+       strcpy(mmd->afd.path, "(none)");
        mmd->vss_status_flags = VSS_NEXT;
        mmd->new_vss_status_flags = VSS_NEXT;
        mmd->sender_cmd_data.cmd_num = -1;
@@ -168,7 +211,7 @@ err_out:
 /**
  * lock the shared memory area containing the mmd struct
  *
- * \sa semop(2), struct misc_meta_data
+ * \sa semop(2), struct misc_meta_data.
  */
 void mmd_lock(void)
 {
@@ -194,7 +237,7 @@ static void parse_config(int override)
        char *cf;
 
        if (conf.config_file_given)
-               cf = conf.config_file_arg;
+               cf = para_strdup(conf.config_file_arg);
        else
                cf = make_message("%s/.paraslash/server.conf", home);
        free(user_list_file);
@@ -345,8 +388,6 @@ static unsigned do_inits(int argc, char **argv)
        /* become daemon */
        if (conf.daemon_given)
                daemon_init();
-//     init_selector();
-//     PARA_ERROR_LOG("num: %d\n", mmd->selector_num);
        PARA_NOTICE_LOG("%s", "initializing virtual streaming system\n");
        afh_init();
        vss_init();
@@ -392,8 +433,8 @@ out:
        prev_events = mmd->events;
        mmd->vss_status_flags = mmd->new_vss_status_flags;
        if (ret) {
-               PARA_DEBUG_LOG("%d events, forcing status update, af = %d\n",
-                       mmd->events, mmd->audio_format);
+               PARA_DEBUG_LOG("%d events, forcing status update\n",
+                       mmd->events);
                killpg(0, SIGUSR1);
        }
 }