From d8a43924eca4fc92a07fc60f00024d76c6749fd8 Mon Sep 17 00:00:00 2001 From: Johannes Berg Date: Wed, 16 Mar 2011 15:58:41 +0200 Subject: [PATCH] wpa_s AP mode: Add notification functions for STA authorized Signed-off-by: Johannes Berg --- wpa_supplicant/ap.c | 10 ++++++++++ wpa_supplicant/notify.c | 22 ++++++++++++++++++++++ wpa_supplicant/notify.h | 2 ++ 3 files changed, 34 insertions(+) diff --git a/wpa_supplicant/ap.c b/wpa_supplicant/ap.c index ec2de4ce6..77e5b78a3 100644 --- a/wpa_supplicant/ap.c +++ b/wpa_supplicant/ap.c @@ -42,6 +42,7 @@ #include "p2p_supplicant.h" #include "ap.h" #include "ap/sta_info.h" +#include "notify.h" #ifdef CONFIG_WPS @@ -243,6 +244,13 @@ static void ap_wps_event_cb(void *ctx, enum wps_event event, } +static void ap_sta_authorized_cb(void *ctx, const u8 *mac_addr, + int authorized) +{ + wpas_notify_sta_authorized(ctx, mac_addr, authorized); +} + + static int ap_vendor_action_rx(void *ctx, const u8 *buf, size_t len, int freq) { #ifdef CONFIG_P2P @@ -411,6 +419,8 @@ int wpa_supplicant_create_ap(struct wpa_supplicant *wpa_s, hapd_iface->bss[i]->wps_reg_success_cb_ctx = wpa_s; hapd_iface->bss[i]->wps_event_cb = ap_wps_event_cb; hapd_iface->bss[i]->wps_event_cb_ctx = wpa_s; + hapd_iface->bss[i]->sta_authorized_cb = ap_sta_authorized_cb; + hapd_iface->bss[i]->sta_authorized_cb_ctx = wpa_s; #ifdef CONFIG_P2P hapd_iface->bss[i]->p2p = wpa_s->global->p2p; hapd_iface->bss[i]->p2p_group = wpas_p2p_group_init( diff --git a/wpa_supplicant/notify.c b/wpa_supplicant/notify.c index 9ee7dc20b..2053c3d20 100644 --- a/wpa_supplicant/notify.c +++ b/wpa_supplicant/notify.c @@ -416,3 +416,25 @@ void wpas_notify_p2p_sd_response(struct wpa_supplicant *wpa_s, } #endif /* CONFIG_P2P */ + + +static void wpas_notify_ap_sta_authorized(struct wpa_supplicant *wpa_s, + const u8 *sta) +{ +} + + +static void wpas_notify_ap_sta_deauthorized(struct wpa_supplicant *wpa_s, + const u8 *sta) +{ +} + + +void wpas_notify_sta_authorized(struct wpa_supplicant *wpa_s, + const u8 *mac_addr, int authorized) +{ + if (authorized) + wpas_notify_ap_sta_authorized(wpa_s, mac_addr); + else + wpas_notify_ap_sta_deauthorized(wpa_s, mac_addr); +} diff --git a/wpa_supplicant/notify.h b/wpa_supplicant/notify.h index 156774a62..6c8fdf7bf 100644 --- a/wpa_supplicant/notify.h +++ b/wpa_supplicant/notify.h @@ -79,6 +79,8 @@ void wpas_notify_debug_show_keys_changed(struct wpa_global *global); void wpas_notify_suspend(struct wpa_global *global); void wpas_notify_resume(struct wpa_global *global); +void wpas_notify_sta_authorized(struct wpa_supplicant *wpa_s, + const u8 *mac_addr, int authorized); void wpas_notify_p2p_device_found(struct wpa_supplicant *wpa_s, const u8 *dev_addr, int new_device); void wpas_notify_p2p_device_lost(struct wpa_supplicant *wpa_s,