mirror of
https://github.com/espressif/openthread.git
synced 2026-10-11 02:07:40 +00:00
CoAP API cleanup.
This commit is contained in:
+3
-1
@@ -35,6 +35,7 @@ DIST_SUBDIRS = \
|
||||
commissioning \
|
||||
dhcp6 \
|
||||
ncp \
|
||||
openthread \
|
||||
platform \
|
||||
$(NULL)
|
||||
|
||||
@@ -45,6 +46,7 @@ SUBDIRS = \
|
||||
commissioning \
|
||||
dhcp6 \
|
||||
ncp \
|
||||
openthread \
|
||||
platform \
|
||||
$(NULL)
|
||||
|
||||
@@ -55,13 +57,13 @@ PRETTY_SUBDIRS = \
|
||||
commissioning \
|
||||
dhcp6 \
|
||||
ncp \
|
||||
openthread \
|
||||
platform \
|
||||
$(NULL)
|
||||
|
||||
include_HEADERS = \
|
||||
openthread/link_raw.h \
|
||||
openthread.h \
|
||||
openthread-coap.h \
|
||||
openthread-crypto.h \
|
||||
openthread-diag.h \
|
||||
openthread-icmp6.h \
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
#
|
||||
# Copyright (c) 2016, The OpenThread Authors.
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are met:
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
# 3. Neither the name of the copyright holder nor the
|
||||
# names of its contributors may be used to endorse or promote products
|
||||
# derived from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
|
||||
include $(abs_top_nlbuild_autotools_dir)/automake/pre.am
|
||||
|
||||
openthread_headers = \
|
||||
coap.h \
|
||||
$(NULL)
|
||||
|
||||
openthreaddir = $(includedir)/openthread
|
||||
dist_openthread_HEADERS = $(openthread_headers)
|
||||
|
||||
include_HEADERS = \
|
||||
$(NULL)
|
||||
|
||||
install-headers: install-includeHEADERS
|
||||
|
||||
include $(abs_top_nlbuild_autotools_dir)/automake/post.am
|
||||
@@ -35,9 +35,15 @@
|
||||
#ifndef OPENTHREAD_COAP_H_
|
||||
#define OPENTHREAD_COAP_H_
|
||||
|
||||
#ifdef OPENTHREAD_CONFIG_FILE
|
||||
#include OPENTHREAD_CONFIG_FILE
|
||||
#else
|
||||
#include <openthread-config.h>
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include <openthread-types.h>
|
||||
#include "openthread-types.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@@ -121,23 +127,23 @@ typedef struct otCoapHeader
|
||||
{
|
||||
struct
|
||||
{
|
||||
uint8_t mVersionTypeToken;
|
||||
uint8_t mCode;
|
||||
uint16_t mMessageId;
|
||||
} mFields;
|
||||
uint8_t mBytes[OT_COAP_HEADER_MAX_LENGTH];
|
||||
} mHeader;
|
||||
uint8_t mHeaderLength;
|
||||
uint16_t mOptionLast;
|
||||
uint16_t mNextOptionOffset;
|
||||
otCoapOption mOption;
|
||||
uint8_t mVersionTypeToken; ///< The CoAP Version, Type, and Token Length
|
||||
uint8_t mCode; ///< The CoAP Code
|
||||
uint16_t mMessageId; ///< The CoAP Message ID
|
||||
} mFields; ///< Structure representing a CoAP base header
|
||||
uint8_t mBytes[OT_COAP_HEADER_MAX_LENGTH]; ///< The raw byte encoding for the CoAP header
|
||||
} mHeader; ///< The CoAP header encoding
|
||||
uint8_t mHeaderLength; ///< The CoAP header length (bytes)
|
||||
uint16_t mOptionLast; ///< The last CoAP Option Number value
|
||||
uint16_t mNextOptionOffset; ///< The byte offset for the next CoAP Option
|
||||
otCoapOption mOption; ///< A structure representing the current CoAP Option.
|
||||
} otCoapHeader;
|
||||
|
||||
/**
|
||||
* This function pointer is called when a CoAP response is received or on the request timeout.
|
||||
*
|
||||
* @param[in] aContext A pointer to application-specific context.
|
||||
* @param[in[ aHeader A pointer to the received CoAP header. NULL if no response was received.
|
||||
* @param[in] aHeader A pointer to the received CoAP header. NULL if no response was received.
|
||||
* @param[in] aMessage A pointer to the message buffer containing the response. NULL if no response was received.
|
||||
* @param[in] aMessageInfo A pointer to the message info for @p aMessage. NULL if no response was received.
|
||||
* @param[in] aResult A result of the CoAP transaction.
|
||||
@@ -168,10 +174,10 @@ typedef void (*otCoapRequestHandler)(void *aContext, otCoapHeader *aHeader, otMe
|
||||
*/
|
||||
typedef struct otCoapResource
|
||||
{
|
||||
const char *mUriPath;
|
||||
otCoapRequestHandler mHandler;
|
||||
void *mContext;
|
||||
struct otCoapResource *mNext;
|
||||
const char *mUriPath; ///< The URI Path string
|
||||
otCoapRequestHandler mHandler; ///< The callback for handling a received request
|
||||
void *mContext; ///< Application-specific context
|
||||
struct otCoapResource *mNext; ///< The next CoAP resource in the list
|
||||
} otCoapResource;
|
||||
|
||||
#if OPENTHREAD_ENABLE_APPLICATION_COAP
|
||||
Reference in New Issue
Block a user