diff --git a/src/core/common/message.cpp b/src/core/common/message.cpp index 3ac797c35..d24ae7e7f 100644 --- a/src/core/common/message.cpp +++ b/src/core/common/message.cpp @@ -61,7 +61,7 @@ MessagePool::MessagePool(Instance &aInstance) #endif } -Message *MessagePool::New(uint8_t aType, uint16_t aReserveHeader, uint8_t aPriority) +Message *MessagePool::New(Message::Type aType, uint16_t aReserveHeader, uint8_t aPriority) { otError error = OT_ERROR_NONE; Message *message; @@ -87,7 +87,7 @@ exit: return message; } -Message *MessagePool::New(uint8_t aType, uint16_t aReserveHeader, const otMessageSettings *aSettings) +Message *MessagePool::New(Message::Type aType, uint16_t aReserveHeader, const otMessageSettings *aSettings) { Message *message; bool linkSecurityEnabled; diff --git a/src/core/common/message.hpp b/src/core/common/message.hpp index 6861fe7a0..225997506 100644 --- a/src/core/common/message.hpp +++ b/src/core/common/message.hpp @@ -230,7 +230,11 @@ class Message : public Buffer friend class PriorityQueue; public: - enum + /** + * This enumeration represents the message type. + * + */ + enum Type { kTypeIp6 = 0, ///< A full uncompressed IPv6 packet kType6lowpan = 1, ///< A 6lowpan frame @@ -331,7 +335,7 @@ public: * @returns The type of the message. * */ - uint8_t GetType(void) const { return GetMetadata().mType; } + Type GetType(void) const { return static_cast(GetMetadata().mType); } /** * This method sets the message type. @@ -339,7 +343,7 @@ public: * @param[in] aType The message type. * */ - void SetType(uint8_t aType) { GetMetadata().mType = aType; } + void SetType(Type aType) { GetMetadata().mType = aType; } /** * This method returns the sub type of the message. @@ -1135,7 +1139,7 @@ public: * @returns A pointer to the message or NULL if no message buffers are available. * */ - Message *New(uint8_t aType, uint16_t aReserveHeader, uint8_t aPriority = kDefaultMessagePriority); + Message *New(Message::Type aType, uint16_t aReserveHeader, uint8_t aPriority = kDefaultMessagePriority); /** * This method is used to obtain a new message with specified settings. @@ -1150,7 +1154,7 @@ public: * @returns A pointer to the message or NULL if no message buffers are available. * */ - Message *New(uint8_t aType, uint16_t aReserveHeader, const otMessageSettings *aSettings); + Message *New(Message::Type aType, uint16_t aReserveHeader, const otMessageSettings *aSettings); /** * This method is used to free a message and return all message buffers to the buffer pool. diff --git a/src/core/thread/mesh_forwarder.cpp b/src/core/thread/mesh_forwarder.cpp index 0b4ce53e1..a70d67297 100644 --- a/src/core/thread/mesh_forwarder.cpp +++ b/src/core/thread/mesh_forwarder.cpp @@ -476,11 +476,14 @@ otError MeshForwarder::HandleFrameRequest(Mac::TxFrame &aFrame) // there is a pending indirect supervision message in the send // queue for it. The message would be then converted to a // direct tx. + + // Fall through +#endif + + default: mMessageNextOffset = mSendMessage->GetLength(); error = OT_ERROR_ABORT; ExitNow(); - -#endif } aFrame.SetIsARetransmission(false);