Add features support to socket-default plugin
authorMartin Willi <martin@revosec.ch>
Thu, 13 Oct 2011 09:45:41 +0000 (11:45 +0200)
committerMartin Willi <martin@revosec.ch>
Fri, 14 Oct 2011 08:05:48 +0000 (10:05 +0200)
src/libcharon/plugins/socket_default/socket_default_plugin.c

index 1bc8244..01d9473 100644 (file)
@@ -43,11 +43,20 @@ METHOD(plugin_t, get_name, char*,
 METHOD(plugin_t, destroy, void,
        private_socket_default_plugin_t *this)
 {
-       charon->socket->remove_socket(charon->socket,
-                                               (socket_constructor_t)socket_default_socket_create);
        free(this);
 }
 
+METHOD(plugin_t, get_features, int,
+       private_socket_default_plugin_t *this, plugin_feature_t *features[])
+{
+       static plugin_feature_t f[] = {
+               PLUGIN_CALLBACK(socket_register, socket_default_socket_create),
+                       PLUGIN_PROVIDE(CUSTOM, "socket"),
+       };
+       *features = f;
+       return countof(f);
+}
+
 /*
  * see header file
  */
@@ -59,15 +68,11 @@ plugin_t *socket_default_plugin_create()
                .public = {
                        .plugin = {
                                .get_name = _get_name,
-                               .reload = (void*)return_false,
+                               .get_features = _get_features,
                                .destroy = _destroy,
                        },
                },
        );
 
-       charon->socket->add_socket(charon->socket,
-                                               (socket_constructor_t)socket_default_socket_create);
-
        return &this->public.plugin;
 }
-