2 * CDE - Common Desktop Environment
4 * Copyright (c) 1993-2012, The Open Group. All rights reserved.
6 * These libraries and programs are free software; you can
7 * redistribute them and/or modify them under the terms of the GNU
8 * Lesser General Public License as published by the Free Software
9 * Foundation; either version 2 of the License, or (at your option)
12 * These libraries and programs are distributed in the hope that
13 * they will be useful, but WITHOUT ANY WARRANTY; without even the
14 * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 * PURPOSE. See the GNU Lesser General Public License for more
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with these libraries and programs; if not, write
20 * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
21 * Floor, Boston, MA 02110-1301 USA
23 /*%% (c) Copyright 1993, 1994 Hewlett-Packard Company */
24 /*%% (c) Copyright 1993, 1994 International Business Machines Corp. */
25 /*%% (c) Copyright 1993, 1994 Sun Microsystems, Inc. */
26 /*%% (c) Copyright 1993, 1994 Novell, Inc. */
27 /*%% $XConsortium: isam.h /main/3 1995/10/23 11:33:51 rswiston $ */
34 * Copyright (c) 1988 by Sun Microsystems, Inc.
41 * isam.h is to be included in NetISAM C application programs.
43 * Make sure all changes in this file are reflected in lib/db/tt_client_isam.h
57 extern float ldfloat();
58 extern double lddbl();
59 extern short ldshort();
60 extern int ldchar(), stchar(), stlong(), stdbl();
61 extern int stint(short val, char *p);
62 extern int stfloat(float f, char *p);
65 extern int iserrno; /* isam error number code */
66 extern long isrecnum; /* record number of last call */
67 extern int isreclen; /* used for variable length recs */
68 extern char isstat1; /* cobol status characters */
78 #define LONGSIZE LONG_BIT/8
92 #define ISDESC 0x80 /* add to make descending type */
93 #define TYPEMASK 0x7f /* type mask */
95 #define BYTEMASK 0xff /* mask for one byte */
96 #define BYTESHFT 8 /* shift for one byte */
98 /* mode parameter in isread() and isstart() */
100 #define ISFIRST 0 /* first record */
101 #define ISLAST 1 /* last record */
102 #define ISNEXT 2 /* next record */
103 #define ISPREV 3 /* previous record */
104 #define ISCURR 4 /* current record */
106 #define ISEQUAL 5 /* equal value */
107 #define ISGREAT 6 /* greater value */
108 #define ISGTEQ 7 /* >= value */
109 #define ISLESS 8 /* < */
110 #define ISLTEQ 9 /* <= */
112 /* isopen, isbuild lock modes */
113 #define ISAUTOLOCK 0x200 /* automatic record lock */
114 #define ISMANULOCK 0x400 /* manual record lock */
115 #define ISEXCLLOCK 0x800 /* exclusive isam file lock */
116 #define ISFASTLOCK 0x4000 /* no locking when EXCLLOCK! */
118 /* isread lock modes */
119 #define ISLOCK 0x100 /* lock record before reading */
120 #define ISSKIPLOCK 0x1000 /* advance record pointer to */
122 /* isstart lock mode for automatic record locking */
123 #define ISKEEPLOCK 0x2000 /* keep record locked */
125 /* Fix/Variable length records mode */
127 #define ISVARLEN 0x10000
129 /* Access remote file via NFS */
130 #define ISNFS 0x20000
133 #define ISINPUT 0 /* open for input only */
134 #define ISOUTPUT 1 /* open for output only */
135 #define ISINOUT 2 /* open for input and output */
137 #define MAXKEYSIZE 150 /* max number of bytes in key */
138 #define NPARTS 8 /* max number of key parts */
140 /*#define ISMAXRECLEN 8192 */ /* Maximum number of bytes in record */
141 #define ISMAXRECLEN 32767 /* 32K - 1 */
142 #define ISMINRECLEN 4 /* Minimum number of bytes in record */
145 unsigned short kp_start; /* starting byte of key part */
146 short kp_leng; /* length in bytes */
147 short kp_type; /* type of key part */
151 short k_flags; /* flags */
152 short k_nparts; /* number of parts in key */
153 struct keypart k_part[NPARTS]; /* each part */
156 /* The next three defines are for compatibility with X/OPEN */
157 #define k_start k_part[0].kp_start
158 #define k_leng k_part[0].kp_leng
159 #define k_type k_part[0].kp_type
161 #define ISNODUPS 000 /* no duplicates and */
163 #define ISDUPS 001 /* duplicates allowed */
164 #define COMPRESS 020 /* full compression */
167 short di_nkeys; /* number of keys defined */
168 unsigned short di_recsize; /* data record size */
169 short di_idxsize; /* index record size */
170 long di_nrecords; /* number of records in file */
173 /* msb in di_nkeys indicates that ISAM file supports variable length records */
174 #define DICTVARLENBIT 0x8000
176 /* mask to access the true number of keys */
177 #define DICTNKEYSMASK (DICTVARLENBIT - 1)
180 #define ENOERROR 0 /* No error */
181 #define EDUPL 100 /* duplicate record */
182 #define ENOTOPEN 101 /* file not open */
183 #define EBADARG 102 /* illegal argument */
184 #define EBADKEY 103 /* illegal key desc */
185 #define ETOOMANY 104 /* too many files open */
186 #define EBADFILE 105 /* bad ISAM file format */
187 #define ENOTEXCL 106 /* non-exclusive access */
188 #define ELOCKED 107 /* record locked */
189 #define EKEXISTS 108 /* key already exists */
190 #define EPRIMKEY 109 /* is primary key */
191 #define EENDFILE 110 /* end/begin of file */
192 #define ENOREC 111 /* no record found */
193 #define ENOCURR 112 /* no current record */
194 #define EFLOCKED 113 /* file locked */
195 #define EFNAME 114 /* file name too long */
196 #define EBADMEM 116 /* cannot allocate memory */
198 /* NetISAM specific error codes non XOPEN compliant*/
199 #define ETIMEOUT 1117 /* RPC timeout */
200 #define ERPC 1118 /* Broken TCP/IP */
201 #define ETCP 1119 /* Cannot connect to server */
202 #define EIMPORT 1120 /* Cannot import */
203 #define ENODAEMON 1121 /* no local daemon */
204 #define EFATAL 1122 /* internal fatal error */
205 #define ELANG 1123 /* Locale/LANG mismatch */
208 #define ISOK 0 /* no error return code */
209 #define ISERROR -1 /* error return code */
212 extern struct keydesc *nokey; /* May be used as parameter
214 * primary key is to be built
217 /* ischeckindex() diagmode values */
218 #define CHK_NODIAG 0 /* do not print any messages */
219 #define CHK_DIAG 1 /* Access Level module will print to stderr */
221 /* values of corrupt parameter of ischeckindex() */
222 #define CHK_OK 0 /* ISAM file is not corrupted */
223 #define CHK_DAT 1 /* .dat file is corrupted */
224 #define CHK_VAR 2 /* .var file is corrupted */
225 #define CHK_IND 3 /* .ind file is corrupted */
228 /* iscntl() definitions */
229 /* For one isfd - use iscntl(isfd, func, ...) */
230 #define ISCNTL_RPCS_TO_SET 1 /* short oper. timeout (in sec) */
231 #define ISCNTL_RPCS_TO_GET 2 /* short oper. timeout (in sec) */
232 #define ISCNTL_RPCL_TO_SET 3 /* long oper. timeout (in sec) */
233 #define ISCNTL_RPCL_TO_GET 4 /* long oper. timeout (in sec) */
234 #define ISCNTL_TCP_TO_SET 5 /* timeout to reconnect TCP?IP */
235 #define ISCNTL_TCP_TO_GET 6 /* timeout to reconnect TCP?IP */
236 #define ISCNTL_APPLMAGIC_WRITE 7 /* Write Appl. Magic */
237 #define ISCNTL_APPLMAGIC_READ 8 /* Read Appl. Magic */
238 #define ISCNTL_FSYNC 9 /* Flush pages to disk */
239 #define ISCNTL_FDLIMIT_SET 10 /* Set UNIX fd usage limit */
240 #define ISCNTL_FDLIMIT_GET 11 /* Get UNIX fd usage limit */
241 #define ISCNTL_FATAL 12 /* Specify NetISAM fatal error hadler */
242 #define ISCNTL_MASKSIGNALS 13 /* Enable or Disable masking signals during NetISAM operations */
244 #define ISAPPLMAGICLEN 32
247 * ALLISFD in iscntl() calls means that the operation should be done
248 * on all open file descriptors, or the operation is not related to
249 * any file descriptor (e.g: maskintg signals)
253 /* isshowlocks() and isshowhostlocks() return an array of struct showlock */
254 #define IPADDRLEN 4 /* IP address length */
256 short dev; /* Major/Minor device number,
257 * actually type dev_t */
258 long inode; /* inode number */
259 long recnum; /* record number */
260 char hostid[IPADDRLEN]; /* IP address of host */
261 short pid; /* UNIX process ID */
262 long uid; /* User ID */
263 short type; /* See below */
267 /* NetISAM Programmer Toolkit related definitions */
281 struct isfldmap *tbi_fields;
283 struct keydesc *tbi_keys;
287 /* record descriptor isreadm/iswritem record descriptor */
296 * The following defines and variable definitions are not used by NetISAM 1.0.
297 * They are defined for compatibility with VSX 2.5.
299 #define EBADCOLL (-1)
301 #define IO_OPEN 0x10 /* open() */
302 #define IO_CREA 0x20 /* creat() */
303 #define IO_SEEK 0x30 /* lseek() */
304 #define IO_READ 0x40 /* read() */
305 #define IO_WRIT 0x50 /* write() */
306 #define IO_LOCK 0x60 /* lockf() */
307 #define IO_IOCTL 0x70 /* ioctl() */
308 #define IO_RENAME 0x80 /* rename() */
309 #define IO_UNLINK 0x90 /* unlink() */
314 #endif /* !_ISAM_H */