1/*
2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License").  You may not use this file except in compliance
7 * with the License.
8 *
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
13 *
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
19 *
20 * CDDL HEADER END
21 */
22/*
23 * Copyright (c) 1991,1997-1998 by Sun Microsystems, Inc.
24 * All rights reserved.
25 */
26
27/*
28 * This header file defines the interface to the NIS database. All
29 * implementations of the database must export at least these routines.
30 * They must also follow the conventions set herein. See the implementors
31 * guide for specific semantics that are required.
32 */
33
34#ifndef	_RPCSVC_NIS_DB_H
35#define	_RPCSVC_NIS_DB_H
36
37#pragma ident	"%Z%%M%	%I%	%E% SMI"
38
39#include <rpc/rpc.h>
40#include <rpcsvc/nis.h>
41
42#ifdef	__cplusplus
43extern "C" {
44#endif
45
46enum db_status {
47	DB_SUCCESS = 0,
48	DB_NOTFOUND = 1,
49	DB_NOTUNIQUE = 2,
50	DB_BADTABLE = 3,
51	DB_BADQUERY = 4,
52	DB_BADOBJECT = 5,
53	DB_MEMORY_LIMIT = 6,
54	DB_STORAGE_LIMIT = 7,
55	DB_INTERNAL_ERROR = 8
56};
57typedef enum db_status db_status;
58
59enum db_action {
60	DB_LOOKUP = 0,
61	DB_REMOVE = 1,
62	DB_ADD = 2,
63	DB_FIRST = 3,
64	DB_NEXT = 4,
65	DB_ALL = 5,
66	DB_RESET_NEXT = 6
67};
68typedef enum db_action db_action;
69
70typedef entry_obj *entry_object_p;
71
72typedef struct {
73	uint_t db_next_desc_len;
74	char *db_next_desc_val;
75} db_next_desc;
76
77struct db_result {
78	db_status status;
79	db_next_desc nextinfo;
80	struct {
81		uint_t objects_len;
82		entry_object_p *objects_val;
83	} objects;
84	long ticks;
85};
86typedef struct db_result db_result;
87
88/*
89 * Prototypes for the database functions.
90 */
91
92#if defined(__STDC__) || defined(__cplusplus)
93
94extern bool_t db_initialize(char *);
95extern db_status db_create_table(char *, table_obj *);
96extern db_status db_destroy_table(char *);
97extern db_result *db_first_entry(char *, int, nis_attr *);
98extern db_result *db_next_entry(char *, db_next_desc *);
99extern db_result *db_reset_next_entry(char *, db_next_desc *);
100extern db_result *db_list_entries(char *, int, nis_attr *);
101extern db_result *db_add_entry(char *, int,  nis_attr *, entry_obj *);
102extern db_result *db_remove_entry(char *, int, nis_attr *);
103extern db_status db_checkpoint(char *);
104extern db_status db_standby(char *);
105extern db_status db_table_exists(char *);
106extern db_status db_unload_table(char *);
107extern void db_free_result(db_result *);
108
109#else /* Non-prototype definitions */
110
111extern bool_t db_initialize();
112extern db_status db_create_table();
113extern db_status db_destroy_table();
114extern db_result *db_first_entry();
115extern db_result *db_next_entry();
116extern db_result *db_reset_next_entry();
117extern db_result *db_list_entries();
118extern db_result *db_add_entry();
119extern db_result *db_remove_entry();
120extern db_status db_checkpoint();
121extern db_status db_standby();
122extern db_status db_table_exists();
123extern db_status db_unload_table();
124extern void db_free_result();
125
126#endif  /* defined(__STDC__) || defined(__cplusplus) */
127
128#ifdef __cplusplus
129}
130#endif
131
132#endif	/* _RPCSVC_NIS_DB_H */
133