mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2025-02-02 06:44:13 +01:00
eap: Add eap event_func
This is used to get arbitrary information out of the EAP method. Needed for EAP-WSC to signal credential information obtained from the peer. Other uses include signaling why EAP-WSC failed (e.g. invalid PIN, etc) and processing of M2D discovery messages. The information in M2Ds might be useful to external clients.
This commit is contained in:
parent
fb446dcb9f
commit
1b72fe9713
14
src/eap.c
14
src/eap.c
@ -37,6 +37,7 @@ struct eap_state {
|
||||
eap_tx_packet_func_t tx_packet;
|
||||
eap_key_material_func_t set_key_material;
|
||||
eap_complete_func_t complete;
|
||||
eap_event_func_t event_func;
|
||||
void *user_data;
|
||||
size_t mtu;
|
||||
|
||||
@ -77,6 +78,11 @@ void eap_set_key_material_func(struct eap_state *eap,
|
||||
eap->set_key_material = func;
|
||||
}
|
||||
|
||||
void eap_set_event_func(struct eap_state *eap, eap_event_func_t func)
|
||||
{
|
||||
eap->event_func = func;
|
||||
}
|
||||
|
||||
void eap_free(struct eap_state *eap)
|
||||
{
|
||||
if (eap->method_state)
|
||||
@ -410,6 +416,14 @@ void eap_set_key_material(struct eap_state *eap,
|
||||
iv, iv_len, eap->user_data);
|
||||
}
|
||||
|
||||
void eap_method_event(struct eap_state *eap, unsigned int id, const void *data)
|
||||
{
|
||||
if (!eap->event_func)
|
||||
return;
|
||||
|
||||
eap->event_func(id, data, eap->user_data);
|
||||
}
|
||||
|
||||
void eap_method_success(struct eap_state *eap)
|
||||
{
|
||||
eap->method_success = true;
|
||||
|
@ -40,6 +40,8 @@ typedef void (*eap_key_material_func_t)(const uint8_t *msk_data, size_t msk_len,
|
||||
const uint8_t *iv, size_t iv_len,
|
||||
void *user_data);
|
||||
typedef void (*eap_complete_func_t)(enum eap_result result, void *user_data);
|
||||
typedef void (*eap_event_func_t)(unsigned int event, const void *event_data,
|
||||
void *user_data);
|
||||
|
||||
struct eap_state *eap_new(eap_tx_packet_func_t tx_packet,
|
||||
eap_complete_func_t complete, void *user_data);
|
||||
@ -50,6 +52,7 @@ bool eap_load_settings(struct eap_state *eap, struct l_settings *settings,
|
||||
|
||||
void eap_set_key_material_func(struct eap_state *eap,
|
||||
eap_key_material_func_t func);
|
||||
void eap_set_event_func(struct eap_state *eap, eap_event_func_t func);
|
||||
|
||||
void eap_set_mtu(struct eap_state *eap, size_t mtu);
|
||||
size_t eap_get_mtu(struct eap_state *eap);
|
||||
@ -128,6 +131,8 @@ void eap_start_complete_timeout(struct eap_state *eap);
|
||||
|
||||
void eap_method_success(struct eap_state *eap);
|
||||
void eap_method_error(struct eap_state *eap);
|
||||
void eap_method_event(struct eap_state *eap, unsigned int type,
|
||||
const void *data);
|
||||
|
||||
void eap_save_last_id(struct eap_state *eap, uint8_t *last_id);
|
||||
void eap_restore_last_id(struct eap_state *eap, uint8_t last_id);
|
||||
|
Loading…
Reference in New Issue
Block a user