|
|
1.1 root 1: /* actions5.c - VTPM: FSM sector 5 actions */
2:
3: #ifndef lint
4: static char *rcsid = "$Header: /f/osi/vt/RCS/actions5.c,v 7.0 89/11/23 22:31:27 mrose Rel $";
5: #endif
6:
7: /*
8: * $Header: /f/osi/vt/RCS/actions5.c,v 7.0 89/11/23 22:31:27 mrose Rel $
9: *
10: *
11: * $Log: actions5.c,v $
12: * Revision 7.0 89/11/23 22:31:27 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: #include "vtpm.h"
29: #include "sector1.h"
30:
31: /************************************************************************/
32: /* This file contains the functions that are executed when the */
33: /* VT Protocol machine is in a Sector 5 state and a protocol */
34: /* event occurs. The state transition matrix is specified in */
35: /* Table 32 of ISO 9041 (July 1987 version). The actions which */
36: /* this collection of functions perform are specified in Table 40 */
37: /* of ISO 9041. */
38: /************************************************************************/
39:
40: extern int sd; /*Global Session Descriptor (ISODE) */
41:
42: /* xx1x xxxx = awaiting ack from peer i.e., 420 */
43: /* xxxx xx1x = awaiting ack from user */
44:
45: /* T = got token, N = no got token */
46:
47:
48: /*
49: req: usr==>vtpm
50: ind: vtpm==>usr
51: */
52: int
53: ce_104(pe) /* common event 104 */
54: PE pe;
55: {
56: /* if (vnt > 0) */
57: if(pe != NULLPE) vdatind(SEQUENCED,pe);
58: vnt = 0;
59: return(OK);
60: }
61:
62: int
63: ce_105() /* common event 105 */
64: {
65: /* if (vns > 0) for(... */
66: if(p_ondq != NULLPE)
67: (void)p_data(p_ondq); /* send NDQ */
68: vns = 0;
69: return(OK);
70: }
71:
72:
73: /* ARGSUSED */
74: int
75: a5_0(pe) /*VDATreq-sqtr in states 400B or 402B */
76: /* V data request addressing sequenced trigger co */
77: PE pe;
78: {
79: return(ce_105());
80: /*
81: ==> SAMESTATE;
82: */
83: }
84:
85:
86: /* ARGSUSED */
87: int
88: a5_1(pe) /*VDATreq-n in states 400B, 402B or 40T */
89: /* V data request addressing sequenced trigger co */
90: PE pe;
91: {
92:
93: /*
94: vns++;
95: ==> SAMESTATE
96: */
97: return(ce_105()); /*Autonomous Event to Ship it*/
98: }
99:
100:
101: int
102: a5_2(pe) /*NDQ-tr in states 400B, 420B */
103: PE pe;
104: {
105: /*
106: vnt++;
107: */
108:
109: return(ce_104(pe));
110: /*
111: ==> SAMESTATE
112: */
113: }
114:
115:
116: int
117: a5_3(pe) /*NDQ-ntr in states 400B, 420B */
118: PE pe;
119: {
120: /*
121: vnt++;
122: */
123: /*
124: ==> SAMESTATE
125: */
126: return(ce_104(pe)); /*Autonomous Event to Deliver to User*/
127: }
128:
129: int
130: a5_5(pe) /* VBRKreq */
131: PE pe;
132: {
133: vtok = 0; /* giving the token away */
134: vnt = 0;
135: vns = 0;
136: /* vtkp was set in vbrkreq so it could be coded in to the pe */
137: (void)p_resync_req(pe,SYNC_RESTART); /* send break request */
138: state = S5_61;
139: return(OK);
140: }
141:
142: int
143: a5_6(pe) /* VBRKrsp in state 62 */
144: PE pe;
145: {
146: (void)p_resync_resp(pe); /* send out break response */
147: if (vsmd && vtok)
148: state = S5_40T;
149: else
150: if (vsmd)
151: state = S5_40N;
152: else {
153: vtkp = INITIATOR;
154: if (vtok)
155: vtkp = ACCEPTOR;
156: state = S5_400B;
157: }
158: return(OK);
159: }
160:
161: int
162: a5_9(pe) /*VDELreq in states 400B, 402B */
163: PE pe;
164: {
165: if (dcno) /* no delivery control */
166: {
167: advise(LLOG_DEBUG,NULLCP,"a5_9: dcno hasn't been set");
168: /* ==> SAMESTATE */
169: return(NOTOK);
170: }
171: (void)ce_105();
172: /* send out dlq */
173: /* this will be replace by the new-fangled pepy schtuff;
174: will use this now for compatability */
175:
176: (void)p_data(pe);
177: state = (vra) ? state + 2 : state; /* pretty neeto eh? */
178: return(OK);
179: }
180:
181: int
182: a5_11(pe) /*HDQ request in 400B*/
183: PE pe;
184: {
185: (void) p_typed_data(pe);
186: return(OK);
187: }
188:
189: /*ARGSUSED*/
190: int
191: a5_17(pe) /*VRELreq in states 400B */
192: PE pe;
193: {
194: /* ce_105(); */
195: sector = 1;
196: if(vtok)
197: {
198: state = S1_51Q; /*Must change state first because
199: vt_disconnect gets RLR & calls
200: state machine again. */
201: vt_disconnect(); /*May be only TEMP*/
202: }
203: else
204: {
205: request_token();
206: /*Need call to ISODE to request token*/
207: state = S1_50B;
208: }
209:
210: return(OK);
211: }
212:
213: int
214: a5_28(pe) /*UDQ request in 400B*/
215: PE pe;
216: {
217: (void) p_typed_data(pe);
218: return(OK);
219: }
220:
221: int
222: a5_31(pe) /* BKR in 61 */
223: PE pe;
224: {
225: if (vsmd && vtok) state = S5_40T;
226: else if (vsmd) state = S5_40N;
227: else state = S5_400B;
228: vbrkcnf(pe);
229: return(OK);
230: }
231:
232: int
233: a5_32(pe) /* BKQ could occur in any state except 62 */
234: PE pe;
235: {
236: vnt = 0;
237: vns = 0;
238: /*
239: vbrkind clears queues etc.
240: and then map the break character to user
241: and sets vtok to 1
242: (we should have received the token)
243: */
244: state = S5_62;
245: vbrkind(pe);
246: return(OK);
247: }
248:
249: int
250: a5_34(pe) /*UDQ in 400B*/
251: PE pe;
252: {
253: if(pe != NULLPE) vudatind(pe);
254: return(OK);
255: }
256:
257: int
258: a5_35(pe) /* DEL in states 400B, 420B */
259: PE pe;
260: {
261:
262: if ((vra = prim2flag(pe)) == NOTOK)
263: adios("a5_35: bogus PDU (%s)", pe_error (pe -> pe_errno));
264: (void)ce_104(NULLPE);
265: vdelind(pe,vra);
266: state = (vra) ? state + 2 : state;
267: return(OK);
268: }
269:
270:
271: int
272: a5_38(pe) /* RLQ in states 400B */
273: PE pe;
274: {
275:
276: (void)ce_104(pe);
277: sector = 1;
278: state = S1_51R;
279: (void)vrelind();
280: return(OK);
281: }
282:
283: int
284: a5_106(pe)
285: PE pe;
286: {
287: if(pe != NULLPE) vhdatind(pe);
288: return(OK);
289: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.