1 /*# name=Main Maximus header file 2 */ 3 4 #ifndef __MAX_H_DEFINED 5 #define __MAX_H_DEFINED 6 7 #include "prog.h" 8 9 /*************************************************************************** 10 * Conditional flags for the entire program, and portability stuff * 11 ***************************************************************************/ 12 13 #define CANENCRYPT /* Do we support encryption of passwords? */ 14 #define MUSTENCRYPT /* Should we always encrypt the user's password 15 * at logon, even if they don't try to change it? 16 * (This requires CANENCRYPT.) 17 */ 18 #define CHANGEENCRYPT /* Passwords are always encrypted when the user 19 * changes it or logs on for the first time */ 20 #define TTYVIDEO /* Local video supported via fputc() et al */ 21 #define MAXIMUS /* Who are we? */ 22 #define MEX /* Include MEX support */ 23 #define MAX_TRACKER /* Use message tracking subsystem */ 24 /*#define FLUSH_LOG*/ 25 #define INTERNAL_PROTOCOLS 26 #define SHORT_MDM_CMD 27 28 #if !defined(__FLAT__) && !defined(ORACLE) 29 /*#define KEY*/ /* Use key file */ 30 #endif 31 32 #ifdef OS_2 33 #define MCP 34 35 #ifndef ORACLE 36 #define MCP_VIDEO 37 #endif 38 39 #ifndef __FLAT__ 40 /*#define MAXSNOOP*/ 41 #endif 42 #endif 43 44 45 /*************************************************************************** 46 Initialization of variables 47 ***************************************************************************/ 48 49 #define extrn extern 50 #define IS(x) 51 #define LEN(x) 52 53 #include <time.h> 54 #include "utime.h" 55 56 57 #ifdef BLINK 58 #undef BLINK 59 #endif 60 61 #ifdef DLE 62 #undef DLE 63 #endif 64 65 /*************************************************************************** 66 Miscellanious Macros 67 ***************************************************************************/ 68 69 #ifdef __TURBOC__ 70 #define isupsp(c) (_ctype[(c) + 1] & (_IS_UPP | _IS_SP)) 71 #else 72 #define isupsp(c) (isupper(c) || isspace(c)) 73 #endif 74 75 #define MNU(m,o) (((m).menuheap)+(m).o) 76 #define MsgAreaHasLock(a,l) ((a).msglock & (1L << (dword)(l))) 77 #define FileAreaHasLock(a,l)((a).filelock & (1L << (dword)(l))) 78 #define GEPriv(p1,p2) ((word)(p1) >= (word)(p2)) 79 #define LEPriv(p1,p2) ((word)(p1) <= (word)(p2)) 80 81 /*************************************************************************** 82 Constant #define's 83 ***************************************************************************/ 84 85 86 #define FFLAG_TAG 0x0001 /* File was T)agged */ 87 #define FFLAG_THIS1 0x0002 /* Selected during THIS wcard expansion */ 88 #define FFLAG_NOTIME 0x0004 /* Don't debit time for this file */ 89 #define FFLAG_NOBYTES 0x0008 /* Don't debit DL bytes for this file */ 90 #define FFLAG_EXP 0x0010 /* Filename was expanded from wildcard */ 91 #define FFLAG_NOENT 0x0020 /* This file is not on disk */ 92 #define FFLAG_OK 0x0040 /* This file previously verified for DL */ 93 #define FFLAG_NOLIST 0x0080 /* File is not in FILES.BBS */ 94 #define FFLAG_GOT 0x0100 /* This file was uploaded */ 95 #define FFLAG_SENT 0x0200 /* This file was downloaded */ 96 #define FFLAG_STAGE 0x0400 /* Copy file to staging area before xfer*/ 97 #define FFLAG_SLOW 0x0800 /* File is from from an FA_SLOW area */ 98 #define FFLAG_DUPE 0x8000 /* File is a dupe */ 99 100 #define CMSG_PAGE 0x00 /* "You're being paged by another user!" */ 101 #define CMSG_ENQ 0x01 /* "Are you on this chat channel?" */ 102 #define CMSG_ACK 0x02 /* "Yes, I AM on this channel!" */ 103 #define CMSG_EOT 0x03 /* "I'm leaving this chat channel!" */ 104 #define CMSG_CDATA 0x04 /* Text typed by used while in chat */ 105 #define CMSG_HEY_DUDE 0x05 /* A normal messge. Always displayed. */ 106 #define CMSG_DISPLAY 0x06 /* Display a file to the user */ 107 108 #define MAX_MENUNAME PATHLEN /* Max. length of menuname[]. */ 109 #define RST_VER 3 /* Version number of RESTARxx.BBS */ 110 #define MAX_LINE 255 /* Max. length of a .CTL file line! */ 111 #define PREREGISTERED 0xfffe /* Priv. value that means let no new * 112 * callers on the system. */ 113 #define RESTART_MENU 0x00 /* If restarting at a menu */ 114 #define RESTART_DOTBBS 0x01 /* If restarting in middle of .BBS file */ 115 116 #define NUM_MENU 256 /* Max. # of options in a menu file */ 117 118 119 /* Defines for *.MNU: */ 120 121 #define AREATYPE_LOCAL 0x01 /* Tells which type (and which type ONLY) */ 122 #define AREATYPE_MATRIX 0x02 /* that command can be used in. */ 123 #define AREATYPE_ECHO 0x04 124 #define AREATYPE_CONF 0x08 125 126 #define AREATYPE_ALL (AREATYPE_LOCAL | AREATYPE_MATRIX | \ 127 AREATYPE_ECHO | AREATYPE_CONF) 128 129 #define HEADER_NONE 0x00 /* The header type for each menu. */ 130 #define HEADER_MESSAGE 0x01 131 #define HEADER_FILE 0x02 132 #define HEADER_CHANGE 0x03 133 #define HEADER_CHAT 0x04 134 135 #define OFLAG_NODSP 0x0001 /* Don't display menu option on MENU, but */ 136 /* accept it as a command. */ 137 #define OFLAG_CTL 0x0002 /* Produce a .CTL file for this xtern cmd */ 138 #define OFLAG_NOCLS 0x0004 /* Don't do a CLS for this display_menu */ 139 #define OFLAG_THEN 0x0008 /* Do only if last IF equation was true */ 140 #define OFLAG_ELSE 0x0010 /* Do only if last IF equation was FALSE */ 141 #define OFLAG_ULOCAL 0x0020 /* Only display for local users */ 142 #define OFLAG_UREMOTE 0x0040 /* Only display for remote useres */ 143 #define OFLAG_REREAD 0x0080 /* Re-read LASTUSER.BBS upon re-entry */ 144 #define OFLAG_STAY 0x0100 /* Don't perform menu clean-up operations */ 145 #define OFLAG_RIP 0x0200 /* Available for RIP callers only */ 146 #define OFLAG_NORIP 0x0400 /* Available for non-RIP callers only */ 147 148 /*************************************************************************** 149 Structure Definitions 150 ***************************************************************************/ 151 152 #ifndef __MSGAPI_H_DEFINED 153 154 typedef struct _netaddr NETADDR; 155 156 struct _netaddr 157 { 158 word zone; 159 word net; 160 word node; 161 word point; 162 }; 163 164 #endif 165 166 struct _maxcol 167 { 168 byte status_bar; /* black on white */ 169 byte status_cht; /* blinking black on white */ 170 byte status_key; /* blinking black on white */ 171 172 byte pop_text; /* white on blue */ 173 byte pop_border; /* yellow on blue */ 174 byte pop_high; /* yellow on blue */ 175 byte pop_list; /* black on grey */ 176 byte pop_lselect; /* grey on red */ 177 178 byte wfc_stat; /* white on blue */ 179 byte wfc_stat_bor; /* yellow on blue */ 180 byte wfc_modem; /* gray on blue */ 181 byte wfc_modem_bor; /* lgreen on blue */ 182 byte wfc_keys; /* yellow on blue */ 183 byte wfc_keys_bor; /* white on blue */ 184 byte wfc_activ; /* white on blue */ 185 byte wfc_activ_bor; /* lcyan on blue */ 186 byte wfc_name; /* yellow on black */ 187 byte wfc_line; /* white on black */ 188 }; 189 190 191 192 /* Typedefs */ 193 194 typedef word zstr; /* Offset of string within area heap */ 195 196 #define CLS_ID 0x8f7c9321L 197 198 #include "uclass.h" 199 #include "max_u.h" /* USER.BBS structure */ 200 #include "option.h" /* Menu option enumeration */ 201 #include "callinfo.h" /* Caller information log */ 202 203 /* An individual menu option. There are many of these contained in one * 204 * _menu file, following the _menu data header, optionally with some * 205 * NULL-terminated strings between each _opt structure, for the argument. */ 206 207 struct _opt 208 { 209 #ifdef __FLAT__ 210 /* force enum to be 16 bits */ 211 word type; 212 #else 213 option type; /* What this menu option does */ 214 #endif 215 216 zstr priv; /* Priv level required to execute this command */ 217 dword rsvd; /* Bit-field locks for this particular menu option */ 218 word flag; /* See the OFLAG_xxx contants for more info. */ 219 zstr name; /* The menu option, as it appears to user */ 220 zstr keypoke; /* Auto-keypoke string */ 221 zstr arg; /* The argument for this menu option */ 222 byte areatype;/* If this particular option can only be used if the user * 223 * is in a certain message-area type. */ 224 byte fill1; /* Reserved by Maximus for future use */ 225 226 byte rsvd2[8]; /* Reserved for future uses */ 227 }; 228 229 #define DEFAULT_OPT_WIDTH 20 230 231 struct _menu 232 { 233 word header, /* What to display when the user enters menu, such as * 234 * "The MESSAGE Section", "The CHG SETUP Section", etc */ 235 num_options, /* Total number of options (struct _opt's) in menu */ 236 menu_length, /* Number of lines long the .?BS menu file is! */ 237 opt_width; /* Option width override */ 238 239 sword hot_colour; /* What colour to display if a user uses hotkeys to * 240 * bypass a .?BS menu display, before displaying the * 241 * key. -1 == display nothing. */ 242 243 word title; /* Length of the title string, not counting \0. */ 244 word headfile; /* Length of the header filename, not counting \0 */ 245 word dspfile; /* Name of file to display for menu, instead of * 246 * generating menu from .Mnu file. */ 247 word flag; /* See MFLAG_XXX in MAX.H. */ 248 }; 249 250 251 252 /* Menu structure used INTERNALLY within Max itself */ 253 254 typedef struct _amenu 255 { 256 struct _menu m; 257 struct _opt *opt; 258 char *menuheap; 259 } AMENU, *PAMENU; 260 261 262 #define MFLAG_MF_NOVICE 0x0001u /* MenuFile for these levels only */ 263 #define MFLAG_MF_REGULAR 0x0002u 264 #define MFLAG_MF_EXPERT 0x0004u 265 #define MFLAG_MF_RIP 0x0400u 266 #define MFLAG_MF_ALL (MFLAG_MF_NOVICE | MFLAG_MF_REGULAR | \ 267 MFLAG_MF_EXPERT /*| MFLAG_MF_HOTFLASH*/) 268 269 #define MFLAG_HF_NOVICE 0x0010u /* HeaderFile for these levels only */ 270 #define MFLAG_HF_REGULAR 0x0020u 271 #define MFLAG_HF_EXPERT 0x0040u 272 #define MFLAG_HF_RIP 0x0800u 273 274 #define MFLAG_HF_ALL (MFLAG_HF_NOVICE | MFLAG_HF_REGULAR | \ 275 MFLAG_HF_EXPERT /*| MFLAG_HF_HOTFLASH*/) 276 277 #define MFLAG_SILENT 0x0100u /* Silent menuheader option */ 278 #define MFLAG_RESET 0x0200u /* Reset term size on display */ 279 280 281 282 283 #define STATS_VER 1 /* Version number of the BBSTATxx.BBS file */ 284 285 struct _bbs_stats 286 { 287 byte version; /* Version number of BBSTATxx.BBS file */ 288 dword num_callers; 289 dword quote_pos; 290 dword msgs_written; 291 time_t online_date; 292 dword total_dl; 293 dword total_ul; 294 sword today_callers; 295 union stamp_combo date; 296 byte lastuser[36]; 297 }; 298 299 300 301 /* Structure for entries in PROTOCOL.MAX */ 302 303 struct _proto 304 { 305 #define P_ISPROTO 0x01 /* This bit always set */ 306 #define P_BATCH 0x02 /* Can handle batch transfers */ 307 #define P_OPUS 0x04 /* Write an Opus-style .CTL file */ 308 #define P_ERL 0x08 /* Exit with xtern_erlvl */ 309 #define P_BI 0x10 /* Bidirectional transfer */ 310 311 word flag; 312 313 char desc[40]; 314 char log[PATHLEN]; 315 char ctl[PATHLEN]; 316 char dlcmd[PATHLEN]; 317 char ulcmd[PATHLEN]; 318 char dlstr[40]; 319 char ulstr[40]; 320 char dlkey[40]; 321 char ulkey[40]; 322 323 word fnamword; 324 word descword; 325 }; 326 327 328 329 #include "prm.h" /* MAX.PRM structure */ 330 #include "newarea.h" 331 332 333 /* IPCxx.BBS header structure */ 334 335 struct _cstat 336 { 337 word avail; 338 339 byte username[36]; 340 byte status[80]; 341 342 #ifndef MCP 343 word msgs_waiting; 344 345 dword next_msgofs; 346 dword new_msgofs; 347 #endif 348 }; 349 350 351 352 /* Data element in IPCxx.BBS file (see MAX_CHAT.C) */ 353 354 struct _cdat 355 { 356 word tid; 357 word type; 358 word len; 359 360 #ifdef MCP 361 word dest_tid; 362 dword rsvd1; 363 #else 364 dword rsvd1; 365 word rsvd2; 366 #endif 367 }; 368 369 /* Handle for saving CHAT status. Mainly used internally, but also * 370 * in RESTARxx.BBS. */ 371 372 struct _css 373 { 374 word avail; 375 byte status[80]; 376 }; 377 378 379 /* NOTE: The following structure is not completely stable. Unless * 380 * rst.rst_ver is equal to RST_VER, then the ONLY items you're guaranteed * 381 * to be able to read are those marked with "*STABLE*". Those items * 382 * are guaranteed to be stored at those offsets for all future versions * 383 * of Maximus, regardless of the version number. However, everything * 384 * else is likely to change at a moment's notice. */ 385 386 struct _restart 387 { 388 byte rst_ver; /* Version number of restart data *STABLE* */ 389 390 sdword timeon; /* Date user got on system, seconds since 1970 *STABLE* */ 391 sdword timeoff; /* Date user must be OFF system, secs since '70 *STABLE* */ 392 sdword restart_offset; /* Offset in .BBS file to restart at *STABLE* */ 393 394 dword baud; /* User's baud rate *STABLE* */ 395 dword max_time; /* Max time, as given by '-t' param *STABLE* */ 396 397 sword port; /* Current COM port, 0=COM1, 1=COM2, *STABLE* */ 398 399 char written_echomail; /* 0=user HASN'T written echomail *STABLE* */ 400 char written_matrix; /* 0=user HASN'T entered matrix msg *STABLE* */ 401 char local; /* 0=NOT local *STABLE* */ 402 403 struct _stamp laston; /* Time the user was last on system *STABLE* */ 404 405 word steady_baud; /* Locked baud rate of user *STABLE* */ 406 407 sdword starttime; /* Start time, for external protocol */ 408 sdword timestart; /* Time when MAX.EXE was started */ 409 sdword ultoday; /* KB's the user has uploaded today */ 410 411 union stamp_combo next_ludate; 412 413 byte restart_type; /* 1 if started via .BBS file, 0 otherwise */ 414 char restart_name[PATHLEN]; /* Name of .BBS file to restart in */ 415 char menupath[PATHLEN]; /* The current menu path */ 416 char firstname[36]; /* The user's first name */ 417 char last_onexit[PATHLEN]; /* The 'onexit' filename for current .BBS file*/ 418 char parm[PATHLEN]; /* Parms for external program, if any */ 419 char fix_menupath[PATHLEN]; /* Readjust menu name */ 420 421 char lastmenu; /* Last ^oR menu choice */ 422 char snoop; /* If snoop is currently on or off */ 423 424 char locked; /* If priv is locked via keyboard 'L' command */ 425 426 char keyboard; /* If the Sysop's keyboard is turned on */ 427 char protocol_letter; /* Letter representing current protocol choice */ 428 429 char chatreq; /* If user wanted to chat with SysOp */ 430 char mn_dirty; /* If menuname buf is dirty */ 431 432 char barricade_ok; /* If current barricade area is OK */ 433 char no_zmodem; /* If zmodem not allowed */ 434 435 sword usr_time; /* User's usr.time value */ 436 sword rsvdxx1; /* reserved for future use */ 437 sword lockpriv; /* If rst.locked (above), then this is real priv */ 438 sword ctltype; /* Control-file type (for xternal protocol) */ 439 440 word current_baud; /* User's baud rate, as a mask for mdm_baud() */ 441 442 /* Bit flags for ECHOTOSS.LOG */ 443 char rsvd[(1296/CHAR_BITS)+1]; 444 char rsvd2[1120]; /* old area data structure */ 445 struct _css css; 446 447 char log_name[80]; 448 449 struct _usr origusr; /* User record as it was at log-on */ 450 451 char event_num; 452 char rsvd3; 453 454 sword last_protocol; 455 long getoff; 456 char returning[PATHLEN]; 457 long steady_baud_l; /* Locked baud rate (as integer) */ 458 SCOMBO date_newfile; /* User's last newfiles date */ 459 }; 460 461 462 /*************************************************************************** 463 Global Variables and Constant Strings 464 ***************************************************************************/ 465 466 #define PROTOCOL_NONE (sword)-1 /* Protocol to use for sending/receiving */ 467 #define PROTOCOL_XMODEM (sword)-2 /* files. If we're using an EXTERNAL */ 468 #define PROTOCOL_YMODEM (sword)-3 /* protocol, `protocol' will have a value */ 469 #define PROTOCOL_XMODEM1K (sword)-4 /* >= 0. */ 470 #define PROTOCOL_SEALINK (sword)-5 471 #define PROTOCOL_ZMODEM (sword)-6 472 #define PROTOCOL_YMODEMG (sword)-7 473 474 #define EXPERT (byte)0x02 475 #define REGULAR (byte)0x04 476 #define NOVICE (byte)0x06 477 478 #endif /* __MAX_H_DEFINED */ 479 480