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