yp.x revision 1.2
1/* $OpenBSD: yp.x,v 1.2 1997/08/19 07:54:52 niklas Exp $ */ 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 32/* 33 * Protocol description file for the Yellow Pages Service 34 */ 35 36#ifndef RPC_HDR 37%#ifndef lint 38%/*static char sccsid[] = "from: @(#)yp.x 2.1 88/08/01 4.0 RPCSRC";*/ 39%static char rcsid[] = "$OpenBSD: yp.x,v 1.2 1997/08/19 07:54:52 niklas Exp $"; 40%#endif /* not lint */ 41#endif 42 43const YPMAXRECORD = 1024; 44const YPMAXDOMAIN = 64; 45const YPMAXMAP = 64; 46const YPMAXPEER = 64; 47 48 49enum ypstat { 50 YP_TRUE = 1, 51 YP_NOMORE = 2, 52 YP_FALSE = 0, 53 YP_NOMAP = -1, 54 YP_NODOM = -2, 55 YP_NOKEY = -3, 56 YP_BADOP = -4, 57 YP_BADDB = -5, 58 YP_YPERR = -6, 59 YP_BADARGS = -7, 60 YP_VERS = -8 61}; 62 63 64enum ypxfrstat { 65 YPXFR_SUCC = 1, 66 YPXFR_AGE = 2, 67 YPXFR_NOMAP = -1, 68 YPXFR_NODOM = -2, 69 YPXFR_RSRC = -3, 70 YPXFR_RPC = -4, 71 YPXFR_MADDR = -5, 72 YPXFR_YPERR = -6, 73 YPXFR_BADARGS = -7, 74 YPXFR_DBM = -8, 75 YPXFR_FILE = -9, 76 YPXFR_SKEW = -10, 77 YPXFR_CLEAR = -11, 78 YPXFR_FORCE = -12, 79 YPXFR_XFRERR = -13, 80 YPXFR_REFUSED = -14 81}; 82 83 84typedef string domainname<YPMAXDOMAIN>; 85typedef string mapname<YPMAXMAP>; 86typedef string peername<YPMAXPEER>; 87typedef opaque keydat<YPMAXRECORD>; 88typedef opaque valdat<YPMAXRECORD>; 89 90 91struct ypmap_parms { 92 domainname domain; 93 mapname map; 94 unsigned int ordernum; 95 peername peer; 96}; 97 98struct ypreq_key { 99 domainname domain; 100 mapname map; 101 keydat key; 102}; 103 104struct ypreq_nokey { 105 domainname domain; 106 mapname map; 107}; 108 109struct ypreq_xfr { 110 ypmap_parms map_parms; 111 unsigned int transid; 112 unsigned int prog; 113 unsigned int port; 114}; 115 116 117struct ypresp_val { 118 ypstat stat; 119 valdat val; 120}; 121 122struct ypresp_key_val { 123 ypstat stat; 124 keydat key; 125 valdat val; 126}; 127 128 129struct ypresp_master { 130 ypstat stat; 131 peername peer; 132}; 133 134struct ypresp_order { 135 ypstat stat; 136 unsigned int ordernum; 137}; 138 139union ypresp_all switch (bool more) { 140case TRUE: 141 ypresp_key_val val; 142case FALSE: 143 void; 144}; 145 146struct ypresp_xfr { 147 unsigned int transid; 148 ypxfrstat xfrstat; 149}; 150 151struct ypmaplist { 152 mapname map; 153 ypmaplist *next; 154}; 155 156struct ypresp_maplist { 157 ypstat stat; 158 ypmaplist *maps; 159}; 160 161enum yppush_status { 162 YPPUSH_SUCC = 1, /* Success */ 163 YPPUSH_AGE = 2, /* Master's version not newer */ 164 YPPUSH_NOMAP = -1, /* Can't find server for map */ 165 YPPUSH_NODOM = -2, /* Domain not supported */ 166 YPPUSH_RSRC = -3, /* Local resource alloc failure */ 167 YPPUSH_RPC = -4, /* RPC failure talking to server */ 168 YPPUSH_MADDR = -5, /* Can't get master address */ 169 YPPUSH_YPERR = -6, /* YP server/map db error */ 170 YPPUSH_BADARGS = -7, /* Request arguments bad */ 171 YPPUSH_DBM = -8, /* Local dbm operation failed */ 172 YPPUSH_FILE = -9, /* Local file I/O operation failed */ 173 YPPUSH_SKEW = -10, /* Map version skew during transfer */ 174 YPPUSH_CLEAR = -11, /* Can't send "Clear" req to local ypserv */ 175 YPPUSH_FORCE = -12, /* No local order number in map use -f flag. */ 176 YPPUSH_XFRERR = -13, /* ypxfr error */ 177 YPPUSH_REFUSED = -14 /* Transfer request refused by ypserv */ 178}; 179 180struct yppushresp_xfr { 181 unsigned transid; 182 yppush_status status; 183}; 184 185/* 186 * Response structure and overall result status codes. Success and failure 187 * represent two separate response message types. 188 */ 189 190enum ypbind_resptype { 191 YPBIND_SUCC_VAL = 1, 192 YPBIND_FAIL_VAL = 2 193}; 194 195struct ypbind_binding { 196 opaque ypbind_binding_addr[4]; /* In network order */ 197 opaque ypbind_binding_port[2]; /* In network order */ 198}; 199 200union ypbind_resp switch (ypbind_resptype ypbind_status) { 201case YPBIND_FAIL_VAL: 202 unsigned ypbind_error; 203case YPBIND_SUCC_VAL: 204 ypbind_binding ypbind_bindinfo; 205}; 206 207/* Detailed failure reason codes for response field ypbind_error*/ 208 209const YPBIND_ERR_ERR = 1; /* Internal error */ 210const YPBIND_ERR_NOSERV = 2; /* No bound server for passed domain */ 211const YPBIND_ERR_RESC = 3; /* System resource allocation failure */ 212 213 214/* 215 * Request data structure for ypbind "Set domain" procedure. 216 */ 217struct ypbind_setdom { 218 domainname ypsetdom_domain; 219 ypbind_binding ypsetdom_binding; 220 unsigned ypsetdom_vers; 221}; 222 223 224/* 225 * YP access protocol 226 */ 227program YPPROG { 228 version YPVERS { 229 void 230 YPPROC_NULL(void) = 0; 231 232 bool 233 YPPROC_DOMAIN(domainname) = 1; 234 235 bool 236 YPPROC_DOMAIN_NONACK(domainname) = 2; 237 238 ypresp_val 239 YPPROC_MATCH(ypreq_key) = 3; 240 241 ypresp_key_val 242 YPPROC_FIRST(ypreq_key) = 4; 243 244 ypresp_key_val 245 YPPROC_NEXT(ypreq_key) = 5; 246 247 ypresp_xfr 248 YPPROC_XFR(ypreq_xfr) = 6; 249 250 void 251 YPPROC_CLEAR(void) = 7; 252 253 ypresp_all 254 YPPROC_ALL(ypreq_nokey) = 8; 255 256 ypresp_master 257 YPPROC_MASTER(ypreq_nokey) = 9; 258 259 ypresp_order 260 YPPROC_ORDER(ypreq_nokey) = 10; 261 262 ypresp_maplist 263 YPPROC_MAPLIST(domainname) = 11; 264 } = 2; 265} = 100004; 266 267 268/* 269 * YPPUSHPROC_XFRRESP is the callback routine for result of YPPROC_XFR 270 */ 271program YPPUSH_XFRRESPPROG { 272 version YPPUSH_XFRRESPVERS { 273 void 274 YPPUSHPROC_NULL(void) = 0; 275 276 yppushresp_xfr 277 YPPUSHPROC_XFRRESP(void) = 1; 278 } = 1; 279} = 0x40000000; /* transient: could be anything up to 0x5fffffff */ 280 281 282/* 283 * YP binding protocol 284 */ 285program YPBINDPROG { 286 version YPBINDVERS { 287 void 288 YPBINDPROC_NULL(void) = 0; 289 290 ypbind_resp 291 YPBINDPROC_DOMAIN(domainname) = 1; 292 293 void 294 YPBINDPROC_SETDOM(ypbind_setdom) = 2; 295 } = 2; 296} = 100007; 297 298 299