home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 2 BBS / 02-BBS.zip / XGRP_000.SZH / XGROUP.H < prev    next >
C/C++ Source or Header  |  1991-08-21  |  11KB  |  354 lines

  1. /* XGROUP.H file */
  2.  
  3. /* I hate a lot of little header files.  Guess you'll figure that out. */
  4.  
  5. #ifdef TSC
  6.  
  7.     #define OS2 _os2
  8.     #define _fastcall
  9.     #define _pascal pascal
  10.     #define _cdecl cdecl
  11.     #define elif elsif
  12.     #define searchpath(x) (x)
  13.     #define MAXDIR        256
  14.     #define SH_DENYNONE   SH_DENYNO
  15.     #define INCL_DOS
  16.     #include <os2kernl.h>
  17.  
  18. #elif __TURBOC__
  19.  
  20.     #define _fastcall pascal
  21.     #define _pascal   pascal
  22.     #define _cdecl    cdecl
  23.     #define SH_DENYNO SH_DENYNONE
  24.  
  25.     /* you're on your own handling the OS/2 stuff... */
  26.  
  27. #else
  28.  
  29.     #ifdef DEBUG
  30.         #define _fastcall _pascal
  31.     #endif
  32.  
  33.     #define searchpath(x) (x)
  34.     #define MAXDIR        256
  35.     #define SH_DENYNONE   SH_DENYNO
  36.     #define INCL_DOS
  37.     #include <os2.h>
  38.  
  39. #endif
  40.  
  41.  
  42. #include <signal.h>
  43. #include <sys/types.h>
  44. #include <sys/stat.h>
  45. #include <sys/locking.h>
  46. #include <io.h>
  47. #include <fcntl.h>
  48. #include <stdio.h>
  49. #include <string.h>
  50. #include <stdlib.h>
  51. #include <ctype.h>
  52. #include <time.h>
  53. #include <process.h>
  54. #include <share.h>
  55. #include <stdarg.h>
  56. #include <conio.h>
  57. #include <errno.h>
  58.  
  59.  
  60. typedef unsigned int  word;
  61. typedef unsigned int  bit;
  62. typedef unsigned char byte;
  63. typedef unsigned long ulong;
  64. typedef unsigned char uchar;
  65.  
  66.  
  67. /*------------------------------------------------------*/
  68. /* FIDO Message attributes (attr)                       */
  69. /*------------------------------------------------------*/
  70. #define MSGPRIVATE 0x0001  /* private message,          */
  71. #define MSGCRASH   0x0002  /* accept for forwarding     */
  72. #define MSGREAD    0x0004  /* read by addressee         */
  73. #define MSGSENT    0x0008  /* sent OK (remote)          */
  74. #define MSGFILE    0x0010  /* file attached to msg      */
  75. #define MSGFWD     0x0020  /* being forwarded           */
  76. #define MSGORPHAN  0x0040  /* unknown dest node         */
  77. #define MSGKILL    0x0080  /* kill after mailing        */
  78. #define MSGLOCAL   0x0100  /* FidoNet vs. local         */
  79. #define MSGXX1     0x0200  /*                           */
  80. #define MSGXX2     0x0400  /* STRIPPED by FidoNet<tm>   */
  81. #define MSGFRQ     0x0800  /* file request              */
  82. #define MSGRRQ     0x1000  /* receipt requested         */
  83. #define MSGCPT     0x2000  /* is a return receipt       */
  84. #define MSGARQ     0x4000  /* audit trail requested     */
  85. #define MSGURQ     0x8000  /* update request            */
  86.  
  87. /*------------------------------------------------------*/
  88. /* XBBS Message header                                  */
  89. /*------------------------------------------------------*/
  90. struct __xmsg__ {
  91.       char from[36];
  92.       char to[36];
  93.       char subj[64];
  94.       word o_point;
  95.       word length;         /* Length of message */
  96.      ulong start;          /* Starting postition in text file              */
  97.       char date[20];
  98.       word times;          /* Number of times read                         */
  99.       word dest;           /* Destination node                             */
  100.       word orig;           /* Origination node number                      */
  101.       word cost;           /* Unit cost charged to send the message        */
  102.       word orig_net;       /* Origination network number                   */
  103.       word dest_net;       /* Destination network number                   */
  104.       char indate[4];      /* import date  (YMD(null))                     */
  105.       word m_attr;         /* Extra attributes                             */
  106.       word d_zone;         /* Destination zone                             */
  107.       word o_zone;         /* Origination zone                             */
  108.       word attr;           /* Attribute (behavior) of the message          */
  109.       word d_point;
  110. };
  111. typedef struct __xmsg__ XMSG;
  112.  
  113. /* These apply to m_attr */
  114.  
  115. #define MSGDELETED 0x0001  /* deleted message,             */
  116. #define MSGANON    0x0002  /* anonymous message            */
  117. #define MSGECHO    0x0004  /* unmoved echo message         */
  118. #define MSGNET     0x0008  /* unmoved net message          */
  119. #define MSGHOLD    0x0010  /* file attached to msg         */
  120. #define MSGHOST    0x0020  /* being forwarded              */
  121. #define MSGSCANNED 0x0040  /* already scanned              */
  122. #define MSGKEEP    0x0080  /* don't delete                 */
  123. #define MSGTREATED 0x0100  /* soft cr's & lf's removed     */
  124. #define MSGPACKED  0x0200  /* message LZSS compressed      */
  125. #define MSGGSCAN   0x0400  /* message scanned by groupmail */
  126. #define MSGRSCAN   0x0800  /* message scanned by RFC0822   */
  127. /*
  128.    #define    0x1000        all reserved
  129.    #define    0x2000
  130.    #define    0x4000
  131. */
  132. #define MSGTAGGED  0x8000  /* used by offline readers   */
  133.  
  134. /* Packet header structure per FSC-0045 */
  135.  
  136. struct __pkthdr__ {
  137.     unsigned int
  138.         onode,
  139.         dnode,
  140.         opoint,
  141.         dpoint;
  142.     char
  143.         zeros[8];
  144.     unsigned int
  145.         subver,
  146.         version,
  147.         onet,
  148.         dnet;
  149.     char
  150.         product,
  151.         rev_lev,
  152.         password[8];
  153.     unsigned int
  154.         ozone,
  155.         dzone;
  156.     char
  157.         odomain[8],
  158.         ddomain[8];
  159.     long
  160.         specific;
  161. };
  162.  
  163. typedef struct __pkthdr__ PKTHDR;
  164.  
  165. struct __oldpkthdr__ {         /* got this from JoHo */
  166.     word
  167.         orig_node,             /* originating node */
  168.         dest_node,             /* destination node */
  169.         year,                  /* 1989 - nnnnn */
  170.         month,
  171.         day,
  172.         hour,
  173.         minute,
  174.         second,
  175.         rate,                  /* unused */
  176.         ver,                   /* 2 */
  177.         orig_net,              /* originating net */
  178.         dest_net;              /* destination net */
  179.     byte
  180.         product,
  181.         rev_lev,               /* revision level */
  182.         password[8];
  183.      word
  184.         qm_orig_zone,
  185.         qm_dest_zone;
  186.      byte
  187.         domain[8];
  188.      word
  189.         orig_zone,             /* originating zone */
  190.         dest_zone,             /* destination zone */
  191.         orig_point,            /* originating point */
  192.         dest_point;            /* destination point */
  193.      long
  194.         pr_data;
  195. };
  196.  
  197. typedef struct __oldpkthdr__ OLDPKTHDR;
  198.  
  199. struct __dupes__ {
  200.     long msgidcrc;
  201.     long serialno;
  202. };
  203.  
  204. typedef struct __dupes__ DUPES;
  205.  
  206. #define MAXDUPES 1000
  207.  
  208. struct __address__ {
  209.     word zone,net,node,point;
  210.     char *domain;
  211.     struct __address__ *next;
  212. };
  213. typedef struct __address__ ADDR;
  214.  
  215. struct __groups__ {         /* groupmail area control structure */
  216.     char *id;
  217.     ADDR *uplink;
  218.     word areano;
  219.     word imported;
  220.     word exported;
  221.     word forwarded;
  222.     word numdays;
  223.     char *password;
  224.     bit  style:      2;
  225.     bit  reserved:   6;
  226.     struct __groups__ *next;
  227. };
  228. typedef struct __groups__ GROUP;
  229.  
  230. struct __controls__ {       /* miscellaneous control bits */
  231.     bit xbbsos2:    1;
  232.     bit tinysbs:    1;
  233.     bit noforward:  1;
  234.     bit nolocalfor: 1;
  235.     bit partialok:  1;
  236.     bit fullok:     1;
  237.     bit forfiles:   1;
  238.     bit noassholes: 1;
  239.     bit assexport:  1;
  240.     bit nodupes:    1;
  241.     bit keeppath:   1;
  242.     bit keepsbs:    1;
  243.     bit keepdupes:  1;
  244.     bit delbaddate: 1;
  245.     bit keepnoforwards: 1;
  246.     bit allowbadareas:  1;
  247.     bit reserved:   8;
  248. };
  249. typedef struct __controls__ CONTROLS;
  250.  
  251. struct __assholes__ {
  252.     char *name;
  253.     unsigned int from:  1;
  254.     unsigned int to:    1;
  255.     unsigned int del:   1;
  256.     unsigned int noin:    1;
  257.     unsigned int subj:  1;
  258.     unsigned int res:   3;
  259.     time_t expire;
  260.     struct __assholes__ *next;
  261. };
  262. typedef struct __assholes__ ASSHOLE;
  263.  
  264. struct __route__ {
  265.     char *mask;
  266.     char *archive;
  267.     char type;
  268.     ADDR *addr;
  269.     struct __route__ *next;
  270. };
  271. typedef struct __route__ ROUTE;
  272.  
  273. struct __sb__ {
  274.     word net,node;
  275. };
  276. typedef struct __sb__ SB;
  277.  
  278. struct __echorec__ {
  279.     char *tag;
  280.     word areano;
  281.     ADDR *addr;
  282.     word imported;
  283.     word exported;
  284.     word forwarded;
  285.     char *password;
  286.     struct __echorec__ *next;
  287. };
  288. typedef struct __echorec__ ECHOREC;
  289.  
  290. struct __to_names__ {
  291.     char     *to;
  292.     char     *prgname;
  293.     ADDR     *addr;
  294.     bit msg:      1;
  295.     bit route:    1;
  296.     bit prog:     1;
  297.     bit reserved: 5;
  298.     struct __to_names__ *next;
  299. };
  300. typedef struct __to_names__ TONAMES;
  301.  
  302. /* global function definitions */
  303.  
  304. char *  _fastcall assign (char *s,char *p);
  305. int     _fastcall parse_addr (char **p, ADDR *r,ADDR *rr);
  306. int     _fastcall guess_rest (ADDR *r, ADDR *m);
  307. ADDR *  _fastcall best_guess (ADDR *r,ADDR *m);
  308. int     _fastcall config (char *configfile);
  309. char *  _fastcall skip_white (char *p);
  310. char *  _fastcall skip_nonwhite (char *p);
  311. char *  _fastcall to_delim (char *p, char *delim);
  312. char *  _fastcall fgetsx (char *str,unsigned int num,unsigned int handle);
  313. unsigned int _cdecl ffprintf (unsigned int handle,char *string,...);
  314. char *  _fastcall rstrip (char *a);
  315. char *  _fastcall lstrip (char *a);
  316. char *  _fastcall stripcr (char *a);
  317. char *  _fastcall strip_trail_bksl (char *a);
  318. int     _fastcall ext_reserved (char *ext);
  319. char *  _fastcall unpack_msg (char **hold);
  320. char *  _fastcall pack_msg (char *hold,XMSG *msg);
  321. void    _fastcall group_import_mail (void);
  322. void    _fastcall group_export_mail (void);
  323. void    _fastcall echo_import_mail (void);
  324. void    _fastcall echo_export_mail (void);
  325. void    _fastcall net_export_mail (void);
  326. SB *    _fastcall sort_sb (SB *s);
  327. int     _fastcall add_tiny_seenbys (SB *s,int x,ECHOREC *echos,
  328.                                     ADDR *pktaddr,int tsb);
  329. SB *    _fastcall parse_seenbys (char *sbs,ECHOREC *echos,
  330.                                  ADDR *pktaddr);
  331. SB *    _fastcall make_tinysbs (ECHOREC *echo,ADDR *pktaddr);
  332. long    _fastcall spit_seenbys (SB *s,int handle);
  333. SB *    _fastcall parse_oldpath (char *sbs);
  334. long    _fastcall spit_oldpath (SB *s,int handle);
  335. ADDR *  _fastcall parse_newpath (char *npth);
  336. long    _fastcall spit_newpath (SB *s,ADDR *addr,ADDR *maddr,int handle);
  337. void    _fastcall free_addresses (ADDR *top);
  338. int     _fastcall switch_to (char *dir);
  339. int     _fastcall switch_back (void);
  340. void    _fastcall free_assholes (void);
  341. void    _fastcall load_assholes (word areano);
  342. void    _fastcall rewrite_assholes (word areano);
  343. long    _fastcall crc32blk (char *str,int blklen);
  344. long    _fastcall crc32str(char *str,int casesensitive);
  345. void    _fastcall free_dupes (void);
  346. void    _fastcall load_dupes (word areano);
  347. void    _cdecl logf (char *szFormat, ...);
  348. int     _fastcall do_request_or_attach (XMSG *msg,ADDR *addr);
  349. int     _fastcall my_unlink(char *fname);
  350. int     _fastcall my_rename(char *oname,char *nname);
  351. void    _fastcall my_free (void *ptr);
  352.  
  353. /* END OF FILE: xgroup.h */
  354.