svn rev #24155: branches/plugins/src/ config-files/ include/ lib/crypto/krb/yarrow/ ...

tsitkova@MIT.EDU tsitkova at MIT.EDU
Wed Jun 30 17:52:07 EDT 2010


http://src.mit.edu/fisheye/changelog/krb5/?cs=24155
Commit By: tsitkova
Log Message:
Renamed factory into loader.
Example of plugin section in krb5.conf after renaming:
        PQ_DYN = {
                plugin_api = plugin_pwd_qlty
                plugin_loader_name = plugin_dyn_loader
                plugin_loader_type = dynamic
                plugin_name = plugin_pwd_qlty_DYN
                plugin_loader_path = /var/tsitkova/Sources/pl/src/plugin_dynamic/libplugin_dynamic.so
                plugin_type = service
                plugin_id = 33
        }
 



Changed Files:
U   branches/plugins/src/config-files/krb5.conf
U   branches/plugins/src/include/k5-int.h
U   branches/plugins/src/lib/crypto/krb/yarrow/deps
U   branches/plugins/src/lib/krb5/os/Makefile.in
U   branches/plugins/src/plugin_core/Makefile.in
U   branches/plugins/src/plugin_core/deps
U   branches/plugins/src/plugin_core/impl/Makefile.in
U   branches/plugins/src/plugin_core/impl/deps
D   branches/plugins/src/plugin_core/impl/plugin_default_factory.c
D   branches/plugins/src/plugin_core/impl/plugin_default_factory.h
A   branches/plugins/src/plugin_core/impl/plugin_default_loader.c
A   branches/plugins/src/plugin_core/impl/plugin_default_loader.h
U   branches/plugins/src/plugin_core/impl/plugin_default_manager.c
U   branches/plugins/src/plugin_core/impl/plugin_impl.exports
U   branches/plugins/src/plugin_core/libplugin_core.exports
D   branches/plugins/src/plugin_core/plugin_factory.c
D   branches/plugins/src/plugin_core/plugin_factory.h
A   branches/plugins/src/plugin_core/plugin_loader.c
A   branches/plugins/src/plugin_core/plugin_loader.h
U   branches/plugins/src/plugin_dynamic/Makefile.in
U   branches/plugins/src/plugin_dynamic/deps
U   branches/plugins/src/plugin_dynamic/libplugin_dynamic.exports
D   branches/plugins/src/plugin_dynamic/plugin_dyn_factory.c
D   branches/plugins/src/plugin_dynamic/plugin_dyn_factory.h
A   branches/plugins/src/plugin_dynamic/plugin_dyn_loader.c
A   branches/plugins/src/plugin_dynamic/plugin_dyn_loader.h
U   branches/plugins/src/plugins/pa/deps
U   branches/plugins/src/plugins/pa/encrypted_challenge/deps
U   branches/plugins/src/plugins/pwd_qlty/deps
U   branches/plugins/src/plugins/pwd_qlty/plugin_pwd_qlty_X/deps
U   branches/plugins/src/plugins/pwd_qlty/plugin_pwd_qlty_krb/deps
Modified: branches/plugins/src/config-files/krb5.conf
===================================================================
--- branches/plugins/src/config-files/krb5.conf	2010-06-30 21:05:43 UTC (rev 24154)
+++ branches/plugins/src/config-files/krb5.conf	2010-06-30 21:52:07 UTC (rev 24155)
@@ -31,8 +31,8 @@
 
         PQ1 = {
                 plugin_api = plugin_pwd_qlty
-                plugin_factory_name = plugin_default_factory
-                plugin_factory_type = static
+                plugin_loader_name = plugin_default_loader
+                plugin_loader_type = static
                 plugin_name = plugin_pwd_qlty_X
                 plugin_type = service
                 plugin_id = 1
@@ -40,8 +40,8 @@
 
         PQ2 = {
                 plugin_api = plugin_pwd_qlty
-                plugin_factory_name = plugin_default_factory
-                plugin_factory_type = static
+                plugin_loader_name = plugin_default_loader
+                plugin_loader_type = static
                 plugin_name = plugin_pwd_qlty_krb
                 plugin_type = service
                 plugin_id = 0

Modified: branches/plugins/src/include/k5-int.h
===================================================================
--- branches/plugins/src/include/k5-int.h	2010-06-30 21:05:43 UTC (rev 24154)
+++ branches/plugins/src/include/k5-int.h	2010-06-30 21:52:07 UTC (rev 24155)
@@ -91,12 +91,6 @@
 #    endif
 #endif
 
-/* Plugin manager */
-//#include <plugin_manager.h>
-//#include <plugin_factory.h>
-//#include "plugin_default_manager.h"
-//#include "plugin_default_factory.h"
-
 /*
  * Begin "k5-config.h"
  */

Modified: branches/plugins/src/lib/crypto/krb/yarrow/deps
===================================================================
--- branches/plugins/src/lib/crypto/krb/yarrow/deps	2010-06-30 21:05:43 UTC (rev 24154)
+++ branches/plugins/src/lib/crypto/krb/yarrow/deps	2010-06-30 21:52:07 UTC (rev 24155)
@@ -28,7 +28,7 @@
 plugin_prng_impl.so plugin_prng_impl.po $(OUTPRE)plugin_prng_impl.$(OBJEXT): \
   $(BUILDTOP)/include/krb5/krb5.h $(COM_ERR_DEPS) $(top_srcdir)/plugins/prng/plugin_yarrow/plugin_prng_impl.h \
   $(top_srcdir)/plugin_core/plugin_manager.h \
-  $(top_srcdir)/plugin_core/plugin_factory.h \
+  $(top_srcdir)/plugin_core/plugin_loader.h \
   $(srcdir)/../../../crypto/builtin/yhash.h \
   $(srcdir)/../../../crypto/builtin/enc_provider/enc_provider.h \
   plugin_prng_impl.c

Modified: branches/plugins/src/lib/krb5/os/Makefile.in
===================================================================
--- branches/plugins/src/lib/krb5/os/Makefile.in	2010-06-30 21:05:43 UTC (rev 24154)
+++ branches/plugins/src/lib/krb5/os/Makefile.in	2010-06-30 21:52:07 UTC (rev 24155)
@@ -226,14 +226,14 @@
 	echo '}' >> ./t_an.conf
 	echo '[plugins]' >> ./t_an.conf
 	echo 'plugin_prng = {' >> ./t_an.conf
-	echo 'plugin_factory_name = plugin_default_factory' >> ./t_an.conf
-	echo 'plugin_factory_type = static' >> ./t_an.conf
+	echo 'plugin_loader_name = plugin_default_loader' >> ./t_an.conf
+	echo 'plugin_loader_type = static' >> ./t_an.conf
 	echo 'plugin_name =  plugin_yarrow_prng' >> ./t_an.conf
 	echo 'plugin_type = service' >> ./t_an.conf
 	echo ' }' >> ./t_an.conf
 	echo 'plugin_pa = {' >> ./t_an.conf
-	echo 'plugin_factory_name = plugin_default_factory' >> ./t_an.conf
-	echo 'plugin_factory_type = static' >> ./t_an.conf
+	echo 'plugin_loader_name = plugin_default_loader' >> ./t_an.conf
+	echo 'plugin_loader_type = static' >> ./t_an.conf
 	echo 'plugin_name = plugin_encrypted_challenge_pa' >> ./t_an.conf
 	echo 'plugin_type = service' >> ./t_an.conf
 	echo '}' >> ./t_an.conf

Modified: branches/plugins/src/plugin_core/Makefile.in
===================================================================
--- branches/plugins/src/plugin_core/Makefile.in	2010-06-30 21:05:43 UTC (rev 24154)
+++ branches/plugins/src/plugin_core/Makefile.in	2010-06-30 21:52:07 UTC (rev 24155)
@@ -22,9 +22,9 @@
 
 SHLIB_EXPLIBS=  $(LIBS_UTILS)
  
-STLIBOBJS= plugin_manager.o plugin_factory.o krb5_parser.o	
+STLIBOBJS= plugin_manager.o plugin_loader.o krb5_parser.o	
 
-SRCS= plugin_manager.c plugin_factory.c krb5_parser.c
+SRCS= plugin_manager.c plugin_loader.c krb5_parser.c
 
 all-unix:: all-liblinks
 install-unix:: install-libs

Modified: branches/plugins/src/plugin_core/deps
===================================================================
--- branches/plugins/src/plugin_core/deps	2010-06-30 21:05:43 UTC (rev 24154)
+++ branches/plugins/src/plugin_core/deps	2010-06-30 21:52:07 UTC (rev 24155)
@@ -1,7 +1,7 @@
 plugin_manager.so plugin_manager.po $(OUTPRE)plugin_manager.$(OBJEXT): \
   $(BUILDTOP)/include/krb5/krb5.h $(COM_ERR_DEPS) $(top_srcdir)/plugin_core/plugin_manager.h \
   plugin_manager.c
-plugin_factory.so plugin_factory.po $(OUTPRE)plugin_factory.$(OBJEXT): \
-  $(BUILDTOP)/include/krb5/krb5.h $(COM_ERR_DEPS) $(top_srcdir)/plugin_core/plugin_factory.h \
+plugin_loader.so plugin_loader.po $(OUTPRE)plugin_loader.$(OBJEXT): \
+  $(BUILDTOP)/include/krb5/krb5.h $(COM_ERR_DEPS) $(top_srcdir)/plugin_core/plugin_loader.h \
   $(top_srcdir)/plugin_core/plugin_manager.h \
-  plugin_factory.c
+  plugin_loader.c

Modified: branches/plugins/src/plugin_core/impl/Makefile.in
===================================================================
--- branches/plugins/src/plugin_core/impl/Makefile.in	2010-06-30 21:05:43 UTC (rev 24154)
+++ branches/plugins/src/plugin_core/impl/Makefile.in	2010-06-30 21:52:07 UTC (rev 24155)
@@ -14,9 +14,9 @@
 
 LIBBASE=plugin_impl
 
-STLIBOBJS= plugin_default_factory.o plugin_default_manager.o
+STLIBOBJS= plugin_default_loader.o plugin_default_manager.o
 
-SRCS= plugin_default_factory.c plugin_default_manager.c
+SRCS= plugin_default_loader.c plugin_default_manager.c
 
 STOBJLISTS=OBJS.ST
 

Modified: branches/plugins/src/plugin_core/impl/deps
===================================================================
--- branches/plugins/src/plugin_core/impl/deps	2010-06-30 21:05:43 UTC (rev 24154)
+++ branches/plugins/src/plugin_core/impl/deps	2010-06-30 21:52:07 UTC (rev 24155)
@@ -3,12 +3,12 @@
   $(top_srcdir)/plugin_core/plugin_manager.h \
   $(top_srcdir)/plugin_core/krb5_parser.h \
   $(top_srcdir)/plugin_core/impl/plugin_default_manager.h \
-  $(top_srcdir)/plugin_core/impl/plugin_default_factory.h \
+  $(top_srcdir)/plugin_core/impl/plugin_default_loader.h \
   plugin_default_manager.c
-plugin_default_factory.so plugin_default_factory.po $(OUTPRE)plugin_default_factory.$(OBJEXT): \
-  $(BUILDTOP)/include/krb5/krb5.h $(COM_ERR_DEPS) $(top_srcdir)/plugin_core/plugin_factory.h \
+plugin_default_loader.so plugin_default_loader.po $(OUTPRE)plugin_default_loader.$(OBJEXT): \
+  $(BUILDTOP)/include/krb5/krb5.h $(COM_ERR_DEPS) $(top_srcdir)/plugin_core/plugin_loader.h \
   $(top_srcdir)/plugin_core/plugin_manager.h \
   $(top_srcdir)/plugins/pa/encrypted_challenge/plugin_pa_impl.h \
   $(top_srcdir)/plugin_core/impl/plugin_default_manager.h \
-  $(top_srcdir)/plugin_core/impl/plugin_default_factory.h \
-  plugin_default_factory.c
+  $(top_srcdir)/plugin_core/impl/plugin_default_loader.h \
+  plugin_default_loader.c

Copied: branches/plugins/src/plugin_core/impl/plugin_default_loader.c (from rev 24153, branches/plugins/src/plugin_core/impl/plugin_default_factory.c)
===================================================================
--- branches/plugins/src/plugin_core/impl/plugin_default_loader.c	                        (rev 0)
+++ branches/plugins/src/plugin_core/impl/plugin_default_loader.c	2010-06-30 21:52:07 UTC (rev 24155)
@@ -0,0 +1,71 @@
+/*
+ * plugin_default_loader.c
+ *
+ */
+#include <string.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "plugin_manager.h"
+#include "plugin_loader.h"
+#include "plugin_pa_impl.h"
+#include "plugin_default_loader.h"
+
+static plugin_loader* _default_loader_instance = NULL;
+
+/* built-in plugins */
+static plugin_descr  plugin_default_loader_table[] = {
+        {"plugin_pwd_qlty_X",   plugin_pwd_qlty_X_create},
+        {"plugin_pwd_qlty_krb", plugin_pwd_qlty_krb_create},
+        {"plugin_encrypted_challenge_pa", plugin_encrypted_challenge_pa_create},
+        {"plugin_ldap_audit", NULL},
+        {NULL,NULL}
+};
+
+/* Loader API implementation */
+static void
+_get_loader_content (const char* container[]) {
+    plugin_descr *ptr = NULL;
+    int i = 0;
+    for( ptr = plugin_default_loader_table; ptr->plugin_name != NULL; ptr++,i++) {
+        container[i] = ptr->plugin_name;
+    }
+}
+
+static plhandle
+_create_api (const char* plugin_name)
+{
+    plhandle handle;
+    plugin_descr *ptr = NULL;
+
+    memset(&handle, 0, sizeof(handle));
+    if(plugin_name){
+        handle.api = NULL;
+        for( ptr = plugin_default_loader_table; ptr->plugin_name != NULL; ptr++) {
+            if (strcmp(ptr->plugin_name, plugin_name) == 0) {
+                handle = ptr->plugin_creator();
+                break;
+            }
+        }
+    }
+    return handle;
+}
+
+
+loader_handle
+plugin_loader_get_instance()
+{
+    plugin_loader* instance = _default_loader_instance;
+    loader_handle handle;
+
+    if(_default_loader_instance == NULL) {
+        instance = (plugin_loader*) malloc(sizeof(plugin_loader));
+        memset(instance, 0, sizeof(plugin_loader));
+        instance->get_loader_content = _get_loader_content;
+        instance->create_api = _create_api;
+        _default_loader_instance = instance;
+    }
+    handle.api = instance;
+    return (handle);
+}
+


Added: svn:mergeinfo
   + 

Copied: branches/plugins/src/plugin_core/impl/plugin_default_loader.h (from rev 24153, branches/plugins/src/plugin_core/impl/plugin_default_factory.h)
===================================================================
--- branches/plugins/src/plugin_core/impl/plugin_default_loader.h	                        (rev 0)
+++ branches/plugins/src/plugin_core/impl/plugin_default_loader.h	2010-06-30 21:52:07 UTC (rev 24155)
@@ -0,0 +1,17 @@
+/*
+ * plugin_default_loader.h
+ *
+ */
+
+#ifndef PLUGIN_DEFAULT_LOADER_H_
+#define PLUGIN_DEFAULT_LOADER_H_
+
+#include <plugin_loader.h>
+#include "plugin_pwd_qlty_krb_impl.h"
+#include "plugin_pwd_qlty_X_impl.h"
+
+
+loader_handle plugin_loader_get_instance(void);
+
+
+#endif /* PLUGIN_DEFAULT_LOADER_H_ */


Added: svn:mergeinfo
   + 

Modified: branches/plugins/src/plugin_core/impl/plugin_default_manager.c
===================================================================
--- branches/plugins/src/plugin_core/impl/plugin_default_manager.c	2010-06-30 21:05:43 UTC (rev 24154)
+++ branches/plugins/src/plugin_core/impl/plugin_default_manager.c	2010-06-30 21:52:07 UTC (rev 24155)
@@ -7,50 +7,50 @@
 #include <stdio.h>
 #include <dlfcn.h>
 #include <plugin_manager.h>
-#include <plugin_factory.h>
+#include <plugin_loader.h>
 #include "plugin_default_manager.h"
-#include "plugin_default_factory.h"
+#include "plugin_default_loader.h"
 #ifdef CONFIG_IN_YAML
 #include "yaml_parser.h"
 #else
 #include "krb5_parser.h"
 #endif
 
-static plugin_factory_descr _table[] = {
-        {"plugin_default_factory", plugin_factory_get_instance},
+static plugin_loader_descr _table[] = {
+        {"plugin_default_loader", plugin_loader_get_instance},
         {NULL, NULL}
 };
 
-static factory_handle
-_load_dynamic_factory (const char* factory_name, const char* path)
+static loader_handle
+_load_dynamic_loader (const char* loader_name, const char* path)
 {
-    factory_handle handle;
+    loader_handle handle;
     void *h_dl = dlopen(path, RTLD_LAZY);
-    factory_handle (*plugin_d_factory_get_instance)() = NULL;
+    loader_handle (*plugin_d_loader_get_instance)() = NULL;
 #ifdef DEBUG_PLUGINS
-    printf("plugins:  _load_dynamic_factory %s\n", factory_name);
+    printf("plugins:  _load_dynamic_loader %s\n", loader_name);
 #endif
     if(h_dl){
-        plugin_d_factory_get_instance = dlsym(h_dl, "plugin_factory_get_instance");
-        handle = plugin_d_factory_get_instance();
+        plugin_d_loader_get_instance = dlsym(h_dl, "plugin_loader_get_instance");
+        handle = plugin_d_loader_get_instance();
     }
 
     return handle;
 }
 
-static factory_handle
-_load_static_factory (const char* factory_name)
+static loader_handle
+_load_static_loader (const char* loader_name)
 {
-    factory_handle handle;
-    plugin_factory_descr *ptr = NULL;
+    loader_handle handle;
+    plugin_loader_descr *ptr = NULL;
 #ifdef DEBUG_PLUGINS
-    printf("plugins:  _load_static_factory %s\n", factory_name);
+    printf("plugins:  _load_static_loader %s\n", loader_name);
 #endif
 
     handle.api = NULL;
-    for( ptr = _table; ptr->factory_name != NULL; ptr++) {
-        if (strcmp(ptr->factory_name, factory_name) == 0) {
-            handle = ptr->factory_creator();
+    for( ptr = _table; ptr->loader_name != NULL; ptr++) {
+        if (strcmp(ptr->loader_name, loader_name) == 0) {
+            handle = ptr->loader_creator();
             break;
         }
     }
@@ -60,20 +60,20 @@
 #define DYNAMIC_TYPE "dynamic"
 #define EMPTY_STR ""
 
-static factory_handle
-_load_factory(const char* factory_name, const char* factory_type, const char* factory_path)
+static loader_handle
+_load_loader(const char* loader_name, const char* loader_type, const char* loader_path)
 {
-    factory_handle handle;
-    if(strncmp(factory_type, BUILTIN_TYPE, strlen(BUILTIN_TYPE)) == 0){
-        handle = _load_static_factory(factory_name);
-    } else if(strncmp(factory_type, DYNAMIC_TYPE, strlen(DYNAMIC_TYPE)) == 0){
-        handle = _load_dynamic_factory(factory_name, factory_path);
+    loader_handle handle;
+    if(strncmp(loader_type, BUILTIN_TYPE, strlen(BUILTIN_TYPE)) == 0){
+        handle = _load_static_loader(loader_name);
+    } else if(strncmp(loader_type, DYNAMIC_TYPE, strlen(DYNAMIC_TYPE)) == 0){
+        handle = _load_dynamic_loader(loader_name, loader_path);
     } else {
-        if (factory_type)
-            printf("plugins: unknown factory_type %s\n", factory_type);
+        if (loader_type)
+            printf("plugins: unknown loader_type %s\n", loader_type);
         else {
-            printf("plugins: no factory_type found. Defaulting to built-in\n");
-            handle = _load_static_factory(factory_name);
+            printf("plugins: no loader_type found. Defaulting to built-in\n");
+            handle = _load_static_loader(loader_name);
         }
     }
     return handle;
@@ -123,11 +123,11 @@
 
 static plhandle
 _create_api(const char* plugin_name, const char* plugin_id,
-            const char* factory_name, const char* factory_type, const char* factory_path
+            const char* loader_name, const char* loader_type, const char* loader_path
             /*, config_node* properties*/)
 {
     plhandle p_handle;
-    factory_handle f_handle = _load_factory(factory_name, factory_type, factory_path);
+    loader_handle f_handle = _load_loader(loader_name, loader_type, loader_path);
 #ifdef DEBUG_PLUGINS
     printf("plugins:  _create_api\n");
 #endif
@@ -202,9 +202,9 @@
     config_node* p = NULL;
     config_node* properties = NULL;
     const char* plugin_api = NULL;
-    const char* factory_name = NULL;
-    const char* factory_type = NULL;
-    const char* factory_path = NULL;
+    const char* loader_name = NULL;
+    const char* loader_type = NULL;
+    const char* loader_path = NULL;
     const char* plugin_name = NULL;
     const char* plugin_type = NULL;
     const char* plugin_id = NULL;
@@ -219,12 +219,12 @@
         } else if(strcmp(p->node_name, "constructor") == 0) {
             config_node* q = NULL;
             for(q = p->node_value.seq_value.start; q != NULL; q = q->next) {
-                if(strcmp(q->node_name, "factory_name") == 0) {
-                    factory_name = q->node_value.str_value;
-                } else if(strcmp(q->node_name, "factory_type") == 0) {
-                    factory_type = q->node_value.str_value;
-                } else if(strcmp(q->node_name, "factory_path") == 0) {
-                    factory_path = q->node_value.str_value;
+                if(strcmp(q->node_name, "loader_name") == 0) {
+                    loader_name = q->node_value.str_value;
+                } else if(strcmp(q->node_name, "loader_type") == 0) {
+                    loader_type = q->node_value.str_value;
+                } else if(strcmp(q->node_name, "loader_path") == 0) {
+                    loader_path = q->node_value.str_value;
                 } else if(strcmp(q->node_name, "plugin_name") == 0) {
                     plugin_name = q->node_value.str_value;
                 } else if(strcmp(q->node_name, "plugin_id") == 0) {
@@ -239,8 +239,8 @@
 #ifdef DEBUG_PLUGINS
     printf("**Start**\n");
     printf("api=%s\n", plugin_api);
-    printf("factory=%s\n", factory_name);
-    printf("factory_type=%s\n", factory_type);
+    printf("loader=%s\n", loader_name);
+    printf("loader_type=%s\n", loader_type);
     printf("plugin_name=%s\n", plugin_name);
     printf("plugin_type=%s\n", plugin_type);
     printf("plugin_path=%s\n", plugin_path);
@@ -249,22 +249,22 @@
 #endif
 
     handle = _create_api(plugin_name, plugin_id,
-                         factory_name, factory_type, factory_path /*, properties*/);
+                         loader_name, loader_type, loader_path /*, properties*/);
     if(handle.api != NULL) {
         ret = _register_api(mdata->registry,plugin_api, plugin_type, handle);
         if (ret != API_REGISTER_OK) {
 #ifdef DEBUG_PLUGINS
-            printf("Failed to register %s for %s(factory=%s,plugin_type=%s)\n",
-                    plugin_name, plugin_api, factory_name, plugin_type);
+            printf("Failed to register %s for %s(loader=%s,plugin_type=%s)\n",
+                    plugin_name, plugin_api, loader_name, plugin_type);
 #endif
         }
         else
-            printf("SUCCESS to register %s for %s(factory=%s,plugin_type=%s)\n",
-                    plugin_name, plugin_api, factory_name, plugin_type);
+            printf("SUCCESS to register %s for %s(loader=%s,plugin_type=%s)\n",
+                    plugin_name, plugin_api, loader_name, plugin_type);
     } else {
 #ifdef DEBUG_PLUGINS
-        printf("Failed to configure plugin: api=%s, plugin_name=%s,factory=%s\n",
-                plugin_api, plugin_name, factory_name);
+        printf("Failed to configure plugin: api=%s, plugin_name=%s,loader=%s\n",
+                plugin_api, plugin_name, loader_name);
 #endif
     }
     return ret;
@@ -308,7 +308,7 @@
     profile_filespec_t *files = NULL;
     profile_t profile;
     const char  *hierarchy[4];
-    char **factory_name, **factory_type, **factory_path, **plugin_name, **plugin_type;
+    char **loader_name, **loader_type, **loader_path, **plugin_name, **plugin_type;
     char** plugin_id;
     char** plugin_api;
     char *f_path = NULL;
@@ -384,22 +384,22 @@
         hierarchy[3] = 0;
         retval = profile_get_values(profile, hierarchy, &plugin_id);
 
-        /* factory_name */
-        hierarchy[2] = "plugin_factory_name";
+        /* loader_name */
+        hierarchy[2] = "plugin_loader_name";
         hierarchy[3] = 0;
-        retval = profile_get_values(profile, hierarchy, &factory_name);
+        retval = profile_get_values(profile, hierarchy, &loader_name);
 
-        /* factory_type */
-        hierarchy[2] = "plugin_factory_type";
+        /* loader_type */
+        hierarchy[2] = "plugin_loader_type";
         hierarchy[3] = 0;
-        retval = profile_get_values(profile, hierarchy, &factory_type);
+        retval = profile_get_values(profile, hierarchy, &loader_type);
 
-        /* factory_path */
-        hierarchy[2] = "plugin_factory_path";
+        /* loader_path */
+        hierarchy[2] = "plugin_loader_path";
         hierarchy[3] = 0;
-        retval = profile_get_values(profile, hierarchy, &factory_path);
+        retval = profile_get_values(profile, hierarchy, &loader_path);
         if(!retval)
-           f_path = *factory_path;
+           f_path = *loader_path;
         else
            f_path = NULL;
 
@@ -407,9 +407,9 @@
 #ifdef DEBUG_PLUGINS
         printf("ZH plugins:  >>>\n");
         printf("api=%s\n", *plugin_api);
-        printf("factory=%s\n", *factory_name);
-        printf("factory_type=%s\n", *factory_type);
-        if (f_path) printf("factory_path=%s\n", f_path);
+        printf("loader=%s\n", *loader_name);
+        printf("loader_type=%s\n", *loader_type);
+        if (f_path) printf("loader_path=%s\n", f_path);
         printf("plugin_name=%s\n", *plugin_name);
         printf("plugin_type=%s\n",*plugin_type);
         printf("plugin_id=%s\n", *plugin_id);
@@ -417,13 +417,13 @@
 #endif
 
         handle = _create_api(*plugin_name, *plugin_id,
-                             *factory_name, *factory_type, f_path /*, properties*/);
+                             *loader_name, *loader_type, f_path /*, properties*/);
         if(handle.api != NULL) {
             retval = _register_api(mdata->registry,*plugin_api, *plugin_type, handle);
             if(retval != API_REGISTER_OK) {
 #ifdef DEBUG_PLUGINS
-                printf("plugins: Failed to register %s for %s(factory=%s,plugin_type=%s) ret=%i\n",
-                       *plugin_name, *plugin_api, *factory_name, *plugin_type, retval);
+                printf("plugins: Failed to register %s for %s(loader=%s,plugin_type=%s) ret=%i\n",
+                       *plugin_name, *plugin_api, *loader_name, *plugin_type, retval);
 #endif
             } else {
 #ifdef DEBUG_PLUGINS
@@ -432,8 +432,8 @@
             }
         } else {
 #ifdef DEBUG_PLUGINS
-            printf("plugins: Failed to configure plugin: api=%s, plugin_name=%s,factory=%s\n",
-                    *plugin_api, *plugin_name, *factory_name);
+            printf("plugins: Failed to configure plugin: api=%s, plugin_name=%s,loader=%s\n",
+                    *plugin_api, *plugin_name, *loader_name);
 #endif
         }
 

Modified: branches/plugins/src/plugin_core/impl/plugin_impl.exports
===================================================================
--- branches/plugins/src/plugin_core/impl/plugin_impl.exports	2010-06-30 21:05:43 UTC (rev 24154)
+++ branches/plugins/src/plugin_core/impl/plugin_impl.exports	2010-06-30 21:52:07 UTC (rev 24155)
@@ -1,2 +1,2 @@
-plugin_default_factory_get_instance
+plugin_default_loader_get_instance
 plugin_default_manager_get_instance

Modified: branches/plugins/src/plugin_core/libplugin_core.exports
===================================================================
--- branches/plugins/src/plugin_core/libplugin_core.exports	2010-06-30 21:05:43 UTC (rev 24154)
+++ branches/plugins/src/plugin_core/libplugin_core.exports	2010-06-30 21:52:07 UTC (rev 24155)
@@ -1,4 +1,4 @@
-get_factory_content
+get_loader_content
 plugin_manager_configure
 plugin_manager_get_service
 plugin_manager_start

Copied: branches/plugins/src/plugin_core/plugin_loader.c (from rev 24153, branches/plugins/src/plugin_core/plugin_factory.c)
===================================================================
--- branches/plugins/src/plugin_core/plugin_loader.c	                        (rev 0)
+++ branches/plugins/src/plugin_core/plugin_loader.c	2010-06-30 21:52:07 UTC (rev 24155)
@@ -0,0 +1,27 @@
+/*
+ * plugin_loader.c
+ *
+ */
+
+#include <string.h>
+#include "plugin_loader.h"
+
+void
+get_loader_content (loader_handle handle, const char* container[])
+{
+    plugin_loader* loader = (plugin_loader*) handle.api;
+    if (loader != NULL) {
+        return loader->get_loader_content(container);
+    }
+    return;
+}
+
+plhandle
+create_api (loader_handle handle, const char* plugin_name)
+{
+    plugin_loader* loader = (plugin_loader*) handle.api;
+    if (loader != NULL) {
+        return loader->create_api(plugin_name);
+    }
+    return;
+}


Added: svn:mergeinfo
   + 

Copied: branches/plugins/src/plugin_core/plugin_loader.h (from rev 24153, branches/plugins/src/plugin_core/plugin_factory.h)
===================================================================
--- branches/plugins/src/plugin_core/plugin_loader.h	                        (rev 0)
+++ branches/plugins/src/plugin_core/plugin_loader.h	2010-06-30 21:52:07 UTC (rev 24155)
@@ -0,0 +1,34 @@
+/*
+ * plugin_loader.h
+ *
+ */
+#ifndef PLUGIN_LOADER_H_
+#define PLUGIN_LOADER_H_
+
+#include "plugin_manager.h"
+
+/* Plugin loader API */
+typedef struct {
+	void *api;
+} loader_handle;
+
+typedef struct {
+	const char* loader_name;
+	loader_handle (*loader_creator)();
+} plugin_loader_descr;
+
+typedef struct {
+	const char* plugin_name;
+	plhandle (*plugin_creator)();
+} plugin_descr;
+
+typedef struct {
+	void (*get_loader_content)(const char* []);
+	plhandle (*create_api)(const char*);
+} plugin_loader;
+
+/* Utility functions */
+void get_loader_content(loader_handle handle, const char* container[]);
+plhandle create_api(loader_handle handle, const char* plugin_name);
+
+#endif /* PLUGIN_LOADER_H_ */


Added: svn:mergeinfo
   + 

Modified: branches/plugins/src/plugin_dynamic/Makefile.in
===================================================================
--- branches/plugins/src/plugin_dynamic/Makefile.in	2010-06-30 21:05:43 UTC (rev 24154)
+++ branches/plugins/src/plugin_dynamic/Makefile.in	2010-06-30 21:52:07 UTC (rev 24155)
@@ -26,9 +26,9 @@
 
 SHLIB_EXPLIBS=  $(LIBS_UTILS)
  
-STLIBOBJS= plugin_dyn_factory.o $(srcdir)/../plugins/pwd_qlty/plugin_pwd_qlty_DYN/plugin_pwd_qlty_DYN_impl.o	
+STLIBOBJS= plugin_dyn_loader.o $(srcdir)/../plugins/pwd_qlty/plugin_pwd_qlty_DYN/plugin_pwd_qlty_DYN_impl.o	
 
-SRCS= plugin_dyn_factory.c $(srcdir)/../plugins/pwd_qlty/plugin_pwd_qlty_DYN/plugin_pwd_qlty_DYN_impl.c
+SRCS= plugin_dyn_loader.c $(srcdir)/../plugins/pwd_qlty/plugin_pwd_qlty_DYN/plugin_pwd_qlty_DYN_impl.c
 
 all-unix:: all-liblinks
 install-unix:: install-libs

Modified: branches/plugins/src/plugin_dynamic/deps
===================================================================
--- branches/plugins/src/plugin_dynamic/deps	2010-06-30 21:05:43 UTC (rev 24154)
+++ branches/plugins/src/plugin_dynamic/deps	2010-06-30 21:52:07 UTC (rev 24155)
@@ -1,11 +1,11 @@
-plugin_dyn_factory.so plugin_dyn_factory.po $(OUTPRE)plugin_dyn_factory.$(OBJEXT): \
-  $(BUILDTOP)/include/krb5/krb5.h $(COM_ERR_DEPS) $(top_srcdir)/plugin_core/plugin_factory.h \
+plugin_dyn_loader.so plugin_dyn_loader.po $(OUTPRE)plugin_dyn_loader.$(OBJEXT): \
+  $(BUILDTOP)/include/krb5/krb5.h $(COM_ERR_DEPS) $(top_srcdir)/plugin_core/plugin_loader.h \
   $(top_srcdir)/plugin_core/plugin_manager.h \
-  $(top_srcdir)/plugin_dynamic/plugin_dyn_factory.h \
-  plugin_dyn_factory.c
+  $(top_srcdir)/plugin_dynamic/plugin_dyn_loader.h \
+  plugin_dyn_loader.c
 plugin_pwd_qlty_DYN_impl.so plugin_pwd_qlty_DYN_impl.po $(OUTPRE)plugin_pwd_qlty_DYN_impl.$(OBJEXT): \
   $(BUILDTOP)/include/krb5/krb5.h $(COM_ERR_DEPS) \
   $(top_srcdir)/plugins/pwd_qlty/plugin_pwd_qlty_DYN/plugin_pwd_qlty_DYN_impl.h \
   $(top_srcdir)/plugin_core/plugin_manager.h \
-  $(top_srcdir)/plugin_core/plugin_factory.h \
+  $(top_srcdir)/plugin_core/plugin_loader.h \
   plugin_pwd_qlty_DYN_impl.c

Modified: branches/plugins/src/plugin_dynamic/libplugin_dynamic.exports
===================================================================
--- branches/plugins/src/plugin_dynamic/libplugin_dynamic.exports	2010-06-30 21:05:43 UTC (rev 24154)
+++ branches/plugins/src/plugin_dynamic/libplugin_dynamic.exports	2010-06-30 21:52:07 UTC (rev 24155)
@@ -1,2 +1,2 @@
-plugin_factory_get_instance
+plugin_loader_get_instance
 plugin_pwd_qlty_DYN_create

Copied: branches/plugins/src/plugin_dynamic/plugin_dyn_loader.c (from rev 24153, branches/plugins/src/plugin_dynamic/plugin_dyn_factory.c)
===================================================================
--- branches/plugins/src/plugin_dynamic/plugin_dyn_loader.c	                        (rev 0)
+++ branches/plugins/src/plugin_dynamic/plugin_dyn_loader.c	2010-06-30 21:52:07 UTC (rev 24155)
@@ -0,0 +1,66 @@
+/*
+ * plugin_dyn_loader.c
+ *
+ */
+#include <string.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+#include <plugin_manager.h>
+#include <plugin_loader.h>
+#include <plugin_dyn_loader.h>
+
+static plugin_loader* _dyn_loader_instance = NULL;
+
+/* dynamic  plugins */
+static plugin_descr  plugin_dyn_loader_table[] = {
+        {"plugin_pwd_qlty_DYN",   plugin_pwd_qlty_DYN_create},
+        {NULL,NULL}
+};
+
+static void
+_get_loader_content (const char* container[]) {
+    plugin_descr *ptr = NULL;
+    int i = 0;
+    for( ptr = plugin_dyn_loader_table; ptr->plugin_name != NULL; ptr++,i++) {
+        container[i] = ptr->plugin_name;
+    }
+}
+
+static plhandle
+_create_api (const char* plugin_name)
+{
+    plhandle handle;
+    plugin_descr *ptr = NULL;
+
+    memset(&handle, 0, sizeof(handle));
+    if(plugin_name){
+        handle.api = NULL;
+        for( ptr = plugin_dyn_loader_table; ptr->plugin_name != NULL; ptr++) {
+            if (strcmp(ptr->plugin_name, plugin_name) == 0) {
+                handle = ptr->plugin_creator();
+                break;
+            }
+        }
+    }
+    return handle;
+}
+
+
+loader_handle
+plugin_loader_get_instance()
+{
+    plugin_loader* instance = _dyn_loader_instance;
+    loader_handle handle;
+
+    if(_dyn_loader_instance == NULL) {
+        instance = (plugin_loader*) malloc(sizeof(plugin_loader));
+        memset(instance, 0, sizeof(plugin_loader));
+        instance->get_loader_content = _get_loader_content;
+        instance->create_api = _create_api;
+        _dyn_loader_instance = instance;
+    }
+    handle.api = instance;
+    return (handle);
+}
+


Added: svn:mergeinfo
   + 

Copied: branches/plugins/src/plugin_dynamic/plugin_dyn_loader.h (from rev 24153, branches/plugins/src/plugin_dynamic/plugin_dyn_factory.h)
===================================================================
--- branches/plugins/src/plugin_dynamic/plugin_dyn_loader.h	                        (rev 0)
+++ branches/plugins/src/plugin_dynamic/plugin_dyn_loader.h	2010-06-30 21:52:07 UTC (rev 24155)
@@ -0,0 +1,14 @@
+/*
+ * plugin_dyn_loader.h
+ *
+ */
+
+#ifndef PLUGIN_DYN_LOADER_H_
+#define PLUGIN_DYN_LOADER_H_
+
+#include <plugin_loader.h>
+#include "plugin_pwd_qlty_DYN_impl.h"
+
+loader_handle plugin_loader_get_instance(void);
+
+#endif /* PLUGIN_DYN_LOADER_H_ */


Added: svn:mergeinfo
   + 

Modified: branches/plugins/src/plugins/pa/deps
===================================================================
--- branches/plugins/src/plugins/pa/deps	2010-06-30 21:05:43 UTC (rev 24154)
+++ branches/plugins/src/plugins/pa/deps	2010-06-30 21:52:07 UTC (rev 24155)
@@ -4,10 +4,10 @@
 plugin_pa.so plugin_pa.po $(OUTPRE)plugin_pa.$(OBJEXT): \
   $(BUILDTOP)/include/krb5/krb5.h $(COM_ERR_DEPS) $(top_srcdir)/plugins/pa/plugin_pa.h \
   $(top_srcdir)/plugin_core/plugin_manager.h \
-  $(top_srcdir)/plugin_core/plugin_factory.h \
+  $(top_srcdir)/plugin_core/plugin_loader.h \
   plugin_pa.c
 plugin_pa_impl.so plugin_pa_impl.po $(OUTPRE)plugin_pa_impl.$(OBJEXT): \
   $(BUILDTOP)/include/krb5/krb5.h $(COM_ERR_DEPS) $(top_srcdir)/plugins/pa/plugin_pa_impl.h \
   $(top_srcdir)/plugin_core/plugin_manager.h \
-  $(top_srcdir)/plugin_core/plugin_factory.h \
+  $(top_srcdir)/plugin_core/plugin_loader.h \
   plugin_pa_impl.c

Modified: branches/plugins/src/plugins/pa/encrypted_challenge/deps
===================================================================
--- branches/plugins/src/plugins/pa/encrypted_challenge/deps	2010-06-30 21:05:43 UTC (rev 24154)
+++ branches/plugins/src/plugins/pa/encrypted_challenge/deps	2010-06-30 21:52:07 UTC (rev 24155)
@@ -5,6 +5,6 @@
   $(BUILDTOP)/include/krb5/krb5.h $(COM_ERR_DEPS) $(top_srcdir)/plugins/pa/encrypted_challenge/plugin_pa_impl.h \
   $(top_srcdir)/plugins/preauth/fast_factor.h \
   $(top_srcdir)/plugin_core/plugin_manager.h \
-  $(top_srcdir)/plugin_core/plugin_factory.h \
+  $(top_srcdir)/plugin_core/plugin_loader.h \
   plugin_pa_impl.c
 

Modified: branches/plugins/src/plugins/pwd_qlty/deps
===================================================================
--- branches/plugins/src/plugins/pwd_qlty/deps	2010-06-30 21:05:43 UTC (rev 24154)
+++ branches/plugins/src/plugins/pwd_qlty/deps	2010-06-30 21:52:07 UTC (rev 24155)
@@ -4,6 +4,6 @@
 plugin_pwd_qlty.so plugin_pwd_qlty.po $(OUTPRE)plugin_pwd_qlty.$(OBJEXT): \
   $(BUILDTOP)/include/krb5/krb5.h $(COM_ERR_DEPS) $(top_srcdir)/plugins/pwd_qlty/plugin_pwd_qlty.h \
   $(top_srcdir)/plugin_core/plugin_manager.h \
-  $(top_srcdir)/plugin_core/plugin_factory.h \
+  $(top_srcdir)/plugin_core/plugin_loader.h \
   $(top_srcdir)/lib/kadm5/admin.h \
   plugin_pwd_qlty.c

Modified: branches/plugins/src/plugins/pwd_qlty/plugin_pwd_qlty_X/deps
===================================================================
--- branches/plugins/src/plugins/pwd_qlty/plugin_pwd_qlty_X/deps	2010-06-30 21:05:43 UTC (rev 24154)
+++ branches/plugins/src/plugins/pwd_qlty/plugin_pwd_qlty_X/deps	2010-06-30 21:52:07 UTC (rev 24155)
@@ -6,6 +6,6 @@
   $(top_srcdir)/plugins/pwd_qlty/plugin_pwd_qlty_X/plugin_pwd_qlty_X_impl.h \
   $(top_srcdir)/lib/kadm5/admin.h \
   $(top_srcdir)/plugin_core/plugin_manager.h \
-  $(top_srcdir)/plugin_core/plugin_factory.h \
+  $(top_srcdir)/plugin_core/plugin_loader.h \
   plugin_pwd_qlty_X_impl.c
 

Modified: branches/plugins/src/plugins/pwd_qlty/plugin_pwd_qlty_krb/deps
===================================================================
--- branches/plugins/src/plugins/pwd_qlty/plugin_pwd_qlty_krb/deps	2010-06-30 21:05:43 UTC (rev 24154)
+++ branches/plugins/src/plugins/pwd_qlty/plugin_pwd_qlty_krb/deps	2010-06-30 21:52:07 UTC (rev 24155)
@@ -6,6 +6,6 @@
   $(top_srcdir)/plugins/pwd_qlty/plugin_pwd_qlty_krb/plugin_pwd_qlty_krb_impl.h \
   $(top_srcdir)/lib/kadm5/admin.h \
   $(top_srcdir)/plugin_core/plugin_manager.h \
-  $(top_srcdir)/plugin_core/plugin_factory.h \
+  $(top_srcdir)/plugin_core/plugin_loader.h \
   plugin_pwd_qlty_krb_impl.c
 

Property changes on: branches/plugins/src/plugin_core/impl/plugin_default_loader.c
___________________________________________________________________
Property changes on: branches/plugins/src/plugin_core/impl/plugin_default_loader.h
___________________________________________________________________
Property changes on: branches/plugins/src/plugin_core/plugin_loader.c
___________________________________________________________________
Property changes on: branches/plugins/src/plugin_core/plugin_loader.h
___________________________________________________________________
Property changes on: branches/plugins/src/plugin_dynamic/plugin_dyn_loader.c
___________________________________________________________________
Property changes on: branches/plugins/src/plugin_dynamic/plugin_dyn_loader.h
___________________________________________________________________



More information about the cvs-krb5 mailing list