• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  *  Copyright (c) 2016, The OpenThread Authors.
3  *  All rights reserved.
4  *
5  *  Redistribution and use in source and binary forms, with or without
6  *  modification, are permitted provided that the following conditions are met:
7  *  1. Redistributions of source code must retain the above copyright
8  *     notice, this list of conditions and the following disclaimer.
9  *  2. Redistributions in binary form must reproduce the above copyright
10  *     notice, this list of conditions and the following disclaimer in the
11  *     documentation and/or other materials provided with the distribution.
12  *  3. Neither the name of the copyright holder nor the
13  *     names of its contributors may be used to endorse or promote products
14  *     derived from this software without specific prior written permission.
15  *
16  *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17  *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18  *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19  *  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
20  *  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21  *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22  *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23  *  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24  *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25  *  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26  *  POSSIBILITY OF SUCH DAMAGE.
27  */
28 
29 // Disable OpenThread's own new implementation to avoid duplicate definition
30 #define OT_INCLUDE_COMMON_NEW_HPP_
31 #include "test_platform.h"
32 
33 #include <map>
34 #include <vector>
35 
36 #include <stdio.h>
37 #include <sys/time.h>
38 #ifdef OPENTHREAD_CONFIG_BLE_TCAT_ENABLE
39 #include <openthread/tcat.h>
40 #include <openthread/platform/ble.h>
41 #endif
42 
43 enum
44 {
45     FLASH_SWAP_SIZE = 2048,
46     FLASH_SWAP_NUM  = 2,
47 };
48 
49 std::map<uint32_t, std::vector<std::vector<uint8_t>>> settings;
50 
testInitInstance(void)51 ot::Instance *testInitInstance(void)
52 {
53     otInstance *instance = nullptr;
54 
55 #if OPENTHREAD_CONFIG_MULTIPLE_INSTANCE_ENABLE
56 #if OPENTHREAD_CONFIG_MULTIPLE_STATIC_INSTANCE_ENABLE
57     instance = otInstanceInitMultiple(0);
58 #else
59     size_t   instanceBufferLength = 0;
60     uint8_t *instanceBuffer       = nullptr;
61 
62     // Call to query the buffer size
63     (void)otInstanceInit(nullptr, &instanceBufferLength);
64 
65     // Call to allocate the buffer
66     instanceBuffer = (uint8_t *)malloc(instanceBufferLength);
67     VerifyOrQuit(instanceBuffer != nullptr, "Failed to allocate otInstance");
68     memset(instanceBuffer, 0, instanceBufferLength);
69 
70     // Initialize OpenThread with the buffer
71     instance = otInstanceInit(instanceBuffer, &instanceBufferLength);
72 #endif
73 #else
74     instance = otInstanceInitSingle();
75 #endif
76 
77     return static_cast<ot::Instance *>(instance);
78 }
79 
80 #if OPENTHREAD_CONFIG_MULTIPLE_INSTANCE_ENABLE && OPENTHREAD_CONFIG_MULTIPLE_STATIC_INSTANCE_ENABLE
testInitAdditionalInstance(uint8_t id)81 ot::Instance *testInitAdditionalInstance(uint8_t id)
82 {
83     otInstance *instance = nullptr;
84 
85     instance = otInstanceInitMultiple(id);
86 
87     return static_cast<ot::Instance *>(instance);
88 }
89 #endif
90 
testFreeInstance(otInstance * aInstance)91 void testFreeInstance(otInstance *aInstance)
92 {
93     otInstanceFinalize(aInstance);
94 
95 #if OPENTHREAD_CONFIG_MULTIPLE_INSTANCE_ENABLE && !OPENTHREAD_CONFIG_MULTIPLE_STATIC_INSTANCE_ENABLE
96     free(aInstance);
97 #endif
98 }
99 
100 bool sDiagMode = false;
101 
102 static otPlatDiagOutputCallback sOutputCallback        = nullptr;
103 static void                    *sOutputCallbackContext = nullptr;
104 
105 extern "C" {
106 
107 #if OPENTHREAD_CONFIG_HEAP_EXTERNAL_ENABLE
otPlatCAlloc(size_t aNum,size_t aSize)108 OT_TOOL_WEAK void *otPlatCAlloc(size_t aNum, size_t aSize) { return calloc(aNum, aSize); }
109 
otPlatFree(void * aPtr)110 OT_TOOL_WEAK void otPlatFree(void *aPtr) { free(aPtr); }
111 #endif
112 
otTaskletsSignalPending(otInstance *)113 OT_TOOL_WEAK void otTaskletsSignalPending(otInstance *) {}
114 
otPlatAlarmMilliStop(otInstance *)115 OT_TOOL_WEAK void otPlatAlarmMilliStop(otInstance *) {}
116 
otPlatAlarmMilliStartAt(otInstance *,uint32_t,uint32_t)117 OT_TOOL_WEAK void otPlatAlarmMilliStartAt(otInstance *, uint32_t, uint32_t) {}
118 
otPlatAlarmMilliGetNow(void)119 OT_TOOL_WEAK uint32_t otPlatAlarmMilliGetNow(void)
120 {
121     struct timeval tv;
122 
123     gettimeofday(&tv, nullptr);
124 
125     return (uint32_t)((tv.tv_sec * 1000) + (tv.tv_usec / 1000) + 123456);
126 }
127 
otPlatAlarmMicroStop(otInstance *)128 OT_TOOL_WEAK void otPlatAlarmMicroStop(otInstance *) {}
129 
otPlatAlarmMicroStartAt(otInstance *,uint32_t,uint32_t)130 OT_TOOL_WEAK void otPlatAlarmMicroStartAt(otInstance *, uint32_t, uint32_t) {}
131 
otPlatAlarmMicroGetNow(void)132 OT_TOOL_WEAK uint32_t otPlatAlarmMicroGetNow(void)
133 {
134     struct timeval tv;
135 
136     gettimeofday(&tv, nullptr);
137 
138     return (uint32_t)((tv.tv_sec * 1000000) + tv.tv_usec + 123456);
139 }
140 
otPlatMultipanGetActiveInstance(otInstance **)141 OT_TOOL_WEAK otError otPlatMultipanGetActiveInstance(otInstance **) { return OT_ERROR_NOT_IMPLEMENTED; }
142 
otPlatMultipanSetActiveInstance(otInstance *,bool)143 OT_TOOL_WEAK otError otPlatMultipanSetActiveInstance(otInstance *, bool) { return OT_ERROR_NOT_IMPLEMENTED; }
144 
otPlatRadioGetIeeeEui64(otInstance *,uint8_t *)145 OT_TOOL_WEAK void otPlatRadioGetIeeeEui64(otInstance *, uint8_t *) {}
146 
otPlatRadioSetPanId(otInstance *,uint16_t)147 OT_TOOL_WEAK void otPlatRadioSetPanId(otInstance *, uint16_t) {}
148 
otPlatRadioSetExtendedAddress(otInstance *,const otExtAddress *)149 OT_TOOL_WEAK void otPlatRadioSetExtendedAddress(otInstance *, const otExtAddress *) {}
150 
otPlatRadioSetShortAddress(otInstance *,uint16_t)151 OT_TOOL_WEAK void otPlatRadioSetShortAddress(otInstance *, uint16_t) {}
152 
otPlatRadioSetPromiscuous(otInstance *,bool)153 OT_TOOL_WEAK void otPlatRadioSetPromiscuous(otInstance *, bool) {}
154 
otPlatRadioSetRxOnWhenIdle(otInstance *,bool)155 OT_TOOL_WEAK void otPlatRadioSetRxOnWhenIdle(otInstance *, bool) {}
156 
otPlatRadioIsEnabled(otInstance *)157 OT_TOOL_WEAK bool otPlatRadioIsEnabled(otInstance *) { return true; }
158 
otPlatRadioEnable(otInstance *)159 OT_TOOL_WEAK otError otPlatRadioEnable(otInstance *) { return OT_ERROR_NONE; }
160 
otPlatRadioDisable(otInstance *)161 OT_TOOL_WEAK otError otPlatRadioDisable(otInstance *) { return OT_ERROR_NONE; }
162 
otPlatRadioSleep(otInstance *)163 OT_TOOL_WEAK otError otPlatRadioSleep(otInstance *) { return OT_ERROR_NONE; }
164 
otPlatRadioReceive(otInstance *,uint8_t)165 OT_TOOL_WEAK otError otPlatRadioReceive(otInstance *, uint8_t) { return OT_ERROR_NONE; }
166 
otPlatRadioTransmit(otInstance *,otRadioFrame *)167 OT_TOOL_WEAK otError otPlatRadioTransmit(otInstance *, otRadioFrame *) { return OT_ERROR_NONE; }
168 
otPlatRadioGetTransmitBuffer(otInstance *)169 OT_TOOL_WEAK otRadioFrame *otPlatRadioGetTransmitBuffer(otInstance *) { return nullptr; }
170 
otPlatRadioGetRssi(otInstance *)171 OT_TOOL_WEAK int8_t otPlatRadioGetRssi(otInstance *) { return 0; }
172 
otPlatRadioGetCaps(otInstance *)173 OT_TOOL_WEAK otRadioCaps otPlatRadioGetCaps(otInstance *) { return OT_RADIO_CAPS_NONE; }
174 
otPlatRadioGetPromiscuous(otInstance *)175 OT_TOOL_WEAK bool otPlatRadioGetPromiscuous(otInstance *) { return false; }
176 
otPlatRadioEnableSrcMatch(otInstance *,bool)177 OT_TOOL_WEAK void otPlatRadioEnableSrcMatch(otInstance *, bool) {}
178 
otPlatRadioAddSrcMatchShortEntry(otInstance *,uint16_t)179 OT_TOOL_WEAK otError otPlatRadioAddSrcMatchShortEntry(otInstance *, uint16_t) { return OT_ERROR_NONE; }
180 
otPlatRadioAddSrcMatchExtEntry(otInstance *,const otExtAddress *)181 OT_TOOL_WEAK otError otPlatRadioAddSrcMatchExtEntry(otInstance *, const otExtAddress *) { return OT_ERROR_NONE; }
182 
otPlatRadioClearSrcMatchShortEntry(otInstance *,uint16_t)183 OT_TOOL_WEAK otError otPlatRadioClearSrcMatchShortEntry(otInstance *, uint16_t) { return OT_ERROR_NONE; }
184 
otPlatRadioClearSrcMatchExtEntry(otInstance *,const otExtAddress *)185 OT_TOOL_WEAK otError otPlatRadioClearSrcMatchExtEntry(otInstance *, const otExtAddress *) { return OT_ERROR_NONE; }
186 
otPlatRadioClearSrcMatchShortEntries(otInstance *)187 OT_TOOL_WEAK void otPlatRadioClearSrcMatchShortEntries(otInstance *) {}
188 
otPlatRadioClearSrcMatchExtEntries(otInstance *)189 OT_TOOL_WEAK void otPlatRadioClearSrcMatchExtEntries(otInstance *) {}
190 
otPlatRadioEnergyScan(otInstance *,uint8_t,uint16_t)191 OT_TOOL_WEAK otError otPlatRadioEnergyScan(otInstance *, uint8_t, uint16_t) { return OT_ERROR_NOT_IMPLEMENTED; }
192 
otPlatRadioSetTransmitPower(otInstance *,int8_t)193 OT_TOOL_WEAK otError otPlatRadioSetTransmitPower(otInstance *, int8_t) { return OT_ERROR_NOT_IMPLEMENTED; }
194 
otPlatRadioGetReceiveSensitivity(otInstance *)195 OT_TOOL_WEAK int8_t otPlatRadioGetReceiveSensitivity(otInstance *) { return -100; }
196 
otPlatEntropyGet(uint8_t * aOutput,uint16_t aOutputLength)197 OT_TOOL_WEAK otError otPlatEntropyGet(uint8_t *aOutput, uint16_t aOutputLength)
198 {
199     otError error = OT_ERROR_NONE;
200 
201     VerifyOrExit(aOutput, error = OT_ERROR_INVALID_ARGS);
202 
203 #if __SANITIZE_ADDRESS__ == 0
204     {
205         FILE  *file = nullptr;
206         size_t readLength;
207 
208         file = fopen("/dev/urandom", "rb");
209         VerifyOrExit(file != nullptr, error = OT_ERROR_FAILED);
210 
211         readLength = fread(aOutput, 1, aOutputLength, file);
212 
213         if (readLength != aOutputLength)
214         {
215             error = OT_ERROR_FAILED;
216         }
217 
218         fclose(file);
219     }
220 #else
221     for (uint16_t length = 0; length < aOutputLength; length++)
222     {
223         aOutput[length] = (uint8_t)rand();
224     }
225 #endif
226 
227 exit:
228     return error;
229 }
230 
DiagOutput(const char * aFormat,...)231 static void DiagOutput(const char *aFormat, ...)
232 {
233     va_list args;
234 
235     va_start(args, aFormat);
236 
237     if (sOutputCallback != nullptr)
238     {
239         sOutputCallback(aFormat, args, sOutputCallbackContext);
240     }
241 
242     va_end(args);
243 }
244 
otPlatDiagSetOutputCallback(otInstance * aInstance,otPlatDiagOutputCallback aCallback,void * aContext)245 OT_TOOL_WEAK void otPlatDiagSetOutputCallback(otInstance *aInstance, otPlatDiagOutputCallback aCallback, void *aContext)
246 {
247     sOutputCallback        = aCallback;
248     sOutputCallbackContext = aContext;
249 }
250 
otPlatDiagProcess(otInstance *,uint8_t,char * aArgs[])251 OT_TOOL_WEAK otError otPlatDiagProcess(otInstance *, uint8_t, char *aArgs[])
252 {
253     DiagOutput("diag feature '%s' is not supported\r\n", aArgs[0]);
254     return OT_ERROR_NONE;
255 }
256 
otPlatDiagModeSet(bool aMode)257 OT_TOOL_WEAK void otPlatDiagModeSet(bool aMode) { sDiagMode = aMode; }
258 
otPlatDiagModeGet()259 OT_TOOL_WEAK bool otPlatDiagModeGet() { return sDiagMode; }
260 
otPlatDiagChannelSet(uint8_t)261 OT_TOOL_WEAK void otPlatDiagChannelSet(uint8_t) {}
262 
otPlatDiagTxPowerSet(int8_t)263 OT_TOOL_WEAK void otPlatDiagTxPowerSet(int8_t) {}
264 
otPlatDiagRadioReceived(otInstance *,otRadioFrame *,otError)265 OT_TOOL_WEAK void otPlatDiagRadioReceived(otInstance *, otRadioFrame *, otError) {}
266 
otPlatDiagAlarmCallback(otInstance *)267 OT_TOOL_WEAK void otPlatDiagAlarmCallback(otInstance *) {}
268 
otPlatUartSendDone(void)269 OT_TOOL_WEAK void otPlatUartSendDone(void) {}
270 
otPlatUartReceived(const uint8_t *,uint16_t)271 OT_TOOL_WEAK void otPlatUartReceived(const uint8_t *, uint16_t) {}
272 
otPlatReset(otInstance *)273 OT_TOOL_WEAK void otPlatReset(otInstance *) {}
274 
otPlatResetToBootloader(otInstance *)275 OT_TOOL_WEAK otError otPlatResetToBootloader(otInstance *) { return OT_ERROR_NOT_CAPABLE; }
276 
otPlatGetResetReason(otInstance *)277 OT_TOOL_WEAK otPlatResetReason otPlatGetResetReason(otInstance *) { return OT_PLAT_RESET_REASON_POWER_ON; }
278 
otPlatWakeHost(void)279 OT_TOOL_WEAK void otPlatWakeHost(void) {}
280 
otPlatLog(otLogLevel,otLogRegion,const char *,...)281 OT_TOOL_WEAK void otPlatLog(otLogLevel, otLogRegion, const char *, ...) {}
282 
otPlatSettingsInit(otInstance *,const uint16_t *,uint16_t)283 OT_TOOL_WEAK void otPlatSettingsInit(otInstance *, const uint16_t *, uint16_t) {}
284 
otPlatSettingsDeinit(otInstance *)285 OT_TOOL_WEAK void otPlatSettingsDeinit(otInstance *) {}
286 
otPlatSettingsGet(otInstance *,uint16_t aKey,int aIndex,uint8_t * aValue,uint16_t * aValueLength)287 OT_TOOL_WEAK otError otPlatSettingsGet(otInstance *, uint16_t aKey, int aIndex, uint8_t *aValue, uint16_t *aValueLength)
288 {
289     auto setting = settings.find(aKey);
290 
291     if (setting == settings.end())
292     {
293         return OT_ERROR_NOT_FOUND;
294     }
295 
296     if (aIndex > setting->second.size())
297     {
298         return OT_ERROR_NOT_FOUND;
299     }
300 
301     if (aValueLength == nullptr)
302     {
303         return OT_ERROR_NONE;
304     }
305 
306     const auto &data = setting->second[aIndex];
307 
308     if (aValue == nullptr)
309     {
310         *aValueLength = data.size();
311         return OT_ERROR_NONE;
312     }
313 
314     if (*aValueLength >= data.size())
315     {
316         *aValueLength = data.size();
317     }
318 
319     memcpy(aValue, &data[0], *aValueLength);
320 
321     return OT_ERROR_NONE;
322 }
323 
otPlatSettingsSet(otInstance *,uint16_t aKey,const uint8_t * aValue,uint16_t aValueLength)324 OT_TOOL_WEAK otError otPlatSettingsSet(otInstance *, uint16_t aKey, const uint8_t *aValue, uint16_t aValueLength)
325 {
326     auto setting = std::vector<uint8_t>(aValue, aValue + aValueLength);
327 
328     settings[aKey].clear();
329     settings[aKey].push_back(setting);
330 
331     return OT_ERROR_NONE;
332 }
333 
otPlatSettingsAdd(otInstance *,uint16_t aKey,const uint8_t * aValue,uint16_t aValueLength)334 OT_TOOL_WEAK otError otPlatSettingsAdd(otInstance *, uint16_t aKey, const uint8_t *aValue, uint16_t aValueLength)
335 {
336     auto setting = std::vector<uint8_t>(aValue, aValue + aValueLength);
337     settings[aKey].push_back(setting);
338 
339     return OT_ERROR_NONE;
340 }
341 
otPlatSettingsDelete(otInstance *,uint16_t aKey,int aIndex)342 OT_TOOL_WEAK otError otPlatSettingsDelete(otInstance *, uint16_t aKey, int aIndex)
343 {
344     auto setting = settings.find(aKey);
345     if (setting == settings.end())
346     {
347         return OT_ERROR_NOT_FOUND;
348     }
349 
350     if (aIndex >= setting->second.size())
351     {
352         return OT_ERROR_NOT_FOUND;
353     }
354     setting->second.erase(setting->second.begin() + aIndex);
355     return OT_ERROR_NONE;
356 }
357 
otPlatSettingsWipe(otInstance *)358 OT_TOOL_WEAK void otPlatSettingsWipe(otInstance *) { settings.clear(); }
359 
GetFlash(void)360 uint8_t *GetFlash(void)
361 {
362     static uint8_t sFlash[FLASH_SWAP_SIZE * FLASH_SWAP_NUM];
363     static bool    sInitialized;
364 
365     if (!sInitialized)
366     {
367         memset(sFlash, 0xff, sizeof(sFlash));
368         sInitialized = true;
369     }
370 
371     return sFlash;
372 }
373 
otPlatFlashInit(otInstance *)374 OT_TOOL_WEAK void otPlatFlashInit(otInstance *) {}
375 
otPlatFlashGetSwapSize(otInstance *)376 OT_TOOL_WEAK uint32_t otPlatFlashGetSwapSize(otInstance *) { return FLASH_SWAP_SIZE; }
377 
otPlatFlashErase(otInstance *,uint8_t aSwapIndex)378 OT_TOOL_WEAK void otPlatFlashErase(otInstance *, uint8_t aSwapIndex)
379 {
380     uint32_t address;
381 
382     VerifyOrQuit(aSwapIndex < FLASH_SWAP_NUM, "aSwapIndex invalid");
383 
384     address = aSwapIndex ? FLASH_SWAP_SIZE : 0;
385 
386     memset(GetFlash() + address, 0xff, FLASH_SWAP_SIZE);
387 }
388 
otPlatFlashRead(otInstance *,uint8_t aSwapIndex,uint32_t aOffset,void * aData,uint32_t aSize)389 OT_TOOL_WEAK void otPlatFlashRead(otInstance *, uint8_t aSwapIndex, uint32_t aOffset, void *aData, uint32_t aSize)
390 {
391     uint32_t address;
392 
393     VerifyOrQuit(aSwapIndex < FLASH_SWAP_NUM, "aSwapIndex invalid");
394     VerifyOrQuit(aSize <= FLASH_SWAP_SIZE, "aSize invalid");
395     VerifyOrQuit(aOffset <= (FLASH_SWAP_SIZE - aSize), "aOffset + aSize invalid");
396 
397     address = aSwapIndex ? FLASH_SWAP_SIZE : 0;
398 
399     memcpy(aData, GetFlash() + address + aOffset, aSize);
400 }
401 
otPlatFlashWrite(otInstance *,uint8_t aSwapIndex,uint32_t aOffset,const void * aData,uint32_t aSize)402 OT_TOOL_WEAK void otPlatFlashWrite(otInstance *,
403                                    uint8_t     aSwapIndex,
404                                    uint32_t    aOffset,
405                                    const void *aData,
406                                    uint32_t    aSize)
407 {
408     uint32_t address;
409 
410     VerifyOrQuit(aSwapIndex < FLASH_SWAP_NUM, "aSwapIndex invalid");
411     VerifyOrQuit(aSize <= FLASH_SWAP_SIZE, "aSize invalid");
412     VerifyOrQuit(aOffset <= (FLASH_SWAP_SIZE - aSize), "aOffset + aSize invalid");
413 
414     address = aSwapIndex ? FLASH_SWAP_SIZE : 0;
415 
416     for (uint32_t index = 0; index < aSize; index++)
417     {
418         GetFlash()[address + aOffset + index] &= ((uint8_t *)aData)[index];
419     }
420 }
421 
422 #if OPENTHREAD_CONFIG_TIME_SYNC_ENABLE || OPENTHREAD_CONFIG_MAC_CSL_RECEIVER_ENABLE
otPlatTimeGetXtalAccuracy(void)423 OT_TOOL_WEAK uint16_t otPlatTimeGetXtalAccuracy(void) { return 0; }
424 #endif
425 
426 #if OPENTHREAD_CONFIG_MAC_CSL_RECEIVER_ENABLE
otPlatRadioEnableCsl(otInstance *,uint32_t,otShortAddress,const otExtAddress *)427 OT_TOOL_WEAK otError otPlatRadioEnableCsl(otInstance *, uint32_t, otShortAddress, const otExtAddress *)
428 {
429     return OT_ERROR_NONE;
430 }
431 
otPlatRadioResetCsl(otInstance *)432 OT_TOOL_WEAK otError otPlatRadioResetCsl(otInstance *) { return OT_ERROR_NONE; }
433 
otPlatRadioUpdateCslSampleTime(otInstance *,uint32_t)434 OT_TOOL_WEAK void otPlatRadioUpdateCslSampleTime(otInstance *, uint32_t) {}
435 
otPlatRadioGetCslAccuracy(otInstance *)436 OT_TOOL_WEAK uint8_t otPlatRadioGetCslAccuracy(otInstance *)
437 {
438     return static_cast<uint8_t>(otPlatTimeGetXtalAccuracy() / 2);
439 }
440 #endif
441 
442 #if OPENTHREAD_CONFIG_OTNS_ENABLE
otPlatOtnsStatus(const char *)443 OT_TOOL_WEAK void otPlatOtnsStatus(const char *) {}
444 #endif
445 
446 #if OPENTHREAD_CONFIG_RADIO_LINK_TREL_ENABLE
otPlatTrelEnable(otInstance *,uint16_t *)447 OT_TOOL_WEAK void otPlatTrelEnable(otInstance *, uint16_t *) {}
448 
otPlatTrelDisable(otInstance *)449 OT_TOOL_WEAK void otPlatTrelDisable(otInstance *) {}
450 
otPlatTrelSend(otInstance *,const uint8_t *,uint16_t,const otSockAddr *)451 OT_TOOL_WEAK void otPlatTrelSend(otInstance *, const uint8_t *, uint16_t, const otSockAddr *) {}
452 
otPlatTrelNotifyPeerSocketAddressDifference(otInstance *,const otSockAddr *,const otSockAddr *)453 OT_TOOL_WEAK void otPlatTrelNotifyPeerSocketAddressDifference(otInstance *, const otSockAddr *, const otSockAddr *) {}
454 
otPlatTrelRegisterService(otInstance *,uint16_t,const uint8_t *,uint8_t)455 OT_TOOL_WEAK void otPlatTrelRegisterService(otInstance *, uint16_t, const uint8_t *, uint8_t) {}
456 
otPlatTrelGetCounters(otInstance *)457 OT_TOOL_WEAK const otPlatTrelCounters *otPlatTrelGetCounters(otInstance *) { return nullptr; }
458 
otPlatTrelResetCounters(otInstance *)459 OT_TOOL_WEAK void otPlatTrelResetCounters(otInstance *) {}
460 #endif
461 
462 #if OPENTHREAD_CONFIG_MLE_LINK_METRICS_SUBJECT_ENABLE
otPlatRadioConfigureEnhAckProbing(otInstance *,otLinkMetrics,const otShortAddress,const otExtAddress *)463 OT_TOOL_WEAK otError otPlatRadioConfigureEnhAckProbing(otInstance *,
464                                                        otLinkMetrics,
465                                                        const otShortAddress,
466                                                        const otExtAddress *)
467 {
468     return OT_ERROR_NONE;
469 }
470 
otPlatRadioGetEnhAckProbingMetrics(otInstance *,const otShortAddress)471 OT_TOOL_WEAK otLinkMetrics otPlatRadioGetEnhAckProbingMetrics(otInstance *, const otShortAddress)
472 {
473     otLinkMetrics metrics;
474 
475     memset(&metrics, 0, sizeof(metrics));
476 
477     return metrics;
478 }
479 #endif
480 
481 #if OPENTHREAD_CONFIG_BORDER_ROUTING_ENABLE
otPlatInfraIfHasAddress(uint32_t,const otIp6Address *)482 OT_TOOL_WEAK bool otPlatInfraIfHasAddress(uint32_t, const otIp6Address *) { return false; }
483 
otPlatInfraIfSendIcmp6Nd(uint32_t,const otIp6Address *,const uint8_t *,uint16_t)484 OT_TOOL_WEAK otError otPlatInfraIfSendIcmp6Nd(uint32_t, const otIp6Address *, const uint8_t *, uint16_t)
485 {
486     return OT_ERROR_FAILED;
487 }
488 
otPlatInfraIfDiscoverNat64Prefix(uint32_t)489 OT_TOOL_WEAK otError otPlatInfraIfDiscoverNat64Prefix(uint32_t) { return OT_ERROR_FAILED; }
490 #endif
491 
492 #if OPENTHREAD_CONFIG_PLATFORM_KEY_REFERENCES_ENABLE
493 
otPlatCryptoImportKey(otCryptoKeyRef * aKeyRef,otCryptoKeyType aKeyType,otCryptoKeyAlgorithm aKeyAlgorithm,int aKeyUsage,otCryptoKeyStorage aKeyPersistence,const uint8_t * aKey,size_t aKeyLen)494 otError otPlatCryptoImportKey(otCryptoKeyRef      *aKeyRef,
495                               otCryptoKeyType      aKeyType,
496                               otCryptoKeyAlgorithm aKeyAlgorithm,
497                               int                  aKeyUsage,
498                               otCryptoKeyStorage   aKeyPersistence,
499                               const uint8_t       *aKey,
500                               size_t               aKeyLen)
501 {
502     OT_UNUSED_VARIABLE(aKeyRef);
503     OT_UNUSED_VARIABLE(aKeyType);
504     OT_UNUSED_VARIABLE(aKeyAlgorithm);
505     OT_UNUSED_VARIABLE(aKeyUsage);
506     OT_UNUSED_VARIABLE(aKeyPersistence);
507     OT_UNUSED_VARIABLE(aKey);
508     OT_UNUSED_VARIABLE(aKeyLen);
509 
510     return OT_ERROR_NONE;
511 }
512 
otPlatCryptoExportKey(otCryptoKeyRef aKeyRef,uint8_t * aBuffer,size_t aBufferLen,size_t * aKeyLen)513 otError otPlatCryptoExportKey(otCryptoKeyRef aKeyRef, uint8_t *aBuffer, size_t aBufferLen, size_t *aKeyLen)
514 {
515     OT_UNUSED_VARIABLE(aKeyRef);
516     OT_UNUSED_VARIABLE(aBuffer);
517     OT_UNUSED_VARIABLE(aBufferLen);
518 
519     *aKeyLen = 0;
520 
521     return OT_ERROR_NONE;
522 }
523 
otPlatCryptoDestroyKey(otCryptoKeyRef aKeyRef)524 otError otPlatCryptoDestroyKey(otCryptoKeyRef aKeyRef)
525 {
526     OT_UNUSED_VARIABLE(aKeyRef);
527 
528     return OT_ERROR_NONE;
529 }
530 
otPlatCryptoHasKey(otCryptoKeyRef aKeyRef)531 bool otPlatCryptoHasKey(otCryptoKeyRef aKeyRef)
532 {
533     OT_UNUSED_VARIABLE(aKeyRef);
534 
535     return false;
536 }
537 
otPlatCryptoEcdsaGenerateAndImportKey(otCryptoKeyRef aKeyRef)538 otError otPlatCryptoEcdsaGenerateAndImportKey(otCryptoKeyRef aKeyRef)
539 {
540     OT_UNUSED_VARIABLE(aKeyRef);
541 
542     return OT_ERROR_NONE;
543 }
544 
otPlatCryptoEcdsaExportPublicKey(otCryptoKeyRef aKeyRef,otPlatCryptoEcdsaPublicKey * aPublicKey)545 otError otPlatCryptoEcdsaExportPublicKey(otCryptoKeyRef aKeyRef, otPlatCryptoEcdsaPublicKey *aPublicKey)
546 {
547     OT_UNUSED_VARIABLE(aKeyRef);
548     OT_UNUSED_VARIABLE(aPublicKey);
549 
550     return OT_ERROR_NONE;
551 }
552 
otPlatCryptoEcdsaSignUsingKeyRef(otCryptoKeyRef aKeyRef,const otPlatCryptoSha256Hash * aHash,otPlatCryptoEcdsaSignature * aSignature)553 otError otPlatCryptoEcdsaSignUsingKeyRef(otCryptoKeyRef                aKeyRef,
554                                          const otPlatCryptoSha256Hash *aHash,
555                                          otPlatCryptoEcdsaSignature   *aSignature)
556 {
557     OT_UNUSED_VARIABLE(aKeyRef);
558     OT_UNUSED_VARIABLE(aHash);
559     OT_UNUSED_VARIABLE(aSignature);
560 
561     return OT_ERROR_NONE;
562 }
563 
otPlatCryptoEcdsaVerifyUsingKeyRef(otCryptoKeyRef aKeyRef,const otPlatCryptoSha256Hash * aHash,const otPlatCryptoEcdsaSignature * aSignature)564 otError otPlatCryptoEcdsaVerifyUsingKeyRef(otCryptoKeyRef                    aKeyRef,
565                                            const otPlatCryptoSha256Hash     *aHash,
566                                            const otPlatCryptoEcdsaSignature *aSignature)
567 {
568     OT_UNUSED_VARIABLE(aKeyRef);
569     OT_UNUSED_VARIABLE(aHash);
570     OT_UNUSED_VARIABLE(aSignature);
571 
572     return OT_ERROR_NONE;
573 }
574 
575 #endif // OPENTHREAD_CONFIG_PLATFORM_KEY_REFERENCES_ENABLE
576 
otPlatRadioSetCcaEnergyDetectThreshold(otInstance * aInstance,int8_t aThreshold)577 otError otPlatRadioSetCcaEnergyDetectThreshold(otInstance *aInstance, int8_t aThreshold)
578 {
579     OT_UNUSED_VARIABLE(aInstance);
580     OT_UNUSED_VARIABLE(aThreshold);
581 
582     return OT_ERROR_NONE;
583 }
584 
585 #if OPENTHREAD_CONFIG_MULTICAST_DNS_ENABLE
586 
otPlatMdnsSetListeningEnabled(otInstance * aInstance,bool aEnable,uint32_t aInfraIfIndex)587 OT_TOOL_WEAK otError otPlatMdnsSetListeningEnabled(otInstance *aInstance, bool aEnable, uint32_t aInfraIfIndex)
588 {
589     OT_UNUSED_VARIABLE(aInstance);
590     OT_UNUSED_VARIABLE(aEnable);
591     OT_UNUSED_VARIABLE(aInfraIfIndex);
592 
593     return OT_ERROR_NOT_IMPLEMENTED;
594 }
595 
otPlatMdnsSendMulticast(otInstance * aInstance,otMessage * aMessage,uint32_t aInfraIfIndex)596 OT_TOOL_WEAK void otPlatMdnsSendMulticast(otInstance *aInstance, otMessage *aMessage, uint32_t aInfraIfIndex)
597 {
598     OT_UNUSED_VARIABLE(aInstance);
599     OT_UNUSED_VARIABLE(aMessage);
600     OT_UNUSED_VARIABLE(aInfraIfIndex);
601 }
602 
otPlatMdnsSendUnicast(otInstance * aInstance,otMessage * aMessage,const otPlatMdnsAddressInfo * aAddress)603 OT_TOOL_WEAK void otPlatMdnsSendUnicast(otInstance                  *aInstance,
604                                         otMessage                   *aMessage,
605                                         const otPlatMdnsAddressInfo *aAddress)
606 {
607     OT_UNUSED_VARIABLE(aInstance);
608     OT_UNUSED_VARIABLE(aMessage);
609     OT_UNUSED_VARIABLE(aAddress);
610 }
611 
612 #endif // OPENTHREAD_CONFIG_MULTICAST_DNS_ENABLE
613 
614 #if OPENTHREAD_CONFIG_DNS_DSO_ENABLE
615 
otPlatDsoEnableListening(otInstance * aInstance,bool aEnable)616 OT_TOOL_WEAK void otPlatDsoEnableListening(otInstance *aInstance, bool aEnable)
617 {
618     OT_UNUSED_VARIABLE(aInstance);
619     OT_UNUSED_VARIABLE(aEnable);
620 }
621 
otPlatDsoConnect(otPlatDsoConnection * aConnection,const otSockAddr * aPeerSockAddr)622 OT_TOOL_WEAK void otPlatDsoConnect(otPlatDsoConnection *aConnection, const otSockAddr *aPeerSockAddr)
623 {
624     OT_UNUSED_VARIABLE(aConnection);
625     OT_UNUSED_VARIABLE(aPeerSockAddr);
626 }
627 
otPlatDsoSend(otPlatDsoConnection * aConnection,otMessage * aMessage)628 OT_TOOL_WEAK void otPlatDsoSend(otPlatDsoConnection *aConnection, otMessage *aMessage)
629 {
630     OT_UNUSED_VARIABLE(aConnection);
631     OT_UNUSED_VARIABLE(aMessage);
632 }
633 
otPlatDsoDisconnect(otPlatDsoConnection * aConnection,otPlatDsoDisconnectMode aMode)634 OT_TOOL_WEAK void otPlatDsoDisconnect(otPlatDsoConnection *aConnection, otPlatDsoDisconnectMode aMode)
635 {
636     OT_UNUSED_VARIABLE(aConnection);
637     OT_UNUSED_VARIABLE(aMode);
638 }
639 
640 #endif // #if OPENTHREAD_CONFIG_DNS_DSO_ENABLE
641 
642 #if OPENTHREAD_CONFIG_PLATFORM_UDP_ENABLE
otPlatUdpSocket(otUdpSocket * aUdpSocket)643 otError otPlatUdpSocket(otUdpSocket *aUdpSocket)
644 {
645     OT_UNUSED_VARIABLE(aUdpSocket);
646     return OT_ERROR_NONE;
647 }
648 
otPlatUdpClose(otUdpSocket * aUdpSocket)649 otError otPlatUdpClose(otUdpSocket *aUdpSocket)
650 {
651     OT_UNUSED_VARIABLE(aUdpSocket);
652     return OT_ERROR_NONE;
653 }
654 
otPlatUdpBind(otUdpSocket * aUdpSocket)655 otError otPlatUdpBind(otUdpSocket *aUdpSocket)
656 {
657     OT_UNUSED_VARIABLE(aUdpSocket);
658     return OT_ERROR_NONE;
659 }
660 
otPlatUdpBindToNetif(otUdpSocket * aUdpSocket,otNetifIdentifier aNetifIdentifier)661 otError otPlatUdpBindToNetif(otUdpSocket *aUdpSocket, otNetifIdentifier aNetifIdentifier)
662 {
663     OT_UNUSED_VARIABLE(aUdpSocket);
664     OT_UNUSED_VARIABLE(aNetifIdentifier);
665     return OT_ERROR_NONE;
666 }
667 
otPlatUdpConnect(otUdpSocket * aUdpSocket)668 otError otPlatUdpConnect(otUdpSocket *aUdpSocket)
669 {
670     OT_UNUSED_VARIABLE(aUdpSocket);
671     return OT_ERROR_NONE;
672 }
673 
otPlatUdpSend(otUdpSocket * aUdpSocket,otMessage * aMessage,const otMessageInfo * aMessageInfo)674 otError otPlatUdpSend(otUdpSocket *aUdpSocket, otMessage *aMessage, const otMessageInfo *aMessageInfo)
675 {
676     OT_UNUSED_VARIABLE(aUdpSocket);
677     OT_UNUSED_VARIABLE(aMessageInfo);
678     return OT_ERROR_NONE;
679 }
680 
otPlatUdpJoinMulticastGroup(otUdpSocket * aUdpSocket,otNetifIdentifier aNetifIdentifier,const otIp6Address * aAddress)681 otError otPlatUdpJoinMulticastGroup(otUdpSocket        *aUdpSocket,
682                                     otNetifIdentifier   aNetifIdentifier,
683                                     const otIp6Address *aAddress)
684 {
685     OT_UNUSED_VARIABLE(aUdpSocket);
686     OT_UNUSED_VARIABLE(aNetifIdentifier);
687     OT_UNUSED_VARIABLE(aAddress);
688     return OT_ERROR_NONE;
689 }
690 
otPlatUdpLeaveMulticastGroup(otUdpSocket * aUdpSocket,otNetifIdentifier aNetifIdentifier,const otIp6Address * aAddress)691 otError otPlatUdpLeaveMulticastGroup(otUdpSocket        *aUdpSocket,
692                                      otNetifIdentifier   aNetifIdentifier,
693                                      const otIp6Address *aAddress)
694 {
695     OT_UNUSED_VARIABLE(aUdpSocket);
696     OT_UNUSED_VARIABLE(aNetifIdentifier);
697     OT_UNUSED_VARIABLE(aAddress);
698     return OT_ERROR_NONE;
699 }
700 #endif // OPENTHREAD_CONFIG_PLATFORM_UDP_ENABLE
701 
702 #if OPENTHREAD_CONFIG_DNS_UPSTREAM_QUERY_ENABLE
otPlatDnsStartUpstreamQuery(otInstance * aInstance,otPlatDnsUpstreamQuery * aTxn,const otMessage * aQuery)703 void otPlatDnsStartUpstreamQuery(otInstance *aInstance, otPlatDnsUpstreamQuery *aTxn, const otMessage *aQuery)
704 {
705     OT_UNUSED_VARIABLE(aInstance);
706     OT_UNUSED_VARIABLE(aTxn);
707     OT_UNUSED_VARIABLE(aQuery);
708 }
709 
otPlatDnsCancelUpstreamQuery(otInstance * aInstance,otPlatDnsUpstreamQuery * aTxn)710 void otPlatDnsCancelUpstreamQuery(otInstance *aInstance, otPlatDnsUpstreamQuery *aTxn)
711 {
712     otPlatDnsUpstreamQueryDone(aInstance, aTxn, nullptr);
713 }
714 #endif
715 
otPlatRadioGetCcaEnergyDetectThreshold(otInstance *,int8_t *)716 OT_TOOL_WEAK otError otPlatRadioGetCcaEnergyDetectThreshold(otInstance *, int8_t *) { return OT_ERROR_NONE; }
717 
otPlatRadioGetCoexMetrics(otInstance *,otRadioCoexMetrics *)718 OT_TOOL_WEAK otError otPlatRadioGetCoexMetrics(otInstance *, otRadioCoexMetrics *) { return OT_ERROR_NONE; }
719 
otPlatRadioGetTransmitPower(otInstance *,int8_t *)720 OT_TOOL_WEAK otError otPlatRadioGetTransmitPower(otInstance *, int8_t *) { return OT_ERROR_NONE; }
721 
otPlatRadioIsCoexEnabled(otInstance *)722 OT_TOOL_WEAK bool otPlatRadioIsCoexEnabled(otInstance *) { return true; }
723 
otPlatRadioSetCoexEnabled(otInstance *,bool)724 OT_TOOL_WEAK otError otPlatRadioSetCoexEnabled(otInstance *, bool) { return OT_ERROR_NOT_IMPLEMENTED; }
725 
726 #if OPENTHREAD_CONFIG_PLATFORM_POWER_CALIBRATION_ENABLE
otPlatRadioSetChannelTargetPower(otInstance * aInstance,uint8_t aChannel,int16_t aTargetPower)727 OT_TOOL_WEAK otError otPlatRadioSetChannelTargetPower(otInstance *aInstance, uint8_t aChannel, int16_t aTargetPower)
728 {
729     return OT_ERROR_NONE;
730 }
731 
otPlatRadioAddCalibratedPower(otInstance * aInstance,uint8_t aChannel,int16_t aActualPower,const uint8_t * aRawPowerSetting,uint16_t aRawPowerSettingLength)732 OT_TOOL_WEAK otError otPlatRadioAddCalibratedPower(otInstance    *aInstance,
733                                                    uint8_t        aChannel,
734                                                    int16_t        aActualPower,
735                                                    const uint8_t *aRawPowerSetting,
736                                                    uint16_t       aRawPowerSettingLength)
737 {
738     return OT_ERROR_NONE;
739 }
740 
otPlatRadioClearCalibratedPowers(otInstance * aInstance)741 OT_TOOL_WEAK otError otPlatRadioClearCalibratedPowers(otInstance *aInstance) { return OT_ERROR_NONE; }
742 #endif // OPENTHREAD_CONFIG_PLATFORM_POWER_CALIBRATION_ENABLE
743 
744 #if OPENTHREAD_CONFIG_NCP_ENABLE_MCU_POWER_STATE_CONTROL
otPlatGetMcuPowerState(otInstance * aInstance)745 OT_TOOL_WEAK otPlatMcuPowerState otPlatGetMcuPowerState(otInstance *aInstance) { return OT_PLAT_MCU_POWER_STATE_ON; }
746 
otPlatSetMcuPowerState(otInstance * aInstance,otPlatMcuPowerState aState)747 OT_TOOL_WEAK otError otPlatSetMcuPowerState(otInstance *aInstance, otPlatMcuPowerState aState) { return OT_ERROR_NONE; }
748 #endif // OPENTHREAD_CONFIG_NCP_ENABLE_MCU_POWER_STATE_CONTROL
749 #ifdef OPENTHREAD_CONFIG_BLE_TCAT_ENABLE
otPlatBleEnable(otInstance * aInstance)750 otError otPlatBleEnable(otInstance *aInstance)
751 {
752     OT_UNUSED_VARIABLE(aInstance);
753     return OT_ERROR_NONE;
754 }
755 
otPlatBleDisable(otInstance * aInstance)756 otError otPlatBleDisable(otInstance *aInstance)
757 {
758     OT_UNUSED_VARIABLE(aInstance);
759     return OT_ERROR_NONE;
760 }
761 
otPlatBleGetAdvertisementBuffer(otInstance * aInstance,uint8_t ** aAdvertisementBuffer)762 otError otPlatBleGetAdvertisementBuffer(otInstance *aInstance, uint8_t **aAdvertisementBuffer)
763 {
764     OT_UNUSED_VARIABLE(aInstance);
765     static uint8_t sAdvertisementBuffer[OT_TCAT_ADVERTISEMENT_MAX_LEN];
766 
767     *aAdvertisementBuffer = sAdvertisementBuffer;
768 
769     return OT_ERROR_NONE;
770 }
771 
otPlatBleGapAdvStart(otInstance * aInstance,uint16_t aInterval)772 otError otPlatBleGapAdvStart(otInstance *aInstance, uint16_t aInterval)
773 {
774     OT_UNUSED_VARIABLE(aInstance);
775     OT_UNUSED_VARIABLE(aInterval);
776     return OT_ERROR_NONE;
777 }
778 
otPlatBleGapAdvStop(otInstance * aInstance)779 otError otPlatBleGapAdvStop(otInstance *aInstance)
780 {
781     OT_UNUSED_VARIABLE(aInstance);
782     return OT_ERROR_NONE;
783 }
784 
otPlatBleGapDisconnect(otInstance * aInstance)785 otError otPlatBleGapDisconnect(otInstance *aInstance)
786 {
787     OT_UNUSED_VARIABLE(aInstance);
788     return OT_ERROR_NONE;
789 }
790 
otPlatBleGattMtuGet(otInstance * aInstance,uint16_t * aMtu)791 otError otPlatBleGattMtuGet(otInstance *aInstance, uint16_t *aMtu)
792 {
793     OT_UNUSED_VARIABLE(aInstance);
794     OT_UNUSED_VARIABLE(aMtu);
795     return OT_ERROR_NONE;
796 }
797 
otPlatBleGattServerIndicate(otInstance * aInstance,uint16_t aHandle,const otBleRadioPacket * aPacket)798 otError otPlatBleGattServerIndicate(otInstance *aInstance, uint16_t aHandle, const otBleRadioPacket *aPacket)
799 {
800     OT_UNUSED_VARIABLE(aInstance);
801     OT_UNUSED_VARIABLE(aHandle);
802     OT_UNUSED_VARIABLE(aPacket);
803     return OT_ERROR_NONE;
804 }
805 
otPlatBleGetLinkCapabilities(otInstance * aInstance,otBleLinkCapabilities * aBleLinkCapabilities)806 void otPlatBleGetLinkCapabilities(otInstance *aInstance, otBleLinkCapabilities *aBleLinkCapabilities)
807 {
808     OT_UNUSED_VARIABLE(aInstance);
809 
810     aBleLinkCapabilities->mGattNotifications = true;
811     aBleLinkCapabilities->mL2CapDirect       = false;
812     aBleLinkCapabilities->mRsv               = 0;
813 }
814 
otPlatBleSupportsMultiRadio(otInstance * aInstance)815 bool otPlatBleSupportsMultiRadio(otInstance *aInstance)
816 {
817     OT_UNUSED_VARIABLE(aInstance);
818     return false;
819 }
820 
otPlatBleGapAdvSetData(otInstance * aInstance,uint8_t * aAdvertisementData,uint16_t aAdvertisementLen)821 otError otPlatBleGapAdvSetData(otInstance *aInstance, uint8_t *aAdvertisementData, uint16_t aAdvertisementLen)
822 {
823     OT_UNUSED_VARIABLE(aInstance);
824     OT_UNUSED_VARIABLE(aAdvertisementData);
825     OT_UNUSED_VARIABLE(aAdvertisementLen);
826     return OT_ERROR_NONE;
827 }
828 
829 #endif // OPENTHREAD_CONFIG_BLE_TCAT_ENABLE
830 
831 #if OPENTHREAD_CONFIG_PLATFORM_DNSSD_ENABLE
832 
otPlatDnssdGetState(otInstance * aInstance)833 OT_TOOL_WEAK otPlatDnssdState otPlatDnssdGetState(otInstance *aInstance)
834 {
835     OT_UNUSED_VARIABLE(aInstance);
836 
837     return OT_PLAT_DNSSD_STOPPED;
838 }
839 
otPlatDnssdRegisterService(otInstance * aInstance,const otPlatDnssdService * aService,otPlatDnssdRequestId aRequestId,otPlatDnssdRegisterCallback aCallback)840 OT_TOOL_WEAK void otPlatDnssdRegisterService(otInstance                 *aInstance,
841                                              const otPlatDnssdService   *aService,
842                                              otPlatDnssdRequestId        aRequestId,
843                                              otPlatDnssdRegisterCallback aCallback)
844 {
845     OT_UNUSED_VARIABLE(aInstance);
846     OT_UNUSED_VARIABLE(aService);
847     OT_UNUSED_VARIABLE(aRequestId);
848     OT_UNUSED_VARIABLE(aCallback);
849 }
850 
otPlatDnssdUnregisterService(otInstance * aInstance,const otPlatDnssdService * aService,otPlatDnssdRequestId aRequestId,otPlatDnssdRegisterCallback aCallback)851 OT_TOOL_WEAK void otPlatDnssdUnregisterService(otInstance                 *aInstance,
852                                                const otPlatDnssdService   *aService,
853                                                otPlatDnssdRequestId        aRequestId,
854                                                otPlatDnssdRegisterCallback aCallback)
855 {
856     OT_UNUSED_VARIABLE(aInstance);
857     OT_UNUSED_VARIABLE(aService);
858     OT_UNUSED_VARIABLE(aRequestId);
859     OT_UNUSED_VARIABLE(aCallback);
860 }
861 
otPlatDnssdRegisterHost(otInstance * aInstance,const otPlatDnssdHost * aHost,otPlatDnssdRequestId aRequestId,otPlatDnssdRegisterCallback aCallback)862 OT_TOOL_WEAK void otPlatDnssdRegisterHost(otInstance                 *aInstance,
863                                           const otPlatDnssdHost      *aHost,
864                                           otPlatDnssdRequestId        aRequestId,
865                                           otPlatDnssdRegisterCallback aCallback)
866 {
867     OT_UNUSED_VARIABLE(aInstance);
868     OT_UNUSED_VARIABLE(aHost);
869     OT_UNUSED_VARIABLE(aRequestId);
870     OT_UNUSED_VARIABLE(aCallback);
871 }
872 
otPlatDnssdUnregisterHost(otInstance * aInstance,const otPlatDnssdHost * aHost,otPlatDnssdRequestId aRequestId,otPlatDnssdRegisterCallback aCallback)873 OT_TOOL_WEAK void otPlatDnssdUnregisterHost(otInstance                 *aInstance,
874                                             const otPlatDnssdHost      *aHost,
875                                             otPlatDnssdRequestId        aRequestId,
876                                             otPlatDnssdRegisterCallback aCallback)
877 {
878     OT_UNUSED_VARIABLE(aInstance);
879     OT_UNUSED_VARIABLE(aHost);
880     OT_UNUSED_VARIABLE(aRequestId);
881     OT_UNUSED_VARIABLE(aCallback);
882 }
883 
otPlatDnssdRegisterKey(otInstance * aInstance,const otPlatDnssdKey * aKey,otPlatDnssdRequestId aRequestId,otPlatDnssdRegisterCallback aCallback)884 OT_TOOL_WEAK void otPlatDnssdRegisterKey(otInstance                 *aInstance,
885                                          const otPlatDnssdKey       *aKey,
886                                          otPlatDnssdRequestId        aRequestId,
887                                          otPlatDnssdRegisterCallback aCallback)
888 {
889     OT_UNUSED_VARIABLE(aInstance);
890     OT_UNUSED_VARIABLE(aKey);
891     OT_UNUSED_VARIABLE(aRequestId);
892     OT_UNUSED_VARIABLE(aCallback);
893 }
894 
otPlatDnssdUnregisterKey(otInstance * aInstance,const otPlatDnssdKey * aKey,otPlatDnssdRequestId aRequestId,otPlatDnssdRegisterCallback aCallback)895 OT_TOOL_WEAK void otPlatDnssdUnregisterKey(otInstance                 *aInstance,
896                                            const otPlatDnssdKey       *aKey,
897                                            otPlatDnssdRequestId        aRequestId,
898                                            otPlatDnssdRegisterCallback aCallback)
899 {
900     OT_UNUSED_VARIABLE(aInstance);
901     OT_UNUSED_VARIABLE(aKey);
902     OT_UNUSED_VARIABLE(aRequestId);
903     OT_UNUSED_VARIABLE(aCallback);
904 }
905 
otPlatDnssdStartBrowser(otInstance * aInstance,const otPlatDnssdBrowser * aBrowser)906 OT_TOOL_WEAK void otPlatDnssdStartBrowser(otInstance *aInstance, const otPlatDnssdBrowser *aBrowser)
907 {
908     OT_UNUSED_VARIABLE(aInstance);
909     OT_UNUSED_VARIABLE(aBrowser);
910 }
911 
otPlatDnssdStopBrowser(otInstance * aInstance,const otPlatDnssdBrowser * aBrowser)912 OT_TOOL_WEAK void otPlatDnssdStopBrowser(otInstance *aInstance, const otPlatDnssdBrowser *aBrowser)
913 {
914     OT_UNUSED_VARIABLE(aInstance);
915     OT_UNUSED_VARIABLE(aBrowser);
916 }
917 
otPlatDnssdStartSrvResolver(otInstance * aInstance,const otPlatDnssdSrvResolver * aResolver)918 OT_TOOL_WEAK void otPlatDnssdStartSrvResolver(otInstance *aInstance, const otPlatDnssdSrvResolver *aResolver)
919 {
920     OT_UNUSED_VARIABLE(aInstance);
921     OT_UNUSED_VARIABLE(aResolver);
922 }
923 
otPlatDnssdStopSrvResolver(otInstance * aInstance,const otPlatDnssdSrvResolver * aResolver)924 OT_TOOL_WEAK void otPlatDnssdStopSrvResolver(otInstance *aInstance, const otPlatDnssdSrvResolver *aResolver)
925 {
926     OT_UNUSED_VARIABLE(aInstance);
927     OT_UNUSED_VARIABLE(aResolver);
928 }
929 
otPlatDnssdStartTxtResolver(otInstance * aInstance,const otPlatDnssdTxtResolver * aResolver)930 OT_TOOL_WEAK void otPlatDnssdStartTxtResolver(otInstance *aInstance, const otPlatDnssdTxtResolver *aResolver)
931 {
932     OT_UNUSED_VARIABLE(aInstance);
933     OT_UNUSED_VARIABLE(aResolver);
934 }
935 
otPlatDnssdStopTxtResolver(otInstance * aInstance,const otPlatDnssdTxtResolver * aResolver)936 OT_TOOL_WEAK void otPlatDnssdStopTxtResolver(otInstance *aInstance, const otPlatDnssdTxtResolver *aResolver)
937 {
938     OT_UNUSED_VARIABLE(aInstance);
939     OT_UNUSED_VARIABLE(aResolver);
940 }
941 
otPlatDnssdStartIp6AddressResolver(otInstance * aInstance,const otPlatDnssdAddressResolver * aResolver)942 OT_TOOL_WEAK void otPlatDnssdStartIp6AddressResolver(otInstance *aInstance, const otPlatDnssdAddressResolver *aResolver)
943 {
944     OT_UNUSED_VARIABLE(aInstance);
945     OT_UNUSED_VARIABLE(aResolver);
946 }
947 
otPlatDnssdStopIp6AddressResolver(otInstance * aInstance,const otPlatDnssdAddressResolver * aResolver)948 OT_TOOL_WEAK void otPlatDnssdStopIp6AddressResolver(otInstance *aInstance, const otPlatDnssdAddressResolver *aResolver)
949 {
950     OT_UNUSED_VARIABLE(aInstance);
951     OT_UNUSED_VARIABLE(aResolver);
952 }
953 
otPlatDnssdStartIp4AddressResolver(otInstance * aInstance,const otPlatDnssdAddressResolver * aResolver)954 OT_TOOL_WEAK void otPlatDnssdStartIp4AddressResolver(otInstance *aInstance, const otPlatDnssdAddressResolver *aResolver)
955 {
956     OT_UNUSED_VARIABLE(aInstance);
957     OT_UNUSED_VARIABLE(aResolver);
958 }
959 
otPlatDnssdStopIp4AddressResolver(otInstance * aInstance,const otPlatDnssdAddressResolver * aResolver)960 OT_TOOL_WEAK void otPlatDnssdStopIp4AddressResolver(otInstance *aInstance, const otPlatDnssdAddressResolver *aResolver)
961 {
962     OT_UNUSED_VARIABLE(aInstance);
963     OT_UNUSED_VARIABLE(aResolver);
964 }
965 
966 #endif // OPENTHREAD_CONFIG_PLATFORM_DNSSD_ENABLE
967 
968 #if OPENTHREAD_CONFIG_PLATFORM_LOG_CRASH_DUMP_ENABLE
otPlatLogCrashDump(void)969 OT_TOOL_WEAK otError otPlatLogCrashDump(void) { return OT_ERROR_NONE; }
970 #endif
971 
otPlatAssertFail(const char *,int)972 OT_TOOL_WEAK void otPlatAssertFail(const char *, int) {}
973 } // extern "C"
974