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