1 /*
2  * pmap_prot.h
3  * Protocol for the local binder service, or pmap.
4  *
5  * Copyright (c) 2010, Oracle America, Inc.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions are
9  * met:
10  *
11  *     * Redistributions of source code must retain the above copyright
12  *       notice, this list of conditions and the following disclaimer.
13  *     * Redistributions in binary form must reproduce the above
14  *       copyright notice, this list of conditions and the following
15  *       disclaimer in the documentation and/or other materials
16  *       provided with the distribution.
17  *     * Neither the name of the "Oracle America, Inc." nor the names of its
18  *       contributors may be used to endorse or promote products derived
19  *       from this software without specific prior written permission.
20  *
21  *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22  *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23  *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
24  *   FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
25  *   COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
26  *   INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27  *   DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
28  *   GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
29  *   INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
30  *   WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
31  *   NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
32  *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33  */
34 
35 #ifndef _RPC_PMAP_PROT_H
36 #define _RPC_PMAP_PROT_H	1
37 
38 #include <features.h>
39 
40 #include <rpc/xdr.h>
41 
42 __BEGIN_DECLS
43 
44 /* The following procedures are supported by the protocol:
45  *
46  * PMAPPROC_NULL() returns ()
47  *	takes nothing, returns nothing
48  *
49  * PMAPPROC_SET(struct pmap) returns (bool_t)
50  *	TRUE is success, FALSE is failure.  Registers the tuple
51  *	[prog, vers, prot, port].
52  *
53  * PMAPPROC_UNSET(struct pmap) returns (bool_t)
54  *	TRUE is success, FALSE is failure.  Un-registers pair
55  *	[prog, vers].  prot and port are ignored.
56  *
57  * PMAPPROC_GETPORT(struct pmap) returns (long unsigned).
58  *	0 is failure.  Otherwise returns the port number where the pair
59  *	[prog, vers] is registered.  It may lie!
60  *
61  * PMAPPROC_DUMP() RETURNS (struct pmaplist *)
62  *
63  * PMAPPROC_CALLIT(unsigned, unsigned, unsigned, string<>)
64  *	RETURNS (port, string<>);
65  * usage: encapsulatedresults = PMAPPROC_CALLIT(prog, vers, proc, encapsulatedargs);
66  *	Calls the procedure on the local machine.  If it is not registered,
67  *	this procedure is quite; ie it does not return error information!!!
68  *	This procedure only is supported on rpc/udp and calls via
69  *	rpc/udp.  This routine only passes null authentication parameters.
70  *	This file has no interface to xdr routines for PMAPPROC_CALLIT.
71  *
72  * The service supports remote procedure calls on udp/ip or tcp/ip socket 111.
73  */
74 
75 #define PMAPPORT		((u_short)111)
76 #define PMAPPROG		((u_long)100000)
77 #define PMAPVERS		((u_long)2)
78 #define PMAPVERS_PROTO		((u_long)2)
79 #define PMAPVERS_ORIG		((u_long)1)
80 #define PMAPPROC_NULL		((u_long)0)
81 #define PMAPPROC_SET		((u_long)1)
82 #define PMAPPROC_UNSET		((u_long)2)
83 #define PMAPPROC_GETPORT	((u_long)3)
84 #define PMAPPROC_DUMP		((u_long)4)
85 #define PMAPPROC_CALLIT		((u_long)5)
86 
87 struct pmap {
88 	long unsigned pm_prog;
89 	long unsigned pm_vers;
90 	long unsigned pm_prot;
91 	long unsigned pm_port;
92 };
93 
94 extern bool_t xdr_pmap (XDR *__xdrs, struct pmap *__regs) __THROW;
95 
96 struct pmaplist {
97 	struct pmap	pml_map;
98 	struct pmaplist *pml_next;
99 };
100 
101 extern bool_t xdr_pmaplist (XDR *__xdrs, struct pmaplist **__rp) __THROW;
102 
103 __END_DECLS
104 
105 #endif /* rpc/pmap_prot.h */
106