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