new_ftp_backend.c mysql.c file_plugin.c \
feed.c authz.c attrs.c\
is_client.c \
- env_C.c
+ soap_switch.c
# ${ps_prefix}ServerLib.c \
# ${is_prefix}ClientLib.c jpps_C.c
${gsoap_bin_prefix}/soapcpp2 /dev/null
perl -ne '$$. == 2 && /.*([0-9])\.([0-9])\.([0-9]).*/ && printf "#define GSOAP_VERSION %d%02d%02d\n",$$1,$$2,$$3' soapH.h >$@
-rm soapC.cpp soapH.h soapStub.h soapClient.cpp soapServer.cpp soapClientLib.cpp soapServerLib.cpp
+
+soap_env_ctx.c soap_env_ctx.h soap_switch.c: env_C.c mk_soap_switch.pl
+ ${top_srcdir}/src/mk_soap_switch.pl env_C.c >soap_switch.c
*data = (void *) soap_new();
printf("[%d] slave started\n",getpid());
+ glite_jpps_srv_init(ctx);
glite_jppsbe_init_slave(ctx); /* XXX: global but slave's */
- sleep(10);
+ // sleep(10);
if (glite_jppsbe_read_feeds(ctx)) fputs(glite_jp_error_chain(ctx),stderr);
printf("[%d] slave init done\n",getpid());
#include <errno.h>
#include <assert.h>
+#define SOAP_FMAC1 static
+
#include "glite/jp/types.h"
#include "glite/security/glite_gsplugin.h"
#include "feed.h"
#include "is_client.h"
-#include "jpis_ClientLib.c"
+/* same as ClientLib.c, without WITH_NOGLOBAL */
+#define SOAP_FMAC3 static
+#include "jpis_C.c"
+#include "jpis_Client.c"
+
#include "jpis_.nsmap"
#include "soap_util.c"
+#include "soap_env_ctx.h"
+#include "soap_env_ctx.c"
+
extern char *server_key, *server_cert; /* XXX */
static int check_other_soap(glite_jp_context_t ctx)
}
}
+static struct _glite_jp_soap_env_ctx_t *keep_soap_env_ctx;
+
+#define SWITCH_SOAP_CTX \
+{ \
+ keep_soap_env_ctx = glite_jp_soap_env_ctx; \
+ glite_jp_soap_env_ctx = &my_soap_env_ctx; \
+} \
+
+#define RESTORE_SOAP_CTX \
+{ \
+ glite_jp_soap_env_ctx = keep_soap_env_ctx; \
+} \
int glite_jpps_single_feed(
glite_jp_context_t ctx,
jr.primaryStorage = &ctx->myURL;
+ SWITCH_SOAP_CTX
if (soap_call___jpsrv__UpdateJobs(ctx->other_soap,destination,"",
&in,&out
)) {
buf[999] = 0;
glite_jp_stack_error(ctx,&err);
}
+ RESTORE_SOAP_CTX
attrValues_free(ctx->other_soap,jr.attributes,jr.__sizeattributes);
jr->primaryStorage = &ctx->myURL;
}
+ SWITCH_SOAP_CTX
check_fault(ctx,ctx->other_soap,
soap_call___jpsrv__UpdateJobs(ctx->other_soap,destination,"", &in,&out));
+ RESTORE_SOAP_CTX
for (i=0; i<njobs; i++) {
jr = in.jobAttributes[i];
attrValues_free(ctx->other_soap,jr->attributes,jr->__sizeattributes);
--- /dev/null
+#!/usr/bin/perl
+
+$formula = "/* Generated from @ARGV with the help of black magic.\n Do not edit.\n*/\n\n";
+print "${formula}#include \"soap_env_ctx.h\"\n\n";
+
+# XXX: hardcoded
+$prefix = 'ENV';
+
+open EH,">soap_env_ctx.h" or die "soap_env_ctx.h: $!\n";
+open EC,">soap_env_ctx.c" or die "soap_env_ctx.c: $!\n";
+
+print EH "${formula}struct _glite_jp_soap_env_ctx_t {\n";
+
+print EC "${formula}static struct _glite_jp_soap_env_ctx_t my_soap_env_ctx = {\n";
+
+
+while ($_ = <>) {
+ if (/^}$/) {
+ print;
+ $infunc = 0;
+ undef @args;
+ next;
+ }
+
+ next if $infunc;
+
+ if (/^SOAP_FMAC3\s+(.+)\s+SOAP_FMAC4\s+([^(]+)\(([^)]*)\)/) {
+ $type = $1;
+ $func = $2;
+ @a = split /,/,$3;
+ for $a (@a) {
+ $a =~ /.*\W(\w+)/;
+ push @args,$1;
+ }
+ print;
+
+ next if $func =~ "SOAP_$prefix";
+
+ print EH "\t$type (*$func)();\n";
+ print EC "\t$func,\n";
+ next;
+ }
+
+ if (/^{/) {
+ print;
+ next if $func =~ "SOAP_$prefix";
+ local $"=',';
+ $infunc = 1;
+ print "\t";
+ print 'return ' unless $type eq 'void';
+ print "glite_jp_soap_env_ctx->$func(@args);\n";
+
+ next;
+ }
+
+ print;
+}
+
+print EH "};\n\n";
+print EH "extern struct _glite_jp_soap_env_ctx_t *glite_jp_soap_env_ctx;\n";
+print EC "};\n";
+
+print "struct _glite_jp_soap_env_ctx_t *glite_jp_soap_env_ctx;\n";
#include <fcntl.h>
#include <assert.h>
+#define SOAP_FMAC1 static
+
#include "glite/jp/types.h"
#include "glite/jp/context.h"
#include "glite/jp/attr.h"
#include "file_plugin.h"
#include "builtin_plugins.h"
-#include "jpps_ServerLib.c"
+/* the same as ServerLib.c but without WITH_NOGLOBAL which breaks the soap_env_ctx trick */
+#define SOAP_FMAC3 static
+#include "jpps_C.c"
+#include "jpps_Server.c"
+
#include "jpps_.nsmap"
#include "soap_util.c"
+#include "soap_env_ctx.h"
+#include "soap_env_ctx.c"
+
static struct jptype__genericFault *jp2s_error(struct soap *soap,
const glite_jp_error_t *err)
{
#define CONTEXT_FROM_SOAP(soap,ctx) glite_jp_context_t ctx = (glite_jp_context_t) ((soap)->user)
+int glite_jpps_srv_init(glite_jp_context_t ctx)
+{
+ glite_jp_soap_env_ctx = &my_soap_env_ctx;
+ return 0;
+}
+
SOAP_FMAC5 int SOAP_FMAC6 __jpsrv__RegisterJob(
struct soap *soap,
struct _jpelem__RegisterJob *in,