| 1 | /* acsapreleas3.c - ACPM: interpret release */ |
| 2 | |
| 3 | #ifndef lint |
| 4 | static char *rcsid = "$Header: /f/osi/acsap/RCS/acsapreleas3.c,v 7.2 91/02/22 09:14:15 mrose Interim $"; |
| 5 | #endif |
| 6 | |
| 7 | /* |
| 8 | * $Header: /f/osi/acsap/RCS/acsapreleas3.c,v 7.2 91/02/22 09:14:15 mrose Interim $ |
| 9 | * |
| 10 | * |
| 11 | * $Log: acsapreleas3.c,v $ |
| 12 | * Revision 7.2 91/02/22 09:14:15 mrose |
| 13 | * Interim 6.8 |
| 14 | * |
| 15 | * Revision 7.1 90/07/01 21:02:06 mrose |
| 16 | * pepsy |
| 17 | * |
| 18 | * Revision 7.0 89/11/23 21:21:56 mrose |
| 19 | * Release 6.0 |
| 20 | * |
| 21 | */ |
| 22 | |
| 23 | /* |
| 24 | * NOTICE |
| 25 | * |
| 26 | * Acquisition, use, and distribution of this module and related |
| 27 | * materials are subject to the restrictions of a license agreement. |
| 28 | * Consult the Preface in the User's Manual for the full terms of |
| 29 | * this agreement. |
| 30 | * |
| 31 | */ |
| 32 | |
| 33 | |
| 34 | /* LINTLIBRARY */ |
| 35 | |
| 36 | #include <stdio.h> |
| 37 | #include <signal.h> |
| 38 | #include "ACS-types.h" |
| 39 | #define ACSE |
| 40 | #include "acpkt.h" |
| 41 | #ifdef DEBUG |
| 42 | #include "tailor.h" |
| 43 | #endif |
| 44 | |
| 45 | /* \f handle P-RELEASE.INDICATION */ |
| 46 | |
| 47 | int AcFINISHser (sd, pf, aci) |
| 48 | int sd; |
| 49 | register struct PSAPfinish *pf; |
| 50 | register struct AcSAPindication *aci; |
| 51 | { |
| 52 | SBV smask; |
| 53 | int result; |
| 54 | PE pe; |
| 55 | register struct assocblk *acb; |
| 56 | register struct AcSAPfinish *acf; |
| 57 | struct type_ACS_ACSE__apdu *pdu; |
| 58 | register struct type_ACS_RLRQ__apdu *rlrq; |
| 59 | |
| 60 | missingP (pf); |
| 61 | missingP (aci); |
| 62 | |
| 63 | smask = sigioblock (); |
| 64 | |
| 65 | acsapPsig (acb, sd); |
| 66 | |
| 67 | bzero ((char *) aci, sizeof *aci); |
| 68 | aci -> aci_type = ACI_FINISH; |
| 69 | acf = &aci -> aci_finish; |
| 70 | |
| 71 | pdu = NULL; |
| 72 | |
| 73 | if (pf -> pf_ninfo < 1) { |
| 74 | result = acsaplose (aci, ACS_PROTOCOL, NULLCP, |
| 75 | "no user-data on P-RELEASE"); |
| 76 | goto out; |
| 77 | } |
| 78 | |
| 79 | result = decode_ACS_ACSE__apdu (pe = pf -> pf_info[0], 1, NULLIP, NULLVP, |
| 80 | &pdu); |
| 81 | |
| 82 | #ifdef DEBUG |
| 83 | if (result == OK && (acsap_log -> ll_events & LLOG_PDUS)) |
| 84 | pvpdu (acsap_log, print_ACS_ACSE__apdu_P, pe, "ACSE-apdu", 1); |
| 85 | #endif |
| 86 | |
| 87 | pe_free (pe); |
| 88 | pe = pf -> pf_info[0] = NULLPE; |
| 89 | |
| 90 | if (result == NOTOK) { |
| 91 | result = acsaplose (aci, ACS_PROTOCOL, NULLCP, "%s", PY_pepy); |
| 92 | goto out; |
| 93 | } |
| 94 | |
| 95 | if (pdu -> offset != type_ACS_ACSE__apdu_rlrq) { |
| 96 | result = acsaplose (aci, ACS_PROTOCOL, NULLCP, |
| 97 | "unexpected PDU %d on P-RELEASE", pdu -> offset); |
| 98 | goto out; |
| 99 | } |
| 100 | |
| 101 | rlrq = pdu -> un.rlrq; |
| 102 | if (rlrq -> optionals & opt_ACS_RLRQ__apdu_reason) |
| 103 | acf -> acf_reason = rlrq -> reason; |
| 104 | else |
| 105 | acf -> acf_reason = int_ACS_reason_normal; |
| 106 | result = apdu2info (acb, aci, rlrq -> user__information, acf -> acf_info, |
| 107 | &acf -> acf_ninfo); |
| 108 | |
| 109 | out: ; |
| 110 | if (result == NOTOK) |
| 111 | freeacblk (acb); |
| 112 | else |
| 113 | acb -> acb_flags |= ACB_FINN; |
| 114 | |
| 115 | PFFREE (pf); |
| 116 | if (pdu) |
| 117 | free_ACS_ACSE__apdu (pdu); |
| 118 | |
| 119 | (void) sigiomask (smask); |
| 120 | |
| 121 | return result; |
| 122 | } |