takashi kadono / Mbed OS Nucleo_446

Dependencies:   ssd1331

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers ws_common.h Source File

ws_common.h

00001 /*
00002  * Copyright (c) 2016-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 #ifndef WS_COMMON_H_
00019 #define WS_COMMON_H_
00020 
00021 
00022 #include "ns_types.h"
00023 #include "fhss_api.h "
00024 #include "fhss_config.h "
00025 #include "net_fhss.h"
00026 #include "6LoWPAN/ws/ws_common_defines.h"
00027 #include "6LoWPAN/ws/ws_neighbor_class.h"
00028 
00029 struct ws_pan_information_s;
00030 struct ws_neighbor_class_s;
00031 
00032 typedef struct parent_info_s {
00033         uint16_t pan_id;            /**< PAN ID */
00034         uint8_t addr[8];            /**< address */
00035         uint8_t link_quality;       /**< LQI value measured during reception of the MPDU */
00036         int8_t signal_dbm;          /**< This extension for normal IEEE 802.15.4 Data indication */
00037         ws_pan_information_t pan_information;
00038         ws_utt_ie_t ws_utt;
00039         ws_us_ie_t ws_us;
00040         uint32_t timestamp;            /**< Timestamp when packet was received */
00041 }parent_info_t;
00042 
00043 typedef struct ws_info_s {
00044     char network_name[33]; // Network name max 32 octets + terminating 0.
00045     uint16_t network_pan_id;
00046 
00047     trickle_t trickle_pan_config_solicit;
00048     trickle_t trickle_pan_config;
00049     trickle_t trickle_pan_advertisement_solicit;
00050     trickle_t trickle_pan_advertisement;
00051     uint8_t rpl_state; // state from rpl_event_t
00052     uint8_t pas_requests; // Amount of PAN solicits sent
00053     parent_info_t parent_info;
00054     uint32_t pan_version_timer;            /**< border router version udate timeout */
00055     uint32_t pan_version_timeout_timer;    /**< routers will fallback to previous state after this */
00056     uint8_t gtkhash[32];
00057     bool configuration_learned:1;
00058 
00059     struct ws_pan_information_s pan_information;
00060     ws_hopping_schedule_t hopping_schdule;
00061     struct ws_neighbor_class_s neighbor_storage;
00062     struct fhss_timer *fhss_timer_ptr; // Platform adaptation for FHSS timers.
00063     struct fhss_api *fhss_api;
00064 } ws_info_t;
00065 
00066 #ifdef HAVE_WS
00067 
00068 int8_t ws_common_regulatory_domain_config(protocol_interface_info_entry_t *cur);
00069 
00070 int8_t ws_common_allocate_and_init(protocol_interface_info_entry_t *cur);
00071 
00072 void ws_common_seconds_timer(protocol_interface_info_entry_t *cur, uint32_t seconds);
00073 
00074 void ws_common_fast_timer(protocol_interface_info_entry_t *cur, uint16_t ticks);
00075 
00076 void ws_common_neighbor_update(protocol_interface_info_entry_t *cur, const uint8_t *ll_address);
00077 
00078 #define ws_info(cur) ((cur)->ws_info)
00079 #else
00080 #define ws_info(cur) ((ws_info_t *) NULL)
00081 #define ws_common_seconds_timer(cur, seconds)
00082 #define ws_common_neighbor_update(cur, ll_address) ((void) 0)
00083 #define ws_common_fast_timer(cur, ticks) ((void) 0)
00084 
00085 
00086 #endif //HAVE_WS
00087 #endif //WS_COMMON_H_