-include Makefile.inc
-include ../Makefile.inc
+CC=gcc
+
GSOAP_FILES_PREFIX:= bk_ws_
YACC=bison -y
INSTALL:=libtool --mode=install install
LINKXX:=libtool --mode=link ${CXX} -rpath ${stagedir}/lib ${LDFLAGS}
-# assisst & gss due to VOMS only
-# -lglobus_gss_assist_${nothrflavour} \
-# -lglobus_gssapi_gsi_${nothrflavour} \
-
GLOBUS_LIBS:= -L${globus_prefix}/lib \
-lglobus_common_${nothrflavour} \
-lglobus_gssapi_gsi_${nothrflavour}
-
-# XXX: our vomsc.la depends on badly installed expat
-
-# not yet
-# -L${repository}/${gacl}/lib -lgacl \
-# ${repository}/${voms}/lib/libvomsc.a \
-
EXT_LIBS:= -L${ares_prefix}/lib -lares \
-L${mysql_prefix}/lib -lmysqlclient -lz\
-L${expat_prefix}/lib -lexpat \
SERVER_SOAP_OBJS:=${GSOAP_FILES_PREFIX}C.o ${GSOAP_FILES_PREFIX}Server.o \
ws_plugin.o ws_query.o ws_fault.o ws_typeref.o
-
INDEX_OBJS:= index.o index_parse.o jobstat_supp.o lbs_db.o openserver.o \
jobstat.o query.o lock.o get_events.o write2rgma.o index_lex.o \
lb_authz.o store.o bkindex.o
+WS_CLIENT_OBJS:= test_ws_plugin.o $(GSOAP_FILES_PREFIX)C.o $(GSOAP_FILES_PREFIX)Client.o ws_fault.o ws_typeref.o
+WS_CLIENT_LIBS:= ${GSOAP_LIBS} -L${stagedir}/lib -lglite_lb_client_${nothrflavour}
+
+
glite_lb_bkserverd: ${SERVER_OBJS} ${SERVER_SOAP_OBJS}
${LINK} -o $@ ${SERVER_OBJS} ${SERVER_SOAP_OBJS} ${COMMON_LIB} ${SRVBONES_LIB} ${GSOAP_LIBS} ${EXT_LIBS}
compile: glite_lb_bkserverd glite_lb_bkindex
-check: compile test.xml
+check: compile test.soapconv
-echo check.query not complete yet
test_coverage:
cd coverage && $(MAKE) -f ../Makefile top_srcdir=../../ COVERAGE_FLAGS="-fprofile-arcs -ftest-coverage" check
cd coverage && for i in `echo ${INDEX_OBJS} ${SERVER_OBJS} | tr ' ' '\012' | sort -u`; do gcov $$i ; done
-test.xml: test_xml
- ./test_xml
-
-test_xml: test_xml.cpp
- ${CXX} -c ${CFLAGS} ${TEST_INC} $<
- ${LINKXX} -o $@ test_xml.o lb_xml_parse.o ${COMMON_LIB} ${TEST_LIBS}
-
lb_xml_parse.c: lb_xml_parse.c.T
rm -f $@
${AT3} $< >$@ || rm -f $@
chmod -w $@ >/dev/null
-${GSOAP_FILES_PREFIX}H.h ${GSOAP_FILES_PREFIX}C.c ${GSOAP_FILES_PREFIX}Server.c: LB.xh
+${GSOAP_FILES_PREFIX}H.h ${GSOAP_FILES_PREFIX}C.c ${GSOAP_FILES_PREFIX}Server.c ${GSOAP_FILES_PREFIX}Client.c: LB.xh
${gsoap_prefix}/bin/soapcpp2 -w -c -p ${GSOAP_FILES_PREFIX} LB.xh
LB.xh: LB.wsdl ws_typemap.dat
${gsoap_prefix}/bin/wsdl2h -c -t ${top_srcdir}/src/ws_typemap.dat -o $@ LB.wsdl
rm LB.wsdl
+test.xml: test_xml
+ ./test_xml
+
+test_xml: test_xml.cpp
+ ${CXX} -c ${CFLAGS} ${TEST_INC} $<
+ ${LINKXX} -o $@ test_xml.o lb_xml_parse.o ${COMMON_LIB} ${TEST_LIBS}
check.query: test_query_events
./test_query_events
${LINKXX} -o $@ test_query_events.o ${query_events_objs} \
${TEST_LIBS} ${COMMON_LIB} ${EXT_LIBS}
-WS_CLIENT_OBJS:= test_ws_plugin.o $(GSOAP_FILES_PREFIX)C.o $(GSOAP_FILES_PREFIX)Client.o ws_fault.o ws_typeref.o
-WS_CLIENT_LIBS:= ${GSOAP_LIBS} -L${stagedir}/lib -lglite_lb_client_${nothrflavour}
+test.soapconv: test_soap_conv
+ ./test_soap_conv
+test_soap_conv: test_soap_conv.cpp ${WS_CLIENT_OBJS}
+ ${CXX} -c ${CFLAGS} ${TEST_INC} $<
+ ${LINKXX} -o $@ test_soap_conv.o ${WS_CLIENT_OBJS} ${WS_CLIENT_LIBS} ${COMMON_LIB} ${TEST_LIBS}
ws_jobstat: ws_jobstat.o ${WS_CLIENT_OBJS}
${LINK} -o $@ ws_jobstat.o ${WS_CLIENT_OBJS} ${WS_CLIENT_LIBS} ${EXT_LIBS}
ws_query_ex: ws_query_ex.o ${WS_CLIENT_OBJS}
${LINK} -o $@ ws_query_ex.o ${WS_CLIENT_OBJS} ${WS_CLIENT_LIBS} ${EXT_LIBS}
-test_ws_plugin.o: ${top_srcdir}/src/ws_plugin.c
+ws_query_ext: ws_query_ext.o ${WS_CLIENT_OBJS}
+ ${LINK} -o $@ ws_query_ext.o ${WS_CLIENT_OBJS} ${WS_CLIENT_LIBS} ${EXT_LIBS}
+
+test_ws_plugin.o: ws_plugin.c
${CC} ${CFLAGS} -DPLUGIN_TEST -c -o $@ ${top_srcdir}/src/ws_plugin.c
doc:
#include "glite/lb/consumer.h"
/* XXX: references only, src and dest share pointers */
-static void edg_wll_JobStatCodeToSoap(edg_wll_JobStatCode in, enum edgwll__JobStatCode *out)
+void edg_wll_JobStatCodeToSoap(edg_wll_JobStatCode in, enum edgwll__JobStatCode *out)
{
switch ( in )
{
}
}
-static void edg_wll_SoapToJobStatCode(enum edgwll__JobStatCode in, edg_wll_JobStatCode *out)
+void edg_wll_SoapToJobStatCode(enum edgwll__JobStatCode in, edg_wll_JobStatCode *out)
{
switch ( in )
{
}
}
-void edg_wll_StatusToSoap(struct soap *soap,edg_wll_JobStat const *src,struct edgwll__JobStat *dest)
+int edg_wll_StatusToSoap(struct soap *soap,edg_wll_JobStat const *src,struct edgwll__JobStat **dest)
{
int i;
+ struct edgwll__JobStat *js;
- memset(dest,0,sizeof *dest);
- dest->state = src->state; /* XXX: enum mapping */
+ if ( !(js = soap_malloc(soap, sizeof(*js))) ) return SOAP_FAULT;
+ memset(js, 0, sizeof(*js));
+ edg_wll_JobStatCodeToSoap(src->state, &(js->state));
@@@{
selectType $status '_common_';
for (getFieldsOrdered $status) {
my $usuc = $_;
$usuc = $1.uc($2).$3 while ($usuc =~ /([^_]*)_([a-z])(.*)/);
if ($ft eq 'jobid') {
- gen "\tdest->$usuc = edg_wlc_JobIdUnparse(src->$_);\n";
+ gen "\tjs->$usuc = edg_wlc_JobIdUnparse(src->$_);\n";
}
elsif ($ft eq 'strlist') {
gen "\tfor (i=0; src->$_ && src->$_\[i]; i++);\n";
- gen "\tdest->__size$usuc = i;\n";
- gen "\tdest->$usuc = src->$_;\n";
+ gen "\tjs->__size$usuc = i;\n";
+ gen "\tjs->$usuc = src->$_;\n";
} elsif ($ft eq 'intlist') {
- gen "\tdest->__size$usuc = src->$_ ? src->$_\[0] : 0;\n";
- gen "\tdest->$usuc = src->$_ ? src->$_ + 1 : NULL;\n";
+ gen "\tjs->__size$usuc = src->$_ ? src->$_\[0] : 0;\n";
+ gen "\tjs->$usuc = src->$_ ? src->$_ + 1 : NULL;\n";
} elsif ($ft eq 'stslist' || $ft eq 'taglist') {
# FIXME
- gen "\tdest->__size$usuc = 0;\n";
- gen "\tdest->$usuc = NULL;\n";
+ gen "\tjs->__size$usuc = 0;\n";
+ gen "\tjs->$usuc = NULL;\n";
} elsif ($ft eq 'timeval') {
- gen "\tdest->$usuc = soap_malloc(soap,sizeof *dest->$usuc);\n";
- gen "\tdest->$usuc->tvSec = src->$_.tv_sec;\n";
- gen "\tdest->$usuc->tvUsec = src->$_.tv_usec;\n";
+ gen "\tjs->$usuc = soap_malloc(soap,sizeof *js->$usuc);\n";
+ gen "\tjs->$usuc->tvSec = src->$_.tv_sec;\n";
+ gen "\tjs->$usuc->tvUsec = src->$_.tv_usec;\n";
}
- else { gen "\tdest->$usuc = src->$_;\n"; }
+ else { gen "\tjs->$usuc = src->$_;\n"; }
}
@@@}
+
+ *dest = js;
+ return SOAP_OK;
}
void edg_wll_SoapToStatus(struct soap *soap,struct edgwll__JobStat const *src,edg_wll_JobStat *dest)
{
memset(dest,0,sizeof *dest);
- dest->state = src->state; /* XXX: enum mapping */
+ edg_wll_SoapToJobStatCode(src->state, &(dest->state));
@@@{
selectType $status '_common_';
int i;
assert(in); assert(out);
+ *out = 0;
for ( i = 0; i < in->__sizeflag; i++ ) switch ( in->flag[i] )
{
case CLASSADS: *out |= EDG_WLL_STAT_CLASSADS; break;
return SOAP_OK;
}
-static void edg_wll_SoapToAttr(const enum edgwll__QueryAttr in, edg_wll_QueryAttr *out)
+void edg_wll_SoapToAttr(const enum edgwll__QueryAttr in, edg_wll_QueryAttr *out)
{
switch ( in )
{
}
}
-static void edg_wll_AttrToSoap(const edg_wll_QueryAttr in, enum edgwll__QueryAttr *out)
+void edg_wll_AttrToSoap(const edg_wll_QueryAttr in, enum edgwll__QueryAttr *out)
{
switch ( in )
{
}
}
-static void edg_wll_SoapToQueryOp(const enum edgwll__QueryOp in, edg_wll_QueryOp *out)
+void edg_wll_SoapToQueryOp(const enum edgwll__QueryOp in, edg_wll_QueryOp *out)
{
switch ( in )
{
}
}
-static void edg_wll_QueryOpToSoap(const enum edgwll__QueryOp in, edg_wll_QueryOp *out)
+void edg_wll_QueryOpToSoap(const edg_wll_QueryOp in, enum edgwll__QueryOp *out)
{
switch ( in )
{
case EDG_WLL_QUERY_ATTR_DESTINATION:
case EDG_WLL_QUERY_ATTR_HOST:
case EDG_WLL_QUERY_ATTR_INSTANCE:
- if ( !(out->c = soap_strdup(soap, in->c)) ) return SOAP_FAULT;
+ if ( in->c && !(out->c = soap_strdup(soap, in->c)) ) return SOAP_FAULT;
break;
case EDG_WLL_QUERY_ATTR_JOBID:
case EDG_WLL_QUERY_ATTR_PARENT: {
int edg_wll_QueryRecToSoap(
struct soap *soap,
const edg_wll_QueryRec *in,
- struct edgwll__QueryRec *out)
+ struct edgwll__QueryRec **out)
{
- struct edgwll__QueryRec qr;
+ struct edgwll__QueryRec *qr;
assert(in); assert(out);
- if ( !in ) { memset(out, 0, sizeof(*out)); return SOAP_OK; }
- memset(&qr, 0, sizeof(qr));
- edg_wll_QueryOpToSoap(in->op, &(qr.op));
+ if ( !(qr = soap_malloc(soap, sizeof(*qr))) ) return SOAP_FAULT;
+ memset(qr, 0, sizeof(*qr));
+ if ( !in ) goto ret;
+ edg_wll_QueryOpToSoap(in->op, &(qr->op));
if ( in->attr == EDG_WLL_QUERY_ATTR_TIME
|| in->attr == EDG_WLL_QUERY_ATTR_USERTAG ) {
- if ( !(qr.attrid = soap_malloc(soap, sizeof(*(qr.attrid)))) ) return SOAP_FAULT;
- memset(qr.attrid, 0, sizeof(*(qr.attrid)));
+ if ( !(qr->attrid = soap_malloc(soap, sizeof(*(qr->attrid)))) ) return SOAP_FAULT;
+ memset(qr->attrid, 0, sizeof(*(qr->attrid)));
if ( in->attr == EDG_WLL_QUERY_ATTR_TIME ) {
- qr.attrid->state = soap_malloc(soap, sizeof(*(qr.attrid->state)));
- if ( !qr.attrid->state ) return SOAP_FAULT;
- edg_wll_JobStatCodeToSoap(in->attr_id.state, qr.attrid->state);
+ qr->attrid->state = soap_malloc(soap, sizeof(*(qr->attrid->state)));
+ if ( !qr->attrid->state ) return SOAP_FAULT;
+ edg_wll_JobStatCodeToSoap(in->attr_id.state, qr->attrid->state);
}
else {
- qr.attrid->tag = soap_strdup(soap, in->attr_id.tag);
- if ( !qr.attrid->tag ) return SOAP_FAULT;
+ qr->attrid->tag = soap_strdup(soap, in->attr_id.tag);
+ if ( !qr->attrid->tag ) return SOAP_FAULT;
}
}
switch ( in->op ) {
case EDG_WLL_QUERY_OP_WITHIN:
- if ( !(qr.value2 = soap_malloc(soap, sizeof(*(qr.value2)))) ) return SOAP_FAULT;
- if ( edg_wll_QueryValToSoap(soap, in->attr, &(in->value2), qr.value2) ) return SOAP_FAULT;
+ if ( !(qr->value2 = soap_malloc(soap, sizeof(*(qr->value2)))) ) return SOAP_FAULT;
+ if ( edg_wll_QueryValToSoap(soap, in->attr, &(in->value2), qr->value2) ) return SOAP_FAULT;
default:
- if ( !(qr.value1 = soap_malloc(soap, sizeof(*(qr.value1)))) ) return SOAP_FAULT;
- if ( edg_wll_QueryValToSoap(soap, in->attr, &(in->value), qr.value1) ) return SOAP_FAULT;
+ if ( !(qr->value1 = soap_malloc(soap, sizeof(*(qr->value1)))) ) return SOAP_FAULT;
+ if ( edg_wll_QueryValToSoap(soap, in->attr, &(in->value), qr->value1) ) return SOAP_FAULT;
break;
}
- memcpy(out, &qr, sizeof(qr));
+ret:
+ *out = qr;
return SOAP_OK;
}
edg_wll_QueryRec *qr;
- assert(in); assert(*out);
+ assert(in); assert(out);
if ( !(qr = calloc(in->__sizerecords+1, sizeof(*qr))) ) goto err;
for ( i = 0; i < in->__sizerecords; i++ )
if ( edg_wll_SoapToQueryRec(in->attr, in->records[i], qr+i) ) goto err;
int edg_wll_QueryCondsToSoap(
struct soap *soap,
const edg_wll_QueryRec *in,
- struct edgwll__QueryCondition *out)
+ struct edgwll__QueryCondition **out)
{
int i;
- struct edgwll__QueryCondition qc;
+ struct edgwll__QueryCondition *qc;
assert(out);
- if ( !in ) { memset(out, 0, sizeof(*out)); return SOAP_OK; }
- memset(&qc, 0, sizeof(qc));
- while ( in[qc.__sizerecords].attr ) qc.__sizerecords++;
- if ( qc.__sizerecords ) { memset(out, 0, sizeof(*out)); return SOAP_OK; }
- qc.records = soap_malloc(soap, sizeof(*qc.records)*qc.__sizerecords);
- if ( !qc.records ) return SOAP_FAULT;
- edg_wll_AttrToSoap(in[0].attr, &(qc.attr));
+ if ( !(qc = soap_malloc(soap, sizeof(*qc))) ) return SOAP_FAULT;
+ memset(qc, 0, sizeof(*qc));
+ if ( !in ) goto ret;
+ while ( in[qc->__sizerecords].attr ) qc->__sizerecords++;
+ if ( !qc->__sizerecords ) goto ret;
+ qc->records = soap_malloc(soap, sizeof(*(qc->records))*qc->__sizerecords);
+ if ( !qc->records ) return SOAP_FAULT;
+ edg_wll_AttrToSoap(in[0].attr, &(qc->attr));
for ( i = 0; in[i].attr; i++ )
- if ( edg_wll_QueryRecToSoap(soap, in+i, qc.records[i]) )
+ if ( edg_wll_QueryRecToSoap(soap, in+i, qc->records+i) )
return SOAP_FAULT;
- memcpy(out, &qc, sizeof(qc));
+ret:
+ *out = qc;
return SOAP_OK;
}
edg_wll_QueryRec **qr;
- assert(in); assert(*out);
+ assert(in); assert(out);
if ( !(qr = calloc(in->__sizecondition+1, sizeof(*qr))) ) return -1;
for ( i = 0; i < in->__sizecondition; i++ )
- if ( edg_wll_SoapToQueryConds(*(in->condition), qr+i) ) goto err;
+ if ( edg_wll_SoapToQueryConds(in->condition[i], qr+i) ) goto err;
*out = qr;
return 0;
int edg_wll_QueryCondsExtToSoap(
struct soap *soap,
const edg_wll_QueryRec **in,
- struct edgwll__QueryConditions *out)
+ struct edgwll__QueryConditions **out)
{
int i;
- struct edgwll__QueryConditions qc;
+ struct edgwll__QueryConditions *qc;
assert(out);
- if ( !in ) { memset(out, 0, sizeof(*out)); return SOAP_OK; }
- memset(&qc, 0, sizeof(qc));
- while ( in[qc.__sizecondition] ) qc.__sizecondition++;
- if ( !qc.__sizecondition ) { memset(out, 0, sizeof(*out)); return SOAP_OK; }
- qc.condition = soap_malloc(soap, sizeof(*qc.condition)*qc.__sizecondition);
- if ( !qc.condition ) return SOAP_FAULT;
+ if ( !(qc = soap_malloc(soap, sizeof(*qc))) ) return SOAP_FAULT;
+ memset(qc, 0, sizeof(*qc));
+ if ( !in ) goto ret;
+ while ( in[qc->__sizecondition] ) qc->__sizecondition++;
+ if ( !qc->__sizecondition ) goto ret;
+ qc->condition = soap_malloc(soap, sizeof(*(qc->condition))*qc->__sizecondition);
+ if ( !qc->condition ) return SOAP_FAULT;
for ( i = 0; in[i]; i++ )
- if ( edg_wll_QueryCondsToSoap(soap, in[i], qc.condition[i]) )
+ if ( edg_wll_QueryCondsToSoap(soap, in[i], qc->condition+i) )
return SOAP_FAULT;
- memcpy(out, &qc, sizeof(qc));
+ret:
+ *out = qc;
return SOAP_OK;
}
int edg_wll_JobsQueryResToSoap(
struct soap *soap,
- edg_wlc_JobId *jobs,
- edg_wll_JobStat *states,
+ const edg_wlc_JobId *jobs,
+ const edg_wll_JobStat *states,
struct edgwll2__QueryJobsResponse *out)
{
int i;
for ( i = 0; states[i].state; i++ ) ;
out->states->states = soap_malloc(soap, sizeof(*(out->states->states))*i);
if ( !out->states->states ) return SOAP_FAULT;
+ out->states->__sizestates = i;
+
for ( i = 0; states[i].state; i++ )
- edg_wll_StatusToSoap(soap, states+i, out->states->states[i]);
+ if ( edg_wll_StatusToSoap(soap, states+i, out->states->states+i) )
+ return SOAP_FAULT;
}
return SOAP_OK;