edg_wll_QueryRec const *empty[] = { NULL };
char *notif_s;
- if (edg_wll_NotifNew(ctx,empty,-1,NULL,¬if,&valid)) {
+ if (edg_wll_NotifNew(ctx,empty,0,-1,NULL,¬if,&valid)) {
char *et,*ed;
edg_wll_Error(ctx,&et,&ed);
* Only a single occurence of a specific attribute is allowed
* among ANDed conditions (due to the ability to modify them
* further).
+ * \param[in] flags verbosity of notifications
+ 0 - send basic job status info
+ EDG_WLL_STAT_CLASSADS - send also JDL in job status
* \param[in] fd = -1 create or reuse the default listening socket (one per context)
* >= 0 non-default listening socket
* \param[in] address_override if not NULL, use this address instead of extracting it
int edg_wll_NotifNew(
edg_wll_Context context,
edg_wll_QueryRec const * const *conditions,
+ int flags,
int fd,
const char *address_override,
edg_wll_NotifId *id_out,
/* convert query to conditions */
conditions = convertQueryVectorExt(queryExt);
/* register */
- ret = edg_wll_NotifNew(ctx,conditions,-1,NULL,¬ifId,&valid);
+ ret = edg_wll_NotifNew(ctx,conditions,0,-1,NULL,¬ifId,&valid);
check_result(ret,ctx,"edg_wll_NotifNew");
/* clean */
if (conditions) {
int edg_wll_NotifNew(
edg_wll_Context ctx,
edg_wll_QueryRec const * const *conditions,
+ int flags,
int fd,
const char *address_override,
edg_wll_NotifId *id_out,
goto err;
if ( (ret = edg_wll_NotifRequestToXML(ctx, "New", notifId, address,
- EDG_WLL_NOTIF_NOOP, *valid, conditions, &send_mess)) )
+ EDG_WLL_NOTIF_NOOP, *valid, conditions, flags, &send_mess)) )
goto err;
ctx->p_tmp_timeout = ctx->p_notif_timeout;
goto err;
if (edg_wll_NotifRequestToXML(ctx, "Bind", id, address,
- EDG_WLL_NOTIF_NOOP, *valid, NULL, &send_mess))
+ EDG_WLL_NOTIF_NOOP, *valid, NULL, 0, &send_mess))
goto err;
ctx->p_tmp_timeout = ctx->p_notif_timeout;
goto err;
if (edg_wll_NotifRequestToXML(ctx, "Change", id, NULL,
- op, -1, conditions, &send_mess))
+ op, -1, conditions, 0, &send_mess))
goto err;
ctx->p_tmp_timeout = ctx->p_notif_timeout;
goto err;
if (edg_wll_NotifRequestToXML(ctx, "Refresh", id, NULL,
- EDG_WLL_NOTIF_NOOP, *valid, NULL, &send_mess))
+ EDG_WLL_NOTIF_NOOP, *valid, NULL, 0, &send_mess))
goto err;
ctx->p_tmp_timeout = ctx->p_notif_timeout;
goto err;
if (edg_wll_NotifRequestToXML(ctx, "Drop", id, NULL,
- EDG_WLL_NOTIF_NOOP, -1, NULL, &send_mess))
+ EDG_WLL_NOTIF_NOOP, -1, NULL, 0, &send_mess))
goto err;
ctx->p_tmp_timeout = ctx->p_notif_timeout;
me);
}
if ( !cmd || !strcmp(cmd, "new") )
- fprintf(stderr,"\n'new' command usage: %s new [ { -s socket_fd | -a fake_addr } -t requested_validity ] {-j jobid | -o owner | -n network_server | -v virtual_organization }\n"
+ fprintf(stderr,"\n'new' command usage: %s new [ { -s socket_fd | -a fake_addr } -t requested_validity ] {-j jobid | -o owner | -n network_server | -v virtual_organization } [-f flags]\n"
" jobid Job ID to connect notif. reg. with\n"
" owner Match this owner DN\n"
" requested_validity Validity of notification req. in seconds\n"
+ " flags 0 - return basic status, 1 - return also JDL in status\n"
" network_server Match only this networ server (WMS entry point)\n\n"
, me);
if ( !cmd || !strcmp(cmd, "bind") )
char *errt, *errd;
void *fields = NULL;
- int sock = -1;
+ int sock = -1, flags = 0;
char *fake_addr = NULL;
// sleep(20);
char *arg = NULL;
int attr = 0;
- while ((c = getopt(argc-1,argv+1,"j:o:v:n:s:a:t:")) > 0) switch (c) {
+ while ((c = getopt(argc-1,argv+1,"j:o:v:n:s:a:t:f:")) > 0) switch (c) {
case 'j':
if (arg) { usage("new"); return EX_USAGE; }
attr = EDG_WLL_QUERY_ATTR_JOBID;
fake_addr = optarg; break;
case 't':
valid = time(NULL) + atol(optarg); break;
+ case 'f':
+ flags = atoi(optarg); break;
default:
usage("new"); return EX_USAGE;
}
if ( !edg_wll_NotifNew(ctx,
(edg_wll_QueryRec const* const*)conditions,
- sock, fake_addr, &id_out, &valid))
+ flags, sock, fake_addr, &id_out, &valid))
fprintf(stderr,"notification ID: %s\nvalid: %s (%ld)\n",
edg_wll_NotifIdUnparse(id_out),
TimeToStr(valid),
extern int edg_wll_IndexedAttrsRequestToXML(edg_wll_Context ctx, char **message);
-extern int edg_wll_NotifRequestToXML( edg_wll_Context ctx, const char *function, const edg_wll_NotifId notifId, const char *address, edg_wll_NotifChangeOp op, time_t validity, edg_wll_QueryRec const * const *conditions, char **message);
+extern int edg_wll_NotifRequestToXML( edg_wll_Context ctx, const char *function, const edg_wll_NotifId notifId, const char *address, edg_wll_NotifChangeOp op, time_t validity, edg_wll_QueryRec const * const *conditions, int flags, char **message);
extern int edg_wll_QuerySequenceCodeToXML(edg_wll_Context ctx, glite_jobid_const_t jobId, char **message);
edg_wll_NotifChangeOp op,
time_t validity,
edg_wll_QueryRec const * const *conditions,
+ int flags,
char **message)
{
- char *pomA=NULL, *pomB=NULL, *pomC=NULL;
+ char *pomA=NULL, *pomB=NULL, *pomC=NULL, *cflags=NULL;
pomA = strdup("");
edg_wll_add_time_t_to_XMLBody(&pomA, validity, "requestedValidity", -1);
if (conditions && conditions[0] && conditions[0][0].attr != EDG_WLL_QUERY_ATTR_UNDEF)
edg_wll_JobQueryRecToXML(ctx, conditions, &pomB);
-
+ cflags = edg_wll_stat_flags_to_string(flags);
if (pomB)
- trio_asprintf(&pomC,"%s function=\"%s\">\r\n%s\t<and>\r\n%s\t</and>\r\n%s",
- NOTIF_REQUEST_BEGIN,function,pomA,pomB,NOTIF_REQUEST_END);
+ trio_asprintf(&pomC,"%s function=\"%s\">\r\n\t<flags>%s</flags>\r\n%s\t<and>\r\n%s\t</and>\r\n%s",
+ NOTIF_REQUEST_BEGIN,function,cflags,pomA,pomB,NOTIF_REQUEST_END);
else
- trio_asprintf(&pomC,"%s function=\"%s\">\r\n%s%s",
- NOTIF_REQUEST_BEGIN,function,pomA,NOTIF_REQUEST_END);
+ trio_asprintf(&pomC,"%s function=\"%s\">\r\n\t<flags>%s</flags>\r\n%s%s",
+ NOTIF_REQUEST_BEGIN,function,cflags,pomA,NOTIF_REQUEST_END);
+ free(cflags);
free(pomA);
free(pomB);
*message = pomC;
};
extern int edg_wll_NotifNewServer(edg_wll_Context,
- edg_wll_QueryRec const * const *, char const *,
+ edg_wll_QueryRec const * const *, int flags, char const *,
const edg_wll_NotifId, time_t *);
extern int edg_wll_NotifBindServer(edg_wll_Context,
const edg_wll_NotifId, const char *, time_t *);
edg_wll_NotifId notifId;
edg_wll_NotifChangeOp op;
edg_wll_QueryRec **conditions;
+ int flags;
time_t validity = -1;
int i,j;
if (parseNotifRequest(ctx, messageBody, &function, ¬ifId,
- &address, &op, &validity, &conditions))
+ &address, &op, &validity, &conditions, &flags))
ret = HTTP_BADREQ;
else {
int fatal = 0, err = 0;
// navratove chyby nejsou zname, nutno predelat dle aktualni situace
if (!strcmp(function,"New"))
err = edg_wll_NotifNewServer(ctx,
- (edg_wll_QueryRec const * const *)conditions,
+ (edg_wll_QueryRec const * const *)conditions, flags,
address, notifId, &validity);
else if (!strcmp(function,"Bind"))
err = edg_wll_NotifBindServer(ctx, notifId, address, &validity);
XMLCtx->jobQueryRec_begin = XML_GetCurrentByteIndex(XMLCtx->p);
}
else if ( (strcasecmp(el,"notifId")) && (strcasecmp(el,"clientAddress")) &&
- (strcasecmp(el,"notifChangeOp")) && (strcasecmp(el,"requestedValidity")) ) unexp()
+ (strcasecmp(el,"notifChangeOp")) && (strcasecmp(el,"requestedValidity")) &&
+ (strcasecmp(el,"flags")) ) unexp()
break;
case 2: /* fall through */
case 3: /* do not check xml tags, processed in startJobQueryRec */
parseJobQueryRec(XMLCtx->ctx, XMLCtx->message_body + XMLCtx->jobQueryRec_begin, len,
&XMLCtx->job_conditions);
}
+ else if (!strcmp(XMLCtx->element,"flags") && XMLCtx->char_buf) {
+ char *s;
+
+ s = glite_lbu_UnescapeXML((const char *) XMLCtx->char_buf);
+ // XXX: check if it works
+ XMLCtx->flags = edg_wll_string_to_stat_flags(s);
+ free(s);
+ }
+
}
edg_wll_freeBuf(XMLCtx);
return ret;
}
/* parse Notif request from client */
-int parseNotifRequest(edg_wll_Context ctx, char *messageBody, char **function, edg_wll_NotifId *notifId, char **address, edg_wll_NotifChangeOp *op, time_t *validity, edg_wll_QueryRec ***conditions)
+int parseNotifRequest(edg_wll_Context ctx, char *messageBody, char **function, edg_wll_NotifId *notifId, char **address, edg_wll_NotifChangeOp *op, time_t *validity, edg_wll_QueryRec ***conditions, int *flags)
{
int ret;
edg_wll_XML_ctx XMLCtx;
*op = EDG_WLL_NOTIF_NOOP;
*validity = 0;
*conditions = NULL;
+ *flags = 0;
} else {
*function = XMLCtx.notifFunction;
*notifId = XMLCtx.notifId;
*op = XMLCtx.notifChangeOp;
*validity = XMLCtx.notifValidity;
*conditions = XMLCtx.job_conditions;
+ *flags = XMLCtx.flags;
}
int parsePurgeRequest(edg_wll_Context ctx, char *messageBody, int (*tagToIndex)(), edg_wll_PurgeRequest *request);
int parseDumpRequest(edg_wll_Context ctx, char *messageBody, edg_wll_DumpRequest *request);
int parseLoadRequest(edg_wll_Context ctx, char *messageBody, edg_wll_LoadRequest *request);
-int parseNotifRequest(edg_wll_Context ctx, char *messageBody, char **function, edg_wll_NotifId *notifId, char **address, edg_wll_NotifChangeOp *op, time_t *validity, edg_wll_QueryRec ***conditions);
+int parseNotifRequest(edg_wll_Context ctx, char *messageBody, char **function, edg_wll_NotifId *notifId, char **address, edg_wll_NotifChangeOp *op, time_t *validity, edg_wll_QueryRec ***conditions, int *flags);
int parseQuerySequenceCodeRequest(edg_wll_Context ctx, char *messageBody, edg_wlc_JobId *jobId, char **source);
int edg_wll_QueryEventsToXML(edg_wll_Context, edg_wll_Event *, char **);
int edg_wll_QueryJobsToXML(edg_wll_Context, edg_wlc_JobId *, edg_wll_JobStat *, char **);
int edg_wll_NotifNewServer(
edg_wll_Context ctx,
edg_wll_QueryRec const * const *conditions,
+ int flags,
char const *address_override,
const edg_wll_NotifId nid,
time_t *valid)