]> code.delx.au - pulseaudio/blobdiff - src/pulse/client-conf.h
client-conf: Don't create multiple cookie files
[pulseaudio] / src / pulse / client-conf.h
index c6c74cadeed93d13f2c1510f5e27780cb0c4b460..cf424f55744f73a8941549138c105a0593d4a416 100644 (file)
 /* A structure containing configuration data for PulseAudio clients. */
 
 typedef struct pa_client_conf {
-    char *daemon_binary, *extra_arguments, *default_sink, *default_source, *default_server, *default_dbus_server, *cookie_file;
+    char *daemon_binary;
+    char *extra_arguments;
+    char *default_sink;
+    char *default_source;
+    char *default_server;
+    char *default_dbus_server;
+    char *cookie_file_from_env;
+    uint8_t cookie_from_x11[PA_NATIVE_COOKIE_LENGTH];
+    bool cookie_from_x11_valid;
+    char *cookie_file_from_application;
+    char *cookie_file_from_client_conf;
     bool autospawn, disable_shm, auto_connect_localhost, auto_connect_display;
-    uint8_t cookie[PA_NATIVE_COOKIE_LENGTH];
-    bool cookie_valid; /* non-zero, when cookie is valid */
     size_t shm_size;
 } pa_client_conf;
 
@@ -43,17 +51,16 @@ void pa_client_conf_free(pa_client_conf *c);
  * the current settings in *c. */
 int pa_client_conf_load(pa_client_conf *c);
 
+/* Load the cookie from the cookie sources specified in the configuration, or
+ * if nothing is specified or none of the sources work, load the cookie from
+ * the default source. If the default source doesn't work either, this function
+ * returns a negative value and initializes the cookie to all-zeroes. */
+int pa_client_conf_load_cookie(pa_client_conf *c, uint8_t *cookie, size_t cookie_length);
+
 /* Load the configuration data from the environment of the current
    process, overwriting the current settings in *c. */
 int pa_client_conf_env(pa_client_conf *c);
 
-/* Load cookie data from cookie_file_path into c->cookie */
-int pa_client_conf_load_cookie_from_file(pa_client_conf *c, const char *cookie_file_path);
-
-/* Load cookie data from hexdecimal string into c->cookie */
-int pa_client_conf_load_cookie_from_hex(pa_client_conf *c, const char *cookie_in_hex);
-
-/* Set cookie direct from memory */
-int pa_client_conf_set_cookie(pa_client_conf *c, uint8_t *cookie, size_t cookie_size);
+void pa_client_conf_set_cookie_file_from_application(pa_client_conf *c, const char *cookie_file);
 
 #endif