Commit | Line | Data |
---|---|---|
a0be6343 WJ |
1 | /* ssapmajor2.c - SPM: respond to majorsyncs */ |
2 | ||
3 | #ifndef lint | |
4 | static char *rcsid = "$Header: /f/osi/ssap/RCS/ssapmajor2.c,v 7.1 91/02/22 09:45:53 mrose Interim $"; | |
5 | #endif | |
6 | ||
7 | /* | |
8 | * $Header: /f/osi/ssap/RCS/ssapmajor2.c,v 7.1 91/02/22 09:45:53 mrose Interim $ | |
9 | * | |
10 | * | |
11 | * $Log: ssapmajor2.c,v $ | |
12 | * Revision 7.1 91/02/22 09:45:53 mrose | |
13 | * Interim 6.8 | |
14 | * | |
15 | * Revision 7.0 89/11/23 22:25:31 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 "spkt.h" | |
36 | ||
37 | /* \f S-MAJOR-SYNC.RESPONSE */ | |
38 | ||
39 | int SMajSyncResponse (sd, data, cc, si) | |
40 | int sd; | |
41 | char *data; | |
42 | int cc; | |
43 | struct SSAPindication *si; | |
44 | { | |
45 | SBV smask; | |
46 | int result; | |
47 | register struct ssapblk *sb; | |
48 | ||
49 | missingP (si); | |
50 | ||
51 | smask = sigioblock (); | |
52 | ||
53 | ssapPsig (sb, sd); | |
54 | toomuchP (sb, data, cc, SN_SIZE, "majorsync"); | |
55 | ||
56 | result = SMajSyncResponseAux (sb, data, cc, si); | |
57 | ||
58 | (void) sigiomask (smask); | |
59 | ||
60 | return result; | |
61 | } | |
62 | ||
63 | /* \f */ | |
64 | ||
65 | int SMajSyncResponseAux (sb, data, cc, si) | |
66 | register struct ssapblk *sb; | |
67 | char *data; | |
68 | int cc; | |
69 | register struct SSAPindication *si; | |
70 | { | |
71 | int result; | |
72 | ||
73 | if (!(sb -> sb_requirements & SR_MAJORSYNC) | |
74 | && !(sb -> sb_requirements & SR_ACTIVITY) | |
75 | && !(sb -> sb_flags & SB_Vact)) | |
76 | return ssaplose (si, SC_OPERATION, NULLCP, | |
77 | "major synchronize service unavailable"); | |
78 | if (!(sb -> sb_flags & SB_MAA)) | |
79 | return ssaplose (si, SC_OPERATION, NULLCP, | |
80 | "no majorsync in progress"); | |
81 | ||
82 | if ((result = SWriteRequestAux (sb, SPDU_MAA, data, cc, 0, | |
83 | sb -> sb_V_M - 1, 0, NULLSD, NULLSD, NULLSR, si)) == NOTOK) | |
84 | freesblk (sb); | |
85 | else { | |
86 | sb -> sb_V_A = sb -> sb_V_R = sb -> sb_V_M; | |
87 | if (sb -> sb_requirements & SR_ACTIVITY) | |
88 | if (sb -> sb_flags & SB_Vnextact) | |
89 | sb -> sb_flags |= SB_Vact; | |
90 | else | |
91 | sb -> sb_flags &= ~SB_Vact; | |
92 | ||
93 | sb -> sb_flags &= ~(SB_MAA | SB_AE); | |
94 | } | |
95 | ||
96 | return result; | |
97 | } |