hostapd: add support for authenticating with multiple PSKs via ubus helper
[openwrt/staging/nbd.git] / package / network / services / hostapd / files / hostapd.uc
index dfddf8185ba8ef5ff72f43210aa4f1cfd32e7949..c522b2270c0f1815e940c31cf65a8fd4593b8a37 100644 (file)
@@ -871,6 +871,10 @@ let main_obj = {
 
 hostapd.data.ubus = ubus;
 hostapd.data.obj = ubus.publish("hostapd", main_obj);
+
+
+let auth_obj = {};
+hostapd.data.auth_obj = ubus.publish("hostapd-auth", auth_obj);
 hostapd.udebug_set("hostapd", hostapd.data.ubus);
 
 function bss_event(type, name, data) {
@@ -889,6 +893,12 @@ return {
                hostapd.udebug_set(null);
                hostapd.ubus.disconnect();
        },
+       afc_request: function(iface, data) {
+               let ret = ubus.call("afc", "request", { data });
+               if (type(ret) != "object")
+                       return;
+               return ret.data;
+       },
        bss_add: function(name, obj) {
                bss_event("add", name);
        },
@@ -897,5 +907,23 @@ return {
        },
        bss_remove: function(name, obj) {
                bss_event("remove", name);
-       }
+       },
+       sta_auth: function(iface, sta) {
+               let msg = { iface, sta };
+               let ret = {};
+               let data_cb = (type, data) => {
+                       ret = { ...ret, ...data };
+               };
+               hostapd.data.auth_obj.notify("sta_auth", msg, data_cb, null, null, 1000);
+               return ret;
+       },
+       sta_connected: function(iface, sta, data) {
+               let msg = { iface, sta, ...data };
+               let ret = {};
+               let data_cb = (type, data) => {
+                       ret = { ...ret, ...data };
+               };
+               hostapd.data.auth_obj.notify("sta_connected", msg, data_cb, null, null, 1000);
+               return ret;
+       },
 };