|
DataMuseum.dkPresents historical artifacts from the history of: DKUUG/EUUG Conference tapes |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about DKUUG/EUUG Conference tapes Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - downloadIndex: T a
Length: 4551 (0x11c7) Types: TextFile Names: »acsapreleas1.c«
└─⟦3d0c2be1b⟧ Bits:30001254 ISODE-5.0 Tape └─⟦eba4602b1⟧ »./isode-5.0.tar.Z« └─⟦d3ac74d73⟧ └─⟦this⟧ »isode-5.0/acsap/acsapreleas1.c«
/* acsapreleas1.c - ACPM: initiate release */ #ifndef lint static char *rcsid = "$Header: /f/osi/acsap/RCS/acsapreleas1.c,v 6.0 89/03/18 23:24:17 mrose Rel $"; #endif /* * $Header: /f/osi/acsap/RCS/acsapreleas1.c,v 6.0 89/03/18 23:24:17 mrose Rel $ * * * $Log: acsapreleas1.c,v $ * Revision 6.0 89/03/18 23:24:17 mrose * Release 5.0 * */ /* * NOTICE * * Acquisition, use, and distribution of this module and related * materials are subject to the restrictions of a license agreement. * Consult the Preface in the User's Manual for the full terms of * this agreement. * */ /* LINTLIBRARY */ #include <stdio.h> #include <signal.h> #include "ACS-types.h" #define ACSE #include "acpkt.h" #include "tailor.h" /* \f A-RELEASE.REQUEST */ int AcRelRequest (sd, reason, data, ndata, acr, aci) int sd; int reason; PE *data; int ndata; struct AcSAPrelease *acr; struct AcSAPindication *aci; { SBV smask; int result; register struct assocblk *acb; PE pe; struct PSAPrelease prs; register struct PSAPrelease *pr = &prs; struct PSAPindication pis; register struct PSAPabort *pa = &pis.pi_abort; struct type_ACS_ACSE__apdu *pdu; register struct type_ACS_RLRQ__apdu *rlrq; register struct type_ACS_RLRE__apdu *rlre; switch (reason) { case ACF_NORMAL: case ACF_URGENT: case ACF_USERDEFINED: break; default: return acsaplose (aci, ACS_PARAMETER, NULLCP, "invalid value for reason parameter"); } toomuchP (data, ndata, NACDATA, "release"); if (data) { /* XXX: probably should have a more intensive check... */ register int i; register PE *pep; for (pep = data, i = ndata; i > 0; pep++, i--) if ((*pep) -> pe_context == PE_DFLT_CTX) return acsaplose (aci, ACS_PARAMETER, NULLCP, "default context not allowed for user-data at slot %d", pep - data); } missingP (acr); missingP (aci); smask = sigioblock (); acsapPsig (acb, sd); pe = NULLPE; pdu = NULL; if ((rlrq = (struct type_ACS_RLRQ__apdu *) calloc (1, sizeof *rlrq)) == NULL) { result = acsaplose (aci, ACS_CONGEST, NULLCP, "out of memory"); goto out2; } rlrq -> optionals |= opt_ACS_RLRQ__apdu_reason; rlrq -> reason = reason; if (data && ndata > 0 && (rlrq -> user__information = info2apdu (acb, aci, data, ndata)) == NULL) goto out2; result = encode_ACS_RLRQ__apdu (&pe, 1, 0, NULLCP, rlrq); free_ACS_RLRQ__apdu (rlrq); rlrq = NULL; if (result == NOTOK) { (void) acsaplose (aci, ACS_CONGEST, NULLCP, "error encoding PDU: %s", PY_pepy); goto out2; } pe -> pe_context = acb -> acb_id; PLOG (acsap_log, print_ACS_ACSE__apdu, pe, "RLRQ-apdu", 0); if ((result = PRelRequest (acb -> acb_fd, &pe, 1, pr, &pis)) == NOTOK) { if (pa -> pa_peer) { (void) AcABORTser (acb -> acb_fd, pa, aci); goto out1; } (void) ps2acslose (acb, aci, "PRelRequest", pa); if (PC_FATAL (pa -> pa_reason)) goto out2; else goto out1; } bzero ((char *) acr, sizeof *acr); if (pr -> pr_ninfo == 0) { result = acsaplose (aci, ACS_PROTOCOL, NULLCP, "no user-data on P-RELEASE"); goto out3; } pe_free (pe); result = decode_ACS_ACSE__apdu (pe = pr -> pr_info[0], 1, NULLIP, NULLVP, &pdu); #ifdef DEBUG if (result == OK && (acsap_log -> ll_events & LLOG_PDUS)) vpdu (acsap_log, print_ACS_ACSE__apdu, pe, "ACSE-apdu", 1); #endif pe_free (pe); pe = pr -> pr_info[0] = NULLPE; if (result == NOTOK) { (void) acpktlose (acb, aci, ACS_PROTOCOL, NULLCP, "%s", PY_pepy); goto out3; } if (pdu -> offset != type_ACS_ACSE__apdu_rlre) { (void) acpktlose (acb, aci, ACS_PROTOCOL, NULLCP, "unexpected PDU %d on P-RELEASE", pdu -> offset); goto out3; } rlre = pdu -> un.rlre; if (rlre -> optionals & opt_ACS_RLRE__apdu_reason) acr -> acr_reason = rlre -> reason; else acr -> acr_reason = int_ACS_reason_normal; if (apdu2info (acb, aci, rlre -> user__information, acr -> acr_info, &acr -> acr_ninfo) == NOTOK) goto out3; if (acr -> acr_affirmative = pr -> pr_affirmative) { acb -> acb_fd = NOTOK; result = OK; } else result = DONE; out3: ; PRFREE (pr); out2: ; if (result == DONE) result = OK; else freeacblk (acb); out1: ; if (pe) pe_free (pe); if (rlrq) free_ACS_RLRQ__apdu (rlrq); if (pdu) free_ACS_ACSE__apdu (pdu); (void) sigiomask (smask); return result; }