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