mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-12-16 08:56:40 -05:00
* Don't build seperate ipv4/ipv6 versions of the protocol plugins
* Instead try IPv6 and if that fails fall back to IPv4 git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@548 fefdeb5f-60dc-0310-8127-8f9354f1896f
This commit is contained in:
parent
c07928a32d
commit
8c80dd6302
4 changed files with 51 additions and 69 deletions
|
|
@ -697,13 +697,9 @@ libx11prop_la_LIBADD = $(AM_LIBADD) $(X_PRE_LIBS) -lX11 $(X_LIBS) $(X_EXTRA_LIBS
|
||||||
modlib_LTLIBRARIES += \
|
modlib_LTLIBRARIES += \
|
||||||
module-cli.la \
|
module-cli.la \
|
||||||
module-cli-protocol-tcp.la \
|
module-cli-protocol-tcp.la \
|
||||||
module-cli-protocol-tcp6.la \
|
|
||||||
module-simple-protocol-tcp.la \
|
module-simple-protocol-tcp.la \
|
||||||
module-simple-protocol-tcp6.la \
|
|
||||||
module-esound-protocol-tcp.la \
|
module-esound-protocol-tcp.la \
|
||||||
module-esound-protocol-tcp6.la \
|
|
||||||
module-native-protocol-tcp.la \
|
module-native-protocol-tcp.la \
|
||||||
module-native-protocol-tcp6.la \
|
|
||||||
module-native-protocol-fd.la \
|
module-native-protocol-fd.la \
|
||||||
module-sine.la \
|
module-sine.la \
|
||||||
module-combine.la \
|
module-combine.la \
|
||||||
|
|
@ -712,7 +708,6 @@ modlib_LTLIBRARIES += \
|
||||||
module-null-sink.la \
|
module-null-sink.la \
|
||||||
module-esound-sink.la \
|
module-esound-sink.la \
|
||||||
module-http-protocol-tcp.la \
|
module-http-protocol-tcp.la \
|
||||||
module-http-protocol-tcp6.la \
|
|
||||||
module-detect.la
|
module-detect.la
|
||||||
|
|
||||||
if HAVE_AF_UNIX
|
if HAVE_AF_UNIX
|
||||||
|
|
@ -792,18 +787,14 @@ endif
|
||||||
SYMDEF_FILES = \
|
SYMDEF_FILES = \
|
||||||
modules/module-cli-symdef.h \
|
modules/module-cli-symdef.h \
|
||||||
modules/module-cli-protocol-tcp-symdef.h \
|
modules/module-cli-protocol-tcp-symdef.h \
|
||||||
modules/module-cli-protocol-tcp6-symdef.h \
|
|
||||||
modules/module-cli-protocol-unix-symdef.h \
|
modules/module-cli-protocol-unix-symdef.h \
|
||||||
modules/module-pipe-sink-symdef.h \
|
modules/module-pipe-sink-symdef.h \
|
||||||
modules/module-pipe-source-symdef.h \
|
modules/module-pipe-source-symdef.h \
|
||||||
modules/module-simple-protocol-tcp-symdef.h \
|
modules/module-simple-protocol-tcp-symdef.h \
|
||||||
modules/module-simple-protocol-tcp6-symdef.h \
|
|
||||||
modules/module-simple-protocol-unix-symdef.h \
|
modules/module-simple-protocol-unix-symdef.h \
|
||||||
modules/module-esound-protocol-tcp-symdef.h \
|
modules/module-esound-protocol-tcp-symdef.h \
|
||||||
modules/module-esound-protocol-tcp6-symdef.h \
|
|
||||||
modules/module-esound-protocol-unix-symdef.h \
|
modules/module-esound-protocol-unix-symdef.h \
|
||||||
modules/module-native-protocol-tcp-symdef.h \
|
modules/module-native-protocol-tcp-symdef.h \
|
||||||
modules/module-native-protocol-tcp6-symdef.h \
|
|
||||||
modules/module-native-protocol-unix-symdef.h \
|
modules/module-native-protocol-unix-symdef.h \
|
||||||
modules/module-native-protocol-fd-symdef.h \
|
modules/module-native-protocol-fd-symdef.h \
|
||||||
modules/module-sine-symdef.h \
|
modules/module-sine-symdef.h \
|
||||||
|
|
@ -819,7 +810,6 @@ SYMDEF_FILES = \
|
||||||
modules/module-lirc-symdef.h \
|
modules/module-lirc-symdef.h \
|
||||||
modules/module-mmkbd-evdev-symdef.h \
|
modules/module-mmkbd-evdev-symdef.h \
|
||||||
modules/module-http-protocol-tcp-symdef.h \
|
modules/module-http-protocol-tcp-symdef.h \
|
||||||
modules/module-http-protocol-tcp6-symdef.h \
|
|
||||||
modules/module-http-protocol-unix-symdef.h \
|
modules/module-http-protocol-unix-symdef.h \
|
||||||
modules/module-x11-bell-symdef.h \
|
modules/module-x11-bell-symdef.h \
|
||||||
modules/module-x11-publish-symdef.h \
|
modules/module-x11-publish-symdef.h \
|
||||||
|
|
@ -844,11 +834,6 @@ module_simple_protocol_tcp_la_CFLAGS = -DUSE_TCP_SOCKETS -DUSE_PROTOCOL_SIMPLE $
|
||||||
module_simple_protocol_tcp_la_LDFLAGS = -module -avoid-version
|
module_simple_protocol_tcp_la_LDFLAGS = -module -avoid-version
|
||||||
module_simple_protocol_tcp_la_LIBADD = $(AM_LIBADD) libpolypcore.la libprotocol-simple.la libsocket-server.la
|
module_simple_protocol_tcp_la_LIBADD = $(AM_LIBADD) libpolypcore.la libprotocol-simple.la libsocket-server.la
|
||||||
|
|
||||||
module_simple_protocol_tcp6_la_SOURCES = modules/module-protocol-stub.c
|
|
||||||
module_simple_protocol_tcp6_la_CFLAGS = -DUSE_TCP6_SOCKETS -DUSE_PROTOCOL_SIMPLE $(AM_CFLAGS)
|
|
||||||
module_simple_protocol_tcp6_la_LDFLAGS = -module -avoid-version
|
|
||||||
module_simple_protocol_tcp6_la_LIBADD = $(AM_LIBADD) libpolypcore.la libprotocol-simple.la libsocket-server.la
|
|
||||||
|
|
||||||
module_simple_protocol_unix_la_SOURCES = modules/module-protocol-stub.c
|
module_simple_protocol_unix_la_SOURCES = modules/module-protocol-stub.c
|
||||||
module_simple_protocol_unix_la_CFLAGS = -DUSE_UNIX_SOCKETS -DUSE_PROTOCOL_SIMPLE $(AM_CFLAGS)
|
module_simple_protocol_unix_la_CFLAGS = -DUSE_UNIX_SOCKETS -DUSE_PROTOCOL_SIMPLE $(AM_CFLAGS)
|
||||||
module_simple_protocol_unix_la_LDFLAGS = -module -avoid-version
|
module_simple_protocol_unix_la_LDFLAGS = -module -avoid-version
|
||||||
|
|
@ -865,11 +850,6 @@ module_cli_protocol_tcp_la_CFLAGS = -DUSE_TCP_SOCKETS -DUSE_PROTOCOL_CLI $(AM_CF
|
||||||
module_cli_protocol_tcp_la_LDFLAGS = -module -avoid-version
|
module_cli_protocol_tcp_la_LDFLAGS = -module -avoid-version
|
||||||
module_cli_protocol_tcp_la_LIBADD = $(AM_LIBADD) libpolypcore.la libprotocol-cli.la libsocket-server.la
|
module_cli_protocol_tcp_la_LIBADD = $(AM_LIBADD) libpolypcore.la libprotocol-cli.la libsocket-server.la
|
||||||
|
|
||||||
module_cli_protocol_tcp6_la_SOURCES = modules/module-protocol-stub.c
|
|
||||||
module_cli_protocol_tcp6_la_CFLAGS = -DUSE_TCP6_SOCKETS -DUSE_PROTOCOL_CLI $(AM_CFLAGS)
|
|
||||||
module_cli_protocol_tcp6_la_LDFLAGS = -module -avoid-version
|
|
||||||
module_cli_protocol_tcp6_la_LIBADD = $(AM_LIBADD) libpolypcore.la libprotocol-cli.la libsocket-server.la
|
|
||||||
|
|
||||||
module_cli_protocol_unix_la_SOURCES = modules/module-protocol-stub.c
|
module_cli_protocol_unix_la_SOURCES = modules/module-protocol-stub.c
|
||||||
module_cli_protocol_unix_la_CFLAGS = -DUSE_UNIX_SOCKETS -DUSE_PROTOCOL_CLI $(AM_CFLAGS)
|
module_cli_protocol_unix_la_CFLAGS = -DUSE_UNIX_SOCKETS -DUSE_PROTOCOL_CLI $(AM_CFLAGS)
|
||||||
module_cli_protocol_unix_la_LDFLAGS = -module -avoid-version
|
module_cli_protocol_unix_la_LDFLAGS = -module -avoid-version
|
||||||
|
|
@ -882,11 +862,6 @@ module_http_protocol_tcp_la_CFLAGS = -DUSE_TCP_SOCKETS -DUSE_PROTOCOL_HTTP $(AM_
|
||||||
module_http_protocol_tcp_la_LDFLAGS = -module -avoid-version
|
module_http_protocol_tcp_la_LDFLAGS = -module -avoid-version
|
||||||
module_http_protocol_tcp_la_LIBADD = $(AM_LIBADD) libpolypcore.la libprotocol-http.la libsocket-server.la
|
module_http_protocol_tcp_la_LIBADD = $(AM_LIBADD) libpolypcore.la libprotocol-http.la libsocket-server.la
|
||||||
|
|
||||||
module_http_protocol_tcp6_la_SOURCES = modules/module-protocol-stub.c
|
|
||||||
module_http_protocol_tcp6_la_CFLAGS = -DUSE_TCP6_SOCKETS -DUSE_PROTOCOL_HTTP $(AM_CFLAGS)
|
|
||||||
module_http_protocol_tcp6_la_LDFLAGS = -module -avoid-version
|
|
||||||
module_http_protocol_tcp6_la_LIBADD = $(AM_LIBADD) libpolypcore.la libprotocol-http.la libsocket-server.la
|
|
||||||
|
|
||||||
module_http_protocol_unix_la_SOURCES = modules/module-protocol-stub.c
|
module_http_protocol_unix_la_SOURCES = modules/module-protocol-stub.c
|
||||||
module_http_protocol_unix_la_CFLAGS = -DUSE_UNIX_SOCKETS -DUSE_PROTOCOL_HTTP $(AM_CFLAGS)
|
module_http_protocol_unix_la_CFLAGS = -DUSE_UNIX_SOCKETS -DUSE_PROTOCOL_HTTP $(AM_CFLAGS)
|
||||||
module_http_protocol_unix_la_LDFLAGS = -module -avoid-version
|
module_http_protocol_unix_la_LDFLAGS = -module -avoid-version
|
||||||
|
|
@ -899,11 +874,6 @@ module_native_protocol_tcp_la_CFLAGS = -DUSE_TCP_SOCKETS -DUSE_PROTOCOL_NATIVE $
|
||||||
module_native_protocol_tcp_la_LDFLAGS = -module -avoid-version
|
module_native_protocol_tcp_la_LDFLAGS = -module -avoid-version
|
||||||
module_native_protocol_tcp_la_LIBADD = $(AM_LIBADD) libpolypcore.la libprotocol-native.la libsocket-server.la
|
module_native_protocol_tcp_la_LIBADD = $(AM_LIBADD) libpolypcore.la libprotocol-native.la libsocket-server.la
|
||||||
|
|
||||||
module_native_protocol_tcp6_la_SOURCES = modules/module-protocol-stub.c
|
|
||||||
module_native_protocol_tcp6_la_CFLAGS = -DUSE_TCP6_SOCKETS -DUSE_PROTOCOL_NATIVE $(AM_CFLAGS)
|
|
||||||
module_native_protocol_tcp6_la_LDFLAGS = -module -avoid-version
|
|
||||||
module_native_protocol_tcp6_la_LIBADD = $(AM_LIBADD) libpolypcore.la libprotocol-native.la libsocket-server.la
|
|
||||||
|
|
||||||
module_native_protocol_unix_la_SOURCES = modules/module-protocol-stub.c
|
module_native_protocol_unix_la_SOURCES = modules/module-protocol-stub.c
|
||||||
module_native_protocol_unix_la_CFLAGS = -DUSE_UNIX_SOCKETS -DUSE_PROTOCOL_NATIVE $(AM_CFLAGS)
|
module_native_protocol_unix_la_CFLAGS = -DUSE_UNIX_SOCKETS -DUSE_PROTOCOL_NATIVE $(AM_CFLAGS)
|
||||||
module_native_protocol_unix_la_LDFLAGS = -module -avoid-version
|
module_native_protocol_unix_la_LDFLAGS = -module -avoid-version
|
||||||
|
|
@ -921,11 +891,6 @@ module_esound_protocol_tcp_la_CFLAGS = -DUSE_TCP_SOCKETS -DUSE_PROTOCOL_ESOUND $
|
||||||
module_esound_protocol_tcp_la_LDFLAGS = -module -avoid-version
|
module_esound_protocol_tcp_la_LDFLAGS = -module -avoid-version
|
||||||
module_esound_protocol_tcp_la_LIBADD = $(AM_LIBADD) libpolypcore.la libprotocol-esound.la libsocket-server.la
|
module_esound_protocol_tcp_la_LIBADD = $(AM_LIBADD) libpolypcore.la libprotocol-esound.la libsocket-server.la
|
||||||
|
|
||||||
module_esound_protocol_tcp6_la_SOURCES = modules/module-protocol-stub.c
|
|
||||||
module_esound_protocol_tcp6_la_CFLAGS = -DUSE_TCP6_SOCKETS -DUSE_PROTOCOL_ESOUND $(AM_CFLAGS)
|
|
||||||
module_esound_protocol_tcp6_la_LDFLAGS = -module -avoid-version
|
|
||||||
module_esound_protocol_tcp6_la_LIBADD = $(AM_LIBADD) libpolypcore.la libprotocol-esound.la libsocket-server.la
|
|
||||||
|
|
||||||
module_esound_protocol_unix_la_SOURCES = modules/module-protocol-stub.c
|
module_esound_protocol_unix_la_SOURCES = modules/module-protocol-stub.c
|
||||||
module_esound_protocol_unix_la_CFLAGS = -DUSE_UNIX_SOCKETS -DUSE_PROTOCOL_ESOUND $(AM_CFLAGS)
|
module_esound_protocol_unix_la_CFLAGS = -DUSE_UNIX_SOCKETS -DUSE_PROTOCOL_ESOUND $(AM_CFLAGS)
|
||||||
module_esound_protocol_unix_la_LDFLAGS = -module -avoid-version
|
module_esound_protocol_unix_la_LDFLAGS = -module -avoid-version
|
||||||
|
|
|
||||||
|
|
@ -53,9 +53,6 @@
|
||||||
#ifdef USE_TCP_SOCKETS
|
#ifdef USE_TCP_SOCKETS
|
||||||
#define SOCKET_DESCRIPTION "(TCP sockets)"
|
#define SOCKET_DESCRIPTION "(TCP sockets)"
|
||||||
#define SOCKET_USAGE "port=<TCP port number> loopback=<listen on loopback device only?>"
|
#define SOCKET_USAGE "port=<TCP port number> loopback=<listen on loopback device only?>"
|
||||||
#elif defined(USE_TCP6_SOCKETS)
|
|
||||||
#define SOCKET_DESCRIPTION "(TCP/IPv6 sockets)"
|
|
||||||
#define SOCKET_USAGE "port=<TCP port number> loopback=<listen on loopback device only?>"
|
|
||||||
#else
|
#else
|
||||||
#define SOCKET_DESCRIPTION "(UNIX sockets)"
|
#define SOCKET_DESCRIPTION "(UNIX sockets)"
|
||||||
#define SOCKET_USAGE "socket=<path to UNIX socket>"
|
#define SOCKET_USAGE "socket=<path to UNIX socket>"
|
||||||
|
|
@ -71,8 +68,6 @@
|
||||||
#define MODULE_ARGUMENTS "rate", "format", "channels", "sink", "source", "playback", "record",
|
#define MODULE_ARGUMENTS "rate", "format", "channels", "sink", "source", "playback", "record",
|
||||||
#if defined(USE_TCP_SOCKETS)
|
#if defined(USE_TCP_SOCKETS)
|
||||||
#include "module-simple-protocol-tcp-symdef.h"
|
#include "module-simple-protocol-tcp-symdef.h"
|
||||||
#elif defined(USE_TCP6_SOCKETS)
|
|
||||||
#include "module-simple-protocol-tcp6-symdef.h"
|
|
||||||
#else
|
#else
|
||||||
#include "module-simple-protocol-unix-symdef.h"
|
#include "module-simple-protocol-unix-symdef.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -88,8 +83,6 @@
|
||||||
#define MODULE_ARGUMENTS
|
#define MODULE_ARGUMENTS
|
||||||
#ifdef USE_TCP_SOCKETS
|
#ifdef USE_TCP_SOCKETS
|
||||||
#include "module-cli-protocol-tcp-symdef.h"
|
#include "module-cli-protocol-tcp-symdef.h"
|
||||||
#elif defined(USE_TCP6_SOCKETS)
|
|
||||||
#include "module-cli-protocol-tcp6-symdef.h"
|
|
||||||
#else
|
#else
|
||||||
#include "module-cli-protocol-unix-symdef.h"
|
#include "module-cli-protocol-unix-symdef.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -105,8 +98,6 @@
|
||||||
#define MODULE_ARGUMENTS
|
#define MODULE_ARGUMENTS
|
||||||
#ifdef USE_TCP_SOCKETS
|
#ifdef USE_TCP_SOCKETS
|
||||||
#include "module-http-protocol-tcp-symdef.h"
|
#include "module-http-protocol-tcp-symdef.h"
|
||||||
#elif defined(USE_TCP6_SOCKETS)
|
|
||||||
#include "module-http-protocol-tcp6-symdef.h"
|
|
||||||
#else
|
#else
|
||||||
#include "module-http-protocol-unix-symdef.h"
|
#include "module-http-protocol-unix-symdef.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -122,8 +113,6 @@
|
||||||
#define MODULE_ARGUMENTS "public", "cookie",
|
#define MODULE_ARGUMENTS "public", "cookie",
|
||||||
#ifdef USE_TCP_SOCKETS
|
#ifdef USE_TCP_SOCKETS
|
||||||
#include "module-native-protocol-tcp-symdef.h"
|
#include "module-native-protocol-tcp-symdef.h"
|
||||||
#elif defined(USE_TCP6_SOCKETS)
|
|
||||||
#include "module-native-protocol-tcp6-symdef.h"
|
|
||||||
#else
|
#else
|
||||||
#include "module-native-protocol-unix-symdef.h"
|
#include "module-native-protocol-unix-symdef.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -140,8 +129,6 @@
|
||||||
#define MODULE_ARGUMENTS "sink", "source", "public", "cookie",
|
#define MODULE_ARGUMENTS "sink", "source", "public", "cookie",
|
||||||
#ifdef USE_TCP_SOCKETS
|
#ifdef USE_TCP_SOCKETS
|
||||||
#include "module-esound-protocol-tcp-symdef.h"
|
#include "module-esound-protocol-tcp-symdef.h"
|
||||||
#elif defined(USE_TCP6_SOCKETS)
|
|
||||||
#include "module-esound-protocol-tcp6-symdef.h"
|
|
||||||
#else
|
#else
|
||||||
#include "module-esound-protocol-unix-symdef.h"
|
#include "module-esound-protocol-unix-symdef.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -156,7 +143,7 @@ PA_MODULE_VERSION(PACKAGE_VERSION)
|
||||||
|
|
||||||
static const char* const valid_modargs[] = {
|
static const char* const valid_modargs[] = {
|
||||||
MODULE_ARGUMENTS
|
MODULE_ARGUMENTS
|
||||||
#if defined(USE_TCP_SOCKETS) || defined(USE_TCP6_SOCKETS)
|
#if defined(USE_TCP_SOCKETS)
|
||||||
"port",
|
"port",
|
||||||
"loopback",
|
"loopback",
|
||||||
#else
|
#else
|
||||||
|
|
@ -167,7 +154,7 @@ static const char* const valid_modargs[] = {
|
||||||
|
|
||||||
static pa_socket_server *create_socket_server(pa_core *c, pa_modargs *ma) {
|
static pa_socket_server *create_socket_server(pa_core *c, pa_modargs *ma) {
|
||||||
pa_socket_server *s;
|
pa_socket_server *s;
|
||||||
#if defined(USE_TCP_SOCKETS) || defined(USE_TCP6_SOCKETS)
|
#if defined(USE_TCP_SOCKETS)
|
||||||
int loopback = 1;
|
int loopback = 1;
|
||||||
uint32_t port = IPV4_PORT;
|
uint32_t port = IPV4_PORT;
|
||||||
|
|
||||||
|
|
@ -181,13 +168,14 @@ static pa_socket_server *create_socket_server(pa_core *c, pa_modargs *ma) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef USE_TCP6_SOCKETS
|
|
||||||
if (!(s = pa_socket_server_new_ipv6(c->mainloop, loopback ? (const uint8_t*) &in6addr_loopback : (const uint8_t*) &in6addr_any, port)))
|
if (loopback) {
|
||||||
return NULL;
|
if (!(s = pa_socket_server_new_ip_loopback(c->mainloop, port, TCPWRAP_SERVICE)))
|
||||||
#else
|
return NULL;
|
||||||
if (!(s = pa_socket_server_new_ipv4(c->mainloop, loopback ? INADDR_LOOPBACK : INADDR_ANY, port, TCPWRAP_SERVICE)))
|
} else {
|
||||||
return NULL;
|
if (!(s = pa_socket_server_new_ip_any(c->mainloop, port, TCPWRAP_SERVICE)))
|
||||||
#endif
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
int r;
|
int r;
|
||||||
|
|
@ -250,10 +238,10 @@ finish:
|
||||||
void pa__done(pa_core *c, pa_module*m) {
|
void pa__done(pa_core *c, pa_module*m) {
|
||||||
assert(c && m);
|
assert(c && m);
|
||||||
|
|
||||||
#if defined(USE_PROTOCOL_ESOUND)
|
#if defined(USE_PROTOCOL_ESOUND) && !defined(USE_TCP_SOCKETS)
|
||||||
if (remove (ESD_UNIX_SOCKET_NAME) != 0)
|
if (remove(ESD_UNIX_SOCKET_NAME) != 0)
|
||||||
pa_log("%s: Failed to remove %s : %s.\n", __FILE__, ESD_UNIX_SOCKET_NAME, strerror (errno));
|
pa_log("%s: Failed to remove %s : %s.\n", __FILE__, ESD_UNIX_SOCKET_NAME, strerror (errno));
|
||||||
if (remove (ESD_UNIX_SOCKET_DIR) != 0)
|
if (remove(ESD_UNIX_SOCKET_DIR) != 0)
|
||||||
pa_log("%s: Failed to remove %s : %s.\n", __FILE__, ESD_UNIX_SOCKET_DIR, strerror (errno));
|
pa_log("%s: Failed to remove %s : %s.\n", __FILE__, ESD_UNIX_SOCKET_DIR, strerror (errno));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -101,18 +101,18 @@ static void callback(pa_mainloop_api *mainloop, pa_io_event *e, int fd, PA_GCC_U
|
||||||
|
|
||||||
#ifdef HAVE_LIBWRAP
|
#ifdef HAVE_LIBWRAP
|
||||||
|
|
||||||
if (s->type == SOCKET_SERVER_IPV4 && s->tcpwrap_service) {
|
if (s->tcpwrap_service) {
|
||||||
struct request_info req;
|
struct request_info req;
|
||||||
|
|
||||||
request_init(&req, RQ_DAEMON, s->tcpwrap_service, RQ_FILE, nfd, NULL);
|
request_init(&req, RQ_DAEMON, s->tcpwrap_service, RQ_FILE, nfd, NULL);
|
||||||
fromhost(&req);
|
fromhost(&req);
|
||||||
if (!hosts_access(&req)) {
|
if (!hosts_access(&req)) {
|
||||||
pa_log(__FILE__": TCP connection refused by tcpwrap.\n");
|
pa_log_warn(__FILE__": TCP connection refused by tcpwrap.\n");
|
||||||
close(nfd);
|
close(nfd);
|
||||||
goto finish;
|
goto finish;
|
||||||
}
|
}
|
||||||
|
|
||||||
pa_log(__FILE__": TCP connection accepted by tcpwrap.\n");
|
pa_log_info(__FILE__": TCP connection accepted by tcpwrap.\n");
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
@ -221,7 +221,7 @@ pa_socket_server* pa_socket_server_new_ipv4(pa_mainloop_api *m, uint32_t address
|
||||||
assert(m && port);
|
assert(m && port);
|
||||||
|
|
||||||
if ((fd = socket(PF_INET, SOCK_STREAM, 0)) < 0) {
|
if ((fd = socket(PF_INET, SOCK_STREAM, 0)) < 0) {
|
||||||
pa_log(__FILE__": socket(): %s\n", strerror(errno));
|
pa_log(__FILE__": socket(PF_INET): %s\n", strerror(errno));
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -261,7 +261,7 @@ fail:
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
pa_socket_server* pa_socket_server_new_ipv6(pa_mainloop_api *m, const uint8_t address[16], uint16_t port) {
|
pa_socket_server* pa_socket_server_new_ipv6(pa_mainloop_api *m, const uint8_t address[16], uint16_t port, const char *tcpwrap_service) {
|
||||||
pa_socket_server *ss;
|
pa_socket_server *ss;
|
||||||
int fd = -1;
|
int fd = -1;
|
||||||
struct sockaddr_in6 sa;
|
struct sockaddr_in6 sa;
|
||||||
|
|
@ -270,7 +270,7 @@ pa_socket_server* pa_socket_server_new_ipv6(pa_mainloop_api *m, const uint8_t ad
|
||||||
assert(m && port);
|
assert(m && port);
|
||||||
|
|
||||||
if ((fd = socket(PF_INET6, SOCK_STREAM, 0)) < 0) {
|
if ((fd = socket(PF_INET6, SOCK_STREAM, 0)) < 0) {
|
||||||
pa_log(__FILE__": socket(): %s\n", strerror(errno));
|
pa_log(__FILE__": socket(PF_INET6): %s\n", strerror(errno));
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -296,8 +296,10 @@ pa_socket_server* pa_socket_server_new_ipv6(pa_mainloop_api *m, const uint8_t ad
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((ss = pa_socket_server_new(m, fd)))
|
if ((ss = pa_socket_server_new(m, fd))) {
|
||||||
ss->type = SOCKET_SERVER_IPV6;
|
ss->type = SOCKET_SERVER_IPV6;
|
||||||
|
ss->tcpwrap_service = pa_xstrdup(tcpwrap_service);
|
||||||
|
}
|
||||||
|
|
||||||
return ss;
|
return ss;
|
||||||
|
|
||||||
|
|
@ -308,6 +310,31 @@ fail:
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pa_socket_server* pa_socket_server_new_ip_loopback(pa_mainloop_api *m, uint16_t port, const char *tcpwrap_service) {
|
||||||
|
pa_socket_server *s;
|
||||||
|
|
||||||
|
assert(m);
|
||||||
|
assert(port > 0);
|
||||||
|
|
||||||
|
if (!(s = pa_socket_server_new_ipv6(m, in6addr_loopback.s6_addr, port, tcpwrap_service)))
|
||||||
|
s = pa_socket_server_new_ipv4(m, INADDR_LOOPBACK, port, tcpwrap_service);
|
||||||
|
|
||||||
|
return s;
|
||||||
|
}
|
||||||
|
|
||||||
|
pa_socket_server* pa_socket_server_new_ip_any(pa_mainloop_api *m, uint16_t port, const char *tcpwrap_service) {
|
||||||
|
pa_socket_server *s;
|
||||||
|
|
||||||
|
assert(m);
|
||||||
|
assert(port > 0);
|
||||||
|
|
||||||
|
if (!(s = pa_socket_server_new_ipv6(m, in6addr_any.s6_addr, port, tcpwrap_service)))
|
||||||
|
s = pa_socket_server_new_ipv4(m, INADDR_ANY, port, tcpwrap_service);
|
||||||
|
|
||||||
|
return s;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static void socket_server_free(pa_socket_server*s) {
|
static void socket_server_free(pa_socket_server*s) {
|
||||||
assert(s);
|
assert(s);
|
||||||
close(s->fd);
|
close(s->fd);
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,9 @@ typedef struct pa_socket_server pa_socket_server;
|
||||||
pa_socket_server* pa_socket_server_new(pa_mainloop_api *m, int fd);
|
pa_socket_server* pa_socket_server_new(pa_mainloop_api *m, int fd);
|
||||||
pa_socket_server* pa_socket_server_new_unix(pa_mainloop_api *m, const char *filename);
|
pa_socket_server* pa_socket_server_new_unix(pa_mainloop_api *m, const char *filename);
|
||||||
pa_socket_server* pa_socket_server_new_ipv4(pa_mainloop_api *m, uint32_t address, uint16_t port, const char *tcpwrap_service);
|
pa_socket_server* pa_socket_server_new_ipv4(pa_mainloop_api *m, uint32_t address, uint16_t port, const char *tcpwrap_service);
|
||||||
pa_socket_server* pa_socket_server_new_ipv6(pa_mainloop_api *m, const uint8_t address[16], uint16_t port);
|
pa_socket_server* pa_socket_server_new_ipv6(pa_mainloop_api *m, const uint8_t address[16], uint16_t port, const char *tcpwrap_service);
|
||||||
|
pa_socket_server* pa_socket_server_new_ip_loopback(pa_mainloop_api *m, uint16_t port, const char *tcpwrap_service);
|
||||||
|
pa_socket_server* pa_socket_server_new_ip_any(pa_mainloop_api *m, uint16_t port, const char *tcpwrap_service);
|
||||||
|
|
||||||
void pa_socket_server_unref(pa_socket_server*s);
|
void pa_socket_server_unref(pa_socket_server*s);
|
||||||
pa_socket_server* pa_socket_server_ref(pa_socket_server *s);
|
pa_socket_server* pa_socket_server_ref(pa_socket_server *s);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue