mirror of
https://github.com/espressif/openthread.git
synced 2026-08-02 17:17:45 +00:00
[message] add Message::Type (#4977)
This commit is contained in:
committed by
Jonathan Hui
parent
66afc9a969
commit
2b613be823
@@ -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;
|
||||
|
||||
@@ -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<Type>(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.
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user