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