xref: /freebsd/include/rpcsvc/nis_db.h (revision ce834215a70ff69e7e222827437116eee2f9ac6f)
1 /*
2  * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
3  * unrestricted use provided that this legend is included on all tape
4  * media and as a part of the software program in whole or part.  Users
5  * may copy or modify Sun RPC without charge, but are not authorized
6  * to license or distribute it to anyone else except as part of a product or
7  * program developed by the user.
8  *
9  * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
10  * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
11  * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
12  *
13  * Sun RPC is provided with no support and without any obligation on the
14  * part of Sun Microsystems, Inc. to assist in its use, correction,
15  * modification or enhancement.
16  *
17  * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
18  * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
19  * OR ANY PART THEREOF.
20  *
21  * In no event will Sun Microsystems, Inc. be liable for any lost revenue
22  * or profits or other special, indirect and consequential damages, even if
23  * Sun has been advised of the possibility of such damages.
24  *
25  * Sun Microsystems, Inc.
26  * 2550 Garcia Avenue
27  * Mountain View, California  94043
28  */
29 
30 /*
31  * Copyright (c) 1991, by Sun Microsystems Inc.
32  */
33 
34 /*
35  * This header file defines the interface to the NIS database. All
36  * implementations of the database must export at least these routines.
37  * They must also follow the conventions set herein. See the implementors
38  * guide for specific semantics that are required.
39  */
40 
41 #ifndef	_RPCSVC_NIS_DB_H
42 #define	_RPCSVC_NIS_DB_H
43 
44 
45 /* From: #pragma ident	"@(#)nis_db.h	1.8	94/05/03 SMI" */
46 #pragma ident "$Id: nis_db.h,v 1.3 1996/07/29 13:59:13 wpaul Exp $"
47 
48 /*
49  * Note: although the version of <rpcsvc/nis_db.h> shipped with Solaris
50  * 2.5/2.5.x is actually older than this one (according to the ident
51  * string), it contains changes and a few added functions. Those changes
52  * have been hand merged into this file to bring it up to date.
53  */
54 
55 #include <rpc/rpc.h>
56 #include <rpcsvc/nis.h>
57 
58 #ifdef	__cplusplus
59 extern "C" {
60 #endif
61 
62 enum db_status {
63 	DB_SUCCESS = 0,
64 	DB_NOTFOUND = 1,
65 	DB_NOTUNIQUE = 2,
66 	DB_BADTABLE = 3,
67 	DB_BADQUERY = 4,
68 	DB_BADOBJECT = 5,
69 	DB_MEMORY_LIMIT = 6,
70 	DB_STORAGE_LIMIT = 7,
71 	DB_INTERNAL_ERROR = 8
72 };
73 typedef enum db_status db_status;
74 
75 enum db_action {
76 	DB_LOOKUP = 0,
77 	DB_REMOVE = 1,
78 	DB_ADD = 2,
79 	DB_FIRST = 3,
80 	DB_NEXT = 4,
81 	DB_ALL = 5,
82 	DB_RESET_NEXT = 6,
83 };
84 typedef enum db_action db_action;
85 
86 typedef entry_obj *entry_object_p;
87 
88 typedef struct {
89 	u_int db_next_desc_len;
90 	char *db_next_desc_val;
91 } db_next_desc;
92 
93 struct db_result {
94 	db_status status;
95 	db_next_desc nextinfo;
96 	struct {
97 		u_int objects_len;
98 		entry_object_p *objects_val;
99 	} objects;
100 	long ticks;
101 };
102 typedef struct db_result db_result;
103 
104 /*
105  * Prototypes for the database functions.
106  */
107 
108 #if (__STDC__)
109 
110 extern bool_t db_initialize(char *);
111 #ifdef ORIGINAL_DECLS
112 extern bool_t db_create_table(char *, table_obj *);
113 extern bool_t db_destroy_table(char *);
114 #else
115 extern db_status db_create_table(char *, table_obj *);
116 extern db_status db_destroy_table(char *);
117 #endif
118 extern db_result *db_first_entry(char *, int, nis_attr *);
119 extern db_result *db_next_entry(char *, db_next_desc *);
120 extern db_result *db_reset_next_entry(char *, db_next_desc *);
121 extern db_result *db_list_entries(char *, int, nis_attr *);
122 extern db_result *db_add_entry(char *, int,  nis_attr *, entry_obj *);
123 extern db_result *db_remove_entry(char *, int, nis_attr *);
124 extern db_status db_checkpoint(char *);
125 extern db_status db_standby(char *);
126 #ifndef ORIGINAL_DECLS
127 extern db_status db_table_exists(char *);
128 extern db_status db_unload_table(char *);
129 extern void db_free_result(db_result *);
130 #endif
131 
132 #else /* Non-prototype definitions */
133 
134 extern bool_t db_initialize();
135 #ifdef ORIGINAL_DECLS
136 extern bool_t db_create_table();
137 extern bool_t db_destroy_table();
138 #else
139 extern db_status db_create_table();
140 extern db_status db_destroy_table();
141 #endif
142 extern db_result *db_first_entry();
143 extern db_result *db_next_entry();
144 extern db_result *db_reset_next_entry();
145 extern db_result *db_list_entries();
146 extern db_result *db_add_entry();
147 extern db_result *db_remove_entry();
148 extern db_status db_checkpoint();
149 extern db_status db_standby();
150 #ifndef ORIGINAL_DECLS
151 extern db_status db_table_exists();
152 extern db_status db_unload_table();
153 extern void db_free_result();
154 #endif
155 #endif  /* __STDC__ */
156 
157 #ifdef __cplusplus
158 }
159 #endif
160 
161 #endif	/* _RPCSVC_NIS_DB_H */
162