2 * Copyright (c) 2010, Oracle America, Inc.
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above
11 * copyright notice, this list of conditions and the following
12 * disclaimer in the documentation and/or other materials
13 * provided with the distribution.
14 * * Neither the name of the "Oracle America, Inc." nor the names of its
15 * contributors may be used to endorse or promote products derived
16 * from this software without specific prior written permission.
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
21 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
22 * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
23 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
25 * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
27 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
28 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 * Protocol description file for the Yellow Pages Service
36 const YPMAXRECORD = 16777216;
37 const YPMAXDOMAIN = 64;
77 typedef string domainname<YPMAXDOMAIN>;
78 typedef string mapname<YPMAXMAP>;
79 typedef string peername<YPMAXPEER>;
80 typedef opaque keydat<YPMAXRECORD>;
81 typedef opaque valdat<YPMAXRECORD>;
87 unsigned int ordernum;
103 ypmap_parms map_parms;
104 unsigned int transid;
115 struct ypresp_key_val {
117 #ifdef STUPID_SUN_BUG /* These are backwards */
127 struct ypresp_master {
132 struct ypresp_order {
134 unsigned int ordernum;
137 union ypresp_all switch (bool more) {
145 unsigned int transid;
154 struct ypresp_maplist {
160 YPPUSH_SUCC = 1, /* Success */
161 YPPUSH_AGE = 2, /* Master's version not newer */
162 YPPUSH_NOMAP = -1, /* Can't find server for map */
163 YPPUSH_NODOM = -2, /* Domain not supported */
164 YPPUSH_RSRC = -3, /* Local resource alloc failure */
165 YPPUSH_RPC = -4, /* RPC failure talking to server */
166 YPPUSH_MADDR = -5, /* Can't get master address */
167 YPPUSH_YPERR = -6, /* YP server/map db error */
168 YPPUSH_BADARGS = -7, /* Request arguments bad */
169 YPPUSH_DBM = -8, /* Local dbm operation failed */
170 YPPUSH_FILE = -9, /* Local file I/O operation failed */
171 YPPUSH_SKEW = -10, /* Map version skew during transfer */
172 YPPUSH_CLEAR = -11, /* Can't send "Clear" req to local ypserv */
173 YPPUSH_FORCE = -12, /* No local order number in map use -f flag. */
174 YPPUSH_XFRERR = -13, /* ypxfr error */
175 YPPUSH_REFUSED = -14 /* Transfer request refused by ypserv */
178 struct yppushresp_xfr {
180 yppush_status status;
184 * Response structure and overall result status codes. Success and failure
185 * represent two separate response message types.
188 enum ypbind_resptype {
193 struct ypbind_binding {
194 opaque ypbind_binding_addr[4]; /* In network order */
195 opaque ypbind_binding_port[2]; /* In network order */
198 union ypbind_resp switch (ypbind_resptype ypbind_status) {
199 case YPBIND_FAIL_VAL:
200 unsigned ypbind_error;
201 case YPBIND_SUCC_VAL:
202 ypbind_binding ypbind_bindinfo;
205 /* Detailed failure reason codes for response field ypbind_error*/
207 const YPBIND_ERR_ERR = 1; /* Internal error */
208 const YPBIND_ERR_NOSERV = 2; /* No bound server for passed domain */
209 const YPBIND_ERR_RESC = 3; /* System resource allocation failure */
213 * Request data structure for ypbind "Set domain" procedure.
215 struct ypbind_setdom {
216 domainname ypsetdom_domain;
217 ypbind_binding ypsetdom_binding;
218 unsigned ypsetdom_vers;
223 * NIS v1 support for backwards compatibility
237 union yprequest switch (ypreqtype yp_reqtype) {
239 ypreq_key yp_req_keytype;
241 ypreq_nokey yp_req_nokeytype;
242 case YPREQ_MAP_PARMS:
243 ypmap_parms yp_req_map_parmstype;
246 union ypresponse switch (ypresptype yp_resptype) {
248 ypresp_val yp_resp_valtype;
250 ypresp_key_val yp_resp_key_valtype;
251 case YPRESP_MAP_PARMS:
252 ypmap_parms yp_resp_map_parmstype;
255 #if !defined(YPBIND_ONLY) && !defined(YPPUSH_ONLY)
261 * NIS v1 support for backwards compatibility
265 YPOLDPROC_NULL(void) = 0;
268 YPOLDPROC_DOMAIN(domainname) = 1;
271 YPOLDPROC_DOMAIN_NONACK(domainname) = 2;
274 YPOLDPROC_MATCH(yprequest) = 3;
277 YPOLDPROC_FIRST(yprequest) = 4;
280 YPOLDPROC_NEXT(yprequest) = 5;
283 YPOLDPROC_POLL(yprequest) = 6;
286 YPOLDPROC_PUSH(yprequest) = 7;
289 YPOLDPROC_PULL(yprequest) = 8;
292 YPOLDPROC_GET(yprequest) = 9;
297 YPPROC_NULL(void) = 0;
300 YPPROC_DOMAIN(domainname) = 1;
303 YPPROC_DOMAIN_NONACK(domainname) = 2;
306 YPPROC_MATCH(ypreq_key) = 3;
309 #ifdef STUPID_SUN_BUG /* should be ypreq_nokey */
310 YPPROC_FIRST(ypreq_key) = 4;
312 YPPROC_FIRST(ypreq_nokey) = 4;
315 YPPROC_NEXT(ypreq_key) = 5;
318 YPPROC_XFR(ypreq_xfr) = 6;
321 YPPROC_CLEAR(void) = 7;
324 YPPROC_ALL(ypreq_nokey) = 8;
327 YPPROC_MASTER(ypreq_nokey) = 9;
330 YPPROC_ORDER(ypreq_nokey) = 10;
333 YPPROC_MAPLIST(domainname) = 11;
337 #if !defined(YPSERV_ONLY) && !defined(YPBIND_ONLY)
339 * YPPUSHPROC_XFRRESP is the callback routine for result of YPPROC_XFR
341 program YPPUSH_XFRRESPPROG {
342 version YPPUSH_XFRRESPVERS {
344 YPPUSHPROC_NULL(void) = 0;
345 #ifdef STUPID_SUN_BUG /* argument and return value are backwards */
347 YPPUSHPROC_XFRRESP(void) = 1;
350 YPPUSHPROC_XFRRESP(yppushresp_xfr) = 1;
353 } = 0x40000000; /* transient: could be anything up to 0x5fffffff */
355 #if !defined(YPSERV_ONLY) && !defined(YPPUSH_ONLY)
357 * YP binding protocol
362 YPBINDPROC_NULL(void) = 0;
365 YPBINDPROC_DOMAIN(domainname) = 1;
368 YPBINDPROC_SETDOM(ypbind_setdom) = 2;