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