nis_db.h revision 26206
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
2826206Swpaul */
2926206Swpaul
3026206Swpaul/*
3126206Swpaul * Copyright (c) 1991, by Sun Microsystems Inc.
3226206Swpaul */
3326206Swpaul
3426206Swpaul/*
3526206Swpaul * This header file defines the interface to the NIS database. All
3626206Swpaul * implementations of the database must export at least these routines.
3726206Swpaul * They must also follow the conventions set herein. See the implementors
3826206Swpaul * guide for specific semantics that are required.
3926206Swpaul */
4026206Swpaul
4126206Swpaul#ifndef	_RPCSVC_NIS_DB_H
4226206Swpaul#define	_RPCSVC_NIS_DB_H
4326206Swpaul
4426206Swpaul
4526206Swpaul/* From: #pragma ident	"@(#)nis_db.h	1.8	94/05/03 SMI" */
4626206Swpaul#pragma ident "$Id: nis_db.h,v 1.3 1996/07/29 13:59:13 wpaul Exp $"
4726206Swpaul
4826206Swpaul/*
4926206Swpaul * Note: although the version of <rpcsvc/nis_db.h> shipped with Solaris
5026206Swpaul * 2.5/2.5.x is actually older than this one (according to the ident
5126206Swpaul * string), it contains changes and a few added functions. Those changes
5226206Swpaul * have been hand merged into this file to bring it up to date.
5326206Swpaul */
5426206Swpaul
5526206Swpaul#include <rpc/rpc.h>
5626206Swpaul#include <rpcsvc/nis.h>
5726206Swpaul
5826206Swpaul#ifdef	__cplusplus
5926206Swpaulextern "C" {
6026206Swpaul#endif
6126206Swpaul
6226206Swpaulenum db_status {
6326206Swpaul	DB_SUCCESS = 0,
6426206Swpaul	DB_NOTFOUND = 1,
6526206Swpaul	DB_NOTUNIQUE = 2,
6626206Swpaul	DB_BADTABLE = 3,
6726206Swpaul	DB_BADQUERY = 4,
6826206Swpaul	DB_BADOBJECT = 5,
6926206Swpaul	DB_MEMORY_LIMIT = 6,
7026206Swpaul	DB_STORAGE_LIMIT = 7,
7126206Swpaul	DB_INTERNAL_ERROR = 8
7226206Swpaul};
7326206Swpaultypedef enum db_status db_status;
7426206Swpaul
7526206Swpaulenum db_action {
7626206Swpaul	DB_LOOKUP = 0,
7726206Swpaul	DB_REMOVE = 1,
7826206Swpaul	DB_ADD = 2,
7926206Swpaul	DB_FIRST = 3,
8026206Swpaul	DB_NEXT = 4,
8126206Swpaul	DB_ALL = 5,
8226206Swpaul	DB_RESET_NEXT = 6,
8326206Swpaul};
8426206Swpaultypedef enum db_action db_action;
8526206Swpaul
8626206Swpaultypedef entry_obj *entry_object_p;
8726206Swpaul
8826206Swpaultypedef struct {
8926206Swpaul	u_int db_next_desc_len;
9026206Swpaul	char *db_next_desc_val;
9126206Swpaul} db_next_desc;
9226206Swpaul
9326206Swpaulstruct db_result {
9426206Swpaul	db_status status;
9526206Swpaul	db_next_desc nextinfo;
9626206Swpaul	struct {
9726206Swpaul		u_int objects_len;
9826206Swpaul		entry_object_p *objects_val;
9926206Swpaul	} objects;
10026206Swpaul	long ticks;
10126206Swpaul};
10226206Swpaultypedef struct db_result db_result;
10326206Swpaul
10426206Swpaul/*
10526206Swpaul * Prototypes for the database functions.
10626206Swpaul */
10726206Swpaul
10826206Swpaul#if (__STDC__)
10926206Swpaul
11026206Swpaulextern bool_t db_initialize(char *);
11126206Swpaul#ifdef ORIGINAL_DECLS
11226206Swpaulextern bool_t db_create_table(char *, table_obj *);
11326206Swpaulextern bool_t db_destroy_table(char *);
11426206Swpaul#else
11526206Swpaulextern db_status db_create_table(char *, table_obj *);
11626206Swpaulextern db_status db_destroy_table(char *);
11726206Swpaul#endif
11826206Swpaulextern db_result *db_first_entry(char *, int, nis_attr *);
11926206Swpaulextern db_result *db_next_entry(char *, db_next_desc *);
12026206Swpaulextern db_result *db_reset_next_entry(char *, db_next_desc *);
12126206Swpaulextern db_result *db_list_entries(char *, int, nis_attr *);
12226206Swpaulextern db_result *db_add_entry(char *, int,  nis_attr *, entry_obj *);
12326206Swpaulextern db_result *db_remove_entry(char *, int, nis_attr *);
12426206Swpaulextern db_status db_checkpoint(char *);
12526206Swpaulextern db_status db_standby(char *);
12626206Swpaul#ifndef ORIGINAL_DECLS
12726206Swpaulextern db_status db_table_exists(char *);
12826206Swpaulextern db_status db_unload_table(char *);
12926206Swpaulextern void db_free_result(db_result *);
13026206Swpaul#endif
13126206Swpaul
13226206Swpaul#else /* Non-prototype definitions */
13326206Swpaul
13426206Swpaulextern bool_t db_initialize();
13526206Swpaul#ifdef ORIGINAL_DECLS
13626206Swpaulextern bool_t db_create_table();
13726206Swpaulextern bool_t db_destroy_table();
13826206Swpaul#else
13926206Swpaulextern db_status db_create_table();
14026206Swpaulextern db_status db_destroy_table();
14126206Swpaul#endif
14226206Swpaulextern db_result *db_first_entry();
14326206Swpaulextern db_result *db_next_entry();
14426206Swpaulextern db_result *db_reset_next_entry();
14526206Swpaulextern db_result *db_list_entries();
14626206Swpaulextern db_result *db_add_entry();
14726206Swpaulextern db_result *db_remove_entry();
14826206Swpaulextern db_status db_checkpoint();
14926206Swpaulextern db_status db_standby();
15026206Swpaul#ifndef ORIGINAL_DECLS
15126206Swpaulextern db_status db_table_exists();
15226206Swpaulextern db_status db_unload_table();
15326206Swpaulextern void db_free_result();
15426206Swpaul#endif
15526206Swpaul#endif  /* __STDC__ */
15626206Swpaul
15726206Swpaul#ifdef __cplusplus
15826206Swpaul}
15926206Swpaul#endif
16026206Swpaul
16126206Swpaul#endif	/* _RPCSVC_NIS_DB_H */
162