From c908b620b649e6fe0b293a732184f21598a90198 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Ale=C5=A1=20K=C5=99enek?= Date: Fri, 8 Apr 2005 12:08:12 +0000 Subject: [PATCH] *** empty log message *** --- org.glite.jp.primary/src/builtin_plugins.h | 7 ++++ org.glite.jp.primary/src/file_plugin.c | 65 ++++++++++++++++++++++++++++++ 2 files changed, 72 insertions(+) create mode 100644 org.glite.jp.primary/src/builtin_plugins.h create mode 100644 org.glite.jp.primary/src/file_plugin.c diff --git a/org.glite.jp.primary/src/builtin_plugins.h b/org.glite.jp.primary/src/builtin_plugins.h new file mode 100644 index 0000000..3b2c201 --- /dev/null +++ b/org.glite.jp.primary/src/builtin_plugins.h @@ -0,0 +1,7 @@ + +#define GLITE_JP_FILETYPE_TAGS "urn:org.glite.jp.primary:tags" +#define GLITE_JP_FILETYPE_LB "urn:org.glite.jp.primary:lb" +#define GLITE_JP_FILETYPE_ISB "urn:org.glite.jp.primary:isb" +#define GLITE_JP_FILETYPE_OSB "urn:org.glite.jp.primary:osb" + +#define GLITE_JP_FPLUG_TAGS_APPEND 0 diff --git a/org.glite.jp.primary/src/file_plugin.c b/org.glite.jp.primary/src/file_plugin.c new file mode 100644 index 0000000..ec3db35 --- /dev/null +++ b/org.glite.jp.primary/src/file_plugin.c @@ -0,0 +1,65 @@ +#include +#include +#include +#include + +#include +#include "file_plugin.h" + +static struct option opts[] = { + { "plugin", 1, NULL, 'p' }, + { NULL } +}; + +static void *loadit(glite_jp_context_t ctx,const char *so) +{ + void *dl_handle = dlopen(so,RTLD_NOW); + glite_jp_error_t err; + char *e; + + glite_jpps_fplug_init_t init; + + if (!dl_handle) { + err.source = "dlopen()"; + err.code = EINVAL; + err.desc = dlerror(); + glite_jp_stack_error(ctx,&err); + return NULL; + } + + dlerror(); + init = dlsym(dl_handle,"init"); + e = dlerror(); + if (e) { + char buf[300]; + snprintf(buf,sizeof buf,"dlsym(\"%s\",\"init\")",so); + buf[299] = 0; + err.source = buf; + err.code = ENOENT; + err.desc = e; + } + + /* FIXME: zavolat init */ + +} + +int glite_jpps_fplug_load(glite_jp_context_t ctx,int *argc,char **argv) +{ + int opt; + void *fctx; + + while ((opt = getopt_long(*argc,argv,"p:",opts,NULL)) != EOF) switch (opt) { + case 'p': fctx = loadit(ctx,optarg); + if (!fctx) return -1; + default: break; + } + + return 0; +} + +int glite_jpps_fplug_lookup(glite_jp_context_t ctx,const char *uri, glite_jpps_fplug_data_t *plugin_data) +{ + /* TODO */ + return 0; +} + -- 1.8.2.3