xref: /original-bsd/usr.bin/tn3270/ctlr/api.h (revision 1a56dd2c)
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 this notice is preserved and that due credit is given
7  * to the University of California at Berkeley. The name of the University
8  * may not be used to endorse or promote products derived from this
9  * software without specific prior written permission. This software
10  * is provided ``as is'' without express or implied warranty.
11  *
12  *	@(#)api.h	3.3 (Berkeley) 03/28/88
13  */
14 
15 /*
16  * This file contains header information used by the PC API routines.
17  */
18 
19 #if	!defined(MSDOS)
20 #define far			/* For 'far *' checks */
21 #endif	/* !defined(MSDOS) */
22 
23 #define	API_INTERRUPT_NUMBER	0x7A		/* API Interrupt Number */
24 
25 /*
26  * Define the gate numbers.  These are returned via the Name Resolution
27  * service.
28  */
29 
30 #define	GATE_SESSMGR	1234
31 #define	GATE_KEYBOARD	5678
32 #define	GATE_COPY	9101
33 #define	GATE_OIAM	1121
34 
35 /*
36  * The names which correspond to the above gate numbers.
37  */
38 
39 #define	NAME_SESSMGR	"SESSMGR "
40 #define	NAME_KEYBOARD	"KEYBOARD"
41 #define	NAME_COPY	"COPY    "
42 #define	NAME_OIAM	"OIAM    "
43 
44 
45 /*
46  * Name Resolution is specified in AH.
47  */
48 
49 #define	NAME_RESOLUTION		0x81
50 
51 #if	defined(unix)
52 /*
53  * In unix, we offer a service to allow the application to keep from
54  * having to poll us constantly.
55  */
56 #define	PS_OR_OIA_MODIFIED	0x99
57 
58 #endif	/* defined(unix) */
59 
60 /*
61  * Codes specified in AL for various services.
62  */
63 
64 #define	QUERY_SESSION_ID		0x01
65 #define	QUERY_SESSION_PARAMETERS	0x02
66 #define	QUERY_SESSION_CURSOR		0x0b
67 
68 #define	CONNECT_TO_KEYBOARD		0x01
69 #define	DISCONNECT_FROM_KEYBOARD	0x02
70 #define	WRITE_KEYSTROKE			0x04
71 #define	DISABLE_INPUT			0x05
72 #define	ENABLE_INPUT			0x06
73 
74 #define	COPY_STRING			0x01
75 
76 #define	READ_OIA_GROUP			0x02
77 
78 /*
79  * For each service, we define the assoicated parameter blocks.
80  */
81 
82 /*
83  * Supervisor Services
84  */
85 
86 typedef struct {
87     char	gate_name[8];
88 } NameResolveParms;
89 
90 
91 /*
92  * Session Information Services
93  */
94 
95 typedef struct {
96     char
97 	short_name,
98 	type,
99 	session_id,
100 	reserved,
101 	long_name[8];
102 } NameArrayElement;
103 
104 typedef struct {
105     unsigned char
106 	length,
107 	number_matching_session;
108     NameArrayElement
109 	name_array_element;		/* Variable number */
110 } NameArray;
111 
112 typedef struct {
113     char
114 	rc,
115 	function_id,
116 	option_code,
117 	data_code;
118     NameArray far
119 	*name_array;
120     char
121 	long_name[8];
122 } QuerySessionIdParms;
123 
124 #define	ID_OPTION_BY_NAME	0x01		/* By short (or long) name */
125 #define	ID_OPTION_ALL		0x00		/* All (of specified type */
126 
127 typedef struct {
128     char
129 	rc,
130 	function_id,
131 	session_id,
132 	reserved,
133 	session_type,
134 	session_characteristics,
135 	rows,
136 	columns;
137     char far
138 	*presentation_space;
139 } QuerySessionParametersParms;
140 
141 #define	TYPE_WSCTL		0x01		/* Work Station Control */
142 #define	TYPE_DFT		0x02		/* DFT Host Session */
143 #define	TYPE_CUT		0x03		/* CUT Host Session */
144 #define	TYPE_NOTEPAD		0x04		/* Notepad Session */
145 #define	TYPE_PC			0x05		/* Personal Computer Session */
146 
147 #define	CHARACTERISTIC_EAB	0x80		/* Extended Attribute Buffer */
148 #define	CHARACTERISTIC_PSS	0x40		/* Program Symbols Supported */
149 
150 typedef struct {
151     char
152 	rc,
153 	function_id,
154 	session_id,
155 	cursor_type,
156 	row_address,				/* from 0 */
157 	column_address;				/* from 0 */
158 } QuerySessionCursorParms;
159 
160 #define	CURSOR_INHIBITED_AUTOSCROLL	0x10
161 #define	CURSOR_INHIBITED		0x04
162 #define	CURSOR_BLINKING			0x02
163 #define	CURSOR_BOX			0x01
164 typedef struct {
165     char
166 	rc,
167 	function_id,
168 	session_id,
169 	reserved;
170     int
171 	event_queue_id,
172 	input_queue_id;
173     char
174 	intercept_options,
175 	first_connection_identifier;
176 } ConnectToKeyboardParms;
177 
178 typedef struct {
179     char
180 	rc,
181 	function_id,
182 	session_id,
183 	reserved;
184     int
185 	connectors_task_id;
186 } DisconnectFromKeyboardParms;
187 
188 typedef struct {
189     char
190 	scancode,
191 	shift_state;
192 } KeystrokeEntry;
193 
194 typedef struct {
195     int
196 	length;			/* Length (in bytes) of list */
197     KeystrokeEntry keystrokes;	/* Variable size */
198 } KeystrokeList;
199 
200 typedef struct {
201     char
202 	rc,
203 	function_id,
204 	session_id,
205 	reserved;
206     int
207 	connectors_task_id;
208     char
209 	options,
210 	number_of_keys_sent;
211     union {
212 	KeystrokeEntry
213 	    keystroke_entry;
214 	KeystrokeList far
215 	    *keystroke_list;
216     } keystroke_specifier;
217 } WriteKeystrokeParms;
218 
219 #define	OPTION_SINGLE_KEYSTROKE		0x20
220 #define	OPTION_MULTIPLE_KEYSTROKES	0x30
221 
222 typedef struct {
223     char
224 	rc,
225 	function_id,
226 	session_id,
227 	reserved;
228     int
229 	connectors_task_id;
230 } DisableInputParms;
231 
232 typedef DisableInputParms EnableInputParms;
233 
234 typedef struct {
235     char
236 	session_id,
237 	reserved;
238     char far
239 	*buffer;
240     char
241 	characteristics,
242 	session_type;
243     int
244 	begin;			/* Offset within buffer */
245 } BufferDescriptor;
246 
247 typedef struct {
248     char
249 	rc,
250 	function_id;
251     BufferDescriptor
252 	source;
253     int
254 	source_end;		/* Offset within source buffer */
255     BufferDescriptor
256 	target;
257     char
258 	copy_mode,
259 	reserved;
260 } CopyStringParms;
261 
262 #define	COPY_MODE_7_COLOR		0x80	/* Else 4 color mode */
263 #define	COPY_MODE_FIELD_ATTRIBUTES	0x40	/* Else don't copy attributes */
264 
265 typedef struct {
266     char
267 	rc,
268 	function_id,
269 	session_id,
270 	reserved;
271     char far
272 	*oia_buffer;
273     char
274 	oia_group_number;
275 } ReadOiaGroupParms;
276 
277 /* If the user wants all groups, we return API_OIA_BYTES_ALL_GROUPS bytes */
278 #define	API_OIA_ALL_GROUPS		'\377'
279 #define	API_OIA_BYTES_ALL_GROUPS	22	/* 22 bytes of data */
280 
281 /* API_OIA_INPUT_INHIBITED is special.  It returns more than on byte of data */
282 #define	API_OIA_INPUT_INHIBITED		8
283 
284 #define	API_OIA_LAST_LEGAL_GROUP	18	/* Highest legal number */
285 
286 
287 
288 #if	defined(MSDOS)
289 
290 #if	!defined(FP_SEG)
291 #include <dos.h>
292 #endif	/* !defined(FP_SEG) */
293 
294 #else	/* defined(MSDOS) */
295 
296 /*
297  * These definitions are here to provide the descriptions of
298  * some registers which are, normally, defined in <dos.h> on
299  * a dos system.
300  */
301 
302 #define	FP_SEG(x)	(x)
303 #define	FP_OFF(y)	(y)
304 
305 /*
306  * Now, it is somewhat of a pain, but we need to keep
307  * 8086 conventions about which of the "highlow"'s map
308  * into which of the "words".
309  */
310 
311 struct highlow {
312     unsigned char
313 #if	defined(vax)
314 	al,
315 	ah,
316 	bl,
317 	bh,
318 	cl,
319 	ch,
320 	dl,
321 	dh;
322 #endif	/* defined(vax) */
323 #if	defined(sun) || defined(tahoe) || defined(ibm032) || defined(pyr)
324 	ah,
325 	al,
326 	bh,
327 	bl,
328 	ch,
329 	cl,
330 	dh,
331 	dl;
332 #endif	/* defined(sun) || defined(tahoe) || defined(ibm032) */
333 };
334 
335 struct words {
336     unsigned short
337 	ax,
338 	bx,
339 	cx,
340 	dx;
341     unsigned int
342 	si,
343 	di;
344 };
345 
346 union REGS {
347     struct highlow h;
348     struct words x;
349 };
350 
351 struct SREGS {
352     unsigned int
353 	cs,
354 	ds,
355 	es,
356 	ss;
357 };
358 #endif	/* defined(MSDOS) (else section) */
359