afsocket: Restore localport() support for network destinations

A while ago, the functionality to set the local, originating ports of
network destinations has been lost. This patch restores that
functionality by setting the port on the socket address when it is being
set up.

Reported-by: Sebastiaan Hoogeveen <zebaz@xs4all.nl>
Signed-off-by: Gergely Nagy <algernon@balabit.hu>
compat/socket.h: define struct sockaddr_storage if not defined by system headers

This patch defines struct sockaddr_storage and removes conditional compilation
from a number of sites that used this structure conditionally.

Signed-off-by: Balazs Scheidler <bazsi@balabit.hu>
Makefile.am: allow unit tests to use crypto functions

This patch adds crypto related libs to TEST_LDADD, which is
libsyslog-ng-crypto.so if that's compiled separately or libsyslog-ng.so.

Signed-off-by: Balazs Scheidler <bazsi@balabit.hu>
transport: rename init_method() to init_instance() for consistency

The _method() suffix is commonly used for functions that are assigned to
function pointers pointing to virtual methods. The init_instance() suffix
is used to statically initialize an instance given a self pointer.

So, log_transport_init_method() should have been
log_transport_init_instance().

Signed-off-by: Balazs Scheidler <bazsi@balabit.hu>
apphook: fix potential use-after-free at exit
afsocket: fix transport-mapper-unix to contain the proper source file

transport-mapper-unix was actually a duplicate of transport-mapper-inet
due to a typo in the Makefile.
afsocket: added assert_transport_mapper_apply_fails() to transport-mapper-lib

Signed-off-by: Balazs Scheidler <bazsi@balabit.hu>
afsocket: build test programs with SSL enabled
afsocket: delegate LogTransport factory function to TransportMapper instance
afsocket: remove construct_transport() in favour of TransportMapper->construct_log_transport

Instead of overriding construct_transport in the driver classes to create a
LogTransportTLS, fully delegate LogTransport creation to TransportMapper.

This means that tls_context and related functions have also moved to
TransportMapper and were removed from the driver classes.

Signed-off-by: Balazs Scheidler <bazsi@balabit.hu>
transport: fix erroneous log_transport_init_method() references

An incorrectly split patch resulted in using the old incarnation of the
just renamed function log_transport_init_instance(), that used to be
named log_transport_init_method().

This patch fixes those.

Signed-off-by: Balazs Scheidler <bazsi@balabit.hu>
Merge pull request #44 from balabit/merge/h/bbz-266-hostresolve-with-service

afsocket: Restore localport() support for network destinations