int wmesh_netlink_get_mpath_info(const char* mesh_if_name, GList **mpath_list);
int wmesh_netlink_get_meshconf_info(wmesh_service *service);
-int wmesh_netlink_register_event_handler();
+int wmesh_netlink_register_event_handler(wmesh_service *service);
int wmesh_netlink_unregister_event_handler();
#endif /* __WMESH_NETLINK_H__ */
/* Mesh Conf */
int wmesh_request_get_meshconf_info(wmesh_service *service);
-int wmesh_request_register_event_handler();
+int wmesh_request_register_event_handler(wmesh_service *service);
int wmesh_request_unregister_event_handler();
/* Notifications */
void wmesh_notify_scan_done();
void wmesh_notify_connection_state(const char* mesh_id, const char* bssid,
int channel, wmeshd_security_type_e sec, wmeshd_connection_state_e state);
-void wmesh_notify_station_joined(const char* bssid);
-void wmesh_notify_station_left(const char* bssid);
+void wmesh_notify_station_joined(const char* bssid,
+ wmeshd_station_type_e station_type);
+void wmesh_notify_station_left(const char* bssid,
+ wmeshd_station_type_e station_type);
#ifdef __cplusplus
}
WMESHD_IP_CONFIG_TYPE_STATIC, /**< Static */
} wmeshd_ip_config_type_e;
+/**< Internal enum for station type. It should be matched with API side */
+typedef enum {
+ WMESHD_STATION_TYPE_MESH_POINT = 0, /**< Mesh Point Station Type */
+ WMESHD_STATION_TYPE_SOFTAP, /**< SoftAP Station Type */
+} wmeshd_station_type_e;
+
/**< mesh interface information structure */
typedef struct {
gchar *bridge_interface; /**< Bridge name between mesh and others */
</signal>\r
<signal name="sta_joined">\r
<arg type="s" name="bssid" direction="out"/>\r
+ <arg type="i" name="station_type" direction="out"/>\r
</signal>\r
<signal name="sta_left">\r
<arg type="s" name="bssid" direction="out"/>\r
+ <arg type="i" name="station_type" direction="out"/>\r
</signal>\r
</interface>\r
</node>\r
char ifname[16] = { 0, };
char macbuf[MAX_MAC_ADDR_LEN];
- NOTUSED(arg);
+ wmesh_service *service = arg;
+ wmesh_interface_s *info = service->interface_info;
nla_parse(tb, NL80211_ATTR_MAX, genlmsg_attrdata(gnlh, 0), genlmsg_attrlen(gnlh, 0), NULL);
case NL80211_CMD_NEW_STATION:
mac_addr_n2a(macbuf, nla_data(tb[NL80211_ATTR_MAC]));
WMESH_LOGD("[%s] new station [%s]", ifname, macbuf);
- wmesh_notify_station_joined((const char*)macbuf);
+
+ if (g_strcmp0(info->mesh_interface, ifname) == 0)
+ wmesh_notify_station_joined((const char*)macbuf,
+ WMESHD_STATION_TYPE_MESH_POINT);
+ else if (g_strcmp0(info->softap_interface, ifname) == 0)
+ wmesh_notify_station_joined((const char*)macbuf,
+ WMESHD_STATION_TYPE_SOFTAP);
break;
case NL80211_CMD_DEL_STATION:
mac_addr_n2a(macbuf, nla_data(tb[NL80211_ATTR_MAC]));
WMESH_LOGD("[%s] del station [%s]", ifname, macbuf);
- wmesh_notify_station_left((const char*)macbuf);
+
+ if (g_strcmp0(info->mesh_interface, ifname) == 0)
+ wmesh_notify_station_left((const char*)macbuf,
+ WMESHD_STATION_TYPE_MESH_POINT);
+ else if (g_strcmp0(info->softap_interface, ifname) == 0)
+ wmesh_notify_station_left((const char*)macbuf,
+ WMESHD_STATION_TYPE_SOFTAP);
break;
case NL80211_CMD_NEW_MPATH:
return WMESHD_ERROR_OPERATION_FAILED;
}
-static int _send_nl_register_event_handler()
+static int _send_nl_register_event_handler(wmesh_service *service)
{
int err = WMESHD_ERROR_NONE;
int ret;
/* Set callbacks for event handler */
nl_cb_set(event_state->cb, NL_CB_VALID, NL_CB_CUSTOM,
- _on_receive_mesh_event, event_state);
+ _on_receive_mesh_event, service);
/* No sequence checking for multicast messages. */
nl_cb_set(event_state->cb, NL_CB_SEQ_CHECK, NL_CB_CUSTOM, no_seq_check, NULL);
return ret;
}
-int wmesh_netlink_register_event_handler()
+int wmesh_netlink_register_event_handler(wmesh_service *service)
{
int ret = WMESHD_ERROR_NONE;
WMESH_LOGD("Register mesh event handler");
- ret = _send_nl_register_event_handler();
+ ret = _send_nl_register_event_handler(service);
return ret;
}
return WMESHD_ERROR_NONE;
}
-int wmesh_request_register_event_handler()
+int wmesh_request_register_event_handler(wmesh_service *service)
{
int ret = WMESHD_ERROR_NONE;
WMESH_LOGD("Request to register mesh event handler");
/* Get MPath info */
- ret = wmesh_netlink_register_event_handler();
+ ret = wmesh_netlink_register_event_handler(service);
if (WMESHD_ERROR_NONE != ret)
return ret;
net_wmesh_emit_connection_state(object, mesh_id, bssid, channel, (int)sec, (int)state);
}
-void wmesh_notify_station_joined(const char* bssid)
+void wmesh_notify_station_joined(const char* bssid,
+ wmeshd_station_type_e station_type)
{
NetWmesh *object = wmeshd_dbus_get_object();
- net_wmesh_emit_sta_joined(object, bssid);
+ net_wmesh_emit_sta_joined(object, bssid, station_type);
}
-void wmesh_notify_station_left(const char* bssid)
+void wmesh_notify_station_left(const char* bssid,
+ wmeshd_station_type_e station_type)
{
NetWmesh *object = wmeshd_dbus_get_object();
- net_wmesh_emit_sta_left(object, bssid);
+ net_wmesh_emit_sta_left(object, bssid, station_type);
}
wmeshd_check_null_ret_error("info", info, FALSE);
/* Register event handler first */
- ret = wmesh_request_register_event_handler();
+ ret = wmesh_request_register_event_handler(service);
if (WMESHD_ERROR_IN_PROGRESS == ret) {
WMESH_LOGE("Currently set netlink event handler !! [%d]", ret);
ret = WMESHD_ERROR_NONE;