40
40
#include " agent/application.hpp"
41
41
#include " common/code_utils.hpp"
42
42
#include " common/mainloop_manager.hpp"
43
+ #include " host/posix/dnssd.hpp"
43
44
#include " utils/infra_link_selector.hpp"
44
45
45
46
namespace otbr {
@@ -63,6 +64,9 @@ Application::Application(Host::ThreadHost &aHost,
63
64
, mPublisher (
64
65
Mdns::Publisher::Create ([this ](Mdns::Publisher::State aState) { mMdnsStateSubject .UpdateState (aState); }))
65
66
#endif
67
+ #if OTBR_ENABLE_DNSSD_PLAT
68
+ , mDnssdPlatform (*mPublisher )
69
+ #endif
66
70
#if OTBR_ENABLE_DBUS_SERVER && OTBR_ENABLE_BORDER_AGENT
67
71
, mDBusAgent (MakeUnique<DBus::DBusAgent>(mHost , *mPublisher ))
68
72
#endif
@@ -221,6 +225,9 @@ void Application::CreateRcpMode(const std::string &aRestListenAddress, int aRest
221
225
222
226
void Application::InitRcpMode (void )
223
227
{
228
+ Host::RcpHost &rcpHost = static_cast <otbr::Host::RcpHost &>(mHost );
229
+ OTBR_UNUSED_VARIABLE (rcpHost);
230
+
224
231
#if OTBR_ENABLE_BORDER_AGENT
225
232
mMdnsStateSubject .AddObserver (*mBorderAgent );
226
233
#endif
@@ -233,6 +240,13 @@ void Application::InitRcpMode(void)
233
240
#if OTBR_ENABLE_TREL
234
241
mMdnsStateSubject .AddObserver (*mTrelDnssd );
235
242
#endif
243
+ #if OTBR_ENABLE_DNSSD_PLAT
244
+ mMdnsStateSubject .AddObserver (mDnssdPlatform );
245
+ mDnssdPlatform .SetDnssdStateChangedCallback (([&rcpHost](otPlatDnssdState aState) {
246
+ OTBR_UNUSED_VARIABLE (aState);
247
+ otPlatDnssdStateHandleStateChange (rcpHost.GetInstance ());
248
+ }));
249
+ #endif
236
250
237
251
#if OTBR_ENABLE_MDNS
238
252
mPublisher ->Start ();
@@ -267,10 +281,16 @@ void Application::InitRcpMode(void)
267
281
#if OTBR_ENABLE_VENDOR_SERVER
268
282
mVendorServer ->Init ();
269
283
#endif
284
+ #if OTBR_ENABLE_DNSSD_PLAT
285
+ mDnssdPlatform .Start ();
286
+ #endif
270
287
}
271
288
272
289
void Application::DeinitRcpMode (void )
273
290
{
291
+ #if OTBR_ENABLE_DNSSD_PLAT
292
+ mDnssdPlatform .Stop ();
293
+ #endif
274
294
#if OTBR_ENABLE_SRP_ADVERTISING_PROXY
275
295
mAdvertisingProxy ->SetEnabled (false );
276
296
#endif
0 commit comments