RAVENNAKIT
Loading...
Searching...
No Matches
dnssd_advertiser.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <memory>
4
8
9#include <boost/asio/io_context.hpp>
10
11namespace rav::dnssd {
12
17 public:
22 SafeFunction<void(const std::string& error_message)> on_error;
23
29 SafeFunction<void(const char* reg_type, const char* name)> on_name_conflict;
30
31 explicit Advertiser() = default;
32 virtual ~Advertiser() = default;
33
54 const std::string& reg_type, const char* name, const char* domain, uint16_t port, const TxtRecord& txt_record, bool auto_rename,
55 bool local_only
56 ) = 0;
57
68 virtual void update_txt_record(Id id, const TxtRecord& txt_record) = 0;
69
74 virtual void unregister_service(Id id) = 0;
75
80 static std::unique_ptr<Advertiser> create(boost::asio::io_context& io_context);
81};
82
83} // namespace rav::dnssd
A class which represents a unique identifier.
Definition id.hpp:38
A simple callback function wrapper that can be used to store and call a function with a specific sign...
SafeFunction< void(const std::string &error_message)> on_error
Called when an error occurs during registration.
virtual void update_txt_record(Id id, const TxtRecord &txt_record)=0
Updates the TXT record of this service.
SafeFunction< void(const char *reg_type, const char *name)> on_name_conflict
Called when a name conflict occurs during registration.
virtual Id register_service(const std::string &reg_type, const char *name, const char *domain, uint16_t port, const TxtRecord &txt_record, bool auto_rename, bool local_only)=0
Registers a service with given arguments.
virtual ~Advertiser()=default
virtual void unregister_service(Id id)=0
Unregisters this service from the mDnsResponder, after which the service will no longer be found on t...
static std::unique_ptr< Advertiser > create(boost::asio::io_context &io_context)
Creates the most appropriate dnssd_advertiser implementation for the platform.
std::map< std::string, std::string > TxtRecord
Simple typedef for representing a TXT record.