};
+static void hostapd_ctrl_iface_send(struct hostapd_data *hapd, int level,
+ const char *buf, size_t len);
+
+
static int hostapd_ctrl_iface_attach(struct hostapd_data *hapd,
struct sockaddr_un *from,
socklen_t fromlen)
}
+static void hostapd_ctrl_iface_msg_cb(void *ctx, int level,
+ const char *txt, size_t len)
+{
+ struct hostapd_data *hapd = ctx;
+ if (hapd == NULL)
+ return;
+ hostapd_ctrl_iface_send(hapd, level, txt, len);
+}
+
+
int hostapd_ctrl_iface_init(struct hostapd_data *hapd)
{
struct sockaddr_un addr;
hapd->ctrl_sock = s;
eloop_register_read_sock(s, hostapd_ctrl_iface_receive, hapd,
NULL);
+ wpa_msg_register_cb(hostapd_ctrl_iface_msg_cb);
return 0;
}
-void hostapd_ctrl_iface_send(struct hostapd_data *hapd, int level,
- char *buf, size_t len)
+static void hostapd_ctrl_iface_send(struct hostapd_data *hapd, int level,
+ const char *buf, size_t len)
{
struct wpa_ctrl_dst *dst, *next;
struct msghdr msg;
os_snprintf(levelstr, sizeof(levelstr), "<%d>", level);
io[0].iov_base = levelstr;
io[0].iov_len = os_strlen(levelstr);
- io[1].iov_base = buf;
+ io[1].iov_base = (char *) buf;
io[1].iov_len = len;
os_memset(&msg, 0, sizeof(msg));
msg.msg_iov = io;
#ifndef CONFIG_NO_CTRL_IFACE
int hostapd_ctrl_iface_init(struct hostapd_data *hapd);
void hostapd_ctrl_iface_deinit(struct hostapd_data *hapd);
-void hostapd_ctrl_iface_send(struct hostapd_data *hapd, int level,
- char *buf, size_t len);
#else /* CONFIG_NO_CTRL_IFACE */
static inline int hostapd_ctrl_iface_init(struct hostapd_data *hapd)
{
static inline void hostapd_ctrl_iface_deinit(struct hostapd_data *hapd)
{
}
-
-static inline void hostapd_ctrl_iface_send(struct hostapd_data *hapd,
- int level, char *buf, size_t len)
-{
-}
#endif /* CONFIG_NO_CTRL_IFACE */
#endif /* CTRL_IFACE_H */
#include "eloop.h"
#include "uuid.h"
#include "wpa_ctrl.h"
-#include "ctrl_iface.h"
#include "ieee802_11_defs.h"
#include "wps/wps.h"
#include "wps/wps_defs.h"
dev->model_number, dev->serial_number,
dev->categ, dev->oui, dev->sub_categ);
if (len > 0 && len < (int) sizeof(txt))
- hostapd_ctrl_iface_send(hapd, MSG_INFO, txt, len);
+ wpa_msg(hapd, MSG_INFO, "%s", txt);
if (hapd->conf->wps_pin_requests) {
FILE *f;
wpa_printf(MSG_DEBUG, "WPS: MAC Address " MACSTR,
MAC2STR(cred->mac_addr));
- hostapd_ctrl_iface_send(hapd, MSG_INFO, WPS_EVENT_NEW_AP_SETTINGS,
- os_strlen(WPS_EVENT_NEW_AP_SETTINGS));
+ wpa_msg(hapd, MSG_INFO, WPS_EVENT_NEW_AP_SETTINGS);
len = os_strlen(hapd->iface->config_fname) + 5;
tmp_fname = os_malloc(len);