@@ -208,7 +208,7 @@ static bool protocol_6lowpan_challenge_callback(int8_t interface_id, uint16_t ms
208208 memcpy (mac64 , ll64_ptr + 8 , 8 );
209209 mac64 [0 ] ^= 2 ;
210210
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 );
212212
213213 if (!neig_info ) {
214214 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
222222
223223 if (usedAllRetries ) {
224224 //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 );
226226 return false;
227227 }
228228
@@ -407,7 +407,7 @@ static uint8_t *mle_table_set_neighbours(protocol_interface_info_entry_t *cur, u
407407 // defaults: complete, 2 bytes long link-layer address
408408 link_flags_ptr = ptr ++ ;
409409 * 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 )) {
411411 * link_flags_ptr |= 0x07 ;
412412 neigh_count_max = mle_advert_neigh_cnt (cur , false);
413413 } else {
@@ -490,7 +490,7 @@ static int protocol_6lowpan_mle_neigh_advertise(protocol_interface_info_entry_t
490490 return 0 ;
491491 }
492492
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 )) {
494494 neig_cache_size += mle_advert_neigh_cnt (cur , false) * 10 ;
495495 } else {
496496 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
565565 timeout_tlv = mle_6lowpan_data -> host_lifetime ;
566566 }
567567 }
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 );
569569}
570570
571571static 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,
729729
730730static void protocol_6lowpan_link_reject_handler (protocol_interface_info_entry_t * cur , uint8_t * ll64 )
731731{
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 );
733733 tr_debug ("MLE link reject" );
734734 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 );
736736 }
737737}
738738
@@ -1048,7 +1048,7 @@ void mle_6lowpan_message_handler(int8_t interface_id, mle_message_t *mle_msg, ml
10481048 mle_6lowpan_data -> link_req_token_bucket -- ;
10491049 } else {
10501050 //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 );
10521052 if (entry_temp ) {
10531053 mle_neigh_time_and_mode_update (entry_temp ,mle_msg );
10541054 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
10841084 }
10851085
10861086 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 );
10881088 if (!entry_temp ) {
10891089 // If there is space for neighbors try to allocate new entry
10901090 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 );
10921092 }
10931093 }
10941094
@@ -1148,7 +1148,7 @@ void mle_6lowpan_message_handler(int8_t interface_id, mle_message_t *mle_msg, ml
11481148 t_ptr = mle_tlv_info .dataPtr ;
11491149 mode = * t_ptr ;
11501150 }
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 );
11521152 if (!entry_temp ) {
11531153 if ((mode & MLE_DEV_MASK ) == MLE_FFD_DEV ) {
11541154 // 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
11831183 //Possible remove
11841184 if ((mode & MLE_DEV_MASK ) == MLE_RFD_DEV ) {
11851185 //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 );
11871187 tr_error ("MLE adv: Own address not found" );
11881188 return ;
11891189 }
@@ -1196,7 +1196,7 @@ void mle_6lowpan_message_handler(int8_t interface_id, mle_message_t *mle_msg, ml
11961196 mle_neigh_entry_update_by_mle_tlv_list (cur -> id ,entry_temp , mle_msg -> data_ptr , mle_msg -> data_length , cur -> mac , own_mac16 );
11971197 mle_neigh_entry_frame_counter_update (entry_temp , mle_msg -> data_ptr , mle_msg -> data_length , cur , security_headers -> KeyIndex );
11981198 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 );
12001200 }
12011201 }
12021202 break ;
@@ -1294,7 +1294,7 @@ static void protocol_6lowpan_mle_purge_neighbors(struct protocol_interface_info_
12941294
12951295 // Sends REJECT
12961296 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 );
12981298
12991299 // Adds purged neighbor to blacklist so that it is not added right away back from advertisement
13001300 blacklist_update (ll64 , false);
@@ -1679,16 +1679,16 @@ int8_t arm_6lowpan_bootstarp_bootstrap_set(int8_t interface_id, net_6lowpan_mode
16791679 cur -> mac_security_key_usage_update_cb = arm_6lowpan_security_key_update_cb ;
16801680 //Allocate MLE class here
16811681 //Deallocate old here
1682- mac_neighbor_table_delete (cur -> mac_parameters -> mac_neighbor_table );
1682+ mac_neighbor_table_delete (mac_neighbor_info ( cur ) );
16831683 mac_description_storage_size_t buffer ;
16841684 //Read MAC device table sizes
16851685 if (cur -> mac_api -> mac_storage_sizes_get (cur -> mac_api , & buffer ) != 0 ) {
16861686 return -1 ;
16871687 }
16881688
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
16901690 , lowpan_neighbor_entry_nud_notify , cur );
1691- if (!cur -> mac_parameters -> mac_neighbor_table ) {
1691+ if (!mac_neighbor_info ( cur ) ) {
16921692 return -1 ;
16931693 }
16941694
@@ -1973,7 +1973,7 @@ static void protocol_6lowpan_nd_ready(protocol_interface_info_entry_t *cur)
19731973 addrtype_t addrType ;
19741974 uint8_t tempAddr [8 ];
19751975 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 );
19771977
19781978 if (neig_info ) {
19791979 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
27982798
27992799 break ;
28002800 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 );
28022802 if (entry_ptr ) {
28032803 // 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 );
28052805 }
28062806 break ;
28072807 default :
@@ -2817,13 +2817,13 @@ bool lowpan_neighbour_data_clean(int8_t interface_id, const uint8_t *link_local_
28172817 return false;
28182818 }
28192819 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 );
28212821 if (neigh_entry ) {
28222822 //Remove entry
28232823 if (neigh_entry -> link_role == PRIORITY_PARENT_NEIGHBOUR || neigh_entry -> link_role == SECONDARY_PARENT_NEIGHBOUR ) {
28242824 return_value = true;
28252825 }
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 );
28272827 }
28282828 return return_value ;
28292829}
0 commit comments