1*4904Srs200217 /* 2*4904Srs200217 * CDDL HEADER START 3*4904Srs200217 * 4*4904Srs200217 * The contents of this file are subject to the terms of the 5*4904Srs200217 * Common Development and Distribution License (the "License"). 6*4904Srs200217 * You may not use this file except in compliance with the License. 7*4904Srs200217 * 8*4904Srs200217 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9*4904Srs200217 * or http://www.opensolaris.org/os/licensing. 10*4904Srs200217 * See the License for the specific language governing permissions 11*4904Srs200217 * and limitations under the License. 12*4904Srs200217 * 13*4904Srs200217 * When distributing Covered Code, include this CDDL HEADER in each 14*4904Srs200217 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15*4904Srs200217 * If applicable, add the following below this CDDL HEADER, with the 16*4904Srs200217 * fields enclosed by brackets "[]" replaced with your own identifying 17*4904Srs200217 * information: Portions Copyright [yyyy] [name of copyright owner] 18*4904Srs200217 * 19*4904Srs200217 * CDDL HEADER END 20*4904Srs200217 */ 21*4904Srs200217 22*4904Srs200217 /* 23*4904Srs200217 * Copyright 2007 Sun Microsystems, Inc. All rights reserved. 24*4904Srs200217 * Use is subject to license terms. 25*4904Srs200217 */ 26*4904Srs200217 27*4904Srs200217 #pragma ident "%Z%%M% %I% %E% SMI" 28*4904Srs200217 29*4904Srs200217 #ifndef _MDNS_COMMON_H 30*4904Srs200217 #define _MDNS_COMMON_H 31*4904Srs200217 32*4904Srs200217 #include <stdio.h> 33*4904Srs200217 #include <ctype.h> 34*4904Srs200217 #include <sys/types.h> 35*4904Srs200217 #include <sys/socket.h> 36*4904Srs200217 #include <netdb.h> 37*4904Srs200217 #include <strings.h> 38*4904Srs200217 #include <syslog.h> 39*4904Srs200217 #include <sys/time.h> 40*4904Srs200217 #include <sys/select.h> 41*4904Srs200217 #include <netinet/in.h> 42*4904Srs200217 #include <arpa/inet.h> 43*4904Srs200217 #include <arpa/nameser.h> 44*4904Srs200217 #include <nsswitch.h> 45*4904Srs200217 #include <nss_common.h> 46*4904Srs200217 #include <nss_dbdefs.h> 47*4904Srs200217 #include <stdlib.h> 48*4904Srs200217 #include <signal.h> 49*4904Srs200217 #include <libscf.h> 50*4904Srs200217 #include <dns_sd.h> 51*4904Srs200217 52*4904Srs200217 #ifdef __cplusplus 53*4904Srs200217 extern "C" { 54*4904Srs200217 #endif 55*4904Srs200217 56*4904Srs200217 #define NSSMDNS_MAXQRYTMO 1 57*4904Srs200217 #define NSSMDNS_MAXSRCHDMNS 6 58*4904Srs200217 #define NSSMDNS_MAXVALIDDMNS 10 59*4904Srs200217 60*4904Srs200217 #define SMF_MDNS_FMRI "svc:/network/dns/multicast:default" 61*4904Srs200217 #define SMF_NSSMDNSCFG_PROPGRP "nss_mdns_config" 62*4904Srs200217 #define SMF_NSSMDNSCFG_SRCHPROP "search" 63*4904Srs200217 #define SMF_NSSMDNSCFG_DMNPROP "domain" 64*4904Srs200217 65*4904Srs200217 typedef struct mdns_backend *mdns_backend_ptr_t; 66*4904Srs200217 typedef nss_status_t (*mdns_backend_op_t)(mdns_backend_ptr_t, void *); 67*4904Srs200217 68*4904Srs200217 struct mdns_backend { 69*4904Srs200217 mdns_backend_op_t *ops; 70*4904Srs200217 nss_dbop_t n_ops; 71*4904Srs200217 char *dmnsrchlist[NSSMDNS_MAXSRCHDMNS]; 72*4904Srs200217 char *validdmnlist[NSSMDNS_MAXVALIDDMNS]; 73*4904Srs200217 struct timeval conftimestamp; 74*4904Srs200217 }; 75*4904Srs200217 76*4904Srs200217 struct mdns_querydata { 77*4904Srs200217 nss_XbyY_args_t *argp; 78*4904Srs200217 char *buffer; 79*4904Srs200217 int buflen; 80*4904Srs200217 int ttl; 81*4904Srs200217 boolean_t qrydone; 82*4904Srs200217 int status; 83*4904Srs200217 int af; 84*4904Srs200217 char paddrbuf[INET6_ADDRSTRLEN + 1]; 85*4904Srs200217 int withttlbsize; 86*4904Srs200217 char *withttlbuffer; 87*4904Srs200217 }; 88*4904Srs200217 89*4904Srs200217 nss_backend_t *_nss_mdns_constr(mdns_backend_op_t *, int); 90*4904Srs200217 void _nss_mdns_destr(mdns_backend_ptr_t); 91*4904Srs200217 int _nss_mdns_querybyname(mdns_backend_ptr_t, char *name, 92*4904Srs200217 int af, struct mdns_querydata *data); 93*4904Srs200217 int _nss_mdns_querybyaddr(mdns_backend_ptr_t, char *name, 94*4904Srs200217 int af, struct mdns_querydata *data); 95*4904Srs200217 void _nss_mdns_updatecfg(mdns_backend_ptr_t); 96*4904Srs200217 97*4904Srs200217 nss_status_t _nss_mdns_gethost_withttl(void *buf, size_t bufsize, int ipnode); 98*4904Srs200217 nss_status_t _nss_get_mdns_hosts_name(mdns_backend_ptr_t *be, 99*4904Srs200217 void **bufp, size_t *sizep); 100*4904Srs200217 nss_status_t _nss_get_mdns_ipnodes_name(mdns_backend_ptr_t *be, 101*4904Srs200217 void **bufp, size_t *sizep); 102*4904Srs200217 103*4904Srs200217 #ifdef __cplusplus 104*4904Srs200217 } 105*4904Srs200217 #endif 106*4904Srs200217 107*4904Srs200217 #endif /* _MDNS_COMMON_H */ 108