]> git.saurik.com Git - apple/network_cmds.git/blob - makedbm.tproj/ypdb.h
5082ef2b9567336eae089feb759da472db36e670
[apple/network_cmds.git] / makedbm.tproj / ypdb.h
1 /*
2 * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
11 * file.
12 *
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
20 *
21 * @APPLE_LICENSE_HEADER_END@
22 */
23 /* $OpenBSD: ypdb.h,v 1.5 1997/02/09 09:49:37 maja Exp $ */
24
25 /*
26 * Copyright (c) 1990, 1993
27 * The Regents of the University of California. All rights reserved.
28 * All rights reserved.
29 *
30 * This code is derived from software contributed to Berkeley by
31 * Margo Seltzer.
32 *
33 * This code is derived from ndbm module of BSD4.4 db (hash) by
34 * Mats O Jansson
35 *
36 * Redistribution and use in source and binary forms, with or without
37 * modification, are permitted provided that the following conditions
38 * are met:
39 * 1. Redistributions of source code must retain the above copyright
40 * notice, this list of conditions and the following disclaimer.
41 * 2. Redistributions in binary form must reproduce the above copyright
42 * notice, this list of conditions and the following disclaimer in the
43 * documentation and/or other materials provided with the distribution.
44 * 3. All advertising materials mentioning features or use of this software
45 * must display the following acknowledgement:
46 * This product includes software developed by the University of
47 * California, Berkeley and its contributors.
48 * 4. Neither the name of the University nor the names of its contributors
49 * may be used to endorse or promote products derived from this software
50 * without specific prior written permission.
51 *
52 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
53 * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
54 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
55 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
56 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
57 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
58 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
59 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
60 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
61 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
62 * SUCH DAMAGE.
63 */
64
65 #ifndef _YPDB_H_
66 #define _YPDB_H_
67
68 #ifndef _DB_H_
69 #include <db.h>
70 #endif
71
72 #define YPDB_SUFFIX ".db"
73
74 /* Flags to ypdb_store(). */
75 #define YPDB_INSERT 0
76 #define YPDB_REPLACE 1
77
78 #ifndef DATUM
79 typedef struct {
80 char *dptr;
81 int dsize;
82 } datum;
83 #define DATUM
84 #endif
85
86 typedef DB DBM;
87
88 __BEGIN_DECLS
89 void ypdb_close __P((DBM *));
90 datum ypdb_fetch __P((DBM *, datum));
91 datum ypdb_firstkey __P((DBM *));
92 datum ypdb_nextkey __P((DBM *));
93 datum ypdb_setkey __P((DBM *, datum));
94 DBM *ypdb_open __P((const char *, int, int));
95 DBM *ypdb_open_suf __P((const char *, int, int));
96 int ypdb_store __P((DBM *, datum, datum, int));
97 __END_DECLS
98
99 #endif /* !_YPDB_H_ */