From: Aleš Křenek Date: Thu, 22 Nov 2007 13:47:32 +0000 (+0000) Subject: support NS notifications X-Git-Tag: glite-yaim-lb_R_4_0_1_1~26 X-Git-Url: http://scientific.zcu.cz/git/?a=commitdiff_plain;h=eb9797f8862d85fece1fc7e0facf8783ada94ca5;p=jra1mw.git support NS notifications - does not work yet --- diff --git a/org.glite.lb.client/examples/notify.c b/org.glite.lb.client/examples/notify.c index f4a4c77..7f9b367 100644 --- a/org.glite.lb.client/examples/notify.c +++ b/org.glite.lb.client/examples/notify.c @@ -41,9 +41,10 @@ static void usage(char *cmd) me); } if ( !cmd || !strcmp(cmd, "new") ) - printf("\n'new' command usage: %s new [-j jobid] [-o owner]\n" + printf("\n'new' command usage: %s new {-j jobid | -o owner | -n network_server}\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" , me); if ( !cmd || !strcmp(cmd, "bind") ) printf("\n'bind' command usage: %s bind notifid [fake_addr]\n" @@ -157,20 +158,26 @@ err: int c; edg_wlc_JobId jid; edg_wll_NotifId id_out; - char *job = NULL,*owner = NULL; - - while ((c = getopt(argc-1,argv+1,"j:o:")) > 0) switch (c) { - case 'j': job = optarg; break; - case 'o': owner = optarg; break; + char *arg = NULL; + int attr = 0; + + while ((c = getopt(argc-1,argv+1,"j:o:n:")) > 0) switch (c) { + case 'j': + if (arg) { usage("new"); return 0; } + attr = EDG_WLL_QUERY_ATTR_JOBID; + arg = optarg; break; + case 'o': + if (arg) { usage("new"); return 0; } + attr = EDG_WLL_QUERY_ATTR_OWNER; + arg = optarg; break; + case 'n': + if (arg) { usage("new"); return 0; } + attr= EDG_WLL_QUERY_ATTR_NETWORK_SERVER; + arg = optarg; break; default: usage("new"); goto cleanup; } - if ((!job && !owner) || (job && owner)) { - usage("new"); - goto cleanup; - } - - if ( job && edg_wlc_JobIdParse(job, &jid) ) { + if ( attr == EDG_WLL_QUERY_ATTR_JOBID && edg_wlc_JobIdParse(arg, &jid) ) { printf("Job ID parameter not set propperly!\n"); usage("new"); goto cleanup; @@ -179,10 +186,10 @@ err: conditions = (edg_wll_QueryRec **)calloc(2,sizeof(edg_wll_QueryRec *)); conditions[0] = (edg_wll_QueryRec *)calloc(2,sizeof(edg_wll_QueryRec)); - conditions[0][0].attr = job ? EDG_WLL_QUERY_ATTR_JOBID : EDG_WLL_QUERY_ATTR_OWNER; + conditions[0][0].attr = attr; conditions[0][0].op = EDG_WLL_QUERY_OP_EQUAL; - if (job) conditions[0][0].value.j = jid; - else conditions[0][0].value.c = owner; + if (attr == EDG_WLL_QUERY_ATTR_JOBID) conditions[0][0].value.j = jid; + else conditions[0][0].value.c = arg; if ( !edg_wll_NotifNew(ctx, (edg_wll_QueryRec const* const*)conditions, @@ -192,7 +199,7 @@ err: TimeToStr(valid), valid); edg_wll_NotifIdFree(id_out); - if (job) edg_wlc_JobIdFree(jid); + if (attr == EDG_WLL_QUERY_ATTR_JOBID) edg_wlc_JobIdFree(jid); } else if ( !strcmp(argv[1], "bind") ) {