2 * Copyright (C) 1997-2010 Andre Noll <maan@systemlinux.org>
4 * Licensed under the GPL v2. For licencing details see COPYING.
7 /** \file server.h Common server data structures. */
9 /** Size of the selector_info and audio_file info strings of struct misc_meta_data. */
10 #define MMD_INFO_SIZE 16384
12 /** The maximum length of the host component in an URL */
13 #define MAX_HOSTLEN 256
16 /** Holds the arguments for the para_server's sender command. */
17 struct sender_command_data{
18 /** Greater than 0 indicates that a sender cmd is already queued. */
20 /** The number of the sender in question. */
22 /** Used for the allow/deny/add/remove subcommands. */
23 char host[MAX_HOSTLEN];
24 /** Used for allow/deny. */
26 /** The port number for add/remove. */
28 /** Number of data slices plus redundant slices. */
29 uint8_t slices_per_group;
30 /** Number of slices minus number of redundant slices. */
31 uint8_t data_slices_per_group;
35 * Used for parent-child communication.
37 * There's only one struct of this type which lives in shared memory
38 * for communication between the server instances. Access to this
39 * area is serialized via mmd_lock() and mmd_unlock(). There are two
40 * reasons for a variable to be included here:
42 * - At least one command (i.e. child of the server) must be able to
47 * - The contents are listed in the stat command and have to be up to
50 struct misc_meta_data {
51 /** The size of the current audio file in bytes. */
53 /** The last modification time of the current audio file. */
55 /** The "old" status flags -- commands may only read them. */
56 unsigned int vss_status_flags;
57 /** The new status flags -- commands may set them. */
58 unsigned int new_vss_status_flags;
59 /** The number of data chunks sent for the current audio file. */
60 long unsigned chunks_sent;
61 /** Set by the jmp/ff commands to the new position in chunks. */
62 long unsigned repos_request;
63 /** The number of the chunk currently sent out. */
64 long unsigned current_chunk;
65 /** The milliseconds that have been skipped of the current audio file. */
67 /** The time para_server started to stream. */
68 struct timeval stream_start;
72 * Commands may increase this to force a status update to be sent to all
76 /** The number of audio files already sent. */
77 unsigned int num_played;
78 /** The number of executed commands. */
79 unsigned int num_commands;
80 /** The number of connections para_server received so far. */
81 unsigned int num_connects;
82 /** The number of connections currently active. */
83 unsigned int active_connections;
84 /** The process id of the audio file selector. */
86 /** This gets updated by afs and contains its current mode. */
87 char afs_mode_string[MAXLINE];
88 /** Used by the sender command. */
89 struct sender_command_data sender_cmd_data;
90 /** Describes the current audio file. */
91 struct audio_file_data afd;
94 /** Command line options for para_server. */
95 extern struct server_args_info conf;
97 __noreturn void handle_connect(int fd, const char *peername);
98 void parse_config_or_die(int override);