Commit | Line | Data |
---|---|---|
a0be6343 WJ |
1 | /* ssapminor2.c - SPM: respond to minorsyncs */ |
2 | ||
3 | #ifndef lint | |
4 | static char *rcsid = "$Header: /f/osi/ssap/RCS/ssapminor2.c,v 7.1 91/02/22 09:45:55 mrose Interim $"; | |
5 | #endif | |
6 | ||
7 | /* | |
8 | * $Header: /f/osi/ssap/RCS/ssapminor2.c,v 7.1 91/02/22 09:45:55 mrose Interim $ | |
9 | * | |
10 | * | |
11 | * $Log: ssapminor2.c,v $ | |
12 | * Revision 7.1 91/02/22 09:45:55 mrose | |
13 | * Interim 6.8 | |
14 | * | |
15 | * Revision 7.0 89/11/23 22:25:33 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-MINOR-SYNC.RESPONSE */ | |
38 | ||
39 | int SMinSyncResponse (sd, ssn, data, cc, si) | |
40 | int sd; | |
41 | long ssn; | |
42 | char *data; | |
43 | int cc; | |
44 | struct SSAPindication *si; | |
45 | { | |
46 | SBV smask; | |
47 | int result; | |
48 | register struct ssapblk *sb; | |
49 | ||
50 | if (SERIAL_MIN > ssn || ssn > SERIAL_MAX) | |
51 | return ssaplose (si, SC_PARAMETER, NULLCP, "invalid serial number"); | |
52 | missingP (si); | |
53 | ||
54 | smask = sigioblock (); | |
55 | ||
56 | ssapPsig (sb, sd); | |
57 | toomuchP (sb, data, cc, SN_SIZE, "minorsync"); | |
58 | ||
59 | result = SMinSyncResponseAux (sb, ssn, data, cc, si); | |
60 | ||
61 | (void) sigiomask (smask); | |
62 | ||
63 | return result; | |
64 | } | |
65 | ||
66 | /* \f */ | |
67 | ||
68 | static int SMinSyncResponseAux (sb, ssn, data, cc, si) | |
69 | register struct ssapblk *sb; | |
70 | long ssn; | |
71 | char *data; | |
72 | int cc; | |
73 | register struct SSAPindication *si; | |
74 | { | |
75 | int result; | |
76 | ||
77 | if (!(sb -> sb_requirements & SR_MINORSYNC)) | |
78 | return ssaplose (si, SC_OPERATION, NULLCP, | |
79 | "minor synchronize service unavailable"); | |
80 | if (!(sb -> sb_flags & SB_Vsc)) | |
81 | return ssaplose (si, SC_OPERATION, NULLCP, | |
82 | "no minorsync in progress"); | |
83 | if (ssn < sb -> sb_V_A) | |
84 | return ssaplose (si, SC_OPERATION, NULLCP, | |
85 | "bad choice for minor ssn, should be >= %ld", sb -> sb_V_A); | |
86 | ||
87 | if ((result = SWriteRequestAux (sb, SPDU_MIA, data, cc, 0, ssn, 0, NULLSD, | |
88 | NULLSD, NULLSR, si)) == NOTOK) | |
89 | freesblk (sb); | |
90 | else | |
91 | sb -> sb_V_A = ssn + 1; | |
92 | ||
93 | return result; | |
94 | } |