Skip to content

Commit

Permalink
Thread Neighbor class update
Browse files Browse the repository at this point in the history
Added support to config and read Thread full data set and secured data request.

Change-Id: I3d07c7fcb3c1740848ba8f140f4ce5dbdbbd564b
  • Loading branch information
Juha Heiskanen authored and juhhei01 committed Jun 25, 2018
1 parent 26dd252 commit 7bb978e
Show file tree
Hide file tree
Showing 3 changed files with 108 additions and 1 deletion.
61 changes: 61 additions & 0 deletions source/6LoWPAN/Thread/thread_neighbor_class.c
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,67 @@ bool thread_neighbor_class_mleid_compare(thread_neighbor_class_t *class_ptr, uin
return true;
}

bool thread_neighbor_class_request_full_data_setup(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) {
return false;
}
return entry->request_full_data_set;

}

bool thread_neighbor_class_request_secured_data_request(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) {
return false;
}
return entry->secured_data_request;
}

void thread_neighbor_class_request_full_data_setup_set(thread_neighbor_class_t *class_ptr, uint8_t attribute_index, bool value)
{
thread_neigh_table_entry_t *entry = thread_neighbor_class_table_entry_get(class_ptr,attribute_index);
if (entry) {
entry->request_full_data_set = value;
}
}

void thread_neighbor_class_request_secured_data_request_set(thread_neighbor_class_t *class_ptr, uint8_t attribute_index, bool value)
{
thread_neigh_table_entry_t *entry = thread_neighbor_class_table_entry_get(class_ptr,attribute_index);
if (entry) {
entry->secured_data_request = value;
}
}

void thread_neighbor_class_mode_parse_to_entry(thread_neighbor_class_t *class_ptr, uint8_t attribute_index, uint8_t mode)
{
thread_neigh_table_entry_t *entry = thread_neighbor_class_table_entry_get(class_ptr,attribute_index);
if (entry) {
entry->request_full_data_set = mode & MLE_THREAD_REQ_FULL_DATA_SET;
entry->secured_data_request = mode & MLE_THREAD_SECURED_DATA_REQUEST;
}
}

uint8_t thread_neighbor_class_mode_write_from_entry(thread_neighbor_class_t *class_ptr, uint8_t attribute_index)
{
uint8_t mode = 0;
thread_neigh_table_entry_t *entry = thread_neighbor_class_table_entry_get(class_ptr,attribute_index);
if (entry) {
if (entry->request_full_data_set) {
mode |= MLE_THREAD_REQ_FULL_DATA_SET;
}

if (entry->secured_data_request) {
mode |= MLE_THREAD_SECURED_DATA_REQUEST;
}
}
return mode;
}


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);
Expand Down
18 changes: 17 additions & 1 deletion source/6LoWPAN/Thread/thread_neighbor_class.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@

struct thread_neighbor_class_s;

/** Thead Spesific ModeFlags */
#define MLE_THREAD_SECURED_DATA_REQUEST 0x04
#define MLE_THREAD_REQ_FULL_DATA_SET 0x01

bool thread_neighbor_class_create(struct thread_neighbor_class_s *class_ptr, uint8_t neigh_table_size);

void thread_neighbor_class_delete(struct thread_neighbor_class_s *class_ptr);
Expand All @@ -32,14 +36,26 @@ 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_communication_time_update(thread_neighbor_class_t *class_ptr, uint8_t attribute_index);
void thread_neighbor_last_communication_time_update(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_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);

bool thread_neighbor_class_request_full_data_setup(struct thread_neighbor_class_s *class_ptr, uint8_t attribute_index);

bool thread_neighbor_class_request_secured_data_request(struct thread_neighbor_class_s *class_ptr, uint8_t attribute_index);

void thread_neighbor_class_mode_parse_to_entry(struct thread_neighbor_class_s *class_ptr, uint8_t attribute_index, uint8_t mode);

uint8_t thread_neighbor_class_mode_write_from_entry(struct thread_neighbor_class_s *class_ptr, uint8_t attribute_index);

void thread_neighbor_class_request_full_data_setup_set(struct thread_neighbor_class_s *class_ptr, uint8_t attribute_index, bool value);

void thread_neighbor_class_request_secured_data_request_set(struct thread_neighbor_class_s *class_ptr, uint8_t attribute_index, bool value);

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

#endif /* THREAD_NEIGHBOR_CLASS_H_ */
30 changes: 30 additions & 0 deletions test/nanostack/unittest/stub/thread_neighbor_class_stub.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,3 +78,33 @@ void thread_neighbor_last_communication_time_update(thread_neighbor_class_t *cla
{

}

bool thread_neighbor_class_request_full_data_setup(struct thread_neighbor_class_s *class_ptr, uint8_t attribute_index)
{
return true;
}

bool thread_neighbor_class_request_secured_data_request(struct thread_neighbor_class_s *class_ptr, uint8_t attribute_index)
{
return false;
}

void thread_neighbor_class_mode_parse_to_entry(struct thread_neighbor_class_s *class_ptr, uint8_t attribute_index, uint8_t mode)
{

}

uint8_t thread_neighbor_class_mode_write_from_entry(struct thread_neighbor_class_s *class_ptr, uint8_t attribute_index)
{
return 1;
}

void thread_neighbor_class_request_full_data_setup_set(struct thread_neighbor_class_s *class_ptr, uint8_t attribute_index, bool value)
{

}

void thread_neighbor_class_request_secured_data_request_set(struct thread_neighbor_class_s *class_ptr, uint8_t attribute_index, bool value)
{

}

0 comments on commit 7bb978e

Please sign in to comment.