2 * Copyright (C) 1997 Andre Noll <maan@tuebingen.mpg.de>
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 /** Arguments for the sender command. */
17 struct sender_command_data {
18 /** Greater than zero 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 /** Maximal slice size. */
29 uint16_t max_slice_bytes;
30 /** Number of data slices plus redundant slices. */
31 uint8_t slices_per_group;
32 /** Number of slices minus number of redundant slices. */
33 uint8_t data_slices_per_group;
37 * Miscellaneous data for communication between server and command handlers.
39 * There's only one instance of this structure which lives in a shared memory
40 * area. Command handlers communicate with the server process through this
41 * area. Changes made by the command handlers stay after the command handler
42 * exits. Conversely, changes made by the server process propagate to the
43 * command handlers. Access to this area is serialized via mmd_lock() and
46 * There are two reasons for a variable to be included here: (a) at least one
47 * command handler changes its value, or (b) updates by the server must
48 * propagate to the stat command handlers.
50 struct misc_meta_data {
51 /** The "old" status flags -- commands may only read them. */
52 unsigned int vss_status_flags;
53 /** The new status flags -- commands may set them. */
54 unsigned int new_vss_status_flags;
55 /** The number of data chunks sent so far. */
56 long unsigned chunks_sent;
57 /** Set by the jmp/ff commands to the new position in chunks. */
58 long unsigned repos_request;
59 /** The number of the chunk currently being sent. */
60 long unsigned current_chunk;
61 /** The milliseconds that have been skipped of the current audio file. */
63 /** The time para_server started to stream. */
64 struct timeval stream_start;
68 * Commands may increase this to force a status update to be sent to
69 * all connected stat clients.
72 /** The number of audio files already sent. */
73 unsigned int num_played;
74 /** The number of executed commands. */
75 unsigned int num_commands;
76 /** The number of connections para_server received so far. */
77 unsigned int num_connects;
78 /** The number of connections currently active. */
79 unsigned int active_connections;
80 /** The process id of the audio file selector. */
82 /** This gets updated by afs and contains its current mode. */
83 char afs_mode_string[MAXLINE];
84 /** Used by the sender command. */
85 struct sender_command_data sender_cmd_data;
86 /** Describes the current audio file. */
87 struct audio_file_data afd;
90 /** Command line options for para_server. */
91 extern struct server_args_info conf;
93 __noreturn void handle_connect(int fd, const char *peername);
94 void parse_config_or_die(int override);
95 char *server_get_tasks(void);