1 /*- 2 * Copyright (c) 1988, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * %sccs.include.redist.c% 6 * 7 * @(#)api.h 8.1 (Berkeley) 06/06/93 8 */ 9 10 /* 11 * This file contains header information used by the PC API routines. 12 */ 13 14 #if !defined(MSDOS) 15 #define far /* For 'far *' checks */ 16 #endif /* !defined(MSDOS) */ 17 18 #define API_INTERRUPT_NUMBER 0x7A /* API Interrupt Number */ 19 20 /* 21 * Define the gate numbers. These are returned via the Name Resolution 22 * service. 23 */ 24 25 #define GATE_SESSMGR 1234 26 #define GATE_KEYBOARD 5678 27 #define GATE_COPY 9101 28 #define GATE_OIAM 1121 29 30 /* 31 * The names which correspond to the above gate numbers. 32 */ 33 34 #define NAME_SESSMGR "SESSMGR " 35 #define NAME_KEYBOARD "KEYBOARD" 36 #define NAME_COPY "COPY " 37 #define NAME_OIAM "OIAM " 38 39 40 /* 41 * Name Resolution is specified in AH. 42 */ 43 44 #define NAME_RESOLUTION 0x81 45 46 #if defined(unix) 47 /* 48 * In unix, we offer a service to allow the application to keep from 49 * having to poll us constantly. 50 */ 51 #define PS_OR_OIA_MODIFIED 0x99 52 53 #endif /* defined(unix) */ 54 55 /* 56 * Codes specified in AL for various services. 57 */ 58 59 #define QUERY_SESSION_ID 0x01 60 #define QUERY_SESSION_PARAMETERS 0x02 61 #define QUERY_SESSION_CURSOR 0x0b 62 63 #define CONNECT_TO_KEYBOARD 0x01 64 #define DISCONNECT_FROM_KEYBOARD 0x02 65 #define WRITE_KEYSTROKE 0x04 66 #define DISABLE_INPUT 0x05 67 #define ENABLE_INPUT 0x06 68 69 #define COPY_STRING 0x01 70 71 #define READ_OIA_GROUP 0x02 72 73 /* 74 * For each service, we define the assoicated parameter blocks. 75 */ 76 77 /* 78 * Supervisor Services 79 */ 80 81 typedef struct { 82 char gate_name[8]; 83 } NameResolveParms; 84 85 86 /* 87 * Session Information Services 88 */ 89 90 typedef struct { 91 char 92 short_name, 93 type, 94 session_id, 95 reserved, 96 long_name[8]; 97 } NameArrayElement; 98 99 typedef struct { 100 unsigned char 101 length, 102 number_matching_session; 103 NameArrayElement 104 name_array_element; /* Variable number */ 105 } NameArray; 106 107 typedef struct { 108 char 109 rc, 110 function_id, 111 option_code, 112 data_code; 113 NameArray far 114 *name_array; 115 char 116 long_name[8]; 117 } QuerySessionIdParms; 118 119 #define ID_OPTION_BY_NAME 0x01 /* By short (or long) name */ 120 #define ID_OPTION_ALL 0x00 /* All (of specified type */ 121 122 typedef struct { 123 char 124 rc, 125 function_id, 126 session_id, 127 reserved, 128 session_type, 129 session_characteristics, 130 rows, 131 columns; 132 char far 133 *presentation_space; 134 } QuerySessionParametersParms; 135 136 #define TYPE_WSCTL 0x01 /* Work Station Control */ 137 #define TYPE_DFT 0x02 /* DFT Host Session */ 138 #define TYPE_CUT 0x03 /* CUT Host Session */ 139 #define TYPE_NOTEPAD 0x04 /* Notepad Session */ 140 #define TYPE_PC 0x05 /* Personal Computer Session */ 141 142 #define CHARACTERISTIC_EAB 0x80 /* Extended Attribute Buffer */ 143 #define CHARACTERISTIC_PSS 0x40 /* Program Symbols Supported */ 144 145 typedef struct { 146 char 147 rc, 148 function_id, 149 session_id, 150 cursor_type, 151 row_address, /* from 0 */ 152 column_address; /* from 0 */ 153 } QuerySessionCursorParms; 154 155 #define CURSOR_INHIBITED_AUTOSCROLL 0x10 156 #define CURSOR_INHIBITED 0x04 157 #define CURSOR_BLINKING 0x02 158 #define CURSOR_BOX 0x01 159 typedef struct { 160 char 161 rc, 162 function_id, 163 session_id, 164 reserved; 165 short 166 event_queue_id, 167 input_queue_id; 168 char 169 intercept_options, 170 first_connection_identifier; 171 } ConnectToKeyboardParms; 172 173 typedef struct { 174 char 175 rc, 176 function_id, 177 session_id, 178 reserved; 179 short 180 connectors_task_id; 181 } DisconnectFromKeyboardParms; 182 183 typedef struct { 184 unsigned char 185 scancode, 186 shift_state; 187 } KeystrokeEntry; 188 189 typedef struct { 190 short 191 length; /* Length (in bytes) of list */ 192 KeystrokeEntry keystrokes; /* Variable size */ 193 } KeystrokeList; 194 195 typedef struct { 196 char 197 rc, 198 function_id, 199 session_id, 200 reserved; 201 short 202 connectors_task_id; 203 char 204 options, 205 number_of_keys_sent; 206 union { 207 KeystrokeEntry 208 keystroke_entry; 209 KeystrokeList far 210 *keystroke_list; 211 } keystroke_specifier; 212 } WriteKeystrokeParms; 213 214 #define OPTION_SINGLE_KEYSTROKE 0x20 215 #define OPTION_MULTIPLE_KEYSTROKES 0x30 216 217 typedef struct { 218 char 219 rc, 220 function_id, 221 session_id, 222 reserved; 223 short 224 connectors_task_id; 225 } DisableInputParms; 226 227 typedef DisableInputParms EnableInputParms; 228 229 typedef struct { 230 char 231 session_id, 232 reserved; 233 char far 234 *buffer; 235 char 236 characteristics, 237 session_type; 238 short 239 begin; /* Offset within buffer */ 240 } BufferDescriptor; 241 242 typedef struct { 243 char 244 rc, 245 function_id; 246 BufferDescriptor 247 source; 248 short 249 source_end; /* Offset within source buffer */ 250 BufferDescriptor 251 target; 252 char 253 copy_mode, 254 reserved; 255 } CopyStringParms; 256 257 #define COPY_MODE_7_COLOR 0x80 /* Else 4 color mode */ 258 #define COPY_MODE_FIELD_ATTRIBUTES 0x40 /* Else don't copy attributes */ 259 260 typedef struct { 261 char 262 rc, 263 function_id, 264 session_id, 265 reserved; 266 char far 267 *oia_buffer; 268 char 269 oia_group_number; 270 } ReadOiaGroupParms; 271 272 /* If the user wants all groups, we return API_OIA_BYTES_ALL_GROUPS bytes */ 273 #define API_OIA_ALL_GROUPS '\377' 274 #define API_OIA_BYTES_ALL_GROUPS 22 /* 22 bytes of data */ 275 276 /* API_OIA_INPUT_INHIBITED is special. It returns more than on byte of data */ 277 #define API_OIA_INPUT_INHIBITED 8 278 279 #define API_OIA_LAST_LEGAL_GROUP 18 /* Highest legal number */ 280 281 282 283 #if defined(MSDOS) 284 285 #if !defined(FP_SEG) 286 #include <dos.h> 287 #endif /* !defined(FP_SEG) */ 288 289 #else /* defined(MSDOS) */ 290 291 /* 292 * These definitions are here to provide the descriptions of 293 * some registers which are, normally, defined in <dos.h> on 294 * a dos system. 295 */ 296 297 #define FP_SEG(x) ((unsigned int)(((unsigned long)(x))>>16)) 298 #define FP_OFF(y) ((unsigned int)(((unsigned long)(y))&0xFFFF)) 299 300 /* 301 * Undo the preceeding. 302 */ 303 304 #define SEG_OFF_BACK(x,y) (((x)<<16)|(y)) 305 306 /* 307 * Now, it is somewhat of a pain, but we need to keep 308 * 8086 conventions about which of the "highlow"'s map 309 * into which of the "words". 310 */ 311 312 #include <sys/param.h> /* Get ENDIAN from machine/endian.h */ 313 314 /* Determine endian'ess (if necessary) */ 315 316 #if !(defined(BYTE_ORDER) && defined(BIG_ENDIAN)) 317 #define LITTLE_ENDIAN 1234 /* least-significant byte first (vax) */ 318 #define BIG_ENDIAN 4321 /* most-significant byte first (IBM, net) */ 319 320 #if defined(vax) || defined(ns32000) || defined(i386) || (defined(mips)&&defined(MIPSEL)) 321 #define BYTE_ORDER LITTLE_ENDIAN 322 #endif /* defined(vax) || defined(ns32000) */ 323 324 #if defined(sun) || defined(tahoe) || defined(ibm032) || defined(pyr) || defined(gould) || (defined(mips)&&defined(MIPSEB)) 325 #define BYTE_ORDER BIG_ENDIAN 326 #endif /* defined(sun) || defined(tahoe) || defined(ibm032) || defined(pyr) || defined(gould) */ 327 328 #endif /* !(defined(BYTE_ORDER) && defined(BIG_ENDIAN)) */ 329 330 struct highlow { 331 unsigned char 332 #if BYTE_ORDER == LITTLE_ENDIAN 333 al, 334 ah, 335 bl, 336 bh, 337 cl, 338 ch, 339 dl, 340 dh; 341 #endif /* BYTE_ORDER == LITTLE_ENDIAN */ 342 #if BYTE_ORDER == BIG_ENDIAN 343 ah, 344 al, 345 bh, 346 bl, 347 ch, 348 cl, 349 dh, 350 dl; 351 #endif /* BYTE_ORDER == BIG_ENDIAN */ 352 }; 353 354 struct words { 355 unsigned short 356 ax, 357 bx, 358 cx, 359 dx; 360 unsigned short 361 si, 362 di; 363 }; 364 365 union REGS { 366 struct highlow h; 367 struct words x; 368 }; 369 370 struct SREGS { 371 unsigned short 372 cs, 373 ds, 374 es, 375 ss; 376 }; 377 #endif /* defined(MSDOS) (else section) */ 378