|
|
1.1 root 1: /* psapactivity.c - PPM: activities */
2:
3: #ifndef lint
4: static char *rcsid = "$Header: /f/osi/psap2/RCS/psapactivity.c,v 7.0 89/11/23 22:14:18 mrose Rel $";
5: #endif
6:
7: /*
8: * $Header: /f/osi/psap2/RCS/psapactivity.c,v 7.0 89/11/23 22:14:18 mrose Rel $
9: *
10: *
11: * $Log: psapactivity.c,v $
12: * Revision 7.0 89/11/23 22:14:18 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 "ppkt.h"
33:
34: /* P-CONTROL-GIVE.REQUEST */
35:
36: int PGControlRequest (sd, pi)
37: int sd;
38: struct PSAPindication *pi;
39: {
40: SBV smask;
41: int result;
42: register struct psapblk *pb;
43: struct SSAPindication sis;
44: register struct SSAPabort *sa = &sis.si_abort;
45:
46: missingP (pi);
47:
48: smask = sigioblock ();
49:
50: psapPsig (pb, sd);
51:
52: if ((result = SGControlRequest (sd, &sis)) == NOTOK)
53: if (SC_FATAL (sa -> sa_reason))
54: (void) ss2pslose (pb, pi, "SGControlRequest", sa);
55: else {
56: (void) ss2pslose (NULLPB, pi, "SGControlRequest", sa);
57: goto out1;
58: }
59: else
60: pb -> pb_owned = 0;
61:
62: if (result == NOTOK)
63: freepblk (pb);
64: out1: ;
65: (void) sigiomask (smask);
66:
67: return result;
68: }
69:
70: /* P-ACTIVITY-START.REQUEST */
71:
72: int PActStartRequest (sd, id, data, ndata, pi)
73: int sd;
74: struct SSAPactid *id;
75: int ndata;
76: PE *data;
77: struct PSAPindication *pi;
78: {
79: SBV smask;
80: int len,
81: result;
82: char *base,
83: *realbase;
84: register struct psapblk *pb;
85: struct SSAPindication sis;
86: register struct SSAPabort *sa = &sis.si_abort;
87:
88: toomuchP (data, ndata, NPDATA, "activity start");
89: missingP (pi);
90:
91: smask = sigioblock ();
92:
93: psapPsig (pb, sd);
94:
95: if ((result = info2ssdu (pb, pi, data, ndata, &realbase, &base, &len,
96: "P-ACTIVITY-START user-data", PPDU_NONE)) != OK)
97: goto out2;
98:
99: if ((result = SActStartRequest (sd, id, base, len, &sis)) == NOTOK)
100: if (SC_FATAL (sa -> sa_reason))
101: (void) ss2pslose (pb, pi, "SActStartRequest", sa);
102: else {
103: (void) ss2pslose (NULLPB, pi, "SActStartRequest", sa);
104: goto out1;
105: }
106:
107: out2: ;
108: if (result == NOTOK)
109: freepblk (pb);
110: else
111: if (result == DONE)
112: result = NOTOK;
113: out1: ;
114: if (realbase)
115: free (realbase);
116: else
117: if (base)
118: free (base);
119:
120: (void) sigiomask (smask);
121:
122: return result;
123: }
124:
125: /* P-ACTIVITY-RESUME.REQUEST */
126:
127: int PActResumeRequest (sd, id, oid, ssn, ref, data, ndata, pi)
128: int sd;
129: struct SSAPactid *id,
130: *oid;
131: int ndata;
132: long ssn;
133: struct SSAPref *ref;
134: PE *data;
135: struct PSAPindication *pi;
136: {
137: SBV smask;
138: int len,
139: result;
140: char *base,
141: *realbase;
142: register struct psapblk *pb;
143: struct SSAPindication sis;
144: register struct SSAPabort *sa = &sis.si_abort;
145:
146: toomuchP (data, ndata, NPDATA, "activity resume");
147: missingP (pi);
148:
149: smask = sigioblock ();
150:
151: psapPsig (pb, sd);
152:
153: if ((result = info2ssdu (pb, pi, data, ndata, &realbase, &base, &len,
154: "P-ACTIVITY-RESUME user-data", PPDU_NONE)) != OK)
155: goto out2;
156:
157: if ((result = SActResumeRequest (sd, id, oid, ssn, ref, base, len, &sis))
158: == NOTOK)
159: if (SC_FATAL (sa -> sa_reason))
160: (void) ss2pslose (pb, pi, "SActResumeRequest", sa);
161: else {
162: (void) ss2pslose (NULLPB, pi, "SActResumeRequest", sa);
163: goto out1;
164: }
165:
166: out2: ;
167: if (result == NOTOK)
168: freepblk (pb);
169: else
170: if (result == DONE)
171: result = NOTOK;
172: out1: ;
173: if (realbase)
174: free (realbase);
175: else
176: if (base)
177: free (base);
178:
179: (void) sigiomask (smask);
180:
181: return result;
182: }
183:
184: /* P-ACTIVITY-{INTERRUPT,DISCARD}.REQUEST */
185:
186: int PActIntrRequestAux (sd, reason, pi, sfunc, stype)
187: int sd;
188: int reason;
189: struct PSAPindication *pi;
190: char *stype;
191: IFP sfunc;
192: {
193: SBV smask;
194: int result;
195: register struct psapblk *pb;
196: struct SSAPindication sis;
197: register struct SSAPabort *sa = &sis.si_abort;
198:
199: missingP (pi);
200: missingP (sfunc);
201: missingP (stype);
202:
203: smask = sigioblock ();
204:
205: psapPsig (pb, sd);
206:
207: if ((result = (*sfunc) (sd, reason, &sis)) == NOTOK)
208: if (SC_FATAL (sa -> sa_reason))
209: (void) ss2pslose (pb, pi, stype, sa);
210: else {
211: (void) ss2pslose (NULLPB, pi, stype, sa);
212: goto out1;
213: }
214:
215: if (result == NOTOK)
216: freepblk (pb);
217: out1: ;
218: (void) sigiomask (smask);
219:
220: return result;
221: }
222:
223: /* P-ACTIVITY-{INTERRUPT,DISCARD}.RESPONSE */
224:
225: int PActIntrResponseAux (sd, pi, sfunc, stype)
226: int sd;
227: struct PSAPindication *pi;
228: char *stype;
229: IFP sfunc;
230: {
231: SBV smask;
232: int result;
233: register struct psapblk *pb;
234: struct SSAPindication sis;
235: register struct SSAPabort *sa = &sis.si_abort;
236:
237: missingP (pi);
238: missingP (sfunc);
239: missingP (stype);
240:
241: smask = sigioblock ();
242:
243: psapPsig (pb, sd);
244:
245: if ((result = (*sfunc) (sd, &sis)) == NOTOK)
246: if (SC_FATAL (sa -> sa_reason))
247: (void) ss2pslose (pb, pi, stype, sa);
248: else {
249: (void) ss2pslose (NULLPB, pi, stype, sa);
250: goto out1;
251: }
252:
253: if (result == NOTOK)
254: freepblk (pb);
255: out1: ;
256: (void) sigiomask (smask);
257:
258: return result;
259: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.