xref: /onnv-gate/usr/src/cmd/ypcmd/ypserv_resolv_common.h (revision 5942:f6814e9b7def)
10Sstevel@tonic-gate /*
20Sstevel@tonic-gate  * CDDL HEADER START
30Sstevel@tonic-gate  *
40Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
54321Scasper  * Common Development and Distribution License (the "License").
64321Scasper  * You may not use this file except in compliance with the License.
70Sstevel@tonic-gate  *
80Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
90Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
100Sstevel@tonic-gate  * See the License for the specific language governing permissions
110Sstevel@tonic-gate  * and limitations under the License.
120Sstevel@tonic-gate  *
130Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
140Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
150Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
160Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
170Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
180Sstevel@tonic-gate  *
190Sstevel@tonic-gate  * CDDL HEADER END
200Sstevel@tonic-gate  */
210Sstevel@tonic-gate /*
22*5942Ssm26363  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
230Sstevel@tonic-gate  * Use is subject to license terms.
240Sstevel@tonic-gate  */
250Sstevel@tonic-gate 
260Sstevel@tonic-gate #ifndef _RESOLV_COMMON_H
270Sstevel@tonic-gate #define	_RESOLV_COMMON_H
280Sstevel@tonic-gate 
290Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
300Sstevel@tonic-gate 
310Sstevel@tonic-gate #ifdef __cplusplus
320Sstevel@tonic-gate extern "C" {
330Sstevel@tonic-gate #endif
340Sstevel@tonic-gate 
350Sstevel@tonic-gate /*
360Sstevel@tonic-gate  * Definitions common to ypserv, rpc.nisd_resolv and rpc.resolv code.
370Sstevel@tonic-gate  * Stolen from rpcbind and is used to access xprt->xp_p2 fields.
380Sstevel@tonic-gate  */
390Sstevel@tonic-gate 
400Sstevel@tonic-gate #define	YPDNSPROC4	1L
410Sstevel@tonic-gate #define	YPDNSPROC6	2L
420Sstevel@tonic-gate 
430Sstevel@tonic-gate #ifdef TDRPC	/* ****** 4.1 ******** */
440Sstevel@tonic-gate 
450Sstevel@tonic-gate #define	xdrproc_t bool
460Sstevel@tonic-gate #define	GETCALLER(xprt)	svc_getcaller(xprt)
470Sstevel@tonic-gate #define	SETCALLER(xprt, addrp)	*(svc_getcaller(xprt)) = *addrp;
484321Scasper struct svc_dg_data {
49*5942Ssm26363 	uint_t   su_iosz;
50*5942Ssm26363 	ulong_t  su_xid;
510Sstevel@tonic-gate 	XDR	su_xdrs;	/* XDR handle */
520Sstevel@tonic-gate 	char    su_verfbody[MAX_AUTH_BYTES];    /* verifier body */
530Sstevel@tonic-gate 	char	*su_cache;	/* cached data, NULL if no cache */
540Sstevel@tonic-gate };
55*5942Ssm26363 #define	get_svc_dg_data(xprt) ((struct svc_dg_data *)(xprt->xp_p2))
560Sstevel@tonic-gate 
570Sstevel@tonic-gate #else		/* ****** 5.x ******** */
580Sstevel@tonic-gate 
594321Scasper #include <rpcsvc/svc_dg_priv.h>
604321Scasper 
610Sstevel@tonic-gate #define	MAX_UADDR	25
620Sstevel@tonic-gate #define	GETCALLER(xprt)	svc_getrpccaller(xprt)
630Sstevel@tonic-gate #define	SETCALLER(xprt, nbufp)	xprt->xp_rtaddr.len = nbufp->len; \
64*5942Ssm26363 	(void) memcpy(xprt->xp_rtaddr.buf, nbufp->buf, nbufp->len);
650Sstevel@tonic-gate #define	RPC_BUF_MAX	32768
660Sstevel@tonic-gate 
670Sstevel@tonic-gate #endif		/* ****** end ******** */
680Sstevel@tonic-gate 
690Sstevel@tonic-gate 
700Sstevel@tonic-gate struct ypfwdreq_key4 {
710Sstevel@tonic-gate 	char *map;
720Sstevel@tonic-gate 	datum keydat;
730Sstevel@tonic-gate 	unsigned long xid;
740Sstevel@tonic-gate 	unsigned long ip;
750Sstevel@tonic-gate 	unsigned short port;
760Sstevel@tonic-gate };
770Sstevel@tonic-gate 
780Sstevel@tonic-gate struct ypfwdreq_key6 {
790Sstevel@tonic-gate 	char		*map;
800Sstevel@tonic-gate 	datum		keydat;
810Sstevel@tonic-gate 	unsigned long	xid;
820Sstevel@tonic-gate 	uint32_t	*addr;
830Sstevel@tonic-gate 	in_port_t	port;
840Sstevel@tonic-gate };
850Sstevel@tonic-gate 
86*5942Ssm26363 extern ulong_t svc_getxid(SVCXPRT *xprt);
870Sstevel@tonic-gate extern bool_t xdr_ypfwdreq_key4(XDR *, struct ypfwdreq_key4 *);
880Sstevel@tonic-gate extern bool_t xdr_ypfwdreq_key6(XDR *, struct ypfwdreq_key6 *);
890Sstevel@tonic-gate 
900Sstevel@tonic-gate #ifdef __cplusplus
910Sstevel@tonic-gate }
920Sstevel@tonic-gate #endif
930Sstevel@tonic-gate 
940Sstevel@tonic-gate #endif	/* _RESOLV_COMMON_H */
95