, me);
}
-static void printstat(edg_wll_JobStat stat, int level);
+//static void printstat(edg_wll_JobStat stat, int level);
int main(int argc,char** argv)
{
edg_wll_Context ctx;
glite_gsplugin_Context gsplugin_ctx;
struct soap soap;
- struct edgwll2__GetVersionResponse out;
+ struct _lbe__GetVersionResponse out;
int opt, err;
char *server = "http://localhost:8999/",
*name = NULL;
glite_gsplugin_set_udata(&soap, gsplugin_ctx);
- switch (err = soap_call_edgwll2__GetVersion(&soap, server, "", &out))
+ switch (err = soap_call___lb__GetVersion(&soap, server, "", NULL, &out))
{
case SOAP_OK: printf("Server version: %s\n", out.version); break;
case SOAP_FAULT:
- default: printf("???\n");
+ default: printf("???, err=%d\n", err);
}
+ soap_done(&soap);
+
return 0;
}
#endif
-#if 0
-int edgwll2__GetVersion(
- struct soap *soap,
- struct edgwll2__GetVersionResponse *out)
-{
- out->version = strdup(VERSION);
+static void freeQueryRecsExt(edg_wll_QueryRec **qr);
+static void freeJobIds(edg_wlc_JobId *jobs);
+static void freeJobStats(edg_wll_JobStat *stats);
- return SOAP_OK;
-}
-#endif
SOAP_FMAC5 int SOAP_FMAC6 __lb__GetVersion(
struct soap* soap,
struct _lbe__GetVersion *in,
struct _lbe__GetVersionResponse *out)
{
+ out->version = soap_strdup(soap, VERSION);
+
+ return out->version ? SOAP_OK : SOAP_FAULT;
}
SOAP_FMAC5 int SOAP_FMAC6 __lb__JobStatus(
struct _lbe__QueryJobs *in,
struct _lbe__QueryJobsResponse *out)
{
-}
-
-
-#if 0
-int edgwll2__QueryJobs(
- struct soap *soap,
- struct edgwll__QueryConditions *conditions,
- struct edgwll__JobStatFlags *flags,
- struct edgwll2__QueryJobsResponse *out)
-{
- edg_wll_Context ctx = (edg_wll_Context) glite_gsplugin_get_udata(soap);
- edg_wlc_JobId *jobsOut = NULL;
- edg_wll_JobStat *statesOut = NULL;
- edg_wll_QueryRec **qr = NULL;
- int fl,
- i, j,
- ret = SOAP_FAULT;
-
+ edg_wll_Context ctx;
+ edg_wll_QueryRec **conditions;
+ int flags;
+ edg_wlc_JobId *jobs;
+ edg_wll_JobStat *states;
+ int ret;
out->states = soap_malloc(soap, sizeof(*out->states));
out->jobs = soap_malloc(soap, sizeof(*out->jobs));
if ( !out->states || !out->jobs ) goto cleanup;
- memset(out->states, 0, sizeof(*(out->states)));
- memset(out->jobs, 0, sizeof(*(out->jobs)));
+
+ ctx = (edg_wll_Context) glite_gsplugin_get_udata(soap);
+ jobs = NULL;
+ states = NULL;
+ ret = SOAP_FAULT;
edg_wll_ResetError(ctx);
- edg_wll_SoapToJobStatFlags(flags, &fl);
- if ( edg_wll_SoapToQueryCondsExt(conditions, &qr) ) {
+ if ( edg_wll_SoapToQueryCondsExt(*in->conditions, in->__sizeconditions, &conditions) ) {
edg_wll_SetError(ctx, ENOMEM, "Couldn't create internal structures");
goto cleanup;
}
- if ( edg_wll_QueryJobsServer(ctx, (const edg_wll_QueryRec **)qr, fl,
- &jobsOut, &statesOut) ) goto cleanup;
- if ( edg_wll_JobsQueryResToSoap(soap, jobsOut, statesOut, out) ) goto cleanup;
+ edg_wll_SoapToJobStatFlags(in->flags, &flags);
+
+ if (edg_wll_QueryJobsServer(ctx, (const edg_wll_QueryRec **)conditions, flags, &jobs, &states) != 0) goto cleanup;
+
+ if (edg_wll_JobsQueryResToSoap(soap, jobs, states, out) != SOAP_OK) goto cleanup;
ret = SOAP_OK;
cleanup:
- if ( qr ) {
- for ( i = 0; qr[i]; i++ ) {
- for ( j = 0; qr[i][j].attr; j++ )
- edg_wll_QueryRecFree(&qr[i][j]);
- free(qr[i]);
- }
- free(qr);
- }
- if ( jobsOut ) {
- for ( i = 0; jobsOut[i]; i++ )
- edg_wlc_JobIdFree(jobsOut[i]);
- free(jobsOut);
- }
- if ( statesOut ) {
- for ( i = 0; statesOut[i].state; i++ )
- edg_wll_FreeStatus(&statesOut[i]);
- free(statesOut);
- }
+ freeQueryRecsExt(conditions);
+ freeJobIds(jobs);
+ freeJobStats(states);
+
if ( ret == SOAP_FAULT ) edg_wll_ErrToFault(ctx, soap);
return ret;
}
+
+SOAP_FMAC5 int SOAP_FMAC6 __lb__UserJobs(
+ struct soap *soap,
+ struct _lbe__UserJobs *in,
+ struct _lbe__UserJobsResponse *out)
+{
+}
+
+#if 0
int edgwll2__UserJobs(
struct soap *soap,
struct edgwll2__UserJobsResponse *out)
return SOAP_OK;
}
-/*
-int edgwll2__QueryEvents(
- struct soap *soap,
- struct edgwll__QueryConditions *jc,
- struct edgwll__QueryConditions *ec,
- struct edgwll2__QueryEventsResponse *out)
-{
- edg_wll_Context ctx = (edg_wll_Context) glite_gsplugin_get_udata(soap);
- edg_wll_Event *eventsOut = NULL;
- edg_wll_QueryRec **qrj = NULL,
- **qre = NULL;
-
- int fl,
- i, j,
- ret = SOAP_FAULT;
-
-
-x out->states = soap_malloc(soap, sizeof(*out->states));
-x out->jobs = soap_malloc(soap, sizeof(*out->jobs));
-x if ( !out->states || !out->jobs ) goto cleanup;
-x memset(out->states, 0, sizeof(*(out->states)));
-x memset(out->jobs, 0, sizeof(*(out->jobs)));
+#endif
- edg_wll_ResetError(ctx);
- if ( edg_wll_SoapToQueryCondsExt(jc, &qrj) ) {
- edg_wll_SetError(ctx, ENOMEM, "Couldn't create internal structures");
- goto cleanup;
- }
- if ( edg_wll_SoapToQueryCondsExt(ec, &qre) ) {
- edg_wll_SetError(ctx, ENOMEM, "Couldn't create internal structures");
- goto cleanup;
- }
- if ( edg_wll_QueryEventsServer( ctx, ctx->noAuth, (const edg_wll_QueryRec **) jc,
- (const edg_wll_QueryRec **) ec, &eventsOut) )
- goto cleanup;
+SOAP_FMAC5 int SOAP_FMAC6 __lb__QueryEvents(
+ struct soap *soap,
+ struct _lbe__QueryEvents *in,
+ struct _lbe__QueryEventsResponse *out)
+{
+}
- if ( edg_wll_EventsQueryResToSoap(soap, eventsOut, out) ) goto cleanup;
- ret = SOAP_OK;
-cleanup:
- if ( qrj ) {
- for ( i = 0; qrj[i]; i++ ) {
- for ( j = 0; qrj[i][j].attr; j++ )
- edg_wll_QueryRecFree(&qrj[i][j]);
- free(qrj[i]);
- }
- free(qrj);
- }
+static void freeQueryRecsExt(edg_wll_QueryRec **qr) {
+ int i, j;
- if ( qre ) {
- for ( i = 0; qre[i]; i++ ) {
- for ( j = 0; qre[i][j].attr; j++ )
- edg_wll_QueryRecFree(&qre[i][j]);
- free(qre[i]);
+ if ( qr ) {
+ for ( i = 0; qr[i]; i++ ) {
+ if (qr[i]) {
+ for ( j = 0; qr[i][j].attr; j++ ) edg_wll_QueryRecFree(&qr[i][j]);
+ free(qr[i]);
+ }
}
free(qr);
}
- if ( eventsOut ) {
- for ( i = 0; eventsOut[i].type; i++ )
- edg_wll_FreeEvent(&eventsOut[i]);
- free(eventssOut);
- }
- if ( ret == SOAP_FAULT ) edg_wll_ErrToFault(ctx, soap);
-
- return ret;
}
-*/
-#endif
-/* TODO */
-SOAP_FMAC5 int SOAP_FMAC6 __lb__UserJobs(
- struct soap *soap,
- struct _lbe__UserJobs *in,
- struct _lbe__UserJobsResponse *out)
-{
-}
+static void freeJobIds(edg_wlc_JobId *jobs) {
+ int i;
-SOAP_FMAC5 int SOAP_FMAC6 __lb__QueryEvents(
- struct soap *soap,
- struct _lbe__QueryEvents *in,
- struct _lbe__QueryEventsResponse *out)
-{
+ if ( jobs ) {
+ for ( i = 0; jobs[i]; i++ )
+ edg_wlc_JobIdFree(jobs[i]);
+ free(jobs);
+ }
}
+
+static void freeJobStats(edg_wll_JobStat *stats) {
+ int i;
+
+ if ( stats ) {
+ for ( i = 0; stats[i].state; i++ )
+ edg_wll_FreeStatus(&stats[i]);
+ free(stats);
+ }
+}
return SOAP_OK;
}
-#if 0
void edg_wll_SoapToAttr(const enum lbt__queryAttr in, edg_wll_QueryAttr *out)
{
switch ( in )
}
int edg_wll_SoapToQueryRec(
- const edg_wll_QueryAttr attr,
+ const struct lbt__queryConditions *collection,
const struct lbt__queryRecord *in,
edg_wll_QueryRec *out)
{
- assert(attr); assert(in); assert(out);
+ assert(collection); assert(in); assert(out);
memset(out, 0, sizeof(*out));
- edg_wll_SoapToAttr(attr, &out->attr);
+ edg_wll_SoapToAttr(collection->attr, &out->attr);
switch ( out->attr )
{
case EDG_WLL_QUERY_ATTR_TIME:
- edg_wll_SoapToJobStatCode(*(in->attrid->state), &(out->attr_id.state));
+ edg_wll_SoapToJobStatCode(*(collection->statName), &(out->attr_id.state));
break;
case EDG_WLL_QUERY_ATTR_USERTAG:
- out->attr_id.tag = strdup(in->attrid->tag);
+ out->attr_id.tag = strdup(collection->tagName);
break;
default:
break;
edg_wll_QueryRecFree(out);
return -1;
}
+#if 0
int edg_wll_QueryRecToSoap(
struct soap *soap,
*out = qr;
return SOAP_OK;
}
+#endif
+/**
+ * Translate query conditions from Soap form to query rec structure
+ *
+ * \param IN in pointer to soap query condition
+ * \param OUT out target array of queryRec
+ */
int edg_wll_SoapToQueryConds(const struct lbt__queryConditions *in, edg_wll_QueryRec **out)
{
int i;
edg_wll_QueryRec *qr;
-
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;
+ if ( !(qr = calloc(in->__sizerecord+1, sizeof(*qr))) ) goto err;
+ for ( i = 0; i < in->__sizerecord; i++ )
+ if ( edg_wll_SoapToQueryRec(in, in->record[i], qr+i) ) goto err;
*out = qr;
return 0;
return -1;
}
+#if 0
int edg_wll_QueryCondsToSoap(
struct soap *soap,
const edg_wll_QueryRec *in,
*out = qc;
return SOAP_OK;
}
+#endif
-int edg_wll_SoapToQueryCondsExt(const struct lbt__queryConditions *in, edg_wll_QueryRec ***out)
+/**
+ * Translate extended query conditions from Soap form to query rec structure
+ *
+ * \param IN in array of soap query condition
+ * \param OUT out target array of queryRec
+ */
+int edg_wll_SoapToQueryCondsExt(const struct lbt__queryConditions *in, int __sizecondition, edg_wll_QueryRec ***out)
{
int i;
edg_wll_QueryRec **qr;
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[i], qr+i) ) goto err;
+ if ( !(qr = calloc(__sizecondition, sizeof(*qr))) ) return -1;
+ for ( i = 0; i < __sizecondition; i++ )
+ if ( edg_wll_SoapToQueryConds(&in[i], qr+i) ) goto err;
*out = qr;
return 0;
return -1;
}
+#if 0
int edg_wll_QueryCondsExtToSoap(
struct soap *soap,
const edg_wll_QueryRec **in,
*out = qc;
return SOAP_OK;
}
+#endif
int edg_wll_JobsQueryResToSoap(
- struct soap *soap,
- const edg_wlc_JobId *jobs,
- const edg_wll_JobStat *states,
- struct _lbe__QueryJobsResponse *out)
+ struct soap *soap,
+ const edg_wlc_JobId *jobs,
+ const edg_wll_JobStat *states,
+ struct _lbe__QueryJobsResponse *out)
{
int i;
- assert(out); assert(out->states); assert(out->jobs);
- memset(out->jobs, 0, sizeof(*(out->jobs)));
- memset(out->states, 0, sizeof(*(out->states)));
+ assert(out); //assert(out->states); assert(out->jobs);
+ out->jobs = NULL;
+ out->states = NULL;
+ out->__sizejobs = 0;
+ out->__sizestates = 0;
if ( jobs ) {
for ( i = 0; jobs[i]; i++ ) ;
- out->jobs->jobs = soap_malloc(soap, sizeof(*(out->jobs->jobs))*i);
- if ( !out->jobs->jobs ) return SOAP_FAULT;
- out->jobs->__sizejobs = i;
+ out->jobs = soap_malloc(soap, sizeof(*(out->jobs))*i);
+ if ( !out->jobs ) return SOAP_FAULT;
+ out->__sizejobs = i;
for ( i = 0; jobs[i]; i++ ) {
char *s;
if ( !(s = edg_wlc_JobIdUnparse(jobs[i])) ) return SOAP_FAULT;
- if ( !(out->jobs->jobs[i] = soap_strdup(soap, s)) ) return SOAP_FAULT;
+ if ( !(out->jobs[i] = soap_strdup(soap, s)) ) return SOAP_FAULT;
free(s);
}
}
if ( states ) {
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;
+ out->states = soap_malloc(soap, sizeof(*(out->states))*i);
+ if ( !out->states ) return SOAP_FAULT;
+ out->__sizestates = i;
for ( i = 0; states[i].state; i++ )
- if ( edg_wll_StatusToSoap(soap, states+i, out->states->states+i) )
+ if ( edg_wll_StatusToSoap(soap, states+i, out->states+i) )
return SOAP_FAULT;
}
return SOAP_OK;
}
-
-#endif
struct lbt__queryRecValue *);
extern int edg_wll_SoapToQueryRec(
- const enum lbt__queryAttr,
- const struct lbt__queryRecord *,
- edg_wll_QueryRec *);
+ const struct lbt__queryConditions *collection,
+ const struct lbt__queryRecord *in,
+ edg_wll_QueryRec *out);
extern int edg_wll_QueryRecToSoap(struct soap *,
const edg_wll_QueryRec *,
struct lbt__queryRecord *);
extern int edg_wll_SoapToQueryCondsExt(
const struct lbt__queryConditions *,
+ int __sizecondition,
edg_wll_QueryRec ***);
extern int edg_wll_QueryCondsExtToSoap(struct soap *,
const edg_wll_QueryRec **,