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