]>
Commit | Line | Data |
---|---|---|
6259ec0d UD |
1 | /* |
2 | * This file contains symbols and structures defining the rpc protocol | |
3 | * between the NIS clients and the NIS servers. The servers | |
f8b87ef0 | 4 | * are the NIS database servers, and the NIS binders. |
6259ec0d UD |
5 | */ |
6 | ||
7 | #ifndef _RPCSVC_YP_PROT_H | |
8 | #define _RPCSVC_YP_PROT_H | |
9 | ||
10 | #include <features.h> | |
11 | ||
12 | #include <rpc/rpc.h> | |
13 | #include <rpcsvc/ypclnt.h> | |
14 | ||
a5a0310d UD |
15 | __BEGIN_DECLS |
16 | ||
6259ec0d UD |
17 | /* |
18 | * The following procedures are supported by the protocol: | |
f8b87ef0 | 19 | * |
6259ec0d UD |
20 | * YPPROC_NULL() returns () takes nothing, returns nothing. This indicates |
21 | * that the NIS server is alive. | |
f8b87ef0 | 22 | * |
6259ec0d UD |
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. | |
f8b87ef0 | 26 | * |
6259ec0d UD |
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. | |
f8b87ef0 | 29 | * |
6259ec0d UD |
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. | |
f8b87ef0 | 33 | * |
6259ec0d UD |
34 | * YPPROC_FIRST (struct ypreq_nokey) returns (struct ypresp_key_val). |
35 | * Returns the first key-value pair from a named domain and map. | |
f8b87ef0 | 36 | * |
6259ec0d UD |
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. | |
40 | * | |
41 | * YPPROC_XFR (struct ypreq_xfr) returns nothing. Indicates to a server that | |
42 | * a map should be updated. | |
43 | * | |
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. | |
f8b87ef0 | 47 | * |
6259ec0d UD |
48 | * YPPROC_ALL (struct ypreq_nokey), returns |
49 | * union switch (bool_t more) { | |
50 | * TRUE: (struct ypresp_key_val); | |
51 | * FALSE: (struct) {}; | |
52 | * } | |
53 | * | |
54 | * YPPROC_MASTER (struct ypreq_nokey), returns (ypresp_master) | |
55 | * | |
56 | * YPPROC_ORDER (struct ypreq_nokey), returns (ypresp_order) | |
57 | * | |
58 | * YPPROC_MAPLIST (char *), returns (struct ypmaplist *) | |
59 | */ | |
60 | ||
61 | /* Program and version symbols, magic numbers */ | |
62 | ||
a1129917 UD |
63 | #define YPPROG 100004 |
64 | #define YPVERS 2 | |
65 | #define YPVERS_ORIG 1 | |
831372e7 | 66 | #define YPMAXRECORD 1024 |
a1129917 | 67 | #define YPMAXDOMAIN 64 /* XXX orig. yp_prot.h defines 256 */ |
831372e7 | 68 | #define YPMAXMAP 64 |
a1129917 | 69 | #define YPMAXPEER 64 /* XXX orig. yp_prot.h defines 256 */ |
6259ec0d UD |
70 | |
71 | /* byte size of a large NIS packet */ | |
72 | #define YPMSGSZ 1600 | |
73 | ||
6259ec0d | 74 | typedef struct { |
831372e7 UD |
75 | u_int keydat_len; |
76 | char *keydat_val; | |
a5a0310d | 77 | } keydat_t; |
831372e7 UD |
78 | |
79 | typedef struct { | |
80 | u_int valdat_len; | |
81 | char *valdat_val; | |
a5a0310d | 82 | } valdat_t; |
6259ec0d UD |
83 | |
84 | struct ypmap_parms { | |
85 | char *domain; /* Null string means not available */ | |
86 | char *map; /* Null string means not available */ | |
831372e7 | 87 | unsigned int ordernum; /* 0 means not available */ |
6259ec0d UD |
88 | char *owner; /* Null string means not available */ |
89 | }; | |
90 | ||
91 | /* | |
92 | * Request parameter structures | |
93 | */ | |
94 | ||
95 | struct ypreq_key { | |
f8b87ef0 UD |
96 | const char *domain; |
97 | const char *map; | |
a5a0310d | 98 | keydat_t keydat; |
6259ec0d UD |
99 | }; |
100 | ||
101 | struct ypreq_nokey { | |
102 | char *domain; | |
103 | char *map; | |
104 | }; | |
105 | ||
106 | struct ypreq_xfr { | |
107 | struct ypmap_parms map_parms; | |
831372e7 UD |
108 | u_int transid; |
109 | u_int proto; | |
110 | u_int port; | |
6259ec0d UD |
111 | }; |
112 | ||
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 | |
117 | ||
831372e7 UD |
118 | /* Return status values */ |
119 | ||
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 | |
144 | }; | |
145 | ||
6259ec0d UD |
146 | /* |
147 | * Response parameter structures | |
148 | */ | |
149 | ||
831372e7 UD |
150 | typedef enum ypstat ypstat; |
151 | ||
6259ec0d | 152 | struct ypresp_val { |
831372e7 | 153 | ypstat status; |
a5a0310d | 154 | valdat_t valdat; |
6259ec0d UD |
155 | }; |
156 | ||
157 | struct ypresp_key_val { | |
831372e7 | 158 | ypstat status; |
6952e59e UD |
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. */ | |
a5a0310d UD |
165 | keydat_t keydat; |
166 | valdat_t valdat; | |
6952e59e | 167 | #else |
a5a0310d UD |
168 | valdat_t valdat; |
169 | keydat_t keydat; | |
6952e59e | 170 | #endif |
6259ec0d UD |
171 | }; |
172 | ||
173 | struct ypresp_master { | |
831372e7 | 174 | ypstat status; |
6259ec0d UD |
175 | char *master; |
176 | }; | |
177 | ||
178 | struct ypresp_order { | |
831372e7 UD |
179 | ypstat status; |
180 | u_int ordernum; | |
6259ec0d UD |
181 | }; |
182 | ||
183 | struct ypmaplist { | |
831372e7 | 184 | char *map; |
f8b87ef0 UD |
185 | #define ypml_name map |
186 | struct ypmaplist *next; | |
187 | #define ypml_next next | |
6259ec0d UD |
188 | }; |
189 | ||
190 | struct ypresp_maplist { | |
831372e7 | 191 | ypstat status; |
6259ec0d UD |
192 | struct ypmaplist *list; |
193 | }; | |
194 | ||
195 | /* | |
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. | |
199 | */ | |
200 | ||
a1129917 UD |
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 | |
207 | #define YPPROC_XFR 6 | |
208 | #define YPPROC_CLEAR 7 | |
209 | #define YPPROC_ALL 8 | |
210 | #define YPPROC_MASTER 9 | |
211 | #define YPPROC_ORDER 10 | |
212 | #define YPPROC_MAPLIST 11 | |
213 | #define YPPROC_NEWXFR 12 | |
6259ec0d | 214 | |
6259ec0d UD |
215 | /* |
216 | * Protocol between clients and NIS binder servers | |
217 | */ | |
218 | ||
219 | /* | |
220 | * The following procedures are supported by the protocol: | |
221 | * | |
222 | * YPBINDPROC_NULL() returns () | |
223 | * takes nothing, returns nothing | |
224 | * | |
225 | * YPBINDPROC_DOMAIN takes (char *) returns (struct ypbind_resp) | |
226 | * | |
227 | * YPBINDPROC_SETDOM takes (struct ypbind_setdom) returns nothing | |
228 | */ | |
f8b87ef0 | 229 | |
6259ec0d UD |
230 | /* Program and version symbols, magic numbers */ |
231 | ||
a1129917 UD |
232 | #define YPBINDPROG 100007 |
233 | #define YPBINDVERS 2 | |
234 | #define YPBINDVERS_ORIG 1 | |
6259ec0d UD |
235 | |
236 | /* Procedure symbols */ | |
237 | ||
a1129917 UD |
238 | #define YPBINDPROC_NULL 0 |
239 | #define YPBINDPROC_DOMAIN 1 | |
240 | #define YPBINDPROC_SETDOM 2 | |
6259ec0d UD |
241 | /* |
242 | * Response structure and overall result status codes. Success and failure | |
243 | * represent two separate response message types. | |
244 | */ | |
245 | ||
246 | enum ypbind_resptype {YPBIND_SUCC_VAL = 1, YPBIND_FAIL_VAL = 2}; | |
247 | ||
248 | struct ypbind_binding { | |
249 | struct in_addr ypbind_binding_addr; /* In network order */ | |
250 | unsigned short int ypbind_binding_port; /* In network order */ | |
251 | }; | |
252 | ||
253 | struct ypbind_resp { | |
254 | enum ypbind_resptype ypbind_status; | |
255 | union { | |
831372e7 | 256 | u_int ypbind_error; |
6259ec0d UD |
257 | struct ypbind_binding ypbind_bindinfo; |
258 | } ypbind_respbody; | |
259 | }; | |
260 | ||
261 | ||
262 | /* Detailed failure reason codes for response field ypbind_error*/ | |
263 | ||
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 */ | |
267 | ||
268 | /* | |
269 | * Request data structure for ypbind "Set domain" procedure. | |
270 | */ | |
271 | struct ypbind_setdom { | |
831372e7 | 272 | char *ypsetdom_domain; |
6259ec0d | 273 | struct ypbind_binding ypsetdom_binding; |
831372e7 | 274 | u_int ypsetdom_vers; |
6259ec0d UD |
275 | }; |
276 | #define ypsetdom_addr ypsetdom_binding.ypbind_binding_addr | |
277 | #define ypsetdom_port ypsetdom_binding.ypbind_binding_port | |
278 | ||
279 | /* | |
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. | |
284 | */ | |
a1129917 UD |
285 | #define YPPUSHVERS 1 |
286 | #define YPPUSHVERS_ORIG 1 | |
6259ec0d UD |
287 | |
288 | /* Procedure symbols */ | |
289 | ||
a1129917 UD |
290 | #define YPPUSHPROC_NULL 0 |
291 | #define YPPUSHPROC_XFRRESP 1 | |
6259ec0d | 292 | |
6259ec0d UD |
293 | /* Status values for yppushresp_xfr.status */ |
294 | ||
831372e7 UD |
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 | |
330 | }; | |
331 | typedef enum yppush_status yppush_status; | |
6259ec0d | 332 | |
c0e45674 UD |
333 | struct yppushresp_xfr { |
334 | u_int transid; | |
335 | yppush_status status; | |
336 | }; | |
337 | ||
6259ec0d UD |
338 | struct ypresp_all { |
339 | bool_t more; | |
340 | union { | |
341 | struct ypresp_key_val val; | |
342 | } ypresp_all_u; | |
343 | }; | |
344 | ||
4e6bc1f6 AJ |
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); | |
6259ec0d UD |
363 | |
364 | __END_DECLS | |
365 | ||
366 | #endif /* _RPCSVC_YP_PROT_H */ |