#include <sys/stat.h>
#include <stddef.h>
-#include "hostapd.h"
+#include "common.h"
#include "eloop.h"
-#include "config.h"
-#include "ieee802_1x.h"
-#include "wpa.h"
+#include "drivers/driver.h"
#include "radius/radius_client.h"
-#include "ieee802_11.h"
+#include "ap/hostapd.h"
+#include "ap/config.h"
+#include "ap/ieee802_1x.h"
+#include "ap/wpa.h"
+#include "ap/ieee802_11.h"
+#include "ap/sta_info.h"
+#include "ap/accounting.h"
+#include "ap/wps_hostapd.h"
+#include "ap/ctrl_iface_ap.h"
#include "ctrl_iface.h"
-#include "sta_info.h"
-#include "accounting.h"
-#include "wps_hostapd.h"
-#include "drivers/driver.h"
struct wpa_ctrl_dst {
}
-static int hostapd_ctrl_iface_sta_mib(struct hostapd_data *hapd,
- struct sta_info *sta,
- char *buf, size_t buflen)
-{
- int len, res, ret;
-
- if (sta == NULL) {
- ret = os_snprintf(buf, buflen, "FAIL\n");
- if (ret < 0 || (size_t) ret >= buflen)
- return 0;
- return ret;
- }
-
- len = 0;
- ret = os_snprintf(buf + len, buflen - len, MACSTR "\n",
- MAC2STR(sta->addr));
- if (ret < 0 || (size_t) ret >= buflen - len)
- return len;
- len += ret;
-
- res = ieee802_11_get_mib_sta(hapd, sta, buf + len, buflen - len);
- if (res >= 0)
- len += res;
- res = wpa_get_mib_sta(sta->wpa_sm, buf + len, buflen - len);
- if (res >= 0)
- len += res;
- res = ieee802_1x_get_mib_sta(hapd, sta, buf + len, buflen - len);
- if (res >= 0)
- len += res;
-
- return len;
-}
-
-
-static int hostapd_ctrl_iface_sta_first(struct hostapd_data *hapd,
- char *buf, size_t buflen)
-{
- return hostapd_ctrl_iface_sta_mib(hapd, hapd->sta_list, buf, buflen);
-}
-
-
-static int hostapd_ctrl_iface_sta(struct hostapd_data *hapd,
- const char *txtaddr,
- char *buf, size_t buflen)
-{
- u8 addr[ETH_ALEN];
- int ret;
-
- if (hwaddr_aton(txtaddr, addr)) {
- ret = os_snprintf(buf, buflen, "FAIL\n");
- if (ret < 0 || (size_t) ret >= buflen)
- return 0;
- return ret;
- }
- return hostapd_ctrl_iface_sta_mib(hapd, ap_get_sta(hapd, addr),
- buf, buflen);
-}
-
-
-static int hostapd_ctrl_iface_sta_next(struct hostapd_data *hapd,
- const char *txtaddr,
- char *buf, size_t buflen)
-{
- u8 addr[ETH_ALEN];
- struct sta_info *sta;
- int ret;
-
- if (hwaddr_aton(txtaddr, addr) ||
- (sta = ap_get_sta(hapd, addr)) == NULL) {
- ret = os_snprintf(buf, buflen, "FAIL\n");
- if (ret < 0 || (size_t) ret >= buflen)
- return 0;
- return ret;
- }
- return hostapd_ctrl_iface_sta_mib(hapd, sta->next, buf, buflen);
-}
-
-
static int hostapd_ctrl_iface_new_sta(struct hostapd_data *hapd,
const char *txtaddr)
{
#ifdef CONFIG_IEEE80211W
-#ifdef NEED_MLME
+#ifdef NEED_AP_MLME
static int hostapd_ctrl_iface_sa_query(struct hostapd_data *hapd,
const char *txtaddr)
{
return 0;
}
-#endif /* NEED_MLME */
+#endif /* NEED_AP_MLME */
#endif /* CONFIG_IEEE80211W */
else
reply_len += res;
}
+#ifndef CONFIG_NO_RADIUS
if (reply_len >= 0) {
res = radius_client_get_mib(hapd->radius,
reply + reply_len,
else
reply_len += res;
}
+#endif /* CONFIG_NO_RADIUS */
} else if (os_strcmp(buf, "STA-FIRST") == 0) {
reply_len = hostapd_ctrl_iface_sta_first(hapd, reply,
reply_size);
if (hostapd_ctrl_iface_new_sta(hapd, buf + 8))
reply_len = -1;
#ifdef CONFIG_IEEE80211W
-#ifdef NEED_MLME
+#ifdef NEED_AP_MLME
} else if (os_strncmp(buf, "SA_QUERY ", 9) == 0) {
if (hostapd_ctrl_iface_sa_query(hapd, buf + 9))
reply_len = -1;
-#endif /* NEED_MLME */
+#endif /* NEED_AP_MLME */
#endif /* CONFIG_IEEE80211W */
#ifdef CONFIG_WPS
} else if (os_strncmp(buf, "WPS_PIN ", 8) == 0) {
hapd->ctrl_sock = s;
eloop_register_read_sock(s, hostapd_ctrl_iface_receive, hapd,
NULL);
+ hapd->msg_ctx = hapd;
wpa_msg_register_cb(hostapd_ctrl_iface_msg_cb);
return 0;