xref: /illumos-gate/usr/src/head/rpcsvc/nis.x (revision 36e852a1)
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 (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 /*
22  * RPC Language Protocol description file for NIS Plus
23  *
24  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
25  * Use is subject to license terms.
26  *
27  *
28  * From 4.1 : @(#)nis.x	1.61 Copyright 1989 Sun Microsystems
29  */
30 
31 /* This gets stuffed into the source files. */
32 #if RPC_HDR
33 %#include <rpc/xdr.h>
34 #endif
35 #if defined(RPC_XDR) || defined(RPC_CLNT) || defined(RPC_SVC)
36 %#ifndef xdr_uint32_t
37 %#define xdr_uint32_t	xdr_u_int
38 %#endif
39 %#ifndef xdr_uint_t
40 %#define xdr_uint_t	xdr_u_int
41 %#endif
42 #endif
43 #if RPC_SVC
44 %#include "nis_svc.h"
45 #endif
46 
47 /* Include the RPC Language description of NIS objects */
48 #include "nis_object.x"
49 
50 
51 
52 
53 /*
54  * These are the type of entries that are stored in the transaction log,
55  * note that modifications will appear as two entries, for names, they have
56  * a "OLD" entry followed by a "NEW" entry. For entries in tables, there
57  * is a remove followed by an add. It is done this way so that we can read
58  * the log backwards to back out transactions and forwards to propogate
59  * updated.
60  */
61 enum log_entry_t {
62 	LOG_NOP = 0,
63 	ADD_NAME = 1,		/* Name Added to name space 		  */
64 	REM_NAME = 2,		/* Name removed from name space 	  */
65 	MOD_NAME_OLD = 3,	/* Name was modified in the name space 	  */
66 	MOD_NAME_NEW = 4,	/* Name was modified in the name space 	  */
67 	ADD_IBASE = 5,		/* Entry added to information base 	  */
68 	REM_IBASE = 6,		/* Entry removed from information base    */
69 	MOD_IBASE = 7,		/* Entry was modified in information base */
70 	UPD_STAMP = 8		/* Update timestamp (used as fenceposts)  */
71 };
72 
73 /*
74  * This result is returned from the name service when it is requested to
75  * dump logged entries from its transaction log. Information base updates
76  * will have the name of the information base in the le_name field and
77  * a canonical set of attribute/value pairs to fully specify the entry's
78  * 'name'.
79  */
80 struct log_entry {
81 	uint32_t	le_time;	/* Time in seconds 		*/
82 	log_entry_t	le_type;	/* Type of log entry 		*/
83 	nis_name	le_princp;	/* Principal making the change	*/
84 	nis_name	le_name;	/* Name of table/dir involved 	*/
85 	nis_attr	le_attrs<>;	/* List of AV pairs.		*/
86 	nis_object	le_object;	/* Actual object value 		*/
87 };
88 
89 
90 /*
91  * This structure defines a generic NIS tag list. The taglist contains
92  * zero or tags, each of which is a type and a value. (u_int).
93  * These are used to report statistics (see tag definitions below)
94  * and to set or reset state variables.
95  */
96 struct nis_tag {
97 	u_int	tag_type;	/* Statistic tag (may vary) 	 */
98 	string	tag_val<>;	/* Statistic value may also vary */
99 };
100 
101 
102 %/*
103 % * Structures used for server binding.
104 % */
105 struct nis_bound_endpoint {
106 	endpoint ep;
107 	int generation;
108 	int rank;
109 	u_int flags;
110 	int hostnum;
111 	int epnum;
112 	nis_name uaddr;
113 	endpoint cbep;
114 };
115 typedef struct nis_bound_endpoint nis_bound_endpoint;
116 
117 struct nis_bound_directory {
118 	int generation;
119 	int min_rank;           /* minimum rank of bound endpoints */
120 	int optimal_rank;       /* best possible rank of all endpoints */
121 	directory_obj dobj;
122 	nis_bound_endpoint BEP<>;
123 };
124 typedef struct nis_bound_directory nis_bound_directory;
125 %#define bep_len BEP.BEP_len
126 %#define bep_val BEP.BEP_val
127 
128 struct nis_active_endpoint {
129 	endpoint ep;
130 	nis_name hostname;
131 	int rank;
132 	int uaddr_generation;
133 	nis_name uaddr;
134 	int cbep_generation;
135 	endpoint cbep;
136 };
137 typedef struct nis_active_endpoint nis_active_endpoint;
138 
139 %/* defines for nis_bound_endpoint.flags */
140 %#define NIS_BOUND 0x1
141 %#define NIS_TRANSIENT_ERRORS 0x2
142 
143 
144 
145 /*
146  * What's going on here? Well, it's like this. When the service
147  * is being compiled it wants to have the service definition specific
148  * info included, and when the client is being compiled it wants that
149  * info. This includes the appropriate file which was generated by
150  * make in the protocols directory (probably /usr/include/rpcsvc).
151  */
152 #ifdef RPC_SVC
153 %#include "nis_svc.h"
154 #endif
155 #ifdef RPC_CLNT
156 %#include "nis_clnt.h"
157 #endif
158 
159 
160 /*
161  * Included below are the defines that become part of nis.h,
162  * they are technically not part of the protocol, but do define
163  * key aspects of the implementation and are therefore useful
164  * in building a conforming server or client.
165  */
166 #if RPC_HDR
167 %/*
168 % * Generic "hash" datastructures, used by all types of hashed data.
169 % */
170 %struct nis_hash_data {
171 %	nis_name		name;	   /* NIS name of hashed item      */
172 %	int			keychain;  /* It's hash key (for pop)      */
173 %	struct nis_hash_data	*next;	   /* Hash collision pointer       */
174 %	struct nis_hash_data	*prv_item; /* A serial, doubly linked list */
175 %	struct nis_hash_data	*nxt_item; /* of items in the hash table   */
176 %};
177 %typedef struct nis_hash_data NIS_HASH_ITEM;
178 %
179 %struct nis_hash_table {
180 %	NIS_HASH_ITEM	*keys[64];	/* A hash table of items           */
181 %	NIS_HASH_ITEM	*first;		/* The first "item" in serial list */
182 %};
183 %typedef struct nis_hash_table NIS_HASH_TABLE;
184 %
185 %/* Structure for storing dynamically allocated static data */
186 %struct nis_sdata {
187 %	void	*buf;	/* Memory allocation pointer 	*/
188 %	u_int	size;	/* Buffer size			*/
189 %};
190 %
191 %/* Generic client creating flags */
192 %#define ZMH_VC		1
193 %#define ZMH_DG		2
194 %#define ZMH_AUTH	4
195 %#define ZMH_NOFALLBACK 8
196 %
197 %/* Testing Access rights for objects */
198 %
199 %#define NIS_READ_ACC		1
200 %#define NIS_MODIFY_ACC		2
201 %#define NIS_CREATE_ACC		4
202 %#define NIS_DESTROY_ACC	8
203 %/* Test macros. a == access rights, m == desired rights. */
204 %#define NIS_WORLD(a, m)	(((a) & (m)) != 0)
205 %#define NIS_GROUP(a, m)	(((a) & ((m) << 8)) != 0)
206 %#define NIS_OWNER(a, m)	(((a) & ((m) << 16)) != 0)
207 %#define NIS_NOBODY(a, m)	(((a) & ((m) << 24)) != 0)
208 %/*
209 % * EOL Alert - The following non-prefixed test macros are
210 % * here for backward compatability, and will be not be present
211 % * in future releases - use the NIS_*() macros above.
212 % */
213 %#define WORLD(a, m)	(((a) & (m)) != 0)
214 %#define GROUP(a, m)	(((a) & ((m) << 8)) != 0)
215 %#define OWNER(a, m)	(((a) & ((m) << 16)) != 0)
216 %#define NOBODY(a, m)	(((a) & ((m) << 24)) != 0)
217 %
218 %#define OATYPE(d, n) (((d)->do_armask.do_armask_val+n)->oa_otype)
219 %#define OARIGHTS(d, n) (((d)->do_armask.do_armask_val+n)->oa_rights)
220 %#define WORLD_DEFAULT (NIS_READ_ACC)
221 %#define GROUP_DEFAULT (NIS_READ_ACC << 8)
222 %#define OWNER_DEFAULT ((NIS_READ_ACC +\
223 %			 NIS_MODIFY_ACC +\
224 %			 NIS_CREATE_ACC +\
225 %			 NIS_DESTROY_ACC) << 16)
226 %#define DEFAULT_RIGHTS (WORLD_DEFAULT | GROUP_DEFAULT | OWNER_DEFAULT)
227 %
228 %/* Result manipulation defines ... */
229 %#define NIS_RES_NUMOBJ(x)	((x)->objects.objects_len)
230 %#define NIS_RES_OBJECT(x)	((x)->objects.objects_val)
231 %#define NIS_RES_COOKIE(x)	((x)->cookie)
232 %#define NIS_RES_STATUS(x)	((x)->status)
233 %
234 %/* These defines make getting at the variant part of the object easier. */
235 %#define TA_data zo_data.objdata_u.ta_data
236 %#define EN_data zo_data.objdata_u.en_data
237 %#define DI_data zo_data.objdata_u.di_data
238 %#define LI_data zo_data.objdata_u.li_data
239 %#define GR_data zo_data.objdata_u.gr_data
240 %
241 %#define __type_of(o) ((o)->zo_data.zo_type)
242 %
243 %/* Declarations for the internal subroutines in nislib.c */
244 %enum name_pos {SAME_NAME, HIGHER_NAME, LOWER_NAME, NOT_SEQUENTIAL, BAD_NAME};
245 %typedef enum name_pos name_pos;
246 %
247 %/*
248 % * Defines for getting at column data in entry objects. Because RPCGEN
249 % * generates some rather wordy structures, we create some defines that
250 % * collapse the needed keystrokes to access a particular value using
251 % * these definitions they take an nis_object *, and an int and return
252 % * a u_char * for Value, and an int for length.
253 % */
254 %#define ENTRY_VAL(obj, col) \
255 %	(obj)->EN_data.en_cols.en_cols_val[col].ec_value.ec_value_val
256 %#define ENTRY_LEN(obj, col) \
257 %	(obj)->EN_data.en_cols.en_cols_val[col].ec_value.ec_value_len
258 %
259 %
260 %
261 %#ifdef __cplusplus
262 %}
263 %#endif
264 %
265 %/* Prototypes, and extern declarations for the NIS library functions. */
266 %#include <rpcsvc/nislib.h>
267 %#endif /* __NIS_RPCGEN_H */
268 %/* EDIT_START */
269 %
270 %/*
271 % * nis_3.h
272 % *
273 % * This file contains definitions that are only of interest to the actual
274 % * service daemon and client stubs. Normal users of NIS will not include
275 % * this file.
276 % *
277 % * NOTE : This include file is automatically created by a combination
278 % * of rpcgen and sed. DO NOT EDIT IT, change the nis.x file instead
279 % * and then remake this file.
280 % */
281 %#ifndef __nis_3_h
282 %#define __nis_3_h
283 %#ifdef __cplusplus
284 %extern "C" {
285 %#endif
286 #endif
287