2 * This file is part of DisOrder.
3 * Copyright (C) 2004, 2005, 2006 Richard Kettlewell
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
21 #ifndef CONFIGURATION_H
22 #define CONFIGURATION_H
26 /* Configuration is kept in a @struct config@; the live configuration
27 * is always pointed to by @config@. Values in @config@ are UTF-8 encoded.
35 struct stringlistlist
{
46 struct collectionlist
{
52 char *part
; /* part */
53 struct real_pcre
*re
; /* regexp */
54 char *replace
; /* replacement string */
55 char *context
; /* context glob */
56 unsigned reflags
; /* regexp flags */
65 char *type
; /* track or dir */
66 char *context
; /* sort or choose */
67 char *replace
; /* substitution string */
68 struct real_pcre
*re
; /* compiled re */
69 unsigned flags
; /* regexp flags */
72 struct transformlist
{
79 struct stringlistlist player
; /* players */
80 struct stringlistlist allow
; /* allowed users */
81 struct stringlist scratch
; /* scratch tracks */
82 long gap
; /* gap between tracks */
83 long history
; /* length of history */
84 struct stringlist trust
; /* trusted users */
85 const char *user
; /* user to run as */
86 long nice_rescan
; /* rescan subprocess niceness */
87 struct stringlist plugins
; /* plugin path */
88 struct stringlist stopword
; /* stopwords for track search */
89 struct collectionlist collection
; /* track collections */
90 long checkpoint_kbyte
;
92 char *mixer
; /* mixer device file */
93 char *channel
; /* mixer channel */
94 long prefsync
; /* preflog sync intreval */
95 struct stringlist listen
; /* secondary listen address */
96 const char *alias
; /* alias format */
97 int lock
; /* server takes a lock */
98 long nice_server
; /* nice value for server */
99 long nice_speaker
; /* nice value for speaker */
100 /* shared client/server config */
101 const char *home
; /* home directory for state files */
103 const char *username
, *password
; /* our own username and password */
104 struct stringlist connect
; /* connect address */
106 struct stringlist templates
; /* template path */
107 const char *url
; /* canonical URL */
108 long refresh
; /* maximum refresh period */
109 unsigned restrictions
; /* restrictions */
110 #define RESTRICT_SCRATCH 1
111 #define RESTRICT_REMOVE 2
112 #define RESTRICT_MOVE 4
113 struct namepartlist namepart
; /* transformations */
114 int signal
; /* termination signal */
115 const char *device
; /* ALSA output device */
116 struct transformlist transform
; /* path name transformations */
118 /* derived values: */
119 int nparts
; /* number of distinct name parts */
120 char **parts
; /* name part list */
123 extern struct config
*config
;
124 /* the current configuration */
126 int config_read(void);
127 /* re-read config, return 0 on success or non-0 on error.
128 * Only updates @config@ if the new configuration is valid. */
130 char *config_get_file(const char *name
);
131 /* get a filename within the home directory */
135 char *config_userconf(const char *home
, const struct passwd
*pw
);
136 /* get the user's own private conffile, assuming their home dir is
137 * @home@ if not null and using @pw@ otherwise */
139 char *config_usersysconf(const struct passwd
*pw
);
140 /* get the user's conffile in /etc */
142 char *config_private(void);
143 /* get the private config file */
145 extern char *configfile
;
147 #endif /* CONFIGURATION_H */
155 /* arch-tag:bf8be7718c5e6348d0c922dfa66b85f9 */