Skip to content

Commit 2b8c846

Browse files
author
Mika Leppänen
committed
PAE BR address write/read interface
1 parent 9777ad1 commit 2b8c846

File tree

2 files changed

+62
-0
lines changed

2 files changed

+62
-0
lines changed

source/6LoWPAN/ws/ws_pae_controller.c

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ typedef void ws_pae_timer(uint16_t ticks);
4141
typedef struct {
4242
ns_list_link_t link; /**< Link */
4343
uint8_t target_eui_64[8]; /**< EAPOL target */
44+
uint8_t br_eui_64[8]; /**< Border router EUI-64 */
4445
sec_prot_gtk_keys_t gtks; /**< GTKs */
4546
sec_prot_certs_t certs; /**< Certificates */
4647
protocol_interface_info_entry_t *interface_ptr; /**< List link entry */
@@ -176,6 +177,7 @@ int8_t ws_pae_controller_init(protocol_interface_info_entry_t *interface_ptr)
176177
}
177178

178179
memset(controller->target_eui_64, 0, 8);
180+
memset(controller->br_eui_64, 0, 8);
179181
controller->interface_ptr = interface_ptr;
180182
controller->auth_completed = NULL;
181183
controller->key_insert = NULL;
@@ -253,6 +255,39 @@ int8_t ws_pae_controller_certificate_chain_set(const arm_certificate_chain_entry
253255
return 0;
254256
}
255257

258+
int8_t ws_pae_controller_border_router_addr_write(protocol_interface_info_entry_t *interface_ptr, uint8_t *eui_64)
259+
{
260+
if (!interface_ptr || !eui_64) {
261+
return -1;
262+
}
263+
264+
pae_controller_t *controller = ws_pae_controller_get(interface_ptr);
265+
if (!controller) {
266+
return -1;
267+
}
268+
269+
memcpy(controller->br_eui_64, eui_64, 8);
270+
271+
return 0;
272+
273+
}
274+
275+
int8_t ws_pae_controller_border_router_addr_read(protocol_interface_info_entry_t *interface_ptr, uint8_t *eui_64)
276+
{
277+
if (!interface_ptr || !eui_64) {
278+
return -1;
279+
}
280+
281+
pae_controller_t *controller = ws_pae_controller_get(interface_ptr);
282+
if (!controller) {
283+
return -1;
284+
}
285+
286+
memcpy(eui_64, controller->br_eui_64, 8);
287+
288+
return 0;
289+
}
290+
256291
void ws_pae_controller_timer(uint16_t ticks)
257292
{
258293
ns_list_foreach(pae_controller_t, entry, &pae_controller_list) {

source/6LoWPAN/ws/ws_pae_controller.h

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,30 @@ int8_t ws_pae_controller_delete(protocol_interface_info_entry_t *interface_ptr);
101101
*/
102102
int8_t ws_pae_controller_certificate_chain_set(const arm_certificate_chain_entry_s *chain);
103103

104+
/**
105+
* ws_pae_controller_border_router_addr_write write border router address
106+
*
107+
* \param interface_ptr interface
108+
* \param eui_64 pointer to EUI-64
109+
*
110+
* \return < 0 failure
111+
* \return >= 0 success
112+
*
113+
*/
114+
int8_t ws_pae_controller_border_router_addr_write(protocol_interface_info_entry_t *interface_ptr, uint8_t *eui_64);
115+
116+
/**
117+
* ws_pae_controller_bored_router_addr_read read border router address
118+
*
119+
* \param interface_ptr interface
120+
* \param eui_64 pointer to EUI-64
121+
*
122+
* \return < 0 failure
123+
* \return >= 0 success
124+
*
125+
*/
126+
int8_t ws_pae_controller_bored_router_addr_read(protocol_interface_info_entry_t *interface_ptr, uint8_t *eui_64);
127+
104128
/**
105129
* ws_pae_controller_key_insert new GTK key available callback
106130
*
@@ -148,6 +172,9 @@ void ws_pae_controller_timer(uint16_t ticks);
148172

149173
#define ws_pae_controller_authenticator_start(interface_ptr, local_port, remote_address, remote_port)
150174

175+
#define ws_pae_controller_border_router_addr_write(interface_ptr, eui_64) -1
176+
#define ws_pae_controller_border_router_addr_read(interface_ptr, eui_64) -1
177+
151178
#define ws_pae_controller_init(interface_ptr) 1
152179
#define ws_pae_controller_stop(interface_ptr)
153180
#define ws_pae_controller_delete(interface_ptr)

0 commit comments

Comments
 (0)