takashi kadono / Mbed OS Nucleo_446

Dependencies:   ssd1331

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers thread_extension.h Source File

thread_extension.h

00001 /*
00002  * Copyright (c) 2016-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  * \brief Thread extensions for network bootstrap.
00032  */
00033 
00034 #ifndef THREAD_EXTENSION_H_
00035 #define THREAD_EXTENSION_H_
00036 
00037 #ifdef __cplusplus
00038 extern "C" {
00039 #endif
00040 
00041 struct discovery_response_list;
00042 
00043 #ifdef HAVE_THREAD_V2
00044 
00045 void thread_extension_allocate(protocol_interface_info_entry_t *cur);
00046 void thread_extension_free(protocol_interface_info_entry_t *cur);
00047 void thread_extension_init(int8_t interface_id, int8_t coap_service_id);
00048 void thread_extension_mtd_service_register(protocol_interface_info_entry_t *cur);
00049 int thread_extension_network_prefix_get(int8_t interface_id, uint8_t *options_ptr, uint8_t *prefix_ptr, uint8_t *prefix_len);
00050 void thread_extension_network_data_process(struct protocol_interface_info_entry *cur);
00051 int thread_extension_primary_bbr_get(struct protocol_interface_info_entry *cur, uint8_t *addr_ptr, uint8_t *seq_ptr, uint32_t *timer1_ptr, uint32_t *timer2_ptr);
00052 void thread_extension_address_registration(struct protocol_interface_info_entry *interface, const uint8_t *addr, const uint8_t *child_mac64, bool refresh_child_entry, bool duplicate_child_detected);
00053 void thread_extension_address_generate(protocol_interface_info_entry_t *cur);
00054 void thread_extension_aloc_generate(struct protocol_interface_info_entry *cur);
00055 bool thread_extension_aloc_map(protocol_interface_info_entry_t *cur, uint16_t *addr16);
00056 void thread_extension_mcast_subscrition_change(protocol_interface_info_entry_t *interface);
00057 void thread_extension_address_registration_trigger(protocol_interface_info_entry_t *interface);
00058 void thread_extension_route_set(protocol_interface_info_entry_t *cur);
00059 void thread_extension_activate(protocol_interface_info_entry_t *cur);
00060 bool thread_extension_enabled(protocol_interface_info_entry_t *cur);
00061 bool thread_extension_context_can_delete(int8_t id, uint8_t servicesPrefix[16], uint8_t context_prefix_length);
00062 bool thread_extension_version_check(uint8_t version);
00063 void thread_extension_discover_response_read(struct discovery_response_list *nwk_info, uint16_t discover_response_tlv, uint8_t *data_ptr, uint16_t data_len);
00064 void thread_extension_discover_response_tlv_write(uint16_t *data, uint8_t version, uint16_t securityPolicy);
00065 int thread_extension_service_init(protocol_interface_info_entry_t *cur);
00066 void thread_extension_addr_ntf_send(struct protocol_interface_info_entry *cur, uint8_t *destination_address, const uint8_t *addr_data_ptr, uint8_t bbr_status);
00067 #ifdef HAVE_THREAD_ROUTER
00068 bool thread_extension_joining_enabled(int8_t interface_id);
00069 uint8_t thread_extension_discover_response_len(protocol_interface_info_entry_t *cur);
00070 uint8_t *thread_extension_discover_response_write(protocol_interface_info_entry_t *cur, uint8_t *ptr);
00071 
00072 #else
00073 #define thread_extension_joining_enabled(interface_id) false
00074 #define thread_extension_discover_response_len(cur) 0
00075 #define thread_extension_discover_response_write(cur, ptr) (ptr)
00076 #endif //HAVE_THREAD_ROUTER
00077 #else
00078 
00079 #define thread_extension_allocate(cur)
00080 #define thread_extension_free(cur)
00081 #define thread_extension_init(interface_id,coap_service_id)
00082 #define thread_extension_network_prefix_get(interface_id,options_ptr,prefix_ptr,prefix_len) (-1)
00083 #define thread_extension_network_data_process(cur)
00084 #define thread_extension_primary_bbr_get(cur,addr_ptr,seq_ptr,timer1_ptr, timer2_ptr) (-1)
00085 #define thread_extension_address_registration(interface,addr,child_mac64,refresh_child_entry,duplicate_child_detected)
00086 #define thread_extension_address_generate(cur)
00087 #define thread_extension_aloc_generate(cur)
00088 #define thread_extension_aloc_map(cur, addr16) false
00089 #define thread_extension_mcast_subscrition_change(interface)
00090 #define thread_extension_route_set(cur)
00091 #define thread_extension_activate(cur)
00092 #define thread_extension_enabled(cur) (false)
00093 #define thread_extension_version_check(version) (false)
00094 #define thread_extension_discover_response_read(nwk_info, discover_response_tlv, data_ptr, data_len)
00095 #define thread_extension_discover_response_tlv_write(data, version, extension_bit) (data)
00096 #define thread_extension_service_init(cur) 0
00097 #define thread_extension_joining_enabled(interface_id) false
00098 #define thread_extension_discover_response_len(cur) 0
00099 #define thread_extension_discover_response_write(cur, ptr) (ptr)
00100 #define thread_extension_addr_ntf_send(cur,destination_address,addr_data_ptr,bbr_status)
00101 #define thread_extension_context_can_delete(id, servicesPrefix, context_prefix_length) false
00102 #endif
00103 
00104 #ifdef __cplusplus
00105 }
00106 #endif
00107 
00108 #endif /* THREAD_EXTENSION_H_ */