Update.
[glibc.git] / nis / rpcsvc / yp_prot.h
blob82f93b49edc4e7a03eb400ad593d7256ea537292
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>
15 __BEGIN_DECLS
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
25 * support.
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
32 * domain.
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
39 * domain and map.
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
46 * held open.
48 * YPPROC_ALL (struct ypreq_nokey), returns
49 * union switch (bool_t more) {
50 * TRUE: (struct ypresp_key_val);
51 * FALSE: (struct) {};
52 * }
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 */
63 #define YPPROG ((u_long)100004)
64 #define YPVERS ((u_long)2)
65 #define YPVERS_ORIG ((u_long)1)
66 #define YPMAXRECORD 1024
67 #define YPMAXDOMAIN 64 /* XXX orig. yp_prot.h defines ((u_long)256) */
68 #define YPMAXMAP 64
69 #define YPMAXPEER 64 /* XXX orig. yp_prot.h defines ((u_long)256) */
71 /* byte size of a large NIS packet */
72 #define YPMSGSZ 1600
74 typedef struct {
75 u_int keydat_len;
76 char *keydat_val;
77 } keydat_t;
79 typedef struct {
80 u_int valdat_len;
81 char *valdat_val;
82 } valdat_t;
84 struct ypmap_parms {
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
95 struct ypreq_key {
96 const char *domain;
97 const char *map;
98 keydat_t keydat;
101 struct ypreq_nokey {
102 char *domain;
103 char *map;
106 struct ypreq_xfr {
107 struct ypmap_parms map_parms;
108 u_int transid;
109 u_int proto;
110 u_int port;
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 */
120 enum ypstat {
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;
152 struct ypresp_val {
153 ypstat status;
154 valdat_t valdat;
157 struct ypresp_key_val {
158 ypstat status;
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. */
165 keydat_t keydat;
166 valdat_t valdat;
167 #else
168 valdat_t valdat;
169 keydat_t keydat;
170 #endif
173 struct ypresp_master {
174 ypstat status;
175 char *master;
178 struct ypresp_order {
179 ypstat status;
180 u_int ordernum;
183 struct ypmaplist {
184 char *map;
185 #define ypml_name map
186 struct ypmaplist *next;
187 #define ypml_next next
190 struct ypresp_maplist {
191 ypstat status;
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
198 * of the protocol.
201 #define YPPROC_NULL ((u_long)0)
202 #define YPPROC_DOMAIN ((u_long)1)
203 #define YPPROC_DOMAIN_NONACK ((u_long)2)
204 #define YPPROC_MATCH ((u_long)3)
205 #define YPPROC_FIRST ((u_long)4)
206 #define YPPROC_NEXT ((u_long)5)
207 #define YPPROC_XFR ((u_long)6)
208 #define YPPROC_CLEAR ((u_long)7)
209 #define YPPROC_ALL ((u_long)8)
210 #define YPPROC_MASTER ((u_long)9)
211 #define YPPROC_ORDER ((u_long)10)
212 #define YPPROC_MAPLIST ((u_long)11)
213 #define YPPROC_NEWXFR ((u_long)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 ((u_long)100007)
233 #define YPBINDVERS ((u_long)2)
234 #define YPBINDVERS_ORIG ((u_long)1)
236 /* Procedure symbols */
238 #define YPBINDPROC_NULL ((u_long)0)
239 #define YPBINDPROC_DOMAIN ((u_long)1)
240 #define YPBINDPROC_SETDOM ((u_long)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 */
253 struct ypbind_resp {
254 enum ypbind_resptype ypbind_status;
255 union {
256 u_int ypbind_error;
257 struct ypbind_binding ypbind_bindinfo;
258 } ypbind_respbody;
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;
274 u_int ypsetdom_vers;
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.
285 #define YPPUSHVERS ((u_long)1)
286 #define YPPUSHVERS_ORIG ((u_long)1)
288 /* Procedure symbols */
290 #define YPPUSHPROC_NULL ((u_long)0)
291 #define YPPUSHPROC_XFRRESP ((u_long)1)
293 /* Status values for yppushresp_xfr.status */
295 enum yppush_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 {
334 u_int transid;
335 yppush_status status;
338 struct ypresp_all {
339 bool_t more;
340 union {
341 struct ypresp_key_val val;
342 } ypresp_all_u;
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 */