Skip to content

Commit 1687b4a

Browse files
author
Arto Kinnunen
committed
Squashed 'features/nanostack/sal-stack-nanostack/' changes from cc03296..9a21668
9a21668 Merge branch 'release_internal' into release_external 8e72b80 MAC CCA thr: Check if channel out of range (#2363) 146a0a3 Corrected trace on authenticator d04a96d Merge pull request #2361 from ARMmbed/sync_with_mbedos 2c2b915 Added empty function for ns time callback 76ac0de Remove NCS36510 target 0258ac3 Remove KW24D target 788f01b Netsocket/lwIP Stack: Remove support for ARM Compiler 5 2fbc7a1 Corrected invalid memory read on access revoke 941b9b4 Updates to stagger/latency (#2358) c2abaaa Corrected defects 1811194 Corrected warning trace, validations and ut stubs 69e2d19 Added NS filesystem and interface to application c5b6993 refactored packet ingress a05605e Unsecured packets will be acked by default automatically. 36dfb29 MAC: Implemented automatic CCA threshold (#2353) 0396b97 Revert EAPOL simplify failure handling and focus this problem later on. b2fe3d4 Ignoring authentication failure if security protocol already started 11de56d Added info API for Wi-SUN border router 87a4f69 Added EAPOL key storage to authenticator and unified GTK storage (#2345) ff1ca25 EAPOL failure simplify and EAPOL relay agent add trace when eapol temp pool is empty 6667b31 Update NA trace 34cdafe Temporary EAPOL neighbour entry Update and MAC MLME update d092f83 Iotthd 3995 (#2347) e2ea4e4 Disabled BR (TLS server) EC calculation queue 5759851 Changed the rate limiting function to calculate the values runtime 899e755 Make it possible to update tr51 table to larger dynamically 8436669 Added configuration for DHCP lifetime value da732bc When network name or PAN ID is changed authenticator updates MAC keys git-subtree-dir: features/nanostack/sal-stack-nanostack git-subtree-split: 9a21668
1 parent 8696907 commit 1687b4a

File tree

85 files changed

+5203
-979
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

85 files changed

+5203
-979
lines changed

mbed_lib.json

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,6 @@
99
},
1010
"macros": ["NS_USE_EXTERNAL_MBED_TLS"],
1111
"target_overrides": {
12-
"KW24D": {
13-
"nanostack.configuration": "lowpan_router"
14-
},
15-
"NCS36510": {
16-
"nanostack.configuration": "lowpan_router"
17-
},
1812
"TB_SENSE_12": {
1913
"nanostack.configuration": "lowpan_router"
2014
},

nanostack/fhss_config.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,16 @@ typedef struct fhss_configuration {
8888
*/
8989
typedef int32_t fhss_vendor_defined_cf(const fhss_api_t *api, uint16_t slot, uint8_t eui64[8], uint16_t bsi, uint16_t number_of_channels);
9090

91+
/**
92+
* \brief Struct fhss_config_parameters defines FHSS configuration parameters.
93+
*
94+
*/
95+
typedef struct fhss_config_parameters {
96+
/** Number of channel retries defines how many consecutive channels are used when retransmitting a frame after initial transmission channel. */
97+
uint8_t number_of_channel_retries;
98+
} fhss_config_parameters_t;
99+
100+
91101
/**
92102
* \brief Struct fhss_ws_configuration defines configuration of WS FHSS.
93103
*/
@@ -125,6 +135,9 @@ typedef struct fhss_ws_configuration {
125135
/** Vendor defined channel function. */
126136
fhss_vendor_defined_cf *vendor_defined_cf;
127137

138+
/** Configuration parameters. */
139+
fhss_config_parameters_t config_parameters;
140+
128141
} fhss_ws_configuration_t;
129142

130143
/**

nanostack/fhss_test_api.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,17 @@ extern "C" {
3939
*/
4040
int8_t fhss_set_optimal_packet_length(const fhss_api_t *fhss_api, uint16_t packet_length);
4141

42+
/**
43+
* \brief Set number of channel retries
44+
*
45+
* \param fhss_api FHSS instance.
46+
* \param number_of_channel_retries Number of channel retries
47+
*
48+
* \return 0 Success
49+
* \return -1 Failure
50+
*/
51+
int8_t fhss_set_number_of_channel_retries(const fhss_api_t *fhss_api, uint8_t number_of_channel_retries);
52+
4253
#ifdef __cplusplus
4354
}
4455
#endif

nanostack/mlme.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,8 @@ typedef enum {
264264
macAutoRequestKeyIndex = 0x7b, /*<The index of the key used for automatic data*/
265265
macDefaultKeySource = 0x7c, /*<Default key source*/
266266
//NON standard extension
267+
macCCAThresholdStart = 0xf4, /*< Start automatic CCA threshold */
268+
macDevicePendingAckTrig = 0xf5, /*< Trig Pending ACK for Accepted Data packet for temporary neighbour */
267269
mac802_15_4Mode = 0xf6, /*<IEEE 802.15.4 mode*/
268270
macDeviceDescriptionPanIDUpdate = 0xf7, /*<Thread pending link update case this will update device descrioton list pan-id to new one*/
269271
macTXPower = 0xf8, /*<TX output power*/

nanostack/ns_file_system.h

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,109 @@ int ns_file_system_set_root_path(const char *root_path);
5050
*/
5151
char *ns_file_system_get_root_path(void);
5252

53+
/**
54+
* \brief NS file handle
55+
*
56+
*/
57+
typedef void *NS_FILE;
58+
59+
/**
60+
* File open callback
61+
*
62+
* Depending on underlying file system file open for read for non-existing
63+
* files can return success. In that case file read will fail.
64+
*
65+
* \param filename filename
66+
* \param mode can be either "r" or "w"
67+
*
68+
* \return file handle
69+
* \return NULL on error
70+
*
71+
*/
72+
typedef NS_FILE(*ns_file_open)(const char *filename, const char *mode);
73+
74+
/**
75+
* File close callback
76+
*
77+
* \param handle file handle
78+
*
79+
* \return 0 on success
80+
* \return < 0 in case of errors
81+
*
82+
*/
83+
typedef int (*ns_file_close)(NS_FILE *handle);
84+
85+
/**
86+
* File remove callback
87+
*
88+
* \param filename filename
89+
*
90+
* \return 0 on success
91+
* \return < 0 in case of errors
92+
*
93+
*/
94+
typedef int (*ns_file_remove)(const char *filename);
95+
96+
/**
97+
* File write callback
98+
*
99+
* Write is not stream write. The whole file is written from start to end
100+
* and if function is called again, previous file content is replaced with
101+
* new content.
102+
*
103+
* \param handle file handle
104+
* \param buffer buffer
105+
* \param buffer buffer size
106+
*
107+
* \return bytes written
108+
*
109+
*/
110+
typedef size_t (*ns_file_write)(NS_FILE *handle, const void *buffer, size_t size);
111+
112+
/**
113+
* File read callback
114+
*
115+
* Read is not stream read. The whole file is read from start to end
116+
* and if function is called again, read is started from start again.
117+
*
118+
* \param handle file handle
119+
* \param buffer buffer
120+
* \param size buffer size
121+
*
122+
* \return bytes written
123+
*
124+
*/
125+
typedef size_t (*ns_file_read)(NS_FILE *handle, void *buffer, size_t size);
126+
127+
/**
128+
* File size callback
129+
*
130+
* Reads file size.
131+
*
132+
* \param handle file handle
133+
* \param size file size
134+
*
135+
* \return 0 on success
136+
* \return < 0 in case of reading file size is not supported
137+
*
138+
*/
139+
typedef int (*ns_file_size)(NS_FILE *handle, size_t *size);
140+
141+
/**
142+
* File callbacks set
143+
*
144+
* Sets file handling callbacks to nanostack.
145+
*
146+
* \param open file open callback
147+
* \param close file close callback
148+
* \param remove file remove callback
149+
* \param write file write callback
150+
* \param read file read callback
151+
* \param size file size callback
152+
*
153+
*/
154+
void ns_file_system_callbacks_set(ns_file_open open, ns_file_close close, ns_file_remove remove, ns_file_write write, ns_file_read read, ns_file_size size);
155+
53156
#ifdef __cplusplus
54157
}
55158
#endif

nanostack/ns_time_api.h

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
/*
2+
* Copyright (c) 2020, Arm Limited and affiliates.
3+
* SPDX-License-Identifier: Apache-2.0
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
18+
/**
19+
* \file ns_time_api.h
20+
* \brief Nanostack time API
21+
*
22+
* This is Nanostack time API.
23+
*
24+
*/
25+
26+
#ifndef NS_TIME_API_H_
27+
#define NS_TIME_API_H_
28+
29+
#include "ns_types.h"
30+
31+
/**
32+
* System time callback.
33+
*
34+
* Callback shall return the system time in seconds after 1970.
35+
*
36+
* \param seconds system time in seconds
37+
*
38+
*/
39+
typedef uint64_t ns_time_api_system_time_callback(void);
40+
41+
/**
42+
* System time callback set.
43+
*
44+
* Sets callback for the system time.
45+
*
46+
* \param callback system time callback
47+
*
48+
*/
49+
void ns_time_api_system_time_callback_set(ns_time_api_system_time_callback callback);
50+
51+
#endif /* NS_TIME_API_H_ */

nanostack/platform/arm_hal_phy.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ typedef enum {
8080
PHY_EXTENSION_FILTERING_SUPPORT, /**< Return filtering modes that can be supported by the PHY driver. See phy_link_filters_e */
8181
PHY_EXTENSION_SET_TX_POWER, /**< Set TX output power which is given as percentage of maximum. 0 is the lowest possible TX power and 100 is the highest possible TX power */
8282
PHY_EXTENSION_SET_CCA_THRESHOLD, /**< Set CCA threshold which is given as percentage of maximum threshold. 0 is the lowest(strictest) possible threshold and 100 is the highest possible threshold */
83+
PHY_EXTENSION_SET_CHANNEL_CCA_THRESHOLD, /**< Set CCA threshold which is given as dBm. This value is set in PHY_LINK_CCA_PREPARE callback and PHY driver should update the CCA threshold configuration */
8384
PHY_EXTENSION_SET_802_15_4_MODE /**< Set IEEE 802.15.4 mode as defined by phy_802_15_4_mode_t*/
8485
} phy_extension_type_e;
8586

nanostack/ws_bbr_api.h

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,34 @@
3030

3131
#include "ns_types.h"
3232

33+
/**
34+
* \brief Struct ws_statistics Border router dynamic information.
35+
*/
36+
typedef struct bbr_information {
37+
/** Timestamp of the the device. Can be used as version number*/
38+
uint64_t timestamp;
39+
/** Border router dodag id */
40+
uint8_t dodag_id[16];
41+
/** Address prefix given to devices in network set to 0 if not available*/
42+
uint8_t prefix[8];
43+
/** Amount of devices in the network. */
44+
uint16_t devices_in_network;
45+
/** Border router instance identifier defined in RPL */
46+
uint8_t instance_id;
47+
/** RPL version number */
48+
uint8_t version;
49+
} bbr_information_t;
50+
51+
/**
52+
* \brief Struct route_info is parent child relation structure.
53+
*/
54+
typedef struct bbr_route_info {
55+
/** IID of target device public IPv6 address can be formed by combining prefix + IID*/
56+
uint8_t target[8];
57+
/** IID of parent*/
58+
uint8_t parent[8];
59+
} bbr_route_info_t;
60+
3361
/**
3462
* Start backbone border router service.
3563
*
@@ -83,6 +111,49 @@ int ws_bbr_configure(int8_t interface_id, uint16_t options);
83111
*/
84112
void ws_bbr_stop(int8_t interface_id);
85113

114+
/**
115+
* Get border router information
116+
*
117+
* \param interface_id interface ID of the Wi-SUN network
118+
* \param info_ptr Structure given to stack where information is stored
119+
*
120+
* \return 0 on success
121+
* \return <0 in case of errors
122+
*
123+
*/
124+
int ws_bbr_info_get(int8_t interface_id, bbr_information_t *info_ptr);
125+
126+
/**
127+
* Routing table get
128+
*
129+
* Table is Parent child relation using the Global address IID of the devices
130+
* To get the full IPv6 address of the device.
131+
* IPv6 = Global Prefix + IID.
132+
*
133+
* Routing table is in the format: 18 bytes per entry
134+
* | Node IID 8 bytes | parent IID 8 bytes |
135+
* | 1122112211221122 | 1111111111111111 |
136+
* | 1133113311331133 | 1111111111111111 |
137+
* | 1144114411441144 | 1111111111111111 |
138+
* | 1155115511551155 | 1122112211221122 |
139+
* | 1166116611661166 | 1122112211221122 |
140+
* | 1177117711771177 | 1155115511551155 |
141+
* | 1188118811881188 | 1177117711771177 |
142+
*
143+
* Order is not assured only parent child link is given in random order
144+
*
145+
* Return value is device amount in network divided by 16 bytes per route entry
146+
*
147+
* \param interface_id interface ID of the Wi-SUN network
148+
* \param table_ptr Application allocated memory block where routing table is written.
149+
* \param table_len Length of the table allocated by application given as amount of entries.
150+
*
151+
* \return 0 - x on success indicates amount of bytes written to the table_ptr
152+
* \return <0 in case of errors
153+
*
154+
*/
155+
int ws_bbr_routing_table_get(int8_t interface_id, bbr_route_info_t *table_ptr, uint16_t table_len);
156+
86157
/**
87158
* Remove node's keys from border router
88159
*
@@ -243,4 +314,40 @@ int ws_bbr_pan_configuration_get(int8_t interface_id, uint16_t *pan_id);
243314
*/
244315
int ws_bbr_pan_configuration_validate(int8_t interface_id, uint16_t pan_id);
245316

317+
/**
318+
* ws_bbr_key_storage_memory_set sets memory used for key storages
319+
*
320+
* This functions can be used to set memory used by EAPOL key storage. When memory
321+
* areas are set, module does not allocate memory internally from heap.
322+
*
323+
* \param interface_id Network interface ID.
324+
* \param key_storages_number number of memory areas.
325+
* \param key_storage_size array of memory area sizes.
326+
* \param key_storages array of memory area start pointers.
327+
*
328+
* \return < 0 failure
329+
* \return >= 0 success
330+
*
331+
*/
332+
int ws_bbr_key_storage_memory_set(int8_t interface_id, uint8_t key_storages_number, const uint16_t *key_storage_size, void **key_storages);
333+
334+
/**
335+
* ws_bbr_key_storage_settings_set sets key storage settings
336+
*
337+
* This functions can be used to set the settings of EAPOL key storage.
338+
* Allocation max number and allocation size sets the settings that are used when key storage
339+
* memory is allocated dynamically from heap. These settings must be set before (first) interface
340+
* up and shall not be set if key storage memory is set by ws_pae_key_storage_memory_set() call.
341+
*
342+
* \param interface_id Network interface ID.
343+
* \param alloc_max_number maximum number of allocation made to dynamic memory.
344+
* \param alloc_size size of each allocation.
345+
* \param storing_interval interval in which the check to store to NVM is made.
346+
*
347+
* \return < 0 failure
348+
* \return >= 0 success
349+
*
350+
*/
351+
int ws_bbr_key_storage_settings_set(int8_t interface_id, uint8_t alloc_max_number, uint16_t alloc_size, uint16_t storing_interval);
352+
246353
#endif /* WS_BBR_API_H_ */

0 commit comments

Comments
 (0)