diff --git a/include/openthread-types.h b/include/openthread-types.h index 344c31503..029583d09 100644 --- a/include/openthread-types.h +++ b/include/openthread-types.h @@ -324,14 +324,14 @@ typedef enum otMleAttachFilter /** * Represents a Thread device role. */ -enum otDeviceRole +typedef enum { kDeviceRoleDisabled, ///< The Thread stack is disabled. kDeviceRoleDetached, ///< Not currently participating in a Thread network/partition. kDeviceRoleChild, ///< The Thread Child role. kDeviceRoleRouter, ///< The Thread Router role. kDeviceRoleLeader, ///< The Thread Leader role. -}; +} otDeviceRole; /** * @} diff --git a/include/openthread.h b/include/openthread.h index fbb250c87..19b0b4d7b 100644 --- a/include/openthread.h +++ b/include/openthread.h @@ -36,6 +36,7 @@ #define OPENTHREAD_H_ #include +#include #include @@ -367,7 +368,7 @@ ThreadError otSetPanId(otPanId aPanId); * * @returns A pointer to the first Network Inteface Address. */ -const otNetifAddress *otGetUnicastAddresses(); +const otNetifAddress *otGetUnicastAddresses(void); /** * Add a Network Interface Address to the Thread interface. @@ -651,7 +652,7 @@ void otRemoveMacWhitelist(const uint8_t *aExtAddr); * @sa otDisableMacWhitelist * @sa otEnableMacWhitelist */ -void otClearMacWhitelist(); +void otClearMacWhitelist(void); /** * Disable MAC whitelist filtering. @@ -663,7 +664,7 @@ void otClearMacWhitelist(); * @sa otClearMacWhitelist * @sa otEnableMacWhitelist */ -void otDisableMacWhitelist(); +void otDisableMacWhitelist(void); /** * Enable MAC whitelist filtering. @@ -674,7 +675,7 @@ void otDisableMacWhitelist(); * @sa otClearMacWhitelist * @sa otDisableMacWhitelist */ -void otEnableMacWhitelist(); +void otEnableMacWhitelist(void); /** * Detach from the Thread network. @@ -682,7 +683,7 @@ void otEnableMacWhitelist(); * @retval kThreadErrorNone Successfully detached from the Thread network. * @retval kThreadErrorBusy Thread is disabled. */ -ThreadError otBecomeDetached(); +ThreadError otBecomeDetached(void); /** * Attempt to reattach as a child. @@ -700,14 +701,14 @@ ThreadError otBecomeChild(otMleAttachFilter aFilter); * @retval kThreadErrorNone Successfully begin attempt to become a router. * @retval kThreadErrorBusy Thread is disabled or already operating in a router or leader role. */ -ThreadError otBecomeRouter(); +ThreadError otBecomeRouter(void); /** * Become a leader and start a new partition. * * @retval kThreadErrorNone Successfully became a leader and started a new partition. */ -ThreadError otBecomeLeader(); +ThreadError otBecomeLeader(void); /** * @} @@ -738,35 +739,35 @@ ThreadError otBecomeLeader(); * @retval ::kDeviceRoleRouter The device is currently operating as a Thread Router. * @retval ::kDeviceRoleLeader The device is currently operating as a Thread Leader. */ -otDeviceRole otGetDeviceRole(); +otDeviceRole otGetDeviceRole(void); /** * Get the Leader's Router ID. * * @returns The Leader's Router ID. */ -uint8_t otGetLeaderRouterId(); +uint8_t otGetLeaderRouterId(void); /** * Get the Leader's Weight. * * @returns The Leader's Weight. */ -uint8_t otGetLeaderWeight(); +uint8_t otGetLeaderWeight(void); /** * Get the Network Data Version. * * @returns The Network Data Version. */ -uint8_t otGetNetworkDataVersion(); +uint8_t otGetNetworkDataVersion(void); /** * Get the Partition ID. * * @returns The Partition ID. */ -uint32_t otGetPartitionId(); +uint32_t otGetPartitionId(void); /** * Get the RLOC16. @@ -780,14 +781,14 @@ uint16_t otGetRloc16(void); * * @returns The Router ID Sequence. */ -uint8_t otGetRouterIdSequence(); +uint8_t otGetRouterIdSequence(void); /** * Get the Stable Network Data Version. * * @returns The Stable Network Data Version. */ -uint8_t otGetStableNetworkDataVersion(); +uint8_t otGetStableNetworkDataVersion(void); /** * @} @@ -1010,7 +1011,7 @@ int otWriteMessage(otMessage aMessage, uint16_t aOffset, const void *aBuf, uint1 * * @sa otFreeMessage */ -otMessage otNewUdpMessage(); +otMessage otNewUdpMessage(void); /** * Open a UDP/IPv6 socket. diff --git a/src/core/openthread.cpp b/src/core/openthread.cpp index 1c9b464f0..ac816319e 100644 --- a/src/core/openthread.cpp +++ b/src/core/openthread.cpp @@ -62,7 +62,7 @@ static otDEFINE_ALIGNED_VAR(sThreadNetifRaw, sizeof(ThreadNetif), uint64_t); static void HandleActiveScanResult(void *aContext, Mac::Frame *aFrame); -void otInit() +void otInit(void) { otLogInfoApi("Init\n"); Message::Init(); @@ -341,22 +341,22 @@ void otRemoveMacWhitelist(const uint8_t *aExtAddr) sThreadNetif->GetMac().GetWhitelist().Remove(*reinterpret_cast(aExtAddr)); } -void otClearMacWhitelist() +void otClearMacWhitelist(void) { sThreadNetif->GetMac().GetWhitelist().Clear(); } -void otDisableMacWhitelist() +void otDisableMacWhitelist(void) { sThreadNetif->GetMac().GetWhitelist().Disable(); } -void otEnableMacWhitelist() +void otEnableMacWhitelist(void) { sThreadNetif->GetMac().GetWhitelist().Enable(); } -ThreadError otBecomeDetached() +ThreadError otBecomeDetached(void) { return sThreadNetif->GetMle().BecomeDetached(); } @@ -366,17 +366,17 @@ ThreadError otBecomeChild(otMleAttachFilter aFilter) return sThreadNetif->GetMle().BecomeChild(aFilter); } -ThreadError otBecomeRouter() +ThreadError otBecomeRouter(void) { return sThreadNetif->GetMle().BecomeRouter(); } -ThreadError otBecomeLeader() +ThreadError otBecomeLeader(void) { return sThreadNetif->GetMle().BecomeLeader(); } -otDeviceRole otGetDeviceRole() +otDeviceRole otGetDeviceRole(void) { otDeviceRole rval = kDeviceRoleDisabled; @@ -406,22 +406,22 @@ otDeviceRole otGetDeviceRole() return rval; } -uint8_t otGetLeaderRouterId() +uint8_t otGetLeaderRouterId(void) { return sThreadNetif->GetMle().GetLeaderDataTlv().GetLeaderRouterId(); } -uint8_t otGetLeaderWeight() +uint8_t otGetLeaderWeight(void) { return sThreadNetif->GetMle().GetLeaderDataTlv().GetWeighting(); } -uint8_t otGetNetworkDataVersion() +uint8_t otGetNetworkDataVersion(void) { return sThreadNetif->GetMle().GetLeaderDataTlv().GetDataVersion(); } -uint32_t otGetPartitionId() +uint32_t otGetPartitionId(void) { return sThreadNetif->GetMle().GetLeaderDataTlv().GetPartitionId(); } @@ -431,12 +431,12 @@ uint16_t otGetRloc16(void) return sThreadNetif->GetMle().GetRloc16(); } -uint8_t otGetRouterIdSequence() +uint8_t otGetRouterIdSequence(void) { return sThreadNetif->GetMle().GetRouterIdSequence(); } -uint8_t otGetStableNetworkDataVersion() +uint8_t otGetStableNetworkDataVersion(void) { return sThreadNetif->GetMle().GetLeaderDataTlv().GetStableDataVersion(); } @@ -451,7 +451,7 @@ ThreadError otIp6AddressFromString(const char *str, otIp6Address *address) return static_cast(address)->FromString(str); } -const otNetifAddress *otGetUnicastAddresses() +const otNetifAddress *otGetUnicastAddresses(void) { return sThreadNetif->GetUnicastAddresses(); } @@ -527,7 +527,7 @@ exit: return; } -otMessage otNewUdpMessage() +otMessage otNewUdpMessage(void) { return Ip6::Udp::NewMessage(0); }