xref: /illumos-gate/usr/src/head/rpcsvc/nis.x (revision 36e852a1)
17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate  * CDDL HEADER START
37c478bd9Sstevel@tonic-gate  *
47c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*36e852a1SRaja Andra  * Common Development and Distribution License (the "License").
6*36e852a1SRaja Andra  * You may not use this file except in compliance with the License.
77c478bd9Sstevel@tonic-gate  *
87c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
107c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
117c478bd9Sstevel@tonic-gate  * and limitations under the License.
127c478bd9Sstevel@tonic-gate  *
137c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
147c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
167c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
177c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
187c478bd9Sstevel@tonic-gate  *
197c478bd9Sstevel@tonic-gate  * CDDL HEADER END
207c478bd9Sstevel@tonic-gate  */
217c478bd9Sstevel@tonic-gate /*
227c478bd9Sstevel@tonic-gate  * RPC Language Protocol description file for NIS Plus
237c478bd9Sstevel@tonic-gate  *
24*36e852a1SRaja Andra  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
257c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
267c478bd9Sstevel@tonic-gate  *
277c478bd9Sstevel@tonic-gate  *
287c478bd9Sstevel@tonic-gate  * From 4.1 : @(#)nis.x	1.61 Copyright 1989 Sun Microsystems
297c478bd9Sstevel@tonic-gate  */
307c478bd9Sstevel@tonic-gate 
317c478bd9Sstevel@tonic-gate /* This gets stuffed into the source files. */
327c478bd9Sstevel@tonic-gate #if RPC_HDR
337c478bd9Sstevel@tonic-gate %#include <rpc/xdr.h>
347c478bd9Sstevel@tonic-gate #endif
357c478bd9Sstevel@tonic-gate #if defined(RPC_XDR) || defined(RPC_CLNT) || defined(RPC_SVC)
367c478bd9Sstevel@tonic-gate %#ifndef xdr_uint32_t
377c478bd9Sstevel@tonic-gate %#define xdr_uint32_t	xdr_u_int
387c478bd9Sstevel@tonic-gate %#endif
397c478bd9Sstevel@tonic-gate %#ifndef xdr_uint_t
407c478bd9Sstevel@tonic-gate %#define xdr_uint_t	xdr_u_int
417c478bd9Sstevel@tonic-gate %#endif
427c478bd9Sstevel@tonic-gate #endif
437c478bd9Sstevel@tonic-gate #if RPC_SVC
447c478bd9Sstevel@tonic-gate %#include "nis_svc.h"
457c478bd9Sstevel@tonic-gate #endif
467c478bd9Sstevel@tonic-gate 
477c478bd9Sstevel@tonic-gate /* Include the RPC Language description of NIS objects */
487c478bd9Sstevel@tonic-gate #include "nis_object.x"
497c478bd9Sstevel@tonic-gate 
507c478bd9Sstevel@tonic-gate 
517c478bd9Sstevel@tonic-gate 
527c478bd9Sstevel@tonic-gate 
537c478bd9Sstevel@tonic-gate /*
547c478bd9Sstevel@tonic-gate  * These are the type of entries that are stored in the transaction log,
557c478bd9Sstevel@tonic-gate  * note that modifications will appear as two entries, for names, they have
567c478bd9Sstevel@tonic-gate  * a "OLD" entry followed by a "NEW" entry. For entries in tables, there
577c478bd9Sstevel@tonic-gate  * is a remove followed by an add. It is done this way so that we can read
587c478bd9Sstevel@tonic-gate  * the log backwards to back out transactions and forwards to propogate
597c478bd9Sstevel@tonic-gate  * updated.
607c478bd9Sstevel@tonic-gate  */
617c478bd9Sstevel@tonic-gate enum log_entry_t {
627c478bd9Sstevel@tonic-gate 	LOG_NOP = 0,
637c478bd9Sstevel@tonic-gate 	ADD_NAME = 1,		/* Name Added to name space 		  */
647c478bd9Sstevel@tonic-gate 	REM_NAME = 2,		/* Name removed from name space 	  */
657c478bd9Sstevel@tonic-gate 	MOD_NAME_OLD = 3,	/* Name was modified in the name space 	  */
667c478bd9Sstevel@tonic-gate 	MOD_NAME_NEW = 4,	/* Name was modified in the name space 	  */
677c478bd9Sstevel@tonic-gate 	ADD_IBASE = 5,		/* Entry added to information base 	  */
687c478bd9Sstevel@tonic-gate 	REM_IBASE = 6,		/* Entry removed from information base    */
697c478bd9Sstevel@tonic-gate 	MOD_IBASE = 7,		/* Entry was modified in information base */
707c478bd9Sstevel@tonic-gate 	UPD_STAMP = 8		/* Update timestamp (used as fenceposts)  */
717c478bd9Sstevel@tonic-gate };
727c478bd9Sstevel@tonic-gate 
737c478bd9Sstevel@tonic-gate /*
747c478bd9Sstevel@tonic-gate  * This result is returned from the name service when it is requested to
757c478bd9Sstevel@tonic-gate  * dump logged entries from its transaction log. Information base updates
767c478bd9Sstevel@tonic-gate  * will have the name of the information base in the le_name field and
777c478bd9Sstevel@tonic-gate  * a canonical set of attribute/value pairs to fully specify the entry's
787c478bd9Sstevel@tonic-gate  * 'name'.
797c478bd9Sstevel@tonic-gate  */
807c478bd9Sstevel@tonic-gate struct log_entry {
817c478bd9Sstevel@tonic-gate 	uint32_t	le_time;	/* Time in seconds 		*/
827c478bd9Sstevel@tonic-gate 	log_entry_t	le_type;	/* Type of log entry 		*/
837c478bd9Sstevel@tonic-gate 	nis_name	le_princp;	/* Principal making the change	*/
847c478bd9Sstevel@tonic-gate 	nis_name	le_name;	/* Name of table/dir involved 	*/
857c478bd9Sstevel@tonic-gate 	nis_attr	le_attrs<>;	/* List of AV pairs.		*/
867c478bd9Sstevel@tonic-gate 	nis_object	le_object;	/* Actual object value 		*/
877c478bd9Sstevel@tonic-gate };
887c478bd9Sstevel@tonic-gate 
897c478bd9Sstevel@tonic-gate 
907c478bd9Sstevel@tonic-gate /*
917c478bd9Sstevel@tonic-gate  * This structure defines a generic NIS tag list. The taglist contains
927c478bd9Sstevel@tonic-gate  * zero or tags, each of which is a type and a value. (u_int).
937c478bd9Sstevel@tonic-gate  * These are used to report statistics (see tag definitions below)
947c478bd9Sstevel@tonic-gate  * and to set or reset state variables.
957c478bd9Sstevel@tonic-gate  */
967c478bd9Sstevel@tonic-gate struct nis_tag {
977c478bd9Sstevel@tonic-gate 	u_int	tag_type;	/* Statistic tag (may vary) 	 */
987c478bd9Sstevel@tonic-gate 	string	tag_val<>;	/* Statistic value may also vary */
997c478bd9Sstevel@tonic-gate };
1007c478bd9Sstevel@tonic-gate 
1017c478bd9Sstevel@tonic-gate 
1027c478bd9Sstevel@tonic-gate %/*
1037c478bd9Sstevel@tonic-gate % * Structures used for server binding.
1047c478bd9Sstevel@tonic-gate % */
1057c478bd9Sstevel@tonic-gate struct nis_bound_endpoint {
1067c478bd9Sstevel@tonic-gate 	endpoint ep;
1077c478bd9Sstevel@tonic-gate 	int generation;
1087c478bd9Sstevel@tonic-gate 	int rank;
1097c478bd9Sstevel@tonic-gate 	u_int flags;
1107c478bd9Sstevel@tonic-gate 	int hostnum;
1117c478bd9Sstevel@tonic-gate 	int epnum;
1127c478bd9Sstevel@tonic-gate 	nis_name uaddr;
1137c478bd9Sstevel@tonic-gate 	endpoint cbep;
1147c478bd9Sstevel@tonic-gate };
1157c478bd9Sstevel@tonic-gate typedef struct nis_bound_endpoint nis_bound_endpoint;
1167c478bd9Sstevel@tonic-gate 
1177c478bd9Sstevel@tonic-gate struct nis_bound_directory {
1187c478bd9Sstevel@tonic-gate 	int generation;
1197c478bd9Sstevel@tonic-gate 	int min_rank;           /* minimum rank of bound endpoints */
1207c478bd9Sstevel@tonic-gate 	int optimal_rank;       /* best possible rank of all endpoints */
1217c478bd9Sstevel@tonic-gate 	directory_obj dobj;
1227c478bd9Sstevel@tonic-gate 	nis_bound_endpoint BEP<>;
1237c478bd9Sstevel@tonic-gate };
1247c478bd9Sstevel@tonic-gate typedef struct nis_bound_directory nis_bound_directory;
1257c478bd9Sstevel@tonic-gate %#define bep_len BEP.BEP_len
1267c478bd9Sstevel@tonic-gate %#define bep_val BEP.BEP_val
1277c478bd9Sstevel@tonic-gate 
1287c478bd9Sstevel@tonic-gate struct nis_active_endpoint {
1297c478bd9Sstevel@tonic-gate 	endpoint ep;
1307c478bd9Sstevel@tonic-gate 	nis_name hostname;
1317c478bd9Sstevel@tonic-gate 	int rank;
1327c478bd9Sstevel@tonic-gate 	int uaddr_generation;
1337c478bd9Sstevel@tonic-gate 	nis_name uaddr;
1347c478bd9Sstevel@tonic-gate 	int cbep_generation;
1357c478bd9Sstevel@tonic-gate 	endpoint cbep;
1367c478bd9Sstevel@tonic-gate };
1377c478bd9Sstevel@tonic-gate typedef struct nis_active_endpoint nis_active_endpoint;
1387c478bd9Sstevel@tonic-gate 
1397c478bd9Sstevel@tonic-gate %/* defines for nis_bound_endpoint.flags */
1407c478bd9Sstevel@tonic-gate %#define NIS_BOUND 0x1
1417c478bd9Sstevel@tonic-gate %#define NIS_TRANSIENT_ERRORS 0x2
1427c478bd9Sstevel@tonic-gate 
1437c478bd9Sstevel@tonic-gate 
1447c478bd9Sstevel@tonic-gate 
1457c478bd9Sstevel@tonic-gate /*
1467c478bd9Sstevel@tonic-gate  * What's going on here? Well, it's like this. When the service
1477c478bd9Sstevel@tonic-gate  * is being compiled it wants to have the service definition specific
1487c478bd9Sstevel@tonic-gate  * info included, and when the client is being compiled it wants that
1497c478bd9Sstevel@tonic-gate  * info. This includes the appropriate file which was generated by
1507c478bd9Sstevel@tonic-gate  * make in the protocols directory (probably /usr/include/rpcsvc).
1517c478bd9Sstevel@tonic-gate  */
1527c478bd9Sstevel@tonic-gate #ifdef RPC_SVC
1537c478bd9Sstevel@tonic-gate %#include "nis_svc.h"
1547c478bd9Sstevel@tonic-gate #endif
1557c478bd9Sstevel@tonic-gate #ifdef RPC_CLNT
1567c478bd9Sstevel@tonic-gate %#include "nis_clnt.h"
1577c478bd9Sstevel@tonic-gate #endif
1587c478bd9Sstevel@tonic-gate 
1597c478bd9Sstevel@tonic-gate 
1607c478bd9Sstevel@tonic-gate /*
1617c478bd9Sstevel@tonic-gate  * Included below are the defines that become part of nis.h,
1627c478bd9Sstevel@tonic-gate  * they are technically not part of the protocol, but do define
1637c478bd9Sstevel@tonic-gate  * key aspects of the implementation and are therefore useful
1647c478bd9Sstevel@tonic-gate  * in building a conforming server or client.
1657c478bd9Sstevel@tonic-gate  */
1667c478bd9Sstevel@tonic-gate #if RPC_HDR
1677c478bd9Sstevel@tonic-gate %/*
1687c478bd9Sstevel@tonic-gate % * Generic "hash" datastructures, used by all types of hashed data.
1697c478bd9Sstevel@tonic-gate % */
1707c478bd9Sstevel@tonic-gate %struct nis_hash_data {
1717c478bd9Sstevel@tonic-gate %	nis_name		name;	   /* NIS name of hashed item      */
1727c478bd9Sstevel@tonic-gate %	int			keychain;  /* It's hash key (for pop)      */
1737c478bd9Sstevel@tonic-gate %	struct nis_hash_data	*next;	   /* Hash collision pointer       */
1747c478bd9Sstevel@tonic-gate %	struct nis_hash_data	*prv_item; /* A serial, doubly linked list */
1757c478bd9Sstevel@tonic-gate %	struct nis_hash_data	*nxt_item; /* of items in the hash table   */
1767c478bd9Sstevel@tonic-gate %};
1777c478bd9Sstevel@tonic-gate %typedef struct nis_hash_data NIS_HASH_ITEM;
1787c478bd9Sstevel@tonic-gate %
1797c478bd9Sstevel@tonic-gate %struct nis_hash_table {
1807c478bd9Sstevel@tonic-gate %	NIS_HASH_ITEM	*keys[64];	/* A hash table of items           */
1817c478bd9Sstevel@tonic-gate %	NIS_HASH_ITEM	*first;		/* The first "item" in serial list */
1827c478bd9Sstevel@tonic-gate %};
1837c478bd9Sstevel@tonic-gate %typedef struct nis_hash_table NIS_HASH_TABLE;
1847c478bd9Sstevel@tonic-gate %
1857c478bd9Sstevel@tonic-gate %/* Structure for storing dynamically allocated static data */
1867c478bd9Sstevel@tonic-gate %struct nis_sdata {
1877c478bd9Sstevel@tonic-gate %	void	*buf;	/* Memory allocation pointer 	*/
1887c478bd9Sstevel@tonic-gate %	u_int	size;	/* Buffer size			*/
1897c478bd9Sstevel@tonic-gate %};
1907c478bd9Sstevel@tonic-gate %
1917c478bd9Sstevel@tonic-gate %/* Generic client creating flags */
1927c478bd9Sstevel@tonic-gate %#define ZMH_VC		1
1937c478bd9Sstevel@tonic-gate %#define ZMH_DG		2
1947c478bd9Sstevel@tonic-gate %#define ZMH_AUTH	4
1957c478bd9Sstevel@tonic-gate %#define ZMH_NOFALLBACK 8
1967c478bd9Sstevel@tonic-gate %
1977c478bd9Sstevel@tonic-gate %/* Testing Access rights for objects */
1987c478bd9Sstevel@tonic-gate %
1997c478bd9Sstevel@tonic-gate %#define NIS_READ_ACC		1
2007c478bd9Sstevel@tonic-gate %#define NIS_MODIFY_ACC		2
2017c478bd9Sstevel@tonic-gate %#define NIS_CREATE_ACC		4
2027c478bd9Sstevel@tonic-gate %#define NIS_DESTROY_ACC	8
2037c478bd9Sstevel@tonic-gate %/* Test macros. a == access rights, m == desired rights. */
2047c478bd9Sstevel@tonic-gate %#define NIS_WORLD(a, m)	(((a) & (m)) != 0)
2057c478bd9Sstevel@tonic-gate %#define NIS_GROUP(a, m)	(((a) & ((m) << 8)) != 0)
2067c478bd9Sstevel@tonic-gate %#define NIS_OWNER(a, m)	(((a) & ((m) << 16)) != 0)
2077c478bd9Sstevel@tonic-gate %#define NIS_NOBODY(a, m)	(((a) & ((m) << 24)) != 0)
2087c478bd9Sstevel@tonic-gate %/*
2097c478bd9Sstevel@tonic-gate % * EOL Alert - The following non-prefixed test macros are
2107c478bd9Sstevel@tonic-gate % * here for backward compatability, and will be not be present
2117c478bd9Sstevel@tonic-gate % * in future releases - use the NIS_*() macros above.
2127c478bd9Sstevel@tonic-gate % */
2137c478bd9Sstevel@tonic-gate %#define WORLD(a, m)	(((a) & (m)) != 0)
2147c478bd9Sstevel@tonic-gate %#define GROUP(a, m)	(((a) & ((m) << 8)) != 0)
2157c478bd9Sstevel@tonic-gate %#define OWNER(a, m)	(((a) & ((m) << 16)) != 0)
2167c478bd9Sstevel@tonic-gate %#define NOBODY(a, m)	(((a) & ((m) << 24)) != 0)
2177c478bd9Sstevel@tonic-gate %
2187c478bd9Sstevel@tonic-gate %#define OATYPE(d, n) (((d)->do_armask.do_armask_val+n)->oa_otype)
2197c478bd9Sstevel@tonic-gate %#define OARIGHTS(d, n) (((d)->do_armask.do_armask_val+n)->oa_rights)
2207c478bd9Sstevel@tonic-gate %#define WORLD_DEFAULT (NIS_READ_ACC)
2217c478bd9Sstevel@tonic-gate %#define GROUP_DEFAULT (NIS_READ_ACC << 8)
2227c478bd9Sstevel@tonic-gate %#define OWNER_DEFAULT ((NIS_READ_ACC +\
2237c478bd9Sstevel@tonic-gate %			 NIS_MODIFY_ACC +\
2247c478bd9Sstevel@tonic-gate %			 NIS_CREATE_ACC +\
2257c478bd9Sstevel@tonic-gate %			 NIS_DESTROY_ACC) << 16)
2267c478bd9Sstevel@tonic-gate %#define DEFAULT_RIGHTS (WORLD_DEFAULT | GROUP_DEFAULT | OWNER_DEFAULT)
2277c478bd9Sstevel@tonic-gate %
2287c478bd9Sstevel@tonic-gate %/* Result manipulation defines ... */
2297c478bd9Sstevel@tonic-gate %#define NIS_RES_NUMOBJ(x)	((x)->objects.objects_len)
2307c478bd9Sstevel@tonic-gate %#define NIS_RES_OBJECT(x)	((x)->objects.objects_val)
2317c478bd9Sstevel@tonic-gate %#define NIS_RES_COOKIE(x)	((x)->cookie)
2327c478bd9Sstevel@tonic-gate %#define NIS_RES_STATUS(x)	((x)->status)
2337c478bd9Sstevel@tonic-gate %
2347c478bd9Sstevel@tonic-gate %/* These defines make getting at the variant part of the object easier. */
2357c478bd9Sstevel@tonic-gate %#define TA_data zo_data.objdata_u.ta_data
2367c478bd9Sstevel@tonic-gate %#define EN_data zo_data.objdata_u.en_data
2377c478bd9Sstevel@tonic-gate %#define DI_data zo_data.objdata_u.di_data
2387c478bd9Sstevel@tonic-gate %#define LI_data zo_data.objdata_u.li_data
2397c478bd9Sstevel@tonic-gate %#define GR_data zo_data.objdata_u.gr_data
2407c478bd9Sstevel@tonic-gate %
2417c478bd9Sstevel@tonic-gate %#define __type_of(o) ((o)->zo_data.zo_type)
2427c478bd9Sstevel@tonic-gate %
2437c478bd9Sstevel@tonic-gate %/* Declarations for the internal subroutines in nislib.c */
2447c478bd9Sstevel@tonic-gate %enum name_pos {SAME_NAME, HIGHER_NAME, LOWER_NAME, NOT_SEQUENTIAL, BAD_NAME};
2457c478bd9Sstevel@tonic-gate %typedef enum name_pos name_pos;
2467c478bd9Sstevel@tonic-gate %
2477c478bd9Sstevel@tonic-gate %/*
2487c478bd9Sstevel@tonic-gate % * Defines for getting at column data in entry objects. Because RPCGEN
2497c478bd9Sstevel@tonic-gate % * generates some rather wordy structures, we create some defines that
2507c478bd9Sstevel@tonic-gate % * collapse the needed keystrokes to access a particular value using
2517c478bd9Sstevel@tonic-gate % * these definitions they take an nis_object *, and an int and return
2527c478bd9Sstevel@tonic-gate % * a u_char * for Value, and an int for length.
2537c478bd9Sstevel@tonic-gate % */
2547c478bd9Sstevel@tonic-gate %#define ENTRY_VAL(obj, col) \
2557c478bd9Sstevel@tonic-gate %	(obj)->EN_data.en_cols.en_cols_val[col].ec_value.ec_value_val
2567c478bd9Sstevel@tonic-gate %#define ENTRY_LEN(obj, col) \
2577c478bd9Sstevel@tonic-gate %	(obj)->EN_data.en_cols.en_cols_val[col].ec_value.ec_value_len
2587c478bd9Sstevel@tonic-gate %
2597c478bd9Sstevel@tonic-gate %
2607c478bd9Sstevel@tonic-gate %
2617c478bd9Sstevel@tonic-gate %#ifdef __cplusplus
2627c478bd9Sstevel@tonic-gate %}
2637c478bd9Sstevel@tonic-gate %#endif
2647c478bd9Sstevel@tonic-gate %
2657c478bd9Sstevel@tonic-gate %/* Prototypes, and extern declarations for the NIS library functions. */
2667c478bd9Sstevel@tonic-gate %#include <rpcsvc/nislib.h>
2677c478bd9Sstevel@tonic-gate %#endif /* __NIS_RPCGEN_H */
2687c478bd9Sstevel@tonic-gate %/* EDIT_START */
2697c478bd9Sstevel@tonic-gate %
2707c478bd9Sstevel@tonic-gate %/*
2717c478bd9Sstevel@tonic-gate % * nis_3.h
2727c478bd9Sstevel@tonic-gate % *
2737c478bd9Sstevel@tonic-gate % * This file contains definitions that are only of interest to the actual
2747c478bd9Sstevel@tonic-gate % * service daemon and client stubs. Normal users of NIS will not include
2757c478bd9Sstevel@tonic-gate % * this file.
2767c478bd9Sstevel@tonic-gate % *
2777c478bd9Sstevel@tonic-gate % * NOTE : This include file is automatically created by a combination
2787c478bd9Sstevel@tonic-gate % * of rpcgen and sed. DO NOT EDIT IT, change the nis.x file instead
2797c478bd9Sstevel@tonic-gate % * and then remake this file.
2807c478bd9Sstevel@tonic-gate % */
2817c478bd9Sstevel@tonic-gate %#ifndef __nis_3_h
2827c478bd9Sstevel@tonic-gate %#define __nis_3_h
2837c478bd9Sstevel@tonic-gate %#ifdef __cplusplus
2847c478bd9Sstevel@tonic-gate %extern "C" {
2857c478bd9Sstevel@tonic-gate %#endif
2867c478bd9Sstevel@tonic-gate #endif
287