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