xref: /freebsd/lib/libc/rpc/pmap_prot.c (revision 2e322d379631c3bd6107e295f3e5d814c7845fc7)
18360efbdSAlfred Perlstein /*	$NetBSD: pmap_prot.c,v 1.10 2000/01/22 22:19:18 mycroft Exp $	*/
28360efbdSAlfred Perlstein 
3*2e322d37SHiroki Sato /*-
4*2e322d37SHiroki Sato  * Copyright (c) 2009, Sun Microsystems, Inc.
5*2e322d37SHiroki Sato  * All rights reserved.
699064799SGarrett Wollman  *
7*2e322d37SHiroki Sato  * Redistribution and use in source and binary forms, with or without
8*2e322d37SHiroki Sato  * modification, are permitted provided that the following conditions are met:
9*2e322d37SHiroki Sato  * - Redistributions of source code must retain the above copyright notice,
10*2e322d37SHiroki Sato  *   this list of conditions and the following disclaimer.
11*2e322d37SHiroki Sato  * - Redistributions in binary form must reproduce the above copyright notice,
12*2e322d37SHiroki Sato  *   this list of conditions and the following disclaimer in the documentation
13*2e322d37SHiroki Sato  *   and/or other materials provided with the distribution.
14*2e322d37SHiroki Sato  * - Neither the name of Sun Microsystems, Inc. nor the names of its
15*2e322d37SHiroki Sato  *   contributors may be used to endorse or promote products derived
16*2e322d37SHiroki Sato  *   from this software without specific prior written permission.
1799064799SGarrett Wollman  *
18*2e322d37SHiroki Sato  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19*2e322d37SHiroki Sato  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20*2e322d37SHiroki Sato  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21*2e322d37SHiroki Sato  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
22*2e322d37SHiroki Sato  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23*2e322d37SHiroki Sato  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24*2e322d37SHiroki Sato  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25*2e322d37SHiroki Sato  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26*2e322d37SHiroki Sato  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27*2e322d37SHiroki Sato  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28*2e322d37SHiroki Sato  * POSSIBILITY OF SUCH DAMAGE.
2999064799SGarrett Wollman  */
3099064799SGarrett Wollman 
3199064799SGarrett Wollman #if defined(LIBC_SCCS) && !defined(lint)
32a986ef57SDavid E. O'Brien static char *sccsid2 = "@(#)pmap_prot.c 1.17 87/08/11 Copyr 1984 Sun Micro";
338360efbdSAlfred Perlstein static char *sccsid = "@(#)pmap_prot.c	2.1 88/07/29 4.0 RPCSRC";
3499064799SGarrett Wollman #endif
35d3d20c82SDavid E. O'Brien #include <sys/cdefs.h>
36d3d20c82SDavid E. O'Brien __FBSDID("$FreeBSD$");
3799064799SGarrett Wollman 
3899064799SGarrett Wollman /*
3999064799SGarrett Wollman  * pmap_prot.c
4099064799SGarrett Wollman  * Protocol for the local binder service, or pmap.
4199064799SGarrett Wollman  *
4299064799SGarrett Wollman  * Copyright (C) 1984, Sun Microsystems, Inc.
4399064799SGarrett Wollman  */
4499064799SGarrett Wollman 
458360efbdSAlfred Perlstein #include "namespace.h"
468360efbdSAlfred Perlstein #include <assert.h>
478360efbdSAlfred Perlstein 
4899064799SGarrett Wollman #include <rpc/types.h>
4999064799SGarrett Wollman #include <rpc/xdr.h>
5099064799SGarrett Wollman #include <rpc/pmap_prot.h>
518360efbdSAlfred Perlstein #include "un-namespace.h"
5299064799SGarrett Wollman 
5399064799SGarrett Wollman 
5499064799SGarrett Wollman bool_t
5599064799SGarrett Wollman xdr_pmap(xdrs, regs)
5699064799SGarrett Wollman 	XDR *xdrs;
5799064799SGarrett Wollman 	struct pmap *regs;
5899064799SGarrett Wollman {
5999064799SGarrett Wollman 
608360efbdSAlfred Perlstein 	assert(xdrs != NULL);
618360efbdSAlfred Perlstein 	assert(regs != NULL);
628360efbdSAlfred Perlstein 
6399064799SGarrett Wollman 	if (xdr_u_long(xdrs, &regs->pm_prog) &&
6499064799SGarrett Wollman 		xdr_u_long(xdrs, &regs->pm_vers) &&
6599064799SGarrett Wollman 		xdr_u_long(xdrs, &regs->pm_prot))
6699064799SGarrett Wollman 		return (xdr_u_long(xdrs, &regs->pm_port));
6799064799SGarrett Wollman 	return (FALSE);
6899064799SGarrett Wollman }
69