21 #ifndef OLAD_AVAHIDISCOVERYAGENT_H_
22 #define OLAD_AVAHIDISCOVERYAGENT_H_
24 #include <avahi-client/client.h>
25 #include <avahi-common/thread-watch.h>
26 #include <avahi-client/publish.h>
29 #include <ola/util/Backoff.h>
34 #include "olad/DiscoveryAgent.h"
50 const std::string &type,
63 AvahiEntryGroup *group,
64 AvahiEntryGroupState state);
75 const std::string service_name;
77 std::string actual_service_name;
79 AvahiEntryGroup *group;
80 AvahiEntryGroupState state;
83 ServiceEntry(
const std::string &service_name,
84 const std::string &type_spec,
88 std::string key()
const;
89 const std::string &type()
const {
return m_type; }
90 const std::vector<std::string> sub_types()
const {
return m_sub_types; }
93 std::string m_type_spec;
95 std::vector<std::string> m_sub_types;
98 typedef std::map<std::string, ServiceEntry*> Services;
100 AvahiThreadedPoll *m_threaded_poll;
101 AvahiClient *m_client;
102 AvahiTimeout *m_reconnect_timeout;
106 bool InternalRegisterService(ServiceEntry *service);
107 void CreateNewClient();
108 void UpdateServices();
109 void DeregisterAllServices();
110 void SetUpReconnectTimeout();
111 bool RenameAndRegister(ServiceEntry *service);
113 static std::string ClientStateToString(AvahiClientState state);
114 static std::string GroupStateToString(AvahiEntryGroupState state);
119 #endif // OLAD_AVAHIDISCOVERYAGENT_H_