126206Swpaul/*
226206Swpaul * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
326206Swpaul * unrestricted use provided that this legend is included on all tape
426206Swpaul * media and as a part of the software program in whole or part.  Users
526206Swpaul * may copy or modify Sun RPC without charge, but are not authorized
626206Swpaul * to license or distribute it to anyone else except as part of a product or
726206Swpaul * program developed by the user.
826206Swpaul *
926206Swpaul * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
1026206Swpaul * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
1126206Swpaul * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
1226206Swpaul *
1326206Swpaul * Sun RPC is provided with no support and without any obligation on the
1426206Swpaul * part of Sun Microsystems, Inc. to assist in its use, correction,
1526206Swpaul * modification or enhancement.
1626206Swpaul *
1726206Swpaul * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
1826206Swpaul * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
1926206Swpaul * OR ANY PART THEREOF.
2026206Swpaul *
2126206Swpaul * In no event will Sun Microsystems, Inc. be liable for any lost revenue
2226206Swpaul * or profits or other special, indirect and consequential damages, even if
2326206Swpaul * Sun has been advised of the possibility of such damages.
2426206Swpaul *
2526206Swpaul * Sun Microsystems, Inc.
2626206Swpaul * 2550 Garcia Avenue
2726206Swpaul * Mountain View, California  94043
2832556Sbde *
2950473Speter * $FreeBSD$
3026206Swpaul */
3126206Swpaul
3226206Swpaul/*
3326206Swpaul * Copyright (c) 1991, by Sun Microsystems Inc.
3426206Swpaul */
3526206Swpaul
3626206Swpaul/*
3726206Swpaul * This header file defines the interface to the NIS database. All
3826206Swpaul * implementations of the database must export at least these routines.
3926206Swpaul * They must also follow the conventions set herein. See the implementors
4026206Swpaul * guide for specific semantics that are required.
4126206Swpaul */
4226206Swpaul
4326206Swpaul#ifndef	_RPCSVC_NIS_DB_H
4426206Swpaul#define	_RPCSVC_NIS_DB_H
4526206Swpaul
4626206Swpaul
4726206Swpaul/* From: #pragma ident	"@(#)nis_db.h	1.8	94/05/03 SMI" */
4826206Swpaul
4926206Swpaul/*
5026206Swpaul * Note: although the version of <rpcsvc/nis_db.h> shipped with Solaris
5126206Swpaul * 2.5/2.5.x is actually older than this one (according to the ident
5226206Swpaul * string), it contains changes and a few added functions. Those changes
5326206Swpaul * have been hand merged into this file to bring it up to date.
5426206Swpaul */
5526206Swpaul
5626206Swpaul#include <rpc/rpc.h>
5726206Swpaul#include <rpcsvc/nis.h>
5826206Swpaul
5926206Swpaul#ifdef	__cplusplus
6026206Swpaulextern "C" {
6126206Swpaul#endif
6226206Swpaul
6326206Swpaulenum db_status {
6426206Swpaul	DB_SUCCESS = 0,
6526206Swpaul	DB_NOTFOUND = 1,
6626206Swpaul	DB_NOTUNIQUE = 2,
6726206Swpaul	DB_BADTABLE = 3,
6826206Swpaul	DB_BADQUERY = 4,
6926206Swpaul	DB_BADOBJECT = 5,
7026206Swpaul	DB_MEMORY_LIMIT = 6,
7126206Swpaul	DB_STORAGE_LIMIT = 7,
7226206Swpaul	DB_INTERNAL_ERROR = 8
7326206Swpaul};
7426206Swpaultypedef enum db_status db_status;
7526206Swpaul
7626206Swpaulenum db_action {
7726206Swpaul	DB_LOOKUP = 0,
7826206Swpaul	DB_REMOVE = 1,
7926206Swpaul	DB_ADD = 2,
8026206Swpaul	DB_FIRST = 3,
8126206Swpaul	DB_NEXT = 4,
8226206Swpaul	DB_ALL = 5,
8332556Sbde	DB_RESET_NEXT = 6
8426206Swpaul};
8526206Swpaultypedef enum db_action db_action;
8626206Swpaul
8726206Swpaultypedef entry_obj *entry_object_p;
8826206Swpaul
8926206Swpaultypedef struct {
9026206Swpaul	u_int db_next_desc_len;
9126206Swpaul	char *db_next_desc_val;
9226206Swpaul} db_next_desc;
9326206Swpaul
9426206Swpaulstruct db_result {
9526206Swpaul	db_status status;
9626206Swpaul	db_next_desc nextinfo;
9726206Swpaul	struct {
9826206Swpaul		u_int objects_len;
9926206Swpaul		entry_object_p *objects_val;
10026206Swpaul	} objects;
10126206Swpaul	long ticks;
10226206Swpaul};
10326206Swpaultypedef struct db_result db_result;
10426206Swpaul
10526206Swpaul/*
10626206Swpaul * Prototypes for the database functions.
10726206Swpaul */
10826206Swpaul
10926206Swpaulextern bool_t db_initialize(char *);
11026206Swpaul#ifdef ORIGINAL_DECLS
11126206Swpaulextern bool_t db_create_table(char *, table_obj *);
11226206Swpaulextern bool_t db_destroy_table(char *);
11326206Swpaul#else
11426206Swpaulextern db_status db_create_table(char *, table_obj *);
11526206Swpaulextern db_status db_destroy_table(char *);
11626206Swpaul#endif
11726206Swpaulextern db_result *db_first_entry(char *, int, nis_attr *);
11826206Swpaulextern db_result *db_next_entry(char *, db_next_desc *);
11926206Swpaulextern db_result *db_reset_next_entry(char *, db_next_desc *);
12026206Swpaulextern db_result *db_list_entries(char *, int, nis_attr *);
12126206Swpaulextern db_result *db_add_entry(char *, int,  nis_attr *, entry_obj *);
12226206Swpaulextern db_result *db_remove_entry(char *, int, nis_attr *);
12326206Swpaulextern db_status db_checkpoint(char *);
12426206Swpaulextern db_status db_standby(char *);
12526206Swpaul#ifndef ORIGINAL_DECLS
12626206Swpaulextern db_status db_table_exists(char *);
12726206Swpaulextern db_status db_unload_table(char *);
12826206Swpaulextern void db_free_result(db_result *);
12926206Swpaul#endif
13026206Swpaul
13126206Swpaul#ifdef __cplusplus
13226206Swpaul}
13326206Swpaul#endif
13426206Swpaul
13526206Swpaul#endif	/* _RPCSVC_NIS_DB_H */
136