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