home *** CD-ROM | disk | FTP | other *** search
/ Amiga Developer CD 2.1 / Amiga Developer CD v2.1.iso / Reference / DevCon / Atlanta_1990 / Atlanta-Devcon.2 / AppShell / examples / WatchMan / fn_handler.h < prev    next >
Encoding:
C/C++ Source or Header  |  1992-08-26  |  3.1 KB  |  104 lines

  1. /* $Id: fn_handler.h,v 1.8 90/06/22 12:41:24 ewout Exp Locker: ewout $
  2.  * 
  3.  * $Log:    fn_handler.h,v $
  4.  * Revision 1.8  90/06/22  12:41:24  ewout
  5.  * Changed to no longer use hardcoded callback function
  6.  * 
  7.  * Revision 1.7  90/06/12  14:39:34  ewout
  8.  * changed FN_REMTARGET to FN_DELTARGET for consistency
  9.  * 
  10.  * Revision 1.6  90/06/08  17:59:37  ewout
  11.  * appshell version
  12.  * 
  13.  * Revision 1.5  90/06/03  13:19:54  ewout
  14.  * transition, don't use
  15.  * 
  16.  * Revision 1.4  90/05/23  21:04:08  ewout
  17.  * semi-appshell DON'T USE
  18.  * 
  19.  * Revision 1.3  90/05/23  16:56:22  ewout
  20.  * *** empty log message ***
  21.  * 
  22.  * Revision 1.2  90/05/21  17:03:58  ewout
  23.  * Added FN_NEWER & FN_SYNC
  24.  * 
  25.  * Revision 1.1  90/05/21  14:56:29  ewout
  26.  * Initial revision
  27.  * 
  28.  */
  29.  
  30. /* Handler ID */
  31. #define APSH_FN_ID   APSH_USER_ID + 1000L
  32. #define APSH_FNUSERID APSH_USER_ID + 2000L
  33.  
  34. /* Protos */
  35.  
  36. struct MsgHandler *setup_fnA (struct AppInfo *ai, struct TagItem *tl);
  37.  
  38. /* Application callable Notification prototype */
  39.  
  40. VOID FileNotify(struct AppInfo *, STRPTR, ULONG, ...);
  41. /*
  42. VOID FileNotify(struct AppInfo *, STRPTR, struct TagItem *);
  43. */
  44. #define INFINITE          -1    /* retry forever */
  45.  
  46. struct FNData {
  47.    UBYTE          *fnd_Filename;
  48.    LONG            fnd_Interval;
  49.    LONG            fnd_Retries;
  50.    ULONG           fnd_Flags;
  51.    LONG            fnd_Status;
  52. };
  53.  
  54. struct FNInfo {
  55.     struct MsgPort *fni_fnport;
  56.     struct MsgPort *fni_clientport;
  57.     struct MsgPort *fni_replyport;
  58.     struct SIPCMessage *fni_sipcmsg;
  59.     struct FNData *fni_fndata;
  60. };
  61.  
  62. enum {
  63.     FN_Command = APSH_FNUSERID,  /* Command to notifier                         */
  64.     FN_Filename,            /* ptr to filename, must be qualified path     */
  65.     FN_Retries,             /* number of retries or INFINITE, default -1   */
  66.     FN_Interval,            /* Time between file status checks, default 60 */
  67.     FN_Flags,               /* flags describing what to watch for, default FN_NEWER */
  68.     FN_MustExist,           /* Target must exist when request is made      */
  69.     FN_Smaller,             /* BOOL's, override FN_Flags...                */
  70.     FN_Bigger,
  71.     FN_Created,
  72.     FN_Deleted,
  73.     FN_Newer,
  74.     FN_Error,               /* address of BOOL, returns TRUE if error      */
  75.     FN_Buffer               /* ptr to buffer sizeof(struct FNData) to fill */
  76. };                          /* NOTE: buffer->fnd_Filename is a pointer to
  77.                              * the filename supplied as a tag !
  78.                              */
  79.  
  80. /* Commands application/user can send */
  81.  
  82. #define FN_INQUIRY      1
  83. #define FN_ADDTARGET    2
  84. #define FN_DELTARGET    3
  85. #define FN_SYNC         4
  86.  
  87.  
  88. #define FN_DONE         0x01    /* Set in fnd_FNStatus when number of */
  89.                                 /* retries has been reached */
  90.  
  91. #define FN_MUSTEXIST    0x02    /* File must exist when request is made */
  92.  
  93. /* Following are both flags which tell handler what to look out for
  94.  * and inform the application what happened.
  95.  */
  96.  
  97. #define FN_SMALLER      0x04
  98. #define FN_BIGGER       0x08
  99. #define FN_DELETED      0x10
  100. #define FN_CREATED      0x20
  101. #define FN_NEWER        0x40
  102.  
  103. #define FN_ALLFLAGS     (FN_SMALLER|FN_BIGGER|FN_DELETED|FN_CREATED|FN_NEWER)
  104.