1#ifndef fooclientconfhfoo
2#define fooclientconfhfoo
3
4/***
5  This file is part of PulseAudio.
6
7  Copyright 2004-2006 Lennart Poettering
8
9  PulseAudio is free software; you can redistribute it and/or modify
10  it under the terms of the GNU Lesser General Public License as published
11  by the Free Software Foundation; either version 2.1 of the License,
12  or (at your option) any later version.
13
14  PulseAudio is distributed in the hope that it will be useful, but
15  WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17  General Public License for more details.
18
19  You should have received a copy of the GNU Lesser General Public License
20  along with PulseAudio; if not, see <http://www.gnu.org/licenses/>.
21***/
22
23#include <pulsecore/macro.h>
24#include <pulsecore/native-common.h>
25
26/* A structure containing configuration data for PulseAudio clients. */
27
28typedef struct pa_client_conf {
29    char *daemon_binary;
30    char *extra_arguments;
31    char *default_sink;
32    char *default_source;
33    char *default_server;
34    char *default_dbus_server;
35    char *cookie_file_from_env;
36    uint8_t cookie_from_x11[PA_NATIVE_COOKIE_LENGTH];
37    bool cookie_from_x11_valid;
38    char *cookie_file_from_application;
39    char *cookie_file_from_client_conf;
40    bool autospawn, disable_shm, disable_memfd, auto_connect_localhost, auto_connect_display;
41    size_t shm_size;
42} pa_client_conf;
43
44/* Create a new configuration data object and reset it to defaults */
45pa_client_conf *pa_client_conf_new(void);
46void pa_client_conf_free(pa_client_conf *c);
47
48/* Load the configuration data from the client configuration file and
49 * optionally from X11 and/or environment variables, overwriting the current
50 * settings in *c. */
51void pa_client_conf_load(pa_client_conf *c, bool load_from_x11, bool load_from_env);
52
53/* Load the cookie from the cookie sources specified in the configuration, or
54 * if nothing is specified or none of the sources work, load the cookie from
55 * the default source. If the default source doesn't work either, this function
56 * returns a negative value and initializes the cookie to all-zeroes. */
57int pa_client_conf_load_cookie(pa_client_conf *c, uint8_t *cookie, size_t cookie_length);
58
59void pa_client_conf_set_cookie_file_from_application(pa_client_conf *c, const char *cookie_file);
60
61#endif
62