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