xref: /freebsd/include/rpcsvc/nis_db.h (revision 5a1d14419a5b620430949a46cb6ee63148a43cb9)
13b0f7467SBill Paul /*
23b0f7467SBill Paul  * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
33b0f7467SBill Paul  * unrestricted use provided that this legend is included on all tape
43b0f7467SBill Paul  * media and as a part of the software program in whole or part.  Users
53b0f7467SBill Paul  * may copy or modify Sun RPC without charge, but are not authorized
63b0f7467SBill Paul  * to license or distribute it to anyone else except as part of a product or
73b0f7467SBill Paul  * program developed by the user.
83b0f7467SBill Paul  *
93b0f7467SBill Paul  * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
103b0f7467SBill Paul  * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
113b0f7467SBill Paul  * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
123b0f7467SBill Paul  *
133b0f7467SBill Paul  * Sun RPC is provided with no support and without any obligation on the
143b0f7467SBill Paul  * part of Sun Microsystems, Inc. to assist in its use, correction,
153b0f7467SBill Paul  * modification or enhancement.
163b0f7467SBill Paul  *
173b0f7467SBill Paul  * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
183b0f7467SBill Paul  * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
193b0f7467SBill Paul  * OR ANY PART THEREOF.
203b0f7467SBill Paul  *
213b0f7467SBill Paul  * In no event will Sun Microsystems, Inc. be liable for any lost revenue
223b0f7467SBill Paul  * or profits or other special, indirect and consequential damages, even if
233b0f7467SBill Paul  * Sun has been advised of the possibility of such damages.
243b0f7467SBill Paul  *
253b0f7467SBill Paul  * Sun Microsystems, Inc.
263b0f7467SBill Paul  * 2550 Garcia Avenue
273b0f7467SBill Paul  * Mountain View, California  94043
283b0f7467SBill Paul  */
293b0f7467SBill Paul 
303b0f7467SBill Paul /*
313b0f7467SBill Paul  * Copyright (c) 1991, by Sun Microsystems Inc.
323b0f7467SBill Paul  */
333b0f7467SBill Paul 
343b0f7467SBill Paul /*
353b0f7467SBill Paul  * This header file defines the interface to the NIS database. All
363b0f7467SBill Paul  * implementations of the database must export at least these routines.
373b0f7467SBill Paul  * They must also follow the conventions set herein. See the implementors
383b0f7467SBill Paul  * guide for specific semantics that are required.
393b0f7467SBill Paul  */
403b0f7467SBill Paul 
413b0f7467SBill Paul #ifndef	_RPCSVC_NIS_DB_H
423b0f7467SBill Paul #define	_RPCSVC_NIS_DB_H
433b0f7467SBill Paul 
443b0f7467SBill Paul 
453b0f7467SBill Paul /*
463b0f7467SBill Paul  * Note: although the version of <rpcsvc/nis_db.h> shipped with Solaris
473b0f7467SBill Paul  * 2.5/2.5.x is actually older than this one (according to the ident
483b0f7467SBill Paul  * string), it contains changes and a few added functions. Those changes
493b0f7467SBill Paul  * have been hand merged into this file to bring it up to date.
503b0f7467SBill Paul  */
513b0f7467SBill Paul 
523b0f7467SBill Paul #include <rpc/rpc.h>
533b0f7467SBill Paul #include <rpcsvc/nis.h>
543b0f7467SBill Paul 
553b0f7467SBill Paul #ifdef	__cplusplus
563b0f7467SBill Paul extern "C" {
573b0f7467SBill Paul #endif
583b0f7467SBill Paul 
593b0f7467SBill Paul enum db_status {
603b0f7467SBill Paul 	DB_SUCCESS = 0,
613b0f7467SBill Paul 	DB_NOTFOUND = 1,
623b0f7467SBill Paul 	DB_NOTUNIQUE = 2,
633b0f7467SBill Paul 	DB_BADTABLE = 3,
643b0f7467SBill Paul 	DB_BADQUERY = 4,
653b0f7467SBill Paul 	DB_BADOBJECT = 5,
663b0f7467SBill Paul 	DB_MEMORY_LIMIT = 6,
673b0f7467SBill Paul 	DB_STORAGE_LIMIT = 7,
683b0f7467SBill Paul 	DB_INTERNAL_ERROR = 8
693b0f7467SBill Paul };
703b0f7467SBill Paul typedef enum db_status db_status;
713b0f7467SBill Paul 
723b0f7467SBill Paul enum db_action {
733b0f7467SBill Paul 	DB_LOOKUP = 0,
743b0f7467SBill Paul 	DB_REMOVE = 1,
753b0f7467SBill Paul 	DB_ADD = 2,
763b0f7467SBill Paul 	DB_FIRST = 3,
773b0f7467SBill Paul 	DB_NEXT = 4,
783b0f7467SBill Paul 	DB_ALL = 5,
79b68659fcSBruce Evans 	DB_RESET_NEXT = 6
803b0f7467SBill Paul };
813b0f7467SBill Paul typedef enum db_action db_action;
823b0f7467SBill Paul 
833b0f7467SBill Paul typedef entry_obj *entry_object_p;
843b0f7467SBill Paul 
853b0f7467SBill Paul typedef struct {
863b0f7467SBill Paul 	u_int db_next_desc_len;
873b0f7467SBill Paul 	char *db_next_desc_val;
883b0f7467SBill Paul } db_next_desc;
893b0f7467SBill Paul 
903b0f7467SBill Paul struct db_result {
913b0f7467SBill Paul 	db_status status;
923b0f7467SBill Paul 	db_next_desc nextinfo;
933b0f7467SBill Paul 	struct {
943b0f7467SBill Paul 		u_int objects_len;
953b0f7467SBill Paul 		entry_object_p *objects_val;
963b0f7467SBill Paul 	} objects;
973b0f7467SBill Paul 	long ticks;
983b0f7467SBill Paul };
993b0f7467SBill Paul typedef struct db_result db_result;
1003b0f7467SBill Paul 
1013b0f7467SBill Paul /*
1023b0f7467SBill Paul  * Prototypes for the database functions.
1033b0f7467SBill Paul  */
1043b0f7467SBill Paul 
1053b0f7467SBill Paul extern bool_t db_initialize(char *);
1063b0f7467SBill Paul #ifdef ORIGINAL_DECLS
1073b0f7467SBill Paul extern bool_t db_create_table(char *, table_obj *);
1083b0f7467SBill Paul extern bool_t db_destroy_table(char *);
1093b0f7467SBill Paul #else
1103b0f7467SBill Paul extern db_status db_create_table(char *, table_obj *);
1113b0f7467SBill Paul extern db_status db_destroy_table(char *);
1123b0f7467SBill Paul #endif
1133b0f7467SBill Paul extern db_result *db_first_entry(char *, int, nis_attr *);
1143b0f7467SBill Paul extern db_result *db_next_entry(char *, db_next_desc *);
1153b0f7467SBill Paul extern db_result *db_reset_next_entry(char *, db_next_desc *);
1163b0f7467SBill Paul extern db_result *db_list_entries(char *, int, nis_attr *);
1173b0f7467SBill Paul extern db_result *db_add_entry(char *, int,  nis_attr *, entry_obj *);
1183b0f7467SBill Paul extern db_result *db_remove_entry(char *, int, nis_attr *);
1193b0f7467SBill Paul extern db_status db_checkpoint(char *);
1203b0f7467SBill Paul extern db_status db_standby(char *);
1213b0f7467SBill Paul #ifndef ORIGINAL_DECLS
1223b0f7467SBill Paul extern db_status db_table_exists(char *);
1233b0f7467SBill Paul extern db_status db_unload_table(char *);
1243b0f7467SBill Paul extern void db_free_result(db_result *);
1253b0f7467SBill Paul #endif
1263b0f7467SBill Paul 
1273b0f7467SBill Paul #ifdef __cplusplus
1283b0f7467SBill Paul }
1293b0f7467SBill Paul #endif
1303b0f7467SBill Paul 
1313b0f7467SBill Paul #endif	/* _RPCSVC_NIS_DB_H */
132