* \param[in] address_override if not NULL, use this address instead of extracting it
* from the connection (useful when multiple interfaces are present,
* circumventing NAT problems etc.)
- * \param[in] valid until when the registration is valid (NULL means no interest in
+ * \param[in,out] valid until when the registration is valid
+ in: requested validity (NULL means 'give me server defaults')
+ out: value really set on the server
* \param[out] id_out returened NotifId
* the value
* \retval 0 OK
* \param[in] id notification ID you are binding to
* \param[in] fd same as for \ref edg_wll_NotifNew
* \param[in] address_override same as for \ref edg_wll_NotifNew
- * \param[in] valid same as for \ref edg_wll_NotifNew
+ * \param[in,out] valid same as for \ref edg_wll_NotifNew
*/
int edg_wll_NotifBind(
/** Refresh the registration, i.e. extend its validity period.
* \param[in,out] context context to work with
* \param[in] id notification ID you are working with
- * \param[in] valid until when the registration is valid (NULL means no interest in
- * the value
+ * \param[in,out] valid same as for \ref edg_wll_NotifNew
*/
int edg_wll_NotifRefresh(
goto err;
if ( (ret = edg_wll_NotifRequestToXML(ctx, "New", notifId, address,
- EDG_WLL_NOTIF_NOOP, conditions, &send_mess)) )
+ EDG_WLL_NOTIF_NOOP, *valid, conditions, &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, NULL, &send_mess))
+ EDG_WLL_NOTIF_NOOP, *valid, NULL, &send_mess))
goto err;
ctx->p_tmp_timeout = ctx->p_notif_timeout;
goto err;
if (edg_wll_NotifRequestToXML(ctx, "Change", id, NULL,
- op, conditions, &send_mess))
+ op, -1, conditions, &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, NULL, &send_mess))
+ EDG_WLL_NOTIF_NOOP, *valid, NULL, &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, NULL, &send_mess))
+ EDG_WLL_NOTIF_NOOP, -1, NULL, &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 } ] {-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 }\n"
" jobid job ID to connect notif. reg. with\n"
" owner match this owner DN\n"
" network_server match only this networ server (WMS entry point)\n\n"
, me);
if ( !cmd || !strcmp(cmd, "bind") )
- fprintf(stderr,"\n'bind' command usage: %s bind [ { -s socket_fd | -a fake_addr } ] notifid\n"
+ fprintf(stderr,"\n'bind' command usage: %s bind [ { -s socket_fd | -a fake_addr } -t requested_validity ] notifid\n"
" notifid Notification ID\n"
" fake_addr Fake the client address\n", me);
/* UNIMPL
" jobid Job ID to connect notif. reg. with.\n", me);
*/
if ( !cmd || !strcmp(cmd, "refresh") )
- fprintf(stderr,"\n'refresh' command usage: %s refresh notifid\n"
+ fprintf(stderr,"\n'refresh' command usage: %s refresh [-t requested_validity ] notifid\n"
" notifid Notification ID.\n", me);
if ( !cmd || !strcmp(cmd, "receive") )
fprintf(stderr,"\n'receive' command usage: %s receive [ { -s socket_fd | -a fake_addr } ] [-t timeout] [-f field1,field2,...] [notifid]\n"
{
edg_wll_Context ctx;
edg_wll_QueryRec **conditions = NULL;
- time_t valid;
+ time_t valid = 0;
char *errt, *errd;
struct timeval tout = {220, 0};
void *fields = NULL;
char *arg = NULL;
int attr = 0;
- while ((c = getopt(argc-1,argv+1,"j:o:v:n:s:a:")) > 0) switch (c) {
+ while ((c = getopt(argc-1,argv+1,"j:o:v:n:s:a:t:")) > 0) switch (c) {
case 'j':
if (arg) { usage("new"); return EX_USAGE; }
attr = EDG_WLL_QUERY_ATTR_JOBID;
case 'a':
if (sock >= 0) { usage("new"); return EX_USAGE; }
fake_addr = optarg; break;
+ case 't':
+ valid = atol(optarg); break;
default:
usage("new"); return EX_USAGE;
}
edg_wll_NotifId nid;
int c;
- while ((c = getopt(argc-1,argv+1,"s:a:")) > 0) switch (c) {
+ while ((c = getopt(argc-1,argv+1,"s:a:t:")) > 0) switch (c) {
case 's':
if (fake_addr) { usage("bind"); return EX_USAGE; }
sock = atoi(optarg); break;
case 'a':
if (sock >= 0) { usage("bind"); return EX_USAGE; }
fake_addr = optarg; break;
+ case 't':
+ valid = atol(optarg); break;
default:
usage("bind"); return EX_USAGE;
}
else if ( !strcmp(argv[1], "refresh") )
{
edg_wll_NotifId nid;
+ int c;
- if ( (argc < 3) || edg_wll_NotifIdParse(argv[2], &nid) )
+ while ((c = getopt(argc-1,argv+1,"t:")) > 0) switch (c) {
+ case 't':
+ valid = atol(optarg); break;
+ default:
+ usage("refresh"); return EX_USAGE;
+ }
+
+ if ( (optind+1 == argc) || edg_wll_NotifIdParse(argv[optind+1], &nid) )
{
- fprintf(stderr,"Notification ID parameter not set propperly!\n");
+ fprintf(stderr,"Notification ID parameter not set propperly!\n\n");
usage("refresh");
return EX_USAGE;
}
+
if ( !edg_wll_NotifRefresh(ctx, nid, &valid) )
printf("valid until: %s (%ld)\n", TimeToStr(valid), valid);
edg_wll_NotifIdFree(nid);
if (parseNotifRequest(ctx, messageBody, &function, ¬ifId,
- &address, &op, &conditions))
+ &address, &op, &validity, &conditions))
ret = HTTP_BADREQ;
else {
int fatal = 0, err = 0;
XMLCtx->jobQueryRec_begin = XML_GetCurrentByteIndex(XMLCtx->p);
}
else if ( (strcasecmp(el,"notifId")) && (strcasecmp(el,"clientAddress")) &&
- (strcasecmp(el,"notifChangeOp")) ) unexp()
+ (strcasecmp(el,"notifChangeOp")) && (strcasecmp(el,"requestedValidity")) ) unexp()
break;
case 2: /* fall through */
case 3: /* do not check xml tags, processed in startJobQueryRec */
XMLCtx->notifChangeOp = edg_wll_StringToNotifChangeOp(pom);
free(pom);
}
+ else if (!strcmp(XMLCtx->element,"requestedValidity")) {
+ XMLCtx->notifValidity = edg_wll_from_string_to_time_t(XMLCtx);
+ }
else if (!strcmp(el,"and")) {
long len = (XML_GetCurrentByteIndex(XMLCtx->p) + XML_GetCurrentByteCount(XMLCtx->p))
- XMLCtx->jobQueryRec_begin;
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, 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 ret;
edg_wll_XML_ctx XMLCtx;
*notifId = NULL;
*address = NULL;
*op = EDG_WLL_NOTIF_NOOP;
+ *validity = 0;
*conditions = NULL;
} else {
*function = XMLCtx.notifFunction;
*notifId = XMLCtx.notifId;
*address = XMLCtx.notifClientAddress;
*op = XMLCtx.notifChangeOp;
+ *validity = XMLCtx.notifValidity;
*conditions = XMLCtx.job_conditions;
}
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, 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 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 **);
/* Format time of validity
*/
-/* XXX: until valid works [inout] */
- *valid = time(NULL) + ctx->notifDuration;
+ if (*valid == 0)
+ *valid = time(NULL) + ctx->notifDuration;
adjust_validity(ctx,valid);
glite_lbu_TimeToDB(*valid, &time_s);
/* Format time of validity
*/
-/* XXX: until valid works [inout] */
- *valid = time(NULL) + ctx->notifDuration;
+ if (*valid == 0)
+ *valid = time(NULL) + ctx->notifDuration;
adjust_validity(ctx,valid);
glite_lbu_TimeToDB(*valid, &time_s);
/* Format time of validity
*/
-/* XXX: until valid works [inout] */
- *valid = time(NULL) + ctx->notifDuration;
+ if (*valid == 0)
+ *valid = time(NULL) + ctx->notifDuration;
adjust_validity(ctx,valid);
glite_lbu_TimeToDB(*valid, &time_s);