2 * Copyright (C) 1997-2009 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 /** 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 * Used for parent-child communication.
39 * There's only one struct of this type which lives in shared memory
40 * for communication between the server instances. Access to this
41 * area is serialized via mmd_lock() and mmd_unlock(). There are two
42 * reasons for a variable to be included here:
44 * - At least one command (i.e. child of the server) must be able to
49 * - The contents are listed in the stat command and have to be up to
52 struct misc_meta_data
{
53 /** The size of the current audio file in bytes. */
55 /** The last modification time of the current audio file. */
57 /** The "old" status flags -- commands may only read them. */
58 unsigned int vss_status_flags
;
59 /** The new status flags -- commands may set them. */
60 unsigned int new_vss_status_flags
;
61 /** The number of data chunks sent for the current audio file. */
62 long unsigned chunks_sent
;
63 /** Set by the jmp/ff commands to the new position in chunks. */
64 long unsigned repos_request
;
65 /** The number of the chunk currently sent out. */
66 long unsigned current_chunk
;
67 /** The milliseconds that have been skipped of the current audio file. */
69 /** The time para_server started to stream. */
70 struct timeval stream_start
;
74 * Commands may increase this to force a status update to be sent to all
78 /** The number of audio files already sent. */
79 unsigned int num_played
;
80 /** The number of executed commands. */
81 unsigned int num_commands
;
82 /** The number of connections para_server received so far. */
83 unsigned int num_connects
;
84 /** The number of connections currently active. */
85 unsigned int active_connections
;
86 /** The process id of the audio file selector. */
88 /** This gets updated by afs and contains its current mode. */
89 char afs_mode_string
[MAXLINE
];
90 /** Used by the sender command. */
91 struct sender_command_data sender_cmd_data
;
92 /** Describes the current audio file. */
93 struct audio_file_data afd
;
96 /** Command line options for para_server. */
97 extern struct server_args_info conf
;
99 __noreturn
void handle_connect(int fd
, const char *peername
);
100 void parse_config_or_die(int override
);