Message#
This module includes functions that manipulate OpenThread message buffers.
Modules#
Enumerations#
Defines the OpenThread message priority levels.
Defines the OpenThread message origins.
Typedefs#
Defines the OpenThread message priority levels.
Defines the OpenThread message origins.
Represents a message settings.
Represents link-specific information for messages received from the Thread radio.
Represents information about a message queue.
Represents the message buffer information for different queues used by OpenThread stack.
Functions#
Free an allocated message buffer.
Get the message length in bytes.
Set the message length in bytes.
Get the message offset in bytes.
Set the message offset in bytes.
Indicates whether or not link security is enabled for the message.
Indicates whether or not the message is allowed to be looped back to host.
Sets whether or not the message is allowed to be looped back to host.
Indicates whether the given message may be looped back in a case of a multicast destination address.
Controls whether the given message may be looped back in a case of a multicast destination address.
Gets the message origin.
Sets the message origin.
Sets/forces the message to be forwarded using direct transmission.
Returns the average RSS (received signal strength) associated with the message.
Retrieves the link-specific information for a message received over Thread radio.
Append bytes to a message.
Read bytes from a message.
Write bytes to a message.
Initialize the message queue.
Adds a message to the end of the given message queue.
Adds a message at the head/front of the given message queue.
Removes a message from the given message queue.
Returns a pointer to the message at the head of the queue.
Returns a pointer to the next message in the queue by iterating forward (from head to tail).
Get the Message Buffer information.
Reset the Message Buffer information counter tracking the maximum number buffers in use at the same time.
Enumeration Documentation#
otMessagePriority#
otMessagePriority
Defines the OpenThread message priority levels.
Enumerator | |
---|---|
OT_MESSAGE_PRIORITY_LOW | Low priority level. |
OT_MESSAGE_PRIORITY_NORMAL | Normal priority level. |
OT_MESSAGE_PRIORITY_HIGH | High priority level. |
otMessageOrigin#
otMessageOrigin
Defines the OpenThread message origins.
Enumerator | |
---|---|
OT_MESSAGE_ORIGIN_THREAD_NETIF | Message from Thread Netif. |
OT_MESSAGE_ORIGIN_HOST_TRUSTED | Message from a trusted source on host. |
OT_MESSAGE_ORIGIN_HOST_UNTRUSTED | Message from an untrusted source on host. |
Typedef Documentation#
otMessage#
typedef struct otMessage otMessage
An opaque representation of an OpenThread message buffer.
otMessagePriority#
typedef enum otMessagePriority otMessagePriority
Defines the OpenThread message priority levels.
otMessageOrigin#
typedef enum otMessageOrigin otMessageOrigin
Defines the OpenThread message origins.
otThreadLinkInfo#
typedef struct otThreadLinkInfo otThreadLinkInfo
Represents link-specific information for messages received from the Thread radio.
otMessageQueueInfo#
typedef struct otMessageQueueInfo otMessageQueueInfo
Represents information about a message queue.
otBufferInfo#
typedef struct otBufferInfo otBufferInfo
Represents the message buffer information for different queues used by OpenThread stack.
Function Documentation#
otMessageFree#
void otMessageFree (otMessage * aMessage)
Free an allocated message buffer.
Type | Direction | Argument Name | Description |
---|---|---|---|
otMessage * | [in] | aMessage | A pointer to a message buffer. |
See Also
otMessageGetLength#
uint16_t otMessageGetLength (const otMessage * aMessage)
Get the message length in bytes.
Type | Direction | Argument Name | Description |
---|---|---|---|
const otMessage * | [in] | aMessage | A pointer to a message buffer. |
Returns
The message length in bytes.
See Also
otMessageSetLength#
otError otMessageSetLength (otMessage * aMessage, uint16_t aLength)
Set the message length in bytes.
Type | Direction | Argument Name | Description |
---|---|---|---|
otMessage * | [in] | aMessage | A pointer to a message buffer. |
uint16_t | [in] | aLength | A length in bytes. |
See Also
otMessageGetOffset#
uint16_t otMessageGetOffset (const otMessage * aMessage)
Get the message offset in bytes.
Type | Direction | Argument Name | Description |
---|---|---|---|
const otMessage * | [in] | aMessage | A pointer to a message buffer. |
Returns
The message offset value.
See Also
otMessageSetOffset#
void otMessageSetOffset (otMessage * aMessage, uint16_t aOffset)
Set the message offset in bytes.
Type | Direction | Argument Name | Description |
---|---|---|---|
otMessage * | [in] | aMessage | A pointer to a message buffer. |
uint16_t | [in] | aOffset | An offset in bytes. |
See Also
otMessageIsLinkSecurityEnabled#
bool otMessageIsLinkSecurityEnabled (const otMessage * aMessage)
Indicates whether or not link security is enabled for the message.
Type | Direction | Argument Name | Description |
---|---|---|---|
const otMessage * | [in] | aMessage | A pointer to a message buffer. |
otMessageIsLoopbackToHostAllowed#
bool otMessageIsLoopbackToHostAllowed (const otMessage * aMessage)
Indicates whether or not the message is allowed to be looped back to host.
Type | Direction | Argument Name | Description |
---|---|---|---|
const otMessage * | [in] | aMessage | A pointer to a message buffer. |
otMessageSetLoopbackToHostAllowed#
void otMessageSetLoopbackToHostAllowed (otMessage * aMessage, bool aAllowLoopbackToHost)
Sets whether or not the message is allowed to be looped back to host.
Type | Direction | Argument Name | Description |
---|---|---|---|
otMessage * | [in] | aMessage | A pointer to a message buffer. |
bool | [in] | aAllowLoopbackToHost | Whether to allow the message to be looped back to host. |
otMessageIsMulticastLoopEnabled#
bool otMessageIsMulticastLoopEnabled (otMessage * aMessage)
Indicates whether the given message may be looped back in a case of a multicast destination address.
Type | Direction | Argument Name | Description |
---|---|---|---|
otMessage * | [in] | aMessage | A pointer to the message. |
If aMessage
is used along with an otMessageInfo
, the mMulticastLoop
field from otMessageInfo
structure takes precedence and will be used instead of the the value set on aMessage
.
This API is mainly intended for use along with otIp6Send()
which expects an already prepared IPv6 message.
otMessageSetMulticastLoopEnabled#
void otMessageSetMulticastLoopEnabled (otMessage * aMessage, bool aEnabled)
Controls whether the given message may be looped back in a case of a multicast destination address.
Type | Direction | Argument Name | Description |
---|---|---|---|
otMessage * | [in] | aMessage | A pointer to the message. |
bool | [in] | aEnabled | The configuration value. |
otMessageGetOrigin#
otMessageOrigin otMessageGetOrigin (const otMessage * aMessage)
Gets the message origin.
Type | Direction | Argument Name | Description |
---|---|---|---|
const otMessage * | [in] | aMessage | A pointer to a message buffer. |
Returns
The message origin.
otMessageSetOrigin#
void otMessageSetOrigin (otMessage * aMessage, otMessageOrigin aOrigin)
Sets the message origin.
Type | Direction | Argument Name | Description |
---|---|---|---|
otMessage * | [in] | aMessage | A pointer to a message buffer. |
otMessageOrigin | [in] | aOrigin | The message origin. |
otMessageSetDirectTransmission#
void otMessageSetDirectTransmission (otMessage * aMessage, bool aEnabled)
Sets/forces the message to be forwarded using direct transmission.
Type | Direction | Argument Name | Description |
---|---|---|---|
otMessage * | [in] | aMessage | A pointer to a message buffer. |
bool | [in] | aEnabled | If |
Default setting for a new message is false
.
otMessageGetRss#
int8_t otMessageGetRss (const otMessage * aMessage)
Returns the average RSS (received signal strength) associated with the message.
Type | Direction | Argument Name | Description |
---|---|---|---|
const otMessage * | [in] | aMessage | A pointer to a message buffer. |
Returns
The average RSS value (in dBm) or OT_RADIO_RSSI_INVALID if no average RSS is available.
otMessageGetThreadLinkInfo#
otError otMessageGetThreadLinkInfo (const otMessage * aMessage, otThreadLinkInfo * aLinkInfo)
Retrieves the link-specific information for a message received over Thread radio.
Type | Direction | Argument Name | Description |
---|---|---|---|
const otMessage * | [in] | aMessage | The message from which to retrieve |
otThreadLinkInfo * | N/A | aLinkInfo |
otMessageAppend#
otError otMessageAppend (otMessage * aMessage, const void * aBuf, uint16_t aLength)
Append bytes to a message.
Type | Direction | Argument Name | Description |
---|---|---|---|
otMessage * | [in] | aMessage | A pointer to a message buffer. |
const void * | [in] | aBuf | A pointer to the data to append. |
uint16_t | [in] | aLength | Number of bytes to append. |
See Also
otMessageRead#
uint16_t otMessageRead (const otMessage * aMessage, uint16_t aOffset, void * aBuf, uint16_t aLength)
Read bytes from a message.
Type | Direction | Argument Name | Description |
---|---|---|---|
const otMessage * | [in] | aMessage | A pointer to a message buffer. |
uint16_t | [in] | aOffset | An offset in bytes. |
void * | [in] | aBuf | A pointer to a buffer that message bytes are read to. |
uint16_t | [in] | aLength | Number of bytes to read. |
Returns
The number of bytes read.
See Also
otMessageWrite#
int otMessageWrite (otMessage * aMessage, uint16_t aOffset, const void * aBuf, uint16_t aLength)
Write bytes to a message.
Type | Direction | Argument Name | Description |
---|---|---|---|
otMessage * | [in] | aMessage | A pointer to a message buffer. |
uint16_t | [in] | aOffset | An offset in bytes. |
const void * | [in] | aBuf | A pointer to a buffer that message bytes are written from. |
uint16_t | [in] | aLength | Number of bytes to write. |
Returns
The number of bytes written.
See Also
otMessageQueueInit#
void otMessageQueueInit (otMessageQueue * aQueue)
Initialize the message queue.
Type | Direction | Argument Name | Description |
---|---|---|---|
otMessageQueue * | [in] | aQueue | A pointer to a message queue. |
MUST be called once and only once for a otMessageQueue
instance before any other otMessageQueue
functions. The behavior is undefined if other queue APIs are used with an otMessageQueue
before it being initialized or if it is initialized more than once.
otMessageQueueEnqueue#
void otMessageQueueEnqueue (otMessageQueue * aQueue, otMessage * aMessage)
Adds a message to the end of the given message queue.
Type | Direction | Argument Name | Description |
---|---|---|---|
otMessageQueue * | [in] | aQueue | A pointer to the message queue. |
otMessage * | [in] | aMessage | The message to add. |
otMessageQueueEnqueueAtHead#
void otMessageQueueEnqueueAtHead (otMessageQueue * aQueue, otMessage * aMessage)
Adds a message at the head/front of the given message queue.
Type | Direction | Argument Name | Description |
---|---|---|---|
otMessageQueue * | [in] | aQueue | A pointer to the message queue. |
otMessage * | [in] | aMessage | The message to add. |
otMessageQueueDequeue#
void otMessageQueueDequeue (otMessageQueue * aQueue, otMessage * aMessage)
Removes a message from the given message queue.
Type | Direction | Argument Name | Description |
---|---|---|---|
otMessageQueue * | [in] | aQueue | A pointer to the message queue. |
otMessage * | [in] | aMessage | The message to remove. |
otMessageQueueGetHead#
otMessage * otMessageQueueGetHead (otMessageQueue * aQueue)
Returns a pointer to the message at the head of the queue.
Type | Direction | Argument Name | Description |
---|---|---|---|
otMessageQueue * | [in] | aQueue | A pointer to a message queue. |
Returns
A pointer to the message at the head of queue or NULL if queue is empty.
otMessageQueueGetNext#
otMessage * otMessageQueueGetNext (otMessageQueue * aQueue, const otMessage * aMessage)
Returns a pointer to the next message in the queue by iterating forward (from head to tail).
Type | Direction | Argument Name | Description |
---|---|---|---|
otMessageQueue * | [in] | aQueue | A pointer to a message queue. |
const otMessage * | [in] | aMessage | A pointer to current message buffer. |
Returns
A pointer to the next message in the queue after
aMessage
or NULL ifaMessage is the tail of queue. NULL is returned if
aMessageis not in the queue
aQueue`.
otMessageGetBufferInfo#
void otMessageGetBufferInfo (otInstance * aInstance, otBufferInfo * aBufferInfo)
Get the Message Buffer information.
Type | Direction | Argument Name | Description |
---|---|---|---|
otInstance * | [in] | aInstance | A pointer to the OpenThread instance. |
otBufferInfo * | [out] | aBufferInfo | A pointer where the message buffer information is written. |
otMessageResetBufferInfo#
void otMessageResetBufferInfo (otInstance * aInstance)
Reset the Message Buffer information counter tracking the maximum number buffers in use at the same time.
Type | Direction | Argument Name | Description |
---|---|---|---|
otInstance * | [in] | aInstance | A pointer to the OpenThread instance. |
This resets mMaxUsedBuffers
in otBufferInfo
.