Skip to content

Commit

Permalink
Function parameter and name refactor.
Browse files Browse the repository at this point in the history
Change-Id: I2219bfc9cecb637edf718947714533143a64adcd
  • Loading branch information
Juha Heiskanen authored and juhhei01 committed Jun 12, 2018
1 parent 13b3b05 commit fde5104
Show file tree
Hide file tree
Showing 19 changed files with 70 additions and 70 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1150,7 +1150,7 @@ void mle_6lowpan_message_handler(int8_t interface_id, mle_message_t *mle_msg, ml
mle_neigh_entry_frame_counter_update(entry_temp, mle_msg->data_ptr, mle_msg->data_length, cur, security_headers->KeyIndex);
// If MLE frame counter was invalid update its value since three way handshake is complete
if (security_headers->invalid_frame_counter) {
mle_service_frame_counter_table_add(interface_id, entry_temp->attribute_index, security_headers->frameCounter);
mle_service_frame_counter_entry_add(interface_id, entry_temp->attribute_index, security_headers->frameCounter);
}
break;

Expand Down
2 changes: 1 addition & 1 deletion source/6LoWPAN/MAC/mac_data_poll.c
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ void mac_mlme_poll_confirm(protocol_interface_info_entry_t *cur, const mlme_poll
break;
}
if (thread_info(cur) && entry) {
thread_neighbor_commucation_update(cur, entry->attribute_index);
thread_neighbor_communication_update(cur, entry->attribute_index);
}

mac_poll_timer_trig(poll_time, cur);
Expand Down
8 changes: 4 additions & 4 deletions source/6LoWPAN/Thread/thread_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -1134,7 +1134,7 @@ static uint8_t *thread_linkquality_write(int8_t interface_id, uint8_t *buffer)
ns_list_foreach(mle_neigh_table_entry_t, cur, neigh_list) {
if (thread_is_router_addr(cur->short_adr)) {
// Only count routers to link quality
uint16_t link_margin = thread_neighbor_class_linkmargin_get(&interface_ptr->thread_info->neighbor_class, cur->attribute_index);
uint16_t link_margin = thread_neighbor_entry_linkmargin_get(&interface_ptr->thread_info->neighbor_class, cur->attribute_index);
thread_link_quality = thread_link_margin_to_quality(link_margin);
switch (thread_link_quality) {
case QUALITY_20dB:
Expand Down Expand Up @@ -1872,7 +1872,7 @@ void thread_reset_neighbour_info(protocol_interface_info_entry_t *cur, mle_neigh
thread_router_bootstrap_reset_child_info(cur, neighbour);
protocol_6lowpan_release_long_link_address_from_neighcache(cur, neighbour->mac64);
mac_helper_devicetable_remove(cur->mac_api, neighbour->attribute_index);
thread_neighbor_class_table_remove(&cur->thread_info->neighbor_class, neighbour->attribute_index);
thread_neighbor_class_entry_remove(&cur->thread_info->neighbor_class, neighbour->attribute_index);
}

uint8_t thread_get_router_count_from_route_tlv(mle_tlv_info_t *routeTlv)
Expand Down Expand Up @@ -1948,9 +1948,9 @@ void thread_old_partition_data_purge(protocol_interface_info_entry_t *cur)

}

void thread_neighbor_commucation_update(protocol_interface_info_entry_t *cur, uint8_t neighbor_attribute_index)
void thread_neighbor_communication_update(protocol_interface_info_entry_t *cur, uint8_t neighbor_attribute_index)
{
thread_neighbor_last_communincation_time_update(&cur->thread_info->neighbor_class, neighbor_attribute_index);
thread_neighbor_last_communication_time_update(&cur->thread_info->neighbor_class, neighbor_attribute_index);
}

#endif
Expand Down
4 changes: 2 additions & 2 deletions source/6LoWPAN/Thread/thread_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,7 @@ void thread_calculate_key_guard_timer(protocol_interface_info_entry_t *cur, link
void thread_set_link_local_address(protocol_interface_info_entry_t *cur);
void thread_mcast_group_change(struct protocol_interface_info_entry *interface, struct if_group_entry *group, bool group_added);
void thread_old_partition_data_purge(protocol_interface_info_entry_t *cur);
void thread_neighbor_commucation_update(protocol_interface_info_entry_t *cur, uint8_t neighbor_attribute_index);
void thread_neighbor_communication_update(protocol_interface_info_entry_t *cur, uint8_t neighbor_attribute_index);

#else // HAVE_THREAD

Expand All @@ -454,7 +454,7 @@ NS_DUMMY_DEFINITIONS_OK
#define thread_link_reject_send(interface, ll64) 0
#define thread_addr_is_mesh_local_16(addr, cur) false
#define thread_mcast_group_change(interface, group, group_added) ((void)0)
#define thread_neighbor_commucation_update(cur, neighbor_attribute_index) ((void)0)
#define thread_neighbor_communication_update(cur, neighbor_attribute_index) ((void)0)
#endif // HAVE_THREAD

#endif /* LOWPAN_THREAD_H_ */
10 changes: 5 additions & 5 deletions source/6LoWPAN/Thread/thread_host_bootstrap.c
Original file line number Diff line number Diff line change
Expand Up @@ -163,12 +163,12 @@ static bool thread_parent_discover_timeout_cb(int8_t interface_id, uint16_t msgI
return false;
}
thread_neighbor_class_update_link(&cur->thread_info->neighbor_class, entry_temp->attribute_index, parent->linkMarginToParent, new_entry_created);
thread_neighbor_last_communincation_time_update(&cur->thread_info->neighbor_class, entry_temp->attribute_index);
thread_neighbor_last_communication_time_update(&cur->thread_info->neighbor_class, entry_temp->attribute_index);

entry_temp->short_adr = parent->shortAddress;
entry_temp->priorityFlag = true;

mle_service_frame_counter_table_add(interface_id, entry_temp->attribute_index, parent->mleFrameCounter);
mle_service_frame_counter_entry_add(interface_id, entry_temp->attribute_index, parent->mleFrameCounter);

thread_management_key_sets_calc(cur, linkConfiguration, cur->thread_info->thread_attach_scanned_parent->keySequence);
thread_calculate_key_guard_timer(cur, linkConfiguration, true);
Expand Down Expand Up @@ -336,7 +336,7 @@ static int thread_end_device_synch_response_validate(protocol_interface_info_ent
return -2;
}
thread_neighbor_class_update_link(&cur->thread_info->neighbor_class, entry_temp->attribute_index, linkMargin, new_entry_created);
thread_neighbor_last_communincation_time_update(&cur->thread_info->neighbor_class, entry_temp->attribute_index);
thread_neighbor_last_communication_time_update(&cur->thread_info->neighbor_class, entry_temp->attribute_index);
/*
*/
Expand Down Expand Up @@ -799,7 +799,7 @@ static void thread_mle_child_request_receive_cb(int8_t interface_id, mle_message
return;
}
thread_neighbor_class_update_link(&cur->thread_info->neighbor_class, entry_temp->attribute_index, thread_compute_link_margin(mle_msg->dbm), new_entry_created);
thread_neighbor_last_communincation_time_update(&cur->thread_info->neighbor_class, entry_temp->attribute_index);
thread_neighbor_last_communication_time_update(&cur->thread_info->neighbor_class, entry_temp->attribute_index);

//Parse mandatory TLV's
if (!thread_leader_data_parse(mle_msg->data_ptr, mle_msg->data_length, &leaderData)) {
Expand Down Expand Up @@ -961,7 +961,7 @@ void thread_endevice_synch_start(protocol_interface_info_entry_t *cur)
if (entry_temp) {
//Add link margin 64
thread_neighbor_class_update_link(&cur->thread_info->neighbor_class, entry_temp->attribute_index,64, new_entry_created);
thread_neighbor_last_communincation_time_update(&cur->thread_info->neighbor_class, entry_temp->attribute_index);
thread_neighbor_last_communication_time_update(&cur->thread_info->neighbor_class, entry_temp->attribute_index);

entry_temp->short_adr = cur->thread_info->thread_endnode_parent->shortAddress;
entry_temp->handshakeReady = 1;
Expand Down
2 changes: 1 addition & 1 deletion source/6LoWPAN/Thread/thread_management_if.c
Original file line number Diff line number Diff line change
Expand Up @@ -812,7 +812,7 @@ void thread_comm_status_indication_cb(int8_t if_id, const mlme_comm_status_t* st
case MLME_DATA_POLL_NOTIFICATION:
entry = mle_refresh_entry_timeout(if_id, status->SrcAddr, (addrtype_t)status->SrcAddrMode, false);
if (entry) {
thread_neighbor_commucation_update(cur, entry->attribute_index);
thread_neighbor_communication_update(cur, entry->attribute_index);
}
break;
default:
Expand Down
14 changes: 7 additions & 7 deletions source/6LoWPAN/Thread/thread_mle_message_handler.c
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ static void thread_update_mle_entry(protocol_interface_info_entry_t *cur, mle_me
mle_neigh_entry_frame_counter_update(entry_temp, mle_msg->data_ptr, mle_msg->data_length, cur, security_headers->KeyIndex);

thread_neighbor_class_update_link(&cur->thread_info->neighbor_class, entry_temp->attribute_index,linkMargin, false);
thread_neighbor_last_communincation_time_update(&cur->thread_info->neighbor_class, entry_temp->attribute_index);
thread_neighbor_last_communication_time_update(&cur->thread_info->neighbor_class, entry_temp->attribute_index);

if (!thread_attach_active_router(cur) && !thread_check_is_this_my_parent(cur, entry_temp)) {
mle_entry_timeout_refresh(entry_temp);
Expand Down Expand Up @@ -349,7 +349,7 @@ static void thread_parse_advertisement(protocol_interface_info_entry_t *cur, mle
entry_temp = mle_class_get_entry_by_ll64(cur->id, mle_msg->packet_src_address, false, NULL);
if (entry_temp) {
thread_neighbor_class_update_link(&cur->thread_info->neighbor_class, entry_temp->attribute_index, linkMargin, false);
thread_neighbor_last_communincation_time_update(&cur->thread_info->neighbor_class, entry_temp->attribute_index);
thread_neighbor_last_communication_time_update(&cur->thread_info->neighbor_class, entry_temp->attribute_index);
}

// Check if this is from my parent
Expand Down Expand Up @@ -459,7 +459,7 @@ static void thread_parse_accept(protocol_interface_info_entry_t *cur, mle_messag
return;
}
thread_neighbor_class_update_link(&cur->thread_info->neighbor_class, entry_temp->attribute_index, linkMargin, new_entry_created);
thread_neighbor_last_communincation_time_update(&cur->thread_info->neighbor_class, entry_temp->attribute_index);
thread_neighbor_last_communication_time_update(&cur->thread_info->neighbor_class, entry_temp->attribute_index);

if (security_headers->KeyIdMode == MAC_KEY_ID_MODE_SRC4_IDX) {
thread_management_key_synch_req(cur->id, common_read_32_bit(security_headers->Keysource));
Expand All @@ -471,7 +471,7 @@ static void thread_parse_accept(protocol_interface_info_entry_t *cur, mle_messag
}

entry_temp->short_adr = shortAddress;
mle_service_frame_counter_table_add(cur->id, entry_temp->attribute_index, mleFrameCounter);
mle_service_frame_counter_entry_add(cur->id, entry_temp->attribute_index, mleFrameCounter);
// Set full data as REED needs full data and SED will not make links
entry_temp->mode |= MLE_THREAD_REQ_FULL_DATA_SET;
mlme_device_descriptor_t device_desc;
Expand Down Expand Up @@ -573,7 +573,7 @@ static void thread_parse_data_response(protocol_interface_info_entry_t *cur, mle
entry_temp = mle_class_get_entry_by_ll64(cur->id, mle_msg->packet_src_address, false, NULL);
if (entry_temp) {
thread_neighbor_class_update_link(&cur->thread_info->neighbor_class, entry_temp->attribute_index, linkMargin, false);
thread_neighbor_last_communincation_time_update(&cur->thread_info->neighbor_class, entry_temp->attribute_index);
thread_neighbor_last_communication_time_update(&cur->thread_info->neighbor_class, entry_temp->attribute_index);
}

if(cur->thread_info->thread_device_mode == THREAD_DEVICE_MODE_ROUTER ||
Expand Down Expand Up @@ -734,7 +734,7 @@ static void thread_host_child_update_request_process(protocol_interface_info_ent
}

thread_neighbor_class_update_link(&cur->thread_info->neighbor_class, entry_temp->attribute_index, linkMargin, false);
thread_neighbor_last_communincation_time_update(&cur->thread_info->neighbor_class, entry_temp->attribute_index);
thread_neighbor_last_communication_time_update(&cur->thread_info->neighbor_class, entry_temp->attribute_index);

mle_tlv_read_tlv(MLE_TYPE_CHALLENGE, mle_msg->data_ptr, mle_msg->data_length, &challengeTlv);
mle_tlv_read_tlv(MLE_TYPE_TLV_REQUEST, mle_msg->data_ptr, mle_msg->data_length, &tlv_req);
Expand Down Expand Up @@ -817,7 +817,7 @@ static void thread_parse_child_update_response(protocol_interface_info_entry_t *

if (security_headers->KeyIdMode == MAC_KEY_ID_MODE_SRC4_IDX) {
thread_neighbor_class_update_link(&cur->thread_info->neighbor_class, entry_temp->attribute_index, linkMargin, false);
thread_neighbor_last_communincation_time_update(&cur->thread_info->neighbor_class, entry_temp->attribute_index);
thread_neighbor_last_communication_time_update(&cur->thread_info->neighbor_class, entry_temp->attribute_index);
thread_management_key_synch_req(cur->id, common_read_32_bit(security_headers->Keysource));
} else {
tr_debug("Key ID Mode 2 not used; dropped.");
Expand Down
2 changes: 1 addition & 1 deletion source/6LoWPAN/Thread/thread_nd.c
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ static int thread_nd_address_query_lookup(int8_t interface_id, const uint8_t tar
mle_entry = thread_nd_child_mleid_get(cur, &n->ll_address[2], mleid_ptr);
if (mle_entry) {
//Get MLEID from Child
uint32_t last_contact = thread_neighbor_last_communincation_time(&cur->thread_info->neighbor_class, mle_entry->attribute_index);
uint32_t last_contact = thread_neighbor_last_communication_time_get(&cur->thread_info->neighbor_class, mle_entry->attribute_index);
*last_transaction_time = (protocol_core_monotonic_time - last_contact) / 10; /* Both variables are count of 100ms ticks. */
*proxy = true;
return 0;
Expand Down
8 changes: 4 additions & 4 deletions source/6LoWPAN/Thread/thread_neighbor_class.c
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ uint8_t * thread_neighbor_class_get_mleid(struct thread_neighbor_class_s *class_
return entry->mlEid;
}

void thread_neighbor_last_communincation_time_update(thread_neighbor_class_t *class_ptr, uint8_t attribute_index)
void thread_neighbor_last_communication_time_update(thread_neighbor_class_t *class_ptr, uint8_t attribute_index)
{
thread_neigh_table_entry_t *entry = thread_neighbor_class_table_entry_get(class_ptr,attribute_index);
if (!entry) {
Expand All @@ -100,7 +100,7 @@ void thread_neighbor_class_update_link(thread_neighbor_class_t *class_ptr, uint8
}
}

uint16_t thread_neighbor_class_linkmargin_get(thread_neighbor_class_t *class_ptr, uint8_t attribute_index)
uint16_t thread_neighbor_entry_linkmargin_get(thread_neighbor_class_t *class_ptr, uint8_t attribute_index)
{
thread_neigh_table_entry_t *entry = thread_neighbor_class_table_entry_get(class_ptr,attribute_index);
if (!entry) {
Expand All @@ -109,7 +109,7 @@ uint16_t thread_neighbor_class_linkmargin_get(thread_neighbor_class_t *class_ptr
return entry->link_margin;
}

uint32_t thread_neighbor_last_communincation_time(thread_neighbor_class_t *class_ptr, uint8_t attribute_index)
uint32_t thread_neighbor_last_communication_time_get(thread_neighbor_class_t *class_ptr, uint8_t attribute_index)
{
thread_neigh_table_entry_t *entry = thread_neighbor_class_table_entry_get(class_ptr,attribute_index);
if (!entry) {
Expand All @@ -127,7 +127,7 @@ bool thread_neighbor_class_mleid_compare(thread_neighbor_class_t *class_ptr, uin
return true;
}

void thread_neighbor_class_table_remove(thread_neighbor_class_t *class_ptr, uint8_t attribute_index)
void thread_neighbor_class_entry_remove(thread_neighbor_class_t *class_ptr, uint8_t attribute_index)
{
thread_neigh_table_entry_t *entry = thread_neighbor_class_table_entry_get(class_ptr,attribute_index);
if (entry) {
Expand Down
8 changes: 4 additions & 4 deletions source/6LoWPAN/Thread/thread_neighbor_class.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,14 @@ uint8_t * thread_neighbor_class_get_mleid(struct thread_neighbor_class_s *class_

void thread_neighbor_class_update_link(struct thread_neighbor_class_s *class_ptr, uint8_t attribute_index, uint8_t linkmargin, bool new_link);

void thread_neighbor_last_communincation_time_update(thread_neighbor_class_t *class_ptr, uint8_t attribute_index);
void thread_neighbor_last_communication_time_update(thread_neighbor_class_t *class_ptr, uint8_t attribute_index);

uint16_t thread_neighbor_class_linkmargin_get(struct thread_neighbor_class_s *class_ptr, uint8_t attribute_index);
uint16_t thread_neighbor_entry_linkmargin_get(struct thread_neighbor_class_s *class_ptr, uint8_t attribute_index);

uint32_t thread_neighbor_last_communincation_time(struct thread_neighbor_class_s *class_ptr, uint8_t attribute_index);
uint32_t thread_neighbor_last_communication_time_get(struct thread_neighbor_class_s *class_ptr, uint8_t attribute_index);

bool thread_neighbor_class_mleid_compare(struct thread_neighbor_class_s *class_ptr, uint8_t attribute_index, const uint8_t *mleid);

void thread_neighbor_class_table_remove(struct thread_neighbor_class_s *class_ptr, uint8_t attribute_index);
void thread_neighbor_class_entry_remove(struct thread_neighbor_class_s *class_ptr, uint8_t attribute_index);

#endif /* THREAD_NEIGHBOR_CLASS_H_ */
6 changes: 3 additions & 3 deletions source/6LoWPAN/Thread/thread_network_synch.c
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ void thread_dynamic_storage_child_info_store(int8_t interface_id, mle_neigh_tabl
return;
}

uint32_t mle_frame_counter = mle_service_frame_counter_get(interface_id, child->attribute_index);
uint32_t mle_frame_counter = mle_service_neighbor_frame_counter_get(interface_id, child->attribute_index);

thread_sync_child_info_t *child_info = thread_dynamic_storage_child_info_find(interface_id, child);
if (child_info) {
Expand Down Expand Up @@ -269,7 +269,7 @@ void thread_dynamic_storage_build_mle_table(int8_t interface_id)
if (entry) {

entry->short_adr = storeEntry->networ_dynamic_data_parameters.children[i].short_addr;
mle_service_frame_counter_table_add(interface_id, entry->attribute_index, storeEntry->networ_dynamic_data_parameters.children[i].mle_frame_counter);
mle_service_frame_counter_entry_add(interface_id, entry->attribute_index, storeEntry->networ_dynamic_data_parameters.children[i].mle_frame_counter);
entry->mode = storeEntry->networ_dynamic_data_parameters.children[i].mode;

protocol_interface_info_entry_t *cur = protocol_stack_interface_info_get_by_id(interface_id);
Expand All @@ -278,7 +278,7 @@ void thread_dynamic_storage_build_mle_table(int8_t interface_id)
// Set MAC layer frame counter for the child
mlme_device_descriptor_t device_desc;
thread_neighbor_class_update_link(&cur->thread_info->neighbor_class, entry->attribute_index,64, new_entry_created);
thread_neighbor_last_communincation_time_update(&cur->thread_info->neighbor_class, entry->attribute_index);
thread_neighbor_last_communication_time_update(&cur->thread_info->neighbor_class, entry->attribute_index);
mac_helper_device_description_write(cur, &device_desc, entry->mac64, entry->short_adr,storeEntry->networ_dynamic_data_parameters.children[i].mac_frame_counter, false);
mac_helper_devicetable_set(&device_desc, cur, entry->attribute_index, cur->mac_parameters->mac_default_key_index, new_entry_created);
}
Expand Down
Loading

0 comments on commit fde5104

Please sign in to comment.