1 %/*- 2 % * Copyright (c) 2009, Sun Microsystems, Inc. 3 % * All rights reserved. 4 % * 5 % * Redistribution and use in source and binary forms, with or without 6 % * modification, are permitted provided that the following conditions are met: 7 % * - Redistributions of source code must retain the above copyright notice, 8 % * this list of conditions and the following disclaimer. 9 % * - Redistributions in binary form must reproduce the above copyright notice, 10 % * this list of conditions and the following disclaimer in the documentation 11 % * and/or other materials provided with the distribution. 12 % * - Neither the name of Sun Microsystems, Inc. nor the names of its 13 % * contributors may be used to endorse or promote products derived 14 % * from this software without specific prior written permission. 15 % * 16 % * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 % * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 % * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 % * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 20 % * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 % * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 % * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 % * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 % * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 % * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 % * POSSIBILITY OF SUCH DAMAGE. 27 % */ 28 %/* 29 % * Copyright (c) 1988 by Sun Microsystems, Inc. 30 % */ 31 32 %/* from rpcb_prot.x */ 33 34 #ifdef RPC_HDR 35 % 36 %/* #pragma ident "@(#)rpcb_prot.x 1.5 94/04/29 SMI" */ 37 % 38 %#ifndef _KERNEL 39 % 40 #endif 41 42 /* 43 * rpcb_prot.x 44 * rpcbind protocol, versions 3 and 4, in RPC Language 45 */ 46 % 47 %/* 48 % * The following procedures are supported by the protocol in version 3: 49 % * 50 % * RPCBPROC_NULL() returns () 51 % * takes nothing, returns nothing 52 % * 53 % * RPCBPROC_SET(rpcb) returns (bool_t) 54 % * TRUE is success, FALSE is failure. Registers the tuple 55 % * [prog, vers, address, owner, netid]. 56 % * Finds out owner and netid information on its own. 57 % * 58 % * RPCBPROC_UNSET(rpcb) returns (bool_t) 59 % * TRUE is success, FALSE is failure. Un-registers tuple 60 % * [prog, vers, netid]. addresses is ignored. 61 % * If netid is NULL, unregister all. 62 % * 63 % * RPCBPROC_GETADDR(rpcb) returns (string). 64 % * 0 is failure. Otherwise returns the universal address where the 65 % * triple [prog, vers, netid] is registered. Ignore address and owner. 66 % * 67 % * RPCBPROC_DUMP() RETURNS (rpcblist_ptr) 68 % * used to dump the entire rpcbind maps 69 % * 70 % * RPCBPROC_CALLIT(rpcb_rmtcallargs) 71 % * RETURNS (rpcb_rmtcallres); 72 % * Calls the procedure on the remote machine. If it is not registered, 73 % * this procedure is quiet; i.e. it does not return error information!!! 74 % * This routine only passes null authentication parameters. 75 % * It has no interface to xdr routines for RPCBPROC_CALLIT. 76 % * 77 % * RPCBPROC_GETTIME() returns (int). 78 % * Gets the remote machines time 79 % * 80 % * RPCBPROC_UADDR2TADDR(strint) RETURNS (struct netbuf) 81 % * Returns the netbuf address from universal address. 82 % * 83 % * RPCBPROC_TADDR2UADDR(struct netbuf) RETURNS (string) 84 % * Returns the universal address from netbuf address. 85 % * 86 % * END OF RPCBIND VERSION 3 PROCEDURES 87 % */ 88 %/* 89 % * Except for RPCBPROC_CALLIT, the procedures above are carried over to 90 % * rpcbind version 4. Those below are added or modified for version 4. 91 % * NOTE: RPCBPROC_BCAST HAS THE SAME FUNCTIONALITY AND PROCEDURE NUMBER 92 % * AS RPCBPROC_CALLIT. 93 % * 94 % * RPCBPROC_BCAST(rpcb_rmtcallargs) 95 % * RETURNS (rpcb_rmtcallres); 96 % * Calls the procedure on the remote machine. If it is not registered, 97 % * this procedure IS quiet; i.e. it DOES NOT return error information!!! 98 % * This routine should be used for broadcasting and nothing else. 99 % * 100 % * RPCBPROC_GETVERSADDR(rpcb) returns (string). 101 % * 0 is failure. Otherwise returns the universal address where the 102 % * triple [prog, vers, netid] is registered. Ignore address and owner. 103 % * Same as RPCBPROC_GETADDR except that if the given version number 104 % * is not available, the address is not returned. 105 % * 106 % * RPCBPROC_INDIRECT(rpcb_rmtcallargs) 107 % * RETURNS (rpcb_rmtcallres); 108 % * Calls the procedure on the remote machine. If it is not registered, 109 % * this procedure is NOT quiet; i.e. it DOES return error information!!! 110 % * as any normal application would expect. 111 % * 112 % * RPCBPROC_GETADDRLIST(rpcb) returns (rpcb_entry_list_ptr). 113 % * Same as RPCBPROC_GETADDR except that it returns a list of all the 114 % * addresses registered for the combination (prog, vers) (for all 115 % * transports). 116 % * 117 % * RPCBPROC_GETSTAT(void) returns (rpcb_stat_byvers) 118 % * Returns the statistics about the kind of requests received by rpcbind. 119 % */ 120 % 121 %/* 122 % * A mapping of (program, version, network ID) to address 123 % */ 124 struct rpcb { 125 rpcprog_t r_prog; /* program number */ 126 rpcvers_t r_vers; /* version number */ 127 string r_netid<>; /* network id */ 128 string r_addr<>; /* universal address */ 129 string r_owner<>; /* owner of this service */ 130 }; 131 #ifdef RPC_HDR 132 % 133 %typedef rpcb RPCB; 134 % 135 #endif 136 % 137 %/* 138 % * A list of mappings 139 % * 140 % * Below are two definitions for the rpcblist structure. This is done because 141 % * xdr_rpcblist() is specified to take a struct rpcblist **, rather than a 142 % * struct rpcblist * that rpcgen would produce. One version of the rpcblist 143 % * structure (actually called rp__list) is used with rpcgen, and the other is 144 % * defined only in the header file for compatibility with the specified 145 % * interface. 146 % */ 147 148 struct rp__list { 149 rpcb rpcb_map; 150 struct rp__list *rpcb_next; 151 }; 152 153 typedef rp__list *rpcblist_ptr; /* results of RPCBPROC_DUMP */ 154 155 #ifdef RPC_HDR 156 % 157 %typedef struct rp__list rpcblist; 158 %typedef struct rp__list RPCBLIST; 159 % 160 %#ifndef __cplusplus 161 %struct rpcblist { 162 % RPCB rpcb_map; 163 % struct rpcblist *rpcb_next; 164 %}; 165 %#endif 166 % 167 %#ifdef __cplusplus 168 %extern "C" { 169 %#endif 170 %extern bool_t xdr_rpcblist(XDR *, rpcblist**); 171 %#ifdef __cplusplus 172 %} 173 %#endif 174 % 175 #endif 176 177 % 178 %/* 179 % * Arguments of remote calls 180 % */ 181 struct rpcb_rmtcallargs { 182 rpcprog_t prog; /* program number */ 183 rpcvers_t vers; /* version number */ 184 rpcproc_t proc; /* procedure number */ 185 opaque args<>; /* argument */ 186 }; 187 #ifdef RPC_HDR 188 % 189 %/* 190 % * Client-side only representation of rpcb_rmtcallargs structure. 191 % * 192 % * The routine that XDRs the rpcb_rmtcallargs structure must deal with the 193 % * opaque arguments in the "args" structure. xdr_rpcb_rmtcallargs() needs to 194 % * be passed the XDR routine that knows the args' structure. This routine 195 % * doesn't need to go over-the-wire (and it wouldn't make sense anyway) since 196 % * the application being called already knows the args structure. So we use a 197 % * different "XDR" structure on the client side, r_rpcb_rmtcallargs, which 198 % * includes the args' XDR routine. 199 % */ 200 %struct r_rpcb_rmtcallargs { 201 % rpcprog_t prog; 202 % rpcvers_t vers; 203 % rpcproc_t proc; 204 % struct { 205 % u_int args_len; 206 % char *args_val; 207 % } args; 208 % xdrproc_t xdr_args; /* encodes args */ 209 %}; 210 % 211 #endif /* def RPC_HDR */ 212 % 213 %/* 214 % * Results of the remote call 215 % */ 216 struct rpcb_rmtcallres { 217 string addr<>; /* remote universal address */ 218 opaque results<>; /* result */ 219 }; 220 #ifdef RPC_HDR 221 % 222 %/* 223 % * Client-side only representation of rpcb_rmtcallres structure. 224 % */ 225 %struct r_rpcb_rmtcallres { 226 % char *addr; 227 % struct { 228 % u_int32_t results_len; 229 % char *results_val; 230 % } results; 231 % xdrproc_t xdr_res; /* decodes results */ 232 %}; 233 #endif /* RPC_HDR */ 234 % 235 %/* 236 % * rpcb_entry contains a merged address of a service on a particular 237 % * transport, plus associated netconfig information. A list of rpcb_entrys 238 % * is returned by RPCBPROC_GETADDRLIST. See netconfig.h for values used 239 % * in r_nc_* fields. 240 % */ 241 struct rpcb_entry { 242 string r_maddr<>; /* merged address of service */ 243 string r_nc_netid<>; /* netid field */ 244 unsigned int r_nc_semantics; /* semantics of transport */ 245 string r_nc_protofmly<>; /* protocol family */ 246 string r_nc_proto<>; /* protocol name */ 247 }; 248 % 249 %/* 250 % * A list of addresses supported by a service. 251 % */ 252 struct rpcb_entry_list { 253 rpcb_entry rpcb_entry_map; 254 struct rpcb_entry_list *rpcb_entry_next; 255 }; 256 257 typedef rpcb_entry_list *rpcb_entry_list_ptr; 258 259 % 260 %/* 261 % * rpcbind statistics 262 % */ 263 % 264 const rpcb_highproc_2 = RPCBPROC_CALLIT; 265 const rpcb_highproc_3 = RPCBPROC_TADDR2UADDR; 266 const rpcb_highproc_4 = RPCBPROC_GETSTAT; 267 268 const RPCBSTAT_HIGHPROC = 13; /* # of procs in rpcbind V4 plus one */ 269 const RPCBVERS_STAT = 3; /* provide only for rpcbind V2, V3 and V4 */ 270 const RPCBVERS_4_STAT = 2; 271 const RPCBVERS_3_STAT = 1; 272 const RPCBVERS_2_STAT = 0; 273 % 274 %/* Link list of all the stats about getport and getaddr */ 275 struct rpcbs_addrlist { 276 rpcprog_t prog; 277 rpcvers_t vers; 278 int success; 279 int failure; 280 string netid<>; 281 struct rpcbs_addrlist *next; 282 }; 283 % 284 %/* Link list of all the stats about rmtcall */ 285 struct rpcbs_rmtcalllist { 286 rpcprog_t prog; 287 rpcvers_t vers; 288 rpcproc_t proc; 289 int success; 290 int failure; 291 int indirect; /* whether callit or indirect */ 292 string netid<>; 293 struct rpcbs_rmtcalllist *next; 294 }; 295 296 typedef int rpcbs_proc[RPCBSTAT_HIGHPROC]; 297 typedef rpcbs_addrlist *rpcbs_addrlist_ptr; 298 typedef rpcbs_rmtcalllist *rpcbs_rmtcalllist_ptr; 299 300 struct rpcb_stat { 301 rpcbs_proc info; 302 int setinfo; 303 int unsetinfo; 304 rpcbs_addrlist_ptr addrinfo; 305 rpcbs_rmtcalllist_ptr rmtinfo; 306 }; 307 % 308 %/* 309 % * One rpcb_stat structure is returned for each version of rpcbind 310 % * being monitored. 311 % */ 312 313 typedef rpcb_stat rpcb_stat_byvers[RPCBVERS_STAT]; 314 315 #ifdef RPC_HDR 316 % 317 %/* 318 % * We don't define netbuf in RPCL, since it would contain structure member 319 % * names that would conflict with the definition of struct netbuf in 320 % * <tiuser.h>. Instead we merely declare the XDR routine xdr_netbuf() here, 321 % * and implement it ourselves in rpc/rpcb_prot.c. 322 % */ 323 %#ifdef __cplusplus 324 %extern "C" bool_t xdr_netbuf(XDR *, struct netbuf *); 325 % 326 %#else /* __STDC__ */ 327 %extern bool_t xdr_netbuf(XDR *, struct netbuf *); 328 % 329 %#endif 330 #endif /* def RPC_HDR */ 331 332 /* 333 * rpcbind procedures 334 */ 335 program RPCBPROG { 336 version RPCBVERS { 337 bool 338 RPCBPROC_SET(rpcb) = 1; 339 340 bool 341 RPCBPROC_UNSET(rpcb) = 2; 342 343 string 344 RPCBPROC_GETADDR(rpcb) = 3; 345 346 rpcblist_ptr 347 RPCBPROC_DUMP(void) = 4; 348 349 rpcb_rmtcallres 350 RPCBPROC_CALLIT(rpcb_rmtcallargs) = 5; 351 352 unsigned int 353 RPCBPROC_GETTIME(void) = 6; 354 355 struct netbuf 356 RPCBPROC_UADDR2TADDR(string) = 7; 357 358 string 359 RPCBPROC_TADDR2UADDR(struct netbuf) = 8; 360 } = 3; 361 362 version RPCBVERS4 { 363 bool 364 RPCBPROC_SET(rpcb) = 1; 365 366 bool 367 RPCBPROC_UNSET(rpcb) = 2; 368 369 string 370 RPCBPROC_GETADDR(rpcb) = 3; 371 372 rpcblist_ptr 373 RPCBPROC_DUMP(void) = 4; 374 375 /* 376 * NOTE: RPCBPROC_BCAST has the same functionality as CALLIT; 377 * the new name is intended to indicate that this 378 * procedure should be used for broadcast RPC, and 379 * RPCBPROC_INDIRECT should be used for indirect calls. 380 */ 381 rpcb_rmtcallres 382 RPCBPROC_BCAST(rpcb_rmtcallargs) = RPCBPROC_CALLIT; 383 384 unsigned int 385 RPCBPROC_GETTIME(void) = 6; 386 387 struct netbuf 388 RPCBPROC_UADDR2TADDR(string) = 7; 389 390 string 391 RPCBPROC_TADDR2UADDR(struct netbuf) = 8; 392 393 string 394 RPCBPROC_GETVERSADDR(rpcb) = 9; 395 396 rpcb_rmtcallres 397 RPCBPROC_INDIRECT(rpcb_rmtcallargs) = 10; 398 399 rpcb_entry_list_ptr 400 RPCBPROC_GETADDRLIST(rpcb) = 11; 401 402 rpcb_stat_byvers 403 RPCBPROC_GETSTAT(void) = 12; 404 } = 4; 405 } = 100000; 406 #ifdef RPC_HDR 407 % 408 %#define RPCBVERS_3 RPCBVERS 409 %#define RPCBVERS_4 RPCBVERS4 410 % 411 %#define _PATH_RPCBINDSOCK "/var/run/rpcbind.sock" 412 % 413 %#else /* ndef _KERNEL */ 414 %#ifdef __cplusplus 415 %extern "C" { 416 %#endif 417 % 418 %/* 419 % * A mapping of (program, version, network ID) to address 420 % */ 421 %struct rpcb { 422 % rpcprog_t r_prog; /* program number */ 423 % rpcvers_t r_vers; /* version number */ 424 % char *r_netid; /* network id */ 425 % char *r_addr; /* universal address */ 426 % char *r_owner; /* owner of the mapping */ 427 %}; 428 %typedef struct rpcb RPCB; 429 % 430 %/* 431 % * A list of mappings 432 % */ 433 %struct rpcblist { 434 % RPCB rpcb_map; 435 % struct rpcblist *rpcb_next; 436 %}; 437 %typedef struct rpcblist RPCBLIST; 438 %typedef struct rpcblist *rpcblist_ptr; 439 % 440 %/* 441 % * Remote calls arguments 442 % */ 443 %struct rpcb_rmtcallargs { 444 % rpcprog_t prog; /* program number */ 445 % rpcvers_t vers; /* version number */ 446 % rpcproc_t proc; /* procedure number */ 447 % u_int32_t arglen; /* arg len */ 448 % caddr_t args_ptr; /* argument */ 449 % xdrproc_t xdr_args; /* XDR routine for argument */ 450 %}; 451 %typedef struct rpcb_rmtcallargs rpcb_rmtcallargs; 452 % 453 %/* 454 % * Remote calls results 455 % */ 456 %struct rpcb_rmtcallres { 457 % char *addr_ptr; /* remote universal address */ 458 % u_int32_t resultslen; /* results length */ 459 % caddr_t results_ptr; /* results */ 460 % xdrproc_t xdr_results; /* XDR routine for result */ 461 %}; 462 %typedef struct rpcb_rmtcallres rpcb_rmtcallres; 463 % 464 %struct rpcb_entry { 465 % char *r_maddr; 466 % char *r_nc_netid; 467 % unsigned int r_nc_semantics; 468 % char *r_nc_protofmly; 469 % char *r_nc_proto; 470 %}; 471 %typedef struct rpcb_entry rpcb_entry; 472 % 473 %/* 474 % * A list of addresses supported by a service. 475 % */ 476 % 477 %struct rpcb_entry_list { 478 % rpcb_entry rpcb_entry_map; 479 % struct rpcb_entry_list *rpcb_entry_next; 480 %}; 481 %typedef struct rpcb_entry_list rpcb_entry_list; 482 % 483 %typedef rpcb_entry_list *rpcb_entry_list_ptr; 484 % 485 %/* 486 % * rpcbind statistics 487 % */ 488 % 489 %#define rpcb_highproc_2 RPCBPROC_CALLIT 490 %#define rpcb_highproc_3 RPCBPROC_TADDR2UADDR 491 %#define rpcb_highproc_4 RPCBPROC_GETSTAT 492 %#define RPCBSTAT_HIGHPROC 13 493 %#define RPCBVERS_STAT 3 494 %#define RPCBVERS_4_STAT 2 495 %#define RPCBVERS_3_STAT 1 496 %#define RPCBVERS_2_STAT 0 497 % 498 %/* Link list of all the stats about getport and getaddr */ 499 % 500 %struct rpcbs_addrlist { 501 % rpcprog_t prog; 502 % rpcvers_t vers; 503 % int success; 504 % int failure; 505 % char *netid; 506 % struct rpcbs_addrlist *next; 507 %}; 508 %typedef struct rpcbs_addrlist rpcbs_addrlist; 509 % 510 %/* Link list of all the stats about rmtcall */ 511 % 512 %struct rpcbs_rmtcalllist { 513 % rpcprog_t prog; 514 % rpcvers_t vers; 515 % rpcproc_t proc; 516 % int success; 517 % int failure; 518 % int indirect; 519 % char *netid; 520 % struct rpcbs_rmtcalllist *next; 521 %}; 522 %typedef struct rpcbs_rmtcalllist rpcbs_rmtcalllist; 523 % 524 %typedef int rpcbs_proc[RPCBSTAT_HIGHPROC]; 525 % 526 %typedef rpcbs_addrlist *rpcbs_addrlist_ptr; 527 % 528 %typedef rpcbs_rmtcalllist *rpcbs_rmtcalllist_ptr; 529 % 530 %struct rpcb_stat { 531 % rpcbs_proc info; 532 % int setinfo; 533 % int unsetinfo; 534 % rpcbs_addrlist_ptr addrinfo; 535 % rpcbs_rmtcalllist_ptr rmtinfo; 536 %}; 537 %typedef struct rpcb_stat rpcb_stat; 538 % 539 %/* 540 % * One rpcb_stat structure is returned for each version of rpcbind 541 % * being monitored. 542 % */ 543 % 544 %typedef rpcb_stat rpcb_stat_byvers[RPCBVERS_STAT]; 545 % 546 %#ifdef __cplusplus 547 %} 548 %#endif 549 % 550 %#endif /* ndef _KERNEL */ 551 #endif /* RPC_HDR */ 552