@@ -208,7 +208,7 @@ static bool protocol_6lowpan_challenge_callback(int8_t interface_id, uint16_t ms
208
208
memcpy (mac64 , ll64_ptr + 8 , 8 );
209
209
mac64 [0 ] ^= 2 ;
210
210
211
- mac_neighbor_table_entry_t * neig_info = mac_neighbor_table_address_discover (cur_interface -> mac_parameters -> mac_neighbor_table , mac64 , ADDR_802_15_4_LONG );
211
+ mac_neighbor_table_entry_t * neig_info = mac_neighbor_table_address_discover (mac_neighbor_info ( cur_interface ) , mac64 , ADDR_802_15_4_LONG );
212
212
213
213
if (!neig_info ) {
214
214
return false;//Why entry is removed before timeout??
@@ -222,7 +222,7 @@ static bool protocol_6lowpan_challenge_callback(int8_t interface_id, uint16_t ms
222
222
223
223
if (usedAllRetries ) {
224
224
//GET entry
225
- mac_neighbor_table_neighbor_remove (cur_interface -> mac_parameters -> mac_neighbor_table , neig_info );
225
+ mac_neighbor_table_neighbor_remove (mac_neighbor_info ( cur_interface ) , neig_info );
226
226
return false;
227
227
}
228
228
@@ -407,7 +407,7 @@ static uint8_t *mle_table_set_neighbours(protocol_interface_info_entry_t *cur, u
407
407
// defaults: complete, 2 bytes long link-layer address
408
408
link_flags_ptr = ptr ++ ;
409
409
* link_flags_ptr = 0x81 ;
410
- if (mac_neighbor_table_address_discover (cur -> mac_parameters -> mac_neighbor_table , short_temp ,ADDR_802_15_4_SHORT )) {
410
+ if (mac_neighbor_table_address_discover (mac_neighbor_info ( cur ) , short_temp ,ADDR_802_15_4_SHORT )) {
411
411
* link_flags_ptr |= 0x07 ;
412
412
neigh_count_max = mle_advert_neigh_cnt (cur , false);
413
413
} else {
@@ -490,7 +490,7 @@ static int protocol_6lowpan_mle_neigh_advertise(protocol_interface_info_entry_t
490
490
return 0 ;
491
491
}
492
492
493
- if (mac_neighbor_table_address_discover (cur -> mac_parameters -> mac_neighbor_table , short_temp ,ADDR_802_15_4_SHORT )) {
493
+ if (mac_neighbor_table_address_discover (mac_neighbor_info ( cur ) , short_temp ,ADDR_802_15_4_SHORT )) {
494
494
neig_cache_size += mle_advert_neigh_cnt (cur , false) * 10 ;
495
495
} else {
496
496
neig_cache_size += mle_advert_neigh_cnt (cur , true) << 2 ;
@@ -565,7 +565,7 @@ static void mle_neigh_time_and_mode_update(mac_neighbor_table_entry_t *entry_tem
565
565
timeout_tlv = mle_6lowpan_data -> host_lifetime ;
566
566
}
567
567
}
568
- mac_neighbor_table_neighbor_refresh (cur -> mac_parameters -> mac_neighbor_table , entry_temp , timeout_tlv );
568
+ mac_neighbor_table_neighbor_refresh (mac_neighbor_info ( cur ) , entry_temp , timeout_tlv );
569
569
}
570
570
571
571
static void mle_neigh_entry_update_by_mle_tlv_list (int8_t interface_id , mac_neighbor_table_entry_t * entry_temp , uint8_t * tlv_ptr , uint16_t tlv_length , uint8_t * mac64 , uint16_t short_address )
@@ -729,10 +729,10 @@ static int mle_router_accept_request_build(protocol_interface_info_entry_t *cur,
729
729
730
730
static void protocol_6lowpan_link_reject_handler (protocol_interface_info_entry_t * cur , uint8_t * ll64 )
731
731
{
732
- mac_neighbor_table_entry_t * mac_entry = mac_neighbor_entry_get_by_ll64 (cur -> mac_parameters -> mac_neighbor_table , ll64 , false, NULL );
732
+ mac_neighbor_table_entry_t * mac_entry = mac_neighbor_entry_get_by_ll64 (mac_neighbor_info ( cur ) , ll64 , false, NULL );
733
733
tr_debug ("MLE link reject" );
734
734
if (mac_entry ) {
735
- mac_neighbor_table_neighbor_remove (cur -> mac_parameters -> mac_neighbor_table , mac_entry );
735
+ mac_neighbor_table_neighbor_remove (mac_neighbor_info ( cur ) , mac_entry );
736
736
}
737
737
}
738
738
@@ -1048,7 +1048,7 @@ void mle_6lowpan_message_handler(int8_t interface_id, mle_message_t *mle_msg, ml
1048
1048
mle_6lowpan_data -> link_req_token_bucket -- ;
1049
1049
} else {
1050
1050
//Update only old information based on link request
1051
- entry_temp = mac_neighbor_entry_get_by_ll64 (cur -> mac_parameters -> mac_neighbor_table , mle_msg -> packet_src_address , false, NULL );
1051
+ entry_temp = mac_neighbor_entry_get_by_ll64 (mac_neighbor_info ( cur ) , mle_msg -> packet_src_address , false, NULL );
1052
1052
if (entry_temp ) {
1053
1053
mle_neigh_time_and_mode_update (entry_temp ,mle_msg );
1054
1054
mle_neigh_entry_update_by_mle_tlv_list (interface_id , entry_temp , mle_msg -> data_ptr , mle_msg -> data_length , cur -> mac , own_mac16 );
@@ -1084,11 +1084,11 @@ void mle_6lowpan_message_handler(int8_t interface_id, mle_message_t *mle_msg, ml
1084
1084
}
1085
1085
1086
1086
tr_debug ("Accept & Request" );
1087
- entry_temp = mac_neighbor_entry_get_by_ll64 (cur -> mac_parameters -> mac_neighbor_table , mle_msg -> packet_src_address , false, NULL );
1087
+ entry_temp = mac_neighbor_entry_get_by_ll64 (mac_neighbor_info ( cur ) , mle_msg -> packet_src_address , false, NULL );
1088
1088
if (!entry_temp ) {
1089
1089
// If there is space for neighbors try to allocate new entry
1090
1090
if (mle_6lowpan_neighbor_limit_check (mle_msg , true)) {
1091
- entry_temp = mac_neighbor_entry_get_by_ll64 (cur -> mac_parameters -> mac_neighbor_table , mle_msg -> packet_src_address , true, NULL );
1091
+ entry_temp = mac_neighbor_entry_get_by_ll64 (mac_neighbor_info ( cur ) , mle_msg -> packet_src_address , true, NULL );
1092
1092
}
1093
1093
}
1094
1094
@@ -1148,7 +1148,7 @@ void mle_6lowpan_message_handler(int8_t interface_id, mle_message_t *mle_msg, ml
1148
1148
t_ptr = mle_tlv_info .dataPtr ;
1149
1149
mode = * t_ptr ;
1150
1150
}
1151
- entry_temp = mac_neighbor_entry_get_by_ll64 (cur -> mac_parameters -> mac_neighbor_table , mle_msg -> packet_src_address , false, NULL );
1151
+ entry_temp = mac_neighbor_entry_get_by_ll64 (mac_neighbor_info ( cur ) , mle_msg -> packet_src_address , false, NULL );
1152
1152
if (!entry_temp ) {
1153
1153
if ((mode & MLE_DEV_MASK ) == MLE_FFD_DEV ) {
1154
1154
// If there is space for neighbors synchronizes to new router
@@ -1183,7 +1183,7 @@ void mle_6lowpan_message_handler(int8_t interface_id, mle_message_t *mle_msg, ml
1183
1183
//Possible remove
1184
1184
if ((mode & MLE_DEV_MASK ) == MLE_RFD_DEV ) {
1185
1185
//Remove Entry
1186
- mac_neighbor_table_neighbor_remove (cur -> mac_parameters -> mac_neighbor_table , entry_temp );
1186
+ mac_neighbor_table_neighbor_remove (mac_neighbor_info ( cur ) , entry_temp );
1187
1187
tr_error ("MLE adv: Own address not found" );
1188
1188
return ;
1189
1189
}
@@ -1196,7 +1196,7 @@ void mle_6lowpan_message_handler(int8_t interface_id, mle_message_t *mle_msg, ml
1196
1196
mle_neigh_entry_update_by_mle_tlv_list (cur -> id ,entry_temp , mle_msg -> data_ptr , mle_msg -> data_length , cur -> mac , own_mac16 );
1197
1197
mle_neigh_entry_frame_counter_update (entry_temp , mle_msg -> data_ptr , mle_msg -> data_length , cur , security_headers -> KeyIndex );
1198
1198
if (entry_temp -> connected_device ) {
1199
- mac_neighbor_table_neighbor_refresh (cur -> mac_parameters -> mac_neighbor_table , entry_temp , entry_temp -> link_lifetime );
1199
+ mac_neighbor_table_neighbor_refresh (mac_neighbor_info ( cur ) , entry_temp , entry_temp -> link_lifetime );
1200
1200
}
1201
1201
}
1202
1202
break ;
@@ -1294,7 +1294,7 @@ static void protocol_6lowpan_mle_purge_neighbors(struct protocol_interface_info_
1294
1294
1295
1295
// Sends REJECT
1296
1296
mle_service_reject_message_build (cur_interface -> id , ll64 , false);
1297
- mac_neighbor_table_neighbor_remove (cur_interface -> mac_parameters -> mac_neighbor_table , entry );
1297
+ mac_neighbor_table_neighbor_remove (mac_neighbor_info ( cur_interface ) , entry );
1298
1298
1299
1299
// Adds purged neighbor to blacklist so that it is not added right away back from advertisement
1300
1300
blacklist_update (ll64 , false);
@@ -1679,16 +1679,16 @@ int8_t arm_6lowpan_bootstarp_bootstrap_set(int8_t interface_id, net_6lowpan_mode
1679
1679
cur -> mac_security_key_usage_update_cb = arm_6lowpan_security_key_update_cb ;
1680
1680
//Allocate MLE class here
1681
1681
//Deallocate old here
1682
- mac_neighbor_table_delete (cur -> mac_parameters -> mac_neighbor_table );
1682
+ mac_neighbor_table_delete (mac_neighbor_info ( cur ) );
1683
1683
mac_description_storage_size_t buffer ;
1684
1684
//Read MAC device table sizes
1685
1685
if (cur -> mac_api -> mac_storage_sizes_get (cur -> mac_api , & buffer ) != 0 ) {
1686
1686
return -1 ;
1687
1687
}
1688
1688
1689
- cur -> mac_parameters -> mac_neighbor_table = mac_neighbor_table_create (buffer .device_decription_table_size , lowpan_neighbor_entry_remove_notify
1689
+ mac_neighbor_info ( cur ) = mac_neighbor_table_create (buffer .device_decription_table_size , lowpan_neighbor_entry_remove_notify
1690
1690
, lowpan_neighbor_entry_nud_notify , cur );
1691
- if (!cur -> mac_parameters -> mac_neighbor_table ) {
1691
+ if (!mac_neighbor_info ( cur ) ) {
1692
1692
return -1 ;
1693
1693
}
1694
1694
@@ -1973,7 +1973,7 @@ static void protocol_6lowpan_nd_ready(protocol_interface_info_entry_t *cur)
1973
1973
addrtype_t addrType ;
1974
1974
uint8_t tempAddr [8 ];
1975
1975
addrType = mac_helper_coordinator_address_get (cur , tempAddr );
1976
- mac_neighbor_table_entry_t * neig_info = mac_neighbor_table_address_discover (cur -> mac_parameters -> mac_neighbor_table , tempAddr , addrType );
1976
+ mac_neighbor_table_entry_t * neig_info = mac_neighbor_table_address_discover (mac_neighbor_info ( cur ) , tempAddr , addrType );
1977
1977
1978
1978
if (neig_info ) {
1979
1979
if (neig_info -> lifetime > MLE_TABLE_CHALLENGE_TIMER ) {
@@ -2798,10 +2798,10 @@ static void lowpan_comm_status_indication_cb(int8_t if_id, const mlme_comm_statu
2798
2798
2799
2799
break ;
2800
2800
case MLME_DATA_POLL_NOTIFICATION :
2801
- entry_ptr = mac_neighbor_table_address_discover (cur -> mac_parameters -> mac_neighbor_table , status -> SrcAddr , status -> SrcAddrMode );
2801
+ entry_ptr = mac_neighbor_table_address_discover (mac_neighbor_info ( cur ) , status -> SrcAddr , status -> SrcAddrMode );
2802
2802
if (entry_ptr ) {
2803
2803
// Refresh Timeout
2804
- mac_neighbor_table_neighbor_refresh (cur -> mac_parameters -> mac_neighbor_table , entry_ptr , entry_ptr -> link_lifetime );
2804
+ mac_neighbor_table_neighbor_refresh (mac_neighbor_info ( cur ) , entry_ptr , entry_ptr -> link_lifetime );
2805
2805
}
2806
2806
break ;
2807
2807
default :
@@ -2817,13 +2817,13 @@ bool lowpan_neighbour_data_clean(int8_t interface_id, const uint8_t *link_local_
2817
2817
return false;
2818
2818
}
2819
2819
bool return_value = false;
2820
- mac_neighbor_table_entry_t * neigh_entry = mac_neighbor_entry_get_by_ll64 (cur -> mac_parameters -> mac_neighbor_table , link_local_address , false, NULL );
2820
+ mac_neighbor_table_entry_t * neigh_entry = mac_neighbor_entry_get_by_ll64 (mac_neighbor_info ( cur ) , link_local_address , false, NULL );
2821
2821
if (neigh_entry ) {
2822
2822
//Remove entry
2823
2823
if (neigh_entry -> link_role == PRIORITY_PARENT_NEIGHBOUR || neigh_entry -> link_role == SECONDARY_PARENT_NEIGHBOUR ) {
2824
2824
return_value = true;
2825
2825
}
2826
- mac_neighbor_table_neighbor_remove (cur -> mac_parameters -> mac_neighbor_table , neigh_entry );
2826
+ mac_neighbor_table_neighbor_remove (mac_neighbor_info ( cur ) , neigh_entry );
2827
2827
}
2828
2828
return return_value ;
2829
2829
}
0 commit comments