17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate  * CDDL HEADER START
37c478bd9Sstevel@tonic-gate  *
47c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5cb5caa98Sdjl  * Common Development and Distribution License (the "License").
6cb5caa98Sdjl  * You may not use this file except in compliance with the License.
77c478bd9Sstevel@tonic-gate  *
87c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
107c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
117c478bd9Sstevel@tonic-gate  * and limitations under the License.
127c478bd9Sstevel@tonic-gate  *
137c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
147c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
167c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
177c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
187c478bd9Sstevel@tonic-gate  *
197c478bd9Sstevel@tonic-gate  * CDDL HEADER END
207c478bd9Sstevel@tonic-gate  */
21*7257d1b4Sraf 
227c478bd9Sstevel@tonic-gate /*
23*7257d1b4Sraf  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
24cb5caa98Sdjl  * Use is subject to license terms.
25cb5caa98Sdjl  */
26*7257d1b4Sraf 
27cb5caa98Sdjl /*
287c478bd9Sstevel@tonic-gate  * Common code and structures used by name-service-switch "dns" backends.
297c478bd9Sstevel@tonic-gate  */
307c478bd9Sstevel@tonic-gate 
317c478bd9Sstevel@tonic-gate #ifndef _DNS_COMMON_H
327c478bd9Sstevel@tonic-gate #define	_DNS_COMMON_H
337c478bd9Sstevel@tonic-gate 
347c478bd9Sstevel@tonic-gate #include <stdio.h>
357c478bd9Sstevel@tonic-gate #include <ctype.h>
367c478bd9Sstevel@tonic-gate #include <sys/types.h>
377c478bd9Sstevel@tonic-gate #include <sys/socket.h>
387c478bd9Sstevel@tonic-gate #include <netinet/in.h>
397c478bd9Sstevel@tonic-gate #include <netdb.h>
407c478bd9Sstevel@tonic-gate #include <strings.h>
417c478bd9Sstevel@tonic-gate #include <thread.h>
42cb5caa98Sdjl #include <arpa/inet.h>
437c478bd9Sstevel@tonic-gate #include <arpa/nameser.h>
447c478bd9Sstevel@tonic-gate #include <resolv.h>
457c478bd9Sstevel@tonic-gate #include <syslog.h>
467c478bd9Sstevel@tonic-gate #include <nsswitch.h>
47cb5caa98Sdjl #include <nss_common.h>
487c478bd9Sstevel@tonic-gate #include <nss_dbdefs.h>
497c478bd9Sstevel@tonic-gate #include <stdlib.h>
507c478bd9Sstevel@tonic-gate #include <signal.h>
517c478bd9Sstevel@tonic-gate 
527c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
537c478bd9Sstevel@tonic-gate extern "C" {
547c478bd9Sstevel@tonic-gate #endif
557c478bd9Sstevel@tonic-gate 
567c478bd9Sstevel@tonic-gate typedef struct dns_backend *dns_backend_ptr_t;
577c478bd9Sstevel@tonic-gate typedef nss_status_t (*dns_backend_op_t)(dns_backend_ptr_t, void *);
587c478bd9Sstevel@tonic-gate 
597c478bd9Sstevel@tonic-gate struct dns_backend {
607c478bd9Sstevel@tonic-gate 	dns_backend_op_t	*ops;
617c478bd9Sstevel@tonic-gate 	nss_dbop_t		n_ops;
627c478bd9Sstevel@tonic-gate };
637c478bd9Sstevel@tonic-gate 
647c478bd9Sstevel@tonic-gate /* multithreaded libresolv2 related functions and variables */
657c478bd9Sstevel@tonic-gate extern void	(*set_no_hosts_fallback)(void);
667c478bd9Sstevel@tonic-gate extern void	(*unset_no_hosts_fallback)(void);
677c478bd9Sstevel@tonic-gate extern struct __res_state	*(*set_res_retry)();
687c478bd9Sstevel@tonic-gate extern int	(*enable_mt)();
697c478bd9Sstevel@tonic-gate extern int	(*disable_mt)();
707c478bd9Sstevel@tonic-gate extern int	*(*get_h_errno)();
717c478bd9Sstevel@tonic-gate extern int	(*override_retry)(int);
727c478bd9Sstevel@tonic-gate extern void	switch_resolver_setup(int *, sigset_t *, int *);
737c478bd9Sstevel@tonic-gate extern void	switch_resolver_reset(int, sigset_t, int);
747c478bd9Sstevel@tonic-gate extern mutex_t	one_lane;
757c478bd9Sstevel@tonic-gate 
767c478bd9Sstevel@tonic-gate extern int ent2result(struct hostent *, nss_XbyY_args_t *, int);
77cb5caa98Sdjl extern int ent2str(struct hostent *, nss_XbyY_args_t *, int);
787c478bd9Sstevel@tonic-gate 
797c478bd9Sstevel@tonic-gate nss_backend_t *_nss_dns_constr(dns_backend_op_t *, int);
807c478bd9Sstevel@tonic-gate extern	nss_status_t _herrno2nss(int);
817c478bd9Sstevel@tonic-gate 
82cb5caa98Sdjl nss_status_t _nss_dns_gethost_withttl(void *buf, size_t bufsize, int ipnode);
83cb5caa98Sdjl nss_status_t _nss_get_dns_hosts_name(dns_backend_ptr_t *, void **, size_t *);
84cb5caa98Sdjl nss_status_t _nss_get_dns_ipnodes_name(dns_backend_ptr_t *, void **, size_t *);
85cb5caa98Sdjl 
867c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
877c478bd9Sstevel@tonic-gate }
887c478bd9Sstevel@tonic-gate #endif
897c478bd9Sstevel@tonic-gate 
907c478bd9Sstevel@tonic-gate #endif /* _DNS_COMMON_H */
91