yp.x revision 1832
1/* 2 * Sun RPC is a product of Sun Microsystems, Inc. and is provided for 3 * unrestricted use provided that this legend is included on all tape 4 * media and as a part of the software program in whole or part. Users 5 * may copy or modify Sun RPC without charge, but are not authorized 6 * to license or distribute it to anyone else except as part of a product or 7 * program developed by the user. 8 * 9 * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE 10 * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR 11 * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. 12 * 13 * Sun RPC is provided with no support and without any obligation on the 14 * part of Sun Microsystems, Inc. to assist in its use, correction, 15 * modification or enhancement. 16 * 17 * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE 18 * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC 19 * OR ANY PART THEREOF. 20 * 21 * In no event will Sun Microsystems, Inc. be liable for any lost revenue 22 * or profits or other special, indirect and consequential damages, even if 23 * Sun has been advised of the possibility of such damages. 24 * 25 * Sun Microsystems, Inc. 26 * 2550 Garcia Avenue 27 * Mountain View, California 94043 28 */ 29 30/* 31 * Protocol description file for the Yellow Pages Service 32 */ 33 34#ifndef RPC_HDR 35%#ifndef lint 36%/*static char sccsid[] = "from: @(#)yp.x 2.1 88/08/01 4.0 RPCSRC";*/ 37%static char rcsid[] = "$Id: yp.x,v 1.1 1993/09/14 17:42:53 jtc Exp $"; 38%#endif /* not lint */ 39#endif 40 41const YPMAXRECORD = 1024; 42const YPMAXDOMAIN = 64; 43const YPMAXMAP = 64; 44const YPMAXPEER = 64; 45 46 47enum ypstat { 48 YP_TRUE = 1, 49 YP_NOMORE = 2, 50 YP_FALSE = 0, 51 YP_NOMAP = -1, 52 YP_NODOM = -2, 53 YP_NOKEY = -3, 54 YP_BADOP = -4, 55 YP_BADDB = -5, 56 YP_YPERR = -6, 57 YP_BADARGS = -7, 58 YP_VERS = -8 59}; 60 61 62enum ypxfrstat { 63 YPXFR_SUCC = 1, 64 YPXFR_AGE = 2, 65 YPXFR_NOMAP = -1, 66 YPXFR_NODOM = -2, 67 YPXFR_RSRC = -3, 68 YPXFR_RPC = -4, 69 YPXFR_MADDR = -5, 70 YPXFR_YPERR = -6, 71 YPXFR_BADARGS = -7, 72 YPXFR_DBM = -8, 73 YPXFR_FILE = -9, 74 YPXFR_SKEW = -10, 75 YPXFR_CLEAR = -11, 76 YPXFR_FORCE = -12, 77 YPXFR_XFRERR = -13, 78 YPXFR_REFUSED = -14 79}; 80 81 82typedef string domainname<YPMAXDOMAIN>; 83typedef string mapname<YPMAXMAP>; 84typedef string peername<YPMAXPEER>; 85typedef opaque keydat<YPMAXRECORD>; 86typedef opaque valdat<YPMAXRECORD>; 87 88 89struct ypmap_parms { 90 domainname domain; 91 mapname map; 92 unsigned int ordernum; 93 peername peer; 94}; 95 96struct ypreq_key { 97 domainname domain; 98 mapname map; 99 keydat key; 100}; 101 102struct ypreq_nokey { 103 domainname domain; 104 mapname map; 105}; 106 107struct ypreq_xfr { 108 ypmap_parms map_parms; 109 unsigned int transid; 110 unsigned int prog; 111 unsigned int port; 112}; 113 114 115struct ypresp_val { 116 ypstat stat; 117 valdat val; 118}; 119 120struct ypresp_key_val { 121 ypstat stat; 122 keydat key; 123 valdat val; 124}; 125 126 127struct ypresp_master { 128 ypstat stat; 129 peername peer; 130}; 131 132struct ypresp_order { 133 ypstat stat; 134 unsigned int ordernum; 135}; 136 137union ypresp_all switch (bool more) { 138case TRUE: 139 ypresp_key_val val; 140case FALSE: 141 void; 142}; 143 144struct ypresp_xfr { 145 unsigned int transid; 146 ypxfrstat xfrstat; 147}; 148 149struct ypmaplist { 150 mapname map; 151 ypmaplist *next; 152}; 153 154struct ypresp_maplist { 155 ypstat stat; 156 ypmaplist *maps; 157}; 158 159enum yppush_status { 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 */ 176}; 177 178struct yppushresp_xfr { 179 unsigned transid; 180 yppush_status status; 181}; 182 183/* 184 * Response structure and overall result status codes. Success and failure 185 * represent two separate response message types. 186 */ 187 188enum ypbind_resptype { 189 YPBIND_SUCC_VAL = 1, 190 YPBIND_FAIL_VAL = 2 191}; 192 193struct ypbind_binding { 194 opaque ypbind_binding_addr[4]; /* In network order */ 195 opaque ypbind_binding_port[2]; /* In network order */ 196}; 197 198union ypbind_resp switch (ypbind_resptype ypbind_status) { 199case YPBIND_FAIL_VAL: 200 unsigned ypbind_error; 201case YPBIND_SUCC_VAL: 202 ypbind_binding ypbind_bindinfo; 203}; 204 205/* Detailed failure reason codes for response field ypbind_error*/ 206 207const YPBIND_ERR_ERR = 1; /* Internal error */ 208const YPBIND_ERR_NOSERV = 2; /* No bound server for passed domain */ 209const YPBIND_ERR_RESC = 3; /* System resource allocation failure */ 210 211 212/* 213 * Request data structure for ypbind "Set domain" procedure. 214 */ 215struct ypbind_setdom { 216 domainname ypsetdom_domain; 217 ypbind_binding ypsetdom_binding; 218 unsigned ypsetdom_vers; 219}; 220 221 222/* 223 * YP access protocol 224 */ 225program YPPROG { 226 version YPVERS { 227 void 228 YPPROC_NULL(void) = 0; 229 230 bool 231 YPPROC_DOMAIN(domainname) = 1; 232 233 bool 234 YPPROC_DOMAIN_NONACK(domainname) = 2; 235 236 ypresp_val 237 YPPROC_MATCH(ypreq_key) = 3; 238 239 ypresp_key_val 240 YPPROC_FIRST(ypreq_key) = 4; 241 242 ypresp_key_val 243 YPPROC_NEXT(ypreq_key) = 5; 244 245 ypresp_xfr 246 YPPROC_XFR(ypreq_xfr) = 6; 247 248 void 249 YPPROC_CLEAR(void) = 7; 250 251 ypresp_all 252 YPPROC_ALL(ypreq_nokey) = 8; 253 254 ypresp_master 255 YPPROC_MASTER(ypreq_nokey) = 9; 256 257 ypresp_order 258 YPPROC_ORDER(ypreq_nokey) = 10; 259 260 ypresp_maplist 261 YPPROC_MAPLIST(domainname) = 11; 262 } = 2; 263} = 100004; 264 265 266/* 267 * YPPUSHPROC_XFRRESP is the callback routine for result of YPPROC_XFR 268 */ 269program YPPUSH_XFRRESPPROG { 270 version YPPUSH_XFRRESPVERS { 271 void 272 YPPUSHPROC_NULL(void) = 0; 273 274 yppushresp_xfr 275 YPPUSHPROC_XFRRESP(void) = 1; 276 } = 1; 277} = 0x40000000; /* transient: could be anything up to 0x5fffffff */ 278 279 280/* 281 * YP binding protocol 282 */ 283program YPBINDPROG { 284 version YPBINDVERS { 285 void 286 YPBINDPROC_NULL(void) = 0; 287 288 ypbind_resp 289 YPBINDPROC_DOMAIN(domainname) = 1; 290 291 void 292 YPBINDPROC_SETDOM(ypbind_setdom) = 2; 293 } = 2; 294} = 100007; 295 296 297