17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate  * CDDL HEADER START
37c478bd9Sstevel@tonic-gate  *
47c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5f48205beScasper  * Common Development and Distribution License (the "License").
6f48205beScasper  * You may not use this file except in compliance with the License.
77c478bd9Sstevel@tonic-gate  *
87c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
107c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
117c478bd9Sstevel@tonic-gate  * and limitations under the License.
127c478bd9Sstevel@tonic-gate  *
137c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
147c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
167c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
177c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
187c478bd9Sstevel@tonic-gate  *
197c478bd9Sstevel@tonic-gate  * CDDL HEADER END
207c478bd9Sstevel@tonic-gate  */
217c478bd9Sstevel@tonic-gate /*
22*7f159024Ssm  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
237c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
247c478bd9Sstevel@tonic-gate  */
257c478bd9Sstevel@tonic-gate 
267c478bd9Sstevel@tonic-gate #ifndef _RESOLV_COMMON_H
277c478bd9Sstevel@tonic-gate #define	_RESOLV_COMMON_H
287c478bd9Sstevel@tonic-gate 
297c478bd9Sstevel@tonic-gate #ifdef __cplusplus
307c478bd9Sstevel@tonic-gate extern "C" {
317c478bd9Sstevel@tonic-gate #endif
327c478bd9Sstevel@tonic-gate 
337c478bd9Sstevel@tonic-gate /*
347c478bd9Sstevel@tonic-gate  * Definitions common to ypserv, rpc.nisd_resolv and rpc.resolv code.
357c478bd9Sstevel@tonic-gate  * Stolen from rpcbind and is used to access xprt->xp_p2 fields.
367c478bd9Sstevel@tonic-gate  */
377c478bd9Sstevel@tonic-gate 
387c478bd9Sstevel@tonic-gate #define	YPDNSPROC4	1L
397c478bd9Sstevel@tonic-gate #define	YPDNSPROC6	2L
407c478bd9Sstevel@tonic-gate 
417c478bd9Sstevel@tonic-gate #ifdef TDRPC	/* ****** 4.1 ******** */
427c478bd9Sstevel@tonic-gate 
437c478bd9Sstevel@tonic-gate #define	xdrproc_t bool
447c478bd9Sstevel@tonic-gate #define	GETCALLER(xprt)	svc_getcaller(xprt)
457c478bd9Sstevel@tonic-gate #define	SETCALLER(xprt, addrp)	*(svc_getcaller(xprt)) = *addrp;
46f48205beScasper struct svc_dg_data {
47*7f159024Ssm 	uint_t   su_iosz;
48*7f159024Ssm 	ulong_t  su_xid;
497c478bd9Sstevel@tonic-gate 	XDR	su_xdrs;	/* XDR handle */
507c478bd9Sstevel@tonic-gate 	char    su_verfbody[MAX_AUTH_BYTES];    /* verifier body */
517c478bd9Sstevel@tonic-gate 	char	*su_cache;	/* cached data, NULL if no cache */
527c478bd9Sstevel@tonic-gate };
53*7f159024Ssm #define	get_svc_dg_data(xprt) ((struct svc_dg_data *)(xprt->xp_p2))
547c478bd9Sstevel@tonic-gate 
557c478bd9Sstevel@tonic-gate #else		/* ****** 5.x ******** */
567c478bd9Sstevel@tonic-gate 
57f48205beScasper #include <rpcsvc/svc_dg_priv.h>
58f48205beScasper 
597c478bd9Sstevel@tonic-gate #define	MAX_UADDR	25
607c478bd9Sstevel@tonic-gate #define	GETCALLER(xprt)	svc_getrpccaller(xprt)
617c478bd9Sstevel@tonic-gate #define	SETCALLER(xprt, nbufp)	xprt->xp_rtaddr.len = nbufp->len; \
62*7f159024Ssm 	(void) memcpy(xprt->xp_rtaddr.buf, nbufp->buf, nbufp->len);
637c478bd9Sstevel@tonic-gate #define	RPC_BUF_MAX	32768
647c478bd9Sstevel@tonic-gate 
657c478bd9Sstevel@tonic-gate #endif		/* ****** end ******** */
667c478bd9Sstevel@tonic-gate 
677c478bd9Sstevel@tonic-gate 
687c478bd9Sstevel@tonic-gate struct ypfwdreq_key4 {
697c478bd9Sstevel@tonic-gate 	char *map;
707c478bd9Sstevel@tonic-gate 	datum keydat;
717c478bd9Sstevel@tonic-gate 	unsigned long xid;
727c478bd9Sstevel@tonic-gate 	unsigned long ip;
737c478bd9Sstevel@tonic-gate 	unsigned short port;
747c478bd9Sstevel@tonic-gate };
757c478bd9Sstevel@tonic-gate 
767c478bd9Sstevel@tonic-gate struct ypfwdreq_key6 {
777c478bd9Sstevel@tonic-gate 	char		*map;
787c478bd9Sstevel@tonic-gate 	datum		keydat;
797c478bd9Sstevel@tonic-gate 	unsigned long	xid;
807c478bd9Sstevel@tonic-gate 	uint32_t	*addr;
817c478bd9Sstevel@tonic-gate 	in_port_t	port;
827c478bd9Sstevel@tonic-gate };
837c478bd9Sstevel@tonic-gate 
84*7f159024Ssm extern ulong_t svc_getxid(SVCXPRT *xprt);
857c478bd9Sstevel@tonic-gate extern bool_t xdr_ypfwdreq_key4(XDR *, struct ypfwdreq_key4 *);
867c478bd9Sstevel@tonic-gate extern bool_t xdr_ypfwdreq_key6(XDR *, struct ypfwdreq_key6 *);
877c478bd9Sstevel@tonic-gate 
887c478bd9Sstevel@tonic-gate #ifdef __cplusplus
897c478bd9Sstevel@tonic-gate }
907c478bd9Sstevel@tonic-gate #endif
917c478bd9Sstevel@tonic-gate 
927c478bd9Sstevel@tonic-gate #endif	/* _RESOLV_COMMON_H */
93