pmap_prot.x revision 114629
166512Sarchie%/* 266512Sarchie% * Sun RPC is a product of Sun Microsystems, Inc. and is provided for 366512Sarchie% * unrestricted use provided that this legend is included on all tape 466512Sarchie% * media and as a part of the software program in whole or part. Users 566512Sarchie% * may copy or modify Sun RPC without charge, but are not authorized 666512Sarchie% * to license or distribute it to anyone else except as part of a product or 766512Sarchie% * program developed by the user. 866512Sarchie% * 9156313Sschweikh% * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE 1066512Sarchie% * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR 1166512Sarchie% * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. 1266512Sarchie% * 1366512Sarchie% * Sun RPC is provided with no support and without any obligation on the 1494477Sjulian% * part of Sun Microsystems, Inc. to assist in its use, correction, 1566512Sarchie% * modification or enhancement. 1666512Sarchie% * 1766512Sarchie% * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE 1866512Sarchie% * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC 1966512Sarchie% * OR ANY PART THEREOF. 2066512Sarchie% * 2166512Sarchie% * In no event will Sun Microsystems, Inc. be liable for any lost revenue 2266512Sarchie% * or profits or other special, indirect and consequential damages, even if 2366512Sarchie% * Sun has been advised of the possibility of such damages. 2466512Sarchie% * 2566512Sarchie% * Sun Microsystems, Inc. 2666512Sarchie% * 2550 Garcia Avenue 2794477Sjulian% * Mountain View, California 94043 2894477Sjulian% */ 2994477Sjulian%/* 30156313Sschweikh% * Copyright (c) 1984,1989 by Sun Microsystems, Inc. 31156313Sschweikh% */ 32156313Sschweikh 3366512Sarchie%/* from pmap_prot.x */ 34156313Sschweikh 3566512Sarchie#ifdef RPC_HDR 3666512Sarchie% 3766512Sarchie%#pragma ident "@(#)pmap_prot.x 1.6 94/04/29 SMI" 3866512Sarchie%#include <sys/cdefs.h> 3966512Sarchie%__FBSDID("$FreeBSD: head/include/rpcsvc/pmap_prot.x 114629 2003-05-04 02:51:42Z obrien $"); 4094477Sjulian% 4166512Sarchie%#ifndef _KERNEL 4266512Sarchie% 43222179Suqs#endif 4466512Sarchie 4594477Sjulian/* 4694477Sjulian * Port Mapper Protocol Specification (in RPC Language) 4766512Sarchie * derived from RFC 1057 48156313Sschweikh */ 49156313Sschweikh 50156313Sschweikh%/* 5166512Sarchie% * Protocol for the local binder service, or pmap. 52156313Sschweikh% * 5366512Sarchie% * Copyright (C) 1984, Sun Microsystems, Inc. 5466512Sarchie% * 5566512Sarchie% * The following procedures are supported by the protocol: 5666512Sarchie% * 5766512Sarchie% * PMAPPROC_NULL() returns () 5866512Sarchie% * takes nothing, returns nothing 5966512Sarchie% * 6066512Sarchie% * PMAPPROC_SET(struct pmap) returns (bool_t) 61156313Sschweikh% * TRUE is success, FALSE is failure. Registers the tuple 6266512Sarchie% * [prog, vers, prot, port]. 6366512Sarchie% * 6466512Sarchie% * PMAPPROC_UNSET(struct pmap) returns (bool_t) 6566512Sarchie% * TRUE is success, FALSE is failure. Un-registers pair 6666512Sarchie% * [prog, vers]. prot and port are ignored. 6766512Sarchie% * 6866512Sarchie% * PMAPPROC_GETPORT(struct pmap) returns (long unsigned). 6966512Sarchie% * 0 is failure. Otherwise returns the port number where the pair 7066512Sarchie% * [prog, vers] is registered. It may lie! 71156313Sschweikh% * 7266512Sarchie% * PMAPPROC_DUMP() RETURNS (struct pmaplist_ptr) 7366512Sarchie% * 74156313Sschweikh% * PMAPPROC_CALLIT(unsigned, unsigned, unsigned, string<>) 7566512Sarchie% * RETURNS (port, string<>); 76156313Sschweikh% * usage: encapsulatedresults = PMAPPROC_CALLIT(prog, vers, proc, 7766512Sarchie% * encapsulatedargs); 7866512Sarchie% * Calls the procedure on the local machine. If it is not registered, 7966512Sarchie% * this procedure is quite; ie it does not return error information!!! 8066512Sarchie% * This procedure only is supported on rpc/udp and calls via 8166512Sarchie% * rpc/udp. This routine only passes null authentication parameters. 8266512Sarchie% * This file has no interface to xdr routines for PMAPPROC_CALLIT. 83156313Sschweikh% * 8466512Sarchie% * The service supports remote procedure calls on udp/ip or tcp/ip socket 111. 8566512Sarchie% */ 86156313Sschweikh% 8794477Sjulianconst PMAPPORT = 111; /* portmapper port number */ 88156313Sschweikh% 8966512Sarchie% 9066512Sarchie%/* 9166512Sarchie% * A mapping of (program, version, protocol) to port number 9266512Sarchie% */ 9366512Sarchie 9466512Sarchiestruct pmap { 95156313Sschweikh unsigned long pm_prog; 9666512Sarchie unsigned long pm_vers; 9766512Sarchie unsigned long pm_prot; 9866512Sarchie unsigned long pm_port; 9966512Sarchie}; 100156313Sschweikh#ifdef RPC_HDR 10166512Sarchie% 10266512Sarchie%typedef pmap PMAP; 10366512Sarchie% 10466512Sarchie#endif 10566512Sarchie% 10666512Sarchie%/* 10766512Sarchie% * Supported values for the "prot" field 10866512Sarchie% */ 10966512Sarchie% 110156313Sschweikhconst PMAP_IPPROTO_TCP = 6; /* protocol number for TCP/IP */ 11194477Sjulianconst PMAP_IPPROTO_UDP = 17; /* protocol number for UDP/IP */ 11266512Sarchie% 11366512Sarchie% 11494477Sjulian%/* 11594477Sjulian% * A list of mappings 11666512Sarchie% * 117156313Sschweikh% * Below are two definitions for the pmaplist structure. This is done because 11866512Sarchie% * xdr_pmaplist() is specified to take a struct pmaplist **, rather than a 11966512Sarchie% * struct pmaplist * that rpcgen would produce. One version of the pmaplist 12066512Sarchie% * structure (actually called pm__list) is used with rpcgen, and the other is 12166512Sarchie% * defined only in the header file for compatibility with the specified 12266512Sarchie% * interface. 12366512Sarchie% */ 124156313Sschweikh 12566512Sarchiestruct pm__list { 12666512Sarchie pmap pml_map; 12794477Sjulian struct pm__list *pml_next; 12866512Sarchie}; 12966512Sarchie 13066512Sarchietypedef pm__list *pmaplist_ptr; /* results of PMAPPROC_DUMP */ 13166512Sarchie 132156313Sschweikh#ifdef RPC_HDR 13366512Sarchie% 13466512Sarchie%typedef struct pm__list pmaplist; 135156313Sschweikh%typedef struct pm__list PMAPLIST; 13666512Sarchie% 13766512Sarchie%#ifndef __cplusplus 13866512Sarchie%struct pmaplist { 13966512Sarchie% PMAP pml_map; 14066512Sarchie% struct pmaplist *pml_next; 14166512Sarchie%}; 14266512Sarchie%#endif 14366512Sarchie% 14466512Sarchie%#ifdef __cplusplus 14566512Sarchie%extern "C" { 14666512Sarchie%#endif 14794477Sjulian%extern bool_t xdr_pmaplist(XDR *, pmaplist**); 14879035Sdd%#ifdef __cplusplus 14966512Sarchie%} 15094477Sjulian%#endif 15194477Sjulian% 15266512Sarchie#endif 15366512Sarchie 154156313Sschweikh% 15566512Sarchie%/* 15666512Sarchie% * Arguments to callit 15766512Sarchie% */ 15866512Sarchie 15966512Sarchiestruct rmtcallargs { 16066512Sarchie unsigned long prog; 16166512Sarchie unsigned long vers; 16266512Sarchie unsigned long proc; 16366512Sarchie opaque args<>; 16466512Sarchie}; 16566512Sarchie#ifdef RPC_HDR 16666512Sarchie% 16766512Sarchie%/* 168156313Sschweikh% * Client-side only representation of rmtcallargs structure. 16966512Sarchie% * 17066512Sarchie% * The routine that XDRs the rmtcallargs structure must deal with the 171% * opaque arguments in the "args" structure. xdr_rmtcall_args() needs to be 172% * passed the XDR routine that knows the args' structure. This routine 173% * doesn't need to go over-the-wire (and it wouldn't make sense anyway) since 174% * the application being called knows the args structure already. So we use a 175% * different "XDR" structure on the client side, p_rmtcallargs, which includes 176% * the args' XDR routine. 177% */ 178%struct p_rmtcallargs { 179% u_long prog; 180% u_long vers; 181% u_long proc; 182% struct { 183% u_int args_len; 184% char *args_val; 185% } args; 186% xdrproc_t xdr_args; /* encodes args */ 187%}; 188% 189#endif /* def RPC_HDR */ 190% 191% 192%/* 193% * Results of callit 194% */ 195 196struct rmtcallres { 197 unsigned long port; 198 opaque res<>; 199}; 200#ifdef RPC_HDR 201% 202%/* 203% * Client-side only representation of rmtcallres structure. 204% */ 205%struct p_rmtcallres { 206% u_long port; 207% struct { 208% u_int res_len; 209% char *res_val; 210% } res; 211% xdrproc_t xdr_res; /* decodes res */ 212%}; 213% 214#endif /* def RPC_HDR */ 215 216/* 217 * Port mapper procedures 218 */ 219 220program PMAPPROG { 221 version PMAPVERS { 222 void 223 PMAPPROC_NULL(void) = 0; 224 225 bool 226 PMAPPROC_SET(pmap) = 1; 227 228 bool 229 PMAPPROC_UNSET(pmap) = 2; 230 231 unsigned long 232 PMAPPROC_GETPORT(pmap) = 3; 233 234 pmaplist_ptr 235 PMAPPROC_DUMP(void) = 4; 236 237 rmtcallres 238 PMAPPROC_CALLIT(rmtcallargs) = 5; 239 } = 2; 240} = 100000; 241% 242#ifdef RPC_HDR 243%#define PMAPVERS_PROTO ((u_long)2) 244%#define PMAPVERS_ORIG ((u_long)1) 245% 246%#else /* ndef _KERNEL */ 247% 248%#include <rpc/pmap_rmt.h> 249% 250%#ifdef __cplusplus 251%extern "C" { 252%#endif 253% 254%#define PMAPPORT 111 255% 256%struct pmap { 257% long unsigned pm_prog; 258% long unsigned pm_vers; 259% long unsigned pm_prot; 260% long unsigned pm_port; 261%}; 262%typedef struct pmap PMAP; 263%extern bool_t xdr_pmap (XDR *, struct pmap *); 264% 265%struct pmaplist { 266% struct pmap pml_map; 267% struct pmaplist *pml_next; 268%}; 269%typedef struct pmaplist PMAPLIST; 270%typedef struct pmaplist *pmaplist_ptr; 271% 272% 273%#ifdef __cplusplus 274%} 275%#endif 276% 277%#endif /* ndef _KERNEL */ 278#endif 279 280