Annotation of 43BSDReno/contrib/isode-beta/ftam/ftamrelease1.c, revision 1.1

1.1     ! root        1: /* ftamrelease1.c - FPM: initiate release */
        !             2: 
        !             3: #ifndef        lint
        !             4: static char *rcsid = "$Header: /f/osi/ftam/RCS/ftamrelease1.c,v 7.0 89/11/23 21:53:49 mrose Rel $";
        !             5: #endif
        !             6: 
        !             7: /* 
        !             8:  * $Header: /f/osi/ftam/RCS/ftamrelease1.c,v 7.0 89/11/23 21:53:49 mrose Rel $
        !             9:  *
        !            10:  *
        !            11:  * $Log:       ftamrelease1.c,v $
        !            12:  * Revision 7.0  89/11/23  21:53:49  mrose
        !            13:  * Release 6.0
        !            14:  * 
        !            15:  */
        !            16: 
        !            17: /*
        !            18:  *                               NOTICE
        !            19:  *
        !            20:  *    Acquisition, use, and distribution of this module and related
        !            21:  *    materials are subject to the restrictions of a license agreement.
        !            22:  *    Consult the Preface in the User's Manual for the full terms of
        !            23:  *    this agreement.
        !            24:  *
        !            25:  */
        !            26: 
        !            27: 
        !            28: /* LINTLIBRARY */
        !            29: 
        !            30: #include <stdio.h>
        !            31: #include <signal.h>
        !            32: #include "fpkt.h"
        !            33: 
        !            34: /*    F-TERMINATE.REQUEST */
        !            35: 
        !            36: int    FTerminateRequest (sd, sharedASE, ftr, fti)
        !            37: int    sd;
        !            38: PE     sharedASE;
        !            39: struct FTAMrelease *ftr;
        !            40: struct FTAMindication *fti;
        !            41: {
        !            42:     SBV            smask;
        !            43:     int     result;
        !            44:     register struct ftamblk *fsb;
        !            45: 
        !            46:     missingP (ftr);
        !            47:     missingP (fti);
        !            48: 
        !            49:     smask = sigioblock ();
        !            50: 
        !            51:     ftamPsig (fsb, sd);
        !            52: 
        !            53:     result = FTerminateRequestAux (fsb, sharedASE, ftr, fti);
        !            54: 
        !            55:     (void) sigiomask (smask);
        !            56: 
        !            57:     return result;
        !            58: }
        !            59: 
        !            60: /*  */
        !            61: 
        !            62: static int  FTerminateRequestAux (fsb, sharedASE, ftr, fti)
        !            63: register struct ftamblk *fsb;
        !            64: PE     sharedASE;
        !            65: struct FTAMrelease *ftr;
        !            66: struct FTAMindication *fti;
        !            67: {
        !            68:     int     result;
        !            69:     PE     pe;
        !            70:     struct AcSAPrelease acrs;
        !            71:     register struct AcSAPrelease   *acr = &acrs;
        !            72:     struct AcSAPindication  acis;
        !            73:     register struct AcSAPindication *aci = &acis;
        !            74:     register struct AcSAPabort *aca = &aci -> aci_abort;
        !            75:     struct type_FTAM_PDU *pdu;
        !            76:     register struct type_FTAM_F__TERMINATE__response *rsp;
        !            77: 
        !            78:     if (!(fsb -> fsb_flags & FSB_INIT))
        !            79:        return ftamlose (fti, FS_GEN (fsb), 0, NULLCP, "not initiator");
        !            80:     if (fsb -> fsb_state != FSB_INITIALIZED)
        !            81:        return ftamlose (fti, FS_GEN (fsb), 0, NULLCP,
        !            82:                    "not in the initialized state");
        !            83: 
        !            84:     bzero ((char *) acr, sizeof *acr);
        !            85:     bzero ((char *) ftr, sizeof *ftr);
        !            86: 
        !            87:     pe = NULLPE;
        !            88:     if ((pdu = (struct type_FTAM_PDU *) calloc (1, sizeof *pdu)) == NULL) {
        !            89:        (void) ftamlose (fti, FS_GEN (fsb), 1, NULLCP, "out of memory");
        !            90: out: ;
        !            91:        if (pe)
        !            92:            pe_free (pe);
        !            93:        if (pdu)
        !            94:            free_FTAM_PDU (pdu);
        !            95:        if (fti -> fti_abort.fta_action == FACTION_PERM)
        !            96:            freefsblk (fsb);
        !            97:        return NOTOK;
        !            98:     }
        !            99:     pdu -> offset = type_FTAM_PDU_f__terminate__request;
        !           100:     if (sharedASE
        !           101:            && (pdu -> un.f__terminate__request =
        !           102:                        shared2fpm (fsb, sharedASE, fti)) == NULL)
        !           103:        goto out;
        !           104: 
        !           105:     if (encode_FTAM_PDU (&pe, 1, 0, NULLCP, pdu) == NOTOK) {
        !           106:        (void) ftamlose (fti, FS_GEN (fsb), 1, NULLCP,
        !           107:                         "error encoding PDU: %s", PY_pepy);
        !           108:        goto out;
        !           109:     }
        !           110: 
        !           111:     pe -> pe_context = fsb -> fsb_id;
        !           112: 
        !           113:     fsbtrace (fsb, (fsb -> fsb_fd, "A-RELEASE.REQUEST", "F-TERMINATE-request",
        !           114:                    pe, 0));
        !           115: 
        !           116:     result = AcRelRequest (fsb -> fsb_fd, ACF_NORMAL, &pe, 1, NOTOK, acr, aci);
        !           117: 
        !           118:     pe_free (pe);
        !           119:     pe = NULLPE;
        !           120:     free_FTAM_PDU (pdu);
        !           121:     pdu = NULL;
        !           122: 
        !           123:     if (result == NOTOK) {
        !           124:        if (aca -> aca_source == ACA_USER)
        !           125:            return acs2ftamabort (fsb, aca, fti);
        !           126: 
        !           127:        (void) acs2ftamlose (fsb, fti, "AcRelRequest", aca);
        !           128:        goto out;
        !           129:     }
        !           130: 
        !           131:     if (!acr -> acr_affirmative) {
        !           132:        result = fpktlose (fsb, fti, FS_ACS_MGMT, NULLCP,
        !           133:                "other side refused to release association");
        !           134:        goto done;
        !           135:     }
        !           136:     fsb -> fsb_fd = NOTOK;
        !           137: 
        !           138:     if (acr -> acr_ninfo < 1 || (pe = acr -> acr_info[0]) == NULLPE) {
        !           139:        result = fpktlose (fsb, fti, FS_PRO_ERR, NULLCP, NULLCP);
        !           140:        goto done;
        !           141:     }
        !           142: 
        !           143:     if (decode_FTAM_PDU (pe, 1, NULLIP, NULLVP, &pdu) == NOTOK)
        !           144:        result = fpktlose (fsb, fti, FS_PRO_ERRMSG, NULLCP,
        !           145:                           "unable to parse PDU: %s", PY_pepy);
        !           146:     else {
        !           147:        if (pdu -> offset != type_FTAM_PDU_f__terminate__response) {
        !           148:            result = fpktlose (fsb, fti, FS_PRO_ERRPROC, NULLCP,
        !           149:                               "expecting F-TERMINATE-response, got %d",
        !           150:                               pdu -> offset);
        !           151:            goto done;
        !           152:        }
        !           153:        rsp = pdu -> un.f__terminate__response;
        !           154: 
        !           155:        fsbtrace (fsb,
        !           156:                (fsb -> fsb_fd, "A-RELEASE.CONFIRMATION",
        !           157:                "F-TERMINATE-response", pe, 1));
        !           158: 
        !           159:        if (rsp -> shared__ASE__information
        !           160:                && fpm2shared (fsb, rsp -> shared__ASE__information,
        !           161:                               &ftr -> ftr_sharedASE, fti) == NOTOK)
        !           162:            goto done;
        !           163:        if (rsp -> charging
        !           164:                && fpm2chrg (fsb, rsp -> charging, &ftr -> ftr_charges, fti)
        !           165:                        == NOTOK)
        !           166:            goto done;
        !           167: 
        !           168:        result = OK;
        !           169:     }
        !           170: 
        !           171: done: ;
        !           172:     if (pdu)
        !           173:        free_FTAM_PDU (pdu);
        !           174:     ACRFREE (acr);
        !           175:     freefsblk (fsb);
        !           176: 
        !           177:     return result;
        !           178: }

unix.superglobalmegacorp.com

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