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_
#define DISALLOW_COPY_AND_ASSIGN(TypeName)
Creates dummy copy constructor and assignment operator declarations.
Definition: Macro.h:44
void GroupStateChanged(const std::string &service_key, AvahiEntryGroup *group, AvahiEntryGroupState state)
Called when an entry group state changes.
Definition: AvahiDiscoveryAgent.cpp:233
void ClientStateChanged(AvahiClientState state, AvahiClient *client)
Called when the Avahi client state changes.
Definition: AvahiDiscoveryAgent.cpp:193
bool Init()
Initialize the DiscoveryAgent.
Definition: AvahiDiscoveryAgent.cpp:149
void RegisterService(const std::string &service_name, const std::string &type, uint16_t port, const RegisterOptions &options)
Register a service.
Definition: AvahiDiscoveryAgent.cpp:160
Definition: Backoff.h:123
Definition: AvahiDiscoveryAgent.cpp:52
Options for the RegisterService method.
Definition: DiscoveryAgent.h:49
The interface to DNS-SD operations like register, browse etc.
Definition: DiscoveryAgent.h:34
The namespace containing all OLA symbols.
Definition: Credentials.cpp:44
An implementation of DiscoveryAgentInterface that uses the Avahi client library.
Definition: AvahiDiscoveryAgent.h:42
void ReconnectTimeout()
Called when the reconnect timeout expires.
Definition: AvahiDiscoveryAgent.cpp:273