xref: /dflybsd-src/lib/libc/rpc/pmap_prot.c (revision ba96d07f7c72db2df2f4855fd9cef54db7111960)
1*ba96d07fShrs /*-
2*ba96d07fShrs  * Copyright (c) 2009, Sun Microsystems, Inc.
3*ba96d07fShrs  * All rights reserved.
4984263bcSMatthew Dillon  *
5*ba96d07fShrs  * Redistribution and use in source and binary forms, with or without
6*ba96d07fShrs  * modification, are permitted provided that the following conditions are met:
7*ba96d07fShrs  * - Redistributions of source code must retain the above copyright notice,
8*ba96d07fShrs  *   this list of conditions and the following disclaimer.
9*ba96d07fShrs  * - Redistributions in binary form must reproduce the above copyright notice,
10*ba96d07fShrs  *   this list of conditions and the following disclaimer in the documentation
11*ba96d07fShrs  *   and/or other materials provided with the distribution.
12*ba96d07fShrs  * - Neither the name of Sun Microsystems, Inc. nor the names of its
13*ba96d07fShrs  *   contributors may be used to endorse or promote products derived
14*ba96d07fShrs  *   from this software without specific prior written permission.
15984263bcSMatthew Dillon  *
16*ba96d07fShrs  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17*ba96d07fShrs  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18*ba96d07fShrs  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19*ba96d07fShrs  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
20*ba96d07fShrs  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21*ba96d07fShrs  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22*ba96d07fShrs  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23*ba96d07fShrs  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24*ba96d07fShrs  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25*ba96d07fShrs  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26*ba96d07fShrs  * POSSIBILITY OF SUCH DAMAGE.
271de703daSMatthew Dillon  *
281de703daSMatthew Dillon  * @(#)pmap_prot.c 1.17 87/08/11 Copyr 1984 Sun Micro
291de703daSMatthew Dillon  * @(#)pmap_prot.c	2.1 88/07/29 4.0 RPCSRC
30ce0e08e2SPeter Avalos  * $NetBSD: pmap_prot.c,v 1.10 2000/01/22 22:19:18 mycroft Exp $
31ce0e08e2SPeter Avalos  * $FreeBSD: src/lib/libc/rpc/pmap_prot.c,v 1.9 2004/10/16 06:11:35 obrien Exp $
32c9b6181eSSascha Wildner  * $DragonFly: src/lib/libc/rpc/pmap_prot.c,v 1.3 2005/11/13 12:27:04 swildner Exp $
33984263bcSMatthew Dillon  */
34984263bcSMatthew Dillon 
35984263bcSMatthew Dillon /*
36984263bcSMatthew Dillon  * pmap_prot.c
37984263bcSMatthew Dillon  * Protocol for the local binder service, or pmap.
38984263bcSMatthew Dillon  *
39984263bcSMatthew Dillon  * Copyright (C) 1984, Sun Microsystems, Inc.
40984263bcSMatthew Dillon  */
41984263bcSMatthew Dillon 
42ce0e08e2SPeter Avalos #include "namespace.h"
43ce0e08e2SPeter Avalos #include <assert.h>
44ce0e08e2SPeter Avalos 
45984263bcSMatthew Dillon #include <rpc/types.h>
46984263bcSMatthew Dillon #include <rpc/xdr.h>
47984263bcSMatthew Dillon #include <rpc/pmap_prot.h>
48ce0e08e2SPeter Avalos #include "un-namespace.h"
49984263bcSMatthew Dillon 
50984263bcSMatthew Dillon 
51984263bcSMatthew Dillon bool_t
xdr_pmap(XDR * xdrs,struct pmap * regs)52c9b6181eSSascha Wildner xdr_pmap(XDR *xdrs, struct pmap *regs)
53984263bcSMatthew Dillon {
54984263bcSMatthew Dillon 
55ce0e08e2SPeter Avalos 	assert(xdrs != NULL);
56ce0e08e2SPeter Avalos 	assert(regs != NULL);
57ce0e08e2SPeter Avalos 
58984263bcSMatthew Dillon 	if (xdr_u_long(xdrs, &regs->pm_prog) &&
59984263bcSMatthew Dillon 		xdr_u_long(xdrs, &regs->pm_vers) &&
60984263bcSMatthew Dillon 		xdr_u_long(xdrs, &regs->pm_prot))
61984263bcSMatthew Dillon 		return (xdr_u_long(xdrs, &regs->pm_port));
62984263bcSMatthew Dillon 	return (FALSE);
63984263bcSMatthew Dillon }
64