Annotation of 43BSDReno/contrib/isode-beta/quipu/task_invoke.c, revision 1.1

1.1     ! root        1: /* task_invoke.c - deal with invocation of an operation over a connection */
        !             2: 
        !             3: #ifndef        lint
        !             4: static char *rcsid = "$Header: /f/osi/quipu/RCS/task_invoke.c,v 7.0 89/11/23 22:18:13 mrose Rel $";
        !             5: #endif
        !             6: 
        !             7: /* 
        !             8:  * $Header: /f/osi/quipu/RCS/task_invoke.c,v 7.0 89/11/23 22:18:13 mrose Rel $
        !             9:  *
        !            10:  *
        !            11:  * $Log:       task_invoke.c,v $
        !            12:  * Revision 7.0  89/11/23  22:18:13  mrose
        !            13:  * Release 6.0
        !            14:  * 
        !            15:  */
        !            16: 
        !            17: /*
        !            18:  *                               NOTICE
        !            19:  *
        !            20:  *    Acquisition, use, and distribution of this module and related
        !            21:  *    materials are subject to the restrictions of a license agreement.
        !            22:  *    Consult the Preface in the User's Manual for the full terms of
        !            23:  *    this agreement.
        !            24:  *
        !            25:  */
        !            26: 
        !            27: 
        !            28: /* LINTLIBRARY */
        !            29: 
        !            30: #include "rosap.h"
        !            31: #include "quipu/util.h"
        !            32: #include "quipu/connection.h"
        !            33: 
        !            34: extern LLog    * log_dsap;
        !            35: extern time_t    timenow;
        !            36: extern time_t    admin_time;
        !            37: extern UTC       str2utct();
        !            38: struct task_act *       task_alloc();
        !            39: struct common_args     * get_ca_ref();
        !            40: 
        !            41: int      task_invoke(conn, dx)
        !            42: register       struct connection       * conn;
        !            43: register       struct DSAPinvoke       * dx;
        !            44: {
        !            45:     time_t               timer;
        !            46:     struct task_act    * task;
        !            47:     struct extension   * ext;
        !            48:     struct common_args * ca;
        !            49: 
        !            50:     DLOG(log_dsap, LLOG_TRACE, ("task_invoke()"));
        !            51: 
        !            52:     for(task=conn->cn_tasklist; task!=NULLTASK; task=task->tk_next)
        !            53:        if(task->tk_dx.dx_id == dx->dx_id)
        !            54:            break;
        !            55: 
        !            56:     if(task != NULLTASK)
        !            57:     {
        !            58:        DLOG(log_dsap, LLOG_TRACE, ("Duplicate invocation identifier %d", dx->dx_id));
        !            59:        send_ro_ureject(conn->cn_ad, &(dx->dx_id), ROS_IP_DUP);
        !            60:        return(NOTOK);
        !            61:     }
        !            62: 
        !            63:     task = task_alloc();
        !            64: 
        !            65:     DLOG(log_dsap, LLOG_TRACE, ("Operation Invoked"));
        !            66: 
        !            67:     task->tk_conn = conn;
        !            68:     task->tk_state = TK_ACTIVE;
        !            69:     task->tk_dx = (*dx);               /* struct copy */
        !            70: 
        !            71:     if(task->tk_dx.dx_arg.dca_dsarg.arg_type == OP_ABANDON)
        !            72:     {
        !            73:        DLOG(log_dsap, LLOG_NOTICE, ("Abandon received"));
        !            74: #ifndef NO_STATS
        !            75:        log_x500_event (&(task->tk_dx.dx_arg.dca_dsarg),task->tk_conn->cn_ctx,NULLDN,NULLDN,task->tk_conn->cn_ad);
        !            76: #endif
        !            77:        if(perform_abandon(task) == OK)
        !            78:        {
        !            79:            task_result(task);
        !            80:        }
        !            81:        else
        !            82:        {
        !            83:            task_error(task);
        !            84:        }
        !            85:        task_free(task);
        !            86:        return(OK);
        !            87:     }
        !            88: 
        !            89:     if(task->tk_dx.dx_arg.dca_dsarg.arg_type == OP_GETEDB)
        !            90:     {
        !            91:        DLOG(log_dsap, LLOG_TRACE, ("GetEDB received"));
        !            92:        task->tk_dx.dx_arg.dca_charg.cha_originator = dn_cpy(task->tk_conn->cn_dn);
        !            93:     }
        !            94: 
        !            95:     if((ca = get_ca_ref(&task->tk_dx.dx_arg)) != NULL_COMMONARG)
        !            96:     {
        !            97:        switch(ca->ca_servicecontrol.svc_prio)
        !            98:        {
        !            99:        case SVC_PRIO_LOW:
        !           100:            task->tk_prio = DSA_PRIO_LOW;
        !           101:            break;
        !           102:        case SVC_PRIO_MED:
        !           103:            task->tk_prio = DSA_PRIO_MED;
        !           104:            break;
        !           105:        case SVC_PRIO_HIGH:
        !           106:            task->tk_prio = DSA_PRIO_HIGH;
        !           107:            break;
        !           108:        default:
        !           109:            DLOG(log_dsap, LLOG_EXCEPTIONS, ("Impossibly svc_prio = %d",
        !           110:                    ca->ca_servicecontrol.svc_prio));
        !           111:            task->tk_prio = DSA_PRIO_LOW;
        !           112:            break;
        !           113:        }
        !           114: 
        !           115:        for(ext = ca->ca_extensions; ext!=NULLEXT; ext=ext->ext_next)
        !           116:        {
        !           117:            /* Check for unavailable critical extension */
        !           118:            if(ext->ext_critical)
        !           119:                break;
        !           120:        }
        !           121: 
        !           122:        if(ext != NULLEXT)
        !           123:        {
        !           124:            task->tk_resp.di_type = DI_ERROR;
        !           125:            task->tk_resp.di_error.de_err.dse_type = DSE_SERVICEERROR;
        !           126:            task->tk_resp.di_error.de_err.dse_un.dse_un_service.DSE_sv_problem = DSE_SV_UNAVAILABLECRITICALEXTENSION;
        !           127:            task_error(task);
        !           128:            task_free(task);
        !           129:            return(NOTOK);
        !           130:        }
        !           131:     }
        !           132:     else
        !           133:     {
        !           134:        /* Logic warning: No common args => low prio */
        !           135:        task->tk_prio = DSA_PRIO_LOW;
        !           136:     }
        !           137: 
        !           138:     /* Check for loop */
        !           139:     if(conn->cn_ctx == DS_CTX_X500_DAP)
        !           140:     {
        !           141:                if(ca != NULL_COMMONARG)
        !           142:        {
        !           143:            if(ca->ca_servicecontrol.svc_timelimit == SVC_NOTIMELIMIT)
        !           144:            {
        !           145:                task->tk_timed = FALSE;
        !           146:                if ( ! manager (task->tk_conn->cn_dn))
        !           147:                {
        !           148:                        task->tk_timed = 2;
        !           149:                        task->tk_timeout = timenow + admin_time;
        !           150:                }
        !           151:            }
        !           152:            else
        !           153:            {
        !           154:                task->tk_timed = TRUE;
        !           155:                if ((timer = ca->ca_servicecontrol.svc_timelimit) > admin_time)
        !           156:                {
        !           157:                    if (! manager (task->tk_conn->cn_dn))
        !           158:                    {
        !           159:                        task->tk_timed = 2;
        !           160:                        timer = admin_time;
        !           161:                    }
        !           162:                }
        !           163:                task->tk_timeout = timenow + timer;
        !           164:            }
        !           165: #ifdef DEBUG
        !           166:            if (task->tk_timed)
        !           167:                DLOG(log_dsap, LLOG_DEBUG, ("CommonArgs timelimit is %d secs", task->tk_timeout - timenow));
        !           168: #endif
        !           169:        }
        !           170:        else
        !           171:        {
        !           172:            task->tk_timed = FALSE;
        !           173:        }
        !           174:     }
        !           175:     else
        !           176:     {
        !           177:        struct chain_arg        * cha = &(task->tk_dx.dx_arg.dca_charg);
        !           178: 
        !           179:        if(cha_loopdetected(cha))
        !           180:        {
        !           181:            task->tk_resp.di_type = DI_ERROR;
        !           182:            task->tk_resp.di_error.de_err.dse_type = DSE_SERVICEERROR;
        !           183:            task->tk_resp.di_error.de_err.dse_un.dse_un_service.DSE_sv_problem = DSE_SV_LOOPDETECT;
        !           184:            task_error(task);
        !           185:            task_free(task);
        !           186:            return(NOTOK);
        !           187:        }
        !           188: 
        !           189:        if(cha->cha_timelimit == NULLCP)
        !           190:        {
        !           191:            task->tk_timed = 2;
        !           192:            task->tk_timeout = timenow + admin_time;
        !           193: 
        !           194:             if(ca != NULL_COMMONARG) 
        !           195:            {
        !           196:                if(ca->ca_servicecontrol.svc_timelimit != SVC_NOTIMELIMIT)
        !           197:                {
        !           198:                    task->tk_timed = TRUE;
        !           199:                    if (ca->ca_servicecontrol.svc_timelimit < admin_time)
        !           200:                    {
        !           201:                        task->tk_timeout = timenow + ca->ca_servicecontrol.svc_timelimit;
        !           202:                    }
        !           203:                }
        !           204:            }
        !           205: #ifdef DEBUG
        !           206:            if (task->tk_timed)
        !           207:                DLOG(log_dsap, LLOG_DEBUG, ("DSP CommonArgs timelimit is %d secs", task->tk_timeout - timenow));
        !           208: #endif
        !           209:        }
        !           210:        else
        !           211:        {
        !           212:            UTC   ut;
        !           213: 
        !           214:            task->tk_timed = TRUE;
        !           215:            ut = str2utct(cha->cha_timelimit, 12);
        !           216:            task->tk_timeout = gtime(ut2tm(ut));
        !           217:            timer = timenow;
        !           218:            if (task->tk_timeout - timer > admin_time)
        !           219:            {
        !           220:                /* DSP -> can't rely on manager() !!! */
        !           221:                task->tk_timed = 2;
        !           222:                task->tk_timeout = timer + admin_time;
        !           223:                DLOG(log_dsap, LLOG_DEBUG, ("Chained timeout (limited) is %s", cha->cha_timelimit));
        !           224:            }
        !           225:            else 
        !           226:            {
        !           227:                DLOG(log_dsap, LLOG_DEBUG, ("Chained timeout is %s", cha->cha_timelimit));
        !           228:            }
        !           229:        }
        !           230:     }
        !           231: 
        !           232:     if(task->tk_timed == FALSE)
        !           233:     {
        !           234:        DLOG(log_dsap, LLOG_TRACE, ("task has NO timelimit"));
        !           235:     }
        !           236: #ifdef DEBUG
        !           237:     else
        !           238:     {
        !           239:        struct UTCtime    ut;
        !           240:        struct UTCtime    ut2;
        !           241: 
        !           242:        DLOG(log_dsap, LLOG_TRACE, ("inv task has timelimit of %ld", task->tk_timeout));
        !           243:        tm2ut(gmtime(&(task->tk_timeout)), &ut);
        !           244:        DLOG(log_dsap, LLOG_DEBUG, ("converted timelimit = %s", utct2str(&(ut))));
        !           245:        tm2ut(gmtime(&(timenow)), &ut2);
        !           246:        DLOG(log_dsap, LLOG_DEBUG, ("time now = %s", utct2str(&(ut2))));
        !           247:     }
        !           248: #endif
        !           249: 
        !           250:     task->tk_next = conn->cn_tasklist;
        !           251:     conn->cn_tasklist = task;
        !           252:     task->tk_state = TK_ACTIVE;
        !           253:     return(OK);
        !           254: }
        !           255: 

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.