Skip to content

Commit 4ed4c4f

Browse files
author
Arto Kinnunen
committed
Squashed 'connectivity/nanostack/sal-stack-nanostack/' changes from b3fe574..48609ae
48609ae Merge branch 'release_internal' into release_external 62d8586 Ignore ns_monitor when receiving Ack (ARMmbed#2417) 3323f36 Add support for Ethernet RA dns configuration d8e7d40 Iotthd 4239 (ARMmbed#2414) b46f3c6 add empty function for ws_stack_info_get fc97980 Changed RADIUS shared secret length to 16-bit value f827ffc Added information API to Wi-SUN and border router 8f1f9d5 EDFE error handling update 51bf94e Fix adaptation interface unit tests (ARMmbed#2409) 0860b57 FHSS_WS: Fixed reading unicast remaining slots (ARMmbed#2408) 4d8c03b Border Router RADIUS client basic authentication functionality (ARMmbed#2406) fbfada9 Adaptation IF: Allocate fragmentation buffer only if needed (ARMmbed#2407) 66f1bff Added storing of PAN version to NVM on BR 89826ce Iotthd 4224 (ARMmbed#2403) 3fc1ae2 BR EUI-64 is now selected for 4WH using PMKID on 4WH Message 1 af8438e Timing tool traces (ARMmbed#2401) 7938795 Fixed new PD data request for check if EDFE exchange is active. 85ab8fd Extented Frame exchange support 86b1f27 Merge pull request ARMmbed#2399 from ARMmbed/IOTTHD-4220 fed69e0 Add missing test method to ws_empty_functions 6b58e26 Add EDFE mode to Socket API setsockopt 1283077 Test API to adjust 6LoWPAN fragmentation MTU size (ARMmbed#2398) e787874 Init MAC MTU size based on driver MTU size (ARMmbed#2397) bf8e89e Ignore neighbors using unsupported channel function (ARMmbed#2395) 1c263fd FHSS exclude channel usage from mask and Brazilian Domain support 841dcbe MAC: Configurable data whitening (ARMmbed#2393) 9a10d66 Fix global address detection (ARMmbed#2392) f27fe86 Corrected network name and PAN ID change on auth start bcce0ed Clarified border router routing table API description e4630a4 Wi-SUN interface now informs address changes as interface events 2174374 Fix error found by coverity (ARMmbed#2389) 843254a MPL: traces for transmit and receive message (ARMmbed#2387) git-subtree-dir: connectivity/nanostack/sal-stack-nanostack git-subtree-split: 48609ae
1 parent 42a7bff commit 4ed4c4f

File tree

98 files changed

+4754
-412
lines changed

Some content is hidden

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

98 files changed

+4754
-412
lines changed

nanostack/mac_api.h

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,14 @@ typedef void mcps_data_indication_ext(const mac_api_t *api, const mcps_data_ind_
183183
typedef void mcps_ack_data_req_ext(const mac_api_t *api, mcps_ack_data_payload_t *data, int8_t rssi, uint8_t lqi);
184184

185185

186+
/**
187+
* @brief mcps_edfe_handler Callback for handle and detect edfe frame
188+
* @param api The API which handled the response
189+
* @param response_message Enhanced message response data and status
190+
*/
191+
typedef void mcps_edfe_handler(const mac_api_t *api, mcps_edfe_response_t *response_message);
192+
193+
186194
/**
187195
* @brief mcps_purge_confirm MCPS-PURGE confirm is called as a response to MCPS-PURGE request
188196
* @param api The API which handled the request
@@ -254,6 +262,15 @@ typedef int8_t mac_api_enable_mcps_ext(mac_api_t *api,
254262
mcps_data_confirm_ext *data_cnf_cb,
255263
mcps_ack_data_req_ext *ack_data_req_cb);
256264

265+
/**
266+
* @brief mac_api_enable_mcps_edfe_ext Initialises MAC 2015 extension for EDFE handler callbacks must be non-NULL.
267+
* @param api mac_api_t pointer, which is created by application.
268+
* @param edfe_ind_cb Upper layer function to handle and detect EDFE's
269+
* @return -1 if error, -2 if OOM, 0 otherwise
270+
*/
271+
typedef int8_t mac_api_enable_mcps_edfe_ext(mac_api_t *api,
272+
mcps_edfe_handler *edfe_ind_cb);
273+
257274
/**
258275
* \brief Struct mac_api_s defines functions for two-way communications between external MAC and Upper layer.
259276
* Application creates mac_api_t object by calling external MAC's creator function.
@@ -263,17 +280,18 @@ typedef int8_t mac_api_enable_mcps_ext(mac_api_t *api,
263280
struct mac_api_s {
264281
mac_api_initialize *mac_initialize; /**< MAC initialize function to use */
265282
mac_api_enable_mcps_ext *mac_mcps_extension_enable; /**< MAC MCPS IE extension enable function, optional feature */
283+
mac_api_enable_mcps_edfe_ext *mac_mcps_edfe_enable; /**< MAC MCPS MCPS EDFE frame extension enable function, optional feature */
266284
//External MAC callbacks
267285
mlme_request *mlme_req; /**< MAC MLME request function to use */
268286
mcps_data_request *mcps_data_req; /**< MAC MCPS data request function to use */
269287
mcps_data_request_ext *mcps_data_req_ext; /**< MAC MCPS data request with Information element extension function to use */
270288
mcps_purge_request *mcps_purge_req; /**< MAC MCPS purge request function to use */
271-
272289
//Upper layer callbacksMLME_ASSOCIATE
273290
mcps_data_confirm *data_conf_cb; /**< MAC MCPS data confirm callback function */
274291
mcps_data_confirm_ext *data_conf_ext_cb; /**< MAC MCPS data confirm with payload callback function */
275292
mcps_data_indication *data_ind_cb; /**< MAC MCPS data indication callback function */
276293
mcps_data_indication_ext *data_ind_ext_cb; /**< MAC MCPS data indication with IE extension's callback function */
294+
mcps_edfe_handler *edfe_ind_cb; /**< MAC MCPS EDFE detection extension's callback function */
277295
mcps_ack_data_req_ext *enhanced_ack_data_req_cb; /**< Enhanced ACK IE element and payload request from MAC user */
278296
mcps_purge_confirm *purge_conf_cb; /**< MAC MCPS purge confirm callback function */
279297
mlme_confirm *mlme_conf_cb; /**< MAC MLME confirm callback function */

nanostack/mac_mcps.h

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ typedef struct mcps_data_req_s {
4444
bool PendingBit: 1; /**< Specifies whether more fragments are to be sent or not */
4545
bool SeqNumSuppressed: 1; /**< True suppress sequence number from frame. This will be only checked when 2015 extension is enabled */
4646
bool PanIdSuppressed: 1; /**< True suppress PAN-id is done when possible from frame. This will be only checked when 2015 extension is enabled */
47+
bool ExtendedFrameExchange: 1; /**< True for Extended Frame change. This will be only checked when 2015 extension and enhanced frame is enabled */
4748
mlme_security_t Key; /**< Security key */
4849
} mcps_data_req_t;
4950

@@ -86,6 +87,7 @@ typedef struct mcps_data_ind_s {
8687
uint16_t SrcPANId; /**< Source PAN ID */
8788
uint8_t SrcAddr[8]; /**< Source address */
8889
unsigned DstAddrMode: 2; /**< Destination address mode */
90+
bool DSN_suppressed: 1; /**< Indicate when DSN not include valid sequency id */
8991
uint16_t DstPANId; /**< Destination PAN ID */
9092
uint8_t DstAddr[8]; /**< Destination address */
9193
uint8_t mpduLinkQuality; /**< LQI value measured during reception of the MPDU */
@@ -164,5 +166,31 @@ typedef struct mcps_purge_conf_s {
164166
uint8_t status; /**< Status of the purge performed */
165167
} mcps_purge_conf_t;
166168

169+
#define MCPS_EDFE_NORMAL_FRAME 0 /**< Normal Data message normal behaviour */
170+
#define MCPS_EDFE_MALFORMED_FRAME 1 /**< Drop whole packet */
171+
#define MCPS_EDFE_TX_FRAME 2 /**< Tx message send data if pending in 1ms -5ms time window */
172+
#define MCPS_EDFE_RESPONSE_FRAME 3 /**< Response message send data if pending in 1ms -5ms time window */
173+
#define MCPS_EDFE_FINAL_FRAME_TX 4 /**< Final response message send in 1ms -5ms time window */
174+
#define MCPS_EDFE_FINAL_FRAME_RX 5 /**< EDFE session can be close at MAC side and drop this packet */
175+
176+
/**
177+
* @brief struct mcps_edfe_response_t EDFE detetction and response structure
178+
*
179+
*/
180+
typedef struct mcps_edfe_response_s {
181+
struct mcps_data_ie_list ie_elements; /**< IE hader and payload's elements from Packet */
182+
struct mcps_data_req_ie_list ie_response; /**< IE hader and payload's elements for Response Packet */
183+
uint8_t edfe_message_status; /**< Indicate Packet handler status */
184+
uint8_t message_handle; /**< EDFE Data request message ID for detect pending data at LLC layer*/
185+
int8_t rssi; /**< Received packet signal streng in dbm */
186+
unsigned SrcAddrMode: 2; /**< Source address mode: used for RX validation and TX purpose */
187+
unsigned DstAddrMode: 2; /**< Destination address mode: used for RX validation and TX purpose */
188+
uint8_t Address[8]; /**< RX: Packet Address Src & TX Response Destination address */
189+
bool SeqNumSuppressed: 1; /**< True suppress sequence number from frame. This will be only checked when 2015 extension is enabled */
190+
bool PanIdSuppressed: 1; /**< True suppress PAN-id is done when possible from frame. */
191+
bool wait_response: 1; /**< True enable response wait timer and re-send operation. */
192+
bool use_message_handle_to_discover: 1; /**< EDFE Data request message ID is valid at message_handle. */
193+
} mcps_edfe_response_t;
194+
167195

168196
#endif // MAC_MCPS_H

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+
macEdfeForceStop = 0xf2, /*< Use this command for Data wait timeout at LLC: Mac stop Edfe session data wait and enable normal FHSS mode */
268+
macSetDataWhitening = 0xf3, /*< Enable or disable data whitening, boolean true for enable, false for disable */
267269
macCCAThresholdStart = 0xf4, /*< Start automatic CCA threshold */
268270
macDevicePendingAckTrig = 0xf5, /*< Trig Pending ACK for Accepted Data packet for temporary neighbour */
269271
mac802_15_4Mode = 0xf6, /*<IEEE 802.15.4 mode*/

nanostack/net_interface.h

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,12 @@ typedef struct {
286286
uint8_t *beacon_payload_tlv_ptr; /**< Optional steering parameters. */
287287
} network_driver_setup_s;
288288

289+
/** CCA threshold table */
290+
typedef struct {
291+
uint8_t number_of_channels; /**< Number of channels */
292+
const int8_t *cca_threshold_table; /**< CCA threshold table */
293+
} cca_threshold_table_s;
294+
289295
/**
290296
* Init 6LoWPAN library
291297
*
@@ -1135,6 +1141,20 @@ extern int8_t arm_nwk_set_cca_threshold(int8_t interface_id, uint8_t cca_thresho
11351141
*/
11361142
extern int8_t arm_nwk_set_tx_output_power(int8_t interface_id, uint8_t tx_power);
11371143

1144+
/**
1145+
* \brief Get CCA threshold table.
1146+
*
1147+
* This function can be used to read CCA threshold table.
1148+
* CCA threshold table structure contains number of channels and an array indicating the currently used CCA threshold value of each channel. CCA threshold values are updated by library continuously.
1149+
* If channels are reconfigured, number of channels and table length are changed automatically. User should check the table length (number of channels) before reading the table.
1150+
* Automatic CCA threshold feature may not be enabled before interface is up, causing function to return NULL.
1151+
* Returned pointer to cca_threshold_table_s structure is valid until interface is destroyed. Re-reading the pointer with this function is allowed any time.
1152+
*
1153+
* \param interface_id Network interface ID.
1154+
* \return NULL if automatic CCA threshold feature is not enabled, otherwise pointer to CCA threshold structure.
1155+
*/
1156+
extern const cca_threshold_table_s *arm_nwk_get_cca_threshold_table(int8_t interface_id);
1157+
11381158

11391159
#ifdef __cplusplus
11401160
}

nanostack/net_ipv6_api.h

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,4 +131,50 @@ int8_t arm_nwk_ipv6_opaque_iid_key(const void *secret_key, uint8_t key_len);
131131
*/
132132
int8_t arm_nwk_ipv6_opaque_iid_enable(int8_t interface_id, bool enable);
133133

134+
/**
135+
* \brief Enable/disable default route in Router advertisements
136+
*
137+
* Enable or disable RFC 4861 Default router configuration in router advertisements.
138+
* This makes the device a default router in the interface.
139+
*
140+
* \param interface_id Interface ID.
141+
* \param enable True to enable.
142+
* \return 0 enabled/disabled OK.
143+
* \return <0 failed (for example invalid interface ID).
144+
*
145+
*/
146+
int8_t arm_nwk_ipv6_default_route_enable(int8_t interface_id, bool enable);
147+
148+
/**
149+
* \brief add Recursive DNS Server Option information to Router advertisements
150+
*
151+
* Add Recursive DNS Server Option from RFC 8106 to router advertisements.
152+
* This makes it possible to configure DNS server address to other devices connected to the interface.
153+
*
154+
* \param interface_id Interface ID.
155+
* \param address 16 byte array for IPv6 address.
156+
* \param lifetime advertised lifetime of the entry. 0 to delete address.
157+
* \return 0 DNS server option option successful.
158+
* \return <0 failed (for example invalid interface ID).
159+
*
160+
*/
161+
int8_t arm_nwk_ipv6_dns_server_add(int8_t interface_id, uint8_t *address, uint32_t lifetime);
162+
163+
/**
164+
* \brief add DNS Search List Option information to Router advertisements
165+
*
166+
* Add DNS Search List Option from RFC 8106 to router advertisements.
167+
* This makes it possible to configure DNS search list to other devices connected to the interface.
168+
*
169+
* \param interface_id Interface ID.
170+
* \param data byte array encoded following https://tools.ietf.org/html/rfc1035#section-3.1.
171+
* \param data_len Length of the byte array
172+
* \param lifetime advertised lifetime of the entry. 0 to delete address.
173+
* \return 0 DNS server option option successful.
174+
* \return <0 failed (for example invalid interface ID).
175+
*
176+
*/
177+
int8_t arm_nwk_ipv6_dns_search_list_add(int8_t interface_id, uint8_t *data, uint16_t data_len, uint32_t lifetime);
178+
179+
134180
#endif /* NET_IPV6_API_H_ */

nanostack/net_ws_test.h

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,43 @@ int ws_test_gtk_time_settings_set(
167167
*/
168168
int ws_test_next_gtk_set(int8_t interface_id, uint8_t *gtk[4]);
169169

170+
/**
171+
* Sets 6LoWPAN fragmentation MTU size to test fragmentation
172+
*
173+
* \param interface_id Network interface ID.
174+
* \param mtu_size Size of 6LoWPAN MTU when fragmentation occurs.
175+
*
176+
* \return 0 Success
177+
* \return <0 Failure
178+
*/
179+
int ws_test_6lowpan_fragmentation_mtu_size_set(int8_t interface_id, uint16_t mtu_size);
180+
181+
/**
182+
* Disable First EDFE data packet send.
183+
*
184+
* Made only for test purpose for test EDFE client Data wait timeout.
185+
*
186+
* \param interface_id Network interface ID.
187+
* \param skip True for skip first data packet false disable unused flag.
188+
*
189+
* \return 0 Success
190+
* \return <0 Failure
191+
*/
192+
void ws_test_skip_edfe_data_send(int8_t interface_id, bool skip);
193+
194+
/**
195+
* Drop configured EDFE data packets.
196+
*
197+
* Made only for test purpose for test EDFE data sender retry send logic.
198+
*
199+
* \param interface_id Network interface ID.
200+
* \param number_of_dropped_frames How many packets will be dropped.
201+
*
202+
* \return 0 Success
203+
* \return <0 Failure
204+
*/
205+
int8_t ws_test_drop_edfe_data_frames(int8_t interface_id, uint8_t number_of_dropped_frames);
206+
170207
#ifdef __cplusplus
171208
}
172209
#endif

nanostack/platform/arm_hal_phy.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ typedef enum {
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 */
8383
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 */
84+
PHY_EXTENSION_SET_DATA_WHITENING, /**< Enable or disable data whitening. Boolean true for enable, false for disable */
8485
PHY_EXTENSION_SET_802_15_4_MODE /**< Set IEEE 802.15.4 mode as defined by phy_802_15_4_mode_t*/
8586
} phy_extension_type_e;
8687

nanostack/socket_api.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -712,11 +712,12 @@ static inline int8_t socket_read_session_address(int8_t socket, ns_address_t *ad
712712
* | SOCKET_IPV6_MULTICAST_LOOP | bool | Yes | Yes | No |
713713
* | SOCKET_IPV6_JOIN_GROUP | ns_ipv6_mreq_t | Set only | No | No |
714714
* | SOCKET_IPV6_LEAVE_GROUP | ns_ipv6_mreq_t | Set only | No | No |
715+
* | SOCKET_LATENCY | ns_ipv6_latency_t | Get only | No | No |
716+
* | SOCKET_STAGGER | ns_ipv6_stagger_t | Get only | No | No |
717+
* | SOCKET_EDFE_MODE | bool | Set only | No | No |
715718
* | SOCKET_BROADCAST_PAN | int8_t | Yes | No | No |
716719
* | SOCKET_LINK_LAYER_SECURITY | int8_t | Yes | No | No |
717720
* | SOCKET_INTERFACE_SELECT | int8_t | Yes | No | No |
718-
* | SOCKET_LATENCY | ns_ipv6_latency_t | Get only | No | No |
719-
* | SOCKET_STAGGER | ns_ipv6_stagger_t | Get only | No | No |
720721
*
721722
*/
722723

@@ -755,11 +756,10 @@ static inline int8_t socket_read_session_address(int8_t socket, ns_address_t *ad
755756
#define SOCKET_IPV6_JOIN_GROUP 15
756757
/** Leave a multicast group, using ns_ipv6_mreq_t */
757758
#define SOCKET_IPV6_LEAVE_GROUP 16
758-
/** Read estimated latency to reach destination */
759-
#define SOCKET_LATENCY 17
760-
/** Read estimated stagger value that can be used as initial delay after bootstrap or firmware update. */
761-
#define SOCKET_STAGGER 18
762759

760+
#define SOCKET_LATENCY 0xf9 /**< Not standard, read estimated latency to reach destination */
761+
#define SOCKET_STAGGER 0xfa /**< Not standard, read estimated stagger value that can be used as initial delay after bootstrap or firmware update. */
762+
#define SOCKET_EDFE_MODE 0xfb /**< Not standard, Extended Directed Frame Exchange mode enabled/disabled in MAC layer */
763763
#define SOCKET_BROADCAST_PAN 0xfc /**< Internal use - transmit with IEEE 802.15.4 broadcast PAN ID */
764764
#define SOCKET_LINK_LAYER_SECURITY 0xfd /**< Not standard enable or disable socket security at link layer (For 802.15.4). */
765765
#define SOCKET_INTERFACE_SELECT 0xfe /**< Not standard socket interface ID. */

0 commit comments

Comments
 (0)