syslog(LOG_DEBUG, "%s() " fmt, __FUNCTION__ , ## arg); \
} while (0)
+static void system_ready(void)
+{
+ DBG("");
+
+ //supplicant_set_debug_level(1);
+}
+
+static void system_killed(void)
+{
+ DBG("");
+}
+
static void interface_added(struct supplicant_interface *interface)
{
const char *ifname = supplicant_interface_get_ifname(interface);
}
static const struct supplicant_callbacks callbacks = {
+ .system_ready = system_ready,
+ .system_killed = system_killed,
.interface_added = interface_added,
.interface_removed = interface_removed,
.network_added = network_added,
static const struct supplicant_callbacks *callbacks_pointer;
+static dbus_bool_t system_available = FALSE;
+
static dbus_int32_t debug_level = 0;
static dbus_bool_t debug_show_timestamps = FALSE;
static dbus_bool_t debug_show_keys = FALSE;
return SUPPLICANT_STATE_UNKNOWN;
}
+static void callback_system_ready(void)
+{
+ if (callbacks_pointer == NULL)
+ return;
+
+ if (callbacks_pointer->system_ready == NULL)
+ return;
+
+ callbacks_pointer->system_ready();
+}
+
+static void callback_system_killed(void)
+{
+ if (callbacks_pointer == NULL)
+ return;
+
+ if (callbacks_pointer->system_killed == NULL)
+ return;
+
+ callbacks_pointer->system_killed();
+}
+
static void callback_interface_added(struct supplicant_interface *interface)
{
if (callbacks_pointer == NULL)
static void service_property(const char *key, DBusMessageIter *iter,
void *user_data)
{
- if (key == NULL)
+ if (key == NULL) {
+ callback_system_ready();
return;
+ }
if (g_strcmp0(key, "DebugParams") == 0) {
DBusMessageIter list;
if (old == NULL || new == NULL)
return;
- if (strlen(old) > 0 && strlen(new) == 0)
+ if (strlen(old) > 0 && strlen(new) == 0) {
+ system_available = FALSE;
g_hash_table_remove_all(interface_table);
+ callback_system_killed();
+ }
- if (strlen(new) > 0 && strlen(old) == 0)
+ if (strlen(new) > 0 && strlen(old) == 0) {
+ system_available = TRUE;
supplicant_bootstrap();
+ }
}
static void signal_properties_changed(const char *path, DBusMessageIter *iter)
dbus_connection_flush(connection);
if (dbus_bus_name_has_owner(connection,
- SUPPLICANT_SERVICE, NULL) == TRUE)
+ SUPPLICANT_SERVICE, NULL) == TRUE) {
+ system_available = TRUE;
supplicant_bootstrap();
+ }
return 0;
}
interface_table = NULL;
}
+ if (system_available == TRUE)
+ callback_system_killed();
+
if (connection != NULL) {
dbus_connection_unref(connection);
connection = NULL;
enum supplicant_mode supplicant_network_get_mode(struct supplicant_network *network);
struct supplicant_callbacks {
+ void (*system_ready) (void);
+ void (*system_killed) (void);
void (*interface_added) (struct supplicant_interface *interface);
void (*interface_removed) (struct supplicant_interface *interface);
void (*network_added) (struct supplicant_network *network);