xref: /csrg-svn/usr.bin/tn3270/ctlr/api.h (revision 31183)
1 /*
2  * This file contains header information used by the PC API routines.
3  */
4 
5 #if	!defined(MSDOS)
6 #define far			/* For 'far *' checks */
7 #endif	/* !defined(MSDOS) */
8 
9 #define	API_INTERRUPT_NUMBER	0x7A		/* API Interrupt Number */
10 
11 /*
12  * Define the gate numbers.  These are returned via the Name Resolution
13  * service.
14  */
15 
16 #define	GATE_SESSMGR	1
17 #define	GATE_KEYBOARD	2
18 #define	GATE_COPY	3
19 #define	GATE_OIAM	4
20 
21 /*
22  * The names which correspond to the above gate numbers.
23  */
24 
25 #define	NAME_SESSMGR	"SESSMGR "
26 #define	NAME_KEYBOARD	"KEYBOARD"
27 #define	NAME_COPY	"COPY    "
28 #define	NAME_OIAM	"OIAM    "
29 
30 
31 /*
32  * Name Resolution is specified in AH.
33  */
34 
35 #define	NAME_RESOLUTION	0x81
36 
37 /*
38  * Codes specified in AL for various services.
39  */
40 
41 #define	QUERY_SESSION_ID		0x01
42 #define	QUERY_SESSION_PARMS		0x02
43 #define	QUERY_SESSION_CURSOR		0x0b
44 
45 #define	CONNECT_TO_KEYBOARD		0x01
46 #define	DISCONNECT_FROM_KEYBOARD	0x02
47 #define	WRITE_KEYSTROKE			0x04
48 #define	DISABLE_INPUT			0x05
49 #define	ENABLE_INPUT			0x06
50 
51 #define	COPY_STRING			0x01
52 
53 #define	READ_OIA_GROUP			0x02
54 
55 /*
56  * For each service, we define the assoicated parameter blocks.
57  */
58 
59 /*
60  * Supervisor Services
61  */
62 
63 typedef struct {
64     char	gate_name[8];
65 } NameResolveParms;
66 
67 
68 /*
69  * Session Information Services
70  */
71 
72 typedef struct {
73     char
74 	short_name,
75 	type,
76 	session_id,
77 	reserved,
78 	long_name[8];
79 } NameArrayElement;
80 
81 typedef struct {
82     char
83 	length,
84 	number_matching_session;
85     NameArrayElement
86 	name_array_element;		/* Variable number */
87 } NameArray;
88 
89 typedef struct {
90     char
91 	rc,
92 	function_id,
93 	option_code,
94 	data_code;
95     NameArray far
96 	*name_array;
97     char
98 	long_name[8];
99 } QuerySessionIdParms;
100 
101 typedef struct {
102     char
103 	rc,
104 	function_id,
105 	session_id,
106 	reserved,
107 	session_type,
108 	session_characteristics,
109 	rows,
110 	columns;
111     char far
112 	*presentation_space;
113 } QuerySessionParametersParms;
114 
115 #define	TYPE_WSCTL		0x01		/* Work Station Control */
116 #define	TYPE_DFT		0x02		/* DFT Host Session */
117 #define	TYPE_CUT		0x03		/* CUT Host Session */
118 #define	TYPE_NOTEPAD		0x04		/* Notepad Session */
119 #define	TYPE_PC			0x05		/* Personal Computer Session */
120 
121 #define	CHARACTERISTIC_EAB	0x80		/* Extended Attribute Buffer */
122 #define	CHARACTERISTIC_PSS	0x40		/* Program Symbols Supported */
123 
124 typedef struct {
125     char
126 	rc,
127 	function_id,
128 	session_id,
129 	cursor_type,
130 	row_address,				/* from 0 */
131 	column_address;				/* from 0 */
132 } QuerySessionCursorParms;
133 
134 #define	CURSOR_INHIBITED_AUTOSCROLL	0x10
135 #define	CURSOR_INHIBITED		0x04
136 #define	CURSOR_BLINKING			0x02
137 #define	CURSOR_BOX			0x01
138 typedef struct {
139     char
140 	rc,
141 	function_id,
142 	session_id,
143 	reserved;
144     int
145 	event_queue_id,
146 	input_queue_id;
147     char
148 	intercept_options,
149 	first_connection_identifier;
150 } ConnectToKeyboardParms;
151 
152 typedef struct {
153     char
154 	rc,
155 	function_id,
156 	session_id,
157 	reserved;
158     int
159 	connectors_task_id;
160 } DisconnectFromKeyboardParms;
161 
162 typedef struct {
163     char
164 	scancode,
165 	shift_state;
166 } KeystrokeEntry;
167 
168 typedef struct {
169     int
170 	length;			/* Length (in bytes) of list */
171     KeystrokeEntry keystrokes;	/* Variable size */
172 } KeystrokeList;
173 
174 typedef struct {
175     char
176 	rc,
177 	function_id,
178 	session_id,
179 	reserved;
180     int
181 	connectors_task_id;
182     char
183 	options,
184 	number_of_keys_sent;
185     union {
186 	KeystrokeEntry
187 	    keystroke_entry;
188 	KeystrokeList far
189 	    *keystroke_list;
190     } keystroke_specifier;
191 } WriteKeystrokeParms;
192 
193 typedef struct {
194     char
195 	rc,
196 	function_id,
197 	session_id,
198 	reserved;
199     int
200 	connectors_task_id;
201 } DisableInputParms;
202 
203 typedef DisableInputParms EnableInputParms;
204 
205 typedef struct {
206     char
207 	session_id,
208 	reserved;
209     char far
210 	*buffer;
211     char
212 	characteristics,
213 	session_type;
214     int
215 	begin;			/* Offset within buffer */
216 } BufferDescriptor;
217 
218 typedef struct {
219     char
220 	rc,
221 	function_id;
222     BufferDescriptor
223 	source;
224     int
225 	source_end;		/* Offset within source buffer */
226     BufferDescriptor
227 	target;
228     char
229 	copy_mode,
230 	reserved;
231 } CopyStringParms;
232 
233 #define	COPY_MODE_7_COLOR		0x80	/* Else 4 color mode */
234 #define	COPY_MODE_FIELD_ATTRIBUTES	0x40	/* Else don't copy attributes */
235 
236 typedef struct {
237     char
238 	rc,
239 	function_id,
240 	session_id,
241 	reserved;
242     char far
243 	*oia_buffer;
244     char
245 	oia_group_number;
246 } ReadOiaGroupParms;
247 
248 #define	OIA_ALL_GROUPS				0xFF
249 #define	OIA_ONLINE_OWNERSHIP			0x01
250 #	define	OIA_SETUP		0x80
251 #	define	OIA_TEST		0x40
252 #	define	OIA_SSCP_LU		0x20
253 #	define	OIA_LU_LU		0x10
254 #	define	OIA_UNOWNED		0x08
255 #	define	OIA_SUBSYSTEM_READY	0x04
256 
257 #define	OIA_CHARACTER_SELECTION			0x02
258 #	define	OIA_EXTENDED_SELECT	0x80
259 #	define	OIA_APL			0x40
260 #	define	OIA_KANA		0x20
261 #	define	OIA_ALPHA		0x10
262 #	define	OIA_TEXT		0x08
263 
264 #define	OIA_SHIFT_STATE				0x03
265 #	define	OIA_NUMERIC		0x80
266 #	define	OIA_UPPER_SHIFT		0x40
267 
268 #define	OIA_PSS_GROUP_1				0x04
269 #define	OIA_HIGHLIGHT_GROUP_1			0x05
270 #define	OIA_COLOR_GROUP_1			0x06
271 #	define	OIA_SELECTABLE		0x80
272 #	define	OIA_FIELD_INHERIT	0x40
273 
274 #define	OIA_INSERT				0x07
275 #	define	OIA_INSERT_MODE		0x80
276 
277 /* We define this to be a 'long' followed by a 'char' (5 bytes) */
278 
279 #define	OIA_INPUT_INHIBITED			0x08
280 
281 #	define	OIA_NON_RESETTABLE	0x80000000
282 #	define	OIA_SECURITY_KEY	0x40000000
283 #	define	OIA_MACHINE_CHECK	0x20000000
284 #	define	OIA_COMM_CHECK		0x10000000
285 #	define	OIA_PROGRAM_CHECK	0x08000000
286 #	define	OIA_RETRY		0x04000000
287 #	define	OIA_DEVICE_NOT_WORKING	0x02000000
288 #	define	OIA_DEVICE_VERY_BUSY	0x01000000
289 
290 #	define	OIA_DEVICE_BUSY		0x00800000
291 #	define	OIA_TERMINAL_WAIT	0x00400000
292 #	define	OIA_MINUS_SYMBOL	0x00200000
293 #	define	OIA_MINUS_FUNCTION	0x00100000
294 #	define	OIA_TOO_MUCH_ENTERED	0x00080000
295 #	define	OIA_NOT_ENOUGH_ENTERED	0x00040000
296 #	define	OIA_WRONG_NUMBER	0x00020000
297 #	define	OIA_NUMERIC_FIELD	0x00010000
298 
299 #	define	OIA_OP_UNAUTHORIZED	0x00008000
300 #	define	OIA_OP_UNAUTHORIZED_MIN	0x00004000
301 #	define	OIA_INVALID_DEAD_KEY_COMBO 0x00002000
302 #	define	OIA_WRONG_PLACE		0x00001000
303 
304 #	define	OIA_MESSAGE_PENDING	0x00000080
305 #	define	OIA_PARTITION_WAIT	0x00000040
306 #	define	OIA_SYSTEM_WAIT		0x00000020
307 #	define	OIA_HARDWARE_MISMATCH	0x00000010
308 #	define	OIA_LOGICAL_TERM_NOT_CONF 0x00000008
309 
310 
311 #	define	OIA_AUTOKEY_INHIBIT	0x80
312 #	define	OIA_API_INHIBIT		0x40
313 
314 #define	OIA_PSS_GROUP_2				0x09
315 #	define	OIA_PS_SELECTED		0x80
316 #	define	OIA_PC_DISPLAY_DISABLE	0x40
317 
318 #define	OIA_HIGHLIGHT_GROUP_2			0x0a
319 #define	OIA_COLOR_GROUP_2			0x0b
320 #	define	OIA_SELECTED		0x80
321 
322 #define	OIA_COMM_ERROR_REMINDER		0x0c
323 #	define	OIA_COMM_ERROR		0x80
324 #	define	OIA_RTM			0x40
325 
326 #define	OIA_PRINTER_STATUS			0x0d
327 #	define	OIA_PRINT_NOT_CUSTOM	0x80
328 #	define	OIA_PRINTER_MALFUNCTION	0x40
329 #	define	OIA_PRINTER_PRINTING	0x20
330 #	define	OIA_ASSIGN_PRINTER	0x10
331 #	define	OIA_WHAT_PRINTER	0x08
332 #	define	OIA_PRINTER_ASSIGNMENT	0x04
333 
334 #define	OIA_AUTOKEY_PLAY_RECORD_STATUS		0x10
335 #	define	OIA_PLAY		0x80
336 #	define	OIA_RECORD		0x40
337 
338 #define	OIA_AUTOKEY_ABORT_PAUSE_STATUS		0x11
339 #	define	OIA_RECORDING_OVERFLOW	0x80
340 #	define	OIA_PAUSE		0x40
341 
342 #define	OIA_ENLARGE_STATE			0x12
343 #	define	OIA_WINDOW_IS_ENLARGED	0x80
344 
345 
346 
347 #if	defined(MSDOS)
348 
349 #if	!defined(FP_SEG)
350 #include <dos.h>
351 #endif	/* !defined(FP_SEG) */
352 
353 #else	/* defined(MSDOS) */
354 
355 /*
356  * These definitions are here to provide the descriptions of
357  * some registers which are, normally, defined in <dos.h> on
358  * a dos system.
359  */
360 
361 
362 struct highlow {
363     char
364 	ah,
365 	al,
366 	bh,
367 	bl,
368 	ch,
369 	cl,
370 	dh,
371 	dl;
372 };
373 
374 struct words {
375     int
376 	ax,
377 	bx,
378 	cx,
379 	dx,
380 	si,
381 	di;
382 };
383 
384 union REGS {
385     struct highlow h;
386     struct words x;
387 };
388 
389 struct SREGS {
390     int
391 	cs,
392 	ds,
393 	es,
394 	ss;
395 };
396 #endif	/* defined(MSDOS) (else section) */
397