Commit | Line | Data |
---|---|---|
cf908fd1 WJ |
1 | /* psaprelease2.c - PPM: respond to release */ |
2 | ||
3 | #ifndef lint | |
4 | static char *rcsid = "$Header: /f/osi/psap2/RCS/psaprelease2.c,v 7.1 91/02/22 09:37:42 mrose Interim $"; | |
5 | #endif | |
6 | ||
7 | /* | |
8 | * $Header: /f/osi/psap2/RCS/psaprelease2.c,v 7.1 91/02/22 09:37:42 mrose Interim $ | |
9 | * | |
10 | * | |
11 | * $Log: psaprelease2.c,v $ | |
12 | * Revision 7.1 91/02/22 09:37:42 mrose | |
13 | * Interim 6.8 | |
14 | * | |
15 | * Revision 7.0 89/11/23 22:14:26 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 "ppkt.h" | |
36 | ||
37 | /* \f P-RELEASE.RESPONSE */ | |
38 | ||
39 | int PRelResponse (sd, status, data, ndata, pi) | |
40 | int sd; | |
41 | int status; | |
42 | PE *data; | |
43 | int ndata; | |
44 | struct PSAPindication *pi; | |
45 | { | |
46 | SBV smask; | |
47 | int len, | |
48 | result; | |
49 | char *base, | |
50 | *realbase; | |
51 | register struct psapblk *pb; | |
52 | struct SSAPindication sis; | |
53 | register struct SSAPabort *sa = &sis.si_abort; | |
54 | ||
55 | toomuchP (data, ndata, NPDATA, "release"); | |
56 | missingP (pi); | |
57 | ||
58 | smask = sigioblock (); | |
59 | ||
60 | psapFsig (pb, sd); | |
61 | ||
62 | switch (result = info2ssdu (pb, pi, data, ndata, &realbase, &base, &len, | |
63 | "P-RELEASE user-data", PPDU_NONE)) { | |
64 | case NOTOK: | |
65 | goto out2; | |
66 | ||
67 | case OK: | |
68 | default: | |
69 | break; | |
70 | ||
71 | case DONE: | |
72 | result = NOTOK; | |
73 | goto out1; | |
74 | } | |
75 | ||
76 | if ((result = SRelResponse (pb -> pb_fd, status, base, len, &sis)) | |
77 | == NOTOK) | |
78 | if (SC_FATAL (sa -> sa_reason)) { | |
79 | (void) ss2pslose (pb, pi, "SRelResponse", sa); | |
80 | goto out2; | |
81 | } | |
82 | else { | |
83 | (void) ss2pslose (NULLPB, pi, "SRelResponse", sa); | |
84 | goto out1; | |
85 | } | |
86 | ||
87 | if (status == SC_ACCEPT) | |
88 | pb -> pb_fd = NOTOK; | |
89 | else | |
90 | pb -> pb_flags &= ~PB_FINN; | |
91 | ||
92 | result = OK; | |
93 | ||
94 | out2: ; | |
95 | if (result == NOTOK || status == SC_ACCEPT) | |
96 | freepblk (pb); | |
97 | out1: ; | |
98 | if (base) | |
99 | free (base); | |
100 | ||
101 | (void) sigiomask (smask); | |
102 | ||
103 | return result; | |
104 | } |