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

index 5bd28bd..1299c30 100644 (file)
@@ -40,11 +40,20 @@ METHOD(plugin_t, get_name, char*,
        return "socket-raw";
 }
 
        return "socket-raw";
 }
 
+METHOD(plugin_t, get_features, int,
+       private_socket_raw_plugin_t *this, plugin_feature_t *features[])
+{
+       static plugin_feature_t f[] = {
+               PLUGIN_CALLBACK(socket_register, socket_raw_socket_create),
+                       PLUGIN_PROVIDE(CUSTOM, "socket"),
+       };
+       *features = f;
+       return countof(f);
+}
+
 METHOD(plugin_t, destroy, void,
        private_socket_raw_plugin_t *this)
 {
 METHOD(plugin_t, destroy, void,
        private_socket_raw_plugin_t *this)
 {
-       charon->socket->remove_socket(charon->socket,
-                                                       (socket_constructor_t)socket_raw_socket_create);
        free(this);
 }
 
        free(this);
 }
 
@@ -59,15 +68,12 @@ plugin_t *socket_raw_plugin_create()
                .public = {
                        .plugin = {
                                .get_name = _get_name,
                .public = {
                        .plugin = {
                                .get_name = _get_name,
-                               .reload = (void*)return_false,
+                               .get_features = _get_features,
                                .destroy = _destroy,
                        },
                },
        );
 
                                .destroy = _destroy,
                        },
                },
        );
 
-       charon->socket->add_socket(charon->socket,
-                                                       (socket_constructor_t)socket_raw_socket_create);
-
        return &this->public.plugin;
 }
 
        return &this->public.plugin;
 }