Gleb Klochkov / Mbed OS Climatcontroll_Main

Dependencies:   esp8266-driver

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers thread_management_internal.h Source File

thread_management_internal.h

00001 /*
00002  * Copyright (c) 2014-2017, 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 #ifndef THREAD_MANAGEMENT_INTERNAL_H_
00031 #define THREAD_MANAGEMENT_INTERNAL_H_
00032 
00033 #include "net_interface.h"
00034 #ifdef HAVE_THREAD
00035 
00036 struct link_configuration;
00037 /**
00038  *  Function for pushing Network Data to Managment IF from MLE module
00039  *
00040  * \param cur interface pointer to active interface
00041  * \param data_pointer pointer to Network Data
00042  * \param length Network Data length
00043  */
00044 int thread_management_network_data_tlv_push(struct protocol_interface_info_entry *cur, uint8_t *data_pointer, uint16_t length);
00045 /**
00046  * Get Mesh Local prefix.
00047  *
00048  * \param interface_id Network Interface.
00049  * \param prefix_ptr pointer where address prefix will be copied.
00050  *
00051  * return 0, Read OK
00052  * return <0 Read fail
00053  */
00054 
00055 int thread_management_get_ml_prefix(int8_t interface_id, uint8_t *prefix_ptr);
00056 /**
00057  * Get Mesh Local prefix added with short address prefix.
00058  *
00059  * You can add short address at end of this prefix to get ML16 address of any device.
00060  *
00061  * \param interface_id Network Interface.
00062  * \param prefix_ptr pointer where address prefix will be copied.
00063  *
00064  * return 0, Read OK
00065  * return <0 Read fail
00066  */
00067 int thread_management_get_ml_prefix_112(int8_t interface_id, uint8_t *prefix_ptr);
00068 
00069 /**
00070  * Step into next key in network.
00071  *
00072  * \param interface_id Network Interface
00073  * return 0, OK
00074  * return < 0 NOK
00075  */
00076 int thread_management_increment_key_sequence_counter(int8_t interface_id);
00077 
00078 int thread_management_key_sets_calc(protocol_interface_info_entry_t *cur, link_configuration_s *linkConfiguration, uint32_t thrKeySequenceCounter);
00079 
00080 uint8_t *thread_management_key_request(int8_t interface_id, uint8_t keyId);
00081 
00082 void thread_management_key_synch_req(int8_t interface_id, uint32_t keySequnce);
00083 uint8_t *thread_management_key_request_with_sequence(int8_t interface_id, uint8_t keyId, uint32_t keySequnce);
00084 
00085 void thread_security_update_from_mac(struct protocol_interface_info_entry *cur);
00086 
00087 void thread_history_key_material_push(struct thread_info_s *thread_info, uint8_t *mleKeyPtr, uint8_t keyId);
00088 
00089 void thread_security_next_key_generate(struct protocol_interface_info_entry *cur, uint8_t *masterKey, uint32_t keySequence);
00090 
00091 void thread_key_get(uint8_t *key, uint8_t *key_material_buf,  uint32_t key_sequence_counter);
00092 
00093 int thread_management_get_current_keysequence(int8_t interface_id, uint32_t *sequencePtr);
00094 
00095 void arm_thread_private_ula_prefix_set(protocol_interface_info_entry_t *cur, const uint8_t *ula_prefix);
00096 
00097 int8_t thread_node_bootstrap_init(int8_t interface_id, net_6lowpan_mode_e bootstrap_mode);
00098 #else // HAVE_THREAD
00099 
00100 #define thread_management_key_request(interface_id, keyId) ((uint8_t *) NULL)
00101 #define thread_management_key_request_with_sequence(interface_id, keyId, keySequnce) ((uint8_t *) NULL)
00102 #define thread_history_key_material_push(thread_info, mleKeyPtr, keyId) ((void) mleKeyPtr, (void) keyId) // evaluate parameters to suppress "unused" warnings
00103 #define thread_security_update_from_mac(cur) ((void) 0)
00104 #define thread_node_bootstrap_init(interface_id, bootstrap_mode) -1
00105 #define thread_management_get_current_keysequence(interface_id, sequencePtr) -1
00106 //#define thread_security_next_key_generate(cur, masterKey, keySequence) ((void) 0)
00107 
00108 #endif // HAVE_THREAD
00109 
00110 
00111 #endif /* THREAD_MANAGEMENT_INTERNAL_H_ */