xref: /illumos-gate/usr/src/lib/libnisdb/db_entry_c.x (revision 75eba5b6d79ed4d2ce3daf7b2806306b6b69a938)
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  *	db_entry_c.x
24  *
25  * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
26  * Use is subject to license terms.
27  */
28 
29 %#pragma ident	"%Z%%M%	%I%	%E% SMI"
30 
31 /*
32  * Some manifest constants, chosen to maximize flexibility without
33  * plugging the wire full of data.
34  */
35 
36 #if RPC_HDR
37 %#ifndef _DB_NIS_H
38 %#define _DB_NIS_H
39 
40 %#include <rpcsvc/nis.h>
41 #endif /* RPC_HDR */
42 
43 #ifdef USINGC
44 enum db_status {DB_SUCCESS, DB_NOTFOUND, DB_NOTUNIQUE,
45 		DB_BADTABLE, DB_BADQUERY, DB_BADOBJECT,
46 		DB_MEMORY_LIMIT, DB_STORAGE_LIMIT, DB_INTERNAL_ERROR};
47 
48 enum db_action {DB_LOOKUP, DB_REMOVE, DB_ADD, DB_FIRST, DB_NEXT,
49 			DB_ALL, DB_RESET_NEXT, DB_ADD_NOLOG,
50 			DB_ADD_NOSYNC, DB_REMOVE_NOSYNC };
51 #endif /* USINGC */
52 
53 /* Make alias to NIS definition */
54 
55 typedef entry_obj entry_object;
56 typedef entry_object * entry_object_p;
57 
58 typedef nis_name db_stringname;
59 typedef nis_attr db_attrname;          /* What the database knows it as */
60 
61 
62 /*  nis_dba.x ----------------------------- */
63 
64 /*
65  * Structure definitions for the parameters and results of the actual
66  * NIS DBA calls
67  *
68  * This is the standard result (in the protocol) of most of the nis
69  * requests.
70  */
71 
72 /*typedef long db_next_desc;*/
73 
74 typedef opaque db_next_desc<>;            /* opaque string */
75 
76 struct db_result {
77 	db_status 	status;		/* The status itself 	 */
78 	db_next_desc    nextinfo;       /* for first/next sequence */
79 	entry_object_p	objects<>;	/* And the objects found */
80 	long		ticks;		/* for statistics	 */
81 };
82 
83 struct db_request {
84   db_stringname table_name;
85   db_attrname  attrs<NIS_MAXCOLUMNS>;
86   entry_object * obj;      /* only used for addition */
87 };
88 
89 #ifndef USINGC
90 %#ifdef __cplusplus
91 %extern "C"  entry_object * new_entry( entry_object*);
92 %extern "C"  bool_t copy_entry ( entry_object*, entry_object*);
93 %extern "C"  void free_entry (entry_object*);
94 %extern "C"  bool_t sameEntry(entry_object *, entry_object *);
95 %#elif __STDC__
96 %extern entry_object * new_entry( entry_object*);
97 %extern bool_t copy_entry ( entry_object*, entry_object*);
98 %extern void free_entry (entry_object*);
99 %extern bool_t sameEntry(entry_object *, entry_object *);
100 %#endif
101 #else
102 #if RPC_HDR
103 %extern void print_entry();
104 %extern char copy_entry();
105 %extern void free_entry();
106 %extern void new_entry();
107 #endif /* RPC_HDR */
108 #endif /* USINGC */
109 
110 #if RPC_HDR
111 %#endif /* _DB_NIS_H */
112 #endif /* RPC_HDR */
113