/*

                      LoraBBS (DOS / OS2) Ver. 2.40

   Copyright (c) 1989, 1990, 1991, 1992, 1993, 1994 by Marco Maccaferri.
                          All rights reserved.


                   Structure definitions for release



  You may use those structures at your own risk. The author cannot guarantee
  that this structures are maintained in all future versions of the program.
  You can freely (and you are encouraged on that) distribute this file
  without limitations.

  You can contact the autor at one of the following address:

  E-Mail: Marco Maccaferri
  BBS: 39-51-6331730 (2:332/402)
       39-51-6331746 (2:332/422)
  Internet: macca@arci01.bo.cnr.it
            100421.1633@compuserve.com
  CompuServe: 100421,1633

*/

#ifndef _LORA240_INCLUDED
#define _LORA240_INCLUDED

#pragma pack(1)

typedef unsigned int   bits;
typedef unsigned short words;
typedef unsigned char  byte;
typedef long           lword;

struct _lastread
{
   words area;               /* Message area number */
   short msg_num;            /* Last message read */
};

#define MAXLREAD   50
#define MAXDLREAD  20
#define MAXFLAGS   4
#define MAXCOUNTER 10

struct _usridx       /* Structure for the USERS.IDX file */
{
   long id;              /* User-ID is the 32 bit CRC of the user's name */
   long alias_id;        /* 32 bit CRC of the user's alias name */
};

struct _usr          /* Structure for the USERS.BBS file */
{
   char  name[36];         /* User's name */
   char  alias[36];        /* User's alias name */
   char  city[26];         /* User's city */

   struct _lastread lastread[MAXLREAD];   /* Last messages read for the last
                                             MAXLREAD message areas (used for
                                             QWK selections) */
   struct _lastread lastread2[MAXDLREAD]; /* Last messages read for the last
                                             MAXDLREAD message areas */
   char  pwd[16];          /* User's password (crypted) (*) */
   lword times;            /* Times the user has called the system */
   words nulls;            /* Number of nulls (0) sent after a CR/LF */
   words msg;              /* User's last message area visited */

   bits  avatar    :1;     /* 1=Avatar color/graphics enabled */
   bits  color     :1;     /* 1=Color codes will be sent */
   bits  scanmail  :1;     /* 1=Check for mail at logon */
   bits  use_lore  :1;     /* 0=Use the Ansi full screen editor */
   bits  more      :1;     /* 1=Pause at the end of each page */
   bits  ansi      :1;     /* 1=Ansi color/graphics enabled */
   bits  kludge    :1;     /* 1=Display the ^a kludge lines */
   bits  formfeed  :1;     /* 1=Screen clearing codes will be sent */

   bits  old_hotkey:1;     /* 1=Hot keyed menus (obsolete in 2.40+) */
   bits  tabs      :1;     /* 0=tabs (9) are converted to spaces */
   bits  full_read :1;     /* 1=Full screen message wiewer */
   bits  badpwd    :1;     /* 1=Bad password for the last call */
   bits  usrhidden :1;     /* 1=The user is hidden from the users list */
   bits  nokill    :1;     /* 1=Don't kill this user */
   bits  ibmset    :1;     /* 1=Character > 127 will be sent */
   bits  deleted   :1;     /* 1=User is deleted from the list */

   byte  language;         /* User's language number */
   byte  priv;             /* User's privilege level */
   long  flags;            /* Flags settings */
   char  ldate[20];        /* User's last call date */
   short time;             /* Time the user has spent on-line today */
   lword upld;             /* User's total kbytes uploaded */
   lword dnld;             /* User's total kbytes downloaded */
   words dnldl;            /* Users' kbytes downloaded today */
   words n_upld;           /* Number of files uploaded */
   words n_dnld;           /* Number of files downloaded */
   words files;            /* User's last file area visited */
   words credit;           /* Netmail credit */
   words dbase;            /* <reserved> (**) */
   char  signature[58];    /* User's personal signature */
   char  voicephone[20];   /* User's voice telephone number */
   char  dataphone[20];    /* User's data telephone number */
   char  birthdate[10];    /* User's date of birth */
   char  expiredate[10];   /* Expiration date */
   char  firstdate[20];    /* User's first call date and time */
   char  lastpwdchange[10];/* User's last password change date */
   long  ptrquestion;      /* Pointer to the answer questionaire file */
   byte  len;              /* User's screen length */
   byte  width;            /* User's screen width */
   long  id;               /* This is the 32 bit CRC of the user's name */
   short msgposted;        /* Number of messages posted */
   char  comment[80];      /* Comment for advanced user editors */
   byte  help;             /* <reserved> (**) */
   words old_baud_rate;    /* Last call connection speed (obsolete in 2.40+) */
   byte  counter[MAXCOUNTER]; /* General pourpouse counters */
   words chat_minutes;     /* Minutes used today to chat with Sysop */

   bits  xfer_prior:1;     /* 1=No download limits */
   bits  quiet     :1;     /* <reserved> (**) */
   bits  nerd      :1;     /* 1=Yell don't bell for this user */
   bits  donotdisturb:1;   /* <reserved> (**) */
   bits  robbed    :1;     /* <reserved> (**) */
   bits  novote    :1;     /* <reserved> (**) */

   char  protocol;         /* User's default file trasnfer protocol */
   char  archiver;         /* User's default compressor */

   struct _ovr_class_rec {
      short max_time;       /* Minutes per day */
      short max_call;       /* Minutes per call */
      short max_dl;         /* Download limit */
      words ratio;          /* Download/Upload ratio */
      words min_baud;       /* Minimum logon baud */
      words min_file_baud;  /* Minimum download bad */
      words start_ratio;    /* Start ratio */
   } ovr_class;

   short msg_sig;          /* Default message group */
   words account;          /* Account for time bank */
   words f_account;        /* Account for file bank */
   short votes;            /* Holds votes received */
   short file_sig;         /* Default file group */

   long  baud_rate;        /* New baud rate field (2.40+) */

   bits  hotkey    :1;     /* Hot key ON/OFF (2.40+) */

   long  alias_id;         /* 32 bit CRC of user's alias name (2.40+) */

   char  extradata[281];   /* Reserved for future use */
                           /* Total=1024 bytes */
};

#define SIZEOF_MSGAREA    512
#define SIZEOF_FILEAREA   640

struct _sys          /* Structure for the internal system records.
                        The files SYSMSG.DAT and SYSFILE.DAT
                        are composed by the respective portions of this
                        structure */
{
   /* Begin of the SYSMSG.DAT file --------------------------------------- */
   char  msg_name[70];      /* Message area name */
   short msg_num;           /* Message area number */
   char  msg_path[40];      /* Message area path */
   char  origin[56];        /* Echomail origin line */
   bits  echomail  :1;      /* 1=Echomail area */
   bits  netmail   :1;      /* 1=Netmail area */
   bits  dopublic  :1;      /* 1=Public message allowed */
   bits  doprivate :1;      /* 1=Private message allowed */
   bits  anon_ok   :1;      /* 1=Use the user's handle in the from field */
   bits  no_matrix :1;      /* <reserved> (**) */
   bits  squish    :1;      /* Squish<tm> message area */
   bits  kill_unlisted :1;  /* <reserved> (**) */
   words msg_sig;           /* Message area's group */
   char  echotag[32];       /* Echotag name */
   words pip_board;         /* Pip-base board number */
   byte  quick_board;       /* QuickBBS board number */
   byte  msg_priv;          /* Minimum level to access this area */
   long  msg_flags;         /* Flags settings */
   byte  write_priv;        /* Minimum level to write messages */
   long  write_flags;       /* Flags settings */
   byte  use_alias;         /* Use alias # with this area */
   short max_msgs;          /* Maximum number of messages in this area */
   short max_age;           /* Max age of messages (days) */
   short age_rcvd;          /* Max age of received messages (days) */
   char  forward1[80];      /* Forward node list 1/3 */
   char  forward2[80];      /* Forward node list 2/3 */
   char  forward3[80];      /* Forward node list 3/3 */
   bits  msg_restricted :1; /* Access restricted to message area's group */
   bits  passthrough    :1; /* Pass-through area */
   byte  areafix;           /* Areafix access level for that area */
   char  qwk_name[14];      /* Short name used by the QWK mail packer */
   long  afx_flags;         /* Areafix flags */
   words gold_board;        /* Goldbase board number */
   char  filler1[27];
   /* End of the SYSMSG.DAT file ----------------------------------------- */

   /* Begin of the SYSFILE.DAT file -------------------------------------- */
   char  file_name[70];     /* File area name */
   short file_num;          /* File area number */
   char  uppath[40];        /* Upload path */
   char  filepath[40];      /* Download path */
   char  filelist[50];      /* CD-ROM list file name */
   bits  freearea  :1;      /* Free download limit */
   bits  norm_req  :1;      /* <reserved> (**) */
   bits  know_req  :1;      /* <reserved> (**) */
   bits  prot_req  :1;      /* <reserved> (**) */
   bits  nonews    :1;      /* <reserved> (**) */
   bits  no_global_search :1; /* 1=Exclude from global searches */
   bits  no_filedate :1;    /* <reserved> (**) */
   bits  file_restricted :1; /* Access restricted to file area's group */
   words file_sig;          /* <reserved> (**) */
   byte  file_priv;         /* Minimum level to access this area */
   long  file_flags;        /* Flags settings */
   byte  download_priv;     /* Minimum level to download files */
   long  download_flags;    /* Flags settings */
   byte  upload_priv;       /* Minimum level to upload files */
   long  upload_flags;      /* Flags settings */
   byte  list_priv;         /* Minimum level to see the file titles */
   long  list_flags;        /* Flags settings */
   char  filler2[10];
   char  short_name[13];    /* Area's short name */
   char  filler3[8];
   char  tic_tag[32];       /* TIC processor area's tag name */
   char  tic_forward1[80];  /* Forward node list (1/3) */
   char  tic_forward2[80];  /* Forward node list (2/3) */
   char  tic_forward3[80];  /* Forward node list (3/3) */
   byte  tic_level;         /* TIC area's level */
   long  tic_flags;         /* TIC area's flags */
   bits  cdrom     :1;      /* 1=Area is on CD-ROM, 0=Hard disk */
   char  filler4[106];
   /* End of the SYSFILE.DAT file ---------------------------------------- */
};

struct _sys_idx     /* Structure for the SYSMSG.IDX, SYSFILE.IDX files */
{
   byte  priv;            /* Area's privilege level */
   byte  flags[MAXFLAGS]; /* Flags settings */
   char  key[13];         /* Area's name */
   words area;            /* Area absolute number */
   words sig;             /* Area group number */
};

/* Privilege levels definitions */

#define  TWIT        0x10
#define  DISGRACE    0x20
#define  LIMITED     0x30
#define  NORMAL      0x40
#define  WORTHY      0x50
#define  PRIVIL      0x60
#define  FAVORED     0x70
#define  EXTRA       0x80
#define  CLERK       0x90
#define  ASSTSYSOP   0xA0
#define  SYSOP       0xB0
#define  HIDDEN      0xC0

struct _daystat {    /* Record for statistics used in SYSINFO.DAT */
   long timestamp;       /* Time-stamp check */

   long incalls;         /* Number of inbound calls */
   long outcalls;        /* Number of outbound calls */
   long humancalls;      /* Number of inbound human calls */
   long filesent;        /* Number of files sent */
   long bytesent;        /* Number of bytes sent */
   long filerequest;     /* Number of file requests received */
   long filereceived;    /* Number of files received */
   long bytereceived;    /* Number of bytes received */
   long completed;       /* Number of completed calls */
   long failed;          /* Number of failed calls (including cost) */
   long cost;            /* Number of cost failed calls */

   long emailreceived;   /* Number of netmail messages received */
   long emailsent;       /* Number of netmail messages sent */
   long echoreceived;    /* Number of echomail messages received */
   long echosent;        /* Number of echomail messages sent */
   long dupes;           /* Number of dupe echomail messages received */
   long bad;             /* Number of bad echomail messages received */

   long exectime;        /* Seconds of system activity */
   long idletime;        /* Seconds of idle time */
   long interaction;     /* Seconds of operator's interaction */
   long echoscan;        /* Seconds spent during echomail processing */
   long inconnects;      /* Seconds spent on inbound calls */
   long outconnects;     /* Seconds spent on outbound calls */
   long humanconnects;   /* Seconds spent on human calls */
};

struct _sysinfo      /* Structure for the SYSINFO.DAT file */
{
   long stamp_up;              /* <reserved> (**) */
   long stamp_down;            /* <reserved> (**) */
   long quote_position;        /* Last position in the quote file */
   unsigned long total_calls;  /* Total system calls */
   char pwd[40];               /* Keyboard password (crypted) (*) */
   struct _daystat today;      /* Dayly system statistics */
   struct _daystat yesterday;  /* Dayly system statistics (yesteday) */
   struct _daystat week;       /* Weekly system statistics */
   struct _daystat month;      /* Monthly system statistics */
   struct _daystat year;       /* Yearly system statistics */
};

#define NOCHANGE        0
#define WFC             1
#define LOGIN           2
#define BROWSING        3
#define UPLDNLD         4
#define READWRITE       5
#define DOOR            6
#define CHATTING        7
#define QUESTIONAIRE    8
#define QWKDOOR         9

struct _useron {     /* Structure for the USERON.BBS file */
   char   name[36];             /* User's name */
   short  line;                 /* Task number currently on */
   long   baud;                 /* Baud rate */
   char   city[26];             /* User's city */
   bits   donotdisturb: 1;      /* Do not disturb flag */
   bits   priv_chat   : 1;      /* <reserved> (**) */
   short  line_status;          /* User's status (numeric value) */
   short  cb_channel;           /* CB Chat System channel */
   char   status[32];           /* User's status (string) */
};

struct _lastcall     /* Structure for the LASTCALL.BBS file */
{
   short line;                  /* Task number */
   char  name[36];              /* User's name */
   char  city[26];              /* User's city */
   words baud;                  /* Baud rate */
   long  times;                 /* Times the user has called the system */
   char  logon[6];              /* Logon time HH:MM */
   char  logoff[6];             /* Logoff time HH:MM */
   long  timestamp;             /* Logout time-stamp (binary format) */
};

struct _menu_header  /* Header of the *.MNU files

                        Menus are structured as follow:

                        <_menu_header>
                           <_cmd> \
                           ......  |- _menu_header.n_elem
                           <_cmd> /
                        <_menu_header>
                           <_cmd> \
                           ......  |- _menu_header.n_elem
                           <_cmd> /
                        ..............
                      */
{
   char name[14];    /* Menu' name */
   short n_elem;      /* Number of struct _cmd records for this menu */
};

struct _cmd          /* Structure for the *.MNU files */
{
   char   name[80];        /* User's display */
   byte   priv;            /* Minimum level for this command */
   byte   flags[MAXFLAGS]; /* Minimum flags setting */
   short  flag_type;       /* Type of command */
   bits   automatic: 1;    /* Automatic execution */
   bits   dummy:     1;    /* <reserved> (**) */
   bits   first_time:1;    /* Executed only the first time the menu' is read */
   byte   color;           /* Normal background and foreground colors */
   byte   first_color;     /* Hilight background and foreground colors */
   byte   hotkey;          /* Key that activate the command */
   char   argument[50];    /* Optional argument list */
};

struct _mail         /* Structure for the MSGTOIDX.DAT file */
{
   long  to;                    /* Recipient's name 32-bit CRC */
   words area;                  /* Message area number */
   words msg_num;               /* Message number */
};

struct _lorainfo     /* Structure for the LORAINFO.Txx file.
                        xx=Task number in two digit hex number */
{
   struct _usr usr;            /* The complete user record */
   words baud;                  /* The current baud rate */
   short port;                  /* The current comm port number */
   short time;                  /* Minutes remaining for this call */
   char  log[40];               /* Log file name */
   char  system[80];            /* System name */
   char  sysop[36];             /* Sysop's name */
   words task;                  /* Current task number */
   words max_baud;              /* Maximum modem baud rate */
   long  posuser;               /* User's position in the user file */
   words yelling;               /* Number of times the user has requested
                                  for a chat */
   words downloadlimit;         /* User's download limit */
   short max_time;              /* User's maximum on line time in 24h */
   short max_call;              /* User's maximum on line time for call */
   words ratio;                 /* Download/upload ratio limit (0=No limit) */
   words min_baud;              /* Minimum baud rate for user's level */
   words min_file_baud;         /* Minimum baud rate for file transfers */
   bits  wants_chat  :1;        /* 1=The user has request a chat */
   bits  mnp_connect :1;        /* 1=MNP connection */
   bits  keylock     :1;        /* 1=The keyboard is locked */
   char  logindate[20];         /* User's login date */
   char  password[40];          /* Keyboard password (crypted) (*) */
   unsigned long total_calls;  /* Total system calls */
   words start_ratio;           /* User's ratio start value */
   char  from[36];              /* From field of new messages */
   char  to[36];                /* To field of new messages */
   char  subj[72];              /* Subject field of new messages */
   char  msgdate[20];           /* Date field of new messages */
   words attrib;                /* Attribute field of new messages */
};

struct _bbslist      /* Structure for the BBSLIST.BBS file */
{
   char  bbs_name[40];          /* System's name */
   char  sysop_name[36];        /* Sysop's name */
   char  number[20];            /* Telephone number */
   words baud;                  /* Maximum baud rate */
   char  open_times[12];        /* Open hours */
   char  net[16];               /* Network address */
   char  bbs_soft[16];          /* Software used */
   char  other[60];             /* Other informations */
   char  extra_space[100];      /* Reserved for future use */
};

#define CONFIG_VERSION   3

#define MAXNL            10
#define MAXPACKER        10
#define MAX_ALIAS        20
#define MAX_LANG         20

#define DAY_SUNDAY       0x01
#define DAY_MONDAY       0x02
#define DAY_TUESDAY      0x04
#define DAY_WEDNESDAY    0x08
#define DAY_THURSDAY     0x10
#define DAY_FRIDAY       0x20
#define DAY_SATURDAY     0x40
#define DAY_UNUSED       0x80

struct _alias
{
   short zone;              /* Zone number */
   short net;               /* Net number */
   short node;              /* Node number */
   short point;             /* Point number */
   words fakenet;           /* Fake net number */
   char  *domain;           /* <reserved> (**) */
};

struct class_rec
{
   short priv;              /* Access level */
   short max_time;          /* Dayly time limit */
   short max_call;          /* Per call time limit */
   short max_dl;            /* Default download limit */
   short dl_300;            /* Speed specific download limit */
   short dl_1200;           /* Speed specific download limit */
   short dl_2400;           /* Speed specific download limit */
   short dl_9600;           /* Speed specific download limit */
   words ratio;             /* Download/Upload ratio */
   words min_baud;          /* Minimum login speed */
   words min_file_baud;     /* Minimum file transfer speed */
   words start_ratio;       /* Start ratio after some downloads */
};

struct _configuration     /* Structure for the CONFIG.DAT file */
{
   short version;                    /* Configuration file version */

   char  sys_path[40];               /* System directory */

   char  log_name[40];               /* Log file name */
   char  log_style;                  /* Type of log: 0=Verbose, 1=Short */

   char  sched_name[40];             /* Scheduler file name */
   char  user_file[40];              /* User's file base name (w/o extension) */

   char  norm_filepath[40];          /* Unknow nodes inbound */
   char  know_filepath[40];          /* Know nodes inbound */
   char  prot_filepath[40];          /* Protected nodes inbound */
   char  outbound[40];               /* Outbound base directory */
   char  netmail_dir[40];            /* Netmail directory */
   char  bad_msgs[40];               /* Bad messages directory */
   char  dupes[40];                  /* Dupe messages directory */
   char  quick_msgpath[40];          /* QuickBBS (Hudson) message base path */
   char  pip_msgpath[40];            /* Pip-base path */
   char  ipc_path[40];               /* Temporary files storage */
   char  net_info[40];               /* Nodelist directory */
   char  glob_text_path[40];         /* Text files path */
   char  menu_path[40];              /* Menu/Languages path */
   char  flag_dir[40];               /* Activity flags directory */

   long  keycode;                    /* Registration key code (<2.33) */

   char  about[40];                  /* 'ABOUT' file to send */
   char  files[40];                  /* 'FILES' file to send */
   short norm_max_kbytes;            /* Unknow nodes f/req. kbytes limit */
   short prot_max_kbytes;            /* Protected nodes f/req. kbytes limit */
   short know_max_kbytes;            /* Know nodes f/req. kbytes limit */
   short norm_max_requests;          /* Unknow nodes f/req. files limit */
   short prot_max_requests;          /* Protected nodes f/req. files limit */
   short know_max_requests;          /* Know nodes f/req. files limit */
   char  def_pack;                   /* Default packer */

   char  enterbbs[70];               /* 'Press ESC to enter the BBS' */
   char  banner[70];                 /* Initial mailer banner */
   char  mail_only[70];              /* Mail only banner */

   short com_port;                   /* Serial port (0-based) */
   short old_speed;                  /* Obsolete */
   char  modem_busy[20];             /* Modem busy command */
   char  dial[20];                   /* Modem default dial command */
   char  init[40];                   /* Modem initialization command */
   char  term_init[40];              /* Terminal mode initialization command */

   byte mustbezero;                  /* Must be zero */

   byte echomail_exit;               /* <reserved> (**) */
   byte netmail_exit;                /* <reserved> (**) */
   byte both_exit;                   /* <reserved> (**) */

   long speed;                       /* Modem initial speed */

   byte filler[12];                  /* <reserved> (**) */

   struct _altern_dial {             /* Alternative dialing commands */
       char prefix[20];              /* Prefix command */
       char suffix[20];              /* Suffix command */
   } altdial[10];

   bits  lock_baud   :1;             /* 1=Lock serial port to speed baud */
   bits  ansilogon   :2;             /* 0=No ansi at logon, 1=Detect, 2=Ask, 3=Yes */
   bits  birthdate   :1;             /* 1=Ask for birthdate */
   bits  voicephone  :1;             /* 1=Ask for voice phone */
   bits  dataphone   :1;             /* 1=Ask for data phone */
   bits  emsi        :1;             /* 1=EMSI sessions enabled */
   bits  ibmset      :1;             /* 1=Ask for IBM set display */

   bits  wazoo       :1;             /* 1=WAZOO sessions enabled */
   bits  msgtrack    :1;             /* <reserved> (**) */
   bits  keeptransit :1;             /* 1=Keep in-transit netmail */
   bits  hslink      :1;             /* 1=HS-Link enabled */
   bits  puma        :1;             /* 1=Puma enabled */
   bits  secure      :1;             /* 1=Check import messages */
   bits  janus       :1;             /* 1=Janus protocol enabled */
   bits  terminal    :1;             /* 1=Null modem connections */

   bits  fillerbug   :1;             /* <reserved> (**) */
   bits  no_direct   :1;             /* 1=Use BIOS screen writes */
   bits  snooping    :1;             /* 1=Snoop user on-line */
   bits  snow_check  :1;             /* 1=CGA snow check */
   bits  unpack_norm :1;             /* <reserved> (**) */
   bits  unpack_know :1;             /* <reserved> (**) */
   bits  unpack_prot :1;             /* <reserved> (**) */

   short blank_timer;                /* Screen blanker timeout in minutes */

   struct _language {               /* Languages available for the users */
       char txt_path[30];            /* Text files directory */
       char descr[24];               /* Description */
       char basename[10];            /* Base file name */
   } language[MAX_LANG];

   char  sysop[36];                  /* Sysop name */
   char  system_name[50];            /* System name */
   char  location[50];               /* System's location */
   char  phone[32];                  /* System's phone number */
   char  flags[50];                  /* System's flags */

   struct _alias alias[MAX_ALIAS];   /* Network addresses */

   char  newareas_create[50];        /* Nodes that can create new areas */
   char  newareas_link[50];          /* Nodes that are linked to new areas */

   short line_offset;                /* Task number */
   short min_calls;                  /* <reserved> (**) */
   short vote_limit;                 /* <reserved> (**) */
   short target_up;                  /* <reserved> (**) */
   short target_down;                /* <reserved> (**) */
   byte  vote_priv;                  /* <reserved> (**) */
   byte  max_readpriv;               /* <reserved> (**) */

   words speed_graphics;             /* Speed for ANSI/Avatar graphics */

   byte  aftercaller_exit;           /* After caller exit errorlevel */
   byte  aftermail_exit;             /* After mail exit errorlevel */
   short max_connects;               /* <reserved> (**) */
   short max_noconnects;             /* <reserved> (**) */

   byte  logon_level;                /* New users level */
   long  logon_flags;                /* New users flags */

   char  areachange_key[4];          /* Hotkeys for the change area command */
   char  dateformat[20];             /* Format of the date fields */
   char  timeformat[20];             /* Format fo the time fields */
   char  external_editor[50];        /* External BBS message editor */

   struct class_rec uclass[12];      /* Access level definitions */

   char  local_editor[50];           /* Local message editor */

   char  QWKDir[40];                 /* QWK mail packer work directory */
   char  BBSid[10];                  /* QWK board name */
   words qwk_maxmsgs;                /* Maximum number of messages for QWK packets */

   char  galileo[30];                /* Clocksynch phone number */

   char  norm_okfile[40];            /* Unknow request list */
   char  know_okfile[40];            /* Know request list */
   char  prot_okfile[40];            /* Protected request list */

   char  reg_name[36];               /* <reserved> (**) */
   long  betakey;                    /* <unused> */

   struct _packers {                /* Mail packers */
       char id[10];                  /* Short name */
       char packcmd[30];             /* Pack commands */
       char unpackcmd[30];           /* unpack commands */
   } packers[10];

   struct _nl {                      /* Nodelist database */
       char list_name[14];           /* Nodelist base name */
       char diff_name[14];           /* Nodediff base name */
       char arc_name[14];            /* <reserved> (**) */
   } nl[10];

   bits  ansigraphics   :2;          /* 0=No Ansi, 1=Yes, 2=Ask */
   bits  avatargraphics :2;          /* 0=No Avatar, 1=Yes, 2=Ask */
   bits  hotkeys        :2;          /* 0=No hotkeyed menu, 1=Yes, 2=Ask */
   bits  screenclears   :2;          /* 0=No screen clears, 1=Yes, 2=Ask */

   bits  autozmodem     :1;          /* Terminal mode auto zmodem download */
   bits  avatar         :1;          /* Terminal mode Avatar emulation */
   bits  moreprompt     :2;          /* 0=No more prompt, 1=Yes, 2=Ask */
   bits  mailcheck      :2;          /* 0=No mail check, 1=Yes, 2=Ask */
   bits  fullscrnedit   :2;          /* 0=No full screen editor, 1=Yes, 2=Ask */

   bits  fillerbits     :2;          /* <reserved> (**) */
   bits  ask_protocol   :1;          /* 1=Ask default protocol */
   bits  ask_packer     :1;          /* 1=Ask default packer */
   bits  put_uploader   :1;          /* 1=Put uploader name in files.bbs */
   bits  keep_dl_count  :1;          /* 1=Keep count of download times */
   bits  use_areasbbs   :1;          /* 1=Use the areas.bbs file */
   bits  write_areasbbs :1;          /* 1=Keep the areas.bbs file up to date */

   short rookie_calls;               /* Number of calls for new users to be a rookie */

   char  pre_import[40];             /* Pre import batch */
   char  after_import[40];           /* After import batch */
   char  pre_export[40];             /* Pre export batch */
   char  after_export[40];           /* After export batch */

   byte  emulation;                  /* <reserved> (**) */
   char  dl_path[40];                /* Terminal emulator download path */
   char  ul_path[40];                /* terminal emulator upload path */

   bits  manual_answer  :1;          /* Manually answers phone */
   bits  limited_hours  :1;          /* Answer only at certain hours */
   bits  solar          :1;          /* <reserved> (**) */
   bits  areafix        :1;          /* 1=Use internal areafix */
   bits  doflagfile     :1;          /* 1=Log semaphores creation/deletion */
   bits  multitask      :1;          /* 1=Multitasking environment */
   bits  ask_alias      :1;          /* 1=Ask for an alias name */
   bits  random_birth   :1;          /* 1=Random birthdate check */

   short start_time;                 /* Answer start time in minutes */
   short end_time;                   /* Answer end time in minutes */

   char  boxpath[40];                /* User's filebox base directory */
   char  dial_suffix[20];            /* Dialing suffix command */

   char  galileo_dial[40];           /* Clocksynch dialing command */
   char  galileo_suffix[40];         /* Clocksynch dialing suffix command */
   char  galileo_init[40];           /* Clocksynch initialization command */

   char  areafix_help[40];           /* Areafix's help file name */
   char  alert_nodes[50];            /* Nodes that receives a copy of all areafix response messages */

   char  automaint[40];              /* Batch to execute once a day */

   byte  min_login_level;            /* Minimum login level */
   long  min_login_flags;            /* Minimul login flags */
   byte  min_login_age;              /* Minimul login age */

   char  resync_nodes[50];           /* Nodes to resynch the clock with */
   char  bbs_batch[40];              /* External BBS batch file */
   byte  altx_errorlevel;            /* ALT-X command errorlevel */

   char  fax_response[20];           /* FAX response */
   byte  fax_errorlevel;             /* Fax exit errorlevel */

   char  dl_counter_limits[4];       /* Download counter delimiters */

   char  areas_bbs[40];              /* AREAS.BBS path and file name */
   byte  afx_remote_maint;           /* Areafix level for %FROM command */
   byte  afx_change_tag;             /* Areafix level for #<old>:<new> command */

   bits  allow_rescan    :1;         /* 1=Allow rescan of new areas */
   bits  check_city      :1;         /* 1=Check user's city at logon */
   bits  check_echo_zone :1;         /* 1=Check zones in areafix's requests */
   bits  save_my_mail    :1;         /* 1=Save mail directed to the Sysop */
   bits  mail_method     :2;         /* 0=Separate netmail, 1=Net & echomail */
                                     /* in the same packet */
   bits  replace_tear    :2;         /* 0=No, 1=Link unlimited, 2=Link */
                                     /* limited to 35 char, 3=Always */

   char  my_mail[40];                /* Path to Sysop's mail */

   bits  stripdash       :1;         /* 1=Strip dashes from phone numbers */
   bits  use_iemsi       :1;         /* 1=Allows IEMSI logins */
   bits  newmail_flash   :1;         /* 1=Flashing MAIL active */
   bits  mymail_flash    :1;         /* 1=Flashing PERSONAL active */
   bits  keep_empty      :1;         /* 1=Do not import empty netmail */
   bits  show_missing    :1;         /* 1=Show missing files in file listings */
   bits  random_redial   :1;         /* 1=Redial numbers at random time */

   char  override_pwd[20];           /* Mail only override password */
   char  pre_pack[40];               /* Pre-PACK DOS command */
   char  after_pack[40];             /* After-PACK DOS command */

   byte  modem_timeout;              /* Modem answer timeout (seconds) */
   byte  login_timeout;              /* User's login timeout (minutes) */
   byte  inactivity_timeout;         /* User's inactivity timeout (seconds) */

   struct _altern_prefix {
       char flag[6];                 /* Nodelist flag (HST,V32B,etc.) */
       char prefix[20];              /* Dialing prefix */
   } prefixdial[10];

   char  iemsi_handle[36];           /* IEMSI: User's handle name */
   char  iemsi_pwd[20];              /* IEMSI: Password */
   short iemsi_infotime;             /* IEMSI: Seconds to display server */
                                     /*        informations */

   bits  iemsi_on        :1;         /* IEMSI: 1=Active, 0=Ignore */
   bits  iemsi_hotkeys   :1;         /* IEMSI: 1=Use hot-keyed menu */
   bits  iemsi_quiet     :1;         /* IEMSI: 1=Do not disturb */
   bits  iemsi_pausing   :1;         /* IEMSI: 1=Pause at end of screen */
   bits  iemsi_editor    :1;         /* IEMSI: 1=Use full screen editor */
   bits  iemsi_news      :1;         /* IEMSI: 1=Display news bulletins */
   bits  iemsi_newmail   :1;         /* IEMSI: 1=Check for new mail */
   bits  iemsi_newfiles  :1;         /* IEMSI: 1=Check for new files */

   bits  iemsi_screenclr :1;         /* IEMSI: 1=Send clearing screen codes */
   bits  prot_xmodem     :1;         /* 1=Internal XMODEM active */
   bits  prot_1kxmodem   :1;         /* 1=Internal 1K-XMODEM active */
   bits  prot_zmodem     :1;         /* 1=Internal ZMODEM active */
   bits  prot_sealink    :1;         /* 1=Internal SEALINK active */

   char  newkey_code[30];            /* Registration key code (>=2.33) */
   char  tearline[36];               /* Custom tear line */

   char  uucp_gatename[20];          /* UUCP gateway name */
   short uucp_zone;                  /* UUCP gateway zone */
   short uucp_net;                   /* UUCP gateway net */
   short uucp_node;                  /* UUCP gateway node */

   byte  carrier_mask;               /* Carrier detect bit mask */
   byte  dcd_timeout;                /* Timeout after drop DCD before hangup */

   struct {
      char display[20];              /* User's display packer name */
      short offset;                   /* @@ Offset of the signature id */
      char ident[20];                /* Packer's signature id */
   } packid[10];
#if 0
   char quote_string[5];             /* String to put in front of quoted lines */
   char quote_header[50];            /* Quote text file header */

   char tic_help[40];                /* Help file name for TIC processor */
   char tic_alert_nodes[50];         /* Nodes that receives a copy of all TIC response messages */
   char tic_newareas_create[50];     /* Nodes that can create new TIC areas */
   char tic_newareas_link[50];       /* Nodes that are linked to new TIC areas */
   byte tic_remote_maint;            /* TIC level for %FROM command */
   byte tic_change_tag;              /* TIC level for #<old>:<new> command */

   short  uucp_point;                  /* @@ UUCP gateway point */

   byte  dial_timeout;               /*  */
   byte  dial_pause;                 /*  */

   bits  newfilescheck   :2;         /*  */
   bits  mono_attr       :1;         /*  */
   bits  force_intl      :1;         /* 1=Force ^aINTL line in matrix */
   bits  inp_dateformat  :2;         /* Date format for input fields */
   bits  single_pass     :1;         /* <reserved> (**) */

   short   ul_free_space;            /* @@ Min. disk space for uploads */
   char  hangup_string[40];          /* Modem hangup command */
   char  init2[40];                  /* 2nd modem init command */
   char  init3[40];                  /* 3th modem init command */

   short page_start[7];              /* @@Sysop paging start hours */
   short page_end[7];                /* @@Sysop paging end hours */

   char  logbuffer;                  /* Size of log file buffer */

   char  newareas_path[40];          /* Where to create new areas */
   char  newareas_base;              /* Message base type for new areas */

   char  answer[40];                 /* Modem answer command */

   bits  blanker_type   :3;          /* Screen blanker type */
   bits  tcpip          :2;          /* <reserved> (**) */

   char  internet_gate;              /* Type of internet gate */
                                     /* 0=Uupc */
                                     /* 1=GIGO */

   char  areafix_watch[50];          /* Alternate Areafix names */
   char  tic_watch[50];              /* Alternate Raid names */
#endif
};

typedef struct _nodeinfo   /* Struct for the NODES.DAT file */
{
   short zone;                /* Zone number */
   short net;                 /* Net number */
   short node;                /* Node number */
   short point;               /* Point number */
   short afx_level;           /* Areafix level */
   char  pw_session[20];      /* Session password */
   char  pw_areafix[20];      /* Areafix password */
   char  pw_tic[20];          /* <reserved> (**) */
   char  pw_packet[9];        /* Packet password */
   short modem_type;          /* >0=Use alternate dialing string */
   char  phone[30];           /* Override phone number */
   short packer;              /* Packer type */
   char  sysop_name[36];      /* Sysop name */
   char  System[36];          /* System name */
   bits  remap4d      :1;     /* Remap to point */
   bits  can_do_22pkt :1;     /* <reserved> (**) */
   bits  wazoo        :1;     /* WAZOO sessions enabled */
   bits  emsi         :1;     /* EMSI sessions enabled */
   bits  janus        :1;     /* Janus protocol enabled */
   bits  pkt_create   :2;     /* <reserved> (**) */
   char  aka;                 /* >0 Aka number to use when sending mail to this node */
   short tic_level;           /* TIC level */
   long  afx_flags;           /* Areafix flags */
   long  tic_flags;           /* TIC flags */
   char  tic_aka;             /* >0 Aka number to use when sending TIC files */
   char  filler[58];
} NODEINFO;

typedef struct _idx_header    /* Header for the NODES.IDX file

                              The records are structured as follow:

                              <_idx_header>
                                 <_idx_entry> \
                                    ......     |- _idx_header.entry
                                 <_idx_entry> /
                              <_idx_header>
                                 <_idx_entry> \
                                    ......     |- _idx_header.entry
                                 <_idx_entry> /
                              ..............

                              Each _idx_entry marks the beginning of a
                              net. When the application founds the net, it
                              must scan the nodelist file from that position
                              to found the node's entry.
                              */
{
   char name[14];             /* Name of the St. Louis nodelist file */
   long entry;                /* Number of _idx_entry that follows */
} NODEHEADER;

typedef struct _idx_entry     /* Index record for the NODE.IDX file */
{
   short zone;                /* Zone number */
   short net;                 /* Net number */
   short node;                /* Node number (!= 0 only if related to a
                                 point list */
   long  offset;              /* Offset inside the nodelist file at which the
                                 net zone:net begins */
} NODEINDEX;

#define MAXCOST 20

typedef struct _translation  /* Structure for the COST.DAT file */
{
   char location[30];        /* Location's name */
   char search[20];          /* International phone prefix */
   char traslate[60];        /* Local phone prefix for that country */
   struct _cost {            /* Cost table */
      short days;            /* Days to apply */
      short start;           /* Starting time in minutes */
      short stop;            /* Ending time in minutes */
      short cost_first;      /* First segment cost */
      short time_first;      /* First segment length in seconds */
      short cost;            /* Extra segments cost */
      short time;            /* Extra segments length in seconds */
      bits  crash    :1;     /* <reserved> */
      bits  direct   :1;     /* <reserved> */
      bits  normal   :1;     /* <reserved> */
   } cost[MAXCOST];
} ACCOUNT;

#define MAXDUPES      1000

typedef struct _dupecheck     /* Structure for the DUPES.DAT file */
{
   char  areatag[48];        /* Area's echomail tag */
   short dupe_pos;           /* Position of the last record writtin in dupes[] */
   short max_dupes;          /* <unused> */
   long  area_pos;           /* Area record position inside DUPES.DAT file */
   long  dupes[MAXDUPES];    /* Dupes array. Each record is a 32bit CRC */
} DUPERECORD;

typedef struct _dupeindex    /* Structure for the DUPES.IDX file */
{
   char  areatag[48];        /* Area's echomail tag */
   long  area_pos;           /* Area record position inside DUPES.DAT file */
} DUPEINDEXRECORD;

typedef struct _protocol      /* Structure for the PROTOCOL.DAT file */
{
   char  name[30];            /* Protocol name (user's display) */
   char  hotkey;              /* Command key */

   bits  active          :1;  /* 1=Protocol is available */
   bits  batch           :1;  /* 1=The protocol doesn't require the file
                                 name from the user during uploads */
   bits  disable_fossil  :1;  /* 1=Disable the fossil before calling the
                                 protocol */
   bits  change_to_dl    :1;  /* 1=Change to the upload directory before
                                 calling the protocol */

   char  dl_command[80];      /* Download command */
   char  ul_command[80];      /* Upload command */
   char  log_name[40];        /* Log name (DSZ format) */
   char  ctl_name[40];        /* Control file name */
   char  dl_ctl_string[40];   /* Download control string */
   char  ul_ctl_string[40];   /* Upload control string */
   char  dl_keyword[20];      /* Download keyword */
   char  ul_keyword[20];      /* Upload keyword */
   short filename;            /* Filename word position */
   short size;                /* Size word position */
   short cps;                 /* CPS word position */
} PROTOCOL;


/*
    (*)  All the passwords are crypted with a proprietary algorithm for
         system safety. Only known third party authors can request to the
         autor the functions to perform the decryption/encryption.

    (**) Reserved fields are fields that aren't used as for now or are bytes
         reserved for future enhancements.
*/

#pragma pack()

#endif

