sws: move away from IPv4/IPv4-only assumption

Instead of depending the socket domain type on use_ipv6, specify the
domain type (AF_INET / AF_INET6) as variable.

Besides abstracting the socket type, make the debugging messages be
independent on IP (introduce location_str which points to "port XXXXX").
Rename "ipv_inuse" to "socket_type" and tighten the scope (main).

Signed-off-by: Peter Wu <peter@lekensteyn.nl>