126206Swpaul%/* 226206Swpaul% * Sun RPC is a product of Sun Microsystems, Inc. and is provided for 326206Swpaul% * unrestricted use provided that this legend is included on all tape 426206Swpaul% * media and as a part of the software program in whole or part. Users 526206Swpaul% * may copy or modify Sun RPC without charge, but are not authorized 626206Swpaul% * to license or distribute it to anyone else except as part of a product or 726206Swpaul% * program developed by the user. 826206Swpaul% * 926206Swpaul% * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE 1026206Swpaul% * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR 1126206Swpaul% * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. 1226206Swpaul% * 1326206Swpaul% * Sun RPC is provided with no support and without any obligation on the 1426206Swpaul% * part of Sun Microsystems, Inc. to assist in its use, correction, 1526206Swpaul% * modification or enhancement. 1626206Swpaul% * 1726206Swpaul% * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE 1826206Swpaul% * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC 1926206Swpaul% * OR ANY PART THEREOF. 2026206Swpaul% * 2126206Swpaul% * In no event will Sun Microsystems, Inc. be liable for any lost revenue 2226206Swpaul% * or profits or other special, indirect and consequential damages, even if 2326206Swpaul% * Sun has been advised of the possibility of such damages. 2426206Swpaul% * 2526206Swpaul% * Sun Microsystems, Inc. 2626206Swpaul% * 2550 Garcia Avenue 2726206Swpaul% * Mountain View, California 94043 2826206Swpaul% */ 2926206Swpaul%/* 3026206Swpaul% * Copyright (c) 1984,1989 by Sun Microsystems, Inc. 3126206Swpaul% */ 3226206Swpaul 3326206Swpaul%/* from pmap_prot.x */ 3426206Swpaul 3526206Swpaul#ifdef RPC_HDR 3626206Swpaul% 3726206Swpaul%#pragma ident "@(#)pmap_prot.x 1.6 94/04/29 SMI" 38114629Sobrien%#include <sys/cdefs.h> 39114629Sobrien%__FBSDID("$FreeBSD: releng/10.2/include/rpcsvc/pmap_prot.x 114629 2003-05-04 02:51:42Z obrien $"); 4026206Swpaul% 4126206Swpaul%#ifndef _KERNEL 4226206Swpaul% 4326206Swpaul#endif 4426206Swpaul 4526206Swpaul/* 4626206Swpaul * Port Mapper Protocol Specification (in RPC Language) 4726206Swpaul * derived from RFC 1057 4826206Swpaul */ 4926206Swpaul 5026206Swpaul%/* 5126206Swpaul% * Protocol for the local binder service, or pmap. 5226206Swpaul% * 5326206Swpaul% * Copyright (C) 1984, Sun Microsystems, Inc. 5426206Swpaul% * 5526206Swpaul% * The following procedures are supported by the protocol: 5626206Swpaul% * 5726206Swpaul% * PMAPPROC_NULL() returns () 5826206Swpaul% * takes nothing, returns nothing 5926206Swpaul% * 6026206Swpaul% * PMAPPROC_SET(struct pmap) returns (bool_t) 6126206Swpaul% * TRUE is success, FALSE is failure. Registers the tuple 6226206Swpaul% * [prog, vers, prot, port]. 6326206Swpaul% * 6426206Swpaul% * PMAPPROC_UNSET(struct pmap) returns (bool_t) 6526206Swpaul% * TRUE is success, FALSE is failure. Un-registers pair 6626206Swpaul% * [prog, vers]. prot and port are ignored. 6726206Swpaul% * 6826206Swpaul% * PMAPPROC_GETPORT(struct pmap) returns (long unsigned). 6926206Swpaul% * 0 is failure. Otherwise returns the port number where the pair 7026206Swpaul% * [prog, vers] is registered. It may lie! 7126206Swpaul% * 7226206Swpaul% * PMAPPROC_DUMP() RETURNS (struct pmaplist_ptr) 7326206Swpaul% * 7426206Swpaul% * PMAPPROC_CALLIT(unsigned, unsigned, unsigned, string<>) 7526206Swpaul% * RETURNS (port, string<>); 7626206Swpaul% * usage: encapsulatedresults = PMAPPROC_CALLIT(prog, vers, proc, 7726206Swpaul% * encapsulatedargs); 7826206Swpaul% * Calls the procedure on the local machine. If it is not registered, 7926206Swpaul% * this procedure is quite; ie it does not return error information!!! 8026206Swpaul% * This procedure only is supported on rpc/udp and calls via 8126206Swpaul% * rpc/udp. This routine only passes null authentication parameters. 8226206Swpaul% * This file has no interface to xdr routines for PMAPPROC_CALLIT. 8326206Swpaul% * 8426206Swpaul% * The service supports remote procedure calls on udp/ip or tcp/ip socket 111. 8526206Swpaul% */ 8626206Swpaul% 8726206Swpaulconst PMAPPORT = 111; /* portmapper port number */ 8826206Swpaul% 8926206Swpaul% 9026206Swpaul%/* 9126206Swpaul% * A mapping of (program, version, protocol) to port number 9226206Swpaul% */ 9326206Swpaul 9426206Swpaulstruct pmap { 9526206Swpaul unsigned long pm_prog; 9626206Swpaul unsigned long pm_vers; 9726206Swpaul unsigned long pm_prot; 9826206Swpaul unsigned long pm_port; 9926206Swpaul}; 10026206Swpaul#ifdef RPC_HDR 10126206Swpaul% 10226206Swpaul%typedef pmap PMAP; 10326206Swpaul% 10426206Swpaul#endif 10526206Swpaul% 10626206Swpaul%/* 10726206Swpaul% * Supported values for the "prot" field 10826206Swpaul% */ 10926206Swpaul% 11026206Swpaulconst PMAP_IPPROTO_TCP = 6; /* protocol number for TCP/IP */ 11126206Swpaulconst PMAP_IPPROTO_UDP = 17; /* protocol number for UDP/IP */ 11226206Swpaul% 11326206Swpaul% 11426206Swpaul%/* 11526206Swpaul% * A list of mappings 11626206Swpaul% * 11726206Swpaul% * Below are two definitions for the pmaplist structure. This is done because 11826206Swpaul% * xdr_pmaplist() is specified to take a struct pmaplist **, rather than a 11926206Swpaul% * struct pmaplist * that rpcgen would produce. One version of the pmaplist 12026206Swpaul% * structure (actually called pm__list) is used with rpcgen, and the other is 12126206Swpaul% * defined only in the header file for compatibility with the specified 12226206Swpaul% * interface. 12326206Swpaul% */ 12426206Swpaul 12526206Swpaulstruct pm__list { 12626206Swpaul pmap pml_map; 12726206Swpaul struct pm__list *pml_next; 12826206Swpaul}; 12926206Swpaul 13026206Swpaultypedef pm__list *pmaplist_ptr; /* results of PMAPPROC_DUMP */ 13126206Swpaul 13226206Swpaul#ifdef RPC_HDR 13326206Swpaul% 13426206Swpaul%typedef struct pm__list pmaplist; 13526206Swpaul%typedef struct pm__list PMAPLIST; 13626206Swpaul% 13726206Swpaul%#ifndef __cplusplus 13826206Swpaul%struct pmaplist { 13926206Swpaul% PMAP pml_map; 14026206Swpaul% struct pmaplist *pml_next; 14126206Swpaul%}; 14226206Swpaul%#endif 14326206Swpaul% 14426206Swpaul%#ifdef __cplusplus 14526206Swpaul%extern "C" { 14626206Swpaul%#endif 14726206Swpaul%extern bool_t xdr_pmaplist(XDR *, pmaplist**); 14826206Swpaul%#ifdef __cplusplus 14926206Swpaul%} 15026206Swpaul%#endif 15126206Swpaul% 15226206Swpaul#endif 15326206Swpaul 15426206Swpaul% 15526206Swpaul%/* 15626206Swpaul% * Arguments to callit 15726206Swpaul% */ 15826206Swpaul 15926206Swpaulstruct rmtcallargs { 16026206Swpaul unsigned long prog; 16126206Swpaul unsigned long vers; 16226206Swpaul unsigned long proc; 16326206Swpaul opaque args<>; 16426206Swpaul}; 16526206Swpaul#ifdef RPC_HDR 16626206Swpaul% 16726206Swpaul%/* 16826206Swpaul% * Client-side only representation of rmtcallargs structure. 16926206Swpaul% * 17026206Swpaul% * The routine that XDRs the rmtcallargs structure must deal with the 17126206Swpaul% * opaque arguments in the "args" structure. xdr_rmtcall_args() needs to be 17226206Swpaul% * passed the XDR routine that knows the args' structure. This routine 17326206Swpaul% * doesn't need to go over-the-wire (and it wouldn't make sense anyway) since 17426206Swpaul% * the application being called knows the args structure already. So we use a 17526206Swpaul% * different "XDR" structure on the client side, p_rmtcallargs, which includes 17626206Swpaul% * the args' XDR routine. 17726206Swpaul% */ 17826206Swpaul%struct p_rmtcallargs { 17926206Swpaul% u_long prog; 18026206Swpaul% u_long vers; 18126206Swpaul% u_long proc; 18226206Swpaul% struct { 18326206Swpaul% u_int args_len; 18426206Swpaul% char *args_val; 18526206Swpaul% } args; 18626206Swpaul% xdrproc_t xdr_args; /* encodes args */ 18726206Swpaul%}; 18826206Swpaul% 18926206Swpaul#endif /* def RPC_HDR */ 19026206Swpaul% 19126206Swpaul% 19226206Swpaul%/* 19326206Swpaul% * Results of callit 19426206Swpaul% */ 19526206Swpaul 19626206Swpaulstruct rmtcallres { 19726206Swpaul unsigned long port; 19826206Swpaul opaque res<>; 19926206Swpaul}; 20026206Swpaul#ifdef RPC_HDR 20126206Swpaul% 20226206Swpaul%/* 20326206Swpaul% * Client-side only representation of rmtcallres structure. 20426206Swpaul% */ 20526206Swpaul%struct p_rmtcallres { 20626206Swpaul% u_long port; 20726206Swpaul% struct { 20826206Swpaul% u_int res_len; 20926206Swpaul% char *res_val; 21026206Swpaul% } res; 21126206Swpaul% xdrproc_t xdr_res; /* decodes res */ 21226206Swpaul%}; 21326206Swpaul% 21426206Swpaul#endif /* def RPC_HDR */ 21526206Swpaul 21626206Swpaul/* 21726206Swpaul * Port mapper procedures 21826206Swpaul */ 21926206Swpaul 22026206Swpaulprogram PMAPPROG { 22126206Swpaul version PMAPVERS { 22226206Swpaul void 22326206Swpaul PMAPPROC_NULL(void) = 0; 22426206Swpaul 22526206Swpaul bool 22626206Swpaul PMAPPROC_SET(pmap) = 1; 22726206Swpaul 22826206Swpaul bool 22926206Swpaul PMAPPROC_UNSET(pmap) = 2; 23026206Swpaul 23126206Swpaul unsigned long 23226206Swpaul PMAPPROC_GETPORT(pmap) = 3; 23326206Swpaul 23426206Swpaul pmaplist_ptr 23526206Swpaul PMAPPROC_DUMP(void) = 4; 23626206Swpaul 23726206Swpaul rmtcallres 23826206Swpaul PMAPPROC_CALLIT(rmtcallargs) = 5; 23926206Swpaul } = 2; 24026206Swpaul} = 100000; 24126206Swpaul% 24226206Swpaul#ifdef RPC_HDR 24326206Swpaul%#define PMAPVERS_PROTO ((u_long)2) 24426206Swpaul%#define PMAPVERS_ORIG ((u_long)1) 24526206Swpaul% 24626206Swpaul%#else /* ndef _KERNEL */ 24726206Swpaul% 24826206Swpaul%#include <rpc/pmap_rmt.h> 24926206Swpaul% 25026206Swpaul%#ifdef __cplusplus 25126206Swpaul%extern "C" { 25226206Swpaul%#endif 25326206Swpaul% 25426206Swpaul%#define PMAPPORT 111 25526206Swpaul% 25626206Swpaul%struct pmap { 25726206Swpaul% long unsigned pm_prog; 25826206Swpaul% long unsigned pm_vers; 25926206Swpaul% long unsigned pm_prot; 26026206Swpaul% long unsigned pm_port; 26126206Swpaul%}; 26226206Swpaul%typedef struct pmap PMAP; 26326206Swpaul%extern bool_t xdr_pmap (XDR *, struct pmap *); 26426206Swpaul% 26526206Swpaul%struct pmaplist { 26626206Swpaul% struct pmap pml_map; 26726206Swpaul% struct pmaplist *pml_next; 26826206Swpaul%}; 26926206Swpaul%typedef struct pmaplist PMAPLIST; 27026206Swpaul%typedef struct pmaplist *pmaplist_ptr; 27126206Swpaul% 27226206Swpaul% 27326206Swpaul%#ifdef __cplusplus 27426206Swpaul%} 27526206Swpaul%#endif 27626206Swpaul% 27726206Swpaul%#endif /* ndef _KERNEL */ 27826206Swpaul#endif 27926206Swpaul 280