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.
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.
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.
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.
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.
25 * Sun Microsystems, Inc.
27 * Mountain View, California 94043
29 * @(#)rpcb_stat.c 1.7 94/04/25 SMI
30 * $NetBSD: rpcb_stat.c,v 1.2 2000/07/04 20:27:40 matt Exp $
31 * $FreeBSD: src/usr.sbin/rpcbind/rpcb_stat.c,v 1.4 2003/10/29 09:29:23 mbr Exp $
37 * Allows for gathering of statistics
39 * Copyright (c) 1990 by Sun Microsystems, Inc.
43 #include <netconfig.h>
45 #include <rpc/rpcb_prot.h>
48 #include <rpc/pmap_prot.h>
54 static rpcb_stat_byvers inf
;
63 rpcbs_procinfo(rpcvers_t rtype
, rpcproc_t proc
)
67 case PMAPVERS
: /* version 2 */
68 if (proc
> rpcb_highproc_2
)
72 case RPCBVERS
: /* version 3 */
73 if (proc
> rpcb_highproc_3
)
76 case RPCBVERS4
: /* version 4 */
77 if (proc
> rpcb_highproc_4
)
82 inf
[rtype
].info
[proc
]++;
87 rpcbs_set(rpcvers_t rtype
, bool_t success
)
89 if ((rtype
>= RPCBVERS_STAT
) || (success
== FALSE
))
96 rpcbs_unset(rpcvers_t rtype
, bool_t success
)
98 if ((rtype
>= RPCBVERS_STAT
) || (success
== FALSE
))
100 inf
[rtype
].unsetinfo
++;
105 rpcbs_getaddr(rpcvers_t rtype
, rpcprog_t prog
, rpcvers_t vers
, char *netid
,
109 struct netconfig
*nconf
;
111 if (rtype
>= RPCBVERS_STAT
)
113 for (al
= inf
[rtype
].addrinfo
; al
; al
= al
->next
) {
115 if(al
->netid
== NULL
)
117 if ((al
->prog
== prog
) && (al
->vers
== vers
) &&
118 (strcmp(al
->netid
, netid
) == 0)) {
119 if ((uaddr
== NULL
) || (uaddr
[0] == 0))
126 nconf
= rpcbind_get_conf(netid
);
130 al
= (rpcbs_addrlist
*) malloc(sizeof (rpcbs_addrlist
));
136 al
->netid
= nconf
->nc_netid
;
137 if ((uaddr
== NULL
) || (uaddr
[0] == 0)) {
144 al
->next
= inf
[rtype
].addrinfo
;
145 inf
[rtype
].addrinfo
= al
;
149 rpcbs_rmtcall(rpcvers_t rtype
, rpcproc_t rpcbproc
, rpcprog_t prog
,
150 rpcvers_t vers
, rpcproc_t proc
, char *netid
, rpcblist_ptr rbl
)
152 rpcbs_rmtcalllist
*rl
;
153 struct netconfig
*nconf
;
155 if (rtype
> RPCBVERS_STAT
)
157 for (rl
= inf
[rtype
].rmtinfo
; rl
; rl
= rl
->next
) {
159 if(rl
->netid
== NULL
)
162 if ((rl
->prog
== prog
) && (rl
->vers
== vers
) &&
163 (rl
->proc
== proc
) &&
164 (strcmp(rl
->netid
, netid
) == 0)) {
166 (rbl
->rpcb_map
.r_vers
!= vers
))
170 if (rpcbproc
== RPCBPROC_INDIRECT
)
175 nconf
= rpcbind_get_conf(netid
);
179 rl
= (rpcbs_rmtcalllist
*) malloc(sizeof (rpcbs_rmtcalllist
));
186 rl
->netid
= nconf
->nc_netid
;
188 (rbl
->rpcb_map
.r_vers
!= vers
)) {
196 rl
->next
= inf
[rtype
].rmtinfo
;
197 inf
[rtype
].rmtinfo
= rl
;
202 rpcbproc_getstat(void *arg __unused
, struct svc_req
*req __unused
,
203 SVCXPRT
*xprt __unused
, rpcvers_t versnum __unused
)