home *** CD-ROM | disk | FTP | other *** search
/ The CDPD Public Domain Collection for CDTV 3 / CDPDIII.bin / bbs / ff846.lha / FF846 / FileCache / FileCache.h < prev    next >
C/C++ Source or Header  |  1993-03-31  |  3KB  |  80 lines

  1. /****************************/
  2. /*  Include pour FileCache  */
  3. /* Sat Feb  6 22:49:54 1993    */
  4. /****************************/
  5.  
  6.  
  7. #define FILECACHEPORTNAME  "FileCache.Port"   /* Port Name of Server */
  8.  
  9.  
  10. struct FileCacheMsg
  11. {
  12.   struct Message fcm_Msg;
  13.   ULONG  fcm_Command;        /* commands sended to server */
  14.   ULONG  fcm_Flags;          /* flags */
  15.   ULONG  fcm_Error;          /* Error code returned by server */
  16.   union
  17.   {
  18.     struct
  19.     {  /* fields for file operations */
  20.       STRPTR FileName;      /* filename with or without path */
  21.       STRPTR *Directory;    /* array of directory with FC_MULTIPLEDIR flag */
  22.       ULONG  DirIndex;      /* Index of directory */
  23.       ULONG  FileBuffer;    /* pointer to memory of the file */
  24.       ULONG  FileLength;    /* size of file in memory pointed by FileBuffer */
  25.       ULONG  Reserved0;     /* set to 0 */
  26.     } FileCmd;
  27.     struct
  28.     {  /* fields for cache operation */
  29.       ULONG CacheSize;      /* Size of cache in bytes */
  30.       ULONG MemoryUsed;     /* memory used by the cache (in bytes) */
  31.       UWORD NbFiles;        /* number of file in cache */
  32.       UWORD NbLocks;        /* nmuber of locks on server */
  33.     } CacheCmd;
  34.   } ExtCmdInfo;
  35.   ULONG  fcm_Reserved[2];    /* set to 0 */
  36. };
  37.  
  38. /* a cheap way to hide the union and struct mess */
  39. #define fcm_FileName   ExtCmdInfo.FileCmd.FileName
  40. #define fcm_Directory  ExtCmdInfo.FileCmd.Directory
  41. #define fcm_DirIndex   ExtCmdInfo.FileCmd.DirIndex
  42. #define fcm_FileBuffer ExtCmdInfo.FileCmd.FileBuffer
  43. #define fcm_FileLength ExtCmdInfo.FileCmd.FileLength
  44.  
  45. #define fcm_CacheSize  ExtCmdInfo.CacheCmd.CacheSize
  46. #define fcm_MemoryUsed ExtCmdInfo.CacheCmd.MemoryUsed
  47. #define fcm_NbFiles    ExtCmdInfo.CacheCmd.NbFiles
  48. #define fcm_NbLocks    ExtCmdInfo.CacheCmd.NbLocks
  49.  
  50.  
  51. /* definitions des commandes fcm_Command */
  52. #define FC_CMD_QUIT     0   /* flush cache and kill FileCache if possible */
  53. #define FC_CMD_GETTOKEN 1   /* locks FileCache server */
  54. #define FC_CMD_DELTOKEN 2   /* unlock FileCache server */
  55. #define FC_CMD_LOAD     3   /* load a file */
  56. #define FC_CMD_FLUSH    4   /* flush the cache */
  57. #define FC_CMD_SETMEM   5   /* modify size of cache */
  58. #define FC_CMD_INFO     6   /* returns infos on cache */
  59. #define FC_CMD_DELETE   7   /* remove a file from  cache */
  60. #define FC_CMD_DEBUG    8   /* PRIVATE (don't use) */
  61. #define FC_CMD_LAST     FC_CMD_DEBUG
  62.  
  63. /* definitions for fcm_Flags */
  64. #define FC_NOUPDATE     1    /* don't check file modification */
  65. #define FC_MULTIPLEDIR  2    /* Use the array of directory put in fcm_Directory */
  66. #define FC_USEWRITEFLAG 4    /* if FIBF_WRITE set don't check file changes */
  67.  
  68. /* definitions des erreurs fcm_Error */
  69. #define FC_ERR_OK           0    /* No errorr */
  70. #define FC_ERR_NOMEMORY     1    /* not enough memory */
  71. #define FC_ERR_NOFILE       2    /* file don't exist */
  72. #define FC_ERR_DIRECTORY    3    /* it's a directory */
  73. #define FC_ERR_READERROR    4    /* can't read this file */
  74. #define FC_ERR_FILETOOBIG   5    /* file bigger than cache */
  75. #define FC_ERR_CANTOPENFILE 6    /* can't open file */
  76. #define FC_ERR_INUSE        7    /* Can't kill server, still locked */
  77. #define FC_ERR_UPDATE       8    /* Error for checking file */
  78. #define FC_ERR_NOTINCACHE   9    /* file not in cache (FC_CMD_DELETE) */
  79. #define FC_ERR_BADCOMMAND   100  /* unknown command */
  80.