xref: /onnv-gate/usr/src/lib/nsswitch/dns/common/dns_common.h (revision 6812:febeba71273d)
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
52830Sdjl  * Common Development and Distribution License (the "License").
62830Sdjl  * 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  */
21*6812Sraf 
220Sstevel@tonic-gate /*
23*6812Sraf  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
242830Sdjl  * Use is subject to license terms.
252830Sdjl  */
26*6812Sraf 
272830Sdjl /*
280Sstevel@tonic-gate  * Common code and structures used by name-service-switch "dns" backends.
290Sstevel@tonic-gate  */
300Sstevel@tonic-gate 
310Sstevel@tonic-gate #ifndef _DNS_COMMON_H
320Sstevel@tonic-gate #define	_DNS_COMMON_H
330Sstevel@tonic-gate 
340Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
350Sstevel@tonic-gate 
360Sstevel@tonic-gate #include <stdio.h>
370Sstevel@tonic-gate #include <ctype.h>
380Sstevel@tonic-gate #include <sys/types.h>
390Sstevel@tonic-gate #include <sys/socket.h>
400Sstevel@tonic-gate #include <netinet/in.h>
410Sstevel@tonic-gate #include <netdb.h>
420Sstevel@tonic-gate #include <strings.h>
430Sstevel@tonic-gate #include <thread.h>
442830Sdjl #include <arpa/inet.h>
450Sstevel@tonic-gate #include <arpa/nameser.h>
460Sstevel@tonic-gate #include <resolv.h>
470Sstevel@tonic-gate #include <syslog.h>
480Sstevel@tonic-gate #include <nsswitch.h>
492830Sdjl #include <nss_common.h>
500Sstevel@tonic-gate #include <nss_dbdefs.h>
510Sstevel@tonic-gate #include <stdlib.h>
520Sstevel@tonic-gate #include <signal.h>
530Sstevel@tonic-gate 
540Sstevel@tonic-gate #ifdef	__cplusplus
550Sstevel@tonic-gate extern "C" {
560Sstevel@tonic-gate #endif
570Sstevel@tonic-gate 
580Sstevel@tonic-gate typedef struct dns_backend *dns_backend_ptr_t;
590Sstevel@tonic-gate typedef nss_status_t (*dns_backend_op_t)(dns_backend_ptr_t, void *);
600Sstevel@tonic-gate 
610Sstevel@tonic-gate struct dns_backend {
620Sstevel@tonic-gate 	dns_backend_op_t	*ops;
630Sstevel@tonic-gate 	nss_dbop_t		n_ops;
640Sstevel@tonic-gate };
650Sstevel@tonic-gate 
660Sstevel@tonic-gate /* multithreaded libresolv2 related functions and variables */
670Sstevel@tonic-gate extern void	(*set_no_hosts_fallback)(void);
680Sstevel@tonic-gate extern void	(*unset_no_hosts_fallback)(void);
690Sstevel@tonic-gate extern struct __res_state	*(*set_res_retry)();
700Sstevel@tonic-gate extern int	(*enable_mt)();
710Sstevel@tonic-gate extern int	(*disable_mt)();
720Sstevel@tonic-gate extern int	*(*get_h_errno)();
730Sstevel@tonic-gate extern int	(*override_retry)(int);
740Sstevel@tonic-gate extern void	switch_resolver_setup(int *, sigset_t *, int *);
750Sstevel@tonic-gate extern void	switch_resolver_reset(int, sigset_t, int);
760Sstevel@tonic-gate extern mutex_t	one_lane;
770Sstevel@tonic-gate 
780Sstevel@tonic-gate extern int ent2result(struct hostent *, nss_XbyY_args_t *, int);
792830Sdjl extern int ent2str(struct hostent *, nss_XbyY_args_t *, int);
800Sstevel@tonic-gate 
810Sstevel@tonic-gate nss_backend_t *_nss_dns_constr(dns_backend_op_t *, int);
820Sstevel@tonic-gate extern	nss_status_t _herrno2nss(int);
830Sstevel@tonic-gate 
842830Sdjl nss_status_t _nss_dns_gethost_withttl(void *buf, size_t bufsize, int ipnode);
852830Sdjl nss_status_t _nss_get_dns_hosts_name(dns_backend_ptr_t *, void **, size_t *);
862830Sdjl nss_status_t _nss_get_dns_ipnodes_name(dns_backend_ptr_t *, void **, size_t *);
872830Sdjl 
880Sstevel@tonic-gate #ifdef	__cplusplus
890Sstevel@tonic-gate }
900Sstevel@tonic-gate #endif
910Sstevel@tonic-gate 
920Sstevel@tonic-gate #endif /* _DNS_COMMON_H */
93