Collage  1.1.2
High-performance C++ library for developing object-oriented distributed applications.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Pages
co::Zeroconf Class Reference

A zeroconf communicator. More...

#include <zeroconf.h>

+ Collaboration diagram for co::Zeroconf:

Public Member Functions

CO_API Zeroconf (const Zeroconf &from)
 Create a copy of a zeroconf communicator. More...
 
CO_API ~Zeroconf ()
 Destruct this zeroconf communicator. More...
 
CO_API Zeroconfoperator= (const Zeroconf &rhs)
 Assign the data from another zeroconf communicator. More...
 
CO_API void set (const std::string &key, const std::string &value)
 Set a key/value pair to be announced. More...
 
CO_API Strings getInstances () const
 
CO_API Strings getKeys (const std::string &instance) const
 
CO_API bool containsKey (const std::string &instance, const std::string &key) const
 
CO_API const std::string & get (const std::string &instance, const std::string &key) const
 

Friends

class LocalNode
 

Detailed Description

A zeroconf communicator.

When Collage is compiled with Servus support (COLLAGE_USE_SERVUS), it uses the ZeroConf service "_collage._tcp" to announce the presence of a listening LocalNode using the zeroconf protocol, unless the LocalNode has no listening connections. This class may be used to add additional key/value pairs to this service to announce application-specific data, and to retrieve a snapshot of all key/value pairs of all discovered nodes on the network. Internal keys start with 'co_', this prefix should not be used by applications. Please refer to the documentation of lunchbox::Servus::set() for details.

When Collage is compiled without Servus support, this class implements dummy functionality.

See Also
LocalNode::getZeroconf()

Definition at line 46 of file zeroconf.h.

Constructor & Destructor Documentation

CO_API co::Zeroconf::Zeroconf ( const Zeroconf from)

Create a copy of a zeroconf communicator.

Version
1.0
CO_API co::Zeroconf::~Zeroconf ( )

Destruct this zeroconf communicator.

Version
1.0

Member Function Documentation

CO_API bool co::Zeroconf::containsKey ( const std::string &  instance,
const std::string &  key 
) const
Returns
true if the given key was discovered.
Version
1.0
CO_API const std::string& co::Zeroconf::get ( const std::string &  instance,
const std::string &  key 
) const
Returns
the value of the given key on the given instance.
Version
1.0
CO_API Strings co::Zeroconf::getInstances ( ) const
Returns
all instances found at the time of creation.
Version
1.0
CO_API Strings co::Zeroconf::getKeys ( const std::string &  instance) const
Returns
all keys discovered on the given instance.
Version
1.0
CO_API Zeroconf& co::Zeroconf::operator= ( const Zeroconf rhs)

Assign the data from another zeroconf communicator.

Version
1.0
CO_API void co::Zeroconf::set ( const std::string &  key,
const std::string &  value 
)

Set a key/value pair to be announced.

Keys should be at most eight characters, and values are truncated to 255 characters. The total length of all keys and values cannot exceed 65535 characters. Setting a value on an announced service causes an update which needs some time to propagate after this function returns.

Version
1.0

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