![]() |
![]() |
OpenThread
1.05.03.02
|
This module includes functions that control CoAP communication. More...
Data Structures | |
struct | otCoapBlockwiseResource |
struct | otCoapOption |
struct | otCoapOptionIterator |
struct | otCoapResource |
struct | otCoapTxParameters |
Macros | |
#define | OT_COAP_CODE(c, d) ((((c)&0x7) << 5) | ((d)&0x1f)) |
#define | OT_COAP_DEFAULT_TOKEN_LENGTH 2 |
Default token length. More... | |
#define | OT_COAP_MAX_RETRANSMIT 20 |
Max retransmit supported by OpenThread. More... | |
#define | OT_COAP_MAX_TOKEN_LENGTH 8 |
Max token length as specified (RFC 7252). More... | |
#define | OT_COAP_MIN_ACK_TIMEOUT 1000 |
Minimal ACK timeout in milliseconds supported by OpenThread. More... | |
#define | OT_DEFAULT_COAP_PORT 5683 |
Default CoAP port, as specified in RFC 7252. More... | |
Typedefs | |
typedef enum otCoapBlockSzx | otCoapBlockSzx |
typedef otError(* | otCoapBlockwiseReceiveHook) (void *aContext, const uint8_t *aBlock, uint32_t aPosition, uint16_t aBlockLength, bool aMore, uint32_t aTotalLength) |
typedef struct otCoapBlockwiseResource | otCoapBlockwiseResource |
typedef otError(* | otCoapBlockwiseTransmitHook) (void *aContext, uint8_t *aBlock, uint32_t aPosition, uint16_t *aBlockLength, bool *aMore) |
typedef enum otCoapCode | otCoapCode |
typedef struct otCoapOption | otCoapOption |
typedef enum otCoapOptionContentFormat | otCoapOptionContentFormat |
typedef struct otCoapOptionIterator | otCoapOptionIterator |
typedef enum otCoapOptionType | otCoapOptionType |
typedef void(* | otCoapRequestHandler) (void *aContext, otMessage *aMessage, const otMessageInfo *aMessageInfo) |
typedef struct otCoapResource | otCoapResource |
typedef void(* | otCoapResponseHandler) (void *aContext, otMessage *aMessage, const otMessageInfo *aMessageInfo, otError aResult) |
typedef struct otCoapTxParameters | otCoapTxParameters |
typedef enum otCoapType | otCoapType |
This module includes functions that control CoAP communication.
The functions in this module are available when CoAP API feature (OPENTHREAD_CONFIG_COAP_API_ENABLE
) is enabled.
#define OT_DEFAULT_COAP_PORT 5683 |
Default CoAP port, as specified in RFC 7252.
#define OT_COAP_DEFAULT_TOKEN_LENGTH 2 |
Default token length.
#define OT_COAP_MAX_TOKEN_LENGTH 8 |
Max token length as specified (RFC 7252).
#define OT_COAP_MAX_RETRANSMIT 20 |
Max retransmit supported by OpenThread.
Referenced by TxParameters::IsValid().
#define OT_COAP_MIN_ACK_TIMEOUT 1000 |
Minimal ACK timeout in milliseconds supported by OpenThread.
Referenced by TxParameters::IsValid().
#define OT_COAP_CODE | ( | c, | |
d | |||
) | ((((c)&0x7) << 5) | ((d)&0x1f)) |
Helper macro to define CoAP Code values.
typedef enum otCoapType otCoapType |
CoAP Type values (2 bit unsigned integer).
typedef enum otCoapCode otCoapCode |
CoAP Code values.
typedef enum otCoapOptionType otCoapOptionType |
CoAP Option Numbers
typedef struct otCoapOption otCoapOption |
This structure represents a CoAP option.
typedef struct otCoapOptionIterator otCoapOptionIterator |
This structure acts as an iterator for CoAP options
typedef enum otCoapOptionContentFormat otCoapOptionContentFormat |
CoAP Content Format codes. The full list is documented at https://www.iana.org/assignments/core-parameters/core-parameters.xhtml#content-formats
typedef enum otCoapBlockSzx otCoapBlockSzx |
CoAP Block Size Exponents
typedef void(* otCoapResponseHandler) (void *aContext, otMessage *aMessage, const otMessageInfo *aMessageInfo, otError aResult) |
This function pointer is called when a CoAP response is received or on the request timeout.
[in] | aContext | A pointer to application-specific context. |
[in] | aMessage | A pointer to the message buffer containing the response. NULL if no response was received. |
[in] | aMessageInfo | A pointer to the message info for aMessage . NULL if no response was received. |
[in] | aResult | A result of the CoAP transaction. |
OT_ERROR_NONE | A response was received successfully. |
OT_ERROR_ABORT | A CoAP transaction was reset by peer. |
OT_ERROR_RESPONSE_TIMEOUT | No response or acknowledgment received during timeout period. |
typedef void(* otCoapRequestHandler) (void *aContext, otMessage *aMessage, const otMessageInfo *aMessageInfo) |
This function pointer is called when a CoAP request with a given Uri-Path is received.
[in] | aContext | A pointer to arbitrary context information. |
[in] | aMessage | A pointer to the message. |
[in] | aMessageInfo | A pointer to the message info for aMessage . |
typedef otError(* otCoapBlockwiseReceiveHook) (void *aContext, const uint8_t *aBlock, uint32_t aPosition, uint16_t aBlockLength, bool aMore, uint32_t aTotalLength) |
This function pointer is called when a CoAP message with an block-wise transfer option is received.
This function is available when OPENTHREAD_CONFIG_COAP_BLOCKWISE_TRANSFER_ENABLE configuration is enabled.
[in] | aContext | A pointer to application-specific context. |
[in] | aBlock | A pointer to the block segment. |
[in] | aPosition | The position of aBlock in a sequence in bytes. |
[in] | aBlockLength | The length of the block segment in bytes. |
[in] | aMore | Flag if more block segments are following. |
[in] | aTotalLength | The total length in bytes of the transferred information (indicated by a Size1 or Size2 option). |
OT_ERROR_NONE | Block segment was stored successfully. |
OT_ERROR_NO_BUFS | No more memory to store blocks. |
OT_ERROR_NO_FRAME_RECEIVED | Block segment missing. |
typedef otError(* otCoapBlockwiseTransmitHook) (void *aContext, uint8_t *aBlock, uint32_t aPosition, uint16_t *aBlockLength, bool *aMore) |
This function pointer is called before the next block in a block-wise transfer is sent.
This function is available when OPENTHREAD_CONFIG_COAP_BLOCKWISE_TRANSFER_ENABLE configuration is enabled.
[in] | aContext | A pointer to application-specific context. |
[in,out] | aBlock | A pointer to where the block segment can be written to. |
[in] | aPosition | The position in a sequence from which to obtain the block segment. |
[in,out] | aBlockLength | On entry, the maximum block segment length in bytes. |
[out] | aMore | A pointer to the flag if more block segments will follow. |
OT_ERROR_NONE | No error occurred. |
OT_ERROR_INVALID_ARGS | Block at aPosition does not exist. |
typedef struct otCoapResource otCoapResource |
This structure represents a CoAP resource.
typedef struct otCoapBlockwiseResource otCoapBlockwiseResource |
This structure represents a CoAP resource with block-wise transfer.
typedef struct otCoapTxParameters otCoapTxParameters |
This structure represents the CoAP transmission parameters.
enum otCoapType |
enum otCoapCode |
CoAP Code values.
enum otCoapOptionType |
CoAP Option Numbers
CoAP Content Format codes. The full list is documented at https://www.iana.org/assignments/core-parameters/core-parameters.xhtml#content-formats
enum otCoapBlockSzx |
void otCoapMessageInit | ( | otMessage * | aMessage, |
otCoapType | aType, | ||
otCoapCode | aCode | ||
) |
This function initializes the CoAP header.
[in,out] | aMessage | A pointer to the CoAP message to initialize. |
[in] | aType | CoAP message type. |
[in] | aCode | CoAP message code. |
otError otCoapMessageInitResponse | ( | otMessage * | aResponse, |
const otMessage * | aRequest, | ||
otCoapType | aType, | ||
otCoapCode | aCode | ||
) |
This function initializes a response message.
aRequest
.[in,out] | aResponse | A pointer to the CoAP response message. |
[in] | aRequest | A pointer to the CoAP request message. |
[in] | aType | CoAP message type. |
[in] | aCode | CoAP message code. |
OT_ERROR_NONE | Successfully initialized the response message. |
OT_ERROR_NO_BUFS | Insufficient message buffers available to initialize the response message. |
otError otCoapMessageSetToken | ( | otMessage * | aMessage, |
const uint8_t * | aToken, | ||
uint8_t | aTokenLength | ||
) |
This function sets the Token value and length in a header.
[in,out] | aMessage | A pointer to the CoAP message. |
[in] | aToken | A pointer to the Token value. |
[in] | aTokenLength | The Length of aToken . |
OT_ERROR_NONE | Successfully set the Token value. |
OT_ERROR_NO_BUFS | Insufficient buffers to set the Token value. |
void otCoapMessageGenerateToken | ( | otMessage * | aMessage, |
uint8_t | aTokenLength | ||
) |
This function sets the Token length and randomizes its value.
[in,out] | aMessage | A pointer to the CoAP message. |
[in] | aTokenLength | The Length of a Token to set. |
otError otCoapMessageAppendContentFormatOption | ( | otMessage * | aMessage, |
otCoapOptionContentFormat | aContentFormat | ||
) |
This function appends the Content Format CoAP option as specified in https://tools.ietf.org/html/rfc7252#page-92. This must be called before setting otCoapMessageSetPayloadMarker if a payload is to be included in the message.
The function is a convenience wrapper around otCoapMessageAppendUintOption, and if the desired format type code isn't listed in otCoapOptionContentFormat, this base function should be used instead.
[in,out] | aMessage | A pointer to the CoAP message. |
[in] | aContentFormat | One of the content formats listed in otCoapOptionContentFormat above. |
OT_ERROR_NONE | Successfully appended the option. |
OT_ERROR_INVALID_ARGS | The option type is not equal or greater than the last option type. |
OT_ERROR_NO_BUFS | The option length exceeds the buffer size. |
otError otCoapMessageAppendOption | ( | otMessage * | aMessage, |
uint16_t | aNumber, | ||
uint16_t | aLength, | ||
const void * | aValue | ||
) |
This function appends a CoAP option in a header.
[in,out] | aMessage | A pointer to the CoAP message. |
[in] | aNumber | The CoAP Option number. |
[in] | aLength | The CoAP Option length. |
[in] | aValue | A pointer to the CoAP value. |
OT_ERROR_NONE | Successfully appended the option. |
OT_ERROR_INVALID_ARGS | The option type is not equal or greater than the last option type. |
OT_ERROR_NO_BUFS | The option length exceeds the buffer size. |
This function appends an unsigned integer CoAP option as specified in https://tools.ietf.org/html/rfc7252#section-3.2
[in,out] | aMessage | A pointer to the CoAP message. |
[in] | aNumber | The CoAP Option number. |
[in] | aValue | The CoAP Option unsigned integer value. |
OT_ERROR_NONE | Successfully appended the option. |
OT_ERROR_INVALID_ARGS | The option type is not equal or greater than the last option type. |
OT_ERROR_NO_BUFS | The option length exceeds the buffer size. |
This function appends an Observe option.
[in,out] | aMessage | A pointer to the CoAP message. |
[in] | aObserve | Observe field value. |
OT_ERROR_NONE | Successfully appended the option. |
OT_ERROR_INVALID_ARGS | The option type is not equal or greater than the last option type. |
OT_ERROR_NO_BUFS | The option length exceeds the buffer size. |
This function appends a Uri-Path option.
[in,out] | aMessage | A pointer to the CoAP message. |
[in] | aUriPath | A pointer to a NULL-terminated string. |
OT_ERROR_NONE | Successfully appended the option. |
OT_ERROR_INVALID_ARGS | The option type is not equal or greater than the last option type. |
OT_ERROR_NO_BUFS | The option length exceeds the buffer size. |
uint16_t otCoapBlockSizeFromExponent | ( | otCoapBlockSzx | aSize | ) |
This function converts a CoAP Block option SZX field to the actual block size
[in] | aSize | Block size exponent. |
Referenced by CoapBase::DequeueMessage(), and CoapBase::SendMessage().
otError otCoapMessageAppendBlock2Option | ( | otMessage * | aMessage, |
uint32_t | aNum, | ||
bool | aMore, | ||
otCoapBlockSzx | aSize | ||
) |
This function appends a Block2 option
[in,out] | aMessage | A pointer to the CoAP message. |
[in] | aNum | Current block number. |
[in] | aMore | Boolean to indicate more blocks are to be sent. |
[in] | aSize | Block Size Exponent. |
OT_ERROR_NONE | Successfully appended the option. |
OT_ERROR_INVALID_ARGS | The option type is not equal or greater than the last option type. |
OT_ERROR_NO_BUFS | The option length exceeds the buffer size. |
otError otCoapMessageAppendBlock1Option | ( | otMessage * | aMessage, |
uint32_t | aNum, | ||
bool | aMore, | ||
otCoapBlockSzx | aSize | ||
) |
This function appends a Block1 option
[in,out] | aMessage | A pointer to the CoAP message. |
[in] | aNum | Current block number. |
[in] | aMore | Boolean to indicate more blocks are to be sent. |
[in] | aSize | Block Size Exponent. |
OT_ERROR_NONE | Successfully appended the option. |
OT_ERROR_INVALID_ARGS | The option type is not equal or greater than the last option type. |
OT_ERROR_NO_BUFS | The option length exceeds the buffer size. |
This function appends a Proxy-Uri option.
[in,out] | aMessage | A pointer to the CoAP message. |
[in] | aUriPath | A pointer to a NULL-terminated string. |
OT_ERROR_NONE | Successfully appended the option. |
OT_ERROR_INVALID_ARGS | The option type is not equal or greater than the last option type. |
OT_ERROR_NO_BUFS | The option length exceeds the buffer size. |
This function appends a Max-Age option.
[in,out] | aMessage | A pointer to the CoAP message. |
[in] | aMaxAge | The Max-Age value. |
OT_ERROR_NONE | Successfully appended the option. |
OT_ERROR_INVALID_ARGS | The option type is not equal or greater than the last option type. |
OT_ERROR_NO_BUFS | The option length exceeds the buffer size. |
This function appends a single Uri-Query option.
[in,out] | aMessage | A pointer to the CoAP message. |
[in] | aUriQuery | A pointer to NULL-terminated string, which should contain a single key=value pair. |
OT_ERROR_NONE | Successfully appended the option. |
OT_ERROR_INVALID_ARGS | The option type is not equal or greater than the last option type. |
OT_ERROR_NO_BUFS | The option length exceeds the buffer size. |
This function adds Payload Marker indicating beginning of the payload to the CoAP header.
[in,out] | aMessage | A pointer to the CoAP message. |
OT_ERROR_NONE | Payload Marker successfully added. |
OT_ERROR_NO_BUFS | Header Payload Marker exceeds the buffer size. |
otCoapType otCoapMessageGetType | ( | const otMessage * | aMessage | ) |
This function returns the Type value.
[in] | aMessage | A pointer to the CoAP message. |
otCoapCode otCoapMessageGetCode | ( | const otMessage * | aMessage | ) |
This function returns the Code value.
[in] | aMessage | A pointer to the CoAP message. |
void otCoapMessageSetCode | ( | otMessage * | aMessage, |
otCoapCode | aCode | ||
) |
This function sets the Code value.
[in,out] | aMessage | A pointer to the CoAP message to initialize. |
[in] | aCode | CoAP message code. |
const char* otCoapMessageCodeToString | ( | const otMessage * | aMessage | ) |
This method returns the CoAP Code as human readable string.
[in] | aMessage | A pointer to the CoAP message. |
@ returns The CoAP Code as string.
uint16_t otCoapMessageGetMessageId | ( | const otMessage * | aMessage | ) |
This function returns the Message ID value.
[in] | aMessage | A pointer to the CoAP message. |
uint8_t otCoapMessageGetTokenLength | ( | const otMessage * | aMessage | ) |
This function returns the Token length.
[in] | aMessage | A pointer to the CoAP message. |
const uint8_t* otCoapMessageGetToken | ( | const otMessage * | aMessage | ) |
This function returns a pointer to the Token value.
[in] | aMessage | A pointer to the CoAP message. |
otError otCoapOptionIteratorInit | ( | otCoapOptionIterator * | aIterator, |
const otMessage * | aMessage | ||
) |
This function initialises an iterator for the options in the given message.
[in,out] | aIterator | A pointer to the CoAP message option iterator. |
[in] | aMessage | A pointer to the CoAP message. |
OT_ERROR_NONE | Successfully initialised. |
OT_ERROR_PARSE | Message state is inconsistent. |
const otCoapOption* otCoapOptionIteratorGetFirstOptionMatching | ( | otCoapOptionIterator * | aIterator, |
uint16_t | aOption | ||
) |
This function returns a pointer to the first option matching the specified option number.
[in] | aIterator | A pointer to the CoAP message option iterator. |
[in] | aOption | The option number sought. |
const otCoapOption* otCoapOptionIteratorGetFirstOption | ( | otCoapOptionIterator * | aIterator | ) |
This function returns a pointer to the first option.
[in,out] | aIterator | A pointer to the CoAP message option iterator. |
const otCoapOption* otCoapOptionIteratorGetNextOptionMatching | ( | otCoapOptionIterator * | aIterator, |
uint16_t | aOption | ||
) |
This function returns a pointer to the next option matching the specified option number.
[in] | aIterator | A pointer to the CoAP message option iterator. |
[in] | aOption | The option number sought. |
const otCoapOption* otCoapOptionIteratorGetNextOption | ( | otCoapOptionIterator * | aIterator | ) |
This function returns a pointer to the next option.
[in,out] | aIterator | A pointer to the CoAP message option iterator. |
otError otCoapOptionIteratorGetOptionUintValue | ( | otCoapOptionIterator * | aIterator, |
uint64_t * | aValue | ||
) |
This function fills current option value into aValue
assuming the current value is an unsigned integer encoded according to https://tools.ietf.org/html/rfc7252#section-3.2
[in,out] | aIterator | A pointer to the CoAP message option iterator. |
[out] | aValue | A pointer to an unsigned integer to receive the option value. |
OT_ERROR_NONE | Successfully filled value. |
OT_ERROR_NOT_FOUND | No current option. |
OT_ERROR_NO_BUFS | Value is too long to fit in a uint64_t. |
otError otCoapOptionIteratorGetOptionValue | ( | otCoapOptionIterator * | aIterator, |
void * | aValue | ||
) |
This function fills current option value into aValue
.
[in,out] | aIterator | A pointer to the CoAP message option iterator. |
[out] | aValue | A pointer to a buffer to receive the option value. |
OT_ERROR_NONE | Successfully filled value. |
OT_ERROR_NOT_FOUND | No current option. |
otMessage* otCoapNewMessage | ( | otInstance * | aInstance, |
const otMessageSettings * | aSettings | ||
) |
This function creates a new CoAP message.
aSettings
is 'NULL', the link layer security is enabled and the message priority is set to OT_MESSAGE_PRIORITY_NORMAL by default.[in] | aInstance | A pointer to an OpenThread instance. |
[in] | aSettings | A pointer to the message settings or NULL to set default settings. |
otError otCoapSendRequestWithParameters | ( | otInstance * | aInstance, |
otMessage * | aMessage, | ||
const otMessageInfo * | aMessageInfo, | ||
otCoapResponseHandler | aHandler, | ||
void * | aContext, | ||
const otCoapTxParameters * | aTxParameters | ||
) |
This function sends a CoAP request with custom transmission parameters.
If a response for a request is expected, respective function and context information should be provided. If no response is expected, these arguments should be NULL pointers.
[in] | aInstance | A pointer to an OpenThread instance. |
[in] | aMessage | A pointer to the message to send. |
[in] | aMessageInfo | A pointer to the message info associated with aMessage . |
[in] | aHandler | A function pointer that shall be called on response reception or timeout. |
[in] | aContext | A pointer to arbitrary context information. May be NULL if not used. |
[in] | aTxParameters | A pointer to transmission parameters for this request. Use NULL for defaults. Otherwise, parameters given must meet the following conditions:
|
OT_ERROR_INVALID_ARGS | aTxParameters is invalid. |
OT_ERROR_NONE | Successfully sent CoAP message. |
OT_ERROR_NO_BUFS | Failed to allocate retransmission data. |
Referenced by otCoapSendRequest().
otError otCoapSendRequestBlockWiseWithParameters | ( | otInstance * | aInstance, |
otMessage * | aMessage, | ||
const otMessageInfo * | aMessageInfo, | ||
otCoapResponseHandler | aHandler, | ||
void * | aContext, | ||
const otCoapTxParameters * | aTxParameters, | ||
otCoapBlockwiseTransmitHook | aTransmitHook, | ||
otCoapBlockwiseReceiveHook | aReceiveHook | ||
) |
This function sends a CoAP request block-wise with custom transmission parameters.
This function is available when OPENTHREAD_CONFIG_COAP_BLOCKWISE_TRANSFER_ENABLE configuration is enabled.
If a response for a request is expected, respective function and context information should be provided. If the response is expected to be block-wise, a respective hook function should be provided. If no response is expected, these arguments should be NULL pointers.
[in] | aInstance | A pointer to an OpenThread instance. |
[in] | aMessage | A pointer to the message to send. |
[in] | aMessageInfo | A pointer to the message info associated with aMessage . |
[in] | aHandler | A function pointer that shall be called on response reception or timeout. |
[in] | aContext | A pointer to arbitrary context information. May be NULL if not used. |
[in] | aTxParameters | A pointer to transmission parameters for this request. Use NULL for defaults. |
[in] | aTransmitHook | A pointer to a hook function for outgoing block-wise transfer. |
[in] | aReceiveHook | A pointer to a hook function for incoming block-wise transfer. |
OT_ERROR_NONE | Successfully sent CoAP message. |
OT_ERROR_NO_BUFS | Failed to allocate retransmission data. |
Referenced by otCoapSendRequestBlockWise().
|
inlinestatic |
This function sends a CoAP request block-wise.
This function is available when OPENTHREAD_CONFIG_COAP_BLOCKWISE_TRANSFER_ENABLE configuration is enabled.
If a response for a request is expected, respective function and context information should be provided. If the response is expected to be block-wise, a respective hook function should be provided. If no response is expected, these arguments should be NULL pointers.
[in] | aInstance | A pointer to an OpenThread instance. |
[in] | aMessage | A pointer to the message to send. |
[in] | aMessageInfo | A pointer to the message info associated with aMessage . |
[in] | aHandler | A function pointer that shall be called on response reception or timeout. |
[in] | aContext | A pointer to arbitrary context information. May be NULL if not used. |
[in] | aTransmitHook | A pointer to a hook function for outgoing block-wise transfer. |
[in] | aReceiveHook | A pointer to a hook function for incoming block-wise transfer. |
OT_ERROR_NONE | Successfully sent CoAP message. |
OT_ERROR_NO_BUFS | Failed to allocate retransmission data. |
References otCoapSendRequestBlockWiseWithParameters().
|
inlinestatic |
This function sends a CoAP request.
If a response for a request is expected, respective function and context information should be provided. If no response is expected, these arguments should be NULL pointers.
[in] | aInstance | A pointer to an OpenThread instance. |
[in] | aMessage | A pointer to the message to send. |
[in] | aMessageInfo | A pointer to the message info associated with aMessage . |
[in] | aHandler | A function pointer that shall be called on response reception or timeout. |
[in] | aContext | A pointer to arbitrary context information. May be NULL if not used. |
OT_ERROR_NONE | Successfully sent CoAP message. |
OT_ERROR_NO_BUFS | Failed to allocate retransmission data. |
References otCoapAddBlockWiseResource(), otCoapAddResource(), otCoapRemoveBlockWiseResource(), otCoapRemoveResource(), otCoapSendRequestWithParameters(), otCoapSendResponseBlockWiseWithParameters(), otCoapSendResponseWithParameters(), otCoapSetDefaultHandler(), otCoapStart(), and otCoapStop().
otError otCoapStart | ( | otInstance * | aInstance, |
uint16_t | aPort | ||
) |
This function starts the CoAP server.
[in] | aInstance | A pointer to an OpenThread instance. |
[in] | aPort | The local UDP port to bind to. |
OT_ERROR_NONE | Successfully started the CoAP server. |
OT_ERROR_FAILED | Failed to start the CoAP server. |
Referenced by otCoapSendRequest().
otError otCoapStop | ( | otInstance * | aInstance | ) |
This function stops the CoAP server.
[in] | aInstance | A pointer to an OpenThread instance. |
OT_ERROR_NONE | Successfully stopped the CoAP server. |
Referenced by otCoapSendRequest().
void otCoapAddResource | ( | otInstance * | aInstance, |
otCoapResource * | aResource | ||
) |
This function adds a resource to the CoAP server.
[in] | aInstance | A pointer to an OpenThread instance. |
[in] | aResource | A pointer to the resource. |
Referenced by otCoapSendRequest().
void otCoapRemoveResource | ( | otInstance * | aInstance, |
otCoapResource * | aResource | ||
) |
This function removes a resource from the CoAP server.
[in] | aInstance | A pointer to an OpenThread instance. |
[in] | aResource | A pointer to the resource. |
Referenced by otCoapSendRequest().
void otCoapAddBlockWiseResource | ( | otInstance * | aInstance, |
otCoapBlockwiseResource * | aResource | ||
) |
This function adds a block-wise resource to the CoAP server.
[in] | aInstance | A pointer to an OpenThread instance. |
[in] | aResource | A pointer to the resource. |
Referenced by otCoapSendRequest().
void otCoapRemoveBlockWiseResource | ( | otInstance * | aInstance, |
otCoapBlockwiseResource * | aResource | ||
) |
This function removes a block-wise resource from the CoAP server.
[in] | aInstance | A pointer to an OpenThread instance. |
[in] | aResource | A pointer to the resource. |
Referenced by otCoapSendRequest().
void otCoapSetDefaultHandler | ( | otInstance * | aInstance, |
otCoapRequestHandler | aHandler, | ||
void * | aContext | ||
) |
This function sets the default handler for unhandled CoAP requests.
[in] | aInstance | A pointer to an OpenThread instance. |
[in] | aHandler | A function pointer that shall be called when an unhandled request arrives. |
[in] | aContext | A pointer to arbitrary context information. May be NULL if not used. |
Referenced by otCoapSendRequest().
otError otCoapSendResponseWithParameters | ( | otInstance * | aInstance, |
otMessage * | aMessage, | ||
const otMessageInfo * | aMessageInfo, | ||
const otCoapTxParameters * | aTxParameters | ||
) |
This function sends a CoAP response from the server with custom transmission parameters.
[in] | aInstance | A pointer to an OpenThread instance. |
[in] | aMessage | A pointer to the CoAP response to send. |
[in] | aMessageInfo | A pointer to the message info associated with aMessage . |
[in] | aTxParameters | A pointer to transmission parameters for this response. Use NULL for defaults. |
OT_ERROR_NONE | Successfully enqueued the CoAP response message. |
OT_ERROR_NO_BUFS | Insufficient buffers available to send the CoAP response. |
Referenced by otCoapSendRequest(), and otCoapSendResponse().
otError otCoapSendResponseBlockWiseWithParameters | ( | otInstance * | aInstance, |
otMessage * | aMessage, | ||
const otMessageInfo * | aMessageInfo, | ||
const otCoapTxParameters * | aTxParameters, | ||
void * | aContext, | ||
otCoapBlockwiseTransmitHook | aTransmitHook | ||
) |
This function sends a CoAP response block-wise from the server with custom transmission parameters.
This function is available when OPENTHREAD_CONFIG_COAP_BLOCKWISE_TRANSFER_ENABLE configuration is enabled.
[in] | aInstance | A pointer to an OpenThread instance. |
[in] | aMessage | A pointer to the CoAP response to send. |
[in] | aMessageInfo | A pointer to the message info associated with aMessage . |
[in] | aTxParameters | A pointer to transmission parameters for this response. Use NULL for defaults. |
[in] | aContext | A pointer to arbitrary context information. May be NULL if not used. |
[in] | aTransmitHook | A pointer to a hook function for outgoing block-wise transfer. |
OT_ERROR_NONE | Successfully enqueued the CoAP response message. |
OT_ERROR_NO_BUFS | Insufficient buffers available to send the CoAP response. |
Referenced by otCoapSendRequest(), and otCoapSendResponseBlockWise().
|
inlinestatic |
This function sends a CoAP response block-wise from the server.
This function is available when OPENTHREAD_CONFIG_COAP_BLOCKWISE_TRANSFER_ENABLE configuration is enabled.
[in] | aInstance | A pointer to an OpenThread instance. |
[in] | aMessage | A pointer to the CoAP response to send. |
[in] | aMessageInfo | A pointer to the message info associated with aMessage . |
[in] | aContext | A pointer to arbitrary context information. May be NULL if not used. |
[in] | aTransmitHook | A pointer to a hook function for outgoing block-wise transfer. |
OT_ERROR_NONE | Successfully enqueued the CoAP response message. |
OT_ERROR_NO_BUFS | Insufficient buffers available to send the CoAP response. |
References otCoapSendResponseBlockWiseWithParameters().
|
inlinestatic |
This function sends a CoAP response from the server.
[in] | aInstance | A pointer to an OpenThread instance. |
[in] | aMessage | A pointer to the CoAP response to send. |
[in] | aMessageInfo | A pointer to the message info associated with aMessage . |
OT_ERROR_NONE | Successfully enqueued the CoAP response message. |
OT_ERROR_NO_BUFS | Insufficient buffers available to send the CoAP response. |
References otCoapSendResponseWithParameters().