"SfR Fresh" - the SfR Freeware/Shareware Archive 
Member "tn3270-5.2.0-glibc/tn3270/ctlr/api.h" of archive tn3270-5.2.0-glibc.tgz:
As a special service "SfR Fresh" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting with prefixed line numbers.
Alternatively you can here view or download the uninterpreted source code file.
That can be also achieved for any archive member file by clicking within an archive contents listing on the first character of the file(path) respectively on the according byte size field.
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.h 4.2 (Berkeley) 2/6/89
18 */
19
20 /*
21 * This file contains header information used by the PC API routines.
22 */
23
24 #if !defined(MSDOS)
25 #define far /* For 'far *' checks */
26 #endif /* !defined(MSDOS) */
27
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
35 #define GATE_SESSMGR 1234
36 #define GATE_KEYBOARD 5678
37 #define GATE_COPY 9101
38 #define GATE_OIAM 1121
39
40 /*
41 * The names which correspond to the above gate numbers.
42 */
43
44 #define NAME_SESSMGR "SESSMGR "
45 #define NAME_KEYBOARD "KEYBOARD"
46 #define NAME_COPY "COPY "
47 #define NAME_OIAM "OIAM "
48
49
50 /*
51 * Name Resolution is specified in AH.
52 */
53
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) */
64
65 /*
66 * Codes specified in AL for various services.
67 */
68
69 #define QUERY_SESSION_ID 0x01
70 #define QUERY_SESSION_PARAMETERS 0x02
71 #define QUERY_SESSION_CURSOR 0x0b
72
73 #define CONNECT_TO_KEYBOARD 0x01
74 #define DISCONNECT_FROM_KEYBOARD 0x02
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
83 /*
84 * For each service, we define the assoicated parameter blocks.
85 */
86
87 /*
88 * Supervisor Services
89 */
90
91 typedef struct {
92 char gate_name[8];
93 } NameResolveParms;
94
95
96 /*
97 * Session Information Services
98 */
99
100 typedef struct {
101 char
102 short_name,
103 type,
104 session_id,
105 reserved,
106 long_name[8];
107 } NameArrayElement;
108
109 typedef struct {
110 unsigned char
111 length,
112 number_matching_session;
113 NameArrayElement
114 name_array_element; /* Variable number */
115 } NameArray;
116
117 typedef 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
129 #define ID_OPTION_BY_NAME 0x01 /* By short (or long) name */
130 #define ID_OPTION_ALL 0x00 /* All (of specified type */
131
132 typedef 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;
144 } QuerySessionParametersParms;
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
155 typedef 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
169 typedef struct {
170 char
171 rc,
172 function_id,
173 session_id,
174 reserved;
175 short
176 event_queue_id,
177 input_queue_id;
178 char
179 intercept_options,
180 first_connection_identifier;
181 } ConnectToKeyboardParms;
182
183 typedef struct {
184 char
185 rc,
186 function_id,
187 session_id,
188 reserved;
189 short
190 connectors_task_id;
191 } DisconnectFromKeyboardParms;
192
193 typedef struct {
194 unsigned char
195 scancode,
196 shift_state;
197 } KeystrokeEntry;
198
199 typedef struct {
200 short
201 length; /* Length (in bytes) of list */
202 KeystrokeEntry keystrokes; /* Variable size */
203 } KeystrokeList;
204
205 typedef struct {
206 char
207 rc,
208 function_id,
209 session_id,
210 reserved;
211 short
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
224 #define OPTION_SINGLE_KEYSTROKE 0x20
225 #define OPTION_MULTIPLE_KEYSTROKES 0x30
226
227 typedef struct {
228 char
229 rc,
230 function_id,
231 session_id,
232 reserved;
233 short
234 connectors_task_id;
235 } DisableInputParms;
236
237 typedef DisableInputParms EnableInputParms;
238
239 typedef struct {
240 char
241 session_id,
242 reserved;
243 char far
244 *buffer;
245 char
246 characteristics,
247 session_type;
248 short
249 begin; /* Offset within buffer */
250 } BufferDescriptor;
251
252 typedef struct {
253 char
254 rc,
255 function_id;
256 BufferDescriptor
257 source;
258 short
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
270 typedef 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
282 /* If the user wants all groups, we return API_OIA_BYTES_ALL_GROUPS bytes */
283 #define API_OIA_ALL_GROUPS '\377'
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 */
290
291
292
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
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))
315
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
322 #if defined(linux)
323 #include <endian.h>
324 #endif
325 #include <sys/param.h> /* Get ENDIAN from machine/endian.h */
326
327 /* Determine endian'ess (if necessary) */
328 #if !(defined(BYTE_ORDER) && defined(BIG_ENDIAN))
329 #define LITTLE_ENDIAN 1234 /* least-significant byte first (vax) */
330 #define BIG_ENDIAN 4321 /* most-significant byte first (IBM, net) */
331
332 #if defined(linux) || defined(vax) || defined(ns32000)
333 #define BYTE_ORDER LITTLE_ENDIAN
334 #endif /* defined(vax) || defined(ns32000) */
335
336 #if defined(sun) || defined(tahoe) || defined(ibm032) || defined(pyr) || defined(gould)
337 #define BYTE_ORDER BIG_ENDIAN
338 #endif /* defined(sun) || defined(tahoe) || defined(ibm032) || defined(pyr) || defined(gould) */
339
340 #endif /* !(defined(BYTE_ORDER) && defined(BIG_ENDIAN)) */
341
342 struct highlow {
343 unsigned char
344 #if BYTE_ORDER == LITTLE_ENDIAN
345 al,
346 ah,
347 bl,
348 bh,
349 cl,
350 ch,
351 dl,
352 dh;
353 #endif /* BYTE_ORDER == LITTLE_ENDIAN */
354 #if BYTE_ORDER == BIG_ENDIAN
355 ah,
356 al,
357 bh,
358 bl,
359 ch,
360 cl,
361 dh,
362 dl;
363 #endif /* BYTE_ORDER == BIG_ENDIAN */
364 };
365
366 struct words {
367 unsigned short
368 ax,
369 bx,
370 cx,
371 dx;
372 unsigned short
373 si,
374 di;
375 };
376
377 union REGS {
378 struct highlow h;
379 struct words x;
380 };
381
382 struct SREGS {
383 unsigned short
384 cs,
385 ds,
386 es,
387 ss;
388 };
389 #endif /* defined(MSDOS) (else section) */