enable to pass notification validity from client to server (part II)
authorMiloš Mulač <mulac@civ.zcu.cz>
Mon, 17 Mar 2008 16:14:08 +0000 (16:14 +0000)
committerMiloš Mulač <mulac@civ.zcu.cz>
Mon, 17 Mar 2008 16:14:08 +0000 (16:14 +0000)
org.glite.lb.client/examples/notify.pl
org.glite.lb.client/src/notify.c
org.glite.lb.common/interface/xml_parse.h
org.glite.lb.common/src/xml_parse.c.T

index 425f027..7defa0d 100755 (executable)
@@ -27,7 +27,7 @@ while (1) {
        select($fdin,undef,undef,undef);
        print "got connection\n";
 
-       system "$notif receive -s $fd -t 3";
+       system "$notif receive -s $fd -i 3";
 }
 
 
index 0e8c226..5d5ec2e 100644 (file)
@@ -64,7 +64,7 @@ static void usage(char *cmd)
                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"
+               fprintf(stderr,"\n'receive' command usage: %s receive [ { -s socket_fd | -a fake_addr } ] [-t requested_validity ] [-i timeout] [-f field1,field2,...] [notifid]\n"
                        "    notifid     Notification ID (not used if -s specified).\n"
                        "    fake_addr   Fake the client address.\n"
                        "    field1,field2,...  list of status fields to print (only owner by default)\n"
@@ -199,17 +199,19 @@ int main(int argc,char **argv)
                int                     c;
                char    *field_arg = "owner",*err;
 
-               while ((c = getopt(argc-1,argv+1,"s:a:t:f:")) > 0) switch (c) {
+               while ((c = getopt(argc-1,argv+1,"s:a:i:f:t:")) > 0) switch (c) {
                        case 's':
                                if (fake_addr) { usage("receive"); return EX_USAGE; }
                                sock = atoi(optarg); break;
                        case 'a':
                                if (sock >= 0) { usage("receive"); return EX_USAGE; }
                                fake_addr = optarg; break;
-                       case 't':
+                       case 'i':
                                tout.tv_sec = atoi(optarg); break;
                        case 'f':
                                field_arg = optarg; break;
+                       case 't':
+                               valid = atol(optarg); break;
                        default:
                                usage("receive"); return EX_USAGE;
                }
index 1f92acc..61c72e0 100644 (file)
@@ -59,7 +59,7 @@ extern int edg_wll_LoadRequestToXML(edg_wll_Context ctx, const edg_wll_LoadReque
 
 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, 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, char **message);
 
 extern int edg_wll_QuerySequenceCodeToXML(edg_wll_Context ctx, glite_jobid_const_t jobId, char **message);
        
index 650ae81..a5d9e64 100644 (file)
@@ -2860,6 +2860,7 @@ int edg_wll_NotifRequestToXML(
                const edg_wll_NotifId notifId,
                const char *address,
                edg_wll_NotifChangeOp op,
+               time_t validity,
                edg_wll_QueryRec const * const *conditions,
                 char **message)
 {
@@ -2870,6 +2871,7 @@ int edg_wll_NotifRequestToXML(
        edg_wll_add_string_to_XMLBody(&pomA, edg_wll_NotifIdUnparse(notifId), "notifId", NULL);
        edg_wll_add_string_to_XMLBody(&pomA, address, "clientAddress", NULL);
        edg_wll_add_string_to_XMLBody(&pomA, edg_wll_NotifChangeOpToString(op), "notifChangeOp", NULL);
+       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);