1 /* -*- Mode: C; tab-width: 4 -*- 2 * 3 * Copyright (c) 2002-2003 Apple Computer, Inc. All rights reserved. 4 * 5 * Licensed under the Apache License, Version 2.0 (the "License"); 6 * you may not use this file except in compliance with the License. 7 * You may obtain a copy of the License at 8 * 9 * http://www.apache.org/licenses/LICENSE-2.0 10 * 11 * Unless required by applicable law or agreed to in writing, software 12 * distributed under the License is distributed on an "AS IS" BASIS, 13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 * See the License for the specific language governing permissions and 15 * limitations under the License. 16 17 File: uds_daemon.h 18 19 Contains: Interfaces necessary to talk to uds_daemon.c. 20 21 Version: 1.0 22 23 Change History (most recent first): 24 25 Log: uds_daemon.h,v $ 26 Revision 1.27 2009/04/30 20:07:51 mcguire 27 <rdar://problem/6822674> Support multiple UDSs from launchd 28 29 Revision 1.26 2008/10/02 22:26:21 cheshire 30 Moved declaration of BPF_fd from uds_daemon.c to mDNSMacOSX.c, where it really belongs 31 32 Revision 1.25 2008/09/27 01:08:25 cheshire 33 Added external declaration of "dnssd_sock_t BPF_fd" 34 35 Revision 1.24 2007/09/19 20:25:17 cheshire 36 Deleted outdated comment 37 38 Revision 1.23 2007/07/24 17:23:02 cheshire 39 Rename DefRegList as AutoRegistrationDomains 40 41 Revision 1.22 2007/07/11 02:58:04 cheshire 42 <rdar://problem/5303807> Register IPv6-only hostname and don't create port mappings for AutoTunnel services 43 44 Revision 1.21 2007/04/21 21:47:47 cheshire 45 <rdar://problem/4376383> Daemon: Add watchdog timer 46 47 Revision 1.20 2007/02/14 01:58:19 cheshire 48 <rdar://problem/4995831> Don't delete Unix Domain Socket on exit if we didn't create it on startup 49 50 Revision 1.19 2007/02/07 19:32:00 cheshire 51 <rdar://problem/4980353> All mDNSResponder components should contain version strings in SCCS-compatible format 52 53 Revision 1.18 2007/02/06 19:06:49 cheshire 54 <rdar://problem/3956518> Need to go native with launchd 55 56 Revision 1.17 2007/01/05 05:46:07 cheshire 57 Add mDNS *const m parameter to udsserver_handle_configchange() 58 59 Revision 1.16 2007/01/04 23:11:15 cheshire 60 <rdar://problem/4720673> uDNS: Need to start caching unicast records 61 When an automatic browsing domain is removed, generate appropriate "remove" events for legacy queries 62 63 Revision 1.15 2006/08/14 23:24:57 cheshire 64 Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0 65 66 Revision 1.14 2005/01/27 17:48:39 cheshire 67 Added comment about CFSocketInvalidate closing the underlying socket 68 69 Revision 1.13 2004/12/10 05:27:26 cheshire 70 <rdar://problem/3909147> Guard against multiple autoname services of the same type on the same machine 71 72 Revision 1.12 2004/12/10 04:28:28 cheshire 73 <rdar://problem/3914406> User not notified of name changes for services using new UDS API 74 75 Revision 1.11 2004/12/06 21:15:23 ksekar 76 <rdar://problem/3884386> mDNSResponder crashed in CheckServiceRegistrations 77 78 Revision 1.10 2004/10/26 04:31:44 cheshire 79 Rename CountSubTypes() as ChopSubTypes() 80 81 Revision 1.9 2004/09/30 00:25:00 ksekar 82 <rdar://problem/3695802> Dynamically update default registration domains on config change 83 84 Revision 1.8 2004/09/21 21:05:11 cheshire 85 Move duplicate code out of mDNSMacOSX/daemon.c and mDNSPosix/PosixDaemon.c, 86 into mDNSShared/uds_daemon.c 87 88 Revision 1.7 2004/09/17 01:08:55 cheshire 89 Renamed mDNSClientAPI.h to mDNSEmbeddedAPI.h 90 The name "mDNSClientAPI.h" is misleading to new developers looking at this code. The interfaces 91 declared in that file are ONLY appropriate to single-address-space embedded applications. 92 For clients on general-purpose computers, the interfaces defined in dns_sd.h should be used. 93 94 Revision 1.6 2004/08/11 01:58:49 cheshire 95 Remove "mDNS *globalInstance" parameter from udsserver_init() 96 97 Revision 1.5 2004/06/18 04:44:58 rpantos 98 Use platform layer for socket types 99 100 Revision 1.4 2004/06/12 00:51:58 cheshire 101 Changes for Windows compatibility 102 103 Revision 1.3 2004/01/25 00:03:21 cheshire 104 Change to use mDNSVal16() instead of private PORT_AS_NUM() macro 105 106 Revision 1.2 2004/01/24 08:46:26 bradley 107 Added InterfaceID<->Index platform interfaces since they are now used by all platforms for the DNS-SD APIs. 108 109 Revision 1.1 2003/12/08 21:11:42 rpantos; 110 Changes necessary to support mDNSResponder on Linux. 111 112 */ 113 114 #include "mDNSEmbeddedAPI.h" 115 #include "dnssd_ipc.h" 116 117 /* Client interface: */ 118 119 #define SRS_PORT(S) mDNSVal16((S)->RR_SRV.resrec.rdata->u.srv.port) 120 121 extern int udsserver_init(dnssd_sock_t skts[], mDNSu32 count); 122 extern mDNSs32 udsserver_idle(mDNSs32 nextevent); 123 extern void udsserver_info(mDNS *const m); // print out info about current state 124 extern void udsserver_handle_configchange(mDNS *const m); 125 extern int udsserver_exit(void); // should be called prior to app exit 126 127 /* Routines that uds_daemon expects to link against: */ 128 129 typedef void (*udsEventCallback)(int fd, short filter, void *context); 130 extern mStatus udsSupportAddFDToEventLoop(dnssd_sock_t fd, udsEventCallback callback, void *context); 131 extern mStatus udsSupportRemoveFDFromEventLoop(dnssd_sock_t fd); // Note: This also CLOSES the file descriptor as well 132 133 extern void RecordUpdatedNiceLabel(mDNS *const m, mDNSs32 delay); 134 135 // Globals and functions defined in uds_daemon.c and also shared with the old "daemon.c" on OS X 136 137 extern mDNS mDNSStorage; 138 extern DNameListElem *AutoRegistrationDomains; 139 extern DNameListElem *AutoBrowseDomains; 140 141 extern mDNSs32 ChopSubTypes(char *regtype); 142 extern AuthRecord *AllocateSubTypes(mDNSs32 NumSubTypes, char *p); 143 extern int CountExistingRegistrations(domainname *srv, mDNSIPPort port); 144 extern void FreeExtraRR(mDNS *const m, AuthRecord *const rr, mStatus result); 145 extern int CountPeerRegistrations(mDNS *const m, ServiceRecordSet *const srs); 146 147 #if APPLE_OSX_mDNSResponder 148 extern void machserver_automatic_browse_domain_changed(const domainname *d, mDNSBool add); 149 extern void machserver_automatic_registration_domain_changed(const domainname *d, mDNSBool add); 150 #endif 151 152 extern const char mDNSResponderVersionString_SCCS[]; 153 #define mDNSResponderVersionString (mDNSResponderVersionString_SCCS+5) 154