mirror of
https://github.com/espressif/openthread.git
synced 2026-06-05 21:14:49 +00:00
[ncp] add empty implementation for dnssd platform APIs (#10877)
This commit adds empty implementation for a NCP based version of otPlatDnssd APIs. Like NCP version of otPlatInfraIf APIs, this commit adds a control option to enable/disable the simulation platform version of otPlatDnssd APIs to avoid conflict. By default, the simulation version of implementation will still be turned on.
This commit is contained in:
@@ -235,6 +235,7 @@ ot_option(OT_OPERATIONAL_DATASET_AUTO_INIT OPENTHREAD_CONFIG_OPERATIONAL_DATASET
|
||||
ot_option(OT_OTNS OPENTHREAD_CONFIG_OTNS_ENABLE "OTNS")
|
||||
ot_option(OT_PING_SENDER OPENTHREAD_CONFIG_PING_SENDER_ENABLE "ping sender" ${OT_APP_CLI})
|
||||
ot_option(OT_PLATFORM_BOOTLOADER_MODE OPENTHREAD_CONFIG_PLATFORM_BOOTLOADER_MODE_ENABLE "platform bootloader mode")
|
||||
ot_option(OT_PLATFORM_DNSSD OPENTHREAD_CONFIG_PLATFORM_DNSSD_ENABLE "platform dnssd")
|
||||
ot_option(OT_PLATFORM_KEY_REF OPENTHREAD_CONFIG_PLATFORM_KEY_REFERENCES_ENABLE "platform key reference secure storage")
|
||||
ot_option(OT_PLATFORM_LOG_CRASH_DUMP OPENTHREAD_CONFIG_PLATFORM_LOG_CRASH_DUMP_ENABLE "platform log crash dump")
|
||||
ot_option(OT_PLATFORM_NETIF OPENTHREAD_CONFIG_PLATFORM_NETIF_ENABLE "platform netif")
|
||||
|
||||
@@ -52,6 +52,13 @@ else()
|
||||
target_compile_definitions(ot-simulation-config INTERFACE "OPENTHREAD_SIMULATION_IMPLEMENT_INFRA_IF=0")
|
||||
endif()
|
||||
|
||||
option(OT_SIMULATION_DNSSD "enable simulation dnssd" ON)
|
||||
if (OT_SIMULATION_DNSSD)
|
||||
target_compile_definitions(ot-simulation-config INTERFACE "OPENTHREAD_SIMULATION_IMPLEMENT_DNSSD=1")
|
||||
else()
|
||||
target_compile_definitions(ot-simulation-config INTERFACE "OPENTHREAD_SIMULATION_IMPLEMENT_DNSSD=0")
|
||||
endif()
|
||||
|
||||
if(NOT OT_PLATFORM_CONFIG)
|
||||
set(OT_PLATFORM_CONFIG "openthread-core-simulation-config.h" PARENT_SCOPE)
|
||||
endif()
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
|
||||
#include <openthread/platform/dnssd.h>
|
||||
|
||||
#if OPENTHREAD_CONFIG_PLATFORM_DNSSD_ENABLE
|
||||
#if OPENTHREAD_CONFIG_PLATFORM_DNSSD_ENABLE && OPENTHREAD_SIMULATION_IMPLEMENT_DNSSD
|
||||
otPlatDnssdState otPlatDnssdGetState(otInstance *aInstance)
|
||||
{
|
||||
OT_UNUSED_VARIABLE(aInstance);
|
||||
@@ -164,4 +164,4 @@ void otPlatDnssdStopIp4AddressResolver(otInstance *aInstance, const otPlatDnssdA
|
||||
OT_UNUSED_VARIABLE(aResolver);
|
||||
}
|
||||
|
||||
#endif // OPENTHREAD_CONFIG_PLATFORM_DNSSD_ENABLE
|
||||
#endif // OPENTHREAD_CONFIG_PLATFORM_DNSSD_ENABLE && OPENTHREAD_SIMULATION_IMPLEMENT_DNSSD
|
||||
|
||||
@@ -116,3 +116,12 @@
|
||||
#ifndef OPENTHREAD_SIMULATION_IMPLEMENT_INFRA_IF
|
||||
#define OPENTHREAD_SIMULATION_IMPLEMENT_INFRA_IF 1
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @def OPENTHREAD_SIMULATION_IMPLEMENT_DNSSD
|
||||
*
|
||||
* Define as 1 for the simulation platform to provide implementation of `otPlatDnssd` APIs.
|
||||
*/
|
||||
#ifndef OPENTHREAD_SIMULATION_IMPLEMENT_DNSSD
|
||||
#define OPENTHREAD_SIMULATION_IMPLEMENT_DNSSD 1
|
||||
#endif
|
||||
|
||||
@@ -39,6 +39,7 @@ set(COMMON_SOURCES
|
||||
ncp_base_radio.cpp
|
||||
ncp_spi.cpp
|
||||
ncp_hdlc.cpp
|
||||
platform/dnssd.cpp
|
||||
platform/infra_if.cpp
|
||||
)
|
||||
|
||||
@@ -55,6 +56,13 @@ else()
|
||||
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_NCP_INFRA_IF_ENABLE=0")
|
||||
endif()
|
||||
|
||||
option(OT_NCP_DNSSD "enable NCP DNSSD")
|
||||
if (OT_NCP_DNSSD)
|
||||
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_NCP_DNSSD_ENABLE=1")
|
||||
else()
|
||||
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_NCP_DNSSD_ENABLE=0")
|
||||
endif()
|
||||
|
||||
set(COMMON_NCP_SOURCES
|
||||
${COMMON_SOURCES}
|
||||
ncp_base_ftd.cpp
|
||||
|
||||
@@ -176,6 +176,15 @@
|
||||
#define OPENTHREAD_CONFIG_NCP_INFRA_IF_ENABLE 0
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @def OPENTHREAD_CONFIG_NCP_DNSSD_ENABLE
|
||||
*
|
||||
* Define to 1 to enable NCP based implementation of platform DNS-SD APIs.
|
||||
*/
|
||||
#ifndef OPENTHREAD_CONFIG_NCP_DNSSD_ENABLE
|
||||
#define OPENTHREAD_CONFIG_NCP_DNSSD_ENABLE 0
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @def OPENTHREAD_ENABLE_NCP_VENDOR_HOOK
|
||||
*
|
||||
|
||||
@@ -0,0 +1,168 @@
|
||||
/*
|
||||
* Copyright (c) 2024, The OpenThread Authors.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the copyright holder nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <openthread/instance.h>
|
||||
#include <openthread/platform/dnssd.h>
|
||||
|
||||
#include "ncp/ncp_base.hpp"
|
||||
|
||||
#if OPENTHREAD_CONFIG_NCP_DNSSD_ENABLE && OPENTHREAD_CONFIG_PLATFORM_DNSSD_ENABLE
|
||||
otPlatDnssdState otPlatDnssdGetState(otInstance *aInstance)
|
||||
{
|
||||
OT_UNUSED_VARIABLE(aInstance);
|
||||
|
||||
return OT_PLAT_DNSSD_STOPPED;
|
||||
}
|
||||
|
||||
void otPlatDnssdRegisterService(otInstance *aInstance,
|
||||
const otPlatDnssdService *aService,
|
||||
otPlatDnssdRequestId aRequestId,
|
||||
otPlatDnssdRegisterCallback aCallback)
|
||||
{
|
||||
OT_UNUSED_VARIABLE(aInstance);
|
||||
OT_UNUSED_VARIABLE(aService);
|
||||
OT_UNUSED_VARIABLE(aRequestId);
|
||||
OT_UNUSED_VARIABLE(aCallback);
|
||||
}
|
||||
|
||||
void otPlatDnssdUnregisterService(otInstance *aInstance,
|
||||
const otPlatDnssdService *aService,
|
||||
otPlatDnssdRequestId aRequestId,
|
||||
otPlatDnssdRegisterCallback aCallback)
|
||||
{
|
||||
OT_UNUSED_VARIABLE(aInstance);
|
||||
OT_UNUSED_VARIABLE(aService);
|
||||
OT_UNUSED_VARIABLE(aRequestId);
|
||||
OT_UNUSED_VARIABLE(aCallback);
|
||||
}
|
||||
|
||||
void otPlatDnssdRegisterHost(otInstance *aInstance,
|
||||
const otPlatDnssdHost *aHost,
|
||||
otPlatDnssdRequestId aRequestId,
|
||||
otPlatDnssdRegisterCallback aCallback)
|
||||
{
|
||||
OT_UNUSED_VARIABLE(aInstance);
|
||||
OT_UNUSED_VARIABLE(aHost);
|
||||
OT_UNUSED_VARIABLE(aRequestId);
|
||||
OT_UNUSED_VARIABLE(aCallback);
|
||||
}
|
||||
|
||||
void otPlatDnssdUnregisterHost(otInstance *aInstance,
|
||||
const otPlatDnssdHost *aHost,
|
||||
otPlatDnssdRequestId aRequestId,
|
||||
otPlatDnssdRegisterCallback aCallback)
|
||||
{
|
||||
OT_UNUSED_VARIABLE(aInstance);
|
||||
OT_UNUSED_VARIABLE(aHost);
|
||||
OT_UNUSED_VARIABLE(aRequestId);
|
||||
OT_UNUSED_VARIABLE(aCallback);
|
||||
}
|
||||
|
||||
void otPlatDnssdRegisterKey(otInstance *aInstance,
|
||||
const otPlatDnssdKey *aKey,
|
||||
otPlatDnssdRequestId aRequestId,
|
||||
otPlatDnssdRegisterCallback aCallback)
|
||||
{
|
||||
OT_UNUSED_VARIABLE(aInstance);
|
||||
OT_UNUSED_VARIABLE(aKey);
|
||||
OT_UNUSED_VARIABLE(aRequestId);
|
||||
OT_UNUSED_VARIABLE(aCallback);
|
||||
}
|
||||
|
||||
void otPlatDnssdUnregisterKey(otInstance *aInstance,
|
||||
const otPlatDnssdKey *aKey,
|
||||
otPlatDnssdRequestId aRequestId,
|
||||
otPlatDnssdRegisterCallback aCallback)
|
||||
{
|
||||
OT_UNUSED_VARIABLE(aInstance);
|
||||
OT_UNUSED_VARIABLE(aKey);
|
||||
OT_UNUSED_VARIABLE(aRequestId);
|
||||
OT_UNUSED_VARIABLE(aCallback);
|
||||
}
|
||||
|
||||
void otPlatDnssdStartBrowser(otInstance *aInstance, const otPlatDnssdBrowser *aBrowser)
|
||||
{
|
||||
OT_UNUSED_VARIABLE(aInstance);
|
||||
OT_UNUSED_VARIABLE(aBrowser);
|
||||
}
|
||||
|
||||
void otPlatDnssdStopBrowser(otInstance *aInstance, const otPlatDnssdBrowser *aBrowser)
|
||||
{
|
||||
OT_UNUSED_VARIABLE(aInstance);
|
||||
OT_UNUSED_VARIABLE(aBrowser);
|
||||
}
|
||||
|
||||
void otPlatDnssdStartSrvResolver(otInstance *aInstance, const otPlatDnssdSrvResolver *aResolver)
|
||||
{
|
||||
OT_UNUSED_VARIABLE(aInstance);
|
||||
OT_UNUSED_VARIABLE(aResolver);
|
||||
}
|
||||
|
||||
void otPlatDnssdStopSrvResolver(otInstance *aInstance, const otPlatDnssdSrvResolver *aResolver)
|
||||
{
|
||||
OT_UNUSED_VARIABLE(aInstance);
|
||||
OT_UNUSED_VARIABLE(aResolver);
|
||||
}
|
||||
|
||||
void otPlatDnssdStartTxtResolver(otInstance *aInstance, const otPlatDnssdTxtResolver *aResolver)
|
||||
{
|
||||
OT_UNUSED_VARIABLE(aInstance);
|
||||
OT_UNUSED_VARIABLE(aResolver);
|
||||
}
|
||||
|
||||
void otPlatDnssdStopTxtResolver(otInstance *aInstance, const otPlatDnssdTxtResolver *aResolver)
|
||||
{
|
||||
OT_UNUSED_VARIABLE(aInstance);
|
||||
OT_UNUSED_VARIABLE(aResolver);
|
||||
}
|
||||
|
||||
void otPlatDnssdStartIp6AddressResolver(otInstance *aInstance, const otPlatDnssdAddressResolver *aResolver)
|
||||
{
|
||||
OT_UNUSED_VARIABLE(aInstance);
|
||||
OT_UNUSED_VARIABLE(aResolver);
|
||||
}
|
||||
|
||||
void otPlatDnssdStopIp6AddressResolver(otInstance *aInstance, const otPlatDnssdAddressResolver *aResolver)
|
||||
{
|
||||
OT_UNUSED_VARIABLE(aInstance);
|
||||
OT_UNUSED_VARIABLE(aResolver);
|
||||
}
|
||||
|
||||
void otPlatDnssdStartIp4AddressResolver(otInstance *aInstance, const otPlatDnssdAddressResolver *aResolver)
|
||||
{
|
||||
OT_UNUSED_VARIABLE(aInstance);
|
||||
OT_UNUSED_VARIABLE(aResolver);
|
||||
}
|
||||
|
||||
void otPlatDnssdStopIp4AddressResolver(otInstance *aInstance, const otPlatDnssdAddressResolver *aResolver)
|
||||
{
|
||||
OT_UNUSED_VARIABLE(aInstance);
|
||||
OT_UNUSED_VARIABLE(aResolver);
|
||||
}
|
||||
|
||||
#endif // OPENTHREAD_CONFIG_NCP_DNSSD_ENABLE && OPENTHREAD_CONFIG_PLATFORM_DNSSD_ENABLE
|
||||
Reference in New Issue
Block a user