resolve_sockaddr: fix locking in the gethostbyaddr() case

The return value of the legacy gethostbyaddr() function call was not
properly protected by resolv_lock, fix that by extending the scope
of the lock.

Reported-by: Laszlo Budai <lbudai@balabit.hu>
Signed-off-by: Balazs Scheidler <bazsi@balabit.hu>
func_test: display exit value if syslog-ng exits early

Signed-off-by: Balazs Scheidler <bazsi@balabit.hu>
testutils.h: include <stdio.h>

testutils was missing stdio.h even though it depends on it in its interface.

Signed-off-by: Balazs Scheidler <bazsi@balabit.hu>
syslog-ng.h: disable Glib's deprecation warnings

The latest glib splits out a lot of deprecations around GThread related
function calls. Get rid of them for now.

Signed-off-by: Balazs Scheidler <bazsi@balabit.hu>
logwriter: remove dead code

This was already replaced by a different implementation but wasn't removed
for some reason. Do it now.

Signed-off-by: Balazs Scheidler <bazsi@balabit.hu>
gsockaddr: remove GSockAddrInetRange

This is not used in syslog-ng, remove it.

Signed-off-by: Balazs Scheidler <bazsi@balabit.hu>
gsockaddr: remove free virtual method from GSockAddr

None of the free functions were actually real implementations, a mere
g_slice_free1() is enough in all current cases.

Signed-off-by: Balazs Scheidler <bazsi@balabit.hu>
GSockAddr: drop sa_ prefix from GSockAddr virtual methods
GSockAddr: generalize get_port/set_port to be available at GSockAddr level

In order to make it easier to handle GSockAddr instances regardless
of its type (ipv6 vs. ipv4) make this call available at a higher level.

Classes that do not implement get_port/set_port will trigger a
failed assertion.

Signed-off-by: Balazs Scheidler <bazsi@balabit.hu>
GSockAddr: move functions around a bit in the header

Generic GSockAddr and GSockAddrInet related methods were somewhat
intermixed, clear that up.
GSockAddr: make g_sockaddr_len static

Signed-off-by: Balazs Scheidler <bazsi@balabit.hu>
stats: add SCS_NETWORK as a stats source

Signed-off-by: Balazs Scheidler <bazsi@balabit.hu>
stats: added STATS_LEVEL enums for indicating stats level

Instead of plain "magic" numbers, such enum value scan be used to make
the call sites more readable (e.g. log_writer_set_options).

Signed-off-by: Balazs Scheidler <bazsi@balabit.hu>
afsocket: factor out SocketOptions class

Put the SocketOptions stuff into a separate file instead of keeping it
in the main driver module.

Signed-off-by: Balazs Scheidler <bazsi@balabit.hu>
afsocket: factor out InetSocketOptions to a separate module

Signed-off-by: Balazs Scheidler <bazsi@balabit.hu>
afsocket: introduce TransportMapper class

The role of the TransportMapper is to map a driver's transport() option
to the appropriate set of options that needs to be applied to a socket, like
address family, socket type, protocol, etc.

Signed-off-by: Balazs Scheidler <bazsi@balabit.hu>
afsocket: introduce TransportMapperInet class

This patch adds TransportMapper classes that implement AF_INET related
transport mapping: tcp(), udp(), network(), syslog().

Signed-off-by: Balazs Scheidler <bazsi@balabit.hu>
afsocket: introduce TransportMapperUnix class

This patch introduces a new TransportMapperUnix class that implements
transport mapping for unix-stream() and unix-dgram() drivers.

Signed-off-by: Balazs Scheidler <bazsi@balabit.hu>
afsocket: refactor to use TransportMapper

This patch changes the implementation of afsocket to use TransportMapper,
and at the same time tries to improve the code by splitting various
functions to be smaller in size.

Signed-off-by: Balazs Scheidler <bazsi@balabit.hu>
afinet: hostname should be enclosed in brackets when it contains a colon

IPv6 IP addresses contain colons, so the name of the host is impossible
to extract reliably from the names of stats counters. If a colon is
detected, enclose the stuff in brackets, e.g. use the format
"[::1]:2000" in the stat counter instance name.

Signed-off-by: Balazs Scheidler <bazsi@balabit.hu>