Annotation of 43BSDReno/contrib/isode-beta/dsap/net/dapinvoke.c, revision 1.1.1.1

1.1       root        1: /* dapinvoke.c - DAP : Invoke DAP operations */
                      2: 
                      3: #ifndef        lint
                      4: static char *rcsid = "$Header: /f/osi/dsap/net/RCS/dapinvoke.c,v 7.0 90/07/26 14:45:21 mrose Exp $";
                      5: #endif
                      6: 
                      7: /* 
                      8:  * $Header: /f/osi/dsap/net/RCS/dapinvoke.c,v 7.0 90/07/26 14:45:21 mrose Exp $
                      9:  *
                     10:  *
                     11:  * $Log:       dapinvoke.c,v $
                     12:  * Revision 7.0  90/07/26  14:45:21  mrose
                     13:  * *** empty log message ***
                     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 <stdio.h>
                     31: #include "logger.h"
                     32: #include "quipu/util.h"
                     33: #include "quipu/dap2.h"
                     34: 
                     35: extern  LLog    * log_dsap;
                     36: extern void      ros_log();
                     37: 
                     38: #ifdef PDU_DUMP
                     39: #define DUMP_ARG       "arg"
                     40: #define DUMP_RES       "res"
                     41: #define DUMP_ERR       "err"
                     42: #endif
                     43: 
                     44: int      DapInvokeReqAux (sd, id, op, pe, di, asyn)
                     45: int                      sd;
                     46: int                      id;
                     47: int                      op;
                     48: PE                       pe;
                     49: struct DAPindication   * di;
                     50: int                      asyn;
                     51: {
                     52: 
                     53: #ifdef PDU_DUMP
                     54:     pdu_dump (pe,DUMP_ARG,op);
                     55: #endif
                     56: 
                     57: #ifdef HEAVY_DEBUG
                     58:     pdu_arg_log (pe, op);
                     59: #endif
                     60: 
                     61:        switch (asyn)
                     62:        {
                     63:        case ROS_SYNC:
                     64:                return (DapSyncInvokeRequest (sd, id, op, pe, di));
                     65: 
                     66:        case ROS_INTR:
                     67:                return (DapIntrInvokeRequest (sd, id, op, pe, di));
                     68: 
                     69:        case ROS_ASYNC:
                     70:                return (DapAsynInvokeRequest (sd, id, op, pe, di));
                     71: 
                     72:        default:
                     73:                LLOG (log_dsap, LLOG_EXCEPTIONS, ("DapInvokeReqAux(): asyn has unknown value: %d", asyn));
                     74:                return (daplose (di, DP_INVOKE, NULLCP, "Unknown synchronicity"));
                     75:        }
                     76: }
                     77: 
                     78: int      DapSyncInvokeRequest (sd, id, op, pe, di)
                     79: int                      sd;
                     80: int                      id;
                     81: int                      op;
                     82: PE                       pe;
                     83: struct DAPindication   * di;
                     84: {
                     85:     int                                  result;
                     86:     struct RoSAPindication       roi_s;
                     87:     struct RoSAPindication     * roi = &(roi_s);
                     88:     struct RoSAPpreject                * rop = &(roi->roi_preject);
                     89: 
                     90:     DLOG (log_dsap,LLOG_TRACE,( "DapSyncInvokeRequest()"));
                     91: 
                     92:     result = RoInvokeRequest (sd, op, ROS_SYNC, pe,
                     93:                                id, NULLIP, ROS_NOPRIO, roi);
                     94: 
                     95:     if (result != OK)
                     96:     {
                     97:        if (roi->roi_type != ROI_PREJECT)
                     98:        {
                     99:            LLOG (log_dsap, LLOG_EXCEPTIONS, ("DapSyncInvokeRequest(): Failed without rejection"));
                    100:            return (daplose (di, DP_INVOKE, NULLCP, "RoInvokeRequest inconsistent result"));
                    101:        }
                    102: 
                    103:        if (ROS_FATAL (rop->rop_reason) || (rop->rop_reason == ROS_PARAMETER))
                    104:        {
                    105:            LLOG (log_dsap, LLOG_EXCEPTIONS, ("DapSyncInvokeRequest(): Fatal rejection"));
                    106:            return (daplose (di, DP_INVOKE, NULLCP, "RoInvokeRequest failed"));
                    107:        }
                    108:        else
                    109:        {
                    110:            LLOG (log_dsap, LLOG_EXCEPTIONS, ("DapSyncInvokeRequest(): Non-Fatal rejection"));
                    111:            return (dapreject (di, DP_INVOKE, id, NULLCP, "RoInvokeRequest failed"));
                    112:        }
                    113:     }
                    114: 
                    115:     switch(roi->roi_type)
                    116:     {
                    117:        case ROI_INVOKE:
                    118:            LLOG (log_dsap, LLOG_EXCEPTIONS, ("DapSyncInvokeRequest: Invocation received"));
                    119:            DRejectRequest (sd, ROS_IP_UNRECOG, roi->roi_invoke.rox_id);
                    120:            return (daplose (di, DP_ROS, NULLCP, "DAP initiator cannot accept invokes"));
                    121: 
                    122:        case ROI_RESULT:
                    123:            return (DapDecodeResult (sd, &(roi->roi_result), di));
                    124: 
                    125:        case ROI_ERROR:
                    126:            return (DapDecodeError (sd, &(roi->roi_error), di));
                    127: 
                    128:        case ROI_UREJECT:
                    129:            LLOG (log_dsap, LLOG_EXCEPTIONS, ("DapSyncInvokeRequest: Operation (%d) user rejected (%d)", roi->roi_ureject.rou_id, roi->roi_ureject.rou_reason));
                    130:                return (ros2dapreject (di, "ROI_UREJECT", &(roi->roi_ureject)));
                    131: 
                    132:        case ROI_PREJECT:
                    133:            LLOG (log_dsap, LLOG_EXCEPTIONS, ("DapSyncInvokeRequest: Operation (%d) provider rejected", roi->roi_preject.rop_id));
                    134:            return (ros2daplose (di, "ROI_PREJECT", &(roi->roi_preject)));
                    135: 
                    136:        case ROI_FINISH:
                    137:            LLOG (log_dsap, LLOG_EXCEPTIONS, ("DapSyncInvokeRequest: Unbind request received"));
                    138:            return (daplose (di, DP_ROS, NULLCP, "DAP initiator cannot accept unbind requests"));
                    139: 
                    140:        default:
                    141:            LLOG (log_dsap,LLOG_EXCEPTIONS,( "Unknown indication type : %d", roi->roi_type));
                    142:            break;
                    143:     }
                    144: 
                    145:     return (OK);
                    146: }
                    147: 
                    148: int      DapIntrInvokeRequest (sd, id, op, pe, di)
                    149: int                      sd;
                    150: int                      id;
                    151: int                      op;
                    152: PE                       pe;
                    153: struct DAPindication   * di;
                    154: {
                    155:     int                                  result;
                    156:     struct RoSAPindication       roi_s;
                    157:     struct RoSAPindication     * roi = &(roi_s);
                    158:     struct RoSAPpreject                * rop = &(roi->roi_preject);
                    159: 
                    160:     DLOG (log_dsap,LLOG_TRACE,( "DapIntrInvokeRequest()"));
                    161: 
                    162:     result = RoIntrRequest (sd, op, pe, id, NULLIP, ROS_NOPRIO, roi);
                    163: 
                    164:     if (result != OK)
                    165:     {
                    166:        if (roi->roi_type != ROI_PREJECT)
                    167:        {
                    168:            LLOG (log_dsap, LLOG_EXCEPTIONS, ("DapIntrInvokeRequest(): Failed without rejection"));
                    169:            return (daplose (di, DP_INVOKE, NULLCP, "RoInvokeRequest inconsistent result"));
                    170:        }
                    171: 
                    172:        if (rop->rop_reason == ROS_INTERRUPTED)
                    173:        {
                    174:             return (DapInterrupt(sd, id, op, di));
                    175:        }
                    176: 
                    177:        if (ROS_FATAL (rop->rop_reason) || (rop->rop_reason == ROS_PARAMETER))
                    178:        {
                    179:            LLOG (log_dsap, LLOG_EXCEPTIONS, ("DapIntrInvokeRequest(): Fatal rejection"));
                    180:            return (daplose (di, DP_INVOKE, NULLCP, "RoInvokeRequest failed"));
                    181:        }
                    182:        else
                    183:        {
                    184:            LLOG (log_dsap, LLOG_EXCEPTIONS, ("DapIntrInvokeRequest(): Non-Fatal rejection"));
                    185:            return (dapreject (di, DP_INVOKE, id, NULLCP, "RoInvokeRequest failed"));
                    186:        }
                    187:     }
                    188: 
                    189:     switch(roi->roi_type)
                    190:     {
                    191:        case ROI_INVOKE:
                    192:            LLOG (log_dsap, LLOG_EXCEPTIONS, ("DapIntrInvokeRequest: Invocation received"));
                    193:            DRejectRequest (sd, ROS_IP_UNRECOG, roi->roi_invoke.rox_id);
                    194:            return (daplose (di, DP_ROS, NULLCP, "DAP initiator cannot accept invokes"));
                    195: 
                    196:        case ROI_RESULT:
                    197:            return (DapDecodeResult (sd, &(roi->roi_result), di));
                    198: 
                    199:        case ROI_ERROR:
                    200:            return (DapDecodeError (sd, &(roi->roi_error), di));
                    201: 
                    202:        case ROI_UREJECT:
                    203:            LLOG (log_dsap, LLOG_EXCEPTIONS, ("DapIntrInvokeRequest: Operation (%d) user rejected (%d)", roi->roi_ureject.rou_id, roi->roi_ureject.rou_reason));
                    204:                return (ros2dapreject (di, "ROI_UREJECT", &(roi->roi_ureject)));
                    205: 
                    206:        case ROI_PREJECT:
                    207:                LLOG (log_dsap, LLOG_EXCEPTIONS, ("DapIntrInvokeRequest: Operation (%d) provider rejected", roi->roi_preject.rop_id));
                    208:                return (ros2daplose (di, "ROI_PREJECT", &(roi->roi_preject)));
                    209: 
                    210:        case ROI_FINISH:
                    211:            LLOG (log_dsap, LLOG_EXCEPTIONS, ("DapIntrInvokeRequest: Unbind request received"));
                    212:            return (daplose (di, DP_ROS, NULLCP, "DAP initiator cannot accept unbind requests"));
                    213: 
                    214:        default:
                    215:            LLOG (log_dsap,LLOG_EXCEPTIONS,( "Unknown indication type : %d", roi->roi_type));
                    216:            break;
                    217:     }
                    218: 
                    219:     return (OK);
                    220: }
                    221: 
                    222: int      DapAsynInvokeRequest (sd, id, op, pe, di)
                    223: int                      sd;
                    224: int                      id;
                    225: int                      op;
                    226: PE                       pe;
                    227: struct DAPindication   * di;
                    228: {
                    229:     int                                  result;
                    230:     struct RoSAPindication       roi_s;
                    231:     struct RoSAPindication     * roi = &(roi_s);
                    232:     struct RoSAPpreject                * rop = &(roi->roi_preject);
                    233: 
                    234:     result = RoInvokeRequest (sd, op, ROS_ASYNC, pe,
                    235:                                id, NULLIP, ROS_NOPRIO, roi);
                    236: 
                    237:     if (result != OK)
                    238:     {
                    239:        if (roi->roi_type != ROI_PREJECT)
                    240:        {
                    241:            LLOG (log_dsap, LLOG_EXCEPTIONS, ("DapAsynInvokeRequest(): Failed without rejection"));
                    242:            return (daplose (di, DP_INVOKE, NULLCP, "RoInvokeRequest inconsistent result"));
                    243:        }
                    244: 
                    245:        if (ROS_FATAL (rop->rop_reason) || (rop->rop_reason == ROS_PARAMETER))
                    246:        {
                    247:            LLOG (log_dsap, LLOG_EXCEPTIONS, ("DapAsynInvokeRequest(): Fatal rejection"));
                    248:            return (daplose (di, DP_INVOKE, NULLCP, "RoInvokeRequest failed"));
                    249:        }
                    250:        else
                    251:        {
                    252:            LLOG (log_dsap, LLOG_EXCEPTIONS, ("DapAsynInvokeRequest(): Non-Fatal rejection"));
                    253:            return (dapreject (di, DP_INVOKE, id, NULLCP, "RoInvokeRequest failed"));
                    254:        }
                    255:     }
                    256: 
                    257:     return (OK);
                    258: }
                    259: 
                    260: int      DapInterrupt(sd, id, op, di)
                    261: int                      sd;
                    262: int                      id;
                    263: int                      op;
                    264: struct DAPindication   * di;
                    265: {
                    266:     /*
                    267:     * Abandoning. Trickier than it looks!
                    268:     * Need to RoInvoke an abandon op, which will receive
                    269:     * One of the following:
                    270:     *    Result/Error for op being abandoned sent before
                    271:     *  this abandon arrived at the DSA;
                    272:     *    Abandoned error for op being abandoned;
                    273:     *    Result for abandon op which has overtaken the
                    274:     *  abandoned error for previous op between DSA and DUA
                    275:     *    Error for abandon because DSA has screwed up.
                    276:     *
                    277:     * Unless something goes wrong there should be 2 Ro events to
                    278:     * collect before returning. 
                    279:     */
                    280: 
                    281:     /* abandon operation */
                    282:     struct ds_abandon_arg        ab_arg;
                    283:     struct DSError               ab_err;
                    284:     PE                           ab_req_pe;
                    285:     int                                  old_id;
                    286:     int                                  new_id;
                    287:     int                                  ret1;
                    288:     int                                  ret2;
                    289:     struct RoSAPindication       roi1_s;
                    290:     struct RoSAPindication     * roi1 = &(roi1_s);
                    291:     struct RoSAPpreject                * rop1 = &(roi1->roi_preject);
                    292:     struct RoSAPindication       roi2_s;
                    293:     struct RoSAPindication     * roi2 = &(roi2_s);
                    294:     struct RoSAPpreject                * rop2 = &(roi2->roi_preject);
                    295:     struct RoSAPindication     * result_roi;
                    296: 
                    297:     ab_arg.aba_invokeid = old_id = id;
                    298:     new_id = ++id;
                    299: 
                    300:     if(encode_DAS_AbandonArgument(&ab_req_pe,1,0,NULLCP,&ab_arg) != OK)
                    301:     {
                    302:        LLOG(log_dsap, LLOG_EXCEPTIONS, ("Failed to encode an abandon operation"));
                    303:        /* Go on listening for result or dump out ?? */
                    304:        return(dapreject (di, DP_INVOKE, old_id, NULLCP, "DapInterrupt: Abandon argument encoding failed"));
                    305:     }
                    306:     else
                    307:     {
                    308:        DLOG(log_dsap, LLOG_DEBUG, ("Abandon invoke request"));
                    309: 
                    310:        ret1 = RoInvokeRequest(sd,OP_ABANDON,ROS_SYNC,ab_req_pe,new_id,NULLIP,ROS_NOPRIO,roi1);
                    311: 
                    312:        DLOG(log_dsap, LLOG_DEBUG, ("Abandon RoInvoke returns: %d", ret1));
                    313: 
                    314:        if (ab_req_pe != NULLPE)
                    315:            pe_free(ab_req_pe);
                    316: 
                    317:        switch(ret1)
                    318:        {
                    319:            case OK:
                    320:                /* What have we got? */
                    321:                switch(roi1->roi_type)
                    322:                {
                    323:                    case ROI_RESULT:
                    324:                        if(roi1->roi_result.ror_id == old_id)
                    325:                        {
                    326:                            /* Ferret result away for later */
                    327:                            result_roi = roi1;
                    328:                        }
                    329:                        else if(roi1->roi_result.ror_id == (old_id + 1))
                    330:                        {
                    331:                            RORFREE (&(roi1->roi_result));
                    332:                        }
                    333:                        else
                    334:                        {
                    335:                            LLOG(log_dsap, LLOG_EXCEPTIONS, ("ARRGH! Abandon sent: event for neither op nor abandon op returned!!"));
                    336:                            return(dapreject (di, DP_INVOKE, roi1->roi_result.ror_id, NULLCP, "Unexpected operation identifier"));
                    337:                        }
                    338:                        break;
                    339: 
                    340:                    case ROI_ERROR:
                    341: #ifdef PDU_DUMP
                    342:            pdu_dump (roi1->roi_error.roe_param,DUMP_ERR,op);
                    343: #endif
                    344: 
                    345:                        if(roi1->roi_error.roe_id == old_id)
                    346:                        {
                    347:                            /* Ferret error away for later */
                    348:                            result_roi = roi1;
                    349:                        }
                    350:                        else if(roi1->roi_error.roe_id == (old_id + 1))
                    351:                        {
                    352:                            if (roi1->roi_error.roe_error != DSE_ABANDON_FAILED)
                    353:                            {
                    354:                                LLOG(log_dsap, LLOG_EXCEPTIONS, ("Failed to abandon correctly"));
                    355:                                return(dapreject (di, DP_INVOKE, roi1->roi_error.roe_id, NULLCP, "Error mistyped for abandon"));
                    356:                            }
                    357:                            else
                    358:                            {
                    359:                                if(decode_DAS_AbandonFailedParm (roi1->roi_error.roe_param, 1, NULLIP, NULLVP, &(ab_err.dse_un.dse_un_abandon_fail)) != OK)
                    360:                                {
                    361:                                    LLOG(log_dsap, LLOG_EXCEPTIONS, ("Failed to decode abandonFailed"));
                    362:                                    return(dapreject (di, DP_INVOKE, old_id, NULLCP, "Abandon error decoding failed"));
                    363:                                }
                    364:                                else
                    365:                                {
                    366:                                    LLOG(log_dsap, LLOG_NOTICE, ("Abandon failed error!!!"));
                    367:                                    ab_err.dse_type = DSE_ABANDON_FAILED;
                    368:                                    log_ds_error(&ab_err);
                    369:                                    ds_error_free(&ab_err);
                    370:                                }
                    371:                            }
                    372:                        }
                    373:                        else
                    374:                        {
                    375:                            LLOG(log_dsap, LLOG_EXCEPTIONS, ("Abandon sent : event for neither op nor abandon op returned!!"));
                    376:                            return(dapreject (di, DP_INVOKE, roi1->roi_error.roe_id, NULLCP, "Unrecognised op id"));
                    377:                        }
                    378:                        break;
                    379: 
                    380:                    default:
                    381:                        LLOG(log_dsap, LLOG_FATAL, ("Unexpected roi_type : %d", roi1->roi_type));
                    382:                        return(dapreject (di, DP_INVOKE, -1, NULLCP, "Unrecognised event"));
                    383:                }
                    384:                break;
                    385: 
                    386:            case NOTOK:
                    387:                ros_log(rop1, "RO-INVOKE.REQUEST");
                    388:                if (ROS_FATAL (rop2->rop_reason))
                    389:                {
                    390:                    return (ros2daplose (di, "DapInterrupt", rop2));
                    391:                }
                    392:                else
                    393:                {
                    394:                    return (dapreject (di, DP_ROS, -1, NULLCP, "DapInterrupt: Non-fatal reject"));
                    395:                }
                    396: 
                    397:            case DONE:
                    398:                LLOG(log_dsap, LLOG_EXCEPTIONS, ("Responder has sent Finish!"));
                    399:                return(daplose (di, DP_ROS, NULLCP, "Received Finish"));
                    400: 
                    401:             default:
                    402:                LLOG(log_dsap, LLOG_FATAL, ("Unknown return from RoInvokeRequest : %d", ret1));
                    403:                return(daplose (di, DP_ROS, NULLCP, "RoInvokeRequest error"));
                    404:         }
                    405: 
                    406:        ret2 = RoWaitRequest(sd, NOTOK, roi2);
                    407: 
                    408:        DLOG(log_dsap, LLOG_DEBUG, ("Abandon RoInvoke returns: %d", ret1));
                    409: 
                    410:        switch(ret2)
                    411:        {
                    412:            case OK:
                    413:            /* What have we got? */
                    414:                switch(roi2->roi_type)
                    415:                {
                    416:                    case ROI_RESULT:
                    417:                        if(roi2->roi_result.ror_id == old_id)
                    418:                        {
                    419:                            /* Ferret result away for later */
                    420:                            result_roi = roi2;
                    421:                        }
                    422:                        else if(roi2->roi_result.ror_id == (old_id + 1))
                    423:                        {
                    424:                            RORFREE (&(roi2->roi_result));
                    425:                        }
                    426:                        else
                    427:                        {
                    428:                            LLOG(log_dsap, LLOG_EXCEPTIONS, ("ARRGH! Abandon sent and event for neither op nor abandon op returned!!"));
                    429:                            return(dapreject (di, DP_INVOKE, roi1->roi_result.ror_id, NULLCP, "Unexpected operation identifier"));
                    430:                        }
                    431:                        break;
                    432: 
                    433:                    case ROI_ERROR:
                    434: #ifdef PDU_DUMP
                    435:            pdu_dump (roi1->roi_error.roe_param,DUMP_ERR,op);
                    436: #endif
                    437: 
                    438:                        if(roi2->roi_error.roe_id == old_id)
                    439:                        {
                    440:                            /* Ferret error away for later */
                    441:                            result_roi = roi2;
                    442:                        }
                    443:                        else if(roi2->roi_error.roe_id == (old_id + 1))
                    444:                        {
                    445:                            if (roi2->roi_error.roe_error != DSE_ABANDON_FAILED)
                    446:                            {
                    447:                                LLOG(log_dsap, LLOG_EXCEPTIONS, ("Failed to abandon correctly"));
                    448:                                return(dapreject (di, DP_INVOKE, roi2->roi_error.roe_id, NULLCP, "Error mistyped for abandon"));
                    449:                            }
                    450:                            else
                    451:                            {
                    452:                                if(decode_DAS_AbandonFailedParm (roi2->roi_error.roe_param, 1, NULLIP, NULLVP, &(ab_err.dse_un.dse_un_abandon_fail)) != OK)
                    453:                                {
                    454:                                    LLOG(log_dsap, LLOG_EXCEPTIONS, ("Failed to decode abandonFailed"));
                    455:                                    return(dapreject (di, DP_INVOKE, old_id, NULLCP, "Abandon error decoding failed"));
                    456:                                }
                    457:                                else
                    458:                                {
                    459:                                    LLOG(log_dsap, LLOG_NOTICE, ("Abandon failed error!!!"));
                    460:                                    ab_err.dse_type = DSE_ABANDON_FAILED;
                    461:                                    log_ds_error(&ab_err);
                    462:                                    ds_error_free(&ab_err);
                    463:                                }
                    464:                            }
                    465:                        }
                    466:                        else
                    467:                        {
                    468:                            LLOG(log_dsap, LLOG_EXCEPTIONS, ("Abandon sent : event for neither op nor abandon op returned!!"));
                    469:                            return(dapreject (di, DP_INVOKE, roi1->roi_error.roe_id, NULLCP, "Unrecognised op id"));
                    470:                        }
                    471:                        break;
                    472: 
                    473:                    default:
                    474:                        LLOG(log_dsap, LLOG_FATAL, ("Unexpected roi_type : %d", roi2->roi_type));
                    475:                        return(dapreject (di, DP_INVOKE, -1, NULLCP, "Unrecognised event"));
                    476:                }
                    477:                break;
                    478: 
                    479:            case NOTOK:
                    480:                ros_log(rop2, "RO-WAIT.REQUEST (Abandon)");
                    481:                if (ROS_FATAL (rop1->rop_reason))
                    482:                {
                    483:                    return (ros2daplose (di, "DapInterrupt", rop2));
                    484:                }
                    485:                else
                    486:                {
                    487:                    return (dapreject (di, DP_ROS, -1, NULLCP, "DapInterrupt: Non-fatal reject"));
                    488:                }
                    489: 
                    490:            case DONE:
                    491:                LLOG(log_dsap, LLOG_EXCEPTIONS, ("Responder has sent Finish!"));
                    492:                return(daplose (di, DP_ROS, NULLCP, "Received Finish"));
                    493: 
                    494:             default:
                    495:                LLOG(log_dsap, LLOG_FATAL, ("Unknown return from RoInvokeRequest : %d", ret2));
                    496:                return(daplose (di, DP_ROS, NULLCP, "RoInvokeRequest error"));
                    497:         }
                    498:     }
                    499: 
                    500:     switch(result_roi->roi_type)
                    501:     {
                    502:        case ROI_RESULT:
                    503:            return (DapDecodeResult (sd, &(result_roi->roi_result), di));
                    504: 
                    505:        case ROI_ERROR:
                    506:            return (DapDecodeError (sd, &(result_roi->roi_error), di));
                    507: 
                    508:        default:
                    509:            return (dapreject (di, DP_ROS, old_id, NULLCP, "DapInterrupt erroneous"));
                    510:     }
                    511: }
                    512: 
                    513: #ifdef PDU_DUMP
                    514: 
                    515: static int pdu_count = -1;
                    516: static char * pdu_dir = NULLCP;
                    517: 
                    518: pdu_dump_init (dir)
                    519: char * dir;
                    520: {
                    521:        pdu_count = 0;
                    522:        pdu_dir = strdup (dir);
                    523:        LLOG (log_dsap, LLOG_NOTICE, ("PDU Tracing enabled - %s",dir));
                    524:        
                    525:        (void) mkdir (pdu_dir,0755);
                    526: }
                    527: 
                    528: pdu_dump (pe,type,op)
                    529: PE pe;
                    530: char * type;
                    531: int op;
                    532: {
                    533: char filename [BUFSIZE];
                    534: char * oper;
                    535: PS ps;
                    536: FILE * fptr;
                    537: 
                    538:        if ( pdu_count == -1)
                    539:                return;
                    540: 
                    541:        if (strcmp (type,DUMP_ARG) == 0)
                    542:                pdu_count++;
                    543: 
                    544:        switch (op) {
                    545:                case OP_READ:
                    546:                        oper = "read";
                    547:                        break;
                    548:                case OP_COMPARE:
                    549:                        oper = "compare";
                    550:                        break;
                    551:                case OP_ABANDON:        /* Humm ... */
                    552:                        oper = "abandon";
                    553:                        break;
                    554:                case OP_LIST:
                    555:                        oper = "list";
                    556:                        break;
                    557:                case OP_SEARCH:
                    558:                        oper = "search";
                    559:                        break;
                    560:                case OP_ADDENTRY:
                    561:                        oper = "add";
                    562:                        break;
                    563:                case OP_REMOVEENTRY:
                    564:                        oper = "remove";
                    565:                        break;
                    566:                case OP_MODIFYENTRY:
                    567:                        oper = "modify";
                    568:                        break;
                    569:                case OP_MODIFYRDN:
                    570:                        oper = "modifyrdn";
                    571:                        break;
                    572:                case OP_GETEDB:
                    573:                        oper = "getedb";
                    574:                        break;
                    575:                case 100:       /* special case for bind */
                    576:                        oper = "bind";
                    577:                        break;
                    578:        }
                    579: 
                    580:        (void) sprintf (filename, "%s/%s_%s.%d",pdu_dir,oper,type,pdu_count);
                    581:        DLOG (log_dsap,LLOG_DEBUG,("Writing PDU to file %s",filename));
                    582: 
                    583:        if ((fptr = fopen (filename,"w")) == (FILE *) NULL) {
                    584:                LLOG(log_dsap,LLOG_EXCEPTIONS,("Cant open PDU file %s",filename));
                    585:                return;
                    586:        }
                    587: 
                    588:        ps = ps_alloc (std_open);
                    589:        if (std_setup (ps,fptr) != OK) {
                    590:                (void) fclose (fptr);
                    591:                return;
                    592:        }
                    593:                
                    594:        (void) pe2pl (ps,pe);
                    595: 
                    596:        (void) fclose (fptr);
                    597:        ps_free (ps);
                    598: 
                    599: }
                    600: #endif
                    601: 
                    602: #ifdef HEAVY_DEBUG
                    603: pdu_arg_log (pe,op)
                    604: PE pe;
                    605: int op;
                    606: {
                    607:     /* PDU Level Logging */
                    608:     switch (op) {
                    609:        case OP_READ:
                    610:            PLOG (log_dsap, print_DAS_ReadArgument, pe, "Read", 0);
                    611:            break;
                    612:        case OP_COMPARE:
                    613:            PLOG (log_dsap, print_DAS_CompareArgument, pe, "Compare", 0);
                    614:            break;
                    615:        case OP_ABANDON:
                    616:            PLOG (log_dsap, print_DAS_AbandonArgument, pe, "Abandon", 0);
                    617:            break;
                    618:        case OP_LIST:
                    619:            PLOG (log_dsap, print_DAS_ListArgument, pe, "List", 0);
                    620:            break;
                    621:        case OP_SEARCH:
                    622:            PLOG (log_dsap, print_DAS_SearchArgument, pe, "Search", 0);
                    623:            break;
                    624:        case OP_ADDENTRY:
                    625:            PLOG (log_dsap, print_DAS_AddEntryArgument, pe, "AddEntry", 0);
                    626:            break;
                    627:        case OP_REMOVEENTRY:
                    628:            PLOG (log_dsap, print_DAS_RemoveEntryArgument, pe, "RemoveEntry", 0);
                    629:            break;
                    630:        case OP_MODIFYENTRY:
                    631:            PLOG (log_dsap, print_DAS_ModifyEntryArgument, pe, "ModifyEntry", 0);
                    632:            break;
                    633:        case OP_MODIFYRDN:
                    634:            PLOG (log_dsap, print_DAS_ModifyRDNArgument, pe, "ModifyRDN", 0);
                    635:            break;
                    636:        case OP_GETEDB:
                    637:            PLOG (log_dsap, print_Quipu_GetEntryDataBlockArgument, pe, "GetEDB", 0);
                    638:            break;
                    639:        default:
                    640:                LLOG (log_dsap, LLOG_PDUS, ("Unknown operation (%d) - no argument PDU logged",op));
                    641:     }
                    642: }
                    643: 
                    644: pdu_res_log (pe, op)
                    645: PE       pe;
                    646: int      op;
                    647: {
                    648:     /* PDU Level Logging */
                    649:     switch (op)
                    650:     {
                    651:        case OP_READ:
                    652:            PLOG (log_dsap, print_DAS_ReadResult, pe, "Read", 1);
                    653:            break;
                    654: 
                    655:        case OP_COMPARE:
                    656:            PLOG (log_dsap, print_DAS_CompareResult, pe, "Compare", 1);
                    657:            break;
                    658:        case OP_ABANDON:
                    659:            PLOG (log_dsap, print_DAS_AbandonResult, pe, "Abandon", 1);
                    660:            break;
                    661:        case OP_LIST:
                    662:            PLOG (log_dsap, print_DAS_ListResult, pe, "List", 1);
                    663:            break;
                    664:        case OP_SEARCH:
                    665:            PLOG (log_dsap, print_DAS_SearchResult, pe, "Search", 1);
                    666:            break;
                    667:        case OP_ADDENTRY:
                    668:            PLOG (log_dsap, print_DAS_AddEntryResult, pe, "AddEntry", 1);
                    669:            break;
                    670:        case OP_REMOVEENTRY:
                    671:            PLOG (log_dsap, print_DAS_RemoveEntryResult, pe, "RemoveEntry",1);
                    672:            break;
                    673:        case OP_MODIFYENTRY:
                    674:            PLOG (log_dsap, print_DAS_ModifyEntryResult, pe, "ModifyEntry",1);
                    675:            break;
                    676:        case OP_MODIFYRDN:
                    677:            PLOG (log_dsap, print_DAS_ModifyRDNResult, pe, "ModifyRDN", 1);
                    678:            break;
                    679:        case OP_GETEDB:
                    680:            PLOG (log_dsap, print_Quipu_GetEntryDataBlockResult, pe, "GetEDB", 1);
                    681:            break;
                    682:        default:
                    683:            LLOG (log_dsap, LLOG_PDUS, ("Unknown operation (%d) - no result PDU logged",op));
                    684:     }
                    685: }
                    686: #endif

unix.superglobalmegacorp.com

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