xref: /illumos-gate/usr/src/uts/common/rpc/clnt_soc.h (revision 2aeafac3612e19716bf8164f89c3c9196342979c)
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 /*
35  * clnt.h - Client side remote procedure call interface.
36  */
37 
38 #ifndef _RPC_CLNT_SOC_H
39 #define	_RPC_CLNT_SOC_H
40 
41 #pragma ident	"%Z%%M%	%I%	%E% SMI"
42 
43 /*
44  * All the following declarations are only for backward compatibility
45  * with SUNOS 4.0.
46  */
47 
48 #include <sys/socket.h>
49 #include <netinet/in.h>
50 #include <rpc/xdr.h>
51 #include <rpc/clnt.h>
52 
53 #ifdef	__cplusplus
54 extern "C" {
55 #endif
56 
57 #define	UDPMSGSIZE	8800	/* rpc imposed limit on udp msg size */
58 
59 /*
60  * callrpc(host, prognum, versnum, procnum, inproc, in, outproc, out)
61  *	char *host;
62  *	rpcprog_t prognum;
63  *	rpcvers_t versnum;
64  *	rpcproc_t procnum;
65  *	xdrproc_t inproc, outproc;
66  *	char *in, *out;
67  */
68 #ifdef __STDC__
69 extern int callrpc(char *, rpcprog_t, rpcvers_t, rpcproc_t, xdrproc_t, char *,
70     xdrproc_t, char *);
71 #else
72 extern int callrpc();
73 #endif
74 
75 
76 /*
77  * TCP based rpc
78  * CLIENT *
79  * clnttcp_create(raddr, prog, vers, fdp, sendsz, recvsz)
80  *	struct sockaddr_in *raddr;
81  *	rpcprog_t prog;
82  *	rpcvers_t version;
83  *	int *fdp;
84  *	uint_t sendsz;
85  *	uint_t recvsz;
86  */
87 #ifdef __STDC__
88 extern CLIENT *clnttcp_create(struct sockaddr_in *, rpcprog_t, rpcvers_t,
89     int *, uint_t, uint_t);
90 #else
91 extern CLIENT *clnttcp_create();
92 #endif
93 
94 
95 /*
96  * UDP based rpc.
97  * CLIENT *
98  * clntudp_create(raddr, program, version, wait, fdp)
99  *	struct sockaddr_in *raddr;
100  *	rpcprog_t program;
101  *	rpcvers_t version;
102  *	struct timeval wait;
103  *	int *fdp;
104  *
105  * Same as above, but you specify max packet sizes.
106  * CLIENT *
107  * clntudp_bufcreate(raddr, program, version, wait, fdp, sendsz, recvsz)
108  *	struct sockaddr_in *raddr;
109  *	rpcprog_t program;
110  *	rpcvers_t version;
111  *	struct timeval wait;
112  *	int *fdp;
113  *	uint_t sendsz;
114  *	uint_t recvsz;
115  *
116  */
117 #ifdef __STDC__
118 extern CLIENT *clntudp_create(struct sockaddr_in *, rpcprog_t, rpcvers_t,
119     struct timeval, int *);
120 extern CLIENT *clntudp_bufcreate(struct sockaddr_in *, rpcprog_t, rpcvers_t,
121     struct timeval, int *, uint_t, uint_t);
122 #else
123 extern CLIENT *clntudp_create();
124 extern CLIENT *clntudp_bufcreate();
125 #endif
126 
127 /*
128  * Memory based rpc (for speed check and testing)
129  * CLIENT *
130  * clntraw_create(prog, vers)
131  *	rpcprog_t prog;
132  *	rpcvers_t vers;
133  */
134 #ifdef __STDC__
135 extern CLIENT *clntraw_create(rpcprog_t, rpcvers_t);
136 #else
137 extern CLIENT *clntraw_create();
138 #endif
139 
140 /*
141  * get the local host's IP address without consulting
142  * name service library functions
143  * void
144  * get_myaddress(addr)
145  * 	struct sockaddr_in  *addr;
146  */
147 #ifdef __STDC__
148 extern void get_myaddress(struct sockaddr_in *);
149 #else
150 extern void get_myaddress();
151 #endif
152 
153 /*
154  * get the port number on the host for the rpc program, version and proto
155  * void
156  * getrpcport(host, prognum, versnum, proto)
157  * 	char *host;
158  *	rpcprog_t prognum;
159  *	rpcvers_t versnum;
160  *	rpcprot_t proto;
161  */
162 #ifdef __STDC__
163 extern ushort_t getrpcport(char *, rpcprog_t, rpcvers_t, rpcprot_t);
164 #else
165 extern ushort_t getrpcport();
166 #endif
167 
168 #ifdef	__cplusplus
169 }
170 #endif
171 
172 #endif /* _RPC_CLNT_SOC_H */
173