18785398fSHiroki Sato %/*- 28785398fSHiroki Sato % * Copyright (c) 2010, Oracle America, Inc. 33b0f7467SBill Paul % * 48785398fSHiroki Sato % * Redistribution and use in source and binary forms, with or without 58785398fSHiroki Sato % * modification, are permitted provided that the following conditions are 68785398fSHiroki Sato % * met: 73b0f7467SBill Paul % * 88785398fSHiroki Sato % * * Redistributions of source code must retain the above copyright 98785398fSHiroki Sato % * notice, this list of conditions and the following disclaimer. 108785398fSHiroki Sato % * * Redistributions in binary form must reproduce the above 118785398fSHiroki Sato % * copyright notice, this list of conditions and the following 128785398fSHiroki Sato % * disclaimer in the documentation and/or other materials 138785398fSHiroki Sato % * provided with the distribution. 148785398fSHiroki Sato % * * Neither the name of the "Oracle America, Inc." nor the names of its 158785398fSHiroki Sato % * contributors may be used to endorse or promote products derived 168785398fSHiroki Sato % * from this software without specific prior written permission. 173b0f7467SBill Paul % * 188785398fSHiroki Sato % * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 198785398fSHiroki Sato % * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 208785398fSHiroki Sato % * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 218785398fSHiroki Sato % * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 228785398fSHiroki Sato % * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 238785398fSHiroki Sato % * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 248785398fSHiroki Sato % * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 258785398fSHiroki Sato % * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 268785398fSHiroki Sato % * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 278785398fSHiroki Sato % * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 288785398fSHiroki Sato % * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 298785398fSHiroki Sato % * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 303b0f7467SBill Paul % */ 313b0f7467SBill Paul 323b0f7467SBill Paul /* 333b0f7467SBill Paul * 343b0f7467SBill Paul * RPC Language Protocol description file for NIS Plus 353b0f7467SBill Paul * This version : 1.61 363b0f7467SBill Paul * Last Modified : 3/19/91 373b0f7467SBill Paul */ 383b0f7467SBill Paul #ifdef RPC_HDR 393b0f7467SBill Paul %/* 403b0f7467SBill Paul % * nis.h 413b0f7467SBill Paul % * 423b0f7467SBill Paul % * This file is the main include file for NIS clients. It contains 433b0f7467SBill Paul % * both the client library function defines and the various data 443b0f7467SBill Paul % * structures used by the NIS service. It includes the file nis_tags.h 453b0f7467SBill Paul % * which defines the tag values. This allows the tags to change without 463b0f7467SBill Paul % * having to change the nis.x file. 473b0f7467SBill Paul % * 483b0f7467SBill Paul % * NOTE : DO NOT EDIT THIS FILE! It is automatically generated when 493b0f7467SBill Paul % * rpcgen is run on the nis.x file. Note that there is a 503b0f7467SBill Paul % * simple sed script to remove some unneeded lines. (See the 513b0f7467SBill Paul % * Makefile target nis.h) 523b0f7467SBill Paul % * 533b0f7467SBill Paul % */ 543b0f7467SBill Paul %#include <rpcsvc/nis_tags.h> 553b0f7467SBill Paul #endif 563b0f7467SBill Paul 573b0f7467SBill Paul /* This gets stuffed into the source files. */ 583b0f7467SBill Paul #if RPC_HDR 593b0f7467SBill Paul %#include <rpc/xdr.h> 603b0f7467SBill Paul #endif 613b0f7467SBill Paul /* 623b0f7467SBill Paul * This is just pointless. 633b0f7467SBill Paul */ 643b0f7467SBill Paul #ifdef SUN_STUPIDITY 653b0f7467SBill Paul #if RPC_SVC 663b0f7467SBill Paul %#include "nis_svc.h" 673b0f7467SBill Paul #endif 683b0f7467SBill Paul #endif 693b0f7467SBill Paul 703b0f7467SBill Paul /* Include the RPC Language description of NIS objects */ 713b0f7467SBill Paul #include "nis_object.x" 723b0f7467SBill Paul 733b0f7467SBill Paul /* Errors that can be returned by the service */ 743b0f7467SBill Paul enum nis_error { 753b0f7467SBill Paul NIS_SUCCESS = 0, /* A-ok, let's rock n roll */ 763b0f7467SBill Paul NIS_S_SUCCESS = 1, /* Name found (maybe) */ 773b0f7467SBill Paul NIS_NOTFOUND = 2, /* Name definitely not found */ 783b0f7467SBill Paul NIS_S_NOTFOUND = 3, /* Name maybe not found */ 793b0f7467SBill Paul NIS_CACHEEXPIRED = 4, /* Name exists but cache out of date */ 803b0f7467SBill Paul NIS_NAMEUNREACHABLE = 5, /* Can't get there from here */ 813b0f7467SBill Paul NIS_UNKNOWNOBJ = 6, /* Object type is bogus */ 823b0f7467SBill Paul NIS_TRYAGAIN = 7, /* I'm busy, call back */ 833b0f7467SBill Paul NIS_SYSTEMERROR = 8, /* Out of band failure */ 843b0f7467SBill Paul NIS_CHAINBROKEN = 9, /* First/Next warning */ 853b0f7467SBill Paul NIS_PERMISSION = 10, /* Not enough permission to access */ 863b0f7467SBill Paul NIS_NOTOWNER = 11, /* You don't own it, sorry */ 873b0f7467SBill Paul NIS_NOT_ME = 12, /* I don't serve this name */ 883b0f7467SBill Paul NIS_NOMEMORY = 13, /* Outta VM! Help! */ 893b0f7467SBill Paul NIS_NAMEEXISTS = 14, /* Can't create over another name */ 903b0f7467SBill Paul NIS_NOTMASTER = 15, /* I'm justa secondaray, don't ask me */ 913b0f7467SBill Paul NIS_INVALIDOBJ = 16, /* Object is broken somehow */ 923b0f7467SBill Paul NIS_BADNAME = 17, /* Unparsable name */ 933b0f7467SBill Paul NIS_NOCALLBACK = 18, /* Couldn't talk to call back proc */ 943b0f7467SBill Paul NIS_CBRESULTS = 19, /* Results being called back to you */ 953b0f7467SBill Paul NIS_NOSUCHNAME = 20, /* Name unknown */ 963b0f7467SBill Paul NIS_NOTUNIQUE = 21, /* Value is not uniques (entry) */ 973b0f7467SBill Paul NIS_IBMODERROR = 22, /* Inf. Base. Modify error. */ 983b0f7467SBill Paul NIS_NOSUCHTABLE = 23, /* Name for table was wrong */ 993b0f7467SBill Paul NIS_TYPEMISMATCH = 24, /* Entry and table type mismatch */ 1003b0f7467SBill Paul NIS_LINKNAMEERROR = 25, /* Link points to bogus name */ 1013b0f7467SBill Paul NIS_PARTIAL = 26, /* Partial success, found table */ 1023b0f7467SBill Paul NIS_TOOMANYATTRS = 27, /* Too many attributes */ 1033b0f7467SBill Paul NIS_RPCERROR = 28, /* RPC error encountered */ 1043b0f7467SBill Paul NIS_BADATTRIBUTE = 29, /* Bad or invalid attribute */ 1053b0f7467SBill Paul NIS_NOTSEARCHABLE = 30, /* Non-searchable object searched */ 1063b0f7467SBill Paul NIS_CBERROR = 31, /* Error during callback (svc crash) */ 1073b0f7467SBill Paul NIS_FOREIGNNS = 32, /* Foreign Namespace */ 1083b0f7467SBill Paul NIS_BADOBJECT = 33, /* Malformed object structure */ 1093b0f7467SBill Paul NIS_NOTSAMEOBJ = 34, /* Object swapped during deletion */ 1103b0f7467SBill Paul NIS_MODFAIL = 35, /* Failure during a Modify. */ 1113b0f7467SBill Paul NIS_BADREQUEST = 36, /* Illegal query for table */ 1123b0f7467SBill Paul NIS_NOTEMPTY = 37, /* Attempt to remove a non-empty tbl */ 1133b0f7467SBill Paul NIS_COLDSTART_ERR = 38, /* Error accesing the cold start file */ 1143b0f7467SBill Paul NIS_RESYNC = 39, /* Transaction log too far out of date */ 1153b0f7467SBill Paul NIS_FAIL = 40, /* NIS operation failed. */ 1163b0f7467SBill Paul NIS_UNAVAIL = 41, /* NIS+ service is unavailable (client) */ 1173b0f7467SBill Paul NIS_RES2BIG = 42, /* NIS+ result too big for datagram */ 1183b0f7467SBill Paul NIS_SRVAUTH = 43, /* NIS+ server wasn't authenticated. */ 1193b0f7467SBill Paul NIS_CLNTAUTH = 44, /* NIS+ Client wasn't authenticated. */ 1203b0f7467SBill Paul NIS_NOFILESPACE = 45, /* NIS+ server ran out of disk space */ 1213b0f7467SBill Paul NIS_NOPROC = 46, /* NIS+ server couldn't create new proc */ 1223b0f7467SBill Paul NIS_DUMPLATER = 47 /* NIS+ server already has dump child */ 1233b0f7467SBill Paul }; 1243b0f7467SBill Paul 1253b0f7467SBill Paul 1263b0f7467SBill Paul /* 1273b0f7467SBill Paul * Structure definitions for the parameters and results of the actual 1283b0f7467SBill Paul * NIS RPC calls. 1293b0f7467SBill Paul * 1303b0f7467SBill Paul * This is the standard result (in the protocol) of most of the nis 1313b0f7467SBill Paul * requests. 1323b0f7467SBill Paul */ 1333b0f7467SBill Paul 1343b0f7467SBill Paul struct nis_result { 1353b0f7467SBill Paul nis_error status; /* Status of the response */ 1363b0f7467SBill Paul nis_object objects<>; /* objects found */ 1373b0f7467SBill Paul netobj cookie; /* Cookie Data */ 1383b0f7467SBill Paul u_long zticks; /* server ticks */ 1393b0f7467SBill Paul u_long dticks; /* DBM ticks. */ 1403b0f7467SBill Paul u_long aticks; /* Cache (accel) ticks */ 1413b0f7467SBill Paul u_long cticks; /* Client ticks */ 1423b0f7467SBill Paul }; 1433b0f7467SBill Paul 1443b0f7467SBill Paul /* 1453b0f7467SBill Paul * A Name Service request 1463b0f7467SBill Paul * This request is used to access the name space, ns_name is the name 1473b0f7467SBill Paul * of the object within the namespace and the object is it's value, for 1483b0f7467SBill Paul * add/modify, a copy of the original for remove. 1493b0f7467SBill Paul */ 1503b0f7467SBill Paul 1513b0f7467SBill Paul struct ns_request { 1523b0f7467SBill Paul nis_name ns_name; /* Name in the NIS name space */ 1533b0f7467SBill Paul nis_object ns_object<1>; /* Optional Object (add/remove) */ 1543b0f7467SBill Paul }; 1553b0f7467SBill Paul 1563b0f7467SBill Paul /* 1573b0f7467SBill Paul * An information base request 1583b0f7467SBill Paul * This request includes the NIS name of the table we wish to search, the 1593b0f7467SBill Paul * search criteria in the form of attribute/value pairs and an optional 1603b0f7467SBill Paul * callback program number. If the callback program number is provided 1613b0f7467SBill Paul * the server will send back objects one at a time, otherwise it will 1623b0f7467SBill Paul * return them all in the response. 1633b0f7467SBill Paul */ 1643b0f7467SBill Paul 1653b0f7467SBill Paul struct ib_request { 1663b0f7467SBill Paul nis_name ibr_name; /* The name of the Table */ 1673b0f7467SBill Paul nis_attr ibr_srch<>; /* The search critereia */ 1683b0f7467SBill Paul u_long ibr_flags; /* Optional flags */ 1693b0f7467SBill Paul nis_object ibr_obj<1>; /* optional object (add/modify) */ 1703b0f7467SBill Paul nis_server ibr_cbhost<1>; /* Optional callback info */ 1713b0f7467SBill Paul u_long ibr_bufsize; /* Optional first/next bufsize */ 1723b0f7467SBill Paul netobj ibr_cookie; /* The first/next cookie */ 1733b0f7467SBill Paul }; 1743b0f7467SBill Paul 1753b0f7467SBill Paul /* 1763b0f7467SBill Paul * This argument to the PING call notifies the replicas that something in 1773b0f7467SBill Paul * a directory has changed and this is it's timestamp. The replica will use 1783b0f7467SBill Paul * the timestamp to determine if its resync operation was successful. 1793b0f7467SBill Paul */ 1803b0f7467SBill Paul struct ping_args { 1813b0f7467SBill Paul nis_name dir; /* Directory that had the change */ 1823b0f7467SBill Paul u_long stamp; /* timestamp of the transaction */ 1833b0f7467SBill Paul }; 1843b0f7467SBill Paul 1853b0f7467SBill Paul /* 1863b0f7467SBill Paul * These are the type of entries that are stored in the transaction log, 1873b0f7467SBill Paul * note that modifications will appear as two entries, for names, they have 1889d5abbddSJens Schweikhardt * an "OLD" entry followed by a "NEW" entry. For entries in tables, there 1893b0f7467SBill Paul * is a remove followed by an add. It is done this way so that we can read 1902f98c0baSUlrich Spörlein * the log backwards to back out transactions and forwards to propagate 1912f98c0baSUlrich Spörlein * updates. 1923b0f7467SBill Paul */ 1933b0f7467SBill Paul enum log_entry_t { 1943b0f7467SBill Paul LOG_NOP = 0, 1953b0f7467SBill Paul ADD_NAME = 1, /* Name Added to name space */ 1963b0f7467SBill Paul REM_NAME = 2, /* Name removed from name space */ 1973b0f7467SBill Paul MOD_NAME_OLD = 3, /* Name was modified in the name space */ 1983b0f7467SBill Paul MOD_NAME_NEW = 4, /* Name was modified in the name space */ 1993b0f7467SBill Paul ADD_IBASE = 5, /* Entry added to information base */ 2003b0f7467SBill Paul REM_IBASE = 6, /* Entry removed from information base */ 2013b0f7467SBill Paul MOD_IBASE = 7, /* Entry was modified in information base */ 2023b0f7467SBill Paul UPD_STAMP = 8 /* Update timestamp (used as fenceposts) */ 2033b0f7467SBill Paul }; 2043b0f7467SBill Paul 2053b0f7467SBill Paul /* 2063b0f7467SBill Paul * This result is returned from the name service when it is requested to 2073b0f7467SBill Paul * dump logged entries from its transaction log. Information base updates 2083b0f7467SBill Paul * will have the name of the information base in the le_name field and 2093b0f7467SBill Paul * a canonical set of attribute/value pairs to fully specify the entry's 2103b0f7467SBill Paul * 'name'. 2113b0f7467SBill Paul */ 2123b0f7467SBill Paul struct log_entry { 2133b0f7467SBill Paul u_long le_time; /* Time in seconds */ 2143b0f7467SBill Paul log_entry_t le_type; /* Type of log entry */ 2153b0f7467SBill Paul nis_name le_princp; /* Principal making the change */ 2163b0f7467SBill Paul nis_name le_name; /* Name of table/dir involved */ 2173b0f7467SBill Paul nis_attr le_attrs<>; /* List of AV pairs. */ 2183b0f7467SBill Paul nis_object le_object; /* Actual object value */ 2193b0f7467SBill Paul }; 2203b0f7467SBill Paul 2213b0f7467SBill Paul struct log_result { 2223b0f7467SBill Paul nis_error lr_status; /* The status itself */ 2233b0f7467SBill Paul netobj lr_cookie; /* Used by the dump callback */ 2243b0f7467SBill Paul log_entry lr_entries<>; /* zero or more entries */ 2253b0f7467SBill Paul }; 2263b0f7467SBill Paul 2273b0f7467SBill Paul struct cp_result { 2283b0f7467SBill Paul nis_error cp_status; /* Status of the checkpoint */ 2293b0f7467SBill Paul u_long cp_zticks; /* Service 'ticks' */ 2303b0f7467SBill Paul u_long cp_dticks; /* Database 'ticks' */ 2313b0f7467SBill Paul }; 2323b0f7467SBill Paul 2333b0f7467SBill Paul /* 2343b0f7467SBill Paul * This structure defines a generic NIS tag list. The taglist contains 2353b0f7467SBill Paul * zero or tags, each of which is a type and a value. (u_long). 2363b0f7467SBill Paul * These are used to report statistics (see tag definitions below) 2373b0f7467SBill Paul * and to set or reset state variables. 2383b0f7467SBill Paul */ 2393b0f7467SBill Paul struct nis_tag { 2403b0f7467SBill Paul u_long tag_type; /* Statistic tag (may vary) */ 2413b0f7467SBill Paul string tag_val<1024>; /* Statistic value may also vary */ 2423b0f7467SBill Paul }; 2433b0f7467SBill Paul 2443b0f7467SBill Paul struct nis_taglist { 2453b0f7467SBill Paul nis_tag tags<>; /* List of tags */ 2463b0f7467SBill Paul }; 2473b0f7467SBill Paul 2483b0f7467SBill Paul struct dump_args { 2493b0f7467SBill Paul nis_name da_dir; /* Directory to dump */ 2503b0f7467SBill Paul u_long da_time; /* From this timestamp */ 2513b0f7467SBill Paul nis_server da_cbhost<1>; /* Callback to use. */ 2523b0f7467SBill Paul }; 2533b0f7467SBill Paul 2543b0f7467SBill Paul struct fd_args { 2553b0f7467SBill Paul nis_name dir_name; /* The directory we're looking for */ 2563b0f7467SBill Paul nis_name requester; /* Host principal name for signature */ 2573b0f7467SBill Paul }; 2583b0f7467SBill Paul 2593b0f7467SBill Paul struct fd_result { 2603b0f7467SBill Paul nis_error status; /* Status returned by function */ 2613b0f7467SBill Paul nis_name source; /* Source of this answer */ 2623b0f7467SBill Paul opaque dir_data<>; /* Directory Data (XDR'ed) */ 2633b0f7467SBill Paul opaque signature<>; /* Signature of the source */ 2643b0f7467SBill Paul }; 2653b0f7467SBill Paul 2663b0f7467SBill Paul 2673b0f7467SBill Paul /* 2683b0f7467SBill Paul * What's going on here? Well, it's like this. When the service 2693b0f7467SBill Paul * is being compiled it wants to have the service definition specific 2703b0f7467SBill Paul * info included, and when the client is being compiled it wants that 2713b0f7467SBill Paul * info. This includes the appropriate file which was generated by 2723b0f7467SBill Paul * make in the protocols directory (probably /usr/include/rpcsvc). 2733b0f7467SBill Paul * 2749a01d32bSJeroen Ruigrok van der Werven * Uhm... guys? With RPC, you aren't supposed to have separate 2753b0f7467SBill Paul * server-specific and client-specific header files. You have one header 2763b0f7467SBill Paul * file that's suitable for both. If your code doesn't work using just 2773b0f7467SBill Paul * the one header file, I submit to you that it's broken. 2783b0f7467SBill Paul * -Bill 2793b0f7467SBill Paul */ 2803b0f7467SBill Paul #ifdef SUN_STUPIDITY 2813b0f7467SBill Paul #ifdef RPC_SVC 2823b0f7467SBill Paul %#include "nis_svc.h" 2833b0f7467SBill Paul #endif 2843b0f7467SBill Paul #ifdef RPC_CLNT 2853b0f7467SBill Paul %#include "nis_clnt.h" 2863b0f7467SBill Paul #endif 2873b0f7467SBill Paul #endif 2883b0f7467SBill Paul 2893b0f7467SBill Paul program NIS_PROG { 2903b0f7467SBill Paul 2913b0f7467SBill Paul /* RPC Language description of the NIS+ protocol */ 2923b0f7467SBill Paul version NIS_VERSION { 2933b0f7467SBill Paul /* The name service functions */ 2943b0f7467SBill Paul nis_result NIS_LOOKUP(ns_request) = 1; 2953b0f7467SBill Paul nis_result NIS_ADD(ns_request) = 2; 2963b0f7467SBill Paul nis_result NIS_MODIFY(ns_request) = 3; 2973b0f7467SBill Paul nis_result NIS_REMOVE(ns_request) = 4; 2983b0f7467SBill Paul 2993b0f7467SBill Paul /* The information base functions */ 3003b0f7467SBill Paul nis_result NIS_IBLIST(ib_request) = 5; 3013b0f7467SBill Paul nis_result NIS_IBADD(ib_request) = 6; 3023b0f7467SBill Paul nis_result NIS_IBMODIFY(ib_request) = 7; 3033b0f7467SBill Paul nis_result NIS_IBREMOVE(ib_request) = 8; 3043b0f7467SBill Paul nis_result NIS_IBFIRST(ib_request) = 9; 3053b0f7467SBill Paul nis_result NIS_IBNEXT(ib_request) = 10; 3063b0f7467SBill Paul 3073b0f7467SBill Paul /* NIS Administrative functions */ 3083b0f7467SBill Paul fd_result NIS_FINDDIRECTORY(fd_args) = 12; 3093b0f7467SBill Paul 3103b0f7467SBill Paul /* If fetch and optionally reset statistics */ 3113b0f7467SBill Paul nis_taglist NIS_STATUS(nis_taglist) = 14; 3123b0f7467SBill Paul 3133b0f7467SBill Paul /* Dump changes to directory since time in da_time */ 3143b0f7467SBill Paul log_result NIS_DUMPLOG(dump_args) = 15; 3153b0f7467SBill Paul 3163b0f7467SBill Paul /* Dump contents of directory named */ 3173b0f7467SBill Paul log_result NIS_DUMP(dump_args) = 16; 3183b0f7467SBill Paul 3193b0f7467SBill Paul /* Check status of callback thread */ 3203b0f7467SBill Paul bool NIS_CALLBACK(netobj) = 17; 3213b0f7467SBill Paul 3223b0f7467SBill Paul /* Return last update time for named dir */ 3233b0f7467SBill Paul u_long NIS_CPTIME(nis_name) = 18; 3243b0f7467SBill Paul 3253b0f7467SBill Paul /* Checkpoint directory or table named */ 3263b0f7467SBill Paul cp_result NIS_CHECKPOINT(nis_name) = 19; 3273b0f7467SBill Paul 3283b0f7467SBill Paul /* Send 'status changed' ping to replicates */ 3293b0f7467SBill Paul void NIS_PING(ping_args) = 20; 3303b0f7467SBill Paul 3313b0f7467SBill Paul /* Modify server behaviour (such as debugging) */ 3323b0f7467SBill Paul nis_taglist NIS_SERVSTATE(nis_taglist) = 21; 3333b0f7467SBill Paul 3343b0f7467SBill Paul /* Create a Directory */ 3353b0f7467SBill Paul nis_error NIS_MKDIR(nis_name) = 22; 3363b0f7467SBill Paul 3373b0f7467SBill Paul /* Remove a Directory */ 3383b0f7467SBill Paul nis_error NIS_RMDIR(nis_name) = 23; 3393b0f7467SBill Paul 3403b0f7467SBill Paul /* Update public keys of a directory object */ 3413b0f7467SBill Paul nis_error NIS_UPDKEYS(nis_name) = 24; 3423b0f7467SBill Paul } = 3; 3433b0f7467SBill Paul } = 100300; 3443b0f7467SBill Paul 3453b0f7467SBill Paul /* 3463b0f7467SBill Paul * Included below are the defines that become part of nis.h, 3473b0f7467SBill Paul * they are technically not part of the protocol, but do define 3483b0f7467SBill Paul * key aspects of the implementation and are therefore useful 3493b0f7467SBill Paul * in building a conforming server or client. 3503b0f7467SBill Paul */ 3513b0f7467SBill Paul #if RPC_HDR 3523b0f7467SBill Paul %/* 3533b0f7467SBill Paul % * Generic "hash" datastructures, used by all types of hashed data. 3543b0f7467SBill Paul % */ 3553b0f7467SBill Paul %struct nis_hash_data { 3563b0f7467SBill Paul % nis_name name; /* NIS name of hashed item */ 3573b0f7467SBill Paul % int keychain; /* It's hash key (for pop) */ 3583b0f7467SBill Paul % struct nis_hash_data *next; /* Hash collision pointer */ 3593b0f7467SBill Paul % struct nis_hash_data *prv_item; /* A serial, doubly linked list */ 3603b0f7467SBill Paul % struct nis_hash_data *nxt_item; /* of items in the hash table */ 3613b0f7467SBill Paul %}; 3623b0f7467SBill Paul %typedef struct nis_hash_data NIS_HASH_ITEM; 3633b0f7467SBill Paul % 3643b0f7467SBill Paul %struct nis_hash_table { 3653b0f7467SBill Paul % NIS_HASH_ITEM *keys[64]; /* A hash table of items */ 3663b0f7467SBill Paul % NIS_HASH_ITEM *first; /* The first "item" in serial list */ 3673b0f7467SBill Paul %}; 3683b0f7467SBill Paul %typedef struct nis_hash_table NIS_HASH_TABLE; 3693b0f7467SBill Paul % 3703b0f7467SBill Paul %/* Structure for storing dynamically allocated static data */ 3713b0f7467SBill Paul %struct nis_sdata { 3723b0f7467SBill Paul % void *buf; /* Memory allocation pointer */ 3733b0f7467SBill Paul % u_long size; /* Buffer size */ 3743b0f7467SBill Paul %}; 3753b0f7467SBill Paul % 3763b0f7467SBill Paul %/* Generic client creating flags */ 3773b0f7467SBill Paul %#define ZMH_VC 1 3783b0f7467SBill Paul %#define ZMH_DG 2 3793b0f7467SBill Paul %#define ZMH_AUTH 4 3803b0f7467SBill Paul % 3813b0f7467SBill Paul %/* Testing Access rights for objects */ 3823b0f7467SBill Paul % 3833b0f7467SBill Paul %#define NIS_READ_ACC 1 3843b0f7467SBill Paul %#define NIS_MODIFY_ACC 2 3853b0f7467SBill Paul %#define NIS_CREATE_ACC 4 3863b0f7467SBill Paul %#define NIS_DESTROY_ACC 8 3873b0f7467SBill Paul %/* Test macros. a == access rights, m == desired rights. */ 3883b0f7467SBill Paul %#define WORLD(a, m) (((a) & (m)) != 0) 3893b0f7467SBill Paul %#define GROUP(a, m) (((a) & ((m) << 8)) != 0) 3903b0f7467SBill Paul %#define OWNER(a, m) (((a) & ((m) << 16)) != 0) 3913b0f7467SBill Paul %#define NOBODY(a, m) (((a) & ((m) << 24)) != 0) 3923b0f7467SBill Paul % 3933b0f7467SBill Paul %#define OATYPE(d, n) (((d)->do_armask.do_armask_val+n)->oa_otype) 3943b0f7467SBill Paul %#define OARIGHTS(d, n) (((d)->do_armask.do_armask_val+n)->oa_rights) 3953b0f7467SBill Paul %#define WORLD_DEFAULT (NIS_READ_ACC) 3963b0f7467SBill Paul %#define GROUP_DEFAULT (NIS_READ_ACC << 8) 397*7cec355bSBaptiste Daroussin %#define OWNER_DEFAULT ((NIS_READ_ACC + NIS_MODIFY_ACC + NIS_CREATE_ACC + NIS_DESTROY_ACC) << 16) 3983b0f7467SBill Paul %#define DEFAULT_RIGHTS (WORLD_DEFAULT | GROUP_DEFAULT | OWNER_DEFAULT) 3993b0f7467SBill Paul % 4003b0f7467SBill Paul %/* Result manipulation defines ... */ 4013b0f7467SBill Paul %#define NIS_RES_NUMOBJ(x) ((x)->objects.objects_len) 4023b0f7467SBill Paul %#define NIS_RES_OBJECT(x) ((x)->objects.objects_val) 4033b0f7467SBill Paul %#define NIS_RES_COOKIE(x) ((x)->cookie) 4043b0f7467SBill Paul %#define NIS_RES_STATUS(x) ((x)->status) 4053b0f7467SBill Paul % 4063b0f7467SBill Paul %/* These defines make getting at the variant part of the object easier. */ 4073b0f7467SBill Paul %#define TA_data zo_data.objdata_u.ta_data 4083b0f7467SBill Paul %#define EN_data zo_data.objdata_u.en_data 4093b0f7467SBill Paul %#define DI_data zo_data.objdata_u.di_data 4103b0f7467SBill Paul %#define LI_data zo_data.objdata_u.li_data 4113b0f7467SBill Paul %#define GR_data zo_data.objdata_u.gr_data 4123b0f7467SBill Paul % 4133b0f7467SBill Paul %#define __type_of(o) ((o)->zo_data.zo_type) 4143b0f7467SBill Paul % 4153b0f7467SBill Paul %/* Declarations for the internal subroutines in nislib.c */ 4163b0f7467SBill Paul %enum name_pos {SAME_NAME, HIGHER_NAME, LOWER_NAME, NOT_SEQUENTIAL, BAD_NAME}; 4173b0f7467SBill Paul %typedef enum name_pos name_pos; 4183b0f7467SBill Paul % 4193b0f7467SBill Paul %/* 4203b0f7467SBill Paul % * Defines for getting at column data in entry objects. Because RPCGEN 4213b0f7467SBill Paul % * generates some rather wordy structures, we create some defines that 4223b0f7467SBill Paul % * collapse the needed keystrokes to access a particular value using 4233b0f7467SBill Paul % * these definitions they take an nis_object *, and an int and return 4243b0f7467SBill Paul % * a u_char * for Value, and an int for length. 4253b0f7467SBill Paul % */ 426*7cec355bSBaptiste Daroussin %#define ENTRY_VAL(obj, col) (obj)->EN_data.en_cols.en_cols_val[col].ec_value.ec_value_val 427*7cec355bSBaptiste Daroussin %#define ENTRY_LEN(obj, col) (obj)->EN_data.en_cols.en_cols_val[col].ec_value.ec_value_len 4283b0f7467SBill Paul % 4293b0f7467SBill Paul %#ifdef __cplusplus 4303b0f7467SBill Paul %} 4313b0f7467SBill Paul %#endif 4323b0f7467SBill Paul % 4333b0f7467SBill Paul %/* Prototypes, and extern declarations for the NIS library functions. */ 4343b0f7467SBill Paul %#include <rpcsvc/nislib.h> 4353b0f7467SBill Paul %#endif /* __NIS_RPCGEN_H */ 4363b0f7467SBill Paul %/* EDIT_START */ 4373b0f7467SBill Paul % 4383b0f7467SBill Paul %/* 4393b0f7467SBill Paul % * nis_3.h 4403b0f7467SBill Paul % * 4413b0f7467SBill Paul % * This file contains definitions that are only of interest to the actual 4423b0f7467SBill Paul % * service daemon and client stubs. Normal users of NIS will not include 4433b0f7467SBill Paul % * this file. 4443b0f7467SBill Paul % * 4453b0f7467SBill Paul % * NOTE : This include file is automatically created by a combination 4463b0f7467SBill Paul % * of rpcgen and sed. DO NOT EDIT IT, change the nis.x file instead 4473b0f7467SBill Paul % * and then remake this file. 4483b0f7467SBill Paul % */ 4493b0f7467SBill Paul %#ifndef __nis_3_h 4503b0f7467SBill Paul %#define __nis_3_h 4513b0f7467SBill Paul %#ifdef __cplusplus 4523b0f7467SBill Paul %extern "C" { 4533b0f7467SBill Paul %#endif 4543b0f7467SBill Paul #endif 455