Skip to content

Nanostack release for mbed OS 5.14 #11335

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Aug 28, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -544,7 +544,6 @@ endif
/usr/share/cpputest/scripts/filterGcov.sh $(GCOV_OUTPUT) $(GCOV_ERROR) $(GCOV_REPORT) $(TEST_OUTPUT)
$(SILENCE)cat $(GCOV_REPORT)
$(SILENCE)mkdir -p gcov
$(SILENCE)mv *.gcov gcov
$(SILENCE)mv gcov_* gcov
@echo "See gcov directory for details"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ bool test_coap_message_handler_coap_msg_process()
sn_coap_protocol_stub.expectedHeader->msg_code = 333;
nsdynmemlib_stub.returnCounter = 1;

if (-1 != coap_message_handler_coap_msg_process(handle, 0, buf, 61131, 22, ns_in6addr_any, NULL, 0, process_cb)) {
if (-1 != coap_message_handler_coap_msg_process(handle, 0, 61131, buf, 22, ns_in6addr_any, NULL, 0, process_cb)) {
goto exit;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,22 +34,22 @@

sn_coap_builder_stub_def sn_coap_builder_stub;

sn_coap_hdr_s *sn_coap_build_response(struct coap_s *handle, sn_coap_hdr_s *coap_packet_ptr, uint8_t msg_code)
sn_coap_hdr_s *sn_coap_build_response(struct coap_s *handle, const sn_coap_hdr_s *coap_packet_ptr, uint8_t msg_code)
{
return sn_coap_builder_stub.expectedHeader;
}

int16_t sn_coap_builder(uint8_t *dst_packet_data_ptr, sn_coap_hdr_s *src_coap_msg_ptr)
int16_t sn_coap_builder(uint8_t *dst_packet_data_ptr, const sn_coap_hdr_s *src_coap_msg_ptr)
{
return sn_coap_builder_stub.expectedInt16;
}

uint16_t sn_coap_builder_calc_needed_packet_data_size(sn_coap_hdr_s *src_coap_msg_ptr)
uint16_t sn_coap_builder_calc_needed_packet_data_size(const sn_coap_hdr_s *src_coap_msg_ptr)
{
return sn_coap_builder_stub.expectedUint16;
}

uint16_t sn_coap_builder_calc_needed_packet_data_size_2(sn_coap_hdr_s *src_coap_msg_ptr, uint16_t blockwise_payload_size)
uint16_t sn_coap_builder_calc_needed_packet_data_size_2(const sn_coap_hdr_s *src_coap_msg_ptr, uint16_t blockwise_payload_size)
{
return sn_coap_builder_stub.expectedUint16;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ typedef struct arm_event_s {
uint8_t event_id; /**< Timer ID, NWK interface ID or application specific ID */
void *data_ptr; /**< Application could share data pointer tasklet to tasklet */
arm_library_event_priority_e priority;
uint32_t event_data;
uintptr_t event_data;
} arm_event_t;

/* Backwards compatibility */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,22 @@ typedef int8_t eth_mac_mac48_address_set(const eth_mac_api_t *api, const uint8_t
*/
typedef int8_t eth_mac_mac48_address_get(const eth_mac_api_t *api, uint8_t *mac48_buf);

/**
* @brief Set 64 bit interface identifier from IID64
* @param api API to handle the request
* @param iid64 Pointer having iid64 to be set
* @return 0 if successful, -1 otherwise
*/
typedef int8_t eth_mac_iid64_address_set(const eth_mac_api_t *api, const uint8_t *iid64);

/**
* @brief Read 64 bit interface identifier
* @param api API to handle the request
* @param iid64_buf Pointer where IID64 can be written
* @return 0 if successful, -1 otherwise
*/
typedef int8_t eth_mac_iid64_address_get(const eth_mac_api_t *api, uint8_t *iid64_buf);

/**
* @brief Upper layer will call this function, when MAC is taken into use
* @param api API to initialize
Expand All @@ -147,6 +163,9 @@ struct eth_mac_api_s {
eth_mac_mac48_address_set *mac48_set; /**< Setter for MAC address */
eth_mac_mac48_address_get *mac48_get; /**< Getter for MAC address */

eth_mac_iid64_address_set *iid64_set; /**< Setter for IID64 */
eth_mac_iid64_address_get *iid64_get; /**< Getter for IID64 */

uint8_t parent_id; /**< Upper layer ID */
bool address_resolution_needed; /**< Normal ethernet should set this true for tunnel or false for slip */
};
Expand Down
2 changes: 2 additions & 0 deletions features/nanostack/sal-stack-nanostack/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
macTXPower = 0xf8, /*<TX output power*/
macCCAThreshold = 0xf9, /*<CCA threshold*/
macMultiCSMAParameters = 0xfa, /*<Multi CSMA parameters*/
macRfConfiguration = 0xfb, /*<RF channel configuration parameters*/
macAcceptByPassUnknowDevice = 0xfc, /*< Accept data trough MAC if packet is data can be authenticated by group key nad MIC. Security enforsment point must be handled carefully these packets */
Expand Down
75 changes: 75 additions & 0 deletions features/nanostack/sal-stack-nanostack/nanostack/net_interface.h
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,9 @@ typedef struct {
/** Certificate structure. */
typedef struct {
const uint8_t *cert; /**< Certificate pointer. */
const uint8_t *key; /**< Key pointer. */
uint16_t cert_len; /**< Certificate length. */
uint16_t key_len; /**< Key length. */
} arm_certificate_entry_s;

/** Certificate Revocation List structure. */
Expand Down Expand Up @@ -318,6 +320,20 @@ extern int8_t arm_nwk_interface_ethernet_init(struct eth_mac_api_s *api, const c
*/
extern int8_t arm_nwk_interface_lowpan_init(struct mac_api_s *api, char *interface_name_ptr);

/**
* \brief Create network interface base to IDLE state.
* \param api Generates interface with PPP.
* \param interface_name_ptr String pointer to interface name. Need to end to '\0' character.
* Max length 32 characters including NULL at end. Note: the given name is not copied,
* so it must remain valid as long as the interface is.
*
* \return >=0 Interface ID (0-127). Application needs to save this information.
* \return -1 api was NULL.
* \return -2 PPP is not supported at this build.
* \return -3 No memory for the interface.
*/
extern int8_t arm_nwk_interface_ppp_init(struct eth_mac_api_s *api, const char *interface_name_ptr);

/**
* \brief Set IPv6 interface setup.
*
Expand Down Expand Up @@ -921,6 +937,37 @@ extern int8_t arm_network_trusted_certificate_add(const arm_certificate_entry_s
*/
extern int8_t arm_network_trusted_certificate_remove(const arm_certificate_entry_s *cert);

/**
* Remove trusted certificates
*
* This is used to remove all trusted root or intermediate certificates.
*
* \return 0 on success, negative on failure.
*/
extern int8_t arm_network_trusted_certificates_remove(void);

/**
* Add own certificate
*
* This is used to add own certificate and private key.
* In case intermediate certificates are used, function can be called several times. Each call
* to the function adds a certificate to own certificate chain.
* Certificates are in bottom up order i.e. the top certificate is given last.
*
* \param cert Certificate.
* \return 0 on success, negative on failure.
*/
extern int8_t arm_network_own_certificate_add(const arm_certificate_entry_s *cert);

/**
* Remove own certificates
*
* This is used to remove own certificates (chain).
*
* \return 0 on success, negative on failure.
*/
extern int8_t arm_network_own_certificates_remove(void);

/**
* Add Certificate Revocation List
*
Expand Down Expand Up @@ -1060,6 +1107,34 @@ extern void net_get_version_information(uint8_t *ptr);

extern int arm_nwk_sleepy_device_parent_buffer_size_set(int8_t interface_id, uint16_t big_packet_threshold, uint16_t small_packets_per_child_count, uint16_t big_packets_total_count);

/**
* \brief Set CCA threshold.
*
* This function can be used to set CCA threshold to PHY layer. Threshold is given as percentage of maximum threshold.
* 0 is the lowest(strictest) possible threshold and 100 is the highest possible threshold.
*
* Note! Software MAC must be created and registered before using this function.
*
* \param interface_id Network interface ID.
* \param cca_threshold CCA threshold (%).
* \return 0 on success, <0 on errors.
*/
extern int8_t arm_nwk_set_cca_threshold(int8_t interface_id, uint8_t cca_threshold);

/**
* \brief Set TX output power.
*
* This function can be used to set TX output power to PHY layer. TX power is given as percentage of maximum output power.
* 0 is the lowest possible TX power and 100 is the highest possible TX power.
*
* Note! Software MAC must be created and registered before using this function.
*
* \param interface_id Network interface ID.
* \param tx_power TX output power (%).
* \return 0 on success, <0 on errors.
*/
extern int8_t arm_nwk_set_tx_output_power(int8_t interface_id, uint8_t tx_power);


#ifdef __cplusplus
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,10 @@ typedef enum {
PHY_EXTENSION_GET_TIMESTAMP, /**< Read 32-bit constant monotonic time stamp in us */
PHY_EXTENSION_SET_CSMA_PARAMETERS, /**< CSMA parameter's are given by phy_csma_params_t structure remember type cast uint8_t pointer to structure type*/
PHY_EXTENSION_GET_SYMBOLS_PER_SECOND, /**< Read Symbols per seconds which will help to convert symbol time to real time */
PHY_EXTENSION_SET_RF_CONFIGURATION, /**< Set RF configuration using phy_rf_channel_parameters_s structure */
PHY_EXTENSION_FILTERING_SUPPORT /**< Return filtering modes that can be supported by the PHY driver. See phy_link_filters_e */
PHY_EXTENSION_SET_RF_CONFIGURATION, /**< Set RF configuration using phy_rf_channel_configuration_s structure */
PHY_EXTENSION_FILTERING_SUPPORT, /**< Return filtering modes that can be supported by the PHY driver. See phy_link_filters_e */
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_type_e;

/** Address types */
Expand All @@ -95,7 +97,7 @@ typedef enum phy_link_type_e {
PHY_LINK_15_4_SUBGHZ_TYPE, /**< Standard 802.15.4 subGHz radio 868 /915MHz. */
PHY_LINK_TUN, /**< Tunnel interface for Linux TUN, RF network driver over serial bus or just basic application to application data flow. */
PHY_LINK_SLIP, /**< Generic SLIP driver which just forward SLIP payload */
PHY_LINK_PPP, /**< PPP interface */
PHY_LINK_PPP, /**< PPP */
} phy_link_type_e;

/** Data layers */
Expand Down Expand Up @@ -185,6 +187,13 @@ typedef struct phy_device_channel_page_s {
const phy_rf_channel_configuration_s *rf_channel_configuration; ///< Pointer to channel configuration
} phy_device_channel_page_s;

/** PHY statistics */
typedef struct phy_rf_statistics_s {
uint32_t crc_fails; ///< CRC failures
uint32_t tx_timeouts; ///< transmission timeouts
uint32_t rx_timeouts; ///< reception timeouts
} phy_rf_statistics_s;

/** Virtual data request */
typedef struct virtual_data_req_s {
uint16_t parameter_length; /**< Length of user specified header. Can be zero. */
Expand Down Expand Up @@ -284,6 +293,7 @@ typedef struct phy_device_driver_s {
arm_net_virtual_config_tx_fn *virtual_config_tx_cb; /**< Virtual config send callback. Initialized by \ref arm_net_phy_register(). */
arm_net_virtual_confirmation_rx_fn *virtual_confirmation_rx_cb; /**< Virtual confirmation receive callback. Initialized by \ref arm_net_phy_register(). */
uint16_t tunnel_type; /**< Tun driver type. */
phy_rf_statistics_s *phy_rf_statistics; /**< PHY statistics. */
} phy_device_driver_s;


Expand Down
9 changes: 9 additions & 0 deletions features/nanostack/sal-stack-nanostack/nanostack/sw_mac.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ struct mac_api_s;
struct mac_description_storage_size_s;
struct fhss_api;
struct mac_statistics_s;
struct phy_rf_statistics_s;

/**
* @brief Creates 802.15.4 MAC API instance which will use RF driver given
Expand Down Expand Up @@ -81,6 +82,14 @@ extern struct fhss_api *ns_sw_mac_get_fhss_api(struct mac_api_s *mac_api);
*/
extern int ns_sw_mac_statistics_start(struct mac_api_s *mac_api, struct mac_statistics_s *mac_statistics);

/**
* @brief Start collecting statistics from PHY driver.
* @param mac_api MAC instance.
* @param phy_statistics Statistics storage.
* @return 0 on success, -1 on fail.
*/
extern int ns_sw_mac_phy_statistics_start(struct mac_api_s *mac_api, struct phy_rf_statistics_s *phy_statistics);

/**
* @brief Read current timestamp.
* @param mac_api MAC instance.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,39 @@
/** Energy List TLV. */
#define MESHCOP_TLV_ENERGY_LIST 57

/** Thread 1.2 */

/** Timeout TLV. */
#define MESHCOP_TLV_TIMEOUT 58

/** Thread domain name TLV. */
#define MESHCOP_TLV_DOMAIN_NAME 59

/** Domain prefix TLV TLV.*/
#define MESHCOP_TLV_DOMAIN_PREFIX 60

/** AE Steering Data TLV. */
#define MESHCOP_TLV_AE_STEERING_DATA 61

/** NMKP Steering Data TLV. */
#define MESHCOP_TLV_NMKP_STEERING_DATA 62

/** Commissioner Token TLV. */
#define MESHCOP_TLV_COMM_TOKEN 63

/** Commissioner Signature TLV. */
#define MESHCOP_TLV_COMM_SIGNATURE 64

/** NMKP Steering Data TLV. */
#define MESHCOP_TLV_AE_PORT 65

/** NMKP Steering Data TLV. */
#define MESHCOP_TLV_NMKP_PORT 66

/** Registrar IPV6 address. */
#define MESHCOP_TLV_REGISTRAR_IPV6_ADDRESS 68


/** Discovery Request TLV. */
#define MESHCOP_TLV_DISCOVERY_REQUEST 128
/** Discovery response TLV. */
Expand Down
20 changes: 10 additions & 10 deletions features/nanostack/sal-stack-nanostack/nanostack/ws_bbr_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,21 +49,21 @@ int ws_bbr_start(int8_t interface_id, int8_t backbone_interface_id);
* Border router configuration options
*/
#define BBR_ULA_C 0x0001 /**< Static ULA prefix created automatically */
#define BBR_GUA_C 0x0002 /**< Routable prefix is learned from the backbone */
#define BBR_GUA_ROUTE 0x0004 /**< More specific route is added for GUA prefix */
#define BBR_GUA_SLAAC 0x0008 /**< Use SLAAC addressing in routable prefix */
#define BBR_GUA_WAIT 0x0010 /**< Wait backbone availability before starting RPL dodag */
#define BBR_BB_WAIT 0x0020 /**< Wait backbone availability before starting Wi-SUN network */
#define BBR_GUA_ROUTE 0x0002 /**< More specific route is added for GUA prefix */
#define BBR_BB_WAIT 0x0004 /**< Wait backbone availability before starting Wi-SUN network */

/*Deprecated configuration values */
#define BBR_GUA_C 0x0000 /**< Routable prefix is learned from the backbone */
#define BBR_GUA_SLAAC 0x0000 /**< Use SLAAC addressing in routable prefix */
#define BBR_GUA_WAIT 0x0000 /**< Wait backbone availability before startingRPL dodag */

/**
* Configure border router features.
*
* \param interface_id interface ID of the Wi-SUN network
* \param options Options configured to Border router
* BBR_ULA_C Configure Mesh local ULA prefix with SLAAC address (default)
* BBR_GUA_C Configure GUA/ULA prefix from backbone to RPL (default)
* BBR_GUA_ROUTE Add more specific route for GUA (default)
* BBR_GUA_SLAAC Use SLAAC address generation in GUA prefix
* BBR_GUA_WAIT Start RPL root only when GUA is available
* BBR_ULA_C Configure Mesh local ULA prefix with SLAAC address
* BBR_GUA_ROUTE Add more specific route for GUA
* BBR_BB_WAIT Start Wi-SUN network only when backbone is ready
*
* By default Wi-SUN network is started and is treated as separate interface even if backbone is not available.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,22 @@ int ws_management_node_init(
char *network_name_ptr,
fhss_timer_t *fhss_timer_ptr);

/**
* Change the network name
*
* Change the network name dynamically at a runtime.
* If stack is running the network discovery is restarted.
*
* \param interface_id Network interface ID.
* \param network_name_ptr Nul terminated Network name limited to 32 characters.
*
* \return 0, Init OK.
* \return <0 Init fail.
*/
int ws_management_network_name_set(
int8_t interface_id,
char *network_name_ptr);

/**
* Configure regulatory domain of Wi-SUN stack.
*
Expand Down
Loading