xref: /titanic_44/usr/src/lib/nsswitch/dns/common/dns_common.h (revision 5679c89fcd2facbb4334df8870d3d7a4d2b11673)
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 /*
23  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 /*
28  * Common code and structures used by name-service-switch "dns" backends.
29  */
30 
31 #ifndef _DNS_COMMON_H
32 #define	_DNS_COMMON_H
33 
34 #pragma ident	"%Z%%M%	%I%	%E% SMI"
35 
36 #include <stdio.h>
37 #include <ctype.h>
38 #include <sys/types.h>
39 #include <sys/socket.h>
40 #include <netinet/in.h>
41 #include <netdb.h>
42 #include <strings.h>
43 #include <thread.h>
44 #include <arpa/inet.h>
45 #include <arpa/nameser.h>
46 #include <resolv.h>
47 #include <syslog.h>
48 #include <nsswitch.h>
49 #include <nss_common.h>
50 #include <nss_dbdefs.h>
51 #include <stdlib.h>
52 #include <signal.h>
53 
54 #ifdef	__cplusplus
55 extern "C" {
56 #endif
57 
58 typedef struct dns_backend *dns_backend_ptr_t;
59 typedef nss_status_t (*dns_backend_op_t)(dns_backend_ptr_t, void *);
60 
61 struct dns_backend {
62 	dns_backend_op_t	*ops;
63 	nss_dbop_t		n_ops;
64 };
65 
66 /* multithreaded libresolv2 related functions and variables */
67 extern void	(*set_no_hosts_fallback)(void);
68 extern void	(*unset_no_hosts_fallback)(void);
69 extern struct __res_state	*(*set_res_retry)();
70 extern int	(*enable_mt)();
71 extern int	(*disable_mt)();
72 extern int	*(*get_h_errno)();
73 extern int	(*override_retry)(int);
74 extern void	switch_resolver_setup(int *, sigset_t *, int *);
75 extern void	switch_resolver_reset(int, sigset_t, int);
76 extern mutex_t	one_lane;
77 
78 extern int ent2result(struct hostent *, nss_XbyY_args_t *, int);
79 extern int ent2str(struct hostent *, nss_XbyY_args_t *, int);
80 
81 nss_backend_t *_nss_dns_constr(dns_backend_op_t *, int);
82 extern	nss_status_t _herrno2nss(int);
83 
84 nss_status_t _nss_dns_gethost_withttl(void *buf, size_t bufsize, int ipnode);
85 nss_status_t _nss_get_dns_hosts_name(dns_backend_ptr_t *, void **, size_t *);
86 nss_status_t _nss_get_dns_ipnodes_name(dns_backend_ptr_t *, void **, size_t *);
87 
88 #ifdef	__cplusplus
89 }
90 #endif
91 
92 #endif /* _DNS_COMMON_H */
93