0.01.00
message.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2016, The OpenThread Authors.
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions are met:
7  * 1. Redistributions of source code must retain the above copyright
8  * notice, this list of conditions and the following disclaimer.
9  * 2. Redistributions in binary form must reproduce the above copyright
10  * notice, this list of conditions and the following disclaimer in the
11  * documentation and/or other materials provided with the distribution.
12  * 3. Neither the name of the copyright holder nor the
13  * names of its contributors may be used to endorse or promote products
14  * derived from this software without specific prior written permission.
15  *
16  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
20  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26  * POSSIBILITY OF SUCH DAMAGE.
27  */
28 
35 #ifndef OPENTHREAD_MESSAGE_H_
36 #define OPENTHREAD_MESSAGE_H_
37 
38 #include <openthread/types.h>
39 
40 #ifdef __cplusplus
41 extern "C" {
42 #endif
43 
67 void otMessageFree(otMessage *aMessage);
68 
85 uint16_t otMessageGetLength(otMessage *aMessage);
86 
104 otError otMessageSetLength(otMessage *aMessage, uint16_t aLength);
105 
121 uint16_t otMessageGetOffset(otMessage *aMessage);
122 
140 otError otMessageSetOffset(otMessage *aMessage, uint16_t aOffset);
141 
152 
162 void otMessageSetDirectTransmission(otMessage *aMessage, bool aEnabled);
163 
170 int8_t otMessageGetRss(otMessage *aMessage);
171 
190 otError otMessageAppend(otMessage *aMessage, const void *aBuf, uint16_t aLength);
191 
210 int otMessageRead(otMessage *aMessage, uint16_t aOffset, void *aBuf, uint16_t aLength);
211 
230 int otMessageWrite(otMessage *aMessage, uint16_t aOffset, const void *aBuf, uint16_t aLength);
231 
235 typedef struct
236 {
237  void *mData;
239 
250 void otMessageQueueInit(otMessageQueue *aQueue);
251 
263 
275 
287 
297 
308 otMessage *otMessageQueueGetNext(otMessageQueue *aQueue, const otMessage *aMessage);
309 
317 OTAPI void OTCALL otMessageGetBufferInfo(otInstance *aInstance, otBufferInfo *aBufferInfo);
318 
324 #ifdef __cplusplus
325 } // extern "C"
326 #endif
327 
328 #endif // OPENTHREAD_MESSAGE_H_
This type represents all the static / global variables used by OpenThread allocated in one place...
Definition: openthread-instance.h:59
void otMessageQueueInit(otMessageQueue *aQueue)
Initialize the message queue.
Definition: message_api.cpp:115
This file defines the types and structures used in the OpenThread library API.
uint16_t otMessageGetLength(otMessage *aMessage)
Get the message length in bytes.
Definition: message_api.cpp:47
otError otMessageQueueEnqueueAtHead(otMessageQueue *aQueue, otMessage *aMessage)
This function adds a message at the head/front of the given message queue.
Definition: message_api.cpp:127
This structure represents the message buffer information.
Definition: types.h:1061
otError otMessageAppend(otMessage *aMessage, const void *aBuf, uint16_t aLength)
Append bytes to a message.
Definition: message_api.cpp:97
int otMessageWrite(otMessage *aMessage, uint16_t aOffset, const void *aBuf, uint16_t aLength)
Write bytes to a message.
Definition: message_api.cpp:109
This type points to an OpenThread message buffer.
Definition: types.h:479
otMessage * otMessageQueueGetHead(otMessageQueue *aQueue)
This function returns a pointer to the message at the head of the queue.
Definition: message_api.cpp:141
void * mData
Opaque data used by the implementation.
Definition: message.h:237
otError otMessageSetOffset(otMessage *aMessage, uint16_t aOffset)
Set the message offset in bytes.
Definition: message_api.cpp:65
otError otMessageQueueDequeue(otMessageQueue *aQueue, otMessage *aMessage)
This function removes a message from the given message queue.
Definition: message_api.cpp:134
OTAPI void OTCALL otMessageGetBufferInfo(otInstance *aInstance, otBufferInfo *aBufferInfo)
Get the Message Buffer information.
Definition: message_api.cpp:161
int8_t otMessageGetRss(otMessage *aMessage)
This function returns the average RSS (received signal strength) associated with the message...
Definition: message_api.cpp:91
otMessage * otMessageQueueGetNext(otMessageQueue *aQueue, const otMessage *aMessage)
This function returns a pointer to the next message in the queue by iterating forward (from head to t...
Definition: message_api.cpp:147
int otMessageRead(otMessage *aMessage, uint16_t aOffset, void *aBuf, uint16_t aLength)
Read bytes from a message.
Definition: message_api.cpp:103
void otMessageFree(otMessage *aMessage)
Free an allocated message buffer.
Definition: message_api.cpp:42
otError otMessageSetLength(otMessage *aMessage, uint16_t aLength)
Set the message length in bytes.
Definition: message_api.cpp:53
#define OTCALL
Compiler-specific modifier to export functions in a DLL.
Definition: toolchain.h:217
#define OTAPI
Compiler-specific modifier for public API declarations.
Definition: toolchain.h:216
void otMessageSetDirectTransmission(otMessage *aMessage, bool aEnabled)
This function sets/forces the message to be forwarded using direct transmission.
Definition: message_api.cpp:77
uint16_t otMessageGetOffset(otMessage *aMessage)
Get the message offset in bytes.
Definition: message_api.cpp:59
otError otMessageQueueEnqueue(otMessageQueue *aQueue, otMessage *aMessage)
This function adds a message to the end of the given message queue.
Definition: message_api.cpp:120
bool otMessageIsLinkSecurityEnabled(otMessage *aMessage)
This function indicates whether or not link security is enabled for the message.
Definition: message_api.cpp:71
otError
This enumeration represents error codes used throughout OpenThread.
Definition: types.h:107
This structure represents an OpenThread message queue.
Definition: message.h:235