Skip to content

Commit 20eeaf5

Browse files
Merge pull request #5511 from artokin/nanostack_oss_release
Nanostack OSS release for mbed-os-5.7
2 parents b9c3003 + 02290f9 commit 20eeaf5

File tree

1,337 files changed

+193243
-8688
lines changed

Some content is hidden

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

1,337 files changed

+193243
-8688
lines changed

features/FEATURE_COMMON_PAL/mbed-client-randlib/source/randLIB.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,8 @@ void randLIB_add_seed(uint64_t seed)
121121
if (state[1] == 0 && state[0] == 0) {
122122
state[0] = 1;
123123
}
124+
#else
125+
(void)seed;
124126
#endif
125127
}
126128

features/FEATURE_COMMON_PAL/mbed-trace/README.md

Lines changed: 1 addition & 1 deletion

features/FEATURE_COMMON_PAL/nanostack-libservice/mbed-client-libservice/ns_nvm_helper.h

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,20 @@
1-
/*
2-
* Copyright (c) 2016 ARM Limited. All rights reserved.
3-
*/
1+
// ----------------------------------------------------------------------------
2+
// Copyright 2016-2017 ARM Ltd.
3+
//
4+
// SPDX-License-Identifier: Apache-2.0
5+
//
6+
// Licensed under the Apache License, Version 2.0 (the "License");
7+
// you may not use this file except in compliance with the License.
8+
// You may obtain a copy of the License at
9+
//
10+
// http://www.apache.org/licenses/LICENSE-2.0
11+
//
12+
// Unless required by applicable law or agreed to in writing, software
13+
// distributed under the License is distributed on an "AS IS" BASIS,
14+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
// See the License for the specific language governing permissions and
16+
// limitations under the License.
17+
// ----------------------------------------------------------------------------
418

519
/**
620
* NanoStack NVM helper functions to read, write and delete key-value pairs to platform NVM.

features/FEATURE_COMMON_PAL/nanostack-libservice/source/nsdynmemLIB/nsdynmemLIB.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ struct ns_mem_book {
4646
static ns_mem_book_t *default_book; // heap pointer for original "ns_" API use
4747

4848
// size of a hole_t in our word units
49-
#define HOLE_T_SIZE ((sizeof(hole_t) + sizeof(ns_mem_word_size_t) - 1) / sizeof(ns_mem_word_size_t))
49+
#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)))
5050

5151
static NS_INLINE hole_t *hole_from_block_start(ns_mem_word_size_t *start)
5252
{
@@ -334,8 +334,8 @@ static void ns_mem_free_and_merge_with_adjacent_blocks(ns_mem_book_t *book, ns_m
334334

335335
if (start != book->heap_main) {
336336
if (*(start - 1) < 0) {
337-
int *block_end = start - 1;
338-
size_t block_size = 1 + (-*block_end) + 1;
337+
ns_mem_word_size_t *block_end = start - 1;
338+
ns_mem_word_size_t block_size = 1 + (-*block_end) + 1;
339339
merged_data_size += block_size;
340340
start -= block_size;
341341
if (*start != *block_end) {
@@ -349,8 +349,8 @@ static void ns_mem_free_and_merge_with_adjacent_blocks(ns_mem_book_t *book, ns_m
349349

350350
if (end != book->heap_main_end) {
351351
if (*(end + 1) < 0) {
352-
int *block_start = end + 1;
353-
size_t block_size = 1 + (-*block_start) + 1;
352+
ns_mem_word_size_t *block_start = end + 1;
353+
ns_mem_word_size_t block_size = 1 + (-*block_start) + 1;
354354
merged_data_size += block_size;
355355
end += block_size;
356356
if (*end != *block_start) {

features/FEATURE_COMMON_PAL/nanostack-libservice/source/nvmHelper/ns_nvm_helper.c

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,20 @@
1-
/*
2-
* Copyright (c) 2016 ARM Limited. All rights reserved.
3-
*/
1+
// ----------------------------------------------------------------------------
2+
// Copyright 2016-2017 ARM Ltd.
3+
//
4+
// SPDX-License-Identifier: Apache-2.0
5+
//
6+
// Licensed under the Apache License, Version 2.0 (the "License");
7+
// you may not use this file except in compliance with the License.
8+
// You may obtain a copy of the License at
9+
//
10+
// http://www.apache.org/licenses/LICENSE-2.0
11+
//
12+
// Unless required by applicable law or agreed to in writing, software
13+
// distributed under the License is distributed on an "AS IS" BASIS,
14+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
// See the License for the specific language governing permissions and
16+
// limitations under the License.
17+
// ----------------------------------------------------------------------------
418

519
#include <string.h>
620
#include <ns_types.h>

features/nanostack/CONTRIBUTING.md

Lines changed: 8 additions & 12 deletions
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.

features/nanostack/FEATURE_NANOSTACK/coap-service/coap-service/coap_service_api.h

Lines changed: 72 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,9 @@ extern const uint8_t COAP_MULTICAST_ADDR_SITE_LOCAL[16]; //!> ff05::fd, COAP sit
6969
*
7070
* Function that handles CoAP service message receiving and parsing
7171
*
72-
* \param msg_id Id number of the current message.
72+
* \param service_id Service handle.
7373
* \param source_address IPv6 source address.
74-
* \param source_port Source port
74+
* \param source_port Source port.
7575
* \param response_ptr Pointer to CoAP header structure.
7676
*
7777
* \return 0 for success / -1 for failure
@@ -85,10 +85,11 @@ typedef int coap_service_response_recv(int8_t service_id, uint8_t source_address
8585
*
8686
* \param service_id Id number of the current service.
8787
* \param source_address IPv6 source address.
88-
* \param source_port Source port
88+
* \param source_port Source port.
8989
* \param request_ptr Pointer to CoAP header structure.
9090
*
91-
* \return Status
91+
* \return -1 = Message ignored, no response will be sent. Transaction will be deleted.
92+
* 0 = Response is either already sent or will be send. Transaction is not deleted.
9293
*/
9394
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);
9495

@@ -98,8 +99,10 @@ typedef int coap_service_request_recv_cb(int8_t service_id, uint8_t source_addre
9899
* Starts security service handling and fetches device password.
99100
*
100101
* \param service_id Id number of the current service.
101-
* \param address Address of sender
102-
* \param port Port of the device
102+
* \param address Address of sender.
103+
* \param port Port of the device.
104+
* \param pw Pointer where to write the ecjpake password.
105+
* \param pw_len Pointer where to write length of the ecjpake password.
103106
*
104107
* \return 0 for success / -1 for failure
105108
*/
@@ -111,8 +114,8 @@ typedef int coap_service_security_start_cb(int8_t service_id, uint8_t address[st
111114
* CoAP service security done callback function.
112115
*
113116
* \param service_id Id number of the current service.
114-
* \param address Address of sender
115-
* \param keyblock Security key (40 bits)
117+
* \param address Address of sender.
118+
* \param keyblock Security key (40 bits).
116119
*
117120
* \return 0 for success / -1 for failure
118121
*/
@@ -147,23 +150,12 @@ extern void coap_service_delete( int8_t service_id );
147150
*
148151
* Closes secure connection (if present), but leaves socket open.
149152
*
150-
* \param service_id Id number of the current service.
153+
* \param service_id Id number of the current service.
154+
* \param destimation_addr_ptr Connection destination address.
155+
* \param port Connection destination port.
151156
*/
152157
extern void coap_service_close_secure_connection(int8_t service_id, uint8_t destination_addr_ptr[static 16], uint16_t port);
153158

154-
/**
155-
* \brief Sets password for device
156-
*
157-
* \param service_id Service id
158-
* \param address Device address
159-
* \param port Device port
160-
* \param pw_ptr Pointer to password.
161-
* \param pw_len Lenght of password.
162-
*
163-
* \return 0 for success / -1 for failure
164-
*/
165-
//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);
166-
167159
/**
168160
* \brief Virtual socket sent callback.
169161
*
@@ -213,7 +205,6 @@ extern int16_t coap_service_virtual_socket_set_cb(int8_t service_id, coap_servic
213205
*
214206
* \param service_id Id number of the current service.
215207
* \param *uri Uri address.
216-
* \param port port that Application wants to use for communicate with coap server.
217208
* \param allowed_method Informs method that is allowed to use (used defines described above).
218209
* \param *request_recv_cb CoAP service request receive callback function pointer.
219210
*
@@ -240,7 +231,7 @@ extern int8_t coap_service_unregister_uri(int8_t service_id, const char *uri);
240231
*
241232
* \param service_id Id number of the current service.
242233
* \param options Options defined above.
243-
* \param destination_addr IPv6 address.
234+
* \param destination_addr IPv6 address.
244235
* \param destination_port Destination port
245236
* \param msg_type Message type can be found from sn_coap_header.
246237
* \param msg_code Message code can be found from sn_coap_header.
@@ -261,15 +252,39 @@ extern uint16_t coap_service_request_send(int8_t service_id, uint8_t options, co
261252
* Build and sends CoAP service response message.
262253
*
263254
* \param service_id Id number of the current service.
264-
* \param msg_id Message ID number.
265255
* \param options Options defined above.
266-
* \param response_ptr Pointer to CoAP header structure.
256+
* \param request_ptr Pointer to CoAP request message header structure.
257+
* \param message_code Message code can be found from sn_coap_header.
258+
* \param content_type Content type can be found from sn_coap_header.
259+
* \param payload_ptr Pointer to message content.
260+
* \param payload_len Lenght of the message.
267261
*
268262
* \return -1 For failure
269263
*- 0 For success
270264
*/
271265
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);
272266

267+
/**
268+
* \brief Sends CoAP service response
269+
*
270+
* Build and sends CoAP service response message based on CoAP request message id.
271+
*
272+
* \param service_id Id number of the current service.
273+
* \param options Options defined above.
274+
* \param msg_id Request messages ID.
275+
* \param msg_type Message type can be found from sn_coap_header.
276+
* \param message_code Message code can be found from sn_coap_header.
277+
* \param content_type Content type can be found from sn_coap_header.
278+
* \param payload_ptr Pointer to message content.
279+
* \param payload_len Lenght of the message.
280+
*
281+
* \return -1 For failure
282+
*- 0 For success
283+
*/
284+
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);
285+
286+
287+
273288
/**
274289
* \brief Delete CoAP request transaction
275290
*
@@ -297,18 +312,48 @@ extern int8_t coap_service_request_delete(int8_t service_id, uint16_t msg_id);
297312
*/
298313
extern int8_t coap_service_set_handshake_timeout(int8_t service_id, uint32_t min, uint32_t max);
299314

315+
/**
316+
* \brief Set DTLS handshake limit values
317+
*
318+
* Configures the limits for DTLS sessions. Values must be > 0.
319+
*
320+
* \param handshakes_max Maximum amount of simultaneous handshakes.
321+
* \param connections_max Maximum amount of sessions.
322+
*
323+
* \return -1 For failure
324+
*- 0 For success
325+
*/
326+
extern int8_t coap_service_handshake_limits_set(uint8_t handshakes_max, uint8_t connections_max);
327+
300328
/**
301329
* \brief Set CoAP duplication message buffer size
302330
*
303331
* Configures the CoAP duplication message buffer size.
304332
*
305333
* \param service_id Id number of the current service.
306-
* \param size Buffer size (messages)
334+
* \param size Buffer size (messages).
307335
*
308336
* \return -1 For failure
309337
*- 0 For success
310338
*/
311339
extern int8_t coap_service_set_duplicate_message_buffer(int8_t service_id, uint8_t size);
340+
341+
/**
342+
* \brief Set DTLS certificates
343+
*
344+
* Set DTLS certificates.
345+
*
346+
* \param service_id Id number of the current service.
347+
* \param cert Pointer to certificate chain.
348+
* \param cert_len Certificate length.
349+
* \param priv_key pointer to private key.
350+
* \param priv_key_len length of private key.
351+
*
352+
* \return -1 For failure
353+
*- 0 For success
354+
*/
355+
356+
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);
312357
#ifdef __cplusplus
313358
}
314359
#endif

0 commit comments

Comments
 (0)