home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-385-Vol-1of3.iso / f / fido_h.zip / FIDO.H next >
C/C++ Source or Header  |  1990-10-21  |  29KB  |  864 lines

  1. /*
  2.     Big Fido include file
  3.     T. Jennings 15 Oct 90
  4.  
  5. "Fido" is a trademark of Tom Jennings
  6. "FidoNet" is a trademark of Tom Jennings
  7.  
  8. All rights reserved.
  9.  
  10. The contents of this file copyright Tom Jennings 1989.
  11.  
  12.     Fido Software
  13.     P.O. Box 77731
  14.     San Francisco CA 94107
  15.     (415)-764-1688
  16. */
  17.  
  18. #define FIDOVER 12        /* Fido version */
  19. #define FILEVER ('t' - 'a' + 1)    /* FIDO.SYS version letter */
  20.  
  21. /*
  22.  
  23.  
  24.  
  25.  
  26. IMPORTANT NOTES:
  27.  
  28. "OBSO" means "Obsolete"; they may exist currently, but will not 
  29. in the future. Please use only structures defined as "PUBLIC".
  30.  
  31. -- IMPORTANT! -- IMPORTANT! -- IMPORTANT! -- IMPORTANT! -- IMPORTANT! --
  32. Structures, structure elements, and structure element order, or
  33. other data items not marked "PUBLIC" may change at any time. YOU HAVE 
  34. BEEN WARNED!!!!
  35. -- IMPORTANT! -- IMPORTANT! -- IMPORTANT! -- IMPORTANT! -- IMPORTANT! --
  36.  
  37. "RESERVED" means exactly that: using such fields will damage future
  38. versions of Fido and will certainly tick off your customers when 
  39. nothing works right. Please see the warning above on PUBLIC items.
  40.  
  41. "VERSION" bytes, usually at the beginning of a file or record, is
  42. the current version or format for this file. This value is defined by
  43. Fido Software, and your program should monitor it before operating
  44. on the file. It will be changed only when some incompatible change is 
  45. made, such as the major shuffling done between versions 11 and 12. The
  46. safest route to take is to display a warning "WRONG VERSION PROGRAM"
  47. and halt.
  48.  
  49. */
  50.  
  51. /* Absolute Truths (current version ...) */
  52.  
  53. #define TSYNC (0xae)            /* FidoNet sync character */
  54. #define YOOHOO (0xf1)            /* WAZOO sync character */
  55.  
  56. #define SS 80                /* standard, universal, string size */
  57. #define PS 64                /* maximum MSDOS pathname length */
  58. #define SF (sizeof("FILENAME.EXT")+1)
  59. #define same(s1,s2) (strcmp(s1,s2)==0)
  60. #define NULL 0                /* nothing */
  61. #define MAXAREA 200            /* maximum message/file areas */
  62.  
  63. #define MINS_HR    60            /* minutes in an hour */
  64. #define DAYS_WK 7            /* days in a week */
  65. #define MINS_DAY (24 * 60)        /* minutes in an hour */
  66. #define MINS_WK (MINS_DAY * DAYS_WK)
  67.  
  68. /* Standard node structure used throughout Fido. This is buried within all
  69. the other major structures. */
  70.  
  71. struct _node {
  72.     int zone;        /* zone number */
  73.     int net;        /* net number */
  74.     int number;        /* node number */
  75.     int point;        /* point number */
  76. };
  77.  
  78. #define FLAG char        /* define 1/0 type flags */
  79.  
  80. char *str_node();
  81. char *skip_delim();
  82. char *next_arg();        /* must declare non-INT functions */
  83. char *strip_path();        /* might as well in the global include ... */
  84. char *getarg();
  85. int *msg_highest();
  86. int *msg_total();
  87. char *string();
  88.  
  89. long _fsize();
  90. long lseek();
  91. long sizmem();
  92. char *getmem();
  93.  
  94. /* Callers record. A major functional change for v12 is the name
  95. checksum; the checksum (merely the arithmetic sum of all ASCII characters
  96. in the name, including the spaces, masked to 8 bits) is used as a fast
  97. initial name compare; if the checksums don't match, no sense in
  98. doing a (slow) string compare. if (sum1 == sum2) is a machine instruction
  99. and fast as hell. Cache caller records too and you have a fast logon 
  100. procedure ... 
  101.  
  102. LATE NOTE: The above checksum process is stupid. It doesn't help anything.
  103. Next time think before you code... */
  104.  
  105. #define MAXLREAD 20
  106.  
  107. #define CLRVER 5        /* caller file version, */
  108.  
  109. /* PUBLIC */
  110. struct  _clr {
  111.     char version;        /* caller record version, above */
  112.     char name[36];        /* callers ASCII name, */
  113.     char city[36];        /* city and state, */
  114.     char pwd[16];        /* what else, */
  115.     char date[20];
  116.     char sum;        /* name checksum (for fast compare) */
  117.  
  118. /* NOTE: At some point in the "near" future, the last-message-read junk
  119. is going to be moved out of this file into a linked-list database that
  120. will keep track of every new message addressed to each caller, by
  121. number and area, and it will keep track of renumbered, killed and reply-to
  122. messages. The size of each caller-record will not change; the position of
  123. and uses for other fields will not change. Only the lastmsg[] struct
  124. will be affected; it will be zero'd and part of it used to reference the 
  125. external database. (this note written Aug 89) */
  126.  
  127.     struct {        /* last message read: */
  128.         char area;    /* message area */
  129.         unsigned msg;    /* last msg read */
  130.     } lastmsg[MAXLREAD];
  131.  
  132. /* Runtime statistics */
  133.  
  134.     char msg,files;        /* last selected message/file area */
  135.     unsigned times;        /* total times called, */
  136.     unsigned time;        /* total time on system in 1 day, */
  137.     unsigned upld;        /* total K byte uploaded, */
  138.     unsigned dnld;        /* total K bytes downloaded, */
  139.     unsigned dnldl;        /* total downloaded, for limiting, */
  140.  
  141.     unsigned tleft;        /* time limit left at logoff */
  142.     unsigned baud;        /* last used baud rate */
  143.  
  144. /* Other stuff, settable by SYSOP.EXE */
  145.  
  146.     unsigned credit;    /* credit, in cents, */
  147.     unsigned debit;        /* debit, in cents, */
  148.     long keys;        /* caller keys to system locks (below) */
  149.     long extra;        /* RESERVED */
  150.  
  151. /* Settings from the C)hange command. These are packed for space:
  152.  
  153. d 0 0 g g g k p p p l l l l l l l w w w w w w w n n n n h h 0 0 (32 bits)
  154.  
  155.         range        # bits        shifter
  156. -----------------------------------------------------------
  157. d deleted    0 - 1        1        31     see note below
  158. 0 extra        0 - 7        3        29    RESERVED
  159. g language    0 - 7        3        26
  160. k keep recd    0 - 1        1        25    see note below
  161. p privilege    0 - 7        3        22
  162. l screen length    0 - 127        7        15
  163. w screen width    0 - 127        7        8
  164. n nulls        0 - 15        4        4
  165. h help        0 - 3        2        2
  166. 0 more        0 - 1        1        1    DO NOT USE!!! (use lines = 0)
  167. 0 tabs        0 - 1        1        0    DO NOT USE!!!
  168.  
  169. DELETED is for SYSOP.EXE's use. (Mark for DELETED) Aftermarket
  170. programs may use the DELETED BIT. It is not used in any way 
  171. within Fido.
  172.  
  173. is used by SYSOP.EXE to flag records that should never be
  174. deleted; it is not used by Fido, and new records created by
  175. Fido have this bit clear (like all other bits) to zero.
  176. */
  177.     long stuff;        /* the bits above */
  178.  
  179. /* caller stuff field bits access. */
  180.  
  181. #define CLR_DEL 1        /* delete -- used by sysop/msgmgr */
  182. #define CLR_DELS 31
  183.  
  184. #define CLR_EXT 7        /* extra -- not used */
  185. #define CLR_EXTS 29
  186.  
  187. #define CLR_KEP 1        /* keep -- used by sysop/msgmgr */
  188. #define CLR_KEPS 25
  189.  
  190. #define CLR_LAN 7        /* language selection */
  191. #define CLR_LANS 26
  192.  
  193. #define CLR_PRV 7        /* privilege bit mask/maximum value */
  194. #define CLR_PRVS 22        /* privilege bit shift */
  195.  
  196. #define CLR_LEN    127        /* mask and max value */
  197. #define CLR_LENS 15        /* shift value */
  198.  
  199. #define CLR_WID 127
  200. #define CLR_WIDS 8
  201. #define CLR_NUL 15
  202. #define CLR_NULS 4
  203. #define CLR_HLP 3
  204. #define CLR_HLPS 2
  205. #define CLR_MOR 1
  206. #define CLR_MORS 1
  207. #define CLR_TAB 1
  208. #define CLR_TABS 0
  209. };
  210.  
  211. /* caller privileges */
  212.  
  213. /* PUBLIC */
  214. #define TWIT 0            /* total asshole */
  215. #define DISGRACE 1        /* disgraced caller, */
  216. #define NORMAL 2        /* normal caller, */
  217. #define PRIVEL 3        /* privileged caller, */
  218. #define EXTRA 4            /* extra priveleges, */
  219. #define SYSOP 7            /* SYSOP priveleges, */
  220.  
  221. /* caller help levels */
  222.  
  223. /* PUBLIC */
  224. #define EXPERT 0        /* caller help level: expert */
  225. #define REGULAR 1        /* experienced */
  226. #define NOVICE 2        /* new caller */
  227.  
  228. /* Locks and keys for the access control stuff. These are basically bits
  229. in the LOCK and KEY fields. */
  230.  
  231. /* PUBLIC */
  232. #define K1    1
  233. #define K2    (K1<<1)
  234. #define K3    (K2<<1)
  235. #define K4    (K3<<1)
  236. #define K5    (K4<<1)
  237. #define K6    (K5<<1)
  238. #define K7    (K6<<1)
  239. #define K8    (K7<<1)
  240. #define K9    (K8<<1)
  241. #define K10    (K9<<1)
  242. #define K11    (K10<<1)
  243. #define K12    (K11<<1)
  244. #define K13    (K12<<1)
  245. #define K14    (K13<<1)
  246. #define K15    (K14<<1)
  247. #define K16    (K15<<1)
  248. #define K17    (K16<<1)
  249. #define K18    (K17<<1)
  250. #define K19    (K18<<1)
  251. #define K20    (K19<<1)
  252. #define K21    (K20<<1)
  253. #define K22    (K21<<1)
  254. #define K23    (K22<<1)
  255. #define K24    (K23<<1)
  256. #define K25    (K24<<1)
  257. #define K26    (K25<<1)
  258. #define K27    (K26<<1)
  259. #define K28    (K27<<1)
  260. #define K29    (K28<<1)
  261. #define K30    (K29<<1)
  262. #define K31    (K30<<1)
  263. #define K32    (K31<<1)
  264.  
  265. #define KALL    (-1L)
  266. #define KNONE    (0)
  267.  
  268. #define L1    K1
  269. #define L2    K2
  270. #define L3    K3
  271. #define L4    K4
  272. #define L5    K5
  273. #define L6    K6
  274. #define L7    K7
  275. #define L8    K8
  276. #define L9    K9
  277. #define L10    K10
  278. #define L11    K11
  279. #define L12    K12
  280. #define L13    K13
  281. #define L14    K14
  282. #define L15    K15
  283. #define L16    K16
  284. #define L17    K17
  285. #define L18    K18
  286. #define L19    K19
  287. #define L20    K20
  288. #define L21    K21
  289. #define L22    K22
  290. #define L23    K23
  291. #define L24    K24
  292. #define L25    K25
  293. #define L26    K26
  294. #define L27    K27
  295. #define L28    K28
  296. #define L29    K29
  297. #define L30    K30
  298. #define L31    K31
  299. #define L32    K32
  300.  
  301. #define LALL    KALL
  302. #define LNONE    KNONE
  303.  
  304.  
  305. /* Structure for the time log: first access, last access, and an integer
  306. counter for each hour of each day of the week. */
  307.  
  308. /* PUBLIC */
  309. struct _tlog {
  310.     int calls;        /* # calls in log, */
  311.     char fdate[20];        /* logging started, */
  312.     char ldate[20];        /* logging ended, */
  313.     int log[7][24];        /* the counters, */
  314. };
  315.  
  316. /* Tables of command names and privelege levels for each. */
  317.  
  318. struct _cmd {
  319.     char name[20];        /* command name, */
  320.     char priv;        /* its priv, */
  321.     long locks;        /* lock bits */
  322. };
  323.  
  324. /* Message header structure. The message text is just a long string. The
  325. zone:net/node of course do not conform to the new (v12) standard. */
  326.  
  327. /* PUBLIC */
  328. struct _msg {
  329.     char from[36];        /* who from, */
  330.     char to[36];        /* who to, */
  331.     char subj[72];        /* message subject, */
  332.     char date[20];        /* creation date, */
  333.     int times;        /* number of times read, */
  334.     int dest_node;        /* destination node, */
  335.     int orig_node;        /* originating node */
  336.     int cost;        /* actual cost of this msg */
  337.     int orig_net;        /* v10 originating net */
  338.     int dest_net;        /* v10 destination net */
  339.     int dest_zone;        /* v12 originating zone */
  340.     int orig_zone;        /* v12 destination zone */
  341.     int dest_point;
  342.     int orig_point;
  343.     unsigned reply;        /* thread to previous msg. (reply-to) */
  344.     unsigned attr;        /* message type, see below */
  345.     unsigned up;        /* thread to next msg. (replied-to) */
  346.  
  347. /* NOTE: The date[20] field is another historical embarrasment. The
  348. format is, exactly:
  349.  
  350.     "dd Mon yy  hh:mm:ss"
  351.  
  352. where dd, yy, hh, mm, and ss are two digit numbers, zero filled where
  353. necessary, and Mon is the first three letters of the month, in English,
  354. lower case with the first letter upper case. There are TWO SPACES between
  355. yy and hh.
  356.  
  357.     This format is very important (this is the embarrasing part) because
  358. Fido since v3 has done arithmetic on the string itself. Please preserve this
  359. EXACT FORMAT if you wish things like RENUM and PURGE to work correctly. 
  360. */
  361. };
  362.  
  363. /* Message attribute bits */
  364.  
  365. /* PUBLIC */
  366. #define MSGPRIVATE 1        /* private message, */
  367. #define MSGCRASH 2        /* NOT USED */
  368. #define MSGREAD 4        /* read by addressee */
  369. #define MSGSENT 8        /* sent OK (remote) */
  370. #define MSGFILE 16        /* file(s) attached to msg */
  371. #define MSGFWD 32        /* message in transit */
  372. #define MSGORPHAN 64        /* unknown dest node this sched */
  373. #define MSGKILL 128        /* kill after mailing */
  374. #define MSGLOCAL 256        /* was generated locally */
  375. #define MSGHFP 512        /* Hold For Pickup NOT USED */
  376. #define MSGUNUSED 1024        /* NOT USED */
  377. #define MSGFREQ 2048        /* file(s) requested */
  378. #define MSGRRR 4096        /* Return Receipt Requested NOT USED */
  379. #define MSGIRR 8192        /* Is Return Receipt NOT USED */
  380. #define MSGAR 16384        /* Audit Request NOT USED */
  381. #define MSGFUR 32768        /* File Update Request NOT USED */
  382.  
  383. /* Bits allowed in packets and after unpacking, ie. this mask is used to
  384. strip off message attribute bits. */
  385.  
  386. #define MSGMASK (MSGPRIVATE | MSGCRASH | MSGFILE | MSGUNUSED | MSGRRR | MSGIRR | MSGAR)
  387.  
  388. /* Modem type values */
  389.  
  390. #define NOMODEM 0        /* no modem */
  391. #define HAYES 1            /* DC Hayes and clones */
  392. #define DIRECT 2        /* direct connection */
  393. #define USR 5            /* US Robotics */
  394. #define POPCOM 7        /* Popcom */
  395. #define POP24 8            /* POPCOM 2400 */
  396. #define GDC 10            /* General Data Comm */
  397. #define HAYES24 11        /* Hayes 2400 */
  398. #define USR24 12        /* USR 2400 */
  399. #define MT24 13            /* Multi Tech 2400 */
  400. #define HST 14            /* US Robotics Courier HST, variable rate */
  401. #define HAYES3 15        /* SmartModem 300 */
  402. #define HST2 16            /* HST, fixed at 9600 */
  403. #define HST3 17            /* HST, fixed at 19200 */
  404. #define TBT 18            /* Telebit TrailBlazer, variable rate */
  405. #define TBT2 19            /* Telebit, fixed at 9600 */
  406. #define TBT3 20            /* Telebit, fixed at 19200 */
  407. #define SMV1 21            /* Hayes V-series SmartModem 9600, no ASB */
  408. #define SMV2 22            /* Hayes V-series SmartModem 9600, with ASB */
  409. #define SMV3 23            /* Hayes V-series SmartModem 19200, with ASB */
  410. #define HST4 24            /* HST, fixed at 38400 */
  411. #define USR24H 25        /* USR 2400, hardware handshake */
  412. #define VARF 26            /* fixed rate modem, X1 init */
  413. #define DST1 27            /* Dual Standard HST, fixed at 9600 */
  414. #define DST2 28            /* Dual Standard HST, fixed at 19200 */
  415.  
  416. /* List of message, download and upload areas, as contained in the
  417. big system file. */
  418.  
  419. /* PUBLIC */
  420. struct _area {
  421.     char number;        /* this areas number (in-memory use only) */
  422.     char priv;        /* minimum privilege, */
  423.     long locks;        /* locks needed, */
  424.     char taskid;        /* taskID this is for else 0 */
  425.     char extra;        /* RESERVED */
  426.     char reserved[6];    /* RESERVED */
  427.     char name[16];        /* area name */
  428.     char path[PS];        /* the path string, */
  429.     char upath[PS];        /* alternate (upload) path (RESERVED in msg areas) */
  430.     char desc[PS];        /* the description */
  431.     char flags;        /* bit flags, see below */
  432. };
  433.  
  434. #define AREA_OVW 1        /* allow overwriting in this area */
  435. #define AREA_UPLD 2        /* allow uploading to this area */
  436. #define AREA_ANON 4        /* all messages are from: Anon */
  437. #define AREA_NPVT 8        /* no private messages */
  438. #define AREA_PVT 16        /* all are private messages */
  439. #define AREA_SHARED 32        /* this directory shared with other programs */
  440. #define AREA_RO 64        /* this area is read-only */
  441. #define AREA_ECHO 128        /* this area is an echo area (for 'emit-v11') */
  442.  
  443. /* Internal structure containing stats on the message areas in the system. */
  444.  
  445. struct _msgstat {
  446.     FLAG checked;        /* 1 == checked for mail & counted here */
  447.     unsigned highest;    /* highest msg this area, */
  448.     unsigned total;        /* total messages this area */
  449. };
  450.  
  451. #define SCHEDS 100        /* size of scheduler event table */
  452.  
  453. /* Scheduler event structure within FIDO.SYS. Tags defined:
  454.  
  455. ' ' (ASCII 20h)    disabled event
  456. NUL        disabled event
  457. A - W        FIDONET events
  458. X        ERRORLEVEL event
  459. Y        YELL (P)age) command enable
  460. Z        FREQ (file request) enable
  461. !        IDLE event
  462. all others    RESERVED
  463. */
  464.  
  465. /* PUBLIC */
  466. struct _sched {
  467.     char bits;        /* see below */
  468.     char tag;        /* event type, above, */
  469.     char daywk;        /* event start time: day of the week, */
  470.     char hr;        /*   hour, */
  471.     char min;        /*   minute, */
  472.     int len;        /* event length, in minutes */
  473.     char result;        /* errorlevel */
  474.     char swtch;        /* event enable switch */
  475.     char taskid;        /* which taskID else 0 */
  476. };
  477.  
  478. #define SCHED_OPTIONAL 1    /* this event may be skipped */
  479. #define SCHED_COMPLETE 2    /* this event already run */
  480. #define SCHED_RUSH 4        /* this event is a RUSH event */
  481. #define SCHED_QUICK 8        /* this event is a QUICK (fidonet) event */
  482. #define SCHED_CNT 16        /* this event is CONTINUOUS (fidonet) event */
  483.  
  484. /* FIDO.SYS: This is where Fido keeps global things. External programs
  485. should use FIDO.SYS, not MAIL.SYS or any of the OBSO structures. This file 
  486. is created by Fido when it does not exist or the version is wrong, and
  487. is written out when a session ends. */
  488.  
  489. /* PUBLIC */
  490. struct _fido {
  491.  
  492.     char fido_version;    /* FIDO.EXE version number */
  493.     char file_version;    /* FIDO.SYS version */
  494.  
  495.     long quote_pos;        /* quote file position */
  496.     long callers;        /* number of callers */
  497.  
  498. /* If autolog is not -1 then this record number in the caller file is
  499. logged on, bypassing the usual signon logic, and setting the baud rate
  500. and time limit remaining from the caller record. When a caller is 
  501. logged off, this is cleared to zero. */
  502.  
  503.     unsigned caller;    /* current caller recd # logged in */
  504.     unsigned autolog;    /* log this caller on if not -1 */
  505.  
  506. /* Since we expanded the _node definition to include point, it doesn't
  507. fit; unravel it here, and expand at runtime. (Yuck.) */
  508.  
  509.     int zone;        /* zone number */
  510.     int net;        /* net number */
  511.     int number;        /* node number */
  512.  
  513.     int altzone;        /* zone number */
  514.     int altnet;        /* net number */
  515.     int altnumber;        /* node number */
  516.  
  517. /* File and message area structures are stored in FIDO.SYS, by simply appending
  518. them to the end of the file. To read them, you have to calculate their
  519. position in the file as follows: (code below is exact)
  520.  
  521.  
  522.     msg area #N structure is at:
  523.  
  524. long offset;
  525.     offset= fido.areaoff + (N * sizeof(struct _area))
  526.  
  527.  
  528.     file area #N structure is at:
  529.  
  530. long offset;
  531.     offset= fido.areaoff + (fido.marea_max * sizeof(struct _area))
  532.         + (N * sizeof(struct _area)
  533.  
  534. You then seek to the correct position and load the structure:
  535.  
  536.     lseek(file,offset,0);            /* seek to correct position */
  537.     read(file,&area,sizeof(struct _area));    /* load it */
  538.  
  539.  
  540. NOTE: fido.areaoff is the size of the FIDO.SYS structure itself, starting
  541. with version 12n. Before that it was zero; substitute XXXX as the size
  542. of FIDO.SYS. 
  543.  
  544.     The file area stuff tacked onto the end is PUBLIC.
  545. */
  546.     unsigned marea_max;    /* number of message areas */
  547.     unsigned farea_max;    /* number of file areas */
  548.  
  549.     char bucks;        /* monetary character */
  550.     char sep_char;        /* 1000's separator character, */
  551.     char dec_char;        /* decimal point character */
  552.  
  553.     unsigned mdmtype;    /* type of modem */
  554.     unsigned maxbaud;    /* 0, or override maximum baud rate */
  555.     char mdmstr[40];    /* modem initialization string */
  556.     char extra12[40];    /* RESERVED */
  557.  
  558.     unsigned connect_tries;    /* attempt with connect limit */
  559.     unsigned dial_tries;    /* dial attempts */
  560.     char nodepath[PS];    /* nodelist work area */
  561.     char rings;        /* number of rings to answer the phone */
  562.     char extra8[16];    /* RESERVED */
  563.     char netmarea;        /* FidoNet msg area number */
  564.     char netfarea;        /* FidoNet file area number */
  565.  
  566.     unsigned cd_bit;    /* bit to test for Carrier Detect, */
  567.     unsigned iodev;        /* default serial channel number */    
  568.  
  569.     struct _sched sched[SCHEDS]; /* the schedulers event table */
  570.     unsigned event;        /* currently running event or -1 */
  571.     char tag;        /* current event tag */
  572.  
  573.     char termcode;        /* return code for E)xitDOS */
  574.     char outcode;        /* code to return for O)utside */
  575.     char byecode;        /* code to return for normal logoff */
  576.     char mailcode;        /* code to return after incoming mail */
  577.  
  578.     unsigned textlines;    /* max lines for the msg editor */
  579.     char dial_interval;    /* how often to dial */
  580.     char cont_interval;    /* how often to reenable CONT events */
  581.     char filecode;        /* code to return after incoming files */
  582.  
  583.     unsigned slimit;    /* logon time limit, */
  584.     unsigned nlimit;    /* normal callers limit, */
  585.     unsigned first_limit;    /* limit for 1st time callers, */
  586.     unsigned dlimit;    /* daily maximum time limit, */
  587.     unsigned klimit;    /* 48 hr K byte limit, */
  588.  
  589.     char defmnbr;        /* caller default msg area number */
  590.     char deffnbr;        /* caller default file area number */
  591.     char logonbr;        /* caller logoff comment msg area number */
  592.     char def_priv;        /* default privelege for new callers, */
  593.     long def_keys;        /* caller default keys for new callers */
  594.  
  595. /* Late additions */
  596.  
  597.     char mtasker;        /* multitasker program type */
  598.     unsigned extra15;    /* RESERVED (was modem fixed link rate) */
  599.     char fbits[40];        /* FBIT enables, see below */
  600.     char dial_pref[30];    /* FidoNet dial string prefix */
  601.     char syspath[50];    /* system file path */
  602.     unsigned zmttype;    /* Zmodem Tx behaviour */
  603.     unsigned zmrtype;    /* Zmodem Rx behaviour */
  604.     char switches;        /* event toggle switches */
  605.     char oneshots;        /* event one shot switches */
  606.     char name[60];        /* system name */
  607.     char extra13;        /* RESERVED */
  608.  
  609. /* THINGS BEYOND THIS POINT ARE NOT WRITTEN OUT BY FIDO!!!! Runtime
  610. statistics must be stored before this. */
  611.  
  612. /* The command table stuff is gross. The tables are fixed size, and hard
  613. coded here and in SET-FIDO, where they are loaded. The number is the
  614. number of commands + 1 (for the null name). */
  615.  
  616.     struct _cmdtable {        /* table of Fido commands */
  617.         struct _cmd    main[14];/* main section */
  618.         struct _cmd     chg[10];/* C)hange */
  619.         struct _cmd     msg[16];/* message section */
  620.         struct _cmd    file[13];/* file section */
  621.         struct _cmd    edit[10];/* edit msg */
  622.         struct _cmd  trigger[4];/* T)rigger command */
  623.         struct _cmd  fileatt[4];/* file attach/request */
  624.         struct _cmd bulletin[1];/* bulletins */
  625.         struct _cmd    extra[8];/* unused */
  626. /*            ---------------
  627.             total:   80
  628. */
  629.     } cmd;
  630.  
  631.     char extra14[8];    /* RESERVED */
  632.     char ext_logins[10];    /* "External Login" <X> ERRORLEVELs */
  633.     unsigned zmtstart;    /* Zmodem starting Tx block size */
  634.     unsigned zmblkmax;    /* Zmodem maximum block size and allocation */
  635.  
  636.     int point;        /* our point address */
  637.     int altpoint;
  638.     char textpath[PS];    /* path to .HLP, text .BBS files */
  639.  
  640.     char extra6[108];    /* RESERVED */
  641.  
  642. /* This is the size of FIDO.SYS. It was 0000h before version 12n. The idea
  643. is that you read in XXXX bytes (the complete basic FIDO.SYS file) which gets
  644. you all of the above fields. If areaoff is larger than what you just read,
  645. read some more; it is an extended FIDO.SYS file. (Not yet used.) */
  646.  
  647.     unsigned areaoff;    /* size of main FIDO.SYS file -- offset to areas */
  648. };
  649.  
  650. /* Bits for fido.fbits; these are converted into byte/bit. */
  651.  
  652. #define FBIT_QUICK 0        /* Q)uick login enable */
  653. #define FBIT_SEENBY 1        /* dont display SEEN-BYs */
  654. /* #define FBIT_ZMODE 2    */    /* enable kludgey 12i "Zmode" */
  655. #define FBIT_TSYNC 3        /* enable multiple TSYNCs */
  656. #define FBIT_WAZOO 4        /* enable Wazoo */
  657. #define FBIT_FSC001 5        /* force pure FSC001 protocols */
  658. #define FBIT_FREQ 6        /* File Request enable */
  659. #define FBIT_NEWCLR 7        /* Accept new callers */
  660. #define FBIT_XFERDISP 8        /* Display file transfer status */
  661. #define FBIT_NOMAIL 9        /* Do not run mail (huh?) */
  662. #define FBIT_PATHDISP 10    /* Display File Area pathnames */
  663. #define FBIT_KEEPNMP 11        /* keep .NMP files between events */
  664. #define FBIT_DIETIFNA 12    /* enable Bob Hartman's DIETIFNA spoof */
  665. #define FBIT_KPACKET 13        /* keep packets around after terminate */
  666. #define FBIT_TLG 14        /* generate timelogs */
  667. #define FBIT_NLG 15        /* generate net logs */
  668. #define FBIT_LINGUAL 16        /* requires multiple COMMAND.SYS's / .INI's */
  669. #define FBIT_YNAME 17        /* suppress "Y" as last name */
  670. #define FBIT_V11 18        /* generate version 11 type files also */
  671. #define FBIT_FNAME 19        /* allow free-format caller names */
  672.  
  673.  
  674. /* This structure used to be stored on disk as NODELIST.SYS, but is now
  675. filled in when needed, from the text file NODELIST.BBS. (Saves TONS of 
  676. space). */
  677.  
  678. #define NODEVERS 8        /* nodelist version */
  679.  
  680. struct _ndat {
  681.     struct _node node;    /* read from .IDX */
  682.     int cost;        /* cost per call */
  683.     int rate;        /* baud rate */
  684.     char name[40];        /* node name */
  685.     char phone[40];        /* phone number */
  686.     char city[40];        /* city and state, */
  687.     char pwd[9];        /* per-node password */
  688. };
  689.  
  690. /* Node map; NODELIST.NMP. This is the N x N matrix that does the routing.
  691. It is implemented as a reentrant table; look up NODE, then lookup the
  692. ROUTE-TO node in the table, and use the NODE there. The bits determine
  693. various other things.
  694.  
  695. The 0th record is special; see the _rptrcd structure definition below.
  696.  
  697. Note that this is no longer a very self-explantory structure; it is stored
  698. in an extremely compact form. Instead of a simple 2 column table with each 
  699. column a _node address, the first column is actually the .IDX index (since
  700. it is read-only), and the second column is the record number that points
  701. to the appropriate node address in the .IDX file again. Plus there's bits
  702. in there. 
  703.  
  704. (Thanks Laeeth Isaacs for pointing out the redundant _node struct in NODEVER 5!) */
  705.  
  706. struct _nmp {
  707.     unsigned route_recd;    /* route-to address record number */
  708.     char bits;        /* see NMAP_ defs below */
  709.     char attr;        /* see NMAP_ defs below */
  710. };
  711.  
  712. /* This is the in-memory structure, built from the _node address contained
  713. in the .IDX index file, and the _nmp data structure above. */
  714.  
  715. struct _nmap {            /* refer to NODELIST.SYS file for the version */
  716.     struct _node node;    /* actual address (-1 for regions, etc) */
  717.     unsigned route_recd;    /* route-to addresses record number */
  718.     char bits;        /* see below */
  719.     char attr;        /* see below */
  720. };
  721. #define NMAP_ACCEPT 1        /* ACCEPT-FROM this node */
  722. #define NMAP_PU 2        /* PICKUP from this node */
  723. #define NMAP_POLL 4        /* POLL this node */
  724. #define NMAP_ALIAS 8        /* ALIAS these nodes */
  725. #define NMAP_SEND 16        /* is marked as SEND-TO */
  726. #define NMAP_HOLD 32        /* HOLD mail for this node */
  727. #define NMAP_UPDATE 64        /* re-create the packet to this node */
  728.  
  729. /* These are nmap.attr defs. We distinguish between HOST and REGION by the 
  730. node number; 0 means a HOST, and -1 means a REGION host. 125/0 is a net host 
  731. and we do default host-routing; 10/0 is a region host and does not get default 
  732. host routing; it is stored internally as 10/-1. */
  733.  
  734. #define NMAP_REGION 128        /* this (/0) node is a region host; no default host routing */
  735.  
  736. /* Nodelist index file; NODELIST.IDX and NODELIST.NDX. For .IDX, 'pos' is 
  737. the actual NODELIST.BBS text record file position; for .NDX it is the 
  738. record number of the index and nodelist entry. Since this file is public,
  739. we simulate the original _node definition. */
  740.  
  741. struct _idx {
  742.     int zone;        /* zone number */
  743.     int net;        /* net number */
  744.     int number;        /* node number */
  745.     long pos;        /* record or position */
  746. };
  747.  
  748. /* NODELIST.NTC file: this is an index to NODELIST.NMP entries that
  749. have messages to them; it is created and used only during FidoNet time */
  750.  
  751. struct _ntc {
  752.     struct _node node;    /* node address */
  753.     unsigned recd;        /* recd # in .NMP, .IDX */
  754.     unsigned time;        /* total connect time, seconds, */
  755.     unsigned xfer_time;    /* file transfer time only, seconds, */
  756.     long bytes;        /* total bytes transferred, */
  757.     char msgs;        /* number of messages in the packet, */
  758.     char files;        /* files in the packet, */
  759.     char tries;        /* number of attempts to send, */
  760.     char connects;        /* number of actual connections */
  761.     char bits;        /* see below */
  762.     char totl_tries;    /* total number of tries this event */
  763.     char extra[4];        /* RESERVED */
  764. };
  765. #define NTC_SUCCESS 1        /* Status: sucessful transmission */
  766. #define NTC_PD 2        /* Status: mail was picked up, dont send */
  767. #define NTC_KILLED 4        /* Status: packets etc killed */
  768. #define NTC_REPACKET 8        /* Status: recreate packet please (msg changed) */
  769.  
  770. #define NTC_PU 64        /* Attribute: attempt pickup */
  771. #define NTC_HOLD 128        /* Attribute: do not call, hold for pickup */
  772.  
  773. /* Message packet header. */
  774.  
  775. #define PKTVER 2        /* v10 = 1, v11 = 2 ... */
  776.  
  777. /* PUBLIC */
  778. struct _pkthdr {
  779.     int orig_number;    /* v9 originating Node # */
  780.     int dest_number;    /* v9 destination node */
  781.     int year,month,day,hour,minute,second;
  782.     int rate;        /* v9 OBSO RESERVED baud rate */
  783.     int ver;        /* packet version */
  784.  
  785.     int orig_net;        /* v11 originating net number */
  786.     int dest_net;        /* v11 destination net number */
  787.  
  788.     char product1;        /* v11 product type */
  789.     char product2;        /* v11 extra byte */
  790.     char pwd[8];        /* password */
  791.  
  792.     int orig_zone;        /* originating zone */
  793.     int dest_zone;        /* destination zone */
  794.  
  795.     char extra[16];        /* extra bytes */
  796.     long prod;        /* product dependent */
  797. };
  798.  
  799. /* Wazoo hello packet. */
  800.  
  801. struct _wazoo {
  802.     int signal;        /* always 0x006f */
  803.     int version;
  804.     int product;
  805.     int rev;        /* major rev number */
  806.     int ver;        /* letter code */
  807.     char name[60];        /* system name */
  808.     char sysop[20];        /* sysop name */
  809.     unsigned zone;
  810.     unsigned net;
  811.     unsigned node;
  812.     unsigned point;
  813.     char password[8];
  814.     char reserved[8];    /* Opus reserved */
  815.     unsigned bits;        /* see below */
  816.     char proprietary[12];
  817. };
  818.  
  819. /* Capability bits for above. */
  820.  
  821. #define WAZ_DIETIFNA    1    /* can do DIETIFNA (not SEALINK!) */
  822. #define WAZ_ZMODEM    8    /* can do ZMODEM */
  823. #define WAZ_FREQ    32768    /* can do file requests */
  824.  
  825. /* This is the structure prepended to the nodemaps; it contains
  826. information on the contents of the route file used to generate the
  827. NMP file. To avoid storing FIDO.SYS data in here (which would remain
  828. unchanged if SET-FIDO /K were used) variables are stored such that we
  829. detect which ones are specified in the route file; only those are 
  830. set at run time. (Very Icky.) */
  831.  
  832. struct _rptrcd {
  833.     char revision;        /* nodelist file revision */
  834.     char tag;        /* current schedule */
  835.     char bits;        /* (see below) */
  836.     char extra;
  837.  
  838. /* These are all int's, so that we can test for un-set as < 0. */
  839.  
  840.     int dial_interval;    /* how often to dial */
  841.     int cont_interval;    /* how often to reenable CONT events */
  842.  
  843.     int rings;        /* number of rings to answer the phone */
  844.     int connect_tries;    /* attempt with connect limit */
  845.     int dial_tries;        /* dial attempts */
  846.  
  847.     int mailcode;        /* exit to DOS when msgs received */
  848.     int filecode;        /* exit to DOS when files received */
  849.  
  850.     int iodev;        /* default serial channel number */
  851.     int mdmtype;        /* type of modem (see fido.linkrate) */
  852.     int maxbaud;        /* maximum baud rate */
  853.     int cd_bit;        /* bit to test for Carrier Detect, */
  854.  
  855.     char mdmstr[40];    /* modem initialization string */
  856.     char dial_pref[30];    /* FidoNet dial string prefix */
  857. };
  858.  
  859. #define RPT_EXT 0        /* external mail flag shift value */
  860. #define RPT_SO 1        /* send-only shift */
  861. #define RPT_RO 2        /* recv-only shift */
  862.  
  863. #include <\fido\text.h>        /* path so's can be @include'd from \FIDO\TOOLS */
  864.