|
|
1.1 root 1: /* psapabort.c - PPM: user abort */
2:
3: #ifndef lint
4: static char *rcsid = "$Header: /f/osi/psap2-lpp/RCS/psapabort.c,v 7.1 90/07/01 21:05:23 mrose Exp $";
5: #endif
6:
7: /*
8: * $Header: /f/osi/psap2-lpp/RCS/psapabort.c,v 7.1 90/07/01 21:05:23 mrose Exp $
9: *
10: * Contributed by The Wollongong Group, Inc.
11: *
12: *
13: * $Log: psapabort.c,v $
14: * Revision 7.1 90/07/01 21:05:23 mrose
15: * pepsy
16: *
17: * Revision 7.0 89/11/23 22:15:53 mrose
18: * Release 6.0
19: *
20: */
21:
22: /*
23: * NOTICE
24: *
25: * Acquisition, use, and distribution of this module and related
26: * materials are subject to the restrictions of a license agreement.
27: * Consult the Preface in the User's Manual for the full terms of
28: * this agreement.
29: *
30: */
31:
32:
33: /* LINTLIBRARY */
34:
35: #include <stdio.h>
36: #include <signal.h>
37: #define LPP
38: #include "PS-types.h"
39: #include "ppkt.h"
40: #include "tailor.h"
41:
42: /* P-U-ABORT.REQUEST */
43:
44: int PUAbortRequest (sd, data, ndata, pi)
45: int sd;
46: PE *data;
47: int ndata;
48: struct PSAPindication *pi;
49: {
50: SBV smask;
51: int result;
52: register struct psapblk *pb;
53: PE pe;
54: PS ps;
55: register struct type_PS_Abort__PDU *pdu;
56:
57: toomuchP (data, ndata, NPDATA_PS, "abort");
58: if (ndata > 0) {
59: if ((pe = data[0]) -> pe_context != PCI_ACSE)
60: return psaplose (pi, PC_PARAMETER, NULLCP,
61: "wrong context for abort user data");
62: }
63: else
64: pe = NULLPE;
65: missingP (pi);
66:
67: smask = sigioblock ();
68:
69: if ((pb = findpblk (sd)) == NULL) {
70: (void) sigiomask (smask);
71: return psaplose (pi, PC_PARAMETER, NULLCP,
72: "invalid presentation descriptor");
73: }
74:
75: if ((pdu = (struct type_PS_Abort__PDU *) malloc (sizeof *pdu)) == NULL) {
76: (void) psaplose (pi, PC_CONGEST, NULLCP, "out of memory");
77: goto out;
78: }
79: pdu -> reference = pb -> pb_reliability == LOW_QUALITY ? pb -> pb_reference
80: : NULLRF;
81: pdu -> user__data = pe;
82: pdu -> reason = NULL;
83:
84: pe = NULLPE;
85: result = encode_PS_Abort__PDU (&pe, 1, 0, NULLCP, pdu);
86:
87: pdu -> reference = NULL;
88: pdu -> user__data = NULLPE;
89: free_PS_Abort__PDU (pdu);
90:
91: if (result != NOTOK) {
92: PLOGP (psap2_log,PS_PDUs, pe, "Abort-PDU", 0);
93:
94: if ((result = pe2ps (ps = pb -> pb_stream, pe)) == NOTOK)
95: (void) pslose (pi, ps -> ps_errno);
96: else
97: result = OK;
98: }
99: else
100: (void) psaplose (pi, PC_CONGEST, NULLCP, "error encoding PDU: %s",
101: PY_pepy);
102:
103: if (pe)
104: pe_free (pe);
105:
106: out: ;
107: freepblk (pb);
108:
109: (void) sigiomask (smask);
110:
111: return result;
112: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.