Kenji Arai / mbed-os_TYBLE16

Dependents:   TYBLE16_simple_data_logger TYBLE16_MP3_Air

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers protocol_6lowpan_bootstrap.h Source File

protocol_6lowpan_bootstrap.h

00001 /*
00002  * Copyright (c) 2015-2018, 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 /*
00019  * \file protocol_6lowpan_bootstrap.h
00020  *
00021  */
00022 
00023 #ifndef PROTOCOL_6LOWPAN_BOOTSTRAP_H_
00024 #define PROTOCOL_6LOWPAN_BOOTSTRAP_H_
00025 #include "net_interface.h"
00026 #include "Service_Libs/mle_service/mle_service_api.h"
00027 
00028 struct protocol_interface_info_entry;
00029 struct nd_router;
00030 
00031 #define MLE_NEIGHBOR_PURGE_NBR                3
00032 #define MLE_NEIGHBOR_PURGE_TIMER_TIMEOUT      4       // Times advertisement timeout
00033 
00034 #define MLE_ROUTER_DEFAULT_LIFETIME           128
00035 #define MLE_ROUTER_HOST_LIFETIME              400
00036 
00037 #define MLE_NBR_OF_NEIGHBOR_MAX_LIMIT         0
00038 #define MLE_NBR_OF_NEIGHBOR_LOWER_THRESHOLD   0
00039 #define MLE_NBR_OF_NEIGHBOR_UPPER_THRESHOLD   0
00040 #define MLE_TOKEN_BUCKET_SIZE                 0
00041 #define MLE_TOKEN_BUCKET_RATE                 0
00042 #define MLE_TOKEN_BUCKET_COUNT                0
00043 
00044 #define MLE_LINK_REQ_TOKEN_BUCKET_SIZE        3
00045 
00046 #define LOWPAN_MAX_FRAME_RETRIES 4
00047 
00048 // Waiting Scan confirm from MAC (ms)
00049 #define BOOTSTRAP_SCAN_TIMEOUT  30000
00050 // Waiting Start confirm from MAC (ms)
00051 #define BOOTSTRAP_START_TIMEOUT  10000
00052 
00053 typedef struct mle_6lowpan_data {
00054     uint16_t router_lifetime;               // default lifetime for router neighbor
00055     uint16_t host_lifetime;                 // default lifetime for host neighbor
00056 
00057     uint16_t nbr_of_neigh_lower_threshold;  // start to limit addition of neighbors to neighbor list
00058     uint16_t nbr_of_neigh_upper_threshold;  // only priority neighbors are added to neighbor list
00059     uint16_t nbr_of_neigh_max;              // maximum number of neighbors in neighbor list
00060 
00061     uint8_t token_bucket_size;              // MLE token bucket size
00062     uint8_t token_bucket_rate;              // Rate in which tokens are added to bucket (0.1 seconds * rate)
00063     uint8_t token_bucket_count;             // Count of tokens added to bucket at a time
00064 
00065     uint8_t link_req_token_bucket;          // Token bucket for MLE link request with non-valid security counter
00066 } mle_6lowpan_data_t;
00067 
00068 #ifdef PANA
00069 extern void nwk_6lowpan_bootsrap_pana_authentication_cb(bool processSuccesfully, struct protocol_interface_info_entry *cur);
00070 #endif
00071 #ifdef HAVE_6LOWPAN_ND
00072 uint8_t *protocol_6lowpan_mle_service_security_notify_cb(int8_t interface_id, mle_security_event_t event, uint8_t keyId);
00073 void arm_6lowpan_bootstrap_init(struct protocol_interface_info_entry *cur);
00074 uint8_t *protocol_6lowpan_nd_border_router_address_get(nwk_interface_id nwk_id);
00075 uint8_t protocol_6lowpan_rf_link_scalability_from_lqi(uint8_t lqi);
00076 void protocol_6lowpan_bootstrap_re_start(struct protocol_interface_info_entry *interface);
00077 void protocol_6lowpan_link_advertise_handle(struct nd_router *cur, struct protocol_interface_info_entry *cur_interface, uint16_t tick);
00078 void protocol_6lowpan_bootstrap_nd_ready(struct protocol_interface_info_entry *cur_interface);
00079 void protocol_6lowpan_nd_borderrouter_connection_down(struct protocol_interface_info_entry *interface);
00080 int8_t arm_6lowpan_mle_service_ready_for_security_init(protocol_interface_info_entry_t *cur);
00081 int protocol_6lowpan_router_synch_to_new_router(struct protocol_interface_info_entry *cur, uint8_t *ll64, uint8_t incoming_idr, bool retrans);
00082 void protocol_6lowpan_bootstrap(struct protocol_interface_info_entry *cur);
00083 int protocol_6lowpan_del_ll16(struct protocol_interface_info_entry *cur, uint16_t mac_short_address);
00084 int protocol_6lowpan_set_ll16(struct protocol_interface_info_entry *cur, uint16_t mac_short_address);
00085 int8_t arm_6lowpan_bootstarp_bootstrap_set(int8_t interface_id, net_6lowpan_mode_e bootstrap_mode, net_6lowpan_mode_extension_e net_6lowpan_mode_extension);
00086 struct mle_6lowpan_data *protocol_6lowpan_mle_data_get(void);
00087 bool lowpan_neighbour_data_clean(int8_t interface_id, const uint8_t *link_local_address);
00088 void arm_6lowpan_security_init_ifup(protocol_interface_info_entry_t *cur);
00089 void protocol_6lowpan_mle_timer(uint16_t ticks_update);
00090 #else
00091 #define protocol_6lowpan_nd_border_router_address_get(nwk_id) NULL
00092 #define arm_6lowpan_mle_service_ready_for_security_init(cur) -1
00093 #define protocol_6lowpan_bootstrap(cur) ((void)0)
00094 #define protocol_6lowpan_del_ll16(cur, mac_short_address) -1
00095 #define protocol_6lowpan_set_ll16(cur, mac_short_address) -1
00096 #define arm_6lowpan_bootstarp_bootstrap_set(interface_id, bootstrap_mode, net_6lowpan_mode_extension) -1
00097 #define protocol_6lowpan_mle_data_get() NULL
00098 #define arm_6lowpan_security_init_ifup(cur) ((void)0)
00099 #define protocol_6lowpan_mle_timer(ticks_update) ((void)0)
00100 #endif
00101 void bootstrap_timer_handle(uint16_t ticks);
00102 
00103 #endif /* PROTOCOL_6LOWPAN_BOOTSTRAP_H_ */