xref: /freebsd/crypto/krb5/src/include/gssrpc/pmap_clnt.h (revision 7f2fe78b9dd5f51c821d771b63d2e096f6fd49e9)
1 /* @(#)pmap_clnt.h	2.1 88/07/29 4.0 RPCSRC; from 1.11 88/02/08 SMI */
2 /*
3  * Copyright (c) 2010, Oracle America, Inc.
4  *
5  * All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions are met:
9  *
10  *     * Redistributions of source code must retain the above copyright
11  *       notice, this list of conditions and the following disclaimer.
12  *
13  *     * Redistributions in binary form must reproduce the above copyright
14  *       notice, this list of conditions and the following disclaimer in
15  *       the documentation and/or other materials provided with the
16  *       distribution.
17  *
18  *     * Neither the name of the "Oracle America, Inc." nor the names of
19  *       its contributors may be used to endorse or promote products
20  *       derived from this software without specific prior written permission.
21  *
22  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
23  * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
24  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
25  * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
26  * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
27  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
28  * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
29  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
30  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
31  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
32  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33  */
34 
35 /*
36  * pmap_clnt.h
37  * Supplies C routines to get to portmap services.
38  */
39 
40 #ifndef GSSRPC_PMAP_CLNT_H
41 #define GSSRPC_PMAP_CLNT_H
42 
43 /*
44  * Usage:
45  *	success = pmap_set(program, version, protocol, port);
46  *	success = pmap_unset(program, version);
47  *	port = pmap_getport(address, program, version, protocol);
48  *	head = pmap_getmaps(address);
49  *	clnt_stat = pmap_rmtcall(address, program, version, procedure,
50  *		xdrargs, argsp, xdrres, resp, tout, port_ptr)
51  *		(works for udp only.)
52  * 	clnt_stat = clnt_broadcast(program, version, procedure,
53  *		xdrargs, argsp,	xdrres, resp, eachresult)
54  *		(like pmap_rmtcall, except the call is broadcasted to all
55  *		locally connected nets.  For each valid response received,
56  *		the procedure eachresult is called.  Its form is:
57  *	done = eachresult(resp, raddr)
58  *		bool_t done;
59  *		caddr_t resp;
60  *		struct sockaddr_in raddr;
61  *		where resp points to the results of the call and raddr is the
62  *		address if the responder to the broadcast.
63  */
64 
65 GSSRPC__BEGIN_DECLS
66 extern bool_t		pmap_set(rpcprog_t, rpcvers_t, rpcprot_t, u_int);
67 extern bool_t		pmap_unset(rpcprog_t, rpcvers_t);
68 extern struct pmaplist	*pmap_getmaps(struct sockaddr_in *);
69 enum clnt_stat		pmap_rmtcall(struct sockaddr_in *, rpcprog_t,
70 				     rpcvers_t, rpcproc_t, xdrproc_t,
71 				     caddr_t, xdrproc_t, caddr_t,
72 				     struct timeval, rpcport_t *);
73 
74 typedef bool_t (*resultproc_t)(caddr_t, struct sockaddr_in *);
75 
76 enum clnt_stat		clnt_broadcast(rpcprog_t, rpcvers_t, rpcproc_t,
77 				       xdrproc_t, caddr_t, xdrproc_t,
78 				       caddr_t, resultproc_t);
79 extern u_short		pmap_getport(struct sockaddr_in *,
80 				     rpcprog_t,
81 				     rpcvers_t, rpcprot_t);
82 GSSRPC__END_DECLS
83 #endif /* !defined(GSSRPC_PMAP_CLNT_H) */
84