File tree Expand file tree Collapse file tree 4 files changed +39
-1
lines changed Expand file tree Collapse file tree 4 files changed +39
-1
lines changed Original file line number Diff line number Diff line change 55
55
#define DIAGCOP_TLV_SUPPLY_VOLTAGE 15 /**< Can not reset*/
56
56
#define DIAGCOP_TLV_CHILD_TABLE 16 /**< Can not reset*/
57
57
#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*/
59
60
60
61
/**
61
62
* \brief Write array TLV.
Original file line number Diff line number Diff line change @@ -254,6 +254,7 @@ static uint8_t *thread_diagnostic_get_build(protocol_interface_info_entry_t *cur
254
254
uint8_t * ptr ;
255
255
int written_address_count = 0 ;
256
256
uint16_t ipv6_address_count = 0 ;
257
+ uint32_t max_child_timeout = 0 ;
257
258
uint8_t extended_address [8 ] = {0 };
258
259
259
260
arm_net_interface_address_list_size (cur -> id , & ipv6_address_count );
@@ -352,6 +353,12 @@ static uint8_t *thread_diagnostic_get_build(protocol_interface_info_entry_t *cur
352
353
response_ptr = thread_diagcop_tlv_data_write_uint8 (response_ptr , DIAGCOP_TLV_CHANNEL_PAGES , 0 );
353
354
break ;
354
355
356
+ case DIAGCOP_TLV_MAX_CHILD_TIMEOUT :
357
+ if (thread_router_bootstrap_child_max_timeout_get (cur , & max_child_timeout ) == 0 ) {
358
+ response_ptr = thread_diagcop_tlv_data_write_uint32 (response_ptr , DIAGCOP_TLV_MAX_CHILD_TIMEOUT , max_child_timeout );
359
+ }
360
+ break ;
361
+
355
362
default :
356
363
357
364
break ;
Original file line number Diff line number Diff line change @@ -1196,6 +1196,32 @@ static int mle_attach_child_id_response_build(protocol_interface_info_entry_t *c
1196
1196
1197
1197
1198
1198
}
1199
+
1200
+ int thread_router_bootstrap_child_max_timeout_get (protocol_interface_info_entry_t * cur , uint32_t * max_child_timeout )
1201
+ {
1202
+ uint16_t router_address = thread_info (cur )-> routerShortAddress ;
1203
+ uint32_t max_timeout = 0 ;
1204
+ if (router_address >= 0xfffe ) {
1205
+ router_address = mac_helper_mac16_address_get (cur );
1206
+ }
1207
+ if (router_address & THREAD_CHILD_MASK ) {
1208
+ return -1 ; //I am child
1209
+ }
1210
+ if (router_address >= 0xfffe ) {
1211
+ return -1 ;
1212
+ }
1213
+ mac_neighbor_table_list_t * mac_table_list = & mac_neighbor_info (cur )-> neighbour_list ;
1214
+
1215
+ ns_list_foreach (mac_neighbor_table_entry_t , cur_entry , mac_table_list ) {
1216
+ if (thread_router_addr_from_addr (cur_entry -> mac16 ) == router_address &&
1217
+ !cur_entry -> ffd_device && cur_entry -> lifetime > max_timeout ) {
1218
+ max_timeout = cur_entry -> lifetime ;
1219
+ }
1220
+ }
1221
+ * max_child_timeout = max_timeout ;
1222
+ return 0 ;
1223
+ }
1224
+
1199
1225
uint16_t thread_router_bootstrap_child_count_get (protocol_interface_info_entry_t * cur )
1200
1226
{
1201
1227
uint16_t child_count = 0 ;
Original file line number Diff line number Diff line change @@ -52,6 +52,9 @@ int thread_router_bootstrap_mle_advertise(struct protocol_interface_info_entry *
52
52
void thread_router_bootstrap_child_information_clear (protocol_interface_info_entry_t * cur );
53
53
int thread_router_bootstrap_reset_child_info (protocol_interface_info_entry_t * cur , struct mac_neighbor_table_entry * child );
54
54
uint16_t thread_router_bootstrap_child_count_get (protocol_interface_info_entry_t * cur );
55
+
56
+ // max_child_timeout is longest MLE Timeout a router has registered for all of its active MTD children
57
+ int thread_router_bootstrap_child_max_timeout_get (protocol_interface_info_entry_t * cur , uint32_t * max_child_timeout );
55
58
void thread_router_bootstrap_child_id_handler (struct protocol_interface_info_entry * cur );
56
59
void thread_router_bootstrap_child_id_reject (struct protocol_interface_info_entry * cur );
57
60
void thread_router_bootstrap_router_id_request (struct protocol_interface_info_entry * cur , uint8_t status );
@@ -81,6 +84,7 @@ void thread_router_bootstrap_address_change_notify_send(protocol_interface_info_
81
84
82
85
#define thread_router_bootstrap_child_information_clear (cur )
83
86
#define thread_router_bootstrap_child_count_get (cur ) 0
87
+ #define thread_router_bootstrap_child_max_timeout_get (cur , max_child_timeout ) 0
84
88
#define thread_router_bootstrap_child_id_handler (cur )
85
89
#define thread_router_bootstrap_child_id_reject (cur )
86
90
#define thread_router_bootstrap_router_id_request (cur , status )
You can’t perform that action at this time.
0 commit comments