]> git.tuebingen.mpg.de Git - paraslash.git/commitdiff
audiod: Add missing documentation
authorAndre Noll <maan@systemlinux.org>
Mon, 5 Feb 2007 23:13:22 +0000 (00:13 +0100)
committerAndre Noll <maan@systemlinux.org>
Mon, 5 Feb 2007 23:13:22 +0000 (00:13 +0100)
audiod.c
audiod.h
audiod_command.c

index ec9f34d5ad52e0fdc32bca3e1059553272a7de6d..9d0d0741cb86dd2e94c78eff1ed3503df5edbdd6 100644 (file)
--- a/audiod.c
+++ b/audiod.c
@@ -66,12 +66,28 @@ struct audio_format_info {
        struct timeval restart_barrier;
 };
 
+/**
+ * para_audiod uses \p MAX_STREAM_SLOTS different slots, each of which may
+ * be associated with a receiver/filter/writer triple. This array holds all
+ * information on the status of these slots.
+ *
+ * \sa struct slot_info
+ * */
 struct slot_info slot[MAX_STREAM_SLOTS];
 
 
+/**
+ * the current mode of operation of which can be changed by the on/off/cycle
+ * commands. It is either, AUDIOD_OFF, AUDIOD_ON or AUDIOD_STANDBY.
+ */
 int audiod_status = AUDIOD_ON;
 
+/**
+ * the gengetopt args_info struct that holds information on all command line
+ * arguments
+ */
 struct audiod_args_info conf;
+
 static char *socket_name;
 static FILE *logfile;
 static struct audio_format_info afi[NUM_AUDIO_FORMATS];
@@ -79,6 +95,12 @@ static struct audio_format_info afi[NUM_AUDIO_FORMATS];
 static struct signal_task signal_task_struct, *sig_task = &signal_task_struct;
 
 static struct status_task status_task_struct;
+
+/**
+ * the task that calls the status command of para_server
+ *
+ * \sa struct status_task
+ */
 struct status_task *stat_task = &status_task_struct;
 static struct timeval initial_delay_barrier;
 
@@ -125,8 +147,11 @@ int get_audio_format_num(char *name)
        return -E_UNSUPPORTED_AUDIO_FORMAT;
 }
 
-/*
- * log function. first argument is loglevel.
+/**
+ * the log function of para_audiod
+ *
+ * \param ll loglevel
+ * \param fmt the format string
  */
 void para_log(int ll, const char* fmt,...)
 {
@@ -960,6 +985,18 @@ static void close_stat_pipe(void)
        }
 }
 
+/**
+ * close the connection to para_server and exit
+ *
+ * \param status the exit status which is passed to exit(3)
+ * \param msg the log message
+ *
+ * Log \a msg with loglevel \p EMERG, close the connection to para_server if
+ * open, and call \p exit(status). \a status should be either EXIT_SUCCESS or
+ * EXIT_FAILURE.
+ *
+ * \sa exit(3)
+ */
 void __noreturn clean_exit(int status, const char *msg)
 {
        PARA_EMERG_LOG("%s\n", msg);
@@ -1073,6 +1110,16 @@ static void set_initial_status(void)
                PARA_WARNING_LOG("%s", "invalid mode\n");
 }
 
+/**
+ * the main function of para_audiod
+ *
+ * \param argc usual argument count
+ * \param argv usual argument vector
+ *
+ * \return EXIT_SUCCESS or EXIT_FAILURE
+ *
+ * \sa para_audiod(1)
+ * */
 int main(int argc, char *argv[])
 {
        char *cf;
index 7628c1ea3a2ec9c8038d31a549a3b738a9b9a811..ab75c584b07e3915fb0cc4ea646af67f14e65d66 100644 (file)
--- a/audiod.h
+++ b/audiod.h
@@ -37,8 +37,8 @@ extern const char *audio_formats[];
  * - off: disconnect from para_server
  * - on: receive status information from para_server and play the audio stream
  * - sb: only receive status information but not the audio stream
-*/
-enum {AUDIOD_OFF, AUDIOD_ON, AUDIOD_STANDBY};
+ */
+enum audiod_status_info {AUDIOD_OFF, AUDIOD_ON, AUDIOD_STANDBY};
 
 /** defines one command of para_audiod */
 struct audiod_command {
@@ -65,7 +65,7 @@ struct audiod_command {
  *
  * \sa receier_node, receiver, filter, filter_node, filter_chain, writer,
  * writer_node, writer_node_group.
 */
+ */
 struct slot_info {
        /** number of the audio format in this slot */
        int format;
index 3bb94ad60a8a1079659105b792068e71045c9e01..349480ff1f34f5a9bfebe57f26ddad6f0aef93ce 100644 (file)
@@ -406,6 +406,21 @@ static int check_perms(uid_t uid)
        return -E_UCRED_PERM;
 }
 
+/**
+ * handle arriving connections on the local socket
+ *
+ * \param accept_fd the fd to call accept() on
+ *
+ * This is called whenever para_audiod's main task detects an incoming
+ * connection by the readability of \a accept_fd. This function reads the
+ * command sent by the peer, checks the connecting user's permissions by using
+ * unix socket credentials (if supported by the OS) and calls the corresponding
+ * command handler if permissions are OK.
+ *
+ * \return positive on success, negative on errors
+ *
+ * \sa para_accept(), recv_cred_buffer()
+ * */
 int handle_connect(int accept_fd)
 {
        int i, argc, ret, clifd = -1;