20 #ifndef SERVUS_SERVUS_H
21 #define SERVUS_SERVUS_H
24 #include <servus/result.h>
25 #include <servus/types.h>
31 namespace detail {
class Servus; }
64 SERVUS_API std::string
getString()
const override;
83 SERVUS_API
explicit Servus(
const std::string& name );
89 SERVUS_API
const std::string&
getName()
const;
103 SERVUS_API
void set(
const std::string& key,
const std::string& value );
106 SERVUS_API Strings
getKeys()
const;
109 SERVUS_API
const std::string&
get(
const std::string& key )
const;
120 const std::string& instance );
139 const unsigned browseTime );
169 SERVUS_API Strings
getKeys(
const std::string& instance )
const;
172 SERVUS_API
const std::string&
getHost(
const std::string& instance )
const;
175 SERVUS_API
bool containsKey(
const std::string& instance,
176 const std::string& key )
const;
179 SERVUS_API
const std::string&
get(
const std::string& instance,
180 const std::string& key )
const;
199 typedef std::map< std::string, std::map< std::string, std::string > > Data;
202 SERVUS_API
void getData( Data& data );
207 detail::Servus*
const _impl;
208 friend SERVUS_API std::ostream&
operator << ( std::ostream&,
213 SERVUS_API std::string getHostname();
216 SERVUS_API std::ostream& operator << ( std::ostream&,
const Servus& );
222 #endif // SERVUS_SERVUS_H
Result browse(int32_t timeout=-1)
Browse and process discovered key/value pairs.
Defines export visibility macros for library Servus.
void addListener(Listener *listener)
Add a listener which is invoked according to its supported callbacks.
A result returns an error code and behaves like a boolean.
virtual ~Result()
Destruct the result.
void removeListener(Listener *listener)
Remove a listener to stop invokation on its supported callbacks.
The ZeroConf operation result code.
virtual ~Servus()
Destruct this service.
Result beginBrowsing(const servus::Servus::Interface addr)
Begin the discovery of announced key/value pairs.
static bool isAvailable()
static const int32_t PENDING
operation did not complete.
friend std::ostream & operator<<(std::ostream &, const Servus &)
Output the servus instance in human-readable format.
Simple wrapper for ZeroConf key/value pairs.
Strings discover(const Interface addr, const unsigned browseTime)
Discover all announced key/value pairs.
static const int32_t POLL_ERROR
Error during polling for event.
void endBrowsing()
Stop a discovery process and return all results.
Result announce(const unsigned short port, const std::string &instance)
Start announcing the registered key/value pairs.
const std::string & getHost(const std::string &instance) const
Servus(const std::string &name)
Create a new service handle.
void set(const std::string &key, const std::string &value)
Set a key/value pair to be announced.
A listener interface which can be implemented to listen on changes of a Servus instance.
std::string getString() const override
void withdraw()
Stop announcing the registered key/value pairs.
Strings getInstances() const
bool containsKey(const std::string &instance, const std::string &key) const
static const int32_t NOT_SUPPORTED
Servus compiled without ZeroConf support.
const std::string & getName() const