4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License"). You may not use this file except in compliance
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
23 * Copyright 1997 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
27 #pragma ident "%Z%%M% %I% %E% SMI"
30 * This file contains symbols and structures defining the rpc protocol
31 * between the NIS clients and the NIS servers. The servers
32 * are the NIS database servers, and the NIS binders.
36 * The following procedures are supported by the protocol:
38 * YPPROC_NULL() returns () takes nothing, returns nothing. This indicates
39 * that the NIS server is alive.
41 * YPPROC_DOMAIN (char *) returns (bool_t) TRUE. Indicates that the
42 * responding NIS server does serve the named domain; FALSE indicates no
45 * YPPROC_DOMAIN_NONACK (char *) returns (TRUE) if the NIS server does serve
46 * the named domain, otherwise does not return. Used in the broadcast case.
48 * YPPROC_MATCH (struct ypreq_key) returns (struct ypresp_val). Returns the
49 * right-hand value for a passed left-hand key, within a named map and
52 * YPPROC_FIRST (struct ypreq_nokey) returns (struct ypresp_key_val).
53 * Returns the first key-value pair from a named domain and map.
55 * YPPROC_NEXT (struct ypreq_key) returns (struct ypresp_key_val). Returns
56 * the key-value pair following a passed key-value pair within a named
59 * YPPROC_XFR (struct ypreq_xfr) returns nothing. Indicates to a server that
60 * a map should be updated.
62 * YPPROC_CLEAR takes nothing, returns nothing. Instructs a NIS server to
63 * close the current map, so that old versions of the disk file don't get
66 * YPPROC_ALL (struct ypreq_nokey), returns
67 * union switch (bool more) {
68 * TRUE: (struct ypresp_key_val);
72 * YPPROC_MASTER (struct ypreq_nokey), returns (ypresp_master)
74 * YPPROC_ORDER (struct ypreq_nokey), returns (ypresp_order)
76 * YPPROC_MAPLIST (char *), returns (struct ypmaplist *)
79 typedef unsigned int bool;
83 extern bool xdr_datum();
84 extern bool xdr_ypdomain_wrap_string();
85 extern bool xdr_ypmap_wrap_string();
86 extern bool xdr_ypreq_key();
87 extern bool xdr_ypreq_nokey();
88 extern bool xdr_ypreq_xfr();
89 extern bool xdr_ypresp_val();
90 extern bool xdr_ypresp_key_val();
91 extern bool xdr_ypbind_resp();
92 extern bool xdr_ypbind_setdom();
93 extern bool xdr_yp_inaddr();
94 extern bool xdr_ypmap_parms();
95 extern bool xdr_ypowner_wrap_string();
96 extern bool xdr_yppushresp_xfr();
97 extern bool xdr_ypresp_order();
98 extern bool xdr_ypresp_master();
99 extern bool xdr_ypall();
100 extern bool xdr_ypresp_maplist();
102 /* Program and version symbols, magic numbers */
104 #define YPPROG ((u_long)100004)
105 #define YPVERS ((u_long)2)
106 #define YPVERS_ORIG ((u_long)1)
107 #define YPMAXRECORD ((u_long)1024)
108 #define YPMAXDOMAIN ((u_long)256)
109 #define YPMAXMAP ((u_long)64)
110 #define YPMAXPEER ((u_long)256)
112 /* byte size of a large NIS packet */
124 char *domain
; /* Null string means not available */
125 char *map
; /* Null string means not available */
126 unsigned long int ordernum
; /* 0 means not available */
127 char *owner
; /* Null string means not available */
131 * Request parameter structures
146 struct ypmap_parms map_parms
;
147 unsigned long transid
;
151 #define ypxfr_domain map_parms.domain
152 #define ypxfr_map map_parms.map
153 #define ypxfr_ordernum map_parms.ordernum
154 #define ypxfr_owner map_parms.owner
157 * Response parameter structures
161 long unsigned status
;
165 struct ypresp_key_val
{
166 long unsigned status
;
171 struct ypresp_master
{
172 long unsigned status
;
176 struct ypresp_order
{
177 long unsigned status
;
178 unsigned long int ordernum
;
182 char ypml_name
[YPMAXMAP
+ 1];
183 struct ypmaplist
*ypml_next
;
186 struct ypresp_maplist
{
187 long unsigned status
;
188 struct ypmaplist
*list
;
192 * Procedure symbols. YPPROC_NULL, YPPROC_DOMAIN, and YPPROC_DOMAIN_NONACK
193 * must keep the same values (0, 1, and 2) that they had in the first version
197 #define YPPROC_NULL ((u_long)0)
198 #define YPPROC_DOMAIN ((u_long)1)
199 #define YPPROC_DOMAIN_NONACK ((u_long)2)
200 #define YPPROC_MATCH ((u_long)3)
201 #define YPPROC_FIRST ((u_long)4)
202 #define YPPROC_NEXT ((u_long)5)
203 #define YPPROC_XFR ((u_long)6)
204 #define YPPROC_CLEAR ((u_long)7)
205 #define YPPROC_ALL ((u_long)8)
206 #define YPPROC_MASTER ((u_long)9)
207 #define YPPROC_ORDER ((u_long)10)
208 #define YPPROC_MAPLIST ((u_long)11)
210 /* Return status values */
212 #define YP_TRUE ((long)1) /* General purpose success code */
213 #define YP_NOMORE ((long)2) /* No more entries in map */
214 #define YP_FALSE ((long)0) /* General purpose failure code */
215 #define YP_NOMAP ((long)-1) /* No such map in domain */
216 #define YP_NODOM ((long)-2) /* Domain not supported */
217 #define YP_NOKEY ((long)-3) /* No such key in map */
218 #define YP_BADOP ((long)-4) /* Invalid operation */
219 #define YP_BADDB ((long)-5) /* Server data base is bad */
220 #define YP_YPERR ((long)-6) /* NIS server error */
221 #define YP_BADARGS ((long)-7) /* Request arguments bad */
222 #define YP_VERS ((long)-8) /* NIS server version mismatch - server
223 * can't supply requested service. */
226 * Domain binding data structure, used by ypclnt package and ypserv modules.
227 * Users of the ypclnt package (or of this protocol) don't HAVE to know about
228 * it, but it must be available to users because _yp_dobind is a public
233 struct dom_binding
*dom_pnext
;
234 char dom_domain
[YPMAXDOMAIN
+ 1];
235 struct sockaddr_in dom_server_addr
;
236 unsigned short int dom_server_port
;
239 unsigned short int dom_local_port
;
245 * Protocol between clients and NIS binder servers
249 * The following procedures are supported by the protocol:
251 * YPBINDPROC_NULL() returns ()
252 * takes nothing, returns nothing
254 * YPBINDPROC_DOMAIN takes (char *) returns (struct ypbind_resp)
256 * YPBINDPROC_SETDOM takes (struct ypbind_setdom) returns nothing
259 /* Program and version symbols, magic numbers */
261 #define YPBINDPROG ((u_long)100007)
262 #define YPBINDVERS ((u_long)2)
263 #define YPBINDVERS_ORIG ((u_long)1)
265 /* Procedure symbols */
267 #define YPBINDPROC_NULL ((u_long)0)
268 #define YPBINDPROC_DOMAIN ((u_long)1)
269 #define YPBINDPROC_SETDOM ((u_long)2)
271 * Response structure and overall result status codes. Success and failure
272 * represent two separate response message types.
275 enum ypbind_resptype
{YPBIND_SUCC_VAL
= 1, YPBIND_FAIL_VAL
= 2};
277 struct ypbind_binding
{
278 struct in_addr ypbind_binding_addr
; /* In network order */
279 unsigned short int ypbind_binding_port
; /* In network order */
282 enum ypbind_resptype ypbind_status
;
284 unsigned long ypbind_error
;
285 struct ypbind_binding ypbind_bindinfo
;
290 /* Detailed failure reason codes for response field ypbind_error*/
292 #define YPBIND_ERR_ERR 1 /* Internal error */
293 #define YPBIND_ERR_NOSERV 2 /* No bound server for passed domain */
294 #define YPBIND_ERR_RESC 3 /* System resource allocation failure */
297 * Request data structure for ypbind "Set domain" procedure.
299 struct ypbind_setdom
{
300 char ypsetdom_domain
[YPMAXDOMAIN
+ 1];
301 struct ypbind_binding ypsetdom_binding
;
302 unsigned short ypsetdom_vers
;
304 #define ypsetdom_addr ypsetdom_binding.ypbind_binding_addr
305 #define ypsetdom_port ypsetdom_binding.ypbind_binding_port
308 * Protocol between clients (ypxfr, only) and yppush
309 * yppush speaks a protocol in the transient range, which
310 * is supplied to ypxfr as a command-line parameter when it
311 * is activated by ypserv.
313 #define YPPUSHVERS ((u_long) 1)
314 #define YPPUSHVERS_ORIG ((u_long)1)
316 /* Procedure symbols */
318 #define YPPUSHPROC_NULL ((u_long)0)
319 #define YPPUSHPROC_XFRRESP ((u_long)1)
321 struct yppushresp_xfr
{
322 unsigned long transid
;
323 unsigned long status
;
326 /* Status values for yppushresp_xfr.status */
328 #define YPPUSH_SUCC ((long)1) /* Success */
329 #define YPPUSH_AGE ((long)2) /* Master's version not newer */
330 #define YPPUSH_NOMAP ((long)-1) /* Can't find server for map */
331 #define YPPUSH_NODOM ((long)-2) /* Domain not supported */
332 #define YPPUSH_RSRC ((long)-3) /* Local resouce alloc failure */
333 #define YPPUSH_RPC ((long)-4) /* RPC failure talking to server */
334 #define YPPUSH_MADDR ((long)-5) /* Can't get master address */
335 #define YPPUSH_YPERR ((long)-6) /* NIS server/map db error */
336 #define YPPUSH_BADARGS ((long)-7) /* Request arguments bad */
337 #define YPPUSH_DBM ((long)-8) /* Local dbm operation failed */
338 #define YPPUSH_FILE ((long)-9) /* Local file I/O operation failed */
339 #define YPPUSH_SKEW ((long)-10) /* Map version skew during transfer */
340 #define YPPUSH_CLEAR ((long)-11) /* Can't send "Clear" req to local
342 #define YPPUSH_FORCE ((long)-12) /* No local order number in map -
344 #define YPPUSH_XFRERR ((long)-13) /* ypxfr error */
345 #define YPPUSH_REFUSED ((long)-14) /* Transfer request refused by ypserv */