1244008Srmacklem/*- 2244008Srmacklem * Sun RPC is a product of Sun Microsystems, Inc. and is provided for 3244008Srmacklem * unrestricted use provided that this legend is included on all tape 4244008Srmacklem * media and as a part of the software program in whole or part. Users 5244008Srmacklem * may copy or modify Sun RPC without charge, but are not authorized 6244008Srmacklem * to license or distribute it to anyone else except as part of a product or 7244008Srmacklem * program developed by the user. 8244008Srmacklem * 9244008Srmacklem * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE 10244008Srmacklem * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR 11244008Srmacklem * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. 12244008Srmacklem * 13244008Srmacklem * Sun RPC is provided with no support and without any obligation on the 14244008Srmacklem * part of Sun Microsystems, Inc. to assist in its use, correction, 15244008Srmacklem * modification or enhancement. 16244008Srmacklem * 17244008Srmacklem * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE 18244008Srmacklem * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC 19244008Srmacklem * OR ANY PART THEREOF. 20244008Srmacklem * 21244008Srmacklem * In no event will Sun Microsystems, Inc. be liable for any lost revenue 22244008Srmacklem * or profits or other special, indirect and consequential damages, even if 23244008Srmacklem * Sun has been advised of the possibility of such damages. 24244008Srmacklem * 25244008Srmacklem * Sun Microsystems, Inc. 26244008Srmacklem * 2550 Garcia Avenue 27244008Srmacklem * Mountain View, California 94043 28244008Srmacklem * 29244008Srmacklem * $FreeBSD$ 30244008Srmacklem */ 31244008Srmacklem 32244008Srmacklem#ifndef _RPC_KRPC_H_ 33244008Srmacklem#define _RPC_KRPC_H_ 34244008Srmacklem 35244008Srmacklem#ifdef _KERNEL 36244008Srmacklem/* 37244008Srmacklem * Definitions now shared between client and server RPC for backchannels. 38244008Srmacklem */ 39244008Srmacklem#define MCALL_MSG_SIZE 24 40244008Srmacklem 41244008Srmacklem/* 42244008Srmacklem * A pending RPC request which awaits a reply. Requests which have 43244008Srmacklem * received their reply will have cr_xid set to zero and cr_mrep to 44244008Srmacklem * the mbuf chain of the reply. 45244008Srmacklem */ 46244008Srmacklemstruct ct_request { 47244008Srmacklem TAILQ_ENTRY(ct_request) cr_link; 48244008Srmacklem uint32_t cr_xid; /* XID of request */ 49244008Srmacklem struct mbuf *cr_mrep; /* reply received by upcall */ 50244008Srmacklem int cr_error; /* any error from upcall */ 51244008Srmacklem char cr_verf[MAX_AUTH_BYTES]; /* reply verf */ 52244008Srmacklem}; 53244008Srmacklem 54244008SrmacklemTAILQ_HEAD(ct_request_list, ct_request); 55244008Srmacklem 56244008Srmacklemstruct rc_data { 57244008Srmacklem struct mtx rc_lock; 58244008Srmacklem struct sockaddr_storage rc_addr; /* server address */ 59244008Srmacklem struct netconfig* rc_nconf; /* network type */ 60244008Srmacklem rpcprog_t rc_prog; /* program number */ 61244008Srmacklem rpcvers_t rc_vers; /* version number */ 62244008Srmacklem size_t rc_sendsz; 63244008Srmacklem size_t rc_recvsz; 64244008Srmacklem struct timeval rc_timeout; 65244008Srmacklem struct timeval rc_retry; 66244008Srmacklem int rc_retries; 67244008Srmacklem int rc_privport; 68244008Srmacklem char *rc_waitchan; 69244008Srmacklem int rc_intr; 70244008Srmacklem int rc_connecting; 71244008Srmacklem int rc_closed; 72244008Srmacklem struct ucred *rc_ucred; 73244008Srmacklem CLIENT* rc_client; /* underlying RPC client */ 74244008Srmacklem struct rpc_err rc_err; 75244008Srmacklem void *rc_backchannel; 76244008Srmacklem}; 77244008Srmacklem 78244008Srmacklemstruct ct_data { 79244008Srmacklem struct mtx ct_lock; 80244008Srmacklem int ct_threads; /* number of threads in clnt_vc_call */ 81244008Srmacklem bool_t ct_closing; /* TRUE if we are closing */ 82244008Srmacklem bool_t ct_closed; /* TRUE if we are closed */ 83244008Srmacklem struct socket *ct_socket; /* connection socket */ 84244008Srmacklem bool_t ct_closeit; /* close it on destroy */ 85244008Srmacklem struct timeval ct_wait; /* wait interval in milliseconds */ 86244008Srmacklem struct sockaddr_storage ct_addr; /* remote addr */ 87244008Srmacklem struct rpc_err ct_error; 88244008Srmacklem uint32_t ct_xid; 89244008Srmacklem char ct_mcallc[MCALL_MSG_SIZE]; /* marshalled callmsg */ 90244008Srmacklem size_t ct_mpos; /* pos after marshal */ 91244008Srmacklem const char *ct_waitchan; 92244008Srmacklem int ct_waitflag; 93244008Srmacklem struct mbuf *ct_record; /* current reply record */ 94244008Srmacklem size_t ct_record_resid; /* how much left of reply to read */ 95244008Srmacklem bool_t ct_record_eor; /* true if reading last fragment */ 96244008Srmacklem struct ct_request_list ct_pending; 97244008Srmacklem int ct_upcallrefs; /* Ref cnt of upcalls in prog. */ 98244008Srmacklem SVCXPRT *ct_backchannelxprt; /* xprt for backchannel */ 99244008Srmacklem}; 100244008Srmacklem 101244008Srmacklemstruct cf_conn { /* kept in xprt->xp_p1 for actual connection */ 102244008Srmacklem enum xprt_stat strm_stat; 103244008Srmacklem struct mbuf *mpending; /* unparsed data read from the socket */ 104244008Srmacklem struct mbuf *mreq; /* current record being built from mpending */ 105244008Srmacklem uint32_t resid; /* number of bytes needed for fragment */ 106244008Srmacklem bool_t eor; /* reading last fragment of current record */ 107244008Srmacklem}; 108244008Srmacklem 109244008Srmacklem#endif /* _KERNEL */ 110244008Srmacklem 111244008Srmacklem#endif /* _RPC_KRPC_H_ */ 112