Max Kellermann
f2664e329f
listen: removed unused macro BINDERROR()
2009-03-01 13:34:44 +01:00
Max Kellermann
c0e61687b6
listen: fix windows specific code
...
During the listen_add_host() API transition, the windows code wasn't
tested, and several removed arguments are still in use there.
2009-03-01 01:49:49 +01:00
Max Kellermann
1bb0124b77
listen: allocate sockaddr_storage struct for accept()
...
The generic sockaddr struct is too small for some addresses. For
accept(), we have to allocate a sockaddr_storage struct on the stack,
which is large enough for all addresses.
2009-02-28 15:20:35 +01:00
Max Kellermann
5c10d2ded7
client: use sockaddr_to_string()
...
Removed the sockaddr_to_tmp_string() hack, use
the new function sockaddr_to_string() instead.
2009-02-28 15:20:35 +01:00
Max Kellermann
1630fe00a2
listen: fix unused parameter warnings when TCP is disabled
...
Work around gcc warnings by casting the parameters to void.
2009-02-24 19:06:31 +01:00
Max Kellermann
d0a17ffb9d
listen: removed is_ipv6_enabled()
...
Don't explicitly check is_ipv6_enabled(), just try calling
listen_add_port_ipv6(), but check its error code.
2009-02-24 18:55:12 +01:00
Max Kellermann
adf044eb09
listen: splitted listen_add_port() into IPv4 and IPv6
...
Some more code simplification.
2009-02-24 18:49:09 +01:00
Max Kellermann
d40c439424
listen: don't call listen_add_config_param(NULL)
...
For default bind_to_address settings, don't call
listen_add_config_param(NULL), use listen_add_port() directly.
2009-02-24 18:36:31 +01:00
Max Kellermann
739c23cca5
listen: moved code to listen_add_host()
...
Split code from the rather large function listen_add_config_param(),
part 3.
2009-02-24 18:29:53 +01:00
Max Kellermann
33749e7ea9
listen: moved code to listen_add_path()
...
Split code from the rather large function listen_add_config_param(),
part 2.
2009-02-24 17:51:39 +01:00
Max Kellermann
36b1a860d3
listen: moved code to listen_add_port()
...
Split code from the rather large function listen_add_config_param().
2009-02-24 17:51:32 +01:00
Max Kellermann
dbb067c016
listen: listen_add_address() returns bool/GError
...
Don't return -1 on failure, and abort on fatal error - do proper error
reporting with GError, and return false on failure.
2009-02-24 17:43:10 +01:00
Max Kellermann
7de4e7228f
listen: removed unused macro "MAXHOSTNAME"
2009-02-24 17:42:37 +01:00
Max Kellermann
9bb3f2d060
listen: no CamelCase
...
Renamed functions.
2009-02-24 17:42:36 +01:00
Qball Cow
5484aaee5f
Set boundPort to the current portnumber, so zeroconf announces the right port number
2009-02-11 14:45:04 +01:00
Max Kellermann
5f77910097
conf: const pointers in block get functions
...
All config_get_block_*() functions should accept constant config_param
pointers.
2009-01-25 16:03:49 +01:00
Max Kellermann
2362ee4a48
use config_get_positive() instead of manual parsing
...
Simplify some code by using config_get_positive(), instead of doing
manual parsing and validation each time.
2009-01-21 08:48:02 +01:00
Max Kellermann
4d472c265e
conf: no CamelCase, part I
...
Renamed functions, types, variables.
2009-01-17 20:23:27 +01:00
Max Kellermann
2a7d99702f
listen: explicitly include sys/socket.h
2009-01-16 17:11:18 +01:00
Max Kellermann
5232f05470
listen: don't compile ipv6Supported() if !HAVE_IPV6
...
The function ipv6Supported() is not used at all when IPv6 support was
disabled at compile time.
2009-01-15 08:33:32 +01:00
Max Kellermann
ca5432a79b
listen: remove the socket source from the main context
...
Free memory before exiting.
2009-01-10 18:55:33 +01:00
Max Kellermann
d60cf67d19
listen: added struct listen_socket
...
Make the listen socket an object, allowing us to add more fields
later. Convert listenSockets into a simple linked list.
2009-01-10 18:55:29 +01:00
Max Kellermann
8ebb3196a8
listen: use GLib instead of utils.h
2009-01-03 14:51:43 +01:00
Max Kellermann
2bc0144023
client: use GLib instead of utils.h
2009-01-03 13:44:19 +01:00
Max Kellermann
019bca2475
listen: use gethostbyname() on WIN32
...
WIN32 has no getaddrinfo(). Fall back to gethostbyname().
2009-01-03 13:23:03 +01:00
Max Kellermann
71e7ce5d8e
main: use the GLib main loop
...
This is a rather huge patch, which unfortunately cannot be splitted.
Instead of using our custom ioops.h library, convert everything to use
the GLib main loop.
2008-12-30 19:24:39 +01:00
Max Kellermann
1f0804bdca
listen: don't make the server socket non-blocking
...
There is no point in making the server socket non-blocking. We call
accept() only after select() has notified us about a new connection.
2008-12-30 19:18:59 +01:00
Max Kellermann
2eaeb65666
listen: include winsock headers on WIN32
...
On Windows, socket declarations reside in winsock.h and ws2tcpip.h.
The POSIX headers are not available.
2008-12-30 19:07:10 +01:00
Max Kellermann
6c0f5fc612
listen: moved redirect_stdin() to daemon.c
...
redirect_stdin() is a daemonization function, and disconnecting from
the standard input is always a good idea for MPD.
2008-12-30 16:28:13 +01:00
Max Kellermann
d99595c214
listen: eliminated freeAllListenSockets()
...
Merged freeAllListenSockets() into closeAllListenSockets(), because
this is its only caller.
2008-12-30 16:28:00 +01:00
Max Kellermann
0a9f69eaaa
listen: use GLib logging
2008-12-29 17:29:04 +01:00
Max Kellermann
95b3430f52
removed os_compat.h
...
Only include headers which are really needed. os_compat.h aimed to
make MPD easily portable, but was never actually made portable.
2008-12-29 17:28:32 +01:00
Max Kellermann
4716ef1014
listen: "port" argument is unused when TCP support is disabled
...
Add a G_GNUC_UNUSED attribute.
2008-12-24 11:07:58 +01:00
Max Kellermann
6902ff2084
listen: check if AI_ADDRCONFIG is defined
...
AI_ADDRCONFIG is not available on all operating systems. Check if it
is defined in the current build environment.
2008-12-02 10:23:36 +01:00
Max Kellermann
ac0af91912
listen: enable AI_PASSIVE
...
The getaddrinfo() flag AI_PASSIVE should be used when resolving
addresses for the bind() system call.
2008-12-02 10:22:21 +01:00
Tom Servo
ea92576219
listen: fix namespace collision on OpenSolaris
...
The listen.c module breaks the build because the variable name used
("sun") for the Unix domain socket part collides with something else
on an OpenSolaris system, likely Sun specific. Renaming it to _sun
(or something else of choice) fixes the build.
[mk: renamed to "s_un"]
2008-11-07 10:33:48 +01:00
Max Kellermann
4d72bda4c3
listen: set file mode 666 on the unix socket
...
Depending on MPD's umask, the file permissions of the unix socket were
too restrictive, and many clients were not able to connect. Do a
chmod(0666) on the socket, to allow everybody to connect.
2008-10-30 18:03:18 +01:00
Andrzej Rybczak
52123c1de8
listen: fix "struct ucred" check
...
The macro name is HAVE_STRUCT_UCRED, not HAVE_UCRED.
2008-10-18 18:21:49 +02:00
Max Kellermann
f548216ead
listen: fixed unused variable warning without HAVE_UCRED
...
The local variable "passcred" was only used by ucred code.
2008-10-17 17:40:28 +02:00
Max Kellermann
9b5ce27c3b
configure.ac: check if "struct ucred" is available
...
By default, glibc 2.8 hides struct ucred behind the _GNU_SOURCE
macro. I don't want to enable that globally, because it may encourage
the use of non-portable functions. Test if "struct ucred" is
available, and enable _GNU_SOURCE if required.
For details about that issue, see glib's bug database:
http://sources.redhat.com/bugzilla/show_bug.cgi?id=6545
2008-10-16 14:59:26 +02:00
Max Kellermann
4a7ad5b618
listen, client: enable SO_PASSCRED, get client's uid
...
Enable authentication over unix sockets. Store the client's uid in
the client struct.
2008-10-15 22:34:21 +02:00
Max Kellermann
62ee702877
listen: pass protocol family to establishListen()
...
The caller already knows the protocol family, and we can eliminate the
complicated switch statement in establishListen() if we just pass this
information. This seems more robust.
2008-10-15 07:30:24 +02:00
Max Kellermann
ba594cfec0
listen: use getaddrinfo() instead of gethostbyname()
...
getaddrinfo() is more robust and has proper IPv6 support. The new
code tries to bind to all IP addresses returned by getaddrinfo().
2008-10-15 07:20:53 +02:00
Max Kellermann
c0197c58ba
client: renamed all public functions
...
Functions which operate on the whole client list are prefixed with
"client_manager_", and functions which handle just one client just get
"client_".
2008-08-28 20:03:02 +02:00
Max Kellermann
deb29e0884
renamed interface.c to client.c
...
I don't believe "interface" is a good name for something like
"connection by a client to MPD", let's call it "client". This is the
first patch in the series which changes the name, beginning with the
file name.
2008-08-28 20:02:43 +02:00
Max Kellermann
91b43b481d
unlink the socket before bind()
...
If a unix domain socket already exists, bind() fails. Unlink the
socket file.
git-svn-id: https://svn.musicpd.org/mpd/trunk@7335 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2008-04-12 04:20:56 +00:00
Max Kellermann
c89b358c8a
clean up CPP includes
...
Try to only include headers which are really needed. We should
particularly check all "headers including other headers". The
long-term goal is to have a manageable, small API for plugins
(decoders, output) without so many mpd internals cluttering the
namespace.
git-svn-id: https://svn.musicpd.org/mpd/trunk@7319 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2008-04-12 04:19:26 +00:00
Max Kellermann
6142959456
proper bind error message for unix socket
...
git-svn-id: https://svn.musicpd.org/mpd/trunk@7238 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2008-04-12 04:07:37 +00:00
Max Kellermann
86d6ba077b
provide switches for TCP and unix sockets
...
autoconf flags for enabling and disabling TCP and unix domain socket
support. Embedded machines without a TCP stack may be better off
without TCP support.
git-svn-id: https://svn.musicpd.org/mpd/trunk@7236 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2008-04-12 04:07:24 +00:00
Max Kellermann
d4f319deaf
support listening on unix domain sockets
...
This trivial patch addresses bug 1639. When a bind_to_address
argument starts with a slash, assume that it is the address of a Unix
domain socket.
git-svn-id: https://svn.musicpd.org/mpd/trunk@7235 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2008-04-12 04:07:18 +00:00