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, Version 1.0 only 6 * (the "License"). You may not use this file except in compliance 7 * with the License. 8 * 9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10 * or http://www.opensolaris.org/os/licensing. 11 * See the License for the specific language governing permissions 12 * and limitations under the License. 13 * 14 * When distributing Covered Code, include this CDDL HEADER in each 15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16 * If applicable, add the following below this CDDL HEADER, with the 17 * fields enclosed by brackets "[]" replaced with your own identifying 18 * information: Portions Copyright [yyyy] [name of copyright owner] 19 * 20 * CDDL HEADER END 21 */ 22 /* 23 * Copyright (c) 1993, 1998-1999 by Sun Microsystems, Inc. 24 * All rights reserved. 25 * 26 * Common code and structures used by name-service-switch "dns" backends. 27 */ 28 29 #ifndef _DNS_COMMON_H 30 #define _DNS_COMMON_H 31 32 #pragma ident "%Z%%M% %I% %E% SMI" 33 34 #include <stdio.h> 35 #include <ctype.h> 36 #include <sys/types.h> 37 #include <sys/socket.h> 38 #include <netinet/in.h> 39 #include <netdb.h> 40 #include <strings.h> 41 #include <thread.h> 42 #include <arpa/nameser.h> 43 #include <resolv.h> 44 #include <syslog.h> 45 #include <nsswitch.h> 46 #include <nss_dbdefs.h> 47 #include <stdlib.h> 48 #include <signal.h> 49 50 #ifdef __cplusplus 51 extern "C" { 52 #endif 53 54 typedef struct dns_backend *dns_backend_ptr_t; 55 typedef nss_status_t (*dns_backend_op_t)(dns_backend_ptr_t, void *); 56 57 struct dns_backend { 58 dns_backend_op_t *ops; 59 nss_dbop_t n_ops; 60 }; 61 62 /* multithreaded libresolv2 related functions and variables */ 63 extern void (*set_no_hosts_fallback)(void); 64 extern void (*unset_no_hosts_fallback)(void); 65 extern struct __res_state *(*set_res_retry)(); 66 extern int (*enable_mt)(); 67 extern int (*disable_mt)(); 68 extern int *(*get_h_errno)(); 69 extern int (*override_retry)(int); 70 extern void switch_resolver_setup(int *, sigset_t *, int *); 71 extern void switch_resolver_reset(int, sigset_t, int); 72 extern mutex_t one_lane; 73 74 extern int _thr_sigsetmask(int, const sigset_t *, sigset_t *); 75 extern int _mutex_lock(mutex_t *); 76 extern int _mutex_unlock(mutex_t *); 77 extern const char *inet_ntop(int, const void *, char *, size_t); 78 79 extern int ent2result(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 #ifdef __cplusplus 85 } 86 #endif 87 88 #endif /* _DNS_COMMON_H */ 89