/*
 *             Standard BBS-PC! headers (with a few modifications)
 *
 *             Important note: This header file cannot be precompiled with
 *             Lattice C V5.02, because of a bug which prevents bit fields
 *             from working properly when they are precompiled.
 */

/* Official Micro-Systems Software Structures */

#define NUM_TERM       10              /* Number of computer types             */
#define NUM_SECT       16              /* Number of section names              */

#define CAT_LEN                15              /* File catalogue name lengths  */
#define DESC_LEN       40              /* File catalogue desc length   */
#define        FNAME_LEN       12              /* File name lengths                    */
#define FPATH_LEN      30              /* File name path lengths               */
#define        NAME_LEN        24              /* User name length                             */
#define PASS_LEN       10              /* User password length                 */
#define SECT_LEN       20              /* Section name lengths                 */
#define TERM_LEN       15              /* Computer name lengths                */

/* UDHEAD.DAT record structure */

/* Note some new additions to this structure, for internal tracking */

typedef struct {
       BYTE    type;
       int             local:1;                                        /* True if local upload                 */
       int             bin:1;                                          /* True if binary file                  */
       int             valid:1;                                        /* True if valid                NEW */
       int             online:1;                                       /* True if file online          NEW     */
       int             dirnum:5;                                       /* Real dir num of file         NEW */
       int     :7;                                                     /* Reserved             CHANGED */
       char    cat_name[CAT_LEN];                      /* Catalog filename (key1)              */
       UWORD   date;                                           /* Upload date serial                   */
       BYTE    dir;                                            /* Dir number (key2 - seg1)             */
       BYTE    section;                                        /* Section number (key2 - seg2) */
       UWORD   accesses;                                       /* Number of accesses                   */
       LONG    length;                                         /* File length                                  */
       char    disk_name[FNAME_LEN+1];         /* Disk filename                                */
       char    owner[NAME_LEN+1];                      /* Owner's name                                 */
       char    desc[DESC_LEN+1];                       /* Description text                             */
} UDHEAD;

#define UDSIZE         sizeof(UDHEAD)


/* Terminal parameters */

typedef struct {
       int             linefeed: 1;
       int             :31;
       BYTE    nuls;
       BYTE    protocol;
       BYTE    align;
       BYTE    page[2];
       BYTE    cls[4];
       BYTE    bs[3];
       char    name[TERM_LEN+1];
} TRMNL;


/* CFGINFO.DAT record structure */

typedef struct {
       int             dir0_ok: 1;             /* Directory 0 downloads                        */
       int             by_call: 1;             /* Time limit per call                          */
       short   max_msg;                /* Maximum messages in system           */
       short   max_user;               /* Maximum users in system                      */
       short   max_log;                /* Maximum call log                                     */
       short   max_ud;                 /* Maximum U/D files                            */
       short   reward;                 /* Upload reward                                        */
       short   sleeptime;              /* sleep timeout (adjusted)                     */
       long    dummy;                  /* Reserved                                                     */
       BYTE    log_p1;                 /* Log privilege low                            */
       BYTE    log_p2;                 /* Log privilege high                           */
       BYTE    hi_men;                 /* Highest menu set                                     */
       BYTE    log_type;               /* Login method                                         */
       short   limit[2];               /* Guest/member time limits             */
       short   priv[2];                /* Guest/member privileges                      */
       UWORD   rd_acc[2];              /* Guest/member read access                     */
       UWORD   wr_acc[2];              /* Guest/member write access            */
       UWORD   up_acc[2];              /* Guest/member upload access           */
       UWORD   dn_acc[2];              /* Guest/member download access         */
       BYTE    sav_sec[2];             /* Guest/member save section            */
       BYTE    sec_flg[NUM_SECT];                                      /* Section flags                        */
       char    sec_name[NUM_SECT] [SECT_LEN+1];        /* Section names                        */
       char    ud_alt[NUM_SECT] [FPATH_LEN+1];         /* Alternate UD paths           */
       char    syspass[PASS_LEN+1];                            /* Sysop password                       */
       BYTE    menu[2];                                                        /* Guest/Member menu sets       */
       BYTE    align;
       long    dummy2;
       long    dummy3;
       TRMNL   trmnl[NUM_TERM];                                        /* Terminal parameters          */
} CFGINFO;

#define CFGSIZE                sizeof(CFGINFO)
