Annotation of 43BSDReno/contrib/isode-beta/quipu/oper_act.c, revision 1.1.1.1

1.1       root        1: /* oper_act.c - routines to handle operation activity blocks */
                      2: 
                      3: #ifndef lint
                      4: static char *rcsid = "$Header: /f/osi/quipu/RCS/oper_act.c,v 7.1 90/07/09 14:46:21 mrose Exp $";
                      5: #endif
                      6: 
                      7: /*
                      8:  * $Header: /f/osi/quipu/RCS/oper_act.c,v 7.1 90/07/09 14:46:21 mrose Exp $
                      9:  *
                     10:  *
                     11:  * $Log:       oper_act.c,v $
                     12:  * Revision 7.1  90/07/09  14:46:21  mrose
                     13:  * sync
                     14:  * 
                     15:  * Revision 7.0  89/11/23  22:17:50  mrose
                     16:  * Release 6.0
                     17:  * 
                     18:  */
                     19: 
                     20: /*
                     21:  *                                NOTICE
                     22:  *
                     23:  *    Acquisition, use, and distribution of this module and related
                     24:  *    materials are subject to the restrictions of a license agreement.
                     25:  *    Consult the Preface in the User's Manual for the full terms of
                     26:  *    this agreement.
                     27:  *
                     28:  */
                     29: 
                     30: 
                     31: #include "quipu/util.h"
                     32: #include "quipu/connection.h"
                     33: 
                     34: extern LLog * log_dsap;
                     35: 
                     36: struct oper_act *oper_alloc()
                     37: {
                     38:     struct oper_act    * on_ret;
                     39: 
                     40:     on_ret = (struct oper_act *) calloc(1,sizeof(struct oper_act));
                     41: 
                     42:     on_ret->on_arg = &(on_ret->on_req);
                     43: 
                     44:     on_ret->on_relay = TRUE;   /* Relay unless reason not to. */
                     45: 
                     46:     return(on_ret);
                     47: }
                     48: 
                     49: oper_free(on)
                     50: struct oper_act *on;
                     51: {
                     52:        DLOG(log_dsap, LLOG_TRACE, ("oper_free()"));
                     53:        on->on_state = -1;
                     54: 
                     55:        if (on->on_req.dca_charg.cha_trace != (struct trace_info *)NULL)
                     56:                if (on->on_type == ON_TYPE_SUBTASK) 
                     57:                        ch_arg_free (&on->on_req);
                     58:                else
                     59:                        op_arg_free (&on->on_req.dca_dsarg);
                     60: 
                     61:        free((char *)on);
                     62: }
                     63: 
                     64: oper_extract(on)
                     65: struct oper_act        * on;
                     66: {
                     67:        DLOG(log_dsap, LLOG_TRACE, ("oper_extract()"));
                     68: 
                     69:     if(on->on_conn != NULLCONN)
                     70:        oper_conn_extract(on);
                     71: 
                     72:     if(on->on_task != NULLTASK)
                     73:        oper_task_extract(on);
                     74: 
                     75:     oper_free(on);
                     76: }
                     77: 
                     78: oper_conn_extract(on)
                     79: struct oper_act        * on;
                     80: {
                     81:     /*
                     82:     * Extract the operation activity block from the list held by its
                     83:     * connection.
                     84:     */
                     85:     struct oper_act    * on_tmp;
                     86:     struct oper_act    **on_p;
                     87: 
                     88:        DLOG(log_dsap, LLOG_TRACE, ("oper_conn_extract()"));
                     89: 
                     90:     if(on == NULLOPER)
                     91:     {
                     92:        LLOG (log_dsap,LLOG_FATAL, ("oper_conn_extract: Cannot extract NULLOPER"));
                     93:        return;
                     94:        /* This is an implementation error */
                     95:     }
                     96: 
                     97:     if(on->on_conn == NULLCONN)
                     98:     {
                     99:        LLOG (log_dsap,LLOG_EXCEPTIONS, ("oper_conn_extract: already extracted"));
                    100:        /* This operation must have already been extracted for some reason. */
                    101:        return;
                    102:     }
                    103: 
                    104:     on_p = &(on->on_conn->cn_operlist);
                    105:     for(on_tmp=(*on_p); on_tmp!=NULLOPER; on_tmp=on_tmp->on_next_conn)
                    106:     {
                    107:        if(on_tmp == on)
                    108:            break;
                    109: 
                    110:        on_p = &(on_tmp->on_next_conn);
                    111:     }
                    112:     if(on_tmp == NULLOPER)
                    113:     {
                    114:        LLOG(log_dsap, LLOG_EXCEPTIONS, ("oper_conn_extract: oper not on connections list!"));
                    115:     }
                    116:     else
                    117:     {
                    118:        (*on_p) = on_tmp->on_next_conn;
                    119:     }
                    120: 
                    121:     on->on_conn = NULLCONN; /* Shows that this has been conn_extracted */
                    122: }
                    123: 
                    124: oper_task_extract(on)
                    125: struct oper_act        * on;
                    126: {
                    127:     /*
                    128:     * Extract this operation from the list held by its task.
                    129:     */
                    130:     struct oper_act    * on_tmp;
                    131:     struct oper_act    **on_p;
                    132: 
                    133:        DLOG(log_dsap, LLOG_TRACE, ("oper_task_extract()"));
                    134: 
                    135:     if(on == NULLOPER)
                    136:     {
                    137:        LLOG (log_dsap,LLOG_FATAL, ("oper_task_extract: Cannot extract NULLOPER"));
                    138:        return;
                    139:        /* This is an implementation error */
                    140:     }
                    141: 
                    142:     if(on->on_task == NULLTASK)
                    143:     {
                    144:        /* Must have been extracted previously. */
                    145:        if (on->on_state != ON_ABANDONED)
                    146:                LLOG (log_dsap,LLOG_EXCEPTIONS, ("oper_task_extract: oper has no task"));
                    147:        return;
                    148:     }
                    149: 
                    150:     on_p = &(on->on_task->tk_operlist);
                    151:     for(on_tmp=(*on_p); on_tmp!=NULLOPER; on_tmp=on_tmp->on_next_task)
                    152:     {
                    153:        if(on_tmp == on)
                    154:            break;
                    155: 
                    156:        on_p = &(on_tmp->on_next_task);
                    157:     }
                    158:     if(on_tmp == NULLOPER)
                    159:     {
                    160:        LLOG(log_dsap, LLOG_EXCEPTIONS, ("Oper not on tasks list"));
                    161:     }
                    162:     else
                    163:     {
                    164:        (*on_p) = on_tmp->on_next_task;
                    165:     }
                    166: 
                    167:     if (on->on_dsas != NULL_DI_BLOCK)
                    168:        di_desist (on->on_dsas);
                    169: 
                    170:     on->on_dsas = NULL_DI_BLOCK;
                    171: 
                    172:     on->on_task = NULLTASK; /* Shows that this has been task_extracted */
                    173: }
                    174: 
                    175: oper_log(on)
                    176: struct oper_act        * on;
                    177: {
                    178:     DLOG (log_dsap,LLOG_DEBUG, ("Oper id = %d, state = %d, type = %d",
                    179:        on->on_id, on->on_state, on->on_type));
                    180: }
                    181: 

unix.superglobalmegacorp.com

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