DEBUG:=-g -O0 -DDEBUG
-CFLAGS:=${DEBUG} -I. -I${top_srcdir}/interface -I${top_srcdir}/src -I${gsoap_prefix}/include -I${gsoap_prefix} -I${stagedir}/include -I${classads_prefix}/include -I${libtar_prefix}/include ${GLOBUS_CFLAGS}
+CFLAGS:=${DEBUG} -I. -I${top_srcdir}/src -I${gsoap_prefix}/include -I${gsoap_prefix} -I${stagedir}/include -I${classads_prefix}/include -I${libtar_prefix}/include ${GLOBUS_CFLAGS}
# 3.1 CFLAGS:=${DEBUG} -I. -I${top_srcdir}/interface -I${top_srcdir}/src -I${gsoap_prefix}/include -I${gsoap_prefix} -I${stagedir}/include ${GLOBUS_CFLAGS} -I${mysql_prefix}/include -I${mysql_prefix}/include/mysql -I${classads_prefix}/include -I${libtar_prefix}/include
LDFLAGS:=-L${stagedir}/lib
plugins:=glite-jp-ftpdauth.la glite-jp-classad.la glite-jp-sandbox.la
-HDRS_I=file_plugin.h
-HDRS_S=builtin_plugins.h backend.h feed.h utils.h
-
SRCS:= bones_server.c soap_ops.c \
new_ftp_backend.c file_plugin.c utils.c\
feed.c authz.c attrs.c \
${INSTALL} -m 755 ${daemon} ${PREFIX}/bin
${INSTALL} -m 755 jpps-test ${PREFIX}/examples/glite-jp-primary-test
${INSTALL} -m 755 ${top_srcdir}/examples/getjobattr.pl ${PREFIX}/examples/glite-jpps-getjobattr.pl
- if [ x${DOSTAGE} = xyes ]; then \
- mkdir -p ${PREFIX}/include/${globalprefix}/${jpprefix} ; \
- (cd ${top_srcdir}/interface && install -m 644 ${HDRS_I} ${PREFIX}/include/${globalprefix}/${jpprefix}) ; \
- (cd ${top_srcdir}/src && install -m 644 ${HDRS_S} ${PREFIX}/include/${globalprefix}/${jpprefix}) ; \
- fi
for plugin in ${plugins}; do \
${INSTALL} -m 755 $$plugin ${PREFIX}/lib; \
done
+++ /dev/null
-#ifndef GLITE_JP_FILEPLUGIN_H
-#define GLITE_JP_FILEPLUGIN_H
-
-/** Methods of the file plugin. */
-
-typedef struct _glite_jpps_fplug_op_t {
-
-/** Open a file.
-\param[in] fpctx Context of the plugin, returned by its init.
-\param[in] bhandle Handle of the file via JPPS backend.
-\param[in] uri URI (type) of the opened file.
-\param[out] handle Handle to the opened file structure, to be passed to other plugin functions.
-*/
- int (*open)(void *fpctx,void *bhandle,const char *uri,void **handle);
-/** Open from a string.
-\param[in] fpctx Context of the plugin, returned by its init.
-\param[in] str The string to use.
-\param[in] uri URI (type) of the string
-\param[in] ns namespace to handle
-\param[out] handle Handle to the opened file structure, to be passed to other plugin functions.
-*/
-
- int (*open_str)(void *fpctx,const char *str,const char *uri,const char *ns,void **handle);
-
-/** Close the file. Free data associated to a handle */
- int (*close)(void *fpctx,void *handle);
-
-/** "Preprocess" the file -- this function is called once after the file is commited */
- int (*filecom)(void *fpctx,void *handle);
-
-/** Retrieve value(s) of an attribute.
-\param[in] fpctx Plugin context.
-\param[in] handle Handle of the opened file.
-\param[in] ns Namespace of queried attribute.
-\param[in] attr Queried attribute.
-\param[out] attrval GLITE_JP_ATTR_UNDEF-terminated list of value(s) of the attribute.
- If there are more and there is an interpretation of their order
- they must be sorted, eg. current value of tag is the last one.
-\retval 0 success
-\retval ENOSYS this attribute is not defined by this type of file
-\retval ENOENT no value is present
-*/
- int (*attr)(void *fpctx,void *handle, const char *attr,glite_jp_attrval_t **attrval);
-
-/** File type specific operation.
-\param[in] fpctx Plugin context.
-\param[in] handle Handle of the opened file.
-\param[in] oper Code of the operation, specific for a concrete plugin.
-*/
- int (*generic)(void *fpctx,void *handle,int oper,...);
-
-} glite_jpps_fplug_op_t;
-
-/** Data describing a plugin. */
-typedef struct _glite_jpps_fplug_data_t {
- void *fpctx; /**< Context passed to plugin operations. */
- char **uris; /**< NULL-terminated list of file types (URIs)
- handled by the plugin. */
- char **classes; /**< The same as uris but filesystem-friendly
- (can be used to construct file names).*/
- char **namespaces; /**< Which attribute namespaces this plugin handles. */
-
- glite_jpps_fplug_op_t ops; /**< Plugin operations. */
-} glite_jpps_fplug_data_t;
-
-/** Initialisation function of the plugin.
- Called after dlopen(), must be named "init".
-\param[in] ctx JPPS context
-\param[out] data filled-in plugin data
-*/
-
-typedef int (*glite_jpps_fplug_init_t)(
- glite_jp_context_t ctx,
- glite_jpps_fplug_data_t *plugin_data
-);
-
-
-
-
-/* XXX: not really public interface follows */
-
-int glite_jpps_fplug_load(glite_jp_context_t ctx,int argc,char **argv);
-int glite_jpps_fplug_lookup(glite_jp_context_t ctx,const char *uri, glite_jpps_fplug_data_t ***plugin_data);
-int glite_jpps_fplug_lookup_byclass(glite_jp_context_t, const char *class,glite_jpps_fplug_data_t ***plugin_data);
-
-#endif /* GLITE_JP_FILEPLUGIN_H */
#include <stdlib.h>
#include <stdio.h>
#include <fcntl.h>
+#include <sys/stat.h>
#include "glite/lbu/trio.h"
#include "glite/jp/types.h"
#include "glite/jp/attr.h"
+#include "glite/jp/backend.h"
+#include "glite/jp/file_plugin.h"
#include "feed.h"
-#include "backend.h"
#include "attrs.h"
-#include "utils.h"
-#include "file_plugin.h"
#include "builtin_plugins.h"
static struct {
return nout+nin;
}
-void process_files(glite_jp_context_t ctx, const char *job, glite_jp_attrval_t** out, int* nout, const char* attr, const glite_jpps_fplug_data_t* plugin, const char* class, const char* uri, const char **opened_class, const char **opened_file, void **op_handle, void **of_handle){
+static void process_files(glite_jp_context_t ctx, const char *job, glite_jp_attrval_t** out, int* nout, const char* attr, const glite_jpps_fplug_data_t* plugin, const char* class, const char* uri, char **opened_class, char **opened_file, void **op_handle, void **of_handle){
void *ph, *beh;
char** names = NULL;
int nnames;
#include "glite/jp/types.h"
#include "glite/jp/context.h"
+#include "glite/jp/file_plugin.h"
#include "glite/lbu/srvbones.h"
#include "glite/security/glite_gss.h"
#include "glite/security/glite_gsplugin.h"
#include "feed.h"
-#include "backend.h"
-#include "file_plugin.h"
+#include "backend_private.h"
#include "soap_version.h"
#include "jpps_H.h"
#include <ctype.h>
#include <cclassad.h>
#include <errno.h>
+#include <sys/stat.h>
/*
#include "glite/lb/context.h"
#include "glite/jp/attr.h"
#include "glite/jp/known_attr.h"
-#include "file_plugin.h"
+#include "glite/jp/file_plugin.h"
+#include "glite/jp/backend.h"
+
#include "builtin_plugins.h"
-#include "backend.h"
//#define INITIAL_NUMBER_EVENTS 100
//#define INITIAL_NUMBER_STATES EDG_WLL_NUMBER_OF_STATCODES
#include "glite/jp/context.h"
#include "glite/jp/strmd5.h"
#include "glite/jp/known_attr.h"
+#include "glite/jp/file_plugin.h"
+
#include "feed.h"
-#include "file_plugin.h"
#include "builtin_plugins.h"
#include "is_client.h"
-#include "backend.h"
+#include "backend_private.h"
extern pid_t master;
#include "feed.h"
#include "tags.h"
-#include "backend.h"
+#include "backend_private.h"
#include "jpps_H.h" /* XXX: SOAP_TYPE___jpsrv__GetJob */
#include <stdlib.h>
+#include <stdio.h>
#include <assert.h>
#include <stdarg.h>
#include <string.h>
#include <errno.h>
#include <stdint.h>
+#include <sys/stat.h>
#include <libtar.h>
#include <fcntl.h>
#include <glite/jp/types.h>
#include <glite/jp/known_attr.h>
+#include "glite/jp/backend.h"
-#include "file_plugin.h"
+#include "glite/jp/file_plugin.h"
#include "builtin_plugins.h"
-#include "backend.h"
#define ALLOC_CHUNK 3
#include <stdarg.h>
#include <assert.h>
#include <stdint.h>
+#include <sys/stat.h>
#include <glite/lbu/trio.h>
#include <glite/jp/types.h>
+#include "glite/jp/backend.h"
#include "tags.h"
-#include "backend.h"
/* magic name_len value_len binary sequence timestamp */
#define HEADER "JP#TAG# %05u %012lu %c %05u %012lu#"
char *hdr,*rec;
glite_jp_context_t ctx = fpctx;
uint32_t magic,hlen,rlen,rlen_n;
- size_t r;
+ ssize_t r;
glite_jp_error_t err;
memset(&err,0,sizeof err);
glite_jp_context_t ctx = fpctx;
uint32_t magic,rlen;
glite_jp_error_t err;
- int r;
+ ssize_t r;
size_t off = sizeof rlen;
glite_jp_attrval_t *tp;
char *rp;
+++ /dev/null
-#include <getopt.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include <string.h>
-#include <errno.h>
-#include <stdio.h>
-#include <fcntl.h>
-#include <assert.h>
-#include <limits.h>
-#include <dirent.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-
-#include "glite/jp/types.h"
-#include "glite/jp/context.h"
-#include "glite/jp/strmd5.h"
-#include "glite/jp/known_attr.h"
-#include "glite/jp/attr.h"
-
-#include "feed.h"
-#include "tags.h"
-
-#include "utils.h"
-#include "backend.h"
-
-/*
- * realloc the line to double size if needed
- *
- * \return 0 if failed, did nothing
- * \return 1 if success
- */
-int check_realloc_line(char **line, size_t *maxlen, size_t len) {
- void *tmp;
-
- if (len > *maxlen) {
- *maxlen <<= 1;
- tmp = realloc(*line, *maxlen);
- if (!tmp) return 0;
- *line = tmp;
- }
-
- return 1;
-}
-
-/*
- * read next line from stream
- *
- * \return error code
- */
-int glite_jppsbe_readline(
- glite_jp_context_t ctx,
- void *handle,
- rl_buffer_t *buffer,
- char **line
-)
-{
- size_t maxlen, len, i;
- ssize_t nbytes;
- int retval, z, end;
-
- maxlen = BUFSIZ;
- i = 0;
- len = 0;
- *line = malloc(maxlen);
- end = 0;
-
- do {
- /* read next portion */
- if (buffer->pos >= buffer->size) {
- buffer->pos = 0;
- buffer->size = 0;
- if ((retval = glite_jppsbe_pread(ctx, handle, buffer->buf, BUFSIZ, buffer->offset, &nbytes)) == 0) {
- if (nbytes < 0) {
- retval = EINVAL;
- goto fail;
- } else {
- if (nbytes) {
- buffer->size = (size_t)nbytes;
- buffer->offset += nbytes;
- } else end = 1;
- }
- } else goto fail;
- }
-
- /* we have buffer->size - buffer->pos bytes */
- i = buffer->pos;
- do {
- if (i >= buffer->size) z = '\0';
- else {
- z = buffer->buf[i];
- if (z == '\n') z = '\0';
- }
- len++;
-
- if (!check_realloc_line(line, &maxlen, len)) {
- retval = ENOMEM;
- goto fail;
- }
- (*line)[len - 1] = z;
- i++;
- } while (z && i < buffer->size);
- buffer->pos = i;
- } while (len && (*line)[len - 1] != '\0');
-
- if ((!len || !(*line)[0]) && end) {
- free(*line);
- *line = NULL;
- }
-
- return 0;
-
-fail:
- free(*line);
- *line = NULL;
- return retval;
-}
-
-char* glite_jpps_get_namespace(const char* attr){
- char* namespace = strdup(attr);
- char* colon = strrchr(namespace, ':');
- if (colon)
- namespace[strrchr(namespace, ':') - namespace] = 0;
- else
- namespace[0] = 0;
- return namespace;
-}
-
+++ /dev/null
-#ifndef GLITE_JP_UTILS_H
-#define GLITE_JP_UTILS_H
-
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <unistd.h>
-
-#include "feed.h"
-
-typedef struct _rl_buffer_t {
- char *buf;
- size_t pos, size;
- off_t offset;
-} rl_buffer_t;
-
-int glite_jppsbe_readline(
- glite_jp_context_t ctx,
- void *handle,
- rl_buffer_t *buffer,
- char **line
-);
-
-char* glite_jpps_get_namespace(
- const char* attr
-);
-
-#endif /* GLITE_JP_UTILS_H */