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
ws_common.h
00001 /* 00002 * Copyright (c) 2018-2019, 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 WS_COMMON_H_ 00019 #define WS_COMMON_H_ 00020 00021 00022 #include "ns_types.h" 00023 #include "ns_list.h" 00024 #include "fhss_api.h " 00025 #include "fhss_config.h " 00026 #include "net_fhss.h" 00027 #include "NWK_INTERFACE/Include/protocol.h" 00028 #include "6LoWPAN/ws/ws_config.h" 00029 #include "6LoWPAN/ws/ws_common_defines.h" 00030 #include "6LoWPAN/ws/ws_neighbor_class.h" 00031 #include "Service_Libs/mac_neighbor_table/mac_neighbor_table.h" 00032 00033 00034 extern uint16_t test_max_child_count_override; 00035 00036 struct ws_pan_information_s; 00037 struct ws_neighbor_class_s; 00038 00039 typedef struct parent_info_s { 00040 uint16_t pan_id; /**< PAN ID */ 00041 uint8_t addr[8]; /**< address */ 00042 uint8_t link_quality; /**< LQI value measured during reception of the MPDU */ 00043 int8_t signal_dbm; /**< This extension for normal IEEE 802.15.4 Data indication */ 00044 ws_pan_information_t pan_information; 00045 ws_utt_ie_t ws_utt; 00046 ws_us_ie_t ws_us; 00047 uint32_t timestamp; /**< Timestamp when packet was received */ 00048 uint32_t age; /**< Age of entry in 100ms ticks */ 00049 ns_list_link_t link; 00050 } parent_info_t; 00051 00052 typedef NS_LIST_HEAD (parent_info_t, link) parent_info_list_t; 00053 00054 typedef struct ws_nud_table_entry { 00055 void *neighbor_info; 00056 uint16_t timer; /*!< Timer which resolution is 100ms*/ 00057 unsigned retry_count: 2; 00058 bool wait_response: 1; /*!< True when NS is sended and wait NA, False when random timer is active*/ 00059 bool nud_process; 00060 ns_list_link_t link; 00061 } ws_nud_table_entry_t; 00062 00063 typedef NS_LIST_HEAD (ws_nud_table_entry_t, link) ws_nud_table_list_t; 00064 00065 typedef struct ws_info_s { 00066 char network_name[33]; // Network name max 32 octets + terminating 0. 00067 uint16_t network_pan_id; 00068 00069 trickle_t trickle_pan_config_solicit; 00070 trickle_t trickle_pan_config; 00071 trickle_t trickle_pan_advertisement_solicit; 00072 trickle_t trickle_pan_advertisement; 00073 trickle_params_t trickle_params_pan_discovery; 00074 uint8_t network_size_config; // configuration for network size selection of application. 00075 uint16_t rpl_parent_candidate_max; 00076 uint16_t rpl_selected_parent_max; 00077 uint8_t rpl_state; // state from rpl_event_t 00078 uint8_t pas_requests; // Amount of PAN solicits sent 00079 parent_info_t parent_info[WS_PARENT_LIST_SIZE]; 00080 parent_info_list_t parent_list_free; 00081 parent_info_list_t parent_list_reserved; 00082 uint32_t pan_version_timer; /**< border router version udate timeout */ 00083 uint32_t pan_version_timeout_timer; /**< routers will fallback to previous state after this */ 00084 uint8_t gtkhash[32]; 00085 bool configuration_learned: 1; 00086 bool trickle_pas_running: 1; 00087 bool trickle_pa_running: 1; 00088 bool trickle_pcs_running: 1; 00089 bool trickle_pc_running: 1; 00090 bool fhss_owner: 1; 00091 // default fhss parameters for this device 00092 uint8_t fhss_uc_dwell_interval; 00093 uint8_t fhss_bc_dwell_interval; 00094 uint32_t fhss_bc_interval; 00095 uint8_t fhss_uc_channel_function; 00096 uint8_t fhss_bc_channel_function; 00097 uint16_t fhss_uc_fixed_channel; 00098 uint16_t fhss_bc_fixed_channel; 00099 uint32_t fhss_channel_mask[8]; 00100 ws_nud_table_entry_t nud_table_entrys[ACTIVE_NUD_PROCESS_MAX]; 00101 ws_nud_table_list_t active_nud_process; 00102 ws_nud_table_list_t free_nud_entries; 00103 struct ws_pan_information_s pan_information; 00104 ws_hopping_schedule_t hopping_schdule; 00105 struct ws_statistics *stored_stats_ptr; 00106 struct ws_neighbor_class_s neighbor_storage; 00107 struct fhss_timer *fhss_timer_ptr; // Platform adaptation for FHSS timers. 00108 struct fhss_api *fhss_api; 00109 } ws_info_t; 00110 00111 #ifdef HAVE_WS 00112 00113 int8_t ws_generate_channel_list(uint32_t *channel_mask, uint16_t number_of_channels, uint8_t regulatory_domain); 00114 00115 int8_t ws_common_regulatory_domain_config(protocol_interface_info_entry_t *cur); 00116 00117 uint16_t ws_common_channel_number_calc(uint8_t regulatory_domain, uint8_t operating_class); 00118 00119 int8_t ws_common_allocate_and_init(protocol_interface_info_entry_t *cur); 00120 00121 void ws_common_network_size_configure(protocol_interface_info_entry_t *cur, uint16_t network_size); 00122 00123 void ws_common_seconds_timer(protocol_interface_info_entry_t *cur, uint32_t seconds); 00124 00125 void ws_common_fast_timer(protocol_interface_info_entry_t *cur, uint16_t ticks); 00126 00127 void ws_common_neighbor_update(protocol_interface_info_entry_t *cur, const uint8_t *ll_address); 00128 00129 void ws_common_aro_failure(protocol_interface_info_entry_t *cur, const uint8_t *ll_address, bool cache_full); 00130 00131 void ws_common_neighbor_remove(protocol_interface_info_entry_t *cur, const uint8_t *ll_address); 00132 00133 bool ws_common_allow_child_registration(protocol_interface_info_entry_t *cur, const uint8_t *eui64); 00134 00135 void ws_common_etx_validate(protocol_interface_info_entry_t *interface, mac_neighbor_table_entry_t *neigh); 00136 00137 bool ws_common_negative_aro_mark(protocol_interface_info_entry_t *interface, const uint8_t *eui64); 00138 00139 00140 uint32_t ws_common_version_lifetime_get(uint8_t config); 00141 00142 uint32_t ws_common_version_timeout_get(uint8_t config); 00143 00144 #define ws_info(cur) ((cur)->ws_info) 00145 #else 00146 #define ws_info(cur) ((ws_info_t *) NULL) 00147 #define ws_common_seconds_timer(cur, seconds) 00148 #define ws_common_neighbor_update(cur, ll_address) ((void) 0) 00149 #define ws_common_aro_failure(cur, ll_address, cache_full) 00150 #define ws_common_neighbor_remove(cur, ll_address) 00151 #define ws_common_fast_timer(cur, ticks) ((void) 0) 00152 #define ws_common_allow_child_registration(cur, eui64) (false) 00153 #define ws_common_etx_validate(interface, neigh) ((void) 0) 00154 #define ws_common_negative_aro_mark(interface, eui64)(false) 00155 00156 #endif //HAVE_WS 00157 #endif //WS_COMMON_H_
Generated on Tue Jul 12 2022 13:55:04 by
