SET(SRCS
src/main.c
+ src/wifi-tdls.c
src/wifi.c
src/neterror.c
src/wifi-eap.c
GVariant *netconfig_invoke_dbus_method(const char *dest, const char *path,
const char *interface_name, const char *method,
GVariant *params);
+gboolean netconfig_dbus_emit_signal(const gchar *destination_bus_name,
+ const gchar *object_path,
+ const gchar *interface_name,
+ const gchar *signal_name,
+ GVariant *params);
int setup_gdbus(got_name_cb cb);
void cleanup_gdbus(void);
--- /dev/null
+/*\r
+ * Network Configuration Module\r
+ *\r
+ * Copyright (c) 2012-2013 Samsung Electronics Co., Ltd. All rights reserved.\r
+ *\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ *\r
+ */\r
+#ifndef __TIZEN_NETWORK_WIFI_TDLS_H__\r
+#define __TIZEN_NETWORK_WIFI_TDLS_H__\r
+\r
+#ifdef __cplusplus\r
+ extern "C" {\r
+#endif\r
+\r
+#include <glib.h>\r
+#include "netsupplicant.h"\r
+\r
+typedef struct {\r
+ int is_connected;\r
+ int hdcp;\r
+ int port;\r
+ int availability;\r
+ int tdls_support;\r
+ unsigned char ip_add[4];\r
+}wifi_tdls_wfd_info_s;\r
+\r
+void netconfig_wifi_tlds_connected_event(GVariant *message);\r
+void netconfig_wifi_tlds_disconnected_event(GVariant *message);\r
+void __netconfig_wifi_notify_tdls_connected_event(const char *peer_mac);\r
+gboolean handle_tdls_disconnect(Wifi *wifi, GDBusMethodInvocation *context, gchar *peer_mac_addr);\r
+gboolean handle_tdls_connected_peer(Wifi *wifi, GDBusMethodInvocation *context);\r
+\r
+\r
+#ifdef __cplusplus\r
+}\r
+#endif\r
+\r
+#endif /* __TIZEN_NETWORK_WIFI_TDLS_H__ */\r
+\r
<arg type="s" name="eap" direction="in"/>
<arg type="b" name="allowed" direction="out"/>
</method>
+ <method name="TdlsDisconnect">
+ <arg type="s" name="pee_mac_addr" direction="in"/>
+ <arg type="i" name="result" direction="out" />
+ </method>
+ <method name="TdlsConnectedPeer">
+ <arg type="s" name="peer_mac_addr" direction="out" />
+ </method>
<signal name="PowerOnCompleted"></signal>
<signal name="PowerOffCompleted"></signal>
<signal name="PowerOperationFailed"></signal>
Name: net-config
Summary: TIZEN Network Configuration service
-Version: 1.1.48
+Version: 1.1.49
Release: 2
Group: System/Network
License: Apache-2.0
<check send_destination="net.netconfig" send_interface="net.netconfig.wifi" send_member="PowerOffCompleted" privilege="http://tizen.org/privilege/network.get" />
<check send_destination="net.netconfig" send_interface="net.netconfig.wifi" send_member="SpecificScanCompleted" privilege="http://tizen.org/privilege/network.get" />
<check send_destination="net.netconfig" send_interface="net.netconfig.wifi" send_member="WpsScanCompleted" privilege="http://tizen.org/privilege/network.get" />
+ <check send_destination="net.netconfig" send_interface="net.netconfig.wifi" send_member="TdlsDisconnect" privilege="http://tizen.org/privilege/network.set" />
+ <check send_destination="net.netconfig" send_interface="net.netconfig.wifi" send_member="TdlsConnectedPeer" privilege="http://tizen.org/privilege/network.get" />
<check send_destination="net.netconfig" send_interface="net.connman.Agent" send_member="SetField" privilege="http://tizen.org/privilege/network.profile" />
</policy>
return reply;
}
+gboolean netconfig_dbus_emit_signal(const gchar *destination_bus_name,
+ const gchar *object_path,
+ const gchar *interface_name,
+ const gchar *signal_name,
+ GVariant *params)
+{
+ gboolean rv = FALSE;
+ GError *Error = NULL;
+ GDBusConnection *connection;
+
+ connection = netdbus_get_connection();
+ if (connection == NULL) {
+ ERR("[NET_DBUS] GDBusconnection is NULL");
+ return 0;
+ }
+
+ rv = g_dbus_connection_emit_signal(connection, destination_bus_name,
+ object_path, interface_name, signal_name, params, &Error);
+ if (rv != TRUE) {
+ ERR("[NET_DBUS] Failed to emit signal, Error: %s", Error->message);
+ g_clear_error(&Error);
+ return rv;
+ }
+
+ INFO("Sent signal (%s), Interface (%s)", signal_name, interface_name);
+
+ return rv;
+}
+
static void _got_bus_cb(GDBusConnection *conn, const gchar *name,
gpointer user_data)
{
#include "signal-handler.h"
#include "wifi-ssid-scan.h"
#include "wifi-background-scan.h"
+#include "wifi-tdls.h"
#if defined TIZEN_DEBUG_DISABLE
#include "wifi-dump.h"
#define SIGNAL_PROPERTIES_CHANGED "PropertiesChanged"
#define SIGNAL_PROPERTIES_DRIVER_HANGED "DriverHanged"
#define SIGNAL_PROPERTIES_SESSION_OVERLAPPED "SessionOverlapped"
+#define SIGNAL_TDLS_CONNECTED "TDLSConnected"
+#define SIGNAL_TDLS_DISCONNECTED "TDLSDisconnected"
+#define SIGNAL_TDLS_PEER_FOUND "TDLSPeerFound"
#define CONNMAN_SIGNAL_SERVICES_CHANGED "ServicesChanged"
#define CONNMAN_SIGNAL_PROPERTY_CHANGED "PropertyChanged"
#define CONNMAN_SIGNAL_NAME_CHANGED "NameOwnerChanged"
SIG_SCAN_DONE,
SIG_DRIVER_HANGED,
SIG_SESSION_OVERLAPPED,
+ SIG_TDLS_CONNECTED,
+ SIG_TDLS_DISCONNECTED,
+ SIG_TDLS_PEER_FOUND,
SIG_MAX
} SuppSigArrayIndex;
SIGNAL_SCAN_DONE,
SIGNAL_PROPERTIES_DRIVER_HANGED,
SIGNAL_PROPERTIES_SESSION_OVERLAPPED,
+ SIGNAL_TDLS_CONNECTED,
+ SIGNAL_TDLS_DISCONNECTED,
+ SIGNAL_TDLS_PEER_FOUND,
};
static int supp_subscription_ids[SIG_MAX] = {0};
#endif
}
+static void _supplicant_tdls_connected(GDBusConnection *conn,
+ const gchar *name, const gchar *path, const gchar *interface,
+ const gchar *sig, GVariant *param, gpointer user_data)
+{
+ ERR("Received TDLS Connected Signal");
+ netconfig_wifi_tlds_connected_event(param);
+
+ return;
+}
+
+static void _supplicant_tdls_disconnected(GDBusConnection *conn,
+ const gchar *name, const gchar *path, const gchar *interface,
+ const gchar *sig, GVariant *param, gpointer user_data)
+{
+ ERR("Received TDLS Disconnected Signal");
+ netconfig_wifi_tlds_disconnected_event(param);
+
+ return;
+}
+
+static void _supplicant_tdls_peer_found(GDBusConnection *conn,
+ const gchar *name, const gchar *path, const gchar *interface,
+ const gchar *sig, GVariant *param, gpointer user_data)
+{
+ ERR("Received TDLS Peer Found Signal");
+ return;
+}
+
static supplicant_signal_cb supplicant_cbs[SIG_MAX] = {
_supplicant_interface_removed,
_supplicant_properties_changed,
_supplicant_bss_added,
_supplicant_scan_done,
_supplicant_driver_hanged,
- _supplicant_session_overlapped
+ _supplicant_session_overlapped,
+ _supplicant_tdls_connected,
+ _supplicant_tdls_disconnected,
+ _supplicant_tdls_peer_found
};
#if defined TIZEN_DEBUG_DISABLE
--- /dev/null
+/*\r
+ * Network Configuration Module\r
+ *\r
+ * Copyright (c) 2012-2013 Samsung Electronics Co., Ltd. All rights reserved.\r
+ *\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ *\r
+ */\r
+\r
+#include <stdio.h>\r
+#include <time.h>\r
+#include <stdlib.h>\r
+#include <sys/time.h>\r
+#include <unistd.h>\r
+#include <string.h>\r
+#include "neterror.h"\r
+#include "netdbus.h"\r
+#include "netsupplicant.h"\r
+#include "network-state.h"\r
+#include <vconf.h>\r
+#include <vconf-keys.h>\r
+#include <arpa/inet.h>\r
+#include <log.h>\r
+#include "util.h"\r
+#include "neterror.h"\r
+#include "wifi-tdls.h"\r
+#include <glib.h>\r
+\r
+wifi_tdls_wfd_info_s peer_info;\r
+char *peer_mac = NULL;\r
+\r
+void __netconfig_wifi_notify_tdls_event(const char *sig_name,const char *peer_mac)\r
+{\r
+ GVariantBuilder *builder;\r
+ GVariant *params;\r
+ builder = g_variant_builder_new(G_VARIANT_TYPE("a{sv}"));\r
+ g_variant_builder_add(builder, "{sv}", "peermac", g_variant_new_string(peer_mac));\r
+\r
+ params = g_variant_new("(@a{sv})", g_variant_builder_end(builder));\r
+ g_variant_builder_unref(builder);\r
+\r
+ netconfig_dbus_emit_signal(NULL,\r
+ NETCONFIG_WIFI_PATH,\r
+ NETCONFIG_WIFI_INTERFACE,\r
+ sig_name,\r
+ params);\r
+\r
+ INFO("Sent signal (%s) Peer Mac (%s)", sig_name, peer_mac);\r
+}\r
+\r
+static GVariant * __netconfig_wifi_tdls_send_dbus_str(const char* method, const char *str)\r
+{\r
+ GVariant *message = NULL;\r
+ const char *if_path = NULL;\r
+ GVariant *params = NULL;\r
+\r
+ if_path = netconfig_wifi_get_supplicant_interface();\r
+ if (if_path == NULL) {\r
+ ERR("Fail to get wpa_supplicant DBus path");\r
+ return NULL;\r
+ }\r
+\r
+ params = g_variant_new("(s)", str);\r
+ INFO("[TizenMW-->WPAS] Sent Dbus Method :[%s],value[%s]", method,str);\r
+ message = netconfig_invoke_dbus_method(SUPPLICANT_SERVICE,\r
+ if_path, SUPPLICANT_INTERFACE ".Interface", method, params);\r
+\r
+ INFO("TDLS Returned from Blocking method for Send DBUS Command");\r
+ return message;\r
+}\r
+\r
+gboolean handle_tdls_disconnect(Wifi *wifi, GDBusMethodInvocation *context,\r
+ gchar *peer_mac_Addr)\r
+{\r
+ DBG("[TizenMW-->WPAS]: TDLS Teardown Request: [%s]", peer_mac_Addr);\r
+\r
+ if(!peer_info.is_connected) {\r
+ ERR(" No active TDLS Connection !!!");\r
+\r
+ } else {\r
+ GVariant *message = NULL;\r
+ message = __netconfig_wifi_tdls_send_dbus_str("TDLSTeardown", (const char*)peer_mac_Addr);\r
+ DBG("[TizenMW<--WPAS] TDLS DBUS Command sent successfully");\r
+ g_variant_unref(message);\r
+ peer_info.is_connected = 0;\r
+ }\r
+\r
+ wifi_complete_tdls_disconnect(wifi, context, 1);\r
+ return TRUE;\r
+}\r
+\r
+gboolean handle_tdls_connected_peer(Wifi *wifi, GDBusMethodInvocation *context)\r
+{\r
+ DBG("[TizenMW-->WPAS]: TDLS Connected Peer Request: ");\r
+\r
+ GVariant *message = NULL;\r
+ const gchar* reply_str = NULL;\r
+\r
+ if (peer_mac == NULL) {\r
+ INFO("TDLS: No Active Connection");\r
+ wifi_complete_tdls_connected_peer(wifi, context, "00.00.00.00.00.00");\r
+ return TRUE;\r
+ }\r
+ message = __netconfig_wifi_tdls_send_dbus_str("TDLSStatus", (const char*)peer_mac);\r
+ if (message == NULL) {\r
+ ERR(" TDLS : No active TDLS Link Setup !!!");\r
+ wifi_complete_tdls_connected_peer(wifi, context, "00.00.00.00.00.00");\r
+ return TRUE;\r
+ }\r
+\r
+ g_variant_get(message, "(&s)", &reply_str);\r
+ INFO("param [%s]", g_variant_print(message,TRUE));\r
+ INFO("TDLS reply: [%s]", reply_str);\r
+ INFO("TDLS :peer_mac [%s]", peer_mac);\r
+\r
+ if (g_strcmp0("connected", reply_str) != 0) {\r
+ ERR("[TizenMW<--WPAS] TDLS Connection not available");\r
+ wifi_complete_tdls_connected_peer(wifi, context, "00.00.00.00.00.00");\r
+ g_variant_unref(message);\r
+ return TRUE;\r
+ }\r
+\r
+ INFO("[TizenMW<--WPAS] TDLS Connection available, Peer Mac address %s", peer_mac);\r
+ wifi_complete_tdls_connected_peer(wifi, context, peer_mac);\r
+\r
+ g_variant_unref(message);\r
+ return TRUE;\r
+}\r
+\r
+void netconfig_wifi_tlds_connected_event(GVariant *message)\r
+{\r
+\r
+ DBG("[TizenMW<--WPAS] WiFi TDLS Connected EVENT");\r
+ if (peer_info.is_connected == 1) {\r
+ INFO("TDLS Peer already connected");\r
+ g_free(peer_mac);\r
+ }\r
+\r
+ g_variant_get(message, "(s)", &peer_mac);\r
+ INFO("Peer Mac Address: [%s]", peer_mac);\r
+\r
+ /*update the Peer Mac address in Gloablestructure*/\r
+ peer_info.is_connected = 1;\r
+ __netconfig_wifi_notify_tdls_event("TDLSConnect", peer_mac);\r
+}\r
+\r
+void netconfig_wifi_tlds_disconnected_event(GVariant *message)\r
+{\r
+ DBG("[TizenMW<--WPAS]: WiFi TDLS Disconnected EVENT");\r
+ const gchar *peer_mac_addr = NULL;\r
+\r
+ g_variant_get(message, "(&s)", &peer_mac_addr);\r
+ if (g_strcmp0(peer_mac, peer_mac_addr) == 0) {\r
+ INFO("TDLS Peer Disconnected Mac Address: [%s]", peer_mac);\r
+ peer_info.is_connected = 0;\r
+ __netconfig_wifi_notify_tdls_event("TDLSDisconnect",peer_mac);\r
+ } else\r
+ INFO("TDLS Peer Disconnected peer_mac(%s) != peer_mac_address(%s)", peer_mac, peer_mac_addr);\r
+}\r
#include "wifi-eap-config.h"
#include "wifi-background-scan.h"
#include "wifi-config.h"
+#include "wifi-tdls.h"
static Wifi *wifi_object = NULL;
static NetConnmanAgent *connman_agent_object = NULL;
g_signal_connect(wifi_object, "handle-check-black-list",
G_CALLBACK(handle_check_black_list), NULL);
+ //TDLS methods
+ g_signal_connect(wifi_object, "handle-tdls-disconnect",
+ G_CALLBACK(handle_tdls_disconnect), NULL);
+ g_signal_connect(wifi_object, "handle-tdls-connected-peer",
+ G_CALLBACK(handle_tdls_connected_peer), NULL);
+
if (!g_dbus_interface_skeleton_export(interface_wifi, connection,
NETCONFIG_WIFI_PATH, NULL)) {
ERR("Export WIFI_PATH for wifi failed");