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_CORE_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 extern "C" {
103 
104 #if OPENTHREAD_CONFIG_HEAP_EXTERNAL_ENABLE
otPlatCAlloc(size_t aNum,size_t aSize)105 OT_TOOL_WEAK void *otPlatCAlloc(size_t aNum, size_t aSize) { return calloc(aNum, aSize); }
106 
otPlatFree(void * aPtr)107 OT_TOOL_WEAK void otPlatFree(void *aPtr) { free(aPtr); }
108 #endif
109 
otTaskletsSignalPending(otInstance *)110 OT_TOOL_WEAK void otTaskletsSignalPending(otInstance *) {}
111 
otPlatAlarmMilliStop(otInstance *)112 OT_TOOL_WEAK void otPlatAlarmMilliStop(otInstance *) {}
113 
otPlatAlarmMilliStartAt(otInstance *,uint32_t,uint32_t)114 OT_TOOL_WEAK void otPlatAlarmMilliStartAt(otInstance *, uint32_t, uint32_t) {}
115 
otPlatAlarmMilliGetNow(void)116 OT_TOOL_WEAK uint32_t otPlatAlarmMilliGetNow(void)
117 {
118     struct timeval tv;
119 
120     gettimeofday(&tv, nullptr);
121 
122     return (uint32_t)((tv.tv_sec * 1000) + (tv.tv_usec / 1000) + 123456);
123 }
124 
otPlatAlarmMicroStop(otInstance *)125 OT_TOOL_WEAK void otPlatAlarmMicroStop(otInstance *) {}
126 
otPlatAlarmMicroStartAt(otInstance *,uint32_t,uint32_t)127 OT_TOOL_WEAK void otPlatAlarmMicroStartAt(otInstance *, uint32_t, uint32_t) {}
128 
otPlatAlarmMicroGetNow(void)129 OT_TOOL_WEAK uint32_t otPlatAlarmMicroGetNow(void)
130 {
131     struct timeval tv;
132 
133     gettimeofday(&tv, nullptr);
134 
135     return (uint32_t)((tv.tv_sec * 1000000) + tv.tv_usec + 123456);
136 }
137 
otPlatMultipanGetActiveInstance(otInstance **)138 OT_TOOL_WEAK otError otPlatMultipanGetActiveInstance(otInstance **) { return OT_ERROR_NOT_IMPLEMENTED; }
139 
otPlatMultipanSetActiveInstance(otInstance *,bool)140 OT_TOOL_WEAK otError otPlatMultipanSetActiveInstance(otInstance *, bool) { return OT_ERROR_NOT_IMPLEMENTED; }
141 
otPlatRadioGetIeeeEui64(otInstance *,uint8_t *)142 OT_TOOL_WEAK void otPlatRadioGetIeeeEui64(otInstance *, uint8_t *) {}
143 
otPlatRadioSetPanId(otInstance *,uint16_t)144 OT_TOOL_WEAK void otPlatRadioSetPanId(otInstance *, uint16_t) {}
145 
otPlatRadioSetExtendedAddress(otInstance *,const otExtAddress *)146 OT_TOOL_WEAK void otPlatRadioSetExtendedAddress(otInstance *, const otExtAddress *) {}
147 
otPlatRadioSetShortAddress(otInstance *,uint16_t)148 OT_TOOL_WEAK void otPlatRadioSetShortAddress(otInstance *, uint16_t) {}
149 
otPlatRadioSetPromiscuous(otInstance *,bool)150 OT_TOOL_WEAK void otPlatRadioSetPromiscuous(otInstance *, bool) {}
151 
otPlatRadioSetRxOnWhenIdle(otInstance *,bool)152 OT_TOOL_WEAK void otPlatRadioSetRxOnWhenIdle(otInstance *, bool) {}
153 
otPlatRadioIsEnabled(otInstance *)154 OT_TOOL_WEAK bool otPlatRadioIsEnabled(otInstance *) { return true; }
155 
otPlatRadioEnable(otInstance *)156 OT_TOOL_WEAK otError otPlatRadioEnable(otInstance *) { return OT_ERROR_NONE; }
157 
otPlatRadioDisable(otInstance *)158 OT_TOOL_WEAK otError otPlatRadioDisable(otInstance *) { return OT_ERROR_NONE; }
159 
otPlatRadioSleep(otInstance *)160 OT_TOOL_WEAK otError otPlatRadioSleep(otInstance *) { return OT_ERROR_NONE; }
161 
otPlatRadioReceive(otInstance *,uint8_t)162 OT_TOOL_WEAK otError otPlatRadioReceive(otInstance *, uint8_t) { return OT_ERROR_NONE; }
163 
otPlatRadioTransmit(otInstance *,otRadioFrame *)164 OT_TOOL_WEAK otError otPlatRadioTransmit(otInstance *, otRadioFrame *) { return OT_ERROR_NONE; }
165 
otPlatRadioGetTransmitBuffer(otInstance *)166 OT_TOOL_WEAK otRadioFrame *otPlatRadioGetTransmitBuffer(otInstance *) { return nullptr; }
167 
otPlatRadioGetRssi(otInstance *)168 OT_TOOL_WEAK int8_t otPlatRadioGetRssi(otInstance *) { return 0; }
169 
otPlatRadioGetCaps(otInstance *)170 OT_TOOL_WEAK otRadioCaps otPlatRadioGetCaps(otInstance *) { return OT_RADIO_CAPS_NONE; }
171 
otPlatRadioGetPromiscuous(otInstance *)172 OT_TOOL_WEAK bool otPlatRadioGetPromiscuous(otInstance *) { return false; }
173 
otPlatRadioEnableSrcMatch(otInstance *,bool)174 OT_TOOL_WEAK void otPlatRadioEnableSrcMatch(otInstance *, bool) {}
175 
otPlatRadioAddSrcMatchShortEntry(otInstance *,uint16_t)176 OT_TOOL_WEAK otError otPlatRadioAddSrcMatchShortEntry(otInstance *, uint16_t) { return OT_ERROR_NONE; }
177 
otPlatRadioAddSrcMatchExtEntry(otInstance *,const otExtAddress *)178 OT_TOOL_WEAK otError otPlatRadioAddSrcMatchExtEntry(otInstance *, const otExtAddress *) { return OT_ERROR_NONE; }
179 
otPlatRadioClearSrcMatchShortEntry(otInstance *,uint16_t)180 OT_TOOL_WEAK otError otPlatRadioClearSrcMatchShortEntry(otInstance *, uint16_t) { return OT_ERROR_NONE; }
181 
otPlatRadioClearSrcMatchExtEntry(otInstance *,const otExtAddress *)182 OT_TOOL_WEAK otError otPlatRadioClearSrcMatchExtEntry(otInstance *, const otExtAddress *) { return OT_ERROR_NONE; }
183 
otPlatRadioClearSrcMatchShortEntries(otInstance *)184 OT_TOOL_WEAK void otPlatRadioClearSrcMatchShortEntries(otInstance *) {}
185 
otPlatRadioClearSrcMatchExtEntries(otInstance *)186 OT_TOOL_WEAK void otPlatRadioClearSrcMatchExtEntries(otInstance *) {}
187 
otPlatRadioEnergyScan(otInstance *,uint8_t,uint16_t)188 OT_TOOL_WEAK otError otPlatRadioEnergyScan(otInstance *, uint8_t, uint16_t) { return OT_ERROR_NOT_IMPLEMENTED; }
189 
otPlatRadioSetTransmitPower(otInstance *,int8_t)190 OT_TOOL_WEAK otError otPlatRadioSetTransmitPower(otInstance *, int8_t) { return OT_ERROR_NOT_IMPLEMENTED; }
191 
otPlatRadioGetReceiveSensitivity(otInstance *)192 OT_TOOL_WEAK int8_t otPlatRadioGetReceiveSensitivity(otInstance *) { return -100; }
193 
otPlatEntropyGet(uint8_t * aOutput,uint16_t aOutputLength)194 OT_TOOL_WEAK otError otPlatEntropyGet(uint8_t *aOutput, uint16_t aOutputLength)
195 {
196     otError error = OT_ERROR_NONE;
197 
198     VerifyOrExit(aOutput, error = OT_ERROR_INVALID_ARGS);
199 
200 #if __SANITIZE_ADDRESS__ == 0
201     {
202         FILE  *file = nullptr;
203         size_t readLength;
204 
205         file = fopen("/dev/urandom", "rb");
206         VerifyOrExit(file != nullptr, error = OT_ERROR_FAILED);
207 
208         readLength = fread(aOutput, 1, aOutputLength, file);
209 
210         if (readLength != aOutputLength)
211         {
212             error = OT_ERROR_FAILED;
213         }
214 
215         fclose(file);
216     }
217 #else
218     for (uint16_t length = 0; length < aOutputLength; length++)
219     {
220         aOutput[length] = (uint8_t)rand();
221     }
222 #endif
223 
224 exit:
225     return error;
226 }
227 
otPlatDiagProcess(otInstance *,uint8_t,char * aArgs[],char * aOutput,size_t aOutputMaxLen)228 OT_TOOL_WEAK void otPlatDiagProcess(otInstance *, uint8_t, char *aArgs[], char *aOutput, size_t aOutputMaxLen)
229 {
230     snprintf(aOutput, aOutputMaxLen, "diag feature '%s' is not supported\r\n", aArgs[0]);
231 }
232 
otPlatDiagModeSet(bool aMode)233 OT_TOOL_WEAK void otPlatDiagModeSet(bool aMode) { sDiagMode = aMode; }
234 
otPlatDiagModeGet()235 OT_TOOL_WEAK bool otPlatDiagModeGet() { return sDiagMode; }
236 
otPlatDiagChannelSet(uint8_t)237 OT_TOOL_WEAK void otPlatDiagChannelSet(uint8_t) {}
238 
otPlatDiagTxPowerSet(int8_t)239 OT_TOOL_WEAK void otPlatDiagTxPowerSet(int8_t) {}
240 
otPlatDiagRadioReceived(otInstance *,otRadioFrame *,otError)241 OT_TOOL_WEAK void otPlatDiagRadioReceived(otInstance *, otRadioFrame *, otError) {}
242 
otPlatDiagAlarmCallback(otInstance *)243 OT_TOOL_WEAK void otPlatDiagAlarmCallback(otInstance *) {}
244 
otPlatUartSendDone(void)245 OT_TOOL_WEAK void otPlatUartSendDone(void) {}
246 
otPlatUartReceived(const uint8_t *,uint16_t)247 OT_TOOL_WEAK void otPlatUartReceived(const uint8_t *, uint16_t) {}
248 
otPlatReset(otInstance *)249 OT_TOOL_WEAK void otPlatReset(otInstance *) {}
250 
otPlatResetToBootloader(otInstance *)251 OT_TOOL_WEAK otError otPlatResetToBootloader(otInstance *) { return OT_ERROR_NOT_CAPABLE; }
252 
otPlatGetResetReason(otInstance *)253 OT_TOOL_WEAK otPlatResetReason otPlatGetResetReason(otInstance *) { return OT_PLAT_RESET_REASON_POWER_ON; }
254 
otPlatWakeHost(void)255 OT_TOOL_WEAK void otPlatWakeHost(void) {}
256 
otPlatLog(otLogLevel,otLogRegion,const char *,...)257 OT_TOOL_WEAK void otPlatLog(otLogLevel, otLogRegion, const char *, ...) {}
258 
otPlatSettingsInit(otInstance *,const uint16_t *,uint16_t)259 OT_TOOL_WEAK void otPlatSettingsInit(otInstance *, const uint16_t *, uint16_t) {}
260 
otPlatSettingsDeinit(otInstance *)261 OT_TOOL_WEAK void otPlatSettingsDeinit(otInstance *) {}
262 
otPlatSettingsGet(otInstance *,uint16_t aKey,int aIndex,uint8_t * aValue,uint16_t * aValueLength)263 OT_TOOL_WEAK otError otPlatSettingsGet(otInstance *, uint16_t aKey, int aIndex, uint8_t *aValue, uint16_t *aValueLength)
264 {
265     auto setting = settings.find(aKey);
266 
267     if (setting == settings.end())
268     {
269         return OT_ERROR_NOT_FOUND;
270     }
271 
272     if (aIndex > setting->second.size())
273     {
274         return OT_ERROR_NOT_FOUND;
275     }
276 
277     if (aValueLength == nullptr)
278     {
279         return OT_ERROR_NONE;
280     }
281 
282     const auto &data = setting->second[aIndex];
283 
284     if (aValue == nullptr)
285     {
286         *aValueLength = data.size();
287         return OT_ERROR_NONE;
288     }
289 
290     if (*aValueLength >= data.size())
291     {
292         *aValueLength = data.size();
293     }
294 
295     memcpy(aValue, &data[0], *aValueLength);
296 
297     return OT_ERROR_NONE;
298 }
299 
otPlatSettingsSet(otInstance *,uint16_t aKey,const uint8_t * aValue,uint16_t aValueLength)300 OT_TOOL_WEAK otError otPlatSettingsSet(otInstance *, uint16_t aKey, const uint8_t *aValue, uint16_t aValueLength)
301 {
302     auto setting = std::vector<uint8_t>(aValue, aValue + aValueLength);
303 
304     settings[aKey].clear();
305     settings[aKey].push_back(setting);
306 
307     return OT_ERROR_NONE;
308 }
309 
otPlatSettingsAdd(otInstance *,uint16_t aKey,const uint8_t * aValue,uint16_t aValueLength)310 OT_TOOL_WEAK otError otPlatSettingsAdd(otInstance *, uint16_t aKey, const uint8_t *aValue, uint16_t aValueLength)
311 {
312     auto setting = std::vector<uint8_t>(aValue, aValue + aValueLength);
313     settings[aKey].push_back(setting);
314 
315     return OT_ERROR_NONE;
316 }
317 
otPlatSettingsDelete(otInstance *,uint16_t aKey,int aIndex)318 OT_TOOL_WEAK otError otPlatSettingsDelete(otInstance *, uint16_t aKey, int aIndex)
319 {
320     auto setting = settings.find(aKey);
321     if (setting == settings.end())
322     {
323         return OT_ERROR_NOT_FOUND;
324     }
325 
326     if (aIndex >= setting->second.size())
327     {
328         return OT_ERROR_NOT_FOUND;
329     }
330     setting->second.erase(setting->second.begin() + aIndex);
331     return OT_ERROR_NONE;
332 }
333 
otPlatSettingsWipe(otInstance *)334 OT_TOOL_WEAK void otPlatSettingsWipe(otInstance *) { settings.clear(); }
335 
GetFlash(void)336 uint8_t *GetFlash(void)
337 {
338     static uint8_t sFlash[FLASH_SWAP_SIZE * FLASH_SWAP_NUM];
339     static bool    sInitialized;
340 
341     if (!sInitialized)
342     {
343         memset(sFlash, 0xff, sizeof(sFlash));
344         sInitialized = true;
345     }
346 
347     return sFlash;
348 }
349 
otPlatFlashInit(otInstance *)350 OT_TOOL_WEAK void otPlatFlashInit(otInstance *) {}
351 
otPlatFlashGetSwapSize(otInstance *)352 OT_TOOL_WEAK uint32_t otPlatFlashGetSwapSize(otInstance *) { return FLASH_SWAP_SIZE; }
353 
otPlatFlashErase(otInstance *,uint8_t aSwapIndex)354 OT_TOOL_WEAK void otPlatFlashErase(otInstance *, uint8_t aSwapIndex)
355 {
356     uint32_t address;
357 
358     VerifyOrQuit(aSwapIndex < FLASH_SWAP_NUM, "aSwapIndex invalid");
359 
360     address = aSwapIndex ? FLASH_SWAP_SIZE : 0;
361 
362     memset(GetFlash() + address, 0xff, FLASH_SWAP_SIZE);
363 }
364 
otPlatFlashRead(otInstance *,uint8_t aSwapIndex,uint32_t aOffset,void * aData,uint32_t aSize)365 OT_TOOL_WEAK void otPlatFlashRead(otInstance *, uint8_t aSwapIndex, uint32_t aOffset, void *aData, uint32_t aSize)
366 {
367     uint32_t address;
368 
369     VerifyOrQuit(aSwapIndex < FLASH_SWAP_NUM, "aSwapIndex invalid");
370     VerifyOrQuit(aSize <= FLASH_SWAP_SIZE, "aSize invalid");
371     VerifyOrQuit(aOffset <= (FLASH_SWAP_SIZE - aSize), "aOffset + aSize invalid");
372 
373     address = aSwapIndex ? FLASH_SWAP_SIZE : 0;
374 
375     memcpy(aData, GetFlash() + address + aOffset, aSize);
376 }
377 
otPlatFlashWrite(otInstance *,uint8_t aSwapIndex,uint32_t aOffset,const void * aData,uint32_t aSize)378 OT_TOOL_WEAK void otPlatFlashWrite(otInstance *,
379                                    uint8_t     aSwapIndex,
380                                    uint32_t    aOffset,
381                                    const void *aData,
382                                    uint32_t    aSize)
383 {
384     uint32_t address;
385 
386     VerifyOrQuit(aSwapIndex < FLASH_SWAP_NUM, "aSwapIndex invalid");
387     VerifyOrQuit(aSize <= FLASH_SWAP_SIZE, "aSize invalid");
388     VerifyOrQuit(aOffset <= (FLASH_SWAP_SIZE - aSize), "aOffset + aSize invalid");
389 
390     address = aSwapIndex ? FLASH_SWAP_SIZE : 0;
391 
392     for (uint32_t index = 0; index < aSize; index++)
393     {
394         GetFlash()[address + aOffset + index] &= ((uint8_t *)aData)[index];
395     }
396 }
397 
398 #if OPENTHREAD_CONFIG_TIME_SYNC_ENABLE || OPENTHREAD_CONFIG_MAC_CSL_RECEIVER_ENABLE
otPlatTimeGetXtalAccuracy(void)399 OT_TOOL_WEAK uint16_t otPlatTimeGetXtalAccuracy(void) { return 0; }
400 #endif
401 
402 #if OPENTHREAD_CONFIG_MAC_CSL_RECEIVER_ENABLE
otPlatRadioEnableCsl(otInstance *,uint32_t,otShortAddress,const otExtAddress *)403 OT_TOOL_WEAK otError otPlatRadioEnableCsl(otInstance *, uint32_t, otShortAddress, const otExtAddress *)
404 {
405     return OT_ERROR_NONE;
406 }
407 
otPlatRadioResetCsl(otInstance *)408 OT_TOOL_WEAK otError otPlatRadioResetCsl(otInstance *) { return OT_ERROR_NONE; }
409 
otPlatRadioUpdateCslSampleTime(otInstance *,uint32_t)410 OT_TOOL_WEAK void otPlatRadioUpdateCslSampleTime(otInstance *, uint32_t) {}
411 
otPlatRadioGetCslAccuracy(otInstance *)412 OT_TOOL_WEAK uint8_t otPlatRadioGetCslAccuracy(otInstance *)
413 {
414     return static_cast<uint8_t>(otPlatTimeGetXtalAccuracy() / 2);
415 }
416 #endif
417 
418 #if OPENTHREAD_CONFIG_OTNS_ENABLE
otPlatOtnsStatus(const char *)419 OT_TOOL_WEAK void otPlatOtnsStatus(const char *) {}
420 #endif
421 
422 #if OPENTHREAD_CONFIG_RADIO_LINK_TREL_ENABLE
otPlatTrelEnable(otInstance *,uint16_t *)423 OT_TOOL_WEAK void otPlatTrelEnable(otInstance *, uint16_t *) {}
424 
otPlatTrelDisable(otInstance *)425 OT_TOOL_WEAK void otPlatTrelDisable(otInstance *) {}
426 
otPlatTrelSend(otInstance *,const uint8_t *,uint16_t,const otSockAddr *)427 OT_TOOL_WEAK void otPlatTrelSend(otInstance *, const uint8_t *, uint16_t, const otSockAddr *) {}
428 
otPlatTrelRegisterService(otInstance *,uint16_t,const uint8_t *,uint8_t)429 OT_TOOL_WEAK void otPlatTrelRegisterService(otInstance *, uint16_t, const uint8_t *, uint8_t) {}
430 
otPlatTrelGetCounters(otInstance *)431 OT_TOOL_WEAK const otPlatTrelCounters *otPlatTrelGetCounters(otInstance *) { return nullptr; }
432 
otPlatTrelResetCounters(otInstance *)433 OT_TOOL_WEAK void otPlatTrelResetCounters(otInstance *) {}
434 #endif
435 
436 #if OPENTHREAD_CONFIG_MLE_LINK_METRICS_SUBJECT_ENABLE
otPlatRadioConfigureEnhAckProbing(otInstance *,otLinkMetrics,const otShortAddress,const otExtAddress *)437 OT_TOOL_WEAK otError otPlatRadioConfigureEnhAckProbing(otInstance *,
438                                                        otLinkMetrics,
439                                                        const otShortAddress,
440                                                        const otExtAddress *)
441 {
442     return OT_ERROR_NONE;
443 }
444 
otPlatRadioGetEnhAckProbingMetrics(otInstance *,const otShortAddress)445 OT_TOOL_WEAK otLinkMetrics otPlatRadioGetEnhAckProbingMetrics(otInstance *, const otShortAddress)
446 {
447     otLinkMetrics metrics;
448 
449     memset(&metrics, 0, sizeof(metrics));
450 
451     return metrics;
452 }
453 #endif
454 
455 #if OPENTHREAD_CONFIG_BORDER_ROUTING_ENABLE
otPlatInfraIfHasAddress(uint32_t,const otIp6Address *)456 OT_TOOL_WEAK bool otPlatInfraIfHasAddress(uint32_t, const otIp6Address *) { return false; }
457 
otPlatInfraIfSendIcmp6Nd(uint32_t,const otIp6Address *,const uint8_t *,uint16_t)458 OT_TOOL_WEAK otError otPlatInfraIfSendIcmp6Nd(uint32_t, const otIp6Address *, const uint8_t *, uint16_t)
459 {
460     return OT_ERROR_FAILED;
461 }
462 
otPlatInfraIfDiscoverNat64Prefix(uint32_t)463 OT_TOOL_WEAK otError otPlatInfraIfDiscoverNat64Prefix(uint32_t) { return OT_ERROR_FAILED; }
464 #endif
465 
466 #if OPENTHREAD_CONFIG_PLATFORM_KEY_REFERENCES_ENABLE
467 
otPlatCryptoImportKey(otCryptoKeyRef * aKeyRef,otCryptoKeyType aKeyType,otCryptoKeyAlgorithm aKeyAlgorithm,int aKeyUsage,otCryptoKeyStorage aKeyPersistence,const uint8_t * aKey,size_t aKeyLen)468 otError otPlatCryptoImportKey(otCryptoKeyRef      *aKeyRef,
469                               otCryptoKeyType      aKeyType,
470                               otCryptoKeyAlgorithm aKeyAlgorithm,
471                               int                  aKeyUsage,
472                               otCryptoKeyStorage   aKeyPersistence,
473                               const uint8_t       *aKey,
474                               size_t               aKeyLen)
475 {
476     OT_UNUSED_VARIABLE(aKeyRef);
477     OT_UNUSED_VARIABLE(aKeyType);
478     OT_UNUSED_VARIABLE(aKeyAlgorithm);
479     OT_UNUSED_VARIABLE(aKeyUsage);
480     OT_UNUSED_VARIABLE(aKeyPersistence);
481     OT_UNUSED_VARIABLE(aKey);
482     OT_UNUSED_VARIABLE(aKeyLen);
483 
484     return OT_ERROR_NONE;
485 }
486 
otPlatCryptoExportKey(otCryptoKeyRef aKeyRef,uint8_t * aBuffer,size_t aBufferLen,size_t * aKeyLen)487 otError otPlatCryptoExportKey(otCryptoKeyRef aKeyRef, uint8_t *aBuffer, size_t aBufferLen, size_t *aKeyLen)
488 {
489     OT_UNUSED_VARIABLE(aKeyRef);
490     OT_UNUSED_VARIABLE(aBuffer);
491     OT_UNUSED_VARIABLE(aBufferLen);
492 
493     *aKeyLen = 0;
494 
495     return OT_ERROR_NONE;
496 }
497 
otPlatCryptoDestroyKey(otCryptoKeyRef aKeyRef)498 otError otPlatCryptoDestroyKey(otCryptoKeyRef aKeyRef)
499 {
500     OT_UNUSED_VARIABLE(aKeyRef);
501 
502     return OT_ERROR_NONE;
503 }
504 
otPlatCryptoHasKey(otCryptoKeyRef aKeyRef)505 bool otPlatCryptoHasKey(otCryptoKeyRef aKeyRef)
506 {
507     OT_UNUSED_VARIABLE(aKeyRef);
508 
509     return false;
510 }
511 
otPlatCryptoEcdsaGenerateAndImportKey(otCryptoKeyRef aKeyRef)512 otError otPlatCryptoEcdsaGenerateAndImportKey(otCryptoKeyRef aKeyRef)
513 {
514     OT_UNUSED_VARIABLE(aKeyRef);
515 
516     return OT_ERROR_NONE;
517 }
518 
otPlatCryptoEcdsaExportPublicKey(otCryptoKeyRef aKeyRef,otPlatCryptoEcdsaPublicKey * aPublicKey)519 otError otPlatCryptoEcdsaExportPublicKey(otCryptoKeyRef aKeyRef, otPlatCryptoEcdsaPublicKey *aPublicKey)
520 {
521     OT_UNUSED_VARIABLE(aKeyRef);
522     OT_UNUSED_VARIABLE(aPublicKey);
523 
524     return OT_ERROR_NONE;
525 }
526 
otPlatCryptoEcdsaSignUsingKeyRef(otCryptoKeyRef aKeyRef,const otPlatCryptoSha256Hash * aHash,otPlatCryptoEcdsaSignature * aSignature)527 otError otPlatCryptoEcdsaSignUsingKeyRef(otCryptoKeyRef                aKeyRef,
528                                          const otPlatCryptoSha256Hash *aHash,
529                                          otPlatCryptoEcdsaSignature   *aSignature)
530 {
531     OT_UNUSED_VARIABLE(aKeyRef);
532     OT_UNUSED_VARIABLE(aHash);
533     OT_UNUSED_VARIABLE(aSignature);
534 
535     return OT_ERROR_NONE;
536 }
537 
otPlatCryptoEcdsaVerifyUsingKeyRef(otCryptoKeyRef aKeyRef,const otPlatCryptoSha256Hash * aHash,const otPlatCryptoEcdsaSignature * aSignature)538 otError otPlatCryptoEcdsaVerifyUsingKeyRef(otCryptoKeyRef                    aKeyRef,
539                                            const otPlatCryptoSha256Hash     *aHash,
540                                            const otPlatCryptoEcdsaSignature *aSignature)
541 {
542     OT_UNUSED_VARIABLE(aKeyRef);
543     OT_UNUSED_VARIABLE(aHash);
544     OT_UNUSED_VARIABLE(aSignature);
545 
546     return OT_ERROR_NONE;
547 }
548 
549 #endif // OPENTHREAD_CONFIG_PLATFORM_KEY_REFERENCES_ENABLE
550 
otPlatRadioSetCcaEnergyDetectThreshold(otInstance * aInstance,int8_t aThreshold)551 otError otPlatRadioSetCcaEnergyDetectThreshold(otInstance *aInstance, int8_t aThreshold)
552 {
553     OT_UNUSED_VARIABLE(aInstance);
554     OT_UNUSED_VARIABLE(aThreshold);
555 
556     return OT_ERROR_NONE;
557 }
558 
559 #if OPENTHREAD_CONFIG_MULTICAST_DNS_ENABLE
560 
otPlatMdnsSetListeningEnabled(otInstance * aInstance,bool aEnable,uint32_t aInfraIfIndex)561 OT_TOOL_WEAK otError otPlatMdnsSetListeningEnabled(otInstance *aInstance, bool aEnable, uint32_t aInfraIfIndex)
562 {
563     OT_UNUSED_VARIABLE(aInstance);
564     OT_UNUSED_VARIABLE(aEnable);
565     OT_UNUSED_VARIABLE(aInfraIfIndex);
566 
567     return OT_ERROR_NOT_IMPLEMENTED;
568 }
569 
otPlatMdnsSendMulticast(otInstance * aInstance,otMessage * aMessage,uint32_t aInfraIfIndex)570 OT_TOOL_WEAK void otPlatMdnsSendMulticast(otInstance *aInstance, otMessage *aMessage, uint32_t aInfraIfIndex)
571 {
572     OT_UNUSED_VARIABLE(aInstance);
573     OT_UNUSED_VARIABLE(aMessage);
574     OT_UNUSED_VARIABLE(aInfraIfIndex);
575 }
576 
otPlatMdnsSendUnicast(otInstance * aInstance,otMessage * aMessage,const otPlatMdnsAddressInfo * aAddress)577 OT_TOOL_WEAK void otPlatMdnsSendUnicast(otInstance                  *aInstance,
578                                         otMessage                   *aMessage,
579                                         const otPlatMdnsAddressInfo *aAddress)
580 {
581     OT_UNUSED_VARIABLE(aInstance);
582     OT_UNUSED_VARIABLE(aMessage);
583     OT_UNUSED_VARIABLE(aAddress);
584 }
585 
586 #endif // OPENTHREAD_CONFIG_MULTICAST_DNS_ENABLE
587 
588 #if OPENTHREAD_CONFIG_DNS_DSO_ENABLE
589 
otPlatDsoEnableListening(otInstance * aInstance,bool aEnable)590 OT_TOOL_WEAK void otPlatDsoEnableListening(otInstance *aInstance, bool aEnable)
591 {
592     OT_UNUSED_VARIABLE(aInstance);
593     OT_UNUSED_VARIABLE(aEnable);
594 }
595 
otPlatDsoConnect(otPlatDsoConnection * aConnection,const otSockAddr * aPeerSockAddr)596 OT_TOOL_WEAK void otPlatDsoConnect(otPlatDsoConnection *aConnection, const otSockAddr *aPeerSockAddr)
597 {
598     OT_UNUSED_VARIABLE(aConnection);
599     OT_UNUSED_VARIABLE(aPeerSockAddr);
600 }
601 
otPlatDsoSend(otPlatDsoConnection * aConnection,otMessage * aMessage)602 OT_TOOL_WEAK void otPlatDsoSend(otPlatDsoConnection *aConnection, otMessage *aMessage)
603 {
604     OT_UNUSED_VARIABLE(aConnection);
605     OT_UNUSED_VARIABLE(aMessage);
606 }
607 
otPlatDsoDisconnect(otPlatDsoConnection * aConnection,otPlatDsoDisconnectMode aMode)608 OT_TOOL_WEAK void otPlatDsoDisconnect(otPlatDsoConnection *aConnection, otPlatDsoDisconnectMode aMode)
609 {
610     OT_UNUSED_VARIABLE(aConnection);
611     OT_UNUSED_VARIABLE(aMode);
612 }
613 
614 #endif // #if OPENTHREAD_CONFIG_DNS_DSO_ENABLE
615 
616 #if OPENTHREAD_CONFIG_PLATFORM_UDP_ENABLE
otPlatUdpSocket(otUdpSocket * aUdpSocket)617 otError otPlatUdpSocket(otUdpSocket *aUdpSocket)
618 {
619     OT_UNUSED_VARIABLE(aUdpSocket);
620     return OT_ERROR_NONE;
621 }
622 
otPlatUdpClose(otUdpSocket * aUdpSocket)623 otError otPlatUdpClose(otUdpSocket *aUdpSocket)
624 {
625     OT_UNUSED_VARIABLE(aUdpSocket);
626     return OT_ERROR_NONE;
627 }
628 
otPlatUdpBind(otUdpSocket * aUdpSocket)629 otError otPlatUdpBind(otUdpSocket *aUdpSocket)
630 {
631     OT_UNUSED_VARIABLE(aUdpSocket);
632     return OT_ERROR_NONE;
633 }
634 
otPlatUdpBindToNetif(otUdpSocket * aUdpSocket,otNetifIdentifier aNetifIdentifier)635 otError otPlatUdpBindToNetif(otUdpSocket *aUdpSocket, otNetifIdentifier aNetifIdentifier)
636 {
637     OT_UNUSED_VARIABLE(aUdpSocket);
638     OT_UNUSED_VARIABLE(aNetifIdentifier);
639     return OT_ERROR_NONE;
640 }
641 
otPlatUdpConnect(otUdpSocket * aUdpSocket)642 otError otPlatUdpConnect(otUdpSocket *aUdpSocket)
643 {
644     OT_UNUSED_VARIABLE(aUdpSocket);
645     return OT_ERROR_NONE;
646 }
647 
otPlatUdpSend(otUdpSocket * aUdpSocket,otMessage * aMessage,const otMessageInfo * aMessageInfo)648 otError otPlatUdpSend(otUdpSocket *aUdpSocket, otMessage *aMessage, const otMessageInfo *aMessageInfo)
649 {
650     OT_UNUSED_VARIABLE(aUdpSocket);
651     OT_UNUSED_VARIABLE(aMessageInfo);
652     return OT_ERROR_NONE;
653 }
654 
otPlatUdpJoinMulticastGroup(otUdpSocket * aUdpSocket,otNetifIdentifier aNetifIdentifier,const otIp6Address * aAddress)655 otError otPlatUdpJoinMulticastGroup(otUdpSocket        *aUdpSocket,
656                                     otNetifIdentifier   aNetifIdentifier,
657                                     const otIp6Address *aAddress)
658 {
659     OT_UNUSED_VARIABLE(aUdpSocket);
660     OT_UNUSED_VARIABLE(aNetifIdentifier);
661     OT_UNUSED_VARIABLE(aAddress);
662     return OT_ERROR_NONE;
663 }
664 
otPlatUdpLeaveMulticastGroup(otUdpSocket * aUdpSocket,otNetifIdentifier aNetifIdentifier,const otIp6Address * aAddress)665 otError otPlatUdpLeaveMulticastGroup(otUdpSocket        *aUdpSocket,
666                                      otNetifIdentifier   aNetifIdentifier,
667                                      const otIp6Address *aAddress)
668 {
669     OT_UNUSED_VARIABLE(aUdpSocket);
670     OT_UNUSED_VARIABLE(aNetifIdentifier);
671     OT_UNUSED_VARIABLE(aAddress);
672     return OT_ERROR_NONE;
673 }
674 #endif // OPENTHREAD_CONFIG_PLATFORM_UDP_ENABLE
675 
676 #if OPENTHREAD_CONFIG_DNS_UPSTREAM_QUERY_ENABLE
otPlatDnsStartUpstreamQuery(otInstance * aInstance,otPlatDnsUpstreamQuery * aTxn,const otMessage * aQuery)677 void otPlatDnsStartUpstreamQuery(otInstance *aInstance, otPlatDnsUpstreamQuery *aTxn, const otMessage *aQuery)
678 {
679     OT_UNUSED_VARIABLE(aInstance);
680     OT_UNUSED_VARIABLE(aTxn);
681     OT_UNUSED_VARIABLE(aQuery);
682 }
683 
otPlatDnsCancelUpstreamQuery(otInstance * aInstance,otPlatDnsUpstreamQuery * aTxn)684 void otPlatDnsCancelUpstreamQuery(otInstance *aInstance, otPlatDnsUpstreamQuery *aTxn)
685 {
686     otPlatDnsUpstreamQueryDone(aInstance, aTxn, nullptr);
687 }
688 #endif
689 
otPlatRadioGetCcaEnergyDetectThreshold(otInstance *,int8_t *)690 OT_TOOL_WEAK otError otPlatRadioGetCcaEnergyDetectThreshold(otInstance *, int8_t *) { return OT_ERROR_NONE; }
691 
otPlatRadioGetCoexMetrics(otInstance *,otRadioCoexMetrics *)692 OT_TOOL_WEAK otError otPlatRadioGetCoexMetrics(otInstance *, otRadioCoexMetrics *) { return OT_ERROR_NONE; }
693 
otPlatRadioGetTransmitPower(otInstance *,int8_t *)694 OT_TOOL_WEAK otError otPlatRadioGetTransmitPower(otInstance *, int8_t *) { return OT_ERROR_NONE; }
695 
otPlatRadioIsCoexEnabled(otInstance *)696 OT_TOOL_WEAK bool otPlatRadioIsCoexEnabled(otInstance *) { return true; }
697 
otPlatRadioSetCoexEnabled(otInstance *,bool)698 OT_TOOL_WEAK otError otPlatRadioSetCoexEnabled(otInstance *, bool) { return OT_ERROR_NOT_IMPLEMENTED; }
699 
700 #if OPENTHREAD_CONFIG_PLATFORM_POWER_CALIBRATION_ENABLE
otPlatRadioSetChannelTargetPower(otInstance * aInstance,uint8_t aChannel,int16_t aTargetPower)701 OT_TOOL_WEAK otError otPlatRadioSetChannelTargetPower(otInstance *aInstance, uint8_t aChannel, int16_t aTargetPower)
702 {
703     return OT_ERROR_NONE;
704 }
705 
otPlatRadioAddCalibratedPower(otInstance * aInstance,uint8_t aChannel,int16_t aActualPower,const uint8_t * aRawPowerSetting,uint16_t aRawPowerSettingLength)706 OT_TOOL_WEAK otError otPlatRadioAddCalibratedPower(otInstance    *aInstance,
707                                                    uint8_t        aChannel,
708                                                    int16_t        aActualPower,
709                                                    const uint8_t *aRawPowerSetting,
710                                                    uint16_t       aRawPowerSettingLength)
711 {
712     return OT_ERROR_NONE;
713 }
714 
otPlatRadioClearCalibratedPowers(otInstance * aInstance)715 OT_TOOL_WEAK otError otPlatRadioClearCalibratedPowers(otInstance *aInstance) { return OT_ERROR_NONE; }
716 #endif // OPENTHREAD_CONFIG_PLATFORM_POWER_CALIBRATION_ENABLE
717 
718 #if OPENTHREAD_CONFIG_NCP_ENABLE_MCU_POWER_STATE_CONTROL
otPlatGetMcuPowerState(otInstance * aInstance)719 OT_TOOL_WEAK otPlatMcuPowerState otPlatGetMcuPowerState(otInstance *aInstance) { return OT_PLAT_MCU_POWER_STATE_ON; }
720 
otPlatSetMcuPowerState(otInstance * aInstance,otPlatMcuPowerState aState)721 OT_TOOL_WEAK otError otPlatSetMcuPowerState(otInstance *aInstance, otPlatMcuPowerState aState) { return OT_ERROR_NONE; }
722 #endif // OPENTHREAD_CONFIG_NCP_ENABLE_MCU_POWER_STATE_CONTROL
723 #ifdef OPENTHREAD_CONFIG_BLE_TCAT_ENABLE
otPlatBleEnable(otInstance * aInstance)724 otError otPlatBleEnable(otInstance *aInstance)
725 {
726     OT_UNUSED_VARIABLE(aInstance);
727     return OT_ERROR_NONE;
728 }
729 
otPlatBleDisable(otInstance * aInstance)730 otError otPlatBleDisable(otInstance *aInstance)
731 {
732     OT_UNUSED_VARIABLE(aInstance);
733     return OT_ERROR_NONE;
734 }
735 
otPlatBleGetAdvertisementBuffer(otInstance * aInstance,uint8_t ** aAdvertisementBuffer)736 otError otPlatBleGetAdvertisementBuffer(otInstance *aInstance, uint8_t **aAdvertisementBuffer)
737 {
738     OT_UNUSED_VARIABLE(aInstance);
739     static uint8_t sAdvertisementBuffer[OT_TCAT_ADVERTISEMENT_MAX_LEN];
740 
741     *aAdvertisementBuffer = sAdvertisementBuffer;
742 
743     return OT_ERROR_NONE;
744 }
745 
otPlatBleGapAdvStart(otInstance * aInstance,uint16_t aInterval)746 otError otPlatBleGapAdvStart(otInstance *aInstance, uint16_t aInterval)
747 {
748     OT_UNUSED_VARIABLE(aInstance);
749     OT_UNUSED_VARIABLE(aInterval);
750     return OT_ERROR_NONE;
751 }
752 
otPlatBleGapAdvStop(otInstance * aInstance)753 otError otPlatBleGapAdvStop(otInstance *aInstance)
754 {
755     OT_UNUSED_VARIABLE(aInstance);
756     return OT_ERROR_NONE;
757 }
758 
otPlatBleGapDisconnect(otInstance * aInstance)759 otError otPlatBleGapDisconnect(otInstance *aInstance)
760 {
761     OT_UNUSED_VARIABLE(aInstance);
762     return OT_ERROR_NONE;
763 }
764 
otPlatBleGattMtuGet(otInstance * aInstance,uint16_t * aMtu)765 otError otPlatBleGattMtuGet(otInstance *aInstance, uint16_t *aMtu)
766 {
767     OT_UNUSED_VARIABLE(aInstance);
768     OT_UNUSED_VARIABLE(aMtu);
769     return OT_ERROR_NONE;
770 }
771 
otPlatBleGattServerIndicate(otInstance * aInstance,uint16_t aHandle,const otBleRadioPacket * aPacket)772 otError otPlatBleGattServerIndicate(otInstance *aInstance, uint16_t aHandle, const otBleRadioPacket *aPacket)
773 {
774     OT_UNUSED_VARIABLE(aInstance);
775     OT_UNUSED_VARIABLE(aHandle);
776     OT_UNUSED_VARIABLE(aPacket);
777     return OT_ERROR_NONE;
778 }
779 
otPlatBleGetLinkCapabilities(otInstance * aInstance,otBleLinkCapabilities * aBleLinkCapabilities)780 void otPlatBleGetLinkCapabilities(otInstance *aInstance, otBleLinkCapabilities *aBleLinkCapabilities)
781 {
782     OT_UNUSED_VARIABLE(aInstance);
783 
784     aBleLinkCapabilities->mGattNotifications = true;
785     aBleLinkCapabilities->mL2CapDirect       = false;
786     aBleLinkCapabilities->mRsv               = 0;
787 }
788 
otPlatBleSupportsMultiRadio(otInstance * aInstance)789 bool otPlatBleSupportsMultiRadio(otInstance *aInstance)
790 {
791     OT_UNUSED_VARIABLE(aInstance);
792     return false;
793 }
794 
otPlatBleGapAdvSetData(otInstance * aInstance,uint8_t * aAdvertisementData,uint16_t aAdvertisementLen)795 otError otPlatBleGapAdvSetData(otInstance *aInstance, uint8_t *aAdvertisementData, uint16_t aAdvertisementLen)
796 {
797     OT_UNUSED_VARIABLE(aInstance);
798     OT_UNUSED_VARIABLE(aAdvertisementData);
799     OT_UNUSED_VARIABLE(aAdvertisementLen);
800     return OT_ERROR_NONE;
801 }
802 
803 #endif // OPENTHREAD_CONFIG_BLE_TCAT_ENABLE
804 
805 #if OPENTHREAD_CONFIG_PLATFORM_DNSSD_ENABLE
806 
otPlatDnssdGetState(otInstance * aInstance)807 OT_TOOL_WEAK otPlatDnssdState otPlatDnssdGetState(otInstance *aInstance)
808 {
809     OT_UNUSED_VARIABLE(aInstance);
810 
811     return OT_PLAT_DNSSD_STOPPED;
812 }
813 
otPlatDnssdRegisterService(otInstance * aInstance,const otPlatDnssdService * aService,otPlatDnssdRequestId aRequestId,otPlatDnssdRegisterCallback aCallback)814 OT_TOOL_WEAK void otPlatDnssdRegisterService(otInstance                 *aInstance,
815                                              const otPlatDnssdService   *aService,
816                                              otPlatDnssdRequestId        aRequestId,
817                                              otPlatDnssdRegisterCallback aCallback)
818 {
819     OT_UNUSED_VARIABLE(aInstance);
820     OT_UNUSED_VARIABLE(aService);
821     OT_UNUSED_VARIABLE(aRequestId);
822     OT_UNUSED_VARIABLE(aCallback);
823 }
824 
otPlatDnssdUnregisterService(otInstance * aInstance,const otPlatDnssdService * aService,otPlatDnssdRequestId aRequestId,otPlatDnssdRegisterCallback aCallback)825 OT_TOOL_WEAK void otPlatDnssdUnregisterService(otInstance                 *aInstance,
826                                                const otPlatDnssdService   *aService,
827                                                otPlatDnssdRequestId        aRequestId,
828                                                otPlatDnssdRegisterCallback aCallback)
829 {
830     OT_UNUSED_VARIABLE(aInstance);
831     OT_UNUSED_VARIABLE(aService);
832     OT_UNUSED_VARIABLE(aRequestId);
833     OT_UNUSED_VARIABLE(aCallback);
834 }
835 
otPlatDnssdRegisterHost(otInstance * aInstance,const otPlatDnssdHost * aHost,otPlatDnssdRequestId aRequestId,otPlatDnssdRegisterCallback aCallback)836 OT_TOOL_WEAK void otPlatDnssdRegisterHost(otInstance                 *aInstance,
837                                           const otPlatDnssdHost      *aHost,
838                                           otPlatDnssdRequestId        aRequestId,
839                                           otPlatDnssdRegisterCallback aCallback)
840 {
841     OT_UNUSED_VARIABLE(aInstance);
842     OT_UNUSED_VARIABLE(aHost);
843     OT_UNUSED_VARIABLE(aRequestId);
844     OT_UNUSED_VARIABLE(aCallback);
845 }
846 
otPlatDnssdUnregisterHost(otInstance * aInstance,const otPlatDnssdHost * aHost,otPlatDnssdRequestId aRequestId,otPlatDnssdRegisterCallback aCallback)847 OT_TOOL_WEAK void otPlatDnssdUnregisterHost(otInstance                 *aInstance,
848                                             const otPlatDnssdHost      *aHost,
849                                             otPlatDnssdRequestId        aRequestId,
850                                             otPlatDnssdRegisterCallback aCallback)
851 {
852     OT_UNUSED_VARIABLE(aInstance);
853     OT_UNUSED_VARIABLE(aHost);
854     OT_UNUSED_VARIABLE(aRequestId);
855     OT_UNUSED_VARIABLE(aCallback);
856 }
857 
otPlatDnssdRegisterKey(otInstance * aInstance,const otPlatDnssdKey * aKey,otPlatDnssdRequestId aRequestId,otPlatDnssdRegisterCallback aCallback)858 OT_TOOL_WEAK void otPlatDnssdRegisterKey(otInstance                 *aInstance,
859                                          const otPlatDnssdKey       *aKey,
860                                          otPlatDnssdRequestId        aRequestId,
861                                          otPlatDnssdRegisterCallback aCallback)
862 {
863     OT_UNUSED_VARIABLE(aInstance);
864     OT_UNUSED_VARIABLE(aKey);
865     OT_UNUSED_VARIABLE(aRequestId);
866     OT_UNUSED_VARIABLE(aCallback);
867 }
868 
otPlatDnssdUnregisterKey(otInstance * aInstance,const otPlatDnssdKey * aKey,otPlatDnssdRequestId aRequestId,otPlatDnssdRegisterCallback aCallback)869 OT_TOOL_WEAK void otPlatDnssdUnregisterKey(otInstance                 *aInstance,
870                                            const otPlatDnssdKey       *aKey,
871                                            otPlatDnssdRequestId        aRequestId,
872                                            otPlatDnssdRegisterCallback aCallback)
873 {
874     OT_UNUSED_VARIABLE(aInstance);
875     OT_UNUSED_VARIABLE(aKey);
876     OT_UNUSED_VARIABLE(aRequestId);
877     OT_UNUSED_VARIABLE(aCallback);
878 }
879 
880 #endif // OPENTHREAD_CONFIG_PLATFORM_DNSSD_ENABLE
881 
882 #if OPENTHREAD_CONFIG_PLATFORM_LOG_CRASH_DUMP_ENABLE
otPlatLogCrashDump(void)883 OT_TOOL_WEAK otError otPlatLogCrashDump(void) { return OT_ERROR_NONE; }
884 #endif
885 
886 } // extern "C"
887