xref: /titanic_50/usr/src/cmd/ypcmd/ypserv_resolv_common.h (revision b9bd317cda1afb3a01f4812de73e8cec888cbbd7)
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 (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 /*
22  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
23  * Use is subject to license terms.
24  */
25 
26 #ifndef _RESOLV_COMMON_H
27 #define	_RESOLV_COMMON_H
28 
29 #pragma ident	"%Z%%M%	%I%	%E% SMI"
30 
31 #ifdef __cplusplus
32 extern "C" {
33 #endif
34 
35 /*
36  * Definitions common to ypserv, rpc.nisd_resolv and rpc.resolv code.
37  * Stolen from rpcbind and is used to access xprt->xp_p2 fields.
38  */
39 
40 #define	YPDNSPROC4	1L
41 #define	YPDNSPROC6	2L
42 
43 #ifdef TDRPC	/* ****** 4.1 ******** */
44 
45 #define	xdrproc_t bool
46 #define	GETCALLER(xprt)	svc_getcaller(xprt)
47 #define	SETCALLER(xprt, addrp)	*(svc_getcaller(xprt)) = *addrp;
48 struct svc_dg_data {
49 	uint_t   su_iosz;
50 	ulong_t  su_xid;
51 	XDR	su_xdrs;	/* XDR handle */
52 	char    su_verfbody[MAX_AUTH_BYTES];    /* verifier body */
53 	char	*su_cache;	/* cached data, NULL if no cache */
54 };
55 #define	get_svc_dg_data(xprt) ((struct svc_dg_data *)(xprt->xp_p2))
56 
57 #else		/* ****** 5.x ******** */
58 
59 #include <rpcsvc/svc_dg_priv.h>
60 
61 #define	MAX_UADDR	25
62 #define	GETCALLER(xprt)	svc_getrpccaller(xprt)
63 #define	SETCALLER(xprt, nbufp)	xprt->xp_rtaddr.len = nbufp->len; \
64 	(void) memcpy(xprt->xp_rtaddr.buf, nbufp->buf, nbufp->len);
65 #define	RPC_BUF_MAX	32768
66 
67 #endif		/* ****** end ******** */
68 
69 
70 struct ypfwdreq_key4 {
71 	char *map;
72 	datum keydat;
73 	unsigned long xid;
74 	unsigned long ip;
75 	unsigned short port;
76 };
77 
78 struct ypfwdreq_key6 {
79 	char		*map;
80 	datum		keydat;
81 	unsigned long	xid;
82 	uint32_t	*addr;
83 	in_port_t	port;
84 };
85 
86 extern ulong_t svc_getxid(SVCXPRT *xprt);
87 extern bool_t xdr_ypfwdreq_key4(XDR *, struct ypfwdreq_key4 *);
88 extern bool_t xdr_ypfwdreq_key6(XDR *, struct ypfwdreq_key6 *);
89 
90 #ifdef __cplusplus
91 }
92 #endif
93 
94 #endif	/* _RESOLV_COMMON_H */
95