Skip to content

Commit ef39a19

Browse files
author
Arto Kinnunen
committed
Merge commit '6dd01c679db4deb0a4a2c55832f3abe7b19bc51b' into mbedos511
* commit '6dd01c679db4deb0a4a2c55832f3abe7b19bc51b': Squashed 'features/nanostack/sal-stack-nanostack/' changes from 2535a6c..ccd30a3
2 parents 3c37456 + 6dd01c6 commit ef39a19

File tree

101 files changed

+2460
-944
lines changed

Some content is hidden

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

101 files changed

+2460
-944
lines changed

features/nanostack/sal-stack-nanostack/nanostack/dhcp_service_api.h

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,8 @@
6969
typedef enum dhcp_instance_type
7070
{
7171
DHCP_INSTANCE_CLIENT,
72-
DHCP_INSTANCE_SERVER
72+
DHCP_INSTANCE_SERVER,
73+
DHCP_INTANCE_RELAY_AGENT
7374
} dhcp_instance_type_e;
7475

7576
/**
@@ -124,6 +125,16 @@ typedef int (dhcp_service_receive_resp_cb)(uint16_t instance_id, void *ptr, uint
124125

125126
uint16_t dhcp_service_init(int8_t interface_id, dhcp_instance_type_e instance_type, dhcp_service_receive_req_cb *receive_req_cb);
126127

128+
/**
129+
* \brief Enable DHCPv6 Relay Agent to server.
130+
*
131+
*
132+
* \param instance The instance ID of the registered server.
133+
* \param server_address global server IPv6 address
134+
*/
135+
void dhcp_service_relay_instance_enable(uint16_t instance, uint8_t *server_address);
136+
137+
127138
/**
128139
* \brief Deletes a server instance.
129140
*

features/nanostack/sal-stack-nanostack/nanostack/fhss_api.h

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,8 +132,9 @@ typedef bool fhss_data_tx_fail(const fhss_api_t *api, uint8_t handle, int frame_
132132
* @param api FHSS instance.
133133
* @param fhss_state FHSS state (FHSS states are defined by FHSS api).
134134
* @param pan_id PAN id of the network FHSS synchronizes with.
135+
* @return -1 when failed, otherwise current MAC channel.
135136
*/
136-
typedef void fhss_synch_state_set(const fhss_api_t *api, fhss_states fhss_state, uint16_t pan_id);
137+
typedef int16_t fhss_synch_state_set(const fhss_api_t *api, fhss_states fhss_state, uint16_t pan_id);
137138

138139
/**
139140
* @brief Read timestamp.
@@ -215,6 +216,13 @@ typedef int mac_read_mac_address(const fhss_api_t *fhss_api, uint8_t *mac_addres
215216
*/
216217
typedef uint32_t mac_read_datarate(const fhss_api_t *fhss_api);
217218

219+
/**
220+
* @brief Read 32-bit timestamp.
221+
* @param fhss_api FHSS instance.
222+
* @return Timestamp.
223+
*/
224+
typedef uint32_t mac_read_timestamp(const fhss_api_t *fhss_api);
225+
218226
/**
219227
* @brief Change channel.
220228
* @param fhss_api FHSS instance.
@@ -287,6 +295,7 @@ struct fhss_callback {
287295
mac_read_tx_queue_size *read_tx_queue_size; /**< Read MAC TX queue size. */
288296
mac_read_mac_address *read_mac_address; /**< Read MAC address. */
289297
mac_read_datarate *read_datarate; /**< Read PHY datarate. */
298+
mac_read_timestamp *read_timestamp; /**< Read timestamp. */
290299
mac_change_channel *change_channel; /**< Change channel. */
291300
mac_send_fhss_frame *send_fhss_frame; /**< Send FHSS frame. */
292301
mac_synch_lost_notification *synch_lost_notification; /**< Send notification when FHSS synchronization is lost. */

features/nanostack/sal-stack-nanostack/nanostack/fhss_config.h

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,11 @@ typedef int32_t fhss_vendor_defined_cf(const fhss_api_t *api, uint16_t slot, uin
9696
*/
9797
typedef struct fhss_ws_configuration
9898
{
99-
/** WS channel function. */
100-
fhss_ws_channel_functions ws_channel_function;
99+
/** WS unicast channel function. */
100+
fhss_ws_channel_functions ws_uc_channel_function;
101+
102+
/** WS broadcast channel function. */
103+
fhss_ws_channel_functions ws_bc_channel_function;
101104

102105
/** Broadcast schedule identifier. */
103106
uint16_t bsi;
@@ -111,6 +114,12 @@ typedef struct fhss_ws_configuration
111114
/** Broadcast dwell interval. Range: 15-250 milliseconds. */
112115
uint8_t fhss_bc_dwell_interval;
113116

117+
/** Unicast fixed channel */
118+
uint8_t unicast_fixed_channel;
119+
120+
/** Broadcast fixed channel */
121+
uint8_t broadcast_fixed_channel;
122+
114123
/** Channel mask. */
115124
uint32_t channel_mask[8];
116125

features/nanostack/sal-stack-nanostack/nanostack/fhss_ws_extension.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ typedef struct unicast_timing_info {
3737
unsigned unicast_channel_function:3; /**< Unicast schedule channel function */
3838
uint8_t unicast_dwell_interval; /**< Unicast dwell interval */
3939
uint16_t unicast_number_of_channels; /**< Unicast number of channels */
40+
uint16_t fixed_channel; /**< Unicast fixed channel*/
4041
uint_fast24_t ufsi; /**< Unicast fractional sequence interval */
4142
uint32_t utt_rx_timestamp; /**< UTT-IE reception timestamp */
4243
} unicast_timing_info_t;
@@ -47,6 +48,7 @@ typedef struct unicast_timing_info {
4748
typedef struct broadcast_timing_info {
4849
unsigned broadcast_channel_function:3; /**< Broadcast schedule channel function */
4950
uint8_t broadcast_dwell_interval; /**< Broadcast dwell interval */
51+
uint16_t fixed_channel; /**< Broadcast fixed channel*/
5052
uint16_t broadcast_slot; /**< Broadcast slot number */
5153
uint16_t broadcast_schedule_id; /**< Broadcast schedule identifier */
5254
uint_fast24_t broadcast_interval_offset; /**< Broadcast interval offset */
@@ -78,9 +80,10 @@ typedef fhss_ws_neighbor_timing_info_t *fhss_get_neighbor_info(const fhss_api_t
7880
* @param fhss_api FHSS instance.
7981
* @param eui64 EUI-64 address of parent.
8082
* @param bc_timing_info Pointer to parent broadcast timing/hopping schedule info.
83+
* @param force_synch If false, synchronization is done only if minimum (internal) synchronization interval is exceed.
8184
* @return 0 on success, -1 on fail.
8285
*/
83-
extern int ns_fhss_ws_set_parent(const fhss_api_t *fhss_api, const uint8_t eui64[8], const broadcast_timing_info_t *bc_timing_info);
86+
extern int ns_fhss_ws_set_parent(const fhss_api_t *fhss_api, const uint8_t eui64[8], const broadcast_timing_info_t *bc_timing_info, const bool force_synch);
8487

8588
/**
8689
* @brief Remove parent which was set by ns_fhss_ws_set_parent function.

features/nanostack/sal-stack-nanostack/nanostack/mac_api.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,8 +137,9 @@ typedef void mcps_data_request_ext(const mac_api_t* api, const mcps_data_req_t *
137137
* @brief mcps_purge_request MCPS_PURGE request call
138138
* @param api API to handle the request
139139
* @param data MCPS-PURGE.request specific values
140+
* @return 0 in case of success, non-zero otherwise
140141
*/
141-
typedef void mcps_purge_request(const mac_api_t* api, const mcps_purge_t *data);
142+
typedef uint8_t mcps_purge_request(const mac_api_t* api, const mcps_purge_t *data);
142143

143144
//Upper layer specific callback functions (will also be set by Upper layer after mac_api_t has been created and given to it)
144145

features/nanostack/sal-stack-nanostack/nanostack/net_fhss.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,9 @@ extern "C" {
3939
extern fhss_api_t *ns_fhss_create(const fhss_configuration_t *fhss_configuration, const fhss_timer_t *fhss_timer, fhss_statistics_t *fhss_statistics);
4040

4141
/**
42-
* @brief TODO: description.
42+
* @brief Creates FHSS WS API instance which will be registered to software MAC.
4343
* @param fhss_configuration Basic FHSS configuration.
4444
* @param fhss_timer FHSS platform timer interface and configuration.
45-
* @param fhss_statistics FHSS statistics storage.
4645
* @return New FHSS instance if successful, NULL otherwise.
4746
*/
4847
extern fhss_api_t *ns_fhss_ws_create(const fhss_ws_configuration_t *fhss_configuration, const fhss_timer_t *fhss_timer);

features/nanostack/sal-stack-nanostack/nanostack/thread_bbr_api.h

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ int thread_bbr_start(int8_t interface_id, int8_t backbone_interface_id);
7575
*
7676
*/
7777
int thread_bbr_timeout_set(int8_t interface_id, uint32_t timeout_a, uint32_t timeout_b, uint32_t delay);
78+
7879
/**
7980
* Set prefix to be used as combining multiple thread networks on backbone.
8081
*
@@ -89,6 +90,20 @@ int thread_bbr_timeout_set(int8_t interface_id, uint32_t timeout_a, uint32_t tim
8990
*/
9091
int thread_bbr_prefix_set(int8_t interface_id, uint8_t *prefix);
9192

93+
/**
94+
* Set sequence number to be used by bbr
95+
*
96+
* update sequence number value
97+
*
98+
* \param interface_id interface ID of the Thread network.
99+
* \param sequence_number value that needs to be set on bbr
100+
*
101+
* \return 0 on success
102+
* \return <0 in case of errors
103+
*
104+
*/
105+
int thread_bbr_sequence_number_set(int8_t interface_id, uint8_t sequence_number);
106+
92107
/**
93108
* Set the Thread validation interface destination address.
94109
*

features/nanostack/sal-stack-nanostack/nanostack/thread_commissioning_api.h

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,8 +189,10 @@ void *thread_commission_device_get_next(void *ptr, int8_t interface_id, bool *sh
189189

190190
typedef struct thread_commissioning_link_configuration {
191191
uint8_t name[16]; /**< Name of the Thread network. utf8 string nul terminated if shorter than 16. */
192+
uint8_t destination_address[16]; /**<Border router destination address*/
192193
uint8_t extented_pan_id[8]; /**< Extended PAN ID. */
193194
uint16_t panId; /**< Network ID. */
195+
uint16_t destination_port; /**<destination port for commissioning*/
194196
uint8_t Protocol_id; /**< Current protocol ID. */
195197
uint8_t version; /**< Current protocol version. */
196198
uint8_t rfChannel; /**< Current RF channel. */
@@ -271,6 +273,18 @@ int thread_commissioning_native_commissioner_get_connection_info(int8_t interfac
271273
*/
272274
int8_t thread_commissioning_get_management_id(int8_t interface_id);
273275

276+
/**
277+
* \brief Attach native commissioner to destination address and port.
278+
*
279+
* \param interface_id Network interface ID.
280+
* \param destination_address Destination address pointer.
281+
* \param destination_port Commissioning port.
282+
*
283+
* \return 0 attach OK.
284+
* \return < 0 fail.
285+
*/
286+
int thread_commissioning_attach(int8_t interface_id, uint8_t *destination_address, uint16_t destination_port);
287+
274288
#ifdef __cplusplus
275289
}
276290
#endif

features/nanostack/sal-stack-nanostack/nanostack/thread_diagcop_lib.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,8 @@
5555
#define DIAGCOP_TLV_SUPPLY_VOLTAGE 15 /**< Can not reset*/
5656
#define DIAGCOP_TLV_CHILD_TABLE 16 /**< Can not reset*/
5757
#define DIAGCOP_TLV_CHANNEL_PAGES 17 /**< Can not reset*/
58-
#define DIAGCOP_TLV_TYPE_LIST 18 /**< List type*/
58+
#define DIAGCOP_TLV_TYPE_LIST 18 /**< Cannot reset*/
59+
#define DIAGCOP_TLV_MAX_CHILD_TIMEOUT 19 /**< Cannot reset*/
5960

6061
/**
6162
* \brief Write array TLV.

features/nanostack/sal-stack-nanostack/source/6LoWPAN/Bootstraps/Generic/protocol_6lowpan.c

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@
7474
#include "6LoWPAN/Fragmentation/cipv6_fragmenter.h"
7575
#include "Service_Libs/etx/etx.h"
7676
#include "Service_Libs/mac_neighbor_table/mac_neighbor_table.h"
77+
#include "6LoWPAN/ws/ws_bootstrap.h"
7778

7879

7980
#define TRACE_GROUP_LOWPAN "6lo"
@@ -473,7 +474,6 @@ void protocol_6lowpan_neighbor_priority_update(protocol_interface_info_entry_t *
473474
}
474475

475476
#ifdef HAVE_RPL
476-
#ifndef NO_MLE
477477

478478
uint16_t protocol_6lowpan_neighbor_priority_set(int8_t interface_id, addrtype_t addr_type, const uint8_t *addr_ptr)
479479
{
@@ -486,9 +486,12 @@ uint16_t protocol_6lowpan_neighbor_priority_set(int8_t interface_id, addrtype_t
486486
mac_neighbor_table_entry_t * entry = mac_neighbor_table_address_discover(mac_neighbor_info(cur), addr_ptr + PAN_ID_LEN, addr_type);
487487

488488
if (entry) {
489+
490+
bool new_primary = false;
489491
etx_storage_t *etx_entry = etx_storage_entry_get(interface_id, entry->index);
490492
// If primary parent has changed clears priority from previous parent
491493
if (entry->link_role != PRIORITY_PARENT_NEIGHBOUR) {
494+
new_primary = true;
492495
protocol_6lowpan_neighbor_priority_clear_all(interface_id, PRIORITY_1ST);
493496
}
494497
entry->link_role = PRIORITY_PARENT_NEIGHBOUR;
@@ -501,6 +504,10 @@ uint16_t protocol_6lowpan_neighbor_priority_set(int8_t interface_id, addrtype_t
501504
if (etx_entry) {
502505
protocol_stats_update(STATS_ETX_1ST_PARENT, etx_entry->etx >> 4);
503506
}
507+
508+
if (new_primary) {
509+
ws_primary_parent_update(cur, entry);
510+
}
504511
return 1;
505512
} else {
506513
return 0;
@@ -519,16 +526,21 @@ uint16_t protocol_6lowpan_neighbor_second_priority_set(int8_t interface_id, addr
519526
mac_neighbor_table_entry_t * entry = mac_neighbor_table_address_discover(mac_neighbor_info(cur), addr_ptr + PAN_ID_LEN, addr_type);
520527

521528
if (entry) {
529+
bool new_secondary = false;
522530
etx_storage_t *etx_entry = etx_storage_entry_get(interface_id, entry->index);
523531
// If secondary parent has changed clears priority from previous parent
524532
if (entry->link_role != SECONDARY_PARENT_NEIGHBOUR) {
533+
new_secondary = true;
525534
protocol_6lowpan_neighbor_priority_clear_all(interface_id, PRIORITY_2ND);
526535
}
527536
entry->link_role = SECONDARY_PARENT_NEIGHBOUR;
528537

529538
if (etx_entry) {
530539
protocol_stats_update(STATS_ETX_2ND_PARENT, etx_entry->etx >> 4);
531540
}
541+
if (new_secondary) {
542+
ws_secondary_parent_update(cur);
543+
}
532544
return 1;
533545
} else {
534546
return 0;
@@ -557,7 +569,6 @@ void protocol_6lowpan_neighbor_priority_clear_all(int8_t interface_id, neighbor_
557569
}
558570
}
559571

560-
#endif
561572
#endif
562573

563574
#endif

features/nanostack/sal-stack-nanostack/source/6LoWPAN/Bootstraps/Generic/protocol_6lowpan_bootstrap.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1786,7 +1786,7 @@ int8_t arm_6lowpan_bootstarp_bootstrap_set(int8_t interface_id, net_6lowpan_mode
17861786
*/
17871787
if (cur->lowpan_info & INTERFACE_NWK_ROUTER_DEVICE) {
17881788
//rpl_control_set_domain_on_interface(cur, protocol_6lowpan_rpl_domain, true);
1789-
//rpl_control_set_callback(protocol_6lowpan_rpl_domain, protocol_6lowpan_bootstrap_rpl_callback, cur);
1789+
//rpl_control_set_callback(protocol_6lowpan_rpl_domain, protocol_6lowpan_bootstrap_rpl_callback, NULL, cur);
17901790
}
17911791
#endif
17921792
cur->configure_flags |= INTERFACE_BOOTSTRAP_DEFINED;
@@ -2073,6 +2073,8 @@ static void protocol_6lowpan_bootstrap_rpl_callback(rpl_event_t event, void *han
20732073
tr_error("RPL Local repair fail-->interface to idle");
20742074
nwk_bootsrap_state_update(ARM_NWK_NWK_CONNECTION_DOWN, cur);
20752075
break;
2076+
default:
2077+
break;
20762078
}
20772079
}
20782080

@@ -2179,7 +2181,7 @@ void nwk_6lowpan_nd_address_registartion_ready(protocol_interface_info_entry_t *
21792181
// arm_nwk_6lowpan_rpl_dodag_poison from a previous connection may have left force_leaf set
21802182
rpl_control_force_leaf(protocol_6lowpan_rpl_domain, false);
21812183
rpl_control_set_domain_on_interface(cur, protocol_6lowpan_rpl_domain, true);
2182-
rpl_control_set_callback(protocol_6lowpan_rpl_domain, protocol_6lowpan_bootstrap_rpl_callback, cur);
2184+
rpl_control_set_callback(protocol_6lowpan_rpl_domain, protocol_6lowpan_bootstrap_rpl_callback, NULL, cur);
21832185
}
21842186
// Send unicast DIS to coordinator
21852187
nwk_bootstrap_icmp_rpl_dis_coord_msg_tx(cur);

features/nanostack/sal-stack-nanostack/source/6LoWPAN/MAC/mpx_api.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,10 @@ typedef void mpx_data_request(const mpx_api_t *api, const struct mcps_data_req_s
3939
* @param api API to handle the request
4040
* @param purge MCPS-purge request
4141
* @param user_id MPX user ID
42+
* @return 0 if purge requst was OK, non-zero otherwise
4243
*
4344
*/
44-
typedef void mpx_data_purge_request(const mpx_api_t *api, struct mcps_purge_s *purge, uint16_t user_id);
45+
typedef uint8_t mpx_data_purge_request(const mpx_api_t *api, struct mcps_purge_s *purge, uint16_t user_id);
4546

4647
/**
4748
* @brief mpx_data_confirm MPX-DATA confirm is called as a response to MPX-DATA request

0 commit comments

Comments
 (0)