Skip to content

Nanostack OSS release for mbed-os-5.7 #5511

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 13 commits into from
Nov 27, 2017
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,8 @@ void randLIB_add_seed(uint64_t seed)
if (state[1] == 0 && state[0] == 0) {
state[0] = 1;
}
#else
(void)seed;
#endif
}

Expand Down
2 changes: 1 addition & 1 deletion features/FEATURE_COMMON_PAL/mbed-trace/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ To do so, add the following to your mbed_app.json:

Don't forget to fulfill the other [prerequisites](#prerequisites)!

([Click here for more information on the configuration system](https://github.com/ARMmbed/mbed-os/blob/master/docs/config_system.md))
([Click here for more information on the configuration system](https://docs.mbed.com/docs/mbed-os-api/en/latest/config_system/))

### Traces

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,20 @@
/*
* Copyright (c) 2016 ARM Limited. All rights reserved.
*/
// ----------------------------------------------------------------------------
// Copyright 2016-2017 ARM Ltd.
//
// SPDX-License-Identifier: Apache-2.0
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// ----------------------------------------------------------------------------

/**
* NanoStack NVM helper functions to read, write and delete key-value pairs to platform NVM.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ struct ns_mem_book {
static ns_mem_book_t *default_book; // heap pointer for original "ns_" API use

// size of a hole_t in our word units
#define HOLE_T_SIZE ((sizeof(hole_t) + sizeof(ns_mem_word_size_t) - 1) / sizeof(ns_mem_word_size_t))
#define HOLE_T_SIZE ((ns_mem_word_size_t) ((sizeof(hole_t) + sizeof(ns_mem_word_size_t) - 1) / sizeof(ns_mem_word_size_t)))

static NS_INLINE hole_t *hole_from_block_start(ns_mem_word_size_t *start)
{
Expand Down Expand Up @@ -334,8 +334,8 @@ static void ns_mem_free_and_merge_with_adjacent_blocks(ns_mem_book_t *book, ns_m

if (start != book->heap_main) {
if (*(start - 1) < 0) {
int *block_end = start - 1;
size_t block_size = 1 + (-*block_end) + 1;
ns_mem_word_size_t *block_end = start - 1;
ns_mem_word_size_t block_size = 1 + (-*block_end) + 1;
merged_data_size += block_size;
start -= block_size;
if (*start != *block_end) {
Expand All @@ -349,8 +349,8 @@ static void ns_mem_free_and_merge_with_adjacent_blocks(ns_mem_book_t *book, ns_m

if (end != book->heap_main_end) {
if (*(end + 1) < 0) {
int *block_start = end + 1;
size_t block_size = 1 + (-*block_start) + 1;
ns_mem_word_size_t *block_start = end + 1;
ns_mem_word_size_t block_size = 1 + (-*block_start) + 1;
merged_data_size += block_size;
end += block_size;
if (*end != *block_start) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,20 @@
/*
* Copyright (c) 2016 ARM Limited. All rights reserved.
*/
// ----------------------------------------------------------------------------
// Copyright 2016-2017 ARM Ltd.
//
// SPDX-License-Identifier: Apache-2.0
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// ----------------------------------------------------------------------------

#include <string.h>
#include <ns_types.h>
Expand Down
20 changes: 8 additions & 12 deletions features/nanostack/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,22 +39,18 @@ Send contributions directly to this repository.

## sal-stack-nanostack

This directory holds binary libraries generated from the Nanostack networking library.
This directory holds source code snapshot of the Nanostack networking library. Master repository is available for **mbed Partners** in https://github.com/ARMmbed/sal-stack-nanostack-private.

**Only mbed Partners have access to the source code.**
If you have access to the master repository, please send contributions against that repository.

If you have access, the source directory is available in https://github.com/ARMmbed/sal-stack-nanostack-private

You can replace the binary libraries with the source tree as follows:

* Remove the sal-stack-nanostack directory: `rm -rf sal-stack-nanostack`
* Remove the binaries located one directory up: `rm -rf ../nanostack-binaries`
* Clone the original source repository to root folder of your application: `[email protected]:ARMmbed/sal-stack-nanostack-private.git`
To test changes with access to master repository:
* Remove the sal-stack-nanostack directory: `rm -rf sal-stack-nanostack`
* Clone the master repository `git clone [email protected]:ARMmbed/sal-stack-nanostack-private.git`as sal-stack-nanostack

Now you can modify, build and test your changes with the mbed OS build.

**NOTE:** You do not need to clone the Nanostack to exactly same location in the build tree. This may even cause build problems.
**NOTE:** You do not need to clone the Nanostack master repository to exactly same location in the build tree.

If you don't have access to the master repository then you can send contributions directly to this repository.

### Instructions for generating the binary modules

Check `Releasing.md` from the Nanostack source repository.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,9 @@ extern const uint8_t COAP_MULTICAST_ADDR_SITE_LOCAL[16]; //!> ff05::fd, COAP sit
*
* Function that handles CoAP service message receiving and parsing
*
* \param msg_id Id number of the current message.
* \param service_id Service handle.
* \param source_address IPv6 source address.
* \param source_port Source port
* \param source_port Source port.
* \param response_ptr Pointer to CoAP header structure.
*
* \return 0 for success / -1 for failure
Expand All @@ -85,10 +85,11 @@ typedef int coap_service_response_recv(int8_t service_id, uint8_t source_address
*
* \param service_id Id number of the current service.
* \param source_address IPv6 source address.
* \param source_port Source port
* \param source_port Source port.
* \param request_ptr Pointer to CoAP header structure.
*
* \return Status
* \return -1 = Message ignored, no response will be sent. Transaction will be deleted.
* 0 = Response is either already sent or will be send. Transaction is not deleted.
*/
typedef int coap_service_request_recv_cb(int8_t service_id, uint8_t source_address[static 16], uint16_t source_port, sn_coap_hdr_s *request_ptr);

Expand All @@ -98,8 +99,10 @@ typedef int coap_service_request_recv_cb(int8_t service_id, uint8_t source_addre
* Starts security service handling and fetches device password.
*
* \param service_id Id number of the current service.
* \param address Address of sender
* \param port Port of the device
* \param address Address of sender.
* \param port Port of the device.
* \param pw Pointer where to write the ecjpake password.
* \param pw_len Pointer where to write length of the ecjpake password.
*
* \return 0 for success / -1 for failure
*/
Expand All @@ -111,8 +114,8 @@ typedef int coap_service_security_start_cb(int8_t service_id, uint8_t address[st
* CoAP service security done callback function.
*
* \param service_id Id number of the current service.
* \param address Address of sender
* \param keyblock Security key (40 bits)
* \param address Address of sender.
* \param keyblock Security key (40 bits).
*
* \return 0 for success / -1 for failure
*/
Expand Down Expand Up @@ -147,23 +150,12 @@ extern void coap_service_delete( int8_t service_id );
*
* Closes secure connection (if present), but leaves socket open.
*
* \param service_id Id number of the current service.
* \param service_id Id number of the current service.
* \param destimation_addr_ptr Connection destination address.
* \param port Connection destination port.
*/
extern void coap_service_close_secure_connection(int8_t service_id, uint8_t destination_addr_ptr[static 16], uint16_t port);

/**
* \brief Sets password for device
*
* \param service_id Service id
* \param address Device address
* \param port Device port
* \param pw_ptr Pointer to password.
* \param pw_len Lenght of password.
*
* \return 0 for success / -1 for failure
*/
//int coap_service_security_key_set(int8_t service_id, uint8_t address[static 16], uint16_t port, uint8_t *pw_ptr, uint8_t pw_len);

/**
* \brief Virtual socket sent callback.
*
Expand Down Expand Up @@ -213,7 +205,6 @@ extern int16_t coap_service_virtual_socket_set_cb(int8_t service_id, coap_servic
*
* \param service_id Id number of the current service.
* \param *uri Uri address.
* \param port port that Application wants to use for communicate with coap server.
* \param allowed_method Informs method that is allowed to use (used defines described above).
* \param *request_recv_cb CoAP service request receive callback function pointer.
*
Expand All @@ -240,7 +231,7 @@ extern int8_t coap_service_unregister_uri(int8_t service_id, const char *uri);
*
* \param service_id Id number of the current service.
* \param options Options defined above.
* \param destination_addr IPv6 address.
* \param destination_addr IPv6 address.
* \param destination_port Destination port
* \param msg_type Message type can be found from sn_coap_header.
* \param msg_code Message code can be found from sn_coap_header.
Expand All @@ -261,15 +252,39 @@ extern uint16_t coap_service_request_send(int8_t service_id, uint8_t options, co
* Build and sends CoAP service response message.
*
* \param service_id Id number of the current service.
* \param msg_id Message ID number.
* \param options Options defined above.
* \param response_ptr Pointer to CoAP header structure.
* \param request_ptr Pointer to CoAP request message header structure.
* \param message_code Message code can be found from sn_coap_header.
* \param content_type Content type can be found from sn_coap_header.
* \param payload_ptr Pointer to message content.
* \param payload_len Lenght of the message.
*
* \return -1 For failure
*- 0 For success
*/
extern int8_t coap_service_response_send(int8_t service_id, uint8_t options, sn_coap_hdr_s *request_ptr, sn_coap_msg_code_e message_code, sn_coap_content_format_e content_type, const uint8_t *payload_ptr,uint16_t payload_len);

/**
* \brief Sends CoAP service response
*
* Build and sends CoAP service response message based on CoAP request message id.
*
* \param service_id Id number of the current service.
* \param options Options defined above.
* \param msg_id Request messages ID.
* \param msg_type Message type can be found from sn_coap_header.
* \param message_code Message code can be found from sn_coap_header.
* \param content_type Content type can be found from sn_coap_header.
* \param payload_ptr Pointer to message content.
* \param payload_len Lenght of the message.
*
* \return -1 For failure
*- 0 For success
*/
extern int8_t coap_service_response_send_by_msg_id(int8_t service_id, uint8_t options, uint16_t msg_id, sn_coap_msg_code_e message_code, sn_coap_content_format_e content_type, const uint8_t *payload_ptr,uint16_t payload_len);



/**
* \brief Delete CoAP request transaction
*
Expand Down Expand Up @@ -297,18 +312,48 @@ extern int8_t coap_service_request_delete(int8_t service_id, uint16_t msg_id);
*/
extern int8_t coap_service_set_handshake_timeout(int8_t service_id, uint32_t min, uint32_t max);

/**
* \brief Set DTLS handshake limit values
*
* Configures the limits for DTLS sessions. Values must be > 0.
*
* \param handshakes_max Maximum amount of simultaneous handshakes.
* \param connections_max Maximum amount of sessions.
*
* \return -1 For failure
*- 0 For success
*/
extern int8_t coap_service_handshake_limits_set(uint8_t handshakes_max, uint8_t connections_max);

/**
* \brief Set CoAP duplication message buffer size
*
* Configures the CoAP duplication message buffer size.
*
* \param service_id Id number of the current service.
* \param size Buffer size (messages)
* \param size Buffer size (messages).
*
* \return -1 For failure
*- 0 For success
*/
extern int8_t coap_service_set_duplicate_message_buffer(int8_t service_id, uint8_t size);

/**
* \brief Set DTLS certificates
*
* Set DTLS certificates.
*
* \param service_id Id number of the current service.
* \param cert Pointer to certificate chain.
* \param cert_len Certificate length.
* \param priv_key pointer to private key.
* \param priv_key_len length of private key.
*
* \return -1 For failure
*- 0 For success
*/

extern int8_t coap_service_certificate_set(int8_t service_id, const unsigned char *cert, uint16_t cert_len, const unsigned char *priv_key, uint8_t priv_key_len);
#ifdef __cplusplus
}
#endif
Expand Down
Loading