1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef _RESOLV_COMMON_H
28 #define	_RESOLV_COMMON_H
29 
30 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 #ifdef __cplusplus
33 extern "C" {
34 #endif
35 
36 /*
37  * Definitions common to ypserv, rpc.nisd_resolv and rpc.resolv code.
38  * Stolen from rpcbind and is used to access xprt->xp_p2 fields.
39  */
40 
41 #define	YPDNSPROC4	1L
42 #define	YPDNSPROC6	2L
43 
44 #ifdef TDRPC	/* ****** 4.1 ******** */
45 
46 #define	xdrproc_t bool
47 #define	GETCALLER(xprt)	svc_getcaller(xprt)
48 #define	SETCALLER(xprt, addrp)	*(svc_getcaller(xprt)) = *addrp;
49 struct bogus_data {
50 	u_int   su_iosz;
51 	u_long  su_xid;
52 	XDR	su_xdrs;	/* XDR handle */
53 	char    su_verfbody[MAX_AUTH_BYTES];    /* verifier body */
54 	char	*su_cache;	/* cached data, NULL if no cache */
55 };
56 #define	getbogus_data(xprt) ((struct bogus_data *) (xprt->xp_p2))
57 
58 #else		/* ****** 5.x ******** */
59 
60 #define	MAX_UADDR	25
61 #define	GETCALLER(xprt)	svc_getrpccaller(xprt)
62 #define	SETCALLER(xprt, nbufp)	xprt->xp_rtaddr.len = nbufp->len; \
63 			memcpy(xprt->xp_rtaddr.buf, nbufp->buf, nbufp->len);
64 #define	MAX_OPT_WORDS   128
65 #define	RPC_BUF_MAX	32768
66 struct bogus_data {
67 	/* XXX: optbuf should be the first field, used by ti_opts.c code */
68 	struct  netbuf optbuf;			/* netbuf for options */
69 	long    opts[MAX_OPT_WORDS];		/* options */
70 	u_int   su_iosz;			/* size of send.recv buffer */
71 	u_long  su_xid;				/* transaction id */
72 	XDR	su_xdrs;			/* XDR handle */
73 	char    su_verfbody[MAX_AUTH_BYTES];    /* verifier body */
74 	char	*su_cache;			/* cached data, NULL if none */
75 	struct t_unitdata	su_tudata;	/* tu_data for recv */
76 };
77 #define	getbogus_data(xprt) ((struct bogus_data *) (xprt->xp_p2))
78 
79 #endif		/* ****** end ******** */
80 
81 
82 struct ypfwdreq_key4 {
83 	char *map;
84 	datum keydat;
85 	unsigned long xid;
86 	unsigned long ip;
87 	unsigned short port;
88 };
89 
90 struct ypfwdreq_key6 {
91 	char		*map;
92 	datum		keydat;
93 	unsigned long	xid;
94 	uint32_t	*addr;
95 	in_port_t	port;
96 };
97 
98 extern u_long svc_getxid(SVCXPRT *xprt);
99 extern bool_t xdr_ypfwdreq_key4(XDR *, struct ypfwdreq_key4 *);
100 extern bool_t xdr_ypfwdreq_key6(XDR *, struct ypfwdreq_key6 *);
101 
102 #ifdef __cplusplus
103 }
104 #endif
105 
106 #endif	/* _RESOLV_COMMON_H */
107