summaryrefslogtreecommitdiff
path: root/tools/supplicant-test.c
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2009-12-25 03:44:07 -0800
committerMarcel Holtmann <marcel@holtmann.org>2009-12-25 03:44:07 -0800
commit8e894565e933d77aae491ec1bfd3204836f00fff (patch)
tree69b4960944ae0f8caee2d9492697421dae1eed26 /tools/supplicant-test.c
parent68e51a3dcedbf3ce1aeb1efb1a8b595432bc402e (diff)
downloadconnman-8e894565e933d77aae491ec1bfd3204836f00fff.tar.gz
connman-8e894565e933d77aae491ec1bfd3204836f00fff.tar.bz2
connman-8e894565e933d77aae491ec1bfd3204836f00fff.zip
Add signal handling to supplicant test program
Diffstat (limited to 'tools/supplicant-test.c')
-rw-r--r--tools/supplicant-test.c23
1 files changed, 21 insertions, 2 deletions
diff --git a/tools/supplicant-test.c b/tools/supplicant-test.c
index d2bb3c28..b448a023 100644
--- a/tools/supplicant-test.c
+++ b/tools/supplicant-test.c
@@ -33,6 +33,25 @@
#include "supplicant.h"
+#define DBG(fmt, arg...) do { \
+ syslog(LOG_DEBUG, "%s() " fmt, __FUNCTION__ , ## arg); \
+} while (0)
+
+static void interface_added(const struct supplicant_interface *interface)
+{
+ DBG("interface %p", interface);
+}
+
+static void interface_removed(const struct supplicant_interface *interface)
+{
+ DBG("interface %p", interface);
+}
+
+static const struct supplicant_callbacks callbacks = {
+ .interface_added = interface_added,
+ .interface_removed = interface_removed,
+};
+
static GMainLoop *main_loop = NULL;
static void sig_term(int sig)
@@ -80,14 +99,14 @@ int main(int argc, char *argv[])
syslog(LOG_INFO, "Startup");
- if (supplicant_init() < 0) {
+ if (supplicant_register(&callbacks) < 0) {
syslog(LOG_ERR, "Failed to init supplicant");
goto done;
}
g_main_loop_run(main_loop);
- supplicant_exit();
+ supplicant_unregister(&callbacks);
done:
syslog(LOG_INFO, "Exit");