|
|
1.1 root 1: /* acsapabort2.c - ACPM: interpret abort */
2:
3: #ifndef lint
4: static char *rcsid = "$Header: /f/osi/acsap/RCS/acsapabort2.c,v 7.1 90/07/01 21:01:51 mrose Exp $";
5: #endif
6:
7: /*
8: * $Header: /f/osi/acsap/RCS/acsapabort2.c,v 7.1 90/07/01 21:01:51 mrose Exp $
9: *
10: *
11: * $Log: acsapabort2.c,v $
12: * Revision 7.1 90/07/01 21:01:51 mrose
13: * pepsy
14: *
15: * Revision 7.0 89/11/23 21:21:45 mrose
16: * Release 6.0
17: *
18: */
19:
20: /*
21: * NOTICE
22: *
23: * Acquisition, use, and distribution of this module and related
24: * materials are subject to the restrictions of a license agreement.
25: * Consult the Preface in the User's Manual for the full terms of
26: * this agreement.
27: *
28: */
29:
30:
31: /* LINTLIBRARY */
32:
33: #include <stdio.h>
34: #include <signal.h>
35: #include "ACS-types.h"
36: #define ACSE
37: #include "acpkt.h"
38: #ifdef DEBUG
39: #include "tailor.h"
40: #endif
41:
42: /* handle P-{U,P}-ABORT.INDICATION */
43:
44: int AcABORTser (sd, pa, aci)
45: int sd;
46: register struct PSAPabort *pa;
47: register struct AcSAPindication *aci;
48: {
49: SBV smask;
50: int result;
51: register struct assocblk *acb;
52:
53: missingP (pa);
54: missingP (aci);
55:
56: smask = sigioblock ();
57:
58: if ((acb = findacblk (sd)) == NULL) {
59: (void) sigiomask (smask);
60: return acsaplose (aci, ACS_PARAMETER, NULLCP,
61: "invalid association descriptor");
62: }
63:
64: result = ps2acsabort (acb, pa, aci);
65:
66: (void) sigiomask (smask);
67:
68: return result;
69: }
70:
71: /* */
72:
73: int ps2acsabort (acb, pa, aci)
74: register struct assocblk *acb;
75: register struct PSAPabort *pa;
76: register struct AcSAPindication *aci;
77: {
78: int result;
79: PE pe;
80: register struct AcSAPabort *aca = &aci -> aci_abort;
81: struct type_ACS_ACSE__apdu *pdu;
82: register struct type_ACS_ABRT__apdu *abrt;
83:
84: result = OK;
85: pdu = NULL;
86:
87: if (!pa -> pa_peer) {
88: if (PC_FATAL (pa -> pa_reason))
89: acb -> acb_fd = NOTOK;
90:
91: (void) ps2acslose (acb, aci, NULLCP, pa);
92: goto out;
93: }
94:
95: if (pa -> pa_ninfo == 0) {
96: (void) acsaplose (aci, ACS_ABORTED, NULLCP, NULLCP);
97: if (acb -> acb_sversion == 1)
98: aca -> aca_source = ACA_PROVIDER;
99: goto out;
100: }
101:
102: bzero ((char *) aci, sizeof *aci);
103: aci -> aci_type = ACI_ABORT;
104:
105: if (acb -> acb_sversion == 1) {
106: register int i;
107:
108: aca -> aca_reason = ACS_ABORTED;
109: aca -> aca_source = ACA_USER;
110: if ((i = pa -> pa_ninfo) > NACDATA)
111: i = NACDATA;
112: while (i-- > 0) {
113: aca -> aca_info[i] = pa -> pa_info[i];
114: pa -> pa_info[i] = NULLPE;
115: }
116: goto out;
117: }
118:
119: result = decode_ACS_ACSE__apdu (pe = pa -> pa_info[0], 1, NULLIP, NULLVP,
120: &pdu);
121:
122: #ifdef DEBUG
123: if (result == OK && (acsap_log -> ll_events & LLOG_PDUS))
124: pvpdu (acsap_log, print_ACS_ACSE__apdu_P, pe, "ACSE-apdu", 1);
125: #endif
126:
127: pe_free (pe);
128: pe = pa -> pa_info[0] = NULLPE;
129:
130: if (result == NOTOK) {
131: (void) acsaplose (aci, ACS_PROTOCOL, NULLCP, "%s", PY_pepy);
132: goto out;
133: }
134:
135: if (pdu -> offset != type_ACS_ACSE__apdu_abrt) {
136: result = acsaplose (aci, ACS_PROTOCOL, NULLCP,
137: "unexpected PDU %d on P-U-ABORT", pdu -> offset);
138: goto out;
139: }
140:
141: abrt = pdu -> un.abrt;
142: aca -> aca_reason = ACS_ABORTED;
143: aca -> aca_source = abrt -> abort__source;
144: (void) apdu2info (acb, aci, abrt -> user__information, aca -> aca_info,
145: &aca -> aca_ninfo);
146:
147: out: ;
148: acb -> acb_fd = NOTOK;
149: PAFREE (pa);
150: if (pdu)
151: free_ACS_ACSE__apdu (pdu);
152:
153: return result;
154: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.