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 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
otPlatTrelRegisterService(otInstance *,uint16_t,const uint8_t *,uint8_t)453 OT_TOOL_WEAK void otPlatTrelRegisterService(otInstance *, uint16_t, const uint8_t *, uint8_t) {}
454
otPlatTrelGetCounters(otInstance *)455 OT_TOOL_WEAK const otPlatTrelCounters *otPlatTrelGetCounters(otInstance *) { return nullptr; }
456
otPlatTrelResetCounters(otInstance *)457 OT_TOOL_WEAK void otPlatTrelResetCounters(otInstance *) {}
458 #endif
459
460 #if OPENTHREAD_CONFIG_MLE_LINK_METRICS_SUBJECT_ENABLE
otPlatRadioConfigureEnhAckProbing(otInstance *,otLinkMetrics,const otShortAddress,const otExtAddress *)461 OT_TOOL_WEAK otError otPlatRadioConfigureEnhAckProbing(otInstance *,
462 otLinkMetrics,
463 const otShortAddress,
464 const otExtAddress *)
465 {
466 return OT_ERROR_NONE;
467 }
468
otPlatRadioGetEnhAckProbingMetrics(otInstance *,const otShortAddress)469 OT_TOOL_WEAK otLinkMetrics otPlatRadioGetEnhAckProbingMetrics(otInstance *, const otShortAddress)
470 {
471 otLinkMetrics metrics;
472
473 memset(&metrics, 0, sizeof(metrics));
474
475 return metrics;
476 }
477 #endif
478
479 #if OPENTHREAD_CONFIG_BORDER_ROUTING_ENABLE
otPlatInfraIfHasAddress(uint32_t,const otIp6Address *)480 OT_TOOL_WEAK bool otPlatInfraIfHasAddress(uint32_t, const otIp6Address *) { return false; }
481
otPlatInfraIfSendIcmp6Nd(uint32_t,const otIp6Address *,const uint8_t *,uint16_t)482 OT_TOOL_WEAK otError otPlatInfraIfSendIcmp6Nd(uint32_t, const otIp6Address *, const uint8_t *, uint16_t)
483 {
484 return OT_ERROR_FAILED;
485 }
486
otPlatInfraIfDiscoverNat64Prefix(uint32_t)487 OT_TOOL_WEAK otError otPlatInfraIfDiscoverNat64Prefix(uint32_t) { return OT_ERROR_FAILED; }
488 #endif
489
490 #if OPENTHREAD_CONFIG_PLATFORM_KEY_REFERENCES_ENABLE
491
otPlatCryptoImportKey(otCryptoKeyRef * aKeyRef,otCryptoKeyType aKeyType,otCryptoKeyAlgorithm aKeyAlgorithm,int aKeyUsage,otCryptoKeyStorage aKeyPersistence,const uint8_t * aKey,size_t aKeyLen)492 otError otPlatCryptoImportKey(otCryptoKeyRef *aKeyRef,
493 otCryptoKeyType aKeyType,
494 otCryptoKeyAlgorithm aKeyAlgorithm,
495 int aKeyUsage,
496 otCryptoKeyStorage aKeyPersistence,
497 const uint8_t *aKey,
498 size_t aKeyLen)
499 {
500 OT_UNUSED_VARIABLE(aKeyRef);
501 OT_UNUSED_VARIABLE(aKeyType);
502 OT_UNUSED_VARIABLE(aKeyAlgorithm);
503 OT_UNUSED_VARIABLE(aKeyUsage);
504 OT_UNUSED_VARIABLE(aKeyPersistence);
505 OT_UNUSED_VARIABLE(aKey);
506 OT_UNUSED_VARIABLE(aKeyLen);
507
508 return OT_ERROR_NONE;
509 }
510
otPlatCryptoExportKey(otCryptoKeyRef aKeyRef,uint8_t * aBuffer,size_t aBufferLen,size_t * aKeyLen)511 otError otPlatCryptoExportKey(otCryptoKeyRef aKeyRef, uint8_t *aBuffer, size_t aBufferLen, size_t *aKeyLen)
512 {
513 OT_UNUSED_VARIABLE(aKeyRef);
514 OT_UNUSED_VARIABLE(aBuffer);
515 OT_UNUSED_VARIABLE(aBufferLen);
516
517 *aKeyLen = 0;
518
519 return OT_ERROR_NONE;
520 }
521
otPlatCryptoDestroyKey(otCryptoKeyRef aKeyRef)522 otError otPlatCryptoDestroyKey(otCryptoKeyRef aKeyRef)
523 {
524 OT_UNUSED_VARIABLE(aKeyRef);
525
526 return OT_ERROR_NONE;
527 }
528
otPlatCryptoHasKey(otCryptoKeyRef aKeyRef)529 bool otPlatCryptoHasKey(otCryptoKeyRef aKeyRef)
530 {
531 OT_UNUSED_VARIABLE(aKeyRef);
532
533 return false;
534 }
535
otPlatCryptoEcdsaGenerateAndImportKey(otCryptoKeyRef aKeyRef)536 otError otPlatCryptoEcdsaGenerateAndImportKey(otCryptoKeyRef aKeyRef)
537 {
538 OT_UNUSED_VARIABLE(aKeyRef);
539
540 return OT_ERROR_NONE;
541 }
542
otPlatCryptoEcdsaExportPublicKey(otCryptoKeyRef aKeyRef,otPlatCryptoEcdsaPublicKey * aPublicKey)543 otError otPlatCryptoEcdsaExportPublicKey(otCryptoKeyRef aKeyRef, otPlatCryptoEcdsaPublicKey *aPublicKey)
544 {
545 OT_UNUSED_VARIABLE(aKeyRef);
546 OT_UNUSED_VARIABLE(aPublicKey);
547
548 return OT_ERROR_NONE;
549 }
550
otPlatCryptoEcdsaSignUsingKeyRef(otCryptoKeyRef aKeyRef,const otPlatCryptoSha256Hash * aHash,otPlatCryptoEcdsaSignature * aSignature)551 otError otPlatCryptoEcdsaSignUsingKeyRef(otCryptoKeyRef aKeyRef,
552 const otPlatCryptoSha256Hash *aHash,
553 otPlatCryptoEcdsaSignature *aSignature)
554 {
555 OT_UNUSED_VARIABLE(aKeyRef);
556 OT_UNUSED_VARIABLE(aHash);
557 OT_UNUSED_VARIABLE(aSignature);
558
559 return OT_ERROR_NONE;
560 }
561
otPlatCryptoEcdsaVerifyUsingKeyRef(otCryptoKeyRef aKeyRef,const otPlatCryptoSha256Hash * aHash,const otPlatCryptoEcdsaSignature * aSignature)562 otError otPlatCryptoEcdsaVerifyUsingKeyRef(otCryptoKeyRef aKeyRef,
563 const otPlatCryptoSha256Hash *aHash,
564 const otPlatCryptoEcdsaSignature *aSignature)
565 {
566 OT_UNUSED_VARIABLE(aKeyRef);
567 OT_UNUSED_VARIABLE(aHash);
568 OT_UNUSED_VARIABLE(aSignature);
569
570 return OT_ERROR_NONE;
571 }
572
573 #endif // OPENTHREAD_CONFIG_PLATFORM_KEY_REFERENCES_ENABLE
574
otPlatRadioSetCcaEnergyDetectThreshold(otInstance * aInstance,int8_t aThreshold)575 otError otPlatRadioSetCcaEnergyDetectThreshold(otInstance *aInstance, int8_t aThreshold)
576 {
577 OT_UNUSED_VARIABLE(aInstance);
578 OT_UNUSED_VARIABLE(aThreshold);
579
580 return OT_ERROR_NONE;
581 }
582
583 #if OPENTHREAD_CONFIG_MULTICAST_DNS_ENABLE
584
otPlatMdnsSetListeningEnabled(otInstance * aInstance,bool aEnable,uint32_t aInfraIfIndex)585 OT_TOOL_WEAK otError otPlatMdnsSetListeningEnabled(otInstance *aInstance, bool aEnable, uint32_t aInfraIfIndex)
586 {
587 OT_UNUSED_VARIABLE(aInstance);
588 OT_UNUSED_VARIABLE(aEnable);
589 OT_UNUSED_VARIABLE(aInfraIfIndex);
590
591 return OT_ERROR_NOT_IMPLEMENTED;
592 }
593
otPlatMdnsSendMulticast(otInstance * aInstance,otMessage * aMessage,uint32_t aInfraIfIndex)594 OT_TOOL_WEAK void otPlatMdnsSendMulticast(otInstance *aInstance, otMessage *aMessage, uint32_t aInfraIfIndex)
595 {
596 OT_UNUSED_VARIABLE(aInstance);
597 OT_UNUSED_VARIABLE(aMessage);
598 OT_UNUSED_VARIABLE(aInfraIfIndex);
599 }
600
otPlatMdnsSendUnicast(otInstance * aInstance,otMessage * aMessage,const otPlatMdnsAddressInfo * aAddress)601 OT_TOOL_WEAK void otPlatMdnsSendUnicast(otInstance *aInstance,
602 otMessage *aMessage,
603 const otPlatMdnsAddressInfo *aAddress)
604 {
605 OT_UNUSED_VARIABLE(aInstance);
606 OT_UNUSED_VARIABLE(aMessage);
607 OT_UNUSED_VARIABLE(aAddress);
608 }
609
610 #endif // OPENTHREAD_CONFIG_MULTICAST_DNS_ENABLE
611
612 #if OPENTHREAD_CONFIG_DNS_DSO_ENABLE
613
otPlatDsoEnableListening(otInstance * aInstance,bool aEnable)614 OT_TOOL_WEAK void otPlatDsoEnableListening(otInstance *aInstance, bool aEnable)
615 {
616 OT_UNUSED_VARIABLE(aInstance);
617 OT_UNUSED_VARIABLE(aEnable);
618 }
619
otPlatDsoConnect(otPlatDsoConnection * aConnection,const otSockAddr * aPeerSockAddr)620 OT_TOOL_WEAK void otPlatDsoConnect(otPlatDsoConnection *aConnection, const otSockAddr *aPeerSockAddr)
621 {
622 OT_UNUSED_VARIABLE(aConnection);
623 OT_UNUSED_VARIABLE(aPeerSockAddr);
624 }
625
otPlatDsoSend(otPlatDsoConnection * aConnection,otMessage * aMessage)626 OT_TOOL_WEAK void otPlatDsoSend(otPlatDsoConnection *aConnection, otMessage *aMessage)
627 {
628 OT_UNUSED_VARIABLE(aConnection);
629 OT_UNUSED_VARIABLE(aMessage);
630 }
631
otPlatDsoDisconnect(otPlatDsoConnection * aConnection,otPlatDsoDisconnectMode aMode)632 OT_TOOL_WEAK void otPlatDsoDisconnect(otPlatDsoConnection *aConnection, otPlatDsoDisconnectMode aMode)
633 {
634 OT_UNUSED_VARIABLE(aConnection);
635 OT_UNUSED_VARIABLE(aMode);
636 }
637
638 #endif // #if OPENTHREAD_CONFIG_DNS_DSO_ENABLE
639
640 #if OPENTHREAD_CONFIG_PLATFORM_UDP_ENABLE
otPlatUdpSocket(otUdpSocket * aUdpSocket)641 otError otPlatUdpSocket(otUdpSocket *aUdpSocket)
642 {
643 OT_UNUSED_VARIABLE(aUdpSocket);
644 return OT_ERROR_NONE;
645 }
646
otPlatUdpClose(otUdpSocket * aUdpSocket)647 otError otPlatUdpClose(otUdpSocket *aUdpSocket)
648 {
649 OT_UNUSED_VARIABLE(aUdpSocket);
650 return OT_ERROR_NONE;
651 }
652
otPlatUdpBind(otUdpSocket * aUdpSocket)653 otError otPlatUdpBind(otUdpSocket *aUdpSocket)
654 {
655 OT_UNUSED_VARIABLE(aUdpSocket);
656 return OT_ERROR_NONE;
657 }
658
otPlatUdpBindToNetif(otUdpSocket * aUdpSocket,otNetifIdentifier aNetifIdentifier)659 otError otPlatUdpBindToNetif(otUdpSocket *aUdpSocket, otNetifIdentifier aNetifIdentifier)
660 {
661 OT_UNUSED_VARIABLE(aUdpSocket);
662 OT_UNUSED_VARIABLE(aNetifIdentifier);
663 return OT_ERROR_NONE;
664 }
665
otPlatUdpConnect(otUdpSocket * aUdpSocket)666 otError otPlatUdpConnect(otUdpSocket *aUdpSocket)
667 {
668 OT_UNUSED_VARIABLE(aUdpSocket);
669 return OT_ERROR_NONE;
670 }
671
otPlatUdpSend(otUdpSocket * aUdpSocket,otMessage * aMessage,const otMessageInfo * aMessageInfo)672 otError otPlatUdpSend(otUdpSocket *aUdpSocket, otMessage *aMessage, const otMessageInfo *aMessageInfo)
673 {
674 OT_UNUSED_VARIABLE(aUdpSocket);
675 OT_UNUSED_VARIABLE(aMessageInfo);
676 return OT_ERROR_NONE;
677 }
678
otPlatUdpJoinMulticastGroup(otUdpSocket * aUdpSocket,otNetifIdentifier aNetifIdentifier,const otIp6Address * aAddress)679 otError otPlatUdpJoinMulticastGroup(otUdpSocket *aUdpSocket,
680 otNetifIdentifier aNetifIdentifier,
681 const otIp6Address *aAddress)
682 {
683 OT_UNUSED_VARIABLE(aUdpSocket);
684 OT_UNUSED_VARIABLE(aNetifIdentifier);
685 OT_UNUSED_VARIABLE(aAddress);
686 return OT_ERROR_NONE;
687 }
688
otPlatUdpLeaveMulticastGroup(otUdpSocket * aUdpSocket,otNetifIdentifier aNetifIdentifier,const otIp6Address * aAddress)689 otError otPlatUdpLeaveMulticastGroup(otUdpSocket *aUdpSocket,
690 otNetifIdentifier aNetifIdentifier,
691 const otIp6Address *aAddress)
692 {
693 OT_UNUSED_VARIABLE(aUdpSocket);
694 OT_UNUSED_VARIABLE(aNetifIdentifier);
695 OT_UNUSED_VARIABLE(aAddress);
696 return OT_ERROR_NONE;
697 }
698 #endif // OPENTHREAD_CONFIG_PLATFORM_UDP_ENABLE
699
700 #if OPENTHREAD_CONFIG_DNS_UPSTREAM_QUERY_ENABLE
otPlatDnsStartUpstreamQuery(otInstance * aInstance,otPlatDnsUpstreamQuery * aTxn,const otMessage * aQuery)701 void otPlatDnsStartUpstreamQuery(otInstance *aInstance, otPlatDnsUpstreamQuery *aTxn, const otMessage *aQuery)
702 {
703 OT_UNUSED_VARIABLE(aInstance);
704 OT_UNUSED_VARIABLE(aTxn);
705 OT_UNUSED_VARIABLE(aQuery);
706 }
707
otPlatDnsCancelUpstreamQuery(otInstance * aInstance,otPlatDnsUpstreamQuery * aTxn)708 void otPlatDnsCancelUpstreamQuery(otInstance *aInstance, otPlatDnsUpstreamQuery *aTxn)
709 {
710 otPlatDnsUpstreamQueryDone(aInstance, aTxn, nullptr);
711 }
712 #endif
713
otPlatRadioGetCcaEnergyDetectThreshold(otInstance *,int8_t *)714 OT_TOOL_WEAK otError otPlatRadioGetCcaEnergyDetectThreshold(otInstance *, int8_t *) { return OT_ERROR_NONE; }
715
otPlatRadioGetCoexMetrics(otInstance *,otRadioCoexMetrics *)716 OT_TOOL_WEAK otError otPlatRadioGetCoexMetrics(otInstance *, otRadioCoexMetrics *) { return OT_ERROR_NONE; }
717
otPlatRadioGetTransmitPower(otInstance *,int8_t *)718 OT_TOOL_WEAK otError otPlatRadioGetTransmitPower(otInstance *, int8_t *) { return OT_ERROR_NONE; }
719
otPlatRadioIsCoexEnabled(otInstance *)720 OT_TOOL_WEAK bool otPlatRadioIsCoexEnabled(otInstance *) { return true; }
721
otPlatRadioSetCoexEnabled(otInstance *,bool)722 OT_TOOL_WEAK otError otPlatRadioSetCoexEnabled(otInstance *, bool) { return OT_ERROR_NOT_IMPLEMENTED; }
723
724 #if OPENTHREAD_CONFIG_PLATFORM_POWER_CALIBRATION_ENABLE
otPlatRadioSetChannelTargetPower(otInstance * aInstance,uint8_t aChannel,int16_t aTargetPower)725 OT_TOOL_WEAK otError otPlatRadioSetChannelTargetPower(otInstance *aInstance, uint8_t aChannel, int16_t aTargetPower)
726 {
727 return OT_ERROR_NONE;
728 }
729
otPlatRadioAddCalibratedPower(otInstance * aInstance,uint8_t aChannel,int16_t aActualPower,const uint8_t * aRawPowerSetting,uint16_t aRawPowerSettingLength)730 OT_TOOL_WEAK otError otPlatRadioAddCalibratedPower(otInstance *aInstance,
731 uint8_t aChannel,
732 int16_t aActualPower,
733 const uint8_t *aRawPowerSetting,
734 uint16_t aRawPowerSettingLength)
735 {
736 return OT_ERROR_NONE;
737 }
738
otPlatRadioClearCalibratedPowers(otInstance * aInstance)739 OT_TOOL_WEAK otError otPlatRadioClearCalibratedPowers(otInstance *aInstance) { return OT_ERROR_NONE; }
740 #endif // OPENTHREAD_CONFIG_PLATFORM_POWER_CALIBRATION_ENABLE
741
742 #if OPENTHREAD_CONFIG_NCP_ENABLE_MCU_POWER_STATE_CONTROL
otPlatGetMcuPowerState(otInstance * aInstance)743 OT_TOOL_WEAK otPlatMcuPowerState otPlatGetMcuPowerState(otInstance *aInstance) { return OT_PLAT_MCU_POWER_STATE_ON; }
744
otPlatSetMcuPowerState(otInstance * aInstance,otPlatMcuPowerState aState)745 OT_TOOL_WEAK otError otPlatSetMcuPowerState(otInstance *aInstance, otPlatMcuPowerState aState) { return OT_ERROR_NONE; }
746 #endif // OPENTHREAD_CONFIG_NCP_ENABLE_MCU_POWER_STATE_CONTROL
747 #ifdef OPENTHREAD_CONFIG_BLE_TCAT_ENABLE
otPlatBleEnable(otInstance * aInstance)748 otError otPlatBleEnable(otInstance *aInstance)
749 {
750 OT_UNUSED_VARIABLE(aInstance);
751 return OT_ERROR_NONE;
752 }
753
otPlatBleDisable(otInstance * aInstance)754 otError otPlatBleDisable(otInstance *aInstance)
755 {
756 OT_UNUSED_VARIABLE(aInstance);
757 return OT_ERROR_NONE;
758 }
759
otPlatBleGetAdvertisementBuffer(otInstance * aInstance,uint8_t ** aAdvertisementBuffer)760 otError otPlatBleGetAdvertisementBuffer(otInstance *aInstance, uint8_t **aAdvertisementBuffer)
761 {
762 OT_UNUSED_VARIABLE(aInstance);
763 static uint8_t sAdvertisementBuffer[OT_TCAT_ADVERTISEMENT_MAX_LEN];
764
765 *aAdvertisementBuffer = sAdvertisementBuffer;
766
767 return OT_ERROR_NONE;
768 }
769
otPlatBleGapAdvStart(otInstance * aInstance,uint16_t aInterval)770 otError otPlatBleGapAdvStart(otInstance *aInstance, uint16_t aInterval)
771 {
772 OT_UNUSED_VARIABLE(aInstance);
773 OT_UNUSED_VARIABLE(aInterval);
774 return OT_ERROR_NONE;
775 }
776
otPlatBleGapAdvStop(otInstance * aInstance)777 otError otPlatBleGapAdvStop(otInstance *aInstance)
778 {
779 OT_UNUSED_VARIABLE(aInstance);
780 return OT_ERROR_NONE;
781 }
782
otPlatBleGapDisconnect(otInstance * aInstance)783 otError otPlatBleGapDisconnect(otInstance *aInstance)
784 {
785 OT_UNUSED_VARIABLE(aInstance);
786 return OT_ERROR_NONE;
787 }
788
otPlatBleGattMtuGet(otInstance * aInstance,uint16_t * aMtu)789 otError otPlatBleGattMtuGet(otInstance *aInstance, uint16_t *aMtu)
790 {
791 OT_UNUSED_VARIABLE(aInstance);
792 OT_UNUSED_VARIABLE(aMtu);
793 return OT_ERROR_NONE;
794 }
795
otPlatBleGattServerIndicate(otInstance * aInstance,uint16_t aHandle,const otBleRadioPacket * aPacket)796 otError otPlatBleGattServerIndicate(otInstance *aInstance, uint16_t aHandle, const otBleRadioPacket *aPacket)
797 {
798 OT_UNUSED_VARIABLE(aInstance);
799 OT_UNUSED_VARIABLE(aHandle);
800 OT_UNUSED_VARIABLE(aPacket);
801 return OT_ERROR_NONE;
802 }
803
otPlatBleGetLinkCapabilities(otInstance * aInstance,otBleLinkCapabilities * aBleLinkCapabilities)804 void otPlatBleGetLinkCapabilities(otInstance *aInstance, otBleLinkCapabilities *aBleLinkCapabilities)
805 {
806 OT_UNUSED_VARIABLE(aInstance);
807
808 aBleLinkCapabilities->mGattNotifications = true;
809 aBleLinkCapabilities->mL2CapDirect = false;
810 aBleLinkCapabilities->mRsv = 0;
811 }
812
otPlatBleSupportsMultiRadio(otInstance * aInstance)813 bool otPlatBleSupportsMultiRadio(otInstance *aInstance)
814 {
815 OT_UNUSED_VARIABLE(aInstance);
816 return false;
817 }
818
otPlatBleGapAdvSetData(otInstance * aInstance,uint8_t * aAdvertisementData,uint16_t aAdvertisementLen)819 otError otPlatBleGapAdvSetData(otInstance *aInstance, uint8_t *aAdvertisementData, uint16_t aAdvertisementLen)
820 {
821 OT_UNUSED_VARIABLE(aInstance);
822 OT_UNUSED_VARIABLE(aAdvertisementData);
823 OT_UNUSED_VARIABLE(aAdvertisementLen);
824 return OT_ERROR_NONE;
825 }
826
827 #endif // OPENTHREAD_CONFIG_BLE_TCAT_ENABLE
828
829 #if OPENTHREAD_CONFIG_PLATFORM_DNSSD_ENABLE
830
otPlatDnssdGetState(otInstance * aInstance)831 OT_TOOL_WEAK otPlatDnssdState otPlatDnssdGetState(otInstance *aInstance)
832 {
833 OT_UNUSED_VARIABLE(aInstance);
834
835 return OT_PLAT_DNSSD_STOPPED;
836 }
837
otPlatDnssdRegisterService(otInstance * aInstance,const otPlatDnssdService * aService,otPlatDnssdRequestId aRequestId,otPlatDnssdRegisterCallback aCallback)838 OT_TOOL_WEAK void otPlatDnssdRegisterService(otInstance *aInstance,
839 const otPlatDnssdService *aService,
840 otPlatDnssdRequestId aRequestId,
841 otPlatDnssdRegisterCallback aCallback)
842 {
843 OT_UNUSED_VARIABLE(aInstance);
844 OT_UNUSED_VARIABLE(aService);
845 OT_UNUSED_VARIABLE(aRequestId);
846 OT_UNUSED_VARIABLE(aCallback);
847 }
848
otPlatDnssdUnregisterService(otInstance * aInstance,const otPlatDnssdService * aService,otPlatDnssdRequestId aRequestId,otPlatDnssdRegisterCallback aCallback)849 OT_TOOL_WEAK void otPlatDnssdUnregisterService(otInstance *aInstance,
850 const otPlatDnssdService *aService,
851 otPlatDnssdRequestId aRequestId,
852 otPlatDnssdRegisterCallback aCallback)
853 {
854 OT_UNUSED_VARIABLE(aInstance);
855 OT_UNUSED_VARIABLE(aService);
856 OT_UNUSED_VARIABLE(aRequestId);
857 OT_UNUSED_VARIABLE(aCallback);
858 }
859
otPlatDnssdRegisterHost(otInstance * aInstance,const otPlatDnssdHost * aHost,otPlatDnssdRequestId aRequestId,otPlatDnssdRegisterCallback aCallback)860 OT_TOOL_WEAK void otPlatDnssdRegisterHost(otInstance *aInstance,
861 const otPlatDnssdHost *aHost,
862 otPlatDnssdRequestId aRequestId,
863 otPlatDnssdRegisterCallback aCallback)
864 {
865 OT_UNUSED_VARIABLE(aInstance);
866 OT_UNUSED_VARIABLE(aHost);
867 OT_UNUSED_VARIABLE(aRequestId);
868 OT_UNUSED_VARIABLE(aCallback);
869 }
870
otPlatDnssdUnregisterHost(otInstance * aInstance,const otPlatDnssdHost * aHost,otPlatDnssdRequestId aRequestId,otPlatDnssdRegisterCallback aCallback)871 OT_TOOL_WEAK void otPlatDnssdUnregisterHost(otInstance *aInstance,
872 const otPlatDnssdHost *aHost,
873 otPlatDnssdRequestId aRequestId,
874 otPlatDnssdRegisterCallback aCallback)
875 {
876 OT_UNUSED_VARIABLE(aInstance);
877 OT_UNUSED_VARIABLE(aHost);
878 OT_UNUSED_VARIABLE(aRequestId);
879 OT_UNUSED_VARIABLE(aCallback);
880 }
881
otPlatDnssdRegisterKey(otInstance * aInstance,const otPlatDnssdKey * aKey,otPlatDnssdRequestId aRequestId,otPlatDnssdRegisterCallback aCallback)882 OT_TOOL_WEAK void otPlatDnssdRegisterKey(otInstance *aInstance,
883 const otPlatDnssdKey *aKey,
884 otPlatDnssdRequestId aRequestId,
885 otPlatDnssdRegisterCallback aCallback)
886 {
887 OT_UNUSED_VARIABLE(aInstance);
888 OT_UNUSED_VARIABLE(aKey);
889 OT_UNUSED_VARIABLE(aRequestId);
890 OT_UNUSED_VARIABLE(aCallback);
891 }
892
otPlatDnssdUnregisterKey(otInstance * aInstance,const otPlatDnssdKey * aKey,otPlatDnssdRequestId aRequestId,otPlatDnssdRegisterCallback aCallback)893 OT_TOOL_WEAK void otPlatDnssdUnregisterKey(otInstance *aInstance,
894 const otPlatDnssdKey *aKey,
895 otPlatDnssdRequestId aRequestId,
896 otPlatDnssdRegisterCallback aCallback)
897 {
898 OT_UNUSED_VARIABLE(aInstance);
899 OT_UNUSED_VARIABLE(aKey);
900 OT_UNUSED_VARIABLE(aRequestId);
901 OT_UNUSED_VARIABLE(aCallback);
902 }
903
otPlatDnssdStartBrowser(otInstance * aInstance,const otPlatDnssdBrowser * aBrowser)904 OT_TOOL_WEAK void otPlatDnssdStartBrowser(otInstance *aInstance, const otPlatDnssdBrowser *aBrowser)
905 {
906 OT_UNUSED_VARIABLE(aInstance);
907 OT_UNUSED_VARIABLE(aBrowser);
908 }
909
otPlatDnssdStopBrowser(otInstance * aInstance,const otPlatDnssdBrowser * aBrowser)910 OT_TOOL_WEAK void otPlatDnssdStopBrowser(otInstance *aInstance, const otPlatDnssdBrowser *aBrowser)
911 {
912 OT_UNUSED_VARIABLE(aInstance);
913 OT_UNUSED_VARIABLE(aBrowser);
914 }
915
otPlatDnssdStartSrvResolver(otInstance * aInstance,const otPlatDnssdSrvResolver * aResolver)916 OT_TOOL_WEAK void otPlatDnssdStartSrvResolver(otInstance *aInstance, const otPlatDnssdSrvResolver *aResolver)
917 {
918 OT_UNUSED_VARIABLE(aInstance);
919 OT_UNUSED_VARIABLE(aResolver);
920 }
921
otPlatDnssdStopSrvResolver(otInstance * aInstance,const otPlatDnssdSrvResolver * aResolver)922 OT_TOOL_WEAK void otPlatDnssdStopSrvResolver(otInstance *aInstance, const otPlatDnssdSrvResolver *aResolver)
923 {
924 OT_UNUSED_VARIABLE(aInstance);
925 OT_UNUSED_VARIABLE(aResolver);
926 }
927
otPlatDnssdStartTxtResolver(otInstance * aInstance,const otPlatDnssdTxtResolver * aResolver)928 OT_TOOL_WEAK void otPlatDnssdStartTxtResolver(otInstance *aInstance, const otPlatDnssdTxtResolver *aResolver)
929 {
930 OT_UNUSED_VARIABLE(aInstance);
931 OT_UNUSED_VARIABLE(aResolver);
932 }
933
otPlatDnssdStopTxtResolver(otInstance * aInstance,const otPlatDnssdTxtResolver * aResolver)934 OT_TOOL_WEAK void otPlatDnssdStopTxtResolver(otInstance *aInstance, const otPlatDnssdTxtResolver *aResolver)
935 {
936 OT_UNUSED_VARIABLE(aInstance);
937 OT_UNUSED_VARIABLE(aResolver);
938 }
939
otPlatDnssdStartIp6AddressResolver(otInstance * aInstance,const otPlatDnssdAddressResolver * aResolver)940 OT_TOOL_WEAK void otPlatDnssdStartIp6AddressResolver(otInstance *aInstance, const otPlatDnssdAddressResolver *aResolver)
941 {
942 OT_UNUSED_VARIABLE(aInstance);
943 OT_UNUSED_VARIABLE(aResolver);
944 }
945
otPlatDnssdStopIp6AddressResolver(otInstance * aInstance,const otPlatDnssdAddressResolver * aResolver)946 OT_TOOL_WEAK void otPlatDnssdStopIp6AddressResolver(otInstance *aInstance, const otPlatDnssdAddressResolver *aResolver)
947 {
948 OT_UNUSED_VARIABLE(aInstance);
949 OT_UNUSED_VARIABLE(aResolver);
950 }
951
otPlatDnssdStartIp4AddressResolver(otInstance * aInstance,const otPlatDnssdAddressResolver * aResolver)952 OT_TOOL_WEAK void otPlatDnssdStartIp4AddressResolver(otInstance *aInstance, const otPlatDnssdAddressResolver *aResolver)
953 {
954 OT_UNUSED_VARIABLE(aInstance);
955 OT_UNUSED_VARIABLE(aResolver);
956 }
957
otPlatDnssdStopIp4AddressResolver(otInstance * aInstance,const otPlatDnssdAddressResolver * aResolver)958 OT_TOOL_WEAK void otPlatDnssdStopIp4AddressResolver(otInstance *aInstance, const otPlatDnssdAddressResolver *aResolver)
959 {
960 OT_UNUSED_VARIABLE(aInstance);
961 OT_UNUSED_VARIABLE(aResolver);
962 }
963
964 #endif // OPENTHREAD_CONFIG_PLATFORM_DNSSD_ENABLE
965
966 #if OPENTHREAD_CONFIG_PLATFORM_LOG_CRASH_DUMP_ENABLE
otPlatLogCrashDump(void)967 OT_TOOL_WEAK otError otPlatLogCrashDump(void) { return OT_ERROR_NONE; }
968 #endif
969
970 } // extern "C"
971