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