home *** CD-ROM | disk | FTP | other *** search
/ Jason Aller Floppy Collection / 125.img / PRO-C4.ZIP / BENCH1.ZIP / HDR / XFACEHDR.H < prev   
C/C++ Source or Header  |  1990-05-28  |  6KB  |  121 lines

  1.  
  2. /*Copyright (c) 1985, 1986 SoftCraft, Inc.*/
  3. /****************************************************************************
  4. *                                                                           *
  5. *      C header file for BTRIEVE and xface under XENIX, system V.           *
  6. *                                                                           *
  7. *    NOTE: if a maximum data length of other than MAX_DATA is desired,      *
  8. *    that #define should be set in this file.                               *
  9. *                                                                           *
  10. ****************************************************************************/
  11. #include   <sys/types.h>
  12. #include   <sys/ipc.h>
  13. #include   <sys/msg.h>
  14. extern key_t ftok ();
  15.  
  16. #define MAX_DATA  2048    /* max data buffer length: programmer may change */
  17.  
  18. /*                                                                         */
  19. /*             message IPC constants and structures                        */
  20. /*                       DO NOT CHANGE                                     */
  21. #define BMsgKeyid  'B'         /* byte id to get msg key for btrieve rcv q */
  22. #define XMsgKeyid  'X'           /* byte id to get msg key for xface rcv q */
  23. #define MsgKeypath "/tmp/key.btrieve"               /* path to get msg key */
  24. #define NO_FLAG  0
  25. #define BMsgType 0x00004254           /* msg type sent by xface to btrieve */ 
  26.                         /* process id is msg type sent by btrieve to xface */
  27. #define MSGB_MAX  32767                                /* max message size */
  28.  
  29. /*                                                                         */
  30. /*                         general defines                                 */
  31. /*                                                                         */
  32. #define true      1
  33. #define false     0
  34. #define SECTOR_SIZE 512                                /* disk sector size */
  35. #define POS_LEN   128                             /* position block length */ 
  36. #define BTRIEVE_ACTIVE 0xBA                 /* btrieve is active - sd byte */
  37. #define VALID_POSITION 0xCB                           /* position block id */
  38. #define XUSRNAMELEN    8
  39. #define VARID    0x6176
  40. #define NOVARID  0xCCCC
  41.  
  42. #define MAX_KEY   255                                    /* max key length */
  43. #define MAX_PAGE  4096                                  /* max page length */
  44. /*                                                                         */
  45. /*                define offsets in message buffer                         */
  46. /*                                                                         */
  47. #define OPERATION 0
  48. #define ACCESS    (OPERATION + 2)
  49. #define STAT      (ACCESS + 2)
  50. #define POSITION  (STAT  + 2)
  51. #define RECLEN    6           /* offset in position block of record length */
  52. #define KEYLENS   10          /* offset in position block of key len array */
  53. #define XFACEID   POSITION + 34  /* absolute offset of xface id            */
  54. #define POSID     38          /* offset in position block of pos block id  */
  55. #define UID       104      /* offset in position block of caller's user id */
  56. #define GID       106     /* offset in position block of caller's group id */
  57. #define PID       108   /* offset in position block of caller's process id */
  58. #define TRANPEND  110    /* offset in position block of trans pending flag */
  59. #define KEYLEN    (POSITION + POS_LEN)
  60. #define KEYBUF    (KEYLEN + 2)      
  61. #define DATALEN   (KEYBUF + MAX_KEY)
  62. #define DATABUF   (DATALEN + 2)    
  63. #define UMSGB_MAX (DATABUF + MAX_DATA + 2)        /* max msg buffer length */
  64.                                /* add 1 because offsets + 1 for extra byte */
  65.  
  66. struct xmsgbuf                       /* message buffer structure for xface */
  67.   {                                               /* message IPC structure */
  68.    long     mtype;                                         /* message type */
  69.    char     mtext[UMSGB_MAX];                       /* message text buffer */
  70.   }; 
  71. /*                                            */
  72. /*                                            */
  73. /*              Btrieve function definitions               */
  74. /*                                                                         */
  75. #define B_OPEN        0
  76. #define B_CLOSE     1
  77. #define B_INSERT    2
  78. #define B_UPDATE    3
  79. #define B_DELETE    4
  80. #define B_GET_EQ    5
  81. #define B_GET_NXT   6
  82. #define B_GET_PRV   7
  83. #define B_GET_GT    8
  84. #define B_GET_GE    9
  85. #define B_GET_LT    10
  86. #define B_GET_LE    11
  87. #define B_GET_LO    12
  88. #define B_GET_HI    13
  89. #define B_CREATE    14
  90. #define B_STAT        15
  91. #define B_EXTEND    16
  92. #define B_SET_DIR   17
  93. #define B_GET_DIR   18
  94. #define B_BEG_TRN   19
  95. #define B_END_TRN   20
  96. #define B_ABT_TRN   21
  97. #define B_GET_POS   22
  98. #define B_GET_DRCT  23
  99. #define B_STEP        24
  100. #define B_STOP        25
  101. #define B_VERS        26
  102. #define B_UNLOCK    27
  103. #define B_RESET     28
  104. #define B_SET_OWN   29
  105. #define B_CLR_OWN   30
  106. #define B_LLOCK    100               /* function code bias for loop lock */
  107. #define B_LOCK       200                    /* function code bias for lock */
  108. #define B_MLLOCK   300       /* function code bias for multiple loop lock */
  109. #define B_MLOCK    400        /* function code bias for multiple lock */
  110.  
  111. /*                                                                         */
  112. /*              Btrieve error codes                   */
  113. /*                                                                         */
  114. #define BTR_LOD_ERR 20        /* Btrieve not loaded error           */
  115. #define KEY_BUF_ERR 21             /* Key buffer error                        */
  116. #define DBUF_LEN_ERR 22     /* Data buffer is too short                */
  117. #define REC_IN_USE  84        /* record is currently locked           */
  118. #define FIL_IN_USE  85        /* file is currently locked               */
  119. #define SYSDBL_ERR  97      /* message cannot fit in queue             */
  120.  
  121.