home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 2 BBS / 02-BBS.zip / BSRC_250.LZH / BINK.H < prev    next >
C/C++ Source or Header  |  1991-09-15  |  36KB  |  936 lines

  1. /*--------------------------------------------------------------------------*/
  2. /*                                                                          */
  3. /*                                                                          */
  4. /*      ------------         Bit-Bucket Software, Co.                       */
  5. /*      \ 10001101 /         Writers and Distributors of                    */
  6. /*       \ 011110 /          Freely Available<tm> Software.                 */
  7. /*        \ 1011 /                                                          */
  8. /*         ------                                                           */
  9. /*                                                                          */
  10. /*  (C) Copyright 1987-91, Bit Bucket Software Co., a Delaware Corporation. */
  11. /*                                                                          */
  12. /*                                                                          */
  13. /*                 Major definitions used in BinkleyTerm                    */
  14. /*                                                                          */
  15. /*                                                                          */
  16. /*    For complete  details  of the licensing restrictions, please refer    */
  17. /*    to the License  agreement,  which  is published in its entirety in    */
  18. /*    the MAKEFILE and BT.C, and also contained in the file LICENSE.250.    */
  19. /*                                                                          */
  20. /*    USE  OF THIS FILE IS SUBJECT TO THE  RESTRICTIONS CONTAINED IN THE    */
  21. /*    BINKLEYTERM  LICENSING  AGREEMENT.  IF YOU DO NOT FIND THE TEXT OF    */
  22. /*    THIS  AGREEMENT IN ANY OF THE  AFOREMENTIONED FILES,  OR IF YOU DO    */
  23. /*    NOT HAVE THESE FILES,  YOU  SHOULD  IMMEDIATELY CONTACT BIT BUCKET    */
  24. /*    SOFTWARE CO.  AT ONE OF THE  ADDRESSES  LISTED BELOW.  IN NO EVENT    */
  25. /*    SHOULD YOU  PROCEED TO USE THIS FILE  WITHOUT HAVING  ACCEPTED THE    */
  26. /*    TERMS  OF  THE  BINKLEYTERM  LICENSING  AGREEMENT,  OR  SUCH OTHER    */
  27. /*    AGREEMENT AS YOU ARE ABLE TO REACH WITH BIT BUCKET SOFTWARE, CO.      */
  28. /*                                                                          */
  29. /*                                                                          */
  30. /* You can contact Bit Bucket Software Co. at any one of the following      */
  31. /* addresses:                                                               */
  32. /*                                                                          */
  33. /* Bit Bucket Software Co.        FidoNet  1:104/501, 1:343/491             */
  34. /* P.O. Box 460398                AlterNet 7:491/0                          */
  35. /* Aurora, CO 80046               BBS-Net  86:2030/1                        */
  36. /*                                Internet f491.n343.z1.fidonet.org         */
  37. /*                                                                          */
  38. /* Please feel free to contact us at any time to share your comments about  */
  39. /* our software and/or licensing policies.                                  */
  40. /*                                                                          */
  41. /*--------------------------------------------------------------------------*/
  42.  
  43. /*--------------------------------------------------------------------------*/
  44. /* LEGIBLE SECTION.  Definitions to make "C" look like a real language.     */
  45. /*--------------------------------------------------------------------------*/
  46.  
  47. #ifndef BINK_DEFINED
  48. #define BINK_DEFINED
  49.  
  50. #ifndef max
  51. #define max(a,b)     ((a)>(b)?(a):(b))
  52. #endif
  53.  
  54. #ifndef min
  55. #define min(a,b)     ((a)<=(b)?(a):(b))
  56. #endif
  57.  
  58. /*
  59.  * updcrc macro derived from article Copyright (C) 1986 Stephen Satchell. 
  60.  *  NOTE: First argument must be in range 0 to 255.
  61.  *        Second argument is referenced twice.
  62.  * 
  63.  * Programmers may incorporate any or all code into their programs, 
  64.  * giving proper credit within the source. Publication of the 
  65.  * source routines is permitted so long as proper credit is given 
  66.  * to Stephen Satchell, Satchell Evaluations and Chuck Forsberg, 
  67.  * Omen Technology.
  68.  */
  69.  
  70. #define updcrc(cp, crc) ( crctab[((crc >> 8) & 255) ^ cp] ^ (crc << 8))
  71.  
  72. /* We need it the other way around for BinkleyTerm */
  73. #define xcrc(crc,cp) ( crctab[((crc >> 8) & 255) ^ cp] ^ (crc << 8))
  74.  
  75. typedef unsigned bit;
  76. typedef unsigned int word;
  77. typedef unsigned char byte;
  78.  
  79. #define fallthrough
  80.  
  81. #define LOCAL        static
  82. #define empty_str    ""
  83.  
  84. /* The following changes by Greylock Software, to facilitate the MEWEL
  85.  * version of Bink.
  86.  */
  87.  
  88. #define PRDCT_NM(m)     PrdctTbl[m]
  89. #define WELCOME_LEN     1024
  90.  
  91. #define POLL_POPUP
  92. #define EventSub()
  93.  
  94. #ifdef MILQ
  95. #include "Milq.H"
  96. #endif
  97.  
  98.  
  99. /*
  100.  * This is an attempt to clean up some of the mess.  No longer will
  101.  * we ifdef MILQ simple SendMessages. This should make the code
  102.  * considerably more readable.  In the context of simple Bink,
  103.  * SendMessage has no meaning.
  104.  */
  105.  
  106. #ifndef MILQ
  107. #define GetDlgItem(a,b)      a
  108. #define FlLnModeSet(a,b)
  109. #define SendMessage(a,b,c,d)
  110. #define WinClear(w)
  111. #define WinDrawAllWindows()
  112. #define WinSetText(a,b)
  113. #define call_hWnd       callwin
  114. #define file_hWnd       filewin
  115. #define history_hWnd    historywin
  116. #define history_BBS     historywin
  117. #define history_Cost    historywin
  118. #define history_Fl      historywin
  119. #define history_Last    historywin
  120. #define history_Out     historywin
  121. #define hold_hWnd       holdwin
  122. #define hold_Poll       holdwin
  123. #define hold_Addr       holdwin
  124. #define hold_Init       holdwin
  125. #define hold_Hdr        holdwin
  126. #define HoldWndDtl(x)   holdwin
  127. #define settings_hWnd   settingswin
  128. #define settings_DtTm   settingswin
  129. #define settings_Evt    settingswin
  130. #define settings_Port   settingswin
  131. #define settings_MTask  settingswin
  132. #define settings_Status settingswin
  133. #endif
  134.  
  135. /* These should be stomped out of existance.  They are bad memories
  136.  * from a failed experiment.  However, these should NOT be eliminated
  137.  * yet.  NULL in the MEWEL environment IS NOT the same as NULL in the
  138.  * BC environment.  Comparisons to NULLGLOBALPTR should NOT simply be
  139.  * changed to NULL, but rather (char far *)0.
  140.  */
  141.  
  142. #define NULLGLOBALPTR   (char far *)0
  143. #define NULLLOCALPTR    (char *)0
  144.  
  145. struct _lang_hdr
  146. {
  147.    int ElemCnt;
  148.    int PoolSize;
  149. };
  150.  
  151. struct _key_fnc
  152. {
  153.    int FncIdx;
  154.    int ScanCode;
  155.  };
  156.  
  157. struct _key_fnc_hdr
  158. {
  159.    int              KeyFncCnt;
  160.    int             *KeyFncAry;
  161.    struct _key_fnc *KeyFncTbl;
  162.  };
  163.  
  164.  
  165. #define FA_RDONLY   0x01    /* File is readonly */
  166. #define FA_HIDDEN   0x02    /* File is hidden   */
  167. #define FA_SYSTEM   0x04    /* System file      */
  168. #define FA_VOLID    0x08    /* Volume ID        */
  169. #define FA_SUBDIR   0x10    /* Subdirectory     */
  170. #define FA_ARCH     0x20    /* Archive file     */
  171.  
  172. struct FILEINFO
  173. {
  174.    char rsvd[21];
  175.    char attr;
  176.    long time;
  177.    long size;
  178.    char name[13];
  179.    char nill;
  180. };
  181.  
  182.  
  183. #define DENY_ALL   0
  184. #define DENY_NONE  1
  185. #define DENY_READ  2
  186. #define DENY_RDWR  3
  187. #define DENY_WRITE 4
  188.  
  189.  
  190. typedef struct pnums
  191. {
  192.    char num[20];
  193.    char pre[20];
  194.    char suf[20];
  195.    int len;
  196.    struct pnums *next;
  197. } PN_TRNS;
  198.  
  199. typedef struct mnums
  200. {
  201.    byte mdm;
  202.    char pre[50];
  203.    char suf[50];
  204.    struct mnums *next;
  205. } MDM_TRNS;
  206.  
  207.  
  208. struct prototable
  209. {
  210.    char first_char;
  211.    int entry;
  212. };
  213.  
  214. typedef struct j_types
  215. {
  216.    char j_match[30];
  217.    struct j_types *next;
  218. } J_TYPES, *J_TYPESP;
  219.  
  220. /* mailtypes bit field definitions */
  221. #define MAIL_CRASH   0x0001
  222. #define MAIL_HOLD    0x0002
  223. #define MAIL_DIRECT  0x0004
  224. #define MAIL_NORMAL  0x0008
  225. #define MAIL_REQUEST 0x0010
  226. #define MAIL_WILLGO  0x0020
  227. #define MAIL_TRIED   0x0040
  228. #define MAIL_TOOBAD  0x0080
  229. #define MAIL_UNKNOWN 0x0100
  230. #define MAIL_RES0200 0x0200
  231. #define MAIL_QSMALL  0x0400
  232. #define MAIL_RES0800 0x0800
  233. #define MAIL_RES1000 0x1000
  234. #define MAIL_RES2000 0x2000
  235. #define MAIL_RES4000 0x4000
  236. #define MAIL_RES8000 0x8000
  237.  
  238. typedef struct finfo
  239. {
  240.    int info_size;
  241.    char curr_fossil;
  242.    char curr_rev;
  243.    char far *id_string;
  244.    int ibufr;
  245.    int ifree;
  246.    int obufr;
  247.    int ofree;
  248.    byte swidth;
  249.    byte sheight;
  250.    char baud;
  251. } FOSINFO;
  252.  
  253. typedef int (*PFI3) (int, int, int, int);
  254.  
  255. typedef struct {
  256.    unsigned char background;
  257.    unsigned char settings;
  258.    unsigned char history;
  259.    unsigned char hold;
  260.    unsigned char call;
  261.    unsigned char file;
  262.    unsigned char calling;
  263.    unsigned char popup;
  264. } SB_COLORS;
  265.  
  266. /*--------------------------------------------------------------------------*/
  267. /* Sealink and Telink header structure                                      */
  268. /*--------------------------------------------------------------------------*/
  269. #define HEADER_NAMESIZE  17
  270.  
  271. struct zero_block
  272. {
  273.    long size;                                    /* file length                    */
  274.    long time;                                    /* file date/time stamp           */
  275.    char name[HEADER_NAMESIZE];                   /* original file name             */
  276.    char moi[15];                                 /* sending program name           */
  277.    char noacks;                                  /* for SLO                        */
  278. };
  279.  
  280.  
  281. /*--------------------------------------------------------------------------*/
  282. /* NodeList.Sys                                                             */
  283. /*                                                                          */
  284. /*    NET > 0 and NODE > 0    Normal node                                   */
  285. /*                                                                          */
  286. /*    NET > 0 and NODE <= 0   Host node                                     */
  287. /*                               Net host........node== 0                   */
  288. /*                               Regional host...node==-1                   */
  289. /*                               Country host....node==-2                   */
  290. /*                                                                          */
  291. /*    NET == -1      Nodelist.Sys revision                                  */
  292. /*                                                                          */
  293. /*    NET == -2      Nodelist statement                                     */
  294. /*                                                                          */
  295. /*--------------------------------------------------------------------------*/
  296.  
  297.  
  298. /*--------------------------------------------------------------------------*/
  299. /* NODE                                                                     */
  300. /* Please note the NewStyle structure (below).  Time is running out for the */
  301. /* existing `_node' structure!  Opus currently uses the old style node      */
  302. /* structure, but not for long.                                             */
  303. /*--------------------------------------------------------------------------*/
  304. struct _node
  305. {
  306.    int number;                                   /* node number                                   */
  307.    int net;                                      /* net number                                    */
  308.    int cost;                                     /* cost of a message to this
  309.                                                   * node                */
  310.    int rate;                                     /* baud rate                                     */
  311.    char name[20];                                /* node name                                     */
  312.    char phone[40];                               /* phone number                                  */
  313.    char city[40];                                /* city and state                                */
  314. };
  315.  
  316.  
  317. /*--------------------------------------------------------------------------*/
  318. /* THE NEWSTYLE NODE LIST IS NOW BEING USED BY OPUS 1.10                    */
  319. /*--------------------------------------------------------------------------*/
  320. struct _newnode
  321. {
  322.    word NetNumber;
  323.    word NodeNumber;
  324.    word Cost;                                    /* cost to user for a
  325.                                                   * message */
  326.    char SystemName[34];                          /* node name */
  327.    char PhoneNumber[40];                         /* phone number */
  328.    char MiscInfo[30];                            /* city and state */
  329.    char Password[8];                             /* WARNING: not necessarily
  330.                                                   * null-terminated */
  331.    word RealCost;                                /* phone company's charge */
  332.    word HubNode;                                 /* node # of this node's hub
  333.                                                   * or point number if node is a point */
  334.    byte BaudRate;                                /* baud rate divided by 300 */
  335.    byte ModemType;                               /* RESERVED for modem type */
  336.    word NodeFlags;                               /* set of flags (see below) */
  337.    word NodeFiller;
  338. };
  339.  
  340. /*--------------------------------------------------------------------------*/
  341. /* nodex.ndx                                                                */
  342. /*                                                                          */
  343. /* Version 7 Nodelist Index structure.  This is a 512-byte record, which    */
  344. /* is defined by three structures:  Record 0 is the Control Record, then    */
  345. /* some number of Leaf Node (LNode) Records, then the Index Node (INode)    */
  346. /* Records.  This defines an unbalanced binary tree.                        */
  347. /*                                                                          */
  348. /* This description is based on Scott Samet's CBTREE.PAS program.           */
  349. /*                                                                          */
  350. /*--------------------------------------------------------------------------*/
  351.  
  352. struct _ndx {
  353.     union
  354.     {
  355.         struct _CtlBlk {
  356.             word    CtlBlkSize; /* Blocksize of Index Blocks   */
  357.             long    CtlRoot;    /* Block number of Root        */
  358.             long    CtlHiBlk;   /* Block number of last block  */
  359.             long    CtlLoLeaf;  /* Block number of first leaf  */
  360.             long    CtlHiLeaf;  /* Block number of last leaf   */
  361.             long    CtlFree;    /* Head of freelist            */
  362.             word    CtlLvls;    /* Number of index levels      */
  363.             word    CtlParity;  /* XOR of above fields         */
  364.         } CtlBlk;
  365.  
  366.         struct _INodeBlk {
  367.             long    IndxFirst;  /* Pointer to next lower level */
  368.             long    IndxBLink;  /* Pointer to previous link    */
  369.             long    IndxFLink;  /* Pointer to next link        */
  370.             int     IndxCnt;    /* Count of Items in block     */
  371.             word    IndxStr;    /* Offset in block of 1st str  */
  372.             /* If IndxFirst is NOT -1, this is INode:          */
  373.             struct _IndxRef {
  374.                 word   IndxOfs; /* Offset of string into block */
  375.                 word   IndxLen; /* Length of string            */
  376.                 long   IndxData;/* Record number of string     */
  377.                 long   IndxPtr; /* Block number of lower index */
  378.             } IndxRef[20];
  379.         } INodeBlk;
  380.  
  381.         struct _LNodeBlk {
  382.                                 /* IndxFirst is -1 in LNodes   */
  383.             long    IndxFirst;  /* Pointer to next lower level */
  384.             long    IndxBLink;  /* Pointer to previous link    */
  385.             long    IndxFLink;  /* Pointer to next link        */
  386.             int     IndxCnt;    /* Count of Items in block     */
  387.             word    IndxStr;    /* Offset in block of 1st str  */
  388.             struct _LeafRef {
  389.                 word   KeyOfs;  /* Offset of string into block */
  390.                 word   KeyLen;  /* Length of string            */
  391.                 long   KeyVal;  /* Pointer to data block       */
  392.             } LeafRef[30];
  393.         } LNodeBlk;
  394.  
  395.         char RawNdx[512];
  396.  
  397.     } ndx;
  398. };
  399.  
  400. /*--------------------------------------------------------------------------*/
  401. /*                                                                          */
  402. /* OPUS 1.20 Version 7 Nodelist structure. Copyright 1991 Wynn Wagner III   */
  403. /* and Doug Boone. Used by permission.                                      */
  404. /*                                                                          */
  405. /*--------------------------------------------------------------------------*/
  406.  
  407. struct _vers7 {
  408.         int    Zone;
  409.         int    Net;
  410.         int    Node;
  411.         int    HubNode;        /* If node is a point, this is point number. */
  412.         word CallCost;         /* phone company's charge */
  413.         word MsgFee;           /* Amount charged to user for a message */
  414.         word NodeFlags;        /* set of flags (see below) */
  415.         byte ModemType;        /* RESERVED for modem type */
  416.         byte Phone_len;
  417.         byte Password_len;
  418.         byte Bname_len;
  419.         byte Sname_len;
  420.         byte Cname_len;
  421.         byte pack_len;
  422.         byte BaudRate;         /* baud rate divided by 300 */
  423. };
  424.  
  425. /*------------------------------------------------------------------------*/
  426. /* Values for the `NodeFlags' field                                       */
  427. /*------------------------------------------------------------------------*/
  428. #define B_hub    0x0001  /* node is a net hub     0000 0000 0000 0001 */
  429. #define B_host   0x0002  /* node is a net host    0000 0000 0000 0010 */
  430. #define B_region 0x0004  /* node is region coord  0000 0000 0000 0100 */
  431. #define B_zone   0x0008  /* is a zone gateway     0000 0000 0000 1000 */
  432. #define B_CM     0x0010  /* runs continuous mail  0000 0000 0001 0000 */
  433. #define B_res1   0x0020  /* reserved by Opus      0000 0000 0010 0000 */
  434. #define B_res2   0x0040  /* reserved by Opus      0000 0000 0100 0000 */
  435. #define B_res3   0x0080  /* reserved by Opus      0000 0000 1000 0000 */
  436. #define B_res4   0x0100  /* reserved by Opus      0000 0001 0000 0000 */
  437. #define B_res5   0x0200  /* reserved for non-Opus 0000 0010 0000 0000 */
  438. #define B_res6   0x0400  /* reserved for non-Opus 0000 0100 0000 0000 */
  439. #define B_res7   0x0800  /* reserved for non-Opus 0000 1000 0000 0000 */
  440. #define B_point  0x1000  /* node is a point       0001 0000 0000 0000 */
  441. #define B_res9   0x2000  /* reserved for non-Opus 0010 0000 0000 0000 */
  442. #define B_resa   0x4000  /* reserved for non-Opus 0100 0000 0000 0000 */
  443. #define B_resb   0x8000  /* reserved for non-Opus 1000 0000 0000 0000 */
  444.  
  445.  
  446.  
  447. /*--------------------------------------------------------------------------*/
  448. /* Nodelist.Idx                                                             */
  449. /* (File is terminated by EOF)                                              */
  450. /*--------------------------------------------------------------------------*/
  451.  
  452. struct _ndi
  453. {
  454.    int node;                                     /* node number  */
  455.    int net;                                      /* net number   */
  456. };
  457.  
  458.  
  459. /*--------------------------------------------------------------------------*/
  460. /* QuickBBS 2.00 QNL_IDX.BBS                                                */
  461. /* (File is terminated by EOF)                                              */
  462. /*--------------------------------------------------------------------------*/
  463.  
  464. struct QuickNodeIdxRecord
  465. {
  466.    unsigned int QI_Zone;
  467.    unsigned int QI_Net;
  468.    unsigned int QI_Node;
  469.    byte QI_NodeType;
  470. };
  471.  
  472.  
  473. /*--------------------------------------------------------------------------*/
  474. /* QuickBBS 2.00 QNL_DAT.BBS                                                */
  475. /* (File is terminated by EOF)                                              */
  476. /*--------------------------------------------------------------------------*/
  477.  
  478. struct QuickNodeListRecord
  479. {
  480.    byte QL_NodeType;
  481.    unsigned int QL_Zone;
  482.    unsigned int QL_Net;
  483.    unsigned int QL_Node;
  484.    char QL_Name[21];                             /* Pascal! 1 byte count, up
  485.                                                   * to 20 chars */
  486.    char QL_City[41];                             /* 1 + 40 */
  487.    char QL_Phone[41];                            /* 1 + 40 */
  488.    char QL_Password[9];                          /* 1 + 8 */
  489.    word QL_Flags;                                /* Same as flags in new
  490.                                                   * nodelist structure */
  491.    word QL_BaudRate;
  492.    word QL_Cost;
  493. };
  494.  
  495.  
  496. /* SEAdog NETLIST.DOG format */
  497. struct netls
  498. {
  499.    int netnum;
  500.    char netname[14];
  501.    char netcity[40];
  502.    int havehost;
  503.    int nethost;
  504.    int havegate;
  505.    int netgate;
  506.    long nodeptr;
  507.    int numnodes;
  508. };
  509.  
  510. /* SEAdog NODELIST.DOG format */
  511. struct nodels
  512. {
  513.    int nodenum;
  514.    char nodename[14];
  515.    char nodecity[40];
  516.    char nodephone[40];
  517.    int havehub;
  518.    int nodehub;
  519.    int nodecost;
  520.    int nodebaud;
  521. };
  522.  
  523. /* Things most nodelists don't contain, but Binkley likes to have */
  524. struct extrastuff
  525. {
  526.    char password[8];
  527.    unsigned int flags1;
  528.    byte modem;
  529.    char extra[5];                                /* for future expansion */
  530. };
  531.  
  532. typedef struct
  533. {
  534.    unsigned char header;
  535.    unsigned char block_num;
  536.    unsigned char block_num_comp;
  537.    unsigned char data_bytes[128];
  538.    unsigned char data_check[2];
  539.    } XMDATA, *XMDATAP;
  540.  
  541. typedef struct
  542. {
  543.    unsigned char header;
  544.    unsigned char block_num;
  545.    unsigned char block_num_comp;
  546.    long filelength;
  547.    union
  548.    {
  549.    struct
  550.       {
  551.       unsigned time;
  552.       unsigned date;
  553.       } twowords;
  554.  
  555.    struct 
  556.       {
  557.       unsigned long timedate;
  558.       } oneword;
  559.    } filetime;
  560.    char filename[16];
  561.    char nullbyte;
  562.    char sendingprog[15];
  563.    char noacks;
  564.    unsigned char crcmode;
  565.    char fill[86];
  566.    unsigned char data_check[2];
  567.    } TLDATA, *TLDATAP;
  568.  
  569. typedef struct
  570. {
  571.    unsigned char header;
  572.    unsigned char block_num;
  573.    unsigned char block_num_comp;
  574.    long filelength;
  575.    unsigned long timedate;
  576.    char filename[17];
  577.    char sendingprog[15];
  578.    char SLO;
  579.    char Resync;
  580.    char MACFLOW;
  581.    char fill[85];
  582.    unsigned char data_check[2];
  583.    } SEADATA, *SEADATAP;
  584.  
  585. typedef struct {
  586.    unsigned int SEAlink:1; /* Can do SEAlink */
  587.    unsigned int SLO:1;     /* Can do SEAlink with Overdrive */
  588.    unsigned int Resync:1;  /* Can do SEAlink with Resync */
  589.    unsigned int MacFlow:1; /* Can do SEAlink with Macintosh flow control */
  590.    unsigned int do_CRC:1;  /* Should do CRC instead of checksum */
  591.    unsigned int TeLink:1;  /* We saw a TeLink header */
  592. } TRANS, *TRANSP;
  593.  
  594. typedef struct {
  595.    char *state_name;
  596.    int (*state_func) ();
  597. } STATES, *STATEP;
  598.  
  599. typedef struct {
  600.    TRANS options;    /* Transfer options */
  601.    int result;       /* Result from last operation */
  602.    int sub_results;  /* Extra result codes */
  603.    long T1;          /* General purpose timer */
  604.    long T2;          /* General purpose timer */
  605.    int Window;       /* SEAlink window size */
  606.    long SendBLK;     /* Current block to be sent */
  607.    long NextBLK;     /* Next block we will try to send */
  608.    long ACKBLK;      /* Block that was last ACK'd */
  609.    long LastBlk;     /* Last block in file */
  610.    long ARBLK;       /* Used in ACK Check calculations */
  611.    long WriteBLK;    /* Block number to write to file */
  612.    long filelen;     /* Length of file being sent */
  613.    long curr_byte;   /* Current byte offset of sending or receiving */
  614.    long prev_bytes;  /* Bytes that we are resyncing over */
  615.    long total_blocks;/* Total number of blocks in file to be received */
  616.    long resync_block;/* Block number we received to resync to */
  617.    int NumNAK;       /* Number of NAK's received this block */
  618.    int ACKsRcvd;     /* Number of ACK's received since file start */
  619.    int ACKST;        /* Current state of the ack/nak state variable */
  620.    int tries;        /* Number of tries thus far */
  621.    int goodfile;     /* 0 if file was bad, 1 if file was good */
  622.    int datalen;      /* Length of data in this block */
  623.    int recblock;     /* Block number received */
  624.    int sent_ACK;     /* Whether or not we sent an ACK already */
  625.    int tot_errs;     /* Total number of errors */
  626.    unsigned char ARBLK8;   /* 8 bit value of ARBLK */
  627.    unsigned char blocknum; /* 8 bit value of SendBLK */
  628.    unsigned char check;    /* checksum value */
  629.    unsigned char save_header; /* Received header from first block */
  630.    int CHR;                /* General purpose receive character */
  631.    union                   /* File date and time in Telink or SEAlink format */
  632.    {
  633.    struct
  634.       {
  635.       unsigned time;
  636.       unsigned date;
  637.       } twowords;
  638.  
  639.    struct 
  640.       {
  641.       unsigned long timedate;
  642.       } oneword;
  643.    } save_filetime;
  644.    char received_name[20]; /* Received filename from Telink or SEAlink */
  645.    char m7name[12];        /* Filename in Modem7 format */
  646.    char sending_program[16];/* Sending program name                    */
  647.    char *filename;         /* The filename to be sent or received */
  648.    char *path;             /* Just the path to the file to be sent/received */
  649.    char *fptr;             /* Pointer into character fields */
  650.    char *temp_name;        /* Temporary name for receiving */
  651.    FILE *file_pointer;     /* The pointer for read/write/seek operations */
  652.  
  653.    unsigned char header;
  654.    unsigned char block_num;
  655.    unsigned char block_num_comp;
  656.    unsigned char data[128];
  657.    unsigned char data_check[2];
  658. } XMARGS, *XMARGSP;
  659.  
  660. #define DID_RESYNC 1
  661.  
  662. typedef struct {
  663.    int tries;
  664.    int barklen;
  665.    int barkok;
  666.    long T1;
  667.    int nfiles;
  668.    char *inbound;
  669.    char *filename;
  670.    char barkpacket[128];
  671.    char *barkpw;
  672.    char *barktime;
  673. } BARKARGS, *BARKARGSP;
  674.  
  675. /*--------------------------------------------------------------------------*/
  676. /* FIDONET ADDRESS STRUCTURE                                                */
  677. /*--------------------------------------------------------------------------*/
  678. typedef struct _ADDRESS
  679. {
  680.    word  Zone;
  681.    word  Net;
  682.    word  Node;
  683.    word  Point;
  684.    char  *Domain;
  685. } ADDR, *ADDRP;
  686.  
  687. typedef struct mail {
  688.    ADDR mail_addr;               /* Addressee */
  689.    unsigned int mailtypes;       /* Bitmask of types we have for addressee */
  690.    unsigned long mailsize;       /* Total amount of mail for addressee     */
  691.    unsigned long callsize;       /* Amount of mail that isn't on hold      */
  692.    struct mail *next;
  693.    struct mail *prev;
  694. } MAIL, *MAILP;
  695.  
  696. typedef int (*nfunc) (ADDR *, int);
  697. typedef void (*ufunc) (char *, ADDR *);
  698.  
  699. #define  MAX_EXTERN         8
  700. #define  ALIAS_CNT         15
  701.  
  702. /*--------------------------------------------------------------------------*/
  703. /* Matrix mask                                                              */
  704. /* Undefined bits are reserved by Opus                                      */
  705. /*--------------------------------------------------------------------------*/
  706. #define NO_TRAFFIC 0x0001
  707. #define LOCAL_ONLY 0x0002
  708. #define OPUS_ONLY  0x0004
  709.  
  710. #define NO_EXITS   0x2000
  711. #define MAIL_ONLY  0x4000
  712. #define TAKE_REQ   0x8000
  713.  
  714.  
  715. /*--------------------------------------------------------------------------*/
  716. /* Message packet header                                                    */
  717. /*--------------------------------------------------------------------------*/
  718.  
  719. #define PKTVER       2
  720.  
  721.  /*--------------------------------------------*/
  722.  /* POSSIBLE VALUES FOR `product' (below)      */
  723.  /* */
  724.  /* NOTE: These product codes are assigned by  */
  725.  /* the FidoNet<tm> Technical Stardards Com-   */
  726.  /* mittee.  If you are writing a program that */
  727.  /* builds packets, you will need a product    */
  728.  /* code.  Please use ZERO until you get your  */
  729.  /* own.  For more information on codes, write */
  730.  /* to FTSC at 115/333.                        */
  731.  /* */
  732.  /*--------------------------------------------*/
  733.  
  734. #define isFIDO       0
  735. #define isOPUS       5
  736. #define isIGOR       65
  737. #define isTIMS       66
  738. #define isBITBRAIN   0x1b
  739. #define isMILQUE     0xac
  740.  
  741. #ifdef MILQ
  742. #define PRDCT_CODE      isMILQUE
  743. #define PRDCT_MAJOR     0
  744. #define PRDCT_MINOR     85
  745. #define PRDCT_PRFX      "MILQUE"
  746. #define PRDCT_PRTY      "MilqueToast"
  747. #define PRDCT_SH_PRTY   "Milque"
  748. #define PRDCT_SHRT      "MILQ"
  749. #define PRDCT_VRSN      "0.85"
  750. #endif
  751.  
  752. #ifndef PRDCT_CODE
  753. #define PRDCT_CODE      isBITBRAIN
  754. #endif
  755.  
  756. #ifndef PRDCT_MAJOR
  757. #define PRDCT_MAJOR     2
  758. #endif
  759.  
  760. #ifndef PRDCT_MINOR
  761. #define PRDCT_MINOR     50
  762. #endif
  763.  
  764. #ifndef PRDCT_PRFX
  765. #define PRDCT_PRFX      "BINKLEY"
  766. #endif
  767.  
  768. #ifndef PRDCT_PRTY
  769. #define PRDCT_PRTY      "BinkleyTerm"
  770. #endif
  771.  
  772. #ifndef PRD_SH_PRTY
  773. #define PRD_SH_PRTY     "Binkley"
  774. #endif
  775.  
  776. #ifndef PRDCT_SHRT
  777. #define PRDCT_SHRT      "Bink"
  778. #endif
  779.  
  780. #ifndef PRDCT_VRSN
  781. #define PRDCT_VRSN      "2.50"
  782. #endif
  783.  
  784.  
  785. struct _pkthdr
  786. {
  787.         int orig_node;          /* originating node               */
  788.         int dest_node;          /* destination node               */
  789.         int year;               /* 0..99  when packet was created */
  790.         int month;              /* 0..11  when packet was created */
  791.         int day;                /* 1..31  when packet was created */
  792.         int hour;               /* 0..23  when packet was created */
  793.         int minute;             /* 0..59  when packet was created */
  794.         int second;             /* 0..59  when packet was created */
  795.         int rate;               /* destination's baud rate        */
  796.         int ver;                /* packet version, must be 2      */
  797.         int orig_net;           /* originating network number     */
  798.         int dest_net;           /* destination network number     */
  799.         char product;           /* product type                   */
  800.         char serial;            /* serial number (some systems)   */
  801.  
  802.         byte password[8];       /* session/pickup password        */
  803.         int  orig_zone;         /* originating zone               */
  804.         int  dest_zone;         /* Destination zone               */
  805.         byte B_fill2[16];
  806.         long B_fill3;
  807. };
  808.  
  809. struct _pkthdr45                /* FSC-0045 (2.2) packet type     */
  810. {
  811.         int orig_node;          /* originating node               */
  812.         int dest_node;          /* destination node               */
  813.         int orig_point;         /* originating point              */
  814.         int dest_point;         /* destination point              */
  815.         byte b_fill1[8];        /* Unused, must be zero           */
  816.         int subver;             /* packet subversion, must be 2   */
  817.         int ver;                /* packet version, must be 2      */
  818.         int orig_net;           /* originating network number     */
  819.         int dest_net;           /* destination network number     */
  820.         char product;           /* product type                   */
  821.         char serial;            /* serial number (some systems)   */
  822.  
  823.         byte password[8];       /* session/pickup password        */
  824.         int  orig_zone;         /* originating zone               */
  825.         int  dest_zone;         /* Destination zone               */
  826.         byte orig_domain[8];    /* originating domain             */
  827.         byte dest_domain[8];    /* destination domain             */
  828.         long B_fill3;
  829. };
  830.  
  831. struct _pkthdr39                /* FSC-0039 packet type           */
  832. {
  833.         int orig_node;          /* originating node               */
  834.         int dest_node;          /* destination node               */
  835.         int year;               /* 0..99  when packet was created */
  836.         int month;              /* 0..11  when packet was created */
  837.         int day;                /* 1..31  when packet was created */
  838.         int hour;               /* 0..23  when packet was created */
  839.         int minute;             /* 0..59  when packet was created */
  840.         int second;             /* 0..59  when packet was created */
  841.         int rate;               /* destination's baud rate        */
  842.         int ver;                /* packet version, must be 2      */
  843.         int orig_net;           /* originating network number     */
  844.         int dest_net;           /* destination network number     */
  845.         byte product_low;       /* FTSC product type (low byte)   */
  846.         byte prod_rev_low;      /* product rev (low byte)         */
  847.  
  848.         byte password[8];       /* session/pickup password        */
  849.         int  zone_ignore[2];    /* Zone info from other software  */
  850.         byte B_fill1[2];
  851.         int  CapValid;          /* CapWord with bytes swapped.    */
  852.         byte product_hi;        /* FTSC product type (high byte)  */
  853.         byte prod_rev_hi;       /* product rev (hi byte)          */
  854.         int  CapWord;           /* Capability word                */
  855.         int orig_zone;          /* originating zone               */
  856.         int dest_zone;          /* Destination zone               */
  857.         int orig_point;         /* originating point              */
  858.         int dest_point;         /* destination point              */
  859.         long ProdData;          /* Product-specific data          */
  860. };
  861.  
  862.  
  863. /*--------------------------------------------------------------------------*/
  864. /* WaZOO                                                                    */
  865. /*--------------------------------------------------------------------------*/
  866.  
  867. #ifndef ACK
  868. #define ACK    0x06
  869. #endif
  870.  
  871. #ifndef NAK
  872. #define NAK    0x15
  873. #endif
  874.  
  875. #ifndef ENQ
  876. #define ENQ    0x05
  877. #endif
  878.  
  879. #ifndef YOOHOO
  880. #define YOOHOO 0x00f1
  881. #endif
  882.  
  883. #ifndef  TSYNC
  884. #define  TSYNC 0x00ae
  885. #endif
  886.  
  887. struct _Hello
  888. {
  889.    word signal;                                  /* always 'o'     (0x6f)                   */
  890.    word hello_version;                           /* currently 1    (0x01)                   */
  891.    word product;                                 /* product code                            */
  892.    word product_maj;                             /* major revision of the
  893.                                                   * product           */
  894.    word product_min;                             /* minor revision of the
  895.                                                   * product           */
  896.    char my_name[60];                             /* Other end's name                        */
  897.    char sysop[20];                               /* sysop's name                            */
  898.    word my_zone;                                 /* 0== not supported                       */
  899.    word my_net;                                  /* out primary net number                  */
  900.    word my_node;                                 /* our primary node number                 */
  901.    word my_point;                                /* 0== not supported                       */
  902.    byte my_password[8];                          /* ONLY 6 CHARACTERS ARE
  903.                                                   * SIGNIFICANT !!!!! */
  904.    byte reserved2[8];                            /* reserved by Opus                        */
  905.    word capabilities;                            /* see below                               */
  906.    byte reserved3[12];                           /* available to non-Opus
  907.                                                   * systems by prior  */
  908.    /* "approval" of 124/108.                  */
  909. };                                               /* size 128 bytes */
  910.  
  911.  
  912. /*--------------------------------------------------------------------------*/
  913. /* YOOHOO<tm> CAPABILITY VALUES                                             */
  914. /*--------------------------------------------------------------------------*/
  915. #define Y_DIETIFNA 0x0001
  916. #define FTB_USER   0x0002
  917. #define ZED_ZIPPER 0x0004
  918. #define ZED_ZAPPER 0x0008
  919. #define DOES_IANUS 0x0010
  920. #define Bit_5      0x0020
  921. #define Bit_6      0x0040
  922. #define Bit_7      0x0080
  923. #define Bit_8      0x0100
  924. #define Bit_9      0x0200
  925. #define Bit_a      0x0400
  926. #define Bit_b      0x0800
  927. #define Bit_c      0x1000
  928. #define Bit_d      0x2000
  929. #define DO_DOMAIN  0x4000
  930. #define WZ_FREQ    0x8000
  931.  
  932. #endif
  933.  
  934. /* END OF FILE: bink.h */
  935.  
  936.