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.
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.
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.
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.
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.
26 % * Sun Microsystems, Inc.
27 % * 2550 Garcia Avenue
28 % * Mountain View, California 94043
30 % * $FreeBSD: src/include/rpcsvc/nis.x,v 1.6 2003/05/04 02:51:42 obrien Exp $
34 * From 4.1 : @(#)nis.x 1.61 Copyright 1989 Sun Microsystems
36 * RPC Language Protocol description file for NIS Plus
38 * Last Modified : 3/19/91
44 % * This file is the main include file for NIS clients. It contains
45 % * both the client library function defines and the various data
46 % * structures used by the NIS service. It includes the file nis_tags.h
47 % * which defines the tag values. This allows the tags to change without
48 % * having to change the nis.x file.
50 % * NOTE : DO NOT EDIT THIS FILE! It is automatically generated when
51 % * rpcgen is run on the nis.x file. Note that there is a
52 % * simple sed script to remove some unneeded lines. (See the
53 % * Makefile target nis.h)
56 %#include <rpcsvc/nis_tags.h>
59 /* This gets stuffed into the source files. */
64 * This is just pointless.
72 /* Include the RPC Language description of NIS objects */
73 #include "nis_object.x"
75 /* Errors that can be returned by the service */
77 NIS_SUCCESS = 0, /* A-ok, let's rock n roll */
78 NIS_S_SUCCESS = 1, /* Name found (maybe) */
79 NIS_NOTFOUND = 2, /* Name definitely not found */
80 NIS_S_NOTFOUND = 3, /* Name maybe not found */
81 NIS_CACHEEXPIRED = 4, /* Name exists but cache out of date */
82 NIS_NAMEUNREACHABLE = 5, /* Can't get there from here */
83 NIS_UNKNOWNOBJ = 6, /* Object type is bogus */
84 NIS_TRYAGAIN = 7, /* I'm busy, call back */
85 NIS_SYSTEMERROR = 8, /* Out of band failure */
86 NIS_CHAINBROKEN = 9, /* First/Next warning */
87 NIS_PERMISSION = 10, /* Not enough permission to access */
88 NIS_NOTOWNER = 11, /* You don't own it, sorry */
89 NIS_NOT_ME = 12, /* I don't serve this name */
90 NIS_NOMEMORY = 13, /* Outta VM! Help! */
91 NIS_NAMEEXISTS = 14, /* Can't create over another name */
92 NIS_NOTMASTER = 15, /* I'm justa secondaray, don't ask me */
93 NIS_INVALIDOBJ = 16, /* Object is broken somehow */
94 NIS_BADNAME = 17, /* Unparsable name */
95 NIS_NOCALLBACK = 18, /* Couldn't talk to call back proc */
96 NIS_CBRESULTS = 19, /* Results being called back to you */
97 NIS_NOSUCHNAME = 20, /* Name unknown */
98 NIS_NOTUNIQUE = 21, /* Value is not uniques (entry) */
99 NIS_IBMODERROR = 22, /* Inf. Base. Modify error. */
100 NIS_NOSUCHTABLE = 23, /* Name for table was wrong */
101 NIS_TYPEMISMATCH = 24, /* Entry and table type mismatch */
102 NIS_LINKNAMEERROR = 25, /* Link points to bogus name */
103 NIS_PARTIAL = 26, /* Partial success, found table */
104 NIS_TOOMANYATTRS = 27, /* Too many attributes */
105 NIS_RPCERROR = 28, /* RPC error encountered */
106 NIS_BADATTRIBUTE = 29, /* Bad or invalid attribute */
107 NIS_NOTSEARCHABLE = 30, /* Non-searchable object searched */
108 NIS_CBERROR = 31, /* Error during callback (svc crash) */
109 NIS_FOREIGNNS = 32, /* Foreign Namespace */
110 NIS_BADOBJECT = 33, /* Malformed object structure */
111 NIS_NOTSAMEOBJ = 34, /* Object swapped during deletion */
112 NIS_MODFAIL = 35, /* Failure during a Modify. */
113 NIS_BADREQUEST = 36, /* Illegal query for table */
114 NIS_NOTEMPTY = 37, /* Attempt to remove a non-empty tbl */
115 NIS_COLDSTART_ERR = 38, /* Error accesing the cold start file */
116 NIS_RESYNC = 39, /* Transaction log too far out of date */
117 NIS_FAIL = 40, /* NIS operation failed. */
118 NIS_UNAVAIL = 41, /* NIS+ service is unavailable (client) */
119 NIS_RES2BIG = 42, /* NIS+ result too big for datagram */
120 NIS_SRVAUTH = 43, /* NIS+ server wasn't authenticated. */
121 NIS_CLNTAUTH = 44, /* NIS+ Client wasn't authenticated. */
122 NIS_NOFILESPACE = 45, /* NIS+ server ran out of disk space */
123 NIS_NOPROC = 46, /* NIS+ server couldn't create new proc */
124 NIS_DUMPLATER = 47 /* NIS+ server already has dump child */
129 * Structure definitions for the parameters and results of the actual
132 * This is the standard result (in the protocol) of most of the nis
137 nis_error status; /* Status of the response */
138 nis_object objects<>; /* objects found */
139 netobj cookie; /* Cookie Data */
140 u_long zticks; /* server ticks */
141 u_long dticks; /* DBM ticks. */
142 u_long aticks; /* Cache (accel) ticks */
143 u_long cticks; /* Client ticks */
147 * A Name Service request
148 * This request is used to access the name space, ns_name is the name
149 * of the object within the namespace and the object is it's value, for
150 * add/modify, a copy of the original for remove.
154 nis_name ns_name; /* Name in the NIS name space */
155 nis_object ns_object<1>; /* Optional Object (add/remove) */
159 * An information base request
160 * This request includes the NIS name of the table we wish to search, the
161 * search criteria in the form of attribute/value pairs and an optional
162 * callback program number. If the callback program number is provided
163 * the server will send back objects one at a time, otherwise it will
164 * return them all in the response.
168 nis_name ibr_name; /* The name of the Table */
169 nis_attr ibr_srch<>; /* The search critereia */
170 u_long ibr_flags; /* Optional flags */
171 nis_object ibr_obj<1>; /* optional object (add/modify) */
172 nis_server ibr_cbhost<1>; /* Optional callback info */
173 u_long ibr_bufsize; /* Optional first/next bufsize */
174 netobj ibr_cookie; /* The first/next cookie */
178 * This argument to the PING call notifies the replicas that something in
179 * a directory has changed and this is it's timestamp. The replica will use
180 * the timestamp to determine if its resync operation was successful.
183 nis_name dir; /* Directory that had the change */
184 u_long stamp; /* timestamp of the transaction */
188 * These are the type of entries that are stored in the transaction log,
189 * note that modifications will appear as two entries, for names, they have
190 * an "OLD" entry followed by a "NEW" entry. For entries in tables, there
191 * is a remove followed by an add. It is done this way so that we can read
192 * the log backwards to back out transactions and forwards to propogate
197 ADD_NAME = 1, /* Name Added to name space */
198 REM_NAME = 2, /* Name removed from name space */
199 MOD_NAME_OLD = 3, /* Name was modified in the name space */
200 MOD_NAME_NEW = 4, /* Name was modified in the name space */
201 ADD_IBASE = 5, /* Entry added to information base */
202 REM_IBASE = 6, /* Entry removed from information base */
203 MOD_IBASE = 7, /* Entry was modified in information base */
204 UPD_STAMP = 8 /* Update timestamp (used as fenceposts) */
208 * This result is returned from the name service when it is requested to
209 * dump logged entries from its transaction log. Information base updates
210 * will have the name of the information base in the le_name field and
211 * a canonical set of attribute/value pairs to fully specify the entry's
215 u_long le_time; /* Time in seconds */
216 log_entry_t le_type; /* Type of log entry */
217 nis_name le_princp; /* Principal making the change */
218 nis_name le_name; /* Name of table/dir involved */
219 nis_attr le_attrs<>; /* List of AV pairs. */
220 nis_object le_object; /* Actual object value */
224 nis_error lr_status; /* The status itself */
225 netobj lr_cookie; /* Used by the dump callback */
226 log_entry lr_entries<>; /* zero or more entries */
230 nis_error cp_status; /* Status of the checkpoint */
231 u_long cp_zticks; /* Service 'ticks' */
232 u_long cp_dticks; /* Database 'ticks' */
236 * This structure defines a generic NIS tag list. The taglist contains
237 * zero or tags, each of which is a type and a value. (u_long).
238 * These are used to report statistics (see tag definitions below)
239 * and to set or reset state variables.
242 u_long tag_type; /* Statistic tag (may vary) */
243 string tag_val<1024>; /* Statistic value may also vary */
247 nis_tag tags<>; /* List of tags */
251 nis_name da_dir; /* Directory to dump */
252 u_long da_time; /* From this timestamp */
253 nis_server da_cbhost<1>; /* Callback to use. */
257 nis_name dir_name; /* The directory we're looking for */
258 nis_name requester; /* Host principal name for signature */
262 nis_error status; /* Status returned by function */
263 nis_name source; /* Source of this answer */
264 opaque dir_data<>; /* Directory Data (XDR'ed) */
265 opaque signature<>; /* Signature of the source */
270 * What's going on here? Well, it's like this. When the service
271 * is being compiled it wants to have the service definition specific
272 * info included, and when the client is being compiled it wants that
273 * info. This includes the appropriate file which was generated by
274 * make in the protocols directory (probably /usr/include/rpcsvc).
276 * Uhm... guys? With RPC, you aren't supposed to have separate
277 * server-specific and client-specific header files. You have one header
278 * file that's suitable for both. If your code doesn't work using just
279 * the one header file, I submit to you that it's broken.
284 %#include "nis_svc.h"
287 %#include "nis_clnt.h"
293 /* RPC Language description of the NIS+ protocol */
294 version NIS_VERSION {
295 /* The name service functions */
296 nis_result NIS_LOOKUP(ns_request) = 1;
297 nis_result NIS_ADD(ns_request) = 2;
298 nis_result NIS_MODIFY(ns_request) = 3;
299 nis_result NIS_REMOVE(ns_request) = 4;
301 /* The information base functions */
302 nis_result NIS_IBLIST(ib_request) = 5;
303 nis_result NIS_IBADD(ib_request) = 6;
304 nis_result NIS_IBMODIFY(ib_request) = 7;
305 nis_result NIS_IBREMOVE(ib_request) = 8;
306 nis_result NIS_IBFIRST(ib_request) = 9;
307 nis_result NIS_IBNEXT(ib_request) = 10;
309 /* NIS Administrative functions */
310 fd_result NIS_FINDDIRECTORY(fd_args) = 12;
312 /* If fetch and optionally reset statistics */
313 nis_taglist NIS_STATUS(nis_taglist) = 14;
315 /* Dump changes to directory since time in da_time */
316 log_result NIS_DUMPLOG(dump_args) = 15;
318 /* Dump contents of directory named */
319 log_result NIS_DUMP(dump_args) = 16;
321 /* Check status of callback thread */
322 bool NIS_CALLBACK(netobj) = 17;
324 /* Return last update time for named dir */
325 u_long NIS_CPTIME(nis_name) = 18;
327 /* Checkpoint directory or table named */
328 cp_result NIS_CHECKPOINT(nis_name) = 19;
330 /* Send 'status changed' ping to replicates */
331 void NIS_PING(ping_args) = 20;
333 /* Modify server behaviour (such as debugging) */
334 nis_taglist NIS_SERVSTATE(nis_taglist) = 21;
336 /* Create a Directory */
337 nis_error NIS_MKDIR(nis_name) = 22;
339 /* Remove a Directory */
340 nis_error NIS_RMDIR(nis_name) = 23;
342 /* Update public keys of a directory object */
343 nis_error NIS_UPDKEYS(nis_name) = 24;
348 * Included below are the defines that become part of nis.h,
349 * they are technically not part of the protocol, but do define
350 * key aspects of the implementation and are therefore useful
351 * in building a conforming server or client.
355 % * Generic "hash" datastructures, used by all types of hashed data.
357 %struct nis_hash_data {
358 % nis_name name; /* NIS name of hashed item */
359 % int keychain; /* It's hash key (for pop) */
360 % struct nis_hash_data *next; /* Hash collision pointer */
361 % struct nis_hash_data *prv_item; /* A serial, doubly linked list */
362 % struct nis_hash_data *nxt_item; /* of items in the hash table */
364 %typedef struct nis_hash_data NIS_HASH_ITEM;
366 %struct nis_hash_table {
367 % NIS_HASH_ITEM *keys[64]; /* A hash table of items */
368 % NIS_HASH_ITEM *first; /* The first "item" in serial list */
370 %typedef struct nis_hash_table NIS_HASH_TABLE;
372 %/* Structure for storing dynamically allocated static data */
374 % void *buf; /* Memory allocation pointer */
375 % u_long size; /* Buffer size */
378 %/* Generic client creating flags */
383 %/* Testing Access rights for objects */
385 %#define NIS_READ_ACC 1
386 %#define NIS_MODIFY_ACC 2
387 %#define NIS_CREATE_ACC 4
388 %#define NIS_DESTROY_ACC 8
389 %/* Test macros. a == access rights, m == desired rights. */
390 %#define WORLD(a, m) (((a) & (m)) != 0)
391 %#define GROUP(a, m) (((a) & ((m) << 8)) != 0)
392 %#define OWNER(a, m) (((a) & ((m) << 16)) != 0)
393 %#define NOBODY(a, m) (((a) & ((m) << 24)) != 0)
395 %#define OATYPE(d, n) (((d)->do_armask.do_armask_val+n)->oa_otype)
396 %#define OARIGHTS(d, n) (((d)->do_armask.do_armask_val+n)->oa_rights)
397 %#define WORLD_DEFAULT (NIS_READ_ACC)
398 %#define GROUP_DEFAULT (NIS_READ_ACC << 8)
399 %#define OWNER_DEFAULT ((NIS_READ_ACC + NIS_MODIFY_ACC + NIS_CREATE_ACC + NIS_DESTROY_ACC) << 16)
400 %#define DEFAULT_RIGHTS (WORLD_DEFAULT | GROUP_DEFAULT | OWNER_DEFAULT)
402 %/* Result manipulation defines ... */
403 %#define NIS_RES_NUMOBJ(x) ((x)->objects.objects_len)
404 %#define NIS_RES_OBJECT(x) ((x)->objects.objects_val)
405 %#define NIS_RES_COOKIE(x) ((x)->cookie)
406 %#define NIS_RES_STATUS(x) ((x)->status)
408 %/* These defines make getting at the variant part of the object easier. */
409 %#define TA_data zo_data.objdata_u.ta_data
410 %#define EN_data zo_data.objdata_u.en_data
411 %#define DI_data zo_data.objdata_u.di_data
412 %#define LI_data zo_data.objdata_u.li_data
413 %#define GR_data zo_data.objdata_u.gr_data
415 %#define __type_of(o) ((o)->zo_data.zo_type)
417 %/* Declarations for the internal subroutines in nislib.c */
418 %enum name_pos {SAME_NAME, HIGHER_NAME, LOWER_NAME, NOT_SEQUENTIAL, BAD_NAME};
419 %typedef enum name_pos name_pos;
422 % * Defines for getting at column data in entry objects. Because RPCGEN
423 % * generates some rather wordy structures, we create some defines that
424 % * collapse the needed keystrokes to access a particular value using
425 % * these definitions they take an nis_object *, and an int and return
426 % * a u_char * for Value, and an int for length.
428 %#define ENTRY_VAL(obj, col) (obj)->EN_data.en_cols.en_cols_val[col].ec_value.ec_value_val
429 %#define ENTRY_LEN(obj, col) (obj)->EN_data.en_cols.en_cols_val[col].ec_value.ec_value_len
435 %/* Prototypes, and extern declarations for the NIS library functions. */
436 %#include <rpcsvc/nislib.h>
437 %#endif /* __NIS_RPCGEN_H */
443 % * This file contains definitions that are only of interest to the actual
444 % * service daemon and client stubs. Normal users of NIS will not include
447 % * NOTE : This include file is automatically created by a combination
448 % * of rpcgen and sed. DO NOT EDIT IT, change the nis.x file instead
449 % * and then remake this file.