Skip to content

Commit 7bb978e

Browse files
Juha Heiskanenjuhhei01
authored andcommitted
Thread Neighbor class update
Added support to config and read Thread full data set and secured data request. Change-Id: I3d07c7fcb3c1740848ba8f140f4ce5dbdbbd564b
1 parent 26dd252 commit 7bb978e

File tree

3 files changed

+108
-1
lines changed

3 files changed

+108
-1
lines changed

source/6LoWPAN/Thread/thread_neighbor_class.c

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,67 @@ bool thread_neighbor_class_mleid_compare(thread_neighbor_class_t *class_ptr, uin
127127
return true;
128128
}
129129

130+
bool thread_neighbor_class_request_full_data_setup(thread_neighbor_class_t *class_ptr, uint8_t attribute_index)
131+
{
132+
thread_neigh_table_entry_t *entry = thread_neighbor_class_table_entry_get(class_ptr,attribute_index);
133+
if (!entry) {
134+
return false;
135+
}
136+
return entry->request_full_data_set;
137+
138+
}
139+
140+
bool thread_neighbor_class_request_secured_data_request(thread_neighbor_class_t *class_ptr, uint8_t attribute_index)
141+
{
142+
thread_neigh_table_entry_t *entry = thread_neighbor_class_table_entry_get(class_ptr,attribute_index);
143+
if (!entry) {
144+
return false;
145+
}
146+
return entry->secured_data_request;
147+
}
148+
149+
void thread_neighbor_class_request_full_data_setup_set(thread_neighbor_class_t *class_ptr, uint8_t attribute_index, bool value)
150+
{
151+
thread_neigh_table_entry_t *entry = thread_neighbor_class_table_entry_get(class_ptr,attribute_index);
152+
if (entry) {
153+
entry->request_full_data_set = value;
154+
}
155+
}
156+
157+
void thread_neighbor_class_request_secured_data_request_set(thread_neighbor_class_t *class_ptr, uint8_t attribute_index, bool value)
158+
{
159+
thread_neigh_table_entry_t *entry = thread_neighbor_class_table_entry_get(class_ptr,attribute_index);
160+
if (entry) {
161+
entry->secured_data_request = value;
162+
}
163+
}
164+
165+
void thread_neighbor_class_mode_parse_to_entry(thread_neighbor_class_t *class_ptr, uint8_t attribute_index, uint8_t mode)
166+
{
167+
thread_neigh_table_entry_t *entry = thread_neighbor_class_table_entry_get(class_ptr,attribute_index);
168+
if (entry) {
169+
entry->request_full_data_set = mode & MLE_THREAD_REQ_FULL_DATA_SET;
170+
entry->secured_data_request = mode & MLE_THREAD_SECURED_DATA_REQUEST;
171+
}
172+
}
173+
174+
uint8_t thread_neighbor_class_mode_write_from_entry(thread_neighbor_class_t *class_ptr, uint8_t attribute_index)
175+
{
176+
uint8_t mode = 0;
177+
thread_neigh_table_entry_t *entry = thread_neighbor_class_table_entry_get(class_ptr,attribute_index);
178+
if (entry) {
179+
if (entry->request_full_data_set) {
180+
mode |= MLE_THREAD_REQ_FULL_DATA_SET;
181+
}
182+
183+
if (entry->secured_data_request) {
184+
mode |= MLE_THREAD_SECURED_DATA_REQUEST;
185+
}
186+
}
187+
return mode;
188+
}
189+
190+
130191
void thread_neighbor_class_entry_remove(thread_neighbor_class_t *class_ptr, uint8_t attribute_index)
131192
{
132193
thread_neigh_table_entry_t *entry = thread_neighbor_class_table_entry_get(class_ptr,attribute_index);

source/6LoWPAN/Thread/thread_neighbor_class.h

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@
2020

2121
struct thread_neighbor_class_s;
2222

23+
/** Thead Spesific ModeFlags */
24+
#define MLE_THREAD_SECURED_DATA_REQUEST 0x04
25+
#define MLE_THREAD_REQ_FULL_DATA_SET 0x01
26+
2327
bool thread_neighbor_class_create(struct thread_neighbor_class_s *class_ptr, uint8_t neigh_table_size);
2428

2529
void thread_neighbor_class_delete(struct thread_neighbor_class_s *class_ptr);
@@ -32,14 +36,26 @@ uint8_t * thread_neighbor_class_get_mleid(struct thread_neighbor_class_s *class_
3236

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

35-
void thread_neighbor_last_communication_time_update(thread_neighbor_class_t *class_ptr, uint8_t attribute_index);
39+
void thread_neighbor_last_communication_time_update(struct thread_neighbor_class_s *class_ptr, uint8_t attribute_index);
3640

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

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

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

47+
bool thread_neighbor_class_request_full_data_setup(struct thread_neighbor_class_s *class_ptr, uint8_t attribute_index);
48+
49+
bool thread_neighbor_class_request_secured_data_request(struct thread_neighbor_class_s *class_ptr, uint8_t attribute_index);
50+
51+
void thread_neighbor_class_mode_parse_to_entry(struct thread_neighbor_class_s *class_ptr, uint8_t attribute_index, uint8_t mode);
52+
53+
uint8_t thread_neighbor_class_mode_write_from_entry(struct thread_neighbor_class_s *class_ptr, uint8_t attribute_index);
54+
55+
void thread_neighbor_class_request_full_data_setup_set(struct thread_neighbor_class_s *class_ptr, uint8_t attribute_index, bool value);
56+
57+
void thread_neighbor_class_request_secured_data_request_set(struct thread_neighbor_class_s *class_ptr, uint8_t attribute_index, bool value);
58+
4359
void thread_neighbor_class_entry_remove(struct thread_neighbor_class_s *class_ptr, uint8_t attribute_index);
4460

4561
#endif /* THREAD_NEIGHBOR_CLASS_H_ */

test/nanostack/unittest/stub/thread_neighbor_class_stub.c

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,3 +78,33 @@ void thread_neighbor_last_communication_time_update(thread_neighbor_class_t *cla
7878
{
7979

8080
}
81+
82+
bool thread_neighbor_class_request_full_data_setup(struct thread_neighbor_class_s *class_ptr, uint8_t attribute_index)
83+
{
84+
return true;
85+
}
86+
87+
bool thread_neighbor_class_request_secured_data_request(struct thread_neighbor_class_s *class_ptr, uint8_t attribute_index)
88+
{
89+
return false;
90+
}
91+
92+
void thread_neighbor_class_mode_parse_to_entry(struct thread_neighbor_class_s *class_ptr, uint8_t attribute_index, uint8_t mode)
93+
{
94+
95+
}
96+
97+
uint8_t thread_neighbor_class_mode_write_from_entry(struct thread_neighbor_class_s *class_ptr, uint8_t attribute_index)
98+
{
99+
return 1;
100+
}
101+
102+
void thread_neighbor_class_request_full_data_setup_set(struct thread_neighbor_class_s *class_ptr, uint8_t attribute_index, bool value)
103+
{
104+
105+
}
106+
107+
void thread_neighbor_class_request_secured_data_request_set(struct thread_neighbor_class_s *class_ptr, uint8_t attribute_index, bool value)
108+
{
109+
110+
}

0 commit comments

Comments
 (0)