xref: /illumos-gate/usr/src/uts/common/rpc/pmap_clnt.h (revision 012e6ce759c490003aed29439cc47d3d73a99ad3)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 /* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
27 /* All Rights Reserved */
28 /*
29  * Portions of this source code were derived from Berkeley
30  * 4.3 BSD under license from the Regents of the University of
31  * California.
32  */
33 
34 #ifndef _RPC_PMAP_CLNT_H
35 #define	_RPC_PMAP_CLNT_H
36 
37 /*
38  * pmap_clnt.h
39  * Supplies C routines to get to portmap services.
40  */
41 
42 #include <netinet/in.h>
43 
44 #ifdef __STDC__
45 #include <rpc/clnt.h>
46 #endif
47 
48 #ifdef __cplusplus
49 extern "C" {
50 #endif
51 
52 /*
53  * Usage:
54  *	success = pmap_set(program, version, protocol, port);
55  *	success = pmap_unset(program, version);
56  *	port = pmap_getport(address, program, version, protocol);
57  *	head = pmap_getmaps(address);
58  *	clnt_stat = pmap_rmtcall(address, program, version, procedure,
59  *		xdrargs, argsp, xdrres, resp, tout, port_ptr)
60  *		(works for udp only.)
61  * 	clnt_stat = clnt_broadcast(program, version, procedure,
62  *		xdrargs, argsp,	xdrres, resp, eachresult)
63  *		(like pmap_rmtcall, except the call is broadcasted to all
64  *		locally connected nets.  For each valid response received,
65  *		the procedure eachresult is called.  Its form is:
66  *	done = eachresult(resp, raddr)
67  *		bool_t done;
68  *		caddr_t resp;
69  *		struct sockaddr_in raddr;
70  *		where resp points to the results of the call and raddr is the
71  *		address if the responder to the broadcast.
72  */
73 
74 #ifdef __STDC__
75 extern bool_t pmap_set(rpcprog_t, rpcvers_t, rpcprot_t, unsigned short port);
76 extern bool_t pmap_unset(rpcprog_t, rpcvers_t);
77 extern struct pmaplist *pmap_getmaps(struct sockaddr_in *);
78 extern ushort_t pmap_getport(struct sockaddr_in *, rpcprog_t, rpcvers_t,
79     rpcprot_t);
80 #ifndef _KERNEL
81 enum clnt_stat clnt_broadcast(rpcprog_t, rpcvers_t, rpcproc_t, xdrproc_t,
82     char *, xdrproc_t, char *, resultproc_t);
83 enum clnt_stat pmap_rmtcall(struct sockaddr_in *, rpcprog_t, rpcvers_t,
84     rpcproc_t, xdrproc_t, caddr_t, xdrproc_t, caddr_t, struct timeval,
85     rpcport_t *);
86 #endif
87 #else
88 extern bool_t pmap_set();
89 extern bool_t pmap_unset();
90 extern struct pmaplist *pmap_getmaps();
91 extern ushort_t pmap_getport();
92 #ifndef _KERNEL
93 enum clnt_stat clnt_broadcast();
94 enum clnt_stat pmap_rmtcall();
95 #endif
96 #endif
97 
98 #ifdef __cplusplus
99 }
100 #endif
101 
102 #endif	/* _RPC_PMAP_CLNT_H */
103