home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 2 BBS / 02-BBS.zip / sqdev200.zip / h / sqfeat.h < prev    next >
C/C++ Source or Header  |  1994-05-23  |  10KB  |  229 lines

  1. /***************************************************************************
  2.  *                                                                         *
  3.  *  Squish Developers Kit Source, Version 2.00                             *
  4.  *  Copyright 1989-1994 by SCI Communications.  All rights reserved.       *
  5.  *                                                                         *
  6.  *  USE OF THIS FILE IS SUBJECT TO THE RESTRICTIONS CONTAINED IN THE       *
  7.  *  SQUISH DEVELOPERS KIT LICENSING AGREEMENT IN SQDEV.PRN.  IF YOU DO NOT *
  8.  *  FIND THE TEXT OF THIS AGREEMENT IN THE AFOREMENTIONED FILE, OR IF YOU  *
  9.  *  DO NOT HAVE THIS FILE, YOU SHOULD IMMEDIATELY CONTACT THE AUTHOR AT    *
  10.  *  ONE OF THE ADDRESSES LISTED BELOW.  IN NO EVENT SHOULD YOU PROCEED TO  *
  11.  *  USE THIS FILE WITHOUT HAVING ACCEPTED THE TERMS OF THE SQUISH          *
  12.  *  DEVELOPERS KIT LICENSING AGREEMENT, OR SUCH OTHER AGREEMENT AS YOU ARE *
  13.  *  ABLE TO REACH WITH THE AUTHOR.                                         *
  14.  *                                                                         *
  15.  *  You can contact the author at one of the address listed below:         *
  16.  *                                                                         *
  17.  *  Scott Dudley       FidoNet     1:249/106                               *
  18.  *  777 Downing St.    Internet    sjd@f106.n249.z1.fidonet.org            *
  19.  *  Kingston, Ont.     CompuServe  >INTERNET:sjd@f106.n249.z1.fidonet.org  *
  20.  *  Canada  K7M 5N3    BBS         1-613-634-3058, V.32bis                 *
  21.  *                                                                         *
  22.  ***************************************************************************/
  23.  
  24. #ifndef __SQFEAT_H_DEFINED
  25. #define __SQFEAT_H_DEFINED
  26.  
  27. #ifdef OS_2 /* DLL feature library */
  28.  
  29. #ifndef PATHLEN
  30.   #define PATHLEN 120
  31. #endif
  32.  
  33. #ifndef CFGLEN
  34.   #define CFGLEN 1024
  35. #endif
  36.  
  37. #ifndef MAX_TAGLEN
  38.   #define MAX_TAGLEN 128
  39. #endif
  40.  
  41. /* API entry type */
  42.  
  43. #ifdef __FLAT__
  44.   #define FEATENTRY pascal
  45.   #define FEATRET   USHORT
  46.   #define FEATFAR
  47. #else
  48.   #define FEATENTRY pascal far _loadds
  49.   #define FEATRET   USHORT
  50.   #define FEATFAR   far
  51. #endif
  52.  
  53.  
  54. /* Structure for the "init" call */
  55.  
  56. struct _feat_init
  57. {
  58.   USHORT struct_len;                                /* Length of struct */
  59.   char szConfigName[PATHLEN];                       /* Config items */
  60.   void (cdecl far *pfnLogMsg)(char far *line);      /* Write to Squish log. *
  61.                                                      * SEE BELOW!           */
  62.   ULONG ulFlag;                                     /* Flags filled in by   *
  63.                                                      * DLL.                 */
  64. };
  65.  
  66. /* NOTE!  The format of the string passed to the LogMsg function must be
  67.  * as follows:
  68.  *
  69.  * <char><description>
  70.  *
  71.  * where <char> is the priority character to appear at the beginning of
  72.  * the line, and <descrption> is the log message itself.  For example,
  73.  * the following function call:
  74.  *
  75.  * (*pfi->LogMsg)("!Invalid address declared");
  76.  *
  77.  * might result in this log entry:
  78.  *
  79.  * ! 01 Jan 00:11:22 SQSH Invalid address declared!
  80.  *
  81.  * Note that log messages will only be written to the screen until the
  82.  * config file has been completely parsed.  (In other words, log messages
  83.  * in FeatureInit or FeatureConfig will not be written to the log file.)
  84.  * Since the LogMsg pointer is only passed once, a private copy of the
  85.  * function pointer MUST be saved as a static variable in your .DLL,
  86.  * since the _feat_init pointer will become invalid after FeatureInit
  87.  * returns.
  88.  */
  89.  
  90. /* Structure for the "config line" call */
  91.  
  92. struct _feat_config
  93. {
  94.   USHORT struct_len;
  95.   char szConfigLine[CFGLEN];
  96.   char FEATFAR * FEATFAR * ppszArgs;
  97. };
  98.  
  99. /* Structure for the "process netmail message" call */
  100.  
  101. struct _feat_netmsg
  102. {
  103.   USHORT struct_len;            /* Length of this structure                 */
  104.   ULONG ulAction;               /* Filled in by the feature: Requested      *
  105.                                  * action.  See FACT_XXX, below.            */
  106.   char FEATFAR *pszAreaTag;     /* Tag for the current netmail area         */
  107.   HAREA ha;                     /* MsgAPI handle for current area           */
  108.   HMSG hmsg;                    /* MsgAPI handle for current message        */
  109.   ULONG ulMsgNum;               /* Message number of this message           */
  110.   PXMSG pMsg;                   /* Pointer to this message's header info    */
  111.   char FEATFAR *pszCtrl;        /* Pointer to this message's control info   */
  112.   char FEATFAR *pszMsgTxt;      /* Pointer to this message's body info      */
  113.   NETADDR us;                   /* Our primary address                      */
  114. };
  115.  
  116.  
  117. /* Bitflags for the ulAction field, above.  Any number of these may be      *
  118.  * combined using the bitwise OR ("|") operator.  Note that FACT_KILL       *
  119.  * will be processed after the message has been packed and/or passed to     *
  120.  * any of the other handlers.  If the feature wants the message to be       *
  121.  * killed immediately, use FACT_KILL|FACT_SKIP|FACT_HIDE.  Note that        *
  122.  * FACT_RWMSG cannot be used in conjunction with FACT_KILL.                 */
  123.  
  124. #define FACT_NONE     0x00000000  /* No action */
  125. #define FACT_KILL     0x00000001  /* Delete this message */
  126. #define FACT_SKIP     0x00000002  /* Leave this message alone (do not pack) */
  127. #define FACT_HIDE     0x00000004  /* Do not pass this message to other      *
  128.                                    * features.                              */
  129. #define FACT_RWMSG    0x00000008  /* Rewrite message.  The header was       *
  130.                                    * updated and needs to be written back   *
  131.                                    * to disk.                               */
  132.  
  133. /* Structure for tossing a message */
  134.  
  135. struct _feat_toss
  136. {
  137.   USHORT struct_len;
  138.   ULONG ulTossAction;           /* Filled in by the feature: Requested      *
  139.                                  * action.  See FTACT_XXX, below.           */
  140.  
  141.   char szArea[MAX_TAGLEN];      /* Area tag for this message.  Changing     *
  142.                                  * this tag instructs Squish to toss the    *
  143.                                  * message to a different area.  The        *
  144.                                  * FTACT_AREA flag must be used for this to *
  145.                                  * take effect!                             */
  146.   char szPktName[PATHLEN];      /* Name of current packet file              */
  147.   PXMSG pMsg;                   /* Message header                           */
  148.   char *pszCtrl;                /* Message control info                     */
  149.   char *pszMsgTxt;              /* Message body                             */
  150. };
  151.  
  152.  
  153. #define FTACT_NONE    0x00000000
  154. #define FTACT_KILL    0x00000001  /* Kill message without tossing it        */
  155. #define FTACT_AREA    0x00000002  /* Toss to the new area tag specified in  *
  156.                                    * szArea.                                */
  157. #define FTACT_HIDE    0x00000004  /* Do not pass this to any of the other   *
  158.                                    * features.                              */
  159. #define FTACT_NSCN    0x00000008  /* Do not scan this message to anyone     *
  160.                                    * else (if doing a one-pass toss/scan).  */
  161.  
  162.  
  163. /* Structure for scanning a message */
  164.  
  165. struct _feat_scan
  166. {
  167.   USHORT struct_len;
  168.   ULONG ulScanAction;           /* Filled in by the feature: Requested      *
  169.                                  * action.  See FSACT_XXX, below.           */
  170.  
  171.   char szArea[MAX_TAGLEN];      /* Area tag for this message.  This field   *
  172.                                  * cannot be changed.                       */
  173.  
  174.   PXMSG pMsg;                   /* Message header                           */
  175.   char *pszCtrl;                /* Message control info                     */
  176.   char *pszMsgTxt;              /* Message body                             */
  177. };
  178.  
  179.  
  180.  
  181. /* Termination structure */
  182.  
  183. struct _feat_term
  184. {
  185.   USHORT struct_len;
  186. };
  187.  
  188.  
  189. /* Linked list of features */
  190.  
  191. struct _feature
  192. {
  193.   char *pszDLLName;       /* Name of .DLL */
  194.   HMODULE hmod;           /* Module handle for .DLL */
  195.   ULONG ulFlag;           /* Flags for this feature - see FFLAG_XXX, below*/
  196.  
  197.   char *pszConfigName;    /* Name for DLL-specific items in config file */
  198.  
  199.   FEATRET (FEATENTRY *pfnInit)(struct _feat_init FEATFAR *pfi);
  200.   FEATRET (FEATENTRY *pfnConfig)(struct _feat_config FEATFAR *pfc);
  201.   FEATRET (FEATENTRY *pfnNetMsg)(struct _feat_netmsg FEATFAR *pfn);
  202.   FEATRET (FEATENTRY *pfnTossMsg)(struct _feat_toss FEATFAR *pft);
  203.   FEATRET (FEATENTRY *pfnScanMsg)(struct _feat_scan FEATFAR *pft);
  204.   FEATRET (FEATENTRY *pfnTerm)(struct _feat_term FEATFAR *pft);
  205.  
  206.   struct _feature *pfNext;
  207. };
  208.  
  209.  
  210. /* For the netmail packer feature: */
  211.  
  212. #define FFLAG_NETSENT   0x00000001 /* Only call FeatureNetMsg for messages  *
  213.                                     * which do NOT have the MSGSENT bit     *
  214.                                     * set.                                  */
  215.  
  216. #define FFLAG_NETTOUS   0x00000002 /* Only call FeatureNetMsg for messages  *
  217.                                     * which are to one of our addresses.    */
  218.  
  219. #define FFLAG_NETRECD   0x00000004 /* Only call FeatureNetMsg for messages  *
  220.                                     * which do not have MSGREAD set.        */
  221.  
  222. #define FFLAG_NETNOTTOUS 0x00000008 /* Only call FeatureNetMsg for messages  *
  223.                                     * which are NOT to one of our addresses. */
  224.  
  225. #endif /* OS_2 */
  226.  
  227. #endif /* __SQFEAT_H_DEFINED */
  228.  
  229.