Collage
0.6.1
|
A zeroconf communicator. More...
#include <zeroconf.h>
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 Zeroconf & | operator= (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 |
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.
CO_API co::Zeroconf::Zeroconf | ( | const Zeroconf & | from | ) |
Create a copy of a zeroconf communicator.
CO_API co::Zeroconf::~Zeroconf | ( | ) |
Destruct this zeroconf communicator.
CO_API bool co::Zeroconf::containsKey | ( | const std::string & | instance, |
const std::string & | key | ||
) | const |
CO_API const std::string& co::Zeroconf::get | ( | const std::string & | instance, |
const std::string & | key | ||
) | const |
CO_API Strings co::Zeroconf::getInstances | ( | ) | const |
CO_API Strings co::Zeroconf::getKeys | ( | const std::string & | instance | ) | const |
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.