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