1*47c0e0c3Stron /* $NetBSD: pmap_prot.c,v 1.12 2013/03/11 20:19:29 tron Exp $ */
29e15c989Scgd
363d7b677Scgd /*
4*47c0e0c3Stron * Copyright (c) 2010, Oracle America, Inc.
563d7b677Scgd *
6*47c0e0c3Stron * Redistribution and use in source and binary forms, with or without
7*47c0e0c3Stron * modification, are permitted provided that the following conditions are
8*47c0e0c3Stron * met:
963d7b677Scgd *
10*47c0e0c3Stron * * Redistributions of source code must retain the above copyright
11*47c0e0c3Stron * notice, this list of conditions and the following disclaimer.
12*47c0e0c3Stron * * Redistributions in binary form must reproduce the above
13*47c0e0c3Stron * copyright notice, this list of conditions and the following
14*47c0e0c3Stron * disclaimer in the documentation and/or other materials
15*47c0e0c3Stron * provided with the distribution.
16*47c0e0c3Stron * * Neither the name of the "Oracle America, Inc." nor the names of its
17*47c0e0c3Stron * contributors may be used to endorse or promote products derived
18*47c0e0c3Stron * from this software without specific prior written permission.
1963d7b677Scgd *
20*47c0e0c3Stron * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21*47c0e0c3Stron * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22*47c0e0c3Stron * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
23*47c0e0c3Stron * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
24*47c0e0c3Stron * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
25*47c0e0c3Stron * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26*47c0e0c3Stron * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
27*47c0e0c3Stron * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28*47c0e0c3Stron * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
29*47c0e0c3Stron * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
30*47c0e0c3Stron * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31*47c0e0c3Stron * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3263d7b677Scgd */
3363d7b677Scgd
34c63c52b2Schristos #include <sys/cdefs.h>
3563d7b677Scgd #if defined(LIBC_SCCS) && !defined(lint)
36c63c52b2Schristos #if 0
37c63c52b2Schristos static char *sccsid = "@(#)pmap_prot.c 1.17 87/08/11 Copyr 1984 Sun Micro";
38c63c52b2Schristos static char *sccsid = "@(#)pmap_prot.c 2.1 88/07/29 4.0 RPCSRC";
39c63c52b2Schristos #else
40*47c0e0c3Stron __RCSID("$NetBSD: pmap_prot.c,v 1.12 2013/03/11 20:19:29 tron Exp $");
41c63c52b2Schristos #endif
4263d7b677Scgd #endif
4363d7b677Scgd
4463d7b677Scgd /*
4563d7b677Scgd * pmap_prot.c
4663d7b677Scgd * Protocol for the local binder service, or pmap.
4763d7b677Scgd *
4863d7b677Scgd * Copyright (C) 1984, Sun Microsystems, Inc.
4963d7b677Scgd */
5063d7b677Scgd
5143fa6fe3Sjtc #include "namespace.h"
5246e6c5e8Slukem
53b48252f3Slukem #include <assert.h>
54b48252f3Slukem
5563d7b677Scgd #include <rpc/types.h>
5663d7b677Scgd #include <rpc/xdr.h>
5763d7b677Scgd #include <rpc/pmap_prot.h>
5863d7b677Scgd
5943fa6fe3Sjtc #ifdef __weak_alias
__weak_alias(xdr_pmap,_xdr_pmap)6060549036Smycroft __weak_alias(xdr_pmap,_xdr_pmap)
6143fa6fe3Sjtc #endif
6243fa6fe3Sjtc
6363d7b677Scgd
6463d7b677Scgd bool_t
65adb74221Smatt xdr_pmap(XDR *xdrs, struct pmap *regs)
6663d7b677Scgd {
6763d7b677Scgd
68b48252f3Slukem _DIAGASSERT(xdrs != NULL);
69b48252f3Slukem _DIAGASSERT(regs != NULL);
70b48252f3Slukem
71ce147c1cSlukem if (xdr_u_long(xdrs, ®s->pm_prog) &&
72ce147c1cSlukem xdr_u_long(xdrs, ®s->pm_vers) &&
73ce147c1cSlukem xdr_u_long(xdrs, ®s->pm_prot))
74ce147c1cSlukem return (xdr_u_long(xdrs, ®s->pm_port));
7563d7b677Scgd return (FALSE);
7663d7b677Scgd }
77