|
|
1.1 root 1: /* psaptoken.c - PPM: tokens */
2:
3: #ifndef lint
4: static char *rcsid = "$Header: /f/osi/psap2/RCS/psaptoken.c,v 7.0 89/11/23 22:14:36 mrose Rel $";
5: #endif
6:
7: /*
8: * $Header: /f/osi/psap2/RCS/psaptoken.c,v 7.0 89/11/23 22:14:36 mrose Rel $
9: *
10: *
11: * $Log: psaptoken.c,v $
12: * Revision 7.0 89/11/23 22:14:36 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-TOKEN-GIVE.REQUEST */
35:
36: int PGTokenRequest (sd, tokens, pi)
37: int sd;
38: int tokens;
39: struct PSAPindication *pi;
40: {
41: SBV smask;
42: int result;
43: register struct psapblk *pb;
44: struct SSAPindication sis;
45: register struct SSAPabort *sa = &sis.si_abort;
46:
47: missingP (pi);
48:
49: smask = sigioblock ();
50:
51: psapPsig (pb, sd);
52:
53: if ((result = SGTokenRequest (sd, tokens, &sis)) == NOTOK)
54: if (SC_FATAL (sa -> sa_reason))
55: (void) ss2pslose (pb, pi, "SGTokenRequest", sa);
56: else {
57: (void) ss2pslose (NULLPB, pi, "SGTokenRequest", sa);
58: goto out1;
59: }
60: else
61: pb -> pb_owned &= ~tokens;
62:
63: if (result == NOTOK)
64: freepblk (pb);
65: out1: ;
66: (void) sigiomask (smask);
67:
68: return result;
69: }
70:
71: /* P-TOKEN-PLEASE.REQUEST */
72:
73: int PPTokenRequest (sd, tokens, data, ndata, pi)
74: int sd;
75: int tokens,
76: ndata;
77: PE *data;
78: struct PSAPindication *pi;
79: {
80: SBV smask;
81: int len,
82: result;
83: char *base,
84: *realbase;
85: register struct psapblk *pb;
86: struct SSAPindication sis;
87: register struct SSAPabort *sa = &sis.si_abort;
88:
89: toomuchP (data, ndata, NPDATA, "token");
90: missingP (pi);
91:
92: smask = sigioblock ();
93:
94: psapPsig (pb, sd);
95:
96: if ((result = info2ssdu (pb, pi, data, ndata, &realbase, &base, &len,
97: "P-TOKEN-PLEASE user-data", PPDU_NONE)) != OK)
98: goto out2;
99:
100: if ((result = SPTokenRequest (sd, tokens, base, len, &sis)) == NOTOK)
101: if (SC_FATAL (sa -> sa_reason))
102: (void) ss2pslose (pb, pi, "SPTokenRequest", sa);
103: else {
104: (void) ss2pslose (NULLPB, pi, "SPTokenRequest", sa);
105: goto out1;
106: }
107:
108: out2: ;
109: if (result == NOTOK)
110: freepblk (pb);
111: else
112: if (result == DONE)
113: result = NOTOK;
114: out1: ;
115: if (realbase)
116: free (realbase);
117: else
118: if (base)
119: free (base);
120:
121: (void) sigiomask (smask);
122:
123: return result;
124: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.