home *** CD-ROM | disk | FTP | other *** search
-
- /*Copyright (c) 1985, 1986 SoftCraft, Inc.*/
- /****************************************************************************
- * *
- * C header file for BTRIEVE and xface under XENIX, system V. *
- * *
- * NOTE: if a maximum data length of other than MAX_DATA is desired, *
- * that #define should be set in this file. *
- * *
- ****************************************************************************/
- #include <sys/types.h>
- #include <sys/ipc.h>
- #include <sys/msg.h>
- extern key_t ftok ();
-
- #define MAX_DATA 2048 /* max data buffer length: programmer may change */
-
- /* */
- /* message IPC constants and structures */
- /* DO NOT CHANGE */
- #define BMsgKeyid 'B' /* byte id to get msg key for btrieve rcv q */
- #define XMsgKeyid 'X' /* byte id to get msg key for xface rcv q */
- #define MsgKeypath "/tmp/key.btrieve" /* path to get msg key */
- #define NO_FLAG 0
- #define BMsgType 0x00004254 /* msg type sent by xface to btrieve */
- /* process id is msg type sent by btrieve to xface */
- #define MSGB_MAX 32767 /* max message size */
-
- /* */
- /* general defines */
- /* */
- #define true 1
- #define false 0
- #define SECTOR_SIZE 512 /* disk sector size */
- #define POS_LEN 128 /* position block length */
- #define BTRIEVE_ACTIVE 0xBA /* btrieve is active - sd byte */
- #define VALID_POSITION 0xCB /* position block id */
- #define XUSRNAMELEN 8
- #define VARID 0x6176
- #define NOVARID 0xCCCC
-
- #define MAX_KEY 255 /* max key length */
- #define MAX_PAGE 4096 /* max page length */
- /* */
- /* define offsets in message buffer */
- /* */
- #define OPERATION 0
- #define ACCESS (OPERATION + 2)
- #define STAT (ACCESS + 2)
- #define POSITION (STAT + 2)
- #define RECLEN 6 /* offset in position block of record length */
- #define KEYLENS 10 /* offset in position block of key len array */
- #define XFACEID POSITION + 34 /* absolute offset of xface id */
- #define POSID 38 /* offset in position block of pos block id */
- #define UID 104 /* offset in position block of caller's user id */
- #define GID 106 /* offset in position block of caller's group id */
- #define PID 108 /* offset in position block of caller's process id */
- #define TRANPEND 110 /* offset in position block of trans pending flag */
- #define KEYLEN (POSITION + POS_LEN)
- #define KEYBUF (KEYLEN + 2)
- #define DATALEN (KEYBUF + MAX_KEY)
- #define DATABUF (DATALEN + 2)
- #define UMSGB_MAX (DATABUF + MAX_DATA + 2) /* max msg buffer length */
- /* add 1 because offsets + 1 for extra byte */
-
- struct xmsgbuf /* message buffer structure for xface */
- { /* message IPC structure */
- long mtype; /* message type */
- char mtext[UMSGB_MAX]; /* message text buffer */
- };
- /* */
- /* */
- /* Btrieve function definitions */
- /* */
- #define B_OPEN 0
- #define B_CLOSE 1
- #define B_INSERT 2
- #define B_UPDATE 3
- #define B_DELETE 4
- #define B_GET_EQ 5
- #define B_GET_NXT 6
- #define B_GET_PRV 7
- #define B_GET_GT 8
- #define B_GET_GE 9
- #define B_GET_LT 10
- #define B_GET_LE 11
- #define B_GET_LO 12
- #define B_GET_HI 13
- #define B_CREATE 14
- #define B_STAT 15
- #define B_EXTEND 16
- #define B_SET_DIR 17
- #define B_GET_DIR 18
- #define B_BEG_TRN 19
- #define B_END_TRN 20
- #define B_ABT_TRN 21
- #define B_GET_POS 22
- #define B_GET_DRCT 23
- #define B_STEP 24
- #define B_STOP 25
- #define B_VERS 26
- #define B_UNLOCK 27
- #define B_RESET 28
- #define B_SET_OWN 29
- #define B_CLR_OWN 30
- #define B_LLOCK 100 /* function code bias for loop lock */
- #define B_LOCK 200 /* function code bias for lock */
- #define B_MLLOCK 300 /* function code bias for multiple loop lock */
- #define B_MLOCK 400 /* function code bias for multiple lock */
-
- /* */
- /* Btrieve error codes */
- /* */
- #define BTR_LOD_ERR 20 /* Btrieve not loaded error */
- #define KEY_BUF_ERR 21 /* Key buffer error */
- #define DBUF_LEN_ERR 22 /* Data buffer is too short */
- #define REC_IN_USE 84 /* record is currently locked */
- #define FIL_IN_USE 85 /* file is currently locked */
- #define SYSDBL_ERR 97 /* message cannot fit in queue */
-
-