Register a certexpire listener collecting trustchain information
[strongswan.git] / src / libcharon / plugins / certexpire / certexpire_plugin.c
index 8f92b58..795e8a1 100644 (file)
@@ -15,6 +15,8 @@
 
 #include "certexpire_plugin.h"
 
+#include "certexpire_listener.h"
+
 #include <daemon.h>
 
 typedef struct private_certexpire_plugin_t private_certexpire_plugin_t;
@@ -28,6 +30,11 @@ struct private_certexpire_plugin_t {
         * Implements plugin interface
         */
        certexpire_plugin_t public;
+
+       /**
+        * Listener collecting expire information
+        */
+       certexpire_listener_t *listener;
 };
 
 METHOD(plugin_t, get_name, char*,
@@ -39,6 +46,8 @@ METHOD(plugin_t, get_name, char*,
 METHOD(plugin_t, destroy, void,
        private_certexpire_plugin_t *this)
 {
+       charon->bus->remove_listener(charon->bus, &this->listener->listener);
+       this->listener->destroy(this->listener);
        free(this);
 }
 
@@ -57,7 +66,9 @@ plugin_t *certexpire_plugin_create()
                                .destroy = _destroy,
                        },
                },
+               .listener = certexpire_listener_create(),
        );
+       charon->bus->add_listener(charon->bus, &this->listener->listener);
 
        return &this->public.plugin;
 }