chiark / gitweb /
configure.ac, server/gstdecode.c: Support GStreamer 1.0.
[disorder] / lib / configuration.h
CommitLineData
460b9539 1/*
2 * This file is part of DisOrder.
cca89d7c 3 * Copyright (C) 2004-2011, 2013 Richard Kettlewell
460b9539 4 *
e7eb3a27 5 * This program is free software: you can redistribute it and/or modify
460b9539 6 * it under the terms of the GNU General Public License as published by
e7eb3a27 7 * the Free Software Foundation, either version 3 of the License, or
460b9539 8 * (at your option) any later version.
e7eb3a27
RK
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
460b9539 15 * You should have received a copy of the GNU General Public License
e7eb3a27 16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
460b9539 17 */
0e4472a0 18/** @file lib/configuration.h
19 * @brief Configuration file support
20 */
460b9539 21
22#ifndef CONFIGURATION_H
23#define CONFIGURATION_H
24
cca89d7c
RK
25#if HAVE_PCRE_H
26# include <pcre.h>
27#endif
05b75f8d 28
6d2d327c 29#include "speaker-protocol.h"
04e1fa7c 30#include "rights.h"
76e72f65 31#include "addr.h"
9d5da576 32
b50cfb8a
RK
33struct uaudio;
34
460b9539 35/* Configuration is kept in a @struct config@; the live configuration
36 * is always pointed to by @config@. Values in @config@ are UTF-8 encoded.
37 */
38
3f3bb97b 39/** @brief A list of strings */
460b9539 40struct stringlist {
3f3bb97b 41 /** @brief Number of strings */
460b9539 42 int n;
3f3bb97b 43 /** @brief Array of strings */
460b9539 44 char **s;
45};
46
3f3bb97b 47/** @brief A list of list of strings */
460b9539 48struct stringlistlist {
3f3bb97b 49 /** @brief Number of string lists */
460b9539 50 int n;
3f3bb97b 51 /** @brief Array of string lists */
460b9539 52 struct stringlist *s;
53};
54
3f3bb97b 55/** @brief A collection of tracks */
460b9539 56struct collection {
3f3bb97b 57 /** @brief Module that supports this collection */
460b9539 58 char *module;
3f3bb97b 59 /** @brief Filename encoding */
460b9539 60 char *encoding;
3f3bb97b 61 /** @brief Root directory */
460b9539 62 char *root;
63};
64
3f3bb97b 65/** @brief A list of collections */
460b9539 66struct collectionlist {
3f3bb97b 67 /** @brief Number of collections */
460b9539 68 int n;
3f3bb97b 69 /** @brief Array of collections */
460b9539 70 struct collection *s;
71};
72
cca89d7c 73#if HAVE_PCRE_H
598b07b7 74/** @brief A track name part */
460b9539 75struct namepart {
76 char *part; /* part */
9417e1a3
RK
77 pcre *re; /* compiled regexp */
78 char *res; /* regexp as a string */
460b9539 79 char *replace; /* replacement string */
80 char *context; /* context glob */
81 unsigned reflags; /* regexp flags */
82};
83
598b07b7 84/** @brief A list of track name parts */
460b9539 85struct namepartlist {
86 int n;
87 struct namepart *s;
88};
89
598b07b7 90/** @brief A track name transform */
460b9539 91struct transform {
92 char *type; /* track or dir */
93 char *context; /* sort or choose */
94 char *replace; /* substitution string */
05b75f8d 95 pcre *re; /* compiled re */
460b9539 96 unsigned flags; /* regexp flags */
97};
98
598b07b7 99/** @brief A list of track name transforms */
460b9539 100struct transformlist {
101 int n;
102 struct transform *t;
103};
cca89d7c 104#endif
460b9539 105
3f3bb97b 106/** @brief System configuration */
460b9539 107struct config {
108 /* server config */
3f3bb97b 109
637fdea3
RK
110 /** @brief Authorization algorithm */
111 char *authorization_algorithm;
112
3f3bb97b
RK
113 /** @brief All players */
114 struct stringlistlist player;
115
62dc3748
RK
116 /** @brief All tracklength plugins */
117 struct stringlistlist tracklength;
118
3f3bb97b
RK
119 /** @brief Scratch tracks */
120 struct stringlist scratch;
121
3f3bb97b
RK
122 /** @brief Maximum number of recent tracks to record in history */
123 long history;
124
2a10b70b
RK
125 /** @brief Expiry limit for noticed.db */
126 long noticed_history;
127
3f3bb97b
RK
128 /** @brief User for server to run as */
129 const char *user;
130
131 /** @brief Nice value for rescan subprocess */
132 long nice_rescan;
133
134 /** @brief Paths to search for plugins */
135 struct stringlist plugins;
136
137 /** @brief List of stopwords */
138 struct stringlist stopword;
139
140 /** @brief List of collections */
141 struct collectionlist collection;
142
143 /** @brief Database checkpoint byte limit */
460b9539 144 long checkpoint_kbyte;
3f3bb97b
RK
145
146 /** @brief Databsase checkpoint minimum */
460b9539 147 long checkpoint_min;
3f3bb97b
RK
148
149 /** @brief Path to mixer device */
150 char *mixer;
151
152 /** @brief Mixer channel to use */
153 char *channel;
154
3f3bb97b 155 /** @brief Secondary listen address */
80dc2c5f 156 struct netaddress listen;
3f3bb97b
RK
157
158 /** @brief Alias format string */
159 const char *alias;
160
3f3bb97b
RK
161 /** @brief Nice value for server */
162 long nice_server;
163
164 /** @brief Nice value for speaker */
165 long nice_speaker;
166
167 /** @brief Command execute by speaker to play audio */
168 const char *speaker_command;
169
f75ab9d3
RK
170 /** @brief Pause mode for command backend */
171 const char *pause_mode;
172
3f3bb97b 173 /** @brief Target sample format */
6d2d327c 174 struct stream_header sample_format;
3f3bb97b
RK
175
176 /** @brief Sox syntax generation */
177 long sox_generation;
178
b50cfb8a
RK
179 /** @brief API used to play sound */
180 const char *api;
3c499fe7 181
2563dc1f
RK
182 /** @brief Maximum size of a playlist */
183 long playlist_max;
184
ddbf05c8
RK
185 /** @brief Maximum lifetime of a playlist lock */
186 long playlist_lock_timeout;
187
9e42afcd 188#if !_WIN32
3f3bb97b
RK
189 /** @brief Home directory for state files */
190 const char *home;
9e42afcd 191#endif
3f3bb97b
RK
192
193 /** @brief Login username */
47854c5f 194 char *username;
3f3bb97b
RK
195
196 /** @brief Login password */
47854c5f 197 char *password;
3f3bb97b
RK
198
199 /** @brief Address to connect to */
e41a9999 200 struct netaddress connect;
3f3bb97b
RK
201
202 /** @brief Directories to search for web templates */
203 struct stringlist templates;
204
205 /** @brief Canonical URL of web interface */
b64c2805 206 char *url;
3f3bb97b 207
61507e3c
RK
208 /** @brief Short display limit */
209 long short_display;
210
3f3bb97b
RK
211 /** @brief Maximum refresh interval for web interface (seconds) */
212 long refresh;
213
533272be
RK
214 /** @brief Minimum refresh interval for web interface (seconds) */
215 long refresh_min;
216
3f3bb97b
RK
217 /** @brief Target queue length */
218 long queue_pad;
219
cebe3127
RK
220 /** @brief Minimum time between a track being played again */
221 long replay_min;
222
cca89d7c 223#if HAVE_PCRE_H
460b9539 224 struct namepartlist namepart; /* transformations */
cca89d7c 225#endif
3f3bb97b
RK
226
227 /** @brief Termination signal for subprocesses */
228 int signal;
229
230 /** @brief ALSA output device */
231 const char *device;
cca89d7c
RK
232
233#if HAVE_PCRE_H
460b9539 234 struct transformlist transform; /* path name transformations */
cca89d7c 235#endif
460b9539 236
23205f9c 237 /** @brief Address to send audio data to */
76e72f65 238 struct netaddress broadcast;
23205f9c
RK
239
240 /** @brief Source address for network audio transmission */
76e72f65 241 struct netaddress broadcast_from;
23205f9c 242
ba70caca
RK
243 /** @brief RTP delay threshold */
244 long rtp_delay_threshold;
87864f77
RK
245
246 /** @brief Verbose RTP transmission logging */
247 int rtp_verbose;
ba70caca 248
23205f9c
RK
249 /** @brief TTL for multicast packets */
250 long multicast_ttl;
e83d0967 251
61941295
RK
252 /** @brief Whether to loop back multicast packets */
253 int multicast_loop;
b12be54a
RK
254
255 /** @brief Login lifetime in seconds */
256 long cookie_login_lifetime;
257
258 /** @brief Signing key lifetime in seconds */
259 long cookie_key_lifetime;
04e1fa7c
RK
260
261 /** @brief Default rights for a new user */
0f55e905 262 char *default_rights;
bb6ae3fb 263
2eee4b0c
RK
264 /** @brief Path to sendmail executable */
265 char *sendmail;
266
bb6ae3fb 267 /** @brief SMTP server for sending mail */
268 char *smtp_server;
269
270 /** @brief Origin address for outbound mail */
271 char *mail_sender;
d742bb47
RK
272
273 /** @brief Maximum number of tracks in response to 'new' */
274 long new_max;
6207d2f3 275
276 /** @brief Minimum interval between password reminder emails */
277 long reminder_interval;
810b8083
RK
278
279 /** @brief Whether to allow user management over TCP */
280 int remote_userman;
05dcfac6
RK
281
282 /** @brief Maximum age of biased-up tracks */
283 long new_bias_age;
284
285 /** @brief Maximum bias */
286 long new_bias;
8488cf7d
RK
287
288 /** @brief Rescan on (un)mount */
289 int mount_rescan;
290
b0116b5c
RK
291 /** @brief RTP mode */
292 const char *rtp_mode;
293
460b9539 294 /* derived values: */
295 int nparts; /* number of distinct name parts */
296 char **parts; /* name part list */
8818b7fc
RK
297
298 /* undocumented, for testing only */
299 long dbversion;
460b9539 300};
301
302extern struct config *config;
303/* the current configuration */
304
02ba7921
RK
305int config_read(int server,
306 const struct config *oldconfig);
460b9539 307/* re-read config, return 0 on success or non-0 on error.
308 * Only updates @config@ if the new configuration is valid. */
309
319d7107 310char *config_get_file2(struct config *c, const char *name);
460b9539 311char *config_get_file(const char *name);
312/* get a filename within the home directory */
313
314struct passwd;
315
316char *config_userconf(const char *home, const struct passwd *pw);
317/* get the user's own private conffile, assuming their home dir is
318 * @home@ if not null and using @pw@ otherwise */
319
320char *config_usersysconf(const struct passwd *pw );
321/* get the user's conffile in /etc */
322
323char *config_private(void);
324/* get the private config file */
325
2a1c84fb
RK
326int config_verify(void);
327
47854c5f
RK
328void config_free(struct config *c);
329
460b9539 330extern char *configfile;
63ad732f 331extern int config_per_user;
460b9539 332
b50cfb8a
RK
333extern const struct uaudio *const *config_uaudio_apis;
334
460b9539 335#endif /* CONFIGURATION_H */
336
337/*
338Local Variables:
339c-basic-offset:2
340comment-column:40
341End:
342*/