![]() |
0.01.00
|
This class represents a message. More...
#include <src/core/common/message.hpp>
Public Types | |
| enum | { kTypeIp6 = 0, kType6lowpan = 1, kTypeMacDataPoll = 2, kTypeSupervision = 3 } |
| enum | { kSubTypeNone = 0, kSubTypeMleAnnounce = 1, kSubTypeMleDiscoverRequest = 2, kSubTypeMleDiscoverResponse = 3, kSubTypeJoinerEntrust = 4, kSubTypeMplRetransmission = 5, kSubTypeMleGeneral = 6, kSubTypeJoinerFinalizeResponse = 7, kSubTypeMleChildUpdateRequest = 8 } |
| enum | { kPriorityHigh = 0, kPriorityMedium = 1, kPriorityLow = 2, kPriorityVeryLow = 3, kNumPriorities = 4 } |
Public Member Functions | |
| void | Free (void) |
| This method frees this message buffer. | |
| Message * | GetNext (void) const |
| This method returns a pointer to the next message in the same interface list. More... | |
| uint16_t | GetLength (void) const |
| This method returns the number of bytes in the message. More... | |
| otError | SetLength (uint16_t aLength) |
| This method sets the number of bytes in the message. More... | |
| uint8_t | GetBufferCount (void) const |
| This method returns the number of buffers in the message. | |
| uint16_t | GetOffset (void) const |
| This method returns the byte offset within the message. More... | |
| otError | MoveOffset (int aDelta) |
| This method moves the byte offset within the message. More... | |
| otError | SetOffset (uint16_t aOffset) |
| This method sets the byte offset within the message. More... | |
| uint8_t | GetType (void) const |
| This method returns the type of the message. More... | |
| void | SetType (uint8_t aType) |
| This method sets the message type. More... | |
| uint8_t | GetSubType (void) const |
| This method returns the sub type of the message. More... | |
| void | SetSubType (uint8_t aSubType) |
| This method sets the message sub type. More... | |
| bool | IsSubTypeMle (void) const |
| This method returns whether or not the message is of MLE subtype. More... | |
| uint8_t | GetPriority (void) const |
| This method returns the message priority level. More... | |
| otError | SetPriority (uint8_t aPriority) |
| This method sets the messages priority. More... | |
| otError | Prepend (const void *aBuf, uint16_t aLength) |
| This method prepends bytes to the front of the message. More... | |
| otError | RemoveHeader (uint16_t aLength) |
| This method removes header bytes from the message. More... | |
| otError | Append (const void *aBuf, uint16_t aLength) |
| This method appends bytes to the end of the message. More... | |
| uint16_t | Read (uint16_t aOffset, uint16_t aLength, void *aBuf) const |
| This method reads bytes from the message. More... | |
| int | Write (uint16_t aOffset, uint16_t aLength, const void *aBuf) |
| This method writes bytes to the message. More... | |
| int | CopyTo (uint16_t aSourceOffset, uint16_t aDestinationOffset, uint16_t aLength, Message &aMessage) const |
| This method copies bytes from one message to another. More... | |
| Message * | Clone (uint16_t aLength) const |
| This method creates a copy of the current Message. More... | |
| Message * | Clone (void) const |
| This method creates a copy of the current Message. More... | |
| uint16_t | GetDatagramTag (void) const |
| This method returns the datagram tag used for 6LoWPAN fragmentation. More... | |
| void | SetDatagramTag (uint16_t aTag) |
| This method sets the datagram tag used for 6LoWPAN fragmentation. More... | |
| bool | GetChildMask (uint8_t aChildIndex) const |
| This method returns whether or not the message forwarding is scheduled for the child. More... | |
| void | ClearChildMask (uint8_t aChildIndex) |
| This method unschedules forwarding of the message to the child. More... | |
| void | SetChildMask (uint8_t aChildIndex) |
| This method schedules forwarding of the message to the child. More... | |
| bool | IsChildPending (void) const |
| This method returns whether or not the message forwarding is scheduled for at least one child. More... | |
| uint16_t | GetPanId (void) const |
| This method returns the IEEE 802.15.4 Destination PAN ID. More... | |
| void | SetPanId (uint16_t aPanId) |
| This method sets the IEEE 802.15.4 Destination PAN ID. More... | |
| uint8_t | GetChannel (void) const |
| This method returns the IEEE 802.15.4 Channel to use for transmission. More... | |
| void | SetChannel (uint8_t aChannel) |
| This method sets the IEEE 802.15.4 Channel to use for transmission. More... | |
| uint8_t | GetTimeout (void) const |
| This method returns the timeout used for 6LoWPAN reassembly. More... | |
| void | SetTimeout (uint8_t aTimeout) |
| This method sets the timeout used for 6LoWPAN reassembly. More... | |
| int8_t | GetInterfaceId (void) const |
| This method returns the interface ID. More... | |
| void | SetInterfaceId (int8_t aInterfaceId) |
| This method sets the interface ID. More... | |
| bool | GetDirectTransmission (void) const |
| This method returns whether or not message forwarding is scheduled for direct transmission. More... | |
| void | ClearDirectTransmission (void) |
| This method unschedules forwarding using direct transmission. | |
| void | SetDirectTransmission (void) |
| This method schedules forwarding using direct transmission. | |
| bool | IsLinkSecurityEnabled (void) const |
| This method indicates whether or not link security is enabled for the message. More... | |
| void | SetLinkSecurityEnabled (bool aEnabled) |
| This method sets whether or not link security is enabled for the message. More... | |
| void | AddRss (int8_t aRss) |
| This method updates the average RSS (Received Signal Strength) associated with the message by adding the given RSS value to the average. More... | |
| int8_t | GetAverageRss (void) const |
| This method returns the average RSS (Received Signal Strength) associated with the message. More... | |
| const RssAverager & | GetRssAverager (void) const |
| This method returns a const reference to RssAverager of the message. More... | |
| uint16_t | UpdateChecksum (uint16_t aChecksum, uint16_t aOffset, uint16_t aLength) const |
| This method is used to update a checksum value. More... | |
| MessageQueue * | GetMessageQueue (void) const |
| This method returns a pointer to the message queue (if any) where this message is queued. More... | |
Public Member Functions inherited from ot::Buffer | |
| class Buffer * | GetNextBuffer (void) const |
| This method returns a pointer to the next message buffer. More... | |
| void | SetNextBuffer (class Buffer *buf) |
| This method sets the pointer to the next message buffer. | |
Static Public Member Functions | |
| static uint16_t | UpdateChecksum (uint16_t aChecksum, uint16_t aValue) |
| This static method updates a checksum. More... | |
| static uint16_t | UpdateChecksum (uint16_t aChecksum, const void *aBuf, uint16_t aLength) |
| This static method updates a checksum. More... | |
Friends | |
| class | MessagePool |
| class | MessageQueue |
| class | PriorityQueue |
Additional Inherited Members | |
Public Attributes inherited from otMessage | |
| struct otMessage * | mNext |
| A pointer to the next Message buffer. | |
This class represents a message.
| anonymous enum |
| anonymous enum |
| Enumerator | |
|---|---|
| kSubTypeNone | None. |
| kSubTypeMleAnnounce | MLE Announce. |
| kSubTypeMleDiscoverRequest | MLE Discover Request. |
| kSubTypeMleDiscoverResponse | MLE Discover Response. |
| kSubTypeJoinerEntrust | Joiner Entrust. |
| kSubTypeMplRetransmission | MPL next retransmission message. |
| kSubTypeMleGeneral | General MLE. |
| kSubTypeJoinerFinalizeResponse | Joiner Finalize Response. |
| kSubTypeMleChildUpdateRequest | MLE Child Update Request. |
| anonymous enum |
|
inline |
This method updates the average RSS (Received Signal Strength) associated with the message by adding the given RSS value to the average.
Note that a message can be composed of multiple 802.15.4 data frame fragments each received with a different signal strength.
| [in] | aRss | A new RSS value (in dBm) to be added to average. |
| otError ot::Message::Append | ( | const void * | aBuf, |
| uint16_t | aLength | ||
| ) |
This method appends bytes to the end of the message.
On success, this method grows the message by aLength bytes.
| [in] | aBuf | A pointer to a data buffer. |
| [in] | aLength | The number of bytes to append. |
| OT_ERROR_NONE | Successfully appended the bytes. |
| OT_ERROR_NO_BUFS | Insufficient available buffers to grow the message. |
| void ot::Message::ClearChildMask | ( | uint8_t | aChildIndex | ) |
This method unschedules forwarding of the message to the child.
| [in] | aChildIndex | The index into the child table. |
| Message * ot::Message::Clone | ( | uint16_t | aLength | ) | const |
This method creates a copy of the current Message.
It allocates the new one from the same Message Poll as the original Message and copies aLength octets of a payload.
The Type, SubType, LinkSecurity and Priority fields on the cloned message are also copied from the original one.
| [in] | aLength | Number of payload bytes to copy. |
|
inline |
| int ot::Message::CopyTo | ( | uint16_t | aSourceOffset, |
| uint16_t | aDestinationOffset, | ||
| uint16_t | aLength, | ||
| Message & | aMessage | ||
| ) | const |
This method copies bytes from one message to another.
| [in] | aSourceOffset | Byte offset within the source message to begin reading. |
| [in] | aDestinationOffset | Byte offset within the destination message to begin writing. |
| [in] | aLength | Number of bytes to copy. |
| [in] | aMessage | Message to copy to. |
|
inline |
This method returns the average RSS (Received Signal Strength) associated with the message.
|
inline |
This method returns the IEEE 802.15.4 Channel to use for transmission.
| bool ot::Message::GetChildMask | ( | uint8_t | aChildIndex | ) | const |
This method returns whether or not the message forwarding is scheduled for the child.
| [in] | aChildIndex | The index into the child table. |
| TRUE | If the message is scheduled to be forwarded to the child. |
| FALSE | If the message is not scheduled to be forwarded to the child. |
|
inline |
This method returns the datagram tag used for 6LoWPAN fragmentation.
|
inline |
This method returns whether or not message forwarding is scheduled for direct transmission.
| TRUE | If message forwarding is scheduled for direct transmission. |
| FALSE | If message forwarding is not scheduled for direct transmission. |
|
inline |
This method returns the interface ID.
|
inline |
This method returns the number of bytes in the message.
|
inline |
This method returns a pointer to the message queue (if any) where this message is queued.
| Message * ot::Message::GetNext | ( | void | ) | const |
This method returns a pointer to the next message in the same interface list.
|
inline |
This method returns the byte offset within the message.
|
inline |
This method returns the IEEE 802.15.4 Destination PAN ID.
|
inline |
This method returns the message priority level.
|
inline |
This method returns a const reference to RssAverager of the message.
|
inline |
This method returns the sub type of the message.
|
inline |
This method returns the timeout used for 6LoWPAN reassembly.
|
inline |
This method returns the type of the message.
| bool ot::Message::IsChildPending | ( | void | ) | const |
This method returns whether or not the message forwarding is scheduled for at least one child.
| TRUE | If message forwarding is scheduled for at least one child. |
| FALSE | If message forwarding is not scheduled for any child. |
|
inline |
This method indicates whether or not link security is enabled for the message.
| TRUE | If link security is enabled. |
| FALSE | If link security is not enabled. |
| bool ot::Message::IsSubTypeMle | ( | void | ) | const |
This method returns whether or not the message is of MLE subtype.
| TRUE | If message is of MLE subtype. |
| FLASE | If message is not of MLE subtype. |
| otError ot::Message::MoveOffset | ( | int | aDelta | ) |
This method moves the byte offset within the message.
| [in] | aDelta | The number of bytes to move the current offset, which may be positive or negative. |
| OT_ERROR_NONE | Successfully moved the byte offset. |
| OT_ERROR_INVALID_ARGS | The resulting byte offset is not within the existing message. |
| otError ot::Message::Prepend | ( | const void * | aBuf, |
| uint16_t | aLength | ||
| ) |
This method prepends bytes to the front of the message.
On success, this method grows the message by aLength bytes.
| [in] | aBuf | A pointer to a data buffer. |
| [in] | aLength | The number of bytes to prepend. |
| OT_ERROR_NONE | Successfully prepended the bytes. |
| OT_ERROR_NO_BUFS | Not enough reserved bytes in the message. |
| uint16_t ot::Message::Read | ( | uint16_t | aOffset, |
| uint16_t | aLength, | ||
| void * | aBuf | ||
| ) | const |
This method reads bytes from the message.
| [in] | aOffset | Byte offset within the message to begin reading. |
| [in] | aLength | Number of bytes to read. |
| [in] | aBuf | A pointer to a data buffer. |
| otError ot::Message::RemoveHeader | ( | uint16_t | aLength | ) |
This method removes header bytes from the message.
| [in] | aLength | Number of header bytes to remove. |
| OT_ERROR_NONE | Successfully removed header bytes from the message. |
|
inline |
This method sets the IEEE 802.15.4 Channel to use for transmission.
| [in] | aChannel | The IEEE 802.15.4 Channel to use for transmission. |
| void ot::Message::SetChildMask | ( | uint8_t | aChildIndex | ) |
This method schedules forwarding of the message to the child.
| [in] | aChildIndex | The index into the child table. |
|
inline |
This method sets the datagram tag used for 6LoWPAN fragmentation.
| [in] | aTag | The 6LoWPAN datagram tag. |
|
inline |
This method sets the interface ID.
| [in] | aInterfaceId | The interface ID value. |
| otError ot::Message::SetLength | ( | uint16_t | aLength | ) |
This method sets the number of bytes in the message.
| [in] | aLength | Requested number of bytes in the message. |
| OT_ERROR_NONE | Successfully set the length of the message. |
| OT_ERROR_NO_BUFS | Failed to grow the size of the message because insufficient buffers were available. |
|
inline |
This method sets whether or not link security is enabled for the message.
| [in] | aEnabled | TRUE if link security is enabled, FALSE otherwise. |
| otError ot::Message::SetOffset | ( | uint16_t | aOffset | ) |
This method sets the byte offset within the message.
| [in] | aOffset | The number of bytes to move the current offset, which may be positive or negative. |
| OT_ERROR_NONE | Successfully moved the byte offset. |
| OT_ERROR_INVALID_ARGS | The requested byte offset is not within the existing message. |
|
inline |
This method sets the IEEE 802.15.4 Destination PAN ID.
| [in] | aPanId | The IEEE 802.15.4 Destination PAN ID. |
| otError ot::Message::SetPriority | ( | uint8_t | aPriority | ) |
This method sets the messages priority.
If the message is already queued in a priority queue, changing the priority ensures to update the message in the associated queue.
| [in] | aPrority | The message priority level. |
| OT_ERROR_NONE | Successfully set the priority for the message. |
| OT_ERROR_INVALID_ARGS | Priority level is not invalid. |
|
inline |
This method sets the message sub type.
| [in] | aSubType | The message sub type. |
|
inline |
This method sets the timeout used for 6LoWPAN reassembly.
| [in] | aTimeout | The timeout value. |
|
inline |
This method sets the message type.
| [in] | aType | The message type. |
|
static |
This static method updates a checksum.
| [in] | aChecksum | The checksum value to update. |
| [in] | aValue | The 16-bit value to update aChecksum with. |
|
static |
This static method updates a checksum.
| [in] | aChecksum | The checksum value to update. |
| [in] | aBuf | A pointer to a buffer. |
| [in] | aLength | The number of bytes in aBuf. |
| uint16_t ot::Message::UpdateChecksum | ( | uint16_t | aChecksum, |
| uint16_t | aOffset, | ||
| uint16_t | aLength | ||
| ) | const |
This method is used to update a checksum value.
| [in] | aChecksum | Initial checksum value. |
| [in] | aOffset | Byte offset within the message to begin checksum computation. |
| [in] | aLength | Number of bytes to compute the checksum over. |
| The | updated checksum value. |
| int ot::Message::Write | ( | uint16_t | aOffset, |
| uint16_t | aLength, | ||
| const void * | aBuf | ||
| ) |
This method writes bytes to the message.
| [in] | aOffset | Byte offset within the message to begin writing. |
| [in] | aLength | Number of bytes to write. |
| [in] | aBuf | A pointer to a data buffer. |