xref: /titanic_41/usr/src/lib/nsswitch/dns/common/dns_common.h (revision 7257d1b4d25bfac0c802847390e98a464fd787ac)
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 #pragma ident	"%Z%%M%	%I%	%E% SMI"
357c478bd9Sstevel@tonic-gate 
367c478bd9Sstevel@tonic-gate #include <stdio.h>
377c478bd9Sstevel@tonic-gate #include <ctype.h>
387c478bd9Sstevel@tonic-gate #include <sys/types.h>
397c478bd9Sstevel@tonic-gate #include <sys/socket.h>
407c478bd9Sstevel@tonic-gate #include <netinet/in.h>
417c478bd9Sstevel@tonic-gate #include <netdb.h>
427c478bd9Sstevel@tonic-gate #include <strings.h>
437c478bd9Sstevel@tonic-gate #include <thread.h>
44cb5caa98Sdjl #include <arpa/inet.h>
457c478bd9Sstevel@tonic-gate #include <arpa/nameser.h>
467c478bd9Sstevel@tonic-gate #include <resolv.h>
477c478bd9Sstevel@tonic-gate #include <syslog.h>
487c478bd9Sstevel@tonic-gate #include <nsswitch.h>
49cb5caa98Sdjl #include <nss_common.h>
507c478bd9Sstevel@tonic-gate #include <nss_dbdefs.h>
517c478bd9Sstevel@tonic-gate #include <stdlib.h>
527c478bd9Sstevel@tonic-gate #include <signal.h>
537c478bd9Sstevel@tonic-gate 
547c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
557c478bd9Sstevel@tonic-gate extern "C" {
567c478bd9Sstevel@tonic-gate #endif
577c478bd9Sstevel@tonic-gate 
587c478bd9Sstevel@tonic-gate typedef struct dns_backend *dns_backend_ptr_t;
597c478bd9Sstevel@tonic-gate typedef nss_status_t (*dns_backend_op_t)(dns_backend_ptr_t, void *);
607c478bd9Sstevel@tonic-gate 
617c478bd9Sstevel@tonic-gate struct dns_backend {
627c478bd9Sstevel@tonic-gate 	dns_backend_op_t	*ops;
637c478bd9Sstevel@tonic-gate 	nss_dbop_t		n_ops;
647c478bd9Sstevel@tonic-gate };
657c478bd9Sstevel@tonic-gate 
667c478bd9Sstevel@tonic-gate /* multithreaded libresolv2 related functions and variables */
677c478bd9Sstevel@tonic-gate extern void	(*set_no_hosts_fallback)(void);
687c478bd9Sstevel@tonic-gate extern void	(*unset_no_hosts_fallback)(void);
697c478bd9Sstevel@tonic-gate extern struct __res_state	*(*set_res_retry)();
707c478bd9Sstevel@tonic-gate extern int	(*enable_mt)();
717c478bd9Sstevel@tonic-gate extern int	(*disable_mt)();
727c478bd9Sstevel@tonic-gate extern int	*(*get_h_errno)();
737c478bd9Sstevel@tonic-gate extern int	(*override_retry)(int);
747c478bd9Sstevel@tonic-gate extern void	switch_resolver_setup(int *, sigset_t *, int *);
757c478bd9Sstevel@tonic-gate extern void	switch_resolver_reset(int, sigset_t, int);
767c478bd9Sstevel@tonic-gate extern mutex_t	one_lane;
777c478bd9Sstevel@tonic-gate 
787c478bd9Sstevel@tonic-gate extern int ent2result(struct hostent *, nss_XbyY_args_t *, int);
79cb5caa98Sdjl extern int ent2str(struct hostent *, nss_XbyY_args_t *, int);
807c478bd9Sstevel@tonic-gate 
817c478bd9Sstevel@tonic-gate nss_backend_t *_nss_dns_constr(dns_backend_op_t *, int);
827c478bd9Sstevel@tonic-gate extern	nss_status_t _herrno2nss(int);
837c478bd9Sstevel@tonic-gate 
84cb5caa98Sdjl nss_status_t _nss_dns_gethost_withttl(void *buf, size_t bufsize, int ipnode);
85cb5caa98Sdjl nss_status_t _nss_get_dns_hosts_name(dns_backend_ptr_t *, void **, size_t *);
86cb5caa98Sdjl nss_status_t _nss_get_dns_ipnodes_name(dns_backend_ptr_t *, void **, size_t *);
87cb5caa98Sdjl 
887c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
897c478bd9Sstevel@tonic-gate }
907c478bd9Sstevel@tonic-gate #endif
917c478bd9Sstevel@tonic-gate 
927c478bd9Sstevel@tonic-gate #endif /* _DNS_COMMON_H */
93