Public Member Functions | Protected Attributes

wosh::bundles::DiscoveryUdpBundle Class Reference
[WOSH Bundles]

Implements Host Discovery service on top of UDP. More...

#include <H:/WOSH/win32_vc2010/src/bundles/DiscoveryUdp/DiscoveryUdpBundle.h>

List of all members.

Public Member Functions

 DiscoveryUdpBundle ()
 Empty constructor, init bundle and vars, Properties and Methods.
virtual ~DiscoveryUdpBundle ()
 Empty destructor, may (synch) stop bundle and internal threads when still running.
Discovery Interface
WRESULT doAnnounceLocalHost ()
 Start the discovery procedure of remote WOSH hosts. Announcement may be synchronous or asynchronous, but the discovery procedure is intrinsically asynchronous.

Protected Attributes

DiscoveryUdpImpldiscWorker
 real implementation based on wosh::BundleGenericWorker (worker thread)

Detailed Description

Implements Host Discovery service on top of UDP.

Discovery service enables the (reciprocal) discovery of WOSH hosts sending and receiving information as UDP datagrams. The service interacts with wosh::NetworkManager which holds the updated list of all known WOSH hosts of the wosh-network.

The DiscoveryUdpBundle service is (build and) installed on all WOSH Applications and represents the most common Host-Discovery service.

A sample configuration is available: 001_DiscoveryUdp.conf

The service runs an UDP server on local-host (you may bind it to ANY interface on most platforms) listening for incomin packets (sent by remote hosts); periodically it broadcast discovery-messages to one or more hosts (address/port), frequency is configurable.

Most important Properties are:

These fields and the important role of Discovery service is deeply related to WOSH Networking.

Network configuration notes
The internal UDP socket provides two useful functionalities:
  • It's capable of binding to ANY network-interface (on almost all platforms), in most case you may just leave the default binding address, DiscoveryUdp will listen on all interfaces (network-card) at port 8787
  • Allow broadcast packets (again it partially depends on the platform, but last subnet x.y.z.255 is always supported). In short, set the broadcast network-mask(s) of your host(s).

Suppose you have a LAN with two or more hosts, their IP looks like X.Y.Z.<NODE-id> (192.168.0.1, 192.168.0.56 and so on), then settings are the same for all hosts: Bind to '0.0.0.0:8787' and Broadcast to 'X.Y.Z.255:8787'. A more complex case is the following: one of these hosts is a sort of gateway and is connected to another LAN (as the wireless-network), let's say A.B.C (192.168.1.x), then just add 'A.B.C.255:8787' to the Broadcast list (of all hosts), so it looks like '192.168.0.255:8787;192.168.1.255:8787'.

Note:
The DiscoveryUdp service is not intented to discover WOSH hosts over the Internet (because of UDP routing and security-issues both), but only within a (local) trusted-network.
Packet format
Discovery packet is represented by DiscoveryUdpMessage, which implements (de)serialization routines.

Theorically almost all fields of WoshHost may be sent, actually only few of them are required by the WOSH networking-system. Most important fields included in package are:

Outgoing message Flow
DiscoveryUdpMessage is generated from local wosh::WoshHost, retrieved calling wosh::NetworkManager::getLocalWoshHost(). Sending action is always asynchronous (performed by internal thread).
inline_mscgraph_8
Incoming message Flow
Incoming datagrams are converted to wosh::WoshHost object and forwarded to wosh::NetworkManager::updateWoshHost().
inline_mscgraph_9

A typical log-output emphatizing the system-results of an incoming Discovery packet is:

I^18:39:26   NetworkManager:updateWoshHost(wosh28, 1,0, -2) Updated Host

DiscoveryUdp is a wrapper (bundle-adapter), real implementation is DiscoveryUdpImpl.

See also:
wosh::NetworkManager, wosh::WoshHost
wosh::interfaces::network::Discovery, wosh::interfaces::network::DiscoveryUdp
Version:
0.8.711
Id:
DiscoveryUdpBundle.h 3775 2011-01-01 16:38:17Z alex
Date:
Released Stable on 2011-01-14
Author:
Alessandro Polo

Definition at line 154 of file DiscoveryUdpBundle.h.


Constructor & Destructor Documentation

wosh::bundles::DiscoveryUdpBundle::DiscoveryUdpBundle (  )

Empty constructor, init bundle and vars, Properties and Methods.

Definition at line 52 of file DiscoveryUdpBundle.cpp.

References wosh::LOG_DEBUG.

wosh::bundles::DiscoveryUdpBundle::~DiscoveryUdpBundle (  ) [virtual]

Empty destructor, may (synch) stop bundle and internal threads when still running.

Definition at line 83 of file DiscoveryUdpBundle.cpp.

References wosh::LOG_DEBUG, wosh::LOG_VERBOSE, and wosh::LOG_WARNING.


Member Function Documentation

WRESULT wosh::bundles::DiscoveryUdpBundle::doAnnounceLocalHost (  ) [virtual]

Start the discovery procedure of remote WOSH hosts. Announcement may be synchronous or asynchronous, but the discovery procedure is intrinsically asynchronous.

Returns:
custom error codes; WRET_OK on success
See also:
wosh::NetworkManager::getLocalWoshHost()
wosh::NetworkManager::updateWoshHost()

Implements wosh::interfaces::network::Discovery.

Definition at line 157 of file DiscoveryUdpBundle.cpp.


Member Data Documentation

real implementation based on wosh::BundleGenericWorker (worker thread)

Definition at line 187 of file DiscoveryUdpBundle.h.


The documentation for this class was generated from the following files:

Generated on Tue Feb 8 2011 09:33:34 for WOSH system 0.8.888 [wolf] by Alessandro Polo, using DoxyGen 1.7.2 hosted by WOSH Framework