From 2762e25d1d3a8849333199cc97a3972e0dceaf53 Mon Sep 17 00:00:00 2001 From: "TOKITA, Hiroshi" Date: Tue, 21 Jul 2020 22:09:11 +0900 Subject: [PATCH 1/3] Reduce system include path --- libraries/OpenThread/src/core/openthread_freertos.c | 2 +- libraries/OpenThread/src/core/otr_system.c | 2 +- platform.txt | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/libraries/OpenThread/src/core/openthread_freertos.c b/libraries/OpenThread/src/core/openthread_freertos.c index 258271e36..af523891d 100644 --- a/libraries/OpenThread/src/core/openthread_freertos.c +++ b/libraries/OpenThread/src/core/openthread_freertos.c @@ -39,7 +39,7 @@ //#include #include -#include +#include #include #include #include diff --git a/libraries/OpenThread/src/core/otr_system.c b/libraries/OpenThread/src/core/otr_system.c index 053b0167c..d533359ae 100644 --- a/libraries/OpenThread/src/core/otr_system.c +++ b/libraries/OpenThread/src/core/otr_system.c @@ -81,7 +81,7 @@ void otrSystemProcess(otInstance *aInstance) #include #include -#include +#include #include void otrSystemPoll(otInstance *aInstance) diff --git a/platform.txt b/platform.txt index fd900e2dd..6cdccd3c4 100644 --- a/platform.txt +++ b/platform.txt @@ -68,7 +68,7 @@ build.flags.mbedtls_config="nrf-config.h" build.flags.mbedtls_user_config="nrf52840-mbedtls-config.h" build.flags.openthread.ftd= -DOPENTHREAD_CONFIG_BORDER_AGENT_ENABLE=1 -DOPENTHREAD_CONFIG_BORDER_ROUTER_ENABLE=1 -DOPENTHREAD_CONFIG_CHILD_SUPERVISION_ENABLE=1 -DOPENTHREAD_CONFIG_COAP_API_ENABLE=1 -DOPENTHREAD_CONFIG_COAP_SECURE_API_ENABLE=1 -DOPENTHREAD_CONFIG_COMMISSIONER_ENABLE=1 -DOPENTHREAD_CONFIG_DHCP6_CLIENT_ENABLE=1 -DOPENTHREAD_CONFIG_DHCP6_SERVER_ENABLE=1 -DOPENTHREAD_CONFIG_DIAG_ENABLE=1 -DOPENTHREAD_CONFIG_DNS_CLIENT_ENABLE=1 -DOPENTHREAD_CONFIG_ECDSA_ENABLE=1 -DOPENTHREAD_CONFIG_ENABLE_BUILTIN_MBEDTLS=0 -DOPENTHREAD_CONFIG_HEAP_EXTERNAL_ENABLE=1 -DOPENTHREAD_CONFIG_IP6_SLAAC_ENABLE=1 -DOPENTHREAD_CONFIG_JAM_DETECTION_ENABLE=1 -DOPENTHREAD_CONFIG_JOINER_ENABLE=1 -DOPENTHREAD_CONFIG_LINK_RAW_ENABLE=1 -DOPENTHREAD_CONFIG_MAC_FILTER_ENABLE=1 -DOPENTHREAD_CONFIG_NCP_UART_ENABLE=1 -DOPENTHREAD_CONFIG_SNTP_CLIENT_ENABLE=1 -DOPENTHREAD_CONFIG_THREAD_VERSION=2 -DOPENTHREAD_CONFIG_TMF_NETDATA_SERVICE_ENABLE=1 -DOPENTHREAD_CONFIG_TMF_NETWORK_DIAG_MTD_ENABLE=1 -DOPENTHREAD_CONFIG_UDP_FORWARD_ENABLE=1 -DOPENTHREAD_ENABLE_NCP_SPINEL_ENCRYPTER=0 -DOPENTHREAD_ENABLE_VENDOR_EXTENSION=0 -DOPENTHREAD_EXAMPLES_SIMULATION=0 -DOPENTHREAD_FTD=1 -DOPENTHREAD_MTD=0 -DOPENTHREAD_PLATFORM_POSIX=0 -DOPENTHREAD_POSIX_CONFIG_DAEMON_ENABLE=0 -DOPENTHREAD_RADIO=0 build.flags.openthread= {build.flags.openthread.ftd} -DMBEDTLS_CONFIG_FILE={build.flags.mbedtls_config} -DMBEDTLS_USER_CONFIG_FILE={build.flags.mbedtls_user_config} -DOPENTHREAD_CONFIG_FILE={build.flags.openthread_config} -DMBEDTLS_USER_CONFIG_FILE={build.flags.mbedtls_user_config} -DCONFIG_GPIO_AS_PINRESET -DNRF_SD_BLE_API_VERSION=7 -DS140 -D__HEAP_SIZE=8192 -D__STACK_SIZE=8192 -DSOFTDEVICE_PRESENT -DFREERTOS -DMULTIPROTOCOL_802154_CONFIG_PRESENT -DNRF52840_XXAA -DBOARD_PCA10056 -D_BSD_SOURCE=1 -D_DEFAULT_SOURCE=1 {build.flags.nordic_includes} -build.flags.nordic_includes= -I{nordic.path}/config/nrf52840/config -I{nordic.path}/softdevice/common -I{nordic.path}/softdevice/s140_nrf52_7.0.1_API/include -I{nordic.path}/softdevice/s140_nrf52_7.0.1_API/include/nrf52 -I{nordic.path}/nrfx -I{nordic.path}/nrfx/legacy -I{nordic.path}/nrfx/drivers/include -I{nordic.path}/nrfx/hal -I{nordic.path}/nrfx/mdk -I{nordic.path}/components/libraries/experimental_section_vars -I{nordic.path}/components/libraries/log -I{nordic.path}/components/libraries/strerror -I{nordic.path}/components/libraries/util -I{nordic.path}/external/nRF-IEEE-802.15.4-radio-driver/src -I{nordic.path}/external/nRF-IEEE-802.15.4-radio-driver/src/fem -I{nordic.path}/external/nRF-IEEE-802.15.4-radio-driver/src/fem/three_pin_gpio -I{nordic.path}/external/nRF-IEEE-802.15.4-radio-driver/src/rsch/raal/softdevice -I{nordic.path}/external/nrf_security/config -I{nordic.path}/external/nrf_security/include -I{nordic.path}/external/nrf_security/mbedtls_plat_config -I{nordic.path}/external/nrf_security/nrf_cc310_plat/include -I{nordic.path}/external/openthread/include -I{nordic.path}/external/openthread/project/nrf52840 -I{nordic.path}/external/openthread/project/config -I{nordic.path}/external/openthread/include/openthread/platform +build.flags.nordic_includes= -I{nordic.path}/config/nrf52840/config -I{nordic.path}/softdevice/common -I{nordic.path}/softdevice/s140_nrf52_7.0.1_API/include -I{nordic.path}/softdevice/s140_nrf52_7.0.1_API/include/nrf52 -I{nordic.path}/nrfx -I{nordic.path}/nrfx/legacy -I{nordic.path}/nrfx/drivers/include -I{nordic.path}/nrfx/hal -I{nordic.path}/nrfx/mdk -I{nordic.path}/components/libraries/experimental_section_vars -I{nordic.path}/components/libraries/log -I{nordic.path}/components/libraries/strerror -I{nordic.path}/components/libraries/util -I{nordic.path}/external/nRF-IEEE-802.15.4-radio-driver/src -I{nordic.path}/external/nRF-IEEE-802.15.4-radio-driver/src/fem -I{nordic.path}/external/nRF-IEEE-802.15.4-radio-driver/src/fem/three_pin_gpio -I{nordic.path}/external/nRF-IEEE-802.15.4-radio-driver/src/rsch/raal/softdevice -I{nordic.path}/external/nrf_security/config -I{nordic.path}/external/nrf_security/include -I{nordic.path}/external/nrf_security/mbedtls_plat_config -I{nordic.path}/external/nrf_security/nrf_cc310_plat/include -I{nordic.path}/external/openthread/include libnrf_cc310.path={nordic.path}/external/nrf_security/lib libopenthread.path={nordic.path}/external/openthread/lib/nrf52840/gcc From f469dbf63732044f0d3e9a96ed6433c5f2155138 Mon Sep 17 00:00:00 2001 From: "TOKITA, Hiroshi" Date: Tue, 21 Jul 2020 19:56:59 +0900 Subject: [PATCH 2/3] Update OpenThread APIs --- libraries/OpenThread/src/OpenThread.h | 347 +++-------- libraries/OpenThread/src/OpenThread_APIs.cpp | 531 +++++++++++----- libraries/OpenThread/src/OpenThread_APIs.inc | 620 +++++++++++++++++++ 3 files changed, 1063 insertions(+), 435 deletions(-) create mode 100644 libraries/OpenThread/src/OpenThread_APIs.inc diff --git a/libraries/OpenThread/src/OpenThread.h b/libraries/OpenThread/src/OpenThread.h index c8e6e26fc..985d6bd3d 100644 --- a/libraries/OpenThread/src/OpenThread.h +++ b/libraries/OpenThread/src/OpenThread.h @@ -25,40 +25,47 @@ #include #include -#if OPENTHREAD_CONFIG_BORDER_ROUTER_ENABLE +#include +#include +#include #include -#endif #include #include #include #include #include #include -#if OPENTHREAD_CONFIG_APPLICATION_COAP_ENABLE #include -#endif -#if OPENTHREAD_CONFIG_APPLICATION_COAP_SECURE_ENABLE #include -#endif -#if OPENTHREAD_FTD #include #include -#endif -#if OPENTHREAD_CONFIG_DIAG_ENABLE #include -#endif -#if OPENTHREAD_CONFIG_COMMISSIONER_ENABLE #include -#endif -#if OPENTHREAD_CONFIG_JOINER_ENABLE #include -#endif #include -#if OPENTHREAD_CONFIG_SERVICE_ENABLE #include -#endif #include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + #define OT_CALL_FUNC0(cls, fn) ot##cls##fn (otrGetInstance()) #define OT_CALL_FUNC1(cls, fn) ot##cls##fn (otrGetInstance(), a1) #define OT_CALL_FUNC2(cls, fn) ot##cls##fn (otrGetInstance(), a1, a2) @@ -121,6 +128,20 @@ #define OT_FUNC_4_DECL(ty, na, cat, n2, t1, t2, t3, t4) \ ty na(t1, t2, t3, t4) +#define OTCLS(cls) OT ## cls +#define OT_DECL__FUNC(n, cls, rettype, fn, ...) \ +rettype OpenThreadClass:: OTCLS(cls) :: fn (OT_DECL_ARGS ## n(__VA_ARGS__)) \ +{ \ + rettype ret = OT_CALL_FUNC ## n(cls, fn); \ + return ret; \ +} + +#define OT_DECL_VFUNC(n, cls, rettype, fn, ...) \ +rettype OpenThreadClass:: OTCLS(cls) :: fn (OT_DECL_ARGS ## n(__VA_ARGS__)) \ +{ \ + OT_CALL_FUNC ## n(cls, fn); \ +} + template class OTm8Buffer : public Printable { public: OTm8Buffer() : value(&default_value) { } @@ -419,282 +440,54 @@ class OpenThreadClass { OT_FUNC_1_DECL(otError, txpower, PlatRadio, GetTransmitPower, int8_t*); int8_t txpower() { int8_t ret; otError err = txpower(&ret); return err ? 0 : ret; } inline const char* version() { return otGetVersionString(); } + inline const char* VersionString() { return otGetVersionString(); } + inline const char* RadioVersionString() { return otGetRadioVersionString(otrGetInstance()); } inline const char* otErrorToString(otError err) { return otThreadErrorToString(err); } + inline otError SetStateChangedCallback(otStateChangedCallback cb, void* user) { + return otSetStateChangedCallback(otrGetInstance(), cb, user); + } + inline void RemoveStateChangeCallback(otStateChangedCallback cb, void* user) { + otRemoveStateChangeCallback(otrGetInstance(), cb, user); + } +#include "OpenThread_APIs.inc" - -#if OPENTHREAD_CONFIG_BORDER_ROUTER_ENABLE - class OTBorderRouter { - friend class OpenThreadClass; - public: - otError GetNetData(bool, uint8_t*, uint8_t*); - otError AddOnMeshPrefix(const otBorderRouterConfig*); - otError RemoveOnMeshPrefix(const otIp6Prefix*); - otError GetNextOnMeshPrefix(otNetworkDataIterator*, otBorderRouterConfig*); - otError AddRoute(const otExternalRouteConfig*); - otError RemoveRoute(const otIp6Prefix*); - otError GetNextRoute(otNetworkDataIterator*, otExternalRouteConfig*); - otError Register(); - }; - + OTBackboneRouter BackboneRouter; + OTBorderAgent BorderAgent; OTBorderRouter BorderRouter; -#endif - -#if OPENTHREAD_CONFIG_COMMISSIONER_ENABLE - class OTCommissioner { - friend class OpenThreadClass; - public: - otError Start(otCommissionerStateCallback, otCommissionerJoinerCallback, void*); - otError Stop(); - otError AddJoiner(const otExtAddress*, const char*, uint32_t); - otError RemoveJoiner(const otExtAddress*); - otError SetProvisioningUrl(const char*); - otError AnnounceBegin(uint32_t, uint8_t, uint16_t, const otIp6Address*); - otError EnergyScan(uint32_t, uint8_t, uint16_t, uint16_t, const otIp6Address*, otCommissionerEnergyReportCallback, void*); - otError PanIdQuery(uint16_t, uint32_t, const otIp6Address*, otCommissionerPanIdConflictCallback, void*); - otError SendMgmtGet(const uint8_t*, uint8_t); - otError SendMgmtSet(const otCommissioningDataset*, const uint8_t*, uint8_t); - uint16_t GetSessionId(); - otCommissionerState GetState(); - otError GeneratePskc(const char*, const char*, const otExtendedPanId*, uint8_t*); - }; - + OTChannelManager ChannelManager; + OTChannelMonitor ChannelMonitor; + OTChildSupervision ChildSupervision; + OTCli Cli; + OTCoap Coap; + OTCoapSecure CoapSecure; OTCommissioner Commissioner; -#endif - - class OTDataset { - friend class OpenThreadClass; - public: - bool IsCommissioned(); - otError GetActive(otOperationalDataset*); - otError SetActive(const otOperationalDataset*); - otError GetPending(otOperationalDataset*); - otError SetPending(const otOperationalDataset*); - otError SendMgmtActiveGet(const otOperationalDatasetComponents*, const uint8_t*, uint8_t, const otIp6Address*); - otError SendMgmtActiveSet(const otOperationalDataset*, const uint8_t*, uint8_t); - otError SendMgmtPendingGet(const otOperationalDatasetComponents*, const uint8_t*, uint8_t, const otIp6Address*); - otError SendMgmtPendingSet(const otOperationalDataset*, const uint8_t*, uint8_t); - uint32_t GetDelayTimerMinimal(); - otError SetDelayTimerMinimal(uint32_t); - }; - + OTCrypto Crypto; OTDataset Dataset; - - class OTError { - friend class OpenThreadClass; - public: - inline const char* ErrorToString(otError err) { return otThreadErrorToString(err); } - }; - - OTError Error; - - class OTInstance { - friend class OpenThreadClass; - public: - otError SetStateChangedCallback(otStateChangedCallback, void*); - void RemoveStateChangeCallback(otStateChangedCallback, void*); - void Reset(); - void FactoryReset(); - inline const char* GetVersionString(void) { return otGetVersionString(); } - }; - + OTDiag Diag; + OTDnsClient DnsClient; + OTEntropy Entropy; + OTHeap Heap; + OTIcmp6 Icmp6; OTInstance Instance; - - class OTIp6 { - friend class OpenThreadClass; - public: - otError SetEnabled(bool); - bool IsEnabled(); - otError AddUnicastAddress(const otNetifAddress*); - otError RemoveUnicastAddress(const otIp6Address*); - const otNetifAddress* GetUnicastAddresses(); - - static inline bool IsAddressEqual(const otIp6Address* a1, const otIp6Address* a2) - { - return otIp6IsAddressEqual(a1, a2); - } - static inline otError AddressFromString(const char* str, otIp6Address* addr) - { - return otIp6AddressFromString(str, addr); - } - uint8_t PrefixMatch(const otIp6Address* addr1, const otIp6Address* addr2) - { - return otIp6PrefixMatch(addr1, addr2); - } - }; - OTIp6 Ip6; - -#if OPENTHREAD_CONFIG_JOINER_ENABLE - class OTJoiner { - friend class OpenThreadClass; - public: - otError Start(const char*, const char*, const char*, const char*, const char*, const char*, otJoinerCallback, void*); - void Stop(); - otJoinerState GetState(); - void GetId(otExtAddress*); - }; - + OTJamDetection JamDetection; OTJoiner Joiner; -#endif - - class OTLink { - friend class OpenThreadClass; - public: - otError ActiveScan(uint32_t, uint16_t, otHandleActiveScanResult, void*); - bool IsActiveScanInProgress(); - otError EnergyScan(uint32_t, uint16_t, otHandleEnergyScanResult, void*); - bool IsEnergyScanInProgress(); - otError SendDataRequest(); - bool IsInTransmitState(); - otError OutOfBandTransmitRequest(otRadioFrame*); - uint8_t GetChannel(); - otError SetChannel(uint8_t); - const otExtAddress* GetExtendedAddress(); - otError SetExtendedAddress(const otExtAddress*); - void GetFactoryAssignedIeeeEui64(otExtAddress*); - otPanId GetPanId(); - otError SetPanId(otPanId); - uint32_t GetPollPeriod(); - otError SetPollPeriod(uint32_t); - otShortAddress GetShortAddress(); -#if OPENTHREAD_CONFIG_MAC_FILTER_ENABLE - otMacFilterAddressMode FilterGetAddressMode(); - otError FilterSetAddressMode(otMacFilterAddressMode); - otError FilterAddAddress(const otExtAddress*); - otError FilterRemoveAddress(const otExtAddress*); - void FilterClearAddresses(); - otError FilterGetNextAddress(otMacFilterIterator*, otMacFilterEntry*); - otError FilterAddRssIn(const otExtAddress*, int8_t); - otError FilterRemoveRssIn(const otExtAddress*); - void FilterClearRssIn(); - otError FilterGetNextRssIn(otMacFilterIterator*, otMacFilterEntry*); -#endif - const otMacCounters* GetCounters(); - }; - OTLink Link; - - class OTMessage { - friend class OpenThreadClass; - public: - void GetBufferInfo(otBufferInfo*); - }; - + OTLogging Logging; OTMessage Message; - - class OTNetData { - friend class OpenThreadClass; - public: - otError Get(bool, uint8_t*, uint8_t*); - otError GetNextOnMeshPrefix(otNetworkDataIterator*, otBorderRouterConfig*); - uint8_t GetVersion(); - uint8_t GetStableVersion(); - }; - + OTNcp Ncp; OTNetData NetData; - -#if OPENTHREAD_CONFIG_SERVICE_ENABLE - class OTServer { - friend class OpenThreadClass; - public: - otError GetNetDataLocal(bool, uint8_t*, uint8_t*); - otError AddService(const otServiceConfig*); - otError RemoveService(uint32_t, uint8_t*, uint8_t); - otError GetNextService(otNetworkDataIterator*, otServiceConfig*); - otError Register(); - }; - + OTNetworkTime NetworkTime; + OTPlat Plat; + OTRandomCrypto RandomCrypto; + OTRandomNonCrypto RandomNonCrypto; OTServer Server; -#endif - - class OTThread { - friend class OpenThreadClass; - public: - otError SetEnabled(bool aEnabled); - bool IsSingleton(); - - otError Discover(uint32_t aScanChannels, uint16_t aPanId, bool aJoiner, bool aEnableEui64Filtering, otHandleActiveScanResult aCallback, void* aCallbackContext); - - bool IsDiscoverInProgress(); - uint32_t GetChildTimeout(); - void SetChildTimeout(uint32_t aTimeout); - const otExtendedPanId* GetExtendedPanId(); - otError SetExtendedPanId(const otExtendedPanId *aExtendedPanId); - otError GetLeaderRloc(otIp6Address *aLeaderRloc); - otLinkModeConfig GetLinkMode(); - otError SetLinkMode(otLinkModeConfig aConfig); - const otMasterKey* GetMasterKey(); - otError SetMasterKey(const otMasterKey *aKey); - const otIp6Address* GetMeshLocalEid(); - const otMeshLocalPrefix* GetMeshLocalPrefix(); - otError SetMeshLocalPrefix(const otMeshLocalPrefix *aMeshLocalPrefix); - const char* GetNetworkName(); - otError SetNetworkName(const char *aNetworkName); - uint32_t GetKeySequenceCounter(); - void SetKeySequenceCounter(uint32_t aKeySequenceCounter); - uint32_t GetKeySwitchGuardTime(); - void SetKeySwitchGuardTime(uint32_t aKeySwitchGuardTime); - otError BecomeDetached(); - otError BecomeChild(); - otError GetNextNeighborInfo(otNeighborInfoIterator *aIterator, otNeighborInfo * aInfo); - otDeviceRole GetDeviceRole(); - otError GetLeaderData(otLeaderData *aLeaderData); - uint8_t GetLeaderRouterId(); - uint8_t GetLeaderWeight(); - uint32_t GetPartitionId(); - uint16_t GetRloc16(); - otError GetParentInfo(otRouterInfo *aParentInfo); - otError GetParentAverageRssi(int8_t *aParentRssi); - otError GetParentLastRssi(int8_t *aLastRssi); -// otError SendDiagnosticGet(const otIp6Address *aDestination, const uint8_t aTlvTypes[], uint8_t aCount); -// otError SendDiagnosticReset(const otIp6Address *aDestination, const uint8_t aTlvTypes[], uint8_t aCount); - const otIpCounters* GetIp6Counters(); - - void RegisterParentResponseCallback(otThreadParentResponseCallback aCallback, void* aContext); - - uint8_t GetMaxAllowedChildren(); - otError SetMaxAllowedChildren(uint8_t aMaxChildren); - otError SetPreferredRouterId(uint8_t aRouterId); - uint8_t GetLocalLeaderWeight(); - void SetLocalLeaderWeight(uint8_t aWeight); - uint32_t GetLocalLeaderPartitionId(); - void SetLocalLeaderPartitionId(uint32_t aPartitionId); - uint16_t GetJoinerUdpPort(); - otError SetJoinerUdpPort(uint16_t aJoinerUdpPort); - uint32_t GetContextIdReuseDelay(); - void SetContextIdReuseDelay(uint32_t aDelay); - uint8_t GetNetworkIdTimeout(); - void SetNetworkIdTimeout(uint8_t aTimeout); - uint8_t GetRouterUpgradeThreshold(); - void SetRouterUpgradeThreshold(uint8_t aThreshold); - otError ReleaseRouterId(uint8_t aRouterId); - otError BecomeRouter(); - otError BecomeLeader(); - uint8_t GetRouterDowngradeThreshold(); - void SetRouterDowngradeThreshold(uint8_t aThreshold); - uint8_t GetRouterSelectionJitter(); - void SetRouterSelectionJitter(uint8_t aRouterJitter); -#if OPENTHREAD_FTD - otError GetChildInfoById(uint16_t aChildId, otChildInfo *aChildInfo); - otError GetChildInfoByIndex(uint8_t aChildIndex, otChildInfo *aChildInfo); -#endif - uint8_t GetRouterIdSequence(); - uint8_t GetMaxRouterId(); - otError GetRouterInfo(uint16_t aRouterId, otRouterInfo *aRouterInfo); -#if OPENTHREAD_FTD -// otError GetEidCacheEntry(uint8_t aIndex, otEidCacheEntry *aEntry); -#endif - const otPskc* GetPskc(); - otError SetPskc(const otPskc *aPskc); - int8_t GetParentPriority(); - otError SetParentPriority(int8_t aParentPriority); - }; - + OTSntpClient SntpClient; + OTTasklets Tasklets; OTThread Thread; - + OTUdp Udp; private: - struct discover_data { //struct k_sem sem; otError error; diff --git a/libraries/OpenThread/src/OpenThread_APIs.cpp b/libraries/OpenThread/src/OpenThread_APIs.cpp index db990947f..3324b82d6 100644 --- a/libraries/OpenThread/src/OpenThread_APIs.cpp +++ b/libraries/OpenThread/src/OpenThread_APIs.cpp @@ -1,223 +1,438 @@ -/* - Copyright (c) 2019 Tokita, Hiroshi All right reserved. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - See the GNU Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -*/ - #include "OpenThread.h" #include -//#include -//#include - -#define OTCLS(cls) OT ## cls -#define OT_DECL__FUNC(n, cls, rettype, fn, ...) \ -rettype OpenThreadClass:: OTCLS(cls) :: fn (OT_DECL_ARGS ## n(__VA_ARGS__)) \ -{ \ - rettype ret = OT_CALL_FUNC ## n(cls, fn); \ - return ret; \ -} - -#define OT_DECL_VFUNC(n, cls, rettype, fn, ...) \ -rettype OpenThreadClass:: OTCLS(cls) :: fn (OT_DECL_ARGS ## n(__VA_ARGS__)) \ -{ \ - OT_CALL_FUNC ## n(cls, fn); \ -} - -otError OpenThreadClass::OTInstance::SetStateChangedCallback(otStateChangedCallback cb, void* user) -{ - return otSetStateChangedCallback(otrGetInstance(), cb, user); -} - -void OpenThreadClass::OTInstance::RemoveStateChangeCallback(otStateChangedCallback cb, void* user) -{ - otRemoveStateChangeCallback(otrGetInstance(), cb, user); -} -OT_DECL_VFUNC(0, Instance, void, Reset); -OT_DECL_VFUNC(0, Instance, void, FactoryReset); - -#if OPENTHREAD_CONFIG_BORDER_ROUTER_ENABLE -OT_DECL__FUNC(3, BorderRouter, otError, GetNetData, bool, uint8_t*, uint8_t*) +OT_DECL__FUNC(1, BackboneRouter, otError, GetPrimary, otBackboneRouterConfig*) +OT_DECL__FUNC(0, BackboneRouter, otBackboneRouterState, GetState) +OT_DECL__FUNC(0, BackboneRouter, otError, Register) +OT_DECL__FUNC(0, BackboneRouter, uint8_t, GetRegistrationJitter) +OT_DECL_VFUNC(1, BackboneRouter, void, GetConfig, otBackboneRouterConfig*) +OT_DECL_VFUNC(1, BackboneRouter, void, SetConfig, const otBackboneRouterConfig*) +OT_DECL_VFUNC(1, BackboneRouter, void, SetEnabled, bool) +OT_DECL_VFUNC(1, BackboneRouter, void, SetRegistrationJitter, uint8_t) +OT_DECL__FUNC(0, BorderAgent, otBorderAgentState, GetState) OT_DECL__FUNC(1, BorderRouter, otError, AddOnMeshPrefix, const otBorderRouterConfig*) -OT_DECL__FUNC(1, BorderRouter, otError, RemoveOnMeshPrefix, const otIp6Prefix*) -OT_DECL__FUNC(2, BorderRouter, otError, GetNextOnMeshPrefix, otNetworkDataIterator*, otBorderRouterConfig*) OT_DECL__FUNC(1, BorderRouter, otError, AddRoute, const otExternalRouteConfig*) -OT_DECL__FUNC(1, BorderRouter, otError, RemoveRoute, const otIp6Prefix*) +OT_DECL__FUNC(3, BorderRouter, otError, GetNetData, bool, uint8_t*, uint8_t*) +OT_DECL__FUNC(2, BorderRouter, otError, GetNextOnMeshPrefix, otNetworkDataIterator*, otBorderRouterConfig*) OT_DECL__FUNC(2, BorderRouter, otError, GetNextRoute, otNetworkDataIterator*, otExternalRouteConfig*) OT_DECL__FUNC(0, BorderRouter, otError, Register) -#endif - -#if OPENTHREAD_CONFIG_COMISSIONER_ENABLE -OT_DECL__FUNC(3, Commissioner, otError, Start, otCommissionerStateCallback, otCommissionerJoinerCallback, void*) -OT_DECL__FUNC(0, Commissioner, otError, Stop) +OT_DECL__FUNC(1, BorderRouter, otError, RemoveOnMeshPrefix, const otIp6Prefix*) +OT_DECL__FUNC(1, BorderRouter, otError, RemoveRoute, const otIp6Prefix*) +OT_DECL__FUNC(0, ChannelManager, bool, GetAutoChannelSelectionEnabled) +OT_DECL__FUNC(1, ChannelManager, otError, RequestChannelSelect, bool) +OT_DECL__FUNC(1, ChannelManager, otError, SetAutoChannelSelectionInterval, uint32_t) +OT_DECL__FUNC(1, ChannelManager, otError, SetDelay, uint16_t) +OT_DECL__FUNC(0, ChannelManager, uint16_t, GetDelay) +OT_DECL__FUNC(0, ChannelManager, uint32_t, GetAutoChannelSelectionInterval) +OT_DECL__FUNC(0, ChannelManager, uint32_t, GetFavoredChannels) +OT_DECL__FUNC(0, ChannelManager, uint32_t, GetSupportedChannels) +OT_DECL__FUNC(0, ChannelManager, uint8_t, GetRequestedChannel) +OT_DECL_VFUNC(1, ChannelManager, void, RequestChannelChange, uint8_t) +OT_DECL_VFUNC(1, ChannelManager, void, SetAutoChannelSelectionEnabled, bool) +OT_DECL_VFUNC(1, ChannelManager, void, SetFavoredChannels, uint32_t) +OT_DECL_VFUNC(1, ChannelManager, void, SetSupportedChannels, uint32_t) +OT_DECL__FUNC(0, ChannelMonitor, bool, IsEnabled) +OT_DECL__FUNC(0, ChannelMonitor, int8_t, GetRssiThreshold) +OT_DECL__FUNC(1, ChannelMonitor, otError, SetEnabled, bool) +OT_DECL__FUNC(1, ChannelMonitor, uint16_t, GetChannelOccupancy, uint8_t) +OT_DECL__FUNC(0, ChannelMonitor, uint32_t, GetSampleCount) +OT_DECL__FUNC(0, ChannelMonitor, uint32_t, GetSampleInterval) +OT_DECL__FUNC(0, ChannelMonitor, uint32_t, GetSampleWindow) +OT_DECL__FUNC(0, ChildSupervision, uint16_t, GetCheckTimeout) +OT_DECL__FUNC(0, ChildSupervision, uint16_t, GetInterval) +OT_DECL_VFUNC(1, ChildSupervision, void, SetCheckTimeout, uint16_t) +OT_DECL_VFUNC(1, ChildSupervision, void, SetInterval, uint16_t) +/*OT_DECL__FUNC(1, Cli, AppendResult, void, otError)*/ +OT_DECL_VFUNC(2, Cli, void, ConsoleInit, otCliConsoleOutputCallback, void*) +/*OT_DECL__FUNC(2, Cli, ConsoleInputLine, void, char*, uint16_t)*/ +/*OT_DECL__FUNC(2, Cli, Output, void, const char*, uint16_t)*/ +/*OT_DECL__FUNC(2, Cli, OutputBytes, void, const uint8_t*, uint8_t)*/ +/*OT_DECL__FUNC(2, Cli, OutputFormat, void, const char*, ...)*/ +/*OT_DECL__FUNC(4, Cli, PlatLogv, void, otLogLevel, otLogRegion, const char*, va_list)*/ +/*OT_DECL__FUNC(2, Cli, SetUserCommands, void, const otCliCommand*, uint8_t)*/ +OT_DECL_VFUNC(0, Cli, void, UartInit) +/*OT_DECL__FUNC(1, Coap, MessageCodeToString, const char*, const otMessage*)*/ +/*OT_DECL__FUNC(1, Coap, OptionIteratorGetFirstOption, const otCoapOption*, otCoapOptionIterator*)*/ +/*OT_DECL__FUNC(2, Coap, OptionIteratorGetFirstOptionMatching, const otCoapOption*, otCoapOptionIterator*, uint16_t)*/ +/*OT_DECL__FUNC(1, Coap, OptionIteratorGetNextOption, const otCoapOption*, otCoapOptionIterator*)*/ +/*OT_DECL__FUNC(2, Coap, OptionIteratorGetNextOptionMatching, const otCoapOption*, otCoapOptionIterator*, uint16_t)*/ +/*OT_DECL__FUNC(1, Coap, MessageGetToken, const uint8_t*, const otMessage*)*/ +/*OT_DECL__FUNC(1, Coap, MessageGetCode, otCoapCode, const otMessage*)*/ +/*OT_DECL__FUNC(1, Coap, MessageGetType, otCoapType, const otMessage*)*/ +OT_DECL__FUNC(1, Coap, otError, AddResource, otCoapResource*) +/*OT_DECL__FUNC(4, Coap, MessageAppendBlock1Option, otError, otMessage*, uint32_t, bool, otCoapBlockSize)*/ +/*OT_DECL__FUNC(4, Coap, MessageAppendBlock2Option, otError, otMessage*, uint32_t, bool, otCoapBlockSize)*/ +/*OT_DECL__FUNC(2, Coap, MessageAppendContentFormatOption, otError, otMessage*, otCoapOptionContentFormat)*/ +/*OT_DECL__FUNC(2, Coap, MessageAppendMaxAgeOption, otError, otMessage*, uint32_t)*/ +/*OT_DECL__FUNC(2, Coap, MessageAppendObserveOption, otError, otMessage*, uint32_t)*/ +/*OT_DECL__FUNC(4, Coap, MessageAppendOption, otError, otMessage*, uint16_t, uint16_t, const void*)*/ +/*OT_DECL__FUNC(2, Coap, MessageAppendProxyUriOption, otError, otMessage*, const char*)*/ +/*OT_DECL__FUNC(3, Coap, MessageAppendUintOption, otError, otMessage*, uint16_t, uint32_t)*/ +/*OT_DECL__FUNC(2, Coap, MessageAppendUriPathOptions, otError, otMessage*, const char*)*/ +/*OT_DECL__FUNC(2, Coap, MessageAppendUriQueryOption, otError, otMessage*, const char*)*/ +/*OT_DECL__FUNC(4, Coap, MessageInitResponse, otError, otMessage*, const otMessage*, otCoapType, otCoapCode)*/ +/*OT_DECL__FUNC(1, Coap, MessageSetPayloadMarker, otError, otMessage*)*/ +/*OT_DECL__FUNC(3, Coap, MessageSetToken, otError, otMessage*, const uint8_t*, uint8_t)*/ +/*OT_DECL__FUNC(2, Coap, OptionIteratorGetOptionUintValue, otError, otCoapOptionIterator*, uint64_t*)*/ +/*OT_DECL__FUNC(2, Coap, OptionIteratorGetOptionValue, otError, otCoapOptionIterator*, void*)*/ +/*OT_DECL__FUNC(2, Coap, OptionIteratorInit, otError, otCoapOptionIterator*, const otMessage*)*/ +OT_DECL__FUNC(5, Coap, otError, SendRequestWithParameters, otMessage*, const otMessageInfo*, otCoapResponseHandler, void*, const otCoapTxParameters*) +OT_DECL__FUNC(3, Coap, otError, SendResponseWithParameters, otMessage*, const otMessageInfo*, const otCoapTxParameters*) +OT_DECL__FUNC(1, Coap, otError, Start, uint16_t) +OT_DECL__FUNC(0, Coap, otError, Stop) +OT_DECL__FUNC(1, Coap, otMessage*, NewMessage, const otMessageSettings*) +OT_DECL__FUNC(4, Coap, otError, SendRequest, otMessage*, const otMessageInfo*, otCoapResponseHandler, void*) +OT_DECL__FUNC(2, Coap, otError, SendResponse, otMessage*, const otMessageInfo*) +/*OT_DECL__FUNC(1, Coap, BlockSizeFromExponent, uint16_t, otCoapBlockSize)*/ +/*OT_DECL__FUNC(1, Coap, MessageGetMessageId, uint16_t, const otMessage*)*/ +/*OT_DECL__FUNC(1, Coap, MessageGetTokenLength, uint8_t, const otMessage*)*/ +/*OT_DECL__FUNC(2, Coap, MessageGenerateToken, void, otMessage*, uint8_t)*/ +/*OT_DECL__FUNC(3, Coap, MessageInit, void, otMessage*, otCoapType, otCoapCode)*/ +OT_DECL_VFUNC(1, Coap, void, RemoveResource, otCoapResource*) +OT_DECL_VFUNC(2, Coap, void, SetDefaultHandler, otCoapRequestHandler, void*) +OT_DECL__FUNC(0, CoapSecure, bool, IsConnected) +OT_DECL__FUNC(0, CoapSecure, bool, IsConnectionActive) +OT_DECL__FUNC(1, CoapSecure, otError, AddResource, otCoapResource*) +OT_DECL__FUNC(3, CoapSecure, otError, Connect, const otSockAddr*, otHandleCoapSecureClientConnect, void*) +OT_DECL__FUNC(3, CoapSecure, otError, GetPeerCertificateBase64, unsigned char*, size_t*, size_t) +OT_DECL__FUNC(3, CoapSecure, otError, SendRequest, otMessage*, otCoapResponseHandler, void*) +OT_DECL__FUNC(2, CoapSecure, otError, SendResponse, otMessage*, const otMessageInfo*) +OT_DECL__FUNC(1, CoapSecure, otError, Start, uint16_t) +OT_DECL_VFUNC(0, CoapSecure, void, Disconnect) +OT_DECL_VFUNC(1, CoapSecure, void, RemoveResource, otCoapResource*) +OT_DECL_VFUNC(2, CoapSecure, void, SetCaCertificateChain, const uint8_t*, uint32_t) +OT_DECL_VFUNC(4, CoapSecure, void, SetCertificate, const uint8_t*, uint32_t, const uint8_t*, uint32_t) +OT_DECL_VFUNC(2, CoapSecure, void, SetClientConnectedCallback, otHandleCoapSecureClientConnect, void*) +OT_DECL_VFUNC(2, CoapSecure, void, SetDefaultHandler, otCoapRequestHandler, void*) +OT_DECL_VFUNC(4, CoapSecure, void, SetPsk, const uint8_t*, uint16_t, const uint8_t*, uint16_t) +OT_DECL_VFUNC(1, CoapSecure, void, SetSslAuthMode, bool) +OT_DECL_VFUNC(0, CoapSecure, void, Stop) +OT_DECL__FUNC(0, Commissioner, const char*, GetProvisioningUrl) +OT_DECL__FUNC(0, Commissioner, otCommissionerState, GetState) OT_DECL__FUNC(3, Commissioner, otError, AddJoiner, const otExtAddress*, const char*, uint32_t) -OT_DECL__FUNC(1, Commissioner, otError, RemoveJoiner, const otExtAddress*) -OT_DECL__FUNC(1, Commissioner, otError, SetProvisioningUrl, const char*) OT_DECL__FUNC(4, Commissioner, otError, AnnounceBegin, uint32_t, uint8_t, uint16_t, const otIp6Address*) OT_DECL__FUNC(7, Commissioner, otError, EnergyScan, uint32_t, uint8_t, uint16_t, uint16_t, const otIp6Address*, otCommissionerEnergyReportCallback, void*) +OT_DECL__FUNC(2, Commissioner, otError, GetNextJoinerInfo, uint16_t*, otJoinerInfo*) OT_DECL__FUNC(5, Commissioner, otError, PanIdQuery, uint16_t, uint32_t, const otIp6Address*, otCommissionerPanIdConflictCallback, void*) +OT_DECL__FUNC(1, Commissioner, otError, RemoveJoiner, const otExtAddress*) OT_DECL__FUNC(2, Commissioner, otError, SendMgmtGet, const uint8_t*, uint8_t) OT_DECL__FUNC(3, Commissioner, otError, SendMgmtSet, const otCommissioningDataset*, const uint8_t*, uint8_t) +OT_DECL__FUNC(1, Commissioner, otError, SetProvisioningUrl, const char*) +OT_DECL__FUNC(3, Commissioner, otError, Start, otCommissionerStateCallback, otCommissionerJoinerCallback, void*) +OT_DECL__FUNC(0, Commissioner, otError, Stop) OT_DECL__FUNC(0, Commissioner, uint16_t, GetSessionId) -OT_DECL__FUNC(0, Commissioner, otCommissionerState, GetState) -OT_DECL__FUNC(4, Commissioner, otError, GeneratePskc, const char*, const char*, const otExtendedPanId*, uint8_t*) -#endif - +/*OT_DECL__FUNC(6, Crypto, EcdsaSign, otError, uint8_t*, uint16_t*, const uint8_t*, uint16_t, const uint8_t*, uint16_t)*/ +/*OT_DECL__FUNC(12, Crypto, AesCcm, void, const uint8_t*, uint16_t, uint8_t, const void*, uint8_t, const void*, uint32_t, void*, void*, uint32_t, bool, void*)*/ +/*OT_DECL__FUNC(5, Crypto, HmacSha256, void, const uint8_t*, uint16_t, const uint8_t*, uint16_t, uint8_t*)*/ OT_DECL__FUNC(0, Dataset, bool, IsCommissioned) +/*OT_DECL__FUNC(4, Dataset, GeneratePskc, otError, const char*, const otNetworkName*, const otExtendedPanId*, otPskc*)*/ OT_DECL__FUNC(1, Dataset, otError, GetActive, otOperationalDataset*) -OT_DECL__FUNC(1, Dataset, otError, SetActive, const otOperationalDataset*) OT_DECL__FUNC(1, Dataset, otError, GetPending, otOperationalDataset*) -OT_DECL__FUNC(1, Dataset, otError, SetPending, const otOperationalDataset*) OT_DECL__FUNC(4, Dataset, otError, SendMgmtActiveGet, const otOperationalDatasetComponents*, const uint8_t*, uint8_t, const otIp6Address*) OT_DECL__FUNC(3, Dataset, otError, SendMgmtActiveSet, const otOperationalDataset*, const uint8_t*, uint8_t) OT_DECL__FUNC(4, Dataset, otError, SendMgmtPendingGet, const otOperationalDatasetComponents*, const uint8_t*, uint8_t, const otIp6Address*) OT_DECL__FUNC(3, Dataset, otError, SendMgmtPendingSet, const otOperationalDataset*, const uint8_t*, uint8_t) -OT_DECL__FUNC(0, Dataset, uint32_t, GetDelayTimerMinimal) +OT_DECL__FUNC(1, Dataset, otError, SetActive, const otOperationalDataset*) +OT_DECL__FUNC(1, Dataset, otError, SetPending, const otOperationalDataset*) +OT_DECL__FUNC(1, Dataset, otError, CreateNewNetwork, otOperationalDataset*) OT_DECL__FUNC(1, Dataset, otError, SetDelayTimerMinimal, uint32_t) - -OT_DECL__FUNC(1, Ip6, otError, SetEnabled, bool) +OT_DECL__FUNC(0, Dataset, uint32_t, GetDelayTimerMinimal) +OT_DECL__FUNC(0, Diag, bool, IsEnabled) +OT_DECL__FUNC(4, Diag, otError, ProcessCmd, uint8_t, char**, char*, size_t) +OT_DECL_VFUNC(3, Diag, void, ProcessCmdLine, const char*, char*, size_t) +OT_DECL__FUNC(3, DnsClient, otError, Query, const otDnsQuery*, otDnsResponseHandler, void*) +/*OT_DECL__FUNC(1, Entropy, MbedTlsContextGet, mbedtls_entropy_context*, void)*/ +/*OT_DECL__FUNC(1, Thread, ErrorToString, const char*, otError)*/ +/*OT_DECL__FUNC(1, Heap, Free, void, void*)*/ +/*OT_DECL__FUNC(2, Heap, SetCAllocFree, void, otHeapCAllocFn, otHeapFreeFn)*/ +/*OT_DECL__FUNC(2, Heap, CAlloc, void*, size_t, size_t)*/ +OT_DECL__FUNC(1, Icmp6, otError, RegisterHandler, otIcmp6Handler*) +OT_DECL__FUNC(3, Icmp6, otError, SendEchoRequest, otMessage*, const otMessageInfo*, uint16_t) +OT_DECL__FUNC(0, Icmp6, otIcmp6EchoMode, GetEchoMode) +OT_DECL_VFUNC(1, Icmp6, void, SetEchoMode, otIcmp6EchoMode) +OT_DECL__FUNC(0, Instance, bool, IsInitialized) +OT_DECL__FUNC(0, Instance, otError, ErasePersistentInfo) +/*OT_DECL__FUNC(2, Instance, Init, otInstance*, void*, size_t*)*/ +/*OT_DECL__FUNC(1, Instance, InitSingle, otInstance*, void)*/ +OT_DECL_VFUNC(0, Instance, void, FactoryReset) +OT_DECL_VFUNC(0, Instance, void, Finalize) +OT_DECL_VFUNC(0, Instance, void, Reset) +/*OT_DECL__FUNC(2, Ip6, IsAddressEqual, bool, const otIp6Address*, const otIp6Address*)*/ +/*OT_DECL__FUNC(1, Ip6, IsAddressUnspecified, bool, const otIp6Address*)*/ OT_DECL__FUNC(0, Ip6, bool, IsEnabled) +OT_DECL__FUNC(0, Ip6, bool, IsMulticastPromiscuousEnabled) +OT_DECL__FUNC(0, Ip6, bool, IsReceiveFilterEnabled) +OT_DECL__FUNC(0, Ip6, bool, IsSlaacEnabled) +OT_DECL__FUNC(0, Ip6, const otNetifAddress*, GetUnicastAddresses) +OT_DECL__FUNC(0, Ip6, const otNetifMulticastAddress*, GetMulticastAddresses) +OT_DECL__FUNC(1, Ip6, const uint16_t*, GetUnsecurePorts, uint8_t*) OT_DECL__FUNC(1, Ip6, otError, AddUnicastAddress, const otNetifAddress*) +OT_DECL__FUNC(1, Ip6, otError, AddUnsecurePort, uint16_t) +/*OT_DECL__FUNC(2, Ip6, AddressFromString, otError, const char*, otIp6Address*)*/ OT_DECL__FUNC(1, Ip6, otError, RemoveUnicastAddress, const otIp6Address*) -OT_DECL__FUNC(0, Ip6, const otNetifAddress*, GetUnicastAddresses) - -#if OPENTHREAD_CONFIG_JOINER_ENABLE +OT_DECL__FUNC(1, Ip6, otError, RemoveUnsecurePort, uint16_t) +OT_DECL__FUNC(1, Ip6, otError, SelectSourceAddress, otMessageInfo*) +OT_DECL__FUNC(1, Ip6, otError, Send, otMessage*) +OT_DECL__FUNC(1, Ip6, otError, SetEnabled, bool) +OT_DECL__FUNC(1, Ip6, otError, SubscribeMulticastAddress, const otIp6Address*) +OT_DECL__FUNC(1, Ip6, otError, UnsubscribeMulticastAddress, const otIp6Address*) +OT_DECL__FUNC(1, Ip6, otMessage*, NewMessage, const otMessageSettings*) +OT_DECL__FUNC(3, Ip6, otMessage*, NewMessageFromBuffer, const uint8_t*, uint16_t, const otMessageSettings*) +/*OT_DECL__FUNC(2, Ip6, PrefixMatch, uint8_t, const otIp6Address*, const otIp6Address*)*/ +OT_DECL_VFUNC(0, Ip6, void, RemoveAllUnsecurePorts) +OT_DECL_VFUNC(2, Ip6, void, SetAddressCallback, otIp6AddressCallback, void*) +OT_DECL_VFUNC(1, Ip6, void, SetMulticastPromiscuousEnabled, bool) +OT_DECL_VFUNC(2, Ip6, void, SetReceiveCallback, otIp6ReceiveCallback, void*) +OT_DECL_VFUNC(1, Ip6, void, SetReceiveFilterEnabled, bool) +OT_DECL_VFUNC(1, Ip6, void, SetSlaacEnabled, bool) +OT_DECL_VFUNC(1, Ip6, void, SetSlaacPrefixFilter, otIp6SlaacPrefixFilter) +OT_DECL__FUNC(0, JamDetection, bool, GetState) +OT_DECL__FUNC(0, JamDetection, bool, IsEnabled) +OT_DECL__FUNC(0, JamDetection, int8_t, GetRssiThreshold) +OT_DECL__FUNC(1, JamDetection, otError, SetBusyPeriod, uint8_t) +OT_DECL__FUNC(1, JamDetection, otError, SetRssiThreshold, int8_t) +OT_DECL__FUNC(1, JamDetection, otError, SetWindow, uint8_t) +OT_DECL__FUNC(2, JamDetection, otError, Start, otJamDetectionCallback, void*) +OT_DECL__FUNC(0, JamDetection, otError, Stop) +OT_DECL__FUNC(0, JamDetection, uint64_t, GetHistoryBitmap) +OT_DECL__FUNC(0, JamDetection, uint8_t, GetBusyPeriod) +OT_DECL__FUNC(0, JamDetection, uint8_t, GetWindow) OT_DECL__FUNC(8, Joiner, otError, Start, const char*, const char*, const char*, const char*, const char*, const char*, otJoinerCallback, void*) -OT_DECL_VFUNC(0, Joiner, void, Stop) OT_DECL__FUNC(0, Joiner, otJoinerState, GetState) OT_DECL_VFUNC(1, Joiner, void, GetId, otExtAddress*) -#endif - -OT_DECL__FUNC(4, Link, otError, ActiveScan, uint32_t, uint16_t, otHandleActiveScanResult, void*) +OT_DECL_VFUNC(0, Joiner, void, Stop) OT_DECL__FUNC(0, Link, bool, IsActiveScanInProgress) -OT_DECL__FUNC(4, Link, otError, EnergyScan, uint32_t, uint16_t, otHandleEnergyScanResult, void*) +OT_DECL__FUNC(0, Link, bool, IsEnabled) OT_DECL__FUNC(0, Link, bool, IsEnergyScanInProgress) -OT_DECL__FUNC(0, Link, otError, SendDataRequest) OT_DECL__FUNC(0, Link, bool, IsInTransmitState) +OT_DECL__FUNC(0, Link, bool, IsPromiscuous) +OT_DECL__FUNC(0, Link, const otExtAddress*, GetExtendedAddress) +OT_DECL__FUNC(0, Link, const otMacCounters*, GetCounters) +OT_DECL__FUNC(1, Link, const uint32_t*, GetTxDirectRetrySuccessHistogram, uint8_t*) +OT_DECL__FUNC(1, Link, const uint32_t*, GetTxIndirectRetrySuccessHistogram, uint8_t*) +OT_DECL__FUNC(1, Link, int8_t, ConvertLinkQualityToRss, uint8_t) +OT_DECL__FUNC(4, Link, otError, ActiveScan, uint32_t, uint16_t, otHandleActiveScanResult, void*) +OT_DECL__FUNC(4, Link, otError, EnergyScan, uint32_t, uint16_t, otHandleEnergyScanResult, void*) +OT_DECL__FUNC(1, Link, otError, FilterAddAddress, const otExtAddress*) +OT_DECL__FUNC(2, Link, otError, FilterAddRssIn, const otExtAddress*, int8_t) +OT_DECL__FUNC(2, Link, otError, FilterGetNextAddress, otMacFilterIterator*, otMacFilterEntry*) +OT_DECL__FUNC(2, Link, otError, FilterGetNextRssIn, otMacFilterIterator*, otMacFilterEntry*) +OT_DECL__FUNC(1, Link, otError, FilterRemoveAddress, const otExtAddress*) +OT_DECL__FUNC(1, Link, otError, FilterRemoveRssIn, const otExtAddress*) +OT_DECL__FUNC(1, Link, otError, FilterSetAddressMode, otMacFilterAddressMode) OT_DECL__FUNC(1, Link, otError, OutOfBandTransmitRequest, otRadioFrame*) -OT_DECL__FUNC(0, Link, uint8_t, GetChannel) +OT_DECL__FUNC(0, Link, otError, SendDataRequest) OT_DECL__FUNC(1, Link, otError, SetChannel, uint8_t) -OT_DECL__FUNC(0, Link, const otExtAddress*, GetExtendedAddress) +OT_DECL__FUNC(1, Link, otError, SetEnabled, bool) OT_DECL__FUNC(1, Link, otError, SetExtendedAddress, const otExtAddress*) -OT_DECL_VFUNC(1, Link, void, GetFactoryAssignedIeeeEui64, otExtAddress*) -OT_DECL__FUNC(0, Link, otPanId, GetPanId) OT_DECL__FUNC(1, Link, otError, SetPanId, otPanId) -OT_DECL__FUNC(0, Link, uint32_t, GetPollPeriod) OT_DECL__FUNC(1, Link, otError, SetPollPeriod, uint32_t) -OT_DECL__FUNC(0, Link, otShortAddress, GetShortAddress) -#if OPENTHREAD_CONFIG_MAC_FILTER_ENABLE +OT_DECL__FUNC(1, Link, otError, SetPromiscuous, bool) +OT_DECL__FUNC(1, Link, otError, SetSupportedChannelMask, uint32_t) OT_DECL__FUNC(0, Link, otMacFilterAddressMode, FilterGetAddressMode) -OT_DECL__FUNC(1, Link, otError, FilterSetAddressMode, otMacFilterAddressMode) -OT_DECL__FUNC(1, Link, otError, FilterAddAddress, const otExtAddress*) -OT_DECL__FUNC(1, Link, otError, FilterRemoveAddress, const otExtAddress*) +OT_DECL__FUNC(0, Link, otPanId, GetPanId) +OT_DECL__FUNC(0, Link, otShortAddress, GetShortAddress) +OT_DECL__FUNC(0, Link, uint16_t, GetCcaFailureRate) +OT_DECL__FUNC(0, Link, uint32_t, GetPollPeriod) +OT_DECL__FUNC(0, Link, uint32_t, GetSupportedChannelMask) +OT_DECL__FUNC(1, Link, uint8_t, ConvertRssToLinkQuality, int8_t) +OT_DECL__FUNC(0, Link, uint8_t, GetChannel) +OT_DECL__FUNC(0, Link, uint8_t, GetMaxFrameRetriesDirect) +OT_DECL__FUNC(0, Link, uint8_t, GetMaxFrameRetriesIndirect) OT_DECL_VFUNC(0, Link, void, FilterClearAddresses) -OT_DECL__FUNC(2, Link, otError, FilterGetNextAddress, otMacFilterIterator*, otMacFilterEntry*) -OT_DECL__FUNC(2, Link, otError, FilterAddRssIn, const otExtAddress*, int8_t) -OT_DECL__FUNC(1, Link, otError, FilterRemoveRssIn, const otExtAddress*) OT_DECL_VFUNC(0, Link, void, FilterClearRssIn) -OT_DECL__FUNC(2, Link, otError, FilterGetNextRssIn, otMacFilterIterator*, otMacFilterEntry*) -#endif -OT_DECL__FUNC(0, Link, const otMacCounters*, GetCounters) - +OT_DECL_VFUNC(1, Link, void, GetFactoryAssignedIeeeEui64, otExtAddress*) +OT_DECL_VFUNC(0, Link, void, ResetCounters) +OT_DECL_VFUNC(0, Link, void, ResetTxRetrySuccessHistogram) +OT_DECL_VFUNC(1, Link, void, SetMaxFrameRetriesDirect, uint8_t) +OT_DECL_VFUNC(1, Link, void, SetMaxFrameRetriesIndirect, uint8_t) +OT_DECL_VFUNC(2, Link, void, SetPcapCallback, otLinkPcapCallback, void*) +OT_DECL__FUNC(0, Link, bool, RawGetPromiscuous) +OT_DECL__FUNC(0, Link, bool, RawIsEnabled) +OT_DECL__FUNC(0, Link, int8_t, RawGetRssi) +OT_DECL__FUNC(3, Link, otError, RawEnergyScan, uint8_t, uint16_t, otLinkRawEnergyScanDone) +OT_DECL__FUNC(1, Link, otError, RawReceive, otLinkRawReceiveDone) +OT_DECL__FUNC(1, Link, otError, RawSetEnable, bool) +OT_DECL__FUNC(1, Link, otError, RawSetPromiscuous, bool) +OT_DECL__FUNC(1, Link, otError, RawSetShortAddress, uint16_t) +OT_DECL__FUNC(0, Link, otError, RawSleep) +OT_DECL__FUNC(1, Link, otError, RawSrcMatchAddExtEntry, const otExtAddress*) +OT_DECL__FUNC(1, Link, otError, RawSrcMatchAddShortEntry, uint16_t) +OT_DECL__FUNC(0, Link, otError, RawSrcMatchClearExtEntries) +OT_DECL__FUNC(1, Link, otError, RawSrcMatchClearExtEntry, const otExtAddress*) +OT_DECL__FUNC(0, Link, otError, RawSrcMatchClearShortEntries) +OT_DECL__FUNC(1, Link, otError, RawSrcMatchClearShortEntry, uint16_t) +OT_DECL__FUNC(1, Link, otError, RawSrcMatchEnable, bool) +OT_DECL__FUNC(1, Link, otError, RawTransmit, otLinkRawTransmitDone) +OT_DECL__FUNC(0, Link, otRadioCaps, RawGetCaps) +OT_DECL__FUNC(0, Link, otRadioFrame*, RawGetTransmitBuffer) +/*OT_DECL__FUNC(1, Logging, GetLevel, otLogLevel, void)*/ +/*OT_DECL__FUNC(1, Logging, SetLevel, void, otLogLevel)*/ +/*OT_DECL__FUNC(1, Message, IsLinkSecurityEnabled, bool, const otMessage*)*/ +/*OT_DECL__FUNC(4, Message, Write, int, otMessage*, uint16_t, const void*, uint16_t)*/ +/*OT_DECL__FUNC(1, Message, GetRss, int8_t, const otMessage*)*/ +/*OT_DECL__FUNC(3, Message, Append, otError, otMessage*, const void*, uint16_t)*/ +/*OT_DECL__FUNC(2, Message, QueueDequeue, otError, otMessageQueue*, otMessage*)*/ +/*OT_DECL__FUNC(2, Message, QueueEnqueue, otError, otMessageQueue*, otMessage*)*/ +/*OT_DECL__FUNC(2, Message, QueueEnqueueAtHead, otError, otMessageQueue*, otMessage*)*/ +/*OT_DECL__FUNC(2, Message, SetLength, otError, otMessage*, uint16_t)*/ +/*OT_DECL__FUNC(2, Message, SetOffset, otError, otMessage*, uint16_t)*/ +/*OT_DECL__FUNC(1, Message, QueueGetHead, otMessage*, otMessageQueue*)*/ +/*OT_DECL__FUNC(2, Message, QueueGetNext, otMessage*, otMessageQueue*, const otMessage*)*/ +/*OT_DECL__FUNC(1, Message, GetLength, uint16_t, const otMessage*)*/ +/*OT_DECL__FUNC(1, Message, GetOffset, uint16_t, const otMessage*)*/ +/*OT_DECL__FUNC(4, Message, Read, uint16_t, const otMessage*, uint16_t, void*, uint16_t)*/ +/*OT_DECL__FUNC(1, Message, Free, void, otMessage*)*/ OT_DECL_VFUNC(1, Message, void, GetBufferInfo, otBufferInfo*) - +/*OT_DECL__FUNC(1, Message, QueueInit, void, otMessageQueue*)*/ +/*OT_DECL__FUNC(2, Message, SetDirectTransmission, void, otMessage*, bool)*/ +/*OT_DECL__FUNC(3, Ncp, StreamWrite, otError, int, const uint8_t*, int)*/ +/*OT_DECL__FUNC(1, Ncp, HandleDidReceiveNewLegacyUlaPrefix, void, const uint8_t*)*/ +/*OT_DECL__FUNC(1, Ncp, HandleLegacyNodeDidJoin, void, const otExtAddress*)*/ +OT_DECL_VFUNC(0, Ncp, void, Init) +/*OT_DECL__FUNC(4, Ncp, PlatLogv, void, otLogLevel, otLogRegion, const char*, va_list)*/ +/*OT_DECL__FUNC(1, Ncp, RegisterLegacyHandlers, void, const otNcpLegacyHandlers*)*/ +/*OT_DECL__FUNC(2, Ncp, RegisterPeekPokeDelagates, void, otNcpDelegateAllowPeekPoke, otNcpDelegateAllowPeekPoke)*/ OT_DECL__FUNC(3, NetData, otError, Get, bool, uint8_t*, uint8_t*) OT_DECL__FUNC(2, NetData, otError, GetNextOnMeshPrefix, otNetworkDataIterator*, otBorderRouterConfig*) -OT_DECL__FUNC(0, NetData, uint8_t, GetVersion) +OT_DECL__FUNC(2, NetData, otError, GetNextRoute, otNetworkDataIterator*, otExternalRouteConfig*) +OT_DECL__FUNC(2, NetData, otError, GetNextService, otNetworkDataIterator*, otServiceConfig*) OT_DECL__FUNC(0, NetData, uint8_t, GetStableVersion) - -#if OPENTHREAD_CONFIG_SERVICE_ENABLE -OT_DECL__FUNC(3, Server, otError, GetNetDataLocal, bool, uint8_t*, uint8_t*) +OT_DECL__FUNC(0, NetData, uint8_t, GetVersion) +/*OT_DECL__FUNC(3, Thread, GetNextDiagnosticTlv, otError, const otMessage*, otNetworkDiagIterator*, otNetworkDiagTlv*)*/ +OT_DECL__FUNC(3, Thread, otError, SendDiagnosticGet, const otIp6Address*, const uint8_t*, uint8_t) +OT_DECL__FUNC(3, Thread, otError, SendDiagnosticReset, const otIp6Address*, const uint8_t*, uint8_t) +OT_DECL_VFUNC(2, Thread, void, SetReceiveDiagnosticGetCallback, otReceiveDiagnosticGetCallback, void*) +OT_DECL__FUNC(1, NetworkTime, otError, SetSyncPeriod, uint16_t) +OT_DECL__FUNC(1, NetworkTime, otError, SetXtalThreshold, uint16_t) +OT_DECL__FUNC(1, NetworkTime, otNetworkTimeStatus, Get, uint64_t*) +OT_DECL__FUNC(0, NetworkTime, uint16_t, GetSyncPeriod) +OT_DECL__FUNC(0, NetworkTime, uint16_t, GetXtalThreshold) +OT_DECL_VFUNC(2, NetworkTime, void, SyncSetCallback, otNetworkTimeSyncCallbackFn, void*) +/*OT_DECL__FUNC(1, Plat, DiagModeGet, bool, void)*/ +OT_DECL__FUNC(4, Plat, otError, DiagProcess, uint8_t, char**, char*, size_t) +OT_DECL_VFUNC(0, Plat, void, DiagAlarmCallback) +/*OT_DECL__FUNC(1, Plat, DiagChannelSet, void, uint8_t)*/ +/*OT_DECL__FUNC(1, Plat, DiagModeSet, void, bool)*/ +OT_DECL_VFUNC(2, Plat, void, DiagRadioReceived, otRadioFrame*, otError) +/*OT_DECL__FUNC(1, Plat, DiagTxPowerSet, void, int8_t)*/ +/*OT_DECL__FUNC(2, Plat, EntropyGet, otError, uint8_t*, uint16_t)*/ +/*OT_DECL__FUNC(4, Plat, Log, void, otLogLevel, otLogRegion, const char*, ...)*/ +/*OT_DECL__FUNC(1, Plat, UdpBind, otError, otUdpSocket*)*/ +/*OT_DECL__FUNC(1, Plat, UdpClose, otError, otUdpSocket*)*/ +/*OT_DECL__FUNC(1, Plat, UdpConnect, otError, otUdpSocket*)*/ +/*OT_DECL__FUNC(3, Plat, UdpSend, otError, otUdpSocket*, otMessage*, const otMessageInfo*)*/ +/*OT_DECL__FUNC(1, Plat, UdpSocket, otError, otUdpSocket*)*/ +/*OT_DECL__FUNC(1, RandomCrypto, MbedTlsContextGet, mbedtls_ctr_drbg_context*, void)*/ +/*OT_DECL__FUNC(2, RandomCrypto, FillBuffer, otError, uint8_t*, uint16_t)*/ +/*OT_DECL__FUNC(1, RandomNonCrypto, GetUint16, uint16_t, void)*/ +/*OT_DECL__FUNC(2, RandomNonCrypto, GetUint16InRange, uint16_t, uint16_t, uint16_t)*/ +/*OT_DECL__FUNC(2, RandomNonCrypto, AddJitter, uint32_t, uint32_t, uint16_t)*/ +/*OT_DECL__FUNC(1, RandomNonCrypto, GetUint32, uint32_t, void)*/ +/*OT_DECL__FUNC(2, RandomNonCrypto, GetUint32InRange, uint32_t, uint32_t, uint32_t)*/ +/*OT_DECL__FUNC(1, RandomNonCrypto, GetUint8, uint8_t, void)*/ +/*OT_DECL__FUNC(2, RandomNonCrypto, GetUint8InRange, uint8_t, uint8_t, uint8_t)*/ +/*OT_DECL__FUNC(2, RandomNonCrypto, FillBuffer, void, uint8_t*, uint16_t)*/ OT_DECL__FUNC(1, Server, otError, AddService, const otServiceConfig*) -OT_DECL__FUNC(3, Server, otError, RemoveService, uint32_t, uint8_t*, uint8_t) +OT_DECL__FUNC(3, Server, otError, GetNetDataLocal, bool, uint8_t*, uint8_t*) OT_DECL__FUNC(2, Server, otError, GetNextService, otNetworkDataIterator*, otServiceConfig*) OT_DECL__FUNC(0, Server, otError, Register) -#endif - -OT_DECL__FUNC(1, Thread, otError, SetEnabled, bool) -OT_DECL__FUNC(0, Thread, bool, IsSingleton) -OT_DECL__FUNC(6, Thread, otError, Discover, uint32_t, uint16_t, bool, bool, otHandleActiveScanResult, void*) +OT_DECL__FUNC(3, Server, otError, RemoveService, uint32_t, const uint8_t*, uint8_t) +OT_DECL__FUNC(3, SntpClient, otError, Query, const otSntpQuery*, otSntpResponseHandler, void*) +OT_DECL_VFUNC(1, SntpClient, void, SetUnixEra, uint32_t) +OT_DECL__FUNC(0, Tasklets, bool, ArePending) +OT_DECL_VFUNC(0, Tasklets, void, Process) +OT_DECL_VFUNC(0, Tasklets, void, SignalPending) OT_DECL__FUNC(0, Thread, bool, IsDiscoverInProgress) -OT_DECL__FUNC(0, Thread, uint32_t, GetChildTimeout) -OT_DECL_VFUNC(1, Thread, void, SetChildTimeout, uint32_t) +OT_DECL__FUNC(0, Thread, bool, IsSingleton) +OT_DECL__FUNC(0, Thread, const char*, GetNetworkName) OT_DECL__FUNC(0, Thread, const otExtendedPanId*, GetExtendedPanId) -OT_DECL__FUNC(1, Thread, otError, SetExtendedPanId, const otExtendedPanId*) +OT_DECL__FUNC(0, Thread, const otIp6Address*, GetLinkLocalIp6Address) +OT_DECL__FUNC(0, Thread, const otIp6Address*, GetMeshLocalEid) +OT_DECL__FUNC(0, Thread, const otIp6Address*, GetRloc) +OT_DECL__FUNC(0, Thread, const otIpCounters*, GetIp6Counters) +OT_DECL__FUNC(0, Thread, const otMasterKey*, GetMasterKey) +OT_DECL__FUNC(0, Thread, const otMeshLocalPrefix*, GetMeshLocalPrefix) +OT_DECL__FUNC(0, Thread, const otMleCounters*, GetMleCounters) +OT_DECL__FUNC(0, Thread, otDeviceRole, GetDeviceRole) +OT_DECL__FUNC(0, Thread, otError, BecomeChild) +OT_DECL__FUNC(0, Thread, otError, BecomeDetached) +OT_DECL__FUNC(6, Thread, otError, Discover, uint32_t, uint16_t, bool, bool, otHandleActiveScanResult, void*) +OT_DECL__FUNC(1, Thread, otError, GetLeaderData, otLeaderData*) OT_DECL__FUNC(1, Thread, otError, GetLeaderRloc, otIp6Address*) -OT_DECL__FUNC(0, Thread, otLinkModeConfig, GetLinkMode) +OT_DECL__FUNC(2, Thread, otError, GetNextNeighborInfo, otNeighborInfoIterator*, otNeighborInfo*) +OT_DECL__FUNC(1, Thread, otError, GetParentAverageRssi, int8_t*) +OT_DECL__FUNC(1, Thread, otError, GetParentInfo, otRouterInfo*) +OT_DECL__FUNC(1, Thread, otError, GetParentLastRssi, int8_t*) +OT_DECL__FUNC(1, Thread, otError, SetEnabled, bool) +OT_DECL__FUNC(1, Thread, otError, SetExtendedPanId, const otExtendedPanId*) OT_DECL__FUNC(1, Thread, otError, SetLinkMode, otLinkModeConfig) -OT_DECL__FUNC(0, Thread, const otMasterKey*, GetMasterKey) OT_DECL__FUNC(1, Thread, otError, SetMasterKey, const otMasterKey*) -OT_DECL__FUNC(0, Thread, const otIp6Address*, GetMeshLocalEid) -OT_DECL__FUNC(0, Thread, const otMeshLocalPrefix*, GetMeshLocalPrefix) OT_DECL__FUNC(1, Thread, otError, SetMeshLocalPrefix, const otMeshLocalPrefix*) -OT_DECL__FUNC(0, Thread, const char*, GetNetworkName) OT_DECL__FUNC(1, Thread, otError, SetNetworkName, const char*) +OT_DECL__FUNC(0, Thread, otLinkModeConfig, GetLinkMode) +OT_DECL__FUNC(0, Thread, uint16_t, GetRloc16) +/*OT_DECL__FUNC(1, Thread, GetVersion, uint16_t, void)*/ +OT_DECL__FUNC(0, Thread, uint32_t, GetChildTimeout) OT_DECL__FUNC(0, Thread, uint32_t, GetKeySequenceCounter) -OT_DECL_VFUNC(1, Thread, void, SetKeySequenceCounter, uint32_t) OT_DECL__FUNC(0, Thread, uint32_t, GetKeySwitchGuardTime) -OT_DECL_VFUNC(1, Thread, void, SetKeySwitchGuardTime, uint32_t) -OT_DECL__FUNC(0, Thread, otError, BecomeDetached) -OT_DECL__FUNC(0, Thread, otError, BecomeChild) -OT_DECL__FUNC(2, Thread, otError, GetNextNeighborInfo, otNeighborInfoIterator*, otNeighborInfo*) -OT_DECL__FUNC(0, Thread, otDeviceRole, GetDeviceRole) -OT_DECL__FUNC(1, Thread, otError, GetLeaderData, otLeaderData*) +OT_DECL__FUNC(0, Thread, uint32_t, GetPartitionId) OT_DECL__FUNC(0, Thread, uint8_t, GetLeaderRouterId) OT_DECL__FUNC(0, Thread, uint8_t, GetLeaderWeight) -OT_DECL__FUNC(0, Thread, uint32_t, GetPartitionId) -OT_DECL__FUNC(0, Thread, uint16_t, GetRloc16) -OT_DECL__FUNC(1, Thread, otError, GetParentInfo, otRouterInfo*) -OT_DECL__FUNC(1, Thread, otError, GetParentAverageRssi, int8_t*) -OT_DECL__FUNC(1, Thread, otError, GetParentLastRssi, int8_t*) -//OT_DECL__FUNC(3, Thread, otError, SendDiagnosticGet, const otIp6Address*, const uint8_t*, uint8_t) -//OT_DECL__FUNC(3, Thread, otError, SendDiagnosticReset, const otIp6Address*, const uint8_t*, uint8_t) -OT_DECL__FUNC(0, Thread, const otIpCounters*, GetIp6Counters) OT_DECL_VFUNC(2, Thread, void, RegisterParentResponseCallback, otThreadParentResponseCallback, void*) -OT_DECL__FUNC(0, Thread, uint8_t, GetMaxAllowedChildren) -OT_DECL__FUNC(1, Thread, otError, SetMaxAllowedChildren, uint8_t) +OT_DECL_VFUNC(0, Thread, void, ResetIp6Counters) +OT_DECL_VFUNC(0, Thread, void, ResetMleCounters) +OT_DECL_VFUNC(1, Thread, void, SetChildTimeout, uint32_t) +OT_DECL_VFUNC(1, Thread, void, SetKeySequenceCounter, uint32_t) +OT_DECL_VFUNC(1, Thread, void, SetKeySwitchGuardTime, uint32_t) +OT_DECL__FUNC(0, Thread, bool, IsRouterEligible) +OT_DECL__FUNC(0, Thread, const otPskc*, GetPskc) +OT_DECL__FUNC(0, Thread, int8_t, GetParentPriority) +OT_DECL__FUNC(0, Thread, otError, BecomeLeader) +OT_DECL__FUNC(0, Thread, otError, BecomeRouter) +OT_DECL__FUNC(2, Thread, otError, GetChildInfoById, uint16_t, otChildInfo*) +OT_DECL__FUNC(2, Thread, otError, GetChildInfoByIndex, uint16_t, otChildInfo*) +OT_DECL__FUNC(3, Thread, otError, GetChildNextIp6Address, uint16_t, otChildIp6AddressIterator*, otIp6Address*) +OT_DECL__FUNC(2, Thread, otError, GetNextCacheEntry, otCacheEntryInfo*, otCacheEntryIterator*) +OT_DECL__FUNC(2, Thread, otError, GetRouterInfo, uint16_t, otRouterInfo*) +OT_DECL__FUNC(1, Thread, otError, ReleaseRouterId, uint8_t) +OT_DECL__FUNC(1, Thread, otError, SetJoinerUdpPort, uint16_t) +OT_DECL__FUNC(1, Thread, otError, SetMaxAllowedChildren, uint16_t) +OT_DECL__FUNC(1, Thread, otError, SetMaxChildIpAddresses, uint8_t) +OT_DECL__FUNC(1, Thread, otError, SetParentPriority, int8_t) OT_DECL__FUNC(1, Thread, otError, SetPreferredRouterId, uint8_t) -OT_DECL__FUNC(0, Thread, uint8_t, GetLocalLeaderWeight) -OT_DECL_VFUNC(1, Thread, void, SetLocalLeaderWeight, uint8_t) -OT_DECL__FUNC(0, Thread, uint32_t, GetLocalLeaderPartitionId) -OT_DECL_VFUNC(1, Thread, void, SetLocalLeaderPartitionId, uint32_t) +OT_DECL__FUNC(1, Thread, otError, SetPskc, const otPskc*) +OT_DECL__FUNC(1, Thread, otError, SetRouterEligible, bool) OT_DECL__FUNC(0, Thread, uint16_t, GetJoinerUdpPort) -OT_DECL__FUNC(1, Thread, otError, SetJoinerUdpPort, uint16_t) +OT_DECL__FUNC(0, Thread, uint16_t, GetMaxAllowedChildren) OT_DECL__FUNC(0, Thread, uint32_t, GetContextIdReuseDelay) -OT_DECL_VFUNC(1, Thread, void, SetContextIdReuseDelay, uint32_t) +OT_DECL__FUNC(0, Thread, uint32_t, GetLocalLeaderPartitionId) +OT_DECL__FUNC(0, Thread, uint8_t, GetLocalLeaderWeight) +OT_DECL__FUNC(0, Thread, uint8_t, GetMaxChildIpAddresses) +OT_DECL__FUNC(0, Thread, uint8_t, GetMaxRouterId) OT_DECL__FUNC(0, Thread, uint8_t, GetNetworkIdTimeout) -OT_DECL_VFUNC(1, Thread, void, SetNetworkIdTimeout, uint8_t) -OT_DECL__FUNC(0, Thread, uint8_t, GetRouterUpgradeThreshold) -OT_DECL_VFUNC(1, Thread, void, SetRouterUpgradeThreshold, uint8_t) -OT_DECL__FUNC(1, Thread, otError, ReleaseRouterId, uint8_t) -OT_DECL__FUNC(0, Thread, otError, BecomeRouter) -OT_DECL__FUNC(0, Thread, otError, BecomeLeader) OT_DECL__FUNC(0, Thread, uint8_t, GetRouterDowngradeThreshold) -OT_DECL_VFUNC(1, Thread, void, SetRouterDowngradeThreshold, uint8_t) +OT_DECL__FUNC(0, Thread, uint8_t, GetRouterIdSequence) OT_DECL__FUNC(0, Thread, uint8_t, GetRouterSelectionJitter) +OT_DECL__FUNC(0, Thread, uint8_t, GetRouterUpgradeThreshold) +OT_DECL_VFUNC(1, Thread, void, RegisterNeighborTableCallback, otNeighborTableCallback) +OT_DECL_VFUNC(1, Thread, void, SetContextIdReuseDelay, uint32_t) +OT_DECL_VFUNC(1, Thread, void, SetLocalLeaderPartitionId, uint32_t) +OT_DECL_VFUNC(1, Thread, void, SetLocalLeaderWeight, uint8_t) +OT_DECL_VFUNC(1, Thread, void, SetNetworkIdTimeout, uint8_t) +OT_DECL_VFUNC(1, Thread, void, SetRouterDowngradeThreshold, uint8_t) OT_DECL_VFUNC(1, Thread, void, SetRouterSelectionJitter, uint8_t) -#if OPENTHREAD_FTD -OT_DECL__FUNC(2, Thread, otError, GetChildInfoById, uint16_t, otChildInfo*) -OT_DECL__FUNC(2, Thread, otError, GetChildInfoByIndex, uint8_t, otChildInfo*) -#endif -OT_DECL__FUNC(0, Thread, uint8_t, GetRouterIdSequence) -OT_DECL__FUNC(0, Thread, uint8_t, GetMaxRouterId) -OT_DECL__FUNC(2, Thread, otError, GetRouterInfo, uint16_t, otRouterInfo*) -#if OPENTHREAD_FTD -//OT_DECL__FUNC(2, Thread, otError, GetEidCacheEntry, uint8_t, otEidCacheEntry*) -#endif -OT_DECL__FUNC(0, Thread, const otPskc*, GetPskc) -OT_DECL__FUNC(1, Thread, otError, SetPskc, const otPskc*) -OT_DECL__FUNC(0, Thread, int8_t, GetParentPriority) -OT_DECL__FUNC(1, Thread, otError, SetParentPriority, int8_t) - +OT_DECL_VFUNC(1, Thread, void, SetRouterUpgradeThreshold, uint8_t) +OT_DECL_VFUNC(1, Thread, void, SetSteeringData, const otExtAddress*) +OT_DECL__FUNC(1, Udp, otError, AddReceiver, otUdpReceiver*) +/*OT_DECL__FUNC(2, Udp, Bind, otError, otUdpSocket*, otSockAddr*)*/ +/*OT_DECL__FUNC(1, Udp, Close, otError, otUdpSocket*)*/ +/*OT_DECL__FUNC(2, Udp, Connect, otError, otUdpSocket*, otSockAddr*)*/ +OT_DECL__FUNC(3, Udp, otError, Open, otUdpSocket*, otUdpReceive, void*) +OT_DECL__FUNC(1, Udp, otError, RemoveReceiver, otUdpReceiver*) +/*OT_DECL__FUNC(3, Udp, Send, otError, otUdpSocket*, otMessage*, const otMessageInfo*)*/ +OT_DECL__FUNC(2, Udp, otError, SendDatagram, otMessage*, otMessageInfo*) +OT_DECL__FUNC(1, Udp, otMessage*, NewMessage, const otMessageSettings*) +OT_DECL__FUNC(0, Udp, otUdpSocket*, GetSockets) +OT_DECL_VFUNC(4, Udp, void, ForwardReceive, otMessage*, uint16_t, const otIp6Address*, uint16_t) +OT_DECL_VFUNC(2, Udp, void, ForwardSetForwarder, otUdpForwarder, void*) diff --git a/libraries/OpenThread/src/OpenThread_APIs.inc b/libraries/OpenThread/src/OpenThread_APIs.inc new file mode 100644 index 000000000..e5a4b7006 --- /dev/null +++ b/libraries/OpenThread/src/OpenThread_APIs.inc @@ -0,0 +1,620 @@ + class OTBackboneRouter { + friend class OpenThreadClass; + public: + otError GetPrimary(otBackboneRouterConfig* aConfig); + otBackboneRouterState GetState(); + otError Register(); + uint8_t GetRegistrationJitter(); + void GetConfig(otBackboneRouterConfig* aConfig); + void SetConfig(const otBackboneRouterConfig* aConfig); + void SetEnabled(bool aEnable); + void SetRegistrationJitter(uint8_t aJitter); + }; + + class OTBorderAgent { + friend class OpenThreadClass; + public: + otBorderAgentState GetState(); + }; + + class OTBorderRouter { + friend class OpenThreadClass; + public: + otError AddOnMeshPrefix(const otBorderRouterConfig* aConfig); + otError AddRoute(const otExternalRouteConfig* aConfig); + otError GetNetData(bool aStable, uint8_t* aData, uint8_t* aDataLength); + otError GetNextOnMeshPrefix(otNetworkDataIterator* aIterator, otBorderRouterConfig* aConfig); + otError GetNextRoute(otNetworkDataIterator* aIterator, otExternalRouteConfig* aConfig); + otError Register(); + otError RemoveOnMeshPrefix(const otIp6Prefix* aPrefix); + otError RemoveRoute(const otIp6Prefix* aPrefix); + }; + + class OTChannelManager { + friend class OpenThreadClass; + public: + bool GetAutoChannelSelectionEnabled(); + otError RequestChannelSelect(bool aSkipQualityCheck); + otError SetAutoChannelSelectionInterval(uint32_t aInterval); + otError SetDelay(uint16_t aDelay); + uint16_t GetDelay(); + uint32_t GetAutoChannelSelectionInterval(); + uint32_t GetFavoredChannels(); + uint32_t GetSupportedChannels(); + uint8_t GetRequestedChannel(); + void RequestChannelChange(uint8_t aChannel); + void SetAutoChannelSelectionEnabled(bool aEnabled); + void SetFavoredChannels(uint32_t aChannelMask); + void SetSupportedChannels(uint32_t aChannelMask); + }; + + class OTChannelMonitor { + friend class OpenThreadClass; + public: + bool IsEnabled(); + int8_t GetRssiThreshold(); + otError SetEnabled(bool aEnabled); + uint16_t GetChannelOccupancy(uint8_t aChannel); + uint32_t GetSampleCount(); + uint32_t GetSampleInterval(); + uint32_t GetSampleWindow(); + }; + + class OTChildSupervision { + friend class OpenThreadClass; + public: + uint16_t GetCheckTimeout(); + uint16_t GetInterval(); + void SetCheckTimeout(uint16_t aTimeout); + void SetInterval(uint16_t aInterval); + }; + + class OTCli { + friend class OpenThreadClass; + public: + //void Cli::AppendResult(otError aError); + void ConsoleInit(otCliConsoleOutputCallback aCallback, void* aContext); + //void Cli::ConsoleInputLine(char* aBuf, uint16_t aBufLength); + //void Cli::Output(const char* aString, uint16_t aLength); + //void Cli::OutputBytes(const uint8_t* aBytes, uint8_t aLength); + //void Cli::OutputFormat(const char* aFmt,...); + //void Cli::PlatLogv(otLogLevel aLogLevel, otLogRegion aLogRegion, const char* aFormat, va_list aArgs); + //void Cli::SetUserCommands(const otCliCommand* aUserCommands, uint8_t aLength); + void UartInit(); + }; + + class OTCoap { + friend class OpenThreadClass; + public: + //const char* Coap::MessageCodeToString(const otMessage* aMessage); + //const otCoapOption* Coap::OptionIteratorGetFirstOption(otCoapOptionIterator* aIterator); + //const otCoapOption* Coap::OptionIteratorGetFirstOptionMatching(otCoapOptionIterator* aIterator, uint16_t aOption); + //const otCoapOption* Coap::OptionIteratorGetNextOption(otCoapOptionIterator* aIterator); + //const otCoapOption* Coap::OptionIteratorGetNextOptionMatching(otCoapOptionIterator* aIterator, uint16_t aOption); + //const uint8_t* Coap::MessageGetToken(const otMessage* aMessage); + //otCoapCode Coap::MessageGetCode(const otMessage* aMessage); + //otCoapType Coap::MessageGetType(const otMessage* aMessage); + otError AddResource(otCoapResource* aResource); + //otError Coap::MessageAppendBlock1Option(otMessage* aMessage, uint32_t aNum, bool aMore, otCoapBlockSize aSize); + //otError Coap::MessageAppendBlock2Option(otMessage* aMessage, uint32_t aNum, bool aMore, otCoapBlockSize aSize); + //otError Coap::MessageAppendContentFormatOption(otMessage* aMessage, otCoapOptionContentFormat aContentFormat); + //otError Coap::MessageAppendMaxAgeOption(otMessage* aMessage, uint32_t aMaxAge); + //otError Coap::MessageAppendObserveOption(otMessage* aMessage, uint32_t aObserve); + //otError Coap::MessageAppendOption(otMessage* aMessage, uint16_t aNumber, uint16_t aLength, const void* aValue); + //otError Coap::MessageAppendProxyUriOption(otMessage* aMessage, const char* aUriPath); + //otError Coap::MessageAppendUintOption(otMessage* aMessage, uint16_t aNumber, uint32_t aValue); + //otError Coap::MessageAppendUriPathOptions(otMessage* aMessage, const char* aUriPath); + //otError Coap::MessageAppendUriQueryOption(otMessage* aMessage, const char* aUriQuery); + //otError Coap::MessageInitResponse(otMessage* aResponse, const otMessage* aRequest, otCoapType aType, otCoapCode aCode); + //otError Coap::MessageSetPayloadMarker(otMessage* aMessage); + //otError Coap::MessageSetToken(otMessage* aMessage, const uint8_t* aToken, uint8_t aTokenLength); + //otError Coap::OptionIteratorGetOptionUintValue(otCoapOptionIterator* aIterator, uint64_t* const aValue); + //otError Coap::OptionIteratorGetOptionValue(otCoapOptionIterator* aIterator, void* aValue); + //otError Coap::OptionIteratorInit(otCoapOptionIterator* aIterator, const otMessage* aMessage); + otError SendRequestWithParameters(otMessage* aMessage, const otMessageInfo* aMessageInfo, otCoapResponseHandler aHandler, void* aContext, const otCoapTxParameters* aTxParameters); + otError SendResponseWithParameters(otMessage* aMessage, const otMessageInfo* aMessageInfo, const otCoapTxParameters* aTxParameters); + otError Start(uint16_t aPort); + otError Stop(); + otMessage* NewMessage(const otMessageSettings* aSettings); + static otError SendRequest(otMessage* aMessage, const otMessageInfo* aMessageInfo, otCoapResponseHandler aHandler, void* aContext); + static otError SendResponse(otMessage* aMessage, const otMessageInfo* aMessageInfo); + //uint16_t Coap::BlockSizeFromExponent(otCoapBlockSize aSize); + //uint16_t Coap::MessageGetMessageId(const otMessage* aMessage); + //uint8_t Coap::MessageGetTokenLength(const otMessage* aMessage); + //void Coap::MessageGenerateToken(otMessage* aMessage, uint8_t aTokenLength); + //void Coap::MessageInit(otMessage* aMessage, otCoapType aType, otCoapCode aCode); + void RemoveResource(otCoapResource* aResource); + void SetDefaultHandler(otCoapRequestHandler aHandler, void* aContext); + }; + + class OTCoapSecure { + friend class OpenThreadClass; + public: + bool IsConnected(); + bool IsConnectionActive(); + otError AddResource(otCoapResource* aResource); + otError Connect(const otSockAddr* aSockAddr, otHandleCoapSecureClientConnect aHandler, void* aContext); + otError GetPeerCertificateBase64(unsigned char* aPeerCert, size_t* aCertLength, size_t aCertBufferSize); + otError SendRequest(otMessage* aMessage, otCoapResponseHandler aHandler, void* aContext); + otError SendResponse(otMessage* aMessage, const otMessageInfo* aMessageInfo); + otError Start(uint16_t aPort); + void Disconnect(); + void RemoveResource(otCoapResource* aResource); + void SetCaCertificateChain(const uint8_t* aX509CaCertificateChain, uint32_t aX509CaCertChainLength); + void SetCertificate(const uint8_t* aX509Cert, uint32_t aX509Length, const uint8_t* aPrivateKey, uint32_t aPrivateKeyLength); + void SetClientConnectedCallback(otHandleCoapSecureClientConnect aHandler, void* aContext); + void SetDefaultHandler(otCoapRequestHandler aHandler, void* aContext); + void SetPsk(const uint8_t* aPsk, uint16_t aPskLength, const uint8_t* aPskIdentity, uint16_t aPskIdLength); + void SetSslAuthMode(bool aVerifyPeerCertificate); + void Stop(); + }; + + class OTCommissioner { + friend class OpenThreadClass; + public: + const char* GetProvisioningUrl(); + otCommissionerState GetState(); + otError AddJoiner(const otExtAddress* aEui64, const char* aPskd, uint32_t aTimeout); + otError AnnounceBegin(uint32_t aChannelMask, uint8_t aCount, uint16_t aPeriod, const otIp6Address* aAddress); + otError EnergyScan(uint32_t aChannelMask, uint8_t aCount, uint16_t aPeriod, uint16_t aScanDuration, const otIp6Address* aAddress, otCommissionerEnergyReportCallback aCallback, void* aContext); + otError GetNextJoinerInfo(uint16_t* aIterator, otJoinerInfo* aJoiner); + otError PanIdQuery(uint16_t aPanId, uint32_t aChannelMask, const otIp6Address* aAddress, otCommissionerPanIdConflictCallback aCallback, void* aContext); + otError RemoveJoiner(const otExtAddress* aEui64); + otError SendMgmtGet(const uint8_t* aTlvs, uint8_t aLength); + otError SendMgmtSet(const otCommissioningDataset* aDataset, const uint8_t* aTlvs, uint8_t aLength); + otError SetProvisioningUrl(const char* aProvisioningUrl); + otError Start(otCommissionerStateCallback aStateCallback, otCommissionerJoinerCallback aJoinerCallback, void* aCallbackContext); + otError Stop(); + uint16_t GetSessionId(); + }; + + class OTCrypto { + friend class OpenThreadClass; + public: + //otError Crypto::EcdsaSign(uint8_t* aOutput, uint16_t* aOutputLength, const uint8_t* aInputHash, uint16_t aInputHashLength, const uint8_t* aPrivateKey, uint16_t aPrivateKeyLength); + //void Crypto::AesCcm(const uint8_t* aKey, uint16_t aKeyLength, uint8_t aTagLength, const void* aNonce, uint8_t aNonceLength, const void* aHeader, uint32_t aHeaderLength, void* aPlainText, void* aCipherText, uint32_t aLength, bool aEncrypt, void* aTag); + //void Crypto::HmacSha256(const uint8_t* aKey, uint16_t aKeyLength, const uint8_t* aBuf, uint16_t aBufLength, uint8_t* aHash); + //mbedtls_ctr_drbg_context* RandomCrypto::MbedTlsContextGet(void); + //otError RandomCrypto::FillBuffer(uint8_t* aBuffer, uint16_t aSize); + //uint16_t RandomNonCrypto::GetUint16(void); + //uint16_t RandomNonCrypto::GetUint16InRange(uint16_t aMin, uint16_t aMax); + //uint32_t RandomNonCrypto::AddJitter(uint32_t aValue, uint16_t aJitter); + //uint32_t RandomNonCrypto::GetUint32(void); + //uint32_t RandomNonCrypto::GetUint32InRange(uint32_t aMin, uint32_t aMax); + //uint8_t RandomNonCrypto::GetUint8(void); + //uint8_t RandomNonCrypto::GetUint8InRange(uint8_t aMin, uint8_t aMax); + //void RandomNonCrypto::FillBuffer(uint8_t* aBuffer, uint16_t aSize); + }; + + class OTDataset { + friend class OpenThreadClass; + public: + bool IsCommissioned(); + //otError Dataset::GeneratePskc(const char* aPassPhrase, const otNetworkName* aNetworkName, const otExtendedPanId* aExtPanId, otPskc* aPskc); + otError GetActive(otOperationalDataset* aDataset); + otError GetPending(otOperationalDataset* aDataset); + otError SendMgmtActiveGet(const otOperationalDatasetComponents* aDatasetComponents, const uint8_t* aTlvTypes, uint8_t aLength, const otIp6Address* aAddress); + otError SendMgmtActiveSet(const otOperationalDataset* aDataset, const uint8_t* aTlvs, uint8_t aLength); + otError SendMgmtPendingGet(const otOperationalDatasetComponents* aDatasetComponents, const uint8_t* aTlvTypes, uint8_t aLength, const otIp6Address* aAddress); + otError SendMgmtPendingSet(const otOperationalDataset* aDataset, const uint8_t* aTlvs, uint8_t aLength); + otError SetActive(const otOperationalDataset* aDataset); + otError SetPending(const otOperationalDataset* aDataset); + otError CreateNewNetwork(otOperationalDataset* aDataset); + otError SetDelayTimerMinimal(uint32_t aDelayTimerMinimal); + uint32_t GetDelayTimerMinimal(); + }; + + class OTDiag { + friend class OpenThreadClass; + public: + bool IsEnabled(); + otError ProcessCmd(uint8_t aArgsLength, char* aArgs[], char* aOutput, size_t aOutputMaxLen); + void ProcessCmdLine(const char* aString, char* aOutput, size_t aOutputMaxLen); + }; + + class OTDnsClient { + friend class OpenThreadClass; + public: + otError Query(const otDnsQuery* aQuery, otDnsResponseHandler aHandler, void* aContext); + }; + + class OTEntropy { + friend class OpenThreadClass; + public: + //mbedtls_entropy_context* Entropy::MbedTlsContextGet(void); + }; + + class OTHeap { + friend class OpenThreadClass; + public: + //void Heap::Free(void* aPointer); + //void Heap::SetCAllocFree(otHeapCAllocFn aCAlloc, otHeapFreeFn aFree); + //void* Heap::CAlloc(size_t aCount, size_t aSize); + }; + + class OTIcmp6 { + friend class OpenThreadClass; + public: + otError RegisterHandler(otIcmp6Handler* aHandler); + otError SendEchoRequest(otMessage* aMessage, const otMessageInfo* aMessageInfo, uint16_t aIdentifier); + otIcmp6EchoMode GetEchoMode(); + void SetEchoMode(otIcmp6EchoMode aMode); + }; + + class OTInstance { + friend class OpenThreadClass; + public: + bool IsInitialized(); + otError ErasePersistentInfo(); + //otInstance* Instance::Init(void* aInstanceBuffer, size_t* aInstanceBufferSize); + //otInstance* Instance::InitSingle(void); + void FactoryReset(); + void Finalize(); + void Reset(); + }; + + class OTIp6 { + friend class OpenThreadClass; + public: + //bool Ip6::IsAddressEqual(const otIp6Address* aFirst, const otIp6Address* aSecond); + //bool Ip6::IsAddressUnspecified(const otIp6Address* aAddress); + bool IsEnabled(); + bool IsMulticastPromiscuousEnabled(); + bool IsReceiveFilterEnabled(); + bool IsSlaacEnabled(); + const otNetifAddress* GetUnicastAddresses(); + const otNetifMulticastAddress* GetMulticastAddresses(); + const uint16_t* GetUnsecurePorts(uint8_t* aNumEntries); + otError AddUnicastAddress(const otNetifAddress* aAddress); + otError AddUnsecurePort(uint16_t aPort); + //otError Ip6::AddressFromString(const char* aString, otIp6Address* aAddress); + otError RemoveUnicastAddress(const otIp6Address* aAddress); + otError RemoveUnsecurePort(uint16_t aPort); + otError SelectSourceAddress(otMessageInfo* aMessageInfo); + otError Send(otMessage* aMessage); + otError SetEnabled(bool aEnabled); + otError SubscribeMulticastAddress(const otIp6Address* aAddress); + otError UnsubscribeMulticastAddress(const otIp6Address* aAddress); + otMessage* NewMessage(const otMessageSettings* aSettings); + otMessage* NewMessageFromBuffer(const uint8_t* aData, uint16_t aDataLength, const otMessageSettings* aSettings); + //uint8_t Ip6::PrefixMatch(const otIp6Address* aFirst, const otIp6Address* aSecond); + void RemoveAllUnsecurePorts(); + void SetAddressCallback(otIp6AddressCallback aCallback, void* aCallbackContext); + void SetMulticastPromiscuousEnabled(bool aEnabled); + void SetReceiveCallback(otIp6ReceiveCallback aCallback, void* aCallbackContext); + void SetReceiveFilterEnabled(bool aEnabled); + void SetSlaacEnabled(bool aEnabled); + void SetSlaacPrefixFilter(otIp6SlaacPrefixFilter aFilter); + }; + + class OTJamDetection { + friend class OpenThreadClass; + public: + bool GetState(); + bool IsEnabled(); + int8_t GetRssiThreshold(); + otError SetBusyPeriod(uint8_t aBusyPeriod); + otError SetRssiThreshold(int8_t aRssiThreshold); + otError SetWindow(uint8_t aWindow); + otError Start(otJamDetectionCallback aCallback, void* aContext); + otError Stop(); + uint64_t GetHistoryBitmap(); + uint8_t GetBusyPeriod(); + uint8_t GetWindow(); + }; + + class OTJoiner { + friend class OpenThreadClass; + public: + otError Start(const char* aPskd, const char* aProvisioningUrl, const char* aVendorName, const char* aVendorModel, const char* aVendorSwVersion, const char* aVendorData, otJoinerCallback aCallback, void* aContext); + otJoinerState GetState(); + void GetId(otExtAddress* aJoinerId); + void Stop(); + }; + + class OTLink { + friend class OpenThreadClass; + public: + bool IsActiveScanInProgress(); + bool IsEnabled(); + bool IsEnergyScanInProgress(); + bool IsInTransmitState(); + bool IsPromiscuous(); + const otExtAddress* GetExtendedAddress(); + const otMacCounters* GetCounters(); + const uint32_t* GetTxDirectRetrySuccessHistogram(uint8_t* aNumberOfEntries); + const uint32_t* GetTxIndirectRetrySuccessHistogram(uint8_t* aNumberOfEntries); + int8_t ConvertLinkQualityToRss(uint8_t aLinkQuality); + otError ActiveScan(uint32_t aScanChannels, uint16_t aScanDuration, otHandleActiveScanResult aCallback, void* aCallbackContext); + otError EnergyScan(uint32_t aScanChannels, uint16_t aScanDuration, otHandleEnergyScanResult aCallback, void* aCallbackContext); + otError FilterAddAddress(const otExtAddress* aExtAddress); + otError FilterAddRssIn(const otExtAddress* aExtAddress, int8_t aRss); + otError FilterGetNextAddress(otMacFilterIterator* aIterator, otMacFilterEntry* aEntry); + otError FilterGetNextRssIn(otMacFilterIterator* aIterator, otMacFilterEntry* aEntry); + otError FilterRemoveAddress(const otExtAddress* aExtAddress); + otError FilterRemoveRssIn(const otExtAddress* aExtAddress); + otError FilterSetAddressMode(otMacFilterAddressMode aMode); + otError OutOfBandTransmitRequest(otRadioFrame* aOobFrame); + otError SendDataRequest(); + otError SetChannel(uint8_t aChannel); + otError SetEnabled(bool aEnable); + otError SetExtendedAddress(const otExtAddress* aExtAddress); + otError SetPanId(otPanId aPanId); + otError SetPollPeriod(uint32_t aPollPeriod); + otError SetPromiscuous(bool aPromiscuous); + otError SetSupportedChannelMask(uint32_t aChannelMask); + otMacFilterAddressMode FilterGetAddressMode(); + otPanId GetPanId(); + otShortAddress GetShortAddress(); + uint16_t GetCcaFailureRate(); + uint32_t GetPollPeriod(); + uint32_t GetSupportedChannelMask(); + uint8_t ConvertRssToLinkQuality(int8_t aRss); + uint8_t GetChannel(); + uint8_t GetMaxFrameRetriesDirect(); + uint8_t GetMaxFrameRetriesIndirect(); + void FilterClearAddresses(); + void FilterClearRssIn(); + void GetFactoryAssignedIeeeEui64(otExtAddress* aEui64); + void ResetCounters(); + void ResetTxRetrySuccessHistogram(); + void SetMaxFrameRetriesDirect(uint8_t aMaxFrameRetriesDirect); + void SetMaxFrameRetriesIndirect(uint8_t aMaxFrameRetriesIndirect); + void SetPcapCallback(otLinkPcapCallback aPcapCallback, void* aCallbackContext); + bool RawGetPromiscuous(); + bool RawIsEnabled(); + int8_t RawGetRssi(); + otError RawEnergyScan(uint8_t aScanChannel, uint16_t aScanDuration, otLinkRawEnergyScanDone aCallback); + otError RawReceive(otLinkRawReceiveDone aCallback); + otError RawSetEnable(bool aEnabled); + otError RawSetPromiscuous(bool aEnable); + otError RawSetShortAddress(uint16_t aShortAddress); + otError RawSleep(); + otError RawSrcMatchAddExtEntry(const otExtAddress* aExtAddress); + otError RawSrcMatchAddShortEntry(uint16_t aShortAddress); + otError RawSrcMatchClearExtEntries(); + otError RawSrcMatchClearExtEntry(const otExtAddress* aExtAddress); + otError RawSrcMatchClearShortEntries(); + otError RawSrcMatchClearShortEntry(uint16_t aShortAddress); + otError RawSrcMatchEnable(bool aEnable); + otError RawTransmit(otLinkRawTransmitDone aCallback); + otRadioCaps RawGetCaps(); + otRadioFrame* RawGetTransmitBuffer(); + }; + + class OTLogging { + friend class OpenThreadClass; + public: + //otLogLevel Logging::GetLevel(void); + //void Logging::SetLevel(otLogLevel aLogLevel); + }; + + class OTMessage { + friend class OpenThreadClass; + public: + //bool Message::IsLinkSecurityEnabled(const otMessage* aMessage); + //int Message::Write(otMessage* aMessage, uint16_t aOffset, const void* aBuf, uint16_t aLength); + //int8_t Message::GetRss(const otMessage* aMessage); + //otError Message::Append(otMessage* aMessage, const void* aBuf, uint16_t aLength); + //otError Message::QueueDequeue(otMessageQueue* aQueue, otMessage* aMessage); + //otError Message::QueueEnqueue(otMessageQueue* aQueue, otMessage* aMessage); + //otError Message::QueueEnqueueAtHead(otMessageQueue* aQueue, otMessage* aMessage); + //otError Message::SetLength(otMessage* aMessage, uint16_t aLength); + //otError Message::SetOffset(otMessage* aMessage, uint16_t aOffset); + //otMessage* Message::QueueGetHead(otMessageQueue* aQueue); + //otMessage* Message::QueueGetNext(otMessageQueue* aQueue, const otMessage* aMessage); + //uint16_t Message::GetLength(const otMessage* aMessage); + //uint16_t Message::GetOffset(const otMessage* aMessage); + //uint16_t Message::Read(const otMessage* aMessage, uint16_t aOffset, void* aBuf, uint16_t aLength); + //void Message::Free(otMessage* aMessage); + void GetBufferInfo(otBufferInfo* aBufferInfo); + //void Message::QueueInit(otMessageQueue* aQueue); + //void Message::SetDirectTransmission(otMessage* aMessage, bool aEnabled); + }; + + class OTNcp { + friend class OpenThreadClass; + public: + //otError Ncp::StreamWrite(int aStreamId, const uint8_t* aDataPtr, int aDataLen); + //void Ncp::HandleDidReceiveNewLegacyUlaPrefix(const uint8_t* aUlaPrefix); + //void Ncp::HandleLegacyNodeDidJoin(const otExtAddress* aExtAddr); + void Init(); + //void Ncp::PlatLogv(otLogLevel aLogLevel, otLogRegion aLogRegion, const char* aFormat, va_list aArgs); + //void Ncp::RegisterLegacyHandlers(const otNcpLegacyHandlers* aHandlers); + //void Ncp::RegisterPeekPokeDelagates(otNcpDelegateAllowPeekPoke aAllowPeekDelegate, otNcpDelegateAllowPeekPoke aAllowPokeDelegate); + }; + + class OTNetData { + friend class OpenThreadClass; + public: + otError Get(bool aStable, uint8_t* aData, uint8_t* aDataLength); + otError GetNextOnMeshPrefix(otNetworkDataIterator* aIterator, otBorderRouterConfig* aConfig); + otError GetNextRoute(otNetworkDataIterator* aIterator, otExternalRouteConfig* aConfig); + otError GetNextService(otNetworkDataIterator* aIterator, otServiceConfig* aConfig); + uint8_t GetStableVersion(); + uint8_t GetVersion(); + }; + + class OTNetworkTime { + friend class OpenThreadClass; + public: + otError SetSyncPeriod(uint16_t aTimeSyncPeriod); + otError SetXtalThreshold(uint16_t aXTALThreshold); + otNetworkTimeStatus Get(uint64_t* aNetworkTime); + uint16_t GetSyncPeriod(); + uint16_t GetXtalThreshold(); + void SyncSetCallback(otNetworkTimeSyncCallbackFn aCallbackFn, void* aCallbackContext); + }; + + class OTPlat { + friend class OpenThreadClass; + public: + //bool Plat::DiagModeGet(void); + otError DiagProcess(uint8_t aArgsLength, char* aArgs[], char* aOutput, size_t aOutputMaxLen); + void DiagAlarmCallback(); + //void Plat::DiagChannelSet(uint8_t aChannel); + //void Plat::DiagModeSet(bool aMode); + void DiagRadioReceived(otRadioFrame* aFrame, otError aError); + //void Plat::DiagTxPowerSet(int8_t aTxPower); + //otError Plat::EntropyGet(uint8_t* aOutput, uint16_t aOutputLength); + //void Plat::Log(otLogLevel aLogLevel, otLogRegion aLogRegion, const char* aFormat,...); + //otError Plat::UdpBind(otUdpSocket* aUdpSocket); + //otError Plat::UdpClose(otUdpSocket* aUdpSocket); + //otError Plat::UdpConnect(otUdpSocket* aUdpSocket); + //otError Plat::UdpSend(otUdpSocket* aUdpSocket, otMessage* aMessage, const otMessageInfo* aMessageInfo); + //otError Plat::UdpSocket(otUdpSocket* aUdpSocket); + }; + + class OTRandomCrypto { + friend class OpenThreadClass; + public: + //mbedtls_ctr_drbg_context* RandomCrypto::MbedTlsContextGet(void); + //otError RandomCrypto::FillBuffer(uint8_t* aBuffer, uint16_t aSize); + }; + + class OTRandomNonCrypto { + friend class OpenThreadClass; + public: + //uint16_t RandomNonCrypto::GetUint16(void); + //uint16_t RandomNonCrypto::GetUint16InRange(uint16_t aMin, uint16_t aMax); + //uint32_t RandomNonCrypto::AddJitter(uint32_t aValue, uint16_t aJitter); + //uint32_t RandomNonCrypto::GetUint32(void); + //uint32_t RandomNonCrypto::GetUint32InRange(uint32_t aMin, uint32_t aMax); + //uint8_t RandomNonCrypto::GetUint8(void); + //uint8_t RandomNonCrypto::GetUint8InRange(uint8_t aMin, uint8_t aMax); + //void RandomNonCrypto::FillBuffer(uint8_t* aBuffer, uint16_t aSize); + }; + + class OTServer { + friend class OpenThreadClass; + public: + otError AddService(const otServiceConfig* aConfig); + otError GetNetDataLocal(bool aStable, uint8_t* aData, uint8_t* aDataLength); + otError GetNextService(otNetworkDataIterator* aIterator, otServiceConfig* aConfig); + otError Register(); + otError RemoveService(uint32_t aEnterpriseNumber, const uint8_t* aServiceData, uint8_t aServiceDataLength); + }; + + class OTSntpClient { + friend class OpenThreadClass; + public: + otError Query(const otSntpQuery* aQuery, otSntpResponseHandler aHandler, void* aContext); + void SetUnixEra(uint32_t aUnixEra); + }; + + class OTTasklets { + friend class OpenThreadClass; + public: + bool ArePending(); + void Process(); + void SignalPending(); + }; + + class OTThread { + friend class OpenThreadClass; + public: + //const char* Thread::ErrorToString(otError aError); + //otError Thread::GetNextDiagnosticTlv(const otMessage* aMessage, otNetworkDiagIterator* aIterator, otNetworkDiagTlv* aNetworkDiagTlv); + otError SendDiagnosticGet(const otIp6Address* aDestination, const uint8_t aTlvTypes[], uint8_t aCount); + otError SendDiagnosticReset(const otIp6Address* aDestination, const uint8_t aTlvTypes[], uint8_t aCount); + void SetReceiveDiagnosticGetCallback(otReceiveDiagnosticGetCallback aCallback, void* aCallbackContext); + bool IsDiscoverInProgress(); + bool IsSingleton(); + const char* GetNetworkName(); + const otExtendedPanId* GetExtendedPanId(); + const otIp6Address* GetLinkLocalIp6Address(); + const otIp6Address* GetMeshLocalEid(); + const otIp6Address* GetRloc(); + const otIpCounters* GetIp6Counters(); + const otMasterKey* GetMasterKey(); + const otMeshLocalPrefix* GetMeshLocalPrefix(); + const otMleCounters* GetMleCounters(); + otDeviceRole GetDeviceRole(); + otError BecomeChild(); + otError BecomeDetached(); + otError Discover(uint32_t aScanChannels, uint16_t aPanId, bool aJoiner, bool aEnableEui64Filtering, otHandleActiveScanResult aCallback, void* aCallbackContext); + otError GetLeaderData(otLeaderData* aLeaderData); + otError GetLeaderRloc(otIp6Address* aLeaderRloc); + otError GetNextNeighborInfo(otNeighborInfoIterator* aIterator, otNeighborInfo* aInfo); + otError GetParentAverageRssi(int8_t* aParentRssi); + otError GetParentInfo(otRouterInfo* aParentInfo); + otError GetParentLastRssi(int8_t* aLastRssi); + otError SetEnabled(bool aEnabled); + otError SetExtendedPanId(const otExtendedPanId* aExtendedPanId); + otError SetLinkMode(otLinkModeConfig aConfig); + otError SetMasterKey(const otMasterKey* aKey); + otError SetMeshLocalPrefix(const otMeshLocalPrefix* aMeshLocalPrefix); + otError SetNetworkName(const char* aNetworkName); + otLinkModeConfig GetLinkMode(); + uint16_t GetRloc16(); + //uint16_t Thread::GetVersion(void); + uint32_t GetChildTimeout(); + uint32_t GetKeySequenceCounter(); + uint32_t GetKeySwitchGuardTime(); + uint32_t GetPartitionId(); + uint8_t GetLeaderRouterId(); + uint8_t GetLeaderWeight(); + void RegisterParentResponseCallback(otThreadParentResponseCallback aCallback, void* aContext); + void ResetIp6Counters(); + void ResetMleCounters(); + void SetChildTimeout(uint32_t aTimeout); + void SetKeySequenceCounter(uint32_t aKeySequenceCounter); + void SetKeySwitchGuardTime(uint32_t aKeySwitchGuardTime); + bool IsRouterEligible(); + const otPskc* GetPskc(); + int8_t GetParentPriority(); + otError BecomeLeader(); + otError BecomeRouter(); + otError GetChildInfoById(uint16_t aChildId, otChildInfo* aChildInfo); + otError GetChildInfoByIndex(uint16_t aChildIndex, otChildInfo* aChildInfo); + otError GetChildNextIp6Address(uint16_t aChildIndex, otChildIp6AddressIterator* aIterator, otIp6Address* aAddress); + otError GetNextCacheEntry(otCacheEntryInfo* aEntryInfo, otCacheEntryIterator* aIterator); + otError GetRouterInfo(uint16_t aRouterId, otRouterInfo* aRouterInfo); + otError ReleaseRouterId(uint8_t aRouterId); + otError SetJoinerUdpPort(uint16_t aJoinerUdpPort); + otError SetMaxAllowedChildren(uint16_t aMaxChildren); + otError SetMaxChildIpAddresses(uint8_t aMaxIpAddresses); + otError SetParentPriority(int8_t aParentPriority); + otError SetPreferredRouterId(uint8_t aRouterId); + otError SetPskc(const otPskc* aPskc); + otError SetRouterEligible(bool aEligible); + uint16_t GetJoinerUdpPort(); + uint16_t GetMaxAllowedChildren(); + uint32_t GetContextIdReuseDelay(); + uint32_t GetLocalLeaderPartitionId(); + uint8_t GetLocalLeaderWeight(); + uint8_t GetMaxChildIpAddresses(); + uint8_t GetMaxRouterId(); + uint8_t GetNetworkIdTimeout(); + uint8_t GetRouterDowngradeThreshold(); + uint8_t GetRouterIdSequence(); + uint8_t GetRouterSelectionJitter(); + uint8_t GetRouterUpgradeThreshold(); + void RegisterNeighborTableCallback(otNeighborTableCallback aCallback); + void SetContextIdReuseDelay(uint32_t aDelay); + void SetLocalLeaderPartitionId(uint32_t aPartitionId); + void SetLocalLeaderWeight(uint8_t aWeight); + void SetNetworkIdTimeout(uint8_t aTimeout); + void SetRouterDowngradeThreshold(uint8_t aThreshold); + void SetRouterSelectionJitter(uint8_t aRouterJitter); + void SetRouterUpgradeThreshold(uint8_t aThreshold); + void SetSteeringData(const otExtAddress* aExtAddress); + }; + + class OTUdp { + friend class OpenThreadClass; + public: + otError AddReceiver(otUdpReceiver* aUdpReceiver); + //otError Udp::Bind(otUdpSocket* aSocket, otSockAddr* aSockName); + //otError Udp::Close(otUdpSocket* aSocket); + //otError Udp::Connect(otUdpSocket* aSocket, otSockAddr* aSockName); + otError Open(otUdpSocket* aSocket, otUdpReceive aCallback, void* aContext); + otError RemoveReceiver(otUdpReceiver* aUdpReceiver); + //otError Udp::Send(otUdpSocket* aSocket, otMessage* aMessage, const otMessageInfo* aMessageInfo); + otError SendDatagram(otMessage* aMessage, otMessageInfo* aMessageInfo); + otMessage* NewMessage(const otMessageSettings* aSettings); + otUdpSocket* GetSockets(); + void ForwardReceive(otMessage* aMessage, uint16_t aPeerPort, const otIp6Address* aPeerAddr, uint16_t aSockPort); + void ForwardSetForwarder(otUdpForwarder aForwarder, void* aContext); + }; + From 9b20aa3fd258f05d9afc33040986830b31a69aa7 Mon Sep 17 00:00:00 2001 From: "TOKITA, Hiroshi" Date: Tue, 21 Jul 2020 20:18:53 +0900 Subject: [PATCH 3/3] Store scripts for development --- libraries/OpenThread/dist/format_protptype.rb | 35 +++++++++++++++++++ .../OpenThread/dist/funclist_filter_api.rb | 15 ++++++++ libraries/OpenThread/dist/gen_class_decls.rb | 34 ++++++++++++++++++ .../dist/gen_funclist_from_doxyxml.rb | 25 +++++++++++++ libraries/OpenThread/dist/gen_impls.rb | 29 +++++++++++++++ 5 files changed, 138 insertions(+) create mode 100644 libraries/OpenThread/dist/format_protptype.rb create mode 100644 libraries/OpenThread/dist/funclist_filter_api.rb create mode 100644 libraries/OpenThread/dist/gen_class_decls.rb create mode 100644 libraries/OpenThread/dist/gen_funclist_from_doxyxml.rb create mode 100644 libraries/OpenThread/dist/gen_impls.rb diff --git a/libraries/OpenThread/dist/format_protptype.rb b/libraries/OpenThread/dist/format_protptype.rb new file mode 100644 index 000000000..28bd1df96 --- /dev/null +++ b/libraries/OpenThread/dist/format_protptype.rb @@ -0,0 +1,35 @@ +def classese_extract(line, classes) + classes.each do |clz| + if line =~ / ot#{clz}([^\(]*\()/ + line.sub!(/ ot#{clz}/, "\t#{clz}::") + return true + end + end + + return false +end + +def compact_space(line) + line.gsub!(/\ \ */," ") + line.gsub!(/ \*/,"* ") + line.gsub!(/const /,"const_") + line.gsub!(/static_/,"static_") + line.gsub!(/OT_TOOL_WEAK /,"OT_TOOL_WEAK_") +end + +readlines.each do |line| + compact_space(line) + ret = classese_extract(line, + ['Udp', 'Thread', 'Tasklets', 'SntpClient', 'Server', 'RandomNonCrypto', 'RandomCrypto', + 'Plat', 'NetworkTime', 'NetData', 'Ncp', 'Message', 'Logging', 'Link', 'Joiner', 'JamDetection', + 'Ip6', 'Instance', 'Icmp6', 'Heap', 'Entropy', 'DnsClient', 'Diag', 'Dataset', + 'Crypto', 'Cli', 'Commissioner', 'CoapSecure', 'Coap', 'ChildSupervision', 'ChannelMonitor', + 'ChannelManager', 'BorderRouter', 'BorderAgent', 'BackboneRouter']) + + if ret + STDOUT.print line + else + STDERR.print line + end + +end diff --git a/libraries/OpenThread/dist/funclist_filter_api.rb b/libraries/OpenThread/dist/funclist_filter_api.rb new file mode 100644 index 000000000..055f0bc23 --- /dev/null +++ b/libraries/OpenThread/dist/funclist_filter_api.rb @@ -0,0 +1,15 @@ + +headers = [ "backbone_router.h", "backbone_router_ftd.h", "border_agent.h", "border_router.h", "channel_manager.h", "channel_monitor.h", "child_supervision.h", "cli.h", "coap.h", "coap_secure.h", "commissioner.h", "config.h", "crypto.h", "dataset.h", "dataset_ftd.h", "diag.h", "dns.h", "entropy.h", "error.h", "heap.h", "icmp6.h", "instance.h", "ip6.h", "jam_detection.h", "joiner.h", "link.h", "link_raw.h", "logging.h", "message.h", "ncp.h", "netdata.h", "netdiag.h", "network_time.h", "ot_api_doc.h", "platform", "random_crypto.h", "random_noncrypto.h", "server.h", "sntp.h", "tasklet.h", "thread.h", "thread_ftd.h", "udp.h"] + +filtered = readlines.select do |line| + x = true + x = false if not headers.include?( line.split("\t")[0].split(/\//).last ) + x = false if not line =~ /\(/ + x = false if line =~ /::/ + x = false if line =~ /typedef/ + x +end + +filtered.sort.uniq.each do |line| + print line +end diff --git a/libraries/OpenThread/dist/gen_class_decls.rb b/libraries/OpenThread/dist/gen_class_decls.rb new file mode 100644 index 000000000..79c775729 --- /dev/null +++ b/libraries/OpenThread/dist/gen_class_decls.rb @@ -0,0 +1,34 @@ + +lines = readlines + +clzz = [] + +lines.each do |line| + line =~ /(\w*)::/ + clzz.append($1) +end + + +clzz.sort.uniq.each do |clz| + + print " class OT#{clz} {\n" + print " friend class OpenThreadClass;\n" + print " public:\n" + lines.each do |line| + if line =~ /#{clz}::/ + if line =~ /\(otInstance\* aInstance/ + line.gsub!(/#{clz}::/,"") + line.gsub!(/\(otInstance\* aInstance/,"(") + line.gsub!(/\(, /,"(") + print " #{line.strip.sub(/\t/, " ")}".gsub(/const_/, "const ") + print ";\n" + else + print " //#{line.strip.sub(/\t/, " ")}".gsub(/const_/, "const ") + print ";\n" + end + end + end + print " };\n" + print "\n" +end + diff --git a/libraries/OpenThread/dist/gen_funclist_from_doxyxml.rb b/libraries/OpenThread/dist/gen_funclist_from_doxyxml.rb new file mode 100644 index 000000000..7be97aec2 --- /dev/null +++ b/libraries/OpenThread/dist/gen_funclist_from_doxyxml.rb @@ -0,0 +1,25 @@ +require 'rexml/document' +require 'rexml/formatters/pretty' +require 'pp' +require 'stringio' + +formatter = REXML::Formatters::Pretty.new + +ARGV.each do |file| + xml = REXML::Document.new(File.new(file)) + + + REXML::XPath.each(xml, "/doxygen/compounddef/sectiondef/memberdef") do |e| +# print "---- #{file}\n" + if e.elements['definition'] + print e.elements['location'].attributes['file'] + print "\t" + print e.elements['definition'].text + print e.elements['argsstring'].text if e.elements['argsstring'] + print "\n" + end + end + output = StringIO.new +# formatter.write(xml, output) +# print output.string +end diff --git a/libraries/OpenThread/dist/gen_impls.rb b/libraries/OpenThread/dist/gen_impls.rb new file mode 100644 index 000000000..dfa17f807 --- /dev/null +++ b/libraries/OpenThread/dist/gen_impls.rb @@ -0,0 +1,29 @@ +print "#include \"OpenThread.h\"\n" +print "#include \n" +print "\n" + +readlines.each do |line| + line.gsub!(/\s[\w\*]*,/, ",") + line.gsub!(/\s[\w\*]*\)/, ")") + line.gsub!(/\s+\w+\[], /, "*, ") + line.gsub!(/::/,"\t") + line.gsub!(/\(/,"\t") + line.gsub!(/,/,"\t") + line.gsub!(/\)/,"") + line.gsub!(/static /, "") + data = line.chomp.split(/\t/).collect {|d| d.strip} + + if data[3] == "otInstance*" + cols = [(data.count-4).to_s, data[1], data[0], data[2] ].concat( data[4..-1].reject{|i|i=='void'} ) + if data[0] == "void" + print "OT_DECL_VFUNC(#{cols.join(', ')})\n".gsub(/const_/,"const ") + else + print "OT_DECL__FUNC(#{cols.join(', ')})\n".gsub(/const_/,"const ") + end + else + cols = [(data.count-3).to_s, data[1], data[2], data[0] ] + data[3..-1] + print "/*OT_DECL__FUNC(#{cols.join(', ')})*/\n".gsub(/const_/,"const ") + end + + +end