Collage  0.6.1
Public Member Functions | Friends
co::Zeroconf Class Reference

A zeroconf communicator. More...

#include <zeroconf.h>

List of all members.

Public Member Functions

CO_API Zeroconf (const Zeroconf &from)
 Create a copy of a zeroconf communicator.
CO_API ~Zeroconf ()
 Destruct this zeroconf communicator.
CO_API Zeroconfoperator= (const Zeroconf &rhs)
 Assign the data from another zeroconf communicator.
CO_API void set (const std::string &key, const std::string &value)
 Set a key/value pair to be announced.
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 (CO_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.

Definition at line 43 of file zeroconf.h.


Constructor & Destructor Documentation

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

Create a copy of a zeroconf communicator.

Destruct this zeroconf communicator.


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.
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.
CO_API Strings co::Zeroconf::getInstances ( ) const
Returns:
all instances found at the time of creation.
CO_API Strings co::Zeroconf::getKeys ( const std::string &  instance) const
Returns:
all keys discovered on the given instance.
CO_API Zeroconf& co::Zeroconf::operator= ( const Zeroconf rhs)

Assign the data from another zeroconf communicator.

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.


The documentation for this class was generated from the following file:
Generated on Mon Nov 26 2012 14:41:44 for Collage 0.6.1 by  doxygen 1.7.6.1