Annotation of 43BSDReno/contrib/isode-beta/rtsap/test/rtsinit.c, revision 1.1

1.1     ! root        1: #include <stdio.h>
        !             2: #include <isode/rtsap.h>
        !             3: 
        !             4: #include "support.h"   /* defines operation values */
        !             5: 
        !             6:                                /* e.g., "directory" */
        !             7: static char *myservice = "RTSTEST";
        !             8: 
        !             9:                                /* e.g., "directory services" */
        !            10: static char *mycontext = "isode chic read";
        !            11: static char *mypci = "isode chic read pci";
        !            12: 
        !            13: FILE *errfp = stderr;
        !            14: 
        !            15: main (argc, argv, envp)
        !            16: int    argc;
        !            17: char  **argv,
        !            18:       **envp;
        !            19: {
        !            20:     int            sd;
        !            21:     struct SSAPref sfs;
        !            22:     register struct SSAPref *sf;
        !            23:     register struct PSAPaddr *pa;
        !            24:     struct RtSAPconnect rtcs;
        !            25:     register struct RtSAPconnect   *rtc = &rtcs;
        !            26:     struct AcSAPrelease acrs;
        !            27:     register struct AcSAPrelease   *acr = &acrs;
        !            28:     struct RtSAPindication  rtis;
        !            29:     register struct RtSAPindication *rti = &rtis;
        !            30:     register struct RtSAPabort *rta = &rti -> rti_abort;
        !            31:     register AEI aei;
        !            32:     register OID ctx, pci;
        !            33:     struct PSAPctxlist pcs;
        !            34:     register struct PSAPctxlist *pc = &pcs;
        !            35:     int        wantabort;
        !            36: 
        !            37:     if ((aei = str2aei (argv[1], myservice)) == NULLAEI)
        !            38:        fprintf(errfp, "%s-%s: unknown application-entity", argv[1], myservice);
        !            39:     if ((pa = aei2addr (aei)) == NULLPA)
        !            40:        fprintf(errfp, "address translation failed");
        !            41:     if ((ctx = ode2oid (mycontext)) == NULLOID)
        !            42:        fprintf(errfp, "%s: unknown object descriptor", mycontext);
        !            43:     if ((ctx = oid_cpy (ctx)) == NULLOID)
        !            44:        fprintf(errfp, "oid_cpy");
        !            45:     if ((pci = ode2oid (mypci)) == NULLOID)
        !            46:        fprintf(errfp, "%s: unknown object descriptor", mypci);
        !            47:     if ((pci = oid_cpy (pci)) == NULLOID)
        !            48:        fprintf(errfp, "oid_cpy");
        !            49:     pc -> pc_nctx = 1;
        !            50:     pc -> pc_ctx[0].pc_id = 1;
        !            51:     pc -> pc_ctx[0].pc_asn = pci;
        !            52:     pc -> pc_ctx[0].pc_atn = NULLOID;
        !            53: 
        !            54: 
        !            55:     if ((sf = addr2ref (PLocalHostName ())) == NULL) {
        !            56:        sf = &sfs;
        !            57:        (void) bzero ((char *) sf, sizeof *sf);
        !            58:     }
        !            59: 
        !            60:     if (argc > 2)
        !            61:        wantabort = 1; /* Want to do an abort */
        !            62:     else
        !            63:        wantabort = 0;
        !            64:     
        !            65: /* read command line arguments here... */
        !            66: 
        !            67:     fprintf(errfp, "RT-OPEN.REQUEST:\n");
        !            68:     if (RtOpenRequest (RTS_TWA, RTS_INITIATOR, ctx, NULLAEI, NULLAEI,
        !            69:        NULLPA, pa, pc, NULLOID, 0, NULLQOS, rtc, rti)
        !            70:            == NOTOK)
        !            71:        fprintf(errfp, "RT-OPEN.REQUEST: %s", RtErrString (rta -> rta_reason));
        !            72: 
        !            73:     if (rtc -> rtc_result != RTS_ACCEPT)
        !            74:        fprintf(errfp, "association rejected: %s",
        !            75:        RtErrString (rta->rta_reason));
        !            76: 
        !            77:     sd = rtc -> rtc_sd;
        !            78:     RTCFREE (rtc);
        !            79: 
        !            80:     /*
        !            81:      * General run through of all the primatives
        !            82:      * Send using both types of transfer then switch over checking that
        !            83:      * Please and Give both work. Then receive both types of transfer from
        !            84:      * the receiving end and then switch over again test that transmitting
        !            85:      * still works
        !            86:      */
        !            87: 
        !            88:     oper(sd, SIMP_SEND);
        !            89: 
        !            90:     oper(sd, CPLX_SEND);
        !            91: 
        !            92:     oper(sd, RCV_PLS);
        !            93: 
        !            94:     oper(sd, SEND_GIVE);
        !            95: 
        !            96:     oper(sd, SIMP_RCV);
        !            97: 
        !            98:     oper(sd, CPLX_RCV);
        !            99: 
        !           100:     oper(sd, SEND_PLS);
        !           101: 
        !           102:     oper(sd, RCV_GIVE);
        !           103: 
        !           104:     oper(sd, CPLX_SEND);
        !           105: 
        !           106:     if (wantabort)
        !           107:        oper(sd, SEND_ABRT);
        !           108:     else
        !           109:        oper(sd, SEND_CLOSE);
        !           110: 
        !           111:     exit (0);
        !           112: }

unix.superglobalmegacorp.com

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