mirror of
https://github.com/espressif/openthread.git
synced 2026-09-08 18:20:06 +00:00
Change otMessage type to not hide pointer. (#1416)
This commit is contained in:
@@ -154,7 +154,7 @@ typedef struct otCoapHeader
|
||||
* @retval kThreadError_ResponseTimeout No response or acknowledgment received during timeout period.
|
||||
*
|
||||
*/
|
||||
typedef void (*otCoapResponseHandler)(void *aContext, otCoapHeader *aHeader, otMessage aMessage,
|
||||
typedef void (*otCoapResponseHandler)(void *aContext, otCoapHeader *aHeader, otMessage *aMessage,
|
||||
const otMessageInfo *aMessageInfo, ThreadError aResult);
|
||||
|
||||
/**
|
||||
@@ -166,7 +166,7 @@ typedef void (*otCoapResponseHandler)(void *aContext, otCoapHeader *aHeader, otM
|
||||
* @param[in] aMessageInfo A pointer to the message info for @p aMessage.
|
||||
*
|
||||
*/
|
||||
typedef void (*otCoapRequestHandler)(void *aContext, otCoapHeader *aHeader, otMessage aMessage,
|
||||
typedef void (*otCoapRequestHandler)(void *aContext, otCoapHeader *aHeader, otMessage *aMessage,
|
||||
const otMessageInfo *aMessageInfo);
|
||||
|
||||
/**
|
||||
@@ -372,7 +372,7 @@ const otCoapOption *otCoapHeaderGetNextOption(otCoapHeader *aHeader);
|
||||
* @returns A pointer to the message or NULL if failed to allocate message.
|
||||
*
|
||||
*/
|
||||
otMessage otCoapNewMessage(otInstance *aInstance, const otCoapHeader *aHeader);
|
||||
otMessage *otCoapNewMessage(otInstance *aInstance, const otCoapHeader *aHeader);
|
||||
|
||||
/**
|
||||
* This function sends a CoAP request.
|
||||
@@ -390,7 +390,7 @@ otMessage otCoapNewMessage(otInstance *aInstance, const otCoapHeader *aHeader);
|
||||
* @retval kThreadError_NoBufs Failed to allocate retransmission data.
|
||||
*
|
||||
*/
|
||||
ThreadError otCoapSendRequest(otInstance *aInstance, otMessage aMessage, const otMessageInfo *aMessageInfo,
|
||||
ThreadError otCoapSendRequest(otInstance *aInstance, otMessage *aMessage, const otMessageInfo *aMessageInfo,
|
||||
otCoapResponseHandler aHandler, void *aContext);
|
||||
|
||||
/**
|
||||
@@ -456,7 +456,7 @@ void otCoapServerRemoveResource(otInstance *aInstance, otCoapResource *aResource
|
||||
* @retval kThreadError_NoBufs Insufficient buffers available to send the CoAP response.
|
||||
*
|
||||
*/
|
||||
ThreadError otCoapSendResponse(otInstance *aInstance, otMessage aMessage, const otMessageInfo *aMessageInfo);
|
||||
ThreadError otCoapSendResponse(otInstance *aInstance, otMessage *aMessage, const otMessageInfo *aMessageInfo);
|
||||
#endif // OPENTHREAD_ENABLE_APPLICATION_COAP
|
||||
|
||||
/**
|
||||
|
||||
@@ -96,7 +96,7 @@ ThreadError otIcmp6RegisterHandler(otInstance *aInstance, otIcmp6Handler *aHandl
|
||||
* May be zero.
|
||||
*
|
||||
*/
|
||||
ThreadError otIcmp6SendEchoRequest(otInstance *aInstance, otMessage aMessage,
|
||||
ThreadError otIcmp6SendEchoRequest(otInstance *aInstance, otMessage *aMessage,
|
||||
const otMessageInfo *aMessageInfo, uint16_t aIdentifier);
|
||||
|
||||
/**
|
||||
|
||||
@@ -241,7 +241,7 @@ ThreadError otIp6CreateSemanticallyOpaqueIid(otInstance *aInstance, otNetifAddre
|
||||
*
|
||||
* @sa otFreeMessage
|
||||
*/
|
||||
otMessage otIp6NewMessage(otInstance *aInstance, bool aLinkSecurityEnabled);
|
||||
otMessage *otIp6NewMessage(otInstance *aInstance, bool aLinkSecurityEnabled);
|
||||
|
||||
/**
|
||||
* This function pointer is called when an IPv6 datagram is received.
|
||||
@@ -250,7 +250,7 @@ otMessage otIp6NewMessage(otInstance *aInstance, bool aLinkSecurityEnabled);
|
||||
* @param[in] aContext A pointer to application-specific context.
|
||||
*
|
||||
*/
|
||||
typedef void (*otIp6ReceiveCallback)(otMessage aMessage, void *aContext);
|
||||
typedef void (*otIp6ReceiveCallback)(otMessage *aMessage, void *aContext);
|
||||
|
||||
/**
|
||||
* This function registers a callback to provide received IPv6 datagrams.
|
||||
@@ -303,7 +303,7 @@ void otIp6SetReceiveFilterEnabled(otInstance *aInstance, bool aEnabled);
|
||||
* @param[in] aMessage A pointer to the message buffer containing the IPv6 datagram.
|
||||
*
|
||||
*/
|
||||
ThreadError otIp6Send(otInstance *aInstance, otMessage aMessage);
|
||||
ThreadError otIp6Send(otInstance *aInstance, otMessage *aMessage);
|
||||
|
||||
/**
|
||||
* This function adds a port to the allowed unsecured port list.
|
||||
|
||||
@@ -66,7 +66,7 @@ extern "C" {
|
||||
* @sa otMessageRead
|
||||
* @sa otMessageWrite
|
||||
*/
|
||||
ThreadError otMessageFree(otMessage aMessage);
|
||||
ThreadError otMessageFree(otMessage *aMessage);
|
||||
|
||||
/**
|
||||
* Get the message length in bytes.
|
||||
@@ -84,7 +84,7 @@ ThreadError otMessageFree(otMessage aMessage);
|
||||
* @sa otMessageWrite
|
||||
* @sa otMessageSetLength
|
||||
*/
|
||||
uint16_t otMessageGetLength(otMessage aMessage);
|
||||
uint16_t otMessageGetLength(otMessage *aMessage);
|
||||
|
||||
/**
|
||||
* Set the message length in bytes.
|
||||
@@ -103,7 +103,7 @@ uint16_t otMessageGetLength(otMessage aMessage);
|
||||
* @sa otMessageRead
|
||||
* @sa otMessageWrite
|
||||
*/
|
||||
ThreadError otMessageSetLength(otMessage aMessage, uint16_t aLength);
|
||||
ThreadError otMessageSetLength(otMessage *aMessage, uint16_t aLength);
|
||||
|
||||
/**
|
||||
* Get the message offset in bytes.
|
||||
@@ -120,7 +120,7 @@ ThreadError otMessageSetLength(otMessage aMessage, uint16_t aLength);
|
||||
* @sa otMessageRead
|
||||
* @sa otMessageWrite
|
||||
*/
|
||||
uint16_t otMessageGetOffset(otMessage aMessage);
|
||||
uint16_t otMessageGetOffset(otMessage *aMessage);
|
||||
|
||||
/**
|
||||
* Set the message offset in bytes.
|
||||
@@ -139,7 +139,7 @@ uint16_t otMessageGetOffset(otMessage aMessage);
|
||||
* @sa otMessageRead
|
||||
* @sa otMessageWrite
|
||||
*/
|
||||
ThreadError otMessageSetOffset(otMessage aMessage, uint16_t aOffset);
|
||||
ThreadError otMessageSetOffset(otMessage *aMessage, uint16_t aOffset);
|
||||
|
||||
/**
|
||||
* This function indicates whether or not link security is enabled for the message.
|
||||
@@ -150,7 +150,7 @@ ThreadError otMessageSetOffset(otMessage aMessage, uint16_t aOffset);
|
||||
* @retval FALSE If link security is not enabled.
|
||||
*
|
||||
*/
|
||||
bool otMessageIsLinkSecurityEnabled(otMessage aMessage);
|
||||
bool otMessageIsLinkSecurityEnabled(otMessage *aMessage);
|
||||
|
||||
/**
|
||||
* This function sets/forces the message to be forwarded using direct transmission.
|
||||
@@ -161,7 +161,7 @@ bool otMessageIsLinkSecurityEnabled(otMessage aMessage);
|
||||
* follow the normal procedure.
|
||||
*
|
||||
*/
|
||||
void otMessageSetDirectTransmission(otMessage aMessage, bool aEnabled);
|
||||
void otMessageSetDirectTransmission(otMessage *aMessage, bool aEnabled);
|
||||
|
||||
/**
|
||||
* Append bytes to a message.
|
||||
@@ -181,7 +181,7 @@ void otMessageSetDirectTransmission(otMessage aMessage, bool aEnabled);
|
||||
* @sa otMessageRead
|
||||
* @sa otMessageWrite
|
||||
*/
|
||||
ThreadError otMessageAppend(otMessage aMessage, const void *aBuf, uint16_t aLength);
|
||||
ThreadError otMessageAppend(otMessage *aMessage, const void *aBuf, uint16_t aLength);
|
||||
|
||||
/**
|
||||
* Read bytes from a message.
|
||||
@@ -201,7 +201,7 @@ ThreadError otMessageAppend(otMessage aMessage, const void *aBuf, uint16_t aLeng
|
||||
* @sa otMessageSetOffset
|
||||
* @sa otMessageWrite
|
||||
*/
|
||||
int otMessageRead(otMessage aMessage, uint16_t aOffset, void *aBuf, uint16_t aLength);
|
||||
int otMessageRead(otMessage *aMessage, uint16_t aOffset, void *aBuf, uint16_t aLength);
|
||||
|
||||
/**
|
||||
* Write bytes to a message.
|
||||
@@ -221,7 +221,7 @@ int otMessageRead(otMessage aMessage, uint16_t aOffset, void *aBuf, uint16_t aLe
|
||||
* @sa otMessageSetOffset
|
||||
* @sa otMessageRead
|
||||
*/
|
||||
int otMessageWrite(otMessage aMessage, uint16_t aOffset, const void *aBuf, uint16_t aLength);
|
||||
int otMessageWrite(otMessage *aMessage, uint16_t aOffset, const void *aBuf, uint16_t aLength);
|
||||
|
||||
/**
|
||||
* This structure represents an OpenThread message queue.
|
||||
@@ -254,7 +254,7 @@ void otMessageQueueInit(otMessageQueue *aQueue);
|
||||
* @retval kThreadError_Already The message is already enqueued in a queue.
|
||||
*
|
||||
*/
|
||||
ThreadError otMessageQueueEnqueue(otMessageQueue *aQueue, otMessage aMessage);
|
||||
ThreadError otMessageQueueEnqueue(otMessageQueue *aQueue, otMessage *aMessage);
|
||||
|
||||
/**
|
||||
* This function removes a message from the given message queue.
|
||||
@@ -266,7 +266,7 @@ ThreadError otMessageQueueEnqueue(otMessageQueue *aQueue, otMessage aMessage);
|
||||
* @retval kThreadError_NotFound The message is not enqueued in this queue.
|
||||
*
|
||||
*/
|
||||
ThreadError otMessageQueueDequeue(otMessageQueue *aQueue, otMessage aMessage);
|
||||
ThreadError otMessageQueueDequeue(otMessageQueue *aQueue, otMessage *aMessage);
|
||||
|
||||
/**
|
||||
* This function returns a pointer to the message at the head of the queue.
|
||||
@@ -276,7 +276,7 @@ ThreadError otMessageQueueDequeue(otMessageQueue *aQueue, otMessage aMessage);
|
||||
* @returns A pointer to the message at the head of queue or NULL if queue is empty.
|
||||
*
|
||||
*/
|
||||
otMessage otMessageQueueGetHead(otMessageQueue *aQueue);
|
||||
otMessage *otMessageQueueGetHead(otMessageQueue *aQueue);
|
||||
|
||||
/**
|
||||
* This function returns a pointer to the next message in the queue by iterating forward (from head to tail).
|
||||
@@ -288,7 +288,7 @@ otMessage otMessageQueueGetHead(otMessageQueue *aQueue);
|
||||
* NULL is returned if `aMessage` is not in the queue `aQueue`.
|
||||
*
|
||||
*/
|
||||
otMessage otMessageQueueGetNext(otMessageQueue *aQueue, const otMessage aMessage);
|
||||
otMessage *otMessageQueueGetNext(otMessageQueue *aQueue, const otMessage *aMessage);
|
||||
|
||||
/**
|
||||
* Get the Message Buffer information.
|
||||
|
||||
@@ -39,6 +39,8 @@
|
||||
|
||||
#include "openthread/types.h"
|
||||
|
||||
#include "openthread/message.h"
|
||||
|
||||
/**
|
||||
* @defgroup messagepool MessagePool
|
||||
* @ingroup platform
|
||||
@@ -50,15 +52,6 @@
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* This structure contains a pointer to the next Message buffer.
|
||||
*
|
||||
*/
|
||||
struct BufferHeader
|
||||
{
|
||||
struct BufferHeader *mNext; ///< A pointer to the next Message buffer.
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
@@ -78,7 +71,7 @@ void otPlatMessagePoolInit(uint16_t aMinNumFreeBuffers, size_t aBufferSize);
|
||||
* @returns A pointer to the Buffer or NULL if no Buffers are available.
|
||||
*
|
||||
*/
|
||||
struct BufferHeader *otPlatMessagePoolNew(void);
|
||||
otMessage *otPlatMessagePoolNew(void);
|
||||
|
||||
/**
|
||||
* This function is used to free a Buffer back to the platform managed buffer pool.
|
||||
@@ -86,7 +79,7 @@ struct BufferHeader *otPlatMessagePoolNew(void);
|
||||
* @param[in] aBuffer The Buffer to free.
|
||||
*
|
||||
*/
|
||||
void otPlatMessagePoolFree(struct BufferHeader *aBuffer);
|
||||
void otPlatMessagePoolFree(otMessage *aBuffer);
|
||||
|
||||
/**
|
||||
* Get the number of free buffers.
|
||||
|
||||
@@ -848,7 +848,7 @@ OTAPI ThreadError OTCALL otThreadGetParentAverageRssi(otInstance *aInstance, int
|
||||
* @param[in] aContext A pointer to application-specific context.
|
||||
*
|
||||
*/
|
||||
typedef void (*otReceiveDiagnosticGetCallback)(otMessage aMessage, const otMessageInfo *aMessageInfo,
|
||||
typedef void (*otReceiveDiagnosticGetCallback)(otMessage *aMessage, const otMessageInfo *aMessageInfo,
|
||||
void *aContext);
|
||||
|
||||
/**
|
||||
|
||||
@@ -347,7 +347,10 @@ typedef struct otMessageInfo
|
||||
/**
|
||||
* This type points to an OpenThread message buffer.
|
||||
*/
|
||||
typedef void *otMessage;
|
||||
typedef struct otMessage
|
||||
{
|
||||
struct otMessage *mNext; ///< A pointer to the next Message buffer.
|
||||
} otMessage;
|
||||
|
||||
/**
|
||||
* @addtogroup commands Commands
|
||||
@@ -1040,7 +1043,7 @@ typedef struct otIcmp6Header otIcmp6Header;
|
||||
* @param[in] aIcmpHeader A pointer to the received ICMPv6 header.
|
||||
*
|
||||
*/
|
||||
typedef void (*otIcmp6ReceiveCallback)(void *aContext, otMessage aMessage, const otMessageInfo *aMessageInfo,
|
||||
typedef void (*otIcmp6ReceiveCallback)(void *aContext, otMessage *aMessage, const otMessageInfo *aMessageInfo,
|
||||
const otIcmp6Header *aIcmpHeader);
|
||||
|
||||
/**
|
||||
|
||||
@@ -56,7 +56,7 @@ extern "C" {
|
||||
* This callback allows OpenThread to inform the application of a received UDP message.
|
||||
*
|
||||
*/
|
||||
typedef void (*otUdpReceive)(void *aContext, otMessage aMessage, const otMessageInfo *aMessageInfo);
|
||||
typedef void (*otUdpReceive)(void *aContext, otMessage *aMessage, const otMessageInfo *aMessageInfo);
|
||||
|
||||
/**
|
||||
* This structure represents a UDP socket.
|
||||
@@ -83,7 +83,7 @@ typedef struct otUdpSocket
|
||||
* @sa otFreeMessage
|
||||
*
|
||||
*/
|
||||
otMessage otUdpNewMessage(otInstance *aInstance, bool aLinkSecurityEnabled);
|
||||
otMessage *otUdpNewMessage(otInstance *aInstance, bool aLinkSecurityEnabled);
|
||||
|
||||
/**
|
||||
* Open a UDP/IPv6 socket.
|
||||
@@ -149,7 +149,7 @@ ThreadError otUdpBind(otUdpSocket *aSocket, otSockAddr *aSockName);
|
||||
* @sa otUdpSend
|
||||
*
|
||||
*/
|
||||
ThreadError otUdpSend(otUdpSocket *aSocket, otMessage aMessage, const otMessageInfo *aMessageInfo);
|
||||
ThreadError otUdpSend(otUdpSocket *aSocket, otMessage *aMessage, const otMessageInfo *aMessageInfo);
|
||||
|
||||
/**
|
||||
* @}
|
||||
|
||||
Reference in New Issue
Block a user