update from main archive 970203
[glibc.git] / nis / rpcsvc / yp_prot.h
blob0c5a7101f71b191c4ae16cb3c144432afebd5e41
1 /*
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.
5 */
7 #ifndef _RPCSVC_YP_PROT_H
8 #define _RPCSVC_YP_PROT_H
10 #include <features.h>
12 #include <rpc/rpc.h>
13 #include <rpcsvc/ypclnt.h>
16 * The following procedures are supported by the protocol:
18 * YPPROC_NULL() returns () takes nothing, returns nothing. This indicates
19 * that the NIS server is alive.
21 * YPPROC_DOMAIN (char *) returns (bool_t) TRUE. Indicates that the
22 * responding NIS server does serve the named domain; FALSE indicates no
23 * support.
25 * YPPROC_DOMAIN_NONACK (char *) returns (TRUE) if the NIS server does serve
26 * the named domain, otherwise does not return. Used in the broadcast case.
28 * YPPROC_MATCH (struct ypreq_key) returns (struct ypresp_val). Returns the
29 * right-hand value for a passed left-hand key, within a named map and
30 * domain.
32 * YPPROC_FIRST (struct ypreq_nokey) returns (struct ypresp_key_val).
33 * Returns the first key-value pair from a named domain and map.
35 * YPPROC_NEXT (struct ypreq_key) returns (struct ypresp_key_val). Returns
36 * the key-value pair following a passed key-value pair within a named
37 * domain and map.
39 * YPPROC_XFR (struct ypreq_xfr) returns nothing. Indicates to a server that
40 * a map should be updated.
42 * YPPROC_CLEAR takes nothing, returns nothing. Instructs a NIS server to
43 * close the current map, so that old versions of the disk file don't get
44 * held open.
46 * YPPROC_ALL (struct ypreq_nokey), returns
47 * union switch (bool_t more) {
48 * TRUE: (struct ypresp_key_val);
49 * FALSE: (struct) {};
50 * }
52 * YPPROC_MASTER (struct ypreq_nokey), returns (ypresp_master)
54 * YPPROC_ORDER (struct ypreq_nokey), returns (ypresp_order)
56 * YPPROC_MAPLIST (char *), returns (struct ypmaplist *)
59 /* Program and version symbols, magic numbers */
61 #define YPPROG ((u_long)100004)
62 #define YPVERS ((u_long)2)
63 #define YPVERS_ORIG ((u_long)1)
64 #define YPMAXRECORD 1024
65 #define YPMAXDOMAIN 64 /* XXX orig. yp_prot.h defines ((u_long)256) */
66 #define YPMAXMAP 64
67 #define YPMAXPEER 64 /* XXX orig. yp_prot.h defines ((u_long)256) */
69 /* byte size of a large NIS packet */
70 #define YPMSGSZ 1600
72 typedef struct {
73 u_int keydat_len;
74 char *keydat_val;
75 } keydat;
77 typedef struct {
78 u_int valdat_len;
79 char *valdat_val;
80 } valdat;
82 struct ypmap_parms {
83 char *domain; /* Null string means not available */
84 char *map; /* Null string means not available */
85 unsigned int ordernum; /* 0 means not available */
86 char *owner; /* Null string means not available */
90 * Request parameter structures
93 struct ypreq_key {
94 const char *domain;
95 const char *map;
96 keydat keydat;
99 struct ypreq_nokey {
100 char *domain;
101 char *map;
104 struct ypreq_xfr {
105 struct ypmap_parms map_parms;
106 u_int transid;
107 u_int proto;
108 u_int port;
111 #define ypxfr_domain map_parms.domain
112 #define ypxfr_map map_parms.map
113 #define ypxfr_ordernum map_parms.ordernum
114 #define ypxfr_owner map_parms.owner
116 /* Return status values */
118 enum ypstat {
119 YP_TRUE = 1, /* General purpose success code */
120 #define YP_TRUE YP_TRUE
121 YP_NOMORE = 2, /* No more entries in map */
122 #define YP_NOMORE YP_NOMORE
123 YP_FALSE = 0, /* General purpose failure code */
124 #define YP_FALSE YP_FALSE
125 YP_NOMAP = -1, /* No such map in domain */
126 #define YP_NOMAP YP_NOMAP
127 YP_NODOM = -2, /* Domain not supported */
128 #define YP_NODOM YP_NODOM
129 YP_NOKEY = -3, /* No such key in map */
130 #define YP_NOKEY YP_NOKEY
131 YP_BADOP = -4, /* Invalid operation */
132 #define YP_BADOP YP_BADOP
133 YP_BADDB = -5, /* Server data base is bad */
134 #define YP_BADDB YP_BADDB
135 YP_YPERR = -6, /* NIS server error */
136 #define YP_YPERR YP_YPERR
137 YP_BADARGS = -7, /* Request arguments bad */
138 #define YP_BADARGS YP_BADARGS
139 YP_VERS = -8, /* NIS server version mismatch - server can't supply
140 requested service. */
141 #define YP_VERS YP_VERS
145 * Response parameter structures
148 typedef enum ypstat ypstat;
150 struct ypresp_val {
151 ypstat status;
152 valdat valdat;
155 struct ypresp_key_val {
156 ypstat status;
157 #ifdef STUPID_SUN_BUG
158 /* This is the form as distributed by Sun. But even the Sun NIS
159 servers expect the values in the other order. So their
160 implementation somehow must change the order internally. We
161 don't want to follow this bad example since the user should be
162 able to use rpcgen on this file. */
163 keydat key;
164 valdat val;
165 #else
166 valdat val;
167 keydat key;
168 #endif
171 struct ypresp_master {
172 ypstat status;
173 char *master;
176 struct ypresp_order {
177 ypstat status;
178 u_int ordernum;
181 struct ypmaplist {
182 char *map;
183 #define ypml_name map
184 struct ypmaplist *next;
185 #define ypml_next next
188 struct ypresp_maplist {
189 ypstat status;
190 struct ypmaplist *list;
194 * Procedure symbols. YPPROC_NULL, YPPROC_DOMAIN, and YPPROC_DOMAIN_NONACK
195 * must keep the same values (0, 1, and 2) that they had in the first version
196 * of the protocol.
199 #define YPPROC_NULL ((u_long)0)
200 #define YPPROC_DOMAIN ((u_long)1)
201 #define YPPROC_DOMAIN_NONACK ((u_long)2)
202 #define YPPROC_MATCH ((u_long)3)
203 #define YPPROC_FIRST ((u_long)4)
204 #define YPPROC_NEXT ((u_long)5)
205 #define YPPROC_XFR ((u_long)6)
206 #define YPPROC_CLEAR ((u_long)7)
207 #define YPPROC_ALL ((u_long)8)
208 #define YPPROC_MASTER ((u_long)9)
209 #define YPPROC_ORDER ((u_long)10)
210 #define YPPROC_MAPLIST ((u_long)11)
211 #define YPPROC_NEWXFR ((u_long)12)
214 * Protocol between clients and NIS binder servers
218 * The following procedures are supported by the protocol:
220 * YPBINDPROC_NULL() returns ()
221 * takes nothing, returns nothing
223 * YPBINDPROC_DOMAIN takes (char *) returns (struct ypbind_resp)
225 * YPBINDPROC_SETDOM takes (struct ypbind_setdom) returns nothing
228 /* Program and version symbols, magic numbers */
230 #define YPBINDPROG ((u_long)100007)
231 #define YPBINDVERS ((u_long)2)
232 #define YPBINDVERS_ORIG ((u_long)1)
234 /* Procedure symbols */
236 #define YPBINDPROC_NULL ((u_long)0)
237 #define YPBINDPROC_DOMAIN ((u_long)1)
238 #define YPBINDPROC_SETDOM ((u_long)2)
240 * Response structure and overall result status codes. Success and failure
241 * represent two separate response message types.
244 enum ypbind_resptype {YPBIND_SUCC_VAL = 1, YPBIND_FAIL_VAL = 2};
246 struct ypbind_binding {
247 struct in_addr ypbind_binding_addr; /* In network order */
248 unsigned short int ypbind_binding_port; /* In network order */
251 struct ypbind_resp {
252 enum ypbind_resptype ypbind_status;
253 union {
254 u_int ypbind_error;
255 struct ypbind_binding ypbind_bindinfo;
256 } ypbind_respbody;
260 /* Detailed failure reason codes for response field ypbind_error*/
262 #define YPBIND_ERR_ERR 1 /* Internal error */
263 #define YPBIND_ERR_NOSERV 2 /* No bound server for passed domain */
264 #define YPBIND_ERR_RESC 3 /* System resource allocation failure */
267 * Request data structure for ypbind "Set domain" procedure.
269 struct ypbind_setdom {
270 char *ypsetdom_domain;
271 struct ypbind_binding ypsetdom_binding;
272 u_int ypsetdom_vers;
274 #define ypsetdom_addr ypsetdom_binding.ypbind_binding_addr
275 #define ypsetdom_port ypsetdom_binding.ypbind_binding_port
278 * Protocol between clients (ypxfr, only) and yppush
279 * yppush speaks a protocol in the transient range, which
280 * is supplied to ypxfr as a command-line parameter when it
281 * is activated by ypserv.
283 #define YPPUSHVERS ((u_long)1)
284 #define YPPUSHVERS_ORIG ((u_long)1)
286 /* Procedure symbols */
288 #define YPPUSHPROC_NULL ((u_long)0)
289 #define YPPUSHPROC_XFRRESP ((u_long)1)
291 /* Status values for yppushresp_xfr.status */
293 enum yppush_status {
294 YPPUSH_SUCC = 1, /* Success */
295 #define YPPUSH_SUCC YPPUSH_SUCC
296 YPPUSH_AGE = 2, /* Master's version not newer */
297 #define YPPUSH_AGE YPPUSH_AGE
298 YPPUSH_NOMAP = -1, /* Can't find server for map */
299 #define YPPUSH_NOMAP YPPUSH_NOMAP
300 YPPUSH_NODOM = -2, /* Domain not supported */
301 #define YPPUSH_NODOM YPPUSH_NODOM
302 YPPUSH_RSRC = -3, /* Local resouce alloc failure */
303 #define YPPUSH_RSRC YPPUSH_RSRC
304 YPPUSH_RPC = -4, /* RPC failure talking to server */
305 #define YPPUSH_RPC YPPUSH_RPC
306 YPPUSH_MADDR = -5, /* Can't get master address */
307 #define YPPUSH_MADDR YPPUSH_MADDR
308 YPPUSH_YPERR = -6, /* NIS server/map db error */
309 #define YPPUSH_YPERR YPPUSH_YPERR
310 YPPUSH_BADARGS = -7, /* Request arguments bad */
311 #define YPPUSH_BADARGS YPPUSH_BADARGS
312 YPPUSH_DBM = -8, /* Local dbm operation failed */
313 #define YPPUSH_DBM YPPUSH_DBM
314 YPPUSH_FILE = -9, /* Local file I/O operation failed */
315 #define YPPUSH_FILE YPPUSH_FILE
316 YPPUSH_SKEW = -10, /* Map version skew during transfer */
317 #define YPPUSH_SKEW YPPUSH_SKEW
318 YPPUSH_CLEAR = -11, /* Can't send "Clear" req to local ypserv */
319 #define YPPUSH_CLEAR YPPUSH_CLEAR
320 YPPUSH_FORCE = -12, /* No local order number in map - use -f flag*/
321 #define YPPUSH_FORCE YPPUSH_FORCE
322 YPPUSH_XFRERR = -13, /* ypxfr error */
323 #define YPPUSH_XFRERR YPPUSH_XFRERR
324 YPPUSH_REFUSED = -14, /* Transfer request refused by ypserv */
325 #define YPPUSH_REFUSED YPPUSH_REFUSED
326 YPPUSH_NOALIAS = -15 /* Alias not found for map or domain */
327 #define YPPUSH_NOALIAS YPPUSH_NOALIAS
329 typedef enum yppush_status yppush_status;
331 struct yppushresp_xfr {
332 u_int transid;
333 yppush_status status;
336 struct ypresp_all {
337 bool_t more;
338 union {
339 struct ypresp_key_val val;
340 } ypresp_all_u;
343 __BEGIN_DECLS
345 extern bool_t xdr_ypreq_key __P ((XDR *__xdrs, struct ypreq_key * __objp));
346 extern bool_t xdr_ypreq_nokey __P ((XDR *__xdrs, struct ypreq_nokey * __objp));
347 extern bool_t xdr_ypreq_xfr __P ((XDR *__xdrs, struct ypreq_xfr * __objp));
348 extern bool_t xdr_ypresp_val __P ((XDR *__xdrs, struct ypresp_val * __objp));
349 extern bool_t xdr_ypresp_key_val __P ((XDR *__xdrs, struct ypresp_key_val * __objp));
350 extern bool_t xdr_ypbind_resp __P ((XDR *__xdrs, struct ypbind_resp * __objp));
351 extern bool_t xdr_ypbind_setdom __P ((XDR *__xdrs, struct ypbind_setdom * __objp));
352 extern bool_t xdr_ypmap_parms __P ((XDR *__xdrs, struct ypmap_parms * __objp));
353 extern bool_t xdr_yppushresp_xfr __P ((XDR *__xdrs, struct yppushresp_xfr * __objp));
354 extern bool_t xdr_ypresp_order __P ((XDR *__xdrs, struct ypresp_order * __objp));
355 extern bool_t xdr_ypresp_master __P ((XDR *__xdrs, struct ypresp_master * __objp));
356 extern bool_t xdr_ypall __P ((XDR *__xdrs, struct ypall_callback * __objp));
357 extern bool_t xdr_ypresp_maplist __P ((XDR *__xdrs, struct ypresp_maplist * __objp));
358 extern bool_t xdr_ypbind_binding __P ((XDR *__xdrs, struct ypbind_binding * __objp));
359 extern bool_t xdr_ypbind_resptype __P ((XDR *__xdrs, enum ypbind_resptype * __objp));
360 extern bool_t xdr_ypstat __P ((XDR *__xdrs, enum ypbind_resptype * __objp));
361 extern bool_t xdr_ypresp_all __P ((XDR *__xdrs, struct ypresp_all * __objp));
362 extern bool_t xdr_domainname __P ((XDR *__xdrs, char ** __objp));
364 __END_DECLS
366 #endif /* _RPCSVC_YP_PROT_H */