xref: /csrg-svn/usr.bin/tn3270/ctlr/api.h (revision 31198)
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	1
17 #define	GATE_KEYBOARD	2
18 #define	GATE_COPY	3
19 #define	GATE_OIAM	4
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_PARMS		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 typedef struct {
102     char
103 	rc,
104 	function_id,
105 	session_id,
106 	reserved,
107 	session_type,
108 	session_characteristics,
109 	rows,
110 	columns;
111     char far
112 	*presentation_space;
113 } QuerySessionParametersParms;
114 
115 #define	TYPE_WSCTL		0x01		/* Work Station Control */
116 #define	TYPE_DFT		0x02		/* DFT Host Session */
117 #define	TYPE_CUT		0x03		/* CUT Host Session */
118 #define	TYPE_NOTEPAD		0x04		/* Notepad Session */
119 #define	TYPE_PC			0x05		/* Personal Computer Session */
120 
121 #define	CHARACTERISTIC_EAB	0x80		/* Extended Attribute Buffer */
122 #define	CHARACTERISTIC_PSS	0x40		/* Program Symbols Supported */
123 
124 typedef struct {
125     char
126 	rc,
127 	function_id,
128 	session_id,
129 	cursor_type,
130 	row_address,				/* from 0 */
131 	column_address;				/* from 0 */
132 } QuerySessionCursorParms;
133 
134 #define	CURSOR_INHIBITED_AUTOSCROLL	0x10
135 #define	CURSOR_INHIBITED		0x04
136 #define	CURSOR_BLINKING			0x02
137 #define	CURSOR_BOX			0x01
138 typedef struct {
139     char
140 	rc,
141 	function_id,
142 	session_id,
143 	reserved;
144     int
145 	event_queue_id,
146 	input_queue_id;
147     char
148 	intercept_options,
149 	first_connection_identifier;
150 } ConnectToKeyboardParms;
151 
152 typedef struct {
153     char
154 	rc,
155 	function_id,
156 	session_id,
157 	reserved;
158     int
159 	connectors_task_id;
160 } DisconnectFromKeyboardParms;
161 
162 typedef struct {
163     char
164 	scancode,
165 	shift_state;
166 } KeystrokeEntry;
167 
168 typedef struct {
169     int
170 	length;			/* Length (in bytes) of list */
171     KeystrokeEntry keystrokes;	/* Variable size */
172 } KeystrokeList;
173 
174 typedef struct {
175     char
176 	rc,
177 	function_id,
178 	session_id,
179 	reserved;
180     int
181 	connectors_task_id;
182     char
183 	options,
184 	number_of_keys_sent;
185     union {
186 	KeystrokeEntry
187 	    keystroke_entry;
188 	KeystrokeList far
189 	    *keystroke_list;
190     } keystroke_specifier;
191 } WriteKeystrokeParms;
192 
193 #define	OPTION_SINGLE_KEYSTROKE		0x20
194 #define	OPTION_MULTIPLE_KEYSTROKES	0x30
195 
196 typedef struct {
197     char
198 	rc,
199 	function_id,
200 	session_id,
201 	reserved;
202     int
203 	connectors_task_id;
204 } DisableInputParms;
205 
206 typedef DisableInputParms EnableInputParms;
207 
208 typedef struct {
209     char
210 	session_id,
211 	reserved;
212     char far
213 	*buffer;
214     char
215 	characteristics,
216 	session_type;
217     int
218 	begin;			/* Offset within buffer */
219 } BufferDescriptor;
220 
221 typedef struct {
222     char
223 	rc,
224 	function_id;
225     BufferDescriptor
226 	source;
227     int
228 	source_end;		/* Offset within source buffer */
229     BufferDescriptor
230 	target;
231     char
232 	copy_mode,
233 	reserved;
234 } CopyStringParms;
235 
236 #define	COPY_MODE_7_COLOR		0x80	/* Else 4 color mode */
237 #define	COPY_MODE_FIELD_ATTRIBUTES	0x40	/* Else don't copy attributes */
238 
239 typedef struct {
240     char
241 	rc,
242 	function_id,
243 	session_id,
244 	reserved;
245     char far
246 	*oia_buffer;
247     char
248 	oia_group_number;
249 } ReadOiaGroupParms;
250 
251 /* If the user wants all groups, we return API_OIA_BYTES_ALL_GROUPS bytes */
252 #define	API_OIA_ALL_GROUPS		0xFF
253 #define	API_OIA_BYTES_ALL_GROUPS	22	/* 22 bytes of data */
254 
255 /* API_OIA_INPUT_INHIBITED is special.  It returns more than on byte of data */
256 #define	API_OIA_INPUT_INHIBITED		8
257 
258 #define	API_OIA_LAST_LEGAL_GROUP	18	/* Highest legal number */
259 
260 
261 
262 #if	defined(MSDOS)
263 
264 #if	!defined(FP_SEG)
265 #include <dos.h>
266 #endif	/* !defined(FP_SEG) */
267 
268 #else	/* defined(MSDOS) */
269 
270 /*
271  * These definitions are here to provide the descriptions of
272  * some registers which are, normally, defined in <dos.h> on
273  * a dos system.
274  */
275 
276 #define	FP_SEG(x)	(x)
277 #define	FP_OFF(y)	(y)
278 
279 struct highlow {
280     char
281 	ah,
282 	al,
283 	bh,
284 	bl,
285 	ch,
286 	cl,
287 	dh,
288 	dl;
289 };
290 
291 struct words {
292     int
293 	ax,
294 	bx,
295 	cx,
296 	dx,
297 	si,
298 	di;
299 };
300 
301 union REGS {
302     struct highlow h;
303     struct words x;
304 };
305 
306 struct SREGS {
307     int
308 	cs,
309 	ds,
310 	es,
311 	ss;
312 };
313 #endif	/* defined(MSDOS) (else section) */
314