xref: /onnv-gate/usr/src/lib/nsswitch/dns/common/dns_common.h (revision 2830:5228d1267a01)
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
5*2830Sdjl  * Common Development and Distribution License (the "License").
6*2830Sdjl  * 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  */
210Sstevel@tonic-gate /*
22*2830Sdjl  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
23*2830Sdjl  * Use is subject to license terms.
24*2830Sdjl  */
25*2830Sdjl /*
260Sstevel@tonic-gate  * Common code and structures used by name-service-switch "dns" backends.
270Sstevel@tonic-gate  */
280Sstevel@tonic-gate 
290Sstevel@tonic-gate #ifndef _DNS_COMMON_H
300Sstevel@tonic-gate #define	_DNS_COMMON_H
310Sstevel@tonic-gate 
320Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
330Sstevel@tonic-gate 
340Sstevel@tonic-gate #include <stdio.h>
350Sstevel@tonic-gate #include <ctype.h>
360Sstevel@tonic-gate #include <sys/types.h>
370Sstevel@tonic-gate #include <sys/socket.h>
380Sstevel@tonic-gate #include <netinet/in.h>
390Sstevel@tonic-gate #include <netdb.h>
400Sstevel@tonic-gate #include <strings.h>
410Sstevel@tonic-gate #include <thread.h>
42*2830Sdjl #include <arpa/inet.h>
430Sstevel@tonic-gate #include <arpa/nameser.h>
440Sstevel@tonic-gate #include <resolv.h>
450Sstevel@tonic-gate #include <syslog.h>
460Sstevel@tonic-gate #include <nsswitch.h>
47*2830Sdjl #include <nss_common.h>
480Sstevel@tonic-gate #include <nss_dbdefs.h>
490Sstevel@tonic-gate #include <stdlib.h>
500Sstevel@tonic-gate #include <signal.h>
510Sstevel@tonic-gate 
520Sstevel@tonic-gate #ifdef	__cplusplus
530Sstevel@tonic-gate extern "C" {
540Sstevel@tonic-gate #endif
550Sstevel@tonic-gate 
560Sstevel@tonic-gate typedef struct dns_backend *dns_backend_ptr_t;
570Sstevel@tonic-gate typedef nss_status_t (*dns_backend_op_t)(dns_backend_ptr_t, void *);
580Sstevel@tonic-gate 
590Sstevel@tonic-gate struct dns_backend {
600Sstevel@tonic-gate 	dns_backend_op_t	*ops;
610Sstevel@tonic-gate 	nss_dbop_t		n_ops;
620Sstevel@tonic-gate };
630Sstevel@tonic-gate 
640Sstevel@tonic-gate /* multithreaded libresolv2 related functions and variables */
650Sstevel@tonic-gate extern void	(*set_no_hosts_fallback)(void);
660Sstevel@tonic-gate extern void	(*unset_no_hosts_fallback)(void);
670Sstevel@tonic-gate extern struct __res_state	*(*set_res_retry)();
680Sstevel@tonic-gate extern int	(*enable_mt)();
690Sstevel@tonic-gate extern int	(*disable_mt)();
700Sstevel@tonic-gate extern int	*(*get_h_errno)();
710Sstevel@tonic-gate extern int	(*override_retry)(int);
720Sstevel@tonic-gate extern void	switch_resolver_setup(int *, sigset_t *, int *);
730Sstevel@tonic-gate extern void	switch_resolver_reset(int, sigset_t, int);
740Sstevel@tonic-gate extern mutex_t	one_lane;
750Sstevel@tonic-gate 
760Sstevel@tonic-gate extern int _thr_sigsetmask(int, const sigset_t *, sigset_t *);
770Sstevel@tonic-gate extern int _mutex_lock(mutex_t *);
780Sstevel@tonic-gate extern int _mutex_unlock(mutex_t *);
790Sstevel@tonic-gate 
800Sstevel@tonic-gate extern int ent2result(struct hostent *, nss_XbyY_args_t *, int);
81*2830Sdjl extern int ent2str(struct hostent *, nss_XbyY_args_t *, int);
820Sstevel@tonic-gate 
830Sstevel@tonic-gate nss_backend_t *_nss_dns_constr(dns_backend_op_t *, int);
840Sstevel@tonic-gate extern	nss_status_t _herrno2nss(int);
850Sstevel@tonic-gate 
86*2830Sdjl nss_status_t _nss_dns_gethost_withttl(void *buf, size_t bufsize, int ipnode);
87*2830Sdjl nss_status_t _nss_get_dns_hosts_name(dns_backend_ptr_t *, void **, size_t *);
88*2830Sdjl nss_status_t _nss_get_dns_ipnodes_name(dns_backend_ptr_t *, void **, size_t *);
89*2830Sdjl 
900Sstevel@tonic-gate #ifdef	__cplusplus
910Sstevel@tonic-gate }
920Sstevel@tonic-gate #endif
930Sstevel@tonic-gate 
940Sstevel@tonic-gate #endif /* _DNS_COMMON_H */
95