2004-07-16 19:56:36 +00:00
|
|
|
/* $Id$ */
|
|
|
|
|
|
|
|
|
|
/***
|
2006-06-19 21:53:48 +00:00
|
|
|
This file is part of PulseAudio.
|
2004-07-16 19:56:36 +00:00
|
|
|
|
2006-06-19 21:53:48 +00:00
|
|
|
PulseAudio is free software; you can redistribute it and/or modify
|
2004-11-14 14:58:54 +00:00
|
|
|
it under the terms of the GNU Lesser General Public License as published
|
2004-07-16 19:56:36 +00:00
|
|
|
by the Free Software Foundation; either version 2 of the License,
|
|
|
|
|
or (at your option) any later version.
|
|
|
|
|
|
2006-06-19 21:53:48 +00:00
|
|
|
PulseAudio is distributed in the hope that it will be useful, but
|
2004-07-16 19:56:36 +00:00
|
|
|
WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
|
General Public License for more details.
|
|
|
|
|
|
2004-11-14 14:58:54 +00:00
|
|
|
You should have received a copy of the GNU Lesser General Public License
|
2006-06-19 21:53:48 +00:00
|
|
|
along with PulseAudio; if not, write to the Free Software
|
2004-07-16 19:56:36 +00:00
|
|
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
|
|
|
|
USA.
|
|
|
|
|
***/
|
|
|
|
|
|
2004-07-16 19:16:42 +00:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
|
#include <config.h>
|
|
|
|
|
#endif
|
|
|
|
|
|
2004-07-06 00:08:44 +00:00
|
|
|
#include <string.h>
|
|
|
|
|
#include <errno.h>
|
2004-06-29 16:48:37 +00:00
|
|
|
#include <stdio.h>
|
2004-06-08 23:54:24 +00:00
|
|
|
#include <assert.h>
|
2004-06-29 16:48:37 +00:00
|
|
|
#include <unistd.h>
|
2006-01-10 17:51:06 +00:00
|
|
|
#include <limits.h>
|
|
|
|
|
|
|
|
|
|
#ifdef HAVE_SYS_SOCKET_H
|
|
|
|
|
#include <sys/socket.h>
|
|
|
|
|
#endif
|
|
|
|
|
#ifdef HAVE_ARPA_INET_H
|
|
|
|
|
#include <arpa/inet.h>
|
|
|
|
|
#endif
|
|
|
|
|
#ifdef HAVE_NETINET_IN_H
|
2004-09-23 15:57:15 +00:00
|
|
|
#include <netinet/in.h>
|
2006-01-10 17:51:06 +00:00
|
|
|
#endif
|
|
|
|
|
|
2006-06-19 21:53:48 +00:00
|
|
|
#include "../pulsecore/winsock.h"
|
2004-06-08 23:54:24 +00:00
|
|
|
|
2006-06-19 21:53:48 +00:00
|
|
|
#include <pulse/xmalloc.h>
|
2006-05-17 16:34:18 +00:00
|
|
|
|
2006-06-19 21:53:48 +00:00
|
|
|
#include <pulsecore/core-error.h>
|
|
|
|
|
#include <pulsecore/module.h>
|
|
|
|
|
#include <pulsecore/socket-server.h>
|
|
|
|
|
#include <pulsecore/socket-util.h>
|
|
|
|
|
#include <pulsecore/core-util.h>
|
|
|
|
|
#include <pulsecore/modargs.h>
|
|
|
|
|
#include <pulsecore/log.h>
|
|
|
|
|
#include <pulsecore/native-common.h>
|
2006-07-19 21:48:35 +00:00
|
|
|
#include <pulsecore/creds.h>
|
2004-06-19 18:51:30 +00:00
|
|
|
|
2004-09-11 23:17:38 +00:00
|
|
|
#ifdef USE_TCP_SOCKETS
|
|
|
|
|
#define SOCKET_DESCRIPTION "(TCP sockets)"
|
2006-07-19 21:48:35 +00:00
|
|
|
#define SOCKET_USAGE "port=<TCP port number> listen=<address to listen on>"
|
2004-09-11 23:17:38 +00:00
|
|
|
#else
|
|
|
|
|
#define SOCKET_DESCRIPTION "(UNIX sockets)"
|
2004-09-20 17:19:35 +00:00
|
|
|
#define SOCKET_USAGE "socket=<path to UNIX socket>"
|
2004-09-11 23:17:38 +00:00
|
|
|
#endif
|
|
|
|
|
|
2004-08-18 01:00:18 +00:00
|
|
|
#if defined(USE_PROTOCOL_SIMPLE)
|
2006-06-19 21:53:48 +00:00
|
|
|
#include <pulsecore/protocol-simple.h>
|
2004-07-11 22:20:08 +00:00
|
|
|
#define protocol_new pa_protocol_simple_new
|
2004-07-03 23:35:12 +00:00
|
|
|
#define protocol_free pa_protocol_simple_free
|
2006-06-19 21:53:48 +00:00
|
|
|
#define TCPWRAP_SERVICE "pulseaudio-simple"
|
2004-06-20 01:12:13 +00:00
|
|
|
#define IPV4_PORT 4711
|
2004-11-11 21:18:33 +00:00
|
|
|
#define UNIX_SOCKET "simple"
|
2004-07-11 22:20:08 +00:00
|
|
|
#define MODULE_ARGUMENTS "rate", "format", "channels", "sink", "source", "playback", "record",
|
2004-11-11 21:18:33 +00:00
|
|
|
#if defined(USE_TCP_SOCKETS)
|
2004-10-30 01:55:16 +00:00
|
|
|
#include "module-simple-protocol-tcp-symdef.h"
|
|
|
|
|
#else
|
|
|
|
|
#include "module-simple-protocol-unix-symdef.h"
|
|
|
|
|
#endif
|
2004-09-11 23:17:38 +00:00
|
|
|
PA_MODULE_DESCRIPTION("Simple protocol "SOCKET_DESCRIPTION)
|
2006-07-19 17:44:19 +00:00
|
|
|
PA_MODULE_USAGE("rate=<sample rate> "
|
|
|
|
|
"format=<sample format> "
|
|
|
|
|
"channels=<number of channels> "
|
|
|
|
|
"sink=<sink to connect to> "
|
|
|
|
|
"source=<source to connect to> "
|
|
|
|
|
"playback=<enable playback?> "
|
|
|
|
|
"record=<enable record?> "
|
|
|
|
|
SOCKET_USAGE)
|
2004-08-18 01:00:18 +00:00
|
|
|
#elif defined(USE_PROTOCOL_CLI)
|
2006-06-19 21:53:48 +00:00
|
|
|
#include <pulsecore/protocol-cli.h>
|
2004-08-18 01:00:18 +00:00
|
|
|
#define protocol_new pa_protocol_cli_new
|
|
|
|
|
#define protocol_free pa_protocol_cli_free
|
2006-06-19 21:53:48 +00:00
|
|
|
#define TCPWRAP_SERVICE "pulseaudio-cli"
|
2004-08-18 01:00:18 +00:00
|
|
|
#define IPV4_PORT 4712
|
2004-11-11 21:18:33 +00:00
|
|
|
#define UNIX_SOCKET "cli"
|
2004-08-18 01:00:18 +00:00
|
|
|
#define MODULE_ARGUMENTS
|
2004-10-30 01:55:16 +00:00
|
|
|
#ifdef USE_TCP_SOCKETS
|
|
|
|
|
#include "module-cli-protocol-tcp-symdef.h"
|
|
|
|
|
#else
|
|
|
|
|
#include "module-cli-protocol-unix-symdef.h"
|
|
|
|
|
#endif
|
2004-09-11 23:17:38 +00:00
|
|
|
PA_MODULE_DESCRIPTION("Command line interface protocol "SOCKET_DESCRIPTION)
|
2004-09-20 17:19:35 +00:00
|
|
|
PA_MODULE_USAGE(SOCKET_USAGE)
|
2005-01-12 17:37:31 +00:00
|
|
|
#elif defined(USE_PROTOCOL_HTTP)
|
2006-06-19 21:53:48 +00:00
|
|
|
#include <pulsecore/protocol-http.h>
|
2005-01-12 17:37:31 +00:00
|
|
|
#define protocol_new pa_protocol_http_new
|
|
|
|
|
#define protocol_free pa_protocol_http_free
|
2006-06-19 21:53:48 +00:00
|
|
|
#define TCPWRAP_SERVICE "pulseaudio-http"
|
2005-01-12 17:37:31 +00:00
|
|
|
#define IPV4_PORT 4714
|
|
|
|
|
#define UNIX_SOCKET "http"
|
|
|
|
|
#define MODULE_ARGUMENTS
|
|
|
|
|
#ifdef USE_TCP_SOCKETS
|
|
|
|
|
#include "module-http-protocol-tcp-symdef.h"
|
|
|
|
|
#else
|
|
|
|
|
#include "module-http-protocol-unix-symdef.h"
|
|
|
|
|
#endif
|
|
|
|
|
PA_MODULE_DESCRIPTION("HTTP "SOCKET_DESCRIPTION)
|
|
|
|
|
PA_MODULE_USAGE(SOCKET_USAGE)
|
2004-08-18 01:00:18 +00:00
|
|
|
#elif defined(USE_PROTOCOL_NATIVE)
|
2006-06-19 21:53:48 +00:00
|
|
|
#include <pulsecore/protocol-native.h>
|
2004-08-18 01:00:18 +00:00
|
|
|
#define protocol_new pa_protocol_native_new
|
|
|
|
|
#define protocol_free pa_protocol_native_free
|
2006-06-19 21:53:48 +00:00
|
|
|
#define TCPWRAP_SERVICE "pulseaudio-native"
|
2004-09-28 22:47:48 +00:00
|
|
|
#define IPV4_PORT PA_NATIVE_DEFAULT_PORT
|
2004-11-11 21:18:33 +00:00
|
|
|
#define UNIX_SOCKET PA_NATIVE_DEFAULT_UNIX_SOCKET
|
2006-02-24 17:14:23 +00:00
|
|
|
#define MODULE_ARGUMENTS_COMMON "cookie", "auth-anonymous",
|
2004-10-30 01:55:16 +00:00
|
|
|
#ifdef USE_TCP_SOCKETS
|
|
|
|
|
#include "module-native-protocol-tcp-symdef.h"
|
|
|
|
|
#else
|
|
|
|
|
#include "module-native-protocol-unix-symdef.h"
|
|
|
|
|
#endif
|
2006-02-24 17:14:23 +00:00
|
|
|
|
2006-07-19 21:48:35 +00:00
|
|
|
#if defined(HAVE_CREDS) && !defined(USE_TCP_SOCKETS)
|
2006-07-20 18:43:20 +00:00
|
|
|
#define MODULE_ARGUMENTS MODULE_ARGUMENTS_COMMON "auth-group", "auth-group-enable",
|
2006-07-19 21:48:35 +00:00
|
|
|
#define AUTH_USAGE "auth-group=<system group to allow access> auth-group-enable=<enable auth by UNIX group?> "
|
2006-07-20 18:43:20 +00:00
|
|
|
#elif defined(USE_TCP_SOCKETS)
|
|
|
|
|
#define MODULE_ARGUMENTS MODULE_ARGUMENTS_COMMON "auth-ip-acl",
|
|
|
|
|
#define AUTH_USAGE "auth-ip-acl=<IP address ACL to allow access> "
|
2006-02-24 17:14:23 +00:00
|
|
|
#else
|
|
|
|
|
#define MODULE_ARGUMENTS MODULE_ARGUMENTS_COMMON
|
|
|
|
|
#define AUTH_USAGE
|
|
|
|
|
#endif
|
|
|
|
|
|
2004-09-11 23:17:38 +00:00
|
|
|
PA_MODULE_DESCRIPTION("Native protocol "SOCKET_DESCRIPTION)
|
2006-07-19 17:44:19 +00:00
|
|
|
PA_MODULE_USAGE("auth-anonymous=<don't check for cookies?> "
|
|
|
|
|
"cookie=<path to cookie file> "
|
|
|
|
|
AUTH_USAGE
|
|
|
|
|
SOCKET_USAGE)
|
2004-08-18 01:00:18 +00:00
|
|
|
#elif defined(USE_PROTOCOL_ESOUND)
|
2006-06-19 21:53:48 +00:00
|
|
|
#include <pulsecore/protocol-esound.h>
|
|
|
|
|
#include <pulsecore/esound.h>
|
2004-08-18 01:00:18 +00:00
|
|
|
#define protocol_new pa_protocol_esound_new
|
|
|
|
|
#define protocol_free pa_protocol_esound_free
|
2004-09-29 20:13:05 +00:00
|
|
|
#define TCPWRAP_SERVICE "esound"
|
2004-08-18 01:00:18 +00:00
|
|
|
#define IPV4_PORT ESD_DEFAULT_PORT
|
|
|
|
|
#define UNIX_SOCKET ESD_UNIX_SOCKET_NAME
|
2006-07-20 18:43:20 +00:00
|
|
|
#define MODULE_ARGUMENTS_COMMON "sink", "source", "auth-anonymous", "cookie",
|
2004-10-30 01:55:16 +00:00
|
|
|
#ifdef USE_TCP_SOCKETS
|
|
|
|
|
#include "module-esound-protocol-tcp-symdef.h"
|
|
|
|
|
#else
|
|
|
|
|
#include "module-esound-protocol-unix-symdef.h"
|
|
|
|
|
#endif
|
2006-07-20 18:43:20 +00:00
|
|
|
|
|
|
|
|
#if defined(USE_TCP_SOCKETS)
|
|
|
|
|
#define MODULE_ARGUMENTS MODULE_ARGUMENTS_COMMON "auth-ip-acl",
|
|
|
|
|
#define AUTH_USAGE "auth-ip-acl=<IP address ACL to allow access> "
|
|
|
|
|
#else
|
|
|
|
|
#define MODULE_ARGUMENTS MODULE_ARGUMENTS_COMMON
|
|
|
|
|
#define AUTH_USAGE
|
|
|
|
|
#endif
|
|
|
|
|
|
2006-01-27 16:25:31 +00:00
|
|
|
PA_MODULE_DESCRIPTION("ESOUND protocol "SOCKET_DESCRIPTION)
|
2006-07-19 17:44:19 +00:00
|
|
|
PA_MODULE_USAGE("sink=<sink to connect to> "
|
|
|
|
|
"source=<source to connect to> "
|
|
|
|
|
"auth-anonymous=<don't verify cookies?> "
|
|
|
|
|
"cookie=<path to cookie file> "
|
2006-07-20 18:43:20 +00:00
|
|
|
AUTH_USAGE
|
2006-07-19 17:44:19 +00:00
|
|
|
SOCKET_USAGE)
|
2004-06-19 18:51:30 +00:00
|
|
|
#else
|
2004-08-18 01:00:18 +00:00
|
|
|
#error "Broken build system"
|
2004-06-19 18:51:30 +00:00
|
|
|
#endif
|
2004-06-08 23:54:24 +00:00
|
|
|
|
2004-10-30 01:55:16 +00:00
|
|
|
PA_MODULE_AUTHOR("Lennart Poettering")
|
|
|
|
|
PA_MODULE_VERSION(PACKAGE_VERSION)
|
|
|
|
|
|
2004-07-11 22:20:08 +00:00
|
|
|
static const char* const valid_modargs[] = {
|
|
|
|
|
MODULE_ARGUMENTS
|
2006-02-21 01:08:53 +00:00
|
|
|
#if defined(USE_TCP_SOCKETS)
|
2004-07-11 22:20:08 +00:00
|
|
|
"port",
|
2006-02-22 20:44:37 +00:00
|
|
|
"listen",
|
2004-07-11 22:20:08 +00:00
|
|
|
#else
|
|
|
|
|
"socket",
|
|
|
|
|
#endif
|
|
|
|
|
NULL
|
|
|
|
|
};
|
2004-06-08 23:54:24 +00:00
|
|
|
|
2006-03-07 16:02:34 +00:00
|
|
|
struct userdata {
|
|
|
|
|
#if defined(USE_TCP_SOCKETS)
|
|
|
|
|
void *protocol_ipv4;
|
|
|
|
|
void *protocol_ipv6;
|
|
|
|
|
#else
|
|
|
|
|
void *protocol_unix;
|
2006-04-22 20:06:48 +00:00
|
|
|
char *socket_path;
|
2006-03-07 16:02:34 +00:00
|
|
|
#endif
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
int pa__init(pa_core *c, pa_module*m) {
|
|
|
|
|
pa_modargs *ma = NULL;
|
|
|
|
|
int ret = -1;
|
|
|
|
|
|
|
|
|
|
struct userdata *u = NULL;
|
|
|
|
|
|
2006-02-21 01:08:53 +00:00
|
|
|
#if defined(USE_TCP_SOCKETS)
|
2006-04-06 23:52:48 +00:00
|
|
|
pa_socket_server *s_ipv4 = NULL, *s_ipv6 = NULL;
|
2004-09-04 00:27:36 +00:00
|
|
|
uint32_t port = IPV4_PORT;
|
2006-02-22 20:44:37 +00:00
|
|
|
const char *listen_on;
|
2006-03-07 16:02:34 +00:00
|
|
|
#else
|
|
|
|
|
pa_socket_server *s;
|
|
|
|
|
int r;
|
|
|
|
|
char tmp[PATH_MAX];
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
assert(c && m);
|
|
|
|
|
|
|
|
|
|
if (!(ma = pa_modargs_new(m->argument, valid_modargs))) {
|
2006-08-18 21:38:40 +00:00
|
|
|
pa_log("Failed to parse module arguments");
|
2006-03-07 16:02:34 +00:00
|
|
|
goto finish;
|
|
|
|
|
}
|
2004-07-11 22:20:08 +00:00
|
|
|
|
2006-04-22 20:06:48 +00:00
|
|
|
u = pa_xnew0(struct userdata, 1);
|
|
|
|
|
|
2006-04-06 23:52:48 +00:00
|
|
|
#if defined(USE_TCP_SOCKETS)
|
2004-09-04 00:27:36 +00:00
|
|
|
if (pa_modargs_get_value_u32(ma, "port", &port) < 0 || port < 1 || port > 0xFFFF) {
|
2006-08-18 21:38:40 +00:00
|
|
|
pa_log("port= expects a numerical argument between 1 and 65535.");
|
2006-03-07 16:02:34 +00:00
|
|
|
goto fail;
|
2004-07-11 22:20:08 +00:00
|
|
|
}
|
2004-11-11 21:18:33 +00:00
|
|
|
|
2006-02-22 20:44:37 +00:00
|
|
|
listen_on = pa_modargs_get_value(ma, "listen", NULL);
|
2006-02-21 01:08:53 +00:00
|
|
|
|
2006-02-22 20:44:37 +00:00
|
|
|
if (listen_on) {
|
2006-03-07 16:02:34 +00:00
|
|
|
s_ipv6 = pa_socket_server_new_ipv6_string(c->mainloop, listen_on, port, TCPWRAP_SERVICE);
|
2006-04-19 07:31:11 +00:00
|
|
|
s_ipv4 = pa_socket_server_new_ipv4_string(c->mainloop, listen_on, port, TCPWRAP_SERVICE);
|
2006-02-21 01:08:53 +00:00
|
|
|
} else {
|
2006-03-07 16:02:34 +00:00
|
|
|
s_ipv6 = pa_socket_server_new_ipv6_any(c->mainloop, port, TCPWRAP_SERVICE);
|
2006-04-19 07:31:11 +00:00
|
|
|
s_ipv4 = pa_socket_server_new_ipv4_any(c->mainloop, port, TCPWRAP_SERVICE);
|
2006-02-21 01:08:53 +00:00
|
|
|
}
|
2006-04-06 23:52:48 +00:00
|
|
|
|
|
|
|
|
if (!s_ipv4 && !s_ipv6)
|
|
|
|
|
goto fail;
|
|
|
|
|
|
2006-04-22 20:06:48 +00:00
|
|
|
if (s_ipv4)
|
|
|
|
|
if (!(u->protocol_ipv4 = protocol_new(c, s_ipv4, m, ma)))
|
|
|
|
|
pa_socket_server_unref(s_ipv4);
|
|
|
|
|
|
|
|
|
|
if (s_ipv6)
|
|
|
|
|
if (!(u->protocol_ipv6 = protocol_new(c, s_ipv6, m, ma)))
|
|
|
|
|
pa_socket_server_unref(s_ipv6);
|
|
|
|
|
|
|
|
|
|
if (!u->protocol_ipv4 && !u->protocol_ipv6)
|
|
|
|
|
goto fail;
|
|
|
|
|
|
2004-06-19 18:41:24 +00:00
|
|
|
#else
|
2006-07-19 17:44:19 +00:00
|
|
|
|
|
|
|
|
pa_runtime_path(pa_modargs_get_value(ma, "socket", UNIX_SOCKET), tmp, sizeof(tmp));
|
2006-04-22 20:06:48 +00:00
|
|
|
u->socket_path = pa_xstrdup(tmp);
|
2004-07-11 22:20:08 +00:00
|
|
|
|
2006-07-19 17:44:19 +00:00
|
|
|
#if defined(USE_PROTOCOL_ESOUND)
|
|
|
|
|
|
|
|
|
|
/* This socket doesn't reside in our own runtime dir but in
|
|
|
|
|
* /tmp/.esd/, hence we have to create the dir first */
|
|
|
|
|
|
2006-07-20 00:21:50 +00:00
|
|
|
if (pa_make_secure_parent_dir(u->socket_path, c->is_system_instance ? 0755 : 0700, (uid_t)-1, (gid_t)-1) < 0) {
|
2006-08-18 21:38:40 +00:00
|
|
|
pa_log("Failed to create socket directory: %s\n", pa_cstrerror(errno));
|
2006-03-07 16:02:34 +00:00
|
|
|
goto fail;
|
2004-06-29 16:48:37 +00:00
|
|
|
}
|
2006-07-19 17:44:19 +00:00
|
|
|
#endif
|
|
|
|
|
|
2004-11-11 21:18:33 +00:00
|
|
|
if ((r = pa_unix_socket_remove_stale(tmp)) < 0) {
|
2006-08-18 21:38:40 +00:00
|
|
|
pa_log("Failed to remove stale UNIX socket '%s': %s", tmp, pa_cstrerror(errno));
|
2006-03-07 16:02:34 +00:00
|
|
|
goto fail;
|
2004-07-06 00:08:44 +00:00
|
|
|
}
|
2004-06-29 16:48:37 +00:00
|
|
|
|
2004-07-11 22:20:08 +00:00
|
|
|
if (r)
|
2006-08-18 21:38:40 +00:00
|
|
|
pa_log("Removed stale UNIX socket '%s'.", tmp);
|
2004-07-11 22:20:08 +00:00
|
|
|
|
2004-11-11 21:18:33 +00:00
|
|
|
if (!(s = pa_socket_server_new_unix(c->mainloop, tmp)))
|
2006-03-07 16:02:34 +00:00
|
|
|
goto fail;
|
2004-07-06 00:08:44 +00:00
|
|
|
|
2006-03-07 16:02:34 +00:00
|
|
|
if (!(u->protocol_unix = protocol_new(c, s, m, ma)))
|
|
|
|
|
goto fail;
|
2006-04-22 20:06:48 +00:00
|
|
|
|
2006-03-07 16:02:34 +00:00
|
|
|
#endif
|
|
|
|
|
|
2006-03-11 21:25:35 +00:00
|
|
|
m->userdata = u;
|
|
|
|
|
|
2004-07-15 17:33:56 +00:00
|
|
|
ret = 0;
|
|
|
|
|
|
|
|
|
|
finish:
|
|
|
|
|
if (ma)
|
|
|
|
|
pa_modargs_free(ma);
|
|
|
|
|
|
|
|
|
|
return ret;
|
2006-03-07 16:02:34 +00:00
|
|
|
|
|
|
|
|
fail:
|
|
|
|
|
if (u) {
|
|
|
|
|
#if defined(USE_TCP_SOCKETS)
|
|
|
|
|
if (u->protocol_ipv4)
|
|
|
|
|
protocol_free(u->protocol_ipv4);
|
|
|
|
|
if (u->protocol_ipv6)
|
|
|
|
|
protocol_free(u->protocol_ipv6);
|
|
|
|
|
#else
|
|
|
|
|
if (u->protocol_unix)
|
|
|
|
|
protocol_free(u->protocol_unix);
|
2006-04-22 20:06:48 +00:00
|
|
|
|
|
|
|
|
if (u->socket_path)
|
|
|
|
|
pa_xfree(u->socket_path);
|
2006-03-07 16:02:34 +00:00
|
|
|
#endif
|
2006-04-22 20:06:48 +00:00
|
|
|
|
2006-03-07 16:02:34 +00:00
|
|
|
pa_xfree(u);
|
|
|
|
|
} else {
|
|
|
|
|
#if defined(USE_TCP_SOCKETS)
|
|
|
|
|
if (s_ipv4)
|
|
|
|
|
pa_socket_server_unref(s_ipv4);
|
|
|
|
|
if (s_ipv6)
|
|
|
|
|
pa_socket_server_unref(s_ipv6);
|
|
|
|
|
#else
|
|
|
|
|
if (s)
|
|
|
|
|
pa_socket_server_unref(s);
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
goto finish;
|
2004-06-08 23:54:24 +00:00
|
|
|
}
|
|
|
|
|
|
2006-01-11 01:17:39 +00:00
|
|
|
void pa__done(pa_core *c, pa_module*m) {
|
2006-03-07 16:02:34 +00:00
|
|
|
struct userdata *u;
|
2006-04-22 20:06:48 +00:00
|
|
|
|
|
|
|
|
assert(c);
|
|
|
|
|
assert(m);
|
2005-09-15 23:48:09 +00:00
|
|
|
|
2006-03-07 16:02:34 +00:00
|
|
|
u = m->userdata;
|
|
|
|
|
|
|
|
|
|
#if defined(USE_TCP_SOCKETS)
|
|
|
|
|
if (u->protocol_ipv4)
|
|
|
|
|
protocol_free(u->protocol_ipv4);
|
|
|
|
|
if (u->protocol_ipv6)
|
|
|
|
|
protocol_free(u->protocol_ipv6);
|
|
|
|
|
#else
|
|
|
|
|
if (u->protocol_unix)
|
|
|
|
|
protocol_free(u->protocol_unix);
|
2006-04-22 20:06:48 +00:00
|
|
|
|
2006-07-19 17:44:19 +00:00
|
|
|
#if defined(USE_PROTOCOL_ESOUND)
|
2006-04-22 20:06:48 +00:00
|
|
|
if (u->socket_path) {
|
2006-07-19 17:44:19 +00:00
|
|
|
char *p = pa_parent_dir(u->socket_path);
|
|
|
|
|
rmdir(p);
|
|
|
|
|
pa_xfree(p);
|
2006-04-22 20:06:48 +00:00
|
|
|
}
|
2006-03-07 16:02:34 +00:00
|
|
|
#endif
|
2006-07-19 17:44:19 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
pa_xfree(u->socket_path);
|
|
|
|
|
#endif
|
2006-03-07 16:02:34 +00:00
|
|
|
|
|
|
|
|
pa_xfree(u);
|
2004-06-08 23:54:24 +00:00
|
|
|
}
|