xref: /illumos-gate/usr/src/cmd/ypcmd/ypserv_resolv_common.h (revision e3ae4b35c024af1196582063ecee3ab79367227d)
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 #ifdef __cplusplus
30 extern "C" {
31 #endif
32 
33 /*
34  * Definitions common to ypserv, rpc.nisd_resolv and rpc.resolv code.
35  * Stolen from rpcbind and is used to access xprt->xp_p2 fields.
36  */
37 
38 #define	YPDNSPROC4	1L
39 #define	YPDNSPROC6	2L
40 
41 #ifdef TDRPC	/* ****** 4.1 ******** */
42 
43 #define	xdrproc_t bool
44 #define	GETCALLER(xprt)	svc_getcaller(xprt)
45 #define	SETCALLER(xprt, addrp)	*(svc_getcaller(xprt)) = *addrp;
46 struct svc_dg_data {
47 	uint_t   su_iosz;
48 	ulong_t  su_xid;
49 	XDR	su_xdrs;	/* XDR handle */
50 	char    su_verfbody[MAX_AUTH_BYTES];    /* verifier body */
51 	char	*su_cache;	/* cached data, NULL if no cache */
52 };
53 #define	get_svc_dg_data(xprt) ((struct svc_dg_data *)(xprt->xp_p2))
54 
55 #else		/* ****** 5.x ******** */
56 
57 #include <rpcsvc/svc_dg_priv.h>
58 
59 #define	MAX_UADDR	25
60 #define	GETCALLER(xprt)	svc_getrpccaller(xprt)
61 #define	SETCALLER(xprt, nbufp)	xprt->xp_rtaddr.len = nbufp->len; \
62 	(void) memcpy(xprt->xp_rtaddr.buf, nbufp->buf, nbufp->len);
63 #define	RPC_BUF_MAX	32768
64 
65 #endif		/* ****** end ******** */
66 
67 
68 struct ypfwdreq_key4 {
69 	char *map;
70 	datum keydat;
71 	unsigned long xid;
72 	unsigned long ip;
73 	unsigned short port;
74 };
75 
76 struct ypfwdreq_key6 {
77 	char		*map;
78 	datum		keydat;
79 	unsigned long	xid;
80 	uint32_t	*addr;
81 	in_port_t	port;
82 };
83 
84 extern ulong_t svc_getxid(SVCXPRT *xprt);
85 extern bool_t xdr_ypfwdreq_key4(XDR *, struct ypfwdreq_key4 *);
86 extern bool_t xdr_ypfwdreq_key6(XDR *, struct ypfwdreq_key6 *);
87 
88 #ifdef __cplusplus
89 }
90 #endif
91 
92 #endif	/* _RESOLV_COMMON_H */
93