pmap_prot.x revision 303975
1239922Sgonzo%/* 2239922Sgonzo% * Sun RPC is a product of Sun Microsystems, Inc. and is provided for 3239922Sgonzo% * unrestricted use provided that this legend is included on all tape 4239922Sgonzo% * media and as a part of the software program in whole or part. Users 5239922Sgonzo% * may copy or modify Sun RPC without charge, but are not authorized 6239922Sgonzo% * to license or distribute it to anyone else except as part of a product or 7239922Sgonzo% * program developed by the user. 8239922Sgonzo% * 9239922Sgonzo% * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE 10239922Sgonzo% * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR 11239922Sgonzo% * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. 12239922Sgonzo% * 13239922Sgonzo% * Sun RPC is provided with no support and without any obligation on the 14239922Sgonzo% * part of Sun Microsystems, Inc. to assist in its use, correction, 15239922Sgonzo% * modification or enhancement. 16239922Sgonzo% * 17239922Sgonzo% * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE 18239922Sgonzo% * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC 19239922Sgonzo% * OR ANY PART THEREOF. 20239922Sgonzo% * 21239922Sgonzo% * In no event will Sun Microsystems, Inc. be liable for any lost revenue 22239922Sgonzo% * or profits or other special, indirect and consequential damages, even if 23239922Sgonzo% * Sun has been advised of the possibility of such damages. 24239922Sgonzo% * 25239922Sgonzo% * Sun Microsystems, Inc. 26239922Sgonzo% * 2550 Garcia Avenue 27239922Sgonzo% * Mountain View, California 94043 28239922Sgonzo% */ 29239922Sgonzo%/* 30239922Sgonzo% * Copyright (c) 1984,1989 by Sun Microsystems, Inc. 31239922Sgonzo% */ 32239922Sgonzo 33239922Sgonzo%/* from pmap_prot.x */ 34239922Sgonzo 35239922Sgonzo#ifdef RPC_HDR 36239922Sgonzo% 37239922Sgonzo%#pragma ident "@(#)pmap_prot.x 1.6 94/04/29 SMI" 38239922Sgonzo%#include <sys/cdefs.h> 39239922Sgonzo%__FBSDID("$FreeBSD: releng/11.0/include/rpcsvc/pmap_prot.x 114629 2003-05-04 02:51:42Z obrien $"); 40239922Sgonzo% 41239922Sgonzo%#ifndef _KERNEL 42239922Sgonzo% 43239922Sgonzo#endif 44239922Sgonzo 45239922Sgonzo/* 46239922Sgonzo * Port Mapper Protocol Specification (in RPC Language) 47239922Sgonzo * derived from RFC 1057 48239922Sgonzo */ 49239922Sgonzo 50239922Sgonzo%/* 51239922Sgonzo% * Protocol for the local binder service, or pmap. 52239922Sgonzo% * 53239922Sgonzo% * Copyright (C) 1984, Sun Microsystems, Inc. 54239922Sgonzo% * 55239922Sgonzo% * The following procedures are supported by the protocol: 56239922Sgonzo% * 57239922Sgonzo% * PMAPPROC_NULL() returns () 58239922Sgonzo% * takes nothing, returns nothing 59239922Sgonzo% * 60239922Sgonzo% * PMAPPROC_SET(struct pmap) returns (bool_t) 61239922Sgonzo% * TRUE is success, FALSE is failure. Registers the tuple 62239922Sgonzo% * [prog, vers, prot, port]. 63239922Sgonzo% * 64239922Sgonzo% * PMAPPROC_UNSET(struct pmap) returns (bool_t) 65239922Sgonzo% * TRUE is success, FALSE is failure. Un-registers pair 66239922Sgonzo% * [prog, vers]. prot and port are ignored. 67239922Sgonzo% * 68239922Sgonzo% * PMAPPROC_GETPORT(struct pmap) returns (long unsigned). 69239922Sgonzo% * 0 is failure. Otherwise returns the port number where the pair 70239922Sgonzo% * [prog, vers] is registered. It may lie! 71243423Sgonzo% * 72243423Sgonzo% * PMAPPROC_DUMP() RETURNS (struct pmaplist_ptr) 73243423Sgonzo% * 74243423Sgonzo% * PMAPPROC_CALLIT(unsigned, unsigned, unsigned, string<>) 75243423Sgonzo% * RETURNS (port, string<>); 76243423Sgonzo% * usage: encapsulatedresults = PMAPPROC_CALLIT(prog, vers, proc, 77243423Sgonzo% * encapsulatedargs); 78243423Sgonzo% * Calls the procedure on the local machine. If it is not registered, 79243423Sgonzo% * this procedure is quite; ie it does not return error information!!! 80243423Sgonzo% * This procedure only is supported on rpc/udp and calls via 81243423Sgonzo% * rpc/udp. This routine only passes null authentication parameters. 82243423Sgonzo% * This file has no interface to xdr routines for PMAPPROC_CALLIT. 83243423Sgonzo% * 84243423Sgonzo% * The service supports remote procedure calls on udp/ip or tcp/ip socket 111. 85243423Sgonzo% */ 86243423Sgonzo% 87243423Sgonzoconst PMAPPORT = 111; /* portmapper port number */ 88243423Sgonzo% 89243423Sgonzo% 90243423Sgonzo%/* 91243423Sgonzo% * A mapping of (program, version, protocol) to port number 92243423Sgonzo% */ 93243423Sgonzo 94243423Sgonzostruct pmap { 95243423Sgonzo unsigned long pm_prog; 96243423Sgonzo unsigned long pm_vers; 97239922Sgonzo unsigned long pm_prot; 98239922Sgonzo unsigned long pm_port; 99243423Sgonzo}; 100239922Sgonzo#ifdef RPC_HDR 101239922Sgonzo% 102239922Sgonzo%typedef pmap PMAP; 103239922Sgonzo% 104239922Sgonzo#endif 105239922Sgonzo% 106239922Sgonzo%/* 107239922Sgonzo% * Supported values for the "prot" field 108239922Sgonzo% */ 109239922Sgonzo% 110239922Sgonzoconst PMAP_IPPROTO_TCP = 6; /* protocol number for TCP/IP */ 111239922Sgonzoconst PMAP_IPPROTO_UDP = 17; /* protocol number for UDP/IP */ 112239922Sgonzo% 113239922Sgonzo% 114239922Sgonzo%/* 115239922Sgonzo% * A list of mappings 116239922Sgonzo% * 117239922Sgonzo% * Below are two definitions for the pmaplist structure. This is done because 118239922Sgonzo% * xdr_pmaplist() is specified to take a struct pmaplist **, rather than a 119239922Sgonzo% * struct pmaplist * that rpcgen would produce. One version of the pmaplist 120239922Sgonzo% * structure (actually called pm__list) is used with rpcgen, and the other is 121239922Sgonzo% * defined only in the header file for compatibility with the specified 122239922Sgonzo% * interface. 123239922Sgonzo% */ 124239922Sgonzo 125239922Sgonzostruct pm__list { 126239922Sgonzo pmap pml_map; 127239922Sgonzo struct pm__list *pml_next; 128239922Sgonzo}; 129239922Sgonzo 130239922Sgonzotypedef pm__list *pmaplist_ptr; /* results of PMAPPROC_DUMP */ 131239922Sgonzo 132239922Sgonzo#ifdef RPC_HDR 133239922Sgonzo% 134239922Sgonzo%typedef struct pm__list pmaplist; 135239922Sgonzo%typedef struct pm__list PMAPLIST; 136239922Sgonzo% 137243423Sgonzo%#ifndef __cplusplus 138239922Sgonzo%struct pmaplist { 139239922Sgonzo% PMAP pml_map; 140239922Sgonzo% struct pmaplist *pml_next; 141239922Sgonzo%}; 142239922Sgonzo%#endif 143239922Sgonzo% 144239922Sgonzo%#ifdef __cplusplus 145239922Sgonzo%extern "C" { 146239922Sgonzo%#endif 147239922Sgonzo%extern bool_t xdr_pmaplist(XDR *, pmaplist**); 148239922Sgonzo%#ifdef __cplusplus 149239922Sgonzo%} 150239922Sgonzo%#endif 151239922Sgonzo% 152239922Sgonzo#endif 153239922Sgonzo 154239922Sgonzo% 155239922Sgonzo%/* 156239922Sgonzo% * Arguments to callit 157243423Sgonzo% */ 158243423Sgonzo 159239922Sgonzostruct rmtcallargs { 160239922Sgonzo unsigned long prog; 161239922Sgonzo unsigned long vers; 162239922Sgonzo unsigned long proc; 163239922Sgonzo opaque args<>; 164239922Sgonzo}; 165239922Sgonzo#ifdef RPC_HDR 166239922Sgonzo% 167243423Sgonzo%/* 168243423Sgonzo% * Client-side only representation of rmtcallargs structure. 169239922Sgonzo% * 170243423Sgonzo% * The routine that XDRs the rmtcallargs structure must deal with the 171243423Sgonzo% * opaque arguments in the "args" structure. xdr_rmtcall_args() needs to be 172243423Sgonzo% * passed the XDR routine that knows the args' structure. This routine 173243423Sgonzo% * doesn't need to go over-the-wire (and it wouldn't make sense anyway) since 174243423Sgonzo% * the application being called knows the args structure already. So we use a 175243423Sgonzo% * different "XDR" structure on the client side, p_rmtcallargs, which includes 176243423Sgonzo% * the args' XDR routine. 177243423Sgonzo% */ 178243423Sgonzo%struct p_rmtcallargs { 179243423Sgonzo% u_long prog; 180243423Sgonzo% u_long vers; 181243423Sgonzo% u_long proc; 182243423Sgonzo% struct { 183243423Sgonzo% u_int args_len; 184243423Sgonzo% char *args_val; 185243423Sgonzo% } args; 186243423Sgonzo% xdrproc_t xdr_args; /* encodes args */ 187243423Sgonzo%}; 188243423Sgonzo% 189243423Sgonzo#endif /* def RPC_HDR */ 190243423Sgonzo% 191239922Sgonzo% 192239922Sgonzo%/* 193239922Sgonzo% * Results of callit 194239922Sgonzo% */ 195239922Sgonzo 196239922Sgonzostruct rmtcallres { 197239922Sgonzo unsigned long port; 198239922Sgonzo opaque res<>; 199239922Sgonzo}; 200239922Sgonzo#ifdef RPC_HDR 201239922Sgonzo% 202239922Sgonzo%/* 203239922Sgonzo% * Client-side only representation of rmtcallres structure. 204239922Sgonzo% */ 205239922Sgonzo%struct p_rmtcallres { 206243423Sgonzo% u_long port; 207239922Sgonzo% struct { 208239922Sgonzo% u_int res_len; 209239922Sgonzo% char *res_val; 210239922Sgonzo% } res; 211239922Sgonzo% xdrproc_t xdr_res; /* decodes res */ 212239922Sgonzo%}; 213239922Sgonzo% 214239922Sgonzo#endif /* def RPC_HDR */ 215239922Sgonzo 216239922Sgonzo/* 217239922Sgonzo * Port mapper procedures 218243423Sgonzo */ 219243423Sgonzo 220243423Sgonzoprogram PMAPPROG { 221243423Sgonzo version PMAPVERS { 222243423Sgonzo void 223243423Sgonzo PMAPPROC_NULL(void) = 0; 224243423Sgonzo 225243423Sgonzo bool 226239922Sgonzo PMAPPROC_SET(pmap) = 1; 227243423Sgonzo 228239922Sgonzo bool 229243423Sgonzo PMAPPROC_UNSET(pmap) = 2; 230243423Sgonzo 231239922Sgonzo unsigned long 232239922Sgonzo PMAPPROC_GETPORT(pmap) = 3; 233239922Sgonzo 234239922Sgonzo pmaplist_ptr 235239922Sgonzo PMAPPROC_DUMP(void) = 4; 236239922Sgonzo 237239922Sgonzo rmtcallres 238243423Sgonzo PMAPPROC_CALLIT(rmtcallargs) = 5; 239239922Sgonzo } = 2; 240239922Sgonzo} = 100000; 241239922Sgonzo% 242239922Sgonzo#ifdef RPC_HDR 243239922Sgonzo%#define PMAPVERS_PROTO ((u_long)2) 244239922Sgonzo%#define PMAPVERS_ORIG ((u_long)1) 245239922Sgonzo% 246239922Sgonzo%#else /* ndef _KERNEL */ 247239922Sgonzo% 248239922Sgonzo%#include <rpc/pmap_rmt.h> 249239922Sgonzo% 250243423Sgonzo%#ifdef __cplusplus 251239922Sgonzo%extern "C" { 252239922Sgonzo%#endif 253239922Sgonzo% 254239922Sgonzo%#define PMAPPORT 111 255239922Sgonzo% 256239922Sgonzo%struct pmap { 257239922Sgonzo% long unsigned pm_prog; 258239922Sgonzo% long unsigned pm_vers; 259239922Sgonzo% long unsigned pm_prot; 260239922Sgonzo% long unsigned pm_port; 261239922Sgonzo%}; 262239922Sgonzo%typedef struct pmap PMAP; 263239922Sgonzo%extern bool_t xdr_pmap (XDR *, struct pmap *); 264239922Sgonzo% 265239922Sgonzo%struct pmaplist { 266239922Sgonzo% struct pmap pml_map; 267239922Sgonzo% struct pmaplist *pml_next; 268239922Sgonzo%}; 269239922Sgonzo%typedef struct pmaplist PMAPLIST; 270239922Sgonzo%typedef struct pmaplist *pmaplist_ptr; 271239922Sgonzo% 272239922Sgonzo% 273239922Sgonzo%#ifdef __cplusplus 274239922Sgonzo%} 275239922Sgonzo%#endif 276239922Sgonzo% 277239922Sgonzo%#endif /* ndef _KERNEL */ 278239922Sgonzo#endif 279239922Sgonzo 280239922Sgonzo