xref: /openbsd/lib/libc/rpc/clnt_udp.h (revision 903e91b4)
1*903e91b4Sderaadt /*	$OpenBSD: clnt_udp.h,v 1.1 2024/01/22 16:18:06 deraadt Exp $ */
2*903e91b4Sderaadt 
3*903e91b4Sderaadt /*
4*903e91b4Sderaadt  * Copyright (c) 2010, Oracle America, Inc.
5*903e91b4Sderaadt  *
6*903e91b4Sderaadt  * Redistribution and use in source and binary forms, with or without
7*903e91b4Sderaadt  * modification, are permitted provided that the following conditions are
8*903e91b4Sderaadt  * met:
9*903e91b4Sderaadt  *
10*903e91b4Sderaadt  *     * Redistributions of source code must retain the above copyright
11*903e91b4Sderaadt  *       notice, this list of conditions and the following disclaimer.
12*903e91b4Sderaadt  *     * Redistributions in binary form must reproduce the above
13*903e91b4Sderaadt  *       copyright notice, this list of conditions and the following
14*903e91b4Sderaadt  *       disclaimer in the documentation and/or other materials
15*903e91b4Sderaadt  *       provided with the distribution.
16*903e91b4Sderaadt  *     * Neither the name of the "Oracle America, Inc." nor the names of its
17*903e91b4Sderaadt  *       contributors may be used to endorse or promote products derived
18*903e91b4Sderaadt  *       from this software without specific prior written permission.
19*903e91b4Sderaadt  *
20*903e91b4Sderaadt  *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21*903e91b4Sderaadt  *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22*903e91b4Sderaadt  *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
23*903e91b4Sderaadt  *   FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
24*903e91b4Sderaadt  *   COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
25*903e91b4Sderaadt  *   INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26*903e91b4Sderaadt  *   DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
27*903e91b4Sderaadt  *   GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28*903e91b4Sderaadt  *   INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
29*903e91b4Sderaadt  *   WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
30*903e91b4Sderaadt  *   NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31*903e91b4Sderaadt  *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32*903e91b4Sderaadt  */
33*903e91b4Sderaadt 
34*903e91b4Sderaadt /*
35*903e91b4Sderaadt  * Private data kept per client handle
36*903e91b4Sderaadt  */
37*903e91b4Sderaadt struct cu_data {
38*903e91b4Sderaadt 	int		   cu_sock;
39*903e91b4Sderaadt 	bool_t		   cu_closeit;
40*903e91b4Sderaadt 	struct sockaddr_in cu_raddr;
41*903e91b4Sderaadt 	int		   cu_connected;	/* use send() instead */
42*903e91b4Sderaadt 	int		   cu_rlen;
43*903e91b4Sderaadt 	struct timeval	   cu_wait;
44*903e91b4Sderaadt 	struct timeval     cu_total;
45*903e91b4Sderaadt 	struct rpc_err	   cu_error;
46*903e91b4Sderaadt 	XDR		   cu_outxdrs;
47*903e91b4Sderaadt 	u_int		   cu_xdrpos;
48*903e91b4Sderaadt 	u_int		   cu_sendsz;
49*903e91b4Sderaadt 	char		   *cu_outbuf;
50*903e91b4Sderaadt 	u_int		   cu_recvsz;
51*903e91b4Sderaadt 	char		   cu_inbuf[1];
52*903e91b4Sderaadt };
53*903e91b4Sderaadt 
54*903e91b4Sderaadt struct clntudp_bufcreate_args {
55*903e91b4Sderaadt 	struct sockaddr_in *raddr;
56*903e91b4Sderaadt 	u_long program;
57*903e91b4Sderaadt 	u_long version;
58*903e91b4Sderaadt 	struct timeval wait;
59*903e91b4Sderaadt 	int *sockp;
60*903e91b4Sderaadt 	u_int sendsz;
61*903e91b4Sderaadt 	u_int recvsz;
62*903e91b4Sderaadt 	CLIENT *cl;
63*903e91b4Sderaadt 	struct cu_data *cu;
64*903e91b4Sderaadt 	struct rpc_msg call_msg;
65*903e91b4Sderaadt };
66*903e91b4Sderaadt 
67*903e91b4Sderaadt __BEGIN_HIDDEN_DECLS
68*903e91b4Sderaadt extern int clntudp_bufcreate1(struct clntudp_bufcreate_args *);
69*903e91b4Sderaadt extern int clntudp_bufcreate2(struct clntudp_bufcreate_args *);
70*903e91b4Sderaadt __END_HIDDEN_DECLS
71