bool __connman_network_get_weakness(struct connman_network *network);
bool __connman_network_native_autoconnect(struct connman_network *network);
#if defined TIZEN_EXT
+char *__connman_network_get_dhcp_status(const char *ifname);
dbus_bool_t __connman_network_notify_dhcp_changed(const char *key, const char *val);
bool connman_network_get_psk_sha256(struct connman_network *network);
void connman_network_set_psk_sha256(struct connman_network *network, bool is_psk_sha256);
return connman_service_create_dbus_service_reply(msg, service);
}
+
+static DBusMessage *get_dhcp_status(DBusConnection *conn, DBusMessage *msg, void *data)
+{
+ const char *ifname;
+ const char *dhcp_status;
+ DBusMessage *reply;
+ DBusMessageIter iter;
+
+ dbus_message_get_args(msg, NULL, DBUS_TYPE_STRING, &ifname, DBUS_TYPE_INVALID);
+ dhcp_status = __connman_network_get_dhcp_status(ifname);
+
+ reply = dbus_message_new_method_return(msg);
+ if (!reply)
+ return NULL;
+
+ if (!dhcp_status)
+ dhcp_status = "Unknown";
+
+ dbus_message_iter_init_append(reply, &iter);
+ dbus_message_iter_append_basic(&iter, DBUS_TYPE_STRING, &dhcp_status);
+
+ return reply;
+}
#endif
#if defined TIZEN_EXT_INS
GDBUS_ARGS({ "ifname", "s" }),
GDBUS_ARGS({ "service", "oa{sv}" }),
get_connected_service) },
+ { GDBUS_METHOD("GetDhcpStatus",
+ GDBUS_ARGS({ "ifname", "s" }),
+ GDBUS_ARGS({ "status", "s" }),
+ get_dhcp_status) },
#endif
#if defined TIZEN_EXT_INS
{ GDBUS_METHOD("GetINS",
static unsigned char invalid_bssid[WIFI_BSSID_LEN_MAX] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
+
+static GHashTable *dhcp_status_list = NULL;
#endif
static GSList *network_list = NULL;
}
#if defined TIZEN_EXT
+char *__connman_network_get_dhcp_status(const char *ifname)
+{
+ char *status = NULL;
+
+ if (!ifname)
+ return NULL;
+
+ status = g_hash_table_lookup(dhcp_status_list, ifname);
+ DBG("ifname: %s, DHCP status: %s", ifname, status);
+
+ return status;
+}
+
+static void __connman_network_update_dhcp_status(
+ const char *ifname, const char *status)
+{
+ if (!ifname || !status)
+ return;
+
+ g_hash_table_replace(dhcp_status_list, g_strdup(ifname), g_strdup(status));
+}
+
dbus_bool_t __connman_network_notify_dhcp_changed(const char *key, const char *val)
{
DBusMessage *signal;
dbus_message_unref(signal);
+ __connman_network_update_dhcp_status(val, key);
+
return result;
}
#endif
DBG("");
#if defined TIZEN_EXT
connection = connman_dbus_get_connection();
+ dhcp_status_list = g_hash_table_new_full(g_str_hash,
+ g_str_equal, g_free, g_free);
#endif
return 0;
DBG("");
#if defined TIZEN_EXT
dbus_connection_unref(connection);
+ if (dhcp_status_list)
+ g_hash_table_destroy(dhcp_status_list);
#endif
}