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