Back to home page

EIC code displayed by LXR

 
 

    


Warning, /include/tirpc/rpc/rpcb_prot.x is written in an unsupported language. File is not indexed.

0001 %/*
0002 % * $FreeBSD: src/include/rpc/rpcb_prot.x,v 1.3 2002/03/13 10:29:06 obrien Exp $
0003 % *
0004 % * Copyright (c) 2009, Sun Microsystems, Inc.
0005 % * All rights reserved.
0006 % *
0007 % * Redistribution and use in source and binary forms, with or without
0008 % * modification, are permitted provided that the following conditions are met:
0009 % * - Redistributions of source code must retain the above copyright notice,
0010 % *   this list of conditions and the following disclaimer.
0011 % * - Redistributions in binary form must reproduce the above copyright notice,
0012 % *   this list of conditions and the following disclaimer in the documentation
0013 % *   and/or other materials provided with the distribution.
0014 % * - Neither the name of Sun Microsystems, Inc. nor the names of its
0015 % *   contributors may be used to endorse or promote products derived
0016 % *   from this software without specific prior written permission.
0017 % *
0018 % * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
0019 % * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
0020 % * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
0021 % * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
0022 % * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
0023 % * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
0024 % * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
0025 % * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
0026 % * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
0027 % * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
0028 % * POSSIBILITY OF SUCH DAMAGE.
0029 % */
0030 %/*
0031 % * Copyright (c) 1988 by Sun Microsystems, Inc.
0032 % */
0033 
0034 %/* from rpcb_prot.x */
0035 
0036 #ifdef RPC_HDR
0037 %
0038 %/* #pragma ident       "@(#)rpcb_prot.x        1.5     94/04/29 SMI" */
0039 %
0040 %#ifndef _KERNEL
0041 %
0042 #endif
0043 
0044 /*
0045  * rpcb_prot.x
0046  * rpcbind protocol, versions 3 and 4, in RPC Language
0047  */
0048 %
0049 %/*
0050 % * The following procedures are supported by the protocol in version 3:
0051 % *
0052 % * RPCBPROC_NULL() returns ()
0053 % *     takes nothing, returns nothing
0054 % *
0055 % * RPCBPROC_SET(rpcb) returns (bool_t)
0056 % *     TRUE is success, FALSE is failure.  Registers the tuple
0057 % *     [prog, vers, address, owner, netid].
0058 % *     Finds out owner and netid information on its own.
0059 % *
0060 % * RPCBPROC_UNSET(rpcb) returns (bool_t)
0061 % *     TRUE is success, FALSE is failure.  Un-registers tuple
0062 % *     [prog, vers, netid].  addresses is ignored.
0063 % *     If netid is NULL, unregister all.
0064 % *
0065 % * RPCBPROC_GETADDR(rpcb) returns (string).
0066 % *     0 is failure.  Otherwise returns the universal address where the
0067 % *     triple [prog, vers, netid] is registered.  Ignore address and owner.
0068 % *
0069 % * RPCBPROC_DUMP() RETURNS (rpcblist_ptr)
0070 % *     used to dump the entire rpcbind maps
0071 % *
0072 % * RPCBPROC_CALLIT(rpcb_rmtcallargs)
0073 % *     RETURNS (rpcb_rmtcallres);
0074 % *     Calls the procedure on the remote machine.  If it is not registered,
0075 % *     this procedure is quiet; i.e. it does not return error information!!!
0076 % *     This routine only passes null authentication parameters.
0077 % *     It has no interface to xdr routines for RPCBPROC_CALLIT.
0078 % *
0079 % * RPCBPROC_GETTIME() returns (int).
0080 % *     Gets the remote machines time
0081 % *
0082 % * RPCBPROC_UADDR2TADDR(strint) RETURNS (struct netbuf)
0083 % *     Returns the netbuf address from universal address.
0084 % *
0085 % * RPCBPROC_TADDR2UADDR(struct netbuf) RETURNS (string)
0086 % *     Returns the universal address from netbuf address.
0087 % *
0088 % * END OF RPCBIND VERSION 3 PROCEDURES
0089 % */
0090 %/*
0091 % * Except for RPCBPROC_CALLIT, the procedures above are carried over to
0092 % * rpcbind version 4.  Those below are added or modified for version 4.
0093 % * NOTE: RPCBPROC_BCAST HAS THE SAME FUNCTIONALITY AND PROCEDURE NUMBER
0094 % * AS RPCBPROC_CALLIT.
0095 % *
0096 % * RPCBPROC_BCAST(rpcb_rmtcallargs)
0097 % *     RETURNS (rpcb_rmtcallres);
0098 % *     Calls the procedure on the remote machine.  If it is not registered,
0099 % *     this procedure IS quiet; i.e. it DOES NOT return error information!!!
0100 % *     This routine should be used for broadcasting and nothing else.
0101 % *
0102 % * RPCBPROC_GETVERSADDR(rpcb) returns (string).
0103 % *     0 is failure.  Otherwise returns the universal address where the
0104 % *     triple [prog, vers, netid] is registered.  Ignore address and owner.
0105 % *     Same as RPCBPROC_GETADDR except that if the given version number
0106 % *     is not available, the address is not returned.
0107 % *
0108 % * RPCBPROC_INDIRECT(rpcb_rmtcallargs)
0109 % *     RETURNS (rpcb_rmtcallres);
0110 % *     Calls the procedure on the remote machine.  If it is not registered,
0111 % *     this procedure is NOT quiet; i.e. it DOES return error information!!!
0112 % *     as any normal application would expect.
0113 % *
0114 % * RPCBPROC_GETADDRLIST(rpcb) returns (rpcb_entry_list_ptr).
0115 % *     Same as RPCBPROC_GETADDR except that it returns a list of all the
0116 % *     addresses registered for the combination (prog, vers) (for all
0117 % *     transports).
0118 % *
0119 % * RPCBPROC_GETSTAT(void) returns (rpcb_stat_byvers)
0120 % *     Returns the statistics about the kind of requests received by rpcbind.
0121 % */
0122 %
0123 %/*
0124 % * A mapping of (program, version, network ID) to address
0125 % */
0126 struct rpcb {
0127         rpcprog_t r_prog;               /* program number */
0128         rpcvers_t r_vers;               /* version number */
0129         string r_netid<>;               /* network id */
0130         string r_addr<>;                /* universal address */
0131         string r_owner<>;               /* owner of this service */
0132 };
0133 #ifdef RPC_HDR
0134 %
0135 %typedef rpcb RPCB;
0136 %
0137 #endif
0138 %
0139 %/*
0140 % * A list of mappings
0141 % *
0142 % * Below are two definitions for the rpcblist structure.  This is done because
0143 % * xdr_rpcblist() is specified to take a struct rpcblist **, rather than a
0144 % * struct rpcblist * that rpcgen would produce.  One version of the rpcblist
0145 % * structure (actually called rp__list) is used with rpcgen, and the other is
0146 % * defined only in the header file for compatibility with the specified
0147 % * interface.
0148 % */
0149 
0150 struct rp__list {
0151         rpcb rpcb_map;
0152         struct rp__list *rpcb_next;
0153 };
0154 
0155 typedef rp__list *rpcblist_ptr;         /* results of RPCBPROC_DUMP */
0156 
0157 #ifdef RPC_HDR
0158 %
0159 %typedef struct rp__list rpcblist;
0160 %typedef struct rp__list RPCBLIST;
0161 %
0162 %#ifndef __cplusplus
0163 %struct rpcblist {
0164 %       RPCB rpcb_map;
0165 %       struct rpcblist *rpcb_next;
0166 %};
0167 %#endif
0168 %
0169 %#ifdef __cplusplus
0170 %extern "C" {
0171 %#endif
0172 %extern  bool_t xdr_rpcblist(XDR *, rpcblist**);
0173 %#ifdef __cplusplus
0174 %}
0175 %#endif
0176 %
0177 #endif
0178 
0179 %
0180 %/*
0181 % * Arguments of remote calls
0182 % */
0183 struct rpcb_rmtcallargs {
0184         rpcprog_t prog;                 /* program number */
0185         rpcvers_t vers;                 /* version number */
0186         rpcproc_t proc;                 /* procedure number */
0187         opaque args<>;                  /* argument */
0188 };
0189 #ifdef RPC_HDR
0190 %
0191 %/*
0192 % * Client-side only representation of rpcb_rmtcallargs structure.
0193 % *
0194 % * The routine that XDRs the rpcb_rmtcallargs structure must deal with the
0195 % * opaque arguments in the "args" structure.  xdr_rpcb_rmtcallargs() needs to
0196 % * be passed the XDR routine that knows the args' structure.  This routine
0197 % * doesn't need to go over-the-wire (and it wouldn't make sense anyway) since
0198 % * the application being called already knows the args structure.  So we use a
0199 % * different "XDR" structure on the client side, r_rpcb_rmtcallargs, which
0200 % * includes the args' XDR routine.
0201 % */
0202 %struct r_rpcb_rmtcallargs {
0203 %       rpcprog_t prog;
0204 %       rpcvers_t vers;
0205 %       rpcproc_t proc;
0206 %       struct {
0207 %               u_int args_len;
0208 %               char *args_val;
0209 %       } args;
0210 %       xdrproc_t       xdr_args;       /* encodes args */
0211 %};
0212 %
0213 #endif  /* def RPC_HDR */
0214 %
0215 %/*
0216 % * Results of the remote call
0217 % */
0218 struct rpcb_rmtcallres {
0219         string addr<>;                  /* remote universal address */
0220         opaque results<>;               /* result */
0221 };
0222 #ifdef RPC_HDR
0223 %
0224 %/*
0225 % * Client-side only representation of rpcb_rmtcallres structure.
0226 % */
0227 %struct r_rpcb_rmtcallres {
0228 %       char *addr;
0229 %       struct {
0230 %               u_int32_t results_len;
0231 %               char *results_val;
0232 %       } results;
0233 %       xdrproc_t       xdr_res;        /* decodes results */
0234 %};
0235 #endif /* RPC_HDR */
0236 %
0237 %/*
0238 % * rpcb_entry contains a merged address of a service on a particular
0239 % * transport, plus associated netconfig information.  A list of rpcb_entrys
0240 % * is returned by RPCBPROC_GETADDRLIST.  See netconfig.h for values used
0241 % * in r_nc_* fields.
0242 % */
0243 struct rpcb_entry {
0244         string          r_maddr<>;      /* merged address of service */
0245         string          r_nc_netid<>;   /* netid field */
0246         unsigned int    r_nc_semantics; /* semantics of transport */
0247         string          r_nc_protofmly<>; /* protocol family */
0248         string          r_nc_proto<>;   /* protocol name */
0249 };
0250 %
0251 %/*
0252 % * A list of addresses supported by a service.
0253 % */
0254 struct rpcb_entry_list {
0255         rpcb_entry rpcb_entry_map;
0256         struct rpcb_entry_list *rpcb_entry_next;
0257 };
0258 
0259 typedef rpcb_entry_list *rpcb_entry_list_ptr;
0260 
0261 %
0262 %/*
0263 % * rpcbind statistics
0264 % */
0265 %
0266 const rpcb_highproc_2 = RPCBPROC_CALLIT;
0267 const rpcb_highproc_3 = RPCBPROC_TADDR2UADDR;
0268 const rpcb_highproc_4 = RPCBPROC_GETSTAT;
0269 
0270 const RPCBSTAT_HIGHPROC = 13;   /* # of procs in rpcbind V4 plus one */
0271 const RPCBVERS_STAT = 3;        /* provide only for rpcbind V2, V3 and V4 */
0272 const RPCBVERS_4_STAT = 2;
0273 const RPCBVERS_3_STAT = 1;
0274 const RPCBVERS_2_STAT = 0;
0275 %
0276 %/* Link list of all the stats about getport and getaddr */
0277 struct rpcbs_addrlist {
0278         rpcprog_t prog;
0279         rpcvers_t vers;
0280         int success;
0281         int failure;
0282         string netid<>;
0283         struct rpcbs_addrlist *next;
0284 };
0285 %
0286 %/* Link list of all the stats about rmtcall */
0287 struct rpcbs_rmtcalllist {
0288         rpcprog_t prog;
0289         rpcvers_t vers;
0290         rpcproc_t proc;
0291         int success;
0292         int failure;
0293         int indirect;   /* whether callit or indirect */
0294         string netid<>;
0295         struct rpcbs_rmtcalllist *next;
0296 };
0297 
0298 typedef int rpcbs_proc[RPCBSTAT_HIGHPROC];
0299 typedef rpcbs_addrlist *rpcbs_addrlist_ptr;
0300 typedef rpcbs_rmtcalllist *rpcbs_rmtcalllist_ptr;
0301 
0302 struct rpcb_stat {
0303         rpcbs_proc              info;
0304         int                     setinfo;
0305         int                     unsetinfo;
0306         rpcbs_addrlist_ptr      addrinfo;
0307         rpcbs_rmtcalllist_ptr   rmtinfo;
0308 };
0309 %
0310 %/*
0311 % * One rpcb_stat structure is returned for each version of rpcbind
0312 % * being monitored.
0313 % */
0314 
0315 typedef rpcb_stat rpcb_stat_byvers[RPCBVERS_STAT];
0316 
0317 #ifdef RPC_HDR
0318 %
0319 %/*
0320 % * We don't define netbuf in RPCL, since it would contain structure member
0321 % * names that would conflict with the definition of struct netbuf in
0322 % * <tiuser.h>.  Instead we merely declare the XDR routine xdr_netbuf() here,
0323 % * and implement it ourselves in rpc/rpcb_prot.c.
0324 % */
0325 %#ifdef __cplusplus
0326 %extern "C" bool_t xdr_netbuf(XDR *, struct netbuf *);
0327 %
0328 %#else /* __STDC__ */
0329 %extern  bool_t xdr_netbuf(XDR *, struct netbuf *);
0330 %
0331 %#endif
0332 #endif /* def RPC_HDR */
0333 
0334 /*
0335  * rpcbind procedures
0336  */
0337 program RPCBPROG {
0338         version RPCBVERS {
0339                 bool
0340                 RPCBPROC_SET(rpcb) = 1;
0341 
0342                 bool
0343                 RPCBPROC_UNSET(rpcb) = 2;
0344 
0345                 string
0346                 RPCBPROC_GETADDR(rpcb) = 3;
0347 
0348                 rpcblist_ptr
0349                 RPCBPROC_DUMP(void) = 4;
0350 
0351                 rpcb_rmtcallres
0352                 RPCBPROC_CALLIT(rpcb_rmtcallargs) = 5;
0353 
0354                 unsigned int
0355                 RPCBPROC_GETTIME(void) = 6;
0356 
0357                 struct netbuf
0358                 RPCBPROC_UADDR2TADDR(string) = 7;
0359 
0360                 string
0361                 RPCBPROC_TADDR2UADDR(struct netbuf) = 8;
0362         } = 3;
0363 
0364         version RPCBVERS4 {
0365                 bool
0366                 RPCBPROC_SET(rpcb) = 1;
0367 
0368                 bool
0369                 RPCBPROC_UNSET(rpcb) = 2;
0370 
0371                 string
0372                 RPCBPROC_GETADDR(rpcb) = 3;
0373 
0374                 rpcblist_ptr
0375                 RPCBPROC_DUMP(void) = 4;
0376 
0377                 /*
0378                  * NOTE: RPCBPROC_BCAST has the same functionality as CALLIT;
0379                  * the new name is intended to indicate that this
0380                  * procedure should be used for broadcast RPC, and
0381                  * RPCBPROC_INDIRECT should be used for indirect calls.
0382                  */
0383                 rpcb_rmtcallres
0384                 RPCBPROC_BCAST(rpcb_rmtcallargs) = RPCBPROC_CALLIT;
0385 
0386                 unsigned int
0387                 RPCBPROC_GETTIME(void) = 6;
0388 
0389                 struct netbuf
0390                 RPCBPROC_UADDR2TADDR(string) = 7;
0391 
0392                 string
0393                 RPCBPROC_TADDR2UADDR(struct netbuf) = 8;
0394 
0395                 string
0396                 RPCBPROC_GETVERSADDR(rpcb) = 9;
0397 
0398                 rpcb_rmtcallres
0399                 RPCBPROC_INDIRECT(rpcb_rmtcallargs) = 10;
0400 
0401                 rpcb_entry_list_ptr
0402                 RPCBPROC_GETADDRLIST(rpcb) = 11;
0403 
0404                 rpcb_stat_byvers
0405                 RPCBPROC_GETSTAT(void) = 12;
0406         } = 4;
0407 } = 100000;
0408 #ifdef RPC_HDR
0409 %
0410 %#define        RPCBVERS_3              RPCBVERS
0411 %#define        RPCBVERS_4              RPCBVERS4
0412 %
0413 %#define        _PATH_RPCBINDSOCK       "/var/run/rpcbind.sock"
0414 %
0415 %#else          /* ndef _KERNEL */
0416 %#ifdef __cplusplus
0417 %extern "C" {
0418 %#endif
0419 %
0420 %/*
0421 % * A mapping of (program, version, network ID) to address
0422 % */
0423 %struct rpcb {
0424 %       rpcprog_t r_prog;               /* program number */
0425 %       rpcvers_t r_vers;               /* version number */
0426 %       char *r_netid;                  /* network id */
0427 %       char *r_addr;                   /* universal address */
0428 %       char *r_owner;                  /* owner of the mapping */
0429 %};
0430 %typedef struct rpcb RPCB;
0431 %
0432 %/*
0433 % * A list of mappings
0434 % */
0435 %struct rpcblist {
0436 %       RPCB rpcb_map;
0437 %       struct rpcblist *rpcb_next;
0438 %};
0439 %typedef struct rpcblist RPCBLIST;
0440 %typedef struct rpcblist *rpcblist_ptr;
0441 %
0442 %/*
0443 % * Remote calls arguments
0444 % */
0445 %struct rpcb_rmtcallargs {
0446 %       rpcprog_t prog;                 /* program number */
0447 %       rpcvers_t vers;                 /* version number */
0448 %       rpcproc_t proc;                 /* procedure number */
0449 %       u_int32_t arglen;                       /* arg len */
0450 %       caddr_t args_ptr;               /* argument */
0451 %       xdrproc_t xdr_args;             /* XDR routine for argument */
0452 %};
0453 %typedef struct rpcb_rmtcallargs rpcb_rmtcallargs;
0454 %
0455 %/*
0456 % * Remote calls results
0457 % */
0458 %struct rpcb_rmtcallres {
0459 %       char *addr_ptr;                 /* remote universal address */
0460 %       u_int32_t resultslen;           /* results length */
0461 %       caddr_t results_ptr;            /* results */
0462 %       xdrproc_t xdr_results;          /* XDR routine for result */
0463 %};
0464 %typedef struct rpcb_rmtcallres rpcb_rmtcallres;
0465 %
0466 %struct rpcb_entry {
0467 %       char *r_maddr;
0468 %       char *r_nc_netid;
0469 %       unsigned int r_nc_semantics;
0470 %       char *r_nc_protofmly;
0471 %       char *r_nc_proto;
0472 %};
0473 %typedef struct rpcb_entry rpcb_entry;
0474 %
0475 %/*
0476 % * A list of addresses supported by a service.
0477 % */
0478 %
0479 %struct rpcb_entry_list {
0480 %       rpcb_entry rpcb_entry_map;
0481 %       struct rpcb_entry_list *rpcb_entry_next;
0482 %};
0483 %typedef struct rpcb_entry_list rpcb_entry_list;
0484 %
0485 %typedef rpcb_entry_list *rpcb_entry_list_ptr;
0486 %
0487 %/*
0488 % * rpcbind statistics
0489 % */
0490 %
0491 %#define        rpcb_highproc_2 RPCBPROC_CALLIT
0492 %#define        rpcb_highproc_3 RPCBPROC_TADDR2UADDR
0493 %#define        rpcb_highproc_4 RPCBPROC_GETSTAT
0494 %#define        RPCBSTAT_HIGHPROC 13
0495 %#define        RPCBVERS_STAT 3
0496 %#define        RPCBVERS_4_STAT 2
0497 %#define        RPCBVERS_3_STAT 1
0498 %#define        RPCBVERS_2_STAT 0
0499 %
0500 %/* Link list of all the stats about getport and getaddr */
0501 %
0502 %struct rpcbs_addrlist {
0503 %       rpcprog_t prog;
0504 %       rpcvers_t vers;
0505 %       int success;
0506 %       int failure;
0507 %       char *netid;
0508 %       struct rpcbs_addrlist *next;
0509 %};
0510 %typedef struct rpcbs_addrlist rpcbs_addrlist;
0511 %
0512 %/* Link list of all the stats about rmtcall */
0513 %
0514 %struct rpcbs_rmtcalllist {
0515 %       rpcprog_t prog;
0516 %       rpcvers_t vers;
0517 %       rpcproc_t proc;
0518 %       int success;
0519 %       int failure;
0520 %       int indirect;
0521 %       char *netid;
0522 %       struct rpcbs_rmtcalllist *next;
0523 %};
0524 %typedef struct rpcbs_rmtcalllist rpcbs_rmtcalllist;
0525 %
0526 %typedef int rpcbs_proc[RPCBSTAT_HIGHPROC];
0527 %
0528 %typedef rpcbs_addrlist *rpcbs_addrlist_ptr;
0529 %
0530 %typedef rpcbs_rmtcalllist *rpcbs_rmtcalllist_ptr;
0531 %
0532 %struct rpcb_stat {
0533 %       rpcbs_proc info;
0534 %       int setinfo;
0535 %       int unsetinfo;
0536 %       rpcbs_addrlist_ptr addrinfo;
0537 %       rpcbs_rmtcalllist_ptr rmtinfo;
0538 %};
0539 %typedef struct rpcb_stat rpcb_stat;
0540 %
0541 %/*
0542 % * One rpcb_stat structure is returned for each version of rpcbind
0543 % * being monitored.
0544 % */
0545 %
0546 %typedef rpcb_stat rpcb_stat_byvers[RPCBVERS_STAT];
0547 %
0548 %#ifdef __cplusplus
0549 %}
0550 %#endif
0551 %
0552 %#endif         /* ndef _KERNEL */
0553 #endif          /* RPC_HDR */