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

1.1       root        1: /* dsapwait.c - DSAP: Deal with incoming activity */
                      2: 
                      3: #ifndef        lint
                      4: static char *rcsid = "$Header: /f/osi/dsap/net/RCS/dsapwait.c,v 7.0 90/07/26 14:46:04 mrose Exp $";
                      5: #endif
                      6: 
                      7: /* 
                      8:  * $Header: /f/osi/dsap/net/RCS/dsapwait.c,v 7.0 90/07/26 14:46:04 mrose Exp $
                      9:  *
                     10:  *
                     11:  * $Log:       dsapwait.c,v $
                     12:  * Revision 7.0  90/07/26  14:46:04  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 "logger.h"
                     31: #include "quipu/util.h"
                     32: #include "quipu/dsap.h"
                     33: 
                     34: 
                     35: extern LLog    * log_dsap;
                     36: 
                     37: #ifdef PDU_DUMP
                     38: #define DUMP_ARG       "arg"
                     39: #define DUMP_RES       "res"
                     40: #define DUMP_ERR       "err"
                     41: #endif
                     42: 
                     43: /* ARGSUSED */
                     44: 
                     45: int      DWaitRequest (ctx, sd, secs, di)
                     46: int                      ctx;
                     47: int                       sd;
                     48: int                      secs;
                     49: struct DSAPindication  * di;
                     50: {
                     51:     int          result;
                     52: 
                     53:     switch (ctx)
                     54:     {
                     55:         case DS_CTX_X500_DAP:
                     56:            result = DapRespWaitRequest (sd, secs, di);
                     57:            break;
                     58: 
                     59:        case DS_CTX_X500_DSP:
                     60:            result = DspWaitRequest (sd, secs, di);
                     61:            break;
                     62: 
                     63:        case DS_CTX_QUIPU_DSP:
                     64:            result = QspWaitRequest (sd, secs, di);
                     65:            break;
                     66: 
                     67:        default:
                     68:            LLOG (log_dsap, LLOG_EXCEPTIONS, ("DWaitRequest: unknown context id %d", ctx));
                     69:            return (dsaplose (di, DA_APP_CONTEXT, "WAIT REQUEST"));
                     70:     }
                     71: 
                     72:     return (result);
                     73: }
                     74: 
                     75: int      DapRespWaitRequest (sd, secs, di)
                     76: int                      sd;
                     77: int                      secs;
                     78: struct DSAPindication  * di;
                     79: {
                     80:        int       result;
                     81:        struct RoSAPindication    roi_s;
                     82:        struct RoSAPindication  * roi = &(roi_s);
                     83: 
                     84:        DLOG (log_dsap,LLOG_TRACE,( "DapRespWaitRequest()"));
                     85: 
                     86:        result = RoWaitRequest(sd, secs, roi);
                     87: 
                     88:        if (result == NOTOK)
                     89:        {
                     90:                if (roi->roi_preject.rop_reason == ROS_TIMER)
                     91:                {
                     92:                        return (DONE);
                     93:                }
                     94: 
                     95:                if (ROS_FATAL (roi->roi_preject.rop_reason))
                     96:                {
                     97:                        return (ros2dsaplose (di, "DapRespWaitRequest", &(roi->roi_preject)));
                     98:                }
                     99:                else
                    100:                {
                    101:                        return (dsapreject (di, DP_ROS, -1, NULLCP, "DapRespWaitRequest: Non-fatal reject"));
                    102:                }
                    103:         }
                    104: 
                    105:         switch(roi->roi_type)
                    106:         {
                    107:        case ROI_INVOKE:
                    108:                return (DapDecodeInvoke (sd, &(roi->roi_invoke), di));
                    109: 
                    110:        case ROI_RESULT:
                    111:                LLOG (log_dsap, LLOG_EXCEPTIONS, ("DapRespWaitRequest: Result received"));
                    112:                DRejectRequest (sd, ROS_RRP_UNRECOG, roi->roi_result.ror_id);
                    113:                return (dsaplose (di, DI_RESULT, NULLCP, "DAP responder cannot accept results"));
                    114: 
                    115:        case ROI_ERROR:
                    116:                LLOG (log_dsap, LLOG_EXCEPTIONS, ("DapRespWaitRequest: Error received"));
                    117:                DRejectRequest (sd, ROS_REP_UNRECOG, roi->roi_error.roe_id);
                    118:                return (dsaplose (di, DI_RESULT, NULLCP, "DAP responder cannot accept errors"));
                    119: 
                    120:        case ROI_UREJECT:
                    121:                LLOG (log_dsap, LLOG_EXCEPTIONS, ("DapRespWaitRequest: Operation (%d) user rejected (%d)", roi->roi_ureject.rou_id, roi->roi_ureject.rou_reason));
                    122:                return (ros2dsapreject(di, "ROI_UREJECT", &(roi->roi_ureject)));
                    123: 
                    124:        case ROI_PREJECT:
                    125:                LLOG (log_dsap, LLOG_EXCEPTIONS, ("DapRespWaitRequest: Operation (%d) provider rejected", roi->roi_preject.rop_id));
                    126:                return (ros2dsaplose (di, "ROI_PREJECT", &(roi->roi_preject)));
                    127: 
                    128:        case ROI_FINISH:
                    129:            /*
                    130:            * Should be getting an RoBIND structure here.
                    131:            * Currently this is simulated with RoUnBindInit, which
                    132:            * will check that the user data in the release was used
                    133:            * correctly even though no UnbindArgument is present.
                    134:            * This is mapped up into D-UNBIND indication.
                    135:            */
                    136:            return (DDecodeUnbind (sd, &(roi->roi_finish), di));
                    137: 
                    138:        default:
                    139:            LLOG (log_dsap,LLOG_EXCEPTIONS,( "Unknown indication type : %d", roi->roi_type));
                    140:            return (dsaplose (di, DA_NO_REASON, NULLCP, NULLCP));
                    141:         }
                    142: }
                    143: 
                    144: int      DspWaitRequest (sd, secs, di)
                    145: int                      sd;
                    146: int                      secs;
                    147: struct DSAPindication  * di;
                    148: {
                    149:        int       result;
                    150:        struct RoSAPindication    roi_s;
                    151:        struct RoSAPindication  * roi = &(roi_s);
                    152: 
                    153:        DLOG (log_dsap,LLOG_TRACE,( "DspWaitRequest()"));
                    154: 
                    155:        result = RoWaitRequest(sd, secs, roi);
                    156: 
                    157:        if (result == NOTOK)
                    158:        {
                    159:                if (roi->roi_preject.rop_reason == ROS_TIMER)
                    160:                {
                    161:                        return (DONE);
                    162:                }
                    163: 
                    164:                if (ROS_FATAL (roi->roi_preject.rop_reason))
                    165:                {
                    166:                        return (ros2dsaplose (di, "DspRespWaitRequest", &(roi->roi_preject)));
                    167:                }
                    168:                else
                    169:                {
                    170:                        return (dsapreject (di, DP_ROS, -1, NULLCP, "DspRespWaitRequest: Non-fatal reject"));
                    171:                }
                    172:         }
                    173: 
                    174:         switch(roi->roi_type)
                    175:         {
                    176:        case ROI_INVOKE:
                    177:                return (DspDecodeInvoke (sd, &(roi->roi_invoke), di));
                    178: 
                    179:        case ROI_RESULT:
                    180:                return (DspDecodeResult (sd, &(roi->roi_result), di));
                    181: 
                    182:        case ROI_ERROR:
                    183:                return (DDecodeError (sd, &(roi->roi_error), di));
                    184: 
                    185:        case ROI_UREJECT:
                    186:                LLOG (log_dsap, LLOG_EXCEPTIONS, ("DspWaitRequest: Operation (%d) user rejected (%d)", roi->roi_ureject.rou_id, roi->roi_ureject.rou_reason));
                    187:                return (ros2dsapreject(di, "ROI_UREJECT", &(roi->roi_ureject)));
                    188: 
                    189:        case ROI_PREJECT:
                    190:                LLOG (log_dsap, LLOG_EXCEPTIONS, ("DspWaitRequest: Operation (%d) provider rejected", roi->roi_preject.rop_id));
                    191:                return (ros2dsaplose (di, "ROI_PREJECT", &(roi->roi_preject)));
                    192: 
                    193:        case ROI_FINISH:
                    194:            /*
                    195:            * Should be getting an RoBIND structure here.
                    196:            * Currently this is simulated with RoUnBindInit, which
                    197:            * will check that the user data in the release was used
                    198:            * correctly even though no UnbindArgument is present.
                    199:            * This is mapped up into D-UNBIND indication.
                    200:            */
                    201:            return (DDecodeUnbind (sd, &(roi->roi_finish), di));
                    202: 
                    203:        default:
                    204:            LLOG (log_dsap,LLOG_EXCEPTIONS,( "Unknown indication type : %d", roi->roi_type));
                    205:            return (dsaplose (di, DA_NO_REASON, NULLCP, NULLCP));
                    206:         }
                    207: }
                    208: 
                    209: int      QspWaitRequest (sd, secs, di)
                    210: int                      sd;
                    211: int                      secs;
                    212: struct DSAPindication  * di;
                    213: {
                    214:        int       result;
                    215:        struct RoSAPindication    roi_s;
                    216:        struct RoSAPindication  * roi = &(roi_s);
                    217: 
                    218:        DLOG (log_dsap,LLOG_TRACE,( "QspWaitRequest()"));
                    219: 
                    220:        result = RoWaitRequest(sd, secs, roi);
                    221: 
                    222:        if (result == NOTOK)
                    223:        {
                    224:                if (roi->roi_preject.rop_reason == ROS_TIMER)
                    225:                {
                    226:                        return (DONE);
                    227:                }
                    228: 
                    229:                if (ROS_FATAL (roi->roi_preject.rop_reason))
                    230:                {
                    231:                        return (ros2dsaplose (di, "QspRespWaitRequest", &(roi->roi_preject)));
                    232:                }
                    233:                else
                    234:                {
                    235:                        return (dsapreject (di, DP_ROS, -1, NULLCP, "QspRespWaitRequest: Non-fatal reject"));
                    236:                }
                    237:         }
                    238: 
                    239:         switch(roi->roi_type)
                    240:         {
                    241:        case ROI_INVOKE:
                    242:                return (QspDecodeInvoke (sd, &(roi->roi_invoke), di));
                    243: 
                    244:        case ROI_RESULT:
                    245:                return (QspDecodeResult (sd, &(roi->roi_result), di));
                    246: 
                    247:        case ROI_ERROR:
                    248:                return (DDecodeError (sd, &(roi->roi_error), di));
                    249: 
                    250:        case ROI_UREJECT:
                    251:                LLOG (log_dsap, LLOG_EXCEPTIONS, ("QspWaitRequest: Operation (%d) user rejected (%d)", roi->roi_ureject.rou_id, roi->roi_ureject.rou_reason));
                    252:                return (ros2dsapreject(di, "ROI_UREJECT", &(roi->roi_ureject)));
                    253: 
                    254:        case ROI_PREJECT:
                    255:                LLOG (log_dsap, LLOG_EXCEPTIONS, ("QspWaitRequest: Operation (%d) provider rejected", roi->roi_preject.rop_id));
                    256:                return (ros2dsaplose (di, "ROI_PREJECT", &(roi->roi_preject)));
                    257: 
                    258:        case ROI_FINISH:
                    259:            /*
                    260:            * Should be getting an RoBIND structure here.
                    261:            * Currently this is simulated with RoUnBindInit, which
                    262:            * will check that the user data in the release was used
                    263:            * correctly even though no UnbindArgument is present.
                    264:            * This is mapped up into D-UNBIND indication.
                    265:            */
                    266:            return (DDecodeUnbind (sd, &(roi->roi_finish), di));
                    267: 
                    268:        default:
                    269:            LLOG (log_dsap,LLOG_EXCEPTIONS,( "Unknown indication type : %d", roi->roi_type));
                    270:            return (dsaplose (di, DA_NO_REASON, NULLCP, NULLCP));
                    271:         }
                    272: }
                    273: 
                    274: int      DapDecodeInvoke (sd, rox, di)
                    275: int                      sd;
                    276: struct RoSAPinvoke     * rox;
                    277: struct DSAPindication  * di;
                    278: {
                    279:     int                          success;
                    280:     PE                   pe = rox->rox_args;
                    281:     struct ds_op_arg   * dsarg = &(di->di_invoke.dx_arg);
                    282:     struct chain_arg   * charg = &(dsarg->dca_charg);
                    283:     struct DSArgument  * arg = &(dsarg->dca_dsarg);
                    284: 
                    285:     di->di_type = DI_INVOKE;
                    286:     di->di_invoke.dx_id = rox->rox_id;
                    287: 
                    288:     switch(arg->arg_type = rox->rox_op)
                    289:     {
                    290:     case    OP_READ :
                    291:        success = decode_DAS_ReadArgument(pe,1,NULLIP,NULLVP,&(arg->arg_rd));
                    292:        break;
                    293:     case    OP_COMPARE :
                    294:        success = decode_DAS_CompareArgument(pe,1,NULLIP,NULLVP,&(arg->arg_cm));
                    295:        break;
                    296:     case    OP_ABANDON :
                    297:        success = decode_DAS_AbandonArgument(pe,1,NULLIP,NULLVP,&(arg->arg_ab));
                    298:        break;
                    299:     case    OP_LIST :
                    300:        success = decode_DAS_ListArgument(pe,1,NULLIP,NULLVP,&(arg->arg_ls));
                    301:        break;
                    302:     case    OP_SEARCH :
                    303:        success = decode_DAS_SearchArgument(pe,1,NULLIP,NULLVP,&(arg->arg_sr));
                    304:        break;
                    305:     case    OP_ADDENTRY :
                    306:        success = decode_DAS_AddEntryArgument(pe,1,NULLIP,NULLVP,&(arg->arg_ad));
                    307:        break;
                    308:     case    OP_REMOVEENTRY :
                    309:        success = decode_DAS_RemoveEntryArgument(pe,1,NULLIP,NULLVP,&(arg->arg_rm));
                    310:        break;
                    311:     case    OP_MODIFYENTRY :
                    312:        success = decode_DAS_ModifyEntryArgument(pe,1,NULLIP,NULLVP,&(arg->arg_me));
                    313:        break;
                    314:     case    OP_MODIFYRDN :
                    315:        success = decode_DAS_ModifyRDNArgument(pe,1,NULLIP,NULLVP,&(arg->arg_mr));
                    316:        break;
                    317: 
                    318:     default:
                    319:        LLOG(log_dsap, LLOG_EXCEPTIONS, ("DapDecodeInvoke: op id %d unknown!", rox->rox_op));
                    320:        DRejectRequest (sd, ROS_IP_UNRECOG, rox->rox_id);
                    321:        return (dsaplose (di, DP_INVOKE, NULLCP, "Unknown operation identifier"));
                    322:     }
                    323: 
                    324:     if (success == NOTOK)
                    325:     {
                    326:        LLOG (log_dsap, LLOG_EXCEPTIONS, ("DapDecodeInvoke: Unable to parse argument"));
                    327:        DRejectRequest (sd, ROS_IP_MISTYPED, rox->rox_id);
                    328:        return (dsapreject (di, DP_INVOKE, -1, NULLCP, "Undecodable argument"));
                    329:     }
                    330: 
                    331:     charg->cha_originator = NULLDN;
                    332:     charg->cha_target = NULLDN;
                    333:     charg->cha_domaininfo = NULLPE;
                    334:     charg->cha_trace = NULLTRACEINFO;
                    335:     charg->cha_timelimit = NULLCP;
                    336: 
                    337:     return(success);
                    338: }
                    339: 
                    340: int      DspDecodeInvoke (sd, rox, di)
                    341: int                      sd;
                    342: struct RoSAPinvoke     * rox;
                    343: struct DSAPindication  * di;
                    344: {
                    345:     int                          success;
                    346:     PE                   pe = rox->rox_args;
                    347:     struct ds_op_arg   * arg = &(di->di_invoke.dx_arg);
                    348: 
                    349:     di->di_type = DI_INVOKE;
                    350:     di->di_invoke.dx_id = rox->rox_id;
                    351: 
                    352:     switch(arg->dca_dsarg.arg_type = rox->rox_op)
                    353:     {
                    354:     case    OP_READ :
                    355:        success = decode_DO_ChainedReadArgument(pe,1,NULLIP,NULLVP,arg);
                    356:        break;
                    357:     case    OP_COMPARE :
                    358:        success = decode_DO_ChainedCompareArgument(pe,1,NULLIP,NULLVP,arg);
                    359:        break;
                    360:     case    OP_ABANDON :
                    361:        success = decode_DAS_AbandonArgument(pe,1,NULLIP,NULLVP,&(arg->dca_dsarg.arg_ab));
                    362:        break;
                    363:     case    OP_LIST :
                    364:        success = decode_DO_ChainedListArgument(pe,1,NULLIP,NULLVP,arg);
                    365:        break;
                    366:     case    OP_SEARCH :
                    367:        success = decode_DO_ChainedSearchArgument(pe,1,NULLIP,NULLVP,arg);
                    368:        break;
                    369:     case    OP_ADDENTRY :
                    370:        success = decode_DO_ChainedAddEntryArgument(pe,1,NULLIP,NULLVP,arg);
                    371:        break;
                    372:     case    OP_REMOVEENTRY :
                    373:        success = decode_DO_ChainedRemoveEntryArgument(pe,1,NULLIP,NULLVP,arg);
                    374:        break;
                    375:     case    OP_MODIFYENTRY :
                    376:        success = decode_DO_ChainedModifyEntryArgument(pe,1,NULLIP,NULLVP,arg);
                    377:        break;
                    378:     case    OP_MODIFYRDN :
                    379:        success = decode_DO_ChainedModifyRDNArgument(pe,1,NULLIP,NULLVP,arg);
                    380:        break;
                    381:     default:
                    382:        LLOG(log_dsap, LLOG_EXCEPTIONS, ("DspDecodeInvoke: op id %d unknown!", rox->rox_op));
                    383:        DRejectRequest (sd, ROS_IP_UNRECOG, rox->rox_id);
                    384:        return (dsaplose (di, DP_INVOKE, NULLCP, "Unknown operation identifier"));
                    385:     }
                    386: 
                    387:     if (success == NOTOK)
                    388:     {
                    389:        LLOG (log_dsap, LLOG_EXCEPTIONS, ("DspDecodeInvoke: Unable to parse argument"));
                    390:        DRejectRequest (sd, ROS_IP_MISTYPED, rox->rox_id);
                    391:        return (dsaplose (di, DP_INVOKE, NULLCP, "Undecodable argument"));
                    392:     }
                    393: 
                    394:     return(success);
                    395: }
                    396: 
                    397: int      DspDecodeResult (sd, ror, di)
                    398: int                      sd;
                    399: struct RoSAPresult     * ror;
                    400: struct DSAPindication  * di;
                    401: {
                    402:     int                          success;
                    403:     PE                   pe = ror->ror_result;
                    404:     struct ds_op_res   * res = &(di->di_result.dr_res);
                    405: 
                    406:     di->di_type = DI_RESULT;
                    407:     di->di_result.dr_id = ror->ror_id;
                    408: 
                    409:     switch(res->dcr_dsres.result_type = ror->ror_op)
                    410:     {
                    411:     case    OP_READ :
                    412:        success = decode_DO_ChainedReadResult(pe,1,NULLIP,NULLVP,res);
                    413:        break;
                    414:     case    OP_COMPARE :
                    415:        success = decode_DO_ChainedCompareResult(pe,1,NULLIP,NULLVP,res);
                    416:        break;
                    417:     case    OP_ABANDON :
                    418:        success = decode_DAS_AbandonResult(pe,1,NULLIP,NULLVP,NULLCP);
                    419:        break;
                    420:     case    OP_LIST :
                    421:        success = decode_DO_ChainedListResult(pe,1,NULLIP,NULLVP,res);
                    422:        break;
                    423:     case    OP_SEARCH :
                    424:        success = decode_DO_ChainedSearchResult(pe,1,NULLIP,NULLVP,res);
                    425:        break;
                    426:     case    OP_ADDENTRY :
                    427:        success = decode_DO_ChainedAddEntryResult(pe,1,NULLIP,NULLVP,res);
                    428:        break;
                    429:     case    OP_REMOVEENTRY :
                    430:        success = decode_DO_ChainedRemoveEntryResult(pe,1,NULLIP,NULLVP,res);
                    431:        break;
                    432:     case    OP_MODIFYENTRY :
                    433:        success = decode_DO_ChainedModifyEntryResult(pe,1,NULLIP,NULLVP,res);
                    434:        break;
                    435:     case    OP_MODIFYRDN :
                    436:        success = decode_DO_ChainedModifyRDNResult(pe,1,NULLIP,NULLVP,res);
                    437:        break;
                    438: 
                    439:     default:
                    440:        success = NOTOK;
                    441:        LLOG(log_dsap, LLOG_EXCEPTIONS, ("DspDecodeResult: op id %d unknown!", ror->ror_op));
                    442:        DRejectRequest (sd, ROS_RRP_UNRECOG, ror->ror_id);
                    443:        return (dsaplose (di, DP_RESULT, NULLCP, "Unknown operation identifier"));
                    444:     }
                    445: 
                    446:     if (success == NOTOK)
                    447:     {
                    448:        LLOG (log_dsap, LLOG_EXCEPTIONS, ("DspDecodeResult: Unable to parse argument"));
                    449:        DRejectRequest (sd, ROS_RRP_MISTYPED, ror->ror_id);
                    450:        return (dsaplose (di, DP_RESULT, NULLCP, "Undecodable argument"));
                    451:     }
                    452: 
                    453:     return(success);
                    454: }
                    455: 
                    456: int      QspDecodeInvoke (sd, rox, di)
                    457: int                      sd;
                    458: struct RoSAPinvoke     * rox;
                    459: struct DSAPindication  * di;
                    460: {
                    461:     int                          success;
                    462:     PE                   pe = rox->rox_args;
                    463:     struct ds_op_arg   * arg = &(di->di_invoke.dx_arg);
                    464: 
                    465:     di->di_type = DI_INVOKE;
                    466:     di->di_invoke.dx_id = rox->rox_id;
                    467: 
                    468:     switch(arg->dca_dsarg.arg_type = rox->rox_op)
                    469:     {
                    470:     case    OP_READ :
                    471:        success = decode_DO_ChainedReadArgument(pe,1,NULLIP,NULLVP,arg);
                    472:        break;
                    473:     case    OP_COMPARE :
                    474:        success = decode_DO_ChainedCompareArgument(pe,1,NULLIP,NULLVP,arg);
                    475:        break;
                    476:     case    OP_ABANDON :
                    477:        success = decode_DAS_AbandonArgument(pe,1,NULLIP,NULLVP,&(arg->dca_dsarg.arg_ab));
                    478:        break;
                    479:     case    OP_LIST :
                    480:        success = decode_DO_ChainedListArgument(pe,1,NULLIP,NULLVP,arg);
                    481:        break;
                    482:     case    OP_SEARCH :
                    483:        success = decode_DO_ChainedSearchArgument(pe,1,NULLIP,NULLVP,arg);
                    484:        break;
                    485:     case    OP_ADDENTRY :
                    486:        success = decode_DO_ChainedAddEntryArgument(pe,1,NULLIP,NULLVP,arg);
                    487:        break;
                    488:     case    OP_REMOVEENTRY :
                    489:        success = decode_DO_ChainedRemoveEntryArgument(pe,1,NULLIP,NULLVP,arg);
                    490:        break;
                    491:     case    OP_MODIFYENTRY :
                    492:        success = decode_DO_ChainedModifyEntryArgument(pe,1,NULLIP,NULLVP,arg);
                    493:        break;
                    494:     case    OP_MODIFYRDN :
                    495:        success = decode_DO_ChainedModifyRDNArgument(pe,1,NULLIP,NULLVP,arg);
                    496:        break;
                    497:     case    OP_GETEDB :
                    498:        success = decode_Quipu_GetEntryDataBlockArgument(pe,1,NULLIP,NULLVP,&(arg->dca_dsarg.arg_ge));
                    499:        break;
                    500:     default:
                    501:        LLOG(log_dsap, LLOG_EXCEPTIONS, ("QspDecodeInvoke: op id %d unknown!", rox->rox_op));
                    502:        DRejectRequest (sd, ROS_IP_UNRECOG, rox->rox_id);
                    503:        return (dsaplose (di, DP_INVOKE, NULLCP, "Unknown operation identifier"));
                    504:     }
                    505: 
                    506:     if (success == NOTOK)
                    507:     {
                    508:        LLOG (log_dsap, LLOG_EXCEPTIONS, ("QspDecodeInvoke: Unable to parse argument"));
                    509:        DRejectRequest (sd, ROS_IP_MISTYPED, rox->rox_id);
                    510:        return (dsaplose (di, DP_INVOKE, NULLCP, "Undecodable argument"));
                    511:     }
                    512: 
                    513:     return (success);
                    514: }
                    515: 
                    516: int      QspDecodeResult (sd, ror, di)
                    517: int                      sd;
                    518: struct RoSAPresult     * ror;
                    519: struct DSAPindication  * di;
                    520: {
                    521:     int                          success;
                    522:     PE                   pe = ror->ror_result;
                    523:     struct ds_op_res   * res = &(di->di_result.dr_res);
                    524: 
                    525:     di->di_type = DI_RESULT;
                    526:     di->di_result.dr_id = ror->ror_id;
                    527: 
                    528:     switch(res->dcr_dsres.result_type = ror->ror_op)
                    529:     {
                    530:     case    OP_READ :
                    531:        success = decode_DO_ChainedReadResult(pe,1,NULLIP,NULLVP,res);
                    532:        break;
                    533:     case    OP_COMPARE :
                    534:        success = decode_DO_ChainedCompareResult(pe,1,NULLIP,NULLVP,res);
                    535:        break;
                    536:     case    OP_ABANDON :
                    537:        success = decode_DAS_AbandonResult(pe,1,NULLIP,NULLVP,NULLCP);
                    538:        break;
                    539:     case    OP_LIST :
                    540:        success = decode_DO_ChainedListResult(pe,1,NULLIP,NULLVP,res);
                    541:        break;
                    542:     case    OP_SEARCH :
                    543:        success = decode_DO_ChainedSearchResult(pe,1,NULLIP,NULLVP,res);
                    544:        break;
                    545:     case    OP_ADDENTRY :
                    546:        success = decode_DO_ChainedAddEntryResult(pe,1,NULLIP,NULLVP,res);
                    547:        break;
                    548:     case    OP_REMOVEENTRY :
                    549:        success = decode_DO_ChainedRemoveEntryResult(pe,1,NULLIP,NULLVP,res);
                    550:        break;
                    551:     case    OP_MODIFYENTRY :
                    552:        success = decode_DO_ChainedModifyEntryResult(pe,1,NULLIP,NULLVP,res);
                    553:        break;
                    554:     case    OP_MODIFYRDN :
                    555:        success = decode_DO_ChainedModifyRDNResult(pe,1,NULLIP,NULLVP,res);
                    556:        break;
                    557:     case    OP_GETEDB :
                    558:        success = decode_Quipu_GetEntryDataBlockResult(pe,1,NULLIP,NULLVP,&(res->dcr_dsres.res_ge));
                    559:        break;
                    560:     default:
                    561:        success = NOTOK;
                    562:        LLOG(log_dsap, LLOG_EXCEPTIONS, ("QspDecodeResult: op id %d unknown!", ror->ror_op));
                    563:        DRejectRequest (sd, ROS_RRP_UNRECOG, ror->ror_id);
                    564:        return (dsaplose (di, DP_RESULT, NULLCP, "Unknown operation identifier"));
                    565:     }
                    566: 
                    567:     if (success == NOTOK)
                    568:     {
                    569:        LLOG (log_dsap, LLOG_EXCEPTIONS, ("QspDecodeResult: Unable to parse argument"));
                    570:        DRejectRequest (sd, ROS_RRP_MISTYPED, ror->ror_id);
                    571:        return (dsaplose (di, DP_RESULT, NULLCP, "Undecodable argument"));
                    572:     }
                    573: 
                    574:     return(success);
                    575: }
                    576: 
                    577: int      DDecodeError (sd, roe, di)
                    578: int                      sd;
                    579: struct RoSAPerror      * roe;
                    580: struct DSAPindication  * di;
                    581: {
                    582:     int                          success;
                    583:     PE                   pe = roe->roe_param;
                    584:     struct DSError     * err = &(di->di_error.de_err);
                    585: 
                    586: #ifdef PDU_DUMP
                    587:     pdu_dump (pe,DUMP_ERR,roe->roe_id);
                    588: #endif
                    589: 
                    590:     di->di_type = DI_ERROR;
                    591:     di->di_error.de_id = roe->roe_id;
                    592: 
                    593:     switch(err->dse_type = roe->roe_error)
                    594:     {
                    595:     case    DSE_ABANDON_FAILED :
                    596:        success = decode_DAS_AbandonFailedParm(pe,1,NULLIP,NULLVP,&(err->dse_un.dse_un_abandon_fail));
                    597:        break;
                    598:     case    DSE_ATTRIBUTEERROR :
                    599:        success = decode_DAS_AttributeErrorParm(pe,1,NULLIP,NULLVP,&(err->dse_un.dse_un_attribute));
                    600:        break;
                    601:     case    DSE_NAMEERROR :
                    602:        success = decode_DAS_NameErrorParm(pe,1,NULLIP,NULLVP,&(err->dse_un.dse_un_name));
                    603:        break;
                    604:     case    DSE_REFERRAL :
                    605:        success = decode_DAS_ReferralParm(pe,1,NULLIP,NULLVP,&(err->dse_un.dse_un_referral));
                    606:        break;
                    607:     case    DSE_SECURITYERROR :
                    608:        success = decode_DAS_SecurityErrorParm(pe,1,NULLIP,NULLVP,&(err->dse_un.dse_un_security));
                    609:        break;
                    610:     case    DSE_SERVICEERROR :
                    611:        success = decode_DAS_ServiceErrorParm(pe,1,NULLIP,NULLVP,&(err->dse_un.dse_un_service));
                    612:        break;
                    613:     case    DSE_UPDATEERROR :
                    614:        success = decode_DAS_UpdateErrorParm(pe,1,NULLIP,NULLVP,&(err->dse_un.dse_un_update));
                    615:        break;
                    616:     case    DSE_ABANDONED :
                    617:        success = ((pe == NULLPE) ? OK : NOTOK);
                    618:        break;
                    619:     case       DSE_DSAREFERRAL :
                    620:        success = decode_DO_DSAReferralParm(pe, 1, NULLIP, NULLVP, &(err->dse_un.dse_un_referral));
                    621:        break;
                    622: 
                    623:     default:
                    624:        LLOG(log_dsap, LLOG_EXCEPTIONS, ("DDecodeError: op id %d unknown!", roe->roe_error));
                    625:        DRejectRequest (sd, ROS_REP_UNRECOG, roe->roe_id);
                    626:        return (dsaplose (di, DP_ERROR, NULLCP, "Unknown operation identifier"));
                    627:     }
                    628: 
                    629:     if (success == NOTOK)
                    630:     {
                    631:        LLOG (log_dsap, LLOG_EXCEPTIONS, ("DDecodeError: Unable to parse argument"));
                    632:        DRejectRequest (sd, ROS_RRP_MISTYPED, roe->roe_id);
                    633:        return (dsaplose (di, DP_ERROR, NULLCP, "Undecodable argument"));
                    634:     }
                    635: 
                    636:     return(success);
                    637: }
                    638: 
                    639: int      DDecodeUnbind (sd, acf, di)
                    640: int                      sd;
                    641: struct AcSAPfinish     * acf;
                    642: struct DSAPindication  * di;
                    643: {
                    644:     struct RoNOTindication       rni_s;
                    645:     struct RoNOTindication     * rni = &(rni_s);
                    646: 
                    647:     if (RoUnBindInit (acf, rni) != OK)
                    648:        return (ronot2dsaplose (di, "RoUnBindInit", rni));
                    649: 
                    650:     if (acf->acf_ninfo != 0)
                    651:        LLOG (log_dsap, LLOG_EXCEPTIONS, ("Unbind has argument present! sd=%d", sd));
                    652: 
                    653:     di->di_type = DI_FINISH;
                    654:     di->di_finish.df_reason = acf->acf_reason;
                    655: 
                    656:     return (OK);
                    657: }
                    658: 

unix.superglobalmegacorp.com

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