|
|
1.1 root 1: /*
2: * Copyright (c) 1988 Regents of the University of California.
3: * All rights reserved.
4: *
5: * Redistribution and use in source and binary forms are permitted
6: * provided that the above copyright notice and this paragraph are
7: * duplicated in all such forms and that any documentation,
8: * advertising materials, and other materials related to such
9: * distribution and use acknowledge that the software was developed
10: * by the University of California, Berkeley. The name of the
11: * University may not be used to endorse or promote products derived
12: * from this software without specific prior written permission.
13: * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
14: * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
15: * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
16: *
17: * @(#)api_exch.h 4.1 (Berkeley) 12/4/88
18: */
19:
20: /*
21: * This file describes the structures passed back and forth
22: * between the API client and API server on a Unix-based
23: * tn3270 implementation.
24: */
25:
26: /*
27: * The following are the low-level opcodes exchanged between the
28: * two sides. These are designed to allow for type, sequence number,
29: * and direction checking.
30: *
31: * We enforce conversation flow. There are three states: CONTENTION,
32: * SEND, and RECEIVE. Both sides start in CONTENTION.
33: * We never leave RECEIVE state without first reading a TURNAROUND
34: * opcode. We never leave SEND state without first writing a TURNAROUND
35: * opcode. This scheme ensures that we always have conversation flowing
36: * in a synchronized direction (or detect an application error), and that
37: * we never hang with both sides trying to read from the "wire".
38: *
39: * State event action
40: *
41: * CONTENTION read request send TURNAROUND
42: * read RTS
43: * enter RECEIVE
44: * CONTENTION write request send RTS
45: * read TURNAROUND
46: * enter SEND
47: *
48: * RECEIVE read request read whatever
49: * RECEIVE write request read TURNAROUND
50: *
51: * SEND read request send TURNAROUND
52: * SEND write write whatever
53: */
54:
55: #define EXCH_EXCH_COMMAND 0 /* The following is a command */
56: #define EXCH_EXCH_TURNAROUND 1 /* Your turn to send */
57: #define EXCH_EXCH_RTS 2 /* Request to send */
58: #define EXCH_EXCH_TYPE 3 /* The following is a type */
59:
60: struct exch_exch {
61: char
62: opcode; /* COMMAND, TURNAROUND, or TYPE */
63: unsigned char
64: my_sequence, /* 0-ff, initially zero */
65: your_sequence, /* 0-ff, initially zero */
66: command_or_type; /* Application level command or type */
67: unsigned short
68: length; /* The length of any following data */
69: };
70:
71: /*
72: * The following are the command codes which the higher level protocols
73: * send and receive.
74: */
75:
76: #define EXCH_CMD_ASSOCIATE 0 /* Connect [client->server] */
77: /*
78: * struct storage_desc
79: * char key[]
80: */
81: #define EXCH_CMD_DISASSOCIATE 1 /* Disconnect [client->server] */
82: #define EXCH_CMD_SEND_AUTH 2 /* Send password [server->client] */
83: /*
84: * struct storage_desc
85: * char prompt[]
86: * struct storage_desc
87: * char seed[]
88: */
89: #define EXCH_CMD_AUTH 3 /* Authorization [client->server] */
90: /*
91: * struct storage_desc
92: * char authenticator[]
93: */
94: #define EXCH_CMD_ASSOCIATED 4 /* Connected [server->client] */
95: #define EXCH_CMD_REJECTED 5 /* Too bad [server->client] */
96: /*
97: * struct storage_desc
98: * char message[]
99: */
100:
101: #define EXCH_CMD_REQUEST 6 /* A request [client->server] */
102: /* struct regs,
103: * struct sregs,
104: * struct storage_desc
105: * char bytes[]
106: */
107: #define EXCH_CMD_GIMME 7 /* Send storage [server->client] */
108: /*
109: * struct storage_desc
110: */
111: #define EXCH_CMD_HEREIS 8 /* Here is storage [BOTH WAYS] */
112: /*
113: * struct storage_desc
114: * char bytes[]
115: */
116: #define EXCH_CMD_REPLY 9 /* End of discussion */
117: /*
118: * struct regs,
119: * struct sregs,
120: */
121:
122: /*
123: * The following are typed parameters sent across the wire.
124: *
125: * This should be done much more generally, with some form of
126: * XDR or mapped conversation ability.
127: */
128:
129: #define EXCH_TYPE_REGS 0
130: #define EXCH_TYPE_SREGS 1
131: #define EXCH_TYPE_STORE_DESC 2
132: #define EXCH_TYPE_BYTES 3
133:
134: /*
135: * each parameter that comes over looks like:
136: *
137: * char type of following
138: * short (2 bytes) length of following (network byte order)
139: * following
140: */
141:
142: struct storage_descriptor {
143: long location; /* In network byte order */
144: short length; /* In network byte order */
145: };
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.