Deleted Added
full compact
nis.x (26207) nis.x (50473)
1%/*
2% * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
3% * unrestricted use provided that this legend is included on all tape
4% * media and as a part of the software program in whole or part. Users
5% * may copy or modify Sun RPC without charge, but are not authorized
6% * to license or distribute it to anyone else except as part of a product or
7% * program developed by the user or with the express written consent of
8% * Sun Microsystems, Inc.
9% *
10% * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
11% * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
12% * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
13% *
14% * Sun RPC is provided with no support and without any obligation on the
15% * part of Sun Microsystems, Inc. to assist in its use, correction,
16% * modification or enhancement.
17% *
18% * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
19% * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
20% * OR ANY PART THEREOF.
21% *
22% * In no event will Sun Microsystems, Inc. be liable for any lost revenue
23% * or profits or other special, indirect and consequential damages, even if
24% * Sun has been advised of the possibility of such damages.
25% *
26% * Sun Microsystems, Inc.
27% * 2550 Garcia Avenue
28% * Mountain View, California 94043
29% */
30
31#ifndef RPC_HDR
32%#ifndef lint
1%/*
2% * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
3% * unrestricted use provided that this legend is included on all tape
4% * media and as a part of the software program in whole or part. Users
5% * may copy or modify Sun RPC without charge, but are not authorized
6% * to license or distribute it to anyone else except as part of a product or
7% * program developed by the user or with the express written consent of
8% * Sun Microsystems, Inc.
9% *
10% * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
11% * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
12% * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
13% *
14% * Sun RPC is provided with no support and without any obligation on the
15% * part of Sun Microsystems, Inc. to assist in its use, correction,
16% * modification or enhancement.
17% *
18% * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
19% * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
20% * OR ANY PART THEREOF.
21% *
22% * In no event will Sun Microsystems, Inc. be liable for any lost revenue
23% * or profits or other special, indirect and consequential damages, even if
24% * Sun has been advised of the possibility of such damages.
25% *
26% * Sun Microsystems, Inc.
27% * 2550 Garcia Avenue
28% * Mountain View, California 94043
29% */
30
31#ifndef RPC_HDR
32%#ifndef lint
33%static const char rcsid[] = "$Id: nis.x,v 1.5 1996/12/05 06:13:41 wpaul Exp $";
33%static const char rcsid[] =
34% "$FreeBSD: head/include/rpcsvc/nis.x 50473 1999-08-27 23:45:13Z peter $";
34%#endif /* not lint */
35#endif
36
37/*
38 * From 4.1 : @(#)nis.x 1.61 Copyright 1989 Sun Microsystems
39 *
40 * RPC Language Protocol description file for NIS Plus
41 * This version : 1.61
42 * Last Modified : 3/19/91
43 */
44#ifdef RPC_HDR
45%/*
46% * nis.h
47% *
48% * This file is the main include file for NIS clients. It contains
49% * both the client library function defines and the various data
50% * structures used by the NIS service. It includes the file nis_tags.h
51% * which defines the tag values. This allows the tags to change without
52% * having to change the nis.x file.
53% *
54% * NOTE : DO NOT EDIT THIS FILE! It is automatically generated when
55% * rpcgen is run on the nis.x file. Note that there is a
56% * simple sed script to remove some unneeded lines. (See the
57% * Makefile target nis.h)
58% *
59% */
60%#include <rpcsvc/nis_tags.h>
61#endif
62
63/* This gets stuffed into the source files. */
64#if RPC_HDR
65%#include <rpc/xdr.h>
66#endif
67/*
68 * This is just pointless.
69 */
70#ifdef SUN_STUPIDITY
71#if RPC_SVC
72%#include "nis_svc.h"
73#endif
74#endif
75
76/* Include the RPC Language description of NIS objects */
77#include "nis_object.x"
78
79/* Errors that can be returned by the service */
80enum nis_error {
81 NIS_SUCCESS = 0, /* A-ok, let's rock n roll */
82 NIS_S_SUCCESS = 1, /* Name found (maybe) */
83 NIS_NOTFOUND = 2, /* Name definitely not found */
84 NIS_S_NOTFOUND = 3, /* Name maybe not found */
85 NIS_CACHEEXPIRED = 4, /* Name exists but cache out of date */
86 NIS_NAMEUNREACHABLE = 5, /* Can't get there from here */
87 NIS_UNKNOWNOBJ = 6, /* Object type is bogus */
88 NIS_TRYAGAIN = 7, /* I'm busy, call back */
89 NIS_SYSTEMERROR = 8, /* Out of band failure */
90 NIS_CHAINBROKEN = 9, /* First/Next warning */
91 NIS_PERMISSION = 10, /* Not enough permission to access */
92 NIS_NOTOWNER = 11, /* You don't own it, sorry */
93 NIS_NOT_ME = 12, /* I don't serve this name */
94 NIS_NOMEMORY = 13, /* Outta VM! Help! */
95 NIS_NAMEEXISTS = 14, /* Can't create over another name */
96 NIS_NOTMASTER = 15, /* I'm justa secondaray, don't ask me */
97 NIS_INVALIDOBJ = 16, /* Object is broken somehow */
98 NIS_BADNAME = 17, /* Unparsable name */
99 NIS_NOCALLBACK = 18, /* Couldn't talk to call back proc */
100 NIS_CBRESULTS = 19, /* Results being called back to you */
101 NIS_NOSUCHNAME = 20, /* Name unknown */
102 NIS_NOTUNIQUE = 21, /* Value is not uniques (entry) */
103 NIS_IBMODERROR = 22, /* Inf. Base. Modify error. */
104 NIS_NOSUCHTABLE = 23, /* Name for table was wrong */
105 NIS_TYPEMISMATCH = 24, /* Entry and table type mismatch */
106 NIS_LINKNAMEERROR = 25, /* Link points to bogus name */
107 NIS_PARTIAL = 26, /* Partial success, found table */
108 NIS_TOOMANYATTRS = 27, /* Too many attributes */
109 NIS_RPCERROR = 28, /* RPC error encountered */
110 NIS_BADATTRIBUTE = 29, /* Bad or invalid attribute */
111 NIS_NOTSEARCHABLE = 30, /* Non-searchable object searched */
112 NIS_CBERROR = 31, /* Error during callback (svc crash) */
113 NIS_FOREIGNNS = 32, /* Foreign Namespace */
114 NIS_BADOBJECT = 33, /* Malformed object structure */
115 NIS_NOTSAMEOBJ = 34, /* Object swapped during deletion */
116 NIS_MODFAIL = 35, /* Failure during a Modify. */
117 NIS_BADREQUEST = 36, /* Illegal query for table */
118 NIS_NOTEMPTY = 37, /* Attempt to remove a non-empty tbl */
119 NIS_COLDSTART_ERR = 38, /* Error accesing the cold start file */
120 NIS_RESYNC = 39, /* Transaction log too far out of date */
121 NIS_FAIL = 40, /* NIS operation failed. */
122 NIS_UNAVAIL = 41, /* NIS+ service is unavailable (client) */
123 NIS_RES2BIG = 42, /* NIS+ result too big for datagram */
124 NIS_SRVAUTH = 43, /* NIS+ server wasn't authenticated. */
125 NIS_CLNTAUTH = 44, /* NIS+ Client wasn't authenticated. */
126 NIS_NOFILESPACE = 45, /* NIS+ server ran out of disk space */
127 NIS_NOPROC = 46, /* NIS+ server couldn't create new proc */
128 NIS_DUMPLATER = 47 /* NIS+ server already has dump child */
129};
130
131
132/*
133 * Structure definitions for the parameters and results of the actual
134 * NIS RPC calls.
135 *
136 * This is the standard result (in the protocol) of most of the nis
137 * requests.
138 */
139
140struct nis_result {
141 nis_error status; /* Status of the response */
142 nis_object objects<>; /* objects found */
143 netobj cookie; /* Cookie Data */
144 u_long zticks; /* server ticks */
145 u_long dticks; /* DBM ticks. */
146 u_long aticks; /* Cache (accel) ticks */
147 u_long cticks; /* Client ticks */
148};
149
150/*
151 * A Name Service request
152 * This request is used to access the name space, ns_name is the name
153 * of the object within the namespace and the object is it's value, for
154 * add/modify, a copy of the original for remove.
155 */
156
157struct ns_request {
158 nis_name ns_name; /* Name in the NIS name space */
159 nis_object ns_object<1>; /* Optional Object (add/remove) */
160};
161
162/*
163 * An information base request
164 * This request includes the NIS name of the table we wish to search, the
165 * search criteria in the form of attribute/value pairs and an optional
166 * callback program number. If the callback program number is provided
167 * the server will send back objects one at a time, otherwise it will
168 * return them all in the response.
169 */
170
171struct ib_request {
172 nis_name ibr_name; /* The name of the Table */
173 nis_attr ibr_srch<>; /* The search critereia */
174 u_long ibr_flags; /* Optional flags */
175 nis_object ibr_obj<1>; /* optional object (add/modify) */
176 nis_server ibr_cbhost<1>; /* Optional callback info */
177 u_long ibr_bufsize; /* Optional first/next bufsize */
178 netobj ibr_cookie; /* The first/next cookie */
179};
180
181/*
182 * This argument to the PING call notifies the replicas that something in
183 * a directory has changed and this is it's timestamp. The replica will use
184 * the timestamp to determine if its resync operation was successful.
185 */
186struct ping_args {
187 nis_name dir; /* Directory that had the change */
188 u_long stamp; /* timestamp of the transaction */
189};
190
191/*
192 * These are the type of entries that are stored in the transaction log,
193 * note that modifications will appear as two entries, for names, they have
194 * a "OLD" entry followed by a "NEW" entry. For entries in tables, there
195 * is a remove followed by an add. It is done this way so that we can read
196 * the log backwards to back out transactions and forwards to propogate
197 * updated.
198 */
199enum log_entry_t {
200 LOG_NOP = 0,
201 ADD_NAME = 1, /* Name Added to name space */
202 REM_NAME = 2, /* Name removed from name space */
203 MOD_NAME_OLD = 3, /* Name was modified in the name space */
204 MOD_NAME_NEW = 4, /* Name was modified in the name space */
205 ADD_IBASE = 5, /* Entry added to information base */
206 REM_IBASE = 6, /* Entry removed from information base */
207 MOD_IBASE = 7, /* Entry was modified in information base */
208 UPD_STAMP = 8 /* Update timestamp (used as fenceposts) */
209};
210
211/*
212 * This result is returned from the name service when it is requested to
213 * dump logged entries from its transaction log. Information base updates
214 * will have the name of the information base in the le_name field and
215 * a canonical set of attribute/value pairs to fully specify the entry's
216 * 'name'.
217 */
218struct log_entry {
219 u_long le_time; /* Time in seconds */
220 log_entry_t le_type; /* Type of log entry */
221 nis_name le_princp; /* Principal making the change */
222 nis_name le_name; /* Name of table/dir involved */
223 nis_attr le_attrs<>; /* List of AV pairs. */
224 nis_object le_object; /* Actual object value */
225};
226
227struct log_result {
228 nis_error lr_status; /* The status itself */
229 netobj lr_cookie; /* Used by the dump callback */
230 log_entry lr_entries<>; /* zero or more entries */
231};
232
233struct cp_result {
234 nis_error cp_status; /* Status of the checkpoint */
235 u_long cp_zticks; /* Service 'ticks' */
236 u_long cp_dticks; /* Database 'ticks' */
237};
238
239/*
240 * This structure defines a generic NIS tag list. The taglist contains
241 * zero or tags, each of which is a type and a value. (u_long).
242 * These are used to report statistics (see tag definitions below)
243 * and to set or reset state variables.
244 */
245struct nis_tag {
246 u_long tag_type; /* Statistic tag (may vary) */
247 string tag_val<1024>; /* Statistic value may also vary */
248};
249
250struct nis_taglist {
251 nis_tag tags<>; /* List of tags */
252};
253
254struct dump_args {
255 nis_name da_dir; /* Directory to dump */
256 u_long da_time; /* From this timestamp */
257 nis_server da_cbhost<1>; /* Callback to use. */
258};
259
260struct fd_args {
261 nis_name dir_name; /* The directory we're looking for */
262 nis_name requester; /* Host principal name for signature */
263};
264
265struct fd_result {
266 nis_error status; /* Status returned by function */
267 nis_name source; /* Source of this answer */
268 opaque dir_data<>; /* Directory Data (XDR'ed) */
269 opaque signature<>; /* Signature of the source */
270};
271
272
273/*
274 * What's going on here? Well, it's like this. When the service
275 * is being compiled it wants to have the service definition specific
276 * info included, and when the client is being compiled it wants that
277 * info. This includes the appropriate file which was generated by
278 * make in the protocols directory (probably /usr/include/rpcsvc).
279 *
280 * Uhm... guys? With RPC, you aren't supposed to have seperate
281 * server-specific and client-specific header files. You have one header
282 * file that's suitable for both. If your code doesn't work using just
283 * the one header file, I submit to you that it's broken.
284 * -Bill
285 */
286#ifdef SUN_STUPIDITY
287#ifdef RPC_SVC
288%#include "nis_svc.h"
289#endif
290#ifdef RPC_CLNT
291%#include "nis_clnt.h"
292#endif
293#endif
294
295program NIS_PROG {
296
297 /* RPC Language description of the NIS+ protocol */
298 version NIS_VERSION {
299 /* The name service functions */
300 nis_result NIS_LOOKUP(ns_request) = 1;
301 nis_result NIS_ADD(ns_request) = 2;
302 nis_result NIS_MODIFY(ns_request) = 3;
303 nis_result NIS_REMOVE(ns_request) = 4;
304
305 /* The information base functions */
306 nis_result NIS_IBLIST(ib_request) = 5;
307 nis_result NIS_IBADD(ib_request) = 6;
308 nis_result NIS_IBMODIFY(ib_request) = 7;
309 nis_result NIS_IBREMOVE(ib_request) = 8;
310 nis_result NIS_IBFIRST(ib_request) = 9;
311 nis_result NIS_IBNEXT(ib_request) = 10;
312
313 /* NIS Administrative functions */
314 fd_result NIS_FINDDIRECTORY(fd_args) = 12;
315
316 /* If fetch and optionally reset statistics */
317 nis_taglist NIS_STATUS(nis_taglist) = 14;
318
319 /* Dump changes to directory since time in da_time */
320 log_result NIS_DUMPLOG(dump_args) = 15;
321
322 /* Dump contents of directory named */
323 log_result NIS_DUMP(dump_args) = 16;
324
325 /* Check status of callback thread */
326 bool NIS_CALLBACK(netobj) = 17;
327
328 /* Return last update time for named dir */
329 u_long NIS_CPTIME(nis_name) = 18;
330
331 /* Checkpoint directory or table named */
332 cp_result NIS_CHECKPOINT(nis_name) = 19;
333
334 /* Send 'status changed' ping to replicates */
335 void NIS_PING(ping_args) = 20;
336
337 /* Modify server behaviour (such as debugging) */
338 nis_taglist NIS_SERVSTATE(nis_taglist) = 21;
339
340 /* Create a Directory */
341 nis_error NIS_MKDIR(nis_name) = 22;
342
343 /* Remove a Directory */
344 nis_error NIS_RMDIR(nis_name) = 23;
345
346 /* Update public keys of a directory object */
347 nis_error NIS_UPDKEYS(nis_name) = 24;
348 } = 3;
349} = 100300;
350
351/*
352 * Included below are the defines that become part of nis.h,
353 * they are technically not part of the protocol, but do define
354 * key aspects of the implementation and are therefore useful
355 * in building a conforming server or client.
356 */
357#if RPC_HDR
358%/*
359% * Generic "hash" datastructures, used by all types of hashed data.
360% */
361%struct nis_hash_data {
362% nis_name name; /* NIS name of hashed item */
363% int keychain; /* It's hash key (for pop) */
364% struct nis_hash_data *next; /* Hash collision pointer */
365% struct nis_hash_data *prv_item; /* A serial, doubly linked list */
366% struct nis_hash_data *nxt_item; /* of items in the hash table */
367%};
368%typedef struct nis_hash_data NIS_HASH_ITEM;
369%
370%struct nis_hash_table {
371% NIS_HASH_ITEM *keys[64]; /* A hash table of items */
372% NIS_HASH_ITEM *first; /* The first "item" in serial list */
373%};
374%typedef struct nis_hash_table NIS_HASH_TABLE;
375%
376%/* Structure for storing dynamically allocated static data */
377%struct nis_sdata {
378% void *buf; /* Memory allocation pointer */
379% u_long size; /* Buffer size */
380%};
381%
382%/* Generic client creating flags */
383%#define ZMH_VC 1
384%#define ZMH_DG 2
385%#define ZMH_AUTH 4
386%
387%/* Testing Access rights for objects */
388%
389%#define NIS_READ_ACC 1
390%#define NIS_MODIFY_ACC 2
391%#define NIS_CREATE_ACC 4
392%#define NIS_DESTROY_ACC 8
393%/* Test macros. a == access rights, m == desired rights. */
394%#define WORLD(a, m) (((a) & (m)) != 0)
395%#define GROUP(a, m) (((a) & ((m) << 8)) != 0)
396%#define OWNER(a, m) (((a) & ((m) << 16)) != 0)
397%#define NOBODY(a, m) (((a) & ((m) << 24)) != 0)
398%
399%#define OATYPE(d, n) (((d)->do_armask.do_armask_val+n)->oa_otype)
400%#define OARIGHTS(d, n) (((d)->do_armask.do_armask_val+n)->oa_rights)
401%#define WORLD_DEFAULT (NIS_READ_ACC)
402%#define GROUP_DEFAULT (NIS_READ_ACC << 8)
403%#define OWNER_DEFAULT ((NIS_READ_ACC +\
404 NIS_MODIFY_ACC +\
405 NIS_CREATE_ACC +\
406 NIS_DESTROY_ACC) << 16)
407%#define DEFAULT_RIGHTS (WORLD_DEFAULT | GROUP_DEFAULT | OWNER_DEFAULT)
408%
409%/* Result manipulation defines ... */
410%#define NIS_RES_NUMOBJ(x) ((x)->objects.objects_len)
411%#define NIS_RES_OBJECT(x) ((x)->objects.objects_val)
412%#define NIS_RES_COOKIE(x) ((x)->cookie)
413%#define NIS_RES_STATUS(x) ((x)->status)
414%
415%/* These defines make getting at the variant part of the object easier. */
416%#define TA_data zo_data.objdata_u.ta_data
417%#define EN_data zo_data.objdata_u.en_data
418%#define DI_data zo_data.objdata_u.di_data
419%#define LI_data zo_data.objdata_u.li_data
420%#define GR_data zo_data.objdata_u.gr_data
421%
422%#define __type_of(o) ((o)->zo_data.zo_type)
423%
424%/* Declarations for the internal subroutines in nislib.c */
425%enum name_pos {SAME_NAME, HIGHER_NAME, LOWER_NAME, NOT_SEQUENTIAL, BAD_NAME};
426%typedef enum name_pos name_pos;
427%
428%/*
429% * Defines for getting at column data in entry objects. Because RPCGEN
430% * generates some rather wordy structures, we create some defines that
431% * collapse the needed keystrokes to access a particular value using
432% * these definitions they take an nis_object *, and an int and return
433% * a u_char * for Value, and an int for length.
434% */
435%#define ENTRY_VAL(obj, col) \
436 (obj)->EN_data.en_cols.en_cols_val[col].ec_value.ec_value_val
437%#define ENTRY_LEN(obj, col) \
438 (obj)->EN_data.en_cols.en_cols_val[col].ec_value.ec_value_len
439%
440%#ifdef __cplusplus
441%}
442%#endif
443%
444%/* Prototypes, and extern declarations for the NIS library functions. */
445%#include <rpcsvc/nislib.h>
446%#endif /* __NIS_RPCGEN_H */
447%/* EDIT_START */
448%
449%/*
450% * nis_3.h
451% *
452% * This file contains definitions that are only of interest to the actual
453% * service daemon and client stubs. Normal users of NIS will not include
454% * this file.
455% *
456% * NOTE : This include file is automatically created by a combination
457% * of rpcgen and sed. DO NOT EDIT IT, change the nis.x file instead
458% * and then remake this file.
459% */
460%#ifndef __nis_3_h
461%#define __nis_3_h
462%#ifdef __cplusplus
463%extern "C" {
464%#endif
465#endif
35%#endif /* not lint */
36#endif
37
38/*
39 * From 4.1 : @(#)nis.x 1.61 Copyright 1989 Sun Microsystems
40 *
41 * RPC Language Protocol description file for NIS Plus
42 * This version : 1.61
43 * Last Modified : 3/19/91
44 */
45#ifdef RPC_HDR
46%/*
47% * nis.h
48% *
49% * This file is the main include file for NIS clients. It contains
50% * both the client library function defines and the various data
51% * structures used by the NIS service. It includes the file nis_tags.h
52% * which defines the tag values. This allows the tags to change without
53% * having to change the nis.x file.
54% *
55% * NOTE : DO NOT EDIT THIS FILE! It is automatically generated when
56% * rpcgen is run on the nis.x file. Note that there is a
57% * simple sed script to remove some unneeded lines. (See the
58% * Makefile target nis.h)
59% *
60% */
61%#include <rpcsvc/nis_tags.h>
62#endif
63
64/* This gets stuffed into the source files. */
65#if RPC_HDR
66%#include <rpc/xdr.h>
67#endif
68/*
69 * This is just pointless.
70 */
71#ifdef SUN_STUPIDITY
72#if RPC_SVC
73%#include "nis_svc.h"
74#endif
75#endif
76
77/* Include the RPC Language description of NIS objects */
78#include "nis_object.x"
79
80/* Errors that can be returned by the service */
81enum nis_error {
82 NIS_SUCCESS = 0, /* A-ok, let's rock n roll */
83 NIS_S_SUCCESS = 1, /* Name found (maybe) */
84 NIS_NOTFOUND = 2, /* Name definitely not found */
85 NIS_S_NOTFOUND = 3, /* Name maybe not found */
86 NIS_CACHEEXPIRED = 4, /* Name exists but cache out of date */
87 NIS_NAMEUNREACHABLE = 5, /* Can't get there from here */
88 NIS_UNKNOWNOBJ = 6, /* Object type is bogus */
89 NIS_TRYAGAIN = 7, /* I'm busy, call back */
90 NIS_SYSTEMERROR = 8, /* Out of band failure */
91 NIS_CHAINBROKEN = 9, /* First/Next warning */
92 NIS_PERMISSION = 10, /* Not enough permission to access */
93 NIS_NOTOWNER = 11, /* You don't own it, sorry */
94 NIS_NOT_ME = 12, /* I don't serve this name */
95 NIS_NOMEMORY = 13, /* Outta VM! Help! */
96 NIS_NAMEEXISTS = 14, /* Can't create over another name */
97 NIS_NOTMASTER = 15, /* I'm justa secondaray, don't ask me */
98 NIS_INVALIDOBJ = 16, /* Object is broken somehow */
99 NIS_BADNAME = 17, /* Unparsable name */
100 NIS_NOCALLBACK = 18, /* Couldn't talk to call back proc */
101 NIS_CBRESULTS = 19, /* Results being called back to you */
102 NIS_NOSUCHNAME = 20, /* Name unknown */
103 NIS_NOTUNIQUE = 21, /* Value is not uniques (entry) */
104 NIS_IBMODERROR = 22, /* Inf. Base. Modify error. */
105 NIS_NOSUCHTABLE = 23, /* Name for table was wrong */
106 NIS_TYPEMISMATCH = 24, /* Entry and table type mismatch */
107 NIS_LINKNAMEERROR = 25, /* Link points to bogus name */
108 NIS_PARTIAL = 26, /* Partial success, found table */
109 NIS_TOOMANYATTRS = 27, /* Too many attributes */
110 NIS_RPCERROR = 28, /* RPC error encountered */
111 NIS_BADATTRIBUTE = 29, /* Bad or invalid attribute */
112 NIS_NOTSEARCHABLE = 30, /* Non-searchable object searched */
113 NIS_CBERROR = 31, /* Error during callback (svc crash) */
114 NIS_FOREIGNNS = 32, /* Foreign Namespace */
115 NIS_BADOBJECT = 33, /* Malformed object structure */
116 NIS_NOTSAMEOBJ = 34, /* Object swapped during deletion */
117 NIS_MODFAIL = 35, /* Failure during a Modify. */
118 NIS_BADREQUEST = 36, /* Illegal query for table */
119 NIS_NOTEMPTY = 37, /* Attempt to remove a non-empty tbl */
120 NIS_COLDSTART_ERR = 38, /* Error accesing the cold start file */
121 NIS_RESYNC = 39, /* Transaction log too far out of date */
122 NIS_FAIL = 40, /* NIS operation failed. */
123 NIS_UNAVAIL = 41, /* NIS+ service is unavailable (client) */
124 NIS_RES2BIG = 42, /* NIS+ result too big for datagram */
125 NIS_SRVAUTH = 43, /* NIS+ server wasn't authenticated. */
126 NIS_CLNTAUTH = 44, /* NIS+ Client wasn't authenticated. */
127 NIS_NOFILESPACE = 45, /* NIS+ server ran out of disk space */
128 NIS_NOPROC = 46, /* NIS+ server couldn't create new proc */
129 NIS_DUMPLATER = 47 /* NIS+ server already has dump child */
130};
131
132
133/*
134 * Structure definitions for the parameters and results of the actual
135 * NIS RPC calls.
136 *
137 * This is the standard result (in the protocol) of most of the nis
138 * requests.
139 */
140
141struct nis_result {
142 nis_error status; /* Status of the response */
143 nis_object objects<>; /* objects found */
144 netobj cookie; /* Cookie Data */
145 u_long zticks; /* server ticks */
146 u_long dticks; /* DBM ticks. */
147 u_long aticks; /* Cache (accel) ticks */
148 u_long cticks; /* Client ticks */
149};
150
151/*
152 * A Name Service request
153 * This request is used to access the name space, ns_name is the name
154 * of the object within the namespace and the object is it's value, for
155 * add/modify, a copy of the original for remove.
156 */
157
158struct ns_request {
159 nis_name ns_name; /* Name in the NIS name space */
160 nis_object ns_object<1>; /* Optional Object (add/remove) */
161};
162
163/*
164 * An information base request
165 * This request includes the NIS name of the table we wish to search, the
166 * search criteria in the form of attribute/value pairs and an optional
167 * callback program number. If the callback program number is provided
168 * the server will send back objects one at a time, otherwise it will
169 * return them all in the response.
170 */
171
172struct ib_request {
173 nis_name ibr_name; /* The name of the Table */
174 nis_attr ibr_srch<>; /* The search critereia */
175 u_long ibr_flags; /* Optional flags */
176 nis_object ibr_obj<1>; /* optional object (add/modify) */
177 nis_server ibr_cbhost<1>; /* Optional callback info */
178 u_long ibr_bufsize; /* Optional first/next bufsize */
179 netobj ibr_cookie; /* The first/next cookie */
180};
181
182/*
183 * This argument to the PING call notifies the replicas that something in
184 * a directory has changed and this is it's timestamp. The replica will use
185 * the timestamp to determine if its resync operation was successful.
186 */
187struct ping_args {
188 nis_name dir; /* Directory that had the change */
189 u_long stamp; /* timestamp of the transaction */
190};
191
192/*
193 * These are the type of entries that are stored in the transaction log,
194 * note that modifications will appear as two entries, for names, they have
195 * a "OLD" entry followed by a "NEW" entry. For entries in tables, there
196 * is a remove followed by an add. It is done this way so that we can read
197 * the log backwards to back out transactions and forwards to propogate
198 * updated.
199 */
200enum log_entry_t {
201 LOG_NOP = 0,
202 ADD_NAME = 1, /* Name Added to name space */
203 REM_NAME = 2, /* Name removed from name space */
204 MOD_NAME_OLD = 3, /* Name was modified in the name space */
205 MOD_NAME_NEW = 4, /* Name was modified in the name space */
206 ADD_IBASE = 5, /* Entry added to information base */
207 REM_IBASE = 6, /* Entry removed from information base */
208 MOD_IBASE = 7, /* Entry was modified in information base */
209 UPD_STAMP = 8 /* Update timestamp (used as fenceposts) */
210};
211
212/*
213 * This result is returned from the name service when it is requested to
214 * dump logged entries from its transaction log. Information base updates
215 * will have the name of the information base in the le_name field and
216 * a canonical set of attribute/value pairs to fully specify the entry's
217 * 'name'.
218 */
219struct log_entry {
220 u_long le_time; /* Time in seconds */
221 log_entry_t le_type; /* Type of log entry */
222 nis_name le_princp; /* Principal making the change */
223 nis_name le_name; /* Name of table/dir involved */
224 nis_attr le_attrs<>; /* List of AV pairs. */
225 nis_object le_object; /* Actual object value */
226};
227
228struct log_result {
229 nis_error lr_status; /* The status itself */
230 netobj lr_cookie; /* Used by the dump callback */
231 log_entry lr_entries<>; /* zero or more entries */
232};
233
234struct cp_result {
235 nis_error cp_status; /* Status of the checkpoint */
236 u_long cp_zticks; /* Service 'ticks' */
237 u_long cp_dticks; /* Database 'ticks' */
238};
239
240/*
241 * This structure defines a generic NIS tag list. The taglist contains
242 * zero or tags, each of which is a type and a value. (u_long).
243 * These are used to report statistics (see tag definitions below)
244 * and to set or reset state variables.
245 */
246struct nis_tag {
247 u_long tag_type; /* Statistic tag (may vary) */
248 string tag_val<1024>; /* Statistic value may also vary */
249};
250
251struct nis_taglist {
252 nis_tag tags<>; /* List of tags */
253};
254
255struct dump_args {
256 nis_name da_dir; /* Directory to dump */
257 u_long da_time; /* From this timestamp */
258 nis_server da_cbhost<1>; /* Callback to use. */
259};
260
261struct fd_args {
262 nis_name dir_name; /* The directory we're looking for */
263 nis_name requester; /* Host principal name for signature */
264};
265
266struct fd_result {
267 nis_error status; /* Status returned by function */
268 nis_name source; /* Source of this answer */
269 opaque dir_data<>; /* Directory Data (XDR'ed) */
270 opaque signature<>; /* Signature of the source */
271};
272
273
274/*
275 * What's going on here? Well, it's like this. When the service
276 * is being compiled it wants to have the service definition specific
277 * info included, and when the client is being compiled it wants that
278 * info. This includes the appropriate file which was generated by
279 * make in the protocols directory (probably /usr/include/rpcsvc).
280 *
281 * Uhm... guys? With RPC, you aren't supposed to have seperate
282 * server-specific and client-specific header files. You have one header
283 * file that's suitable for both. If your code doesn't work using just
284 * the one header file, I submit to you that it's broken.
285 * -Bill
286 */
287#ifdef SUN_STUPIDITY
288#ifdef RPC_SVC
289%#include "nis_svc.h"
290#endif
291#ifdef RPC_CLNT
292%#include "nis_clnt.h"
293#endif
294#endif
295
296program NIS_PROG {
297
298 /* RPC Language description of the NIS+ protocol */
299 version NIS_VERSION {
300 /* The name service functions */
301 nis_result NIS_LOOKUP(ns_request) = 1;
302 nis_result NIS_ADD(ns_request) = 2;
303 nis_result NIS_MODIFY(ns_request) = 3;
304 nis_result NIS_REMOVE(ns_request) = 4;
305
306 /* The information base functions */
307 nis_result NIS_IBLIST(ib_request) = 5;
308 nis_result NIS_IBADD(ib_request) = 6;
309 nis_result NIS_IBMODIFY(ib_request) = 7;
310 nis_result NIS_IBREMOVE(ib_request) = 8;
311 nis_result NIS_IBFIRST(ib_request) = 9;
312 nis_result NIS_IBNEXT(ib_request) = 10;
313
314 /* NIS Administrative functions */
315 fd_result NIS_FINDDIRECTORY(fd_args) = 12;
316
317 /* If fetch and optionally reset statistics */
318 nis_taglist NIS_STATUS(nis_taglist) = 14;
319
320 /* Dump changes to directory since time in da_time */
321 log_result NIS_DUMPLOG(dump_args) = 15;
322
323 /* Dump contents of directory named */
324 log_result NIS_DUMP(dump_args) = 16;
325
326 /* Check status of callback thread */
327 bool NIS_CALLBACK(netobj) = 17;
328
329 /* Return last update time for named dir */
330 u_long NIS_CPTIME(nis_name) = 18;
331
332 /* Checkpoint directory or table named */
333 cp_result NIS_CHECKPOINT(nis_name) = 19;
334
335 /* Send 'status changed' ping to replicates */
336 void NIS_PING(ping_args) = 20;
337
338 /* Modify server behaviour (such as debugging) */
339 nis_taglist NIS_SERVSTATE(nis_taglist) = 21;
340
341 /* Create a Directory */
342 nis_error NIS_MKDIR(nis_name) = 22;
343
344 /* Remove a Directory */
345 nis_error NIS_RMDIR(nis_name) = 23;
346
347 /* Update public keys of a directory object */
348 nis_error NIS_UPDKEYS(nis_name) = 24;
349 } = 3;
350} = 100300;
351
352/*
353 * Included below are the defines that become part of nis.h,
354 * they are technically not part of the protocol, but do define
355 * key aspects of the implementation and are therefore useful
356 * in building a conforming server or client.
357 */
358#if RPC_HDR
359%/*
360% * Generic "hash" datastructures, used by all types of hashed data.
361% */
362%struct nis_hash_data {
363% nis_name name; /* NIS name of hashed item */
364% int keychain; /* It's hash key (for pop) */
365% struct nis_hash_data *next; /* Hash collision pointer */
366% struct nis_hash_data *prv_item; /* A serial, doubly linked list */
367% struct nis_hash_data *nxt_item; /* of items in the hash table */
368%};
369%typedef struct nis_hash_data NIS_HASH_ITEM;
370%
371%struct nis_hash_table {
372% NIS_HASH_ITEM *keys[64]; /* A hash table of items */
373% NIS_HASH_ITEM *first; /* The first "item" in serial list */
374%};
375%typedef struct nis_hash_table NIS_HASH_TABLE;
376%
377%/* Structure for storing dynamically allocated static data */
378%struct nis_sdata {
379% void *buf; /* Memory allocation pointer */
380% u_long size; /* Buffer size */
381%};
382%
383%/* Generic client creating flags */
384%#define ZMH_VC 1
385%#define ZMH_DG 2
386%#define ZMH_AUTH 4
387%
388%/* Testing Access rights for objects */
389%
390%#define NIS_READ_ACC 1
391%#define NIS_MODIFY_ACC 2
392%#define NIS_CREATE_ACC 4
393%#define NIS_DESTROY_ACC 8
394%/* Test macros. a == access rights, m == desired rights. */
395%#define WORLD(a, m) (((a) & (m)) != 0)
396%#define GROUP(a, m) (((a) & ((m) << 8)) != 0)
397%#define OWNER(a, m) (((a) & ((m) << 16)) != 0)
398%#define NOBODY(a, m) (((a) & ((m) << 24)) != 0)
399%
400%#define OATYPE(d, n) (((d)->do_armask.do_armask_val+n)->oa_otype)
401%#define OARIGHTS(d, n) (((d)->do_armask.do_armask_val+n)->oa_rights)
402%#define WORLD_DEFAULT (NIS_READ_ACC)
403%#define GROUP_DEFAULT (NIS_READ_ACC << 8)
404%#define OWNER_DEFAULT ((NIS_READ_ACC +\
405 NIS_MODIFY_ACC +\
406 NIS_CREATE_ACC +\
407 NIS_DESTROY_ACC) << 16)
408%#define DEFAULT_RIGHTS (WORLD_DEFAULT | GROUP_DEFAULT | OWNER_DEFAULT)
409%
410%/* Result manipulation defines ... */
411%#define NIS_RES_NUMOBJ(x) ((x)->objects.objects_len)
412%#define NIS_RES_OBJECT(x) ((x)->objects.objects_val)
413%#define NIS_RES_COOKIE(x) ((x)->cookie)
414%#define NIS_RES_STATUS(x) ((x)->status)
415%
416%/* These defines make getting at the variant part of the object easier. */
417%#define TA_data zo_data.objdata_u.ta_data
418%#define EN_data zo_data.objdata_u.en_data
419%#define DI_data zo_data.objdata_u.di_data
420%#define LI_data zo_data.objdata_u.li_data
421%#define GR_data zo_data.objdata_u.gr_data
422%
423%#define __type_of(o) ((o)->zo_data.zo_type)
424%
425%/* Declarations for the internal subroutines in nislib.c */
426%enum name_pos {SAME_NAME, HIGHER_NAME, LOWER_NAME, NOT_SEQUENTIAL, BAD_NAME};
427%typedef enum name_pos name_pos;
428%
429%/*
430% * Defines for getting at column data in entry objects. Because RPCGEN
431% * generates some rather wordy structures, we create some defines that
432% * collapse the needed keystrokes to access a particular value using
433% * these definitions they take an nis_object *, and an int and return
434% * a u_char * for Value, and an int for length.
435% */
436%#define ENTRY_VAL(obj, col) \
437 (obj)->EN_data.en_cols.en_cols_val[col].ec_value.ec_value_val
438%#define ENTRY_LEN(obj, col) \
439 (obj)->EN_data.en_cols.en_cols_val[col].ec_value.ec_value_len
440%
441%#ifdef __cplusplus
442%}
443%#endif
444%
445%/* Prototypes, and extern declarations for the NIS library functions. */
446%#include <rpcsvc/nislib.h>
447%#endif /* __NIS_RPCGEN_H */
448%/* EDIT_START */
449%
450%/*
451% * nis_3.h
452% *
453% * This file contains definitions that are only of interest to the actual
454% * service daemon and client stubs. Normal users of NIS will not include
455% * this file.
456% *
457% * NOTE : This include file is automatically created by a combination
458% * of rpcgen and sed. DO NOT EDIT IT, change the nis.x file instead
459% * and then remake this file.
460% */
461%#ifndef __nis_3_h
462%#define __nis_3_h
463%#ifdef __cplusplus
464%extern "C" {
465%#endif
466#endif