Skip to content

Commit

Permalink
Squashed 'features/nanostack/sal-stack-nanostack/' changes from b3fe574
Browse files Browse the repository at this point in the history
…..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: features/nanostack/sal-stack-nanostack
git-subtree-split: 48609ae
  • Loading branch information
Arto Kinnunen committed Aug 18, 2020
1 parent e3c2a36 commit 9460619
Show file tree
Hide file tree
Showing 98 changed files with 4,754 additions and 412 deletions.
20 changes: 19 additions & 1 deletion nanostack/mac_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,14 @@ typedef void mcps_data_indication_ext(const mac_api_t *api, const mcps_data_ind_
typedef void mcps_ack_data_req_ext(const mac_api_t *api, mcps_ack_data_payload_t *data, int8_t rssi, uint8_t lqi);


/**
* @brief mcps_edfe_handler Callback for handle and detect edfe frame
* @param api The API which handled the response
* @param response_message Enhanced message response data and status
*/
typedef void mcps_edfe_handler(const mac_api_t *api, mcps_edfe_response_t *response_message);


/**
* @brief mcps_purge_confirm MCPS-PURGE confirm is called as a response to MCPS-PURGE request
* @param api The API which handled the request
Expand Down Expand Up @@ -254,6 +262,15 @@ typedef int8_t mac_api_enable_mcps_ext(mac_api_t *api,
mcps_data_confirm_ext *data_cnf_cb,
mcps_ack_data_req_ext *ack_data_req_cb);

/**
* @brief mac_api_enable_mcps_edfe_ext Initialises MAC 2015 extension for EDFE handler callbacks must be non-NULL.
* @param api mac_api_t pointer, which is created by application.
* @param edfe_ind_cb Upper layer function to handle and detect EDFE's
* @return -1 if error, -2 if OOM, 0 otherwise
*/
typedef int8_t mac_api_enable_mcps_edfe_ext(mac_api_t *api,
mcps_edfe_handler *edfe_ind_cb);

/**
* \brief Struct mac_api_s defines functions for two-way communications between external MAC and Upper layer.
* Application creates mac_api_t object by calling external MAC's creator function.
Expand All @@ -263,17 +280,18 @@ typedef int8_t mac_api_enable_mcps_ext(mac_api_t *api,
struct mac_api_s {
mac_api_initialize *mac_initialize; /**< MAC initialize function to use */
mac_api_enable_mcps_ext *mac_mcps_extension_enable; /**< MAC MCPS IE extension enable function, optional feature */
mac_api_enable_mcps_edfe_ext *mac_mcps_edfe_enable; /**< MAC MCPS MCPS EDFE frame extension enable function, optional feature */
//External MAC callbacks
mlme_request *mlme_req; /**< MAC MLME request function to use */
mcps_data_request *mcps_data_req; /**< MAC MCPS data request function to use */
mcps_data_request_ext *mcps_data_req_ext; /**< MAC MCPS data request with Information element extension function to use */
mcps_purge_request *mcps_purge_req; /**< MAC MCPS purge request function to use */

//Upper layer callbacksMLME_ASSOCIATE
mcps_data_confirm *data_conf_cb; /**< MAC MCPS data confirm callback function */
mcps_data_confirm_ext *data_conf_ext_cb; /**< MAC MCPS data confirm with payload callback function */
mcps_data_indication *data_ind_cb; /**< MAC MCPS data indication callback function */
mcps_data_indication_ext *data_ind_ext_cb; /**< MAC MCPS data indication with IE extension's callback function */
mcps_edfe_handler *edfe_ind_cb; /**< MAC MCPS EDFE detection extension's callback function */
mcps_ack_data_req_ext *enhanced_ack_data_req_cb; /**< Enhanced ACK IE element and payload request from MAC user */
mcps_purge_confirm *purge_conf_cb; /**< MAC MCPS purge confirm callback function */
mlme_confirm *mlme_conf_cb; /**< MAC MLME confirm callback function */
Expand Down
28 changes: 28 additions & 0 deletions nanostack/mac_mcps.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ typedef struct mcps_data_req_s {
bool PendingBit: 1; /**< Specifies whether more fragments are to be sent or not */
bool SeqNumSuppressed: 1; /**< True suppress sequence number from frame. This will be only checked when 2015 extension is enabled */
bool PanIdSuppressed: 1; /**< True suppress PAN-id is done when possible from frame. This will be only checked when 2015 extension is enabled */
bool ExtendedFrameExchange: 1; /**< True for Extended Frame change. This will be only checked when 2015 extension and enhanced frame is enabled */
mlme_security_t Key; /**< Security key */
} mcps_data_req_t;

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

#define MCPS_EDFE_NORMAL_FRAME 0 /**< Normal Data message normal behaviour */
#define MCPS_EDFE_MALFORMED_FRAME 1 /**< Drop whole packet */
#define MCPS_EDFE_TX_FRAME 2 /**< Tx message send data if pending in 1ms -5ms time window */
#define MCPS_EDFE_RESPONSE_FRAME 3 /**< Response message send data if pending in 1ms -5ms time window */
#define MCPS_EDFE_FINAL_FRAME_TX 4 /**< Final response message send in 1ms -5ms time window */
#define MCPS_EDFE_FINAL_FRAME_RX 5 /**< EDFE session can be close at MAC side and drop this packet */

/**
* @brief struct mcps_edfe_response_t EDFE detetction and response structure
*
*/
typedef struct mcps_edfe_response_s {
struct mcps_data_ie_list ie_elements; /**< IE hader and payload's elements from Packet */
struct mcps_data_req_ie_list ie_response; /**< IE hader and payload's elements for Response Packet */
uint8_t edfe_message_status; /**< Indicate Packet handler status */
uint8_t message_handle; /**< EDFE Data request message ID for detect pending data at LLC layer*/
int8_t rssi; /**< Received packet signal streng in dbm */
unsigned SrcAddrMode: 2; /**< Source address mode: used for RX validation and TX purpose */
unsigned DstAddrMode: 2; /**< Destination address mode: used for RX validation and TX purpose */
uint8_t Address[8]; /**< RX: Packet Address Src & TX Response Destination address */
bool SeqNumSuppressed: 1; /**< True suppress sequence number from frame. This will be only checked when 2015 extension is enabled */
bool PanIdSuppressed: 1; /**< True suppress PAN-id is done when possible from frame. */
bool wait_response: 1; /**< True enable response wait timer and re-send operation. */
bool use_message_handle_to_discover: 1; /**< EDFE Data request message ID is valid at message_handle. */
} mcps_edfe_response_t;


#endif // MAC_MCPS_H
2 changes: 2 additions & 0 deletions nanostack/mlme.h
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,8 @@ typedef enum {
macAutoRequestKeyIndex = 0x7b, /*<The index of the key used for automatic data*/
macDefaultKeySource = 0x7c, /*<Default key source*/
//NON standard extension
macEdfeForceStop = 0xf2, /*< Use this command for Data wait timeout at LLC: Mac stop Edfe session data wait and enable normal FHSS mode */
macSetDataWhitening = 0xf3, /*< Enable or disable data whitening, boolean true for enable, false for disable */
macCCAThresholdStart = 0xf4, /*< Start automatic CCA threshold */
macDevicePendingAckTrig = 0xf5, /*< Trig Pending ACK for Accepted Data packet for temporary neighbour */
mac802_15_4Mode = 0xf6, /*<IEEE 802.15.4 mode*/
Expand Down
20 changes: 20 additions & 0 deletions nanostack/net_interface.h
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,12 @@ typedef struct {
uint8_t *beacon_payload_tlv_ptr; /**< Optional steering parameters. */
} network_driver_setup_s;

/** CCA threshold table */
typedef struct {
uint8_t number_of_channels; /**< Number of channels */
const int8_t *cca_threshold_table; /**< CCA threshold table */
} cca_threshold_table_s;

/**
* Init 6LoWPAN library
*
Expand Down Expand Up @@ -1135,6 +1141,20 @@ extern int8_t arm_nwk_set_cca_threshold(int8_t interface_id, uint8_t cca_thresho
*/
extern int8_t arm_nwk_set_tx_output_power(int8_t interface_id, uint8_t tx_power);

/**
* \brief Get CCA threshold table.
*
* This function can be used to read CCA threshold table.
* 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.
* 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.
* Automatic CCA threshold feature may not be enabled before interface is up, causing function to return NULL.
* 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.
*
* \param interface_id Network interface ID.
* \return NULL if automatic CCA threshold feature is not enabled, otherwise pointer to CCA threshold structure.
*/
extern const cca_threshold_table_s *arm_nwk_get_cca_threshold_table(int8_t interface_id);


#ifdef __cplusplus
}
Expand Down
46 changes: 46 additions & 0 deletions nanostack/net_ipv6_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -131,4 +131,50 @@ int8_t arm_nwk_ipv6_opaque_iid_key(const void *secret_key, uint8_t key_len);
*/
int8_t arm_nwk_ipv6_opaque_iid_enable(int8_t interface_id, bool enable);

/**
* \brief Enable/disable default route in Router advertisements
*
* Enable or disable RFC 4861 Default router configuration in router advertisements.
* This makes the device a default router in the interface.
*
* \param interface_id Interface ID.
* \param enable True to enable.
* \return 0 enabled/disabled OK.
* \return <0 failed (for example invalid interface ID).
*
*/
int8_t arm_nwk_ipv6_default_route_enable(int8_t interface_id, bool enable);

/**
* \brief add Recursive DNS Server Option information to Router advertisements
*
* Add Recursive DNS Server Option from RFC 8106 to router advertisements.
* This makes it possible to configure DNS server address to other devices connected to the interface.
*
* \param interface_id Interface ID.
* \param address 16 byte array for IPv6 address.
* \param lifetime advertised lifetime of the entry. 0 to delete address.
* \return 0 DNS server option option successful.
* \return <0 failed (for example invalid interface ID).
*
*/
int8_t arm_nwk_ipv6_dns_server_add(int8_t interface_id, uint8_t *address, uint32_t lifetime);

/**
* \brief add DNS Search List Option information to Router advertisements
*
* Add DNS Search List Option from RFC 8106 to router advertisements.
* This makes it possible to configure DNS search list to other devices connected to the interface.
*
* \param interface_id Interface ID.
* \param data byte array encoded following https://tools.ietf.org/html/rfc1035#section-3.1.
* \param data_len Length of the byte array
* \param lifetime advertised lifetime of the entry. 0 to delete address.
* \return 0 DNS server option option successful.
* \return <0 failed (for example invalid interface ID).
*
*/
int8_t arm_nwk_ipv6_dns_search_list_add(int8_t interface_id, uint8_t *data, uint16_t data_len, uint32_t lifetime);


#endif /* NET_IPV6_API_H_ */
37 changes: 37 additions & 0 deletions nanostack/net_ws_test.h
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,43 @@ int ws_test_gtk_time_settings_set(
*/
int ws_test_next_gtk_set(int8_t interface_id, uint8_t *gtk[4]);

/**
* Sets 6LoWPAN fragmentation MTU size to test fragmentation
*
* \param interface_id Network interface ID.
* \param mtu_size Size of 6LoWPAN MTU when fragmentation occurs.
*
* \return 0 Success
* \return <0 Failure
*/
int ws_test_6lowpan_fragmentation_mtu_size_set(int8_t interface_id, uint16_t mtu_size);

/**
* Disable First EDFE data packet send.
*
* Made only for test purpose for test EDFE client Data wait timeout.
*
* \param interface_id Network interface ID.
* \param skip True for skip first data packet false disable unused flag.
*
* \return 0 Success
* \return <0 Failure
*/
void ws_test_skip_edfe_data_send(int8_t interface_id, bool skip);

/**
* Drop configured EDFE data packets.
*
* Made only for test purpose for test EDFE data sender retry send logic.
*
* \param interface_id Network interface ID.
* \param number_of_dropped_frames How many packets will be dropped.
*
* \return 0 Success
* \return <0 Failure
*/
int8_t ws_test_drop_edfe_data_frames(int8_t interface_id, uint8_t number_of_dropped_frames);

#ifdef __cplusplus
}
#endif
Expand Down
1 change: 1 addition & 0 deletions nanostack/platform/arm_hal_phy.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ typedef enum {
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 */
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 */
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 */
PHY_EXTENSION_SET_DATA_WHITENING, /**< Enable or disable data whitening. Boolean true for enable, false for disable */
PHY_EXTENSION_SET_802_15_4_MODE /**< Set IEEE 802.15.4 mode as defined by phy_802_15_4_mode_t*/
} phy_extension_type_e;

Expand Down
12 changes: 6 additions & 6 deletions nanostack/socket_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -712,11 +712,12 @@ static inline int8_t socket_read_session_address(int8_t socket, ns_address_t *ad
* | SOCKET_IPV6_MULTICAST_LOOP | bool | Yes | Yes | No |
* | SOCKET_IPV6_JOIN_GROUP | ns_ipv6_mreq_t | Set only | No | No |
* | SOCKET_IPV6_LEAVE_GROUP | ns_ipv6_mreq_t | Set only | No | No |
* | SOCKET_LATENCY | ns_ipv6_latency_t | Get only | No | No |
* | SOCKET_STAGGER | ns_ipv6_stagger_t | Get only | No | No |
* | SOCKET_EDFE_MODE | bool | Set only | No | No |
* | SOCKET_BROADCAST_PAN | int8_t | Yes | No | No |
* | SOCKET_LINK_LAYER_SECURITY | int8_t | Yes | No | No |
* | SOCKET_INTERFACE_SELECT | int8_t | Yes | No | No |
* | SOCKET_LATENCY | ns_ipv6_latency_t | Get only | No | No |
* | SOCKET_STAGGER | ns_ipv6_stagger_t | Get only | No | No |
*
*/

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

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

0 comments on commit 9460619

Please sign in to comment.