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.
Fork of OmniWheels by
mle_tlv.h
00001 /* 00002 * Copyright (c) 2014-2017, Arm Limited and affiliates. 00003 * SPDX-License-Identifier: Apache-2.0 00004 * 00005 * Licensed under the Apache License, Version 2.0 (the "License"); 00006 * you may not use this file except in compliance with the License. 00007 * You may obtain a copy of the License at 00008 * 00009 * http://www.apache.org/licenses/LICENSE-2.0 00010 * 00011 * Unless required by applicable law or agreed to in writing, software 00012 * distributed under the License is distributed on an "AS IS" BASIS, 00013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00014 * See the License for the specific language governing permissions and 00015 * limitations under the License. 00016 */ 00017 00018 #ifndef MLE_TLV_H_ 00019 #define MLE_TLV_H_ 00020 00021 #include "MLE/mle.h" 00022 00023 /** 00024 * TLV message Info structure will be used for Catching proper TLV and save info to current structure 00025 * 00026 */ 00027 typedef struct mle_tlv_info_s { 00028 mle_tlv_type_t tlvType; 00029 uint16_t tlvLen; 00030 uint8_t *dataPtr; 00031 } mle_tlv_info_t; 00032 00033 /** 00034 * This function is for Verify That MLE TLV's are valid 00035 */ 00036 int mle_message_malformed_check(uint8_t *ptr, uint16_t data_len); 00037 00038 /** 00039 * This Function help to discover Requested MLE TLV type from Payload 00040 * 00041 * return value 00042 * -1 if TLV is not found. 00043 * length of TLV if it is found always larger than 0. 00044 */ 00045 int mle_tlv_option_discover(uint8_t *ptr, uint16_t data_len, mle_tlv_type_t discovered_type, mle_tlv_info_t *option_info); 00046 00047 bool mle_tlv_type_requested(uint8_t reqType, uint8_t *ptr, uint16_t data_len); 00048 00049 bool mle_tlv_read_8_bit_tlv(mle_tlv_type_t reqType, uint8_t *ptr, uint16_t data_len, uint8_t *buffer); 00050 bool mle_tlv_read_16_bit_tlv(mle_tlv_type_t reqType, uint8_t *ptr, uint16_t data_len, uint16_t *buffer); 00051 bool mle_tlv_read_32_bit_tlv(mle_tlv_type_t reqType, uint8_t *ptr, uint16_t data_len, uint32_t *buffer); 00052 bool mle_tlv_read_64_bit_tlv(mle_tlv_type_t reqType, uint8_t *ptr, uint16_t data_len, uint64_t *buffer); 00053 bool mle_tlv_read_tlv(mle_tlv_type_t reqType, uint8_t *ptr, uint16_t data_len, mle_tlv_info_t *tlv_info); 00054 00055 /** 00056 * Next Function for MLE TLV option write 00057 * 00058 */ 00059 /** 00060 * Write MLE Response TLV 00061 */ 00062 uint8_t *mle_tlv_write_response(uint8_t *ptr, uint8_t *response_ptr, uint8_t responseLen); 00063 /** 00064 * Write MLE Source Address TLV 00065 */ 00066 uint8_t *mle_tlv_write_source_address(uint8_t *ptr, uint16_t shortAddress); 00067 /** 00068 * Write MLE Short Address TLV 00069 */ 00070 uint8_t *mle_tlv_write_short_address(uint8_t *ptr, uint16_t shortAddress); 00071 /** 00072 * Write MLE Mode TLV 00073 */ 00074 uint8_t *mle_tlv_write_mode(uint8_t *ptr, uint8_t mode); 00075 /** 00076 * Write MLE Timeout TLV 00077 */ 00078 uint8_t *mle_tlv_write_timeout(uint8_t *ptr, uint32_t timeOut); 00079 /** 00080 * Write MLE Challenge TLV 00081 */ 00082 uint8_t *mle_tlv_write_challenge(uint8_t *ptr, uint8_t *challengePtr, uint8_t challenLen); 00083 /** 00084 * Write MLE Link Layer Frame count TLV 00085 */ 00086 uint8_t *mle_tlv_write_link_layer_framecount(uint8_t *ptr, uint32_t frameCount); 00087 /** 00088 * Write MLE Frame counter TLV 00089 */ 00090 uint8_t *mle_tlv_write_framecounter(uint8_t *ptr, uint32_t frameCount); 00091 /** 00092 * Write MLE Scan Mask TLV 00093 */ 00094 uint8_t *mle_tlv_write_scan_mask(uint8_t *ptr, uint8_t scanMask); 00095 /** 00096 * Write MLE TLV request TLV 00097 */ 00098 uint8_t *mle_tlv_req_tlv(uint8_t *ptr, uint8_t *mle_req_tlv_list, uint8_t req_list_len); 00099 /** 00100 * Write MLE RSSI TLV 00101 */ 00102 uint8_t *mle_tlv_rssi_tlv(uint8_t *ptr, uint8_t linkMargin); 00103 00104 /** 00105 * Write MLE version TLV 00106 */ 00107 uint8_t *mle_tlv_write_version(uint8_t *ptr, uint16_t version); 00108 00109 /** 00110 * Write MLE link quality TLV 00111 */ 00112 uint8_t *mle_tlv_write_link_quality(uint8_t *ptr, uint8_t incoming_idr, uint8_t *mac64, uint16_t short_address, uint8_t priority_flag); 00113 /** 00114 * Validate response TLV to mle services challenge TLV 00115 * 00116 * return 0 when Unknow response other it return buffer id 00117 */ 00118 uint16_t mle_tlv_validate_response(uint8_t *ptr, uint16_t data_len); 00119 00120 /** 00121 * check if specific TLV is in request TLV list 00122 * 00123 * return true if TLV is requested else false 00124 */ 00125 bool mle_tlv_requested(uint8_t *tlv_ptr, uint16_t tlv_len, uint8_t tlv_type); 00126 /** 00127 * Modifies the TLV list so that specific TLV is removed from the list 00128 * 00129 * return 0 when Unknow response other it return buffer id 00130 */ 00131 void mle_tlv_ignore(uint8_t *tlv_ptr, uint16_t tlv_len, uint8_t tlv_type); 00132 00133 #endif /* MLE_TLV_H_ */
Generated on Fri Jul 22 2022 04:53:57 by
 1.7.2
 1.7.2 
    