Sync usage with man page.
[netbsd-mini2440.git] / usr.bin / tn3270 / ctlr / api.h
blobc8580ca83316586bd795c5fd053cd1ce1c712f61
1 /* $NetBSD: api.h,v 1.6 2002/06/13 23:41:19 wiz Exp $ */
3 /*-
4 * Copyright (c) 1988 The Regents of the University of California.
5 * All rights reserved.
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 * 3. Neither the name of the University nor the names of its contributors
16 * may be used to endorse or promote products derived from this software
17 * without specific prior written permission.
19 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
20 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
23 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29 * SUCH DAMAGE.
31 * from: @(#)api.h 4.4 (Berkeley) 4/26/91
35 * This file contains header information used by the PC API routines.
38 #if !defined(MSDOS)
39 #define far /* For 'far *' checks */
40 #endif /* !defined(MSDOS) */
42 #define API_INTERRUPT_NUMBER 0x7A /* API Interrupt Number */
45 * Define the gate numbers. These are returned via the Name Resolution
46 * service.
49 #define GATE_SESSMGR 1234
50 #define GATE_KEYBOARD 5678
51 #define GATE_COPY 9101
52 #define GATE_OIAM 1121
55 * The names which correspond to the above gate numbers.
58 #define NAME_SESSMGR "SESSMGR "
59 #define NAME_KEYBOARD "KEYBOARD"
60 #define NAME_COPY "COPY "
61 #define NAME_OIAM "OIAM "
65 * Name Resolution is specified in AH.
68 #define NAME_RESOLUTION 0x81
70 #if defined(unix)
72 * In unix, we offer a service to allow the application to keep from
73 * having to poll us constantly.
75 #define PS_OR_OIA_MODIFIED 0x99
77 #endif /* defined(unix) */
80 * Codes specified in AL for various services.
83 #define QUERY_SESSION_ID 0x01
84 #define QUERY_SESSION_PARAMETERS 0x02
85 #define QUERY_SESSION_CURSOR 0x0b
87 #define CONNECT_TO_KEYBOARD 0x01
88 #define DISCONNECT_FROM_KEYBOARD 0x02
89 #define WRITE_KEYSTROKE 0x04
90 #define DISABLE_INPUT 0x05
91 #define ENABLE_INPUT 0x06
93 #define COPY_STRING 0x01
95 #define READ_OIA_GROUP 0x02
98 * For each service, we define the assoicated parameter blocks.
102 * Supervisor Services
105 typedef struct {
106 char gate_name[8];
107 } NameResolveParms;
111 * Session Information Services
114 typedef struct {
115 char
116 short_name,
117 type,
118 session_id,
119 reserved,
120 long_name[8];
121 } NameArrayElement;
123 typedef struct {
124 unsigned char
125 length,
126 number_matching_session;
127 NameArrayElement
128 name_array_element; /* Variable number */
129 } NameArray;
131 typedef struct {
132 char
134 function_id,
135 option_code,
136 data_code;
137 NameArray far
138 *name_array;
139 char
140 long_name[8];
141 } QuerySessionIdParms;
143 #define ID_OPTION_BY_NAME 0x01 /* By short (or long) name */
144 #define ID_OPTION_ALL 0x00 /* All (of specified type */
146 typedef struct {
147 char
149 function_id,
150 session_id,
151 reserved,
152 session_type,
153 session_characteristics,
154 rows,
155 columns;
156 char far
157 *presentation_space;
158 } QuerySessionParametersParms;
160 #define TYPE_WSCTL 0x01 /* Work Station Control */
161 #define TYPE_DFT 0x02 /* DFT Host Session */
162 #define TYPE_CUT 0x03 /* CUT Host Session */
163 #define TYPE_NOTEPAD 0x04 /* Notepad Session */
164 #define TYPE_PC 0x05 /* Personal Computer Session */
166 #define CHARACTERISTIC_EAB 0x80 /* Extended Attribute Buffer */
167 #define CHARACTERISTIC_PSS 0x40 /* Program Symbols Supported */
169 typedef struct {
170 char
172 function_id,
173 session_id,
174 cursor_type,
175 row_address, /* from 0 */
176 column_address; /* from 0 */
177 } QuerySessionCursorParms;
179 #define CURSOR_INHIBITED_AUTOSCROLL 0x10
180 #define CURSOR_INHIBITED 0x04
181 #define CURSOR_BLINKING 0x02
182 #define CURSOR_BOX 0x01
183 typedef struct {
184 char
186 function_id,
187 session_id,
188 reserved;
189 short
190 event_queue_id,
191 input_queue_id;
192 char
193 intercept_options,
194 first_connection_identifier;
195 } ConnectToKeyboardParms;
197 typedef struct {
198 char
200 function_id,
201 session_id,
202 reserved;
203 short
204 connectors_task_id;
205 } DisconnectFromKeyboardParms;
207 typedef struct {
208 unsigned char
209 scancode,
210 shift_state;
211 } KeystrokeEntry;
213 typedef struct {
214 short
215 length; /* Length (in bytes) of list */
216 KeystrokeEntry keystrokes; /* Variable size */
217 } KeystrokeList;
219 typedef struct {
220 char
222 function_id,
223 session_id,
224 reserved;
225 short
226 connectors_task_id;
227 char
228 options,
229 number_of_keys_sent;
230 union {
231 KeystrokeEntry
232 keystroke_entry;
233 KeystrokeList far
234 *keystroke_list;
235 } keystroke_specifier;
236 } WriteKeystrokeParms;
238 #define OPTION_SINGLE_KEYSTROKE 0x20
239 #define OPTION_MULTIPLE_KEYSTROKES 0x30
241 typedef struct {
242 char
244 function_id,
245 session_id,
246 reserved;
247 short
248 connectors_task_id;
249 } DisableInputParms;
251 typedef DisableInputParms EnableInputParms;
253 typedef struct {
254 char
255 session_id,
256 reserved;
257 char far
258 *buffer;
259 char
260 characteristics,
261 session_type;
262 short
263 begin; /* Offset within buffer */
264 } BufferDescriptor;
266 typedef struct {
267 char
269 function_id;
270 BufferDescriptor
271 source;
272 short
273 source_end; /* Offset within source buffer */
274 BufferDescriptor
275 target;
276 char
277 copy_mode,
278 reserved;
279 } CopyStringParms;
281 #define COPY_MODE_7_COLOR 0x80 /* Else 4 color mode */
282 #define COPY_MODE_FIELD_ATTRIBUTES 0x40 /* Else don't copy attributes */
284 typedef struct {
285 char
287 function_id,
288 session_id,
289 reserved;
290 char far
291 *oia_buffer;
292 char
293 oia_group_number;
294 } ReadOiaGroupParms;
296 /* If the user wants all groups, we return API_OIA_BYTES_ALL_GROUPS bytes */
297 #define API_OIA_ALL_GROUPS '\377'
298 #define API_OIA_BYTES_ALL_GROUPS 22 /* 22 bytes of data */
300 /* API_OIA_INPUT_INHIBITED is special. It returns more than on byte of data */
301 #define API_OIA_INPUT_INHIBITED 8
303 #define API_OIA_LAST_LEGAL_GROUP 18 /* Highest legal number */
307 #if defined(MSDOS)
309 #if !defined(FP_SEG)
310 #include <dos.h>
311 #endif /* !defined(FP_SEG) */
313 #else /* defined(MSDOS) */
316 * These definitions are here to provide the descriptions of
317 * some registers which are, normally, defined in <dos.h> on
318 * a dos system.
321 #define FP_SEG(x) ((unsigned int)(((unsigned long)(x))>>16))
322 #define FP_OFF(y) ((unsigned int)(((unsigned long)(y))&0xFFFF))
325 * Undo the preceding.
328 #define SEG_OFF_BACK(x,y) (((x)<<16)|(y))
331 * Now, it is somewhat of a pain, but we need to keep
332 * 8086 conventions about which of the "highlow"'s map
333 * into which of the "words".
336 #include <sys/param.h> /* Get ENDIAN from machine/endian.h */
338 /* Determine endian'ess (if necessary) */
340 #if !(defined(BYTE_ORDER) && defined(BIG_ENDIAN))
341 #define LITTLE_ENDIAN 1234 /* least-significant byte first (vax) */
342 #define BIG_ENDIAN 4321 /* most-significant byte first (IBM, net) */
344 #if defined(vax) || defined(ns32000) || defined(i386) || (defined(mips)&&defined(MIPSEL))
345 #define BYTE_ORDER LITTLE_ENDIAN
346 #endif /* defined(vax) || defined(ns32000) */
348 #if defined(sun) || defined(tahoe) || defined(ibm032) || defined(pyr) || defined(gould) || (defined(mips)&&defined(MIPSEB))
349 #define BYTE_ORDER BIG_ENDIAN
350 #endif /* defined(sun) || defined(tahoe) || defined(ibm032) || defined(pyr) || defined(gould) */
352 #endif /* !(defined(BYTE_ORDER) && defined(BIG_ENDIAN)) */
354 struct highlow {
355 unsigned char
356 #if BYTE_ORDER == LITTLE_ENDIAN
365 #endif /* BYTE_ORDER == LITTLE_ENDIAN */
366 #if BYTE_ORDER == BIG_ENDIAN
375 #endif /* BYTE_ORDER == BIG_ENDIAN */
378 struct words {
379 unsigned short
384 unsigned short
389 union REGS {
390 struct highlow h;
391 struct words x;
394 struct SREGS {
395 unsigned short
401 #endif /* defined(MSDOS) (else section) */
403 /* Interface */
404 int api_close_api(void);
405 int api_open_api(char *);
406 int api_exch_api(union REGS *, struct SREGS *, char *, int);
408 /* api.c */
409 void handle_api(union REGS *, struct SREGS *);