1 %/* 2 % * Sun RPC is a product of Sun Microsystems, Inc. and is provided for 3 % * unrestricted use provided that this legend is included on all tape 4 % * media and as a part of the software program in whole or part. Users 5 % * may copy or modify Sun RPC without charge, but are not authorized 6 % * to license or distribute it to anyone else except as part of a product or 7 % * program developed by the user. 8 % * 9 % * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE 10 % * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR 11 % * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. 12 % * 13 % * Sun RPC is provided with no support and without any obligation on the 14 % * part of Sun Microsystems, Inc. to assist in its use, correction, 15 % * modification or enhancement. 16 % * 17 % * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE 18 % * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC 19 % * OR ANY PART THEREOF. 20 % * 21 % * In no event will Sun Microsystems, Inc. be liable for any lost revenue 22 % * or profits or other special, indirect and consequential damages, even if 23 % * Sun has been advised of the possibility of such damages. 24 % * 25 % * Sun Microsystems, Inc. 26 % * 2550 Garcia Avenue 27 % * Mountain View, California 94043 28 % */ 29 %/* 30 % * Copyright (c) 1984,1989 by Sun Microsystems, Inc. 31 % */ 32 33 %/* from pmap_prot.x */ 34 35 #ifdef RPC_HDR 36 % 37 %#pragma ident "@(#)pmap_prot.x 1.6 94/04/29 SMI" 38 % 39 %#ifndef _KERNEL 40 % 41 #endif 42 43 /* 44 * Port Mapper Protocol Specification (in RPC Language) 45 * derived from RFC 1057 46 */ 47 48 %/* 49 % * Protocol for the local binder service, or pmap. 50 % * 51 % * Copyright (C) 1984, Sun Microsystems, Inc. 52 % * 53 % * The following procedures are supported by the protocol: 54 % * 55 % * PMAPPROC_NULL() returns () 56 % * takes nothing, returns nothing 57 % * 58 % * PMAPPROC_SET(struct pmap) returns (bool_t) 59 % * TRUE is success, FALSE is failure. Registers the tuple 60 % * [prog, vers, prot, port]. 61 % * 62 % * PMAPPROC_UNSET(struct pmap) returns (bool_t) 63 % * TRUE is success, FALSE is failure. Un-registers pair 64 % * [prog, vers]. prot and port are ignored. 65 % * 66 % * PMAPPROC_GETPORT(struct pmap) returns (long unsigned). 67 % * 0 is failure. Otherwise returns the port number where the pair 68 % * [prog, vers] is registered. It may lie! 69 % * 70 % * PMAPPROC_DUMP() RETURNS (struct pmaplist_ptr) 71 % * 72 % * PMAPPROC_CALLIT(unsigned, unsigned, unsigned, string<>) 73 % * RETURNS (port, string<>); 74 % * usage: encapsulatedresults = PMAPPROC_CALLIT(prog, vers, proc, 75 % * encapsulatedargs); 76 % * Calls the procedure on the local machine. If it is not registered, 77 % * this procedure is quite; ie it does not return error information!!! 78 % * This procedure only is supported on rpc/udp and calls via 79 % * rpc/udp. This routine only passes null authentication parameters. 80 % * This file has no interface to xdr routines for PMAPPROC_CALLIT. 81 % * 82 % * The service supports remote procedure calls on udp/ip or tcp/ip socket 111. 83 % */ 84 % 85 const PMAPPORT = 111; /* portmapper port number */ 86 % 87 % 88 %/* 89 % * A mapping of (program, version, protocol) to port number 90 % */ 91 92 struct pmap { 93 unsigned long pm_prog; 94 unsigned long pm_vers; 95 unsigned long pm_prot; 96 unsigned long pm_port; 97 }; 98 #ifdef RPC_HDR 99 % 100 %typedef pmap PMAP; 101 % 102 #endif 103 % 104 %/* 105 % * Supported values for the "prot" field 106 % */ 107 % 108 const PMAP_IPPROTO_TCP = 6; /* protocol number for TCP/IP */ 109 const PMAP_IPPROTO_UDP = 17; /* protocol number for UDP/IP */ 110 % 111 % 112 %/* 113 % * A list of mappings 114 % * 115 % * Below are two definitions for the pmaplist structure. This is done because 116 % * xdr_pmaplist() is specified to take a struct pmaplist **, rather than a 117 % * struct pmaplist * that rpcgen would produce. One version of the pmaplist 118 % * structure (actually called pm__list) is used with rpcgen, and the other is 119 % * defined only in the header file for compatibility with the specified 120 % * interface. 121 % */ 122 123 struct pm__list { 124 pmap pml_map; 125 struct pm__list *pml_next; 126 }; 127 128 typedef pm__list *pmaplist_ptr; /* results of PMAPPROC_DUMP */ 129 130 #ifdef RPC_HDR 131 % 132 %typedef struct pm__list pmaplist; 133 %typedef struct pm__list PMAPLIST; 134 % 135 %#ifndef __cplusplus 136 %struct pmaplist { 137 % PMAP pml_map; 138 % struct pmaplist *pml_next; 139 %}; 140 %#endif 141 % 142 %#ifdef __cplusplus 143 %extern "C" { 144 %#endif 145 %#ifdef __STDC__ 146 %extern bool_t xdr_pmaplist(XDR *, pmaplist**); 147 %#else /* K&R C */ 148 %bool_t xdr_pmaplist(); 149 %#endif 150 %#ifdef __cplusplus 151 %} 152 %#endif 153 % 154 #endif 155 156 % 157 %/* 158 % * Arguments to callit 159 % */ 160 161 struct rmtcallargs { 162 unsigned long prog; 163 unsigned long vers; 164 unsigned long proc; 165 opaque args<>; 166 }; 167 #ifdef RPC_HDR 168 % 169 %/* 170 % * Client-side only representation of rmtcallargs structure. 171 % * 172 % * The routine that XDRs the rmtcallargs structure must deal with the 173 % * opaque arguments in the "args" structure. xdr_rmtcall_args() needs to be 174 % * passed the XDR routine that knows the args' structure. This routine 175 % * doesn't need to go over-the-wire (and it wouldn't make sense anyway) since 176 % * the application being called knows the args structure already. So we use a 177 % * different "XDR" structure on the client side, p_rmtcallargs, which includes 178 % * the args' XDR routine. 179 % */ 180 %struct p_rmtcallargs { 181 % u_long prog; 182 % u_long vers; 183 % u_long proc; 184 % struct { 185 % u_int args_len; 186 % char *args_val; 187 % } args; 188 % xdrproc_t xdr_args; /* encodes args */ 189 %}; 190 % 191 #endif /* def RPC_HDR */ 192 % 193 % 194 %/* 195 % * Results of callit 196 % */ 197 198 struct rmtcallres { 199 unsigned long port; 200 opaque res<>; 201 }; 202 #ifdef RPC_HDR 203 % 204 %/* 205 % * Client-side only representation of rmtcallres structure. 206 % */ 207 %struct p_rmtcallres { 208 % u_long port; 209 % struct { 210 % u_int res_len; 211 % char *res_val; 212 % } res; 213 % xdrproc_t xdr_res; /* decodes res */ 214 %}; 215 % 216 #endif /* def RPC_HDR */ 217 218 /* 219 * Port mapper procedures 220 */ 221 222 program PMAPPROG { 223 version PMAPVERS { 224 void 225 PMAPPROC_NULL(void) = 0; 226 227 bool 228 PMAPPROC_SET(pmap) = 1; 229 230 bool 231 PMAPPROC_UNSET(pmap) = 2; 232 233 unsigned long 234 PMAPPROC_GETPORT(pmap) = 3; 235 236 pmaplist_ptr 237 PMAPPROC_DUMP(void) = 4; 238 239 rmtcallres 240 PMAPPROC_CALLIT(rmtcallargs) = 5; 241 } = 2; 242 } = 100000; 243 % 244 #ifdef RPC_HDR 245 %#define PMAPVERS_PROTO ((u_long)2) 246 %#define PMAPVERS_ORIG ((u_long)1) 247 % 248 %#else /* ndef _KERNEL */ 249 % 250 %#include <rpc/pmap_rmt.h> 251 % 252 %#ifdef __cplusplus 253 %extern "C" { 254 %#endif 255 % 256 %#define PMAPPORT 111 257 % 258 %struct pmap { 259 % long unsigned pm_prog; 260 % long unsigned pm_vers; 261 % long unsigned pm_prot; 262 % long unsigned pm_port; 263 %}; 264 %typedef struct pmap PMAP; 265 %#ifdef __STDC__ 266 %extern bool_t xdr_pmap (XDR *, struct pmap *); 267 %#else 268 %extern bool_t xdr_pmap (); 269 %#endif 270 % 271 %struct pmaplist { 272 % struct pmap pml_map; 273 % struct pmaplist *pml_next; 274 %}; 275 %typedef struct pmaplist PMAPLIST; 276 %typedef struct pmaplist *pmaplist_ptr; 277 % 278 % 279 %#ifdef __cplusplus 280 %} 281 %#endif 282 % 283 %#endif /* ndef _KERNEL */ 284 #endif 285 286