notif_create_ulm(
edg_wll_Context context,
edg_wll_NotifId reg_id,
- const char *host,
- const uint16_t port,
+ const char *dest_url,
const char *owner,
int expires,
const char *notif_data,
{
int ret;
edg_wll_Event *event=NULL;
+ char *host = NULL;
+ uint16_t port = 0;
*ulm_data = NULL;
*reg_id_s = NULL;
if (context->p_instance) event->notification.src_instance = strdup(context->p_instance);
event->notification.notifId = edg_wll_NotifIdDup(reg_id);
if (owner) event->notification.owner = strdup(owner);
- if (host) event->notification.dest_host = strdup(host);
- event->notification.dest_port = port;
+ if (dest_url) {
+ if (strstr(dest_url, "//")) {
+ // using complete URL
+ event->notification.dest_url = strdup(dest_url);
+ } else {
+ // using plain host:port
+ host = strrchr(dest_url, ':');
+ port = atoi(host+1);
+ if ( !(host = strndup(dest_url, host-dest_url)) )
+ {
+ edg_wll_SetError(context, ret = errno, "updating notification records");
+ goto out;
+ }
+ event->notification.dest_host = host;
+ event->notification.dest_port = port;
+ host = NULL;
+ }
+ }
if (notif_data) event->notification.jobstat = strdup(notif_data);
event->notification.expires = expires;
int
edg_wll_NotifSend(edg_wll_Context context,
edg_wll_NotifId reg_id,
- const char *host,
- int port,
+ const char *dest_url,
const char *owner,
int expires,
const char *notif_data)
if((ret=notif_create_ulm(context,
reg_id,
- host,
- port,
+ dest_url,
owner,
expires,
notif_data,
int
edg_wll_NotifJobStatus(edg_wll_Context context,
edg_wll_NotifId reg_id,
- const char *host,
- int port,
+ const char *dest_url,
const char *owner,
int flags,
int authz_flags,
goto out;
}
- if ((ret=edg_wll_NotifSend(context, reg_id, host, port, owner, expires, xml_esc_data))) {
+ if ((ret=edg_wll_NotifSend(context, reg_id, dest_url, owner, expires, xml_esc_data))) {
char *ed = NULL, *et = NULL;
if(ret) edg_wll_UpdateError(context, ret, "edg_wll_NotifJobStatus()");
int
edg_wll_NotifChangeIL(edg_wll_Context context,
edg_wll_NotifId reg_id,
- const char *host,
- int port,
+ const char *dest_url,
int expires)
{
- return(edg_wll_NotifSend(context, reg_id, host, port, "", expires, ""));
+ return(edg_wll_NotifSend(context, reg_id, dest_url, "", expires, ""));
}
edg_wll_NotifId reg_id)
{
/* XXX: Jan 1 1970 00:00:01 -- quite sure to make it expire immediately */
- return(edg_wll_NotifSend(context, reg_id, NULL, 0, "", 1, ""));
+ return(edg_wll_NotifSend(context, reg_id, NULL, "", 1, ""));
}
else if (notif_match_conditions(ctx,oldstat,stat,jobc[4]) &&
notif_check_acl(ctx,stat,jobc[3], &authz_flags))
{
- char *dest, *aux;
- int port;
+ char *dest;
glite_common_log(LOG_CATEGORY_LB_SERVER, LOG_PRIORITY_DEBUG, "NOTIFY: %s, job %s", jobc[0], ju = edg_wlc_JobIdGetUnique(stat->jobId));
free(ju); ju = NULL;
- dest = strdup(jobc[1]);
- if ( !(aux = strrchr(dest, ':')) )
- {
- edg_wll_SetError(ctx, EINVAL, "Can't parse notification destination");
- free(dest);
- for (i=0; i<sizeof(jobc)/sizeof(jobc[0]); i++) free(jobc[i]);
- goto err;
- }
- *aux = 0;
- aux++;
- port = atoi(aux);
+ dest = jobc[1];
if ( edg_wll_NotifIdSetUnique(&nid, jobc[0]) )
{
/* XXX: only temporary hack!!!
*/
ctx->p_instance = strdup("");
- if ( edg_wll_NotifJobStatus(ctx, nid, dest, port, jobc[3], atoi(jobc[5]), authz_flags, expires, *stat) )
+ if ( edg_wll_NotifJobStatus(ctx, nid, dest, jobc[3], atoi(jobc[5]), authz_flags, expires, *stat) )
{
- free(dest);
for (i=0; i<sizeof(jobc)/sizeof(jobc[0]); i++) free(jobc[i]);
goto err;
}
- free(dest);
}
for (i=0; i<sizeof(jobc)/sizeof(jobc[0]); i++) free(jobc[i]);
}
if ( dest )
{
- host = strrchr(dest, ':');
- port = atoi(host+1);
- if ( !(host = strndup(dest, host-dest)) )
- {
- edg_wll_SetError(ctx, errno, "updating notification records");
- goto cleanup;
- }
trio_asprintf(&aux, "%s destination='%|Ss'", stmt, dest);
free(stmt);
stmt = aux;
*/
}
- if ( host || valid) {
+ if ( dest || valid) {
char *v = strdup(valid),*v2 = strchr(v+1,'\'');
int expires;
printf("edg_wll_NotifChangeIL(ctx, %s, %s, %d)\n",
nid_s? nid_s: "nid", host, port);
*/
- if ( edg_wll_NotifChangeIL(ctx, nid, host, port, expires) ) {
+ if ( edg_wll_NotifChangeIL(ctx, nid, dest, expires) ) {
char *errt, *errd;
edg_wll_Error(ctx, &errt, &errd);