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