|
DataMuseum.dkPresents historical artifacts from the history of: DKUUG/EUUG Conference tapes |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about DKUUG/EUUG Conference tapes Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - downloadIndex: T t
Length: 7170 (0x1c02) Types: TextFile Names: »task_invoke.c«
└─⟦2d1937cfd⟧ Bits:30007241 EUUGD22: P.P 5.0 └─⟦35176feda⟧ »EurOpenD22/isode/isode-6.tar.Z« └─⟦de7628f85⟧ └─⟦this⟧ »isode-6.0/quipu/task_invoke.c«
/* task_invoke.c - deal with invocation of an operation over a connection */ #ifndef lint static char *rcsid = "$Header: /f/osi/quipu/RCS/task_invoke.c,v 7.0 89/11/23 22:18:13 mrose Rel $"; #endif /* * $Header: /f/osi/quipu/RCS/task_invoke.c,v 7.0 89/11/23 22:18:13 mrose Rel $ * * * $Log: task_invoke.c,v $ * Revision 7.0 89/11/23 22:18:13 mrose * Release 6.0 * */ /* * NOTICE * * Acquisition, use, and distribution of this module and related * materials are subject to the restrictions of a license agreement. * Consult the Preface in the User's Manual for the full terms of * this agreement. * */ /* LINTLIBRARY */ #include "rosap.h" #include "quipu/util.h" #include "quipu/connection.h" extern LLog * log_dsap; extern time_t time(); extern time_t admin_time; extern UTC str2utct(); struct task_act * task_alloc(); struct common_args * get_ca_ref(); int task_invoke(conn, rox) register struct connection * conn; register struct RoSAPinvoke * rox; { time_t timer; struct task_act * task; DLOG(log_dsap, LLOG_TRACE, ("task_invoke()")); for(task=conn->cn_tasklist; task!=NULLTASK; task=task->tk_next) if(task->tk_id == rox->rox_id) break; if(task != NULLTASK) { DLOG(log_dsap, LLOG_TRACE, ("Duplicate invocation identifier %d", rox->rox_id)); send_ro_ureject(conn->cn_ad, &(rox->rox_id), ROS_IP_DUP); return(NOTOK); } if(qu_recog_op(rox->rox_op)) { task = task_alloc(); if(decode_OPArgument(conn->cn_ctx, rox->rox_args, rox->rox_op, &(task->tk_req)) == OK) { struct extension * ext; DLOG(log_dsap, LLOG_TRACE, ("Operation Invoked")); task->tk_conn = conn; task->tk_state = TK_ACTIVE; task->tk_type = ACT_TYPE_REQ; task->tk_id = rox->rox_id; if(task->tk_req.dca_dsarg.arg_type == OP_ABANDON) { DLOG(log_dsap, LLOG_NOTICE, ("Abandon received")); #ifndef NO_STATS log_x500_event (&(task->tk_req.dca_dsarg),task->tk_conn->cn_ctx,NULLDN,NULLDN,task->tk_conn->cn_ad); #endif if(perform_abandon(task) == OK) { task_result(task); } else { task_error(task); } task_free(task); return(OK); } if(task->tk_req.dca_dsarg.arg_type == OP_GETEDB) { DLOG(log_dsap, LLOG_TRACE, ("GetEDB received")); task->tk_req.dca_charg.cha_originator = dn_cpy(task->tk_conn->cn_who); } if((task->tk_ca = get_ca_ref(&task->tk_req)) != NULL_COMMONARG) { switch(task->tk_ca->ca_servicecontrol.svc_prio) { case SVC_PRIO_LOW: task->tk_prio = DSA_PRIO_LOW; break; case SVC_PRIO_MED: task->tk_prio = DSA_PRIO_MED; break; case SVC_PRIO_HIGH: task->tk_prio = DSA_PRIO_HIGH; break; default: DLOG(log_dsap, LLOG_EXCEPTIONS, ("Impossibly svc_prio = %d", task->tk_ca->ca_servicecontrol.svc_prio)); task->tk_prio = DSA_PRIO_LOW; break; } for(ext = task->tk_ca->ca_extensions; ext!=NULLEXT; ext=ext->ext_next) { /* Check for unavailable critical extension */ if(ext->ext_critical) break; } if(ext != NULLEXT) { task->tk_type = ACT_TYPE_RESP; task->tk_resp.resp_type = RESP_TYPE_RET; task->tk_resp.ret_type = RET_TYPE_ERR; task->tk_resp.resp_err.dse_type = DSE_SERVICEERROR; task->tk_resp.resp_err.dse_un.dse_un_service.DSE_sv_problem = DSE_SV_UNAVAILABLECRITICALEXTENSION; task_error(task); task_free(task); return(NOTOK); } } else { /* Logic warning: No common args => low prio */ task->tk_prio = DSA_PRIO_LOW; } /* Check for loop */ if(conn->cn_ctx == CN_CTX_X500_DAP) { if(task->tk_ca != NULL_COMMONARG) { if(task->tk_ca->ca_servicecontrol.svc_timelimit == SVC_NOTIMELIMIT) { task->tk_timed = FALSE; if ( ! manager (task->tk_conn->cn_who)) { task->tk_timed = 2; task->tk_timeout = time((time_t *) 0) + admin_time; } } else { task->tk_timed = TRUE; if ((timer = task->tk_ca->ca_servicecontrol.svc_timelimit) > admin_time) if (! manager (task->tk_conn->cn_who)) { task->tk_timed = 2; timer = admin_time; } task->tk_timeout = time((time_t *) 0) + timer; } #ifdef DEBUG if (task->tk_timed) DLOG(log_dsap, LLOG_DEBUG, ("CommonArgs timelimit is %d secs", task->tk_timeout - time((time_t *) 0))); #endif } else { task->tk_timed = FALSE; } } else { if(cha_loopdetected(task->tk_cha)) { task->tk_type = ACT_TYPE_RESP; task->tk_resp.resp_type = RESP_TYPE_RET; task->tk_resp.ret_type = RET_TYPE_ERR; task->tk_resp.resp_err.dse_type = DSE_SERVICEERROR; task->tk_resp.resp_err.dse_un.dse_un_service.DSE_sv_problem = DSE_SV_LOOPDETECT; task_error(task); task_free(task); return(NOTOK); } if(task->tk_cha->cha_timelimit == NULLCP) { task->tk_timed = 2; task->tk_timeout = time((time_t *) 0) + admin_time; if(task->tk_ca != NULL_COMMONARG) if(task->tk_ca->ca_servicecontrol.svc_timelimit != SVC_NOTIMELIMIT) { task->tk_timed = TRUE; if (task->tk_ca->ca_servicecontrol.svc_timelimit < admin_time) task->tk_timeout = time((time_t *) 0) + task->tk_ca->ca_servicecontrol.svc_timelimit; } #ifdef DEBUG if (task->tk_timed) DLOG(log_dsap, LLOG_DEBUG, ("DSP CommonArgs timelimit is %d secs", task->tk_timeout - time((time_t *) 0))); #endif } else { UTC ut; task->tk_timed = TRUE; ut = str2utct(task->tk_cha->cha_timelimit, 12); task->tk_timeout = gtime(ut2tm(ut)); timer = time ((time_t *)0); if (task->tk_timeout - timer > admin_time) { /* DSP -> can't rely on manager() !!! */ task->tk_timed = 2; task->tk_timeout = timer + admin_time; DLOG(log_dsap, LLOG_DEBUG, ("Chained timeout (limited) is %s", task->tk_cha->cha_timelimit)); } else DLOG(log_dsap, LLOG_DEBUG, ("Chained timeout is %s", task->tk_cha->cha_timelimit)); } } if(task->tk_timed == FALSE) { DLOG(log_dsap, LLOG_TRACE, ("task has NO timelimit")); } #ifdef DEBUG else { long clock; struct UTCtime ut; struct UTCtime ut2; DLOG(log_dsap, LLOG_TRACE, ("inv task has timelimit of %ld", task->tk_timeout)); tm2ut(gmtime(&(task->tk_timeout)), &ut); DLOG(log_dsap, LLOG_DEBUG, ("converted timelimit = %s", utct2str(&(ut)))); (void) time(&clock); tm2ut(gmtime(&(clock)), &ut2); DLOG(log_dsap, LLOG_DEBUG, ("time now = %s", utct2str(&(ut2)))); } #endif } else { send_ro_ureject(conn->cn_ad, &(rox->rox_id), ROS_IP_MISTYPED); /* task_free(task); Decoding does not produce structures safe to free when the decoder returns NOTOK. The hack for now is to blank the task and let some memory snarl up. */ free((char *)task); return(NOTOK); } } else { DLOG(log_dsap, LLOG_TRACE, ("Unrecognized operation id %d", rox->rox_op)); send_ro_ureject(conn->cn_ad, &(rox->rox_id), ROS_IP_UNRECOG); return(NOTOK); } task->tk_next = conn->cn_tasklist; conn->cn_tasklist = task; task->tk_state = TK_ACTIVE; return(OK); }