home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 2 BBS / 02-BBS.zip / OP2DEV.ZIP / OS2BBS.H < prev    next >
C/C++ Source or Header  |  1991-07-16  |  32KB  |  739 lines

  1. //
  2. //   OP/2 BBS - Copyright (c) 1990 ExcelSoft Software. All rights reserved.
  3. //
  4. //   OS2BBS.H
  5. //
  6. //   Main header file for BBS and child processes or sessions
  7. //
  8. //    9apr90   cab   Version 1.0 locked
  9. //
  10.  
  11. #ifndef    _OS2BBS_H
  12. #define    _OS2BBS_H
  13.  
  14. #define DEBUG_SYNC
  15.  
  16. #ifdef DEBUG_SYNC
  17.   #define SYNCON(a)      DbaseSync(1,a)
  18.   #define SYNCOFF(a)     DbaseSync(0,a)
  19. #else
  20.   #define SYNCON(a)     
  21.   #define SYNCOFF(a)
  22. #endif
  23.  
  24. #include "os2ver.h"          // version and number of users file
  25.  
  26. #ifndef EXPAN                // shell routines for main bbs only
  27.    #define TRACKER(a,b)      strcpy(UNHAND->cmodule,a);  UNHAND->cline = b;
  28. #endif
  29.  
  30. #define TRUE        1        // some useful on/offs
  31. #define FALSE       0
  32. #define YES         1
  33. #define NO          0
  34.  
  35. #ifndef ON
  36.   #define    ON     1
  37. #endif
  38. #ifndef OFF
  39.   #define    OFF    0
  40. #endif
  41. #define MAXINST     3          // maximum number of instances of the program
  42.  
  43. #ifndef OS_INCLUDED
  44.    #define  BYTE   unsigned char
  45.    #define  ULONG  unsigned long
  46.    #define  USHORT unsigned short
  47.    #define  SHORT  short
  48.    #define  UCHAR  unsigned char
  49.    #define  CHAR   char
  50. #endif
  51.  
  52. #ifdef EXPAN
  53.   #define   LOGGED_IN   ( SerConnected(unhand) && UseTm(unhand) && V_USRON )
  54.   #define   LoggedIn()  ( SerConnected(unhand) && UseTm(unhand) && V_USRON )
  55. #else
  56.   #define   LOGGED_IN   ( SerConnected(UNHAND) && UseTm(UNHAND) && V_USRON )
  57.   #define   LoggedIn()  ( SerConnected(UNHAND) && UseTm(UNHAND) && V_USRON )
  58. #endif
  59. #define Forgotten(a,b)     (uurdbit(a,b->uforget))
  60.  
  61. //
  62. //  Index into lmodemcode[] array for modem results
  63. //
  64. #define OK         0
  65. #define RING       1
  66. #define CNT300     2
  67. #define ARQ300     3
  68. #define CNT1200    4
  69. #define ARQ1200    5
  70. #define CNT2400    6
  71. #define ARQ2400    7
  72. #define CNT4800    8
  73. #define ARQ4800    9
  74. #define CNT9600    10
  75. #define ARQ9600    11
  76.  
  77. #define NUM_TERMS   2             /* number of terminal types available */
  78. #define NONE        0             /* dumb terminal */
  79. #define ANSI        1             /* ANSI standard terminal */
  80.  
  81. typedef struct {
  82.    CHAR   tname[6];               /* terminal name */
  83.    SHORT  tnum;                   /* terminal number code */
  84.    SHORT  tcolor;                 /* has color capability */
  85.    SHORT  tcursor;                /* has cursor movement */
  86. } t_types;
  87.  
  88. #ifdef EXPAN
  89.  #define COLOR(a)   if(PU->u_ttype) TrmColor(a,unhand);
  90. #else
  91.  #define COLOR(a)   if(PU->u_ttype) TrmColor(a,UNHAND);
  92. #endif 
  93.  
  94. // Attributes and colors:
  95. #define ALLOFF      0
  96. #define BRIGHT      1
  97. #define RED         31
  98. #define GREEN       32
  99. #define YELLOW      33
  100. #define BLUE        34
  101. #define MAGENTA     35
  102. #define CYAN        36
  103. #define WHITE       37
  104.  
  105. #define BRRED         (31+64)
  106. #define BRGREEN       (32+64)
  107. #define BRYELLOW      (33+64)
  108. #define BRBLUE        (34+64)
  109. #define BRMAGENTA     (35+64)
  110. #define BRCYAN        (36+64)
  111. #define BRWHITE       (37+64)
  112.  
  113. #define BACKBLACK     (0x2800)
  114. #define BACKRED       (0x2900)
  115. #define BACKGREEN     (0x2A00)
  116. #define BACKYELLOW    (0x2B00)
  117. #define BACKBLUE      (0x2C00)
  118. #define BACKMAGENTA   (0x2D00)
  119. #define BACKCYAN      (0x2E00)
  120. #define BACKWHITE     (0x2F00)
  121.  
  122. // Priority Values
  123. #define  VERY_LOW    0           /* priorities */
  124. #define  LOW         1
  125. #define  MEDIUM      2
  126. #define  HIGH        3
  127. #define  VERY_HIGH   4
  128.  
  129. typedef struct {
  130.    CHAR           lname[10];      // port name, i.e. COM1, COM2
  131.    CHAR           linit[30];      // string to initalize port
  132.    CHAR           lans[10];       // modem answer string
  133.    USHORT         lmodemcode[12]; // Return codes, array elements:
  134.                                   // 0= Okay,          1=Ring,
  135.                                   // 2= Cnct 300 bps,  3= Cnct 300 ARQ
  136.                                   // 4= Cnct 1200 bps, 5= Cnct 1200 bps ARQ
  137.                                   // 6= Cnct 2400 bps, 7= Cnct 2400 bps ARQ
  138.                                   // 8= Cnct 4800 bps, 9= Cnct 4800 bps ARQ
  139.                                   // 10=Cnct 9600 bps, 11=Cnct 9600 bps ARQ
  140.                                   //   Note: ARQ=Error Correcting
  141.    USHORT         lon;            // is this port even on or what?
  142.    USHORT         luptime;        // time this port goes up (not currently used)
  143.    USHORT         ldntime;        // time this port goes down (not currently used)
  144.    USHORT         ldte;           // DTE either 'FIXED' or 'NORMAL'
  145.    USHORT         lrfc;           // receiving flow control
  146.    USHORT         ltfc;           // transmitting flow control
  147.    USHORT         lspeed;         // maximum speed, i.e. 2400
  148.    USHORT         ldbits;         // data bits
  149.    USHORT         lparity;        // parity
  150.    USHORT         lstop;          // stop bits
  151.    USHORT         ldumbterm;      // line is a terminal
  152.    CHAR           lEXPAND[80];    // expansion
  153. } LINECTL;
  154.  
  155.  
  156. typedef struct {
  157.    LONG       xcalls;
  158.    LONG       xlastcall;
  159.    USHORT     xcallstoday;
  160.    USHORT     xuser;              // next user number
  161. } VARCONFIG;
  162.  
  163.  
  164. typedef struct {                  // structure for audit call log
  165.    CHAR   cl_user[14];            // users name
  166.    BYTE   cl_port;
  167.    ULONG  cl_intime;              // time logged in
  168.    ULONG  cl_outtime;             // time logged out
  169.    SHORT  cl_emailwrite;          // mins online
  170.    BYTE   cl_sex;
  171.    BYTE   cl_age;
  172.    BYTE   cl_messwrite;           // messages left while online
  173.    SHORT  cl_messread;            // messages read while online
  174.    BYTE   cl_fldown;              // files downloaded while online
  175.    BYTE   cl_flup;                // files uploaded while online
  176. } CALLLOG;
  177.  
  178. #ifdef STACKSIZE
  179.   #undef STACKSIZE
  180. #endif
  181. #define STACKSIZE    8192         // BIG stack size for each thread
  182. #define ASYNCSTK     4096         // stack for async thread
  183. #define CBUF          128         // communictions input buffer
  184. #define KEYBUFSIZE     64         // console input buffer size
  185. #define EMAIL           0         // email is always section 0
  186. #define FREEZE_PORT    99
  187. #define GODLEVEL       99         // ultimate sysop level
  188. #define MAXPAGE         6         // maximum waiting pages per user
  189. #define PGSIZE        160
  190. #define NEWUSERLEV      1
  191. #define TCLNLEN       135         // teleconf line length
  192. #define UN            usernum
  193. #define UNHAND        (bport+usernum)   // usernumber record handle
  194. #define DEMO_NUM      9999
  195. #ifdef EXPAN
  196.    #define CREGCOL    (unhand->gis->gisInputColor)
  197. #else
  198.    #define CREGCOL    (syscon.cregcol)
  199. #endif
  200. #define MAXFORUM      100
  201. #define MAXCMD         80         // maximum waiting command buffer size 
  202.  
  203. // Page types
  204. #define PAGE_SYSOP      1
  205. #define PAGE_SYSTEM     2
  206. #define PAGE_REGULAR    3
  207. #define PAGE_CHAT       4
  208. #define PAGE_LOGIN      5
  209. #define PAGE_LOGOUT     6
  210. #define PAGE_MAIL       7
  211. #define PAGE_SYSOPALL   8
  212. #define PAGE_BIGBEN     9
  213.  
  214. // Page return codes
  215. #define PERR_OK         0     // page sent okay
  216. #define PERR_FULL       1     // page buffer full
  217. #define PERR_FORGET     2     // paging user has been forgotten
  218. #define PERR_MISCERR    3     // unknown error. Probably no user on line
  219.  
  220. // Time out flags
  221. #define WARN_TMOUT    300
  222. #define KILL_TMOUT    500
  223. #define DEF_TIMEOUT  1500
  224.  
  225.                                   // defines to determin access
  226. #define   MSEE     1
  227. #define   MREAD    2
  228. #define   MWRITE   3
  229. #define   MSYSOP   4
  230.  
  231. #define   FSEE     5
  232. #define   FLIST    6
  233. #define   FDL      7
  234. #define   FUL      8
  235.  
  236. typedef struct {
  237.    USHORT     m_see    : 1;     // can 'view'
  238.    USHORT     m_rd     : 1;     // can read
  239.    USHORT     m_wt     : 1;     // has write privilage
  240.    USHORT     m_sysop  : 1;     // sysop access to this area
  241.    USHORT     m_qscan  : 1;     // flag for quick scan this area
  242.    USHORT     m_lock   : 1;     // locks access levels for this user     
  243.    USHORT     m_exp    : 10;    // expansion
  244. } MA_REC;                       // message access record 
  245.  
  246.  
  247. typedef struct {
  248.    USHORT   f_see    : 1;
  249.    USHORT   f_list   : 1;
  250.    USHORT   f_dload  : 1;
  251.    USHORT   f_upload : 1;
  252.    USHORT   f_sysop  : 1;
  253.    USHORT   f_qscan  : 1;
  254.    USHORT   f_exp    : 10;      // expansion
  255. } FL_REC;
  256.  
  257. typedef struct {
  258.    SHORT    lforumon;           // is the forum active at all?
  259.    CHAR     lcode[2];           //
  260.    SHORT    lanon;              // anonymous messages allowed
  261.    LONG     lcreate;            // forum creation date
  262.    SHORT    lup;                // uploads go directly to download directory */
  263.    SHORT    lmess_on;           // message section turned on
  264.    SHORT    lfile_on;           // file system turned on
  265.    SHORT    laccess;            // level to have default access to this section */
  266.    SHORT    llowaccess;
  267.    SHORT    lkey;
  268.    SHORT    llowkey;
  269.    CHAR     lkeyflag;
  270.    CHAR     llowkeyflag;
  271.    FL_REC   ldef_fl;            // default file access for this forum
  272.    MA_REC   ldef_ma;            // default message access for this forum 
  273.    FL_REC   llow_fl;            // low level file access for this forum
  274.    MA_REC   llow_ma;            // low level message access for this forum
  275.    CHAR     lmod[14];           // conference moderator */
  276.    CHAR     lname[30];          // name of section */
  277.    CHAR     lpath[30];          // path for files... */
  278.    SHORT    lfileraw;           // Raw file system flag, no data base kept.
  279.    USHORT   lmaxmsg;            // Maximum messages for this forum
  280.    USHORT   lautopack;          // Autopack these messages on startup?
  281.    USHORT   lpackwedge;         // Number of message sockets to free beyond packed
  282.    CHAR     lexpand[12];
  283. } SECSETUP;
  284.  
  285. // structure for commands used to trigger a "global action"
  286. typedef struct {
  287.    CHAR  cmdstr[15][10];
  288. } GLOBCMDS;
  289.  
  290. typedef struct {
  291.    LONG      cserialnum;            // system serial number 
  292.    CHAR      cnewuserpw[10];        // password to join system
  293.    SHORT     cclosed;               // flag for closed system, need cnewuserpw to get in
  294.    CHAR      cbbsname[40];          // 1 BBS Name
  295.    CHAR      csysop[20];            // 1 sysop name
  296.    CHAR      cphone[20];            // 1 system phone number
  297.    CHAR      cperpath[30];          // 1 'personal' files path
  298.    CHAR      clogname[30];          // usage log file name and path
  299.    SHORT     cregcol;               // normal menu/system color
  300.  
  301.    CHAR      EXPAND1[12];           // expansion
  302.    ULONG     cnwkey;                // 2 new user stuff, keys... 
  303.    SHORT     cnwaccess;             // 2 new user access level (1-100)
  304.    SHORT     cshowmail;             // code 1 for email only, 2 for all mail
  305.    SHORT     creadmail;             // sysop func: level needed to read private mail
  306.    SHORT     clogmail;              // set to log public messages to disk.
  307.    SHORT     cmodusr;               // sysop func: level needed to modify users
  308.  
  309.    CHAR      EXPAND2[2];
  310.    USHORT    csysopin;              // 1 sysop start avail time
  311.    USHORT    csysopout;             // 1 sysop out time 
  312.  
  313.    MA_REC    cmdef;                 // default access for message areas 
  314.    FL_REC    cfdef;                 // default access for file areas 
  315.    SHORT     cactsec;               // active sections (file, message) 
  316.    SECSETUP  csec[100];             // message/file system array of access levels 
  317.    USHORT    cdaytm[100];           // 2 default time per day for each level 
  318.    USHORT    cmontm[100];           // 2 time per month for each level
  319.  
  320.    SHORT     cdlratio;              // 2 download to upload ratio
  321.    SHORT     culratio;              // number of uploads required per cdlratio
  322.    ULONG     cbytesdl;              // number of bytes in DL equation
  323.    ULONG     cbytesul;              // number of upload bytes in equation
  324.    SHORT     cdlmethod;             // method of dl ratio calc, number or bytes
  325.    ULONG     csavespace;            // 1 space to save in upload directory/drives
  326.  
  327.    SHORT     su_name;               // * if these are set, ignore these fields on signup
  328.    SHORT     su_address;
  329.    SHORT     su_citystatezip;
  330.    SHORT     su_phone;
  331.    SHORT     su_company;
  332.    SHORT     su_sex;
  333.    SHORT     su_age;
  334.    SHORT     su_lines;
  335.    SHORT     su_ttype;
  336.    SHORT     su_expert;
  337.    SHORT     su_macro1;
  338.    SHORT     su_macro2;
  339.  
  340.    SHORT     cauditsuppress;       // suppress auditing
  341.    SHORT     cautospy;             // 1
  342.    CHAR      cmesspath[40];
  343.    CHAR      cusrpath[40];
  344.    USHORT    ctmpercall[100];      // time per call
  345.    SHORT     cbillcode;            // 0=call per day, 1=per month
  346.    SHORT     cnewmesstype;         // 0 for number, 1 for date
  347.    SHORT     cglobcmd;             // 0 to allow, 1 to prohibit
  348.    GLOBCMDS  cglobs;               // global commands
  349.    SHORT     ccallgap;             // minutes user must wait between calls
  350.    SHORT     cverlevel;            // level at which user is considered "verified"
  351.    SHORT     cinetmail;            // allow internet mail
  352.    CHAR      EXPAND3[542];         // temporary expanstion holding
  353. } SYSCONFIG;
  354.  
  355.  
  356. //
  357. //  Token for system and user pages 
  358. //
  359. typedef struct {
  360.    SHORT  pwait;           // page active and waiting!
  361.    CHAR   pfrom[14];       // from what user
  362.    SHORT  pfromln;         // from user on what line
  363.    SHORT  pmaskable;       // is this page maskable (turn off pages to ignore)
  364.    SHORT  pgtype;          // System page, rather then a user page 
  365.    LONG   ptm;             // time of this page
  366.    CHAR   *ptext;          // text for this page
  367. } PAGETOK;
  368.  
  369.  
  370. //
  371. //   Tokens for teleconferencing
  372. //
  373. typedef struct {                  // token for each message passed
  374.    SHORT  tunum;                  // user number of originator
  375.    SHORT  tsystem;                // expansion - system message is from
  376.    SHORT  tprivate;               // if private, to whome. -1 if to all
  377.    SHORT  tmessage;               // general message.. i.e. so and so just left
  378.    UCHAR  tanon;                  // message anonymous
  379.    CHAR   tfrom[14];              // who the token is from
  380.    CHAR   ttext[TCLNLEN];         // token text
  381. } MESSTOK;
  382.  
  383. #define MAX_REPLIES 20
  384.  
  385. //
  386. //  Message header record
  387. //
  388. typedef struct {                    // structure for message header
  389.     ULONG          mnum;            // message number
  390.     USHORT         mbase;           // message base number for this message
  391.     CHAR           mto[14];         // name of receiver
  392.     USHORT         mtoid;           // id of receiver
  393.     CHAR           mfrom[14];       // name of sender
  394.     USHORT         mfromid;         // id of sender
  395.     CHAR           msubject[26];    // subject
  396.     CHAR           mattach[16];     // file name given to the user
  397.     CHAR           mfname[14];      // file name used by file system
  398.     LONG           mattsize;        // file size of attached file
  399.                                     //
  400.     LONG           mdate;           // date and time of message
  401.     LONG           mdaterec;        // date received
  402.     USHORT         mreceive;        // recieved by receivee
  403.     USHORT         mdel;            // true if been deleted
  404.                                     //
  405.     ULONG          mreply[MAX_REPLIES];  // messages replied to this one
  406.     USHORT         mnumreply;       // number of replies
  407.     ULONG          mwasreply;       // message number this was a reply to
  408.     CHAR           mforto[14];      // Forwarded message origionally to mforto
  409.     LONG           mfordate;        // date the message was forwarded
  410.     CHAR           mtocc[14];       // if cc, who was it to origionally
  411.     USHORT         msysid;          // system id of author system. 0 for local
  412.     USHORT         mtoanon;         // hide the recipiant?
  413.     USHORT         manon;           // true if this message is annonymous
  414.     LONG           mstart;          // fpos for start of messege
  415.     USHORT         mlines;          // number of lines to read
  416.     USHORT         mbytes;          // byte count for text portion
  417.     ULONG          mseq;            // sequence of message in history         
  418.     ULONG          mlocseq;         // sequence of message, starting at 1
  419.     CHAR           minet;           // internet flag
  420.     UCHAR          msysfrom[31];    // system name message is from
  421.     CHAR           expand[30];
  422. } MESSREC; 
  423. #define _MESSREC_DEF
  424.  
  425. //
  426. //  Library header record
  427. //
  428. typedef struct {
  429.    CHAR  fname[14];         // file name
  430.    LONG  fdate;             // the file date (entered)
  431.    LONG  fsize;             // file size
  432.    CHAR  fsdesc[50];        // the file's short description
  433.    SHORT fverified;         // if file is verified for publc access
  434.                             // 
  435.    LONG  fldescptr;         // the location of the long desc in text file
  436.    SHORT fldescsz;          // the size of the long description
  437.    SHORT faccess;           // number of times this file accessed
  438.    LONG  flastacc;          // date/time of last access
  439.    CHAR  fcontrib[13];      // contributer
  440.    CHAR  fdel;              // delete flag
  441. } LIBREC;
  442. #define _LIBREC_DEF
  443.  
  444. //
  445. //  User record
  446. //
  447. typedef struct {
  448.     CHAR       u_handle[14];      // handle, limited to 12 actual chars.
  449.     CHAR       u_pword[16];       // password
  450.     BYTE       u_age;             // age
  451.     BYTE       u_sex;             // 0=female, 1=male
  452.     CHAR       u_fname[14];       // first name
  453.     CHAR       u_lname[14];       // last name
  454.     CHAR       u_computer[10];    // computer type
  455.     CHAR       u_address[30];     // street address
  456.     CHAR       u_city[16];        // city
  457.     CHAR       u_state[4];        // state
  458.     CHAR       u_zip[6];          // zipcode
  459.     CHAR       u_phone[14];       // telephone  xxx4 xxxxxxx8
  460.                                   // ACCESS INFORMATION 
  461.     USHORT     u_time_day;        // time allowed per day 
  462.     USHORT     u_time_month;      // time allowed per month 
  463.     BYTE       u_deleted;         // user active? 
  464.     BYTE       u_access;          // user access level 
  465.     ULONG      u_keys;            // 32 user keys 
  466.                                   // CONFIGURATION 
  467.     BYTE       u_lf;              // need linefeeds? 
  468.     BYTE       u_expert;          // expert mode 
  469.     BYTE       u_ttype;           // terminal type, 0=nonansi, 1=ansi
  470.     BYTE       u_rows;            // rows on his screen 
  471.     BYTE       u_cols;            // columns on his screen 
  472.     BYTE       u_FILLER;          // to balance uneven bytes 
  473.                                   // USAGE STATISTICS 
  474.     USHORT     u_day_use;         // min used today 
  475.     USHORT     u_mon_use;         // min used this month 
  476.     LONG       u_last_use;        // time of last login 
  477.     ULONG      u_total_use;       // total min online ever 
  478.     USHORT     u_mtd_logins;      // month to date logins 
  479.     USHORT     u_logins;          // total times logged in 
  480.     USHORT     u_uploads;         // number of uploads total 
  481.     USHORT     u_downloads;       // number of downloads total 
  482.     ULONG      u_ulsize;          // bytes of uploaded material 
  483.     ULONG      u_dlsize;          // bytes of downloaded material 
  484.                                   // MESSAGE BASE AND FILE INFO 
  485.     FL_REC     u_file[MAXFORUM];  // 2 bytes for each file section 
  486.     MA_REC     u_mess[MAXFORUM];  // 2 Byte each, info for each message base 
  487.  
  488.     LONG       u_luse[MAXFORUM];  // time/date last used each forum 
  489.     SHORT      u_lastforum;       // last forum used 
  490.     USHORT     u_sentmess;        // number of messages sent 
  491.     ULONG      u_firstlogin;      // first login
  492.  
  493.     SHORT      u_fpindex;         // File system preference, index (name or date)
  494.     SHORT      u_fpsort;          // File system preference, direction (ascending, descending)
  495.     SHORT      u_ful;             // default upload protocol
  496.     SHORT      u_fdl;             // default download protocol
  497.  
  498.     CHAR       u_country[20];     // users country, if not USA
  499.     SHORT      u_desc;            // short or very short file description default
  500.     USHORT     u_sentemail;       // number of email messages sent
  501.     CHAR       u_macro1[20];      // user macro 1
  502.     CHAR       u_macro2[20];      // user macro 2
  503.     CHAR       u_startup[20];     // macro run on startup
  504.     CHAR       u_company[16];     // users company
  505.     BYTE       u_NoTcEcho;        // Turn on to suppress TC echo
  506.     SHORT      u_fShowLogins : 1; // Flag to show users logging in
  507.     SHORT      u_fShowLogouts : 1;// Flag to show users logging out
  508.     SHORT      u_fBigBen : 1;     // Big ben chimer on
  509.     SHORT      u_fSoundOff : 1;   // True if sound is off
  510.     SHORT      u_fNoLnNum : 1;    // true if suppress line numbers
  511.     SHORT      u_fClear : 1;      // Clear screen between messages
  512.     SHORT      u_fSkipFromYou : 1;// Skip messages address FROM you
  513.     SHORT      u_fEXPAND : 9;     // Expansion flags
  514.     SHORT      u_resuread;        // number of times your resume has been read
  515.     ULONG      u_LastLogOff;      // last time the user logged off the system
  516.     CHAR       u_EXPAND2[15];     // expansion
  517.  
  518.     ULONG      u_LastRead[MAXFORUM];
  519.     USHORT     u_MessScan[16];    // 256 bits. New-scan bit maps
  520.     USHORT     u_FileScan[16];
  521.     USHORT     u_MessWait[16];    // 1 bit/forum for messages waiting
  522.     CHAR       u_EXPAND3[428];
  523. } USER_REC;
  524. #define _USER_REC_DEF
  525.  
  526. //
  527. //  For Mux Semaphores
  528. //
  529. typedef struct {             // structure for Mux of Sems for input read
  530.    USHORT          SemCount; // number of semephores
  531.    USHORT          res1;     // reserved word 1, must be 0
  532.    USHORT   _far   *ps1;     // pointer to semephore 1
  533.    USHORT          res2;     // reserved word 2, must be 0
  534.    USHORT   _far   *ps2;     // pointer to semaphore number 2
  535.    USHORT          res3;     // reserved word 3, must be 0
  536.    USHORT   _far   *ps3;     // pointer to semaphore 3
  537. } MuxList;       
  538.  
  539.  
  540. //
  541. //  System wide data block
  542. //
  543. typedef struct {
  544.    ULONG     ScreenOk;              // Screen write semephore
  545.    ULONG     gisPages;              // Pages on the system since startup
  546.    USHORT    gisMaxusers;           // Max users for the system
  547.    USHORT    gisLogins;             // Logins since system startup
  548.    USHORT    gisInUse;              // Ports in use
  549.    USHORT    gisMessages;           // Messages sent
  550.    SHORT     gisInputColor;         // color used for for text input
  551.    SHORT     gisGlobCmd;            // 0 or 1 to deny or allow global commands
  552.    BYTE      gisBillCode;           // Same as syscon.billcode
  553.    GLOBCMDS  gisGlobs;              // Global command strings
  554.    SHORT     gisVerLevel;           // same as syscon.cverlevel
  555.    CHAR      EXPAND1[347];          // expansion
  556. } GLOBALBLOCK;
  557.  
  558.  
  559. //
  560. //  Main System Control Structure
  561. //
  562. typedef struct {
  563.    SHORT     recnum;           // VITAL, key to DLL use 
  564.                                // FLOW CONTROL FLAGS 
  565.    SHORT     v_local;          // console user 
  566.    SHORT     v_spy;            // console sees output and can enter input 
  567.    SHORT     v_commact;        // com port active 
  568.    SHORT     v_usron;          // flag for user online 
  569.    SHORT     v_chat;           // sysop chat flag    
  570.    SHORT     v_reset;          // reset modem flag
  571.    SHORT     v_offhook;        // taking phone off the hook...
  572.                                // Menu system flags
  573.    SHORT     v_quit;           // Quit current menu flag
  574.    SHORT     v_showmenu;       // redisplay current menu
  575.  
  576.                                // TIME VARS 
  577.    LONG      t_login;          // login time 
  578.    LONG      t_credit;         // sec credited (i.e. sysop chat) 
  579.    LONG      t_offby;          // time in seconds user must be logged off by this call 
  580.                                // USER PAGES 
  581.  
  582.    PAGETOK   PgBuff[MAXPAGE];
  583.    SHORT     PgWait;           // page waiting flag 
  584.    ULONG     PgSem;            // to block read/write pages 
  585.    LONG      PgLastTm;         // time of last page 
  586.                                // USER RECORD 
  587.    USER_REC  *p_user;          // pointer to user information, this port 
  588.    LINECTL   lnctl;            // Line control information 
  589.    SHORT     inviso;           // flag for if this user is invisable
  590.    USHORT    nolog : 1;        // do NOT enter this login in the recent callers log
  591.    USHORT    sysopflag:1;      // Flag user as being a sysop
  592.    USHORT    limitcall:1;      // indicates that this call limited by "time per call", rather then time per "day/month"
  593.    USHORT    castoff:1;        // "Cast off" incomming pages
  594.    USHORT    FLAGEXP:12;       // expansion flags
  595.  
  596.    SHORT     remspyusr;        // Remote spy user, -1 if none
  597.    ULONG     remspysem;        // Remote spy semaphore
  598.    void      *remspyptr;       // PORT_REC pointer of spying user
  599.    BYTE      remspyno;         // Locks out remote spy'ers
  600.  
  601.    CHAR      cmodule[14];      // Debugging
  602.    SHORT     cline;            // Debugging
  603.    
  604.    USHORT    uforget[8];       // 16 byte bit field for users forgotten
  605.    SHORT     ConSecCR;         // consecutive CR/LF sequences sent
  606.    CHAR      ReadStop;         // Flag and clear AbortRead to end a getline
  607.    SHORT     linkrate;         // speed of serial link, can be diff. then bps 
  608.    SHORT     bps;              // bits per second connection rate 
  609.    SHORT     loc;              // location of user on the system 
  610.    SHORT     subloc;           // sublocation.. as in teleconf, room 2 
  611.    USHORT    comtok;           // communications token/handle 
  612.    SHORT     *ncin;            // next com port char in 
  613.    SHORT     *ncout;           // next com port char out 
  614.    SHORT     cbuff[CBUF];      // Com port input ring buffer    
  615.    SHORT     acharin;          // number of chars in the buffer 
  616.    SHORT     lcount;           // current screen line number for output 
  617.    SHORT     lcounton;         // are we checking line counts? 
  618.    ULONG     ReadOk;           // semaphore for okay to read from com port 
  619.    ULONG     KbdIn;            // keyboard input ready semaphore 
  620.    ULONG     AsyncIn;          // Async Input ready semephore 
  621.    ULONG     AbortRead;        // abort read semaphore 
  622.    MuxList   muxs;             // structure for Mux'd above 3 sems 
  623.    ULONG     KeyinBlock;     
  624.    CHAR      keybuff[KEYBUFSIZE];
  625.    CHAR      *keyin;     
  626.    CHAR      *keyout;     
  627.    SHORT     keywait;     
  628.    //////////////////////////// Command buffering 
  629.    CHAR      cmdbuf[MAXCMD]; // waiting command string buffer
  630.    SHORT     cmdwait;        // More commands waiting??
  631.    CHAR      *cmdpoint;      // pointer to next break in cmdbuf 
  632.    //////////////////////////// Btree vars, userbase and message base 
  633.    SHORT     usr_db;         // data base handle for user log
  634.    SHORT     usr_idx;        // index handle for user log    
  635.    //////////////////////////// TELECONFERENCING 
  636.    MESSTOK   *mtok;          // pointer to next text in teleconf
  637.    SHORT     invite;         // room currently invited to join
  638.    ULONG     chatok;         // semephore set while in chat.
  639.    SHORT     chatreq;        // request chat with this user...
  640.    SHORT     chatack;        // chat ack
  641.    USHORT    teleeject : 1;  // eject flag
  642.    USHORT    TEXPAN : 15;    // expansion teleconf flags
  643.  
  644.    SHORT     threadprty;     // thread priority, 1-5
  645.    USHORT    threadid;       // thread id of processing thread
  646.    USHORT    comthrdid;      // thread id of communications thread
  647.    SHORT     curcolor;       // current displayed color
  648.    SHORT     arqconnect;     // connect with error correcting modem
  649.    USHORT    childpid;       // ID for child process for this user
  650.    USHORT    sessionpid;     // Session ID for this child
  651.    GLOBALBLOCK *gis;         // pointer to global block information
  652.    USHORT    SecReq;         // section (file or message) requester
  653.  
  654.    SHORT     TmOuts;         // Number of timeout warnings accumulated
  655.    ULONG     LastInput;      // Time of last user keystroke
  656.    USHORT    LastCmd[2];     // Last MCF ordinal number and type
  657.    BYTE      LogoffWarn;     // Warning level before time limit logoff
  658.    BYTE      DebugCode;      // Flag used for debugging purposes
  659.    BYTE      billcode;       // the syscon billing code used
  660.    ULONG     ChatZeroChar;   // Special semaphore for private chat
  661.    CHAR      locstr[26];     // location on the system
  662.    CHAR      EXPAND2[43];    // 'quick expanstion' space
  663. } PORT_REC;
  664.  
  665.  
  666. #ifdef EXPAN                   // Use for DLL and expansion APPs
  667. #define USENUM     unhand->recnum
  668. #define PU         unhand->p_user
  669. #define V_LOCAL    unhand->v_local
  670. #define V_SPY      unhand->v_spy
  671. #define V_COMMACT  unhand->v_commact
  672. #define V_USRON    unhand->v_usron
  673. #define V_CHAT     unhand->v_chat
  674. #define V_RESET    unhand->v_reset
  675. #define V_OFFHOOK  unhand->v_offhook
  676. #define V_QUIT     unhand->v_quit
  677. #define V_SHOWMENU unhand->v_showmenu
  678. #define INVISO     unhand->inviso
  679. #define NOLOG      unhand->nolog
  680. #define USR_DB     unhand->usr_db
  681. #define USR_IDX    unhand->usr_idx
  682. #define P_USER     unhand->p_user
  683. #define T_LOGIN    unhand->t_login
  684. #define T_OFFBY    unhand->t_offby
  685. #define T_CREDIT   unhand->t_credit
  686. #define COMTOK     unhand->comtok
  687. #define CMDWAIT    unhand->cmdwait
  688. #define LCOUNT     unhand->lcount
  689. #define LCOUNTON   unhand->lcounton
  690. #define CURCOLOR   unhand->curcolor
  691. #define ARQCONNECT unhand->arqconnect
  692. #define SESSIONPID unhand->sessionpid
  693. #define CHILDPID   unhand->childpid
  694. #define GIS        unhand->gis
  695. #define SECREQ     unhand->SecReq
  696. #define REMSPYUSR  unhand->remspyusr
  697. #define REMSPYSEM  unhand->remspysem
  698. #define REMSPYPTR  unhand->remspyptr
  699. #define REMSPYNO   unhand->remspyno
  700. #else                                  // Used in main BBS code
  701. #define USENUM     (bport+usernum)->recnum
  702. #define PU         (bport+usernum)->p_user
  703. #define V_LOCAL    (bport+usernum)->v_local
  704. #define V_SPY      (bport+usernum)->v_spy
  705. #define V_COMMACT  (bport+usernum)->v_commact
  706. #define V_USRON    (bport+usernum)->v_usron
  707. #define V_CHAT     (bport+usernum)->v_chat
  708. #define V_RESET    (bport+usernum)->v_reset
  709. #define V_OFFHOOK  (bport+usernum)->v_offhook
  710. #define V_QUIT     (bport+usernum)->v_quit
  711. #define V_SHOWMENU (bport+usernum)->v_showmenu
  712. #define INVISO     (bport+usernum)->inviso
  713. #define NOLOG      (bport+usernum)->nolog
  714. #define USR_DB     (bport+usernum)->usr_db
  715. #define USR_IDX    (bport+usernum)->usr_idx
  716. #define P_USER     (bport+usernum)->p_user
  717. #define T_LOGIN    (bport+usernum)->t_login
  718. #define T_OFFBY    (bport+usernum)->t_offby
  719. #define T_CREDIT   (bport+usernum)->t_credit
  720. #define COMTOK     (bport+usernum)->comtok
  721. #define CMDWAIT    (bport+usernum)->cmdwait
  722. #define LCOUNT     (bport+usernum)->lcount
  723. #define LCOUNTON   (bport+usernum)->lcounton
  724. #define CURCOLOR   (bport+usernum)->curcolor
  725. #define MODEMCODE  ((bport+usernum)->lnctl.lmodemcode)
  726. #define ARQCONNECT (bport+usernum)->arqconnect
  727. #define SESSIONPID (bport+usernum)->sessionpid
  728. #define CHILDPID   (bport+usernum)->childpid
  729. #define GIS        (bport+usernum)->gis
  730. #define SECREQ     (bport+usernum)->SecReq
  731. #define REMSPYUSR  ((bport+usernum)->remspyusr)
  732. #define REMSPYSEM  ((bport+usernum)->remspysem)
  733. #define REMSPYPTR  ((bport+usernum)->remspyptr)
  734. #define REMSPYNO   ((bport+usernum)->remspyno)
  735. #endif
  736.  
  737. #endif
  738.  
  739.