xref: /csrg-svn/usr.bin/tn3270/ctlr/api.h (revision 31193)
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 typedef struct {
194     char
195 	rc,
196 	function_id,
197 	session_id,
198 	reserved;
199     int
200 	connectors_task_id;
201 } DisableInputParms;
202 
203 typedef DisableInputParms EnableInputParms;
204 
205 typedef struct {
206     char
207 	session_id,
208 	reserved;
209     char far
210 	*buffer;
211     char
212 	characteristics,
213 	session_type;
214     int
215 	begin;			/* Offset within buffer */
216 } BufferDescriptor;
217 
218 typedef struct {
219     char
220 	rc,
221 	function_id;
222     BufferDescriptor
223 	source;
224     int
225 	source_end;		/* Offset within source buffer */
226     BufferDescriptor
227 	target;
228     char
229 	copy_mode,
230 	reserved;
231 } CopyStringParms;
232 
233 #define	COPY_MODE_7_COLOR		0x80	/* Else 4 color mode */
234 #define	COPY_MODE_FIELD_ATTRIBUTES	0x40	/* Else don't copy attributes */
235 
236 typedef struct {
237     char
238 	rc,
239 	function_id,
240 	session_id,
241 	reserved;
242     char far
243 	*oia_buffer;
244     char
245 	oia_group_number;
246 } ReadOiaGroupParms;
247 
248 /* If the user wants all groups, we return API_OIA_BYTES_ALL_GROUPS bytes */
249 #define	API_OIA_ALL_GROUPS		0xFF
250 #define	API_OIA_BYTES_ALL_GROUPS	22	/* 22 bytes of data */
251 
252 /* API_OIA_INPUT_INHIBITED is special.  It returns more than on byte of data */
253 #define	API_OIA_INPUT_INHIBITED		8
254 
255 #define	API_OIA_LAST_LEGAL_GROUP	18	/* Highest legal number */
256 
257 
258 
259 #if	defined(MSDOS)
260 
261 #if	!defined(FP_SEG)
262 #include <dos.h>
263 #endif	/* !defined(FP_SEG) */
264 
265 #else	/* defined(MSDOS) */
266 
267 /*
268  * These definitions are here to provide the descriptions of
269  * some registers which are, normally, defined in <dos.h> on
270  * a dos system.
271  */
272 
273 #define	FP_SEG(x)	(x)
274 #define	FP_OFF(y)	(y)
275 
276 struct highlow {
277     char
278 	ah,
279 	al,
280 	bh,
281 	bl,
282 	ch,
283 	cl,
284 	dh,
285 	dl;
286 };
287 
288 struct words {
289     int
290 	ax,
291 	bx,
292 	cx,
293 	dx,
294 	si,
295 	di;
296 };
297 
298 union REGS {
299     struct highlow h;
300     struct words x;
301 };
302 
303 struct SREGS {
304     int
305 	cs,
306 	ds,
307 	es,
308 	ss;
309 };
310 #endif	/* defined(MSDOS) (else section) */
311