Skip to content

Commit f539287

Browse files
author
Juha Heiskanen
committed
Added support for write/READ EA-IE header IE Element's
Change-Id: I59f67a53d6575e08cbaf97ea0041487ecd91750b
1 parent ce72b55 commit f539287

File tree

5 files changed

+34
-0
lines changed

5 files changed

+34
-0
lines changed

source/6LoWPAN/ws/ws_common_defines.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
#define WH_IE_RSL_TYPE 4 /**< Received Signal Level information */
2828
#define WH_IE_MHDS_TYPE 5 /**< MHDS information for mesh routing */
2929
#define WH_IE_VH_TYPE 6 /**< Vendor header information */
30+
#define WH_IE_EA_TYPE 9 /**< Eapol Auhtenticator EUI-64 header information */
3031

3132
#define WS_WP_NESTED_IE 4 /**< WS nested Payload IE element'selement could include mltiple sub payload IE */
3233

source/6LoWPAN/ws/ws_ie_lib.c

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,14 @@ uint8_t *ws_wh_rsl_write(uint8_t *ptr, int8_t rssi)
118118
return ptr;
119119
}
120120

121+
uint8_t *ws_wh_ea_write(uint8_t *ptr, uint8_t *eui64)
122+
{
123+
ptr = ws_wh_header_base_write(ptr, 8, WH_IE_EA_TYPE);
124+
memcpy(ptr, eui64, 8);
125+
ptr += 8;
126+
return ptr;
127+
}
128+
121129
uint8_t *ws_wh_vh_write(uint8_t *ptr, uint8_t *vendor_header, uint8_t vendor_header_length)
122130
{
123131
ptr = ws_wh_header_base_write(ptr, vendor_header_length, WH_IE_VH_TYPE);
@@ -300,6 +308,18 @@ bool ws_wh_rsl_read(uint8_t *data, uint16_t length, int8_t *rsl)
300308
return true;
301309
}
302310

311+
bool ws_wh_ea_read(uint8_t *data, uint16_t length, uint8_t *eui64)
312+
{
313+
mac_header_IE_t rsl_ie_data;
314+
rsl_ie_data.id = MAC_HEADER_ASSIGNED_EXTERNAL_ORG_IE_ID;
315+
if (8 != mac_ie_header_sub_id_discover(data, length, &rsl_ie_data, WH_IE_EA_TYPE)) {
316+
return false;
317+
}
318+
memcpy(eui64, rsl_ie_data.content_ptr, 8);
319+
320+
return true;
321+
}
322+
303323
static uint8_t *ws_channel_plan_zero_read(uint8_t *ptr, ws_channel_plan_zero_t *plan)
304324
{
305325
plan->regulator_domain = *ptr++;

source/6LoWPAN/ws/ws_ie_lib.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,12 @@ uint8_t *ws_wh_bt_write(uint8_t *ptr);
3838
uint8_t *ws_wh_fc_write(uint8_t *ptr, uint8_t flow_ctrl);
3939
uint8_t *ws_wh_rsl_write(uint8_t *ptr, int8_t rssi);
4040
uint8_t *ws_wh_vh_write(uint8_t *ptr, uint8_t *vendor_header, uint8_t vendor_header_length);
41+
uint8_t *ws_wh_ea_write(uint8_t *ptr, uint8_t *eui64);
4142

4243
bool ws_wh_utt_read(uint8_t *data, uint16_t length, struct ws_utt_ie *utt_ie);
4344
bool ws_wh_bt_read(uint8_t *data, uint16_t length, struct ws_bt_ie *bt_ie);
4445
bool ws_wh_rsl_read(uint8_t *data, uint16_t length, int8_t *rsl);
46+
bool ws_wh_ea_read(uint8_t *data, uint16_t length, uint8_t *eui64);
4547

4648
/* WS_WP_NESTED PAYLOD IE */
4749
uint8_t *ws_wp_base_write(uint8_t *ptr, uint16_t length);

source/6LoWPAN/ws/ws_llc.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ typedef struct wh_ie_sub_list_s {
4141
bool fc_ie: 1; /**< Flow Control for Extended Direct Frame Exchange */
4242
bool rsl_ie: 1; /**< Received Signal Level information */
4343
bool vh_ie: 1; /**< Vendor header information */
44+
bool ea_ie: 1; /**< EAPOL autheticator EUI-64 header information */
4445
} wh_ie_sub_list_t;
4546

4647
/**

test/nanostack/unittest/stub/ws_ie_lib_stub.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,16 @@ bool ws_wh_utt_read(uint8_t *data, uint16_t length, struct ws_utt_ie *utt_ie)
164164
return ws_ie_lib_stub.utt_bool_value;
165165
}
166166

167+
bool ws_wh_ea_read(uint8_t *data, uint16_t length, uint8_t *eui64)
168+
{
169+
return ws_ie_lib_stub.utt_bool_value;
170+
}
171+
172+
uint8_t *ws_wh_ea_write(uint8_t *ptr, uint8_t *eui64)
173+
{
174+
return ptr + 11;
175+
}
176+
167177
bool ws_wh_bt_read(uint8_t *data, uint16_t length, struct ws_bt_ie *bt_ie)
168178
{
169179
*bt_ie = ws_ie_lib_stub.bt_ie;

0 commit comments

Comments
 (0)