11#include <promeki/config.h>
12#if PROMEKI_ENABLE_MDNS
28PROMEKI_NAMESPACE_BEGIN
64class MdnsTypeBrowser :
public ObjectBase {
65 PROMEKI_OBJECT(MdnsTypeBrowser, ObjectBase)
68 static constexpr int64_t InitialQueryIntervalMs = 1000;
71 static constexpr int64_t MaxQueryIntervalMs = 3600 * 1000;
74 explicit MdnsTypeBrowser(ObjectBase *parent =
nullptr);
77 ~MdnsTypeBrowser()
override;
80 void setManager(MdnsManager *manager);
83 MdnsManager *manager()
const {
return _manager; }
86 MdnsManager *effectiveManager()
const;
89 bool isActive()
const {
return _active.value(); }
101 void handlePacket(
const Buffer &data,
const SocketAddress &sender,
102 const NetworkInterface &iface);
105 void onManagerTick(
const TimeStamp &now);
108 List<MdnsServiceType> types()
const;
114 PROMEKI_SIGNAL(typeFound, MdnsServiceType);
116 PROMEKI_SIGNAL(typeLost, MdnsServiceType);
120 MdnsServiceType type;
125 MdnsManager *_manager =
nullptr;
126 mutable Mutex _entriesMtx;
127 Map<String, Entry> _entries;
128 Atomic<bool> _active;
130 TimeStamp _nextQueryAt;
131 Duration _currentInterval;