home *** CD-ROM | disk | FTP | other *** search
/ Amiga MA Magazine 1998 #3 / amigamamagazinepolishissue1998.iso / bazy / kingfisher-distribution / developer / kf.h < prev    next >
C/C++ Source or Header  |  1996-06-05  |  31KB  |  631 lines

  1. /***************************************************************************
  2. **
  3. **  KingFisher Release 2 Public Definitions
  4. **  Copyright © 1992-1995 Udo Schuermann
  5. **  All rights reserved
  6. **
  7. **  Global Definitions
  8. **  $VER: KingFisher_PublicDefs 2.13 (28.10.95)
  9. **
  10. **  These definitions define the message port interface for KingFisher 2.0
  11. **  Any and all applications that wish to interface directly to Kingfisher
  12. **  must take care to follow the proper protocols.
  13. **
  14. **  The message port interface is designed for high speed, flexible, and
  15. **  reliable operation between a potentially unlimited number of clients
  16. **  with the KingFisher Primary Process.  KingFisher must have been started
  17. **  before any client can "talk" with it.
  18. **
  19. **  It is strongly suggested to use the API outlined in the kf-api.(h|c)
  20. **  files as much as possible.  Your program need include only "kf-api.h"
  21. **  to also gain access to the "kf.h" definitions below.  If you choose to
  22. **  ignore the API (as the demo CLIent.c does) then merely include "kf.h"
  23. **
  24. **  Never, ever, change anything in this file!
  25. **
  26. **  Suggestions should be addressed via electronic mail to
  27. **       Udo Schuermann <walrus@wam.umd.edu>
  28. **  or via standard (snail) mail to
  29. **       Udo Schuermann
  30. **       7022 Hanover Parkway, Apt. C2
  31. **       Greenbelt, Maryland 20770-2049
  32. **       USA
  33. **
  34. ***************************************************************************/
  35.  
  36. #include <exec/types.h>
  37. #include <exec/ports.h>
  38.  
  39.  
  40.  
  41. /* KingFisher's public message port name.  All messages sent to this port
  42.  * must be of the type (struct KFMsg) as defined below.
  43.  *
  44.  * NOTE: It is HIGHLY recommended that you use the interface in kf-api.c
  45.  *       whenever possible.  Changes to the underlying protocols can and
  46.  *       will occur; by using the kf-api.c you will save yourself at
  47.  *       least SOME work.
  48.  */
  49. #define  KFPortName "KingFisher-Port"
  50. #define  KFAPIVER   0x0010     /* check that .VERSIONID >= than this value
  51.                 * after a kfcHELLO, otherwise you may not
  52.                 * use the KFServer safely!!!
  53.                 * This is an internal value only and has no
  54.                 * bearing on the actual release/version
  55.                 * number of any of the software.
  56.                 */
  57.  
  58. struct KFMsg {
  59.   struct Message AmigaMsg;     /* standard system stuff */
  60.   UWORD          Error;        /* Non-zero ==> error return (text in *Buffer) */
  61.   UWORD          Command;      /* One of the kfc* commands */
  62.   ULONG          BParam;       /* Binary parameter (may be an address) */
  63.   ULONG          DParam;       /* Disk number */
  64.   UWORD          FParam;       /* Fish flags */
  65.   UWORD          FInfo;        /* Fish Position Info (see kfcGETFISH) */
  66.   ULONG          BufferSize;   /* Originator's buffer size */
  67.   char           *Buffer;      /* Originator's buffer */
  68.   UWORD          VERSIONID;    /* Check after kfcHELLO that it's >= KFAPIVER */
  69.   void           *RESERVED;    /* IMPORTANT: set to NULL before first call */
  70.   char           *RESERVED2;   /* either NULL or a 256+ byte buffer (see kfeFILEOPEN) */
  71. };
  72.  
  73.  
  74.  
  75. /*****************************************************************
  76.  * .Command values
  77.  */
  78. #define kfcHELLO           0x0001   /* Login to server
  79.                      * PROVIDE:
  80.                      *   .BParam = FindTask(0L);
  81.                      *   .Buffer = A scratch buffer containing a nice login identifier
  82.                      *   .BufferSize = size of the scratch buffer
  83.                      *   .RESERVED = 0 ... that's important here!
  84.                      *               Do not ever change this field after the
  85.                      *               kfcLOGIN call, or the server will reject
  86.                      *               your messages!
  87.                      *   .RESERVED2 = a different buffer (256+ bytes) which the
  88.                      *                kfeFILEOPEN error can use to provide you
  89.                      *                with volume:path/filename that failed.
  90.                      *                You may leave this value NULL if you don't
  91.                      *                care to make use of this feature.
  92.                      * RETURNS:
  93.                      *   .VERSIONID = a value you should test for (see above!)
  94.                      *   .BParam = the minimum recommended size for the .Buffer
  95.                      *             If your current (scratch) buffer is smaller
  96.                      *             than this, you should allocate a larger one,
  97.                      *             or else you may frequently receive kfeTRUNC
  98.                      *             errors.  Do not forget to update the
  99.                      *             .BufferSize field accordingly!
  100.                      * We assume henceforth that you ALWAYS provide this buffer
  101.                      * area.
  102.                      */
  103. #define kfcBYE             0x0002   /* Logout of server */
  104. #define kfcQUIT            0x0003   /* RESERVED: Tell server to shutdown
  105.                      * Information on this command is not made public.
  106.                      * Do not use.
  107.                      */
  108. #define kfcFLUSH           0x0004   /* Ask server to flush all file buffers, updated index files, etc
  109.                      * You should not need to use this command at all, because the
  110.                      * KFServer performs this command at certain times.  It is
  111.                      * provided here for those times when you must be absolutely
  112.                      * sure...
  113.                      */
  114.  
  115. #define kfcEXIT            0x000f   /* OBSOLETE: KFServer asks client(!) to shutdown */
  116.                                     /*           Instead of a kfcEXIT message, the client will now */
  117.                                     /*           receive a ^C (CTRL_C) signal to which is should */
  118.                                     /*           respond.  IGNORE kfcEXIT */
  119.  
  120. #define kfcSTATUS          0x0010   /* Client status
  121.                      * RETURNS:
  122.                      *    .Buffer = filled with printable text, multiple lines.
  123.                      *              Do not rely on a specific format for this
  124.                      *              text, as its layout and wording may change.
  125.                      */
  126. #define kfcMAXCLIENTS      0x0011   /* Indicates free/beta/registered version of KFServer
  127.                      * RETURNS:
  128.                      *    .BParam = number of clients that the server supports.
  129.                      *              These value are likely to be found:
  130.                      *              =     2   Freely distributable
  131.                      *              > 32767   Registered
  132.                      *              else      Beta test (non public!)
  133.                      */
  134. #define kfcISTATUS         0x001f   /* RESERVED
  135.                      * Information on this command is not made public.
  136.                      * Do not use.
  137.                      */
  138.  
  139. #define kfcLISTDBASES      0x0020   /* Obtain list of all databases
  140.                      * RETURNS:
  141.                      *    .Buffer = multiple lines of information such as:
  142.                      *              "human-readable-name\1filename.kfdb\n"
  143.                      *              terminated with a \0 byte.  Note \1 is
  144.                      *              a ctrl-A (0x01 byte)
  145.                      */
  146. #define kfcSELECTDBASE     0x0021   /* select a database
  147.                      * PROVIDE:
  148.                      *    .BParam = (char *) to "filename.kfdb"
  149.                      *              Note: the string may be terminated
  150.                      *              with a \n instead of the typical \0
  151.                      *              to allow you to point directly into
  152.                      *              the .Buffer field as returned by the
  153.                      *              kfcLISTDBASES command (above)
  154.                      * RETURNS:
  155.                      *    .BParam = Largest record in this database.
  156.                      *              If your current .Buffer is not at
  157.                      *              least this large, then allocate a
  158.                      *              new one!
  159.                      *    .FParam = 0 if the database is NOT writable
  160.                      *              (You should not call ANY database
  161.                      *               update functions!)
  162.                      *              1 if the database can be updated
  163.                      * NOTE: Some previous versions of the KFServer
  164.                      *       were totally confused about these values.
  165.                      *       and returned only a value in .BParam that
  166.                      *       had nothing to do with the intended use.
  167.                      */
  168. #define kfcGETDBASENAME    0x0022   /* obtain the name of the current database
  169.                      * RETURNS:
  170.                      *    .Buffer = The \0 terminated name of the database
  171.                      *              file (.kfdb) in use.  You may save this
  172.                      *              value and later pass it back to the
  173.                      *              kfcSELECTDBASE command.
  174.                      */
  175. #define kfcGETDBASESIZE    0x0023   /* obtain the number of records in database
  176.                      * RETURNS:
  177.                      *    .BParam = number of records in the database.
  178.                      *              If this value is 0 then the database
  179.                      *              is empty.
  180.                      */
  181. #define kfcGETQINDEX       0x0024   /* obtain a pointer to the current database's quick index
  182.                      * RETURNS:
  183.                      *    .BParam = (char *) to the QuickIndex.
  184.                      *              This index is a \0 terminated list of
  185.                      *              field values, each on a line by itself:
  186.                      *                 "Aquarium\n
  187.                      *                  KingFisher\n
  188.                      *                  NewAqua\n
  189.                      *                  FishCat\n"
  190.                      *    .DParam = (char *) to the QuickIndex Field.
  191.                      *              This points to a \0 terminated string
  192.                      *              of the field to which the QuickIndex
  193.                      *              pertains:
  194.                      *                 "name"
  195.                      * NOTE: The memory does not belong to you.  Do not make
  196.                      *       ANY modifications to this index!!!
  197.                      * NOTE: The pointer obtained becomes invalid after ANY
  198.                      *       command that adds records to the database and
  199.                      *       must be obtained again with kfcGETQINDEX!
  200.                      */
  201. #define kfcGETDBASEDESCRIPT 0x0025  /* obtain long, descriptive label of current database
  202.                      * RETURNS:
  203.                      *    .Buffer = The \0 terminated name of the database
  204.                      *              as given in the .kfdb file's
  205.                      *              'database-name' item.
  206.                      */
  207.  
  208. #define kfcSETPOS          0x0030   /* move to absolute position in database
  209.                      * PROVIDE:
  210.                      *    .BParam = record number to select (1 or greater)
  211.                      * RETURNS:
  212.                      *    .DParam = Disk
  213.                      *    .FParam = Flags
  214.                      *    .FInfo  = Prev/Next flags for Disk/Version/Fish
  215.                      *              (see the Fish Flags (kfi#?) below)
  216.                      * No record will be retrieved from disk, no data
  217.                      * about it will be returned.  Operations such as
  218.                      * kfcNEXTFISH will proceed from the new position.
  219.                      */
  220. #define kfcSETDISKPOS      0x0031   /* move to first fish on indicated disk (1+)
  221.                      * PROVIDE:
  222.                      *    .BParam = disk number to select (1+)
  223.                      * RETURNS:
  224.                      *    (nothing)
  225.                      * Not every database records that its records are
  226.                      * located on disks other than the default, disk 1.
  227.                      */
  228. #define kfcNEXTFISH        0x0032   /* move forward to next fish
  229.                      * PROVIDE:
  230.                      *    (nothing)
  231.                      * RETURNS:
  232.                      *    (nothing)
  233.                      * If the function does not return an error, then
  234.                      * the internal database position is updated.
  235.                      */
  236. #define kfcPREVFISH        0x0033   /* move backward to previous fish
  237.                      * PROVIDE:
  238.                      *    (nothing)
  239.                      * RETURNS:
  240.                      *    (nothing)
  241.                      * If the function does not return an error, then
  242.                      * the internal database position is updated.
  243.                      */
  244.  
  245. #define kfcGETPOS          0x0040   /* obtain current position in database
  246.                      * RETURNS:
  247.                      *    .BParam = 0 if the database is empty
  248.                      *              1+ for a database record
  249.                      * No data is actually retrieved.
  250.                      */
  251. #define kfcGETDISKPOS      0x0041   /* obtain current fish's disk location
  252.                      * RETURNS:
  253.                      *    .BParam = 0 if the database is empty
  254.                      *              1+ for a database record
  255.                      * No data is actually retrieved.
  256.                      */
  257.  
  258. #define kfcGETFISH         0x0050   /* retrieve the information on the current fish
  259.                      * PROVIDE:
  260.                      *    .BParam = 0 to retrieve the current database record.
  261.                      *              1+ to retrieve a specific database record.
  262.                      * RETURNS:
  263.                      *    .Buffer = The record from the database.
  264.                      *    .BParam = The actual record number (1+)
  265.                      *    .DParam = The disk on which the record is stored.
  266.                      *    .FParam = The flags associated with this record.
  267.                      *    .FInfo  = Prev/Next flags for Disk/Version/Fish
  268.                      *              (see the Fish Flags (kfi#?) below)
  269.                      * The record is returned in the "raw" database format.
  270.                      * It is up to the client to reformat this data for the
  271.                      * user!
  272.                      */
  273.  
  274. #define kfcPARSEFILE       0x0070   /* begin or continue parsing a file that conforms to the
  275.                      * Product Info Specification.
  276.                      * PROVIDE:
  277.                      *    .BParam = (char *) filename to begin parsing
  278.                      *              This value is ignored on subsequent calls.
  279.                      * RETURNS:
  280.                      *    .Error = kfeNOMORE => no more record remain in the
  281.                      *             file; the file has been closed, and the
  282.                      *             NEXT kfcPARSEFILE call is assumed to begin
  283.                      *             a NEW file and must provide a valid filename
  284.                      *             with the .BParam field again.
  285.                      *    else:
  286.                      *    .Buffer = The contents of a record from the file,
  287.                      *              which you may (or may not) want to present
  288.                      *              to the user for approval.  You may then use
  289.                      *              a kfcADDFISH call to append the record to
  290.                      *              the database.
  291.                      * A future version will also update the following if the
  292.                      * record was preceded with an .INDEXINFO key:
  293.                      *    .DParam = Disk on which the record is supposed to be
  294.                      *              stored.
  295.                      *    .FParam = Flags that the .INDEXINFO key claimed for
  296.                      *              this record.  If the record comes from a
  297.                      *              foreign database, you may wish to mask out
  298.                      *              all but the standard flags.
  299.                      * If the "error" return value is kfeOK, then you may
  300.                      * pass this record to the server with a kfcADDFISH command
  301.                      * and then call kfcPARSEFILE again.
  302.                      *    If you wish to interrupt kfcPARSEFILE you must send
  303.                      * the server a kfcSTOPPARSE command or else certain other
  304.                      * operations will fail due to the server's inability to
  305.                      * re-use certain internal state values that the parsing
  306.                      * continues to keep locked.
  307.                      */
  308. #define kfcSTOPPARSE       0x0071   /* stop parsing before parsing fails */
  309. #define kfcADDFISH         0x0072   /* add parsed fish from buffer to end of current database
  310.                      * PROVIDE:
  311.                      *    .Buffer = Text to be added
  312.                      *              It is strongly (yes, *STRONGLY*) warned
  313.                      *              against passing arbitrary text to the
  314.                      *              server to add to the database.  Such an
  315.                      *              action is COMPLETELY unsupported and can
  316.                      *              confuse many operations, including the
  317.                      *              kfcREINDEX operation, causing loss of
  318.                      *              data, even undefined and unpredictable
  319.                      *              behavior!
  320.                      *              Information returned by a kfcPARSEFILE
  321.                      *              command is defined to be valid data.
  322.                      *              The absolute minimum is two lines of
  323.                      *              text, the first of which is
  324.                      *                   .name
  325.                      *              and the second of which is at least one
  326.                      *              character.  Both lines should be ended
  327.                      *              with a newline.  In 'C' this string would
  328.                      *              look like:
  329.                      *                   ".name\nProgramName\n"
  330.                      *    .BParam = Disk on which the record is stored
  331.                      *              No, BParam is not a typo; the .DParam
  332.                      *              field was added somewhat late in the
  333.                      *              game, after this command was already
  334.                      *              defined without the benefit of the new
  335.                      *              field.  For backward compatibility, this
  336.                      *              command continues to use .BParam.
  337.                      *    .FParam = Flags to set for this record.
  338.                      * RETURNS:
  339.                      *    .BParam = Record number of the new fish.
  340.                      * The first time you call kfcADDFISH, the KFServer will
  341.                      * reserve the current database for your exclusive use.
  342.                      * This requires that no other client is using that database
  343.                      * or else the kfcADDFISH command will fail.
  344.                      *    Once the kfcADDFISH command has succeeded, you may
  345.                      * safely call the command any number of times.  When you
  346.                      * are finished adding records, release the database again
  347.                      * with the kfcENDADDING command, so that other clients can
  348.                      * again access it, too.
  349.                      *    If you fail to use kfcENDADDING, then similar restrictions
  350.                      * apply as mentioned above, under the kfcPARSEFILE command!
  351.                      *    Notice that the use of kfcADDFISH invalidates any
  352.                      * previously obtained QuickIndex pointers (see kfcGETQINDEX)
  353.                      *    No check is made that the disk numbers of successive
  354.                      * records are actually in sequential order.  You may confuse
  355.                      * any and all DISK related functions (such as kfcSETDISKPOS)
  356.                      * if you do not add records with disk numbers in sequential
  357.                      * order.
  358.                      */
  359. #define kfcENDADDING       0x0073   /* stop adding fish to the current database; release database */
  360. #define kfcSCANTREE        0x0074   /* scans tree on disk and returns contents of .Product-Info files
  361.                      * »»»»» THIS COMMAND IS NOT IMPLEMENTED! «««««
  362.                      * If this functionality is required, it is recommended that you
  363.                      * implement a tree-walking routine yourself, perhaps base on
  364.                      * the 'dirwalker' example provided with SAS/C.
  365.                      */
  366. #define kfcSTOPSCAN        0x0075   /* stops a tree-scan that is in progress before SCANTREE fails.
  367.                      * Not implemented; see kfcSCANTREE above.
  368.                      */
  369. #define kfcTRUNCATE        0x0076   /* truncate the database at (and including) the current fish
  370.                      * Removes all records from the database, beginning with the
  371.                      * current database record.  At present, the records are not
  372.                      * physically removed, which can cause problems when subsequent
  373.                      * additions are made and the database is then reindexed.  A
  374.                      * future version of the KFServer will physically remove the
  375.                      * records, rather than just updating the index.
  376.                      * RETURNS:
  377.                      *    .BParam = Last record number in the database
  378.                      *              (this is 0 if the database is empty)
  379.                      * You should use a kfcGETFISH command to read a new record
  380.                      * from the database.
  381.                      */
  382. #define kfcREINDEX         0x0077   /* rebuilds the main database index and/or the field index
  383.                      * This command MUST BE CALLED multiple times, so long as it
  384.                      * returns kfeOK.  When it returns kfeNOMORE, the operation
  385.                      * has been successfully completed.
  386.                      * PROVIDE:
  387.                      *    .BParam = a mask of kfr#? flags.
  388.                      *              These are currently ignored but may be used
  389.                      *              in future versions of the software.  You
  390.                      *              must set all available flags at this time.
  391.                      * RETURNS:
  392.                      *    .Buffer = Three numbers formatted into a string to
  393.                      *              provide some form of progress feedback.
  394.                      *              The first number is the Disk, the second,
  395.                      *              the record (fish), and the third is the
  396.                      *              total number of bytes that have been
  397.                      *              processed.  The numbers are incremented
  398.                      *              by an internally defined value.  What you
  399.                      *              do with this information is entirely up to
  400.                      *              you.  Example:
  401.                      *                 "15 143 548765"
  402.                      *              refers to disk 15, fish 143, and 548765
  403.                      *              bytes that have been processed.
  404.                      * The need to call this function repeatedly comes from the
  405.                      * fact that a reindex operation usually requires far longer
  406.                      * than a multitasking server can afford to ignore other
  407.                      * clients.  Until KFServer becomes a multi-threaded
  408.                      * application, this requirement will not change.  Please
  409.                      * note that a reindexing operation imposes a SEVERE
  410.                      * penalty on other clients, as the server may not process
  411.                      * more than one or two messages per second, thereby
  412.                      * slowing other clients to a crawl (although not freezing
  413.                      * them altogether, which is the reason for the repeated-call
  414.                      * implementation.)
  415.                      */
  416. #define kfcLOCKDB          0x0078   /* Begins possibly long-term operation on the database,
  417.                      * such as modifying flags, version links, etc.
  418.                      * Do not use this with commands that already provide their
  419.                      * own database locking (such as kfcREINDEX, kfcADDFISH,
  420.                      * kfcPARSEFILE, etc.)
  421.                      * You must use a matching kfcUNLOCKDB to relinquish
  422.                      * access to the database when done.
  423.                      * RETURNS:
  424.                      *    (none)
  425.                      */
  426. #define kfcUNLOCKDB        0x0079   /* Unlocks the database after a successful kfcLOCKDB.
  427.                      * Never EVER use kfcUNLOCKDB in lieu of a kfcENDADDING or
  428.                      * kfcSTOPSCAN command!
  429.                      */
  430.  
  431. #define kfcGETFLAGS        0x0080   /* obtain the flags for the current fish
  432.                      * RETURNS:
  433.                      *    .BParam = Record number of current fish
  434.                      *    .FParam = Flags of the current fish
  435.                      */
  436. #define kfcGETNEXTLINK     0x0081   /* obtain the link to the next version
  437.                      * RETURNS:
  438.                      *    .BParam = Record number of following version
  439.                      *              A value of 0 indicates no link
  440.                      */
  441. #define kfcGETPREVLINK     0x0082   /* obtain the link to the previous version
  442.                      * RETURNS:
  443.                      *    .BParam = Record number of preceding version
  444.                      *              A value of 0 indicates no link
  445.                      */
  446. #define kfcSETFLAG         0x0086   /* set a particular flag for current fish
  447.                      * PROVIDE:
  448.                      *    .FParam = A mask of one or more flags that
  449.                      *              should be set.
  450.                      * RETURNS:
  451.                      *    .FParam = The current flags (new flags
  452.                      *              merged with previous flags)
  453.                      */
  454. #define kfcCLRFLAG         0x0087   /* clear a particular flag for current fish
  455.                      * PROVIDE:
  456.                      *    .FParam = A mask of one or more flags that
  457.                      *              should be cleared.
  458.                      * RETURNS:
  459.                      *    .FParam = The current flags (previous
  460.                      *              minus cleared flags)
  461.                      */
  462. #define kfcSETFLAGS        0x0088   /* set new flags for the current fish
  463.                      * PROVIDE:
  464.                      *    .FParam = A completely new set of flags
  465.                      *              to replace all previous ones.
  466.                      */
  467. #define kfcSETNEXTLINK     0x0089   /* set link to next version
  468.                      * PROVIDE:
  469.                      *    .BParam = New link to following version (1+)
  470.                      *              A value of 0 clears the link
  471.                      */
  472. #define kfcSETPREVLINK     0x008a   /* set link to previous version
  473.                      * PROVIDE:
  474.                      *    .BParam = New link to preceding version (1+)
  475.                      *              A value of 0 clears the link
  476.                      */
  477. #define kfcFINDMASKFORWARD 0x008b   /* locate the next fish matching the masks
  478.                      * PROVIDE:
  479.                      *    .BParam = Number of first record to consider.
  480.                      *    .DParam = Mask of flags to avoid (never match)
  481.                      *    .FParam = Mask of flags to match
  482.                      * RETURNS:
  483.                      *    .BParam = Record number that matched
  484.                      * Returns kfeNOMORE if nothing matched.
  485.                      */
  486. #define kfcFINDMASKREVERSE 0x008c   /* locate the prev fish matching the masks
  487.                      * PROVIDE:
  488.                      *    .BParam = Number of first record to consider.
  489.                      *    .DParam = Mask of flags to avoid (never match)
  490.                      *    .FParam = Mask of flags to match
  491.                      * RETURNS:
  492.                      *    .BParam = Record number that matched
  493.                      * Returns kfeNOMORE if nothing matched.
  494.                      */
  495. #define kfcFINDNEXTUSEDLINK 0x008d  /* locate the next fish that uses a Version Link
  496.                      * PROVIDE:
  497.                      *    .BParam = Number of first record to consider.
  498.                      * RETURNS:
  499.                      *    .BParam = Record number that matched.
  500.                      * Returns kfeNOMORE if nothing matched.
  501.                      */
  502.  
  503. /*****************************************************************
  504.  * .Error return values
  505.  */
  506. #define kfeOK        0x00    /* All is fine.  This is not an error. */
  507. #define kfeREFUSED    0x01    /* Command refused.
  508.                  * Further information is in the .Buffer field.
  509.                  * The client may not be authorized to use the
  510.                  * command or the server is otherwise prevented
  511.                  * from complying with a request.
  512.                  */
  513. #define kfeUNREG    0x02    /* The client has not registered!
  514.                  * The client seems not to be properly registered
  515.                  * with the server.  This may happen when the
  516.                  * server is unexpectedly shutdown, then a new
  517.                  * one started before the client even noticed
  518.                  * that the old server went away.
  519.                  */
  520. #define kfeNOMORE    0x03    /* An operation found no more data.
  521.                  * This can be a move, search, or parse operation,
  522.                  * and is one of the most commonly encountered
  523.                  * "errors" ... your software should not "freak
  524.                  * out" when it encounters this.
  525.                  */
  526. #define kfeBADEXPR    0x04    /* An expression could not be evaluated.
  527.                  * UNUSED.  FORGET ABOUT IT.  NO NEED TO HANDLE THIS.
  528.                  */
  529. #define kfeCONFUSED    0x05    /* KFServer is confused; it might be best to quit! */
  530. #define kfeTRUNC    0x06    /* The .Buffer's size is too small.
  531.                  * An error returned when the KFServer attempts to
  532.                  * store more information in the .Buffer than the
  533.                  * .BufferSize field indicates it can hold.  This
  534.                  * is a rare occurrence, and you may wish to ignore
  535.                  * it and use the partial contents of the buffer,
  536.                  * or re-allocate the buffer to the size indicated
  537.                  * by the .BParam field and try the call again.
  538.                  */
  539. #define kfeMEMORY    0x07    /* The server ran out of memory.
  540.                  * The KFServer performs numerous dynamic allocations
  541.                  * of memory.  If it fails to allocate a necessary
  542.                  * chunk of memory, it returns this error.
  543.                  */
  544. #define kfeBOGUSMSG    0x08    /* The client RETURNED a bogus message to the server.
  545.                  * This can be encountered only when you are responding
  546.                  * to messages at your message port which you did not
  547.                  * send, but the message gets somehow mangled and the
  548.                  * KFServer doesn't recognize it as one of its own,
  549.                  * either.  This should never occur if you're using the
  550.                  * kfc-api.c
  551.                  */
  552. #define kfeFILEOPEN    0x09    /* The server could not open a file that was needed.
  553.                  * If the .RESERVED2 field was not NULL, the KFServer
  554.                  * will fill that field with the filename it failed
  555.                  * to open; if KFAPI_USE_INTUITION is defined _AND_
  556.                  * KFAPIVolumePrompts has not been set to FALSE, the
  557.                  * API will provide prompting for the disk volume
  558.                  * automatically.
  559.                  */
  560. #define kfeBADFISH    0x0a    /* Selected fish doesn't exist */
  561. #define kfeSEEKERROR    0x0b    /* Possibly bad index in the database index */
  562. #define kfeREADERROR    0x0c    /* Some or all of the fish could not be read */
  563. #define kfeWRITEERROR    0x0d    /* Some or all of the fish could not be written */
  564. #define kfeNODBASE    0x0e    /* No database has been selected. */
  565. #define kfeBADDBASE    0x0f    /* Access to the database failed */
  566. #define kfeNOSERVICE    0x10    /* Service request denied or unavailable */
  567.  
  568. /* The following are generated by the kf-api.c by any (even implicit) call to the
  569.  * CallServer() routine; i.e. any call to functions in the kf-api.c file can generate
  570.  * errors like these:
  571.  */
  572. #define kfeNOSERVER     0x81    /* Server did not start within required timeframe */
  573. #define kfeSERVERGONE   0x82    /* The server vanished while a call was in progress */
  574.  
  575.  
  576. /*****************************************************************
  577.  * Fish Flags
  578.  * The following are flags retrievable and settable with the kfcGETFLAGS and kfcSETFLAGS
  579.  * commands.  The values in the range 0x0100 through 0xff00 are reserved for pre-defined
  580.  * flags.  The bits defined below are made into a mask by ORing them together.
  581.  * NOTE: The values 0x0800, 0x1000, 0x2000, and 0x4000 are not defined at the moment and
  582.  *       are reserved for future implementation.  For your own uses, employ the kffUSERx
  583.  *       flags or define equivalent (more meaningful) values in your own code that match
  584.  *       the eight values available to you.
  585.  * NOTE: Use of the kfcREINDEX command will lose all the information below.  This behavior
  586.  *       *MAY* change in a future release.
  587.  */
  588. #define kffDELETED      0x8000  /* fish has been deleted */
  589. #define kffUNDEF1       0x4000  /*    belongs to system; undefined */
  590. #define kffUNDEF2       0x2000  /*    belongs to system; undefined */
  591. #define kffUNDEF3       0x1000  /*    belongs to system; undefined */
  592. #define kffHASTWIN      0x0800  /* fish has twins/duplicates in the database */
  593. #define kffHIDDEN       0x0400  /* fish has been marked hidden */
  594. #define kffOWNED        0x0200  /* fish has already been obtained/downloaded */
  595. #define kffMARKED       0x0100  /* fish has been marked for later retrieval */
  596.  
  597. #define kffUSER7        0x0080
  598. #define kffUSER6        0x0040
  599. #define kffUSER5        0x0020
  600. #define kffUSER4        0x0010
  601. #define kffUSER3        0x0008
  602. #define kffUSER2        0x0004
  603. #define kffUSER1        0x0002
  604. #define kffUSER0        0x0001
  605.  
  606. /*****************************************************************
  607.  * Fish Info
  608.  * The following flags are returned by the kfcGETFISH command to
  609.  * give a GUI information on existence of previous and next fish,
  610.  * disks, and versions.  The .FInfo field will contain this mask.
  611.  */
  612. #define kfiPREVDISK     0x0001  /* This is not the first disk */
  613. #define kfiNEXTDISK     0x0002  /* This is not the last disk */
  614. #define kfiPREVVERS     0x0004  /* A previous version is registered */
  615. #define kfiNEXTVERS     0x0008  /* A succeeding version is registered */
  616. #define kfiPREVFISH     0x0010  /* This is not the first fish */
  617. #define kfiNEXTFISH     0x0020  /* This is not the last fish */
  618.  
  619. /*****************************************************************
  620.  * Options for the kfcREINDEX command
  621.  * These are ignored by the current incarnation of the KFServer;
  622.  * The KFServer currently assumes that the actions indicated by
  623.  * both flags are always desired, and always reindexes both.
  624.  * This behavior may change in a future version if there is call
  625.  * for it.
  626.  */
  627. #define kfrREBUILDMAIN  0x0001  /* Rebuild main index */
  628. #define kfrREBUILDQUICK 0x0002  /* Rebuild quick (name) index */
  629.  
  630. /* EOT */
  631.