2 * This file contains symbols and structures defining the rpc protocol
3 * between the NIS clients and the NIS servers. The servers
4 * are the NIS database servers, and the NIS binders.
7 #ifndef _RPCSVC_YP_PROT_H
8 #define _RPCSVC_YP_PROT_H
13 #include <rpcsvc/ypclnt.h>
18 * The following procedures are supported by the protocol:
20 * YPPROC_NULL() returns () takes nothing, returns nothing. This indicates
21 * that the NIS server is alive.
23 * YPPROC_DOMAIN (char *) returns (bool_t) TRUE. Indicates that the
24 * responding NIS server does serve the named domain; FALSE indicates no
27 * YPPROC_DOMAIN_NONACK (char *) returns (TRUE) if the NIS server does serve
28 * the named domain, otherwise does not return. Used in the broadcast case.
30 * YPPROC_MATCH (struct ypreq_key) returns (struct ypresp_val). Returns the
31 * right-hand value for a passed left-hand key, within a named map and
34 * YPPROC_FIRST (struct ypreq_nokey) returns (struct ypresp_key_val).
35 * Returns the first key-value pair from a named domain and map.
37 * YPPROC_NEXT (struct ypreq_key) returns (struct ypresp_key_val). Returns
38 * the key-value pair following a passed key-value pair within a named
41 * YPPROC_XFR (struct ypreq_xfr) returns nothing. Indicates to a server that
42 * a map should be updated.
44 * YPPROC_CLEAR takes nothing, returns nothing. Instructs a NIS server to
45 * close the current map, so that old versions of the disk file don't get
48 * YPPROC_ALL (struct ypreq_nokey), returns
49 * union switch (bool_t more) {
50 * TRUE: (struct ypresp_key_val);
54 * YPPROC_MASTER (struct ypreq_nokey), returns (ypresp_master)
56 * YPPROC_ORDER (struct ypreq_nokey), returns (ypresp_order)
58 * YPPROC_MAPLIST (char *), returns (struct ypmaplist *)
61 /* Program and version symbols, magic numbers */
66 #define YPMAXRECORD 1024
67 #define YPMAXDOMAIN 64 /* XXX orig. yp_prot.h defines 256 */
69 #define YPMAXPEER 64 /* XXX orig. yp_prot.h defines 256 */
71 /* byte size of a large NIS packet */
85 char *domain; /* Null string means not available */
86 char *map; /* Null string means not available */
87 unsigned int ordernum; /* 0 means not available */
88 char *owner; /* Null string means not available */
92 * Request parameter structures
107 struct ypmap_parms map_parms;
113 #define ypxfr_domain map_parms.domain
114 #define ypxfr_map map_parms.map
115 #define ypxfr_ordernum map_parms.ordernum
116 #define ypxfr_owner map_parms.owner
118 /* Return status values */
121 YP_TRUE = 1, /* General purpose success code */
122 #define YP_TRUE YP_TRUE
123 YP_NOMORE = 2, /* No more entries in map */
124 #define YP_NOMORE YP_NOMORE
125 YP_FALSE = 0, /* General purpose failure code */
126 #define YP_FALSE YP_FALSE
127 YP_NOMAP = -1, /* No such map in domain */
128 #define YP_NOMAP YP_NOMAP
129 YP_NODOM = -2, /* Domain not supported */
130 #define YP_NODOM YP_NODOM
131 YP_NOKEY = -3, /* No such key in map */
132 #define YP_NOKEY YP_NOKEY
133 YP_BADOP = -4, /* Invalid operation */
134 #define YP_BADOP YP_BADOP
135 YP_BADDB = -5, /* Server data base is bad */
136 #define YP_BADDB YP_BADDB
137 YP_YPERR = -6, /* NIS server error */
138 #define YP_YPERR YP_YPERR
139 YP_BADARGS = -7, /* Request arguments bad */
140 #define YP_BADARGS YP_BADARGS
141 YP_VERS = -8, /* NIS server version mismatch - server can't supply
142 requested service. */
143 #define YP_VERS YP_VERS
147 * Response parameter structures
150 typedef enum ypstat ypstat;
157 struct ypresp_key_val {
159 #ifdef STUPID_SUN_BUG
160 /* This is the form as distributed by Sun. But even the Sun NIS
161 servers expect the values in the other order. So their
162 implementation somehow must change the order internally. We
163 don't want to follow this bad example since the user should be
164 able to use rpcgen on this file. */
173 struct ypresp_master {
178 struct ypresp_order {
185 #define ypml_name map
186 struct ypmaplist *next;
187 #define ypml_next next
190 struct ypresp_maplist {
192 struct ypmaplist *list;
196 * Procedure symbols. YPPROC_NULL, YPPROC_DOMAIN, and YPPROC_DOMAIN_NONACK
197 * must keep the same values (0, 1, and 2) that they had in the first version
201 #define YPPROC_NULL 0
202 #define YPPROC_DOMAIN 1
203 #define YPPROC_DOMAIN_NONACK 2
204 #define YPPROC_MATCH 3
205 #define YPPROC_FIRST 4
206 #define YPPROC_NEXT 5
208 #define YPPROC_CLEAR 7
210 #define YPPROC_MASTER 9
211 #define YPPROC_ORDER 10
212 #define YPPROC_MAPLIST 11
213 #define YPPROC_NEWXFR 12
216 * Protocol between clients and NIS binder servers
220 * The following procedures are supported by the protocol:
222 * YPBINDPROC_NULL() returns ()
223 * takes nothing, returns nothing
225 * YPBINDPROC_DOMAIN takes (char *) returns (struct ypbind_resp)
227 * YPBINDPROC_SETDOM takes (struct ypbind_setdom) returns nothing
230 /* Program and version symbols, magic numbers */
232 #define YPBINDPROG 100007
234 #define YPBINDVERS_ORIG 1
236 /* Procedure symbols */
238 #define YPBINDPROC_NULL 0
239 #define YPBINDPROC_DOMAIN 1
240 #define YPBINDPROC_SETDOM 2
242 * Response structure and overall result status codes. Success and failure
243 * represent two separate response message types.
246 enum ypbind_resptype {YPBIND_SUCC_VAL = 1, YPBIND_FAIL_VAL = 2};
248 struct ypbind_binding {
249 struct in_addr ypbind_binding_addr; /* In network order */
250 unsigned short int ypbind_binding_port; /* In network order */
254 enum ypbind_resptype ypbind_status;
257 struct ypbind_binding ypbind_bindinfo;
262 /* Detailed failure reason codes for response field ypbind_error*/
264 #define YPBIND_ERR_ERR 1 /* Internal error */
265 #define YPBIND_ERR_NOSERV 2 /* No bound server for passed domain */
266 #define YPBIND_ERR_RESC 3 /* System resource allocation failure */
269 * Request data structure for ypbind "Set domain" procedure.
271 struct ypbind_setdom {
272 char *ypsetdom_domain;
273 struct ypbind_binding ypsetdom_binding;
276 #define ypsetdom_addr ypsetdom_binding.ypbind_binding_addr
277 #define ypsetdom_port ypsetdom_binding.ypbind_binding_port
280 * Protocol between clients (ypxfr, only) and yppush
281 * yppush speaks a protocol in the transient range, which
282 * is supplied to ypxfr as a command-line parameter when it
283 * is activated by ypserv.
286 #define YPPUSHVERS_ORIG 1
288 /* Procedure symbols */
290 #define YPPUSHPROC_NULL 0
291 #define YPPUSHPROC_XFRRESP 1
293 /* Status values for yppushresp_xfr.status */
296 YPPUSH_SUCC = 1, /* Success */
297 #define YPPUSH_SUCC YPPUSH_SUCC
298 YPPUSH_AGE = 2, /* Master's version not newer */
299 #define YPPUSH_AGE YPPUSH_AGE
300 YPPUSH_NOMAP = -1, /* Can't find server for map */
301 #define YPPUSH_NOMAP YPPUSH_NOMAP
302 YPPUSH_NODOM = -2, /* Domain not supported */
303 #define YPPUSH_NODOM YPPUSH_NODOM
304 YPPUSH_RSRC = -3, /* Local resouce alloc failure */
305 #define YPPUSH_RSRC YPPUSH_RSRC
306 YPPUSH_RPC = -4, /* RPC failure talking to server */
307 #define YPPUSH_RPC YPPUSH_RPC
308 YPPUSH_MADDR = -5, /* Can't get master address */
309 #define YPPUSH_MADDR YPPUSH_MADDR
310 YPPUSH_YPERR = -6, /* NIS server/map db error */
311 #define YPPUSH_YPERR YPPUSH_YPERR
312 YPPUSH_BADARGS = -7, /* Request arguments bad */
313 #define YPPUSH_BADARGS YPPUSH_BADARGS
314 YPPUSH_DBM = -8, /* Local dbm operation failed */
315 #define YPPUSH_DBM YPPUSH_DBM
316 YPPUSH_FILE = -9, /* Local file I/O operation failed */
317 #define YPPUSH_FILE YPPUSH_FILE
318 YPPUSH_SKEW = -10, /* Map version skew during transfer */
319 #define YPPUSH_SKEW YPPUSH_SKEW
320 YPPUSH_CLEAR = -11, /* Can't send "Clear" req to local ypserv */
321 #define YPPUSH_CLEAR YPPUSH_CLEAR
322 YPPUSH_FORCE = -12, /* No local order number in map - use -f flag*/
323 #define YPPUSH_FORCE YPPUSH_FORCE
324 YPPUSH_XFRERR = -13, /* ypxfr error */
325 #define YPPUSH_XFRERR YPPUSH_XFRERR
326 YPPUSH_REFUSED = -14, /* Transfer request refused by ypserv */
327 #define YPPUSH_REFUSED YPPUSH_REFUSED
328 YPPUSH_NOALIAS = -15 /* Alias not found for map or domain */
329 #define YPPUSH_NOALIAS YPPUSH_NOALIAS
331 typedef enum yppush_status yppush_status;
333 struct yppushresp_xfr {
335 yppush_status status;
341 struct ypresp_key_val val;
345 extern bool_t xdr_ypreq_key (XDR *__xdrs, struct ypreq_key * __objp);
346 extern bool_t xdr_ypreq_nokey (XDR *__xdrs, struct ypreq_nokey * __objp);
347 extern bool_t xdr_ypreq_xfr (XDR *__xdrs, struct ypreq_xfr * __objp);
348 extern bool_t xdr_ypresp_val (XDR *__xdrs, struct ypresp_val * __objp);
349 extern bool_t xdr_ypresp_key_val (XDR *__xdrs, struct ypresp_key_val * __objp);
350 extern bool_t xdr_ypbind_resp (XDR *__xdrs, struct ypbind_resp * __objp);
351 extern bool_t xdr_ypbind_setdom (XDR *__xdrs, struct ypbind_setdom * __objp);
352 extern bool_t xdr_ypmap_parms (XDR *__xdrs, struct ypmap_parms * __objp);
353 extern bool_t xdr_yppushresp_xfr (XDR *__xdrs, struct yppushresp_xfr * __objp);
354 extern bool_t xdr_ypresp_order (XDR *__xdrs, struct ypresp_order * __objp);
355 extern bool_t xdr_ypresp_master (XDR *__xdrs, struct ypresp_master * __objp);
356 extern bool_t xdr_ypall (XDR *__xdrs, struct ypall_callback * __objp);
357 extern bool_t xdr_ypresp_maplist (XDR *__xdrs, struct ypresp_maplist * __objp);
358 extern bool_t xdr_ypbind_binding (XDR *__xdrs, struct ypbind_binding * __objp);
359 extern bool_t xdr_ypbind_resptype (XDR *__xdrs, enum ypbind_resptype * __objp);
360 extern bool_t xdr_ypstat (XDR *__xdrs, enum ypbind_resptype * __objp);
361 extern bool_t xdr_ypresp_all (XDR *__xdrs, struct ypresp_all * __objp);
362 extern bool_t xdr_domainname (XDR *__xdrs, char ** __objp);
366 #endif /* _RPCSVC_YP_PROT_H */