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 #include "test_platform.h"
30
31 #include <stdio.h>
32 #include <sys/time.h>
33
34 enum
35 {
36 FLASH_SWAP_SIZE = 2048,
37 FLASH_SWAP_NUM = 2,
38 };
39
40 static uint8_t sFlash[FLASH_SWAP_SIZE * FLASH_SWAP_NUM];
41
testInitInstance(void)42 ot::Instance *testInitInstance(void)
43 {
44 otInstance *instance = nullptr;
45
46 #if OPENTHREAD_CONFIG_MULTIPLE_INSTANCE_ENABLE
47 size_t instanceBufferLength = 0;
48 uint8_t *instanceBuffer = nullptr;
49
50 // Call to query the buffer size
51 (void)otInstanceInit(nullptr, &instanceBufferLength);
52
53 // Call to allocate the buffer
54 instanceBuffer = (uint8_t *)malloc(instanceBufferLength);
55 VerifyOrQuit(instanceBuffer != nullptr, "Failed to allocate otInstance");
56 memset(instanceBuffer, 0, instanceBufferLength);
57
58 // Initialize OpenThread with the buffer
59 instance = otInstanceInit(instanceBuffer, &instanceBufferLength);
60 #else
61 instance = otInstanceInitSingle();
62 #endif
63
64 return static_cast<ot::Instance *>(instance);
65 }
66
testFreeInstance(otInstance * aInstance)67 void testFreeInstance(otInstance *aInstance)
68 {
69 otInstanceFinalize(aInstance);
70
71 #if OPENTHREAD_CONFIG_MULTIPLE_INSTANCE_ENABLE
72 free(aInstance);
73 #endif
74 }
75
76 bool sDiagMode = false;
77
78 extern "C" {
79
80 #if OPENTHREAD_CONFIG_HEAP_EXTERNAL_ENABLE
otPlatCAlloc(size_t aNum,size_t aSize)81 OT_TOOL_WEAK void *otPlatCAlloc(size_t aNum, size_t aSize)
82 {
83 return calloc(aNum, aSize);
84 }
85
otPlatFree(void * aPtr)86 OT_TOOL_WEAK void otPlatFree(void *aPtr)
87 {
88 free(aPtr);
89 }
90 #endif
91
otTaskletsSignalPending(otInstance *)92 OT_TOOL_WEAK void otTaskletsSignalPending(otInstance *)
93 {
94 }
95
otPlatAlarmMilliStop(otInstance *)96 OT_TOOL_WEAK void otPlatAlarmMilliStop(otInstance *)
97 {
98 }
99
otPlatAlarmMilliStartAt(otInstance *,uint32_t,uint32_t)100 OT_TOOL_WEAK void otPlatAlarmMilliStartAt(otInstance *, uint32_t, uint32_t)
101 {
102 }
103
otPlatAlarmMilliGetNow(void)104 OT_TOOL_WEAK uint32_t otPlatAlarmMilliGetNow(void)
105 {
106 struct timeval tv;
107
108 gettimeofday(&tv, nullptr);
109
110 return (uint32_t)((tv.tv_sec * 1000) + (tv.tv_usec / 1000) + 123456);
111 }
112
otPlatAlarmMicroStop(otInstance *)113 OT_TOOL_WEAK void otPlatAlarmMicroStop(otInstance *)
114 {
115 }
116
otPlatAlarmMicroStartAt(otInstance *,uint32_t,uint32_t)117 OT_TOOL_WEAK void otPlatAlarmMicroStartAt(otInstance *, uint32_t, uint32_t)
118 {
119 }
120
otPlatAlarmMicroGetNow(void)121 OT_TOOL_WEAK uint32_t otPlatAlarmMicroGetNow(void)
122 {
123 struct timeval tv;
124
125 gettimeofday(&tv, nullptr);
126
127 return (uint32_t)((tv.tv_sec * 1000000) + tv.tv_usec + 123456);
128 }
129
otPlatRadioGetIeeeEui64(otInstance *,uint8_t *)130 OT_TOOL_WEAK void otPlatRadioGetIeeeEui64(otInstance *, uint8_t *)
131 {
132 }
133
otPlatRadioSetPanId(otInstance *,uint16_t)134 OT_TOOL_WEAK void otPlatRadioSetPanId(otInstance *, uint16_t)
135 {
136 }
137
otPlatRadioSetExtendedAddress(otInstance *,const otExtAddress *)138 OT_TOOL_WEAK void otPlatRadioSetExtendedAddress(otInstance *, const otExtAddress *)
139 {
140 }
141
otPlatRadioSetShortAddress(otInstance *,uint16_t)142 OT_TOOL_WEAK void otPlatRadioSetShortAddress(otInstance *, uint16_t)
143 {
144 }
145
otPlatRadioSetPromiscuous(otInstance *,bool)146 OT_TOOL_WEAK void otPlatRadioSetPromiscuous(otInstance *, bool)
147 {
148 }
149
otPlatRadioIsEnabled(otInstance *)150 OT_TOOL_WEAK bool otPlatRadioIsEnabled(otInstance *)
151 {
152 return true;
153 }
154
otPlatRadioEnable(otInstance *)155 OT_TOOL_WEAK otError otPlatRadioEnable(otInstance *)
156 {
157 return OT_ERROR_NONE;
158 }
159
otPlatRadioDisable(otInstance *)160 OT_TOOL_WEAK otError otPlatRadioDisable(otInstance *)
161 {
162 return OT_ERROR_NONE;
163 }
164
otPlatRadioSleep(otInstance *)165 OT_TOOL_WEAK otError otPlatRadioSleep(otInstance *)
166 {
167 return OT_ERROR_NONE;
168 }
169
otPlatRadioReceive(otInstance *,uint8_t)170 OT_TOOL_WEAK otError otPlatRadioReceive(otInstance *, uint8_t)
171 {
172 return OT_ERROR_NONE;
173 }
174
otPlatRadioTransmit(otInstance *,otRadioFrame *)175 OT_TOOL_WEAK otError otPlatRadioTransmit(otInstance *, otRadioFrame *)
176 {
177 return OT_ERROR_NONE;
178 }
179
otPlatRadioGetTransmitBuffer(otInstance *)180 OT_TOOL_WEAK otRadioFrame *otPlatRadioGetTransmitBuffer(otInstance *)
181 {
182 return nullptr;
183 }
184
otPlatRadioGetRssi(otInstance *)185 OT_TOOL_WEAK int8_t otPlatRadioGetRssi(otInstance *)
186 {
187 return 0;
188 }
189
otPlatRadioGetCaps(otInstance *)190 OT_TOOL_WEAK otRadioCaps otPlatRadioGetCaps(otInstance *)
191 {
192 return OT_RADIO_CAPS_NONE;
193 }
194
otPlatRadioGetPromiscuous(otInstance *)195 OT_TOOL_WEAK bool otPlatRadioGetPromiscuous(otInstance *)
196 {
197 return false;
198 }
199
otPlatRadioEnableSrcMatch(otInstance *,bool)200 OT_TOOL_WEAK void otPlatRadioEnableSrcMatch(otInstance *, bool)
201 {
202 }
203
otPlatRadioAddSrcMatchShortEntry(otInstance *,uint16_t)204 OT_TOOL_WEAK otError otPlatRadioAddSrcMatchShortEntry(otInstance *, uint16_t)
205 {
206 return OT_ERROR_NONE;
207 }
208
otPlatRadioAddSrcMatchExtEntry(otInstance *,const otExtAddress *)209 OT_TOOL_WEAK otError otPlatRadioAddSrcMatchExtEntry(otInstance *, const otExtAddress *)
210 {
211 return OT_ERROR_NONE;
212 }
213
otPlatRadioClearSrcMatchShortEntry(otInstance *,uint16_t)214 OT_TOOL_WEAK otError otPlatRadioClearSrcMatchShortEntry(otInstance *, uint16_t)
215 {
216 return OT_ERROR_NONE;
217 }
218
otPlatRadioClearSrcMatchExtEntry(otInstance *,const otExtAddress *)219 OT_TOOL_WEAK otError otPlatRadioClearSrcMatchExtEntry(otInstance *, const otExtAddress *)
220 {
221 return OT_ERROR_NONE;
222 }
223
otPlatRadioClearSrcMatchShortEntries(otInstance *)224 OT_TOOL_WEAK void otPlatRadioClearSrcMatchShortEntries(otInstance *)
225 {
226 }
227
otPlatRadioClearSrcMatchExtEntries(otInstance *)228 OT_TOOL_WEAK void otPlatRadioClearSrcMatchExtEntries(otInstance *)
229 {
230 }
231
otPlatRadioEnergyScan(otInstance *,uint8_t,uint16_t)232 OT_TOOL_WEAK otError otPlatRadioEnergyScan(otInstance *, uint8_t, uint16_t)
233 {
234 return OT_ERROR_NOT_IMPLEMENTED;
235 }
236
otPlatRadioSetTransmitPower(otInstance *,int8_t)237 OT_TOOL_WEAK otError otPlatRadioSetTransmitPower(otInstance *, int8_t)
238 {
239 return OT_ERROR_NOT_IMPLEMENTED;
240 }
241
otPlatRadioGetReceiveSensitivity(otInstance *)242 OT_TOOL_WEAK int8_t otPlatRadioGetReceiveSensitivity(otInstance *)
243 {
244 return -100;
245 }
246
otPlatEntropyGet(uint8_t * aOutput,uint16_t aOutputLength)247 OT_TOOL_WEAK otError otPlatEntropyGet(uint8_t *aOutput, uint16_t aOutputLength)
248 {
249 otError error = OT_ERROR_NONE;
250
251 VerifyOrExit(aOutput, error = OT_ERROR_INVALID_ARGS);
252
253 #if __SANITIZE_ADDRESS__ == 0
254 {
255 FILE * file = nullptr;
256 size_t readLength;
257
258 file = fopen("/dev/urandom", "rb");
259 VerifyOrExit(file != nullptr, error = OT_ERROR_FAILED);
260
261 readLength = fread(aOutput, 1, aOutputLength, file);
262
263 if (readLength != aOutputLength)
264 {
265 error = OT_ERROR_FAILED;
266 }
267
268 fclose(file);
269 }
270 #else
271 for (uint16_t length = 0; length < aOutputLength; length++)
272 {
273 aOutput[length] = (uint8_t)rand();
274 }
275 #endif
276
277 exit:
278 return error;
279 }
280
otPlatDiagProcess(otInstance *,uint8_t,char * aArgs[],char * aOutput,size_t)281 OT_TOOL_WEAK void otPlatDiagProcess(otInstance *, uint8_t, char *aArgs[], char *aOutput, size_t)
282 {
283 sprintf(aOutput, "diag feature '%s' is not supported\r\n", aArgs[0]);
284 }
285
otPlatDiagModeSet(bool aMode)286 OT_TOOL_WEAK void otPlatDiagModeSet(bool aMode)
287 {
288 sDiagMode = aMode;
289 }
290
otPlatDiagModeGet()291 OT_TOOL_WEAK bool otPlatDiagModeGet()
292 {
293 return sDiagMode;
294 }
295
otPlatDiagChannelSet(uint8_t)296 OT_TOOL_WEAK void otPlatDiagChannelSet(uint8_t)
297 {
298 }
299
otPlatDiagTxPowerSet(int8_t)300 OT_TOOL_WEAK void otPlatDiagTxPowerSet(int8_t)
301 {
302 }
303
otPlatDiagRadioReceived(otInstance *,otRadioFrame *,otError)304 OT_TOOL_WEAK void otPlatDiagRadioReceived(otInstance *, otRadioFrame *, otError)
305 {
306 }
307
otPlatDiagAlarmCallback(otInstance *)308 OT_TOOL_WEAK void otPlatDiagAlarmCallback(otInstance *)
309 {
310 }
311
otPlatUartSendDone(void)312 OT_TOOL_WEAK void otPlatUartSendDone(void)
313 {
314 }
315
otPlatUartReceived(const uint8_t *,uint16_t)316 OT_TOOL_WEAK void otPlatUartReceived(const uint8_t *, uint16_t)
317 {
318 }
319
otPlatReset(otInstance *)320 OT_TOOL_WEAK void otPlatReset(otInstance *)
321 {
322 }
323
otPlatGetResetReason(otInstance *)324 OT_TOOL_WEAK otPlatResetReason otPlatGetResetReason(otInstance *)
325 {
326 return OT_PLAT_RESET_REASON_POWER_ON;
327 }
328
otPlatLog(otLogLevel,otLogRegion,const char *,...)329 OT_TOOL_WEAK void otPlatLog(otLogLevel, otLogRegion, const char *, ...)
330 {
331 }
332
otPlatSettingsInit(otInstance *,const uint16_t *,uint16_t)333 OT_TOOL_WEAK void otPlatSettingsInit(otInstance *, const uint16_t *, uint16_t)
334 {
335 }
336
otPlatSettingsDeinit(otInstance *)337 OT_TOOL_WEAK void otPlatSettingsDeinit(otInstance *)
338 {
339 }
340
otPlatSettingsGet(otInstance *,uint16_t,int,uint8_t *,uint16_t *)341 OT_TOOL_WEAK otError otPlatSettingsGet(otInstance *, uint16_t, int, uint8_t *, uint16_t *)
342 {
343 return OT_ERROR_NOT_FOUND;
344 }
345
otPlatSettingsSet(otInstance *,uint16_t,const uint8_t *,uint16_t)346 OT_TOOL_WEAK otError otPlatSettingsSet(otInstance *, uint16_t, const uint8_t *, uint16_t)
347 {
348 return OT_ERROR_NONE;
349 }
350
otPlatSettingsAdd(otInstance *,uint16_t,const uint8_t *,uint16_t)351 OT_TOOL_WEAK otError otPlatSettingsAdd(otInstance *, uint16_t, const uint8_t *, uint16_t)
352 {
353 return OT_ERROR_NONE;
354 }
355
otPlatSettingsDelete(otInstance *,uint16_t,int)356 OT_TOOL_WEAK otError otPlatSettingsDelete(otInstance *, uint16_t, int)
357 {
358 return OT_ERROR_NONE;
359 }
360
otPlatSettingsWipe(otInstance *)361 OT_TOOL_WEAK void otPlatSettingsWipe(otInstance *)
362 {
363 }
364
otPlatFlashInit(otInstance *)365 OT_TOOL_WEAK void otPlatFlashInit(otInstance *)
366 {
367 memset(sFlash, 0xff, sizeof(sFlash));
368 }
369
otPlatFlashGetSwapSize(otInstance *)370 OT_TOOL_WEAK uint32_t otPlatFlashGetSwapSize(otInstance *)
371 {
372 return FLASH_SWAP_SIZE;
373 }
374
otPlatFlashErase(otInstance *,uint8_t aSwapIndex)375 OT_TOOL_WEAK void otPlatFlashErase(otInstance *, uint8_t aSwapIndex)
376 {
377 uint32_t address;
378
379 VerifyOrQuit(aSwapIndex < FLASH_SWAP_NUM, "aSwapIndex invalid");
380
381 address = aSwapIndex ? FLASH_SWAP_SIZE : 0;
382
383 memset(sFlash + address, 0xff, FLASH_SWAP_SIZE);
384 }
385
otPlatFlashRead(otInstance *,uint8_t aSwapIndex,uint32_t aOffset,void * aData,uint32_t aSize)386 OT_TOOL_WEAK void otPlatFlashRead(otInstance *, uint8_t aSwapIndex, uint32_t aOffset, void *aData, uint32_t aSize)
387 {
388 uint32_t address;
389
390 VerifyOrQuit(aSwapIndex < FLASH_SWAP_NUM, "aSwapIndex invalid");
391 VerifyOrQuit(aSize <= FLASH_SWAP_SIZE, "aSize invalid");
392 VerifyOrQuit(aOffset <= (FLASH_SWAP_SIZE - aSize), "aOffset + aSize invalid");
393
394 address = aSwapIndex ? FLASH_SWAP_SIZE : 0;
395
396 memcpy(aData, sFlash + address + aOffset, aSize);
397 }
398
otPlatFlashWrite(otInstance *,uint8_t aSwapIndex,uint32_t aOffset,const void * aData,uint32_t aSize)399 OT_TOOL_WEAK void otPlatFlashWrite(otInstance *,
400 uint8_t aSwapIndex,
401 uint32_t aOffset,
402 const void *aData,
403 uint32_t aSize)
404 {
405 uint32_t address;
406
407 VerifyOrQuit(aSwapIndex < FLASH_SWAP_NUM, "aSwapIndex invalid");
408 VerifyOrQuit(aSize <= FLASH_SWAP_SIZE, "aSize invalid");
409 VerifyOrQuit(aOffset <= (FLASH_SWAP_SIZE - aSize), "aOffset + aSize invalid");
410
411 address = aSwapIndex ? FLASH_SWAP_SIZE : 0;
412
413 for (uint32_t index = 0; index < aSize; index++)
414 {
415 sFlash[address + aOffset + index] &= ((uint8_t *)aData)[index];
416 }
417 }
418
419 #if OPENTHREAD_CONFIG_TIME_SYNC_ENABLE || OPENTHREAD_CONFIG_MAC_CSL_RECEIVER_ENABLE
otPlatTimeGetXtalAccuracy(void)420 OT_TOOL_WEAK uint16_t otPlatTimeGetXtalAccuracy(void)
421 {
422 return 0;
423 }
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
otPlatRadioUpdateCslSampleTime(otInstance *,uint32_t)432 OT_TOOL_WEAK void otPlatRadioUpdateCslSampleTime(otInstance *, uint32_t)
433 {
434 }
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 {
445 }
446 #endif
447
448 #if OPENTHREAD_CONFIG_RADIO_LINK_TREL_ENABLE
otPlatTrelEnable(otInstance *,uint16_t *)449 OT_TOOL_WEAK void otPlatTrelEnable(otInstance *, uint16_t *)
450 {
451 }
452
otPlatTrelDisable(otInstance *)453 OT_TOOL_WEAK void otPlatTrelDisable(otInstance *)
454 {
455 }
456
otPlatTrelSend(otInstance *,const uint8_t *,uint16_t,const otSockAddr *)457 OT_TOOL_WEAK void otPlatTrelSend(otInstance *, const uint8_t *, uint16_t, const otSockAddr *)
458 {
459 }
460
otPlatTrelRegisterService(otInstance *,uint16_t,const uint8_t *,uint8_t)461 OT_TOOL_WEAK void otPlatTrelRegisterService(otInstance *, uint16_t, const uint8_t *, uint8_t)
462 {
463 }
464 #endif
465
466 #if OPENTHREAD_CONFIG_MLE_LINK_METRICS_SUBJECT_ENABLE
otPlatRadioConfigureEnhAckProbing(otInstance *,otLinkMetrics,const otShortAddress,const otExtAddress *)467 OT_TOOL_WEAK otError otPlatRadioConfigureEnhAckProbing(otInstance *,
468 otLinkMetrics,
469 const otShortAddress,
470 const otExtAddress *)
471 {
472 return OT_ERROR_NONE;
473 }
474
otPlatRadioGetEnhAckProbingMetrics(otInstance *,const otShortAddress)475 OT_TOOL_WEAK otLinkMetrics otPlatRadioGetEnhAckProbingMetrics(otInstance *, const otShortAddress)
476 {
477 otLinkMetrics metrics;
478
479 memset(&metrics, 0, sizeof(metrics));
480
481 return metrics;
482 }
483 #endif
484
485 #if OPENTHREAD_CONFIG_BORDER_ROUTING_ENABLE
otPlatInfraIfHasAddress(uint32_t,const otIp6Address *)486 OT_TOOL_WEAK bool otPlatInfraIfHasAddress(uint32_t, const otIp6Address *)
487 {
488 return false;
489 }
490
otPlatInfraIfSendIcmp6Nd(uint32_t,const otIp6Address *,const uint8_t *,uint16_t)491 OT_TOOL_WEAK otError otPlatInfraIfSendIcmp6Nd(uint32_t, const otIp6Address *, const uint8_t *, uint16_t)
492 {
493 return OT_ERROR_FAILED;
494 }
495 #endif
496
497 #if OPENTHREAD_CONFIG_PLATFORM_KEY_REFERENCES_ENABLE
498
otPlatCryptoImportKey(otCryptoKeyRef * aKeyRef,otCryptoKeyType aKeyType,otCryptoKeyAlgorithm aKeyAlgorithm,int aKeyUsage,otCryptoKeyStorage aKeyPersistence,const uint8_t * aKey,size_t aKeyLen)499 otError otPlatCryptoImportKey(otCryptoKeyRef * aKeyRef,
500 otCryptoKeyType aKeyType,
501 otCryptoKeyAlgorithm aKeyAlgorithm,
502 int aKeyUsage,
503 otCryptoKeyStorage aKeyPersistence,
504 const uint8_t * aKey,
505 size_t aKeyLen)
506 {
507 OT_UNUSED_VARIABLE(aKeyRef);
508 OT_UNUSED_VARIABLE(aKeyType);
509 OT_UNUSED_VARIABLE(aKeyAlgorithm);
510 OT_UNUSED_VARIABLE(aKeyUsage);
511 OT_UNUSED_VARIABLE(aKeyPersistence);
512 OT_UNUSED_VARIABLE(aKey);
513 OT_UNUSED_VARIABLE(aKeyLen);
514
515 return OT_ERROR_NONE;
516 }
517
otPlatCryptoExportKey(otCryptoKeyRef aKeyRef,uint8_t * aBuffer,size_t aBufferLen,size_t * aKeyLen)518 otError otPlatCryptoExportKey(otCryptoKeyRef aKeyRef, uint8_t *aBuffer, size_t aBufferLen, size_t *aKeyLen)
519 {
520 OT_UNUSED_VARIABLE(aKeyRef);
521 OT_UNUSED_VARIABLE(aBuffer);
522 OT_UNUSED_VARIABLE(aBufferLen);
523
524 *aKeyLen = 0;
525
526 return OT_ERROR_NONE;
527 }
528
otPlatCryptoDestroyKey(otCryptoKeyRef aKeyRef)529 otError otPlatCryptoDestroyKey(otCryptoKeyRef aKeyRef)
530 {
531 OT_UNUSED_VARIABLE(aKeyRef);
532
533 return OT_ERROR_NONE;
534 }
535
otPlatCryptoHasKey(otCryptoKeyRef aKeyRef)536 bool otPlatCryptoHasKey(otCryptoKeyRef aKeyRef)
537 {
538 OT_UNUSED_VARIABLE(aKeyRef);
539
540 return false;
541 }
542
543 #endif // OPENTHREAD_CONFIG_PLATFORM_KEY_REFERENCES_ENABLE
544
otPlatRadioSetCcaEnergyDetectThreshold(otInstance * aInstance,int8_t aThreshold)545 otError otPlatRadioSetCcaEnergyDetectThreshold(otInstance *aInstance, int8_t aThreshold)
546 {
547 OT_UNUSED_VARIABLE(aInstance);
548 OT_UNUSED_VARIABLE(aThreshold);
549
550 return OT_ERROR_NONE;
551 }
552
553 #if OPENTHREAD_CONFIG_DNS_DSO_ENABLE
554
otPlatDsoEnableListening(otInstance * aInstance,bool aEnable)555 OT_TOOL_WEAK void otPlatDsoEnableListening(otInstance *aInstance, bool aEnable)
556 {
557 OT_UNUSED_VARIABLE(aInstance);
558 OT_UNUSED_VARIABLE(aEnable);
559 }
560
otPlatDsoConnect(otPlatDsoConnection * aConnection,const otSockAddr * aPeerSockAddr)561 OT_TOOL_WEAK void otPlatDsoConnect(otPlatDsoConnection *aConnection, const otSockAddr *aPeerSockAddr)
562 {
563 OT_UNUSED_VARIABLE(aConnection);
564 OT_UNUSED_VARIABLE(aPeerSockAddr);
565 }
566
otPlatDsoSend(otPlatDsoConnection * aConnection,otMessage * aMessage)567 OT_TOOL_WEAK void otPlatDsoSend(otPlatDsoConnection *aConnection, otMessage *aMessage)
568 {
569 OT_UNUSED_VARIABLE(aConnection);
570 OT_UNUSED_VARIABLE(aMessage);
571 }
572
otPlatDsoDisconnect(otPlatDsoConnection * aConnection,otPlatDsoDisconnectMode aMode)573 OT_TOOL_WEAK void otPlatDsoDisconnect(otPlatDsoConnection *aConnection, otPlatDsoDisconnectMode aMode)
574 {
575 OT_UNUSED_VARIABLE(aConnection);
576 OT_UNUSED_VARIABLE(aMode);
577 }
578
579 #endif // #if OPENTHREAD_CONFIG_DNS_DSO_ENABLE
580
581 } // extern "C"
582