[Fawkes Git] branch/timn/netcomm-ipv6: created (0.5.0-3384-gb62bc0d)

Tim Niemueller niemueller at kbsg.rwth-aachen.de
Mon Dec 12 18:09:53 CET 2016


Changes have been pushed for the project "Fawkes Robotics Software Framework".

Gitweb: http://git.fawkesrobotics.org/fawkes.git
Trac:   http://trac.fawkesrobotics.org

The branch, timn/netcomm-ipv6 has been created
        at  b62bc0d3c98028c2a5b5b9427b35b9c8e47e5c2e (commit)

http://git.fawkesrobotics.org/fawkes.git/timn/netcomm-ipv6

- *Log* ---------------------------------------------------------------
commit 9f59070bb5285dbfa8a16d297cd22da62feda623
Author:     Tim Niemueller <niemueller at kbsg.rwth-aachen.de>
AuthorDate: Mon Dec 12 13:21:12 2016 +0100
Commit:     Tim Niemueller <niemueller at kbsg.rwth-aachen.de>
CommitDate: Mon Dec 12 13:21:12 2016 +0100

    netcomm: remove world info protocol
    
    The world info protocol was specific to robot soccer (Middle Size and
    Standard Platform (Nao) Leagues). It has been removed for several reasons:
    1. it has not been used for years and is unmaintained
    2. if desired, it should reside in its own library or in a plugin
    3. the protocol used a custom message encoding, this should be replaced
       with something more generic such as protobuf
    4. its specificity to robot soccer makes it rather unflexible, even
       within this limited domain, e.g., it did not transmission of
       intentions or strategy moves
    
    Move the enum specification to the refboxcomm plugin. It builds on it
    and this will allow to keep the plugin around for the time being.

http://git.fawkesrobotics.org/fawkes.git/commit/9f59070
http://trac.fawkesrobotics.org/changeset/9f59070

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
commit 9e53cb09e72060fa65101dd21ef9d365fa02bf3e
Author:     Tim Niemueller <niemueller at kbsg.rwth-aachen.de>
AuthorDate: Mon Dec 12 13:24:32 2016 +0100
Commit:     Tim Niemueller <niemueller at kbsg.rwth-aachen.de>
CommitDate: Mon Dec 12 13:24:32 2016 +0100

    refboxcomm: adapt to moved enum specification
    
    Required after removing the world info protocol.

http://git.fawkesrobotics.org/fawkes.git/commit/9e53cb0
http://trac.fawkesrobotics.org/changeset/9e53cb0

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
commit ee5efaf6d48a85bb68317dc86b307b01343eed4d
Author:     Tim Niemueller <niemueller at kbsg.rwth-aachen.de>
AuthorDate: Mon Dec 12 13:25:12 2016 +0100
Commit:     Tim Niemueller <niemueller at kbsg.rwth-aachen.de>
CommitDate: Mon Dec 12 13:25:12 2016 +0100

    worldmodel: remove (soccer) world model plugin
    
    The world model plugin was specific to robot soccer in the RoboCup
    Middle Size and Standard Platform (Nao) Leagues. The fusers might still
    be useful but may then be recovered from version control. They have not
    been used for quite a while.
    
    The name was highly misleading as it really was a soccer-specific
    version of a world model, and even in that sense biased towards the
    mentioned leagues and the specific behavior specifications. It was not a
    generic world model that would have justified that plugin name.

http://git.fawkesrobotics.org/fawkes.git/commit/ee5efaf
http://trac.fawkesrobotics.org/changeset/ee5efaf

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
commit 60be8b94573fbf91d85c7a477b464064cf587203
Author:     Tim Niemueller <niemueller at kbsg.rwth-aachen.de>
AuthorDate: Mon Dec 12 13:27:43 2016 +0100
Commit:     Tim Niemueller <niemueller at kbsg.rwth-aachen.de>
CommitDate: Mon Dec 12 13:27:43 2016 +0100

    refboxrep: remove referee box repeating tool
    
    The tool re-implements much of the refboxcomm plugin and then used the
    (now removed) soccer world info protocol to transmit the information to
    the robots' world models.

http://git.fawkesrobotics.org/fawkes.git/commit/60be8b9
http://trac.fawkesrobotics.org/changeset/60be8b9

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
commit 92270599bca0244281edf063641bc6ace35ba130
Author:     Tim Niemueller <niemueller at kbsg.rwth-aachen.de>
AuthorDate: Mon Dec 12 17:48:12 2016 +0100
Commit:     Tim Niemueller <niemueller at kbsg.rwth-aachen.de>
CommitDate: Mon Dec 12 17:48:12 2016 +0100

    netcomm: socket sub-lib IPv6 compatibility
    
    Make the socket abstraction part compatible with IPv6. This requires
    handling of the two separate address types. The most intrusive change is
    to Socket::connect(), which now iterates over all applicable endpoints
    (which might be more than one, e.g., localhost might refer to 127.0.0.1
    or ::1) and tries to connect to each, the first successful connection is
    used.
    
    Additionally fix some bugs from the old code, e.g., binding to a
    specific IP did not work properly.
    
    By choice IPv6 sockets are IPv6-only, rather than IPv4 and IPv6 at the
    same time on dual stack systems. This is to make the port binding
    obvious in tools like netstat.

http://git.fawkesrobotics.org/fawkes.git/commit/9227059
http://trac.fawkesrobotics.org/changeset/9227059

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
commit b2740fcfdb02b619f4678e35163860e1f04dc0ec
Author:     Tim Niemueller <niemueller at kbsg.rwth-aachen.de>
AuthorDate: Mon Dec 12 17:52:12 2016 +0100
Commit:     Tim Niemueller <niemueller at kbsg.rwth-aachen.de>
CommitDate: Mon Dec 12 17:52:12 2016 +0100

    netcomm: acceptor thread that supports address type and listen address
    
    Add a new constructor for the acceptor thread that can specify the used
    address type and the address to listen to.

http://git.fawkesrobotics.org/fawkes.git/commit/b2740fc
http://trac.fawkesrobotics.org/changeset/b2740fc

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
commit c49c7b2a0a9f54e16daaba0329cc054bba5ebb9f
Author:     Tim Niemueller <niemueller at kbsg.rwth-aachen.de>
AuthorDate: Mon Dec 12 17:54:34 2016 +0100
Commit:     Tim Niemueller <niemueller at kbsg.rwth-aachen.de>
CommitDate: Mon Dec 12 17:54:34 2016 +0100

    netcomm: IPv6 support for fawkes protocol
    
    Modify the fawkes protocol sub-library to support IPv6. This is achieved
    by proper argument passing to the respective underlying sockets for the
    server and client.

http://git.fawkesrobotics.org/fawkes.git/commit/c49c7b2
http://trac.fawkesrobotics.org/changeset/c49c7b2

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
commit 816bac4b2315ceb101a8ddedab25cc13efb37b68
Author:     Tim Niemueller <niemueller at kbsg.rwth-aachen.de>
AuthorDate: Mon Dec 12 17:55:38 2016 +0100
Commit:     Tim Niemueller <niemueller at kbsg.rwth-aachen.de>
CommitDate: Mon Dec 12 17:55:38 2016 +0100

    utils: extend host/port parsing for IPv6
    
    The argument parser's utility methods to parse a host:port pair has been
    extended to support IPv6. It can now be called with "hostname:port",
    "IPv4:port", where IPv4 represents an arbitrary IPv4 address like
    127.0.0.1, or "[IPv6]:port", where IPv6 represents an arbitrary IPv6
    address such as ::1, IPv6 addresses must be encapsulated in square
    brackets.
    
    Added static member functions for the same functionality.

http://git.fawkesrobotics.org/fawkes.git/commit/816bac4
http://trac.fawkesrobotics.org/changeset/816bac4

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
commit cad79d2dbca77b8d6a0dc9639d8db7a1a030f083
Author:     Tim Niemueller <niemueller at kbsg.rwth-aachen.de>
AuthorDate: Mon Dec 12 17:58:07 2016 +0100
Commit:     Tim Niemueller <niemueller at kbsg.rwth-aachen.de>
CommitDate: Mon Dec 12 17:58:07 2016 +0100

    gui_utils: increase service chooser dialog default size
    
    Typical simulation hostnames with IPv4 addresses were already truncated.

http://git.fawkesrobotics.org/fawkes.git/commit/cad79d2
http://trac.fawkesrobotics.org/changeset/cad79d2

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
commit 26c8e9bd4c8b50dbbe195df8c4164cb50ea98600
Author:     Tim Niemueller <niemueller at kbsg.rwth-aachen.de>
AuthorDate: Mon Dec 12 18:00:07 2016 +0100
Commit:     Tim Niemueller <niemueller at kbsg.rwth-aachen.de>
CommitDate: Mon Dec 12 18:00:07 2016 +0100

    gui_utils: remove direct ipaddr access, use generic host:port parsing
    
    Remove direct access to the ipaddr from the function signature. Only
    return the hostname. Especially on dual stack systems, the IP address
    for a hostname might not be unique, as there are multiple endpoints
    matching a hostname, e.g., IPv4 and IPv6. Let the connection procedure
    figure this out by trying multiple end points.
    
    Comment out access to the raw ip address. Do not (yet) remove method,
    needs updating of the downstream code, first.
    
    Use the ArgumentParser methods for parsing host:port strings to support
    manual entry of IPv6 addresses.

http://git.fawkesrobotics.org/fawkes.git/commit/26c8e9b
http://trac.fawkesrobotics.org/changeset/26c8e9b

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
commit 20eff8ca60075b389c3b35df91c8fcd6285961a2
Author:     Tim Niemueller <niemueller at kbsg.rwth-aachen.de>
AuthorDate: Mon Dec 12 18:02:31 2016 +0100
Commit:     Tim Niemueller <niemueller at kbsg.rwth-aachen.de>
CommitDate: Mon Dec 12 18:02:31 2016 +0100

    libbaseapp: support IPv4/IPv6 configuration
    
    Support enabling or disabling IPv4/IPv6 individually, enable both by
    default if not specified in configuration.
    
    Support setting the IP address to bind to. This allows, for example, to
    limit connections to the local host or only to a specific interface.

http://git.fawkesrobotics.org/fawkes.git/commit/20eff8c
http://trac.fawkesrobotics.org/changeset/20eff8c

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
commit a1d300072d62a60b124db799b72f0c4bd9db1484
Author:     Tim Niemueller <niemueller at kbsg.rwth-aachen.de>
AuthorDate: Mon Dec 12 18:05:25 2016 +0100
Commit:     Tim Niemueller <niemueller at kbsg.rwth-aachen.de>
CommitDate: Mon Dec 12 18:05:25 2016 +0100

    netloggui: remove dependence on direct IP access from service chooser
    
    The service chooser dialog signature no longer provides direct access to
    the IP address.

http://git.fawkesrobotics.org/fawkes.git/commit/a1d3000
http://trac.fawkesrobotics.org/changeset/a1d3000

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
commit 9bad06818f45732777822bbf545ea2ac6959e147
Author:     Tim Niemueller <niemueller at kbsg.rwth-aachen.de>
AuthorDate: Mon Dec 12 18:06:19 2016 +0100
Commit:     Tim Niemueller <niemueller at kbsg.rwth-aachen.de>
CommitDate: Mon Dec 12 18:06:19 2016 +0100

    libs: mark new gui_utils dependency on utils

http://git.fawkesrobotics.org/fawkes.git/commit/9bad068
http://trac.fawkesrobotics.org/changeset/9bad068

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
commit 03ed1a8a8097857aaba1dd6a4edf8beaead5a9a0
Author:     Tim Niemueller <niemueller at kbsg.rwth-aachen.de>
AuthorDate: Mon Dec 12 18:06:40 2016 +0100
Commit:     Tim Niemueller <niemueller at kbsg.rwth-aachen.de>
CommitDate: Mon Dec 12 18:06:40 2016 +0100

    ttmainloop: documentation fix
    
    Became apparent when worlmodel plugin was removed. Old c'n'p bug.

http://git.fawkesrobotics.org/fawkes.git/commit/03ed1a8
http://trac.fawkesrobotics.org/changeset/03ed1a8

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
commit 8dd0c67a1e7d323ac9dd1466f1ad2d0602192cd1
Author:     Tim Niemueller <niemueller at kbsg.rwth-aachen.de>
AuthorDate: Mon Dec 12 18:07:15 2016 +0100
Commit:     Tim Niemueller <niemueller at kbsg.rwth-aachen.de>
CommitDate: Mon Dec 12 18:07:15 2016 +0100

    refboxcomm: specify IPv4 address type to sockets
    
    Limit to IPv4 here justified for the time being.

http://git.fawkesrobotics.org/fawkes.git/commit/8dd0c67
http://trac.fawkesrobotics.org/changeset/8dd0c67

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
commit cf9f6e3b2c6d541fcb94eba2b914899b2ac8e555
Author:     Tim Niemueller <niemueller at kbsg.rwth-aachen.de>
AuthorDate: Mon Dec 12 18:08:02 2016 +0100
Commit:     Tim Niemueller <niemueller at kbsg.rwth-aachen.de>
CommitDate: Mon Dec 12 18:08:02 2016 +0100

    libconfig: support !ipv4 and !ipv6 tags in YAML config
    
    Properly verify IPv4 and IPv6 addresses marked with the !ipv4 and !ipv6
    tags in the configuration.

http://git.fawkesrobotics.org/fawkes.git/commit/cf9f6e3
http://trac.fawkesrobotics.org/changeset/cf9f6e3

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
commit b62bc0d3c98028c2a5b5b9427b35b9c8e47e5c2e
Author:     Tim Niemueller <niemueller at kbsg.rwth-aachen.de>
AuthorDate: Mon Dec 12 18:09:02 2016 +0100
Commit:     Tim Niemueller <niemueller at kbsg.rwth-aachen.de>
CommitDate: Mon Dec 12 18:09:02 2016 +0100

    config: proper IPv4/IPv6 default configuration
    
    Enable IPv4 and IPv6 by default and listen to all devices/interfaces.

http://git.fawkesrobotics.org/fawkes.git/commit/b62bc0d
http://trac.fawkesrobotics.org/changeset/b62bc0d

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -


- *Summary* -----------------------------------------------------------
 cfg/config.yaml                                    |   12 +
 src/libs/Makefile                                  |    2 +-
 src/libs/baseapp/run.cpp                           |   24 +-
 src/libs/config/yaml.cpp                           |   49 ++-
 src/libs/gui_utils/Makefile                        |    2 +-
 src/libs/gui_utils/service_chooser_dialog.cpp      |   52 +--
 src/libs/gui_utils/service_chooser_dialog.h        |    2 +-
 src/libs/netcomm/fawkes/client.cpp                 |   70 +--
 src/libs/netcomm/fawkes/client.h                   |   13 +-
 src/libs/netcomm/fawkes/network_manager.cpp        |   18 +-
 src/libs/netcomm/fawkes/network_manager.h          |   10 +-
 src/libs/netcomm/fawkes/server_thread.cpp          |   48 ++-
 src/libs/netcomm/fawkes/server_thread.h            |   11 +-
 src/libs/netcomm/socket/datagram.cpp               |    5 +-
 src/libs/netcomm/socket/datagram.h                 |    2 +-
 src/libs/netcomm/socket/datagram_broadcast.cpp     |   10 +-
 src/libs/netcomm/socket/datagram_broadcast.h       |    2 +-
 src/libs/netcomm/socket/datagram_multicast.cpp     |   16 +-
 src/libs/netcomm/socket/datagram_multicast.h       |    5 +-
 src/libs/netcomm/socket/socket.cpp                 |  444 ++++++++++++-----
 src/libs/netcomm/socket/socket.h                   |   39 ++-
 src/libs/netcomm/socket/stream.cpp                 |   25 +-
 src/libs/netcomm/socket/stream.h                   |    3 +-
 src/libs/netcomm/utils/acceptor_thread.cpp         |   34 ++
 src/libs/netcomm/utils/acceptor_thread.h           |   16 +-
 src/libs/utils/system/argparser.cpp                |  139 ++++--
 src/libs/utils/system/argparser.h                  |    4 +
 src/plugins/Makefile                               |    2 +-
 src/plugins/refboxcomm/processor/msl2010.cpp       |    2 +-
 src/plugins/refboxcomm/processor/spl.cpp           |    2 +-
 src/plugins/refboxcomm/processor/spl.h             |    2 +-
 src/plugins/refboxcomm/processor/state_handler.h   |    2 +-
 src/plugins/ttmainloop/thread.cpp                  |    2 +-
 src/plugins/worldmodel/Makefile                    |   46 --
 src/plugins/worldmodel/fusers/fuser.cpp            |   47 --
 src/plugins/worldmodel/fusers/fuser.h              |   35 --
 src/plugins/worldmodel/fusers/multi_copy.cpp       |  165 ------
 src/plugins/worldmodel/fusers/multi_copy.h         |   63 ---
 src/plugins/worldmodel/fusers/objpos_average.cpp   |  293 -----------
 src/plugins/worldmodel/fusers/objpos_average.h     |   67 ---
 src/plugins/worldmodel/fusers/objpos_majority.cpp  |  534 --------------------
 src/plugins/worldmodel/fusers/objpos_majority.h    |  128 -----
 src/plugins/worldmodel/fusers/qa/Makefile          |   29 -
 .../worldmodel/fusers/qa/qa_objpos_majority.cpp    |  330 ------------
 src/plugins/worldmodel/fusers/single_copy.cpp      |   74 ---
 src/plugins/worldmodel/fusers/single_copy.h        |   49 --
 src/plugins/worldmodel/net_thread.cpp              |  491 ------------------
 src/plugins/worldmodel/net_thread.h                |  134 -----
 src/plugins/worldmodel/wm_thread.cpp               |  285 -----------
 src/plugins/worldmodel/wm_thread.h                 |   82 ---
 src/plugins/worldmodel/worldmodel_plugin.cpp       |   50 --
 src/plugins/worldmodel/worldmodel_plugin.h         |   34 --
 src/tools/Makefile                                 |    2 +-
 src/tools/netloggui/netloggui.cpp                  |    6 +-
 src/tools/refboxrep/Makefile                       |   35 --
 src/tools/refboxrep/ffrefboxrep.txt                |   93 ----
 src/tools/refboxrep/main.cpp                       |  184 -------
 src/tools/refboxrep/msl2007.cpp                    |  257 ----------
 src/tools/refboxrep/msl2007.h                      |   59 ---
 src/tools/refboxrep/msl2008.cpp                    |  361 -------------
 src/tools/refboxrep/msl2008.h                      |   72 ---
 src/tools/refboxrep/msl2010.cpp                    |  401 ---------------
 src/tools/refboxrep/msl2010.h                      |   78 ---
 src/tools/refboxrep/refbox_state_sender.cpp        |  257 ----------
 src/tools/refboxrep/refbox_state_sender.h          |   94 ----
 src/tools/refboxrep/refbox_state_writer.cpp        |  322 ------------
 src/tools/refboxrep/refbox_state_writer.h          |   69 ---
 src/tools/refboxrep/spl.cpp                        |  173 -------
 src/tools/refboxrep/spl.h                          |   95 ----
 69 files changed, 745 insertions(+), 5818 deletions(-)
 delete mode 100644 src/plugins/worldmodel/Makefile
 delete mode 100644 src/plugins/worldmodel/fusers/fuser.cpp
 delete mode 100644 src/plugins/worldmodel/fusers/fuser.h
 delete mode 100644 src/plugins/worldmodel/fusers/multi_copy.cpp
 delete mode 100644 src/plugins/worldmodel/fusers/multi_copy.h
 delete mode 100644 src/plugins/worldmodel/fusers/objpos_average.cpp
 delete mode 100644 src/plugins/worldmodel/fusers/objpos_average.h
 delete mode 100644 src/plugins/worldmodel/fusers/objpos_majority.cpp
 delete mode 100644 src/plugins/worldmodel/fusers/objpos_majority.h
 delete mode 100644 src/plugins/worldmodel/fusers/qa/Makefile
 delete mode 100644 src/plugins/worldmodel/fusers/qa/qa_objpos_majority.cpp
 delete mode 100644 src/plugins/worldmodel/fusers/single_copy.cpp
 delete mode 100644 src/plugins/worldmodel/fusers/single_copy.h
 delete mode 100644 src/plugins/worldmodel/net_thread.cpp
 delete mode 100644 src/plugins/worldmodel/net_thread.h
 delete mode 100644 src/plugins/worldmodel/wm_thread.cpp
 delete mode 100644 src/plugins/worldmodel/wm_thread.h
 delete mode 100644 src/plugins/worldmodel/worldmodel_plugin.cpp
 delete mode 100644 src/plugins/worldmodel/worldmodel_plugin.h
 delete mode 100644 src/tools/refboxrep/Makefile
 delete mode 100644 src/tools/refboxrep/ffrefboxrep.txt
 delete mode 100644 src/tools/refboxrep/main.cpp
 delete mode 100644 src/tools/refboxrep/msl2007.cpp
 delete mode 100644 src/tools/refboxrep/msl2007.h
 delete mode 100644 src/tools/refboxrep/msl2008.cpp
 delete mode 100644 src/tools/refboxrep/msl2008.h
 delete mode 100644 src/tools/refboxrep/msl2010.cpp
 delete mode 100644 src/tools/refboxrep/msl2010.h
 delete mode 100644 src/tools/refboxrep/refbox_state_sender.cpp
 delete mode 100644 src/tools/refboxrep/refbox_state_sender.h
 delete mode 100644 src/tools/refboxrep/refbox_state_writer.cpp
 delete mode 100644 src/tools/refboxrep/refbox_state_writer.h
 delete mode 100644 src/tools/refboxrep/spl.cpp
 delete mode 100644 src/tools/refboxrep/spl.h


- *Diffs* -------------------------------------------------------------

- *commit* 9f59070bb5285dbfa8a16d297cd22da62feda623 - - - - - - - - - -
Author:  Tim Niemueller <niemueller at kbsg.rwth-aachen.de>
Date:    Mon Dec 12 13:21:12 2016 +0100
Subject: netcomm: remove world info protocol

 src/libs/netcomm/worldinfo/defs.h                  |   34 -
 src/libs/netcomm/worldinfo/handler.cpp             |  153 ---
 src/libs/netcomm/worldinfo/handler.h               |   84 --
 src/libs/netcomm/worldinfo/messages.h              |  256 ----
 src/libs/netcomm/worldinfo/transceiver.cpp         | 1239 --------------------
 src/libs/netcomm/worldinfo/transceiver.h           |  220 ----
 .../refboxcomm/processor}/enums.cpp                |    2 +-
 .../refboxcomm/processor}/enums.h                  |    4 +-
 8 files changed, 3 insertions(+), 1989 deletions(-)


- *commit* 9e53cb09e72060fa65101dd21ef9d365fa02bf3e - - - - - - - - - -
Author:  Tim Niemueller <niemueller at kbsg.rwth-aachen.de>
Date:    Mon Dec 12 13:24:32 2016 +0100
Subject: refboxcomm: adapt to moved enum specification

 src/plugins/refboxcomm/processor/spl.h           |    2 +-
 src/plugins/refboxcomm/processor/state_handler.h |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

_Diff for modified files_:
diff --git a/src/plugins/refboxcomm/processor/spl.h b/src/plugins/refboxcomm/processor/spl.h
index 2b9c527..83a38f0 100644
--- a/src/plugins/refboxcomm/processor/spl.h
+++ b/src/plugins/refboxcomm/processor/spl.h
@@ -25,7 +25,7 @@
 #define __TOOLS_REFBOXREP_SPL_H_
 
 #include "processor.h"
-#include <netcomm/worldinfo/enums.h>
+#include "enums.h"
 
 #include <cstdlib>
 #include <stdint.h>
diff --git a/src/plugins/refboxcomm/processor/state_handler.h b/src/plugins/refboxcomm/processor/state_handler.h
index 2d2378d..bdda0a9 100644
--- a/src/plugins/refboxcomm/processor/state_handler.h
+++ b/src/plugins/refboxcomm/processor/state_handler.h
@@ -23,7 +23,7 @@
 #ifndef __PLUGINS_REFBOXCOMM_STATE_HANDLER_H_
 #define __PLUGINS_REFBOXCOMM_STATE_HANDLER_H_
 
-#include <netcomm/worldinfo/enums.h>
+#include "enums.h"
 
 class RefBoxStateHandler
 {

- *commit* ee5efaf6d48a85bb68317dc86b307b01343eed4d - - - - - - - - - -
Author:  Tim Niemueller <niemueller at kbsg.rwth-aachen.de>
Date:    Mon Dec 12 13:25:12 2016 +0100
Subject: worldmodel: remove (soccer) world model plugin

 src/plugins/Makefile                               |    2 +-
 src/plugins/worldmodel/Makefile                    |   46 --
 src/plugins/worldmodel/fusers/fuser.cpp            |   47 --
 src/plugins/worldmodel/fusers/fuser.h              |   35 --
 src/plugins/worldmodel/fusers/multi_copy.cpp       |  165 ------
 src/plugins/worldmodel/fusers/multi_copy.h         |   63 ---
 src/plugins/worldmodel/fusers/objpos_average.cpp   |  293 -----------
 src/plugins/worldmodel/fusers/objpos_average.h     |   67 ---
 src/plugins/worldmodel/fusers/objpos_majority.cpp  |  534 --------------------
 src/plugins/worldmodel/fusers/objpos_majority.h    |  128 -----
 src/plugins/worldmodel/fusers/qa/Makefile          |   29 -
 .../worldmodel/fusers/qa/qa_objpos_majority.cpp    |  330 ------------
 src/plugins/worldmodel/fusers/single_copy.cpp      |   74 ---
 src/plugins/worldmodel/fusers/single_copy.h        |   49 --
 src/plugins/worldmodel/net_thread.cpp              |  491 ------------------
 src/plugins/worldmodel/net_thread.h                |  134 -----
 src/plugins/worldmodel/wm_thread.cpp               |  285 -----------
 src/plugins/worldmodel/wm_thread.h                 |   82 ---
 src/plugins/worldmodel/worldmodel_plugin.cpp       |   50 --
 src/plugins/worldmodel/worldmodel_plugin.h         |   34 --
 20 files changed, 1 insertions(+), 2937 deletions(-)

_Diff for modified files_:
diff --git a/src/plugins/Makefile b/src/plugins/Makefile
index caee20b..5053b67 100644
--- a/src/plugins/Makefile
+++ b/src/plugins/Makefile
@@ -21,7 +21,7 @@ SUBDIRS	= bbsync bblogger webview ttmainloop rrd rrdweb \
 	  laser imu flite festival joystick openrave \
 	  katana jaco pantilt roomba nao robotino \
 	  bumblebee2 perception amcl \
-	  skiller luaagent worldmodel \
+	  skiller luaagent \
 	  laser-filter laser-lines laser-cluster laser-pointclouds \
 	  static_transforms navgraph navgraph-clusters navgraph-generator colli \
 	  clips clips-agent clips-protobuf clips-webview clips-navgraph clips-ros \

- *commit* 60be8b94573fbf91d85c7a477b464064cf587203 - - - - - - - - - -
Author:  Tim Niemueller <niemueller at kbsg.rwth-aachen.de>
Date:    Mon Dec 12 13:27:43 2016 +0100
Subject: refboxrep: remove referee box repeating tool

 src/tools/Makefile                          |    2 +-
 src/tools/refboxrep/Makefile                |   35 ---
 src/tools/refboxrep/ffrefboxrep.txt         |   93 ------
 src/tools/refboxrep/main.cpp                |  184 ------------
 src/tools/refboxrep/msl2007.cpp             |  257 -----------------
 src/tools/refboxrep/msl2007.h               |   59 ----
 src/tools/refboxrep/msl2008.cpp             |  361 ------------------------
 src/tools/refboxrep/msl2008.h               |   72 -----
 src/tools/refboxrep/msl2010.cpp             |  401 ---------------------------
 src/tools/refboxrep/msl2010.h               |   78 ------
 src/tools/refboxrep/refbox_state_sender.cpp |  257 -----------------
 src/tools/refboxrep/refbox_state_sender.h   |   94 -------
 src/tools/refboxrep/refbox_state_writer.cpp |  322 ---------------------
 src/tools/refboxrep/refbox_state_writer.h   |   69 -----
 src/tools/refboxrep/spl.cpp                 |  173 ------------
 src/tools/refboxrep/spl.h                   |   95 -------
 16 files changed, 1 insertions(+), 2551 deletions(-)

_Diff for modified files_:
diff --git a/src/tools/Makefile b/src/tools/Makefile
index abf3959..0f730cc 100644
--- a/src/tools/Makefile
+++ b/src/tools/Makefile
@@ -15,7 +15,7 @@
 
 BASEDIR = ../..
 
-SUBDIRS = plugin logview config plugin_gui netloggui refboxrep \
+SUBDIRS = plugin logview config plugin_gui netloggui \
 	  lasergui skillgui battery_monitor ffinfo vision set_pose \
 		eclipse_debugger
 

- *commit* 92270599bca0244281edf063641bc6ace35ba130 - - - - - - - - - -
Author:  Tim Niemueller <niemueller at kbsg.rwth-aachen.de>
Date:    Mon Dec 12 17:48:12 2016 +0100
Subject: netcomm: socket sub-lib IPv6 compatibility

 src/libs/netcomm/socket/datagram.cpp           |    5 +-
 src/libs/netcomm/socket/datagram.h             |    2 +-
 src/libs/netcomm/socket/datagram_broadcast.cpp |   10 +-
 src/libs/netcomm/socket/datagram_broadcast.h   |    2 +-
 src/libs/netcomm/socket/datagram_multicast.cpp |   16 +-
 src/libs/netcomm/socket/datagram_multicast.h   |    5 +-
 src/libs/netcomm/socket/socket.cpp             |  444 +++++++++++++++++------
 src/libs/netcomm/socket/socket.h               |   39 ++-
 src/libs/netcomm/socket/stream.cpp             |   25 ++-
 src/libs/netcomm/socket/stream.h               |    3 +-
 10 files changed, 405 insertions(+), 146 deletions(-)

_Diff for modified files_:
diff --git a/src/libs/netcomm/socket/datagram.cpp b/src/libs/netcomm/socket/datagram.cpp
index 128d98c..85224c5 100644
--- a/src/libs/netcomm/socket/datagram.cpp
+++ b/src/libs/netcomm/socket/datagram.cpp
@@ -35,11 +35,12 @@ namespace fawkes {
  */
 
 /** Constructor.
+ * @param addr_type Specify IPv4 or IPv6
  * @param timeout timeout, if 0 all operationsare blocking, otherwise it
  * is tried for timeout seconds.
  */
-DatagramSocket::DatagramSocket(float timeout)
-  : Socket(PF_INET, SOCK_DGRAM, 0, timeout)
+DatagramSocket::DatagramSocket(AddrType addr_type, float timeout)
+  : Socket(addr_type, UDP, timeout)
 {
 }
 
diff --git a/src/libs/netcomm/socket/datagram.h b/src/libs/netcomm/socket/datagram.h
index 7d4a3b0..b9b671f 100644
--- a/src/libs/netcomm/socket/datagram.h
+++ b/src/libs/netcomm/socket/datagram.h
@@ -31,7 +31,7 @@ namespace fawkes {
 class DatagramSocket : public Socket
 {
  public:
-  DatagramSocket(float timeout = 0.f);
+	DatagramSocket(AddrType addr_type, float timeout = 0.f);
   DatagramSocket(DatagramSocket &s);
 
   virtual Socket *  clone();
diff --git a/src/libs/netcomm/socket/datagram_broadcast.cpp b/src/libs/netcomm/socket/datagram_broadcast.cpp
index 43e7b2b..777824f 100644
--- a/src/libs/netcomm/socket/datagram_broadcast.cpp
+++ b/src/libs/netcomm/socket/datagram_broadcast.cpp
@@ -35,7 +35,7 @@ namespace fawkes {
 
 /** @class BroadcastDatagramSocket netcomm/socket/datagram.h
  * Broadcast datagram socket.
- * An broadcast UDP socket on top of IP.
+ * An broadcast UDP socket on top of IPv4 (not available for IPv6).
  *
  * @ingroup NetComm
  * @author Christoph Schwering
@@ -51,7 +51,7 @@ namespace fawkes {
 BroadcastDatagramSocket::BroadcastDatagramSocket(const char *broadcast_addr_s,
 						 unsigned short port,
 						 float timeout)
-  : Socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP, timeout)
+  : Socket(IPv4, UDP, timeout)
 {
   broadcast_addr = (struct ::sockaddr_in *)malloc(sizeof(struct ::sockaddr_in));
 
@@ -96,12 +96,12 @@ BroadcastDatagramSocket::bind()
 {
   int broadcast = 1;
   if ( setsockopt(sock_fd, SOL_SOCKET, SO_BROADCAST, &broadcast, sizeof(broadcast)) == -1) {
-    throw SocketException("Could not set SO_BROADCAST", errno);
+	  throw SocketException(errno, "Could not set SO_BROADCAST");
   }
 
   int reuse = 1;
   if ( setsockopt(sock_fd, SOL_SOCKET, SO_REUSEADDR, &reuse, sizeof(reuse)) == -1) {
-    throw SocketException("Could not set SO_REUSEADDR", errno);
+	  throw SocketException(errno, "Could not set SO_REUSEADDR");
   }
 
   struct ::sockaddr_in local;
@@ -110,7 +110,7 @@ BroadcastDatagramSocket::bind()
   local.sin_port = broadcast_addr->sin_port;
 
   if (::bind(sock_fd, (struct ::sockaddr *) &local, sizeof(local)) < 0) {
-    throw SocketException("Could not bind to port", errno);
+	  throw SocketException(errno, "Could not bind to port");
   }
 }
 
diff --git a/src/libs/netcomm/socket/datagram_broadcast.h b/src/libs/netcomm/socket/datagram_broadcast.h
index ef0502e..0fadd73 100644
--- a/src/libs/netcomm/socket/datagram_broadcast.h
+++ b/src/libs/netcomm/socket/datagram_broadcast.h
@@ -33,7 +33,7 @@ class BroadcastDatagramSocket : public Socket
 {
  public:
   BroadcastDatagramSocket(const char *broadcast_addr_s, unsigned short port,
-			  float timeout = 0.f);
+                          float timeout = 0.f);
   BroadcastDatagramSocket(BroadcastDatagramSocket &s);
   virtual ~BroadcastDatagramSocket();
 
diff --git a/src/libs/netcomm/socket/datagram_multicast.cpp b/src/libs/netcomm/socket/datagram_multicast.cpp
index 2ffb460..a86a9a6 100644
--- a/src/libs/netcomm/socket/datagram_multicast.cpp
+++ b/src/libs/netcomm/socket/datagram_multicast.cpp
@@ -41,16 +41,18 @@ namespace fawkes {
  */
 
 /** Constructor.
+ * @param addr_type Specify IPv4 or IPv6
  * @param multicast_addr_s textual representation of the multicast IP address
  * to use for multicast communication. NOT a hostname!
  * @param port port
  * @param timeout timeout, if 0 all operationsare blocking, otherwise it
  * is tried for timeout seconds.
  */
-MulticastDatagramSocket::MulticastDatagramSocket(const char *multicast_addr_s,
+	MulticastDatagramSocket::MulticastDatagramSocket(AddrType addr_type,
+                                                 const char *multicast_addr_s,
 						 unsigned short port,
 						 float timeout)
-  : Socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP, timeout)
+  : Socket(addr_type, UDP, timeout)
 {
   multicast_addr = (struct ::sockaddr_in *)malloc(sizeof(struct ::sockaddr_in));
 
@@ -94,14 +96,14 @@ MulticastDatagramSocket::bind()
 {
   int reuse = 1;
   if ( setsockopt(sock_fd, SOL_SOCKET, SO_REUSEADDR, &reuse, sizeof(reuse)) == -1) {
-    throw SocketException("Could not set SO_REUSEADDR", errno);
+	  throw SocketException(errno, "Could not set SO_REUSEADDR");
   }
 
   struct ip_mreq imr;
   imr.imr_multiaddr.s_addr = multicast_addr->sin_addr.s_addr;
   imr.imr_interface.s_addr = htonl( INADDR_ANY );
   if ( setsockopt(sock_fd, IPPROTO_IP, IP_ADD_MEMBERSHIP, &imr, sizeof(imr)) == -1 ) {
-    throw SocketException("Could not add multicast group membership", errno);
+	  throw SocketException(errno, "Could not add multicast group membership");
   }
 
   struct ::sockaddr_in local;
@@ -110,7 +112,7 @@ MulticastDatagramSocket::bind()
   local.sin_port = multicast_addr->sin_port;
 
   if (::bind(sock_fd, (struct ::sockaddr *) &local, sizeof(local)) < 0) {
-    throw SocketException("Could not bind to port", errno);
+	  throw SocketException(errno, "Could not bind to port");
   }
 }
 
@@ -176,7 +178,7 @@ MulticastDatagramSocket::set_loop(bool loop)
 {
   int l = (loop ? 1 : 0);
   if (setsockopt(sock_fd, IPPROTO_IP, IP_MULTICAST_LOOP, &l, sizeof(l)) == -1) {
-    throw SocketException("MulticastDatagramSocket::set_loop: setsockopt failed", errno);
+	  throw SocketException(errno, "MulticastDatagramSocket::set_loop: setsockopt failed");
   }
 }
 
@@ -189,7 +191,7 @@ MulticastDatagramSocket::set_ttl(int ttl)
 {
   if ( ttl < 0 ) ttl = -ttl;
   if ( setsockopt( sock_fd, IPPROTO_IP, IP_MULTICAST_TTL, &ttl, sizeof(ttl) ) == -1 ) {
-    throw SocketException("MulticastDatagramSocket::set_ttl: setsockopt failed", errno);
+	  throw SocketException(errno, "MulticastDatagramSocket::set_ttl: setsockopt failed");
   }
 }
 
diff --git a/src/libs/netcomm/socket/datagram_multicast.h b/src/libs/netcomm/socket/datagram_multicast.h
index d23f58d..2849f1d 100644
--- a/src/libs/netcomm/socket/datagram_multicast.h
+++ b/src/libs/netcomm/socket/datagram_multicast.h
@@ -32,8 +32,9 @@ namespace fawkes {
 class MulticastDatagramSocket : public Socket
 {
  public:
-  MulticastDatagramSocket(const char *multicast_addr_s, unsigned short port,
-			  float timeout = 0.f);
+	MulticastDatagramSocket(AddrType addr_type,
+	                        const char *multicast_addr_s, unsigned short port,
+	                        float timeout = 0.f);
   MulticastDatagramSocket(MulticastDatagramSocket &s);
   virtual ~MulticastDatagramSocket();
 
diff --git a/src/libs/netcomm/socket/socket.cpp b/src/libs/netcomm/socket/socket.cpp
index 2b7156c..c3b11d3 100644
--- a/src/libs/netcomm/socket/socket.cpp
+++ b/src/libs/netcomm/socket/socket.cpp
@@ -25,6 +25,7 @@
 
 #include <core/exceptions/system.h>
 #include <utils/time/time.h>
+#include <utils/misc/string_conversions.h>
 
 #ifndef _GNU_SOURCE
 #define _GNU_SOURCE
@@ -36,12 +37,14 @@
 #include <netdb.h>
 #include <unistd.h>
 #include <fcntl.h>
-#include <string.h>
-#include <stdlib.h>
+#include <string>
+#include <cstring>
+#include <cstdlib>
 // include <linux/in.h>
 #include <netinet/in.h>
 #include <netinet/in_systm.h>
 #include <netinet/ip.h> 
+#include <arpa/inet.h>
 #include <poll.h>
 
 #include <cstdio>
@@ -67,11 +70,15 @@ namespace fawkes {
  */
 
 /** Constructor.
- * @param msg reason that caused the exception.
+ * @param format format for reason that caused the exception.
  */
-SocketException::SocketException(const char *msg)
-  : Exception("%s", msg)
+	SocketException::SocketException(const char *format, ...)
+  : Exception()
 {
+	va_list va;
+  va_start(va, format);
+  append_va(format, va);
+  va_end(va);
 }
 
 
@@ -79,7 +86,7 @@ SocketException::SocketException(const char *msg)
  * @param msg reason of the exception
  * @param _errno error number (errno returned by a syscall)
  */
-SocketException::SocketException(const char *msg, int _errno)
+SocketException::SocketException(int _errno, const char *msg)
   : Exception(_errno, "%s", msg)
 {
 }
@@ -94,6 +101,9 @@ SocketException::SocketException(const char *msg, int _errno)
  * @author Tim Niemueller
  */
 
+/** @var Socket::addr_type
+ * Address type/family of socket.
+ */
 /** @var Socket::sock_fd
  * Socket file descriptor.
  */
@@ -145,29 +155,50 @@ const short Socket::POLL_NVAL  = POLLNVAL;
  * This creates a new socket. This is a plain pass-through constructor
  * to the socket() syscall. In most cases this should only be used by
  * a derivate.
- * @param domain communication domain, selects the protocol
- * @param type type of the sockets which specifies communication semantics
- * @param protocol protocol to use, most types support only one and protocol
- * should be 0
+ * @param addr_type Specify IPv4 or IPv6
+ * @param sock_type socket type, either TCP or UDP
  * @param timeout See Socket::timeout.
  * @exception SocketException thrown if socket cannot be opened, check errno for cause
  */
-Socket::Socket(int domain, int type, int protocol, float timeout)
+Socket::Socket(AddrType addr_type, SocketType sock_type, float timeout)
+	: addr_type(addr_type), sock_fd(-1), timeout(timeout),
+	  client_addr(NULL), client_addr_len(0), socket_protocol_(0)
 {
-  this->timeout = timeout;
-  if ( (sock_fd = socket(domain, type, protocol)) == -1 ) {
-    throw SocketException("Could not open socket", errno);
+  if (addr_type == IPv4) {
+	  socket_addr_family_ = PF_INET;
+  } else if (addr_type == IPv6) {
+	  socket_addr_family_ = PF_INET6;
+  } else {
+	  throw Exception("Unknown address type");
   }
-
-  if (timeout > 0.f) {
-    // set to non-blocking
-    if ( fcntl(sock_fd, F_SETFL, O_NONBLOCK) == -1 ) {
-      throw SocketException("Could not set socket to non-blocking", errno);
-    }
+  if (sock_type == TCP) {
+	  socket_type_ = SOCK_STREAM;
+  } else if (sock_type == UDP) {
+	  socket_type_ = SOCK_DGRAM;
+  } else {
+	  throw Exception("Unknown socket type");
   }
+}
 
-  client_addr = NULL;
-  client_addr_len = 0;
+/**  IPv4 Constructor.
+ * This creates a new socket. This is a plain pass-through constructor
+ * to the socket() syscall. In most cases this should only be used by
+ * a derivate.
+ * @param sock_type socket type, either TCP or UDP
+ * @param timeout See Socket::timeout.
+ * @exception SocketException thrown if socket cannot be opened, check errno for cause
+ */
+Socket::Socket(SocketType sock_type, float timeout)
+	: sock_fd(-1), timeout(timeout), client_addr(NULL), client_addr_len(0),
+	  socket_addr_family_(-1), socket_protocol_(0)
+{
+	if (sock_type == TCP) {
+	  socket_type_ = SOCK_STREAM;
+  } else if (sock_type == UDP) {
+	  socket_type_ = SOCK_DGRAM;
+  } else {
+	  throw Exception("Unknown socket type");
+  }
 }
 
 
@@ -177,11 +208,9 @@ Socket::Socket(int domain, int type, int protocol, float timeout)
  * properly.
  */
 Socket::Socket()
+	: sock_fd(-1), timeout(0.f), client_addr(NULL), client_addr_len(0),
+	  socket_addr_family_(0), socket_type_(0), socket_protocol_(0)
 {
-  client_addr = NULL;
-  client_addr_len = 0;
-  timeout = 0.f;
-  sock_fd = -1;
 }
 
 
@@ -191,8 +220,11 @@ Socket::Socket()
 Socket::Socket(Socket &socket)
 {
   if ( socket.client_addr != NULL ) {
-    client_addr = (struct ::sockaddr_in *)malloc(socket.client_addr_len);
-    client_addr_len = socket.client_addr_len;
+	  if (socket.client_addr_len > sizeof(struct ::sockaddr_storage)) {
+		  throw SocketException("Invalid client socket address length");
+	  }
+	  client_addr = (struct ::sockaddr_storage *)malloc(sizeof(struct ::sockaddr_storage));
+	  client_addr_len = sizeof(struct ::sockaddr_storage);
     memcpy(client_addr, socket.client_addr, client_addr_len);
   } else {
     client_addr = NULL;
@@ -200,6 +232,29 @@ Socket::Socket(Socket &socket)
   }    
   timeout = socket.timeout;
   sock_fd = socket.sock_fd;
+  socket_addr_family_ = socket.socket_addr_family_;
+  socket_type_ = socket.socket_type_;
+  socket_protocol_ = socket.socket_protocol_;
+}
+
+void
+Socket::create()
+{
+	if (sock_fd != -1)  return;
+	if (socket_addr_family_ == -1) {
+		throw UnknownTypeException("Invalid socket address family, wrong constructor called?");
+	}
+	
+  if ( (sock_fd = socket(socket_addr_family_, socket_type_, socket_protocol_)) == -1 ) {
+	  throw SocketException(errno, "Could not open socket");
+  }
+
+  if (timeout > 0.f) {
+    // set to non-blocking
+    if ( fcntl(sock_fd, F_SETFL, O_NONBLOCK) == -1 ) {
+	    throw SocketException(errno, "Could not set socket to non-blocking");
+    }
+  }
 }
 
 
@@ -230,31 +285,45 @@ Socket::close()
  * you call this on a datagram socket you will tune in to a specific sender and
  * receiver.
  * @param addr_port struct containing address and port to connect to
- * @param struct_size size of addr_port struct
  * @exception SocketException thrown if socket cannot connect, check errno for cause
  */
 void
-Socket::connect(struct sockaddr *addr_port, unsigned int struct_size)
+Socket::connect(const struct ::sockaddr_storage &addr_port)
 {
-  if ( sock_fd == -1 )  throw SocketException("Trying to connect invalid socket");
+	connect((const struct sockaddr *)&addr_port, sizeof(::sockaddr_storage));
+}
 
-  if (timeout == 0.f) {
-    if ( ::connect(sock_fd, addr_port, struct_size) < 0 ) {
-      throw SocketException("Could not connect", errno);
-    }
-  } else {
-    struct timeval start, now;
-    gettimeofday(&start, NULL);
-    do {
-      if ( ::connect(sock_fd, addr_port, struct_size) < 0 ) {
-	if ( (errno != EINPROGRESS) &&
-	     (errno != EALREADY) ) {
-	  throw SocketException("Could not connect", errno);
+/** Connect socket.
+ * If called for a stream socket this will connect to the remote address. If
+ * you call this on a datagram socket you will tune in to a specific sender and
+ * receiver.
+ * @param addr_port struct containing address and port to connect to
+ * @param struct_size size of addr_port struct
+ * @exception SocketException thrown if socket cannot connect, check errno for cause
+ */
+void
+Socket::connect(const struct sockaddr *addr_port, socklen_t struct_size)
+{
+	if ( sock_fd != -1 )  throw SocketException("Socket already initialized and connected");
+
+	create();
+  
+	if (timeout == 0.f) {
+		if ( ::connect(sock_fd, addr_port, struct_size) < 0 ) {
+			throw SocketException(errno, "Could not connect");
+		}
+	} else {
+		struct timeval start, now;
+		gettimeofday(&start, NULL);
+		do {
+			if ( ::connect(sock_fd, addr_port, struct_size) < 0 ) {
+				if ( (errno != EINPROGRESS) && (errno != EALREADY) ) {
+					throw SocketException(errno, "Could not connect");
+				}
+			}
+			gettimeofday(&now, NULL);
+	  } while (time_diff_sec(now, start) < timeout);
 	}
-      }
-      gettimeofday(&now, NULL);
-    } while (time_diff_sec(now, start) < timeout);
-  }
 }
 
 
@@ -269,23 +338,65 @@ Socket::connect(struct sockaddr *addr_port, unsigned int struct_size)
 void
 Socket::connect(const char *hostname, unsigned short int port)
 {
-  if ( sock_fd == -1 )  throw SocketException("Trying to connect invalid socket");
+	if ( sock_fd != -1 )  throw SocketException("Socket already initialized and connected");
 
-  struct hostent* h;
-  struct ::sockaddr_in host;
+	struct addrinfo hints, *servinfo, *p;
+	int rv;
 
+	std::string tried_endpoints;
 
-  h = gethostbyname(hostname);
-  if ( ! h ) {
-    throw SocketException("Cannot lookup hostname", h_errno);
-  }
+	std::string port_s = StringConversions::to_string((unsigned int)port);
+	
+	memset(&hints, 0, sizeof(hints));
+	hints.ai_family = AF_UNSPEC;
+	hints.ai_socktype = socket_type_;
+	if ((rv = getaddrinfo(hostname, port_s.c_str(), &hints, &servinfo)) != 0) {
+		throw SocketException("getaddrinfo failed: %s", gai_strerror(rv));
+	}
 
-  memset(&host, 0, sizeof(host));
-  host.sin_family = AF_INET;
-  memcpy((char *)&host.sin_addr.s_addr, h->h_addr, h->h_length);
-  host.sin_port = htons(port);
+	for (p = servinfo; p != NULL; p = p->ai_next) {
+		bool failed = false;
+		if ((sock_fd = socket(p->ai_family, p->ai_socktype, p->ai_protocol)) == -1) {
+			failed = true;
+		}
+
+		if (! failed) {
+			if (::connect(sock_fd, p->ai_addr, p->ai_addrlen) == -1) {
+				::close(sock_fd);
+				sock_fd = -1;
+				failed = true;
+			}
+		}
+
+		if (failed) {
+			if (p->ai_family == AF_INET) {
+				char tmp[INET_ADDRSTRLEN];
+				if (inet_ntop(p->ai_family, &((struct sockaddr_in *)p->ai_addr)->sin_addr, tmp, INET_ADDRSTRLEN) != NULL) {
+					tried_endpoints += std::string(" IPv4:") + tmp + ":" + port_s;
+				} else {
+					tried_endpoints += std::string(" IPv4:FAIL") + tmp + ":" + port_s;
+				}
+			} else if (p->ai_family == AF_INET6) {
+				char tmp[INET6_ADDRSTRLEN];
+				if (inet_ntop(p->ai_family, &((struct sockaddr_in6 *) p->ai_addr)->sin6_addr, tmp, INET6_ADDRSTRLEN) != NULL) {
+					tried_endpoints += std::string(" IPv6:[") + tmp + "]:" + port_s;
+				} else {
+					tried_endpoints += std::string(" IPv6:FAIL") + tmp + ":" + port_s;
+				}
+			} else {
+				tried_endpoints += std::string(" UNKNOWN_AF:") + port_s;
+			}
+
+			continue;
+		} else {
+			// Connected succesfully!
+			break;
+		}
+	}
 
-  connect((struct sockaddr *)&host, sizeof(host));
+	if (p == NULL || sock_fd == -1) {
+		throw Exception("Failed to connect to any endpoint (tried:%s)", tried_endpoints.c_str());
+	}
 }
 
 
@@ -297,51 +408,120 @@ Socket::connect(const char *hostname, unsigned short int port)
 void
 Socket::bind(const unsigned short int port)
 {
-  struct ::sockaddr_in host;
-
-  host.sin_family = AF_INET;
-  host.sin_addr.s_addr = INADDR_ANY;
-  host.sin_port = htons(port);
-
-  int reuse = 1;
-  if ( setsockopt(sock_fd, SOL_SOCKET, SO_REUSEADDR, &reuse, sizeof(reuse)) == -1) {
-    throw SocketException("Could not set SO_REUSEADDR", errno);
-  }
+	if ( sock_fd != -1 )  throw SocketException("Socket already initialized and connected");
+	create();
+
+	switch (addr_type) {
+	case IPv4:
+		{
+			struct ::sockaddr_in host;
+			memset(&host, 0, sizeof(host));
+	
+			host.sin_family = AF_INET;
+			host.sin_addr.s_addr = INADDR_ANY;
+			host.sin_port = htons(port);
+
+			int reuse = 1;
+			if ( setsockopt(sock_fd, SOL_SOCKET, SO_REUSEADDR, &reuse, sizeof(reuse)) == -1) {
+				throw SocketException(errno, "Could not set SO_REUSEADDR");
+			}
+
+			if (::bind(sock_fd, (struct sockaddr *) &host, sizeof(host)) < 0) {
+				throw SocketException(errno, "Could not bind to port");
+			}
+		}
+		break;
+	case IPv6:
+		{
+			struct ::sockaddr_in6 host;
+			memset(&host, 0, sizeof(host));
+	
+			host.sin6_family = AF_INET6;
+			host.sin6_port = htons(port);
+
+			int on = 1;
+			if ( setsockopt(sock_fd, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on)) == -1) {
+				throw SocketException(errno, "Could not set SO_REUSEADDR");
+			}
+			if ( setsockopt(sock_fd, IPPROTO_IPV6, IPV6_V6ONLY, &on, sizeof(on)) == -1) {
+				throw SocketException(errno, "Could not set IPV6_V6ONLY");
+			}
+
+			if (::bind(sock_fd, (struct sockaddr *) &host, sizeof(host)) < 0) {
+				throw SocketException(errno, "Could not bind to port");
+			}
+		}
+		break;
+	default:
+		throw SocketException("Address type not specified for socket, cannot bind");
+	}
 
-  if (::bind(sock_fd, (struct sockaddr *) &host, sizeof(host)) < 0) {
-    throw SocketException("Could not bind to port", errno);
-  }
 }
 
 
 /** Bind socket to a specific address.
  * @param port port to bind
- * @param hostname hostname or textual IP address of a local interface to bind to.
+ * @param ipaddr textual IP address of a local interface to bind to, must match the address
+ * type passed to the constructor.
  * @exception SocketException thrown if socket cannot bind, check errno for cause
  */
 void
-Socket::bind(const unsigned short int port, const char *hostname)
+Socket::bind(const unsigned short int port, const char *ipaddr)
 {
-  struct hostent* h;
-  struct ::sockaddr_in host;
-
-  h = gethostbyname(hostname);
-  if ( ! h ) {
-    throw SocketException("Cannot lookup hostname", h_errno);
-  }
-
-  memset(&host, 0, sizeof(host));
-  host.sin_family = AF_INET;
-  memcpy(&host.sin_addr.s_addr, h->h_addr, h->h_length);
-  host.sin_port = htons(port);
-
-  host.sin_family = AF_INET;
-  host.sin_addr.s_addr = INADDR_ANY;
-  host.sin_port = htons(port);
-
-  if (::bind(sock_fd, (struct sockaddr *) &host, sizeof(host)) < 0) {
-    throw SocketException("Could not bind to port", errno);
-  }
+	if ( sock_fd != -1 )  throw SocketException("Socket already initialized and connected");
+	create();
+
+	switch (addr_type) {
+	case IPv4:
+		{
+			struct ::sockaddr_in host;
+			memset(&host, 0, sizeof(host));
+
+			host.sin_family = AF_INET;
+			host.sin_port = htons(port);
+
+			if (inet_pton(AF_INET, ipaddr, &host.sin_addr) <= 0) {
+				throw SocketException("bind(IPv4): failed to parse IP address '%s'", ipaddr);
+			}
+
+			int reuse = 1;
+			if ( setsockopt(sock_fd, SOL_SOCKET, SO_REUSEADDR, &reuse, sizeof(reuse)) == -1) {
+				throw SocketException(errno, "Could not set SO_REUSEADDR");
+			}
+
+			if (::bind(sock_fd, (struct sockaddr *) &host, sizeof(host)) < 0) {
+				throw SocketException(errno, "Could not bind to port");
+			}
+		}
+		break;
+	case IPv6:
+		{
+			struct ::sockaddr_in6 host;
+			memset(&host, 0, sizeof(host));
+	
+			host.sin6_family = AF_INET6;
+			host.sin6_port = htons(port);
+
+			if (inet_pton(AF_INET6, ipaddr, &host.sin6_addr) <= 0) {
+				throw SocketException("bind(IPv6): failed to parse IP address '%s'", ipaddr);
+			}
+
+			int on = 1;
+			if ( setsockopt(sock_fd, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on)) == -1) {
+				throw SocketException(errno, "Could not set SO_REUSEADDR");
+			}
+			if ( setsockopt(sock_fd, IPPROTO_IPV6, IPV6_V6ONLY, &on, sizeof(on)) == -1) {
+				throw SocketException(errno, "Could not set IPV6_V6ONLY");
+			}
+
+			if (::bind(sock_fd, (struct sockaddr *) &host, sizeof(host)) < 0) {
+				throw SocketException(errno, "Could not bind to port");
+			}
+		}
+		break;
+	default:
+		throw SocketException("Address type not specified for socket, cannot bind");
+	}
 }
 
 
@@ -356,8 +536,12 @@ Socket::bind(const unsigned short int port, const char *hostname)
 void
 Socket::listen(int backlog)
 {
-  if ( ::listen(sock_fd, backlog) ) {
-    throw SocketException("Cannot listen on socket", errno);
+	if (sock_fd == -1) {
+		throw SocketException("Socket not initialized, call bind() or connect()");
+	}
+
+	if ( ::listen(sock_fd, backlog) ) {
+		throw SocketException(errno, "Cannot listen on socket");
   }
 }
 
@@ -370,7 +554,11 @@ Socket::listen(int backlog)
 Socket *
 Socket::accept()
 {
-  struct ::sockaddr_in  tmp_client_addr;
+	if (sock_fd == -1) {
+		throw SocketException("Socket not initialized, call bind() or connect()");
+	}
+
+	struct ::sockaddr_in  tmp_client_addr;
   unsigned int  tmp_client_addr_len = sizeof(struct ::sockaddr_in);
 
   int a_sock_fd = -1;
@@ -378,7 +566,7 @@ Socket::accept()
   a_sock_fd = ::accept(sock_fd, (sockaddr *)&tmp_client_addr, &tmp_client_addr_len);
   if ( a_sock_fd == -1 ) {
     if (errno != EWOULDBLOCK) {
-      throw SocketException("Could not accept connection", errno);
+	    throw SocketException(errno, "Could not accept connection");
     } else {
       return NULL;
     }
@@ -394,10 +582,12 @@ Socket::accept()
   if ( s->client_addr != NULL ) {
     free(s->client_addr);
   }
+  /*
   struct ::sockaddr_in  *tmp_client_addr_alloc = (struct ::sockaddr_in *)malloc(sizeof(struct ::sockaddr_in));
   memcpy(tmp_client_addr_alloc, &tmp_client_addr, sizeof(struct ::sockaddr_in));
   s->client_addr = tmp_client_addr_alloc;
   s->client_addr_len = tmp_client_addr_len;
+  */
 
   return s;
 }
@@ -463,7 +653,7 @@ Socket::poll(int timeout, short what)
     if ( errno == EINTR ) {
       throw InterruptedException();
     } else {
-      throw SocketException("poll() failed", errno);
+	    throw SocketException(errno, "poll() failed");
     }
   } else {
     return pfd.revents;
@@ -480,7 +670,11 @@ Socket::poll(int timeout, short what)
 void
 Socket::write(const void *buf, size_t count)
 {
-  int retval = 0;
+	if (sock_fd == -1) {
+		throw SocketException("Socket not initialized, call bind() or connect()");
+	}
+
+	int retval = 0;
   unsigned int bytes_written = 0;
   struct timeval start, now;
 
@@ -490,7 +684,7 @@ Socket::write(const void *buf, size_t count)
     retval = ::write(sock_fd, (char *)buf + bytes_written, count - bytes_written);
     if (retval == -1) {
       if (errno != EAGAIN) {
-	throw SocketException("Could not write data", errno);
+	      throw SocketException(errno, "Could not write data");
       } else {
 	// just to meet loop condition
 	retval = 0;
@@ -524,7 +718,11 @@ Socket::write(const void *buf, size_t count)
 size_t
 Socket::read(void *buf, size_t count, bool read_all)
 {
-  int retval = 0;
+	if (sock_fd == -1) {
+		throw SocketException("Socket not initialized, call bind() or connect()");
+	}
+
+	int retval = 0;
   unsigned int bytes_read = 0;
 
   if ( timeout > 0 ) {
@@ -537,7 +735,7 @@ Socket::read(void *buf, size_t count, bool read_all)
 	retval = ::read(sock_fd, (char *)buf + bytes_read, count - bytes_read);
 	if (retval == -1) {
 	  if (errno != EAGAIN) {
-	    throw SocketException("Could not read data", errno);
+		  throw SocketException(errno, "Could not read data");
 	  } else {
 	    // just to meet loop condition
 	    retval = 0;
@@ -554,7 +752,7 @@ Socket::read(void *buf, size_t count, bool read_all)
       do {
 	retval = ::read(sock_fd, (char *)buf, count);
 	if ( (retval == -1) && (errno != EAGAIN) ) {
-	  throw SocketException("Could not read data", errno);
+		throw SocketException(errno, "Could not read data");
 	} else {
 	  bytes_read = retval;
 	}
@@ -566,7 +764,7 @@ Socket::read(void *buf, size_t count, bool read_all)
       do {
 	retval = ::read(sock_fd, (char *)buf + bytes_read, count - bytes_read);
 	if (retval == -1) {
-	  throw SocketException("Could not read data", errno);
+		throw SocketException(errno, "Could not read data");
 	} else if (retval == 0) {
 	  throw SocketException("Could not read any data");
 	} else {
@@ -578,7 +776,7 @@ Socket::read(void *buf, size_t count, bool read_all)
       do {
 	retval = ::read(sock_fd, (char *)buf, count);
 	if ( (retval == -1) && (errno != EAGAIN) ) {
-	  throw SocketException("Could not read data", errno);
+		throw SocketException(errno, "Could not read data");
 	} else {
 	  bytes_read = retval;
 	}
@@ -627,9 +825,13 @@ Socket::send(void *buf, size_t buf_len)
 size_t
 Socket::recv(void *buf, size_t buf_len)
 {
-  ssize_t rv;
+	if (sock_fd == -1) {
+		throw SocketException("Socket not initialized, call bind() or connect()");
+	}
+
+	ssize_t rv;
   if ( (rv = ::recv(sock_fd, buf, buf_len, 0)) == -1 ) {
-    throw SocketException("recv() failed", errno);
+	  throw SocketException(errno, "recv() failed");
   } else if ( rv == 0 ) {
     throw SocketException("Other side closed the connection");
   }
@@ -647,7 +849,11 @@ void
 Socket::send(void *buf, size_t buf_len,
 	     const struct sockaddr *addr, socklen_t addr_len)
 {
-  int retval = 0;
+	if (sock_fd == -1) {
+		throw SocketException("Socket not initialized, call bind() or connect()");
+	}
+
+	int retval = 0;
   unsigned int bytes_written = 0;
   struct timeval start, now;
 
@@ -658,7 +864,7 @@ Socket::send(void *buf, size_t buf_len,
 		      addr, addr_len);
     if (retval == -1) {
       if (errno != EAGAIN) {
-	throw SocketException("Could not read data", errno);
+	      throw SocketException(errno, "Could not read data");
       } else {
 	// just to meet loop condition
 	retval = 0;
@@ -693,10 +899,14 @@ size_t
 Socket::recv(void *buf, size_t buf_len,
 	     struct sockaddr *addr, socklen_t *addr_len)
 {
-  ssize_t rv = 0;
+	if (sock_fd == -1) {
+		throw SocketException("Socket not initialized, call bind() or connect()");
+	}
+
+	ssize_t rv = 0;
 
   if ( (rv = ::recvfrom(sock_fd, buf, buf_len, 0, addr, addr_len)) == -1) {
-    throw SocketException("recvfrom() failed", errno);
+	  throw SocketException(errno, "recvfrom() failed");
   } else if ( rv == 0 ) {
     throw SocketException("Peer has closed the connection");
   } else {
@@ -716,7 +926,7 @@ Socket::listening()
   int i = 0;
   unsigned int len = sizeof(i);
   if ( getsockopt(sock_fd, SOL_SOCKET, SO_ACCEPTCONN, &i, &len) == -1 ) {
-    throw SocketException("Socket::listening(): getsockopt failed", errno);
+	  throw SocketException(errno, "Socket::listening(): getsockopt failed");
   }
   return ( i == 1 );
 }
@@ -729,14 +939,16 @@ Socket::listening()
 unsigned int
 Socket::mtu()
 {
-  int m = 0;
+	if (sock_fd == -1) {
+		throw SocketException("Socket not initialized, call bind() or connect()");
+	}
 
-  if ( sock_fd == -1 ) throw SocketException("Cannot get MTU of disconnected socket");
+	int m = 0;
 
 #ifdef __linux__
   unsigned int len = sizeof(m);
   if ( getsockopt(sock_fd, IPPROTO_IP, IP_MTU, &m, &len) == -1 ) {
-    throw SocketException("Socket::mtu(): getsockopt failed", errno);
+	  throw SocketException(errno, "Socket::mtu(): getsockopt failed");
   }
 
   if ( m < 0 ) {
diff --git a/src/libs/netcomm/socket/socket.h b/src/libs/netcomm/socket/socket.h
index 3f6cf8a..234bc40 100644
--- a/src/libs/netcomm/socket/socket.h
+++ b/src/libs/netcomm/socket/socket.h
@@ -58,8 +58,8 @@ namespace fawkes {
 class SocketException : public Exception
 {
  public:
-  SocketException(const char *msg, int _errno);
-  SocketException(const char *msg);
+	SocketException(int _errno, const char *msg);
+	SocketException(const char *format, ...);
 };
 
 class Socket
@@ -74,16 +74,29 @@ class Socket
   static const short POLL_HUP;
   static const short POLL_NVAL;
 
-  Socket(int domain, int type, int protocol, float timeout = 0.f);
+  /** Address type specification. */
+  typedef enum {
+	  UNSPECIFIED,	/**< Yet unknown address type */
+	  IPv4,					/**< IPv4 */
+	  IPv6					/**< IPv6 */
+  } AddrType;
+
+  /** Socket type. */
+  typedef enum {
+	  TCP,		/**< TCP stream socket */
+	  UDP			/**< UDP datagram socket */
+  } SocketType;
+  
+  Socket(AddrType addr_type, SocketType sock_type, float timeout = 0.f);
   Socket(Socket &socket);
   virtual ~Socket();
 
   virtual void         connect(const char *hostname, const unsigned short int port);
-  virtual void         connect(struct sockaddr *addr_port, unsigned int struct_size);
+  virtual void         connect(const struct ::sockaddr_storage &addr_port);
+  virtual void         connect(const struct sockaddr *addr_port, socklen_t struct_size);
 
   virtual void         bind(const unsigned short int port);
-  virtual void         bind(const unsigned short int port,
-			    const char *hostname);
+  virtual void         bind(const unsigned short int port, const char *ipaddr);
 
   virtual void         listen(int backlog = 1);
   virtual Socket *     accept();
@@ -120,12 +133,22 @@ class Socket
     SocketType *     accept();
 
  protected:
+  Socket(SocketType sock_type, float timeout = 0.f);
   Socket();
 
+  AddrType addr_type;
   int sock_fd;
   float timeout;
-  struct ::sockaddr_in  *client_addr;
-  unsigned int         client_addr_len;
+  struct ::sockaddr_storage  *client_addr;
+  unsigned int                client_addr_len;
+
+  
+ private:
+  int socket_addr_family_;
+  int socket_type_;
+  int socket_protocol_;
+
+  void create();
 
 };
 
diff --git a/src/libs/netcomm/socket/stream.cpp b/src/libs/netcomm/socket/stream.cpp
index de921cc..ed97dee 100644
--- a/src/libs/netcomm/socket/stream.cpp
+++ b/src/libs/netcomm/socket/stream.cpp
@@ -40,11 +40,22 @@ namespace fawkes {
  */
 
 /** Constructor.
+ * This assumes that the socket will later be created using connect().
  * @param timeout timeout, if 0 all operationsare blocking, otherwise it
  * is tried for timeout seconds.
  */
 StreamSocket::StreamSocket(float timeout)
-  : Socket(PF_INET, SOCK_STREAM, 0, timeout)
+	: Socket(Socket::TCP, timeout)
+{
+}
+
+/** Constructor.
+ * @param addr_type Specify IPv4 or IPv6
+ * @param timeout timeout, if 0 all operationsare blocking, otherwise it
+ * is tried for timeout seconds.
+ */
+StreamSocket::StreamSocket(AddrType addr_type, float timeout)
+	: Socket(addr_type, Socket::TCP, timeout)
 {
 }
 
@@ -77,8 +88,12 @@ StreamSocket::clone()
 bool
 StreamSocket::nodelay()
 {
+	if (sock_fd == -1) {
+		throw Exception("Socket not initialized, call bind() or connect()");
+	}
+	
   int val = 0;
- socklen_t val_len = sizeof(val);
+  socklen_t val_len = sizeof(val);
   if ( getsockopt(sock_fd, IPPROTO_TCP, TCP_NODELAY, &val, &val_len) == -1 ) {
     throw SocketException("StreamSocket::nodelay: getsockopt failed", errno);
   }
@@ -93,7 +108,11 @@ StreamSocket::nodelay()
 void
 StreamSocket::set_nodelay(bool nodelay)
 {
-  int val = (nodelay ? 1 : 0);
+	if (sock_fd == -1) {
+		throw Exception("Socket not initialized, call bind() or connect()");
+	}
+
+	int val = (nodelay ? 1 : 0);
   socklen_t val_len = sizeof(val);
   if ( setsockopt(sock_fd, IPPROTO_TCP, TCP_NODELAY, &val, val_len) == -1 ) {
     throw SocketException("StreamSocket::set_nodelay: setsockopt failed", errno);
diff --git a/src/libs/netcomm/socket/stream.h b/src/libs/netcomm/socket/stream.h
index 5d85419..fd967c8 100644
--- a/src/libs/netcomm/socket/stream.h
+++ b/src/libs/netcomm/socket/stream.h
@@ -31,7 +31,8 @@ namespace fawkes {
 class StreamSocket : public Socket
 {
  public:
-  StreamSocket(float timeout = 0.f);
+	StreamSocket(float timeout = 0.f);
+	StreamSocket(AddrType addr_type, float timeout = 0.f);
   StreamSocket(StreamSocket &s);
 
   virtual Socket *  clone();

- *commit* b2740fcfdb02b619f4678e35163860e1f04dc0ec - - - - - - - - - -
Author:  Tim Niemueller <niemueller at kbsg.rwth-aachen.de>
Date:    Mon Dec 12 17:52:12 2016 +0100
Subject: netcomm: acceptor thread that supports address type and listen address

 src/libs/netcomm/utils/acceptor_thread.cpp |   34 ++++++++++++++++++++++++++++
 src/libs/netcomm/utils/acceptor_thread.h   |   16 ++++++++++---
 2 files changed, 46 insertions(+), 4 deletions(-)

_Diff for modified files_:
diff --git a/src/libs/netcomm/utils/acceptor_thread.cpp b/src/libs/netcomm/utils/acceptor_thread.cpp
index efecd40..534b16e 100644
--- a/src/libs/netcomm/utils/acceptor_thread.cpp
+++ b/src/libs/netcomm/utils/acceptor_thread.cpp
@@ -61,6 +61,40 @@ NetworkAcceptorThread::NetworkAcceptorThread(NetworkIncomingConnectionHandler *h
   }
 }
 
+	/** Constructor.
+ * @param handler Connection handler for newly accepted incoming connections.
+ * @param addr_type Specify IPv4 or IPv6
+ * @param listen_addr IP address to listen on (format depends on addr_type), nullptr to listen
+ * on any local (address type specific) address, e.g., :: for IPv6.
+ * @param port port to listen on for incoming connections
+ * @param thread_name name of the thread
+ * @exception SocketException as thrown by StreamSocket connstructor, bind and listen.
+ */
+NetworkAcceptorThread::NetworkAcceptorThread(NetworkIncomingConnectionHandler *handler,
+                                             Socket::AddrType addr_type,
+                                             const std::string &listen_addr,
+                                             unsigned short int port,
+                                             const char *thread_name)
+  : Thread(thread_name)
+{
+  __handler = handler;
+  __port    = port;
+
+  set_prepfin_conc_loop(true);
+
+  try {
+    __socket = new StreamSocket(addr_type);
+    if (listen_addr.empty()) {
+	    __socket->bind(__port);
+    } else {
+	    __socket->bind(__port, listen_addr.c_str());
+    }
+    __socket->listen();
+  } catch (SocketException &e) {
+    throw;
+  }
+}
+
 
 /** Constructor.
  * @param handler Connection handler for newly accepted incoming connections.
diff --git a/src/libs/netcomm/utils/acceptor_thread.h b/src/libs/netcomm/utils/acceptor_thread.h
index da01b6d..7b61e59 100644
--- a/src/libs/netcomm/utils/acceptor_thread.h
+++ b/src/libs/netcomm/utils/acceptor_thread.h
@@ -25,6 +25,9 @@
 #define __NETCOMM_UTILS_ACCEPTOR_THREAD_H_
 
 #include <core/threading/thread.h>
+#include <netcomm/socket/socket.h>
+
+#include <string>
 
 namespace fawkes {
 
@@ -34,12 +37,17 @@ class NetworkIncomingConnectionHandler;
 class NetworkAcceptorThread : public Thread
 {
  public:
+	NetworkAcceptorThread(NetworkIncomingConnectionHandler *handler,
+	                      unsigned short int port,
+	                      const char *thread_name = "NetworkAcceptorThread");
   NetworkAcceptorThread(NetworkIncomingConnectionHandler *handler,
-			unsigned short int port,
-			const char *thread_name = "NetworkAcceptorThread");
+                        Socket::AddrType addr_type,
+                        const std::string &listen_addr,
+                        unsigned short int port,
+                        const char *thread_name = "NetworkAcceptorThread");
   NetworkAcceptorThread(NetworkIncomingConnectionHandler *handler,
-			StreamSocket *socket,
-			const char *thread_name = "NetworkAcceptorThread");
+                        StreamSocket *socket,
+                        const char *thread_name = "NetworkAcceptorThread");
   ~NetworkAcceptorThread();
 
   virtual void loop();

- *commit* c49c7b2a0a9f54e16daaba0329cc054bba5ebb9f - - - - - - - - - -
Author:  Tim Niemueller <niemueller at kbsg.rwth-aachen.de>
Date:    Mon Dec 12 17:54:34 2016 +0100
Subject: netcomm: IPv6 support for fawkes protocol

 src/libs/netcomm/fawkes/client.cpp          |   70 ++++++++-------------------
 src/libs/netcomm/fawkes/client.h            |   13 ++---
 src/libs/netcomm/fawkes/network_manager.cpp |   18 +++++--
 src/libs/netcomm/fawkes/network_manager.h   |   10 +++-
 src/libs/netcomm/fawkes/server_thread.cpp   |   48 +++++++++++++-----
 src/libs/netcomm/fawkes/server_thread.h     |   11 +++-
 6 files changed, 89 insertions(+), 81 deletions(-)

_Diff for modified files_:
diff --git a/src/libs/netcomm/fawkes/client.cpp b/src/libs/netcomm/fawkes/client.cpp
index 00289c8..0b278f9 100644
--- a/src/libs/netcomm/fawkes/client.cpp
+++ b/src/libs/netcomm/fawkes/client.cpp
@@ -209,7 +209,7 @@ class FawkesNetworkClientRecvThread : public Thread
 
   /** Receive and process messages. */
   void recv()
-  {
+	{
     std::list<unsigned int> wakeup_list;
 
     try {
@@ -292,15 +292,13 @@ class FawkesNetworkClientRecvThread : public Thread
  */
 
 /** Constructor.
- * @param hostname remote host to connect to.
+ * @param host remote host to connect to.
  * @param port port to connect to.
- * @param ip optional: use ip to connect, and hostname for cosmetic purposes
  */
-FawkesNetworkClient::FawkesNetworkClient(const char *hostname, unsigned short int port, const char *ip)
+FawkesNetworkClient::FawkesNetworkClient(const char *host, unsigned short int port)
 {
-  __hostname = strdup(hostname);
-  __ip = ip ? strdup(ip) : NULL;
-  __port     = port;
+  __host = strdup(host);
+  __port = port;
 
   s = NULL;
   __send_slave = NULL;
@@ -330,9 +328,8 @@ FawkesNetworkClient::FawkesNetworkClient(const char *hostname, unsigned short in
  */
 FawkesNetworkClient::FawkesNetworkClient()
 {
-  __hostname = NULL;
-  __ip = NULL;
-  __port     = 0;
+  __host = NULL;
+  __port = 0;
 
   s = NULL;
   __send_slave = NULL;
@@ -358,16 +355,14 @@ FawkesNetworkClient::FawkesNetworkClient()
 
 /** Constructor.
  * @param id id of the client.
- * @param hostname remote host to connect to.
+ * @param host remote host to connect to.
  * @param port port to connect to.
- * @param ip optional: use ip to connect, and hostname for cosmetic purposes
  */
-FawkesNetworkClient::FawkesNetworkClient(unsigned int id, const char *hostname,
-                                         unsigned short int port, const char *ip)
+FawkesNetworkClient::FawkesNetworkClient(unsigned int id, const char *host,
+                                         unsigned short int port)
 {
-  __hostname = strdup(hostname);
-  __ip = ip ? strdup(ip) : NULL;
-  __port     = port;
+  __host = strdup(host);
+  __port = port;
 
   s = NULL;
   __send_slave = NULL;
@@ -397,8 +392,7 @@ FawkesNetworkClient::~FawkesNetworkClient()
   disconnect();
 
   delete s;
-  if (__hostname) free(__hostname);
-  if (__ip) free(__ip);
+  if (__host) free(__host);
   delete slave_status_mutex;
 
   delete __connest_waitcond;
@@ -415,7 +409,7 @@ FawkesNetworkClient::~FawkesNetworkClient()
 void
 FawkesNetworkClient::connect()
 {
-  if ( __hostname == NULL && __ip == NULL) {
+  if ( __host == NULL ) {
     throw NullPointerException("Hostname not set. Cannot connect.");
   }
 
@@ -428,7 +422,7 @@ FawkesNetworkClient::connect()
 
   try {
     s = new StreamSocket();
-    s->connect(__ip ? __ip : __hostname, __port);
+    s->connect(__host, __port);
     __send_slave = new FawkesNetworkClientSendThread(s, this);
     __send_slave->start();
     __recv_slave = new FawkesNetworkClientRecvThread(s, this, __recv_mutex);
@@ -469,32 +463,17 @@ FawkesNetworkClient::connect()
 }
 
 
-/** Connect to new host and port.
- * @param hostname new hostname to connect to
- * @param port new port to connect to
- * @see connect() Look there for more documentation and notes about possible
- * exceptions.
- */
-void
-FawkesNetworkClient::connect(const char *hostname, unsigned short int port)
-{
-  connect(hostname, NULL, port);
-}
-
 /** Connect to new ip and port, and set hostname.
- * @param hostname remote host name
- * @param ip new ip to connect to
+ * @param host remote host name
  * @param port new port to connect to
  * @see connect() Look there for more documentation and notes about possible
  * exceptions.
  */
 void
-FawkesNetworkClient::connect(const char *hostname, const char *ip, unsigned short int port)
+FawkesNetworkClient::connect(const char *host, unsigned short int port)
 {
-  if (__hostname)  free(__hostname);
-  if (__ip) free(__ip);
-  __hostname = strdup(hostname);
-  __ip = ip ? strdup(ip) : NULL;
+  if (__host)  free(__host);
+  __host = strdup(host);
   __port = port;
   connect();
 }
@@ -830,16 +809,7 @@ FawkesNetworkClient::id() const
 const char *
 FawkesNetworkClient::get_hostname() const
 {
-  return __hostname;
-}
-
-/** Get the client's ip
- * @return ip or NULL
- */
-const char *
-FawkesNetworkClient::get_ip() const
-{
-  return __ip;
+  return __host;
 }
 
 } // end namespace fawkes
diff --git a/src/libs/netcomm/fawkes/client.h b/src/libs/netcomm/fawkes/client.h
index d40369e..773bc77 100644
--- a/src/libs/netcomm/fawkes/client.h
+++ b/src/libs/netcomm/fawkes/client.h
@@ -54,15 +54,14 @@ class FawkesNetworkClient
  friend class FawkesNetworkClientRecvThread;
  public:
  FawkesNetworkClient();
- FawkesNetworkClient(const char *hostname, unsigned short int port, const char *ip = NULL);
- FawkesNetworkClient(unsigned int id, const char *hostname, 
-                     unsigned short int port, const char *ip = NULL);
+ FawkesNetworkClient(const char *host, unsigned short int port);
+ FawkesNetworkClient(unsigned int id, const char *host, 
+                     unsigned short int port);
   ~FawkesNetworkClient();
 
   void connect();
   void disconnect();
-  void connect(const char *hostname, unsigned short int port);
-  void connect(const char *hostname, const char *ip, unsigned short int port);
+  void connect(const char *host, unsigned short int port);
 
   void enqueue(FawkesNetworkMessage *message);
   void enqueue_and_wait(FawkesNetworkMessage *message, unsigned int timeout_sec = 15);
@@ -81,7 +80,6 @@ class FawkesNetworkClient
   unsigned int id() const;
 
   const char *get_hostname() const;
-  const char *get_ip() const;
 
  private:
   void recv();
@@ -94,8 +92,7 @@ class FawkesNetworkClient
   void set_send_slave_alive();
   void set_recv_slave_alive();
 
-  char *__hostname;
-  char *__ip;
+  char *__host;
   unsigned short int __port;
 
   StreamSocket *s;
diff --git a/src/libs/netcomm/fawkes/network_manager.cpp b/src/libs/netcomm/fawkes/network_manager.cpp
index 8864262..16de25c 100644
--- a/src/libs/netcomm/fawkes/network_manager.cpp
+++ b/src/libs/netcomm/fawkes/network_manager.cpp
@@ -52,17 +52,27 @@ namespace fawkes {
 
 /** Constructor.
  * @param thread_collector thread collector that threads shall be registered to
+ * @param enable_ipv4 true to listen on the IPv4 TCP port
+ * @param enable_ipv6 true to listen on the IPv6 TCP port
+ * @param listen_ipv4 IPv4 address to listen on for incoming connections,
+ * empty string or 0.0.0.0 to listen on any local address
+ * @param listen_ipv6 IPv6 address to listen on for incoming connections,
+ * empty string or :: to listen on any local address
  * @param fawkes_port port to listen on for Fawkes network connections
  * @param service_name Avahi service name for Fawkes network service
  */
 FawkesNetworkManager::FawkesNetworkManager(ThreadCollector *thread_collector,
-					   unsigned short int fawkes_port,
-					   const char *service_name)
+                                           bool enable_ipv4, bool enable_ipv6,
+                                           const std::string &listen_ipv4, const std::string &listen_ipv6,
+                                           unsigned short int fawkes_port,
+                                           const char *service_name)
 {
   __fawkes_port      = fawkes_port;
   __thread_collector = thread_collector;
-  __fawkes_network_thread = new FawkesNetworkServerThread(__fawkes_port,
-							  __thread_collector);
+  __fawkes_network_thread = new FawkesNetworkServerThread(enable_ipv4, enable_ipv6,
+                                                          listen_ipv4, listen_ipv6,
+                                                          __fawkes_port,
+                                                          __thread_collector);
   __thread_collector->add(__fawkes_network_thread);
 #ifdef HAVE_AVAHI
   __avahi_thread          = new AvahiThread();
diff --git a/src/libs/netcomm/fawkes/network_manager.h b/src/libs/netcomm/fawkes/network_manager.h
index 339a3c0..2a46500 100644
--- a/src/libs/netcomm/fawkes/network_manager.h
+++ b/src/libs/netcomm/fawkes/network_manager.h
@@ -24,6 +24,8 @@
 #ifndef __FAWKES_NETWORK_MANAGER_H_
 #define __FAWKES_NETWORK_MANAGER_H_
 
+#include <string>
+
 namespace fawkes {
 #if 0 /* just to make Emacs auto-indent happy */
 }
@@ -40,9 +42,11 @@ class ServiceBrowser;
 class FawkesNetworkManager
 {
  public:
-  FawkesNetworkManager(ThreadCollector *thread_collector,
-		       unsigned short int fawkes_port,
-		       const char *service_name);
+	FawkesNetworkManager(ThreadCollector *thread_collector,
+	                     bool enable_ipv4, bool enable_ipv6,
+	                     const std::string &listen_ipv4, const std::string &listen_ipv6,
+                       unsigned short int fawkes_port,
+                       const char *service_name);
   ~FawkesNetworkManager();
 
   FawkesNetworkHub *     hub();
diff --git a/src/libs/netcomm/fawkes/server_thread.cpp b/src/libs/netcomm/fawkes/server_thread.cpp
index 0df9364..3aa2809 100644
--- a/src/libs/netcomm/fawkes/server_thread.cpp
+++ b/src/libs/netcomm/fawkes/server_thread.cpp
@@ -47,11 +47,19 @@ namespace fawkes {
  */
 
 /** Constructor.
- * @param thread_collector thread collector to register new threads with
+ * @param enable_ipv4 true to listen on the IPv4 TCP port
+ * @param enable_ipv6 true to listen on the IPv6 TCP port
+ * @param listen_ipv4 IPv4 address to listen on for incoming connections,
+ * nullptr or 0.0.0.0 to listen on any local address
+ * @param listen_ipv6 IPv6 address to listen on for incoming connections,
+ * nullptr or :: to listen on any local address
  * @param fawkes_port port for Fawkes network protocol
+ * @param thread_collector thread collector to register new threads with
  */
-FawkesNetworkServerThread::FawkesNetworkServerThread(unsigned int fawkes_port,
-						     ThreadCollector *thread_collector)
+FawkesNetworkServerThread::FawkesNetworkServerThread(bool enable_ipv4, bool enable_ipv6,
+                                                     const std::string &listen_ipv4, const std::string &listen_ipv6,
+                                                     unsigned int fawkes_port,
+                                                     ThreadCollector *thread_collector)
   : Thread("FawkesNetworkServerThread", Thread::OPMODE_WAITFORWAKEUP)
 {
   this->thread_collector = thread_collector;
@@ -59,12 +67,23 @@ FawkesNetworkServerThread::FawkesNetworkServerThread(unsigned int fawkes_port,
   next_client_id = 1;
   inbound_messages = new FawkesNetworkMessageQueue();
 
-  acceptor_thread = new NetworkAcceptorThread(this, fawkes_port,
-					      "FawkesNetworkAcceptorThread");
+  if (enable_ipv4) {
+	  acceptor_threads.push_back(new NetworkAcceptorThread(this, Socket::IPv4, listen_ipv4, fawkes_port,
+	                                                       "FawkesNetworkAcceptorThread"));
+  }
+  if (enable_ipv6) {
+	  acceptor_threads.push_back(new NetworkAcceptorThread(this, Socket::IPv6, listen_ipv6, fawkes_port,
+	                                                       "FawkesNetworkAcceptorThread"));
+  }
+		  
   if ( thread_collector ) {
-    thread_collector->add(acceptor_thread);
+	  for (size_t i = 0; i < acceptor_threads.size(); ++i) {
+		  thread_collector->add(acceptor_threads[i]);
+	  }
   } else {
-    acceptor_thread->start();
+	  for (size_t i = 0; i < acceptor_threads.size(); ++i) {
+		  acceptor_threads[i]->start();
+	  }
   }
 }
 
@@ -81,13 +100,16 @@ FawkesNetworkServerThread::~FawkesNetworkServerThread()
     }
     delete (*cit).second;
   }
-  if ( thread_collector ) {
-    thread_collector->remove(acceptor_thread);
-  } else {
-    acceptor_thread->cancel();
-    acceptor_thread->join();
+  for (size_t i = 0; i < acceptor_threads.size(); ++i) {
+	  if ( thread_collector ) {
+		  thread_collector->remove(acceptor_threads[i]);
+	  } else {
+		  acceptor_threads[i]->cancel();
+		  acceptor_threads[i]->join();
+	  }
+	  delete acceptor_threads[i];
   }
-  delete acceptor_thread;
+  acceptor_threads.clear();
 
   delete inbound_messages;
 }
diff --git a/src/libs/netcomm/fawkes/server_thread.h b/src/libs/netcomm/fawkes/server_thread.h
index aa8097d..28b72a9 100644
--- a/src/libs/netcomm/fawkes/server_thread.h
+++ b/src/libs/netcomm/fawkes/server_thread.h
@@ -29,6 +29,9 @@
 #include <netcomm/fawkes/hub.h>
 #include <netcomm/utils/incoming_connection_handler.h>
 
+#include <vector>
+#include <string>
+
 namespace fawkes {
 
 class ThreadCollector;
@@ -46,8 +49,10 @@ class FawkesNetworkServerThread
   public NetworkIncomingConnectionHandler
 {
  public:
-  FawkesNetworkServerThread(unsigned int fawkes_port,
-			    ThreadCollector *thread_collector = 0);
+  FawkesNetworkServerThread(bool enable_ipv4, bool enable_ipv6,
+                            const std::string &listen_ipv4, const std::string &listen_ipv6,
+                            unsigned int fawkes_port,
+                            ThreadCollector *thread_collector = 0);
   virtual ~FawkesNetworkServerThread();
 
   virtual void loop();
@@ -81,7 +86,7 @@ class FawkesNetworkServerThread
  private:
   ThreadCollector       *thread_collector;
   unsigned int           next_client_id;
-  NetworkAcceptorThread *acceptor_thread;
+  std::vector<NetworkAcceptorThread *> acceptor_threads;
 
   // key: component id,  value: handler
   LockMap<unsigned int, FawkesNetworkHandler *> handlers;

- *commit* 816bac4b2315ceb101a8ddedab25cc13efb37b68 - - - - - - - - - -
Author:  Tim Niemueller <niemueller at kbsg.rwth-aachen.de>
Date:    Mon Dec 12 17:55:38 2016 +0100
Subject: utils: extend host/port parsing for IPv6

 src/libs/utils/system/argparser.cpp |  139 +++++++++++++++++++++++++---------
 src/libs/utils/system/argparser.h   |    4 +
 2 files changed, 106 insertions(+), 37 deletions(-)

_Diff for modified files_:
diff --git a/src/libs/utils/system/argparser.cpp b/src/libs/utils/system/argparser.cpp
index 47e618f..68f0583 100644
--- a/src/libs/utils/system/argparser.cpp
+++ b/src/libs/utils/system/argparser.cpp
@@ -231,29 +231,81 @@ bool
 ArgumentParser::parse_hostport(const char *argn, char **host,
 			       unsigned short int *port)
 {
-  if ((__opts.count(argn) > 0) && (__opts[argn] != NULL)) {
-    char *tmpvalue = strdup(__opts[ (char *)argn ]);
-
-    if ( strchr(tmpvalue, ':') != NULL ) {
-      char *save_ptr;
-      *host = strtok_r(tmpvalue, ":", &save_ptr);
-      char *tmpport = strtok_r(NULL, "", &save_ptr);
-
-      int port_num = atoi(tmpport);
-      if ( (port_num < 0) || (port_num > 0xFFFF) ) {
-	throw OutOfBoundsException("Invalid port", port_num, 0, 0xFFFF);
-      }
-      *port = port_num;
-    } else {
-      *host = tmpvalue;
-    }
-
-    return true;
-  } else {
-    return false;
+	if ((__opts.count(argn) > 0) && (__opts[argn] != NULL)) {
+		parse_hostport_s(__opts[ (char *)argn ], host, port);
+		return true;
+	} else {
+		return false;
   }
 }
 
+/** Parse host:port string.
+ * The value referenced by the given argn is parsed for the pattern "host:port".
+ * If the string does not match this pattern an exception is thrown.
+ * The host will be a newly allocated copy of the string. You have to
+ * free it after you are done with it. If no port is supplied in the string (plain
+ * hostname string) the port argument is left unchanged. If the argument has not
+ * been supplied at all both values are left unchanged. Thus it is safe to put the
+ * default values into the variables before passing them to this method. Note
+ * however that you have to free the returned host string in case of a successful
+ * return, and only in that case probably!
+ * @param s string to parse
+ * @param host Upon successful return contains a pointer to a newly alloated string
+ * with the hostname part. Free it after you are finished.
+ * @param port upon successful return contains the port part
+ * @return true, if the argument was supplied, false otherwise
+ * @exception Exception thrown on parsing error
+ */
+void
+ArgumentParser::parse_hostport_s(const char *s, char **host,
+                                 unsigned short int *port)
+{
+	std::string tmp = s;
+	size_t num_colons = 0;
+	std::string::size_type idx = 0;
+	while ((idx = tmp.find(':', idx)) != std::string::npos) {
+		idx += 1;
+		num_colons += 1;
+	}
+
+	if (num_colons == 1) {
+		idx = tmp.find(':');
+		*host = strdup(tmp.substr(0, idx).c_str());
+		*port = atoi(tmp.substr(idx+1).c_str());
+	} else if (num_colons > 1) {
+		// IPv6
+		if (tmp[0] == '[') {
+			// notation that actually contains a port
+			std::string::size_type closing_idx = tmp.find(']');
+			if (closing_idx == std::string::npos) {
+				throw Exception("No closing bracket for IPv6 address");
+			} else if (closing_idx < (tmp.length() - 1)) {
+				// there might be a port
+				if (tmp[closing_idx + 1] != ':') {
+					throw Exception("Expected colon after closing IPv6 address bracket");
+				} else if (closing_idx > tmp.length() - 3) {
+					throw Exception("Malformed IPv6 address with port, not enough characters after closing bracket");
+				} else {
+					*host = strdup(tmp.substr(1, closing_idx - 1).c_str());
+					*port = atoi(tmp.substr(closing_idx + 2).c_str());
+				}
+			} else {
+				// Just an IPv6 in bracket notation
+				*host = strdup(tmp.substr(1, closing_idx - 2).c_str());
+				*port = 0;
+			}
+		} else {
+			// no port, just an IPv6 address
+			*host = strdup(tmp.c_str());
+			*port = 0;
+		}
+	} else {
+		// no port given
+		*host = strdup(tmp.c_str());
+		*port = 0;
+	}
+}
+
 
 /** Parse host:port string.
  * The value referenced by the given argn is parsed for the pattern "host:port". If the
@@ -273,24 +325,37 @@ ArgumentParser::parse_hostport(const char *argn, std::string &host, unsigned sho
 {
   if ((__opts.count(argn) == 0) || (__opts[argn] == NULL)) return false;
 
-  std::string tmpvalue = __opts[argn];
-
-  size_t col_idx = tmpvalue.find_last_of(':');
-  if ( col_idx == tmpvalue.npos ) {
-    host = tmpvalue;
+  char *tmp_host = NULL;
+  unsigned short int tmp_port = 0;
+  if (parse_hostport(argn, &tmp_host, &tmp_port)) {
+	  host = tmp_host;
+	  port = tmp_port;
+	  return true;
   }
-  else
-  {
-    host = tmpvalue.substr(0, col_idx);
-    std::string tmpport = tmpvalue.substr(col_idx + 1);
-
-    int port_num = atoi(tmpport.c_str());
-    if ( (port_num < 0) || (port_num > 0xFFFF) ) {
-      throw OutOfBoundsException("Invalid port", port_num, 0, 0xFFFF);
-    }
-    port = port_num;
-  }
-  return true;
+  return false;
+}
+
+/** Parse host:port string.
+ * The value referenced by the given argn is parsed for the pattern "host:port". If the
+ * string does not match this pattern an exception is thrown.
+ * If no port is supplied in the string (plain
+ * hostname string) the port argument is left unchanged. If the argument has not
+ * been supplied at all both values are left unchanged. Thus it is safe to put the default
+ * values into the variables before passing them to this method.
+ * @param s string to parse
+ * @param host Upon successful return contains the hostname part
+ * @param port upon successful return contains the port part (unchanged if not supplied)
+ * @return true, if the argument was supplied, false otherwise
+ * @exception OutOfBoundsException thrown if port is not in the range [0..65535]
+ */
+void
+ArgumentParser::parse_hostport_s(const char *s, std::string &host, unsigned short int &port)
+{
+  char *tmp_host = NULL;
+  unsigned short int tmp_port = 0;
+  parse_hostport_s(s, &tmp_host, &tmp_port);
+  host = tmp_host;
+  port = tmp_port;
 }
 
 
diff --git a/src/libs/utils/system/argparser.h b/src/libs/utils/system/argparser.h
index 21bfc80..148a047 100644
--- a/src/libs/utils/system/argparser.h
+++ b/src/libs/utils/system/argparser.h
@@ -77,6 +77,10 @@ class ArgumentParser
 
   bool         parse_hostport(const char *argn, char **host, unsigned short int *port);
   bool         parse_hostport(const char *argn, std::string &host, unsigned short int &port);
+
+  static void  parse_hostport_s(const char *s, char **host, unsigned short int *port);
+  static void  parse_hostport_s(const char *s, std::string &host, unsigned short int &port);
+  
   long int     parse_int(const char *argn);
   double       parse_float(const char *argn);
 

- *commit* cad79d2dbca77b8d6a0dc9639d8db7a1a030f083 - - - - - - - - - -
Author:  Tim Niemueller <niemueller at kbsg.rwth-aachen.de>
Date:    Mon Dec 12 17:58:07 2016 +0100
Subject: gui_utils: increase service chooser dialog default size

 src/libs/gui_utils/service_chooser_dialog.cpp |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

_Diff for modified files_:
diff --git a/src/libs/gui_utils/service_chooser_dialog.cpp b/src/libs/gui_utils/service_chooser_dialog.cpp
index a60891c..3ed88f9 100644
--- a/src/libs/gui_utils/service_chooser_dialog.cpp
+++ b/src/libs/gui_utils/service_chooser_dialog.cpp
@@ -106,7 +106,7 @@ ServiceChooserDialog::~ServiceChooserDialog()
 void
 ServiceChooserDialog::ctor()
 {
-  set_default_size(360, 240);
+  set_default_size(400, 300);
 
   __treeview.set_model(__service_model->get_list_store());
   __treeview.append_column("Service", __service_model->get_column_record().name);

- *commit* 26c8e9bd4c8b50dbbe195df8c4164cb50ea98600 - - - - - - - - - -
Author:  Tim Niemueller <niemueller at kbsg.rwth-aachen.de>
Date:    Mon Dec 12 18:00:07 2016 +0100
Subject: gui_utils: remove direct ipaddr access, use generic host:port parsing

 src/libs/gui_utils/Makefile                   |    2 +-
 src/libs/gui_utils/service_chooser_dialog.cpp |   50 +++++++------------------
 src/libs/gui_utils/service_chooser_dialog.h   |    2 +-
 3 files changed, 16 insertions(+), 38 deletions(-)

_Diff for modified files_:
diff --git a/src/libs/gui_utils/Makefile b/src/libs/gui_utils/Makefile
index 2f4839a..1f65a78 100644
--- a/src/libs/gui_utils/Makefile
+++ b/src/libs/gui_utils/Makefile
@@ -22,7 +22,7 @@ CFLAGS  += $(CFLAGS_GUI)
 LDFLAGS += $(LDFLAGS_GUI)
 
 LIBS_libfawkesguiutils = stdc++ m fawkescore fawkesnetcomm fawkesblackboard \
-			 fawkesinterface fawkesplugin fawkeslogging
+			 fawkesinterface fawkesplugin fawkeslogging fawkesutils
 OBJS_libfawkesguiutils = $(patsubst %.cpp,%.o,$(patsubst qa/%,,$(subst $(SRCDIR)/,,$(realpath $(wildcard $(SRCDIR)/*.cpp $(SRCDIR)/*/*.cpp)))))
 HDRS_libfawkesguiutils = $(subst $(SRCDIR)/,,$(wildcard $(SRCDIR)/*.h $(SRCDIR)/*/*.h))
 
diff --git a/src/libs/gui_utils/service_chooser_dialog.cpp b/src/libs/gui_utils/service_chooser_dialog.cpp
index 3ed88f9..64bd732 100644
--- a/src/libs/gui_utils/service_chooser_dialog.cpp
+++ b/src/libs/gui_utils/service_chooser_dialog.cpp
@@ -27,6 +27,7 @@
 #include <netcomm/utils/resolver.h>
 #include <gui_utils/service_chooser_dialog.h>
 #include <gui_utils/service_model.h>
+#include <utils/system/argparser.h>
 
 #include <algorithm>
 #include <cstring>
@@ -164,43 +165,22 @@ ServiceChooserDialog::ctor()
  * string of the host that has the service and the port.
  * @param name name of the service
  * @param hostname hostname of the host associated with the service
- * @param ipaddr upon successful return contains the IP address as string
  * @param port upon successful return contains the port
  * @exception Exception thrown if no service has been selected
  */
 void
 ServiceChooserDialog::get_selected_service(Glib::ustring &name,
-					   Glib::ustring &hostname,
-					   Glib::ustring &ipaddr,
-					   unsigned short int &port)
+                                           Glib::ustring &hostname,
+                                           unsigned short int &port)
 {
   Glib::RefPtr<Gtk::TreeSelection> treesel = __treeview.get_selection();
   if (__expander.get_expanded() && !__treeview.has_focus()) {
     if ( __entry.get_text_length() > 0 ) {
-      char *tmpvalue = strdup(__entry.get_text().c_str());
-
-      if ( strchr(tmpvalue, ':') != NULL ) {
-	char *save_ptr;
-	hostname = strtok_r(tmpvalue, ":", &save_ptr);
-	char *tmpport = strtok_r(NULL, "", &save_ptr);
-
-	int port_num = atoi(tmpport);
-	if ( (port_num < 0) || (port_num > 0xFFFF) ) {
-	  throw OutOfBoundsException("Invalid port", port_num, 0, 0xFFFF);
-	}
-	port = port_num;
-      } else {
-	hostname = tmpvalue;
-	port = 0;
-      }
-
-      // evil, but Glib::Regex is only availabel in ver >= 2.14, n/a on maemo
-      ipaddr = hostname;
-
-      name = hostname;
-
-      free(tmpvalue);
-      return;
+	    std::string tmp_hostname;
+	    ArgumentParser::parse_hostport_s(__entry.get_text().c_str(), tmp_hostname, port);
+	    hostname = tmp_hostname;
+	    name = hostname;
+	    return;
     }
   }
 
@@ -209,7 +189,6 @@ ServiceChooserDialog::get_selected_service(Glib::ustring &name,
     Gtk::TreeModel::Row row = *iter;
     name     = row[__service_model->get_column_record().name];
     hostname = row[__service_model->get_column_record().hostname];
-    ipaddr   = row[__service_model->get_column_record().ipaddr];
     port     = row[__service_model->get_column_record().port];
 
   } else {
@@ -226,11 +205,12 @@ ServiceChooserDialog::get_selected_service(Glib::ustring &name,
 void
 ServiceChooserDialog::get_raw_address(struct sockaddr *addr, socklen_t addr_size)
 {
+	/*
   if ( addr_size < sizeof(struct sockaddr_in) ) {
     throw Exception("Size of addrlen too small, only %u bytes, but required %zu\n",
 		    addr_size, sizeof(struct sockaddr_in));
   }
-  Glib::ustring name, hostname, ipaddr;
+  Glib::ustring name, hostname;
   unsigned short int port;
   get_selected_service (name, hostname, ipaddr, port);
 
@@ -245,7 +225,7 @@ ServiceChooserDialog::get_raw_address(struct sockaddr *addr, socklen_t addr_size
 		      ipaddr.c_str());
     }
   }
-
+	*/
 }
 
 
@@ -281,12 +261,10 @@ ServiceChooserDialog::run_and_connect()
     try {
       Glib::ustring name;
       Glib::ustring hostname;
-      Glib::ustring ipaddr;
-      unsigned short int port;
-      get_selected_service(name, hostname, ipaddr, port);
-      if ( port == 0 )  port = 1910;
+      unsigned short int port = 1910;
+      get_selected_service(name, hostname, port);
 
-      __client->connect(hostname.c_str(), ipaddr.c_str(), port);
+      __client->connect(hostname.c_str(), port);
     } catch (Exception &e) {
       Glib::ustring message = *(e.begin());
       Gtk::MessageDialog md(__parent, message, /* markup */ false,
diff --git a/src/libs/gui_utils/service_chooser_dialog.h b/src/libs/gui_utils/service_chooser_dialog.h
index dfff72b..dbe9e3c 100644
--- a/src/libs/gui_utils/service_chooser_dialog.h
+++ b/src/libs/gui_utils/service_chooser_dialog.h
@@ -59,7 +59,7 @@ class ServiceChooserDialog
   virtual ~ServiceChooserDialog();
 
   void get_selected_service(Glib::ustring &name, Glib::ustring &hostname,
-			    Glib::ustring &ipaddr, unsigned short int &port);
+                            unsigned short int &port);
   void get_raw_address(struct sockaddr *addr, socklen_t addr_size);
 
   void run_and_connect();

- *commit* 20eff8ca60075b389c3b35df91c8fcd6285961a2 - - - - - - - - - -
Author:  Tim Niemueller <niemueller at kbsg.rwth-aachen.de>
Date:    Mon Dec 12 18:02:31 2016 +0100
Subject: libbaseapp: support IPv4/IPv6 configuration

 src/libs/baseapp/run.cpp |   24 ++++++++++++++++++++++--
 1 files changed, 22 insertions(+), 2 deletions(-)

_Diff for modified files_:
diff --git a/src/libs/baseapp/run.cpp b/src/libs/baseapp/run.cpp
index f721eca..5cda9cb 100644
--- a/src/libs/baseapp/run.cpp
+++ b/src/libs/baseapp/run.cpp
@@ -289,6 +289,10 @@ init(InitOptions options, int & retval)
   }
 
   // *** Determine network parameters
+  bool enable_ipv4 = true;
+  bool enable_ipv6 = true;
+  std::string listen_ipv4;
+  std::string listen_ipv6;
   unsigned int net_tcp_port     = 1910;
   std::string  net_service_name = "Fawkes on %h";
   if (options.has_net_tcp_port()) {
@@ -313,6 +317,20 @@ init(InitOptions options, int & retval)
     net_tcp_port = 1910;
   }
 
+  try {
+	  enable_ipv4 = config->get_bool("/fawkes/mainapp/net/ipv4/enable");
+  } catch (Exception &e) {}  // ignore, we stick with the default
+  try {
+	  enable_ipv6 = config->get_bool("/fawkes/mainapp/net/ipv6/enable");
+  } catch (Exception &e) {}  // ignore, we stick with the default
+
+  try {
+	  listen_ipv4 = config->get_string("/fawkes/mainapp/net/ipv4/listen");
+  } catch (Exception &e) {}  // ignore, we stick with the default
+  try {
+	  listen_ipv6 = config->get_string("/fawkes/mainapp/net/ipv6/listen");
+  } catch (Exception &e) {}  // ignore, we stick with the default
+
   // *** Setup blackboard
   std::string bb_magic_token = "";
   unsigned int bb_size = 2097152;
@@ -359,8 +377,10 @@ init(InitOptions options, int & retval)
 					 options.plugin_module_flags(),
 					 options.init_plugin_cache());
   network_manager    = new FawkesNetworkManager(thread_manager,
-						net_tcp_port,
-						net_service_name.c_str());
+                                                enable_ipv4, enable_ipv6,
+                                                listen_ipv4, listen_ipv6,
+                                                net_tcp_port,
+                                                net_service_name.c_str());
   nethandler_config  = new ConfigNetworkHandler(config,
 						network_manager->hub());
 

- *commit* a1d300072d62a60b124db799b72f0c4bd9db1484 - - - - - - - - - -
Author:  Tim Niemueller <niemueller at kbsg.rwth-aachen.de>
Date:    Mon Dec 12 18:05:25 2016 +0100
Subject: netloggui: remove dependence on direct IP access from service chooser

 src/tools/netloggui/netloggui.cpp |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

_Diff for modified files_:
diff --git a/src/tools/netloggui/netloggui.cpp b/src/tools/netloggui/netloggui.cpp
index 7870fbc..0e0204d 100644
--- a/src/tools/netloggui/netloggui.cpp
+++ b/src/tools/netloggui/netloggui.cpp
@@ -89,13 +89,13 @@ NetLogGuiGtkWindow::on_connection_clicked()
   if (ssd.run() ) {
     struct sockaddr_in saddr;
     socklen_t saddr_size = sizeof(struct sockaddr_in);
-    Glib::ustring name, hostname, ipaddr;
+    Glib::ustring name, hostname;
     unsigned short int port = 1910;
     std::list<std::string> txt;
     int page = -1;
 
     try {
-      ssd.get_selected_service (name, hostname, ipaddr, port);
+      ssd.get_selected_service (name, hostname, port);
       ssd.get_raw_address((struct sockaddr *)&saddr, saddr_size);
       NetworkService *service = new NetworkService(name.c_str(), "_fawkes._tcp", "",
 						   hostname.c_str(), port,
@@ -107,7 +107,7 @@ NetLogGuiGtkWindow::on_connection_clicked()
       if ( page >= 0 ) {
 	Gtk::ScrolledWindow *scrolled = dynamic_cast<Gtk::ScrolledWindow *>(ntb_logviewers.get_nth_page(page));
 	LogView *logview = dynamic_cast<LogView *>(scrolled->get_child());
-	logview->get_client()->connect(ipaddr.c_str(), port);
+	logview->get_client()->connect(hostname.c_str(), port);
       }
     } catch (Exception &e) {
       Glib::ustring message = *(e.begin());

- *commit* 9bad06818f45732777822bbf545ea2ac6959e147 - - - - - - - - - -
Author:  Tim Niemueller <niemueller at kbsg.rwth-aachen.de>
Date:    Mon Dec 12 18:06:19 2016 +0100
Subject: libs: mark new gui_utils dependency on utils

 src/libs/Makefile |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

_Diff for modified files_:
diff --git a/src/libs/Makefile b/src/libs/Makefile
index 14d0b54..3a4be5e 100644
--- a/src/libs/Makefile
+++ b/src/libs/Makefile
@@ -49,7 +49,7 @@ plugin: core netcomm utils config logging
 aspect: core utils blackboard netcomm config plugin webview logging tf pcl_utils
 lua: core utils blackboard config logging
 interfaces: core interface
-gui_utils: core netcomm blackboard interface plugin logging
+gui_utils: core netcomm blackboard interface plugin logging utils
 logging: core utils netcomm
 naoutils: core utils
 webview: core utils logging

- *commit* 03ed1a8a8097857aaba1dd6a4edf8beaead5a9a0 - - - - - - - - - -
Author:  Tim Niemueller <niemueller at kbsg.rwth-aachen.de>
Date:    Mon Dec 12 18:06:40 2016 +0100
Subject: ttmainloop: documentation fix

 src/plugins/ttmainloop/thread.cpp |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

_Diff for modified files_:
diff --git a/src/plugins/ttmainloop/thread.cpp b/src/plugins/ttmainloop/thread.cpp
index 69f02e4..c305ebf 100644
--- a/src/plugins/ttmainloop/thread.cpp
+++ b/src/plugins/ttmainloop/thread.cpp
@@ -27,7 +27,7 @@
 
 using namespace fawkes;
 
-/** @class TimeTrackerMainLoopThread <plugins/worldmodel/wm_thread.h>
+/** @class TimeTrackerMainLoopThread <plugins/ttmainloop/thread.h>
  * Main thread of time tracker main loop plugin.
  * @author Tim Niemueller
  */

- *commit* 8dd0c67a1e7d323ac9dd1466f1ad2d0602192cd1 - - - - - - - - - -
Author:  Tim Niemueller <niemueller at kbsg.rwth-aachen.de>
Date:    Mon Dec 12 18:07:15 2016 +0100
Subject: refboxcomm: specify IPv4 address type to sockets

 src/plugins/refboxcomm/processor/msl2010.cpp |    2 +-
 src/plugins/refboxcomm/processor/spl.cpp     |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

_Diff for modified files_:
diff --git a/src/plugins/refboxcomm/processor/msl2010.cpp b/src/plugins/refboxcomm/processor/msl2010.cpp
index 435675d..cd5df0a 100644
--- a/src/plugins/refboxcomm/processor/msl2010.cpp
+++ b/src/plugins/refboxcomm/processor/msl2010.cpp
@@ -146,7 +146,7 @@ Msl2010RefBoxProcessor::reconnect()
 		     __refbox_host, __refbox_port);
   try {
     __logger->log_info(__name, "Creating MulticastDatagramSocket");
-    __s = new MulticastDatagramSocket(__refbox_host, __refbox_port, 2.3);
+    __s = new MulticastDatagramSocket(Socket::IPv4, __refbox_host, __refbox_port, 2.3);
     //printf("set loop\n");
     __s->set_loop(true); // (re)receive locally sent stuff
     //printf("bind\n");
diff --git a/src/plugins/refboxcomm/processor/spl.cpp b/src/plugins/refboxcomm/processor/spl.cpp
index 1cae246..9d0ab4a 100644
--- a/src/plugins/refboxcomm/processor/spl.cpp
+++ b/src/plugins/refboxcomm/processor/spl.cpp
@@ -118,7 +118,7 @@ SplRefBoxProcessor::SplRefBoxProcessor(fawkes::Logger *logger,
   __team_number = team_number;
   __logger = logger;
   __quit = false;
-  __s = new DatagramSocket(0.0000000001);
+  __s = new DatagramSocket(Socket::IPv4, 0.0000000001);
   __s->bind(broadcast_port);
 
   __penalty = SPL_PENALTY_NONE;

- *commit* cf9f6e3b2c6d541fcb94eba2b914899b2ac8e555 - - - - - - - - - -
Author:  Tim Niemueller <niemueller at kbsg.rwth-aachen.de>
Date:    Mon Dec 12 18:08:02 2016 +0100
Subject: libconfig: support !ipv4 and !ipv6 tags in YAML config

 src/libs/config/yaml.cpp |   49 ++++++++++++++++++++++++++++++++++-----------
 1 files changed, 37 insertions(+), 12 deletions(-)

_Diff for modified files_:
diff --git a/src/libs/config/yaml.cpp b/src/libs/config/yaml.cpp
index 2ce2214..5c81630 100644
--- a/src/libs/config/yaml.cpp
+++ b/src/libs/config/yaml.cpp
@@ -40,6 +40,7 @@
 #include <cerrno>
 #include <dirent.h>
 #include <sys/stat.h>
+#include <arpa/inet.h>
 
 #include <yaml-cpp/exceptions.h>
 
@@ -821,20 +822,44 @@ YamlConfiguration::read_config_doc(const YAML::Node &doc, YamlConfigurationNode
     }
 
   } else if (doc.Type() == YAML::NodeType::Scalar) {
-    if (doc.Tag() == "tag:fawkesrobotics.org,cfg/tcp-port" ||
-	doc.Tag() == "tag:fawkesrobotics.org,cfg/udp-port")
+    if (doc.Tag() == "tag:fawkesrobotics.org,cfg/ipv4" ||
+        doc.Tag() == "tag:fawkesrobotics.org,cfg/ipv6")
     {
-      unsigned int p = 0;
-      try {
-	p = node->get_uint();
+	    std::string addr_s;
+	    try {
+		    addr_s = node->get_string();
       } catch (Exception &e) {
-	e.prepend("YamlConfig: %s: Invalid TCP/UDP port number (not an unsigned int)", path.c_str());
-	throw;
-      }
-      if (p <= 0 || p >= 65535) {
-	throw Exception("YamlConfig: Invalid TCP/UDP port number "
-			"(%u out of allowed range)", p);
-      }
+		    e.prepend("YamlConfig: %s: Invalid IPv4 or IPv6 address (not a string)", path.c_str());
+		    throw;
+	    }
+
+	    if (doc.Tag() == "tag:fawkesrobotics.org,cfg/ipv4") {
+		    struct in_addr addr;
+		    if (inet_pton(AF_INET, addr_s.c_str(), &addr) != 1) {
+			    throw Exception("YamlConfig: %s is not a valid IPv4 address", addr_s.c_str());
+		    }
+	    }
+	    if (doc.Tag() == "tag:fawkesrobotics.org,cfg/ipv6") {
+		    struct in6_addr addr;
+		    if (inet_pton(AF_INET6, addr_s.c_str(), &addr) != 1) {
+			    throw Exception("YamlConfig: %s is not a valid IPv6 address", addr_s.c_str());
+		    }
+	    }
+
+    } else if (doc.Tag() == "tag:fawkesrobotics.org,cfg/tcp-port" ||
+               doc.Tag() == "tag:fawkesrobotics.org,cfg/udp-port")
+    {
+	    unsigned int p = 0;
+	    try {
+		    p = node->get_uint();
+	    } catch (Exception &e) {
+		    e.prepend("YamlConfig: %s: Invalid TCP/UDP port number (not an unsigned int)", path.c_str());
+		    throw;
+	    }
+	    if (p <= 0 || p >= 65535) {
+		    throw Exception("YamlConfig: Invalid TCP/UDP port number "
+		                    "(%u out of allowed range)", p);
+	    }
     } else if (doc.Tag() == "tag:fawkesrobotics.org,cfg/url") {
 #ifdef HAVE_YAMLCPP_0_5
       std::string scalar = doc.Scalar();

- *commit* b62bc0d3c98028c2a5b5b9427b35b9c8e47e5c2e - - - - - - - - - -
Author:  Tim Niemueller <niemueller at kbsg.rwth-aachen.de>
Date:    Mon Dec 12 18:09:02 2016 +0100
Subject: config: proper IPv4/IPv6 default configuration

 cfg/config.yaml |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)

_Diff for modified files_:
diff --git a/cfg/config.yaml b/cfg/config.yaml
index d257499..82635c4 100644
--- a/cfg/config.yaml
+++ b/cfg/config.yaml
@@ -39,6 +39,18 @@ fawkes:
       # %h is replaced by short hostname
       service_name: "Fawkes on %h"
 
+      # Enable or disable IPv4 or IPv6 server port
+
+      # Set "listen" value to bind to a specific IP address of the
+      # host, rather than to "any" address, example shows how to bind
+      # for connections from the local host only
+      ipv4:
+        enable: true
+        #listen: !ipv4 127.0.0.1
+
+      ipv6:
+        enable: true
+        #listen: !ipv6 "::1"
 
 # Log level for ballposlog example plugin; sum of any of
 # debug=0, info=1, warn=2, error=4, none=8




-- 
Fawkes Robotics Framework                 http://www.fawkesrobotics.org


More information about the fawkes-commits mailing list