service_discovery
LocalService.hpp
Go to the documentation of this file.
1 #ifndef _SERVICE_DISCOVERYLOCALSERVICE_H_
2 #define _SERVICE_DISCOVERYLOCALSERVICE_H_
3 
4 #include <list>
5 #include <string>
6 #include <iostream>
7 #include <avahi-client/publish.h>
8 #include <service_discovery/impl/avahi/Client.hpp>
9 #include <service_discovery/impl/avahi/Service.hpp>
10 
11 namespace servicediscovery {
12 namespace avahi {
13 
20 class LocalService: public Service {
21 
22  friend class ServiceDiscovery;
23 
24 private:
28  AvahiEntryGroup *mGroup;
29  AvahiPublishFlags mFlags;
30 
31  bool mPublished;
32 
33  static void entry_group_callback(AvahiEntryGroup *g, AvahiEntryGroupState state, void *userdata);
34 
38  void _unpublish();
39 
40 public:
41 
53  Client *client,
54  std::string name,
55  std::string type,
56  uint16_t port,
57  std::list<std::string> list,
58  uint32_t ttl=0,
59  bool publish=true
60  );
76  Client *client,
77  AvahiIfIndex interf,
78  AvahiProtocol prot,
79  AvahiPublishFlags flags,
80  std::string name,
81  std::string type,
82  std::string domain,
83  uint16_t port,
84  std::list<std::string> list,
85  uint32_t ttl=0,
86  bool publish=false
87  );
88 
89  virtual ~LocalService();
90 
101  int publish();
102 
106  void unpublish();
107 
112  bool published();
113 
117  int updateStringList(std::list<std::string> list);
118 
119 };
120 
121 } // end namespace avahi
122 } // end namespace servicediscovery
123 
124 #endif /* _SERVICE_DISCOVERYLOCALSERVICE_H_ */
Client represent a wrapper to access the avahi_client (a singleton). Every avahi program must set up ...
Definition: Client.hpp:64
Definition: Client.cpp:7
int updateStringList(std::list< std::string > list)
Definition: LocalService.cpp:161
A wrapper class for the avahi service discovery.
Definition: ServiceDiscovery.hpp:77
virtual ~LocalService()
Definition: LocalService.cpp:7
int publish()
Definition: LocalService.cpp:48
Definition: Service.hpp:21
uint16_t port
Definition: Service.hpp:26
LocalService(Client *client, std::string name, std::string type, uint16_t port, std::list< std::string > list, uint32_t ttl=0, bool publish=true)
Definition: LocalService.cpp:31
bool published()
Definition: LocalService.cpp:124
void unpublish()
Definition: LocalService.cpp:103
LocalService for service objects that are meant to be published. Should be not used directly unless y...
Definition: LocalService.hpp:20