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