Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: TYBLE16_simple_data_logger TYBLE16_MP3_Air
thread_diagcop_lib.h
00001 /* 00002 * Copyright (c) 2015-2018, Arm Limited and affiliates. 00003 * SPDX-License-Identifier: BSD-3-Clause 00004 * 00005 * Redistribution and use in source and binary forms, with or without 00006 * modification, are permitted provided that the following conditions are met: 00007 * 00008 * 1. Redistributions of source code must retain the above copyright 00009 * notice, this list of conditions and the following disclaimer. 00010 * 2. Redistributions in binary form must reproduce the above copyright 00011 * notice, this list of conditions and the following disclaimer in the 00012 * documentation and/or other materials provided with the distribution. 00013 * 3. Neither the name of the copyright holder nor the 00014 * names of its contributors may be used to endorse or promote products 00015 * derived from this software without specific prior written permission. 00016 * 00017 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 00018 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 00019 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 00020 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 00021 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 00022 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 00023 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 00024 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 00025 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 00026 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 00027 * POSSIBILITY OF SUCH DAMAGE. 00028 */ 00029 00030 00031 #ifndef NANOSTACK_SOURCE_6LOWPAN_THREAD_THREAD_DIAGCOP_LIB_H_ 00032 #define NANOSTACK_SOURCE_6LOWPAN_THREAD_THREAD_DIAGCOP_LIB_H_ 00033 00034 #include "ns_types.h" 00035 #include "thread_meshcop_lib.h" // this uses the same parser functions than meshcop but different message types 00036 00037 /** 00038 * \file thread_diagcop_lib.h 00039 * \brief CoAP diagnostic TLV. 00040 * Note that these TLV types overlap with meshcop 00041 * and must not be used in same messages. 00042 */ 00043 00044 #define DIAGCOP_TLV_EXTENDED_MAC_ADDRESS 0 /**< Can not reset*/ 00045 #define DIAGCOP_TLV_ADDRESS16 1 /**< Can not reset*/ 00046 #define DIAGCOP_TLV_MODE 2 /**< Can not reset*/ 00047 #define DIAGCOP_TLV_TIMEOUT 3 /**< Can not reset*/ 00048 #define DIAGCOP_TLV_CONNECTIVITY 4 /**< Can not reset*/ 00049 #define DIAGCOP_TLV_ROUTE64 5 /**< Can not reset*/ 00050 #define DIAGCOP_TLV_LEADER_DATA 6 /**< Can not reset*/ 00051 #define DIAGCOP_TLV_NETWORK_DATA 7 /**< Can not reset*/ 00052 #define DIAGCOP_TLV_IPV6_ADDRESS_LIST 8 /**< Can not reset*/ 00053 #define DIAGCOP_TLV_MAC_COUNTERS 9 /**< Can reset*/ 00054 #define DIAGCOP_TLV_BATTERY_LEVEL 14 /**< Can reset*/ 00055 #define DIAGCOP_TLV_SUPPLY_VOLTAGE 15 /**< Can not reset*/ 00056 #define DIAGCOP_TLV_CHILD_TABLE 16 /**< Can not reset*/ 00057 #define DIAGCOP_TLV_CHANNEL_PAGES 17 /**< Can not reset*/ 00058 #define DIAGCOP_TLV_TYPE_LIST 18 /**< Cannot reset*/ 00059 #define DIAGCOP_TLV_MAX_CHILD_TIMEOUT 19 /**< Cannot reset*/ 00060 00061 /** 00062 * \brief Write array TLV. 00063 * 00064 * \param ptr A pointer to array in which to write the TLV. 00065 * \param type The type of TLV. 00066 * \param length The length of the data that is written in TLV. 00067 * \param data The array for TLV value. 00068 * \return pointer The value for writing the next TLV. 00069 */ 00070 #define thread_diagcop_tlv_data_write(ptr,type,length,data) thread_meshcop_tlv_data_write(ptr,type,length,data) 00071 00072 /** 00073 * \brief Write 1 byte length TLV. 00074 * 00075 * \param ptr A pointer to array in which to write the TLV. 00076 * \param type The type of TLV. 00077 * \param data value. 00078 * \return pointer value for writing the next TLV. 00079 */ 00080 #define thread_diagcop_tlv_data_write_uint8(ptr,type,data) thread_meshcop_tlv_data_write_uint8(ptr,type,data) 00081 00082 /** 00083 * \brief Write 2 byte length TLV. 00084 * 00085 * \param ptr pointer for array where to write the TLV. 00086 * \param type Type of TLV. 00087 * \param data value. 00088 * \return pointer value for writing the next TLV. 00089 */ 00090 #define thread_diagcop_tlv_data_write_uint16(ptr,type,data) thread_meshcop_tlv_data_write_uint16(ptr,type,data) 00091 00092 /** 00093 * \brief Write 4 byte length TLV. 00094 * 00095 * \param ptr pointer for array where to write the TLV. 00096 * \param type Type of TLV. 00097 * \param data value. 00098 * \return pointer value for writing the next TLV. 00099 */ 00100 #define thread_diagcop_tlv_data_write_uint32(ptr,type,data) thread_meshcop_tlv_data_write_uint32(ptr,type,data) 00101 00102 /** 00103 * \brief Write 8 byte length TLV. 00104 * 00105 * \param ptr pointer for array where to write the TLV. 00106 * \param type Type of TLV. 00107 * \param data value. 00108 * \return pointer value for writing the next TLV. 00109 */ 00110 #define thread_diagcop_tlv_data_write_uint64(ptr,type,data) thread_meshcop_tlv_data_write_uint64(ptr,type,data) 00111 00112 /** 00113 * \brief Find TLV from message. 00114 * 00115 * \param ptr Message buffer. 00116 * \param length Length of the message buffer to validate message. 00117 * \param type Type of TLV searched. 00118 * \param result Pointer value is given as result if length is positive. Can be NULL which only searches for the length. 00119 * \return The length of the TLV data found 00120 * \return 0 if TLV is empty or no TLV found. 00121 * \return negative value indicates corrupted message. 00122 */ 00123 #define thread_diagcop_tlv_find(ptr,length,type,result) thread_meshcop_tlv_find(ptr,length,type,result) 00124 00125 /** 00126 * \brief Read 1 byte length TLV. 00127 * 00128 * \param ptr pointer TLV message array. 00129 * \param length length of TLV message array. 00130 * \param type Type of TLV. 00131 * \param data pointer to variable where the value is read. 00132 * \return pointer length of TLV 1 if success. 0 means TLV not found or does not have any data. 00133 * Any other value indicates that TLV is not as expected. 00134 */ 00135 #define thread_diagcop_tlv_data_get_uint8(ptr,length,type,data) thread_meshcop_tlv_data_get_uint8(ptr,length,type,data) 00136 00137 /** 00138 * \brief Read 2 byte length TLV. 00139 * 00140 * \param ptr pointer TLV message array. 00141 * \param length length of TLV message array. 00142 * \param type Type of TLV. 00143 * \param data pointer to variable where the value is read. 00144 * \return pointer length of TLV 2 if success. 0 means TLV not found or does not have any data. 00145 * Any other value indicates that TLV is not as expected. 00146 */ 00147 #define thread_diagcop_tlv_data_get_uint16(ptr,length,type,data) thread_meshcop_tlv_data_get_uint16(ptr,length,type,data) 00148 00149 /** 00150 * \brief Read 4 byte length TLV. 00151 * 00152 * \param ptr pointer TLV message array. 00153 * \param length length of TLV message array. 00154 * \param type Type of TLV. 00155 * \param data pointer to variable where the value is read. 00156 * \return pointer length of TLV 4 if success. 0 means TLV not found or does not have any data. 00157 * Any other value indicates that TLV is not as expected. 00158 */ 00159 #define thread_diagcop_tlv_data_get_uint32(ptr,length,type,data) thread_meshcop_tlv_data_get_uint32(ptr,length,type,data) 00160 00161 /** 00162 * \brief Read 8 byte length TLV. 00163 * 00164 * \param ptr pointer TLV message array. 00165 * \param length length of TLV message array. 00166 * \param type Type of TLV. 00167 * \param data pointer to variable where the value is read. 00168 * \return pointer length of TLV 4 if success. 0 means TLV not found or does not have any data. 00169 * Any other value indicates that TLV is not as expected. 00170 */ 00171 #define thread_diagcop_tlv_data_get_uint64(ptr,length,type,data) thread_meshcop_tlv_data_get_uint64(ptr,length,type,data) 00172 00173 00174 #endif /* NANOSTACK_SOURCE_6LOWPAN_THREAD_THREAD_DIAGCOP_LIB_H_ */
Generated on Tue Jul 12 2022 13:54:58 by
1.7.2