1 /* @(#)yp.x 2.1 88/08/01 4.0 RPCSRC */ 2 3 /* 4 * Sun RPC is a product of Sun Microsystems, Inc. and is provided for 5 * unrestricted use provided that this legend is included on all tape 6 * media and as a part of the software program in whole or part. Users 7 * may copy or modify Sun RPC without charge, but are not authorized 8 * to license or distribute it to anyone else except as part of a product or 9 * program developed by the user. 10 * 11 * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE 12 * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR 13 * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. 14 * 15 * Sun RPC is provided with no support and without any obligation on the 16 * part of Sun Microsystems, Inc. to assist in its use, correction, 17 * modification or enhancement. 18 * 19 * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE 20 * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC 21 * OR ANY PART THEREOF. 22 * 23 * In no event will Sun Microsystems, Inc. be liable for any lost revenue 24 * or profits or other special, indirect and consequential damages, even if 25 * Sun has been advised of the possibility of such damages. 26 * 27 * Sun Microsystems, Inc. 28 * 2550 Garcia Avenue 29 * Mountain View, California 94043 30 * 31 * $FreeBSD: src/include/rpcsvc/yp.x,v 1.12 1999/08/27 23:45:12 peter Exp $ 32 * $DragonFly: src/include/rpcsvc/yp.x,v 1.2 2003/06/17 04:25:58 dillon Exp $ 33 */ 34 35 /* 36 * Protocol description file for the Yellow Pages Service 37 */ 38 39 const YPMAXRECORD = 1024; 40 const YPMAXDOMAIN = 64; 41 const YPMAXMAP = 64; 42 const YPMAXPEER = 64; 43 44 45 enum ypstat { 46 YP_TRUE = 1, 47 YP_NOMORE = 2, 48 YP_FALSE = 0, 49 YP_NOMAP = -1, 50 YP_NODOM = -2, 51 YP_NOKEY = -3, 52 YP_BADOP = -4, 53 YP_BADDB = -5, 54 YP_YPERR = -6, 55 YP_BADARGS = -7, 56 YP_VERS = -8 57 }; 58 59 60 enum ypxfrstat { 61 YPXFR_SUCC = 1, 62 YPXFR_AGE = 2, 63 YPXFR_NOMAP = -1, 64 YPXFR_NODOM = -2, 65 YPXFR_RSRC = -3, 66 YPXFR_RPC = -4, 67 YPXFR_MADDR = -5, 68 YPXFR_YPERR = -6, 69 YPXFR_BADARGS = -7, 70 YPXFR_DBM = -8, 71 YPXFR_FILE = -9, 72 YPXFR_SKEW = -10, 73 YPXFR_CLEAR = -11, 74 YPXFR_FORCE = -12, 75 YPXFR_XFRERR = -13, 76 YPXFR_REFUSED = -14 77 }; 78 79 80 typedef string domainname<YPMAXDOMAIN>; 81 typedef string mapname<YPMAXMAP>; 82 typedef string peername<YPMAXPEER>; 83 typedef opaque keydat<YPMAXRECORD>; 84 typedef opaque valdat<YPMAXRECORD>; 85 86 87 struct ypmap_parms { 88 domainname domain; 89 mapname map; 90 unsigned int ordernum; 91 peername peer; 92 }; 93 94 struct ypreq_key { 95 domainname domain; 96 mapname map; 97 keydat key; 98 }; 99 100 struct ypreq_nokey { 101 domainname domain; 102 mapname map; 103 }; 104 105 struct ypreq_xfr { 106 ypmap_parms map_parms; 107 unsigned int transid; 108 unsigned int prog; 109 unsigned int port; 110 }; 111 112 113 struct ypresp_val { 114 ypstat stat; 115 valdat val; 116 }; 117 118 struct ypresp_key_val { 119 ypstat stat; 120 #ifdef STUPID_SUN_BUG /* These are backwards */ 121 keydat key; 122 valdat val; 123 #else 124 valdat val; 125 keydat key; 126 #endif 127 }; 128 129 130 struct ypresp_master { 131 ypstat stat; 132 peername peer; 133 }; 134 135 struct ypresp_order { 136 ypstat stat; 137 unsigned int ordernum; 138 }; 139 140 union ypresp_all switch (bool more) { 141 case TRUE: 142 ypresp_key_val val; 143 case FALSE: 144 void; 145 }; 146 147 struct ypresp_xfr { 148 unsigned int transid; 149 ypxfrstat xfrstat; 150 }; 151 152 struct ypmaplist { 153 mapname map; 154 ypmaplist *next; 155 }; 156 157 struct ypresp_maplist { 158 ypstat stat; 159 ypmaplist *maps; 160 }; 161 162 enum yppush_status { 163 YPPUSH_SUCC = 1, /* Success */ 164 YPPUSH_AGE = 2, /* Master's version not newer */ 165 YPPUSH_NOMAP = -1, /* Can't find server for map */ 166 YPPUSH_NODOM = -2, /* Domain not supported */ 167 YPPUSH_RSRC = -3, /* Local resource alloc failure */ 168 YPPUSH_RPC = -4, /* RPC failure talking to server */ 169 YPPUSH_MADDR = -5, /* Can't get master address */ 170 YPPUSH_YPERR = -6, /* YP server/map db error */ 171 YPPUSH_BADARGS = -7, /* Request arguments bad */ 172 YPPUSH_DBM = -8, /* Local dbm operation failed */ 173 YPPUSH_FILE = -9, /* Local file I/O operation failed */ 174 YPPUSH_SKEW = -10, /* Map version skew during transfer */ 175 YPPUSH_CLEAR = -11, /* Can't send "Clear" req to local ypserv */ 176 YPPUSH_FORCE = -12, /* No local order number in map use -f flag. */ 177 YPPUSH_XFRERR = -13, /* ypxfr error */ 178 YPPUSH_REFUSED = -14 /* Transfer request refused by ypserv */ 179 }; 180 181 struct yppushresp_xfr { 182 unsigned transid; 183 yppush_status status; 184 }; 185 186 /* 187 * Response structure and overall result status codes. Success and failure 188 * represent two separate response message types. 189 */ 190 191 enum ypbind_resptype { 192 YPBIND_SUCC_VAL = 1, 193 YPBIND_FAIL_VAL = 2 194 }; 195 196 struct ypbind_binding { 197 opaque ypbind_binding_addr[4]; /* In network order */ 198 opaque ypbind_binding_port[2]; /* In network order */ 199 }; 200 201 union ypbind_resp switch (ypbind_resptype ypbind_status) { 202 case YPBIND_FAIL_VAL: 203 unsigned ypbind_error; 204 case YPBIND_SUCC_VAL: 205 ypbind_binding ypbind_bindinfo; 206 }; 207 208 /* Detailed failure reason codes for response field ypbind_error*/ 209 210 const YPBIND_ERR_ERR = 1; /* Internal error */ 211 const YPBIND_ERR_NOSERV = 2; /* No bound server for passed domain */ 212 const YPBIND_ERR_RESC = 3; /* System resource allocation failure */ 213 214 215 /* 216 * Request data structure for ypbind "Set domain" procedure. 217 */ 218 struct ypbind_setdom { 219 domainname ypsetdom_domain; 220 ypbind_binding ypsetdom_binding; 221 unsigned ypsetdom_vers; 222 }; 223 224 225 /* 226 * NIS v1 support for backwards compatibility 227 */ 228 enum ypreqtype { 229 YPREQ_KEY = 1, 230 YPREQ_NOKEY = 2, 231 YPREQ_MAP_PARMS = 3 232 }; 233 234 enum ypresptype { 235 YPRESP_VAL = 1, 236 YPRESP_KEY_VAL = 2, 237 YPRESP_MAP_PARMS = 3 238 }; 239 240 union yprequest switch (ypreqtype yp_reqtype) { 241 case YPREQ_KEY: 242 ypreq_key yp_req_keytype; 243 case YPREQ_NOKEY: 244 ypreq_nokey yp_req_nokeytype; 245 case YPREQ_MAP_PARMS: 246 ypmap_parms yp_req_map_parmstype; 247 }; 248 249 union ypresponse switch (ypresptype yp_resptype) { 250 case YPRESP_VAL: 251 ypresp_val yp_resp_valtype; 252 case YPRESP_KEY_VAL: 253 ypresp_key_val yp_resp_key_valtype; 254 case YPRESP_MAP_PARMS: 255 ypmap_parms yp_resp_map_parmstype; 256 }; 257 258 #if !defined(YPBIND_ONLY) && !defined(YPPUSH_ONLY) 259 /* 260 * YP access protocol 261 */ 262 program YPPROG { 263 /* 264 * NIS v1 support for backwards compatibility 265 */ 266 version YPOLDVERS { 267 void 268 YPOLDPROC_NULL(void) = 0; 269 270 bool 271 YPOLDPROC_DOMAIN(domainname) = 1; 272 273 bool 274 YPOLDPROC_DOMAIN_NONACK(domainname) = 2; 275 276 ypresponse 277 YPOLDPROC_MATCH(yprequest) = 3; 278 279 ypresponse 280 YPOLDPROC_FIRST(yprequest) = 4; 281 282 ypresponse 283 YPOLDPROC_NEXT(yprequest) = 5; 284 285 ypresponse 286 YPOLDPROC_POLL(yprequest) = 6; 287 288 ypresponse 289 YPOLDPROC_PUSH(yprequest) = 7; 290 291 ypresponse 292 YPOLDPROC_PULL(yprequest) = 8; 293 294 ypresponse 295 YPOLDPROC_GET(yprequest) = 9; 296 } = 1; 297 298 version YPVERS { 299 void 300 YPPROC_NULL(void) = 0; 301 302 bool 303 YPPROC_DOMAIN(domainname) = 1; 304 305 bool 306 YPPROC_DOMAIN_NONACK(domainname) = 2; 307 308 ypresp_val 309 YPPROC_MATCH(ypreq_key) = 3; 310 311 ypresp_key_val 312 #ifdef STUPID_SUN_BUG /* should be ypreq_nokey */ 313 YPPROC_FIRST(ypreq_key) = 4; 314 #else 315 YPPROC_FIRST(ypreq_nokey) = 4; 316 #endif 317 ypresp_key_val 318 YPPROC_NEXT(ypreq_key) = 5; 319 320 ypresp_xfr 321 YPPROC_XFR(ypreq_xfr) = 6; 322 323 void 324 YPPROC_CLEAR(void) = 7; 325 326 ypresp_all 327 YPPROC_ALL(ypreq_nokey) = 8; 328 329 ypresp_master 330 YPPROC_MASTER(ypreq_nokey) = 9; 331 332 ypresp_order 333 YPPROC_ORDER(ypreq_nokey) = 10; 334 335 ypresp_maplist 336 YPPROC_MAPLIST(domainname) = 11; 337 } = 2; 338 } = 100004; 339 #endif 340 #if !defined(YPSERV_ONLY) && !defined(YPBIND_ONLY) 341 /* 342 * YPPUSHPROC_XFRRESP is the callback routine for result of YPPROC_XFR 343 */ 344 program YPPUSH_XFRRESPPROG { 345 version YPPUSH_XFRRESPVERS { 346 void 347 YPPUSHPROC_NULL(void) = 0; 348 #ifdef STUPID_SUN_BUG /* argument and return value are backwards */ 349 yppushresp_xfr 350 YPPUSHPROC_XFRRESP(void) = 1; 351 #else 352 void 353 YPPUSHPROC_XFRRESP(yppushresp_xfr) = 1; 354 #endif 355 } = 1; 356 } = 0x40000000; /* transient: could be anything up to 0x5fffffff */ 357 #endif 358 #if !defined(YPSERV_ONLY) && !defined(YPPUSH_ONLY) 359 /* 360 * YP binding protocol 361 */ 362 program YPBINDPROG { 363 version YPBINDVERS { 364 void 365 YPBINDPROC_NULL(void) = 0; 366 367 ypbind_resp 368 YPBINDPROC_DOMAIN(domainname) = 1; 369 370 void 371 YPBINDPROC_SETDOM(ypbind_setdom) = 2; 372 } = 2; 373 } = 100007; 374 375 #endif 376