//------------------------------------------------------------------------
//
//  These are the current record layouts for Magnum BBS version 9.00Cxx
//
//  This file was created for Sysop Information on 01 April 1996
//
//  There are 6 general structure types in this file:
//
//       _keyrec  -- describes   USER.KEY  --    58 bytes / record
//       _user    -- describes   USER.DAT  --  1487 bytes / record
//       _msg     -- describes    MSG.DAT  --   290 bytes / record
//       _fls     -- describes   FILE.DAT  --   183 bytes / record
//       _rje     -- describes    RJE.DAT  --   299 bytes / record
//       _utiliz  -- describes UTILIZ.DAT  --    50 bytes / record
//
//  The structure type for MBBSINIT.x is proprietary and is for
//  Gilmore Systems "internal use only" (not included in this file).
//
//------------------------------------------------------------------------

       // NOTES: - All strings (such as user_lastname, user_city, etc are
       //          used (and stored) as ASCII Zstrings (null terminated). This
       //          also applies to date fields.
       //        - All char fields holding a (1=yes,0=no) are used as boolean
       //          fields. They do not store the character '1' or '0', they
       //          hold a binary 1 (0x01) or binary 0 (0x00).
       //        - All date fields are stored in U.S. date format (MM/DD/YYYY)
       //          and are null terminated. Magnum converts these to European
       //          date format at runtime for I/O purposes but they are
       //          always stored in U.S. format.
       //        - ALWAYS, ALWAYS, ALWAYS COMPILE with the -Zp option (at
       //          least with Microsoft's C compiler). This option tells
       //          the compiler to pack structures. To make a long story
       //          short -- if the structure isn't packed, the compiler will
       //          align every new field on a word boundary (causing the sizeof
       //          the structure to be wrong, and the alignment way off)!

//---------------------------------------------------------------------------
//
// The following structure type defines USER.KEY
//
//---------------------------------------------------------------------------

struct _keyrec {
               char          key_deleted;         // bool (1=deleted,0=active)
               unsigned long key_idnum;
               unsigned char key_lastname[21],
                             key_firstname[21],
                             key_middlename[11];
               };

//---------------------------------------------------------------------------
//
// The following structure type defines USER.DAT
//
//---------------------------------------------------------------------------


struct _user {
             unsigned char  user_deleted;           /* user deleted? 0=no, 1=yes */
             unsigned long  user_idnum;             /* user's id number */
             unsigned char  user_lastname[21],      /* user's last name */
                            user_firstname[21],     /* user's first name */
                            user_middlename[11],    /* user's middle name or initial */
                            user_street1[41],       /* user's street address1 */
                            user_street2[41],       /* user's street address2 */
                            user_city[21],          /* user's city */
                            user_state[21],         /* user's state or province */
                            user_zip[21],           /* user's zipcode or other postal stuff */
                            user_country[21],       /* user's country */
                            user_password[21],      /* user's password */
                            user_frstcall[11],      /* date first called mm/dd/yyyy */
                            user_lastcall[11],      /* date last called */
                            user_timelast[6],       /* time last called (hh:mm) */
                            user_dob[11],           /* user's date of birth */
                            user_phone1[21],        /* user's phone number 1 (ie: home) */
                            user_phone2[21],        /* user's phone number 2 (ie: work) */
                            user_lastnew[26][11],   /* user's last new filesearch */
                            user_cputype[21],       /* user's computer type */
                            user_conferences[26],   /* conferences joined */
                            user_memodate1[11],     /* user's memodate #1 */
                            user_memodate2[11],     /* user's memodate #2 */
                            user_comment[61],       /* sysop comment about user */
                            user_xfertype,          /* user's file xfer default n=none, x=xmodem (all types) */
                            user_periodtype,        /* user's period type (daily, weekly, monthly, yearly) */
                            user_expert,            /* user's expert level (0=full menus, 1=expert level) */
                            user_locked_out,        /* user locked out? 0=no, 1=yes */
                            user_color,             /* ANSI color? 0=no, 1=yes */
                            user_display_more,      /* display more prompt? 0=no, 1=yes */
                            user_erase_more,        /* erase more prompt? 0=no, 1=yes */
                            user_hotkeys,           /* use hotkeys? 0=no, 1=yes */
                            user_lines_page;        /* lines per page */
             short          user_level,             /* user's security level */
                            user_uploads,           /* number of uploads user performed */
                            user_downloads,         /* number of downloads user performed */
                            user_cps,               /* last cps transfer rate */
                            user_uldl_ratio;        /* upload/download ratio */
             unsigned long  user_ttl_calls,         /* user's total number of calls */
                            user_remaining,         /* time remaining this call */
                            user_remaining_period,  /* time remaining for period */
                            user_k_uploads,         /* number of Kbytes user uploaded */
                            user_k_downloads,       /* number of Kbytes user downloaded */
                            user_period_downloads,  /* number of downloads allowed per period */
                            user_period_k_downloads, /* number of Kbytes allowed per period for download */
                            user_downloads_this_period,   /* downloads user performed this period */
                            user_k_downloads_this_period, /* k downloads user performed this period */
                            user_daily_time,        /* daily time limit (mins) allowed for user */
                            user_daily_downloads,   /* daily downloads allowed for user */
                            user_daily_k_downloads; /* daily k downloads allowed for user */
             short          user_baudrate;          /* baudrate of user's last call */
             char           user_ec,                /* error correction: 1=yes, 0=no */
                            user_delmsg,            /* user can delete messages (1=yes, 0=no) */
                            user_privmsg,           /* user can enter private messages (1=yes, 0=no) */
                            user_privacy,           /* 1=privacy on, 0=privacy off (chat btwn nodes) */
                            user_file_u_areas[26],  /* user file upload areas */
                            user_file_d_areas[26],  /* user file download areas */
                            user_file_l_areas[26],  /* user file list areas */
                            user_msg_r_areas[26],   /* user message read areas */
                            user_msg_w_areas[26],   /* user message write areas */
                            user_msg_l_areas[26],   /* user message list areas */
                            user_disp_cmds[26],     /* user display commands */
                            user_last_read[26][13]; /* last message ref# read */
             unsigned char  user_interests[81];     /* List of User's Interests */
             unsigned char  user_compresstype;      /* default compression type (A,Z) Arc/Zip */
             unsigned char  user_lastnewfiles[13];  /* user's last '+' (all areas) new files search date */
             unsigned char  user_endmsg_blank;      /* 1=can end msg entry with nul line, 0=must use /EX */
             unsigned short user_publ_msgs_entered; /* #of public messages entered */
             unsigned short user_priv_msgs_entered; /* #of private messages entered */
             unsigned char  user_dateformat;        /* User Date Format - U=USA (MM/DD/YYYY), E=Europe (DD.MM.YYYY) */
             unsigned char  user_extra;
             unsigned char  user_sub_filedel;       /* Subtract upload credit if user deletes file? 1=yes, 0=no (bool) */
             unsigned char  user_free_dl_areas[26]; /* Free file dl areas (A-Z) not affecting ul/dl ratio (doesn't increment download counter) */
             short          user_free_downloads;    /* number of free downloads user performed */
             short          user_rjejobs;           /* number of RJE jobs user submitted */
             unsigned char  user_sendnulls;         /* # nulls to send after CR */
             unsigned char  user_filelist_pref;     /* FileList Preference (C=Chronological, R=Reverse Chronological, other values ignored */
             unsigned char  user_reuse_id;          /* Reuse ID's? BOOL (1/0) */
             unsigned char  user_msg_group;         /* 0-255 for MSG_xxx.GRP */
             unsigned char  user_file_group;        /* 0-255 for FILE_xxx.GRP */
             unsigned char  user_type;              /* U=USER, M=MAIL */
             unsigned char  user_filebase;          /* Last Filebase */
             unsigned char  user_msgbase;           /* Last MsgBase */
             unsigned char  user_rmail;             /* Use remote mail? (0/1) */
             unsigned char  user_editor_pref;       /* Editor Preference (A=Ansi, L=Line) */
             unsigned char  user_show_extdesc;      /* Show Ext'd File Descriptions (bool) */
             unsigned char  user_use_handle;        /* Use Handle (bool) */
             unsigned char  user_outside_mail;      /* Access to outside mail (bool) */
             unsigned char  user_reserved[6];
             };

//---------------------------------------------------------------------------
//
// The following structure type defines MSG.DAT
//
//---------------------------------------------------------------------------

struct _msg {
            long msg_recnum;     /* database record number (not necessarily msg number) */
            char msg_deleted,    /* 0=msg available, 1=msg deleted */
                 msg_conf,       /* conference of msg (A-Z) */
                 msg_private,    /* 0=msg is public, 1=msg is private */
                 msg_received;   /* 0=msg not received, 1=msg received */
            long msg_from,       /* ID# of who the msg is from (-1L if from MBBS) */
                 msg_to,         /* ID# of who the msg is to (-1L for "ALL") */
                 msg_num,        /* ID Number of original adressee */
                 msg_timesread;  /* number of times msg was read */
            char msg_subject[61], /* subject (needed for thread determination) */
                 msg_date[11],   /* date of msg (mm/dd/yyyy) */
                 msg_time[6],    /* time of msg (hh:mm)      */
                 msg_expdate[11], /* message expiration date (nul or blank if none) */
                 msg_cc,         /* 0=original, 1=this is a carbon copy */
                 msg_fwd,        /* this msg has been forwarded */
                 msg_receipt,    /* 0=no receipt wanted, 1=receipt wanted */
                 msg_replies,    /* 0=no replies, 1=replies have been made */
                 msg_isreply,    /* 0=this is not a reply, 1=this is a reply */
                 msg_recv_date[11], /* date received by msg_to */
                 msg_recv_time[6],  /* time received by msg_to */
                 msg_filename[13]; /* format: CMDDYYMM.MSS all hex no's */
                                   /*  C=Conf  (A-Z)        */
                                   /*  M=Month (1-C)        */
                                   /*  DD=Day  (01-1F)      */
                                   /*  YY=Year (00-FF)   (+1980)   */
                                   /*  MM.M    (000-5A0) ((hrs*60)+mins) */
                                   /*  SS      (00-3B)      */
            unsigned char msg_msgbase;      // MsgBase (0-255)
            unsigned long msg_from_psernum, // Parent Ser# of sender
                          msg_to_psernum;  // Parent Ser# addressee
                     char msg_sent;        // 1=yes,
                                           // 0=no (applies to remote mail
                                           // -1 = sent as store/forward
            unsigned char msg_from_username[53]; // Originating UserName
            unsigned char msg_from_filename[13]; // originating filename
            unsigned char msg_from_msgbase;      // originating msgbase
            unsigned char msg_echo;        // 0=no, 1=echoable to other systems
            unsigned char msg_milc;        // MILC command char (when from_psernum!=cominfo->parent_sernum)
            unsigned char msg_to_username[53];   // Adressee UserName
            unsigned char msg_reserved[10]; // reserved for future expansion
            };

//---------------------------------------------------------------------------
//
// The following structure type defines FILE.DAT
//
//---------------------------------------------------------------------------

struct _fls {
            long fls_recnum;       /* database record number */
            char fls_deleted,      /* 0=file available, 1=file deleted */
                 fls_area,         /* file area (A-Z) */
                 fls_private,      /* file requires password */
                 fls_ul_method,    /* protocol used for upload */
                 fls_name[15],     /* file name */
                 fls_password[11], /* password (if required) */
                 fls_date[11],     /* date uploaded (mm/dd/yyyy) */
                 fls_time[6],      /* time of upload (hh:mm) */
                 fls_expdate[11],  /* file expiration date (nul or blank if none) */
                 fls_brief[81],    /* brief (80-char) description of file */
                 fls_datelast[11]; /* date of last access (mm/dd/yyyy) */
           long  fls_who,          /* ID# of who uploaded the file */
                 fls_desfile,      /* A long, used as bool (1=detailed description exists, 0=no) */
                 fls_size,         /* size of file */
                 fls_dl;           /* number of times file was downloaded */
           unsigned char  fls_filebase;    /* filebase (0-255) */
           unsigned char  fls_cdrom;       /* CD-ROM drive letter (optional) */
           unsigned short fls_pathnum;     /* Pathnum in "CDROMnnn.bc" */
           unsigned char  fls_reserved[9]; /* reserved for future use */
           };

//---------------------------------------------------------------------------
//
// The following structure type defines RJE.DAT
//
//---------------------------------------------------------------------------

struct _rje {
          long   rje_recnum;         // record number (not really used)
          char   rje_deleted,        // boolean 1=deleted, 0=active
                 rje_status,         // status (0=running, 1=complete)
                 rje_name[12],       // Format: MDDYYSSSSS
                 rje_startdate[11],  // date started
                 rje_stopdate[11],   // date stopped
                 rje_expdate[11],    // expiration date (matches expdate in file section)
                 rje_pgmname[112],   // name of program or command being executed
                 rje_parms[112];     // command-line arguments being passed
          long   rje_userid,         // user id of who this entry belongs to
                 rje_starttime,      // time started
                 rje_stoptime,       // time stopped
                 rje_seconds;        // time used (derived from start/stop date/time)
          short  rje_prtyclass,      // priority class of job
                 rje_prtylevel,      // priority level of job
                 rje_completioncode; // miscellaneous (future use for ending result code)
 unsigned short  rje_pid;            // PID of child rje process
          };

//---------------------------------------------------------------------------
//
// The following structure type defines UTILIZ.DAT
//
//---------------------------------------------------------------------------

struct _utiliz {
               char utiliz_comport,       // node used for this record (1,2,...)
                    utiliz_startdate[11], // date this call started (MM/DD/YYYY)
                    utiliz_stopdate[11];  // date this call ended (MM/DD/YYYY)
               long utiliz_starttime,     // time this call started (seconds from midnight)
                    utiliz_stoptime,      // time this call ended (seconds from midnight)
                    utiliz_idnum;         // IDnum of caller
              short utiliz_baudrate,      // baudrate of caller
                    utiliz_level,         // caller's security level
                    utiliz_msgs_read,     // number of msgs read this call by caller
                    utiliz_msgs_written;  // number of msgs entered this call by caller
      unsigned char utiliz_files_ul,      // number of uploads this call by caller
                    utiliz_files_dl,      // number of downloads this call by caller
                    utiliz_rjejobs;       // number of RJE jobs started this call by caller
               long utiliz_serialnum;     // serial number of mbbs or localbbs for this session
               };

