Register TKM bus listener in charon-tkm

This commit is contained in:
Reto Buerki
2013-03-19 15:23:47 +01:00
committed by Tobias Brunner
parent c6c8d74026
commit d0ce4116b0
+12
View File
@@ -37,6 +37,12 @@
#include "tkm_nonceg.h" #include "tkm_nonceg.h"
#include "tkm_diffie_hellman.h" #include "tkm_diffie_hellman.h"
#include "tkm_keymat.h" #include "tkm_keymat.h"
#include "tkm_listener.h"
/**
* TKM bus listener for IKE authorize events.
*/
static tkm_listener_t *listener;
/** /**
* PID file, in which charon-tkm stores its process id * PID file, in which charon-tkm stores its process id
@@ -319,6 +325,10 @@ int main(int argc, char *argv[])
goto deinit; goto deinit;
} }
/* register TKM authorization hook */
listener = tkm_listener_create();
charon->bus->add_listener(charon->bus, &listener->listener);
/* add handler for SEGV and ILL, /* add handler for SEGV and ILL,
* INT and TERM are handled by sigwait() in run() */ * INT and TERM are handled by sigwait() in run() */
action.sa_handler = segv_handler; action.sa_handler = segv_handler;
@@ -342,6 +352,8 @@ int main(int argc, char *argv[])
unlink_pidfile(); unlink_pidfile();
status = 0; status = 0;
charon->bus->remove_listener(charon->bus, &listener->listener);
listener->destroy(listener);
deinit: deinit:
libcharon_deinit(); libcharon_deinit();