xref: /titanic_44/usr/src/cmd/ypcmd/ypserv_resolv_common.h (revision 7f159024d938d3699c5fadbaf3c1e06639e95c04)
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*7f159024Ssm26363  * 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 #pragma ident	"%Z%%M%	%I%	%E% SMI"
307c478bd9Sstevel@tonic-gate 
317c478bd9Sstevel@tonic-gate #ifdef __cplusplus
327c478bd9Sstevel@tonic-gate extern "C" {
337c478bd9Sstevel@tonic-gate #endif
347c478bd9Sstevel@tonic-gate 
357c478bd9Sstevel@tonic-gate /*
367c478bd9Sstevel@tonic-gate  * Definitions common to ypserv, rpc.nisd_resolv and rpc.resolv code.
377c478bd9Sstevel@tonic-gate  * Stolen from rpcbind and is used to access xprt->xp_p2 fields.
387c478bd9Sstevel@tonic-gate  */
397c478bd9Sstevel@tonic-gate 
407c478bd9Sstevel@tonic-gate #define	YPDNSPROC4	1L
417c478bd9Sstevel@tonic-gate #define	YPDNSPROC6	2L
427c478bd9Sstevel@tonic-gate 
437c478bd9Sstevel@tonic-gate #ifdef TDRPC	/* ****** 4.1 ******** */
447c478bd9Sstevel@tonic-gate 
457c478bd9Sstevel@tonic-gate #define	xdrproc_t bool
467c478bd9Sstevel@tonic-gate #define	GETCALLER(xprt)	svc_getcaller(xprt)
477c478bd9Sstevel@tonic-gate #define	SETCALLER(xprt, addrp)	*(svc_getcaller(xprt)) = *addrp;
48f48205beScasper struct svc_dg_data {
49*7f159024Ssm26363 	uint_t   su_iosz;
50*7f159024Ssm26363 	ulong_t  su_xid;
517c478bd9Sstevel@tonic-gate 	XDR	su_xdrs;	/* XDR handle */
527c478bd9Sstevel@tonic-gate 	char    su_verfbody[MAX_AUTH_BYTES];    /* verifier body */
537c478bd9Sstevel@tonic-gate 	char	*su_cache;	/* cached data, NULL if no cache */
547c478bd9Sstevel@tonic-gate };
55f48205beScasper #define	get_svc_dg_data(xprt) ((struct svc_dg_data *)(xprt->xp_p2))
567c478bd9Sstevel@tonic-gate 
577c478bd9Sstevel@tonic-gate #else		/* ****** 5.x ******** */
587c478bd9Sstevel@tonic-gate 
59f48205beScasper #include <rpcsvc/svc_dg_priv.h>
60f48205beScasper 
617c478bd9Sstevel@tonic-gate #define	MAX_UADDR	25
627c478bd9Sstevel@tonic-gate #define	GETCALLER(xprt)	svc_getrpccaller(xprt)
637c478bd9Sstevel@tonic-gate #define	SETCALLER(xprt, nbufp)	xprt->xp_rtaddr.len = nbufp->len; \
64*7f159024Ssm26363 	(void) memcpy(xprt->xp_rtaddr.buf, nbufp->buf, nbufp->len);
657c478bd9Sstevel@tonic-gate #define	RPC_BUF_MAX	32768
667c478bd9Sstevel@tonic-gate 
677c478bd9Sstevel@tonic-gate #endif		/* ****** end ******** */
687c478bd9Sstevel@tonic-gate 
697c478bd9Sstevel@tonic-gate 
707c478bd9Sstevel@tonic-gate struct ypfwdreq_key4 {
717c478bd9Sstevel@tonic-gate 	char *map;
727c478bd9Sstevel@tonic-gate 	datum keydat;
737c478bd9Sstevel@tonic-gate 	unsigned long xid;
747c478bd9Sstevel@tonic-gate 	unsigned long ip;
757c478bd9Sstevel@tonic-gate 	unsigned short port;
767c478bd9Sstevel@tonic-gate };
777c478bd9Sstevel@tonic-gate 
787c478bd9Sstevel@tonic-gate struct ypfwdreq_key6 {
797c478bd9Sstevel@tonic-gate 	char		*map;
807c478bd9Sstevel@tonic-gate 	datum		keydat;
817c478bd9Sstevel@tonic-gate 	unsigned long	xid;
827c478bd9Sstevel@tonic-gate 	uint32_t	*addr;
837c478bd9Sstevel@tonic-gate 	in_port_t	port;
847c478bd9Sstevel@tonic-gate };
857c478bd9Sstevel@tonic-gate 
86*7f159024Ssm26363 extern ulong_t svc_getxid(SVCXPRT *xprt);
877c478bd9Sstevel@tonic-gate extern bool_t xdr_ypfwdreq_key4(XDR *, struct ypfwdreq_key4 *);
887c478bd9Sstevel@tonic-gate extern bool_t xdr_ypfwdreq_key6(XDR *, struct ypfwdreq_key6 *);
897c478bd9Sstevel@tonic-gate 
907c478bd9Sstevel@tonic-gate #ifdef __cplusplus
917c478bd9Sstevel@tonic-gate }
927c478bd9Sstevel@tonic-gate #endif
937c478bd9Sstevel@tonic-gate 
947c478bd9Sstevel@tonic-gate #endif	/* _RESOLV_COMMON_H */
95