// Copyright 2015 The Weave Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef LIBWEAVE_EXAMPLES_PROVIDER_AVAHI_CLIENT_H_ #define LIBWEAVE_EXAMPLES_PROVIDER_AVAHI_CLIENT_H_ #include #include #include #include #include #include #include namespace weave { namespace examples { // Example of provider::DnsServiceDiscovery implemented with avahi. class AvahiClient : public provider::DnsServiceDiscovery { public: AvahiClient(); ~AvahiClient() override; void PublishService(const std::string& service_type, uint16_t port, const std::vector& txt) override; void StopPublishing(const std::string& service_name) override; uint16_t prev_port_{0}; std::string prev_type_; std::unique_ptr thread_pool_{nullptr, &avahi_threaded_poll_free}; std::unique_ptr< ::AvahiClient, decltype(&avahi_client_free)> client_{ nullptr, &avahi_client_free}; std::unique_ptr group_{ nullptr, &avahi_entry_group_free}; }; } // namespace examples } // namespace weave #endif // LIBWEAVE_EXAMPLES_PROVIDER_AVAHI_CLIENT_H_