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) 1984,1989 by Sun Microsystems, Inc. 24*7c478bd9Sstevel@tonic-gate % */ 25*7c478bd9Sstevel@tonic-gate 26*7c478bd9Sstevel@tonic-gate %/* from pmap_prot.x */ 27*7c478bd9Sstevel@tonic-gate 28*7c478bd9Sstevel@tonic-gate #ifdef RPC_HDR 29*7c478bd9Sstevel@tonic-gate % 30*7c478bd9Sstevel@tonic-gate %#ifndef _KERNEL 31*7c478bd9Sstevel@tonic-gate % 32*7c478bd9Sstevel@tonic-gate #endif 33*7c478bd9Sstevel@tonic-gate 34*7c478bd9Sstevel@tonic-gate /* 35*7c478bd9Sstevel@tonic-gate * Port Mapper Protocol Specification (in RPC Language) 36*7c478bd9Sstevel@tonic-gate * derived from RFC 1057 37*7c478bd9Sstevel@tonic-gate */ 38*7c478bd9Sstevel@tonic-gate 39*7c478bd9Sstevel@tonic-gate %/* 40*7c478bd9Sstevel@tonic-gate % * Protocol for the local binder service, or pmap. 41*7c478bd9Sstevel@tonic-gate % * 42*7c478bd9Sstevel@tonic-gate % * Copyright (C) 1984, Sun Microsystems, Inc. 43*7c478bd9Sstevel@tonic-gate % * 44*7c478bd9Sstevel@tonic-gate % * The following procedures are supported by the protocol: 45*7c478bd9Sstevel@tonic-gate % * 46*7c478bd9Sstevel@tonic-gate % * PMAPPROC_NULL() returns () 47*7c478bd9Sstevel@tonic-gate % * takes nothing, returns nothing 48*7c478bd9Sstevel@tonic-gate % * 49*7c478bd9Sstevel@tonic-gate % * PMAPPROC_SET(struct pmap) returns (bool_t) 50*7c478bd9Sstevel@tonic-gate % * TRUE is success, FALSE is failure. Registers the tuple 51*7c478bd9Sstevel@tonic-gate % * [prog, vers, prot, port]. 52*7c478bd9Sstevel@tonic-gate % * 53*7c478bd9Sstevel@tonic-gate % * PMAPPROC_UNSET(struct pmap) returns (bool_t) 54*7c478bd9Sstevel@tonic-gate % * TRUE is success, FALSE is failure. Un-registers pair 55*7c478bd9Sstevel@tonic-gate % * [prog, vers]. prot and port are ignored. 56*7c478bd9Sstevel@tonic-gate % * 57*7c478bd9Sstevel@tonic-gate % * PMAPPROC_GETPORT(struct pmap) returns (rpcport_t). 58*7c478bd9Sstevel@tonic-gate % * 0 is failure. Otherwise returns the port number where the pair 59*7c478bd9Sstevel@tonic-gate % * [prog, vers] is registered. It may lie! 60*7c478bd9Sstevel@tonic-gate % * 61*7c478bd9Sstevel@tonic-gate % * PMAPPROC_DUMP() RETURNS (struct pmaplist_ptr) 62*7c478bd9Sstevel@tonic-gate % * 63*7c478bd9Sstevel@tonic-gate % * PMAPPROC_CALLIT(unsigned, unsigned, unsigned, string<>) 64*7c478bd9Sstevel@tonic-gate % * RETURNS (port, string<>); 65*7c478bd9Sstevel@tonic-gate % * usage: encapsulatedresults = PMAPPROC_CALLIT(prog, vers, proc, 66*7c478bd9Sstevel@tonic-gate % * encapsulatedargs); 67*7c478bd9Sstevel@tonic-gate % * Calls the procedure on the local machine. If it is not registered, 68*7c478bd9Sstevel@tonic-gate % * this procedure is quite; ie it does not return error information!!! 69*7c478bd9Sstevel@tonic-gate % * This procedure only is supported on rpc/udp and calls via 70*7c478bd9Sstevel@tonic-gate % * rpc/udp. This routine only passes null authentication parameters. 71*7c478bd9Sstevel@tonic-gate % * This file has no interface to xdr routines for PMAPPROC_CALLIT. 72*7c478bd9Sstevel@tonic-gate % * 73*7c478bd9Sstevel@tonic-gate % * The service supports remote procedure calls on udp/ip or tcp/ip socket 111. 74*7c478bd9Sstevel@tonic-gate % */ 75*7c478bd9Sstevel@tonic-gate % 76*7c478bd9Sstevel@tonic-gate const PMAPPORT = 111; /* portmapper port number */ 77*7c478bd9Sstevel@tonic-gate % 78*7c478bd9Sstevel@tonic-gate % 79*7c478bd9Sstevel@tonic-gate %/* 80*7c478bd9Sstevel@tonic-gate % * A mapping of (program, version, protocol) to port number 81*7c478bd9Sstevel@tonic-gate % */ 82*7c478bd9Sstevel@tonic-gate 83*7c478bd9Sstevel@tonic-gate struct pmap { 84*7c478bd9Sstevel@tonic-gate rpcprog_t pm_prog; 85*7c478bd9Sstevel@tonic-gate rpcvers_t pm_vers; 86*7c478bd9Sstevel@tonic-gate rpcprot_t pm_prot; 87*7c478bd9Sstevel@tonic-gate rpcport_t pm_port; 88*7c478bd9Sstevel@tonic-gate }; 89*7c478bd9Sstevel@tonic-gate #ifdef RPC_HDR 90*7c478bd9Sstevel@tonic-gate % 91*7c478bd9Sstevel@tonic-gate %typedef pmap PMAP; 92*7c478bd9Sstevel@tonic-gate % 93*7c478bd9Sstevel@tonic-gate #endif 94*7c478bd9Sstevel@tonic-gate % 95*7c478bd9Sstevel@tonic-gate %/* 96*7c478bd9Sstevel@tonic-gate % * Supported values for the "prot" field 97*7c478bd9Sstevel@tonic-gate % */ 98*7c478bd9Sstevel@tonic-gate % 99*7c478bd9Sstevel@tonic-gate const PMAP_IPPROTO_TCP = 6; /* protocol number for TCP/IP */ 100*7c478bd9Sstevel@tonic-gate const PMAP_IPPROTO_UDP = 17; /* protocol number for UDP/IP */ 101*7c478bd9Sstevel@tonic-gate % 102*7c478bd9Sstevel@tonic-gate % 103*7c478bd9Sstevel@tonic-gate %/* 104*7c478bd9Sstevel@tonic-gate % * A list of mappings 105*7c478bd9Sstevel@tonic-gate % * 106*7c478bd9Sstevel@tonic-gate % * Below are two definitions for the pmaplist structure. This is done because 107*7c478bd9Sstevel@tonic-gate % * xdr_pmaplist() is specified to take a struct pmaplist **, rather than a 108*7c478bd9Sstevel@tonic-gate % * struct pmaplist * that rpcgen would produce. One version of the pmaplist 109*7c478bd9Sstevel@tonic-gate % * structure (actually called pm__list) is used with rpcgen, and the other is 110*7c478bd9Sstevel@tonic-gate % * defined only in the header file for compatibility with the specified 111*7c478bd9Sstevel@tonic-gate % * interface. 112*7c478bd9Sstevel@tonic-gate % */ 113*7c478bd9Sstevel@tonic-gate 114*7c478bd9Sstevel@tonic-gate struct pm__list { 115*7c478bd9Sstevel@tonic-gate pmap pml_map; 116*7c478bd9Sstevel@tonic-gate struct pm__list *pml_next; 117*7c478bd9Sstevel@tonic-gate }; 118*7c478bd9Sstevel@tonic-gate 119*7c478bd9Sstevel@tonic-gate typedef pm__list *pmaplist_ptr; /* results of PMAPPROC_DUMP */ 120*7c478bd9Sstevel@tonic-gate 121*7c478bd9Sstevel@tonic-gate #ifdef RPC_HDR 122*7c478bd9Sstevel@tonic-gate % 123*7c478bd9Sstevel@tonic-gate %struct pmaplist { 124*7c478bd9Sstevel@tonic-gate % PMAP pml_map; 125*7c478bd9Sstevel@tonic-gate % struct pmaplist *pml_next; 126*7c478bd9Sstevel@tonic-gate %}; 127*7c478bd9Sstevel@tonic-gate % 128*7c478bd9Sstevel@tonic-gate %typedef struct pmaplist pmaplist; 129*7c478bd9Sstevel@tonic-gate %typedef struct pmaplist PMAPLIST; 130*7c478bd9Sstevel@tonic-gate % 131*7c478bd9Sstevel@tonic-gate %#ifdef __cplusplus 132*7c478bd9Sstevel@tonic-gate %extern "C" { 133*7c478bd9Sstevel@tonic-gate %#endif 134*7c478bd9Sstevel@tonic-gate %#ifdef __STDC__ 135*7c478bd9Sstevel@tonic-gate %extern bool_t xdr_pmaplist(XDR *, pmaplist**); 136*7c478bd9Sstevel@tonic-gate %#else /* K&R C */ 137*7c478bd9Sstevel@tonic-gate %bool_t xdr_pmaplist(); 138*7c478bd9Sstevel@tonic-gate %#endif 139*7c478bd9Sstevel@tonic-gate %#ifdef __cplusplus 140*7c478bd9Sstevel@tonic-gate %} 141*7c478bd9Sstevel@tonic-gate %#endif 142*7c478bd9Sstevel@tonic-gate % 143*7c478bd9Sstevel@tonic-gate #endif 144*7c478bd9Sstevel@tonic-gate 145*7c478bd9Sstevel@tonic-gate % 146*7c478bd9Sstevel@tonic-gate %/* 147*7c478bd9Sstevel@tonic-gate % * Arguments to callit 148*7c478bd9Sstevel@tonic-gate % */ 149*7c478bd9Sstevel@tonic-gate 150*7c478bd9Sstevel@tonic-gate struct rmtcallargs { 151*7c478bd9Sstevel@tonic-gate rpcprog_t prog; 152*7c478bd9Sstevel@tonic-gate rpcvers_t vers; 153*7c478bd9Sstevel@tonic-gate rpcproc_t proc; 154*7c478bd9Sstevel@tonic-gate opaque args<>; 155*7c478bd9Sstevel@tonic-gate }; 156*7c478bd9Sstevel@tonic-gate #ifdef RPC_HDR 157*7c478bd9Sstevel@tonic-gate % 158*7c478bd9Sstevel@tonic-gate %/* 159*7c478bd9Sstevel@tonic-gate % * Client-side only representation of rmtcallargs structure. 160*7c478bd9Sstevel@tonic-gate % * 161*7c478bd9Sstevel@tonic-gate % * The routine that XDRs the rmtcallargs structure must deal with the 162*7c478bd9Sstevel@tonic-gate % * opaque arguments in the "args" structure. xdr_rmtcall_args() needs to be 163*7c478bd9Sstevel@tonic-gate % * passed the XDR routine that knows the args' structure. This routine 164*7c478bd9Sstevel@tonic-gate % * doesn't need to go over-the-wire (and it wouldn't make sense anyway) since 165*7c478bd9Sstevel@tonic-gate % * the application being called knows the args structure already. So we use a 166*7c478bd9Sstevel@tonic-gate % * different "XDR" structure on the client side, p_rmtcallargs, which includes 167*7c478bd9Sstevel@tonic-gate % * the args' XDR routine. 168*7c478bd9Sstevel@tonic-gate % */ 169*7c478bd9Sstevel@tonic-gate %struct p_rmtcallargs { 170*7c478bd9Sstevel@tonic-gate % rpcprog_t prog; 171*7c478bd9Sstevel@tonic-gate % rpcvers_t vers; 172*7c478bd9Sstevel@tonic-gate % rpcproc_t proc; 173*7c478bd9Sstevel@tonic-gate % struct { 174*7c478bd9Sstevel@tonic-gate % u_int args_len; 175*7c478bd9Sstevel@tonic-gate % char *args_val; 176*7c478bd9Sstevel@tonic-gate % } args; 177*7c478bd9Sstevel@tonic-gate % xdrproc_t xdr_args; /* encodes args */ 178*7c478bd9Sstevel@tonic-gate %}; 179*7c478bd9Sstevel@tonic-gate % 180*7c478bd9Sstevel@tonic-gate #endif /* def RPC_HDR */ 181*7c478bd9Sstevel@tonic-gate % 182*7c478bd9Sstevel@tonic-gate % 183*7c478bd9Sstevel@tonic-gate %/* 184*7c478bd9Sstevel@tonic-gate % * Results of callit 185*7c478bd9Sstevel@tonic-gate % */ 186*7c478bd9Sstevel@tonic-gate 187*7c478bd9Sstevel@tonic-gate struct rmtcallres { 188*7c478bd9Sstevel@tonic-gate rpcport_t port; 189*7c478bd9Sstevel@tonic-gate opaque res<>; 190*7c478bd9Sstevel@tonic-gate }; 191*7c478bd9Sstevel@tonic-gate #ifdef RPC_HDR 192*7c478bd9Sstevel@tonic-gate % 193*7c478bd9Sstevel@tonic-gate %/* 194*7c478bd9Sstevel@tonic-gate % * Client-side only representation of rmtcallres structure. 195*7c478bd9Sstevel@tonic-gate % */ 196*7c478bd9Sstevel@tonic-gate %struct p_rmtcallres { 197*7c478bd9Sstevel@tonic-gate % rpcport_t port; 198*7c478bd9Sstevel@tonic-gate % struct { 199*7c478bd9Sstevel@tonic-gate % u_int res_len; 200*7c478bd9Sstevel@tonic-gate % char *res_val; 201*7c478bd9Sstevel@tonic-gate % } res; 202*7c478bd9Sstevel@tonic-gate % xdrproc_t xdr_res; /* decodes res */ 203*7c478bd9Sstevel@tonic-gate %}; 204*7c478bd9Sstevel@tonic-gate % 205*7c478bd9Sstevel@tonic-gate #endif /* def RPC_HDR */ 206*7c478bd9Sstevel@tonic-gate 207*7c478bd9Sstevel@tonic-gate /* 208*7c478bd9Sstevel@tonic-gate * Port mapper procedures 209*7c478bd9Sstevel@tonic-gate */ 210*7c478bd9Sstevel@tonic-gate 211*7c478bd9Sstevel@tonic-gate program PMAPPROG { 212*7c478bd9Sstevel@tonic-gate version PMAPVERS { 213*7c478bd9Sstevel@tonic-gate void 214*7c478bd9Sstevel@tonic-gate PMAPPROC_NULL(void) = 0; 215*7c478bd9Sstevel@tonic-gate 216*7c478bd9Sstevel@tonic-gate bool 217*7c478bd9Sstevel@tonic-gate PMAPPROC_SET(pmap) = 1; 218*7c478bd9Sstevel@tonic-gate 219*7c478bd9Sstevel@tonic-gate bool 220*7c478bd9Sstevel@tonic-gate PMAPPROC_UNSET(pmap) = 2; 221*7c478bd9Sstevel@tonic-gate 222*7c478bd9Sstevel@tonic-gate rpcport_t 223*7c478bd9Sstevel@tonic-gate PMAPPROC_GETPORT(pmap) = 3; 224*7c478bd9Sstevel@tonic-gate 225*7c478bd9Sstevel@tonic-gate pmaplist_ptr 226*7c478bd9Sstevel@tonic-gate PMAPPROC_DUMP(void) = 4; 227*7c478bd9Sstevel@tonic-gate 228*7c478bd9Sstevel@tonic-gate rmtcallres 229*7c478bd9Sstevel@tonic-gate PMAPPROC_CALLIT(rmtcallargs) = 5; 230*7c478bd9Sstevel@tonic-gate } = 2; 231*7c478bd9Sstevel@tonic-gate } = 100000; 232*7c478bd9Sstevel@tonic-gate % 233*7c478bd9Sstevel@tonic-gate #ifdef RPC_HDR 234*7c478bd9Sstevel@tonic-gate %#define PMAPVERS_PROTO ((rpcvers_t)2) 235*7c478bd9Sstevel@tonic-gate %#define PMAPVERS_ORIG ((rpcvers_t)1) 236*7c478bd9Sstevel@tonic-gate % 237*7c478bd9Sstevel@tonic-gate %#else /* ndef _KERNEL */ 238*7c478bd9Sstevel@tonic-gate % 239*7c478bd9Sstevel@tonic-gate %#include <rpc/pmap_rmt.h> 240*7c478bd9Sstevel@tonic-gate % 241*7c478bd9Sstevel@tonic-gate %#ifdef __cplusplus 242*7c478bd9Sstevel@tonic-gate %extern "C" { 243*7c478bd9Sstevel@tonic-gate %#endif 244*7c478bd9Sstevel@tonic-gate % 245*7c478bd9Sstevel@tonic-gate %#define PMAPPORT 111 246*7c478bd9Sstevel@tonic-gate % 247*7c478bd9Sstevel@tonic-gate %struct pmap { 248*7c478bd9Sstevel@tonic-gate % rpcprog_t pm_prog; 249*7c478bd9Sstevel@tonic-gate % rpcvers_t pm_vers; 250*7c478bd9Sstevel@tonic-gate % rpcprot_t pm_prot; 251*7c478bd9Sstevel@tonic-gate % rpcport_t pm_port; 252*7c478bd9Sstevel@tonic-gate %}; 253*7c478bd9Sstevel@tonic-gate %typedef struct pmap PMAP; 254*7c478bd9Sstevel@tonic-gate %#ifdef __STDC__ 255*7c478bd9Sstevel@tonic-gate %extern bool_t xdr_pmap (XDR *, struct pmap *); 256*7c478bd9Sstevel@tonic-gate %#else 257*7c478bd9Sstevel@tonic-gate %extern bool_t xdr_pmap (); 258*7c478bd9Sstevel@tonic-gate %#endif 259*7c478bd9Sstevel@tonic-gate % 260*7c478bd9Sstevel@tonic-gate %struct pmaplist { 261*7c478bd9Sstevel@tonic-gate % struct pmap pml_map; 262*7c478bd9Sstevel@tonic-gate % struct pmaplist *pml_next; 263*7c478bd9Sstevel@tonic-gate %}; 264*7c478bd9Sstevel@tonic-gate %typedef struct pmaplist PMAPLIST; 265*7c478bd9Sstevel@tonic-gate %typedef struct pmaplist *pmaplist_ptr; 266*7c478bd9Sstevel@tonic-gate % 267*7c478bd9Sstevel@tonic-gate % 268*7c478bd9Sstevel@tonic-gate %#ifdef __cplusplus 269*7c478bd9Sstevel@tonic-gate %} 270*7c478bd9Sstevel@tonic-gate %#endif 271*7c478bd9Sstevel@tonic-gate % 272*7c478bd9Sstevel@tonic-gate %#endif /* ndef _KERNEL */ 273*7c478bd9Sstevel@tonic-gate #endif 274*7c478bd9Sstevel@tonic-gate 275