xref: /freebsd/include/rpcsvc/nis_db.h (revision 5a1d1441)
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 /*
46  * Note: although the version of <rpcsvc/nis_db.h> shipped with Solaris
47  * 2.5/2.5.x is actually older than this one (according to the ident
48  * string), it contains changes and a few added functions. Those changes
49  * have been hand merged into this file to bring it up to date.
50  */
51 
52 #include <rpc/rpc.h>
53 #include <rpcsvc/nis.h>
54 
55 #ifdef	__cplusplus
56 extern "C" {
57 #endif
58 
59 enum db_status {
60 	DB_SUCCESS = 0,
61 	DB_NOTFOUND = 1,
62 	DB_NOTUNIQUE = 2,
63 	DB_BADTABLE = 3,
64 	DB_BADQUERY = 4,
65 	DB_BADOBJECT = 5,
66 	DB_MEMORY_LIMIT = 6,
67 	DB_STORAGE_LIMIT = 7,
68 	DB_INTERNAL_ERROR = 8
69 };
70 typedef enum db_status db_status;
71 
72 enum db_action {
73 	DB_LOOKUP = 0,
74 	DB_REMOVE = 1,
75 	DB_ADD = 2,
76 	DB_FIRST = 3,
77 	DB_NEXT = 4,
78 	DB_ALL = 5,
79 	DB_RESET_NEXT = 6
80 };
81 typedef enum db_action db_action;
82 
83 typedef entry_obj *entry_object_p;
84 
85 typedef struct {
86 	u_int db_next_desc_len;
87 	char *db_next_desc_val;
88 } db_next_desc;
89 
90 struct db_result {
91 	db_status status;
92 	db_next_desc nextinfo;
93 	struct {
94 		u_int objects_len;
95 		entry_object_p *objects_val;
96 	} objects;
97 	long ticks;
98 };
99 typedef struct db_result db_result;
100 
101 /*
102  * Prototypes for the database functions.
103  */
104 
105 extern bool_t db_initialize(char *);
106 #ifdef ORIGINAL_DECLS
107 extern bool_t db_create_table(char *, table_obj *);
108 extern bool_t db_destroy_table(char *);
109 #else
110 extern db_status db_create_table(char *, table_obj *);
111 extern db_status db_destroy_table(char *);
112 #endif
113 extern db_result *db_first_entry(char *, int, nis_attr *);
114 extern db_result *db_next_entry(char *, db_next_desc *);
115 extern db_result *db_reset_next_entry(char *, db_next_desc *);
116 extern db_result *db_list_entries(char *, int, nis_attr *);
117 extern db_result *db_add_entry(char *, int,  nis_attr *, entry_obj *);
118 extern db_result *db_remove_entry(char *, int, nis_attr *);
119 extern db_status db_checkpoint(char *);
120 extern db_status db_standby(char *);
121 #ifndef ORIGINAL_DECLS
122 extern db_status db_table_exists(char *);
123 extern db_status db_unload_table(char *);
124 extern void db_free_result(db_result *);
125 #endif
126 
127 #ifdef __cplusplus
128 }
129 #endif
130 
131 #endif	/* _RPCSVC_NIS_DB_H */
132