]> git.saurik.com Git - apple/mdnsresponder.git/commitdiff
mDNSResponder-108.tar.gz mac-os-x-1044x86 mac-os-x-1045x86 mac-os-x-1046x86 mac-os-x-1047x86 v108
authorApple <opensource@apple.com>
Mon, 20 Feb 2006 21:40:37 +0000 (21:40 +0000)
committerApple <opensource@apple.com>
Mon, 20 Feb 2006 21:40:37 +0000 (21:40 +0000)
225 files changed:
APPLE_LICENSE [new file with mode: 0644]
Clients/BonjourExample/BonjourExample.cpp
Clients/BonjourExample/stdafx.cpp
Clients/BonjourExample/stdafx.h
Clients/DNSServiceBrowser.NET/AssemblyInfo.cs
Clients/DNSServiceBrowser.NET/DNSServiceBrowser.cs
Clients/DNSServiceBrowser.m
Clients/DNSServiceReg.m
Clients/ExplorerPlugin/ClassFactory.cpp
Clients/ExplorerPlugin/ClassFactory.h
Clients/ExplorerPlugin/ExplorerBar.cpp
Clients/ExplorerPlugin/ExplorerBar.h
Clients/ExplorerPlugin/ExplorerBarWindow.cpp
Clients/ExplorerPlugin/ExplorerBarWindow.h
Clients/ExplorerPlugin/ExplorerPlugin.cpp
Clients/ExplorerPlugin/ExplorerPlugin.def
Clients/ExplorerPlugin/ExplorerPlugin.h
Clients/ExplorerPlugin/LoginDialog.cpp
Clients/ExplorerPlugin/LoginDialog.h
Clients/ExplorerPlugin/Resource.h
Clients/ExplorerPlugin/StdAfx.cpp
Clients/ExplorerPlugin/StdAfx.h
Clients/Java/BrowserApp.java
Clients/Java/DNSSDUnitTest.java
Clients/Java/SimpleChat.java
Clients/Java/SwingBrowseListener.java
Clients/Java/SwingDomainListener.java
Clients/Java/SwingQueryListener.java
Clients/Java/SwingResolveListener.java
Clients/Java/nmakefile
Clients/Makefile
Clients/PrinterSetupWizard/FirstPage.cpp
Clients/PrinterSetupWizard/FirstPage.h
Clients/PrinterSetupWizard/FourthPage.cpp
Clients/PrinterSetupWizard/FourthPage.h
Clients/PrinterSetupWizard/PrinterSetupWizardApp.cpp
Clients/PrinterSetupWizard/PrinterSetupWizardApp.h
Clients/PrinterSetupWizard/PrinterSetupWizardSheet.cpp
Clients/PrinterSetupWizard/PrinterSetupWizardSheet.h
Clients/PrinterSetupWizard/SecondPage.cpp
Clients/PrinterSetupWizard/SecondPage.h
Clients/PrinterSetupWizard/ThirdPage.cpp
Clients/PrinterSetupWizard/ThirdPage.h
Clients/PrinterSetupWizard/UtilTypes.h
Clients/PrinterSetupWizard/resource.h
Clients/PrinterSetupWizard/stdafx.cpp
Clients/PrinterSetupWizard/stdafx.h
Clients/SimpleChat.NET/AssemblyInfo.cs
Clients/SimpleChat.NET/SimpleChat.cs
Clients/dns-sd.c
LICENSE [deleted file]
Makefile
mDNSCore/DNSCommon.c
mDNSCore/DNSCommon.h
mDNSCore/DNSDigest.c
mDNSCore/mDNS.c
mDNSCore/mDNSDebug.h
mDNSCore/mDNSEmbeddedAPI.h
mDNSCore/uDNS.c
mDNSCore/uDNS.h
mDNSMacOS9/CarbonResource.r
mDNSMacOS9/Mac OS Test Responder.c
mDNSMacOS9/Mac OS Test Searcher.c
mDNSMacOS9/Responder.c
mDNSMacOS9/Searcher.c
mDNSMacOS9/SubTypeTester.c
mDNSMacOS9/mDNSLibrary.c
mDNSMacOS9/mDNSLibraryLoader.c
mDNSMacOS9/mDNSLibraryResources.r
mDNSMacOS9/mDNSMacOS9.c
mDNSMacOS9/mDNSMacOS9.h
mDNSMacOS9/mDNSPrefix.h
mDNSMacOSX/DNSServiceDiscoveryDefines.h
mDNSMacOSX/DNSServiceDiscoveryReply.defs
mDNSMacOSX/DNSServiceDiscoveryRequest.defs
mDNSMacOSX/LegacyNATTraversal.c
mDNSMacOSX/PreferencePane/BonjourPref.icns
mDNSMacOSX/PreferencePane/ConfigurationRights.h
mDNSMacOSX/PreferencePane/DNSServiceDiscoveryPref.h
mDNSMacOSX/PreferencePane/DNSServiceDiscoveryPref.m
mDNSMacOSX/PreferencePane/English.lproj/InfoPlist.strings
mDNSMacOSX/PreferencePane/PrivilegedOperations.c
mDNSMacOSX/PreferencePane/PrivilegedOperations.h
mDNSMacOSX/PreferencePane/ddnswriteconfig.m
mDNSMacOSX/PreferencePane/installtool
mDNSMacOSX/SamplemDNSClient.c
mDNSMacOSX/daemon.c
mDNSMacOSX/mDNSMacOSX.c
mDNSMacOSX/mDNSMacOSX.h
mDNSMacOSX/mDNSMacOSXPuma.c
mDNSMacOSX/mDNSResponder.pbproj/project.pbxproj
mDNSPosix/Client.c
mDNSPosix/ExampleClientApp.c
mDNSPosix/ExampleClientApp.h
mDNSPosix/Identify.c
mDNSPosix/Makefile
mDNSPosix/NetMonitor.c
mDNSPosix/PosixDaemon.c
mDNSPosix/ProxyResponder.c
mDNSPosix/ReadMe.txt
mDNSPosix/Responder.c
mDNSPosix/dnsextd.c
mDNSPosix/mDNSPosix.c
mDNSPosix/mDNSPosix.h
mDNSPosix/mDNSUNP.c
mDNSPosix/mDNSUNP.h
mDNSPosix/mdnsd.sh
mDNSPosix/nss_mdns.c
mDNSPosix/nss_mdns.conf
mDNSPosix/parselog.py
mDNSShared/CommonServices.h [deleted file]
mDNSShared/DebugServices.c [deleted file]
mDNSShared/DebugServices.h [deleted file]
mDNSShared/GenLinkedList.c
mDNSShared/GenLinkedList.h
mDNSShared/Java/BaseListener.java
mDNSShared/Java/BrowseListener.java
mDNSShared/Java/DNSRecord.java
mDNSShared/Java/DNSSD.java
mDNSShared/Java/DNSSDException.java
mDNSShared/Java/DNSSDRecordRegistrar.java [deleted file]
mDNSShared/Java/DNSSDRegistration.java
mDNSShared/Java/DNSSDService.java
mDNSShared/Java/DomainListener.java
mDNSShared/Java/JNISupport.c
mDNSShared/Java/QueryListener.java
mDNSShared/Java/RegisterListener.java
mDNSShared/Java/RegisterRecordListener.java [deleted file]
mDNSShared/Java/ResolveListener.java
mDNSShared/Java/TXTRecord.java
mDNSShared/PlatformCommon.c
mDNSShared/PlatformCommon.h
mDNSShared/dns-sd.1
mDNSShared/dns_sd.h
mDNSShared/dnsextd.8
mDNSShared/dnsextd.c [deleted file]
mDNSShared/dnssd_clientlib.c
mDNSShared/dnssd_clientshim.c
mDNSShared/dnssd_clientstub.c
mDNSShared/dnssd_ipc.c
mDNSShared/dnssd_ipc.h
mDNSShared/mDNS.1
mDNSShared/mDNSDebug.c
mDNSShared/mDNSResponder.8
mDNSShared/uds_daemon.c
mDNSShared/uds_daemon.h
mDNSVxWorks/mDNSVxWorks.c
mDNSVxWorks/mDNSVxWorks.h
mDNSVxWorks/mDNSVxWorksIPv4Only.c
mDNSVxWorks/mDNSVxWorksIPv4Only.h
mDNSWindows/CommonServices.h
mDNSWindows/ControlPanel/ConfigDialog.cpp
mDNSWindows/ControlPanel/ConfigDialog.h
mDNSWindows/ControlPanel/ConfigPropertySheet.cpp
mDNSWindows/ControlPanel/ConfigPropertySheet.h
mDNSWindows/ControlPanel/ControlPanel.cpp
mDNSWindows/ControlPanel/ControlPanel.def
mDNSWindows/ControlPanel/ControlPanel.h
mDNSWindows/ControlPanel/FirstPage.cpp
mDNSWindows/ControlPanel/FirstPage.h
mDNSWindows/ControlPanel/SecondPage.cpp
mDNSWindows/ControlPanel/SecondPage.h
mDNSWindows/ControlPanel/SharedSecret.cpp
mDNSWindows/ControlPanel/SharedSecret.h
mDNSWindows/ControlPanel/ThirdPage.cpp
mDNSWindows/ControlPanel/ThirdPage.h
mDNSWindows/ControlPanel/stdafx.cpp
mDNSWindows/ControlPanel/stdafx.h
mDNSWindows/DLL.NET/AssemblyInfo.cpp
mDNSWindows/DLL.NET/PString.h
mDNSWindows/DLL.NET/Stdafx.cpp
mDNSWindows/DLL.NET/Stdafx.h
mDNSWindows/DLL.NET/dnssd_NET.cpp
mDNSWindows/DLL.NET/dnssd_NET.h
mDNSWindows/DLL/dllmain.c
mDNSWindows/DLL/dnssd.def
mDNSWindows/DNSServiceBrowser/Windows/Resources/Application.rc2
mDNSWindows/DNSServiceBrowser/Windows/Sources/AboutDialog.cpp
mDNSWindows/DNSServiceBrowser/Windows/Sources/AboutDialog.h
mDNSWindows/DNSServiceBrowser/Windows/Sources/Application.cpp
mDNSWindows/DNSServiceBrowser/Windows/Sources/Application.h
mDNSWindows/DNSServiceBrowser/Windows/Sources/ChooserDialog.cpp
mDNSWindows/DNSServiceBrowser/Windows/Sources/ChooserDialog.h
mDNSWindows/DNSServiceBrowser/Windows/Sources/LoginDialog.cpp
mDNSWindows/DNSServiceBrowser/Windows/Sources/LoginDialog.h
mDNSWindows/DNSServiceBrowser/Windows/Sources/StdAfx.cpp
mDNSWindows/DNSServiceBrowser/Windows/Sources/StdAfx.h
mDNSWindows/DNSServiceBrowser/WindowsCE/Sources/Application.cpp
mDNSWindows/DNSServiceBrowser/WindowsCE/Sources/Application.h
mDNSWindows/DNSServiceBrowser/WindowsCE/Sources/BrowserDialog.cpp
mDNSWindows/DNSServiceBrowser/WindowsCE/Sources/BrowserDialog.h
mDNSWindows/DNSServiceBrowser/WindowsCE/Sources/StdAfx.cpp
mDNSWindows/DNSServiceBrowser/WindowsCE/Sources/StdAfx.h
mDNSWindows/DNSServiceTest/Tool.c
mDNSWindows/DNSServiceTest/ToolPrefixWindows.h
mDNSWindows/DNSServiceTest/ToolPrefixWindowsDebug.h
mDNSWindows/DNSServices/DNSServiceDiscovery.c
mDNSWindows/DNSServices/DNSServiceDiscovery.h
mDNSWindows/DNSServices/DNSServices.c
mDNSWindows/DNSServices/DNSServices.h
mDNSWindows/DebugServices.c
mDNSWindows/DebugServices.h
mDNSWindows/Java/jdns_sd.rc
mDNSWindows/Java/makefile
mDNSWindows/NSPTool/NSPTool.c
mDNSWindows/NSPTool/Prefix.h
mDNSWindows/RegNames.h
mDNSWindows/SystemService/Firewall.cpp
mDNSWindows/SystemService/Firewall.h
mDNSWindows/SystemService/Prefix.h
mDNSWindows/SystemService/Service.c
mDNSWindows/VPCDetect.cpp
mDNSWindows/VPCDetect.h
mDNSWindows/WinServices.cpp
mDNSWindows/WinServices.h
mDNSWindows/WinVersRes.h
mDNSWindows/dDNS.c
mDNSWindows/dDNS.h
mDNSWindows/isocode.h
mDNSWindows/loclibrary.c
mDNSWindows/loclibrary.h
mDNSWindows/mDNSWin32.c
mDNSWindows/mDNSWin32.h
mDNSWindows/mdnsNSP/mdnsNSP.c
mDNSWindows/mdnsNSP/mdnsNSP.def

diff --git a/APPLE_LICENSE b/APPLE_LICENSE
new file mode 100644 (file)
index 0000000..fe81a60
--- /dev/null
@@ -0,0 +1,367 @@
+APPLE PUBLIC SOURCE LICENSE
+Version 2.0 - August 6, 2003
+
+Please read this License carefully before downloading this software.
+By downloading or using this software, you are agreeing to be bound by
+the terms of this License. If you do not or cannot agree to the terms
+of this License, please do not download or use the software.
+
+1. General; Definitions. This License applies to any program or other
+work which Apple Computer, Inc. ("Apple") makes publicly available and
+which contains a notice placed by Apple identifying such program or
+work as "Original Code" and stating that it is subject to the terms of
+this Apple Public Source License version 2.0 ("License"). As used in
+this License:
+
+1.1 "Applicable Patent Rights" mean: (a) in the case where Apple is
+the grantor of rights, (i) claims of patents that are now or hereafter
+acquired, owned by or assigned to Apple and (ii) that cover subject
+matter contained in the Original Code, but only to the extent
+necessary to use, reproduce and/or distribute the Original Code
+without infringement; and (b) in the case where You are the grantor of
+rights, (i) claims of patents that are now or hereafter acquired,
+owned by or assigned to You and (ii) that cover subject matter in Your
+Modifications, taken alone or in combination with Original Code.
+
+1.2 "Contributor" means any person or entity that creates or
+contributes to the creation of Modifications.
+
+1.3 "Covered Code" means the Original Code, Modifications, the
+combination of Original Code and any Modifications, and/or any
+respective portions thereof.
+
+1.4 "Externally Deploy" means: (a) to sublicense, distribute or
+otherwise make Covered Code available, directly or indirectly, to
+anyone other than You; and/or (b) to use Covered Code, alone or as
+part of a Larger Work, in any way to provide a service, including but
+not limited to delivery of content, through electronic communication
+with a client other than You.
+
+1.5 "Larger Work" means a work which combines Covered Code or portions
+thereof with code not governed by the terms of this License.
+
+1.6 "Modifications" mean any addition to, deletion from, and/or change
+to, the substance and/or structure of the Original Code, any previous
+Modifications, the combination of Original Code and any previous
+Modifications, and/or any respective portions thereof. When code is
+released as a series of files, a Modification is: (a) any addition to
+or deletion from the contents of a file containing Covered Code;
+and/or (b) any new file or other representation of computer program
+statements that contains any part of Covered Code.
+
+1.7 "Original Code" means (a) the Source Code of a program or other
+work as originally made available by Apple under this License,
+including the Source Code of any updates or upgrades to such programs
+or works made available by Apple under this License, and that has been
+expressly identified by Apple as such in the header file(s) of such
+work; and (b) the object code compiled from such Source Code and
+originally made available by Apple under this License.
+
+1.8 "Source Code" means the human readable form of a program or other
+work that is suitable for making modifications to it, including all
+modules it contains, plus any associated interface definition files,
+scripts used to control compilation and installation of an executable
+(object code).
+
+1.9 "You" or "Your" means an individual or a legal entity exercising
+rights under this License. For legal entities, "You" or "Your"
+includes any entity which controls, is controlled by, or is under
+common control with, You, where "control" means (a) the power, direct
+or indirect, to cause the direction or management of such entity,
+whether by contract or otherwise, or (b) ownership of fifty percent
+(50%) or more of the outstanding shares or beneficial ownership of
+such entity.
+
+2. Permitted Uses; Conditions & Restrictions. Subject to the terms
+and conditions of this License, Apple hereby grants You, effective on
+the date You accept this License and download the Original Code, a
+world-wide, royalty-free, non-exclusive license, to the extent of
+Apple's Applicable Patent Rights and copyrights covering the Original
+Code, to do the following:
+
+2.1 Unmodified Code. You may use, reproduce, display, perform,
+internally distribute within Your organization, and Externally Deploy
+verbatim, unmodified copies of the Original Code, for commercial or
+non-commercial purposes, provided that in each instance:
+
+(a) You must retain and reproduce in all copies of Original Code the
+copyright and other proprietary notices and disclaimers of Apple as
+they appear in the Original Code, and keep intact all notices in the
+Original Code that refer to this License; and
+
+(b) You must include a copy of this License with every copy of Source
+Code of Covered Code and documentation You distribute or Externally
+Deploy, and You may not offer or impose any terms on such Source Code
+that alter or restrict this License or the recipients' rights
+hereunder, except as permitted under Section 6.
+
+2.2 Modified Code. You may modify Covered Code and use, reproduce,
+display, perform, internally distribute within Your organization, and
+Externally Deploy Your Modifications and Covered Code, for commercial
+or non-commercial purposes, provided that in each instance You also
+meet all of these conditions:
+
+(a) You must satisfy all the conditions of Section 2.1 with respect to
+the Source Code of the Covered Code;
+
+(b) You must duplicate, to the extent it does not already exist, the
+notice in Exhibit A in each file of the Source Code of all Your
+Modifications, and cause the modified files to carry prominent notices
+stating that You changed the files and the date of any change; and
+
+(c) If You Externally Deploy Your Modifications, You must make
+Source Code of all Your Externally Deployed Modifications either
+available to those to whom You have Externally Deployed Your
+Modifications, or publicly available. Source Code of Your Externally
+Deployed Modifications must be released under the terms set forth in
+this License, including the license grants set forth in Section 3
+below, for as long as you Externally Deploy the Covered Code or twelve
+(12) months from the date of initial External Deployment, whichever is
+longer. You should preferably distribute the Source Code of Your
+Externally Deployed Modifications electronically (e.g. download from a
+web site).
+
+2.3 Distribution of Executable Versions. In addition, if You
+Externally Deploy Covered Code (Original Code and/or Modifications) in
+object code, executable form only, You must include a prominent
+notice, in the code itself as well as in related documentation,
+stating that Source Code of the Covered Code is available under the
+terms of this License with information on how and where to obtain such
+Source Code.
+
+2.4 Third Party Rights. You expressly acknowledge and agree that
+although Apple and each Contributor grants the licenses to their
+respective portions of the Covered Code set forth herein, no
+assurances are provided by Apple or any Contributor that the Covered
+Code does not infringe the patent or other intellectual property
+rights of any other entity. Apple and each Contributor disclaim any
+liability to You for claims brought by any other entity based on
+infringement of intellectual property rights or otherwise. As a
+condition to exercising the rights and licenses granted hereunder, You
+hereby assume sole responsibility to secure any other intellectual
+property rights needed, if any. For example, if a third party patent
+license is required to allow You to distribute the Covered Code, it is
+Your responsibility to acquire that license before distributing the
+Covered Code.
+
+3. Your Grants. In consideration of, and as a condition to, the
+licenses granted to You under this License, You hereby grant to any
+person or entity receiving or distributing Covered Code under this
+License a non-exclusive, royalty-free, perpetual, irrevocable license,
+under Your Applicable Patent Rights and other intellectual property
+rights (other than patent) owned or controlled by You, to use,
+reproduce, display, perform, modify, sublicense, distribute and
+Externally Deploy Your Modifications of the same scope and extent as
+Apple's licenses under Sections 2.1 and 2.2 above.
+
+4. Larger Works. You may create a Larger Work by combining Covered
+Code with other code not governed by the terms of this License and
+distribute the Larger Work as a single product. In each such instance,
+You must make sure the requirements of this License are fulfilled for
+the Covered Code or any portion thereof.
+
+5. Limitations on Patent License. Except as expressly stated in
+Section 2, no other patent rights, express or implied, are granted by
+Apple herein. Modifications and/or Larger Works may require additional
+patent licenses from Apple which Apple may grant in its sole
+discretion.
+
+6. Additional Terms. You may choose to offer, and to charge a fee for,
+warranty, support, indemnity or liability obligations and/or other
+rights consistent with the scope of the license granted herein
+("Additional Terms") to one or more recipients of Covered Code.
+However, You may do so only on Your own behalf and as Your sole
+responsibility, and not on behalf of Apple or any Contributor. You
+must obtain the recipient's agreement that any such Additional Terms
+are offered by You alone, and You hereby agree to indemnify, defend
+and hold Apple and every Contributor harmless for any liability
+incurred by or claims asserted against Apple or such Contributor by
+reason of any such Additional Terms.
+
+7. Versions of the License. Apple may publish revised and/or new
+versions of this License from time to time. Each version will be given
+a distinguishing version number. Once Original Code has been published
+under a particular version of this License, You may continue to use it
+under the terms of that version. You may also choose to use such
+Original Code under the terms of any subsequent version of this
+License published by Apple. No one other than Apple has the right to
+modify the terms applicable to Covered Code created under this
+License.
+
+8. NO WARRANTY OR SUPPORT. The Covered Code may contain in whole or in
+part pre-release, untested, or not fully tested works. The Covered
+Code may contain errors that could cause failures or loss of data, and
+may be incomplete or contain inaccuracies. You expressly acknowledge
+and agree that use of the Covered Code, or any portion thereof, is at
+Your sole and entire risk. THE COVERED CODE IS PROVIDED "AS IS" AND
+WITHOUT WARRANTY, UPGRADES OR SUPPORT OF ANY KIND AND APPLE AND
+APPLE'S LICENSOR(S) (COLLECTIVELY REFERRED TO AS "APPLE" FOR THE
+PURPOSES OF SECTIONS 8 AND 9) AND ALL CONTRIBUTORS EXPRESSLY DISCLAIM
+ALL WARRANTIES AND/OR CONDITIONS, EXPRESS OR IMPLIED, INCLUDING, BUT
+NOT LIMITED TO, THE IMPLIED WARRANTIES AND/OR CONDITIONS OF
+MERCHANTABILITY, OF SATISFACTORY QUALITY, OF FITNESS FOR A PARTICULAR
+PURPOSE, OF ACCURACY, OF QUIET ENJOYMENT, AND NONINFRINGEMENT OF THIRD
+PARTY RIGHTS. APPLE AND EACH CONTRIBUTOR DOES NOT WARRANT AGAINST
+INTERFERENCE WITH YOUR ENJOYMENT OF THE COVERED CODE, THAT THE
+FUNCTIONS CONTAINED IN THE COVERED CODE WILL MEET YOUR REQUIREMENTS,
+THAT THE OPERATION OF THE COVERED CODE WILL BE UNINTERRUPTED OR
+ERROR-FREE, OR THAT DEFECTS IN THE COVERED CODE WILL BE CORRECTED. NO
+ORAL OR WRITTEN INFORMATION OR ADVICE GIVEN BY APPLE, AN APPLE
+AUTHORIZED REPRESENTATIVE OR ANY CONTRIBUTOR SHALL CREATE A WARRANTY.
+You acknowledge that the Covered Code is not intended for use in the
+operation of nuclear facilities, aircraft navigation, communication
+systems, or air traffic control machines in which case the failure of
+the Covered Code could lead to death, personal injury, or severe
+physical or environmental damage.
+
+9. LIMITATION OF LIABILITY. TO THE EXTENT NOT PROHIBITED BY LAW, IN NO
+EVENT SHALL APPLE OR ANY CONTRIBUTOR BE LIABLE FOR ANY INCIDENTAL,
+SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES ARISING OUT OF OR RELATING
+TO THIS LICENSE OR YOUR USE OR INABILITY TO USE THE COVERED CODE, OR
+ANY PORTION THEREOF, WHETHER UNDER A THEORY OF CONTRACT, WARRANTY,
+TORT (INCLUDING NEGLIGENCE), PRODUCTS LIABILITY OR OTHERWISE, EVEN IF
+APPLE OR SUCH CONTRIBUTOR HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+DAMAGES AND NOTWITHSTANDING THE FAILURE OF ESSENTIAL PURPOSE OF ANY
+REMEDY. SOME JURISDICTIONS DO NOT ALLOW THE LIMITATION OF LIABILITY OF
+INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THIS LIMITATION MAY NOT APPLY
+TO YOU. In no event shall Apple's total liability to You for all
+damages (other than as may be required by applicable law) under this
+License exceed the amount of fifty dollars ($50.00).
+
+10. Trademarks. This License does not grant any rights to use the
+trademarks or trade names "Apple", "Apple Computer", "Mac", "Mac OS",
+"QuickTime", "QuickTime Streaming Server" or any other trademarks,
+service marks, logos or trade names belonging to Apple (collectively
+"Apple Marks") or to any trademark, service mark, logo or trade name
+belonging to any Contributor. You agree not to use any Apple Marks in
+or as part of the name of products derived from the Original Code or
+to endorse or promote products derived from the Original Code other
+than as expressly permitted by and in strict compliance at all times
+with Apple's third party trademark usage guidelines which are posted
+at http://www.apple.com/legal/guidelinesfor3rdparties.html.
+
+11. Ownership. Subject to the licenses granted under this License,
+each Contributor retains all rights, title and interest in and to any
+Modifications made by such Contributor. Apple retains all rights,
+title and interest in and to the Original Code and any Modifications
+made by or on behalf of Apple ("Apple Modifications"), and such Apple
+Modifications will not be automatically subject to this License. Apple
+may, at its sole discretion, choose to license such Apple
+Modifications under this License, or on different terms from those
+contained in this License or may choose not to license them at all.
+
+12. Termination.
+
+12.1 Termination. This License and the rights granted hereunder will
+terminate:
+
+(a) automatically without notice from Apple if You fail to comply with
+any term(s) of this License and fail to cure such breach within 30
+days of becoming aware of such breach;
+
+(b) immediately in the event of the circumstances described in Section
+13.5(b); or
+
+(c) automatically without notice from Apple if You, at any time during
+the term of this License, commence an action for patent infringement
+against Apple; provided that Apple did not first commence
+an action for patent infringement against You in that instance.
+
+12.2 Effect of Termination. Upon termination, You agree to immediately
+stop any further use, reproduction, modification, sublicensing and
+distribution of the Covered Code. All sublicenses to the Covered Code
+which have been properly granted prior to termination shall survive
+any termination of this License. Provisions which, by their nature,
+should remain in effect beyond the termination of this License shall
+survive, including but not limited to Sections 3, 5, 8, 9, 10, 11,
+12.2 and 13. No party will be liable to any other for compensation,
+indemnity or damages of any sort solely as a result of terminating
+this License in accordance with its terms, and termination of this
+License will be without prejudice to any other right or remedy of
+any party.
+
+13. Miscellaneous.
+
+13.1 Government End Users. The Covered Code is a "commercial item" as
+defined in FAR 2.101. Government software and technical data rights in
+the Covered Code include only those rights customarily provided to the
+public as defined in this License. This customary commercial license
+in technical data and software is provided in accordance with FAR
+12.211 (Technical Data) and 12.212 (Computer Software) and, for
+Department of Defense purchases, DFAR 252.227-7015 (Technical Data --
+Commercial Items) and 227.7202-3 (Rights in Commercial Computer
+Software or Computer Software Documentation). Accordingly, all U.S.
+Government End Users acquire Covered Code with only those rights set
+forth herein.
+
+13.2 Relationship of Parties. This License will not be construed as
+creating an agency, partnership, joint venture or any other form of
+legal association between or among You, Apple or any Contributor, and
+You will not represent to the contrary, whether expressly, by
+implication, appearance or otherwise.
+
+13.3 Independent Development. Nothing in this License will impair
+Apple's right to acquire, license, develop, have others develop for
+it, market and/or distribute technology or products that perform the
+same or similar functions as, or otherwise compete with,
+Modifications, Larger Works, technology or products that You may
+develop, produce, market or distribute.
+
+13.4 Waiver; Construction. Failure by Apple or any Contributor to
+enforce any provision of this License will not be deemed a waiver of
+future enforcement of that or any other provision. Any law or
+regulation which provides that the language of a contract shall be
+construed against the drafter will not apply to this License.
+
+13.5 Severability. (a) If for any reason a court of competent
+jurisdiction finds any provision of this License, or portion thereof,
+to be unenforceable, that provision of the License will be enforced to
+the maximum extent permissible so as to effect the economic benefits
+and intent of the parties, and the remainder of this License will
+continue in full force and effect. (b) Notwithstanding the foregoing,
+if applicable law prohibits or restricts You from fully and/or
+specifically complying with Sections 2 and/or 3 or prevents the
+enforceability of either of those Sections, this License will
+immediately terminate and You must immediately discontinue any use of
+the Covered Code and destroy all copies of it that are in your
+possession or control.
+
+13.6 Dispute Resolution. Any litigation or other dispute resolution
+between You and Apple relating to this License shall take place in the
+Northern District of California, and You and Apple hereby consent to
+the personal jurisdiction of, and venue in, the state and federal
+courts within that District with respect to this License. The
+application of the United Nations Convention on Contracts for the
+International Sale of Goods is expressly excluded.
+
+13.7 Entire Agreement; Governing Law. This License constitutes the
+entire agreement between the parties with respect to the subject
+matter hereof. This License shall be governed by the laws of the
+United States and the State of California, except that body of
+California law concerning conflicts of law.
+
+Where You are located in the province of Quebec, Canada, the following
+clause applies: The parties hereby confirm that they have requested
+that this License and all related documents be drafted in English. Les
+parties ont exige que le present contrat et tous les documents
+connexes soient rediges en anglais.
+
+EXHIBIT A.
+
+"Portions Copyright (c) 1999-2003 Apple Computer, Inc. All Rights
+Reserved.
+
+This file contains Original Code and/or Modifications of Original Code
+as defined in and that are subject to the Apple Public Source License
+Version 2.0 (the 'License'). You may not use this file except in
+compliance with the License. Please obtain a copy of the License at
+http://www.opensource.apple.com/apsl/ and read it before using this
+file.
+
+The Original Code and all software distributed under the License are
+distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+Please see the License for the specific language governing rights and
+limitations under the License."
index ff50a3981b2ac492e25d036c3a950838a68d7cde..ec448f49fba0173e6b0a9eb1fc05823957a27166 100644 (file)
@@ -1,25 +1,28 @@
-/* -*- Mode: C; tab-width: 4 -*-
- *
+/*
  * Copyright (c) 2005 Apple Computer, Inc. All rights reserved.
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * @APPLE_LICENSE_HEADER_START@
  * 
- *     http://www.apache.org/licenses/LICENSE-2.0
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
  * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
  * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
 
     Change History (most recent first):
 
 $Log: BonjourExample.cpp,v $
-Revision 1.2  2006/08/14 23:23:57  cheshire
-Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
-
 Revision 1.1  2005/05/20 22:01:01  bradley
 Bonjour for Windows example code to browse for HTTP services and deliver via Window messages.
 
index c6899cd105fbf5f750c8f2eaba950b0894d10ee3..2b2483e08b117288a55cd9e9528a3de9f2a3f6a6 100644 (file)
@@ -1,25 +1,28 @@
-/* -*- Mode: C; tab-width: 4 -*-
- *
+/*
  * Copyright (c) 2005 Apple Computer, Inc. All rights reserved.
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * @APPLE_LICENSE_HEADER_START@
  * 
- *     http://www.apache.org/licenses/LICENSE-2.0
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
  * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
  * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
 
     Change History (most recent first):
 
 $Log: stdafx.cpp,v $
-Revision 1.2  2006/08/14 23:23:57  cheshire
-Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
-
 Revision 1.1  2005/05/20 22:01:02  bradley
 Bonjour for Windows example code to browse for HTTP services and deliver via Window messages.
 
index 461d1193a9c8a898ff7191ffdf30b3f2ae718a6b..6ded04030fccf0819d7518c695fc635c4f06c820 100644 (file)
@@ -1,25 +1,28 @@
-/* -*- Mode: C; tab-width: 4 -*-
- *
+/*
  * Copyright (c) 2005 Apple Computer, Inc. All rights reserved.
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * @APPLE_LICENSE_HEADER_START@
  * 
- *     http://www.apache.org/licenses/LICENSE-2.0
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
  * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
  * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
 
     Change History (most recent first):
 
 $Log: stdafx.h,v $
-Revision 1.2  2006/08/14 23:23:57  cheshire
-Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
-
 Revision 1.1  2005/05/20 22:01:02  bradley
 Bonjour for Windows example code to browse for HTTP services and deliver via Window messages.
 
index 588f438d4c5fe8659711d865eea603e51bf5bacc..793362b985ab9cc56cafdabce1403299fc813813 100755 (executable)
@@ -1,25 +1,28 @@
-/* -*- Mode: C; tab-width: 4 -*-\r
- *\r
+/*\r
  * Copyright (c) 1997-2004 Apple Computer, Inc. All rights reserved.\r
  *\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
+ * @APPLE_LICENSE_HEADER_START@\r
  * \r
- *     http://www.apache.org/licenses/LICENSE-2.0\r
+ * This file contains Original Code and/or Modifications of Original Code\r
+ * as defined in and that are subject to the Apple Public Source License\r
+ * Version 2.0 (the 'License'). You may not use this file except in\r
+ * compliance with the License. Please obtain a copy of the License at\r
+ * http://www.opensource.apple.com/apsl/ and read it before using this\r
+ * file.\r
  * \r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
+ * The Original Code and all software distributed under the License are\r
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER\r
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,\r
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,\r
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.\r
+ * Please see the License for the specific language governing rights and\r
  * limitations under the License.\r
+ * \r
+ * @APPLE_LICENSE_HEADER_END@\r
 \r
     Change History (most recent first):\r
     \r
 $Log: AssemblyInfo.cs,v $
-Revision 1.2  2006/08/14 23:23:58  cheshire
-Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
-
 Revision 1.1  2004/07/19 07:54:24  shersche
 Initial revision
 \r
index e279d184b21131d4afd52a9454f2e1ad40bb9309..f2cf813fb5fd91b9b4f19b0900eb5b64ac3e4490 100755 (executable)
@@ -1,25 +1,28 @@
-/* -*- Mode: C; tab-width: 4 -*-
- *
+/*
  * Copyright (c) 1997-2004 Apple Computer, Inc. All rights reserved.
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * @APPLE_LICENSE_HEADER_START@
  * 
- *     http://www.apache.org/licenses/LICENSE-2.0
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
  * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
  * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
 
     Change History (most recent first):
     
 $Log: DNSServiceBrowser.cs,v $
-Revision 1.7  2006/08/14 23:23:58  cheshire
-Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
-
 Revision 1.6  2005/02/10 22:35:06  cheshire
 <rdar://problem/3727944> Update name
 
index 2394a6aa9c5b363f0258331a41e08f81393f4fcc..da427802b04539fa1cf4807622c6a3a95765db51 100755 (executable)
@@ -1,25 +1,28 @@
-/* -*- Mode: C; tab-width: 4 -*-
- *
+/*
  * Copyright (c) 2002-2003 Apple Computer, Inc. All rights reserved.
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * @APPLE_LICENSE_HEADER_START@
  * 
- *     http://www.apache.org/licenses/LICENSE-2.0
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
  * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
  * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
 
     Change History (most recent first):
 
 $Log: DNSServiceBrowser.m,v $
-Revision 1.31  2006/08/14 23:23:55  cheshire
-Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
-
 Revision 1.30  2005/01/27 17:46:16  cheshire
 Added comment
 
index 49e0c36ddb942a2667dc70e9baf7b1279fed6cc4..c4a3ee777b442a4e4e7f4c40bf2f79902ad4cac9 100644 (file)
@@ -1,25 +1,28 @@
-/* -*- Mode: C; tab-width: 4 -*-
- *
+/*
  * Copyright (c) 2002-2003 Apple Computer, Inc. All rights reserved.
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * @APPLE_LICENSE_HEADER_START@
  * 
- *     http://www.apache.org/licenses/LICENSE-2.0
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
  * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
  * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
 
     Change History (most recent first):
 
 $Log: DNSServiceReg.m,v $
-Revision 1.16  2006/08/14 23:23:55  cheshire
-Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
-
 Revision 1.15  2004/06/05 02:01:08  cheshire
 Move DNSServiceRegistration from mDNSMacOSX directory to Clients directory
 
index f77e1826a2cbc583487ecc0ce6542dbe54f72087..b4e06c6180b5303f7bd7e2649144e9af7a20953b 100644 (file)
@@ -1,25 +1,28 @@
-/* -*- Mode: C; tab-width: 4 -*-
- *
+/*
  * Copyright (c) 2003-2004 Apple Computer, Inc. All rights reserved.
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * @APPLE_LICENSE_HEADER_START@
  * 
- *     http://www.apache.org/licenses/LICENSE-2.0
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
  * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
  * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
 
     Change History (most recent first):
     
 $Log: ClassFactory.cpp,v $
-Revision 1.3  2006/08/14 23:24:00  cheshire
-Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
-
 Revision 1.2  2004/07/13 21:24:21  rpantos
 Fix for <rdar://problem/3701120>.
 
index f5fe9d59c148df1dcff33cddb50c37a403d3d70c..76e4b5ed8a4cfedda5a21d1a434de9a681173318 100644 (file)
@@ -1,25 +1,28 @@
-/* -*- Mode: C; tab-width: 4 -*-
- *
+/*
  * Copyright (c) 2003-2004 Apple Computer, Inc. All rights reserved.
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * @APPLE_LICENSE_HEADER_START@
  * 
- *     http://www.apache.org/licenses/LICENSE-2.0
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
  * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
  * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
 
     Change History (most recent first):
     
 $Log: ClassFactory.h,v $
-Revision 1.3  2006/08/14 23:24:00  cheshire
-Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
-
 Revision 1.2  2004/07/13 21:24:21  rpantos
 Fix for <rdar://problem/3701120>.
 
index f09d9833492ca27bf8ff2f08e0b41a18115dbfe1..1c71c9bc59c9e4cd31eebab8b970bd97e0744628 100644 (file)
@@ -1,25 +1,28 @@
-/* -*- Mode: C; tab-width: 4 -*-
- *
+/*
  * Copyright (c) 2003-2004 Apple Computer, Inc. All rights reserved.
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * @APPLE_LICENSE_HEADER_START@
  * 
- *     http://www.apache.org/licenses/LICENSE-2.0
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
  * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
  * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
 
     Change History (most recent first):
     
 $Log: ExplorerBar.cpp,v $
-Revision 1.4  2006/08/14 23:24:00  cheshire
-Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
-
 Revision 1.3  2004/07/26 05:44:08  shersche
 remove extraneous debug statement
 
index 5af86eb08646a2862fab43c1e1cd539170a4ef75..fe58176f081b5494e12d76ae9c013270400671d3 100644 (file)
@@ -1,25 +1,28 @@
-/* -*- Mode: C; tab-width: 4 -*-
- *
+/*
  * Copyright (c) 2003-2004 Apple Computer, Inc. All rights reserved.
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * @APPLE_LICENSE_HEADER_START@
  * 
- *     http://www.apache.org/licenses/LICENSE-2.0
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
  * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
  * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
 
     Change History (most recent first):
     
 $Log: ExplorerBar.h,v $
-Revision 1.3  2006/08/14 23:24:00  cheshire
-Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
-
 Revision 1.2  2004/07/13 21:24:21  rpantos
 Fix for <rdar://problem/3701120>.
 
index 88f4858f86ad220c03660ec29ce065a309eef52b..d4ea5c1d6849c8b6a3465f7d7f2b74ca7e151170 100644 (file)
@@ -1,25 +1,28 @@
-/* -*- Mode: C; tab-width: 4 -*-
- *
+/*
  * Copyright (c) 2003-2004 Apple Computer, Inc. All rights reserved.
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * @APPLE_LICENSE_HEADER_START@
  * 
- *     http://www.apache.org/licenses/LICENSE-2.0
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
  * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
  * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
 
     Change History (most recent first):
     
 $Log: ExplorerBarWindow.cpp,v $
-Revision 1.22  2006/08/14 23:24:00  cheshire
-Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
-
 Revision 1.21  2005/04/06 01:13:07  shersche
 <rdar://problem/4066195> Use the product icon instead of globe icon for 'About' link.
 
index f035872d880c63b52b7a45a53cd77113e5008004..deade955257ee9b59c47938ee6faba7aeff62bef 100644 (file)
@@ -1,25 +1,28 @@
-/* -*- Mode: C; tab-width: 4 -*-
- *
+/*
  * Copyright (c) 2003-2004 Apple Computer, Inc. All rights reserved.
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * @APPLE_LICENSE_HEADER_START@
  * 
- *     http://www.apache.org/licenses/LICENSE-2.0
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
  * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
  * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
 
     Change History (most recent first):
     
 $Log: ExplorerBarWindow.h,v $
-Revision 1.8  2006/08/14 23:24:00  cheshire
-Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
-
 Revision 1.7  2005/02/25 19:57:30  shersche
 <rdar://problem/4023323> Remove FTP browsing from plugin
 
index c2c661b0a849f8ec8db36c68713d8858430d5eed..34b981e687175033607784a7f66711b4ba6ecbcb 100644 (file)
@@ -1,25 +1,28 @@
-/* -*- Mode: C; tab-width: 4 -*-
- *
+/*
  * Copyright (c) 2003-2004 Apple Computer, Inc. All rights reserved.
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * @APPLE_LICENSE_HEADER_START@
  * 
- *     http://www.apache.org/licenses/LICENSE-2.0
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
  * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
  * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
 
     Change History (most recent first):
     
 $Log: ExplorerPlugin.cpp,v $
-Revision 1.9  2006/08/14 23:24:00  cheshire
-Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
-
 Revision 1.8  2005/06/30 18:01:54  shersche
 <rdar://problem/4130635> Cause IE to rebuild cache so we don't have to reboot following an install.
 
index acef773ff9b3443c6cf5201908506700f8b42e91..e82518052ecb1fd3670b4980e9eb7b17ac104cd3 100644 (file)
@@ -1,25 +1,28 @@
 ;
-;
 ; Copyright (c) 2003-2004 Apple Computer, Inc. All rights reserved.
 ;
-; Licensed under the Apache License, Version 2.0 (the "License");
-; you may not use this file except in compliance with the License.
-; You may obtain a copy of the License at
+; @APPLE_LICENSE_HEADER_START@
 ; 
-;     http://www.apache.org/licenses/LICENSE-2.0
+; This file contains Original Code and/or Modifications of Original Code
+; as defined in and that are subject to the Apple Public Source License
+; Version 2.0 (the 'License'). You may not use this file except in
+; compliance with the License. Please obtain a copy of the License at
+; http://www.opensource.apple.com/apsl/ and read it before using this
+; file.
 ; 
-; Unless required by applicable law or agreed to in writing, software
-; distributed under the License is distributed on an "AS IS" BASIS,
-; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-; See the License for the specific language governing permissions and
+; The Original Code and all software distributed under the License are
+; distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+; EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+; INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+; FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+; Please see the License for the specific language governing rights and
 ; limitations under the License.
+; 
+; @APPLE_LICENSE_HEADER_END@
 ;
 ;      Change History (most recent first):
 ;    
 ; $Log: ExplorerPlugin.def,v $
-; Revision 1.3  2006/08/14 23:24:00  cheshire
-; Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
-;
 ; Revision 1.2  2004/07/13 21:24:21  rpantos
 ; Fix for <rdar://problem/3701120>.
 ;
index d14edd3fb66fa7d06133a000c5146b64faff7c30..40a709a51315b4e8a41dfd13bfc452b05cfcd116 100644 (file)
@@ -1,25 +1,28 @@
-/* -*- Mode: C; tab-width: 4 -*-
- *
+/*
  * Copyright (c) 2003-2004 Apple Computer, Inc. All rights reserved.
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * @APPLE_LICENSE_HEADER_START@
  * 
- *     http://www.apache.org/licenses/LICENSE-2.0
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
  * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
  * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
 
     Change History (most recent first):
     
 $Log: ExplorerPlugin.h,v $
-Revision 1.4  2006/08/14 23:24:00  cheshire
-Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
-
 Revision 1.3  2005/01/25 18:35:38  shersche
 Declare APIs for obtaining handles to resource modules
 
index c2afe223d4014d67e90fa07fc9cd8991e97c7b6c..ccee81c153e7706e56345f35a381da93a34d9a54 100644 (file)
@@ -1,25 +1,28 @@
-/* -*- Mode: C; tab-width: 4 -*-
- *
+/*
  * Copyright (c) 2003-2004 Apple Computer, Inc. All rights reserved.
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * @APPLE_LICENSE_HEADER_START@
  * 
- *     http://www.apache.org/licenses/LICENSE-2.0
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
  * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
  * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
 
     Change History (most recent first):
     
 $Log: LoginDialog.cpp,v $
-Revision 1.3  2006/08/14 23:24:00  cheshire
-Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
-
 Revision 1.2  2004/07/13 21:24:21  rpantos
 Fix for <rdar://problem/3701120>.
 
index 0f7bee6725315d90b0749fff4dbef0a7bf55e92b..a89c3a6eb72d939005de715177d789dfa63bc73a 100644 (file)
@@ -1,25 +1,28 @@
-/* -*- Mode: C; tab-width: 4 -*-
- *
+/*
  * Copyright (c) 2003-2004 Apple Computer, Inc. All rights reserved.
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * @APPLE_LICENSE_HEADER_START@
  * 
- *     http://www.apache.org/licenses/LICENSE-2.0
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
  * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
  * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
 
     Change History (most recent first):
     
 $Log: LoginDialog.h,v $
-Revision 1.3  2006/08/14 23:24:00  cheshire
-Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
-
 Revision 1.2  2004/07/13 21:24:21  rpantos
 Fix for <rdar://problem/3701120>.
 
index 9b1f0abe49bc84a423a0f1212567b0769891c957..e6a7b320cab093509e0401cb6c6e5a900a770d83 100644 (file)
@@ -1,18 +1,24 @@
-/* -*- Mode: C; tab-width: 4 -*-
- *
+/*
  * Copyright (c) 2003-2004 Apple Computer, Inc. All rights reserved.
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * @APPLE_LICENSE_HEADER_START@
  * 
- *     http://www.apache.org/licenses/LICENSE-2.0
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
  * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
  * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
 
     Change History (most recent first):
     
index 1d644951dc0988733c544bdfcb3f925b29f62843..b97d8648f695dcf2ef62076be07cf232feeb4f2b 100644 (file)
@@ -1,25 +1,28 @@
-/* -*- Mode: C; tab-width: 4 -*-
- *
+/*
  * Copyright (c) 2003-2004 Apple Computer, Inc. All rights reserved.
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * @APPLE_LICENSE_HEADER_START@
  * 
- *     http://www.apache.org/licenses/LICENSE-2.0
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
  * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
  * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
 
     Change History (most recent first):
     
 $Log: StdAfx.cpp,v $
-Revision 1.3  2006/08/14 23:24:00  cheshire
-Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
-
 Revision 1.2  2004/07/13 21:24:21  rpantos
 Fix for <rdar://problem/3701120>.
 
index 7976129032d14d1a6c5765adb07abc311dbba9c8..407ff3c0a11a390d5a0f81dc00b329103a31cf2a 100644 (file)
@@ -1,25 +1,28 @@
-/* -*- Mode: C; tab-width: 4 -*-
- *
+/*
  * Copyright (c) 2003-2004 Apple Computer, Inc. All rights reserved.
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * @APPLE_LICENSE_HEADER_START@
  * 
- *     http://www.apache.org/licenses/LICENSE-2.0
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
  * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
  * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
 
     Change History (most recent first):
     
 $Log: StdAfx.h,v $
-Revision 1.4  2006/08/14 23:24:00  cheshire
-Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
-
 Revision 1.3  2005/10/19 19:50:34  herscher
 Workaround a bug in the latest Microsoft Platform SDK when compiling C++ files that include (directly or indirectly) <WspiApi.h>
 
index cbdd200713b7ef22808025840e82a712054eaddb..0b55fa5d2b936949ae4f139c44192fcf80e95610 100644 (file)
@@ -1,5 +1,4 @@
-/* -*- Mode: Java; tab-width: 4 -*-
- *
+/*
  * Copyright (c) 2004 Apple Computer, Inc. All rights reserved.
  *
  * Disclaimer: IMPORTANT:  This Apple software is supplied to you by Apple Computer, Inc.
index 121ff61acf035cd180388f13b7920743e4ba13e1..786cab739f20f3b1e709bb88bf53f31dc3b88159 100644 (file)
@@ -1,28 +1,28 @@
-/* -*- Mode: Java; tab-width: 4 -*-
- *
+/*
  * Copyright (c) 2004 Apple Computer, Inc. All rights reserved.
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * @APPLE_LICENSE_HEADER_START@
  * 
- *     http://www.apache.org/licenses/LICENSE-2.0
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
  * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
  * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
 
     Change History (most recent first):
 
 $Log: DNSSDUnitTest.java,v $
-Revision 1.6  2006/08/14 23:24:07  cheshire
-Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
-
-Revision 1.5  2006/06/20 23:01:58  rpantos
-<rdar://problem/3839132> Java needs to implement DNSServiceRegisterRecord equivalent
-
 Revision 1.4  2004/08/04 01:07:43  rpantos
 Update unit test for <rdar://problems/3731579&3731582>.
 
@@ -107,7 +107,6 @@ class       DNSSDUnitTest
                fRegTest = new RegTest();
                new BrowseTest();
                new DomainTest();
-               new RegistrarTest();
                
                this.waitForEnd();
        }
@@ -326,30 +325,3 @@ class      QueryTest extends TermReporter implements QueryListener
        }
 }
 
-class  RegistrarTest extends TermReporter implements RegisterRecordListener
-{
-       public          RegistrarTest()
-       {
-               try {
-                       byte[]  kResponsiblePerson = { 'g','r','o','v','e','r' };
-                       fRegistrar = DNSSD.createRecordRegistrar( this);
-                       fRegistrar.registerRecord( DNSSD.UNIQUE, 0,
-                                       "test.registrartest.local", 17 /*ns_t_rp*/, 1, kResponsiblePerson, 3600);
-               } catch( Exception e) { e.printStackTrace(); }
-       }
-
-       public void     recordRegistered( DNSRecord record, int flags)
-       {
-               String s = "RegistrarTest result flags:" + String.valueOf( flags);
-               System.out.println( s);
-
-               try {
-                       byte[]  kResponsiblePerson = { 'e','l','m','o' };
-                       record.update( 0, kResponsiblePerson, 3600);
-                       record.remove();
-               } catch( Exception e) { e.printStackTrace(); }
-       }
-
-       protected DNSSDRecordRegistrar  fRegistrar;
-}
-
index a1fee5c018ead48351b4e9ee94d53bf6a9d3e8e1..745b9a0dfe4b17389cb6ca89df03300ee87cee67 100644 (file)
@@ -1,5 +1,4 @@
-/* -*- Mode: Java; tab-width: 4 -*-
- *
+/*
  * Copyright (c) 2004 Apple Computer, Inc. All rights reserved.
  *
  * Disclaimer: IMPORTANT:  This Apple software is supplied to you by Apple Computer, Inc.
index db971b2b43326c5b4cd7a8ce4504c7d59d23ad99..78bfe4f4b9c1e60940c71dc710deb0403668e3c6 100644 (file)
@@ -1,5 +1,4 @@
-/* -*- Mode: Java; tab-width: 4 -*-
- *
+/*
  * Copyright (c) 2004 Apple Computer, Inc. All rights reserved.
  *
  * Disclaimer: IMPORTANT:  This Apple software is supplied to you by Apple Computer, Inc.
index b67313b7bca37dcefccea5932d96b3b8a93c45a2..c6c380b9c4278865f14d0ac4197fb9bf0d2b0e7a 100644 (file)
@@ -1,5 +1,4 @@
-/* -*- Mode: Java; tab-width: 4 -*-
- *
+/*
  * Copyright (c) 2004 Apple Computer, Inc. All rights reserved.
  *
  * Disclaimer: IMPORTANT:  This Apple software is supplied to you by Apple Computer, Inc.
index fcac75b832d47205800fd139032745a46d4f0d64..5f2de1d2d334a86b62c43b88cdfce4ff66d483b5 100644 (file)
@@ -1,5 +1,4 @@
-/* -*- Mode: Java; tab-width: 4 -*-
- *
+/*
  * Copyright (c) 2004 Apple Computer, Inc. All rights reserved.
  *
  * Disclaimer: IMPORTANT:  This Apple software is supplied to you by Apple Computer, Inc.
index 19c17996f81cacea33a0cda63577bf290db66d22..f2be4b0255a2f2960408895cea1a53cffb967c05 100644 (file)
@@ -1,5 +1,4 @@
-/* -*- Mode: Java; tab-width: 4 -*-
- *
+/*
  * Copyright (c) 2004 Apple Computer, Inc. All rights reserved.
  *
  * Disclaimer: IMPORTANT:  This Apple software is supplied to you by Apple Computer, Inc.
index 9b08ccbba0bd159dd30d0fdd08167dd52b55cba2..4c016332c926e5eb3ed764af990655e7c54df527 100644 (file)
@@ -1,18 +1,24 @@
-# -*- tab-width: 4 -*-
-#
 # Copyright (c) 2002-2004 Apple Computer, Inc. All rights reserved.
 #
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
+# @APPLE_LICENSE_HEADER_START@
 # 
-#     http://www.apache.org/licenses/LICENSE-2.0
+# This file contains Original Code and/or Modifications of Original Code
+# as defined in and that are subject to the Apple Public Source License
+# Version 2.0 (the 'License'). You may not use this file except in
+# compliance with the License. Please obtain a copy of the License at
+# http://www.opensource.apple.com/apsl/ and read it before using this
+# file.
 # 
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
+# The Original Code and all software distributed under the License are
+# distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+# EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+# INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+# Please see the License for the specific language governing rights and
 # limitations under the License.
+# 
+# @APPLE_LICENSE_HEADER_END@
+#
 #
 # This Makefile builds .jar files for the DNS-SD Java sample apps.
 # You must have the Java support installed.
index c6c2ed2ee3d4bb961262ad560632d7fe0fad5422..709bd2b922ae9deb959b4d987832ba9b4aa526e0 100755 (executable)
@@ -1,26 +1,25 @@
-# -*- tab-width: 4 -*-
-#
 # Copyright (c) 2002-2004 Apple Computer, Inc. All rights reserved.
 #
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
+# @APPLE_LICENSE_HEADER_START@
 # 
-#     http://www.apache.org/licenses/LICENSE-2.0
+# This file contains Original Code and/or Modifications of Original Code
+# as defined in and that are subject to the Apple Public Source License
+# Version 2.0 (the 'License'). You may not use this file except in
+# compliance with the License. Please obtain a copy of the License at
+# http://www.opensource.apple.com/apsl/ and read it before using this
+# file.
 # 
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
+# The Original Code and all software distributed under the License are
+# distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+# EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+# INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+# Please see the License for the specific language governing rights and
 # limitations under the License.
+# 
+# @APPLE_LICENSE_HEADER_END@
 #
 # $Log: Makefile,v $
-# Revision 1.8  2006/08/14 23:23:55  cheshire
-# Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
-#
-# Revision 1.7  2006/01/06 01:06:17  cheshire
-# <rdar://problem/3978979> Compile library and client programs in one pass
-#
 # Revision 1.6  2004/09/24 21:15:26  cheshire
 # <rdar://problem/3724985> Library "libmdns" misnamed; should be "libdns_sd"
 #
 
 #############################################################################
 
-# On OS X the dns_sd library functions are included in libSystem, which is implicitly linked with every executable
-# If /usr/lib/libSystem.dylib exists, then we're on OS X, so we don't need also to link the "dns_sd" shared library
-ifneq "$(wildcard /usr/lib/libSystem.dylib)" ""
-LIBS =
+
+# If library /usr/lib/libdns_sd.* exists, then link it
+ifneq "$(wildcard /usr/lib/libdns_sd.*)" ""
+LIBS = -ldns_sd
 else
-LIBS = -L../mDNSPosix/build/prod/ -ldns_sd
+LIBS =
 endif
 
 targets: build/dns-sd
index 8d4b881ff65f4cc1c93cd19b0b26d54d6f625252..b5131dac93c425425d112f3dbb9006d87639e425 100644 (file)
@@ -1,25 +1,28 @@
-/* -*- Mode: C; tab-width: 4 -*-
- *
+/*
  * Copyright (c) 1997-2004 Apple Computer, Inc. All rights reserved.
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * @APPLE_LICENSE_HEADER_START@
  * 
- *     http://www.apache.org/licenses/LICENSE-2.0
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
  * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
  * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
 
     Change History (most recent first):
     
 $Log: FirstPage.cpp,v $
-Revision 1.6  2006/08/14 23:24:09  cheshire
-Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
-
 Revision 1.5  2005/07/07 17:53:20  shersche
 Fix problems associated with the CUPS printer workaround fix.
 
index c7c96f421478336d162bff9cc817018138c7c31b..a798eb09c6656016de4236b592a0cd9c08c10ca8 100644 (file)
@@ -1,25 +1,28 @@
-/* -*- Mode: C; tab-width: 4 -*-
- *
+/*
  * Copyright (c) 1997-2004 Apple Computer, Inc. All rights reserved.
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * @APPLE_LICENSE_HEADER_START@
  * 
- *     http://www.apache.org/licenses/LICENSE-2.0
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
  * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
  * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
 
     Change History (most recent first):
     
 $Log: FirstPage.h,v $
-Revision 1.3  2006/08/14 23:24:09  cheshire
-Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
-
 Revision 1.2  2005/07/07 17:53:20  shersche
 Fix problems associated with the CUPS printer workaround fix.
 
index 66e514572b1060e08be662d062dcb890030f908d..876e28ba98382b75b9d172935e943c2dbfb25461 100644 (file)
@@ -1,25 +1,28 @@
-/* -*- Mode: C; tab-width: 4 -*-
- *
+/*
  * Copyright (c) 1997-2004 Apple Computer, Inc. All rights reserved.
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * @APPLE_LICENSE_HEADER_START@
  * 
- *     http://www.apache.org/licenses/LICENSE-2.0
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
  * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
  * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
 
     Change History (most recent first):
     
 $Log: FourthPage.cpp,v $
-Revision 1.8  2006/08/14 23:24:09  cheshire
-Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
-
 Revision 1.7  2005/07/07 17:53:20  shersche
 Fix problems associated with the CUPS printer workaround fix.
 
index fc7205958e34bb3d079a096bf591dd9ff8d8b022..fca8cd1f2aee5f36ecefdf92e0afe7030e94dfae 100644 (file)
@@ -1,25 +1,28 @@
-/* -*- Mode: C; tab-width: 4 -*-
- *
+/*
  * Copyright (c) 1997-2004 Apple Computer, Inc. All rights reserved.
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * @APPLE_LICENSE_HEADER_START@
  * 
- *     http://www.apache.org/licenses/LICENSE-2.0
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
  * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
  * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
 
     Change History (most recent first):
     
 $Log: FourthPage.h,v $
-Revision 1.4  2006/08/14 23:24:09  cheshire
-Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
-
 Revision 1.3  2005/07/07 17:53:20  shersche
 Fix problems associated with the CUPS printer workaround fix.
 
index e9e255f41080145e1d3ddbde06fd6e11e32184f2..7b6544313604e74af47fcd109d2d7de20ca8349a 100644 (file)
@@ -1,25 +1,28 @@
-/* -*- Mode: C; tab-width: 4 -*-
- *
+/*
  * Copyright (c) 1997-2004 Apple Computer, Inc. All rights reserved.
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * @APPLE_LICENSE_HEADER_START@
  * 
- *     http://www.apache.org/licenses/LICENSE-2.0
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
  * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
  * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
 
     Change History (most recent first):
     
 $Log: PrinterSetupWizardApp.cpp,v $
-Revision 1.9  2006/08/14 23:24:09  cheshire
-Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
-
 Revision 1.8  2005/04/13 17:43:39  shersche
 <rdar://problem/4081448> Change "PrinterWizard.dll" to "PrinterWizardResources.dll"
 
index 08a182945290ea1698368983a01e930c81fd0ecc..871de5d447c170c46def80a1420c4eb0d776b172 100644 (file)
@@ -1,25 +1,28 @@
-/* -*- Mode: C; tab-width: 4 -*-
- *
+/*
  * Copyright (c) 1997-2004 Apple Computer, Inc. All rights reserved.
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * @APPLE_LICENSE_HEADER_START@
  * 
- *     http://www.apache.org/licenses/LICENSE-2.0
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
  * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
  * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
 
     Change History (most recent first):
     
 $Log: PrinterSetupWizardApp.h,v $
-Revision 1.3  2006/08/14 23:24:09  cheshire
-Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
-
 Revision 1.2  2005/01/25 08:52:55  shersche
 <rdar://problem/3911084> Add APIs to return localizable and non-localizable resource DLL handles
 Bug #: 3911084
index e912716b3a2e0284a0f2976ac8c7ec086c415e3b..34db5483fad131f6d79a38178c12e3a82848067f 100644 (file)
@@ -1,30 +1,33 @@
-/* -*- Mode: C; tab-width: 4 -*-
- *
+/*
  * Copyright (c) 1997-2004 Apple Computer, Inc. All rights reserved.
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * @APPLE_LICENSE_HEADER_START@
  * 
- *     http://www.apache.org/licenses/LICENSE-2.0
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
  * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
  * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
 
     Change History (most recent first):
     
 $Log: PrinterSetupWizardSheet.cpp,v $
-Revision 1.35  2006/08/14 23:24:09  cheshire
-Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
-
 Revision 1.34  2005/10/05 17:32:51  herscher
 <rdar://problem/4141221> Use a case insensitive compare operation to check whether a printer with the same name has already been installed.
 
 Revision 1.33  2005/07/11 20:17:15  shersche
-<rdar://problem/4124524> UI fixes associated with CUPS printer workaround fix.
+<rdar://4124524> UI fixes associated with CUPS printer workaround fix.
 
 Revision 1.32  2005/07/07 17:53:20  shersche
 Fix problems associated with the CUPS printer workaround fix.
index b9cc5ff1e3c5f1eadf803a9b0dcc2b4af9e63f28..63dc0c0ab0bb5fbb87d25e6d14dba90463f9676b 100644 (file)
@@ -1,25 +1,28 @@
-/* -*- Mode: C; tab-width: 4 -*-
- *
+/*
  * Copyright (c) 1997-2004 Apple Computer, Inc. All rights reserved.
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * @APPLE_LICENSE_HEADER_START@
  * 
- *     http://www.apache.org/licenses/LICENSE-2.0
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
  * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
  * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
 
     Change History (most recent first):
     
 $Log: PrinterSetupWizardSheet.h,v $
-Revision 1.12  2006/08/14 23:24:09  cheshire
-Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
-
 Revision 1.11  2005/10/05 17:32:51  herscher
 <rdar://problem/4141221> Use a case insensitive compare operation to check whether a printer with the same name has already been installed.
 
index 83e6685b8a7ece996fd15ecb98aa382dc39f4f53..3c9cedc48b10b8429f561d9434c2ece100b2eed9 100644 (file)
@@ -1,30 +1,33 @@
-/* -*- Mode: C; tab-width: 4 -*-
- *
+/*
  * Copyright (c) 1997-2004 Apple Computer, Inc. All rights reserved.
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * @APPLE_LICENSE_HEADER_START@
  * 
- *     http://www.apache.org/licenses/LICENSE-2.0
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
  * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
  * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
 
     Change History (most recent first):
     
 $Log: SecondPage.cpp,v $
-Revision 1.19  2006/08/14 23:24:09  cheshire
-Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
-
 Revision 1.18  2005/07/20 17:44:54  shersche
 <rdar://problem/4124524> UI fixes for CUPS workaround
 
 Revision 1.17  2005/07/11 20:17:15  shersche
-<rdar://problem/4124524> UI fixes associated with CUPS printer workaround fix.
+<rdar://4124524> UI fixes associated with CUPS printer workaround fix.
 
 Revision 1.16  2005/07/07 17:53:20  shersche
 Fix problems associated with the CUPS printer workaround fix.
index b857334fd08a47c13b8ee984a92ce2a0112317ae..5cf1852aa8093a5b0c5b0a75bd20fe31bf7405f7 100644 (file)
@@ -1,25 +1,28 @@
-/* -*- Mode: C; tab-width: 4 -*-
- *
+/*
  * Copyright (c) 1997-2004 Apple Computer, Inc. All rights reserved.
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * @APPLE_LICENSE_HEADER_START@
  * 
- *     http://www.apache.org/licenses/LICENSE-2.0
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
  * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
  * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
 
     Change History (most recent first):
     
 $Log: SecondPage.h,v $
-Revision 1.9  2006/08/14 23:24:09  cheshire
-Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
-
 Revision 1.8  2005/03/20 20:08:37  shersche
 <rdar://problem/4055670> Second screen should not select a printer by default
 
@@ -120,22 +123,14 @@ private:
        SetPrinterInformationState( BOOL state );
 
        std::string             m_selectedName;
-
-
-private:
-
-
-
-       CStatic m_printerInformation;
-
-       CStatic m_descriptionLabel;
-
-       CStatic m_descriptionField;
-
-       CStatic m_locationLabel;
-
-       CStatic m_locationField;
-
+\r
+private:\r
+\r
+       CStatic m_printerInformation;\r
+       CStatic m_descriptionLabel;\r
+       CStatic m_descriptionField;\r
+       CStatic m_locationLabel;\r
+       CStatic m_locationField;\r
 
        bool    m_gotChoice;
 };
index ac5ff1fa5474e1032c2aa2627fd985c3169f354e..3c554630e70eb240c50760f68c97bf829c564486 100644 (file)
@@ -1,30 +1,33 @@
-/* -*- Mode: C; tab-width: 4 -*-
- *
+/*
  * Copyright (c) 1997-2004 Apple Computer, Inc. All rights reserved.
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * @APPLE_LICENSE_HEADER_START@
  * 
- *     http://www.apache.org/licenses/LICENSE-2.0
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
  * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
  * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
 
     Change History (most recent first):
     
 $Log: ThirdPage.cpp,v $
-Revision 1.28  2006/08/14 23:24:09  cheshire
-Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
-
 Revision 1.27  2005/10/05 21:41:45  herscher
 <rdar://problem/4190104> Use "application/octet-stream" to determine if CUPS shared queue supports raw
 
 Revision 1.26  2005/07/11 20:17:15  shersche
-<rdar://problem/4124524> UI fixes associated with CUPS printer workaround fix.
+<rdar://4124524> UI fixes associated with CUPS printer workaround fix.
 
 Revision 1.25  2005/07/07 17:53:20  shersche
 Fix problems associated with the CUPS printer workaround fix.
index b21f2199fc3f8afffb3971ac5b0151022d14c1e1..8331421fd557c6e0a47eb85d4558a45daf01637d 100644 (file)
@@ -1,25 +1,28 @@
-/* -*- Mode: C; tab-width: 4 -*-
- *
+/*
  * Copyright (c) 1997-2004 Apple Computer, Inc. All rights reserved.
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * @APPLE_LICENSE_HEADER_START@
  * 
- *     http://www.apache.org/licenses/LICENSE-2.0
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
  * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
  * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
 
     Change History (most recent first):
     
 $Log: ThirdPage.h,v $
-Revision 1.6  2006/08/14 23:24:09  cheshire
-Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
-
 Revision 1.5  2005/07/07 17:53:20  shersche
 Fix problems associated with the CUPS printer workaround fix.
 
index aad29f1cb250d269a1567f7181aaf71f25c184a8..e5512b982da3332e0b5e78395c856cc06aa6c678 100644 (file)
@@ -1,25 +1,28 @@
-/* -*- Mode: C; tab-width: 4 -*-
- *
+/*
  * Copyright (c) 1997-2004 Apple Computer, Inc. All rights reserved.
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * @APPLE_LICENSE_HEADER_START@
  * 
- *     http://www.apache.org/licenses/LICENSE-2.0
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
  * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
  * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
 
     Change History (most recent first):
     
 $Log: UtilTypes.h,v $
-Revision 1.15  2006/08/14 23:24:09  cheshire
-Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
-
 Revision 1.14  2005/06/30 18:02:54  shersche
 <rdar://problem/4124524> Workaround for Mac OS X Printer Sharing bug
 
index a44c06f84ceb44069073773a62adc33630394274..5d21d404b112667a18a999905aee09c8ff858564 100644 (file)
@@ -1,18 +1,24 @@
-/* -*- Mode: C; tab-width: 4 -*-\r
- *\r
+/*\r
  * Copyright (c) 1997-2004 Apple Computer, Inc. All rights reserved.\r
  *\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
+ * @APPLE_LICENSE_HEADER_START@\r
  * \r
- *     http://www.apache.org/licenses/LICENSE-2.0\r
+ * This file contains Original Code and/or Modifications of Original Code\r
+ * as defined in and that are subject to the Apple Public Source License\r
+ * Version 2.0 (the 'License'). You may not use this file except in\r
+ * compliance with the License. Please obtain a copy of the License at\r
+ * http://www.opensource.apple.com/apsl/ and read it before using this\r
+ * file.\r
  * \r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
+ * The Original Code and all software distributed under the License are\r
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER\r
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,\r
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,\r
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.\r
+ * Please see the License for the specific language governing rights and\r
  * limitations under the License.\r
+ * \r
+ * @APPLE_LICENSE_HEADER_END@\r
 \r
     Change History (most recent first):\r
 \r
index 548f66f8e676e1934d83fed1d2daea8222d0982e..53abf252b277f84623d41859f9e7ce05b3c23a49 100644 (file)
@@ -1,25 +1,28 @@
-/* -*- Mode: C; tab-width: 4 -*-
- *
+/*
  * Copyright (c) 1997-2004 Apple Computer, Inc. All rights reserved.
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * @APPLE_LICENSE_HEADER_START@
  * 
- *     http://www.apache.org/licenses/LICENSE-2.0
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
  * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
  * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
 
     Change History (most recent first):
     
 $Log: stdafx.cpp,v $
-Revision 1.2  2006/08/14 23:24:09  cheshire
-Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
-
 Revision 1.1  2004/06/18 04:36:58  rpantos
 First checked in
 
index e1ecec8a160d94a09cac0b09ae3e6c0f5cde4f71..8ec4bdb3433535669d48782597395e4113415bef 100644 (file)
@@ -1,25 +1,28 @@
-/* -*- Mode: C; tab-width: 4 -*-
- *
+/*
  * Copyright (c) 1997-2004 Apple Computer, Inc. All rights reserved.
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * @APPLE_LICENSE_HEADER_START@
  * 
- *     http://www.apache.org/licenses/LICENSE-2.0
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
  * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
  * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
 
     Change History (most recent first):
     
 $Log: stdafx.h,v $
-Revision 1.3  2006/08/14 23:24:09  cheshire
-Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
-
 Revision 1.2  2005/10/19 19:50:35  herscher
 Workaround a bug in the latest Microsoft Platform SDK when compiling C++ files that include (directly or indirectly) <WspiApi.h>
 
index 4fc7745be319c594084a13d1bf5a7c6051e5b302..a7784204a7c282a60c516f60436f439e552301fc 100755 (executable)
@@ -1,25 +1,28 @@
-/* -*- Mode: C; tab-width: 4 -*-\r
- *\r
+/*\r
  * Copyright (c) 1997-2004 Apple Computer, Inc. All rights reserved.\r
  *\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
+ * @APPLE_LICENSE_HEADER_START@\r
  * \r
- *     http://www.apache.org/licenses/LICENSE-2.0\r
+ * This file contains Original Code and/or Modifications of Original Code\r
+ * as defined in and that are subject to the Apple Public Source License\r
+ * Version 2.0 (the 'License'). You may not use this file except in\r
+ * compliance with the License. Please obtain a copy of the License at\r
+ * http://www.opensource.apple.com/apsl/ and read it before using this\r
+ * file.\r
  * \r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
+ * The Original Code and all software distributed under the License are\r
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER\r
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,\r
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,\r
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.\r
+ * Please see the License for the specific language governing rights and\r
  * limitations under the License.\r
+ * \r
+ * @APPLE_LICENSE_HEADER_END@\r
 \r
     Change History (most recent first):\r
     \r
 $Log: AssemblyInfo.cs,v $
-Revision 1.2  2006/08/14 23:24:21  cheshire
-Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
-
 Revision 1.1  2004/07/19 07:57:08  shersche
 Initial revision
 \r
index e7f3b1e2f639db311c7d9023d6c8b1aa51463eff..fb841f2c3192d45f66f0cd5dd7f6eed551f15c11 100755 (executable)
@@ -1,25 +1,28 @@
-/* -*- Mode: C; tab-width: 4 -*-
- *
+/*
  * Copyright (c) 1997-2004 Apple Computer, Inc. All rights reserved.
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * @APPLE_LICENSE_HEADER_START@
  * 
- *     http://www.apache.org/licenses/LICENSE-2.0
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
  * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
  * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
 
     Change History (most recent first):
     
 $Log: SimpleChat.cs,v $
-Revision 1.6  2006/08/14 23:24:21  cheshire
-Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
-
 Revision 1.5  2004/09/13 19:37:42  shersche
 Change code to reflect namespace and type changes to dnssd.NET library
 
index 31e620d3a7f1cbbbb8d3198fbbf52afbfe0ad7e6..699a93286da4ad51aa85c27cf8f944ddc1a808cc 100644 (file)
@@ -1,6 +1,5 @@
-/* -*- Mode: C; tab-width: 4 -*-
- *
- * Copyright (c) 2002-2006 Apple Computer, Inc. All rights reserved.
+/*
+ * Copyright (c) 2002-2003 Apple Computer, Inc. All rights reserved.
  *
  * Disclaimer: IMPORTANT:  This Apple software is supplied to you by Apple Computer, Inc.
  * ("Apple") in consideration of your agreement to the following terms, and your
@@ -59,42 +58,31 @@ POSIX systems:
 gcc dns-sd.c -o dns-sd -I../mDNSShared -ldns_sd
 
 Windows:
-cl dns-sd.c -I../mDNSShared -DNOT_HAVE_GETOPT ws2_32.lib ..\mDNSWindows\DLL\Release\dnssd.lib
+cl dns-sd.c -I../mDNSShared -DNOT_HAVE_GETOPT -DNOT_HAVE_SETLINEBUF ws2_32.lib ..\mDNSWindows\DLL\Release\dnssd.lib
 (may require that you run a Visual Studio script such as vsvars32.bat first)
 */
 
-// For testing changes to dnssd_clientstub.c, uncomment this line and the #include below
-// #define __APPLE_API_PRIVATE 1
-
 #include "dns_sd.h"
 #include <ctype.h>
 #include <stdio.h>                     // For stdout, stderr
 #include <stdlib.h>                    // For exit()
 #include <string.h>                    // For strlen(), strcpy(), bzero()
-#include <errno.h>                     // For errno, EINTR
+#include <errno.h>          // For errno, EINTR
 #include <time.h>
-#include <sys/types.h>         // For u_char
+#include <sys/types.h>      // For u_char
 
 #ifdef _WIN32
-#include <winsock2.h>
-#include <ws2tcpip.h>
 #include <process.h>
-typedef int        pid_t;
-#define getpid     _getpid
-#define strcasecmp _stricmp
-#define snprintf   _snprintf
-static const char kFilePathSep = '\\';
+typedef        int     pid_t;
+#define        getpid  _getpid
+#define        strcasecmp      _stricmp
+#define snprintf _snprintf
 #else
-#include <unistd.h>                    // For getopt() and optind
-#include <netdb.h>                     // For getaddrinfo()
 #include <sys/time.h>          // For struct timeval
-#include <sys/socket.h>                // For AF_INET
-#include <netinet/in.h>                // For struct sockaddr_in()
+#include <unistd.h>         // For getopt() and optind
 #include <arpa/inet.h>         // For inet_addr()
-static const char kFilePathSep = '/';
 #endif
 
-//#include "../mDNSShared/dnssd_clientstub.c"
 
 //*************************************************************************************************************
 // Globals
@@ -111,7 +99,7 @@ static DNSRecordRef record = NULL;
 static char myhinfoW[14] = "\002PC\012Windows XP";
 static char myhinfoX[ 9] = "\003Mac\004OS X";
 static char updatetest[3] = "\002AA";
-static char bigNULL[8200];
+static char bigNULL[4096];
 
 // Note: the select() implementation on Windows (Winsock2) fails with any timeout much larger than this
 #define LONG_TIME 100000000
@@ -226,136 +214,124 @@ static const char *GetNextLabel(const char *cstr, char label[64])
        return(cstr);
        }
 
-static void DNSSD_API enum_reply(DNSServiceRef client, const DNSServiceFlags flags, uint32_t ifIndex,
+static void DNSSD_API enum_reply(DNSServiceRef client, DNSServiceFlags flags, uint32_t ifIndex,
        DNSServiceErrorType errorCode, const char *replyDomain, void *context)
        {
-       DNSServiceFlags partialflags = flags & ~(kDNSServiceFlagsMoreComing | kDNSServiceFlagsAdd | kDNSServiceFlagsDefault);
        int labels = 0, depth = 0, i, initial = 0;
        char text[64];
        const char *label[128];
        
        (void)client;       // Unused
        (void)ifIndex;      // Unused
+       (void)errorCode;    // Unused
        (void)context;      // Unused
+       
+       if (!*replyDomain) return;
 
        // 1. Print the header
        if (num_printed++ == 0) printf("Timestamp     Recommended %s domain\n", operation == 'E' ? "Registration" : "Browsing");
        printtimestamp();
-       if (errorCode)
-               printf("Error code %d\n", errorCode);
-       else if (!*replyDomain)
-               printf("Error: No reply domain\n");
-       else
-               {
-               printf("%-10s", DomainMsg(flags));
-               printf("%-8s", (flags & kDNSServiceFlagsMoreComing) ? "(More)" : "");
-               if (partialflags) printf("Flags: %4X  ", partialflags);
-               else printf("             ");
-               
-               // 2. Count the labels
-               while (*replyDomain)
-                       {
-                       label[labels++] = replyDomain;
-                       replyDomain = GetNextLabel(replyDomain, text);
-                       }
-               
-               // 3. Decide if we're going to clump the last two or three labels (e.g. "apple.com", or "nicta.com.au")
-               if      (labels >= 3 && replyDomain - label[labels-1] <= 3 && label[labels-1] - label[labels-2] <= 4) initial = 3;
-               else if (labels >= 2 && replyDomain - label[labels-1] <= 4) initial = 2;
-               else initial = 1;
-               labels -= initial;
+       printf("%-10s", DomainMsg(flags));
+       printf("%-8s", (flags & kDNSServiceFlagsMoreComing) ? "(More)" : "");
+       flags &= ~kDNSServiceFlagsMoreComing;
+       flags &= ~kDNSServiceFlagsAdd;
+       flags &= ~kDNSServiceFlagsDefault;
+       if (flags) printf("Flags: %4X  ", flags);
+       else printf("             ");
        
-               // 4. Print the initial one-, two- or three-label clump
-               for (i=0; i<initial; i++)
-                       {
-                       GetNextLabel(label[labels+i], text);
-                       if (i>0) printf(".");
-                       printf("%s", text);
-                       }
-               printf("\n");
+       // 2. Count the labels
+       while (*replyDomain)
+               {
+               label[labels++] = replyDomain;
+               replyDomain = GetNextLabel(replyDomain, text);
+               }
        
-               // 5. Print the remainder of the hierarchy
-               for (depth=0; depth<labels; depth++)
-                       {
-                       printf("                                             ");
-                       for (i=0; i<=depth; i++) printf("- ");
-                       GetNextLabel(label[labels-1-depth], text);
-                       printf("> %s\n", text);
-                       }
+       // 3. Decide if we're going to clump the last two or three labels (e.g. "apple.com", or "nicta.com.au")
+       if      (labels >= 3 && replyDomain - label[labels-1] <= 3 && label[labels-1] - label[labels-2] <= 4) initial = 3;
+       else if (labels >= 2 && replyDomain - label[labels-1] <= 4) initial = 2;
+       else initial = 1;
+       labels -= initial;
+
+       // 4. Print the initial one-, two- or three-label clump
+       for (i=0; i<initial; i++)
+               {
+               GetNextLabel(label[labels+i], text);
+               if (i>0) printf(".");
+               printf("%s", text);
                }
+       printf("\n");
 
-       if (!(flags & kDNSServiceFlagsMoreComing)) fflush(stdout);
+       // 5. Print the remainder of the hierarchy
+       for (depth=0; depth<labels; depth++)
+               {
+               printf("                                             ");
+               for (i=0; i<=depth; i++) printf("- ");
+               GetNextLabel(label[labels-1-depth], text);
+               printf("> %s\n", text);
+               }
+
+       fflush( stdout );
        }
 
-static void DNSSD_API browse_reply(DNSServiceRef client, const DNSServiceFlags flags, uint32_t ifIndex, DNSServiceErrorType errorCode,
+static void DNSSD_API browse_reply(DNSServiceRef client, DNSServiceFlags flags, uint32_t ifIndex, DNSServiceErrorType errorCode,
        const char *replyName, const char *replyType, const char *replyDomain, void *context)
        {
        char *op = (flags & kDNSServiceFlagsAdd) ? "Add" : "Rmv";
        (void)client;       // Unused
+       (void)errorCode;    // Unused
        (void)context;      // Unused
-       if (num_printed++ == 0) printf("Timestamp     A/R Flags if %-25s %-25s %s\n", "Domain", "Service Type", "Instance Name");
+       if (num_printed++ == 0) printf("Timestamp     A/R Flags if %-24s %-24s %s\n", "Domain", "Service Type", "Instance Name");
        printtimestamp();
-       if (errorCode) printf("Error code %d\n", errorCode);
-       else printf("%s%6X%3d %-25s %-25s %s\n", op, flags, ifIndex, replyDomain, replyType, replyName);
-       if (!(flags & kDNSServiceFlagsMoreComing)) fflush(stdout);
-       }
-
-static void ShowTXTRecord(uint16_t txtLen, const unsigned char *txtRecord)
-       {
-       const unsigned char *ptr = txtRecord;
-       const unsigned char *max = txtRecord + txtLen;
-       while (ptr < max)
-               {
-               const unsigned char *const end = ptr + 1 + ptr[0];
-               if (end > max) { printf("<< invalid data >>"); break; }
-               if (++ptr < end) printf(" ");   // As long as string is non-empty, begin with a space
-               while (ptr<end)
-                       {
-                       // We'd like the output to be shell-friendly, so that it can be copied and pasted unchanged into a "dns-sd -R" command.
-                       // However, this is trickier than it seems. Enclosing a string in double quotes doesn't necessarily make it
-                       // shell-safe, because shells still expand variables like $foo even when they appear inside quoted strings.
-                       // Enclosing a string in single quotes is better, but when using single quotes even backslash escapes are ignored,
-                       // meaning there's simply no way to represent a single quote (or apostrophe) inside a single-quoted string.
-                       // The only remaining solution is not to surround the string with quotes at all, but instead to use backslash
-                       // escapes to encode spaces and all other known shell metacharacters.
-                       // (If we've missed any known shell metacharacters, please let us know.)
-                       // In addition, non-printing ascii codes (0-31) are displayed as \xHH, using a two-digit hex value.
-                       // Because '\' is itself a shell metacharacter (the shell escape character), it has to be escaped as "\\" to survive
-                       // the round-trip to the shell and back. This means that a single '\' is represented here as EIGHT backslashes:
-                       // The C compiler eats half of them, resulting in four appearing in the output.
-                       // The shell parses those four as a pair of "\\" sequences, passing two backslashes to the "dns-sd -R" command.
-                       // The "dns-sd -R" command interprets this single "\\" pair as an escaped literal backslash. Sigh.
-                       if (strchr(" &;`'\"|*?~<>^()[]{}$", *ptr)) printf("\\");
-                       if      (*ptr == '\\') printf("\\\\\\\\");
-                       else if (*ptr >= ' ' ) printf("%c",        *ptr);
-                       else                   printf("\\\\x%02X", *ptr);
-                       ptr++;
-                       }
-               }
+       printf("%s%6X%3d %-24s %-24s %s\n", op, flags, ifIndex, replyDomain, replyType, replyName);
+       fflush( stdout );
        }
 
-static void DNSSD_API resolve_reply(DNSServiceRef client, const DNSServiceFlags flags, uint32_t ifIndex, DNSServiceErrorType errorCode,
-       const char *fullname, const char *hosttarget, uint16_t opaqueport, uint16_t txtLen, const unsigned char *txtRecord, void *context)
+static void DNSSD_API resolve_reply(DNSServiceRef client, DNSServiceFlags flags, uint32_t ifIndex, DNSServiceErrorType errorCode,
+       const char *fullname, const char *hosttarget, uint16_t opaqueport, uint16_t txtLen, const char *txtRecord, void *context)
        {
+       const char *src = txtRecord;
        union { uint16_t s; u_char b[2]; } port = { opaqueport };
        uint16_t PortAsNumber = ((uint16_t)port.b[0]) << 8 | port.b[1];
 
        (void)client;       // Unused
        (void)ifIndex;      // Unused
+       (void)errorCode;    // Unused
+       (void)txtLen;       // Unused
        (void)context;      // Unused
 
        printtimestamp();
-       if (errorCode) printf("Error code %d\n", errorCode);
-       else
+       printf("%s can be reached at %s:%u", fullname, hosttarget, PortAsNumber);
+
+       if (flags) printf(" Flags: %X", flags);
+       if (*src)
                {
-               printf("%s can be reached at %s:%u", fullname, hosttarget, PortAsNumber);
-               if (flags) printf(" Flags: %X", flags);
-               // Don't show degenerate TXT records containing nothing but a single empty string
-               if (txtLen > 1) { printf("\n"); ShowTXTRecord(txtLen, txtRecord); }
-               printf("\n");
+               char txtInfo[64];                               // Display at most first 64 characters of TXT record
+               char *dst = txtInfo;
+               const char *const lim = &txtInfo[sizeof(txtInfo)];
+               while (*src && dst < lim-1)
+                       {
+                       if (*src == '\\') *dst++ = '\\';            // '\' displays as "\\"
+                       if (*src >= ' ') *dst++ = *src++;           // Display normal characters as-is
+                       else
+                               {
+                               *dst++ = '\\';                          // Display a backslash
+                               if (*src ==    1) *dst++ = ' ';         // String boundary displayed as "\ "
+                               else                                    // Other chararacters displayed as "\0xHH"
+                                       {
+                                       static const char hexchars[16] = "0123456789ABCDEF";
+                                       *dst++ = '0';
+                                       *dst++ = 'x';
+                                       *dst++ = hexchars[*src >> 4];
+                                       *dst++ = hexchars[*src & 0xF];
+                                       }
+                               src++;
+                               }
+                       }
+               *dst++ = 0;
+               printf(" TXT %s", txtInfo);
                }
-
-       if (!(flags & kDNSServiceFlagsMoreComing)) fflush(stdout);
+       printf("\n");
+       fflush( stdout );
        }
 
 static void myTimerCallBack(void)
@@ -411,7 +387,7 @@ static void myTimerCallBack(void)
                }
        }
 
-static void DNSSD_API reg_reply(DNSServiceRef client, const DNSServiceFlags flags, DNSServiceErrorType errorCode,
+static void DNSSD_API reg_reply(DNSServiceRef client, DNSServiceFlags flags, DNSServiceErrorType errorCode,
        const char *name, const char *regtype, const char *domain, void *context)
        {
        (void)client;   // Unused
@@ -419,64 +395,45 @@ static void DNSSD_API reg_reply(DNSServiceRef client, const DNSServiceFlags flag
        (void)context;  // Unused
 
        printf("Got a reply for %s.%s%s: ", name, regtype, domain);
-
-       if (errorCode == kDNSServiceErr_NoError)
-               {
-               printf("Name now registered and active\n");
-               if (operation == 'A' || operation == 'U' || operation == 'N') timeOut = 5;
-               }
-       else if (errorCode == kDNSServiceErr_NameConflict)
+       switch (errorCode)
                {
-               printf("Name in use, please choose another\n");
-               exit(-1);
+               case kDNSServiceErr_NoError:      printf("Name now registered and active\n"); break;
+               case kDNSServiceErr_NameConflict: printf("Name in use, please choose another\n"); exit(-1);
+               default:                          printf("Error %d\n", errorCode); return;
                }
-       else
-               printf("Error %d\n", errorCode);
 
-       if (!(flags & kDNSServiceFlagsMoreComing)) fflush(stdout);
+       if (operation == 'A' || operation == 'U' || operation == 'N') timeOut = 5;
+       fflush( stdout );
        }
 
-static void DNSSD_API qr_reply(DNSServiceRef sdRef, const DNSServiceFlags flags, uint32_t ifIndex, DNSServiceErrorType errorCode,
+static void DNSSD_API qr_reply(DNSServiceRef sdRef, DNSServiceFlags flags, uint32_t ifIndex, DNSServiceErrorType errorCode,
        const char *fullname, uint16_t rrtype, uint16_t rrclass, uint16_t rdlen, const void *rdata, uint32_t ttl, void *context)
        {
        char *op = (flags & kDNSServiceFlagsAdd) ? "Add" : "Rmv";
        const unsigned char *rd  = rdata;
        const unsigned char *end = (const unsigned char *) rdata + rdlen;
        char rdb[1000];
-       int unknowntype = 0;
+       char *p = rdb;
+       const char * const lim = rdb + sizeof(rdb);
 
        (void)sdRef;    // Unused
        (void)flags;    // Unused
        (void)ifIndex;  // Unused
+       (void)errorCode;// Unused
        (void)ttl;      // Unused
        (void)context;  // Unused
 
-       if (num_printed++ == 0) printf("Timestamp     A/R Flags if %-30s%4s%4s Rdata\n", "Name", "T", "C");
-       printtimestamp();
-       if (errorCode)
-               printf("Error code %d\n", errorCode);
-       else
+       switch (rrtype)
                {
-               switch (rrtype)
-                       {
-                       case kDNSServiceType_A: sprintf(rdb, "%d.%d.%d.%d", rd[0], rd[1], rd[2], rd[3]); break;
-                       case kDNSServiceType_AAAA: sprintf(rdb, "%02X%02X:%02X%02X:%02X%02X:%02X%02X:%02X%02X:%02X%02X:%02X%02X:%02X%02X",
-                               rd[0x0], rd[0x1], rd[0x2], rd[0x3], rd[0x4], rd[0x5], rd[0x6], rd[0x7],
-                               rd[0x8], rd[0x9], rd[0xA], rd[0xB], rd[0xC], rd[0xD], rd[0xE], rd[0xF]); break;
-                               break;
-                       default : sprintf(rdb, "%d bytes%s", rdlen, rdlen ? ":" : ""); unknowntype = 1; break;
-                       }
-
-               printf("%s%6X%3d %-30s%4d%4d %s", op, flags, ifIndex, fullname, rrtype, rrclass, rdb);
-               if (unknowntype) while (rd < end) printf(" %02X", *rd++);
-               printf("\n");
-       
-               if (operation == 'C')
-                       if (flags & kDNSServiceFlagsAdd)
-                               DNSServiceReconfirmRecord(flags, ifIndex, fullname, rrtype, rrclass, rdlen, rdata);
+               case kDNSServiceType_A: sprintf(rdb, "%d.%d.%d.%d", rd[0], rd[1], rd[2], rd[3]); break;
+               default :       p += snprintf(p, lim-p, "%d bytes%s", rdlen, rdlen ? ":" : "");
+                                       while (rd < end && p < lim) p += snprintf(p, lim-p, " %02X", *rd++);
+                                       break;
                }
-
-       if (!(flags & kDNSServiceFlagsMoreComing)) fflush(stdout);
+       if (num_printed++ == 0) printf("Timestamp     A/R Flags if %-30s%4s%4s Rdata\n", "Name", "T", "C");
+       printtimestamp();
+       printf("%s%6X%3d %-30s%4d%4d %s\n", op, flags, ifIndex, fullname, rrtype, rrclass, rdb);
+       fflush( stdout );
        }
 
 //*************************************************************************************************************
@@ -505,7 +462,7 @@ static void HandleEvents(void)
                if (client2) FD_SET(dns_sd_fd2, &readfds);
 
                // 3. Set up the timeout.
-               tv.tv_sec  = timeOut;
+               tv.tv_sec = timeOut;
                tv.tv_usec = 0;
 
                result = select(nfds, &readfds, (fd_set*)NULL, (fd_set*)NULL, &tv);
@@ -530,7 +487,7 @@ static int getfirstoption( int argc, char **argv, const char *optstr, int *pOptI
 // Return the recognized option in optstr and the option index of the next arg.
 #if NOT_HAVE_GETOPT
        {
-       int i;
+       int     i;
        for ( i=1; i < argc; i++)
                {
                if ( argv[i][0] == '-' && &argv[i][1] && 
@@ -544,13 +501,13 @@ static int getfirstoption( int argc, char **argv, const char *optstr, int *pOptI
        }
 #else
        {
-       int operation = getopt(argc, (char * const *)argv, optstr);
+       int     operation = getopt(argc, (char * const *)argv, optstr);
        *pOptInd = optind;
        return operation;
        }
 #endif
 
-static void DNSSD_API MyRegisterRecordCallback(DNSServiceRef service, DNSRecordRef record, const DNSServiceFlags flags,
+static void DNSSD_API MyRegisterRecordCallback(DNSServiceRef service, DNSRecordRef record, DNSServiceFlags flags,
     DNSServiceErrorType errorCode, void * context)
        {
        char *name = (char *)context;
@@ -564,54 +521,20 @@ static void DNSSD_API MyRegisterRecordCallback(DNSServiceRef service, DNSRecordR
                {
                case kDNSServiceErr_NoError:      printf("Name now registered and active\n"); break;
                case kDNSServiceErr_NameConflict: printf("Name in use, please choose another\n"); exit(-1);
-               default:                          printf("Error %d\n", errorCode); break;
+               default:                          printf("Error %d\n", errorCode); return;
                }
-       if (!(flags & kDNSServiceFlagsMoreComing)) fflush(stdout);
-       }
-
-static unsigned long getip(const char *const name)
-       {
-       unsigned long ip = 0;
-       struct addrinfo hints;
-       struct addrinfo * addrs = NULL;
-
-       memset(&hints, 0, sizeof(hints));
-       hints.ai_family = AF_INET;
-       
-       if (getaddrinfo(name, NULL, &hints, &addrs) == 0)
-               {
-               ip = ((struct sockaddr_in*) addrs->ai_addr)->sin_addr.s_addr;
-               }
-
-       if (addrs)
-               {
-               freeaddrinfo(addrs);
-               }
-
-       return(ip);
+       fflush( stdout );
        }
 
 static DNSServiceErrorType RegisterProxyAddressRecord(DNSServiceRef *sdRef, const char *host, const char *ip)
        {
-       // Call getip() after the call DNSServiceCreateConnection().
-       // On the Win32 platform, WinSock must be initialized for getip() to succeed.
-       // Any DNSService* call will initialize WinSock for us, so we make sure
-       // DNSServiceCreateConnection() is called before getip() is.
-       unsigned long addr = 0;
+       unsigned long addr = inet_addr(ip);
        DNSServiceErrorType err = DNSServiceCreateConnection(sdRef);
        if (err) { fprintf(stderr, "DNSServiceCreateConnection returned %d\n", err); return(err); }
-       addr = getip(ip);
        return(DNSServiceRegisterRecord(*sdRef, &record, kDNSServiceFlagsUnique, kDNSServiceInterfaceIndexAny, host,
                kDNSServiceType_A, kDNSServiceClass_IN, sizeof(addr), &addr, 240, MyRegisterRecordCallback, (void*)host));
-       // Note, should probably add support for creating proxy AAAA records too, one day
        }
 
-#define HexVal(X) ( ((X) >= '0' && (X) <= '9') ? ((X) - '0'     ) :  \
-                                       ((X) >= 'A' && (X) <= 'F') ? ((X) - 'A' + 10) :  \
-                                       ((X) >= 'a' && (X) <= 'f') ? ((X) - 'a' + 10) : 0)
-
-#define HexPair(P) ((HexVal((P)[0]) << 4) | HexVal((P)[1]))
-
 static DNSServiceErrorType RegisterService(DNSServiceRef *sdRef,
        const char *nam, const char *typ, const char *dom, const char *host, const char *port, int argc, char **argv)
        {
@@ -624,42 +547,34 @@ static DNSServiceErrorType RegisterService(DNSServiceRef *sdRef,
        if (nam[0] == '.' && nam[1] == 0) nam = "";   // We allow '.' on the command line as a synonym for empty string
        if (dom[0] == '.' && dom[1] == 0) dom = "";   // We allow '.' on the command line as a synonym for empty string
        
-       printf("Registering Service %s.%s%s%s", nam[0] ? nam : "<<Default>>", typ, dom[0] ? "." : "", dom);
-       if (host && *host) printf(" host %s", host);
-       printf(" port %s\n", port);
-
-       if (argc)
+       for (i = 0; i < argc; i++)
                {
-               for (i = 0; i < argc; i++)
-                       {
-                       const char *p = argv[i];
-                       *ptr = 0;
-                       while (*p && *ptr < 255 && ptr + 1 + *ptr < txt+sizeof(txt))
-                               {
-                               if      (p[0] != '\\' || p[1] == 0)                       { ptr[++*ptr] = *p;           p+=1; }
-                               else if (p[1] == 'x' && isxdigit(p[2]) && isxdigit(p[3])) { ptr[++*ptr] = HexPair(p+2); p+=4; }
-                               else                                                      { ptr[++*ptr] = p[1];         p+=2; }
-                               }
-                       ptr += 1 + *ptr;
-                       }
-               ShowTXTRecord(ptr-txt, txt);
-               printf("\n");
+               unsigned char *len = ptr++;
+               *len = strlen(argv[i]);
+               strcpy((char*)ptr, argv[i]);
+               ptr += *len;
                }
        
-       return(DNSServiceRegister(sdRef, /* kDNSServiceFlagsAllowRemoteQuery */ 0, opinterface, nam, typ, dom, host, registerPort.NotAnInteger, (uint16_t) (ptr-txt), txt, reg_reply, NULL));
+       printf("Registering Service %s.%s%s", nam, typ, dom);
+       if (host && *host) printf(" host %s", host);
+       printf(" port %s %s\n", port, txt);
+       return(DNSServiceRegister(sdRef, /* kDNSServiceFlagsAllowRemoteQuery */ 0, opinterface, nam, typ, dom, host, registerPort.NotAnInteger, ptr-txt, txt, reg_reply, NULL));
        }
 
 int main(int argc, char **argv)
        {
+#ifdef _WIN32
+       const char      kFilePathSep = '\\';
+#else
+       const char      kFilePathSep = '/';
+#endif
        DNSServiceErrorType err;
        char *dom;
-       int optind;
-
-       // Extract the program name from argv[0], which by convention contains the path to this executable.
-       // Note that this is just a voluntary convention, not enforced by the kernel --
-       // the process calling exec() can pass bogus data in argv[0] if it chooses to.
-       const char *a0 = strrchr(argv[0], kFilePathSep) + 1;
-       if (a0 == (const char *)1) a0 = argv[0];
+       int     optind;
+       const char *progname = strrchr(argv[0], kFilePathSep) ? strrchr(argv[0], kFilePathSep) + 1 : argv[0];
+#ifndef NOT_HAVE_SETLINEBUF
+       setlinebuf(stdout);             // Want to see lines as they appear, not block buffered
+#endif
 
        if (argc > 1 && !strcmp(argv[1], "-lo"))
                {
@@ -669,16 +584,8 @@ int main(int argc, char **argv)
                printf("Using LocalOnly\n");
                }
 
-       if (argc > 2 && !strcmp(argv[1], "-i") && atoi(argv[2]))
-               {
-               opinterface = atoi(argv[2]);
-               argc -= 2;
-               argv += 2;
-               printf("Using interface %d\n", opinterface);
-               }
-
        if (argc < 2) goto Fail;        // Minimum command line is the command name and one argument
-       operation = getfirstoption( argc, argv, "EFBLRPQCAUNTMI", &optind);
+       operation = getfirstoption( argc, argv, "EFBLQRPAUNTMI", &optind);
        if (operation == -1) goto Fail;
 
        switch (operation)
@@ -698,7 +605,7 @@ int main(int argc, char **argv)
                case 'B':       if (argc < optind+1) goto Fail;
                                        dom = (argc < optind+2) ? "" : argv[optind+1];
                                        if (dom[0] == '.' && dom[1] == 0) dom[0] = 0;   // We allow '.' on the command line as a synonym for empty string
-                                       printf("Browsing for %s%s%s\n", argv[optind+0], dom[0] ? "." : "", dom);
+                                       printf("Browsing for %s%s\n", argv[optind+0], dom);
                                        err = DNSServiceBrowse(&client, 0, opinterface, argv[optind+0], dom, browse_reply, NULL);
                                        break;
 
@@ -706,7 +613,7 @@ int main(int argc, char **argv)
                                        dom = (argc < optind+3) ? "local" : argv[optind+2];
                                        if (dom[0] == '.' && dom[1] == 0) dom = "local";   // We allow '.' on the command line as a synonym for "local"
                                        printf("Lookup %s.%s.%s\n", argv[optind+0], argv[optind+1], dom);
-                                       err = DNSServiceResolve(&client, 0, opinterface, argv[optind+0], argv[optind+1], dom, (DNSServiceResolveReply)resolve_reply, NULL);
+                                       err = DNSServiceResolve(&client, 0, opinterface, argv[optind+0], argv[optind+1], dom, resolve_reply, NULL);
                                        break;
 
                case 'R':       if (argc < optind+4) goto Fail;
@@ -719,10 +626,9 @@ int main(int argc, char **argv)
                                        err = RegisterService(&client, argv[optind+0], argv[optind+1], argv[optind+2], argv[optind+4], argv[optind+3], argc-(optind+6), argv+(optind+6));
                                        break;
 
-               case 'Q':
-               case 'C':       {
+               case 'Q':       {
                                        uint16_t rrtype, rrclass;
-                                       DNSServiceFlags flags = kDNSServiceFlagsReturnCNAME;
+                                       DNSServiceFlags flags = 0;
                                        if (argc < optind+1) goto Fail;
                                        rrtype = (argc <= optind+1) ? kDNSServiceType_A  : GetRRType(argv[optind+1]);
                                        rrclass = (argc <= optind+2) ? kDNSServiceClass_IN : atoi(argv[optind+2]);
@@ -785,19 +691,18 @@ int main(int argc, char **argv)
        return 0;
 
 Fail:
-       fprintf(stderr, "%s -E                  (Enumerate recommended registration domains)\n", a0);
-       fprintf(stderr, "%s -F                      (Enumerate recommended browsing domains)\n", a0);
-       fprintf(stderr, "%s -B        <Type> <Domain>        (Browse for services instances)\n", a0);
-       fprintf(stderr, "%s -L <Name> <Type> <Domain>           (Look up a service instance)\n", a0);
-       fprintf(stderr, "%s -R <Name> <Type> <Domain> <Port> [<TXT>...] (Register a service)\n", a0);
-       fprintf(stderr, "%s -P <Name> <Type> <Domain> <Port> <Host> <IP> [<TXT>...]  (Proxy)\n", a0);
-       fprintf(stderr, "%s -Q <FQDN> <rrtype> <rrclass> (Generic query for any record type)\n", a0);
-       fprintf(stderr, "%s -C <FQDN> <rrtype> <rrclass>   (Query; reconfirming each result)\n", a0);
-       fprintf(stderr, "%s -A                      (Test Adding/Updating/Deleting a record)\n", a0);
-       fprintf(stderr, "%s -U                                  (Test updating a TXT record)\n", a0);
-       fprintf(stderr, "%s -N                             (Test adding a large NULL record)\n", a0);
-       fprintf(stderr, "%s -T                            (Test creating a large TXT record)\n", a0);
-       fprintf(stderr, "%s -M      (Test creating a registration with multiple TXT records)\n", a0);
-       fprintf(stderr, "%s -I   (Test registering and then immediately updating TXT record)\n", a0);
+       fprintf(stderr, "%s -E                  (Enumerate recommended registration domains)\n", progname);
+       fprintf(stderr, "%s -F                      (Enumerate recommended browsing domains)\n", progname);
+       fprintf(stderr, "%s -B        <Type> <Domain>        (Browse for services instances)\n", progname);
+       fprintf(stderr, "%s -L <Name> <Type> <Domain>           (Look up a service instance)\n", progname);
+       fprintf(stderr, "%s -R <Name> <Type> <Domain> <Port> [<TXT>...] (Register a service)\n", progname);
+       fprintf(stderr, "%s -P <Name> <Type> <Domain> <Port> <Host> <IP> [<TXT>...]  (Proxy)\n", progname);
+       fprintf(stderr, "%s -Q <FQDN> <rrtype> <rrclass> (Generic query for any record type)\n", progname);
+       fprintf(stderr, "%s -A                      (Test Adding/Updating/Deleting a record)\n", progname);
+       fprintf(stderr, "%s -U                                  (Test updating a TXT record)\n", progname);
+       fprintf(stderr, "%s -N                             (Test adding a large NULL record)\n", progname);
+       fprintf(stderr, "%s -T                            (Test creating a large TXT record)\n", progname);
+       fprintf(stderr, "%s -M      (Test creating a registration with multiple TXT records)\n", progname);
+       fprintf(stderr, "%s -I   (Test registering and then immediately updating TXT record)\n", progname);
        return 0;
        }
diff --git a/LICENSE b/LICENSE
deleted file mode 100644 (file)
index f458904..0000000
--- a/LICENSE
+++ /dev/null
@@ -1,13 +0,0 @@
-The majority of the source code in the mDNSResponder project is licensed
-under the terms of the Apache License, Version 2.0, available from:
-   <http://www.apache.org/licenses/LICENSE-2.0>
-
-To accommodate license compatibility with the widest possible range
-of client code licenses, the shared library code, which is linked
-at runtime into the same address space as the client using it, is
-licensed under the terms of the "Three-Clause BSD License".
-
-The Linux Name Service Switch code, contributed by National ICT
-Australia Ltd (NICTA) is licensed under the terms of the NICTA Public
-Software Licence (which is substantially similar to the "Three-Clause
-BSD License", with some additional language pertaining to Australian law).
index 61219d32bd5fed227f3e9de9e3134085113c9623..b6ce9e070ea3aa2bb177687c405b20ff52e5c6ee 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -16,7 +16,7 @@
 
 include /Developer/Makefiles/pb_makefiles/platform.make
 
-MVERS = "mDNSResponder-107.6"
+MVERS = "mDNSResponder-108"
 
 install:
        cd "$(SRCROOT)/mDNSMacOSX"; xcodebuild install     OBJROOT=$(OBJROOT) SYMROOT=$(SYMROOT) DSTROOT=$(DSTROOT) MVERS=$(MVERS)
index 08507b02e2227abbe27394a42c2918c90e861536..2ce24894e8665cb9216b3c06239340b2449742ad 100644 (file)
@@ -1,60 +1,28 @@
-/* -*- Mode: C; tab-width: 4 -*-
- *
+/*
  * Copyright (c) 2002-2003 Apple Computer, Inc. All rights reserved.
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * @APPLE_LICENSE_HEADER_START@
  * 
- *     http://www.apache.org/licenses/LICENSE-2.0
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
  * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
  * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
 
     Change History (most recent first):
 
 $Log: DNSCommon.c,v $
-Revision 1.100.2.1  2006/08/29 06:24:22  cheshire
-Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
-
-Revision 1.100  2006/06/08 22:58:46  cheshire
-<rdar://problem/4335605> IPv6 link-local address prefix is FE80::/10, not FE80::/16
-
-Revision 1.99  2006/05/18 01:32:33  cheshire
-<rdar://problem/4472706> iChat: Lost connection with Bonjour
-(mDNSResponder insufficiently defensive against malformed browsing PTR responses)
-
-Revision 1.98  2006/03/19 17:00:58  cheshire
-Define symbol MaxMsg instead of using hard-coded constant value '80'
-
-Revision 1.97  2006/03/18 21:47:56  cheshire
-<rdar://problem/4073825> Improve logic for delaying packets after repeated interface transitions
-
-Revision 1.96  2006/03/10 21:51:42  cheshire
-<rdar://problem/4111464> After record update, old record sometimes remains in cache
-Split out SameRDataBody() into a separate routine so it can be called from other code
-
-Revision 1.95  2006/03/08 22:43:11  cheshire
-Use "localdomain" symbol instead of literal string
-
-Revision 1.94  2006/03/02 21:59:55  cheshire
-<rdar://problem/4395331> Spurious warning "GetLargeResourceRecord: m->rec appears to be already in use"
-Improve sanity checks & debugging support in GetLargeResourceRecord()
-
-Revision 1.93  2006/03/02 20:30:47  cheshire
-Improved GetRRDisplayString to also show priority, weight, and port for SRV records
-
-Revision 1.92  2005/09/16 21:06:49  cheshire
-Use mDNS_TimeNow_NoLock macro, instead of writing "mDNSPlatformRawTime() + m->timenow_adjust" all over the place
-
-Revision 1.91  2005/07/10 22:10:37  cheshire
-The getOptRdata routine implicitly assumes the destination ResourceRecord is large enough to
-hold MaximumRDSize bytes, but its parameter was a generic ResourceRecord, which need not be that
-large. Changing the parameter to a LargeCacheRecord makes it clearer what the routine requires.
-
 Revision 1.90  2005/03/21 00:33:51  shersche
 <rdar://problem/4021486> Fix build warnings on Win32 platform
 
@@ -468,24 +436,22 @@ mDNSexport char *DNSTypeName(mDNSu16 rrtype)
 // long as this routine is only used for debugging messages, it probably isn't a big problem.
 mDNSexport char *GetRRDisplayString_rdb(const ResourceRecord *rr, RDataBody *rd, char *buffer)
        {
-       #define Max (MaxMsg-1)
        char *ptr = buffer;
-       mDNSu32 length = mDNS_snprintf(buffer, Max, "%4d %##s %s ", rr->rdlength, rr->name->c, DNSTypeName(rr->rrtype));
+       mDNSu32 length = mDNS_snprintf(buffer, 79, "%4d %##s %s ", rr->rdlength, rr->name->c, DNSTypeName(rr->rrtype));
        switch (rr->rrtype)
                {
-               case kDNSType_A:        mDNS_snprintf(buffer+length, Max-length, "%.4a", &rd->ipv4);          break;
+               case kDNSType_A:        mDNS_snprintf(buffer+length, 79-length, "%.4a", &rd->ipv4);          break;
 
                case kDNSType_NS:       // Same as PTR
                case kDNSType_CNAME:// Same as PTR
-               case kDNSType_PTR:      mDNS_snprintf(buffer+length, Max-length, "%##s", rd->name.c);       break;
+               case kDNSType_PTR:      mDNS_snprintf(buffer+length, 79-length, "%##s", rd->name.c);       break;
 
                case kDNSType_HINFO:// Display this the same as TXT (just show first string)
-               case kDNSType_TXT:  mDNS_snprintf(buffer+length, Max-length, "%#s", rd->txt.c);         break;
+               case kDNSType_TXT:  mDNS_snprintf(buffer+length, 79-length, "%#s", rd->txt.c);         break;
 
-               case kDNSType_AAAA:     mDNS_snprintf(buffer+length, Max-length, "%.16a", &rd->ipv6);       break;
-               case kDNSType_SRV:      mDNS_snprintf(buffer+length, Max-length, "%u %u %u %##s",
-                                                               rd->srv.priority, rd->srv.weight, mDNSVal16(rd->srv.port), rd->srv.target.c); break;
-               default:                        mDNS_snprintf(buffer+length, Max-length, "RDLen %d: %s", rr->rdlength, rd->data);  break;
+               case kDNSType_AAAA:     mDNS_snprintf(buffer+length, 79-length, "%.16a", &rd->ipv6);       break;
+               case kDNSType_SRV:      mDNS_snprintf(buffer+length, 79-length, "%##s", rd->srv.target.c); break;
+               default:                        mDNS_snprintf(buffer+length, 79-length, "RDLen %d: %s", rr->rdlength, rd->data);  break;
                }
        for (ptr = buffer; *ptr; ptr++) if (*ptr < ' ') *ptr='.';
        return(buffer);
@@ -507,14 +473,6 @@ mDNSexport mDNSu32 mDNSRandom(mDNSu32 max)
        return (seed & mask);
        }
 
-mDNSexport mDNSu32 mDNSRandomFromFixedSeed(mDNSu32 seed, mDNSu32 max)
-       {
-       mDNSu32 mask = 1;
-       while (mask < max) mask = (mask << 1) | 1;
-       do seed = seed * 21 + 1; while ((seed & mask) > max);
-       return (seed & mask);
-       }
-
 mDNSexport mDNSBool mDNSSameAddress(const mDNSAddr *ip1, const mDNSAddr *ip2)
        {
        if (ip1->type == ip2->type)
@@ -589,13 +547,10 @@ mDNSexport mDNSBool SameDomainName(const domainname *const d1, const domainname
 mDNSexport mDNSBool IsLocalDomain(const domainname *d)
        {
        // Domains that are defined to be resolved via link-local multicast are:
-       // local., 254.169.in-addr.arpa., and {8,9,A,B}.E.F.ip6.arpa.
-       static const domainname *nL = (domainname*)"\x5" "local";
-       static const domainname *nR = (domainname*)"\x3" "254" "\x3" "169"         "\x7" "in-addr" "\x4" "arpa";
-       static const domainname *n8 = (domainname*)"\x1" "8"   "\x1" "e" "\x1" "f" "\x3" "ip6"     "\x4" "arpa";
-       static const domainname *n9 = (domainname*)"\x1" "9"   "\x1" "e" "\x1" "f" "\x3" "ip6"     "\x4" "arpa";
-       static const domainname *nA = (domainname*)"\x1" "a"   "\x1" "e" "\x1" "f" "\x3" "ip6"     "\x4" "arpa";
-       static const domainname *nB = (domainname*)"\x1" "b"   "\x1" "e" "\x1" "f" "\x3" "ip6"     "\x4" "arpa";
+       // local., 254.169.in-addr.arpa., and 0.8.E.F.ip6.arpa.
+       static const domainname *n0 = (domainname*)"\x5" "local";
+       static const domainname *n1 = (domainname*)"\x3" "254" "\x3" "169"                     "\x7" "in-addr" "\x4" "arpa";
+       static const domainname *n2 = (domainname*)"\x1" "0"   "\x1" "8"   "\x1" "e" "\x1" "f" "\x3" "ip6"     "\x4" "arpa";
 
        const domainname *d1, *d2, *d3, *d4, *d5, *d6;  // Top-level domain, second-level domain, etc.
        d1 = d2 = d3 = d4 = d5 = d6 = mDNSNULL;
@@ -605,12 +560,9 @@ mDNSexport mDNSBool IsLocalDomain(const domainname *d)
                d = (domainname*)(d->c + 1 + d->c[0]);
                }
 
-       if (d1 && SameDomainName(d1, nL)) return(mDNStrue);
-       if (d4 && SameDomainName(d4, nR)) return(mDNStrue);
-       if (d6 && SameDomainName(d6, n8)) return(mDNStrue);
-       if (d6 && SameDomainName(d6, n9)) return(mDNStrue);
-       if (d6 && SameDomainName(d6, nA)) return(mDNStrue);
-       if (d6 && SameDomainName(d6, nB)) return(mDNStrue);
+       if (d1 && SameDomainName(d1, n0)) return(mDNStrue);
+       if (d4 && SameDomainName(d4, n1)) return(mDNStrue);
+       if (d6 && SameDomainName(d6, n2)) return(mDNStrue);
        return(mDNSfalse);
        }
 
@@ -911,7 +863,7 @@ mDNSexport mDNSu8 *ConstructServiceName(domainname *const fqdn,
 
        src = type->c;                                                                          // Put the service type into the domain name
        len = *src;
-       if (len < 2 || len >= 0x40 || (len > 15 && !SameDomainName(domain, &localdomain)))
+       if (len < 2 || len >= 0x40 || (len > 15 && !SameDomainName(domain, (domainname*)"\x05" "local")))
                {
                errormsg="Application protocol name must be underscore plus 1-14 characters. See <http://www.dns-sd.org/ServiceTypes.html>";
                goto fail;
@@ -944,11 +896,6 @@ fail:
        return(mDNSNULL);
        }
 
-// A service name has the form: instance.application-protocol.transport-protocol.domain
-// DeconstructServiceName is currently fairly forgiving: It doesn't try to enforce character
-// set or length limits for the protocol names, and the final domain is allowed to be empty.
-// However, if the given FQDN doesn't contain at least three labels,
-// DeconstructServiceName will reject it and return mDNSfalse.
 mDNSexport mDNSBool DeconstructServiceName(const domainname *const fqdn,
        domainlabel *const name, domainname *const type, domainname *const domain)
        {
@@ -957,32 +904,29 @@ mDNSexport mDNSBool DeconstructServiceName(const domainname *const fqdn,
        const mDNSu8 *max = fqdn->c + MAX_DOMAIN_NAME;
        mDNSu8 *dst;
 
-       dst = name->c;                                                                          // Extract the service name
+       dst = name->c;                                                                          // Extract the service name from the domain name
        len = *src;
-       if (!len)        { debugf("DeconstructServiceName: FQDN empty!");            return(mDNSfalse); }
-       if (len >= 0x40) { debugf("DeconstructServiceName: Instance name too long"); return(mDNSfalse); }
+       if (len >= 0x40) { debugf("DeconstructServiceName: service name too long"); return(mDNSfalse); }
        for (i=0; i<=len; i++) *dst++ = *src++;
 
-       dst = type->c;                                                                          // Extract the service type
+       dst = type->c;                                                                          // Extract the service type from the domain name
        len = *src;
-       if (!len)        { debugf("DeconstructServiceName: FQDN contains only one label!");      return(mDNSfalse); }
-       if (len >= 0x40) { debugf("DeconstructServiceName: Application protocol name too long"); return(mDNSfalse); }
+       if (len >= 0x40) { debugf("DeconstructServiceName: service type too long"); return(mDNSfalse); }
        for (i=0; i<=len; i++) *dst++ = *src++;
 
        len = *src;
-       if (!len)        { debugf("DeconstructServiceName: FQDN contains only two labels!");   return(mDNSfalse); }
-       if (len >= 0x40) { debugf("DeconstructServiceName: Transport protocol name too long"); return(mDNSfalse); }
+       if (len >= 0x40) { debugf("DeconstructServiceName: service type too long"); return(mDNSfalse); }
        for (i=0; i<=len; i++) *dst++ = *src++;
-       *dst++ = 0;                                                                                     // Put terminator on the end of service type
+       *dst++ = 0;             // Put the null root label on the end of the service type
 
-       dst = domain->c;                                                                        // Extract the service domain
+       dst = domain->c;                                                                        // Extract the service domain from the domain name
        while (*src)
                {
                len = *src;
                if (len >= 0x40)
-                       { debugf("DeconstructServiceName: Label in service domain too long"); return(mDNSfalse); }
+                       { debugf("DeconstructServiceName: service domain label too long"); return(mDNSfalse); }
                if (src + 1 + len + 1 >= max)
-                       { debugf("DeconstructServiceName: Total service domain too long"); return(mDNSfalse); }
+                       { debugf("DeconstructServiceName: service domain too long"); return(mDNSfalse); }
                for (i=0; i<=len; i++) *dst++ = *src++;
                }
        *dst++ = 0;             // Put the null root label on the end
@@ -1148,32 +1092,25 @@ mDNSexport mDNSu32 RDataHashValue(mDNSu16 const rdlength, const RDataBody *const
        return(sum);
        }
 
-// r1 has to be a full ResourceRecord including rrtype and rdlength
-// r2 is just a bare RDataBody, which MUST be the same rrtype and rdlength as r1
-mDNSexport mDNSBool SameRDataBody(const ResourceRecord *const r1, const RDataBody *const r2)
+mDNSexport mDNSBool SameRData(const ResourceRecord *const r1, const ResourceRecord *const r2)
        {
+       if (r1->rrtype     != r2->rrtype)     return(mDNSfalse);
+       if (r1->rdlength   != r2->rdlength)   return(mDNSfalse);
+       if (r1->rdatahash  != r2->rdatahash)  return(mDNSfalse);
        switch(r1->rrtype)
                {
                case kDNSType_CNAME:// Same as PTR
-               case kDNSType_PTR:      return(SameDomainName(&r1->rdata->u.name, &r2->name));
+               case kDNSType_PTR:      return(SameDomainName(&r1->rdata->u.name, &r2->rdata->u.name));
 
-               case kDNSType_SRV:      return(mDNSBool)(       r1->rdata->u.srv.priority          == r2->srv.priority          &&
-                                                                                               r1->rdata->u.srv.weight            == r2->srv.weight            &&
-                                                                                               r1->rdata->u.srv.port.NotAnInteger == r2->srv.port.NotAnInteger &&
-                                                                                               SameDomainName(&r1->rdata->u.srv.target, &r2->srv.target)       );
+               case kDNSType_SRV:      return(mDNSBool)(       r1->rdata->u.srv.priority          == r2->rdata->u.srv.priority          &&
+                                                                                               r1->rdata->u.srv.weight            == r2->rdata->u.srv.weight            &&
+                                                                                               r1->rdata->u.srv.port.NotAnInteger == r2->rdata->u.srv.port.NotAnInteger &&
+                                                                                               SameDomainName(&r1->rdata->u.srv.target, &r2->rdata->u.srv.target)       );
 
-               default:                        return(mDNSPlatformMemSame(r1->rdata->u.data, r2->data, r1->rdlength));
+               default:                        return(mDNSPlatformMemSame(r1->rdata->u.data, r2->rdata->u.data, r1->rdlength));
                }
        }
 
-mDNSexport mDNSBool SameRData(const ResourceRecord *const r1, const ResourceRecord *const r2)
-       {
-       if (r1->rrtype     != r2->rrtype)     return(mDNSfalse);
-       if (r1->rdlength   != r2->rdlength)   return(mDNSfalse);
-       if (r1->rdatahash  != r2->rdatahash)  return(mDNSfalse);
-       return(SameRDataBody(r1, &r2->rdata->u));
-       }
-
 mDNSexport mDNSBool SameResourceRecord(ResourceRecord *r1, ResourceRecord *r2)
        {
        return (r1->namehash == r2->namehash &&
@@ -1446,10 +1383,9 @@ mDNSlocal mDNSu16 getVal16(const mDNSu8 **ptr)
        return val;
        }
 
-mDNSlocal const mDNSu8 *getOptRdata(const mDNSu8 *ptr, const mDNSu8 *const limit, LargeCacheRecord *const cr, mDNSu16 pktRDLen)
+mDNSlocal const mDNSu8 *getOptRdata(const mDNSu8 *ptr, const mDNSu8 *limit, ResourceRecord *rr, mDNSu16 pktRDLen)
        {
        int nread = 0;
-       ResourceRecord *const rr = &cr->r.resrec;
        rdataOpt *opt = (rdataOpt *)rr->rdata->u.data;
 
        while (nread < pktRDLen && (mDNSu8 *)opt < rr->rdata->u.data + MaximumRDSize - sizeof(rdataOpt))
@@ -1851,10 +1787,11 @@ mDNSexport const mDNSu8 *GetLargeResourceRecord(mDNS *const m, const DNSMessage
        CacheRecord *rr = &largecr->r;
        mDNSu16 pktrdlength;
        
-       if (largecr == &m->rec && largecr->r.resrec.RecordType)
-               LogMsg("GetLargeResourceRecord: m->rec appears to be already in use for %s", CRDisplayString(m, &largecr->r));
+       if (largecr == &m->rec && rr->resrec.RecordType)
+               LogMsg("GetLargeResourceRecord: m->rec appears to be already in use");
 
        rr->next              = mDNSNULL;
+       rr->resrec.RecordType = RecordType;
        rr->resrec.name       = &largecr->namestorage;
 
        rr->NextInKAList      = mDNSNULL;
@@ -1886,7 +1823,7 @@ mDNSexport const mDNSu8 *GetLargeResourceRecord(mDNS *const m, const DNSMessage
        // us to look at. If we decide to copy it into the cache, then we'll update m->NextCacheCheck accordingly.
        pktrdlength           = (mDNSu16)((mDNSu16)ptr[8] <<  8 | ptr[9]);
        if (ptr[2] & (kDNSClass_UniqueRRSet >> 8))
-               RecordType |= kDNSRecordTypePacketUniqueMask;
+               rr->resrec.RecordType |= kDNSRecordTypePacketUniqueMask;
        ptr += 10;
        if (ptr + pktrdlength > end) { debugf("GetResourceRecord: RDATA exceeds end of packet"); return(mDNSNULL); }
        end = ptr + pktrdlength;                // Adjust end to indicate the end of the rdata for this resource record
@@ -1947,7 +1884,7 @@ mDNSexport const mDNSu8 *GetLargeResourceRecord(mDNS *const m, const DNSMessage
                                        rr->resrec.rdata->u.soa.min     = (mDNSu32) ((mDNSu32)ptr[0x10] << 24 | (mDNSu32)ptr[0x11] << 16 | (mDNSu32)ptr[0x12] << 8 | ptr[0x13]);
                                        break;
 
-               case kDNSType_OPT:  getOptRdata(ptr, end, largecr, pktrdlength); break;
+               case kDNSType_OPT:  getOptRdata(ptr, end, &rr->resrec, pktrdlength); break;
 
                default:                        if (pktrdlength > rr->resrec.rdata->MaxRDLength)
                                                                {
@@ -1970,8 +1907,6 @@ mDNSexport const mDNSu8 *GetLargeResourceRecord(mDNS *const m, const DNSMessage
        rr->resrec.namehash = DomainNameHashValue(rr->resrec.name);
        SetNewRData(&rr->resrec, mDNSNULL, 0);
 
-       // Success! Now fill in RecordType to show this record contains valid data
-       rr->resrec.RecordType = RecordType;
        return(ptr + pktrdlength);
        }
 
@@ -2112,14 +2047,14 @@ mDNSexport void mDNS_Lock(mDNS *const m)
        if (m->mDNS_busy == 0)
                {
                if (m->timenow)
-                       LogMsg("mDNS_Lock: m->timenow already set (%ld/%ld)", m->timenow, mDNS_TimeNow_NoLock(m));
-               m->timenow = mDNS_TimeNow_NoLock(m);
+                       LogMsg("mDNS_Lock: m->timenow already set (%ld/%ld)", m->timenow, mDNSPlatformRawTime() + m->timenow_adjust);
+               m->timenow = mDNSPlatformRawTime() + m->timenow_adjust;
                if (m->timenow == 0) m->timenow = 1;
                }
        else if (m->timenow == 0)
                {
                LogMsg("mDNS_Lock: m->mDNS_busy is %ld but m->timenow not set", m->mDNS_busy);
-               m->timenow = mDNS_TimeNow_NoLock(m);
+               m->timenow = mDNSPlatformRawTime() + m->timenow_adjust;
                if (m->timenow == 0) m->timenow = 1;
                }
 
index 3ec6fc346e23548331e9e1c179ea2a755cfa2e15..13b7ca80f2bc64dbbd1cf8d41316b63559e986c6 100644 (file)
@@ -1,32 +1,28 @@
-/* -*- Mode: C; tab-width: 4 -*-
- *
+/*
  * Copyright (c) 2002-2003 Apple Computer, Inc. All rights reserved.
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * @APPLE_LICENSE_HEADER_START@
  * 
- *     http://www.apache.org/licenses/LICENSE-2.0
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
  * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
  * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
 
     Change History (most recent first):
 
 $Log: DNSCommon.h,v $
-Revision 1.34.2.1  2006/08/29 06:24:22  cheshire
-Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
-
-Revision 1.34  2006/03/18 21:47:56  cheshire
-<rdar://problem/4073825> Improve logic for delaying packets after repeated interface transitions
-
-Revision 1.33  2006/03/10 21:51:41  cheshire
-<rdar://problem/4111464> After record update, old record sometimes remains in cache
-Split out SameRDataBody() into a separate routine so it can be called from other code
-
 Revision 1.32  2005/03/21 00:33:51  shersche
 <rdar://problem/4021486> Fix build warnings on Win32 platform
 
@@ -145,7 +141,6 @@ Revision 1.1  2003/12/13 03:05:27  ksekar
        extern "C" {
 #endif
 
-
 // ***************************************************************************
 #if COMPILER_LIKES_PRAGMA_MARK
 #pragma mark - DNS Protocol Constants
@@ -197,7 +192,6 @@ typedef enum
        TSIG_ErrBadTime = 18
        } TSIG_ErrorCode;
        
-
 // ***************************************************************************
 #if COMPILER_LIKES_PRAGMA_MARK
 #pragma mark -
@@ -208,7 +202,6 @@ extern const NetworkInterfaceInfo *GetFirstActiveInterface(const NetworkInterfac
 extern mDNSInterfaceID GetNextActiveInterfaceID(const NetworkInterfaceInfo *intf);
 
 extern mDNSu32 mDNSRandom(mDNSu32 max);
-extern mDNSu32 mDNSRandomFromFixedSeed(mDNSu32 seed, mDNSu32 max);
 
 
 // ***************************************************************************
@@ -242,7 +235,6 @@ extern void mDNS_HostNameCallback(mDNS *const m, AuthRecord *const rr, mStatus r
 
 extern mDNSu32 RDataHashValue(mDNSu16 const rdlength, const RDataBody *const rdb);
 
-extern mDNSBool SameRDataBody(const ResourceRecord *const r1, const RDataBody *const r2);
 extern mDNSBool SameRData(const ResourceRecord *const r1, const ResourceRecord *const r2);
 
 extern mDNSBool ResourceRecordAnswersQuestion(const ResourceRecord *const rr, const DNSQuestion *const q);
@@ -338,7 +330,6 @@ extern const mDNSu8 *LocateAuthorities(const DNSMessage *const msg, const mDNSu8
 
 extern const mDNSu8 *LocateAdditionals(const DNSMessage *const msg, const mDNSu8 *const end);
 
-
 // ***************************************************************************
 #if COMPILER_LIKES_PRAGMA_MARK
 #pragma mark -
@@ -349,7 +340,6 @@ extern const mDNSu8 *LocateAdditionals(const DNSMessage *const msg, const mDNSu8
 extern mStatus mDNSSendDNSMessage(const mDNS *const m, DNSMessage *const msg, mDNSu8 *end,
        mDNSInterfaceID InterfaceID, const mDNSAddr *dst, mDNSIPPort dstport, int sd, uDNS_AuthInfo *authInfo);
 
-
 // ***************************************************************************
 #if COMPILER_LIKES_PRAGMA_MARK
 #pragma mark -
index 91b7078cc9ba4088aaa7b29b616474aa20d32a80..89d7b013fd835b80f4d5d161eec39b94c0b26ff8 100644 (file)
@@ -1,31 +1,28 @@
-/* -*- Mode: C; tab-width: 4 -*-
- *
+/*
  * Copyright (c) 2002-2003 Apple Computer, Inc. All rights reserved.
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * @APPLE_LICENSE_HEADER_START@
  * 
- *     http://www.apache.org/licenses/LICENSE-2.0
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
  * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
  * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
 
     Change History (most recent first):
 
 $Log: DNSDigest.c,v $
-Revision 1.15.2.1  2006/08/29 06:24:22  cheshire
-Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
-
-Revision 1.15  2006/06/20 04:12:30  cheshire
-<rdar://problem/4490961> DNS Update broken
-
-Revision 1.14  2006/02/25 23:12:07  cheshire
-<rdar://problem/4427969> Fix to avoid code generation warning/error on FreeBSD 7
-
 Revision 1.13  2004/12/16 20:12:59  cheshire
 <rdar://problem/3324626> Cache memory management improvements
 
@@ -1413,11 +1410,12 @@ mDNSexport mDNSu8 *DNSDigest_SignMessage(DNSMessage *msg, mDNSu8 **end, mDNSu16
        rdata += 6;                     
        MD5_Update(&c, utc48, 6);
 
-       // 300 sec is fudge recommended in RFC 2485
-       rdata[0] = (mDNSu8)((300 >> 8)  & 0xff);
-       rdata[1] = (mDNSu8)( 300        & 0xff);
-       MD5_Update(&c, rdata, sizeof(mDNSOpaque16));
+       // fudge
+       buf = mDNSOpaque16fromIntVal(300);     // 300 sec is fudge recommended in RFC 2485
+       rdata[0] = buf.b[0];
+       rdata[1] = buf.b[1];
        rdata += sizeof(mDNSOpaque16);
+       MD5_Update(&c, buf.b, sizeof(mDNSOpaque16));
 
        // digest error and other data len (both zero) - we'll add them to the rdata later
        buf.NotAnInteger = 0;
index 4eb871982aa0cd396101bae0755c8939d2505b15..db6d0e537fbeb6f4fd98ba9e55cdfb96f4b1c402 100755 (executable)
@@ -1,18 +1,25 @@
 /* -*- Mode: C; tab-width: 4 -*-
  *
- * Copyright (c) 2002-2006 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2002-2003 Apple Computer, Inc. All rights reserved.
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * @APPLE_LICENSE_HEADER_START@
  * 
- *     http://www.apache.org/licenses/LICENSE-2.0
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
  * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
  * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
  *
  * This code is completely 100% portable C. It does not depend on any external header files
  * from outside the mDNS project -- all the types it expects to find are defined right here.
     Change History (most recent first):
 
 $Log: mDNS.c,v $
-Revision 1.537.2.1  2006/08/29 06:24:22  cheshire
-Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
-
-Revision 1.537  2006/03/19 02:00:07  cheshire
-<rdar://problem/4073825> Improve logic for delaying packets after repeated interface transitions
-
-Revision 1.536  2006/03/08 23:29:53  cheshire
-<rdar://problem/4468716> Improve "Service Renamed" log message
-
-Revision 1.535  2006/03/02 20:41:17  cheshire
-<rdar://problem/4111464> After record update, old record sometimes remains in cache
-Minor code tidying and comments to reduce the risk of similar programming errors in future
-
-Revision 1.534  2006/03/02 03:25:46  cheshire
-<rdar://problem/4111464> After record update, old record sometimes remains in cache
-Code to harmonize RRSet TTLs was inadvertently rescuing expiring records
-
-Revision 1.533  2006/02/26 00:54:41  cheshire
-Fixes to avoid code generation warning/error on FreeBSD 7
-
-Revision 1.532  2005/12/02 20:24:36  cheshire
-<rdar://problem/4363209> Adjust cutoff time for KA list by one second
-
-Revision 1.531  2005/12/02 19:05:42  cheshire
-Tidy up constants
-
-Revision 1.530  2005/11/07 01:49:48  cheshire
-For consistency, use NonZeroTime() function instead of ?: expression
-
-Revision 1.529  2005/10/25 23:42:24  cheshire
-<rdar://problem/4316057> Error in ResolveSimultaneousProbe() when type or class don't match
-Changed switch statement to an "if"
-
-Revision 1.528  2005/10/25 23:34:22  cheshire
-<rdar://problem/4316048> RequireGoodbye state not set/respected sometimes when machine going to sleep
-
-Revision 1.527  2005/10/25 22:43:59  cheshire
-Add clarifying comments
-
 Revision 1.526  2005/10/20 00:10:33  cheshire
 <rdar://problem/4290265> Add check to avoid crashing NAT gateways that have buggy DNS relay code
 
@@ -1769,28 +1737,22 @@ mDNSexport const mDNSInterfaceID mDNSInterface_LocalOnly  = (mDNSInterfaceID)1;
 
 mDNSlocal  const mDNSInterfaceID mDNSInterfaceMark        = (mDNSInterfaceID)~0;
 
-#define UnicastDNSPortAsNumber   53
-#define NATPMPPortAsNumber       5351
-#define DNSEXTPortAsNumber       5352          // Port used for end-to-end DNS operations like LLQ, Updates with Leases, etc.
+#define UnicastDNSPortAsNumber 53
 #define MulticastDNSPortAsNumber 5353
-#define LoopbackIPCPortAsNumber  5354
-
 mDNSexport const mDNSIPPort UnicastDNSPort     = { { UnicastDNSPortAsNumber   >> 8, UnicastDNSPortAsNumber   & 0xFF } };
-mDNSexport const mDNSIPPort NATPMPPort         = { { NATPMPPortAsNumber       >> 8, NATPMPPortAsNumber       & 0xFF } };
-mDNSexport const mDNSIPPort DNSEXTPort         = { { DNSEXTPortAsNumber       >> 8, DNSEXTPortAsNumber       & 0xFF } };
 mDNSexport const mDNSIPPort MulticastDNSPort   = { { MulticastDNSPortAsNumber >> 8, MulticastDNSPortAsNumber & 0xFF } };
-mDNSexport const mDNSIPPort LoopbackIPCPort    = { { LoopbackIPCPortAsNumber  >> 8, LoopbackIPCPortAsNumber  & 0xFF } };
-
 mDNSexport const mDNSv4Addr AllDNSAdminGroup   = { { 239, 255, 255, 251 } };
+mDNSexport const mDNSv4Addr AllDNSLinkGroupv4  = { { 224,   0,   0, 251 } };
+mDNSexport const mDNSv6Addr AllDNSLinkGroupv6  = { { 0xFF,0x02,0x00,0x00, 0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0xFB } };
 mDNSexport const mDNSAddr   AllDNSLinkGroup_v4 = { mDNSAddrType_IPv4, { { { 224,   0,   0, 251 } } } };
 mDNSexport const mDNSAddr   AllDNSLinkGroup_v6 = { mDNSAddrType_IPv6, { { { 0xFF,0x02,0x00,0x00, 0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0xFB } } } };
 
-mDNSexport const mDNSOpaque16 zeroID          = { { 0, 0 } };
-mDNSexport const mDNSOpaque16 QueryFlags      = { { kDNSFlag0_QR_Query    | kDNSFlag0_OP_StdQuery,                0 } };
-mDNSexport const mDNSOpaque16 uQueryFlags     = { { kDNSFlag0_QR_Query    | kDNSFlag0_OP_StdQuery | kDNSFlag0_RD, 0 } };
-mDNSexport const mDNSOpaque16 ResponseFlags   = { { kDNSFlag0_QR_Response | kDNSFlag0_OP_StdQuery | kDNSFlag0_AA, 0 } };
-mDNSexport const mDNSOpaque16 UpdateReqFlags  = { { kDNSFlag0_QR_Query    | kDNSFlag0_OP_Update,                  0 } };
-mDNSexport const mDNSOpaque16 UpdateRespFlags = { { kDNSFlag0_QR_Response | kDNSFlag0_OP_Update,                  0 } };
+mDNSexport const mDNSOpaque16 zeroID = { { 0, 0 } };
+mDNSexport const mDNSOpaque16 QueryFlags    = { { kDNSFlag0_QR_Query    | kDNSFlag0_OP_StdQuery,                0 } };
+mDNSexport const mDNSOpaque16 uQueryFlags   = { { kDNSFlag0_QR_Query    | kDNSFlag0_OP_StdQuery | kDNSFlag0_RD, 0 } };
+mDNSexport const mDNSOpaque16 ResponseFlags = { { kDNSFlag0_QR_Response | kDNSFlag0_OP_StdQuery | kDNSFlag0_AA, 0 } };
+mDNSexport const mDNSOpaque16 UpdateReqFlags= { { kDNSFlag0_QR_Query    | kDNSFlag0_OP_Update,                  0 } };
+mDNSexport const mDNSOpaque16 UpdateRespFlags={ { kDNSFlag0_QR_Response | kDNSFlag0_OP_Update,                  0 } };
 
 // Any records bigger than this are considered 'large' records
 #define SmallRecordLimit 1024
@@ -1970,8 +1932,8 @@ mDNSexport mDNSu32 mDNS_vsnprintf(char *sbuffer, mDNSu32 buflen, const char *fmt
                                                                                                                "%02X%02X:%02X%02X:%02X%02X:%02X%02X:%02X%02X:%02X%02X:%02X%02X:%02X%02X",
                                                                                                                a[0x0], a[0x1], a[0x2], a[0x3], a[0x4], a[0x5], a[0x6], a[0x7],
                                                                                                                a[0x8], a[0x9], a[0xA], a[0xB], a[0xC], a[0xD], a[0xE], a[0xF]); break;
-                                                                       default: i = mDNS_snprintf(mDNS_VACB, sizeof(mDNS_VACB), "%s", "<< ERROR: Must specify"
-                                                                                                               " address size (i.e. %.4a=IPv4, %.6a=Ethernet, %.16a=IPv6) >>"); break;
+                                                                       default: i = mDNS_snprintf(mDNS_VACB, sizeof(mDNS_VACB), "%s", "<< ERROR: Must specify address size "
+                                                                                                               "(i.e. %.4a=IPv4, %.6a=Ethernet, %.16a=IPv6) >>"); break;
                                                                        }
                                                                }
                                                        }
@@ -2043,10 +2005,8 @@ mDNSexport mDNSu32 mDNS_vsnprintf(char *sbuffer, mDNSu32 buflen, const char *fmt
                                                                                if (*a == 0) *s++ = '.';        // Special case for root DNS name
                                                                                while (*a)
                                                                                        {
-                                                                                       if (*a > 63)
-                                                                                               { s += mDNS_snprintf(s, mDNS_VACB_Remain(s), "<<INVALID LABEL LENGTH %u>>", *a); break; }
-                                                                                       if (s + *a >= &mDNS_VACB[254])
-                                                                                               { s += mDNS_snprintf(s, mDNS_VACB_Remain(s), "<<NAME TOO LONG>>"); break; }
+                                                                                       if (*a > 63) { s += mDNS_snprintf(s, mDNS_VACB_Remain(s), "<<INVALID LABEL LENGTH %u>>", *a); break; }
+                                                                                       if (s + *a >= &mDNS_VACB[254]) { s += mDNS_snprintf(s, mDNS_VACB_Remain(s), "<<NAME TOO LONG>>"); break; }
                                                                                        s += mDNS_snprintf(s, mDNS_VACB_Remain(s), "%#s.", a);
                                                                                        a += 1 + *a;
                                                                                        }
@@ -2081,10 +2041,9 @@ mDNSexport mDNSu32 mDNS_vsnprintf(char *sbuffer, mDNSu32 buflen, const char *fmt
                                        } while (i < --F.fieldWidth);
        
                        // Make sure we don't truncate in the middle of a UTF-8 character.
-                       // Note: s[i] is the first eliminated character; i.e. the next character *after* the last character of the
-                       // allowed output. If s[i] is a UTF-8 continuation character, then we've cut a unicode character in half,
-                       // so back up 'i' until s[i] is no longer a UTF-8 continuation character. (if the input was proprly
-                       // formed, s[i] will now be the UTF-8 start character of the multi-byte character we just eliminated).
+                       // Note: s[i] is the first eliminated character; i.e. the next character *after* the last character of the allowed output. If s[i] is a
+                       // UTF-8 continuation character, then we've cut a unicode character in half, so back up 'i' until s[i] is no longer a UTF-8 continuation
+                       // character. (if the input was proprly formed, s[i] will now be the UTF-8 start character of the multi-byte character we just eliminated).
                        if (i > buflen - nwritten)
                                { i = buflen - nwritten; while (i>0 && (s[i] & 0xC0) == 0x80) i--; }
                        for (j=0; j<i; j++) *sbuffer++ = *s++;                  // Write the converted result
@@ -2234,8 +2193,8 @@ mDNSlocal void AnswerLocalOnlyQuestionWithResourceRecord(mDNS *const m, DNSQuest
        m->mDNS_reentrancy--; // Decrement to block mDNS API calls again
        }
 
-// When a new local AuthRecord is created or deleted, AnswerLocalQuestions() runs though our LocalOnlyQuestions delivering answers
-// to each, stopping if it reaches a NewLocalOnlyQuestion -- brand-new questions are handled by AnswerNewLocalOnlyQuestion().
+// When a new local AuthRecord is created or deleted, AnswerLocalQuestions() runs though our LocalOnlyQuestions delivering answers to each,
+// stopping if it reaches a NewLocalOnlyQuestion -- brand-new questions are handled by AnswerNewLocalOnlyQuestion().
 // If the AuthRecord is marked mDNSInterface_LocalOnly, then we also deliver it to any other questions we have using mDNSInterface_Any.
 // Used by AnswerForNewLocalRecords() and mDNS_Deregister_internal()
 mDNSlocal void AnswerLocalQuestions(mDNS *const m, AuthRecord *rr, mDNSBool AddRecord)
@@ -2321,11 +2280,7 @@ mDNSlocal mDNSBool SameResourceRecordSignature(const ResourceRecord *const r1, c
        if (r1->InterfaceID &&
                r2->InterfaceID &&
                r1->InterfaceID != r2->InterfaceID) return(mDNSfalse);
-       return(mDNSBool)(
-               r1->rrtype == r2->rrtype &&
-               r1->rrclass == r2->rrclass &&
-               r1->namehash == r2->namehash &&
-               SameDomainName(r1->name, r2->name));
+       return(mDNSBool)(r1->rrtype == r2->rrtype && r1->rrclass == r2->rrclass && r1->namehash == r2->namehash && SameDomainName(r1->name, r2->name));
        }
 
 // PacketRRMatchesSignature behaves as SameResourceRecordSignature, except that types may differ if our
@@ -2341,10 +2296,7 @@ mDNSlocal mDNSBool PacketRRMatchesSignature(const CacheRecord *const pktrr, cons
                authrr->resrec.InterfaceID &&
                pktrr->resrec.InterfaceID != authrr->resrec.InterfaceID) return(mDNSfalse);
        if (!(authrr->resrec.RecordType & kDNSRecordTypeUniqueMask) && pktrr->resrec.rrtype != authrr->resrec.rrtype) return(mDNSfalse);
-       return(mDNSBool)(
-               pktrr->resrec.rrclass == authrr->resrec.rrclass &&
-               pktrr->resrec.namehash == authrr->resrec.namehash &&
-               SameDomainName(pktrr->resrec.name, authrr->resrec.name));
+       return(mDNSBool)(pktrr->resrec.rrclass == authrr->resrec.rrclass && pktrr->resrec.namehash == authrr->resrec.namehash && SameDomainName(pktrr->resrec.name, authrr->resrec.name));
        }
 
 // IdenticalResourceRecord returns true if two resources records have
@@ -2353,8 +2305,7 @@ mDNSlocal mDNSBool IdenticalResourceRecord(const ResourceRecord *const r1, const
        {
        if (!r1) { LogMsg("IdenticalResourceRecord ERROR: r1 is NULL"); return(mDNSfalse); }
        if (!r2) { LogMsg("IdenticalResourceRecord ERROR: r2 is NULL"); return(mDNSfalse); }
-       if (r1->rrtype != r2->rrtype || r1->rrclass != r2->rrclass || r1->namehash != r2->namehash || !SameDomainName(r1->name, r2->name))
-               return(mDNSfalse);
+       if (r1->rrtype != r2->rrtype || r1->rrclass != r2->rrclass || r1->namehash != r2->namehash || !SameDomainName(r1->name, r2->name)) return(mDNSfalse);
        return(SameRData(r1, r2));
        }
 
@@ -2386,8 +2337,7 @@ mDNSlocal void SetNextAnnounceProbeTime(mDNS *const m, const AuthRecord *const r
        {
        if (rr->resrec.RecordType == kDNSRecordTypeUnique)
                {
-               //LogMsg("ProbeCount %d Next %ld %s",
-               //      rr->ProbeCount, (rr->LastAPTime + rr->ThisAPInterval) - m->timenow, ARDisplayString(m, rr));
+               //LogMsg("ProbeCount %d Next %ld %s", rr->ProbeCount, (rr->LastAPTime + rr->ThisAPInterval) - m->timenow, ARDisplayString(m, rr));
                if (m->NextScheduledProbe - (rr->LastAPTime + rr->ThisAPInterval) >= 0)
                        m->NextScheduledProbe = (rr->LastAPTime + rr->ThisAPInterval);
                }
@@ -2467,8 +2417,7 @@ mDNSlocal void SetTargetToHostName(mDNS *const m, AuthRecord *const rr)
                // changing to the new rdata. However, in practice, we only do SetTargetToHostName for unique records,
                // so when we announce them we'll set the kDNSClass_UniqueRRSet and clear any stale data that way.
                if (rr->RequireGoodbye && rr->resrec.RecordType == kDNSRecordTypeShared)
-                       debugf("Have announced shared record %##s (%s) at least once: should have sent a goodbye packet before updating",
-                               rr->resrec.name->c, DNSTypeName(rr->resrec.rrtype));
+                       debugf("Have announced shared record %##s (%s) at least once: should have sent a goodbye packet before updating", rr->resrec.name->c, DNSTypeName(rr->resrec.rrtype));
 
                rr->AnnounceCount  = InitialAnnounceCount;
                rr->RequireGoodbye = mDNSfalse;
@@ -2491,10 +2440,8 @@ mDNSlocal void AcknowledgeRecord(mDNS *const m, AuthRecord *const rr)
        }
 
 // Two records qualify to be local duplicates if the RecordTypes are the same, or if one is Unique and the other Verified
-#define RecordLDT(A,B) ((A)->resrec.RecordType == (B)->resrec.RecordType || \
-       ((A)->resrec.RecordType | (B)->resrec.RecordType) == (kDNSRecordTypeUnique | kDNSRecordTypeVerified))
-#define RecordIsLocalDuplicate(A,B) \
-       ((A)->resrec.InterfaceID == (B)->resrec.InterfaceID && RecordLDT((A),(B)) && IdenticalResourceRecord(&(A)->resrec, &(B)->resrec))
+#define RecordLDT(A,B) ((A)->resrec.RecordType == (B)->resrec.RecordType || ((A)->resrec.RecordType | (B)->resrec.RecordType) == (kDNSRecordTypeUnique | kDNSRecordTypeVerified))
+#define RecordIsLocalDuplicate(A,B) ((A)->resrec.InterfaceID == (B)->resrec.InterfaceID && RecordLDT((A),(B)) && IdenticalResourceRecord(&(A)->resrec, &(B)->resrec))
 
 mDNSlocal mStatus mDNS_Register_internal(mDNS *const m, AuthRecord *const rr)
        {
@@ -2518,8 +2465,7 @@ mDNSlocal mStatus mDNS_Register_internal(mDNS *const m, AuthRecord *const rr)
        while (*d && *d != rr) d=&(*d)->next;
        if (*d || *p)
                {
-               LogMsg("Error! Tried to register a AuthRecord %p %##s (%s) that's already in the list",
-                       rr, rr->resrec.name->c, DNSTypeName(rr->resrec.rrtype));
+               LogMsg("Error! Tried to register a AuthRecord %p %##s (%s) that's already in the list", rr, rr->resrec.name->c, DNSTypeName(rr->resrec.rrtype));
                return(mStatus_AlreadyRegistered);
                }
 
@@ -2745,8 +2691,7 @@ mDNSlocal mStatus mDNS_Deregister_internal(mDNS *const m, AuthRecord *const rr,
                        if (*d)
                                {
                                AuthRecord *dup = *d;
-                               debugf("Duplicate record %p taking over from %p %##s (%s)",
-                                       dup, rr, rr->resrec.name->c, DNSTypeName(rr->resrec.rrtype));
+                               debugf("Duplicate record %p taking over from %p %##s (%s)", dup, rr, rr->resrec.name->c, DNSTypeName(rr->resrec.rrtype));
                                *d        = dup->next;          // Cut replacement record from DuplicateRecords list
                                dup->next = rr->next;           // And then...
                                rr->next  = dup;                        // ... splice it in right after the record we're about to delete
@@ -2775,16 +2720,14 @@ mDNSlocal mStatus mDNS_Deregister_internal(mDNS *const m, AuthRecord *const rr,
                while (*p && *p != rr) p=&(*p)->next;
                // If we found our record on the duplicate list, then make sure we don't send a goodbye for it
                if (*p) rr->RequireGoodbye = mDNSfalse;
-               if (*p) debugf("DNS_Deregister_internal: Deleting DuplicateRecord %p %##s (%s)",
-                       rr, rr->resrec.name->c, DNSTypeName(rr->resrec.rrtype));
+               if (*p) debugf("DNS_Deregister_internal: Deleting DuplicateRecord %p %##s (%s)", rr, rr->resrec.name->c, DNSTypeName(rr->resrec.rrtype));
                }
 
        if (!*p)
                {
                // No need to log an error message if we already know this is a potentially repeated deregistration
                if (drt != mDNS_Dereg_repeat)
-                       LogMsg("mDNS_Deregister_internal: Record %p %##s (%s) not found in list",
-                               rr, rr->resrec.name->c, DNSTypeName(rr->resrec.rrtype));
+                       LogMsg("mDNS_Deregister_internal: Record %p %##s (%s) not found in list", rr, rr->resrec.name->c, DNSTypeName(rr->resrec.rrtype));
                return(mStatus_BadReferenceErr);
                }
 
@@ -2792,8 +2735,7 @@ mDNSlocal mStatus mDNS_Deregister_internal(mDNS *const m, AuthRecord *const rr,
        // we need to retract that announcement before we delete the record
        if (RecordType == kDNSRecordTypeShared && rr->RequireGoodbye)
                {
-               verbosedebugf("mDNS_Deregister_internal: Sending deregister for %##s (%s)",
-                       rr->resrec.name->c, DNSTypeName(rr->resrec.rrtype));
+               verbosedebugf("mDNS_Deregister_internal: Sending deregister for %##s (%s)", rr->resrec.name->c, DNSTypeName(rr->resrec.rrtype));
                rr->resrec.RecordType    = kDNSRecordTypeDeregistering;
                rr->resrec.rroriginalttl = 0;
                rr->ImmedAnswer          = mDNSInterfaceMark;
@@ -2816,8 +2758,7 @@ mDNSlocal mStatus mDNS_Deregister_internal(mDNS *const m, AuthRecord *const rr,
                                rr->resrec.name->c, DNSTypeName(rr->resrec.rrtype));
                else
                        {
-                       verbosedebugf("mDNS_Deregister_internal: Deleting record for %##s (%s)",
-                               rr->resrec.name->c, DNSTypeName(rr->resrec.rrtype));
+                       verbosedebugf("mDNS_Deregister_internal: Deleting record for %##s (%s)", rr->resrec.name->c, DNSTypeName(rr->resrec.rrtype));
                        rr->resrec.RecordType = kDNSRecordTypeUnregistered;
                        }
 
@@ -3107,8 +3048,7 @@ mDNSlocal void SendResponses(mDNS *const m)
                                {
                                for (r2 = m->ResourceRecords; r2; r2=r2->next)
                                        if (ResourceRecordIsValidAnswer(r2))
-                                               if (r2->ImmedAnswer != mDNSInterfaceMark &&
-                                                       r2->ImmedAnswer != rr->ImmedAnswer && SameResourceRecordSignature(&r2->resrec, &rr->resrec))
+                                               if (r2->ImmedAnswer != mDNSInterfaceMark && r2->ImmedAnswer != rr->ImmedAnswer && SameResourceRecordSignature(&r2->resrec, &rr->resrec))
                                                        r2->ImmedAnswer = rr->ImmedAnswer;
                                }
                        else if (rr->ImmedAdditional)   // If we're sending this as additional, see that its whole RRSet is similarly marked
@@ -3181,7 +3121,7 @@ mDNSlocal void SendResponses(mDNS *const m)
                                        numDereg++;
                                        responseptr = newptr;
                                        }
-                               else if (rr->NewRData && !m->SleepState)                                        // If we have new data for this record
+                               else if (rr->NewRData)                                                  // If we have new data for this record
                                        {
                                        RData *OldRData     = rr->resrec.rdata;
                                        mDNSu16 oldrdlength = rr->resrec.rdlength;
@@ -3192,7 +3132,6 @@ mDNSlocal void SendResponses(mDNS *const m)
                                                if (!newptr && m->omsg.h.numAnswers) break;
                                                numDereg++;
                                                responseptr = newptr;
-                                               rr->RequireGoodbye = mDNSfalse;
                                                }
                                        // Now try to see if we can fit the update in the same packet (not fatal if we can't)
                                        SetNewRData(&rr->resrec, rr->NewRData, rr->newrdlength);
@@ -3200,7 +3139,7 @@ mDNSlocal void SendResponses(mDNS *const m)
                                                rr->resrec.rrclass |= kDNSClass_UniqueRRSet;            // Temporarily set the cache flush bit so PutResourceRecord will set it
                                        newptr = PutResourceRecord(&m->omsg, responseptr, &m->omsg.h.numAnswers, &rr->resrec);
                                        rr->resrec.rrclass &= ~kDNSClass_UniqueRRSet;                   // Make sure to clear cache flush bit back to normal state
-                                       if (newptr) { responseptr = newptr; rr->RequireGoodbye = mDNStrue; }
+                                       if (newptr) responseptr = newptr;
                                        SetNewRData(&rr->resrec, OldRData, oldrdlength);
                                        }
                                else
@@ -3342,11 +3281,10 @@ mDNSlocal void SendResponses(mDNS *const m)
 
 // Note: MUST call SetNextCacheCheckTime any time we change:
 // rr->TimeRcvd
+// rr->DelayDelivery
 // rr->resrec.rroriginalttl
 // rr->UnansweredQueries
 // rr->CRActiveQuestion
-// Also, any time we set rr->DelayDelivery we should call SetNextCacheCheckTime to ensure m->NextCacheCheck is set if necessary
-// Clearing rr->DelayDelivery does not require a call to SetNextCacheCheckTime
 mDNSlocal void SetNextCacheCheckTime(mDNS *const m, CacheRecord *const rr)
        {
        rr->NextRequiredQuery = RRExpireTime(rr);
@@ -3357,9 +3295,8 @@ mDNSlocal void SetNextCacheCheckTime(mDNS *const m, CacheRecord *const rr)
                {
                rr->NextRequiredQuery -= TicksTTL(rr)/20 * (MaxUnansweredQueries - rr->UnansweredQueries);
                rr->NextRequiredQuery += mDNSRandom((mDNSu32)TicksTTL(rr)/50);
-               verbosedebugf("SetNextCacheCheckTime: %##s (%s) NextRequiredQuery in %ld sec CacheCheckGracePeriod %d ticks",
-                       rr->resrec.name->c, DNSTypeName(rr->resrec.rrtype),
-                       (rr->NextRequiredQuery - m->timenow) / mDNSPlatformOneSecond, CacheCheckGracePeriod(rr));
+               verbosedebugf("SetNextCacheCheckTime: %##s (%s) NextRequiredQuery in %ld sec",
+                       rr->resrec.name->c, DNSTypeName(rr->resrec.rrtype), (rr->NextRequiredQuery - m->timenow) / mDNSPlatformOneSecond);
                }
 
        if (m->NextCacheCheck - (rr->NextRequiredQuery + CacheCheckGracePeriod(rr)) > 0)
@@ -3370,10 +3307,9 @@ mDNSlocal void SetNextCacheCheckTime(mDNS *const m, CacheRecord *const rr)
                        m->NextCacheCheck = rr->DelayDelivery;
        }
 
-#define kMinimumReconfirmTime                     ((mDNSu32)mDNSPlatformOneSecond *  5)
-#define kDefaultReconfirmTimeForWake              ((mDNSu32)mDNSPlatformOneSecond *  5)
-#define kDefaultReconfirmTimeForNoAnswer          ((mDNSu32)mDNSPlatformOneSecond * 15)
-#define kDefaultReconfirmTimeForFlappingInterface ((mDNSu32)mDNSPlatformOneSecond * 30)
+#define kDefaultReconfirmTimeForNoAnswer        ((mDNSu32)mDNSPlatformOneSecond * 15)
+#define kDefaultReconfirmTimeForCableDisconnect ((mDNSu32)mDNSPlatformOneSecond *  5)
+#define kMinimumReconfirmTime                   ((mDNSu32)mDNSPlatformOneSecond *  5)
 
 mDNSlocal mStatus mDNS_Reconfirm_internal(mDNS *const m, CacheRecord *const rr, mDNSu32 interval)
        {
@@ -3386,15 +3322,12 @@ mDNSlocal mStatus mDNS_Reconfirm_internal(mDNS *const m, CacheRecord *const rr,
        if (RRExpireTime(rr) - m->timenow > (mDNSs32)((interval * 4) / 3))
                {
                // Add a 33% random amount to the interval, to avoid synchronization between multiple hosts
-               // For all the reconfirmations in a given batch, we want to use the same random value
-               // so that the reconfirmation questions can be grouped into a single query packet
-               if (!m->RandomReconfirmDelay) m->RandomReconfirmDelay = 1 + mDNSRandom(0x3FFFFFFF);
-               interval += mDNSRandomFromFixedSeed(m->RandomReconfirmDelay, interval/3);
+               interval += mDNSRandom(interval/3);
                rr->TimeRcvd          = m->timenow - (mDNSs32)interval * 3;
-               rr->resrec.rroriginalttl     = (interval * 4 + mDNSPlatformOneSecond - 1) / mDNSPlatformOneSecond;
+               rr->resrec.rroriginalttl     = interval * 4 / mDNSPlatformOneSecond;
                SetNextCacheCheckTime(m, rr);
                }
-       debugf("mDNS_Reconfirm_internal:%6ld ticks to go for %s", RRExpireTime(rr) - m->timenow, CRDisplayString(m, rr));
+       debugf("mDNS_Reconfirm_internal:%5ld ticks to go for %s", RRExpireTime(rr) - m->timenow, CRDisplayString(m, rr));
        return(mStatus_NoError);
        }
 
@@ -3417,8 +3350,7 @@ mDNSlocal mDNSBool BuildQuestion(mDNS *const m, DNSMessage *query, mDNSu8 **quer
                }
        else if (newptr + *answerforecast >= limit)
                {
-               verbosedebugf("BuildQuestion: Retracting question %##s new forecast total %d",
-                       q->qname.c, newptr + *answerforecast - query->data);
+               verbosedebugf("BuildQuestion: Retracting question %##s new forecast total %d", q->qname.c, newptr + *answerforecast - query->data);
                query->h.numQuestions--;
                return(mDNSfalse);
                }
@@ -3435,8 +3367,7 @@ mDNSlocal mDNSBool BuildQuestion(mDNS *const m, DNSMessage *query, mDNSu8 **quer
                                rr->NextInKAList == mDNSNULL && ka != &rr->NextInKAList &&      // which is not already in the known answer list
                                rr->resrec.rdlength <= SmallRecordLimit &&                                      // which is small enough to sensibly fit in the packet
                                ResourceRecordAnswersQuestion(&rr->resrec, q) &&                        // which answers our question
-                               rr->TimeRcvd + TicksTTL(rr)/2 - m->timenow >                            // and its half-way-to-expiry time is at least 1 second away
-                                                                                               mDNSPlatformOneSecond)          // (also ensures we never include goodbye records with TTL=1)
+                               rr->TimeRcvd + TicksTTL(rr)/2 - m->timenow >= 0)                        // and it is less than half-way to expiry
                                {
                                *ka = rr;       // Link this record into our known answer chain
                                ka = &rr->NextInKAList;
@@ -3601,10 +3532,6 @@ mDNSlocal mDNSBool AccelerateThisQuery(mDNS *const m, DNSQuestion *q)
 
 mDNSlocal void SendQueries(mDNS *const m)
        {
-       mDNSu32 slot;
-       CacheGroup *cg;
-       CacheRecord *cr;
-       AuthRecord *ar;
        int pktcount = 0;
        DNSQuestion *q;
        // For explanation of maxExistingQuestionInterval logic, see comments for maxExistingAnnounceInterval
@@ -3615,6 +3542,8 @@ mDNSlocal void SendQueries(mDNS *const m)
        // 1. If time for a query, work out what we need to do
        if (m->timenow - m->NextScheduledQuery >= 0)
                {
+               mDNSu32 slot;
+               CacheGroup *cg;
                CacheRecord *rr;
                m->NextScheduledQuery = m->timenow + 0x78000000;
 
@@ -3668,8 +3597,7 @@ mDNSlocal void SendQueries(mDNS *const m)
                                (!q->Target.type && ActiveQuestion(q) && q->ThisQInterval <= maxExistingQuestionInterval && AccelerateThisQuery(m,q)))
                                {
                                // If at least halfway to next query time, advance to next interval
-                               // If less than halfway to next query time, then
-                               // treat this as logically a repeat of the last transmission, without advancing the interval
+                               // If less than halfway to next query time, treat this as logically a repeat of the last transmission, without advancing the interval
                                if (m->timenow - (q->LastQTime + q->ThisQInterval/2) >= 0)
                                        {
                                        q->SendQNow = mDNSInterfaceMark;        // Mark this question for sending on all interfaces
@@ -3678,9 +3606,8 @@ mDNSlocal void SendQueries(mDNS *const m)
                                                q->ThisQInterval = MaxQuestionInterval;
                                        else if (q->CurrentAnswers == 0 && q->ThisQInterval == InitialQuestionInterval * 8)
                                                {
-                                               debugf("SendQueries: Zero current answers for %##s (%s); will reconfirm antecedents",
-                                                       q->qname.c, DNSTypeName(q->qtype));
-                                               ReconfirmAntecedents(m, q);             // Sending third query, and no answers yet; time to begin doubting the source
+                                               debugf("SendQueries: Zero current answers for %##s (%s); will reconfirm antecedents", q->qname.c, DNSTypeName(q->qtype));
+                                               ReconfirmAntecedents(m, q);             // If sending third query, and no answers yet, time to begin doubting the source
                                                }
                                        }
 
@@ -3732,8 +3659,7 @@ mDNSlocal void SendQueries(mDNS *const m)
                                        rr->ProbeCount--;
                                        SetNextAnnounceProbeTime(m, rr);
                                        }
-                               // else, if it has now finished probing, move it to state Verified,
-                               // and update m->NextScheduledResponse so it will be announced
+                               // else, if it has now finished probing, move it to state Verified, and update m->NextScheduledResponse so it will be announced
                                else
                                        {
                                        AuthRecord *r2;
@@ -3759,8 +3685,7 @@ mDNSlocal void SendQueries(mDNS *const m)
                        }
                }
 
-       // 3. Now we know which queries and probes we're sending,
-       // go through our interface list sending the appropriate queries on each interface
+       // 3. Now we know which queries and probes we're sending, go through our interface list sending the appropriate queries on each interface
        while (intf)
                {
                AuthRecord *rr;
@@ -3802,13 +3727,11 @@ mDNSlocal void SendQueries(mDNS *const m)
                                                answerforecast = forecast;
                                                rr->SendRNow = (rr->resrec.InterfaceID) ? mDNSNULL : GetNextActiveInterfaceID(intf);
                                                rr->IncludeInProbe = mDNStrue;
-                                               verbosedebugf("SendQueries:   Put Question %##s (%s) probecount %d",
-                                                       rr->resrec.name->c, DNSTypeName(rr->resrec.rrtype), rr->ProbeCount);
+                                               verbosedebugf("SendQueries:   Put Question %##s (%s) probecount %d", rr->resrec.name->c, DNSTypeName(rr->resrec.rrtype), rr->ProbeCount);
                                                }
                                        else
                                                {
-                                               verbosedebugf("SendQueries:   Retracting Question %##s (%s)",
-                                                       rr->resrec.name->c, DNSTypeName(rr->resrec.rrtype));
+                                               verbosedebugf("SendQueries:   Retracting Question %##s (%s)", rr->resrec.name->c, DNSTypeName(rr->resrec.rrtype));
                                                m->omsg.h.numQuestions--;
                                                }
                                        }
@@ -3822,8 +3745,7 @@ mDNSlocal void SendQueries(mDNS *const m)
                        mDNSu8 *newptr = PutResourceRecordTTL(&m->omsg, queryptr, &m->omsg.h.numAnswers, &rr->resrec, rr->resrec.rroriginalttl - SecsSinceRcvd);
                        if (newptr)
                                {
-                               verbosedebugf("SendQueries:   Put %##s (%s) at %d - %d",
-                                       rr->resrec.name->c, DNSTypeName(rr->resrec.rrtype), queryptr - m->omsg.data, newptr - m->omsg.data);
+                               verbosedebugf("SendQueries:   Put %##s (%s) at %d - %d", rr->resrec.name->c, DNSTypeName(rr->resrec.rrtype), queryptr - m->omsg.data, newptr - m->omsg.data);
                                queryptr = newptr;
                                KnownAnswerList = rr->NextInKAList;
                                rr->NextInKAList = mDNSNULL;
@@ -3876,39 +3798,17 @@ mDNSlocal void SendQueries(mDNS *const m)
                        }
                }
 
-       // 4. Final housekeeping
-       
-       // 4a. Debugging check: Make sure we announced all our records
-       for (ar = m->ResourceRecords; ar; ar=ar->next)
-               if (ar->SendRNow)
-                       {
-                       if (ar->resrec.InterfaceID != mDNSInterface_LocalOnly)
-                               LogMsg("SendQueries: No active interface to send: %s", ARDisplayString(m, ar));
-                       ar->SendRNow = mDNSNULL;
-                       }
-
-       // 4b. When we have lingering cache records that we're keeping around for a few seconds in the hope
-       // that their interface which went away might come back again, the logic will want to send queries
-       // for those records, but we can't because their interface isn't here any more, so to keep the
-       // state machine ticking over we just pretend we did so.
-       // If the interface does not come back in time, the cache record will expire naturally
-       FORALL_CACHERECORDS(slot, cg, cr)
-               if (cr->CRActiveQuestion && cr->UnansweredQueries < MaxUnansweredQueries && m->timenow - cr->NextRequiredQuery >= 0)
-                       {
-                       cr->UnansweredQueries++;
-                       cr->CRActiveQuestion->SendQNow = mDNSNULL;
-                       SetNextCacheCheckTime(m, cr);
-                       }
-
-       // 4c. Debugging check: Make sure we sent all our planned questions
-       // Do this AFTER the lingering cache records check above, because that will prevent spurious warnings for questions
-       // we legitimately couldn't send because the interface is no longer available
-       for (q = m->Questions; q; q=q->next)
-               if (q->SendQNow)
-                       {
-                       LogMsg("SendQueries: No active interface to send: %##s %s", q->qname.c, DNSTypeName(q->qtype));
-                       q->SendQNow = mDNSNULL;
-                       }
+       // Final sanity check for debugging purposes
+               {
+               AuthRecord *rr;
+               for (rr = m->ResourceRecords; rr; rr=rr->next)
+                       if (rr->SendRNow)
+                               {
+                               if (rr->resrec.InterfaceID != mDNSInterface_LocalOnly)
+                                       LogMsg("SendQueries: No active interface to send: %s", ARDisplayString(m, rr));
+                               rr->SendRNow = mDNSNULL;
+                               }
+               }
        }
 
 // ***************************************************************************
@@ -3967,7 +3867,7 @@ mDNSlocal void AnswerQuestionWithResourceRecord(mDNS *const m, DNSQuestion *q, C
 
 mDNSlocal void CacheRecordDeferredAdd(mDNS *const m, CacheRecord *rr)
        {
-       rr->DelayDelivery = 0;          // Note, only need to call SetNextCacheCheckTime() when DelayDelivery is set, not when it's cleared
+       rr->DelayDelivery = 0;
        if (m->CurrentQuestion) LogMsg("CacheRecordDeferredAdd ERROR m->CurrentQuestion already set");
        m->CurrentQuestion = m->Questions;
        while (m->CurrentQuestion && m->CurrentQuestion != m->NewQuestions)
@@ -3992,7 +3892,7 @@ mDNSlocal mDNSs32 CheckForSoonToExpireRecords(mDNS *const m, const domainname *c
                        if (threshhold - RRExpireTime(rr) >= 0)         // If we have records about to expire within a second
                                if (delay - RRExpireTime(rr) < 0)               // then delay until after they've been deleted
                                        delay = RRExpireTime(rr);
-       if (delay - start > 0) return(NonZeroTime(delay));
+       if (delay - start > 0) return(delay ? delay : 1);       // Make sure we return non-zero if we want to delay
        else return(0);
        }
 
@@ -4014,12 +3914,11 @@ mDNSlocal void CacheRecordAdd(mDNS *const m, CacheRecord *rr)
                m->CurrentQuestion = q->next;
                if (ResourceRecordAnswersQuestion(&rr->resrec, q))
                        {
-                       // If this question is one that's actively sending queries, and it's received ten answers within one
-                       // second of sending the last query packet, then that indicates some radical network topology change,
-                       // so reset its exponential backoff back to the start. We must be at least at the eight-second interval
-                       // to do this. If we're at the four-second interval, or less, there's not much benefit accelerating
-                       // because we will anyway send another query within a few seconds. The first reset query is sent out
-                       // randomized over the next four seconds to reduce possible synchronization between machines.
+                       // If this question is one that's actively sending queries, and it's received ten answers within one second of sending the last
+                       // query packet, then that indicates some radical network topology change, so reset its exponential backoff back to the start.
+                       // We must be at least at the eight-second interval to do this. If we're at the four-second interval, or less,
+                       // there's not much benefit accelerating because we will anyway send another query within a few seconds.
+                       // The first reset query is sent out randomized over the next four seconds to reduce possible synchronization between machines.
                        if (q->LastAnswerPktNum != m->PktNum)
                                {
                                q->LastAnswerPktNum = m->PktNum;
@@ -4033,8 +3932,7 @@ mDNSlocal void CacheRecordAdd(mDNS *const m, CacheRecord *rr)
                                        SetNextQueryTime(m,q);
                                        }
                                }
-                       verbosedebugf("CacheRecordAdd %p %##s (%s) %lu",
-                               rr, rr->resrec.name->c, DNSTypeName(rr->resrec.rrtype), rr->resrec.rroriginalttl);
+                       verbosedebugf("CacheRecordAdd %p %##s (%s) %lu", rr, rr->resrec.name->c, DNSTypeName(rr->resrec.rrtype), rr->resrec.rroriginalttl);
                        q->CurrentAnswers++;
                        if (rr->resrec.rdlength > SmallRecordLimit) q->LargeAnswers++;
                        if (rr->resrec.RecordType & kDNSRecordTypePacketUniqueMask) q->UniqueAnswers++;
@@ -4052,7 +3950,6 @@ mDNSlocal void CacheRecordAdd(mDNS *const m, CacheRecord *rr)
                        }
                }
        m->CurrentQuestion = mDNSNULL;
-       SetNextCacheCheckTime(m, rr);
        }
 
 // NoCacheAnswer is only called from mDNSCoreReceiveResponse, *never* directly as a result of a client API call.
@@ -4068,7 +3965,7 @@ mDNSlocal void CacheRecordAdd(mDNS *const m, CacheRecord *rr)
 mDNSlocal void NoCacheAnswer(mDNS *const m, CacheRecord *rr)
        {
        LogMsg("No cache space: Delivering non-cached result for %##s", m->rec.r.resrec.name->c);
-       if (m->CurrentQuestion) LogMsg("NoCacheAnswer ERROR m->CurrentQuestion already set");
+       if (m->CurrentQuestion) LogMsg("CacheRecordAdd ERROR m->CurrentQuestion already set");
        m->CurrentQuestion = m->Questions;
        while (m->CurrentQuestion)
                {
@@ -4099,10 +3996,9 @@ mDNSlocal void CacheRecordRmv(mDNS *const m, CacheRecord *rr)
                m->CurrentQuestion = q->next;
                if (ResourceRecordAnswersQuestion(&rr->resrec, q))
                        {
-                       verbosedebugf("CacheRecordRmv %p %s", rr, CRDisplayString(m, rr));
+                       verbosedebugf("CacheRecordRmv %p %##s (%s)", rr, rr->resrec.name->c, DNSTypeName(rr->resrec.rrtype));
                        if (q->CurrentAnswers == 0)
-                               LogMsg("CacheRecordRmv ERROR: How can CurrentAnswers already be zero for %p %##s (%s)?",
-                                       q, q->qname.c, DNSTypeName(q->qtype));
+                               LogMsg("CacheRecordRmv ERROR: How can CurrentAnswers already be zero for %p %##s (%s)?", q, q->qname.c, DNSTypeName(q->qtype));
                        else
                                {
                                q->CurrentAnswers--;
@@ -4111,11 +4007,9 @@ mDNSlocal void CacheRecordRmv(mDNS *const m, CacheRecord *rr)
                                }
                        if (q->CurrentAnswers == 0)
                                {
-                               debugf("CacheRecordRmv: Zero current answers for %##s (%s); will reconfirm antecedents",
-                                       q->qname.c, DNSTypeName(q->qtype));
+                               debugf("CacheRecordRmv: Zero current answers for %##s (%s); will reconfirm antecedents", q->qname.c, DNSTypeName(q->qtype));
                                ReconfirmAntecedents(m, q);
                                }
-                       q->FlappingInterface = mDNSNULL;
                        AnswerQuestionWithResourceRecord(m, q, rr, mDNSfalse);
                        // MUST NOT dereference q again after calling AnswerQuestionWithResourceRecord()
                        }
@@ -4138,10 +4032,8 @@ mDNSlocal void ReleaseCacheGroup(mDNS *const m, CacheGroup **cp)
        {
        CacheEntity *e = (CacheEntity *)(*cp);
        //LogMsg("ReleaseCacheGroup: Releasing CacheGroup for %p, %##s", (*cp)->name->c, (*cp)->name->c);
-       if ((*cp)->rrcache_tail != &(*cp)->members)
-               LogMsg("ERROR: (*cp)->members == mDNSNULL but (*cp)->rrcache_tail != &(*cp)->members)");
-       //if ((*cp)->name != (domainname*)((*cp)->namestorage))
-       //      LogMsg("ReleaseCacheGroup: %##s, %p %p", (*cp)->name->c, (*cp)->name, (domainname*)((*cp)->namestorage));
+       if ((*cp)->rrcache_tail != &(*cp)->members) LogMsg("ERROR: (*cp)->members == mDNSNULL but (*cp)->rrcache_tail != &(*cp)->members)");
+       //if ((*cp)->name != (domainname*)((*cp)->namestorage)) LogMsg("ReleaseCacheGroup: %##s, %p %p", (*cp)->name->c, (*cp)->name, (domainname*)((*cp)->namestorage));
        if ((*cp)->name != (domainname*)((*cp)->namestorage)) mDNSPlatformMemFree((*cp)->name);
        (*cp)->name = mDNSNULL;
        *cp = (*cp)->next;                      // Cut record from list
@@ -4155,9 +4047,8 @@ mDNSlocal void ReleaseCacheRecord(mDNS *const m, CacheRecord *r)
        ReleaseCacheEntity(m, (CacheEntity *)r);
        }
 
-// Note: We want to be careful that we deliver all the CacheRecordRmv calls before delivering
-// CacheRecordDeferredAdd calls. The in-order nature of the cache lists ensures that all
-// callbacks for old records are delivered before callbacks for newer records.
+// Note: We want to be careful that we deliver all the CacheRecordRmv calls before delivering CacheRecordDeferredAdd calls
+// The in-order nature of the cache lists ensures that all callbacks for old records are delivered before callbacks for newer records
 mDNSlocal void CheckCacheExpiration(mDNS *const m, CacheGroup *cg)
        {
        CacheRecord **rp = &cg->members;
@@ -4197,13 +4088,11 @@ mDNSlocal void CheckCacheExpiration(mDNS *const m, CacheGroup *cg)
                                                // SendQueries() will see that we have records close to expiration, and send FEQs for them.
                                                m->NextScheduledQuery = m->timenow;
                                                // After sending the query we'll increment UnansweredQueries and call SetNextCacheCheckTime(),
-                                               // which will correctly update m->NextCacheCheck for us.
+                                               // which will correctly update m->NextCacheCheck for us
                                                event = m->timenow + 0x3FFFFFFF;
                                                }
                                        }
                                }
-                       verbosedebugf("CheckCacheExpiration:%6d %5d %s",
-                               (event-m->timenow) / mDNSPlatformOneSecond, CacheCheckGracePeriod(rr), CRDisplayString(m, rr));
                        if (m->NextCacheCheck - (event + CacheCheckGracePeriod(rr)) > 0)
                                m->NextCacheCheck = (event + CacheCheckGracePeriod(rr));
                        rp = &rr->next;
@@ -4292,8 +4181,8 @@ mDNSlocal void AnswerNewQuestion(mDNS *const m)
        m->lock_rrcache = 0;
        }
 
-// When a NewLocalOnlyQuestion is created, AnswerNewLocalOnlyQuestion runs though our ResourceRecords delivering any
-// appropriate answers, stopping if it reaches a NewLocalRecord -- these will be handled by AnswerLocalQuestions
+// When a NewLocalOnlyQuestion is created, AnswerNewLocalOnlyQuestion runs though our ResourceRecords delivering any appropriate answers,
+// stopping if it reaches a NewLocalRecord -- these will be handled by AnswerLocalQuestions
 mDNSlocal void AnswerNewLocalOnlyQuestion(mDNS *const m)
        {
        DNSQuestion *q = m->NewLocalOnlyQuestions;              // Grab the question we're going to answer
@@ -4378,8 +4267,7 @@ mDNSlocal CacheEntity *GetCacheEntity(mDNS *const m, const CacheGroup *const Pre
                                                ReleaseCacheRecord(m, rr);
                                                }
                                        }
-                               if ((*cp)->rrcache_tail != rp)
-                                       verbosedebugf("GetFreeCacheRR: Updating rrcache_tail[%lu] from %p to %p", slot, (*cp)->rrcache_tail, rp);
+                               if ((*cp)->rrcache_tail != rp) verbosedebugf("GetFreeCacheRR: Updating rrcache_tail[%lu] from %p to %p", slot, (*cp)->rrcache_tail, rp);
                                (*cp)->rrcache_tail = rp;
                                if ((*cp)->members || (*cp)==PreserveCG) cp=&(*cp)->next;
                                else ReleaseCacheGroup(m, cp);
@@ -4434,8 +4322,7 @@ mDNSlocal CacheGroup *GetCacheGroup(mDNS *const m, const mDNSu32 slot, const Res
        cg->members      = mDNSNULL;
        cg->rrcache_tail = &cg->members;
        cg->name         = (domainname*)cg->namestorage;
-       //LogMsg("GetCacheGroup: %-10s %d-byte cache name %##s",
-       //      (namelen > InlineCacheGroupNameSize) ? "Allocating" : "Inline", namelen, rr->name->c);
+       //LogMsg("GetCacheGroup: %-10s %d-byte cache name %##s", (namelen > InlineCacheGroupNameSize) ? "Allocating" : "Inline", namelen, rr->name->c);
        if (namelen > InlineCacheGroupNameSize) cg->name = mDNSPlatformMemAllocate(namelen);
        if (!cg->name)
                {
@@ -4513,7 +4400,6 @@ mDNSexport mDNSs32 mDNS_Execute(mDNS *const m)
                                        else ReleaseCacheGroup(m, cp);
                                        }
                                }
-                       LogOperation("Cache checked. Next in %ld ticks", m->NextCacheCheck - m->timenow);
                        }
        
                // 4. See if we can answer any of our new local questions from the cache
@@ -4541,10 +4427,10 @@ mDNSexport mDNSs32 mDNS_Execute(mDNS *const m)
                        {
                        // If the platform code is ready, and we're not suppressing packet generation right now
                        // then send our responses, probes, and questions.
-                       // We check the cache first, because there might be records close to expiring that trigger questions to refresh them.
+                       // We check the cache first, because there might be records close to expiring that trigger questions to refresh them
                        // We send queries next, because there might be final-stage probes that complete their probing here, causing
                        // them to advance to announcing state, and we want those to be included in any announcements we send out.
-                       // Finally, we send responses, including the previously mentioned records that just completed probing.
+                       // Finally, we send responses, including the previously mentioned records that just completed probing
                        m->SuppressSending = 0;
        
                        // 6. Send Query packets. This may cause some probing records to advance to announcing state
@@ -4569,9 +4455,7 @@ mDNSexport mDNSs32 mDNS_Execute(mDNS *const m)
                                }
                        }
 
-               // Clear RandomDelay values, ready to pick a new different value next time
-               m->RandomQueryDelay     = 0;
-               m->RandomReconfirmDelay = 0;
+               m->RandomQueryDelay = 0;        // Clear m->RandomQueryDelay, ready to pick a new different value, when necessary
                }
 
        // Note about multi-threaded systems:
@@ -4657,7 +4541,7 @@ mDNSexport void mDNSCoreMachineSleep(mDNS *const m, mDNSBool sleepstate)
                // 2. Re-validate our cache records
                m->NextCacheCheck  = m->timenow;
                FORALL_CACHERECORDS(slot, cg, cr)
-                       mDNS_Reconfirm_internal(m, cr, kDefaultReconfirmTimeForWake);
+                       mDNS_Reconfirm_internal(m, cr, kDefaultReconfirmTimeForCableDisconnect);
 
                // 3. Retrigger probing and announcing for all our authoritative records
                for (rr = m->ResourceRecords; rr; rr=rr->next)
@@ -4767,7 +4651,7 @@ mDNSlocal int CompareRData(AuthRecord *our, CacheRecord *pkt)
        if (*pktptr > *ourptr) return(-1);                                                              // Our data is numerically lower; We lost
        if (*pktptr < *ourptr) return(+1);                                                              // Packet data is numerically lower; We won
        
-       LogMsg("CompareRData ERROR: Invalid state");
+       debugf("CompareRData: How did we get here?");
        return(-1);
        }
 
@@ -4870,13 +4754,14 @@ mDNSlocal void ResolveSimultaneousProbe(mDNS *const m, const DNSMessage *const q
                                int result          = (int)our->resrec.rrclass - (int)m->rec.r.resrec.rrclass;
                                if (!result) result = (int)our->resrec.rrtype  - (int)m->rec.r.resrec.rrtype;
                                if (!result) result = CompareRData(our, &m->rec.r);
-                               if (result > 0)
-                                       debugf("ResolveSimultaneousProbe: %##s (%s): We won",  our->resrec.name->c, DNSTypeName(our->resrec.rrtype));
-                               else if (result < 0)
+                               switch (result)
                                        {
-                                       debugf("ResolveSimultaneousProbe: %##s (%s): We lost", our->resrec.name->c, DNSTypeName(our->resrec.rrtype));
-                                       mDNS_Deregister_internal(m, our, mDNS_Dereg_conflict);
-                                       goto exit;
+                                       case  1:        debugf("ResolveSimultaneousProbe: %##s (%s): We won",  our->resrec.name->c, DNSTypeName(our->resrec.rrtype));
+                                                               break;
+                                       case  0:        break;
+                                       case -1:        debugf("ResolveSimultaneousProbe: %##s (%s): We lost", our->resrec.name->c, DNSTypeName(our->resrec.rrtype));
+                                                               mDNS_Deregister_internal(m, our, mDNS_Dereg_conflict);
+                                                               goto exit;
                                        }
                                }
                        }
@@ -4900,8 +4785,8 @@ mDNSlocal CacheRecord *FindIdenticalRecordInCache(const mDNS *const m, ResourceR
 
 // ProcessQuery examines a received query to see if we have any answers to give
 mDNSlocal mDNSu8 *ProcessQuery(mDNS *const m, const DNSMessage *const query, const mDNSu8 *const end,
-       const mDNSAddr *srcaddr, const mDNSInterfaceID InterfaceID, mDNSBool LegacyQuery, mDNSBool QueryWasMulticast,
-       mDNSBool QueryWasLocalUnicast, DNSMessage *const response)
+       const mDNSAddr *srcaddr, const mDNSInterfaceID InterfaceID, mDNSBool LegacyQuery, mDNSBool QueryWasMulticast, mDNSBool QueryWasLocalUnicast,
+       DNSMessage *const response)
        {
        mDNSBool      FromLocalSubnet    = AddressIsLocalSubnet(m, InterfaceID, srcaddr);
        AuthRecord   *ResponseRecords    = mDNSNULL;
@@ -5021,9 +4906,7 @@ mDNSlocal mDNSu8 *ProcessQuery(mDNS *const m, const DNSMessage *const query, con
                                        if (!q->Target.type && ActiveQuestion(q) && m->timenow - q->LastQTxTime > mDNSPlatformOneSecond / 4)
                                                if (!q->InterfaceID || q->InterfaceID == InterfaceID)
                                                        if (q->NextInDQList == mDNSNULL && dqp != &q->NextInDQList)
-                                                               if (q->qtype == pktq.qtype &&
-                                                                       q->qclass == pktq.qclass &&
-                                                                       q->qnamehash == pktq.qnamehash && SameDomainName(&q->qname, &pktq.qname))
+                                                               if (q->qtype == pktq.qtype && q->qclass == pktq.qclass && q->qnamehash == pktq.qnamehash && SameDomainName(&q->qname, &pktq.qname))
                                                                        { *dqp = q; dqp = &q->NextInDQList; }
                        }
                }
@@ -5329,8 +5212,7 @@ mDNSlocal void mDNSCoreReceiveQuery(mDNS *const m, const DNSMessage *const msg,
        
        if (!InterfaceID && mDNSAddrIsDNSMulticast(dstaddr))
                {
-               LogMsg("Ignoring Query from %#-15a:%-5d to %#-15a:%-5d on 0x%p with "
-                       "%2d Question%s %2d Answer%s %2d Authorit%s %2d Additional%s (Multicast, but no InterfaceID)",
+               LogMsg("Ignoring Query from %#-15a:%-5d to %#-15a:%-5d on 0x%p with %2d Question%s %2d Answer%s %2d Authorit%s %2d Additional%s (Multicast, but no InterfaceID)",
                        srcaddr, mDNSVal16(srcport), dstaddr, mDNSVal16(dstport), InterfaceID,
                        msg->h.numQuestions,   msg->h.numQuestions   == 1 ? ", " : "s,",
                        msg->h.numAnswers,     msg->h.numAnswers     == 1 ? ", " : "s,",
@@ -5339,8 +5221,7 @@ mDNSlocal void mDNSCoreReceiveQuery(mDNS *const m, const DNSMessage *const msg,
                return;
                }
        
-       verbosedebugf("Received Query from %#-15a:%-5d to %#-15a:%-5d on 0x%p with "
-               "%2d Question%s %2d Answer%s %2d Authorit%s %2d Additional%s",
+       verbosedebugf("Received Query from %#-15a:%-5d to %#-15a:%-5d on 0x%p with %2d Question%s %2d Answer%s %2d Authorit%s %2d Additional%s",
                srcaddr, mDNSVal16(srcport), dstaddr, mDNSVal16(dstport), InterfaceID,
                msg->h.numQuestions,   msg->h.numQuestions   == 1 ? ", " : "s,",
                msg->h.numAnswers,     msg->h.numAnswers     == 1 ? ", " : "s,",
@@ -5370,14 +5251,8 @@ mDNSlocal void mDNSCoreReceiveResponse(mDNS *const m,
        const mDNSInterfaceID InterfaceID)
        {
        int i;
-
-       // We ignore questions (if any) in a DNS response packet
-       const mDNSu8 *ptr = LocateAnswers(response, end);
-
-       // "(CacheRecord*)1" is a special (non-zero) end-of-list marker
-       // We use this non-zero marker so that records in our CacheFlushRecords list will always have NextInCFList
-       // set non-zero, and that tells GetCacheEntity() that they're not, at this moment, eligible for recycling.
-       CacheRecord *CacheFlushRecords = (CacheRecord*)1;
+       const mDNSu8 *ptr = LocateAnswers(response, end);       // We ignore questions (if any) in a DNS response packet
+       CacheRecord *CacheFlushRecords = (CacheRecord*)1;       // "(CacheRecord*)1" is special (non-zero) end-of-list marker
        CacheRecord **cfp = &CacheFlushRecords;
 
        // All records in a DNS response packet are treated as equally valid statements of truth. If we want
@@ -5389,8 +5264,7 @@ mDNSlocal void mDNSCoreReceiveResponse(mDNS *const m,
        (void)srcport;
        (void)dstport;
 
-       verbosedebugf("Received Response from %#-15a addressed to %#-15a on %p with "
-               "%2d Question%s %2d Answer%s %2d Authorit%s %2d Additional%s",
+       verbosedebugf("Received Response from %#-15a addressed to %#-15a on %p with %2d Question%s %2d Answer%s %2d Authorit%s %2d Additional%s",
                srcaddr, dstaddr, InterfaceID,
                response->h.numQuestions,   response->h.numQuestions   == 1 ? ", " : "s,",
                response->h.numAnswers,     response->h.numAnswers     == 1 ? ", " : "s,",
@@ -5587,7 +5461,9 @@ mDNSlocal void mDNSCoreReceiveResponse(mDNS *const m,
                                                rr->DelayDelivery = m->timenow + mDNSPlatformOneSecond; // to delay delivery of this 'add' event
                                        else
                                                rr->DelayDelivery = CheckForSoonToExpireRecords(m, rr->resrec.name, rr->resrec.namehash, slot);
-                                       CacheRecordAdd(m, rr);  // CacheRecordAdd calls SetNextCacheCheckTime(m, rr); for us
+                                       CacheRecordAdd(m, rr);
+                                       // MUST do this AFTER CacheRecordAdd(), because that's what sets CRActiveQuestion for us
+                                       SetNextCacheCheckTime(m, rr);
                                        }
                                }
                        }
@@ -5609,20 +5485,13 @@ exit:
                for (r2 = cg ? cg->members : mDNSNULL; r2; r2=r2->next)
                        if (SameResourceRecordSignature(&r1->resrec, &r2->resrec))
                                {
-                               // If record was recently positively received
-                               // (i.e. not counting goodbye packets or cache flush events that set the TTL to 1)
-                               // then we need to ensure the whole RRSet has the same TTL (as required by DNS semantics)
-                               if (r2->resrec.rroriginalttl > 1 && m->timenow - r2->TimeRcvd < mDNSPlatformOneSecond)
-                                       {
-                                       if (r2->resrec.rroriginalttl != r1->resrec.rroriginalttl)
-                                               LogMsg("Correcting TTL from %4d to %4d for %s",
-                                                       r2->resrec.rroriginalttl, r1->resrec.rroriginalttl, CRDisplayString(m, r2));
+                               // If record is recent, just ensure the whole RRSet has the same TTL (as required by DNS semantics)
+                               // else, if record is old, mark it to be flushed
+                               if (m->timenow - r2->TimeRcvd < mDNSPlatformOneSecond)
                                        r2->resrec.rroriginalttl = r1->resrec.rroriginalttl;
-                                       r2->TimeRcvd = m->timenow;
-                                       }
-                               else                            // else, if record is old, mark it to be flushed
+                               else
                                        {
-                                       verbosedebugf("Cache flush %p X %p %s", r1, r2, CRDisplayString(m, r2));
+                                       verbosedebugf("Cache flush %p X %p %##s (%s)", r1, r2, r2->resrec.name->c, DNSTypeName(r2->resrec.rrtype));
                                        // We set stale records to expire in one second.
                                        // This gives the owner a chance to rescue it if necessary.
                                        // This is important in the case of multi-homing and bridged networks:
@@ -5637,12 +5506,11 @@ exit:
                                        r2->resrec.rroriginalttl = 1;
                                        r2->TimeRcvd          = m->timenow;
                                        r2->UnansweredQueries = MaxUnansweredQueries;
+                                       SetNextCacheCheckTime(m, r2);
                                        }
-                               SetNextCacheCheckTime(m, r2);
                                }
                if (r1->DelayDelivery)  // If we were planning to delay delivery of this record, see if we still need to
                        {
-                       // Note, only need to call SetNextCacheCheckTime() when DelayDelivery is set, not when it's cleared
                        r1->DelayDelivery = CheckForSoonToExpireRecords(m, r1->resrec.name, r1->resrec.namehash, slot);
                        if (!r1->DelayDelivery) CacheRecordDeferredAdd(m, r1);
                        }
@@ -5661,7 +5529,9 @@ mDNSexport void mDNSCoreReceive(mDNS *const m, void *const pkt, const mDNSu8 *co
        const mDNSu8 UpdateR = kDNSFlag0_QR_Response | kDNSFlag0_OP_Update;
 
 #ifndef UNICAST_DISABLED       
-       if (srcport.NotAnInteger == NATPMPPort.NotAnInteger)
+       mDNSIPPort NATPort = mDNSOpaque16fromIntVal(NATMAP_PORT);
+
+       if (srcport.NotAnInteger == NATPort.NotAnInteger)
                {
                mDNS_Lock(m);
                uDNS_ReceiveNATMap(m, pkt, (mDNSu16)(end - (mDNSu8 *)pkt));
@@ -5797,15 +5667,17 @@ mDNSlocal mStatus mDNS_StartQuery_internal(mDNS *const m, DNSQuestion *const que
                        return(mStatus_AlreadyRegistered);
                        }
 
-               // If this question is referencing a specific interface, verify it exists
+               // If this question is referencing a specific interface, make sure it exists
                if (question->InterfaceID && question->InterfaceID != mDNSInterface_LocalOnly)
                        {
                        NetworkInterfaceInfo *intf;
                        for (intf = m->HostInterfaces; intf; intf = intf->next)
                                if (intf->InterfaceID == question->InterfaceID) break;
                        if (!intf)
-                               LogMsg("Note: InterfaceID %p for question %##s not currently found in active interface list",
-                                       question->InterfaceID, question->qname.c);
+                               {
+                               debugf("mDNS_StartQuery_internal: Question %##s InterfaceID %p not found", question->qname.c, question->InterfaceID);
+                               return(mStatus_BadInterfaceErr);
+                               }
                        }
 
                if (!ValidateDomainName(&question->qname))
@@ -5820,35 +5692,32 @@ mDNSlocal mStatus mDNS_StartQuery_internal(mDNS *const m, DNSQuestion *const que
                // that we have *no* relevant answers currently in our cache, then it will accelerate that to go out immediately.
                if (!m->RandomQueryDelay) m->RandomQueryDelay = 1 + (mDNSs32)mDNSRandom((mDNSu32)InitialQuestionInterval);
 
-               question->next              = mDNSNULL;
-               question->qnamehash         = DomainNameHashValue(&question->qname);    // MUST do this before FindDuplicateQuestion()
-               question->DelayAnswering    = CheckForSoonToExpireRecords(m, &question->qname, question->qnamehash, HashSlot(&question->qname));
-               question->ThisQInterval     = InitialQuestionInterval * 2;                      // MUST be > zero for an active question
-               question->RequestUnicast    = 2;                                                                                // Set to 2 because is decremented once *before* we check it
-               question->LastQTime         = m->timenow - m->RandomQueryDelay;         // Avoid inter-machine synchronization
-               question->LastAnswerPktNum  = m->PktNum;
-               question->RecentAnswerPkts  = 0;
-               question->CurrentAnswers    = 0;
-               question->LargeAnswers      = 0;
-               question->UniqueAnswers     = 0;
-               question->FlappingInterface = mDNSNULL;
-               question->DuplicateOf       = FindDuplicateQuestion(m, question);
-               question->NextInDQList      = mDNSNULL;
+               question->next             = mDNSNULL;
+               question->qnamehash        = DomainNameHashValue(&question->qname);     // MUST do this before FindDuplicateQuestion()
+               question->DelayAnswering   = CheckForSoonToExpireRecords(m, &question->qname, question->qnamehash, HashSlot(&question->qname));
+               question->ThisQInterval    = InitialQuestionInterval * 2;                       // MUST be > zero for an active question
+               question->RequestUnicast   = 2;                                                                         // Set to 2 because is decremented once *before* we check it
+               question->LastQTime        = m->timenow - m->RandomQueryDelay;          // Avoid inter-machine synchronization
+               question->LastAnswerPktNum = m->PktNum;
+               question->RecentAnswerPkts = 0;
+               question->CurrentAnswers   = 0;
+               question->LargeAnswers     = 0;
+               question->UniqueAnswers    = 0;
+               question->DuplicateOf      = FindDuplicateQuestion(m, question);
+               question->NextInDQList     = mDNSNULL;
                for (i=0; i<DupSuppressInfoSize; i++)
                        question->DupSuppress[i].InterfaceID = mDNSNULL;
                // question->InterfaceID must be already set by caller
-               question->SendQNow          = mDNSNULL;
-               question->SendOnAll         = mDNSfalse;
-               question->LastQTxTime       = m->timenow;
+               question->SendQNow         = mDNSNULL;
+               question->SendOnAll        = mDNSfalse;
+               question->LastQTxTime      = m->timenow;
 
                if (!question->DuplicateOf)
                        verbosedebugf("mDNS_StartQuery_internal: Question %##s (%s) %p %d (%p) started",
-                               question->qname.c, DNSTypeName(question->qtype), question->InterfaceID,
-                               question->LastQTime + question->ThisQInterval - m->timenow, question);
+                               question->qname.c, DNSTypeName(question->qtype), question->InterfaceID, question->LastQTime + question->ThisQInterval - m->timenow, question);
                else
                        verbosedebugf("mDNS_StartQuery_internal: Question %##s (%s) %p %d (%p) duplicate of (%p)",
-                               question->qname.c, DNSTypeName(question->qtype), question->InterfaceID,
-                               question->LastQTime + question->ThisQInterval - m->timenow, question, question->DuplicateOf);
+                               question->qname.c, DNSTypeName(question->qtype), question->InterfaceID, question->LastQTime + question->ThisQInterval - m->timenow, question, question->DuplicateOf);
 
                *q = question;
                if (question->InterfaceID == mDNSInterface_LocalOnly)
@@ -5900,8 +5769,7 @@ mDNSlocal mStatus mDNS_StopQuery_internal(mDNS *const m, DNSQuestion *const ques
                        for (q = m->Questions; q; q=q->next)            // Scan our list of questions
                                if (ActiveQuestion(q) && ResourceRecordAnswersQuestion(&rr->resrec, q))
                                        break;
-                       verbosedebugf("mDNS_StopQuery_internal: Cache RR %##s (%s) setting CRActiveQuestion to %p",
-                               rr->resrec.name->c, DNSTypeName(rr->resrec.rrtype), q);
+                       verbosedebugf("mDNS_StopQuery_internal: Cache RR %##s (%s) setting CRActiveQuestion to %p", rr->resrec.name->c, DNSTypeName(rr->resrec.rrtype), q);
                        rr->CRActiveQuestion = q;               // Question used to be active; new value may or may not be null
                        if (!q) m->rrcache_active--;    // If no longer active, decrement rrcache_active count
                        }
@@ -6131,10 +5999,12 @@ mDNSlocal void FoundServiceInfo(mDNS *const m, DNSQuestion *question, const Reso
        if (query->ServiceInfoQueryCallback && query->GotTXT)
                {
                if (++query->Answers >= 100)
-                       debugf(answer->rrtype == kDNSType_A ?
-                               "**** WARNING **** have given %lu answers for %##s (A) %.4a" :
-                               "**** WARNING **** have given %lu answers for %##s (AAAA) %.16a",
-                               query->Answers, query->qSRV.qname.c, &answer->rdata->u.data);
+                       {
+                       if (answer->rrtype == kDNSType_A)
+                               debugf("**** WARNING **** have given %lu answers for %##s (A) %.4a",     query->Answers, query->qSRV.qname.c, &answer->rdata->u.ipv4);
+                       else
+                               debugf("**** WARNING **** have given %lu answers for %##s (AAAA) %.16a", query->Answers, query->qSRV.qname.c, &answer->rdata->u.ipv6);
+                       }
                query->ServiceInfoQueryCallback(m, query);
                }
        }
@@ -6276,10 +6146,7 @@ mDNSexport mStatus mDNS_Update(mDNS *const m, AuthRecord *const rr, mDNSu32 newt
 #endif
 
        if (!ValidateRData(rr->resrec.rrtype, newrdlength, newrdata))
-               {
-               LogMsg("Attempt to update record with invalid rdata: %s", GetRRDisplayString_rdb(&rr->resrec, &newrdata->u, m->MsgBuffer));
-               return(mStatus_Invalid);
-               }
+               { LogMsg("Attempt to update record with invalid rdata: %s", GetRRDisplayString_rdb(&rr->resrec, &newrdata->u, m->MsgBuffer)); return(mStatus_Invalid); }
        
        mDNS_Lock(m);
 
@@ -6302,8 +6169,7 @@ mDNSexport mStatus mDNS_Update(mDNS *const m, AuthRecord *const rr, mDNSu32 newt
 
        if (unicast) { mStatus status = uDNS_UpdateRecord(m, rr); mDNS_Unlock(m); return(status); }
 
-       if (rr->resrec.rroriginalttl == newttl &&
-               rr->resrec.rdlength == newrdlength && mDNSPlatformMemSame(rr->resrec.rdata->u.data, newrdata->u.data, newrdlength))
+       if (rr->resrec.rroriginalttl == newttl && rr->resrec.rdlength == newrdlength && mDNSPlatformMemSame(rr->resrec.rdata->u.data, newrdata->u.data, newrdlength))
                CompleteRDataUpdate(m, rr);
        else
                {
@@ -6329,8 +6195,7 @@ mDNSexport mStatus mDNS_Update(mDNS *const m, AuthRecord *const rr, mDNSu32 newt
                        if (!rr->UpdateBlocked) rr->UpdateBlocked = NonZeroTime(m->timenow + (mDNSs32)delay * mDNSPlatformOneSecond);
                        rr->ThisAPInterval *= 4;
                        rr->LastAPTime = rr->UpdateBlocked - rr->ThisAPInterval;
-                       LogMsg("Excessive update rate for %##s; delaying announcement by %ld second%s",
-                               rr->resrec.name->c, delay, delay > 1 ? "s" : "");
+                       LogMsg("Excessive update rate for %##s; delaying announcement by %ld second%s", rr->resrec.name->c, delay, delay > 1 ? "s" : "");
                        }
                rr->resrec.rroriginalttl = newttl;
                }
@@ -6548,7 +6413,7 @@ mDNSlocal void UpdateInterfaceProtocols(mDNS *const m, NetworkInterfaceInfo *act
                        }
        }
 
-mDNSexport mStatus mDNS_RegisterInterface(mDNS *const m, NetworkInterfaceInfo *set, mDNSBool flapping)
+mDNSexport mStatus mDNS_RegisterInterface(mDNS *const m, NetworkInterfaceInfo *set, mDNSs32 delay)
        {
        mDNSBool FirstOfType = mDNStrue;
        NetworkInterfaceInfo **p = &m->HostInterfaces;
@@ -6561,12 +6426,11 @@ mDNSexport mStatus mDNS_RegisterInterface(mDNS *const m, NetworkInterfaceInfo *s
 
        mDNS_Lock(m);
        
-       // Assume this interface will be active now, unless we find a duplicate already in the list
+       // Assume this interface will be active
        set->InterfaceActive = mDNStrue;
        set->IPv4Available   = (set->ip.type == mDNSAddrType_IPv4 && set->McastTxRx);
        set->IPv6Available   = (set->ip.type == mDNSAddrType_IPv6 && set->McastTxRx);
 
-       // Scan list to see if this InterfaceID is already represented
        while (*p)
                {
                if (*p == set)
@@ -6576,9 +6440,9 @@ mDNSexport mStatus mDNS_RegisterInterface(mDNS *const m, NetworkInterfaceInfo *s
                        return(mStatus_AlreadyRegistered);
                        }
 
+               // This InterfaceID is already in the list, so mark this interface inactive for now
                if ((*p)->InterfaceID == set->InterfaceID)
                        {
-                       // This InterfaceID already represented by a different interface in the list, so mark this instance inactive for now
                        set->InterfaceActive = mDNSfalse;
                        if (set->ip.type == (*p)->ip.type) FirstOfType = mDNSfalse;
                        if (set->ip.type == mDNSAddrType_IPv4 && set->McastTxRx) (*p)->IPv4Available = mDNStrue;
@@ -6594,12 +6458,12 @@ mDNSexport mStatus mDNS_RegisterInterface(mDNS *const m, NetworkInterfaceInfo *s
        if (set->Advertise)
                AdvertiseInterface(m, set);
 
-       LogOperation("mDNS_RegisterInterface: InterfaceID %p %s (%#a) %s", set->InterfaceID, set->ifname, &set->ip,
+       debugf("mDNS_RegisterInterface: InterfaceID %p %#a %s", set->InterfaceID, &set->ip,
                set->InterfaceActive ?
                        "not represented in list; marking active and retriggering queries" :
                        "already represented in list; marking inactive for now");
        
-       // In early versions of OS X the IPv6 address remains on an interface even when the interface is turned off,
+       // In some versions of OS X the IPv6 address remains on an interface even when the interface is turned off,
        // giving the false impression that there's an active representative of this interface when there really isn't.
        // Therefore, when registering an interface, we want to re-trigger our questions and re-probe our Resource Records,
        // even if we believe that we previously had an active representative of this interface.
@@ -6607,39 +6471,28 @@ mDNSexport mStatus mDNS_RegisterInterface(mDNS *const m, NetworkInterfaceInfo *s
                {
                DNSQuestion *q;
                AuthRecord *rr;
-               // If flapping, delay between first and second queries is eight seconds instead of one
-               mDNSs32 delay    = flapping ? mDNSPlatformOneSecond   * 5 : 0;
-               mDNSu8  announce = flapping ? (mDNSu8)1                   : InitialAnnounceCount;
+               mDNSs32 initial = InitialQuestionInterval;
 
                // Use a small amount of randomness:
-               // In the case of a network administrator turning on an Ethernet hub so that all the
-               // connected machines establish link at exactly the same time, we don't want them all
-               // to go and hit the network with identical queries at exactly the same moment.
+               // In the case of a network administrator turning on an Ethernet hub so that all the connected machines establish link at
+               // exactly the same time, we don't want them to all go and hit the network with identical queries at exactly the same moment.
                if (!m->SuppressSending) m->SuppressSending = m->timenow + (mDNSs32)mDNSRandom((mDNSu32)InitialQuestionInterval);
                
-               if (flapping)
+               if (delay)
                        {
-                       LogMsg("Note: Frequent transitions for interface %s (%#a); network traffic reduction measures in effect", set->ifname, &set->ip);
+                       LogMsg("Repeated transitions for interface %s (%#a); delaying packets by %d seconds",
+                               set->ifname, &set->ip, delay/mDNSPlatformOneSecond);
+                       initial = InitialQuestionInterval * 8;          // Delay between first and second queries is eight seconds
                        if (!m->SuppressProbes ||
                                m->SuppressProbes - (m->timenow + delay) < 0)
                                m->SuppressProbes = (m->timenow + delay);
                        }
-
                for (q = m->Questions; q; q=q->next)                                                    // Scan our list of questions
                        if (!q->InterfaceID || q->InterfaceID == set->InterfaceID)      // If non-specific Q, or Q on this specific interface,
                                {                                                                                                               // then reactivate this question
-                               mDNSs32 initial  = (flapping && q->FlappingInterface != set->InterfaceID) ? InitialQuestionInterval * 8 : InitialQuestionInterval;
-                               mDNSs32 qdelay   = (flapping && q->FlappingInterface != set->InterfaceID) ? mDNSPlatformOneSecond   * 5 : 0;
-                               if (flapping && q->FlappingInterface == set->InterfaceID)
-                                       LogOperation("No cache records for %##s (%s) expired; no need for immediate question", q->qname.c, DNSTypeName(q->qtype));
-                                       
-                               if (!q->ThisQInterval || q->ThisQInterval > initial)
-                                       {
-                                       q->ThisQInterval = initial;
-                                       q->RequestUnicast = 2; // Set to 2 because is decremented once *before* we check it
-                                       }
-                               if (q->LastQTime - (m->timenow - q->ThisQInterval + qdelay) > 0)
-                                       q->LastQTime = (m->timenow - q->ThisQInterval + qdelay);
+                               q->ThisQInterval    = initial;                                                  // MUST be > zero for an active question
+                               q->RequestUnicast   = 2;                                                                // Set to 2 because is decremented once *before* we check it
+                               q->LastQTime        = m->timenow - q->ThisQInterval + delay;
                                q->RecentAnswerPkts = 0;
                                SetNextQueryTime(m,q);
                                }
@@ -6651,7 +6504,7 @@ mDNSexport mStatus mDNS_RegisterInterface(mDNS *const m, NetworkInterfaceInfo *s
                                {
                                if (rr->resrec.RecordType == kDNSRecordTypeVerified && !rr->DependentOn) rr->resrec.RecordType = kDNSRecordTypeUnique;
                                rr->ProbeCount     = DefaultProbeCountForRecordType(rr->resrec.RecordType);
-                               if (rr->AnnounceCount < announce) rr->AnnounceCount  = announce;
+                               rr->AnnounceCount  = delay ? (mDNSu8)1 : InitialAnnounceCount;
                                rr->ThisAPInterval = DefaultAPIntervalForRecordType(rr->resrec.RecordType);
                                InitializeLastAPTime(m, rr);
                                }
@@ -6664,7 +6517,7 @@ mDNSexport mStatus mDNS_RegisterInterface(mDNS *const m, NetworkInterfaceInfo *s
 // NOTE: mDNS_DeregisterInterface calls mDNS_Deregister_internal which can call a user callback, which may change
 // the record list and/or question list.
 // Any code walking either list must use the CurrentQuestion and/or CurrentRecord mechanism to protect against this.
-mDNSexport void mDNS_DeregisterInterface(mDNS *const m, NetworkInterfaceInfo *set, mDNSBool flapping)
+mDNSexport void mDNS_DeregisterInterface(mDNS *const m, NetworkInterfaceInfo *set)
        {
        NetworkInterfaceInfo **p = &m->HostInterfaces;
        
@@ -6700,8 +6553,8 @@ mDNSexport void mDNS_DeregisterInterface(mDNS *const m, NetworkInterfaceInfo *se
                                break;
                if (intf)
                        {
-                       LogOperation("mDNS_DeregisterInterface: Another representative of InterfaceID %p %s (%#a) exists;"
-                               " making it active", set->InterfaceID, set->ifname, &set->ip);
+                       debugf("mDNS_DeregisterInterface: Another representative of InterfaceID %p exists; making it active",
+                               set->InterfaceID);
                        intf->InterfaceActive = mDNStrue;
                        UpdateInterfaceProtocols(m, intf);
                        
@@ -6718,32 +6571,19 @@ mDNSexport void mDNS_DeregisterInterface(mDNS *const m, NetworkInterfaceInfo *se
                        CacheGroup *cg;
                        CacheRecord *rr;
                        DNSQuestion *q;
-                       LogOperation("mDNS_DeregisterInterface: Last representative of InterfaceID %p %s (%#a) deregistered;"
-                               " marking questions etc. dormant", set->InterfaceID, set->ifname, &set->ip);
-
-                       if (flapping)
-                               LogMsg("Note: Frequent transitions for interface %s (%#a); network traffic reduction measures in effect",
-                                       set->ifname, &set->ip);
+                       debugf("mDNS_DeregisterInterface: Last representative of InterfaceID %p deregistered; marking questions etc. dormant",
+                               set->InterfaceID);
 
-                       // 1. Deactivate any questions specific to this interface, and tag appropriate questions
-                       // so that mDNS_RegisterInterface() knows how swiftly it needs to reactivate them
+                       // 1. Deactivate any questions specific to this interface
                        for (q = m->Questions; q; q=q->next)
-                               {
-                               if (q->InterfaceID == set->InterfaceID) q->ThisQInterval = 0;
-                               if (!q->InterfaceID || q->InterfaceID == set->InterfaceID)
-                                       q->FlappingInterface = set->InterfaceID;
-                               }
+                               if (q->InterfaceID == set->InterfaceID)
+                                       q->ThisQInterval = 0;
 
                        // 2. Flush any cache records received on this interface
                        revalidate = mDNSfalse;         // Don't revalidate if we're flushing the records
                        FORALL_CACHERECORDS(slot, cg, rr)
                                if (rr->resrec.InterfaceID == set->InterfaceID)
-                                       {
-                                       // If this interface is deemed flapping,
-                                       // postpone deleting the cache records in case the interface comes back again
-                                       if (!flapping) PurgeCacheResourceRecord(m, rr);
-                                       else mDNS_Reconfirm_internal(m, rr, kDefaultReconfirmTimeForFlappingInterface);
-                                       }
+                                       PurgeCacheResourceRecord(m, rr);
                        }
                }
 
@@ -6762,7 +6602,7 @@ mDNSexport void mDNS_DeregisterInterface(mDNS *const m, NetworkInterfaceInfo *se
                m->NextCacheCheck = m->timenow;
                FORALL_CACHERECORDS(slot, cg, rr)
                        if (rr->resrec.InterfaceID == set->InterfaceID)
-                               mDNS_Reconfirm_internal(m, rr, kDefaultReconfirmTimeForFlappingInterface);
+                               mDNS_Reconfirm_internal(m, rr, kDefaultReconfirmTimeForCableDisconnect);
                }
 
        mDNS_Unlock(m);
@@ -6847,8 +6687,7 @@ mDNSexport mStatus mDNS_RegisterService(mDNS *const m, ServiceRecordSet *sr,
        else sr->Host.c[0] = 0;
        
        // If port number is zero, that means the client is really trying to do a RegisterNoSuchService
-       if (!port.NotAnInteger)
-               return(mDNS_RegisterNoSuchService(m, &sr->RR_SRV, name, type, domain, mDNSNULL, mDNSInterface_Any, NSSCallback, sr));
+       if (!port.NotAnInteger) return(mDNS_RegisterNoSuchService(m, &sr->RR_SRV, name, type, domain, mDNSNULL, mDNSInterface_Any, NSSCallback, sr));
 
        // Initialize the AuthRecord objects to sane values
        mDNS_SetupResourceRecord(&sr->RR_ADV, mDNSNULL, InterfaceID, kDNSType_PTR, kStandardTTL, kDNSRecordTypeAdvisory, ServiceCallback, sr);
@@ -6957,8 +6796,7 @@ mDNSexport mStatus mDNS_AddRecordToService(mDNS *const m, ServiceRecordSet *sr,
        mStatus status;
 
        extra->next = mDNSNULL;
-       mDNS_SetupResourceRecord(&extra->r, rdata, sr->RR_PTR.resrec.InterfaceID,
-               extra->r.resrec.rrtype, ttl, kDNSRecordTypeUnique, ServiceCallback, sr);
+       mDNS_SetupResourceRecord(&extra->r, rdata, sr->RR_PTR.resrec.InterfaceID, extra->r.resrec.rrtype, ttl, kDNSRecordTypeUnique, ServiceCallback, sr);
        AssignDomainName(extra->r.resrec.name, sr->RR_SRV.resrec.name);
        
 #ifndef UNICAST_DISABLED
@@ -6993,8 +6831,7 @@ mDNSexport mStatus mDNS_AddRecordToService(mDNS *const m, ServiceRecordSet *sr,
        return(status);
        }
 
-mDNSexport mStatus mDNS_RemoveRecordFromService(mDNS *const m, ServiceRecordSet *sr, ExtraResourceRecord *extra,
-       mDNSRecordCallback MemFreeCallback, void *Context)
+mDNSexport mStatus mDNS_RemoveRecordFromService(mDNS *const m, ServiceRecordSet *sr, ExtraResourceRecord *extra, mDNSRecordCallback MemFreeCallback, void *Context)
        {
        ExtraResourceRecord **e;
        mStatus status;
@@ -7041,11 +6878,7 @@ mDNSexport mStatus mDNS_RenameAndReregisterService(mDNS *const m, ServiceRecordS
                IncrementLabelSuffix(&name2, mDNStrue);
                newname = &name2;
                }
-       
-       if (SameDomainName(&domain, &localdomain))
-               LogMsg("%##s service renamed from \"%#s\" to \"%#s\"", type.c, name1.c, newname->c);
-       else LogMsg("%##s service (domain %##s) renamed from \"%#s\" to \"%#s\"",type.c, domain.c, name1.c, newname->c);
-
+       LogMsg("Service \"%##s\" renamed to \"%#s\"", sr->RR_SRV.resrec.name->c, newname->c);
        if (sr->RR_SRV.HostTarget == mDNSfalse && sr->Host.c[0]) host = &sr->Host;
        
        err = mDNS_RegisterService(m, sr, newname, &type, &domain,
@@ -7200,7 +7033,7 @@ mDNSexport mStatus mDNS_Init(mDNS *const m, mDNS_PlatformSupport *const p,
        
        m->p                       = p;
        m->KnownBugs               = 0;
-       m->CanReceiveUnicastOn5353 = mDNSfalse; // Assume we can't receive unicasts on 5353, unless platform layer tells us otherwise
+       m->CanReceiveUnicastOn5353 = mDNSfalse;         // Assume we can't receive unicasts on 5353, unless platform layer tells us otherwise
        m->AdvertiseLocalAddresses = AdvertiseLocalAddresses;
        m->mDNSPlatformStatus      = mStatus_Waiting;
        m->UnicastPort4            = zeroIPPort;
@@ -7233,7 +7066,6 @@ mDNSexport mStatus mDNS_Init(mDNS *const m, mDNS_PlatformSupport *const p,
        m->NextScheduledResponse   = timenow + 0x78000000;
        m->ExpectUnicastResponse   = timenow + 0x78000000;
        m->RandomQueryDelay        = 0;
-       m->RandomReconfirmDelay    = 0;
        m->PktNum                  = 0;
        m->SendDeregistrations     = mDNSfalse;
        m->SendImmediateAnswers    = mDNSfalse;
index 591312b82da848baede713359966a73293af5669..11c97378dd1d09d19be8e3ac8a27cde7af03407e 100755 (executable)
@@ -1,28 +1,28 @@
-/* -*- Mode: C; tab-width: 4 -*-
- *
+/*
  * Copyright (c) 2002-2003 Apple Computer, Inc. All rights reserved.
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * @APPLE_LICENSE_HEADER_START@
  * 
- *     http://www.apache.org/licenses/LICENSE-2.0
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
  * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
  * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
 
     Change History (most recent first):
 
 $Log: mDNSDebug.h,v $
-Revision 1.26.2.1  2006/08/29 06:24:22  cheshire
-Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
-
-Revision 1.26  2005/07/04 22:40:26  cheshire
-Additional debugging code to help catch memory corruption
-
 Revision 1.25  2004/12/14 21:34:16  cheshire
 Add "#define ANSWER_REMOTE_HOSTNAME_QUERIES 0" and comment
 
@@ -154,8 +154,6 @@ extern void LogMsgNoIdent(const char *format, ...) IS_A_PRINTF_STYLE_FUNCTION(1,
 #if MACOSX_MDNS_MALLOC_DEBUGGING >= 1
 extern void *mallocL(char *msg, unsigned int size);
 extern void freeL(char *msg, void *x);
-extern void LogMemCorruption(const char *format, ...);
-extern void uds_validatelists(void);
 #else
 #define mallocL(X,Y) malloc(Y)
 #define freeL(X,Y) free(Y)
@@ -181,8 +179,6 @@ extern void uds_validatelists(void);
 #define        LogOperation debugf
 #endif
 
-#define ForceAlerts 0
-
 #ifdef __cplusplus
        }
 #endif
index 4b4d8ae1686da29ad3bd50f9c3241311b479b672..e2d402d518de18b7f4e5b6a54c5a6b13fa95ba8a 100755 (executable)
@@ -1,18 +1,24 @@
-/* -*- Mode: C; tab-width: 4 -*-
- *
+/*
  * Copyright (c) 2002-2003 Apple Computer, Inc. All rights reserved.
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * @APPLE_LICENSE_HEADER_START@
  * 
- *     http://www.apache.org/licenses/LICENSE-2.0
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
  * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
  * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
 
 
    NOTE:
     Change History (most recent first):
 
 $Log: mDNSEmbeddedAPI.h,v $
-Revision 1.296.2.1  2006/08/29 06:24:22  cheshire
-Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
-
-Revision 1.296  2006/06/29 05:28:01  cheshire
-Added comment about mDNSlocal and mDNSexport
-
-Revision 1.295  2006/06/29 03:02:43  cheshire
-<rdar://problem/4607042> mDNSResponder NXDOMAIN and CNAME support
-
-Revision 1.294  2006/06/28 06:50:08  cheshire
-In future we may want to change definition of mDNSs32 from "signed long" to "signed int"
-I doubt anyone is building mDNSResponder on systems where int is 16-bits,
-but lets add a compile-time assertion to make sure.
-
-Revision 1.293  2006/06/12 18:00:43  cheshire
-To make code a little more defensive, check _ILP64 before _LP64,
-in case both are set by mistake on some platforms
-
-Revision 1.292  2006/03/19 17:00:57  cheshire
-Define symbol MaxMsg instead of using hard-coded constant value '80'
-
-Revision 1.291  2006/03/19 02:00:07  cheshire
-<rdar://problem/4073825> Improve logic for delaying packets after repeated interface transitions
-
-Revision 1.290  2006/03/08 22:42:23  cheshire
-Fix spelling mistake: LocalReverseMapomain -> LocalReverseMapDomain
-
-Revision 1.289  2006/02/26 00:54:41  cheshire
-Fixes to avoid code generation warning/error on FreeBSD 7
-
-Revision 1.288  2005/12/21 03:24:58  cheshire
-<rdar://problem/4388858> Code changes required to compile on EFI
-
 Revision 1.287  2005/10/20 00:10:33  cheshire
 <rdar://problem/4290265> Add check to avoid crashing NAT gateways that have buggy DNS relay code
 
@@ -1025,17 +998,7 @@ Merge in license terms from Quinn's copy, in preparation for Darwin release
 #ifndef __mDNSClientAPI_h
 #define __mDNSClientAPI_h
 
-#if defined(EFI32) || defined(EFI64)
-// EFI doesn't have stdarg.h
-#include "Tiano.h"
-#define va_list                        VA_LIST
-#define va_start(a, b) VA_START(a, b)
-#define va_end(a)              VA_END(a)
-#define va_arg(a, b)   VA_ARG(a, b)
-#else
 #include <stdarg.h>            // stdarg.h is required for for va_list support for the mDNS_vsnprintf declaration
-#endif
-
 #include "mDNSDebug.h"
 
 #ifdef __cplusplus
@@ -1057,19 +1020,6 @@ Merge in license terms from Quinn's copy, in preparation for Darwin release
 #define mDNSexport
 #endif
 
-// Explanation: These local/export markers are a little habit of mine for signaling the programmers' intentions.
-// When "mDNSlocal" is just a synonym for "static", and "mDNSexport" is a complete no-op, you could be
-// forgiven for asking what purpose they serve. The idea is that if you see "mDNSexport" in front of a
-// function definition it means the programmer intended it to be exported and callable from other files
-// in the project. If you see "mDNSlocal" in front of a function definition it means the programmer
-// intended it to be private to that file. If you see neither in front of a function definition it
-// means the programmer forgot (so you should work out which it is supposed to be, and fix it).
-// Using "mDNSlocal" instead of "static" makes it easier to do a textual searches for one or the other.
-// For example you can do a search for "static" to find if any functions declare any local variables as "static"
-// (generally a bad idea unless it's also "const", because static storage usually risks being non-thread-safe)
-// without the results being cluttered with hundreds of matches for functions declared static.
-// - Stuart Cheshire
-
 // ***************************************************************************
 // Structure packing macro
 
@@ -1155,17 +1105,15 @@ typedef unsigned short mDNSu16;
 //   Macro Name __LP64__ Value 1
 // A quick Google search for "defined(__LP64__)" OR "#ifdef __LP64__" gives 2590 hits and
 // a search for "#if __LP64__" gives only 12, so I think we'll go with the majority and use defined()
-#if defined(_ILP64) || defined(__ILP64__)
-typedef   signed int32 mDNSs32;
-typedef unsigned int32 mDNSu32;
-#elif defined(_LP64) || defined(__LP64__)
+#if defined(_LP64) || defined(__LP64__)
 typedef   signed int   mDNSs32;
 typedef unsigned int   mDNSu32;
+#elif defined(_ILP64) || defined(__ILP64__)
+typedef   signed int32 mDNSs32;
+typedef unsigned int32 mDNSu32;
 #else
 typedef   signed long  mDNSs32;
 typedef unsigned long  mDNSu32;
-//typedef   signed int mDNSs32;
-//typedef unsigned int mDNSu32;
 #endif
 
 // To enforce useful type checking, we make mDNSInterfaceID be a pointer to a dummy struct
@@ -1905,7 +1853,6 @@ struct DNSQuestion_struct
        mDNSu32               CurrentAnswers;   // Number of records currently in the cache that answer this question
        mDNSu32               LargeAnswers;             // Number of answers with rdata > 1024 bytes
        mDNSu32               UniqueAnswers;    // Number of answers received with kDNSClass_UniqueRRSet bit set
-       mDNSInterfaceID       FlappingInterface;// Set when an interface goes away, to flag if removes are delivered for this Q
        DNSQuestion          *DuplicateOf;
        DNSQuestion          *NextInDQList;
        DupSuppressInfo       DupSuppress[DupSuppressInfoSize];
@@ -1926,7 +1873,6 @@ struct DNSQuestion_struct
        mDNSBool              LongLived;        // Set by client for calls to mDNS_StartQuery to indicate LLQs to unicast layer.
        mDNSBool              ExpectUnique;             // Set by client if it's expecting unique RR(s) for this question, not shared RRs
        mDNSBool              ForceMCast;               // Set by client to force mDNS query, even for apparently uDNS names
-       mDNSBool              ReturnCNAME;              // Set by client to request callbacks for intermediate CNAME records
        mDNSQuestionCallback *QuestionCallback;
        void                 *QuestionContext;
        };
@@ -1977,6 +1923,7 @@ struct ServiceInfoQuery_struct
 #define NATMAP_MAX_TRIES 3                                     // for max 3 tries
 #define NATMAP_DEFAULT_LEASE (60 * 60)  // lease life in seconds
 #define NATMAP_VERS 0
+#define NATMAP_PORT 5351
 #define NATMAP_RESPONSE_MASK 0x80
 
 typedef enum
@@ -2130,8 +2077,7 @@ struct mDNS_struct
        mDNSu8  lock_rrcache;                           // For debugging: Set at times when these lists may not be modified
        mDNSu8  lock_Questions;
        mDNSu8  lock_Records;
-       #define MaxMsg 120
-       char MsgBuffer[MaxMsg];                         // Temp storage used while building error log messages
+       char MsgBuffer[80];                                     // Temp storage used while building error log messages
 
        // Task Scheduling variables
        mDNSs32  timenow_adjust;                        // Correction applied if we ever discover time went backwards
@@ -2145,7 +2091,6 @@ struct mDNS_struct
        mDNSs32  NextScheduledResponse;         // Next time to send authoritative record(s) in responses
        mDNSs32  ExpectUnicastResponse;         // Set when we send a query with the kDNSQClass_UnicastResponse bit set
        mDNSs32  RandomQueryDelay;                      // For de-synchronization of query packets on the wire
-       mDNSu32  RandomReconfirmDelay;          // For de-synchronization of reconfirmation queries on the wire
        mDNSs32  PktNum;                                        // Unique sequence number assigned to each received packet
        mDNSBool SendDeregistrations;           // Set if we need to send deregistrations (immediately)
        mDNSBool SendImmediateAnswers;          // Set if we need to send answers (immediately -- or as soon as SuppressSending clears)
@@ -2211,14 +2156,10 @@ extern const mDNSInterfaceID mDNSInterface_Any;                         // Zero
 extern const mDNSInterfaceID mDNSInterface_LocalOnly;          // Special value
 
 extern const mDNSIPPort      UnicastDNSPort;
-extern const mDNSIPPort      NATPMPPort;
-extern const mDNSIPPort      DNSEXTPort;
 extern const mDNSIPPort      MulticastDNSPort;
-extern const mDNSIPPort      LoopbackIPCPort;
-
 extern const mDNSv4Addr      AllDNSAdminGroup;
-#define AllDNSLinkGroupv4 (AllDNSLinkGroup_v4.ip.v4)
-#define AllDNSLinkGroupv6 (AllDNSLinkGroup_v6.ip.v6)
+extern const mDNSv4Addr      AllDNSLinkGroupv4;
+extern const mDNSv6Addr      AllDNSLinkGroupv6;
 extern const mDNSAddr        AllDNSLinkGroup_v4;
 extern const mDNSAddr        AllDNSLinkGroup_v6;
 
@@ -2229,8 +2170,8 @@ extern const mDNSOpaque16 ResponseFlags;
 extern const mDNSOpaque16 UpdateReqFlags;
 extern const mDNSOpaque16 UpdateRespFlags;
 
-#define localdomain (*(const domainname *)"\x5" "local")
-#define LocalReverseMapDomain (*(const domainname *)"\x3" "254" "\x3" "169" "\x7" "in-addr" "\x4" "arpa")
+#define localdomain (*(const domainname *)"\x5local")
+#define LocalReverseMapomain (*(const domainname *)"\x3" "254" "\x3" "169" "\x7" "in-addr" "\x4" "arpa")
        
 // ***************************************************************************
 #if 0
@@ -2705,8 +2646,8 @@ extern mDNSs32  mDNSPlatformUTC         (void);
 // Platform support modules should provide the following functions to map between opaque interface IDs
 // and interface indexes in order to support the DNS-SD API. If your target platform does not support
 // multiple interfaces and/or does not support the DNS-SD API, these functions can be empty.
-extern mDNSInterfaceID mDNSPlatformInterfaceIDfromInterfaceIndex(mDNS *const m, mDNSu32 index);
-extern mDNSu32 mDNSPlatformInterfaceIndexfromInterfaceID(mDNS *const m, mDNSInterfaceID id);
+extern mDNSInterfaceID mDNSPlatformInterfaceIDfromInterfaceIndex(const mDNS *const m, mDNSu32 index);
+extern mDNSu32 mDNSPlatformInterfaceIndexfromInterfaceID(const mDNS *const m, mDNSInterfaceID id);
 
 // Every platform support module must provide the following functions if it is to support unicast DNS
 // and Dynamic Update.
@@ -2798,8 +2739,8 @@ extern mStatus LNT_UnmapPort(mDNSIPPort PubPort, mDNSBool tcp);
 // not lightweight second-by-second CPU power management modes.)
 
 extern void     mDNS_SetFQDN(mDNS *const m);
-extern mStatus  mDNS_RegisterInterface  (mDNS *const m, NetworkInterfaceInfo *set, mDNSBool flapping);
-extern void     mDNS_DeregisterInterface(mDNS *const m, NetworkInterfaceInfo *set, mDNSBool flapping);
+extern mStatus  mDNS_RegisterInterface  (mDNS *const m, NetworkInterfaceInfo *set, mDNSs32 delay);
+extern void     mDNS_DeregisterInterface(mDNS *const m, NetworkInterfaceInfo *set);
 extern void     mDNSCoreInitComplete(mDNS *const m, mStatus result);
 extern void     mDNSCoreReceive(mDNS *const m, void *const msg, const mDNSu8 *const end,
                                                                const mDNSAddr *const srcaddr, const mDNSIPPort srcport,
@@ -2836,7 +2777,6 @@ struct mDNS_CompileTimeAssertionChecks
        char assertA[(sizeof(mDNSOpaque32)     ==   4                          ) ? 1 : -1];
        char assertB[(sizeof(mDNSOpaque128)    ==  16                          ) ? 1 : -1];
        char assertC[(sizeof(CacheRecord  )    >=  sizeof(CacheGroup)          ) ? 1 : -1];
-       char assertD[(sizeof(int)              >=  4                           ) ? 1 : -1];
        };
 
 // ***************************************************************************
index 20cdadb46be8f859b4b624d683b73712fadf10b3..c129f9d07146dcf386819a8c4fe9e7de852b9e52 100755 (executable)
@@ -1,43 +1,28 @@
-/* -*- Mode: C; tab-width: 4 -*-
+/*
+ * Copyright (c) 2002-2004 Apple Computer, Inc. All rights reserved.
  *
- * Copyright (c) 2002-2006 Apple Computer, Inc. All rights reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * @APPLE_LICENSE_HEADER_START@
  * 
- *     http://www.apache.org/licenses/LICENSE-2.0
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
  * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
  * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
 
     Change History (most recent first):
 
 $Log: uDNS.c,v $
-Revision 1.230.2.1  2006/08/29 06:24:23  cheshire
-Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
-
-Revision 1.230  2006/06/29 03:02:44  cheshire
-<rdar://problem/4607042> mDNSResponder NXDOMAIN and CNAME support
-
-Revision 1.229  2006/03/02 22:03:41  cheshire
-<rdar://problem/4395331> Spurious warning "GetLargeResourceRecord: m->rec appears to be already in use"
-Refinement: m->rec.r.resrec.RecordType needs to be cleared *every* time around for loop, not just once at the end
-
-Revision 1.228  2006/02/26 00:54:42  cheshire
-Fixes to avoid code generation warning/error on FreeBSD 7
-
-Revision 1.227  2006/01/09 20:47:05  cheshire
-<rdar://problem/4395331> Spurious warning "GetLargeResourceRecord: m->rec appears to be already in use"
-
-Revision 1.226  2005/12/20 02:46:33  cheshire
-<rdar://problem/4175520> mDNSPosix wide-area registration broken
-Check too strict -- we can still do wide-area registration (without NAT-PMP)
-without having to know our gateway address
-
 Revision 1.225  2005/10/21 22:51:17  cheshire
 <rdar://problem/4290265> Add check to avoid crashing NAT gateways that have buggy DNS relay code
 Refinement: Shorten "check-for-broken-dns-relay" to just "dnsbugtest"
@@ -961,7 +946,7 @@ mDNSexport void mDNS_AddDNSServer(mDNS *const m, const mDNSAddr *addr, const dom
        mDNS_Lock(m);
        if (!d) d = (domainname *)"";
 
-       while (*p)                 // Check if we already have this {server,domain} pair registered
+       while (*p)              // Check if we already have this {server,domain} pair registered
                {
                if (mDNSSameAddress(&(*p)->addr, addr) && SameDomainName(&(*p)->domain, d))
                        LogMsg("Note: DNS Server %#a for domain %##s registered more than once", addr, d->c);
@@ -1143,6 +1128,8 @@ mDNSlocal mDNSBool FreeNATInfo(mDNS *m, NATTraversalInfo *n)
 mDNSlocal void SendNATMsg(NATTraversalInfo *info, mDNS *m)
        {
        mStatus err;
+       mDNSAddr dst;
+       mDNSIPPort dstport;
        uDNS_GlobalInfo *u = &m->uDNS_info;
 
        if (info->state != NATState_Request && info->state != NATState_Refresh)
@@ -1150,12 +1137,15 @@ mDNSlocal void SendNATMsg(NATTraversalInfo *info, mDNS *m)
 
        if (u->Router.ip.v4.NotAnInteger)
                {
-               // send msg if we have a router
+               // send msg     if we have a router
                const mDNSu8 *end = (mDNSu8 *)&info->request;
                if (info->op == NATOp_AddrRequest) end += sizeof(NATAddrRequest);
                else end += sizeof(NATPortMapRequest);
 
-               err = mDNSPlatformSendUDP(m, &info->request, end, 0, &u->Router, NATPMPPort);
+               dst.type = u->Router.type;
+               dst.ip.v4 = u->Router.ip.v4;
+               dstport = mDNSOpaque16fromIntVal(NATMAP_PORT);
+               err = mDNSPlatformSendUDP(m, &info->request, end, 0, &dst, dstport);
                if (!err) (info->ntries++);  // don't increment attempt counter if the send failed
                }
        
@@ -1972,7 +1962,7 @@ mDNSexport void mDNS_SetPrimaryInterfaceInfo(mDNS *m, const mDNSAddr *v4addr, co
        if (router) u->Router       = *router;  else u->Router.ip.v4.NotAnInteger = 0;
        // setting router to zero indicates that nat mappings must be reestablished when router is reset
        
-       if ((v4Changed || RouterChanged || v6Changed) && v4addr)
+       if ((v4Changed || RouterChanged || v6Changed) && (v4addr && router))
                {
                // don't update these unless we've got V4
                UpdateHostnameRegistrations(m);
@@ -2057,9 +2047,6 @@ mDNSlocal void deriveGoodbyes(mDNS * const m, DNSMessage *msg, const  mDNSu8 *en
                        m->mDNS_reentrancy++; // Increment to allow client to legally make mDNS API calls from the callback
                        question->QuestionCallback(m, question, &ka->resrec, mDNSfalse);
                        m->mDNS_reentrancy--; // Decrement to block mDNS API calls again
-                       // CAUTION: Need to be careful after calling question->QuestionCallback(),
-                       // because the client's callback function is allowed to do anything,
-                       // including starting/stopping queries, registering/deregistering records, etc.
                        if (question != m->uDNS_info.CurrentQuery)
                                {
                                debugf("deriveGoodbyes - question removed via callback.  returning.");
@@ -2105,9 +2092,6 @@ mDNSlocal void deriveGoodbyes(mDNS * const m, DNSMessage *msg, const  mDNSu8 *en
                        m->mDNS_reentrancy++; // Increment to allow client to legally make mDNS API calls from the callback
                        question->QuestionCallback(m, question, &ka->resrec, mDNSfalse);
                        m->mDNS_reentrancy--; // Decrement to block mDNS API calls again
-                       // CAUTION: Need to be careful after calling question->QuestionCallback(),
-                       // because the client's callback function is allowed to do anything,
-                       // including starting/stopping queries, registering/deregistering records, etc.
                        if (question != m->uDNS_info.CurrentQuery)
                                {
                                debugf("deriveGoodbyes - question removed via callback.  returning.");
@@ -2143,10 +2127,9 @@ mDNSlocal void pktResponseHndlr(mDNS * const m, DNSMessage *msg, const  mDNSu8 *
        {
        const mDNSu8 *ptr;
        int i;
-       CacheRecord *cr = &m->rec.r;
-       mDNSBool goodbye, inKAList;
-       int     followedCNames = 0;
-       static const int maxCNames = 5;
+       LargeCacheRecord lcr;
+       CacheRecord *cr = &lcr.r;
+       mDNSBool goodbye, inKAList, followedCName = mDNSfalse;
        LLQ_Info *llqInfo = question->uDNS_info.llq;
        domainname origname;
        origname.c[0] = 0;
@@ -2154,40 +2137,6 @@ mDNSlocal void pktResponseHndlr(mDNS * const m, DNSMessage *msg, const  mDNSu8 *
        if (question != m->uDNS_info.CurrentQuery)
                { LogMsg("ERROR: pktResponseHdnlr called without CurrentQuery ptr set!");  return; }
 
-       if (question->uDNS_info.Answered == 0 && msg->h.numAnswers == 0 && !llq)
-               {
-               /* NXDOMAIN error or empty RR set - notify client */
-               question->uDNS_info.Answered = mDNStrue;
-               
-               /* Create empty resource record */
-               cr->resrec.RecordType = kDNSRecordTypeUnregistered;
-               cr->resrec.InterfaceID = mDNSNULL;
-               cr->resrec.name = &question->qname;
-               cr->resrec.rrtype = question->qtype;
-               cr->resrec.rrclass = question->qclass;
-               cr->resrec.rroriginalttl = 1; /* What should we use for the TTL? TTL from SOA for domain? */
-               cr->resrec.rdlength = 0;
-               cr->resrec.rdestimate = 0;
-               cr->resrec.namehash = 0;
-               cr->resrec.namehash = 0;
-               cr->resrec.rdata = (RData*)&cr->rdatastorage;
-               cr->resrec.rdata->MaxRDLength = cr->resrec.rdlength;
-               
-               /* Pass empty answer to callback */
-               m->mDNS_reentrancy++; // Increment to allow client to legally make mDNS API calls from the callback
-               question->QuestionCallback(m, question, &cr->resrec, 0);
-               m->mDNS_reentrancy--; // Decrement to block mDNS API calls again
-               // CAUTION: Need to be careful after calling question->QuestionCallback(),
-               // because the client's callback function is allowed to do anything,
-               // including starting/stopping queries, registering/deregistering records, etc.
-               m->rec.r.resrec.RecordType = 0; // Clear RecordType to show we're not still using it
-               if (question != m->uDNS_info.CurrentQuery)
-                       {
-                       debugf("pktResponseHndlr - CurrentQuery changed by QuestionCallback - returning.");
-                       return;
-                       }
-               }
-       
        question->uDNS_info.Answered = mDNStrue;
        
        ptr = LocateAnswers(msg, end);
@@ -2195,50 +2144,30 @@ mDNSlocal void pktResponseHndlr(mDNS * const m, DNSMessage *msg, const  mDNSu8 *
 
        for (i = 0; i < msg->h.numAnswers; i++)
                {
-               ptr = GetLargeResourceRecord(m, msg, ptr, end, 0, kDNSRecordTypePacketAns, &m->rec);
+               ptr = GetLargeResourceRecord(m, msg, ptr, end, 0, kDNSRecordTypePacketAns, &lcr);
                if (!ptr) goto pkt_error;
                if (ResourceRecordAnswersQuestion(&cr->resrec, question))
                        {
-                       goodbye = llq ? ((mDNSs32)cr->resrec.rroriginalttl == -1) : mDNSfalse;
                        if (cr->resrec.rrtype == kDNSType_CNAME)
                                {
-                               if (followedCNames > (maxCNames - 1)) LogMsg("Error: too many CNAME referals for question %##s", &origname);
+                               if (followedCName) LogMsg("Error: multiple CNAME referals for question %##s", question->qname.c);
                                else
                                        {
                                        debugf("Following cname %##s -> %##s", question->qname.c, cr->resrec.rdata->u.name.c);
-                                       if (question->ReturnCNAME)
-                                               {
-                                               m->mDNS_reentrancy++; // Increment to allow client to legally make mDNS API calls from the callback
-                                               question->QuestionCallback(m, question, &cr->resrec, !goodbye);
-                                               m->mDNS_reentrancy--; // Decrement to block mDNS API calls again
-                                               // CAUTION: Need to be careful after calling question->QuestionCallback(),
-                                               // because the client's callback function is allowed to do anything,
-                                               // including starting/stopping queries, registering/deregistering records, etc.
-                                               if (question != m->uDNS_info.CurrentQuery)
-                                                       {
-                                                       m->rec.r.resrec.RecordType = 0; // Clear RecordType to show we're not still using it
-                                                       debugf("pktResponseHndlr - CurrentQuery changed by QuestionCallback - returning.");
-                                                       return;
-                                                       }
-                                               }
                                        AssignDomainName(&origname, &question->qname);
                                        AssignDomainName(&question->qname, &cr->resrec.rdata->u.name);
                                        question->qnamehash = DomainNameHashValue(&question->qname);
-                                       followedCNames++;
+                                       followedCName = mDNStrue;
                                        i = -1; // restart packet answer matching
                                        ptr = LocateAnswers(msg, end);
-                                       m->rec.r.resrec.RecordType = 0; // Clear RecordType to show we're not still using it
                                        continue;
                                        }
                                }
                        
+                       goodbye = llq ? ((mDNSs32)cr->resrec.rroriginalttl == -1) : mDNSfalse;
                        inKAList = kaListContainsAnswer(question, cr);
 
-                       if ((goodbye && !inKAList) || (!goodbye && inKAList))
-                               {
-                               m->rec.r.resrec.RecordType = 0; // Clear RecordType to show we're not still using it
-                               continue;  // list up to date
-                               }
+                       if ((goodbye && !inKAList) || (!goodbye && inKAList)) continue;  // list up to date
                        if (!inKAList) addKnownAnswer(question, cr);
                        if (goodbye) removeKnownAnswer(question, cr);
                        m->mDNS_reentrancy++; // Increment to allow client to legally make mDNS API calls from the callback
@@ -2246,15 +2175,16 @@ mDNSlocal void pktResponseHndlr(mDNS * const m, DNSMessage *msg, const  mDNSu8 *
                        m->mDNS_reentrancy--; // Decrement to block mDNS API calls again
                        if (question != m->uDNS_info.CurrentQuery)
                                {
-                               m->rec.r.resrec.RecordType = 0; // Clear RecordType to show we're not still using it
                                debugf("pktResponseHndlr - CurrentQuery changed by QuestionCallback - returning");
                                return;
                                }
                        }
-
-               m->rec.r.resrec.RecordType = 0; // Clear RecordType to show we're not still using it
+               else if (!followedCName || !SameDomainName(cr->resrec.name, &origname))
+                       LogMsg("Question %##s %X (%s) %##s unexpected answer %##s %X (%s)",
+                               question->qname.c, question->qnamehash, DNSTypeName(question->qtype), origname.c,
+                               cr->resrec.name->c, cr->resrec.namehash, DNSTypeName(cr->resrec.rrtype));
                }
-
+       
        if (!llq || llqInfo->state == LLQ_Poll || llqInfo->deriveRemovesOnResume)
                {
                deriveGoodbyes(m, msg, end,question);
@@ -2751,7 +2681,7 @@ mDNSlocal mDNSBool uDNS_ReceiveTestQuestionResponse(mDNS *const m, DNSMessage *c
        if (found && result == DNSServer_Failed)
                LogMsg("NOTE: Wide-Area Service Discovery disabled to avoid crashing defective DNS relay %#a.", srcaddr);
 
-       return(mDNStrue); // Return mDNStrue to tell uDNS_ReceiveMsg it doens't need to process this packet further
+       return(mDNStrue);       // Return mDNStrue to tell uDNS_ReceiveMsg it doens't need to process this packet further
        }
 
 mDNSexport void uDNS_ReceiveMsg(mDNS *const m, DNSMessage *const msg, const mDNSu8 *const end,
@@ -4685,7 +4615,7 @@ mDNSexport mStatus uDNS_AddRecordToService(mDNS *const m, ServiceRecordSet *sr,
        else
                {
                err = SetupRecordRegistration(m, &extra->r);
-               extra->r.uDNS_info.state = regState_ExtraQueued; // %%% Is it okay to overwrite the previous uDNS_info.state?
+               extra->r.uDNS_info.state = regState_ExtraQueued;        // %%% Is it okay to overwrite the previous uDNS_info.state?
                }
        
        if (!err)
@@ -4864,7 +4794,7 @@ mDNSlocal mDNSs32 CheckQueries(mDNS *m, mDNSs32 timenow)
                        {
                        sendtime = q->LastQTime + q->ThisQInterval;
                        if (m->SuppressStdPort53Queries &&
-                               sendtime - m->SuppressStdPort53Queries < 0) // Don't allow sendtime to be earlier than SuppressStdPort53Queries
+                               sendtime - m->SuppressStdPort53Queries < 0)             // Don't allow sendtime to be earlier than SuppressStdPort53Queries
                                sendtime = m->SuppressStdPort53Queries;
                        if (sendtime - timenow < 0)
                                {
@@ -5004,7 +4934,7 @@ mDNSexport void uDNS_Execute(mDNS *const m)
        if (nexte - u->nextevent < 0) u->nextevent = nexte;
 
        if (m->SuppressStdPort53Queries && m->timenow - m->SuppressStdPort53Queries >= 0)
-               m->SuppressStdPort53Queries = 0; // If suppression time has passed, clear it
+               m->SuppressStdPort53Queries = 0;        // If suppression time has passed, clear it
 
        nexte = CheckQueries(m, timenow);
        if (nexte - u->nextevent < 0) u->nextevent = nexte;
index c7e0e7cacab7d21f5d461f1cba916722e16ab010..6d86705370e358c537ae86cb5b44a24f73c057bc 100755 (executable)
@@ -1,25 +1,28 @@
-/* -*- Mode: C; tab-width: 4 -*-
- *
+/*
  * Copyright (c) 2002-2003 Apple Computer, Inc. All rights reserved.
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * @APPLE_LICENSE_HEADER_START@
  * 
- *     http://www.apache.org/licenses/LICENSE-2.0
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
  * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
  * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
 
     Change History (most recent first):
 
 $Log: uDNS.h,v $
-Revision 1.32.2.1  2006/08/29 06:24:23  cheshire
-Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
-
 Revision 1.32  2005/07/29 19:46:10  ksekar
 <rdar://problem/4191860> reduce polling period on failed LLQs to 15 minutes
 
index c7a49a02f5561dc8326448a3f59bd052cbc6dee6..105a3985f47c2c0bad966d472dbb83093816873e 100644 (file)
@@ -1,25 +1,28 @@
-/* -*- Mode: C; tab-width: 4 -*-
- *
+/*
  * Copyright (c) 2002-2003 Apple Computer, Inc. All rights reserved.
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * @APPLE_LICENSE_HEADER_START@
  * 
- *     http://www.apache.org/licenses/LICENSE-2.0
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
  * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
  * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
 
     Change History (most recent first):
 
 $Log: CarbonResource.r,v $
-Revision 1.6  2006/08/14 23:24:29  cheshire
-Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
-
 Revision 1.5  2003/08/12 19:56:24  cheshire
 Update to APSL 2.0
 
index cc141734cca480d4ac917a13bbb30a9870f93fa9..76a426c232fd729f276d3923a03c840074e8c2a2 100644 (file)
@@ -1,25 +1,28 @@
-/* -*- Mode: C; tab-width: 4 -*-
- *
+/*
  * Copyright (c) 2002-2003 Apple Computer, Inc. All rights reserved.
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * @APPLE_LICENSE_HEADER_START@
  * 
- *     http://www.apache.org/licenses/LICENSE-2.0
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
  * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
  * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
 
     Change History (most recent first):
 
 $Log: Mac\040OS\040Test\040Responder.c,v $
-Revision 1.25  2006/08/14 23:24:29  cheshire
-Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
-
 Revision 1.24  2004/12/16 20:49:34  cheshire
 <rdar://problem/3324626> Cache memory management improvements
 
index ac7b7d473adeec603334f910d91c3caf3c9db41b..fd28def8dfbdf487b7fff750f487d897c5a6550b 100644 (file)
@@ -1,25 +1,28 @@
-/* -*- Mode: C; tab-width: 4 -*-
- *
+/*
  * Copyright (c) 2002-2003 Apple Computer, Inc. All rights reserved.
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * @APPLE_LICENSE_HEADER_START@
  * 
- *     http://www.apache.org/licenses/LICENSE-2.0
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
  * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
  * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
 
     Change History (most recent first):
 
 $Log: Mac\040OS\040Test\040Searcher.c,v $
-Revision 1.22  2006/08/14 23:24:29  cheshire
-Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
-
 Revision 1.21  2004/12/16 20:49:34  cheshire
 <rdar://problem/3324626> Cache memory management improvements
 
index 7a1993f6a57d0731ce1ebd1788c3246c59264501..2e7135e9ccfc3a0637015dc4e164fee59b2a2765 100644 (file)
@@ -1,25 +1,28 @@
-/* -*- Mode: C; tab-width: 4 -*-
- *
+/*
  * Copyright (c) 2004 Apple Computer, Inc. All rights reserved.
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * @APPLE_LICENSE_HEADER_START@
  * 
- *     http://www.apache.org/licenses/LICENSE-2.0
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
  * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
  * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
 
     Change History (most recent first):
 
 $Log: Responder.c,v $
-Revision 1.3  2006/08/14 23:24:29  cheshire
-Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
-
 Revision 1.2  2004/05/20 18:38:31  cheshire
 Fix build broken by removal of 'kDNSServiceFlagsAutoRename' from dns_sd.h
 
index 0e880c9bc7d7fd27a15b2475ac4b45c30a7913bf..a0a562f0531729ec6bcbf3930738dcab0ccb6f4d 100644 (file)
@@ -1,25 +1,28 @@
-/* -*- Mode: C; tab-width: 4 -*-
- *
+/*
  * Copyright (c) 2002-2003 Apple Computer, Inc. All rights reserved.
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * @APPLE_LICENSE_HEADER_START@
  * 
- *     http://www.apache.org/licenses/LICENSE-2.0
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
  * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
  * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
 
     Change History (most recent first):
 
 $Log: Searcher.c,v $
-Revision 1.3  2006/08/14 23:24:29  cheshire
-Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
-
 Revision 1.2  2004/05/27 06:30:21  cheshire
 Add code to test DNSServiceQueryRecord()
 
index d0eb61389264c959f8fc207da3b44af2f4f940ee..2206b225be4896e7f7574f37fa3c2b768baecb55 100644 (file)
@@ -1,25 +1,28 @@
-/* -*- Mode: C; tab-width: 4 -*-
- *
+/*
  * Copyright (c) 2002-2003 Apple Computer, Inc. All rights reserved.
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * @APPLE_LICENSE_HEADER_START@
  * 
- *     http://www.apache.org/licenses/LICENSE-2.0
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
  * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
  * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
 
     Change History (most recent first):
 
 $Log: SubTypeTester.c,v $
-Revision 1.7  2006/08/14 23:24:29  cheshire
-Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
-
 Revision 1.6  2004/12/16 20:49:35  cheshire
 <rdar://problem/3324626> Cache memory management improvements
 
index e54ab00fc961d7d06535461058c73d39f93759c5..d385cb45ee978468b3dccd64aad0b717a832aaaa 100644 (file)
@@ -1,25 +1,28 @@
-/* -*- Mode: C; tab-width: 4 -*-
- *
+/*
  * Copyright (c) 2004 Apple Computer, Inc. All rights reserved.
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * @APPLE_LICENSE_HEADER_START@
  * 
- *     http://www.apache.org/licenses/LICENSE-2.0
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
  * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
  * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
 
     Change History (most recent first):
 
 $Log: mDNSLibrary.c,v $
-Revision 1.4  2006/08/14 23:24:29  cheshire
-Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
-
 Revision 1.3  2004/12/16 20:49:35  cheshire
 <rdar://problem/3324626> Cache memory management improvements
 
index f829f14f7fab5a496045ebf8c1610d9c789b9705..d671d777d331cb7ed5ef0012f52c7863867e8951 100644 (file)
@@ -1,25 +1,28 @@
-/* -*- Mode: C; tab-width: 4 -*-
- *
+/*
  * Copyright (c) 2004 Apple Computer, Inc. All rights reserved.
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * @APPLE_LICENSE_HEADER_START@
  * 
- *     http://www.apache.org/licenses/LICENSE-2.0
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
  * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
  * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
 
     Change History (most recent first):
 
 $Log: mDNSLibraryLoader.c,v $
-Revision 1.2  2006/08/14 23:24:29  cheshire
-Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
-
 Revision 1.1  2004/03/12 21:30:26  cheshire
 Build a System-Context Shared Library from mDNSCore, for the benefit of developers
 like Muse Research who want to be able to use mDNS/DNS-SD from GPL-licensed code.
index b3b37ac2fb072c1e2d08951c9292eec1f35ea9fd..82f764c5f446e030f7c5b8089a209456ab73e9df 100644 (file)
@@ -1,24 +1,33 @@
-/* -*- Mode: C; tab-width: 4 -*-
- *
+/*
  * Copyright (c) 2004 Apple Computer, Inc. All rights reserved.
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * @APPLE_LICENSE_HEADER_START@
  * 
- *     http://www.apache.org/licenses/LICENSE-2.0
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
  * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
  * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
 
     Change History (most recent first):
 
 $Log: mDNSLibraryResources.r,v $
-Revision 1.31.2.1  2006/08/29 06:24:28  cheshire
-Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
+Revision 1.33  2005/12/12 17:48:36  cheshire
+mDNSResponder-108
+
+Revision 1.32  2005/05/05 00:06:58  ksekar
+Update version string to 1.0a107.1
 
 Revision 1.31  2005/03/15 02:14:14  cheshire
 mDNSResponder-107
@@ -131,15 +140,15 @@ like Muse Research who want to be able to use mDNS/DNS-SD from GPL-licensed code
 
 resource 'vers' (1, purgeable)
        {
-   0x01, 0x00, alpha, 107, verUS,
-   "1.0a107",
-   "Multicast DNS & DNS Service Discovery 1.0a107"
+       0x01, 0x00, alpha, 108, verUS,
+       "1.0a108",
+       "Multicast DNS & DNS Service Discovery 1.0a108"
        };
 
 resource 'vers' (2, purgeable)
        {
-   0x01, 0x00, alpha, 107, verUS,
-   "1.0a107",
+   0x01, 0x00, alpha, 108, verUS,
+   "1.0a108",
    "developer.apple.com/darwin/projects/bonjour/"
        };
 
index 24cf117a5b03076f0201e13e19b3e517cf1c14d2..0dbbe5e397923bf2816c8d89cbcca27b2ee5d9f6 100644 (file)
@@ -1,28 +1,28 @@
-/* -*- Mode: C; tab-width: 4 -*-
- *
+/*
  * Copyright (c) 2002-2003 Apple Computer, Inc. All rights reserved.
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * @APPLE_LICENSE_HEADER_START@
  * 
- *     http://www.apache.org/licenses/LICENSE-2.0
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
  * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
  * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
 
     Change History (most recent first):
 
 $Log: mDNSMacOS9.c,v $
-Revision 1.46  2006/08/14 23:24:29  cheshire
-Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
-
-Revision 1.45  2006/03/19 02:00:14  cheshire
-<rdar://problem/4073825> Improve logic for delaying packets after repeated interface transitions
-
 Revision 1.44  2005/09/16 21:06:50  cheshire
 Use mDNS_TimeNow_NoLock macro, instead of writing "mDNSPlatformRawTime() + m->timenow_adjust" all over the place
 
@@ -406,7 +406,7 @@ mDNSlocal pascal void mDNSNotifier(void *contextPtr, OTEventCode code, OTResult
                                case mOT_Bind:                  OTBind(m->p->ep, (TBind*)&mDNSbindReq, NULL); break;
                                case mOT_Ready:         mDNSinitComplete(m, mStatus_NoError);
                                                                                // Can't do mDNS_RegisterInterface until *after* mDNSinitComplete has set m->mDNSPlatformStatus to mStatus_NoError
-                                                                               mDNS_RegisterInterface(m, &m->p->interface, mDNSfalse);
+                                                                               mDNS_RegisterInterface(m, &m->p->interface, 0);
                                                                                break;
                                default:                LogMsg("Unexpected m->p->mOTstate %d", m->p->mOTstate-1);
                                }
@@ -423,7 +423,7 @@ mDNSlocal pascal void mDNSNotifier(void *contextPtr, OTEventCode code, OTResult
                        if (m->p->mOTstate == mOT_Ready)
                                {
                                m->p->mOTstate = mOT_Closed;
-                               mDNS_DeregisterInterface(m, &m->p->interface, mDNSfalse);
+                               mDNS_DeregisterInterface(m, &m->p->interface);
                                }
                        if (m->p->ep) { OTCloseProvider(m->p->ep); m->p->ep = NULL; }
                        break;                                          // Do we need to do anything?
@@ -645,7 +645,7 @@ extern void mDNSPlatformClose (mDNS *const m)
        if (m->p->mOTstate == mOT_Ready)
                {
                m->p->mOTstate = mOT_Closed;
-               mDNS_DeregisterInterface(m, &m->p->interface, mDNSfalse);
+               mDNS_DeregisterInterface(m, &m->p->interface);
                }
        if (m->p->ep)          { OTCloseProvider   (m->p->ep);          m->p->ep          = NULL; }
        if (m->p->OTTimerTask) { OTDestroyTimerTask(m->p->OTTimerTask); m->p->OTTimerTask = 0;    }
index 149ec0340804e71aedb2f118bcbb504e19f1fe41..c4fa3100736de3e5ba7beaab9657a166293fbd1b 100755 (executable)
@@ -1,25 +1,28 @@
-/* -*- Mode: C; tab-width: 4 -*-
- *
+/*
  * Copyright (c) 2002-2003 Apple Computer, Inc. All rights reserved.
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * @APPLE_LICENSE_HEADER_START@
  * 
- *     http://www.apache.org/licenses/LICENSE-2.0
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
  * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
  * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
 
     Change History (most recent first):
 
 $Log: mDNSMacOS9.h,v $
-Revision 1.11  2006/08/14 23:24:29  cheshire
-Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
-
 Revision 1.10  2004/03/12 21:30:26  cheshire
 Build a System-Context Shared Library from mDNSCore, for the benefit of developers
 like Muse Research who want to be able to use mDNS/DNS-SD from GPL-licensed code.
index 5cf83fb936546342dffef227d9f69fc2ff7b75fd..80adab4697a51b6db5dc51085d92609490fc3341 100644 (file)
@@ -1,25 +1,28 @@
-/* -*- Mode: C; tab-width: 4 -*-
- *
+/*
  * Copyright (c) 2004 Apple Computer, Inc. All rights reserved.
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * @APPLE_LICENSE_HEADER_START@
  * 
- *     http://www.apache.org/licenses/LICENSE-2.0
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
  * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
  * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
 
     Change History (most recent first):
 
 $Log: mDNSPrefix.h,v $
-Revision 1.4  2006/08/14 23:24:29  cheshire
-Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
-
 Revision 1.3  2004/06/11 00:03:28  cheshire
 Add code for testing avail/busy subtypes
 
index 59bfd038d424649c33ba596153a7d2a398d968a0..c2f50c12b1e23ef8014efd082e019addf5573d90 100644 (file)
@@ -1,25 +1,28 @@
-/* -*- Mode: C; tab-width: 4 -*-
- *
+/*
  * Copyright (c) 2002-2003 Apple Computer, Inc. All rights reserved.
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * @APPLE_LICENSE_HEADER_START@
  * 
- *     http://www.apache.org/licenses/LICENSE-2.0
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
  * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
  * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
 
     Change History (most recent first):
 
 $Log: DNSServiceDiscoveryDefines.h,v $
-Revision 1.7  2006/08/14 23:24:39  cheshire
-Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
-
 Revision 1.6  2004/09/20 21:45:27  ksekar
 Mach IPC cleanup
 
index b918bee40403b780a34c7297db5e31e6175d238d..942fb6b1802216ce7d783fb7dbc84257a8ccf931 100644 (file)
@@ -1,18 +1,24 @@
-/* -*- Mode: C; tab-width: 4 -*-
- *
+/*
  * Copyright (c) 2002 Apple Computer, Inc. All rights reserved.
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * @APPLE_LICENSE_HEADER_START@
  * 
- *     http://www.apache.org/licenses/LICENSE-2.0
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
  * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
  * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
  */
  
 subsystem
index ad06bdb51fd35fe1bda69793df64679195b87e3d..b6d9cf8c2a863238cf6c8bf5cdbf04571a5d8044 100644 (file)
@@ -1,18 +1,24 @@
-/* -*- Mode: C; tab-width: 4 -*-
- *
+/*
  * Copyright (c) 2002 Apple Computer, Inc. All rights reserved.
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * @APPLE_LICENSE_HEADER_START@
  * 
- *     http://www.apache.org/licenses/LICENSE-2.0
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
  * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
  * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
  */
  
 subsystem
index 371b6fc03ca716ddacdf2eb0d7ff7de9ce0bf6f7..9f66c92db4b45dbc54e280095371f49cb37911a3 100644 (file)
@@ -2,23 +2,37 @@
  *
  * Copyright (c) 2004 Apple Computer, Inc. All rights reserved.
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * 
- *     http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
+ * @APPLE_LICENSE_HEADER_START@
+ *
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
+ *
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
  * limitations under the License.
+ *
+ * @APPLE_LICENSE_HEADER_END@
 
     Change History (most recent first):
 
 $Log: LegacyNATTraversal.c,v $
-Revision 1.12.2.1  2006/08/29 06:24:30  cheshire
-Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
+Revision 1.14.2.1  2005/12/12 17:38:40  cheshire
+Put buffer overflow bug 4151514 back in by order of Program CCC:
+"Program CCC Denied.  This change does not meet the criteria for Chardonnay."
+
+Revision 1.14  2005/12/08 03:00:33  cheshire
+<rdar://problem/4349971> Byte order bugs in Legacy NAT traversal code
+
+Revision 1.13  2005/09/07 18:23:05  ksekar
+<rdar://problem/4151514> Off-by-one overflow in LegacyNATTraversal
 
 Revision 1.12  2005/07/22 21:36:16  ksekar
 Fix GCC 4.0/Intel compiler warnings
@@ -102,6 +116,8 @@ Revision 1.1  2004/08/18 17:35:41  ksekar
 // TODO: remove later and do variable length
 #define MAX_SOAPMSGSIZE                65536
 
+// This code accidentally closes fd 0 all over the place
+// To stop that messing up the mDNSResponder core, we trap it and prevent it
 static int safe_close(int fd)
        {
        if (fd < 3) { /* LogMsg("safe_close: ERROR sd %d < 3", fd); */ return(-1); }
@@ -110,6 +126,10 @@ static int safe_close(int fd)
 
 #define close safe_close
 
+// This code uses fprintf(stderr, ...) and similar to log error messages
+// We redirect all of them to syslog using our LogMsg mechanism
+#define fprintf(file, ...) LogMsg(__VA_ARGS__)
+
 ////////////////////////////////////////////////////////////////////////
 // NetAddr Functions
 ////////////////////////////////////////////////////////////////////////
@@ -432,7 +452,7 @@ typedef struct tagIPINFO
 {
         int                             iFlags;
         char                    szIfName[IFNAMELEN];    /* Interface name                       */
-        unsigned char   abIP[IPLEN];                    /* IP in host byte order        */
+        unsigned char   abIP[IPLEN];
         unsigned short  wPort;
 } IPINFO, *PIPINFO, **PPIPINFO;
 
@@ -440,10 +460,13 @@ typedef struct hostent    HOSTENT, *PHOSTENT;
 
 static unsigned long GetNATIPNetmask(unsigned long dwIP)
 {
-       if ((dwIP & 0xFF000000) == 0x0A000000)  return 0xFF000000;
-       if ((dwIP & 0xFFF00000) == 0xAC100000)  return 0xFFF00000;
-       if ((dwIP & 0xFFFF0000) == 0xC0a80000)  return 0xFFFF0000;
-
+       static const union { uint8_t b[4]; uint32_t l; } mask_10 = { { 255, 0,   0, 0 } };      // Mask for 10/8
+       static const union { uint8_t b[4]; uint32_t l; } mask172 = { { 255, 240, 0, 0 } };      // Mask for 172.16/12
+       static const union { uint8_t b[4]; uint32_t l; } mask192 = { { 255, 255, 0, 0 } };      // Mask for 192.168/16
+       uint8_t *p = (uint8_t *)&dwIP;
+       if (p[0] ==  10                       ) return mask_10.l;
+       if (p[0] == 172 && (p[1] & 0xF0) == 16) return mask172.l;
+       if (p[0] == 192 && p[1] == 168        ) return mask192.l;
        return 0;       /* No NAT IP */
 }
 
@@ -527,8 +550,7 @@ static int GetIPInfo(PPIPINFO ppIPInfo)
                {
                case AF_INET:
                        memcpy(pIPInfo[iNum].szIfName, ifr->ifr_name, IFNAMELEN);
-                       dwIP =
-                               ntohl(((struct sockaddr_in *)&ifr->ifr_addr)->sin_addr.s_addr);
+                       dwIP = ((struct sockaddr_in *)&ifr->ifr_addr)->sin_addr.s_addr;
                        memcpy(pIPInfo[iNum].abIP, &dwIP, sizeof(unsigned long));
                        if (ifrcopy.ifr_flags & IFF_POINTOPOINT)
                                pIPInfo[iNum].iFlags |= ISPPP;
@@ -601,7 +623,7 @@ static int SSDPListen()
        saddr.sin_family = AF_INET;
        //saddr.sin_addr.s_addr = inet_addr(SSDP_IP);
        //saddr.sin_port = htons(SSDP_PORT);
-       saddr.sin_addr.s_addr = htonl(g_dwLocalIP);
+       saddr.sin_addr.s_addr = g_dwLocalIP;
        saddr.sin_port = 0;
 
        // and set the multicast add_member structure
@@ -646,7 +668,7 @@ static int EventListen()
                bzero(&saddr, sizeof(saddr));
                saddr.sin_len = sizeof(saddr);
                saddr.sin_family = AF_INET;
-               saddr.sin_addr.s_addr = htonl(g_dwLocalIP);
+               saddr.sin_addr.s_addr = g_dwLocalIP;
                saddr.sin_port = htons(g_wEventPort);
 
                // return if okay
@@ -717,7 +739,7 @@ static void DumpHex(char *buf, int len)
                        nexti = i + 16;
                        endj = (nexti > len) ? len : nexti;
                        for (j = i; j < endj; j++)
-                               fprintf(g_log, "%02x ", buf[j] & 0xff);
+                               fprintf(g_log, "%02x %c ", buf[j] & 0xff, buf[j]);
                        if (j == len) {
                                if ((j % 16) != 0) {
                                        char pad[3 * 16 + 1];  // don't need the last 3 bytes anyway
@@ -756,7 +778,7 @@ static char *FindHTTPHeaderNewLine(char *pbuf, int iBufSize, int *pfEOH)
                result = memchr(pbuf, '\r', iBufSize);
                if (result == NULL) {
                        if (g_fLogging & NALOG_INFO0) {
-                               fprintf(g_log, "FindHTTPHeaderNewLine: er @(%d)\n", i);
+                               fprintf(g_log, "FindHTTPHeaderNewLine: er @(%d/%d)\n", i, iBufSize);
                                fflush(g_log);
                        }
                        return NULL;
@@ -894,7 +916,15 @@ static PHTTPResponse NewHTTPResponse_sz(
                pszEOL = FindHTTPHeaderNewLine(pszEOL,
                        iBufferSize - (pszEOL - pBuf),  // remainder size
                        &fEOH);
-               if (pszEOL == NULL) goto cleanup;  // syntax error
+               if (pszEOL == NULL) {
+                       if (g_fLogging & NALOG_INFO0) {
+                               fprintf(g_log, "NewHTTPResponse_sz: er reading header field %d @ %lu / %lu\n",
+                                       iNumHeaders, pHeader->pszName - pBuf, iBufferSize);
+                               DumpHex(pszHTTPResponse, iBufferSize);
+                               fflush(g_log);
+                       }
+                       goto cleanup;  // syntax error
+               }
 
                *pszEOL = '\0';  // terminate this string
                pszEOL += 2;  // point to beginning of next line
@@ -1304,12 +1334,9 @@ static void *TCPProc(void *in)
                char response[2000];
                PHTTPResponse resp;
                int n;
-               sprintf(callback, "%lu.%lu.%lu.%lu:%u", 
-                       (g_dwLocalIP >> 24) & 0xFF,
-                       (g_dwLocalIP >> 16) & 0xFF,
-                       (g_dwLocalIP >> 8) & 0xFF,
-                       (g_dwLocalIP >> 0) & 0xFF,
-                       g_wEventPort);
+               sprintf(callback, "%u.%u.%u.%u:%u",
+                       ((uint8_t*)&g_dwLocalIP)[0], ((uint8_t*)&g_dwLocalIP)[1],
+                       ((uint8_t*)&g_dwLocalIP)[2], ((uint8_t*)&g_dwLocalIP)[3], g_wEventPort);
 
                n = sprintf((char *)buf,
                        szEventMsgSubscribeFMT,
@@ -1324,7 +1351,7 @@ static void *TCPProc(void *in)
                if (n > 0)
                {
                        response[n] = '\0';
-                       resp = NewHTTPResponse_sz((char *)buf, n, TRUE);
+                       resp = NewHTTPResponse_sz((char *)response, n+1, TRUE);
                        if (NULL != resp)
                        {
 ////TracePrint(ELL_TRACE, "UPnP Subscribe returns %s/%d\n", resp->pszStatus, n);
@@ -1500,7 +1527,7 @@ static void *UDPProc(void *in)
 
                if (!FD_ISSET(g_sUDP, &readfds)) continue;
                recvaddrlen = sizeof(recvaddr);
-               n = recvfrom(g_sUDP, buf, sizeof(buf), 0,
+               n = recvfrom(g_sUDP, buf, sizeof(buf), 0, // ### !!! Buffer overflow !!! Should be sizeof(buf)-1 to allow for "buf[n] = '\0';" below !!!
                        (struct sockaddr *)&recvaddr, &recvaddrlen);
                if (n < 0) {
                        if (g_fLogging & NALOG_ERROR)
@@ -1513,7 +1540,7 @@ static void *UDPProc(void *in)
                }
                buf[n] = '\0';
                if (strncmp((char *)buf, "HTTP/1.1", 8) == 0) {
-                       PHTTPResponse pResponse = NewHTTPResponse_sz((char *)buf, n, TRUE);
+                       PHTTPResponse pResponse = NewHTTPResponse_sz((char *)buf, n+1, TRUE);
                        PrintHTTPResponse(pResponse);
                        if (DiscoverRouter(pResponse) == 0)
                        {
@@ -1532,7 +1559,7 @@ static void *UDPProc(void *in)
                        // temporarily use this to fudge - will have the exact same
                        // parsing, only status/reason set to "*" and "HTTP/1.1".
                        // TODO: add support for HTTP requests
-                       PHTTPResponse pResponse = NewHTTPResponse_sz((char *)buf, n, TRUE);
+                       PHTTPResponse pResponse = NewHTTPResponse_sz((char *)buf, n+1, TRUE);
                        if (DiscoverRouter(pResponse) == 0)
                        {
                                time_t  now = time(NULL);
@@ -1854,13 +1881,14 @@ GetTimeElapsed(&tv_start, &tv_end, &tv_elapsed);
 
                FD_ZERO(&readfds);
                FD_SET(s, &readfds);
-               //timeout.tv_sec = g_iFunctionTimeout / U_TOGRAN;
-               //timeout.tv_usec = (g_iFunctionTimeout % U_TOGRAN) * 1000000 / U_TOGRAN;
-               // just do flat 2 sec now, since connection already established
-               timeout.tv_sec = 1;
-               timeout.tv_usec = 0;
-
 
+               // In testing, the Linksys Wireless-G Broadband Router "WRT54GS" takes
+               // up to four seconds to respond, and even then only a partial response,
+               // with the remainder coming in a second TCP segment half a second later.
+               // Accordingly, we wait up to five seconds for the initial data, and then after that
+               // wait one second after subsequent TCP segments, in care more data is still coming.
+               timeout.tv_sec  = iBufLen ? 1 : 5;
+               timeout.tv_usec = 0;
                iRet = select(s+1, &readfds, NULL, NULL, &timeout);
                if (iRet <= 0)
                {
@@ -1925,7 +1953,7 @@ GetTimeElapsed(&tv_start, &tv_end, &tv_elapsed);
 //fprintf(stderr, "2 -- \n");
 
        if (g_fLogging & NALOG_INFO1)
-               fprintf(g_log, "done recv @%lu\n", time(NULL));
+               fprintf(g_log, "SendTCPMsg_saddr_2part done recv %d @ %lu\n", iBufLen, time(NULL));
 
        if (result == NULL) {    // if caller just want to send/display msgs
                if (g_fLogging & NALOG_DUMP)
@@ -2014,7 +2042,7 @@ static int SendTCPMsg_saddr_parse(
        }
 
        if (g_fLogging & NALOG_INFO1)
-               fprintf(g_log, "SendTCPMsg/parse: Before Sending TCP Msg: %d == %lu?\n",
+               fprintf(g_log, "SendTCPMsg_saddr_parse: Before Sending TCP Msg: %d == %lu?\n",
                        iLen, strlen(msg));
        if (g_fLogging & NALOG_DUMP)
                fprintf(g_log,"Sending TCP msg:\n[%s]\n", msg);
@@ -2066,12 +2094,14 @@ static int SendTCPMsg_saddr_parse(
 
                FD_ZERO(&readfds);
                FD_SET(s, &readfds);
-               //timeout.tv_sec = g_iFunctionTimeout / U_TOGRAN;
-               //timeout.tv_usec = (g_iFunctionTimeout % U_TOGRAN) * 1000000 / U_TOGRAN;
-               // just do flat 2 sec now, since connection already established
-               timeout.tv_sec = 1;
-               timeout.tv_usec = 0;
 
+               // In testing, the Linksys Wireless-G Broadband Router "WRT54GS" takes
+               // up to four seconds to respond, and even then only a partial response,
+               // with the remainder coming in a second TCP segment half a second later.
+               // Accordingly, we wait up to five seconds for the initial data, and then after that
+               // wait one second after subsequent TCP segments, in care more data is still coming.
+               timeout.tv_sec  = iBufLen ? 1 : 5;
+               timeout.tv_usec = 0;
                iRet = select(s+1, &readfds, NULL, NULL, &timeout);
                if (iRet <= 0) {
 //fprintf(stderr, "**********: select failed (%d/%d)\n", iRet, errno);
@@ -2098,6 +2128,8 @@ static int SendTCPMsg_saddr_parse(
                if (resultSize <= iBufLen) {
                        char    t[1000];
                        i = recv(s, &t, 1000, 0);
+                       if (g_fLogging & NALOG_INFO1)
+                               fprintf(g_log, "SendTCPMsg_saddr_parse discarding %d bytes\n", i);
                        if (i== 0) break;
                        // Note that there's no dump here - prevents DoS attack from
                        // flooding the logs/diskspace
@@ -2105,6 +2137,8 @@ static int SendTCPMsg_saddr_parse(
                }
 
                i = recv(s, result + iBufLen, resultSize - iBufLen, 0);
+               if (g_fLogging & NALOG_INFO1)
+                       fprintf(g_log, "SendTCPMsg_saddr_parse read %d bytes (%d/%d)\n", i, iBufLen, resultSize);
                if (0 == i) {
 
                        break;
@@ -2127,7 +2161,7 @@ static int SendTCPMsg_saddr_parse(
 //fprintf(stderr, "p -- \n");
 
        if (g_fLogging & NALOG_INFO1)
-               fprintf(g_log, "done recv @%lu\n", time(NULL));
+               fprintf(g_log, "SendTCPMsg_saddr_parse done recv %d @ %lu\n", iBufLen, time(NULL));
 
        if (result == NULL) {    // if caller just want to send/display msgs
                if (g_fLogging & NALOG_DUMP)
@@ -2239,6 +2273,8 @@ static PHTTPResponse SendSOAPMsgControlAction(
                        &g_saddrRouterSOAP);
        }
 
+       if (g_fLogging & NALOG_INFO1)
+               fprintf(g_log, "SendSOAPMsgControlAction iResultLen %d\n", iResultLen);
        if (iResultLen > 0) {
                if (iResultLen > MAX_SOAPMSGSIZE) {
                        if (g_fLogging & NALOG_ALERT)
@@ -2469,10 +2505,8 @@ static void ParseURL(
        szBuf,
        pszHostPort?pszHostPort:"",
        pszPath?pszPath:"",
-       (psaddr->sin_addr.s_addr >> 24) & 0xff,
-       (psaddr->sin_addr.s_addr >> 16) & 0xff,
-       (psaddr->sin_addr.s_addr >> 8) & 0xff,
-       (psaddr->sin_addr.s_addr >> 0) & 0xff,
+       ((uint8_t*)&psaddr->sin_addr.s_addr)[0], ((uint8_t*)&psaddr->sin_addr.s_addr)[1],
+       ((uint8_t*)&psaddr->sin_addr.s_addr)[2], ((uint8_t*)&psaddr->sin_addr.s_addr)[3],
        psaddr->sin_port);
 #endif
 }
@@ -2602,17 +2636,13 @@ static void GetIPByName(char *hostname, unsigned long *ip_ret)
                if (pHEnt == NULL) {
                        if (g_fLogging & NALOG_ALERT)
                                fprintf(g_log, "Can't translate [%s] to IP...\n", hostname);
-                       g_dwLocalIP = htonl(INADDR_ANY);
+                       g_dwLocalIP = INADDR_ANY;
                        return;
                }
-               ip = ntohl(*(unsigned long *)(pHEnt->h_addr));
+               ip = *(unsigned long *)(pHEnt->h_addr);
                if (g_fLogging & NALOG_INFO1)
-                       fprintf(g_log, "hostname [%s] to ip: %ld.%ld.%ld.%ld\n",
-                               hostname,
-                               (ip >> 24) & 0xff,
-                               (ip >> 16) & 0xff,
-                               (ip >> 8) & 0xff,
-                               (ip >> 0) & 0xff);
+                       fprintf(g_log, "hostname [%s] to ip: %u.%u.%u.%u\n", hostname,
+                               ((uint8_t*)&ip)[0], ((uint8_t*)&ip)[1], ((uint8_t*)&ip)[2], ((uint8_t*)&ip)[3]);
        }
        *ip_ret = ip;
 }
@@ -2680,9 +2710,8 @@ mStatus LNT_UnmapPort(mDNSIPPort PubPort, mDNSBool tcp)
        //unsigned              long dwIP;
        Property                propArgs[3];
        PHTTPResponse   resp;
-    unsigned short port = PubPort.NotAnInteger;
     int protocol = tcp ? IPPROTO_TCP : IPPROTO_UDP;
-       sprintf(szEPort, "%u", port);
+       sprintf(szEPort, "%u", mDNSVal16(PubPort));
 
        bzero(propArgs, sizeof(propArgs));
        propArgs[0].pszName = "NewRemoteHost";
@@ -2730,26 +2759,19 @@ extern mStatus LNT_MapPort(mDNSIPPort priv, mDNSIPPort pub, mDNSBool tcp)
        char                    descr[40];
        Property                propArgs[8];
        PHTTPResponse   resp;
-    unsigned short iport = priv.NotAnInteger;
-    unsigned short eport = pub.NotAnInteger;
     int protocol = tcp ? IPPROTO_TCP : IPPROTO_UDP;
 
-
-       if (NA_E_EXISTS == GetMappingUnused(eport, protocol))
+       if (NA_E_EXISTS == GetMappingUnused(mDNSVal16(pub), protocol))
                return mStatus_AlreadyRegistered;
 
        //DeletePortMapping(eport, protocol);
 
-       sprintf(szEPort, "%u", eport);
-
-       sprintf(szIPort, "%u", iport);
+       sprintf(szEPort, "%u", mDNSVal16(pub));
+       sprintf(szIPort, "%u", mDNSVal16(priv));
 
        dwIP = g_dwLocalIP;
        sprintf(szLocalIP, "%u.%u.%u.%u",
-               (unsigned int)((dwIP >> 24) & 0xff),
-               (unsigned int)((dwIP >> 16) & 0xff),
-               (unsigned int)((dwIP >> 8) & 0xff),
-               (unsigned int)((dwIP >> 0) & 0xff));
+               ((uint8_t*)&dwIP)[0], ((uint8_t*)&dwIP)[1], ((uint8_t*)&dwIP)[2], ((uint8_t*)&dwIP)[3]);
 
        bzero(propArgs, sizeof(propArgs));
        propArgs[0].pszName = "NewRemoteHost";
@@ -2779,7 +2801,7 @@ extern mStatus LNT_MapPort(mDNSIPPort priv, mDNSIPPort pub, mDNSBool tcp)
        propArgs[5].pszValue = "1";
        propArgs[5].pszType = "boolean";
        propArgs[6].pszName = "NewPortMappingDescription";
-       sprintf(descr, "iC%u", eport);
+       sprintf(descr, "iC%u", mDNSVal16(pub));
        //propArgs[6].pszValue = "V";
        propArgs[6].pszValue = descr;
        propArgs[6].pszType = "string";
@@ -2787,9 +2809,15 @@ extern mStatus LNT_MapPort(mDNSIPPort priv, mDNSIPPort pub, mDNSBool tcp)
        propArgs[7].pszValue = "0";
        propArgs[7].pszType = "ui4";
 
+       if (g_fLogging & NALOG_INFO1)
+               fprintf(g_log, "Sending AddPortMapping priv %u pub %u\n", mDNSVal16(priv), mDNSVal16(pub));
+
        resp = SendSOAPMsgControlAction(
                "AddPortMapping", 8, propArgs, FALSE);
 
+       if (g_fLogging & NALOG_INFO1)
+               fprintf(g_log, "AddPortMapping resp %p\n", resp);
+
        if (resp == NULL) {
                return mStatus_NATTraversal;
        }
@@ -2910,11 +2938,13 @@ int LegacyNATInit(void)
        pthread_attr_t  attr;
        int                             iRet;
        //struct timeval        tv;
+       LogOperation("LegacyNATInit");
 
        static int              fFirstInitLocks = TRUE;
        FILE *log = NULL;       
        
        g_fLogging = 0;
+       //g_fLogging = ~0;              // Turns ALL logging on
        g_log = stderr;
 
        SetLocalIP();
index 5ba4674ee10c023e982bef935a5899d38b3f8bdd..97b560f6e303dff0cf5b1151c411dd18d4eafae0 100644 (file)
Binary files a/mDNSMacOSX/PreferencePane/BonjourPref.icns and b/mDNSMacOSX/PreferencePane/BonjourPref.icns differ
index 9e59fa50d5b16738bc6af80123851e46af16bc35..85f441e18215de83e10ab46119462f02b9c1e2d2 100644 (file)
     ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
     Change History (most recent first):
-
 $Log: ConfigurationRights.h,v $
-Revision 1.2  2006/08/14 23:15:47  cheshire
-Tidy up Change History comment
-
 Revision 1.1  2005/02/05 01:59:19  cheshire
 Add Preference Pane to facilitate testing of DDNS & wide-area features
 
index cf69c9c2e19a7c329725b5928e5318e72363ee90..21f98f56ef4493136c65a9a90d9ff7b2084b33c0 100644 (file)
     ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
     Change History (most recent first):
-
 $Log: DNSServiceDiscoveryPref.h,v $
-Revision 1.6  2006/08/14 23:15:47  cheshire
-Tidy up Change History comment
-
 Revision 1.5  2005/02/26 00:44:24  cheshire
 Restore default reg domain if user deletes text and clicks "apply"
 
index 373e52eba87c69fd6b7dbd76521772c7b2b85719..e7744980007dfc77722756c53bef09c9cc8dc24a 100644 (file)
     ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
     Change History (most recent first):
-
 $Log: DNSServiceDiscoveryPref.m,v $
-Revision 1.8  2006/08/14 23:15:47  cheshire
-Tidy up Change History comment
-
-Revision 1.7  2006/07/14 03:59:14  cheshire
-Fix compile warnings: 'sortUsingFunction:context:' comparison function needs to return int
-
 Revision 1.6  2005/02/26 00:44:24  cheshire
 Restore default reg domain if user deletes text and clicks "apply"
 
@@ -77,14 +70,14 @@ Add Preference Pane to facilitate testing of DDNS & wide-area features
 
 @implementation DNSServiceDiscoveryPref
 
-static int
+static CFComparisonResult
 MyArrayCompareFunction(id val1, id val2, void *context)
 {
     return CFStringCompare((CFStringRef)val1, (CFStringRef)val2, kCFCompareCaseInsensitive);
 }
 
 
-static int
+static CFComparisonResult
 MyDomainArrayCompareFunction(id val1, id val2, void *context)
 {
        NSString *domain1 = [val1 objectForKey:(NSString *)SC_DYNDNS_DOMAIN_KEY];
@@ -1207,4 +1200,5 @@ MyDNSServiceAddServiceToRunLoop(MyDNSServiceState * query)
     [self disableControls];
 }
 
-@end
+
+@end
\ No newline at end of file
index c523f4e61e196c00ff06e0e2d0c5b83389108f46..e76e125fac018382ff1d61cbb81b481317e61551 100644 (file)
Binary files a/mDNSMacOSX/PreferencePane/English.lproj/InfoPlist.strings and b/mDNSMacOSX/PreferencePane/English.lproj/InfoPlist.strings differ
index 0ca00dbb2e7b11737755a1580b40f78d2b131ebb..89b9736caababb867e39c9542b0cf24f518e1073 100644 (file)
     ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
     Change History (most recent first):
-
 $Log: PrivilegedOperations.c,v $
-Revision 1.6  2006/08/14 23:15:47  cheshire
-Tidy up Change History comment
-
-Revision 1.5  2006/06/10 02:07:11  mkrochma
-Whoa.  Make sure code compiles before checking it in.
-
-Revision 1.4  2006/05/27 02:32:38  mkrochma
-Wait for installer script to exit before returning result
-
 Revision 1.3  2005/06/04 04:50:00  cheshire
 <rdar://problem/4138070> ddnswriteconfig (Bonjour PreferencePane) vulnerability
 Use installtool instead of requiring ddnswriteconfig to self-install
@@ -142,18 +132,8 @@ OSStatus EnsureToolInstalled(void)
                {
                        char *installerargs[] = { toolSourcePath, NULL };
                        err = AuthorizationExecuteWithPrivileges(authRef, toolInstallerPath, 0, installerargs, (FILE**) NULL);
-                       if (err == noErr) {
-                               int status;
-                               int pid = wait(&status);
-                               if (pid > 0 && WIFEXITED(status)) {
-                                       err = WEXITSTATUS(status);
-                                       if (err == noErr) {
-                                               gToolApproved = true;
-                                       }
-                               } else {
-                                       err = -1;
-                               }
-                       }
+                       if (err == noErr)
+                               gToolApproved = true;
                        (void) AuthorizationFree(authRef, kAuthorizationFlagDestroyRights);
                }
        }
index e76cb6895e5f1c5bd0d52701ff312fa9d8afde4e..c5c68a0b5ad7d3a7d88d51b30e8cc06358a9bc62 100644 (file)
     ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
     Change History (most recent first):
-
 $Log: PrivilegedOperations.h,v $
-Revision 1.5  2006/08/14 23:15:47  cheshire
-Tidy up Change History comment
-
 Revision 1.4  2005/06/04 04:50:00  cheshire
 <rdar://problem/4138070> ddnswriteconfig (Bonjour PreferencePane) vulnerability
 Use installtool instead of requiring ddnswriteconfig to self-install
index 3c5398b0962b6081413a93bebf4131e5c6513b9e..ff3080ef37193ebd2c9de1872294ab29ca6986c4 100644 (file)
     ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
     Change History (most recent first):
-
 $Log: ddnswriteconfig.m,v $
-Revision 1.5  2006/08/14 23:15:47  cheshire
-Tidy up Change History comment
-
 Revision 1.4  2005/06/04 04:47:47  cheshire
 <rdar://problem/4138070> ddnswriteconfig (Bonjour PreferencePane) vulnerability
 Remove self-installing capability of ddnswriteconfig
index 6240d338c11752c1152e778f783903a1812f2a2c..8fa79ad018afd2df9ff477f2503a2e5fbf853291 100755 (executable)
@@ -1,5 +1,4 @@
 #!/usr/bin/perl
-# Emacs settings: -*- tab-width: 4 -*-
 #
 # File: installtool
 # 
 # Change History (most recent first):
 # 
 # $Log: installtool,v $
-# Revision 1.3  2006/09/05 20:00:13  cheshire
-# Moved Emacs settings to second line of file
-#
-# Revision 1.2  2006/08/14 23:15:14  cheshire
-# Added "tab-width" emacs header line
-#
 # Revision 1.1  2005/06/04 04:51:48  cheshire
 # <rdar://problem/4138070> ddnswriteconfig (Bonjour PreferencePane) vulnerability
 # Added separate "installtool" script instead of making ddnswriteconfig self-install
index 1e03989e5bddcb559a5686466b85ec9dc6c38c94..a387269247f4d26c1a2b0bddf92db585100325a8 100644 (file)
@@ -1,18 +1,24 @@
-/* -*- Mode: C; tab-width: 4 -*-
- *
+/*
  * Copyright (c) 2002-2003 Apple Computer, Inc. All rights reserved.
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * @APPLE_LICENSE_HEADER_START@
  * 
- *     http://www.apache.org/licenses/LICENSE-2.0
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
  * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
  * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
  *
  * Formatting notes:
  * This code follows the "Whitesmiths style" C indentation rules. Plenty of discussion
     Change History (most recent first):
 
 $Log: SamplemDNSClient.c,v $
-Revision 1.48  2006/08/14 23:24:39  cheshire
-Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
-
-Revision 1.47  2006/01/10 02:29:22  cheshire
-<rdar://problem/4403861> Cosmetic IPv6 address display problem in mDNS test tool
-
 Revision 1.46  2004/11/02 01:32:34  cheshire
 <rdar://problem/3861705> Update code so it still compiles when DNSServiceDiscovery.h is deprecated
 
@@ -217,14 +217,12 @@ static void resolve_reply(struct sockaddr *interface, struct sockaddr *address,
         else if (address->sa_family == AF_INET6)
             {
             struct sockaddr_in6 *ip6 = (struct sockaddr_in6 *)address;
-            u_int8_t *b = ip6->sin6_addr.__u6_addr.__u6_addr8;
+            u_int16_t *w = ip6->sin6_addr.__u6_addr.__u6_addr16;
             union { uint16_t s; u_char b[2]; } port = { ip6->sin6_port };
             uint16_t PortAsNumber = ((uint16_t)port.b[0]) << 8 | port.b[1];
             char ipstring[40];
             char ifname[IF_NAMESIZE + 1] = "";
-            sprintf(ipstring, "%02X%02X:%02X%02X:%02X%02X:%02X%02X:%02X%02X:%02X%02X:%02X%02X:%02X%02X",
-                               b[0x0], b[0x1], b[0x2], b[0x3], b[0x4], b[0x5], b[0x6], b[0x7],
-                               b[0x8], b[0x9], b[0xA], b[0xB], b[0xC], b[0xD], b[0xE], b[0xF]);
+            sprintf(ipstring, "%04X:%04X:%04X:%04X:%04X:%04X:%04X:%04X", w[0], w[1], w[2], w[3], w[4], w[5], w[6], w[7]);
             if (ip6->sin6_scope_id) { ifname[0] = '%';  if_indextoname(ip6->sin6_scope_id, &ifname[1]); }
             printf("%s%s:%u", ipstring, ifname, PortAsNumber);
             }
index dab0a3087a38bffed0f3baead57e7ab61470c2e8..779447941c2ad40e0534f25c854d9fe909f3b7ae 100644 (file)
@@ -1,18 +1,24 @@
-/* -*- Mode: C; tab-width: 4 -*-
+/*
+ * Copyright (c) 2002-2003 Apple Computer, Inc. All rights reserved.
  *
- * Copyright (c) 2002-2006 Apple Computer, Inc. All rights reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * @APPLE_LICENSE_HEADER_START@
  * 
- *     http://www.apache.org/licenses/LICENSE-2.0
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
  * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
  * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
  *
  * Formatting notes:
  * This code follows the "Whitesmiths style" C indentation rules. Plenty of discussion
     Change History (most recent first):
 
 $Log: daemon.c,v $
-Revision 1.265.2.1  2006/08/29 06:24:30  cheshire
-Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
-
-Revision 1.265  2006/06/29 07:32:08  cheshire
-Added missing LogOperation logging for DNSServiceBrowse results
-
-Revision 1.264  2006/06/29 05:33:30  cheshire
-<rdar://problem/4607043> mDNSResponder conditional compilation options
-
-Revision 1.263  2006/06/08 23:23:48  cheshire
-Fix errant indentation of curly brace at the end of provide_DNSServiceBrowserCreate_rpc()
-
-Revision 1.262  2006/03/18 21:49:11  cheshire
-Added comment in ShowTaskSchedulingError(mDNS *const m)
-
-Revision 1.261  2006/01/06 01:22:28  cheshire
-<rdar://problem/4108164> Reword "mach_absolute_time went backwards" dialog
-
-Revision 1.260  2005/11/07 01:51:58  cheshire
-<rdar://problem/4331591> Include list of configured DNS servers in SIGINFO output
-
-Revision 1.259  2005/07/22 21:50:55  ksekar
+Revision 1.255.2.1  2005/07/22 21:45:04  ksekar
 Fix GCC 4.0/Intel compiler warnings
 
-Revision 1.258  2005/07/04 22:40:26  cheshire
-Additional debugging code to help catch memory corruption
-
-Revision 1.257  2005/03/28 19:28:55  cheshire
-Fix minor typos in LogOperation() messages
-
-Revision 1.256  2005/03/17 22:01:22  cheshire
-Tidy up alignment of lines to make code more readable
-
 Revision 1.255  2005/03/09 00:48:43  cheshire
 <rdar://problem/4015157> QU packets getting sent too early on wake from sleep
 Move "m->p->NetworkChanged = 0;" line from caller to callee
@@ -773,105 +749,59 @@ static DNSServiceRegistration      *DNSServiceRegistrationList      = NULL;
 
 char _malloc_options[] = "AXZ";
 
-mDNSexport void LogMemCorruption(const char *format, ...)
-       {
-       char buffer[512];
-       va_list ptr;
-       va_start(ptr,format);
-       buffer[mDNS_vsnprintf((char *)buffer, sizeof(buffer), format, ptr)] = 0;
-       va_end(ptr);
-       LogMsg("!!!! %s !!!!", buffer);
-       NotifyOfElusiveBug("Memory Corruption", buffer);
-       //*(long*)0 = -1;       // Trick to crash and get a stack trace right here, if that's what we want
-       }
-
 mDNSlocal void validatelists(mDNS *const m)
        {
-       // Check Mach client lists
-       
        DNSServiceDomainEnumeration *e;
+       DNSServiceBrowser           *b;
+       DNSServiceResolver          *l;
+       DNSServiceRegistration      *r;
+       AuthRecord                  *rr;
+       CacheGroup                  *cg;
+       CacheRecord                 *cr;
+       DNSQuestion                 *q;
+       mDNSu32 slot;
+       NetworkInterfaceInfoOSX     *i;
+
        for (e = DNSServiceDomainEnumerationList; e; e=e->next)
                if (e->ClientMachPort == 0 || e->ClientMachPort == (mach_port_t)~0)
-                       LogMemCorruption("DNSServiceDomainEnumerationList: %p is garbage (%X)", e, e->ClientMachPort);
+                       LogMsg("!!!! DNSServiceDomainEnumerationList: %p is garbage (%X) !!!!", e, e->ClientMachPort);
 
-       DNSServiceBrowser           *b;
        for (b = DNSServiceBrowserList; b; b=b->next)
                if (b->ClientMachPort == 0 || b->ClientMachPort == (mach_port_t)~0)
-                       LogMemCorruption("DNSServiceBrowserList: %p is garbage (%X)", b, b->ClientMachPort);
+                       LogMsg("!!!! DNSServiceBrowserList: %p is garbage (%X) !!!!", b, b->ClientMachPort);
 
-       DNSServiceResolver          *l;
        for (l = DNSServiceResolverList; l; l=l->next)
                if (l->ClientMachPort == 0 || l->ClientMachPort == (mach_port_t)~0)
-                       LogMemCorruption("DNSServiceResolverList: %p is garbage (%X)", l, l->ClientMachPort);
+                       LogMsg("!!!! DNSServiceResolverList: %p is garbage (%X) !!!!", l, l->ClientMachPort);
 
-       DNSServiceRegistration      *r;
        for (r = DNSServiceRegistrationList; r; r=r->next)
                if (r->ClientMachPort == 0 || r->ClientMachPort == (mach_port_t)~0)
-                       LogMemCorruption("DNSServiceRegistrationList: %p is garbage (%X)", r, r->ClientMachPort);
+                       LogMsg("!!!! DNSServiceRegistrationList: %p is garbage (%X) !!!!", r, r->ClientMachPort);
 
-       // Check UDS client lists
-       uds_validatelists();
-
-       // Check core mDNS lists
-       AuthRecord                  *rr;
        for (rr = m->ResourceRecords; rr; rr=rr->next)
                {
                if (rr->resrec.RecordType == 0 || rr->resrec.RecordType == 0xFF)
-                       LogMemCorruption("ResourceRecords list: %p is garbage (%X)", rr, rr->resrec.RecordType);
+                       LogMsg("!!!! ResourceRecords list: %p is garbage (%X) !!!!", rr, rr->resrec.RecordType);
                if (rr->resrec.name != &rr->namestorage)
-                       LogMemCorruption("ResourceRecords list: %p name %p does not point to namestorage %p %##s",
+                       LogMsg("!!!! ResourceRecords list: %p name %p does not point to namestorage %p %##s",
                                rr, rr->resrec.name->c, rr->namestorage.c, rr->namestorage.c);
                }
 
        for (rr = m->DuplicateRecords; rr; rr=rr->next)
                if (rr->resrec.RecordType == 0 || rr->resrec.RecordType == 0xFF)
-                       LogMemCorruption("DuplicateRecords list: %p is garbage (%X)", rr, rr->resrec.RecordType);
+                       LogMsg("!!!! DuplicateRecords list: %p is garbage (%X) !!!!", rr, rr->resrec.RecordType);
 
-       DNSQuestion                 *q;
        for (q = m->Questions; q; q=q->next)
                if (q->ThisQInterval == (mDNSs32)~0)
-                       LogMemCorruption("Questions list: %p is garbage (%lX)", q, q->ThisQInterval);
+                       LogMsg("!!!! Questions list: %p is garbage (%lX) !!!!", q, q->ThisQInterval);
 
-       CacheGroup                  *cg;
-       CacheRecord                 *cr;
-       mDNSu32 slot;
        FORALL_CACHERECORDS(slot, cg, cr)
                if (cr->resrec.RecordType == 0 || cr->resrec.RecordType == 0xFF)
-                       LogMemCorruption("Cache slot %lu: %p is garbage (%X)", slot, rr, rr->resrec.RecordType);
+                       LogMsg("!!!! Cache slot %lu: %p is garbage (%X) !!!!", slot, rr, rr->resrec.RecordType);
 
-       // Check platform-layer lists
-
-       NetworkInterfaceInfoOSX     *i;
        for (i = m->p->InterfaceList; i; i = i->next)
                if (!i->ifa_name)
-                       LogMemCorruption("InterfaceList: %p is garbage", i);
-
-       // Check uDNS lists
-
-       for (q = m->uDNS_info.ActiveQueries; q; q=q->next)
-               if (*(long*)q == (mDNSs32)~0)
-                       LogMemCorruption("uDNS_info.ActiveQueries: %p is garbage (%lX)", q, *(long*)q);
-
-       ServiceRecordSet            *s;
-       for (s = m->uDNS_info.ServiceRegistrations; s; s=s->next)
-               if (s->next == (ServiceRecordSet*)~0)
-                       LogMemCorruption("uDNS_info.ServiceRegistrations: %p is garbage (%lX)", s, s->next);
-
-       for (rr = m->uDNS_info.RecordRegistrations; rr; rr=rr->next)
-               {
-               if (rr->resrec.RecordType == 0 || rr->resrec.RecordType == 0xFF)
-                       LogMemCorruption("uDNS_info.RecordRegistrations: %p is garbage (%X)", rr, rr->resrec.RecordType);
-               if (rr->resrec.name != &rr->namestorage)
-                       LogMemCorruption("uDNS_info.RecordRegistrations: %p name %p does not point to namestorage %p %##s",
-                               rr, rr->resrec.name->c, rr->namestorage.c, rr->namestorage.c);
-               }
-
-       NATTraversalInfo            *n;
-       for (n = m->uDNS_info.NATTraversals; n; n=n->next)
-               if (n->op > 2) LogMemCorruption("uDNS_info.NATTraversals: %p is garbage", n);
-
-       for (n = m->uDNS_info.LLQNatInfo; n; n=n->next)
-               if (n->op > 2) LogMemCorruption("uDNS_info.LLQNatInfo: %p is garbage", n);
+                       LogMsg("!!!! InterfaceList: %p is garbage !!!!", i);
        }
 
 void *mallocL(char *msg, unsigned int size)
@@ -972,8 +902,8 @@ mDNSlocal void AbortClient(mach_port_t ClientMachPort, void *m)
                while (qptr)
                        {
                        if (m && m != x)
-                               LogMsg("%5d: DNSServiceBrowse(%##s) STOP; WARNING m %p != x %p", ClientMachPort, qptr->q.qname.c, m, x);
-                       else LogOperation("%5d: DNSServiceBrowse(%##s) STOP", ClientMachPort, qptr->q.qname.c);
+                               LogMsg("%5d: DNSServiceBrowser(%##s) STOP; WARNING m %p != x %p", ClientMachPort, qptr->q.qname.c, m, x);
+                       else LogOperation("%5d: DNSServiceBrowser(%##s) STOP", ClientMachPort, qptr->q.qname.c);
                        mDNS_StopBrowse(&mDNSStorage, &qptr->q);
                        freePtr = qptr;
                        qptr = qptr->next;
@@ -995,8 +925,8 @@ mDNSlocal void AbortClient(mach_port_t ClientMachPort, void *m)
                DNSServiceResolver *x = *l;
                *l = (*l)->next;
                if (m && m != x)
-                       LogMsg("%5d: DNSServiceResolve(%##s) STOP; WARNING m %p != x %p", ClientMachPort, x->i.name.c, m, x);
-               else LogOperation("%5d: DNSServiceResolve(%##s) STOP", ClientMachPort, x->i.name.c);
+                       LogMsg("%5d: DNSServiceResolver(%##s) STOP; WARNING m %p != x %p", ClientMachPort, x->i.name.c, m, x);
+               else LogOperation("%5d: DNSServiceResolver(%##s) STOP", ClientMachPort, x->i.name.c);
                mDNS_StopResolveService(&mDNSStorage, &x->q);
                freeL("DNSServiceResolver", x);
                return;
@@ -1046,21 +976,19 @@ mDNSlocal void AbortClientWithLogMessage(mach_port_t c, char *reason, char *msg,
        while (b && b->ClientMachPort != c) b = b->next;
        while (l && l->ClientMachPort != c) l = l->next;
        while (r && r->ClientMachPort != c) r = r->next;
-
-       if      (e) LogMsg("%5d: DomainEnumeration(%##s) %s%s",                   c, e->dom.qname.c,                reason, msg);
+       if      (e)     LogMsg("%5d: DomainEnumeration(%##s) %s%s",                   c, e->dom.qname.c,            reason, msg);
        else if (b)
-                       {
-                       for (qptr = b->qlist; qptr; qptr = qptr->next)
-                               LogMsg("%5d: Browser(%##s) %s%s",                             c, qptr->q.qname.c,               reason, msg);
-                       }
-       else if (l) LogMsg("%5d: Resolver(%##s) %s%s",                            c, l->i.name.c,                   reason, msg);
+               {
+               for (qptr = b->qlist; qptr; qptr = qptr->next)
+                               LogMsg("%5d: Browser(%##s) %s%s",                             c, qptr->q.qname.c,              reason, msg);
+               }
+       else if (l)     LogMsg("%5d: Resolver(%##s) %s%s",                            c, l->i.name.c,               reason, msg);
        else if (r)
-                       {
-                       ServiceInstance *si;
-                       for (si = r->regs; si; si = si->next)
-                               LogMsg("%5d: Registration(%##s) %s%s",                        c, si->srs.RR_SRV.resrec.name->c, reason, msg);
-                       }
-       else        LogMsg("%5d: (%s) %s, but no record of client can be found!", c,                                reason, msg);
+               {
+               ServiceInstance *si;
+               for (si = r->regs; si; si = si->next) LogMsg("%5d: Registration(%##s) %s%s", c, si->srs.RR_SRV.resrec.name->c, reason, msg);
+               }
+       else            LogMsg("%5d: (%s) %s, but no record of client can be found!", c,                            reason, msg);
 
        AbortClient(c, m);
        }
@@ -1223,9 +1151,6 @@ mDNSlocal void FoundInstance(mDNS *const m, DNSQuestion *question, const Resourc
        DNSServiceBrowserResult **p = &browser->results;
        while (*p) p = &(*p)->next;
        *p = x;
-
-       LogOperation("%5d: DNSServiceBrowse(%##s, %s) RESULT %s %s",
-               browser->ClientMachPort, question->qname.c, DNSTypeName(question->qtype), AddRecord ? "Add" : "Rmv", RRDisplayString(m, answer));
        }
 
 mDNSlocal mStatus AddDomainToBrowser(DNSServiceBrowser *browser, const domainname *d)
@@ -1275,10 +1200,8 @@ mDNSexport void DefaultBrowseDomainChanged(const domainname *d, mDNSBool add)
                                                *q = (*q)->next;
                                                if (remove->q.LongLived)
                                                        {
-                                                       // Give goodbyes for known answers.
-                                                       // Note that this a special case where we know that the QuestionCallback function is our own
-                                                       // code (it's FoundInstance), and that callback routine doesn't ever cancel its operation, so we
-                                                       // don't need to guard against the question being cancelled mid-loop the way the mDNSCore routines do.
+                                                       // give goodbyes for known answers.  note that since events are sent to client via udns_execute(),
+                                                       // we don't need to worry about the question being cancelled mid-loop
                                                        CacheRecord *ka = remove->q.uDNS_info.knownAnswers;
                                                        while (ka) { remove->q.QuestionCallback(&mDNSStorage, &remove->q, &ka->resrec, mDNSfalse); ka = ka->next; }
                                                        }                                               
@@ -1369,7 +1292,7 @@ fail:
        LogMsg("%5d: DNSServiceBrowse(\"%s\", \"%s\") failed: %s (%ld)", client, regtype, domain, errormsg, err);
        if (SearchDomains) mDNS_FreeDNameList(SearchDomains);
        return(err);
-       }
+               }
 
 //*************************************************************************************************************
 // Resolve Service Info
@@ -1487,7 +1410,7 @@ mDNSexport kern_return_t provide_DNSServiceResolverResolve_rpc(mach_port_t unuse
        DNSServiceResolverList = x;
 
        // Do the operation
-       LogOperation("%5d: DNSServiceResolve(%##s) START", client, x->i.name.c);
+       LogOperation("%5d: DNSServiceResolver(%##s) START", client, x->i.name.c);
        err = mDNS_StartResolveService(&mDNSStorage, &x->q, &x->i, FoundInstanceInfo, x);
        if (err) { AbortClient(client, x); errormsg = "mDNS_StartResolveService"; goto fail; }
 
@@ -1788,15 +1711,13 @@ fail:
        return(err);
        }
 
+mDNSlocal CFUserNotificationRef gNotification    = NULL;
+mDNSlocal CFRunLoopSourceRef    gNotificationRLS = NULL;
 mDNSlocal domainlabel           gNotificationPrefHostLabel;    // The prefs as they were the last time we saw them
 mDNSlocal domainlabel           gNotificationPrefNiceLabel;
 mDNSlocal domainlabel           gNotificationUserHostLabel;    // The prefs as they were the last time the user changed them
 mDNSlocal domainlabel           gNotificationUserNiceLabel;
 
-#ifndef NO_CFUSERNOTIFICATION
-mDNSlocal CFUserNotificationRef gNotification    = NULL;
-mDNSlocal CFRunLoopSourceRef    gNotificationRLS = NULL;
-
 mDNSlocal void NotificationCallBackDismissed(CFUserNotificationRef userNotification, CFOptionFlags responseFlags)
        {
        (void)responseFlags;    // Unused
@@ -1841,7 +1762,6 @@ mDNSlocal void ShowNameConflictNotification(CFStringRef header, CFStringRef subt
 
        CFRelease(dictionary);
        }
-#endif /* NO_CFUSERNOTIFICATION */
 
 // This updates either the text of the field currently labelled "Local Hostname",
 // or the text of the field currently labelled "Computer Name"
@@ -1878,7 +1798,6 @@ mDNSlocal void RecordUpdatedName(const mDNS *const m, const domainlabel *const o
                        LogMsg("RecordUpdatedName: ERROR: Couldn't update SCPreferences");
                else if (m->p->NotifyUser)
                        {
-#ifndef NO_CFUSERNOTIFICATION
                        uid_t uid;
                        gid_t gid;
                        CFStringRef userName = SCDynamicStoreCopyConsoleUser(NULL, &uid, &gid);
@@ -1896,9 +1815,6 @@ mDNSlocal void RecordUpdatedName(const mDNS *const m, const domainlabel *const o
                                append(alertHeader, CFSTR("automatically."));
                                ShowNameConflictNotification(alertHeader, subtext);
                                }
-#else
-                       (void)subtext;
-#endif /*  NO_CFUSERNOTIFICATION */
                        }
                if (s0)          CFRelease(s0);
                if (s1)          CFRelease(s1);
@@ -1931,11 +1847,9 @@ mDNSlocal void mDNS_StatusCallback(mDNS *const m, mStatus result)
                        {
                        gNotificationUserHostLabel = gNotificationPrefHostLabel = m->p->userhostlabel;
                        gNotificationUserNiceLabel = gNotificationPrefNiceLabel = m->p->usernicelabel;
-#ifndef NO_CFUSERNOTIFICATION
                        // If we're showing a name conflict notification, and the user has manually edited
                        // the name to remedy the conflict, we should now remove the notification window.
                        if (gNotificationRLS) CFUserNotificationCancel(gNotification);
-#endif /* NO_CFUSERNOTIFICATION */
                        }
 
                DNSServiceRegistration *r;
@@ -2369,7 +2283,6 @@ mDNSlocal void INFOCallback(void)
        DNSServiceResolver          *l;
        DNSServiceRegistration      *r;
        NetworkInterfaceInfoOSX     *i;
-       DNSServer *s;
 
        LogMsgIdent(mDNSResponderVersionString, "---- BEGIN STATE LOG ----");
        
@@ -2411,9 +2324,6 @@ mDNSlocal void INFOCallback(void)
                                &i->ifinfo.ip);
                }
 
-       for (s = mDNSStorage.uDNS_info.Servers; s; s = s->next)
-               LogMsgNoIdent("DNS Server %#a %##s", &s->addr, s->domain.c);
-
        LogMsgIdent(mDNSResponderVersionString, "----  END STATE LOG  ----");
        }
 
@@ -2595,8 +2505,6 @@ mDNSlocal void ShowTaskSchedulingError(mDNS *const m)
 
        LogMsg("Task Scheduling Error: Continuously busy for more than a second");
        
-       // NOTE: To accurately diagnose *why* we're busy, the debugging code here to show needs to mirror the logic in GetNextScheduledEvent
-
        if (m->NewQuestions && (!m->NewQuestions->DelayAnswering || m->timenow - m->NewQuestions->DelayAnswering >= 0))
                LogMsg("Task Scheduling Error: NewQuestion %##s (%s)",
                        m->NewQuestions->qname.c, DNSTypeName(m->NewQuestions->qtype));
index 982192ff3dcbef4a9ec31fb6101e77c9c5bb948c..b67eca908402c67066097476fabb04df466aea05 100644 (file)
@@ -2,69 +2,28 @@
  *
  * Copyright (c) 2002-2004 Apple Computer, Inc. All rights reserved.
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * 
- *     http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
+ * @APPLE_LICENSE_HEADER_START@
+ *
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
+ *
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
  * limitations under the License.
+ *
+ * @APPLE_LICENSE_HEADER_END@
 
     Change History (most recent first):
 
 $Log: mDNSMacOSX.c,v $
-Revision 1.333.2.1  2006/08/29 06:24:30  cheshire
-Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
-
-Revision 1.333  2006/06/29 05:33:30  cheshire
-<rdar://problem/4607043> mDNSResponder conditional compilation options
-
-Revision 1.332  2006/06/28 09:10:36  cheshire
-Extra debugging messages
-
-Revision 1.331  2006/06/21 22:29:42  cheshire
-Make _CFCopySystemVersionDictionary() call more defensive on systems that have no build information set
-
-Revision 1.330  2006/06/20 23:06:00  cheshire
-Fix some keychain API type mismatches (was mDNSu32 instead of UInt32)
-
-Revision 1.329  2006/06/08 23:22:33  cheshire
-Comment changes
-
-Revision 1.328  2006/03/19 03:27:49  cheshire
-<rdar://problem/4118624> Suppress "interface flapping" logic for loopback
-
-Revision 1.327  2006/03/19 02:00:09  cheshire
-<rdar://problem/4073825> Improve logic for delaying packets after repeated interface transitions
-
-Revision 1.326  2006/03/08 22:42:23  cheshire
-Fix spelling mistake: LocalReverseMapomain -> LocalReverseMapDomain
-
-Revision 1.325  2006/01/10 00:39:17  cheshire
-Add comments explaining how IPv6 link-local addresses sometimes have an embedded scope_id
-
-Revision 1.324  2006/01/09 19:28:59  cheshire
-<rdar://problem/4403128> Cap number of "sendto failed" messages we allow mDNSResponder to log
-
-Revision 1.323  2006/01/05 21:45:27  cheshire
-<rdar://problem/4400118> Fix uninitialized structure member in IPv6 code
-
-Revision 1.322  2006/01/05 21:41:50  cheshire
-<rdar://problem/4108164> Reword "mach_absolute_time went backwards" dialog
-
-Revision 1.321  2006/01/05 21:35:06  cheshire
-Add (commented out) trigger value for testing "mach_absolute_time went backwards" notice
-
-Revision 1.320  2005/12/03 01:39:28  cheshire
-<rdar://problem/4363411> Improve diagnostic message to indicate that message will not appear to customers
-
-Revision 1.319  2005/12/02 00:02:15  cheshire
-Include recvmsg return value in error message
-
 Revision 1.318  2005/10/20 00:10:34  cheshire
 <rdar://problem/4290265> Add check to avoid crashing NAT gateways that have buggy DNS relay code
 
@@ -1041,9 +1000,7 @@ Minor code tidying
 #include <netinet/ip.h>             // For IPTOS_LOWDELAY etc.
 #include <netinet6/in6_var.h>       // For IN6_IFF_NOTREADY etc.
 
-#ifndef NO_SECURITYFRAMEWORK
 #include <Security/Security.h>
-#endif /* NO_SECURITYFRAMEWORK */
 
 #include "dnsinfo.h"
 
@@ -1103,14 +1060,6 @@ mDNSlocal void SetSCPrefsBrowseDomain(mDNS *m, const domainname *d, mDNSBool add
 // ***************************************************************************
 // Functions
 
-// We only attempt to send and receive multicast packets on interfaces that are
-// (a) flagged as multicast-capable
-// (b) *not* flagged as point-to-point (e.g. modem)
-// Typically point-to-point interfaces are modems (including mobile-phone pseudo-modems), and we don't want
-// to run up the user's bill sending multicast traffic over a link where there's only a single device at the
-// other end, and that device (e.g. a modem bank) is probably not answering Multicast DNS queries anyway.
-#define MulticastInterface(i) ((i->ifa_flags & IFF_MULTICAST) && !(i->ifa_flags & IFF_POINTOPOINT))
-
 // routines to allow access to default domain lists from daemon layer
 
 mDNSexport DNameListElem *mDNSPlatformGetSearchDomainList(void)
@@ -1167,8 +1116,7 @@ mDNSlocal void RemoveDefRegDomain(domainname *d)
        debugf("Requested removal of default registration domain %##s not in contained in list", d->c); 
        }
 
-#ifndef NO_CFUSERNOTIFICATION
-mDNSexport void NotifyOfElusiveBug(const char *title, const char *msg) // Both strings are UTF-8 text
+mDNSexport void NotifyOfElusiveBug(const char *title, mDNSu32 radarid, const char *msg)
        {
        static int notifyCount = 0;
        if (notifyCount) return;
@@ -1190,22 +1138,13 @@ mDNSexport void NotifyOfElusiveBug(const char *title, const char *msg)  // Both s
                }
        #endif
 
-       LogMsg("%s", title);
-       LogMsg("%s", msg);
-       // Display a notification to the user
+       // Send a notification to the user to contact coreos-networking
        notifyCount++;
-       static const char footer[] = "(Note: This message only appears on machines with 17.x.x.x IP addresses — i.e. at Apple — not on customer machines.)";
-       CFStringRef alertHeader  = CFStringCreateWithCString(NULL, title,  kCFStringEncodingUTF8);
-       CFStringRef alertBody    = CFStringCreateWithCString(NULL, msg,    kCFStringEncodingUTF8);
-       CFStringRef alertFooter  = CFStringCreateWithCString(NULL, footer, kCFStringEncodingUTF8);
-       CFStringRef alertMessage = CFStringCreateWithFormat(NULL, NULL, CFSTR("%@\r\r%@"), alertBody, alertFooter);
+       CFStringRef alertHeader  = CFStringCreateWithCString(NULL, title, kCFStringEncodingUTF8);
+       CFStringRef alertFormat  = CFSTR("Congratulations, you've reproduced an elusive bug. Please contact the owner of <rdar://problem/%d>. %s");
+       CFStringRef alertMessage = CFStringCreateWithFormat(NULL, NULL, alertFormat, radarid, msg);
        CFUserNotificationDisplayNotice(0.0, kCFUserNotificationStopAlertLevel, NULL, NULL, NULL, alertHeader, alertMessage, NULL);
        }
-#else
-mDNSexport void NotifyOfElusiveBug(__unused const char *title, __unused const char *msg)
-       {
-       }
-#endif /* NO_CFUSERNOTIFICATION */
 
 mDNSlocal struct ifaddrs* myGetIfAddrs(int refresh)
        {
@@ -1243,42 +1182,26 @@ mDNSlocal int myIfIndexToName(u_short index, char* name)
        return -1;
        }
 
-mDNSexport mDNSInterfaceID mDNSPlatformInterfaceIDfromInterfaceIndex(mDNS *const m, mDNSu32 index)
+mDNSexport mDNSInterfaceID mDNSPlatformInterfaceIDfromInterfaceIndex(const mDNS *const m, mDNSu32 index)
        {
        NetworkInterfaceInfoOSX *i;
        if (index == kDNSServiceInterfaceIndexLocalOnly) return(mDNSInterface_LocalOnly);
-       if (index == kDNSServiceInterfaceIndexAny      ) return(mDNSNULL);
-
-       // Don't get tricked by inactive interfaces with no InterfaceID set
-       for (i = m->p->InterfaceList; i; i = i->next)
-               if (i->ifinfo.InterfaceID && i->scope_id == index) return(i->ifinfo.InterfaceID);
-
-       // Not found. Make sure our interface list is up to date, then try again.
-       LogOperation("InterfaceID for interface index %d not found; Updating interface list", index);
-       mDNSMacOSXNetworkChanged(m);
-       for (i = m->p->InterfaceList; i; i = i->next)
-               if (i->ifinfo.InterfaceID && i->scope_id == index) return(i->ifinfo.InterfaceID);
-
+       if (index)
+               for (i = m->p->InterfaceList; i; i = i->next)
+                       // Don't get tricked by inactive interfaces with no InterfaceID set
+                       if (i->ifinfo.InterfaceID && i->scope_id == index) return(i->ifinfo.InterfaceID);
        return(mDNSNULL);
        }
 
-mDNSexport mDNSu32 mDNSPlatformInterfaceIndexfromInterfaceID(mDNS *const m, mDNSInterfaceID id)
+mDNSexport mDNSu32 mDNSPlatformInterfaceIndexfromInterfaceID(const mDNS *const m, mDNSInterfaceID id)
        {
        NetworkInterfaceInfoOSX *i;
        if (id == mDNSInterface_LocalOnly) return(kDNSServiceInterfaceIndexLocalOnly);
-       if (id == mDNSInterface_Any      ) return(0);
-
-       // Don't use i->ifinfo.InterfaceID here, because we DO want to find inactive interfaces, which have no InterfaceID set
-       for (i = m->p->InterfaceList; i; i = i->next)
-               if ((mDNSInterfaceID)i == id) return(i->scope_id);
-
-       // Not found. Make sure our interface list is up to date, then try again.
-       LogOperation("Interface index for InterfaceID %p not found; Updating interface list", id);
-       mDNSMacOSXNetworkChanged(m);
-       for (i = m->p->InterfaceList; i; i = i->next)
-               if ((mDNSInterfaceID)i == id) return(i->scope_id);
-
-       return(0);
+       if (id)
+               for (i = m->p->InterfaceList; i; i = i->next)
+                       // Don't use i->ifinfo.InterfaceID here, because we DO want to find inactive interfaces, which have no InterfaceID set
+                       if ((mDNSInterfaceID)i == id) return(i->scope_id);
+       return 0;
        }
 
 mDNSlocal mDNSBool AddrRequiresPPPConnection(const struct sockaddr *addr)
@@ -1349,9 +1272,9 @@ mDNSexport mStatus mDNSPlatformSendUDP(const mDNS *const m, const void *const ms
                return mStatus_BadParamErr;
                }
 
-       // Don't send if it would cause dial-on-demand connection initiation.
-       // As an optimization, don't bother consulting reachability API / routing
-       // table when sending Multicast DNS since we ignore PPP interfaces for mDNS traffic.
+       // Don't send if it would cause dial on demand connection initiation.  As an optimization,
+       // don't bother consulting reachability API / routing table when sending Multicast DNS
+       // since we ignore PPP interfaces for mDNS traffic
        if (!mDNSAddrIsDNSMulticast(dst) && AddrRequiresPPPConnection((struct sockaddr *)&to))
                {
                debugf("mDNSPlatformSendUDP: Surpressing sending to avoid dial-on-demand connection");
@@ -1372,7 +1295,6 @@ mDNSexport mStatus mDNSPlatformSendUDP(const mDNS *const m, const void *const ms
        err = sendto(s, msg, (UInt8*)end - (UInt8*)msg, 0, (struct sockaddr *)&to, to.ss_len);
        if (err < 0)
                {
-               static int MessageCount = 0;
         // Don't report EHOSTDOWN (i.e. ARP failure), ENETDOWN, or no route to host for unicast destinations
                if (!mDNSAddressIsAllDNSLinkGroup(dst))
                        if (errno == EHOSTDOWN || errno == ENETDOWN || errno == EHOSTUNREACH || errno == ENETUNREACH) return(mStatus_TransientErr);
@@ -1382,12 +1304,8 @@ mDNSexport mStatus mDNSPlatformSendUDP(const mDNS *const m, const void *const ms
                if (errno == EHOSTUNREACH && (mDNSu32)(mDNSPlatformRawTime()) < (mDNSu32)(mDNSPlatformOneSecond * 180)) return(mStatus_TransientErr);
                // Don't report EADDRNOTAVAIL ("Can't assign requested address") if we're in the middle of a network configuration change
                if (errno == EADDRNOTAVAIL && m->p->NetworkChanged) return(mStatus_TransientErr);
-               if (MessageCount < 1000)
-                       {
-                       MessageCount++;
-                       LogMsg("mDNSPlatformSendUDP sendto failed to send packet on InterfaceID %p %5s/%ld to %#a:%d skt %d error %d errno %d (%s) %lu",
-                               InterfaceID, ifa_name, dst->type, dst, mDNSVal16(dstPort), s, err, errno, strerror(errno), (mDNSu32)(m->timenow));
-                       }
+               LogMsg("mDNSPlatformSendUDP sendto failed to send packet on InterfaceID %p %5s/%ld to %#a:%d skt %d error %d errno %d (%s) %lu",
+                       InterfaceID, ifa_name, dst->type, dst, mDNSVal16(dstPort), s, err, errno, strerror(errno), (mDNSu32)(m->timenow));
                return(mStatus_UnknownErr);
                }
        
@@ -1424,8 +1342,8 @@ mDNSlocal ssize_t myrecvfrom(const int s, void *const buffer, const size_t max,
                }
        if (msg.msg_controllen < (int)sizeof(struct cmsghdr))
                {
-               if (numLogMessages++ < 100) LogMsg("mDNSMacOSX.c: recvmsg(%d) returned %d msg.msg_controllen %d < sizeof(struct cmsghdr) %lu",
-                       s, n, msg.msg_controllen, sizeof(struct cmsghdr));
+               if (numLogMessages++ < 100) LogMsg("mDNSMacOSX.c: recvmsg(%d) msg.msg_controllen %d < sizeof(struct cmsghdr) %lu",
+                       s, msg.msg_controllen, sizeof(struct cmsghdr));
                return(-1);
                }
        if (msg.msg_flags & MSG_CTRUNC)
@@ -1526,7 +1444,6 @@ mDNSlocal void myCFSocketCallBack(const CFSocketRef cfs, const CFSocketCallBackT
                        senderAddr.type = mDNSAddrType_IPv6;
                        senderAddr.ip.v6 = *(mDNSv6Addr*)&sin6->sin6_addr;
                        senderPort.NotAnInteger = sin6->sin6_port;
-                       //LogOperation("myCFSocketCallBack received IPv6 packet from %#a to %#a", &senderAddr, &destAddr);
                        }
                else
                        {
@@ -1601,10 +1518,8 @@ mDNSlocal void myCFSocketCallBack(const CFSocketRef cfs, const CFSocketCallBackT
                        LogMsg("myCFSocketCallBack recvfrom skt %d error %d errno %d (%s) select %d (%spackets waiting) so_error %d so_nread %d fionread %d count %d",
                                s1, err, save_errno, strerror(save_errno), selectresult, FD_ISSET(s1, &readfds) ? "" : "*NO* ", so_error, so_nread, fionread, count);
                if (numLogMessages > 5)
-                       NotifyOfElusiveBug("Flaw in Kernel (select/recvfrom mismatch)",
-                               "Congratulations, you've reproduced an elusive bug.\r"
-                               "Please contact the current assignee of <rdar://problem/3375328>.\r"
-                               "Alternatively, you can send email to radar-3387020@group.apple.com. (Note number is different.)\r"
+                       NotifyOfElusiveBug("Flaw in Kernel (select/recvfrom mismatch)", 3375328,
+                               "Alternatively, you can send email to radar-3387020@group.apple.com. "
                                "If possible, please leave your machine undisturbed so that someone can come to investigate the problem.");
 
                sleep(1);               // After logging this error, rate limit so we don't flood syslog
@@ -1661,7 +1576,7 @@ mDNSexport mStatus mDNSPlatformTCPConnect(const mDNSAddr *dst, mDNSOpaque16 dstp
        saddr.sin_len = sizeof(saddr);
        memcpy(&saddr.sin_addr, &dst->ip.v4.NotAnInteger, sizeof(saddr.sin_addr));
 
-       // Don't send if it would cause dial-on-demand connection initiation.
+       // Don't send if it would cause dial on demand connection initiation.
        if (AddrRequiresPPPConnection((struct sockaddr *)&saddr))
                {
                debugf("mDNSPlatformTCPConnect: Surpressing sending to avoid dial-on-demand connection");
@@ -2019,8 +1934,8 @@ mDNSlocal mStatus SetupSocket(mDNS *const m, CFSocketSet *cp, mDNSBool mcast, co
                err = setsockopt(skt, IPPROTO_IPV6, IPV6_HOPLIMIT, &on, sizeof(on));
                if (err < 0) { errstr = "setsockopt - IPV6_HOPLIMIT"; goto fail; }
                
-               // We want to receive only IPv6 packets. Without this option we get IPv4 packets too,
-               // with mapped addresses of the form 0:0:0:0:0:FFFF:xxxx:xxxx, where xxxx:xxxx is the IPv4 address
+               // We want to receive only IPv6 packets, without this option, we may
+               // get IPv4 addresses as mapped addresses.
                err = setsockopt(skt, IPPROTO_IPV6, IPV6_V6ONLY, &on, sizeof(on));
                if (err < 0) { errstr = "setsockopt - IPV6_V6ONLY"; goto fail; }
                
@@ -2029,7 +1944,6 @@ mDNSlocal mStatus SetupSocket(mDNS *const m, CFSocketSet *cp, mDNSBool mcast, co
                        // Add multicast group membership on this interface, if it's for multicast receiving
                        int interface_id = if_nametoindex(cp->info->ifa_name);
                        struct ipv6_mreq i6mr;
-                       //LogOperation("SetupSocket: v6 %#a %s %d", ifaddr, cp->info->ifa_name, interface_id);
                        i6mr.ipv6mr_interface = interface_id;
                        i6mr.ipv6mr_multiaddr = *(struct in6_addr*)&AllDNSLinkGroupv6;
                        err = setsockopt(skt, IPPROTO_IPV6, IPV6_JOIN_GROUP, &i6mr, sizeof(i6mr));
@@ -2067,7 +1981,7 @@ mDNSlocal mStatus SetupSocket(mDNS *const m, CFSocketSet *cp, mDNSBool mcast, co
                listening_sockaddr6.sin6_family      = AF_INET6;
                listening_sockaddr6.sin6_port        = port.NotAnInteger;
                listening_sockaddr6.sin6_flowinfo    = 0;
-               listening_sockaddr6.sin6_addr        = in6addr_any; // Want to receive multicasts AND unicasts on this socket
+//             listening_sockaddr6.sin6_addr = IN6ADDR_ANY_INIT; // Want to receive multicasts AND unicasts on this socket
                listening_sockaddr6.sin6_scope_id    = 0;
                err = bind(skt, (struct sockaddr *) &listening_sockaddr6, sizeof(listening_sockaddr6));
                if (err) { errstr = "bind"; goto fail; }
@@ -2085,10 +1999,8 @@ mDNSlocal mStatus SetupSocket(mDNS *const m, CFSocketSet *cp, mDNSBool mcast, co
 fail:
        LogMsg("%s error %ld errno %d (%s)", errstr, err, errno, strerror(errno));
        if (!strcmp(errstr, "bind") && errno == EADDRINUSE)
-               NotifyOfElusiveBug("Setsockopt SO_REUSEPORT failed",
-                       "Congratulations, you've reproduced an elusive bug.\r"
-                       "Please contact the current assignee of <rdar://problem/3814904>.\r"
-                       "Alternatively, you can send email to radar-3387020@group.apple.com. (Note number is different.)\r"
+               NotifyOfElusiveBug("Setsockopt SO_REUSEPORT failed", 3814904,
+                       "Alternatively, you can send email to radar-3387020@group.apple.com. "
                        "If possible, please leave your machine undisturbed so that someone can come to investigate the problem.");
        close(skt);
        return(err);
@@ -2109,13 +2021,8 @@ mDNSlocal mStatus SetupAddr(mDNSAddr *ip, const struct sockaddr *const sa)
        if (sa->sa_family == AF_INET6)
                {
                struct sockaddr_in6 *ifa_addr = (struct sockaddr_in6 *)sa;
-               // Inside the BSD kernel they use a hack where they stuff the sin6->sin6_scope_id
-               // value into the second word of the IPv6 link-local address, so they can just
-               // pass around IPv6 address structures instead of full sockaddr_in6 structures.
-               // Those hacked IPv6 addresses aren't supposed to escape the kernel in that form, but they do.
-               // To work around this we always whack the second word of any IPv6 link-local address back to zero.
-               if (IN6_IS_ADDR_LINKLOCAL(&ifa_addr->sin6_addr)) ifa_addr->sin6_addr.__u6_addr.__u6_addr16[1] = 0;
                ip->type = mDNSAddrType_IPv6;
+               if (IN6_IS_ADDR_LINKLOCAL(&ifa_addr->sin6_addr)) ifa_addr->sin6_addr.__u6_addr.__u6_addr16[1] = 0;
                ip->ip.v6 = *(mDNSv6Addr*)&ifa_addr->sin6_addr;
                return(mStatus_NoError);
                }
@@ -2148,10 +2055,6 @@ mDNSlocal mDNSEthAddr GetBSSID(char *ifa_name)
        return(eth);
        }
 
-// Returns pointer to newly created NetworkInterfaceInfoOSX object, or
-// pointer to already-existing NetworkInterfaceInfoOSX object found in list, or
-// may return NULL if out of memory (unlikely) or parameters are invalid for some reason
-// (e.g. sa_family not AF_INET or AF_INET6)
 mDNSlocal NetworkInterfaceInfoOSX *AddInterfaceToList(mDNS *const m, struct ifaddrs *ifa, mDNSs32 utc)
        {
        mDNSu32 scope_id  = if_nametoindex(ifa->ifa_name);
@@ -2167,8 +2070,6 @@ mDNSlocal NetworkInterfaceInfoOSX *AddInterfaceToList(mDNS *const m, struct ifad
                        {
                        debugf("AddInterfaceToList: Found existing interface %lu %.6a with address %#a at %p", scope_id, &bssid, &ip, *p);
                        (*p)->Exists = mDNStrue;
-                       // If interface was not in getifaddrs list last time we looked, but it is now, update 'AppearanceTime' for this record
-                       if ((*p)->LastSeen != utc) (*p)->AppearanceTime = utc;
                        return(*p);
                        }
 
@@ -2190,14 +2091,11 @@ mDNSlocal NetworkInterfaceInfoOSX *AddInterfaceToList(mDNS *const m, struct ifad
        
        i->next            = mDNSNULL;
        i->Exists          = mDNStrue;
-       i->AppearanceTime  = utc;               // Brand new interface; AppearanceTime is now
        i->LastSeen        = utc;
-       i->Flashing        = mDNSfalse;
-       i->Occulting       = mDNSfalse;
        i->scope_id        = scope_id;
        i->BSSID           = bssid;
        i->sa_family       = ifa->ifa_addr->sa_family;
-       i->ifa_flags       = ifa->ifa_flags;
+       i->Multicast       = (ifa->ifa_flags & IFF_MULTICAST) && !(ifa->ifa_flags & IFF_POINTOPOINT);
 
        i->ss.m     = m;
        i->ss.info  = i;
@@ -2228,10 +2126,8 @@ mDNSlocal mStatus UpdateInterfaceList(mDNS *const m, mDNSs32 utc)
        struct ifaddrs *v6Loopback  = NULL;
        mDNSEthAddr PrimaryMAC      = zeroEthAddr;
        char defaultname[32];
-#ifndef NO_IPV6
        int InfoSocket              = socket(AF_INET6, SOCK_DGRAM, 0);
        if (InfoSocket < 3) LogMsg("UpdateInterfaceList: InfoSocket error %d errno %d (%s)", InfoSocket, errno, strerror(errno));
-#endif
        if (m->SleepState) ifa = NULL;
 
        while (ifa)
@@ -2287,7 +2183,6 @@ mDNSlocal mStatus UpdateInterfaceList(mDNS *const m, mDNSs32 utc)
                                else
                                        {
                                        int ifru_flags6 = 0;
-#ifndef NO_IPV6
                                        if (ifa->ifa_addr->sa_family == AF_INET6 && InfoSocket >= 0)
                                                {
                                                struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)ifa->ifa_addr;
@@ -2299,7 +2194,6 @@ mDNSlocal mStatus UpdateInterfaceList(mDNS *const m, mDNSs32 utc)
                                                        ifru_flags6 = ifr6.ifr_ifru.ifru_flags6;
                                                verbosedebugf("%s %.16a %04X %04X", ifa->ifa_name, &sin6->sin6_addr, ifa->ifa_flags, ifru_flags6);
                                                }
-#endif
                                        if (!(ifru_flags6 & (IN6_IFF_NOTREADY | IN6_IFF_DETACHED | IN6_IFF_DEPRECATED | IN6_IFF_TEMPORARY)))
                                                {
                                                if (ifa->ifa_flags & IFF_LOOPBACK)
@@ -2308,7 +2202,7 @@ mDNSlocal mStatus UpdateInterfaceList(mDNS *const m, mDNSs32 utc)
                                                else
                                                        {
                                                        NetworkInterfaceInfoOSX *i = AddInterfaceToList(m, ifa, utc);
-                                                       if (i && MulticastInterface(i))
+                                                       if (i && i->Multicast)
                                                                {
                                                                if (ifa->ifa_addr->sa_family == AF_INET) foundav4 = mDNStrue;
                                                                else                                     foundav6 = mDNStrue;
@@ -2336,17 +2230,14 @@ mDNSlocal mStatus UpdateInterfaceList(mDNS *const m, mDNSs32 utc)
        for (i = m->p->InterfaceList; i; i = i->next)
                if (i->Exists)
                        {
-                       mDNSBool txrx = MulticastInterface(i) && ((i->ifinfo.ip.type == mDNSAddrType_IPv4) || !FindRoutableIPv4(m, i->scope_id));
+                       mDNSBool txrx = i->Multicast && ((i->ifinfo.ip.type == mDNSAddrType_IPv4) || !FindRoutableIPv4(m, i->scope_id));
                        if (i->ifinfo.McastTxRx != txrx)
                                {
                                i->ifinfo.McastTxRx = txrx;
                                i->Exists = 2; // State change; need to deregister and reregister this interface
                                }
                        }
-
-#ifndef NO_IPV6
        if (InfoSocket >= 0) close(InfoSocket);
-#endif
 
        mDNS_snprintf(defaultname, sizeof(defaultname), "Macintosh-%02X%02X%02X%02X%02X%02X",
                PrimaryMAC.b[0], PrimaryMAC.b[1], PrimaryMAC.b[2], PrimaryMAC.b[3], PrimaryMAC.b[4], PrimaryMAC.b[5]);
@@ -2432,14 +2323,12 @@ mDNSlocal int SetupActiveInterfaces(mDNS *const m, mDNSs32 utc)
                                // If i->LastSeen == utc, then this is a brand-new interface, just created, or an interface that never went away.
                                // If i->LastSeen != utc, then this is an old interface, previously seen, that went away for (utc - i->LastSeen) seconds.
                                // If the interface is an old one that went away and came back in less than a minute, then we're in a flapping scenario.
-                               i->Occulting = !(i->ifa_flags & IFF_LOOPBACK) && (utc - i->LastSeen > 0 && utc - i->LastSeen < 60);
-                               mDNS_RegisterInterface(m, n, i->Flashing && i->Occulting);
+                               mDNSBool flapping = (utc - i->LastSeen > 0 && utc - i->LastSeen < 60);
+                               mDNS_RegisterInterface(m, n, flapping ? mDNSPlatformOneSecond * 5 : 0);
                                if (i->ifinfo.ip.type == mDNSAddrType_IPv4 &&  (i->ifinfo.ip.ip.v4.b[0] != 169 || i->ifinfo.ip.ip.v4.b[1] != 254)) count++;
-                               LogOperation("SetupActiveInterfaces:   Registered    %5s(%lu) %.6a InterfaceID %p %#a/%d%s%s%s",
+                               LogOperation("SetupActiveInterfaces:   Registered    %5s(%lu) %.6a InterfaceID %p %#a/%d%s%s",
                                        i->ifa_name, i->scope_id, &i->BSSID, primary, &n->ip, CountMaskBits(&n->mask),
-                                       i->Flashing        ? " (Flashing)"  : "",
-                                       i->Occulting       ? " (Occulting)" : "",
-                                       n->InterfaceActive ? " (Primary)"   : "");
+                                       flapping ? " (Flapping)" : "", n->InterfaceActive ? " (Primary)" : "");
                                }
        
                        if (!n->McastTxRx)
@@ -2453,14 +2342,12 @@ mDNSlocal int SetupActiveInterfaces(mDNS *const m, mDNSs32 utc)
                                        else          LogMsg("SetupActiveInterfaces:   v4 socket%2d %5s(%lu) %.6a InterfaceID %p %#a/%d FAILED",   primary->ss.sktv4, i->ifa_name, i->scope_id, &i->BSSID, n->InterfaceID, &n->ip, CountMaskBits(&n->mask));
                                        }
                        
-#ifndef NO_IPV6
                                if (i->sa_family == AF_INET6 && primary->ss.sktv6 == -1)
                                        {
                                        mStatus err = SetupSocket(m, &primary->ss, mDNStrue, &i->ifinfo.ip, AF_INET6);
                                        if (err == 0) debugf("SetupActiveInterfaces:   v6 socket%2d %5s(%lu) %.6a InterfaceID %p %#a/%d",          primary->ss.sktv6, i->ifa_name, i->scope_id, &i->BSSID, n->InterfaceID, &n->ip, CountMaskBits(&n->mask));
                                        else          LogMsg("SetupActiveInterfaces:   v6 socket%2d %5s(%lu) %.6a InterfaceID %p %#a/%d FAILED",   primary->ss.sktv6, i->ifa_name, i->scope_id, &i->BSSID, n->InterfaceID, &n->ip, CountMaskBits(&n->mask));
                                        }
-#endif
                                }
                        }
        return count;
@@ -2517,14 +2404,10 @@ mDNSlocal int ClearInactiveInterfaces(mDNS *const m, mDNSs32 utc)
                if (i->ifinfo.InterfaceID)
                        if (i->Exists == 0 || i->Exists == 2 || i->ifinfo.InterfaceID != (mDNSInterfaceID)primary)
                                {
-                               i->Flashing = !(i->ifa_flags & IFF_LOOPBACK) && (utc - i->AppearanceTime < 60);
-                               LogOperation("ClearInactiveInterfaces: Deregistering %5s(%lu) %.6a InterfaceID %p %#a/%d%s%s%s",
+                               LogOperation("ClearInactiveInterfaces: Deregistering %5s(%lu) %.6a InterfaceID %p %#a/%d%s",
                                        i->ifa_name, i->scope_id, &i->BSSID, i->ifinfo.InterfaceID,
-                                       &i->ifinfo.ip, CountMaskBits(&i->ifinfo.mask),
-                                       i->Flashing               ? " (Flashing)"  : "",
-                                       i->Occulting              ? " (Occulting)" : "",
-                                       i->ifinfo.InterfaceActive ? " (Primary)"   : "");
-                               mDNS_DeregisterInterface(m, &i->ifinfo, i->Flashing && i->Occulting);
+                                       &i->ifinfo.ip, CountMaskBits(&i->ifinfo.mask), i->ifinfo.InterfaceActive ? " (Primary)" : "");
+                               mDNS_DeregisterInterface(m, &i->ifinfo);
                                if (i->ifinfo.ip.type == mDNSAddrType_IPv4 && (i->ifinfo.ip.ip.v4.b[0] != 169 || i->ifinfo.ip.ip.v4.b[1] != 254)) count++;
                                i->ifinfo.InterfaceID = mDNSNULL;
                                // NOTE: If n->InterfaceID is set, that means we've called mDNS_RegisterInterface() for this interface,
@@ -2796,7 +2679,7 @@ mDNSlocal void MarkSearchListElem(const char *d)
        if (!MakeDomainNameFromDNSNameString(&domain, d))
                { LogMsg("ERROR: MarkSearchListElem - bad domain %##s", d); return; }
 
-       if (SameDomainName(&domain, &localdomain) || SameDomainName(&domain, &LocalReverseMapDomain))
+       if (SameDomainName(&domain, &localdomain) || SameDomainName(&domain, &LocalReverseMapomain))
                { debugf("MarkSearchListElem - ignoring local domain %##s", domain.c); return; } 
 
        // if domain is in list, mark as pre-existent (0)
@@ -2990,10 +2873,9 @@ mDNSlocal void SCPrefsDynDNSCallback(mDNS *const m, AuthRecord *const rr, mStatu
 
 mDNSlocal void SetSecretForDomain(mDNS *m, const domainname *domain)
        {
-#ifndef NO_SECURITYFRAMEWORK
        OSStatus err = 0;
        char dstring[MAX_ESCAPED_DOMAIN_NAME];
-       UInt32 secretlen;
+       mDNSu32 secretlen;
        void *secret = NULL;
        domainname *d, canon;
        int i, dlen;
@@ -3030,7 +2912,7 @@ mDNSlocal void SetSecretForDomain(mDNS *m, const domainname *domain)
                err = SecKeychainSearchCopyNext(searchRef, &itemRef);
                if (!err)
                        {
-               UInt32 tags[1];
+               mDNSu32 tags[1];
                        SecKeychainAttributeInfo attrInfo;
                        mDNSu32 i;
                        char keybuf[MAX_ESCAPED_DOMAIN_NAME+1];                 
@@ -3070,10 +2952,6 @@ mDNSlocal void SetSecretForDomain(mDNS *m, const domainname *domain)
        if (err && err != errSecItemNotFound) LogMsg("Error: SetSecretForDomain - %s failed with error code %d", failedfn, err);
        if (attrList) SecKeychainItemFreeAttributesAndData(attrList, secret);
        if (itemRef) CFRelease(itemRef);
-#else
-       (void)m; (void)domain;
-       LogMsg("Error: SetSecretForDomain - no keychain support");
-#endif /* NO_SECURITYFRAMEWORK */
        }
 
 mDNSlocal void SetSCPrefsBrowseDomainsFromCFArray(mDNS *m, CFArrayRef browseDomains, mDNSBool add)
@@ -3381,7 +3259,6 @@ exit:
        return(err);
        }
 
-#ifndef NO_IOPOWER
 mDNSlocal void PowerChanged(void *refcon, io_service_t service, natural_t messageType, void *messageArgument)
        {
        mDNS *const m = (mDNS *const)refcon;
@@ -3424,7 +3301,6 @@ mDNSlocal mStatus WatchForPowerChanges(mDNS *const m)
                }
        return(-1);
        }
-#endif /* NO_IOPOWER */
 
 CF_EXPORT CFDictionaryRef _CFCopySystemVersionDictionary(void);
 CF_EXPORT const CFStringRef _kCFSystemVersionProductNameKey;
@@ -3437,7 +3313,7 @@ CF_EXPORT const CFStringRef _kCFSystemVersionBuildVersionKey;
 mDNSexport int mDNSMacOSXSystemBuildNumber(char *HINFO_SWstring)
        {
        int major = 0, minor = 0;
-       char letter = 0, prodname[256]="<Unknown>", prodvers[256]="<Unknown>", buildver[256]="<Unknown>";
+       char letter = 0, prodname[256]="Mac OS X", prodvers[256]="", buildver[256]="?";
        CFDictionaryRef vers = _CFCopySystemVersionDictionary();
        if (vers)
                {
@@ -3450,7 +3326,6 @@ mDNSexport int mDNSMacOSXSystemBuildNumber(char *HINFO_SWstring)
                sscanf(buildver, "%d%c%d", &major, &letter, &minor);
                CFRelease(vers);
                }
-       if (!major) { major=8; LogMsg("Note: No Major Build Version number found; assuming 8"); }
        if (HINFO_SWstring) mDNS_snprintf(HINFO_SWstring, 256, "%s %s (%s), %s", prodname, prodvers, buildver, mDNSResponderVersionString);
        return(major);
        }
@@ -3642,7 +3517,6 @@ mDNSlocal mStatus mDNSPlatformInit_setup(mDNS *const m)
        if (mDNSMacOSXSystemBuildNumber(HINFO_SWstring) < 7) m->KnownBugs |= mDNS_KnownBug_PhantomInterfaces;
        if (mDNSPlatformInit_CanReceiveUnicast())            m->CanReceiveUnicastOn5353 = mDNStrue;
 
-#ifndef NO_HINFO
        mDNSu32 hlen = mDNSPlatformStrLen(HINFO_HWstring);
        mDNSu32 slen = mDNSPlatformStrLen(HINFO_SWstring);
        if (hlen + slen < 254)
@@ -3652,7 +3526,6 @@ mDNSlocal mStatus mDNSPlatformInit_setup(mDNS *const m)
                mDNSPlatformMemCopy(HINFO_HWstring, &m->HIHardware.c[1], hlen);
                mDNSPlatformMemCopy(HINFO_SWstring, &m->HISoftware.c[1], slen);
                }
-#endif /* NO_HINFO */
 
        m->p->unicastsockets.m     = m;
        m->p->unicastsockets.info  = NULL;
@@ -3661,20 +3534,16 @@ mDNSlocal mStatus mDNSPlatformInit_setup(mDNS *const m)
        m->p->unicastsockets.rlsv4 = m->p->unicastsockets.rlsv6 = NULL;
        
        err = SetupSocket(m, &m->p->unicastsockets, mDNSfalse, &zeroAddr, AF_INET);
-#ifndef NO_IPV6
        err = SetupSocket(m, &m->p->unicastsockets, mDNSfalse, &zeroAddr, AF_INET6);
-#endif
 
        struct sockaddr_in s4;
+       struct sockaddr_in6 s6;
        socklen_t n4 = sizeof(s4);
+       socklen_t n6 = sizeof(s6);
        if (getsockname(m->p->unicastsockets.sktv4, (struct sockaddr *)&s4, &n4) < 0) LogMsg("getsockname v4 error %d (%s)", errno, strerror(errno));
        else m->UnicastPort4.NotAnInteger = s4.sin_port;
-#ifndef NO_IPV6
-       struct sockaddr_in6 s6;
-       socklen_t n6 = sizeof(s6);
        if (getsockname(m->p->unicastsockets.sktv6, (struct sockaddr *)&s6, &n6) < 0) LogMsg("getsockname v6 error %d (%s)", errno, strerror(errno));
        else m->UnicastPort6.NotAnInteger = s6.sin6_port;
-#endif
 
        m->p->InterfaceList      = mDNSNULL;
        m->p->userhostlabel.c[0] = 0;
@@ -3687,10 +3556,8 @@ mDNSlocal mStatus mDNSPlatformInit_setup(mDNS *const m)
        err = WatchForNetworkChanges(m);
        if (err) return(err);
        
-#ifndef NO_IOPOWER
        err = WatchForPowerChanges(m);
        if (err) return err;
-#endif /* NO_IOPOWER */
 
        DynDNSRegDomain.c[0] = '\0';
        DynDNSConfigChanged(m);                                         // Get initial DNS configuration
@@ -3716,9 +3583,7 @@ mDNSexport void mDNSPlatformClose(mDNS *const m)
                CFRunLoopRemoveSource(CFRunLoopGetCurrent(), m->p->PowerRLS, kCFRunLoopDefaultMode);
                CFRunLoopSourceInvalidate(m->p->PowerRLS);
                CFRelease(m->p->PowerRLS);
-#ifndef NO_IOPOWER
                IODeregisterForSystemPower(&m->p->PowerNotifier);
-#endif /* NO_IOPOWER */
                m->p->PowerConnection = 0;
                m->p->PowerNotifier   = 0;
                m->p->PowerRLS        = NULL;
@@ -3778,7 +3643,6 @@ mDNSexport mDNSs32 mDNSPlatformRawTime(void)
        if (clockdivisor == 0) { LogMsg("mDNSPlatformRawTime called before mDNSPlatformTimeInit"); return(0); }
 
        static uint64_t last_mach_absolute_time = 0;
-       //static uint64_t last_mach_absolute_time = 0x8000000000000000LL;       // Use this value for testing the alert display
        uint64_t this_mach_absolute_time = mach_absolute_time();
        if ((int64_t)this_mach_absolute_time - (int64_t)last_mach_absolute_time < 0)
                {
@@ -3786,14 +3650,9 @@ mDNSexport mDNSs32 mDNSPlatformRawTime(void)
                LogMsg("mDNSPlatformRawTime: this_mach_absolute_time %08X%08X", this_mach_absolute_time);
                // Update last_mach_absolute_time *before* calling NotifyOfElusiveBug()
                last_mach_absolute_time = this_mach_absolute_time;
-               // Only show "mach_absolute_time went backwards" notice on 10.4 (build 8xyyy) or later.
-               // (This bug happens all the time on 10.3, and we know that's not going to be fixed.)
+               // Only show "mach_absolute_time went backwards" notice on 10.4 (build 8xyyy) or later
                if (mDNSMacOSXSystemBuildNumber(NULL) >= 8)
-                       NotifyOfElusiveBug("mach_absolute_time went backwards!",
-                               "This error occurs from time to time, often on newly released hardware, "
-                               "and usually the exact cause is different in each instance.\r\r"
-                               "Please file a new Radar bug report with the title “mach_absolute_time went backwards” "
-                               "and assign it to Radar Component “Kernel” Version “X”.");
+                       NotifyOfElusiveBug("mach_absolute_time went backwards!", 3438376, "");
                }
        last_mach_absolute_time = this_mach_absolute_time;
 
index 3e146083ad3589b0a0bfb21824cd7e4fb3406f26..7dd31be64f3d2a58bfd29ff715d3b2207f5deb24 100644 (file)
@@ -1,37 +1,28 @@
-/* -*- Mode: C; tab-width: 4 -*-
- *
+/*
  * Copyright (c) 2002-2003 Apple Computer, Inc. All rights reserved.
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * @APPLE_LICENSE_HEADER_START@
  * 
- *     http://www.apache.org/licenses/LICENSE-2.0
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
  * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
  * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
 
     Change History (most recent first):
 
 $Log: mDNSMacOSX.h,v $
-Revision 1.55.2.1  2006/08/29 06:48:07  cheshire
-Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
-
-Revision 1.55  2006/06/29 05:33:30  cheshire
-<rdar://problem/4607043> mDNSResponder conditional compilation options
-
-Revision 1.54  2006/03/19 03:27:49  cheshire
-<rdar://problem/4118624> Suppress "interface flapping" logic for loopback
-
-Revision 1.53  2006/03/19 02:00:09  cheshire
-<rdar://problem/4073825> Improve logic for delaying packets after repeated interface transitions
-
-Revision 1.52  2006/01/05 21:41:49  cheshire
-<rdar://problem/4108164> Reword "mach_absolute_time went backwards" dialog
-
 Revision 1.51  2005/07/04 22:24:36  cheshire
 Export NotifyOfElusiveBug() so other files can call it
 
@@ -243,18 +234,12 @@ struct NetworkInterfaceInfoOSX_struct
        NetworkInterfaceInfoOSX *next;
        mDNSu32                  Exists;                        // 1 = currently exists in getifaddrs list; 0 = doesn't
                                                                                                // 2 = exists, but McastTxRx state changed
-       mDNSs32                  AppearanceTime;        // Time this interface appeared most recently in getifaddrs list
-                                                                                               // i.e. the first time an interface is seen, AppearanceTime is set.
-                                                                                               // If an interface goes away temporarily and then comes back then
-                                                                                               // AppearanceTime is updated to the time of the most recent appearance.
        mDNSs32                  LastSeen;                      // If Exists==0, last time this interface appeared in getifaddrs list
-       mDNSBool                 Flashing;                      // Set if interface appeared for less than 60 seconds and then vanished
-       mDNSBool                 Occulting;                     // Set if interface vanished for less than 60 seconds and then came back
        char                    *ifa_name;                      // Memory for this is allocated using malloc
        mDNSu32                  scope_id;                      // interface index / IPv6 scope ID
        mDNSEthAddr              BSSID;                         // BSSID of 802.11 base station, if applicable
        u_short                  sa_family;
-       unsigned int             ifa_flags;
+       mDNSBool                 Multicast;
        CFSocketSet              ss;
        };
 
@@ -273,7 +258,7 @@ struct mDNS_PlatformSupport_struct
     CFRunLoopSourceRef       PowerRLS;
     };
 
-extern void NotifyOfElusiveBug(const char *title, const char *msg);    // Both strings are UTF-8 text
+extern void NotifyOfElusiveBug(const char *title, mDNSu32 radarid, const char *msg);
 extern void mDNSMacOSXNetworkChanged(mDNS *const m);
 extern int mDNSMacOSXSystemBuildNumber(char *HINFO_SWstring);
 
index cf2d86f85929ccd9cd42f2d8663f6a304ebe00a7..7764e2a4626faaad8fc2fefe8fbde603df2d15d3 100644 (file)
@@ -1,18 +1,24 @@
-/* -*- Mode: C; tab-width: 4 -*-
- *
+/*
  * Copyright (c) 2002-2003 Apple Computer, Inc. All rights reserved.
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * @APPLE_LICENSE_HEADER_START@
  * 
- *     http://www.apache.org/licenses/LICENSE-2.0
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
  * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
  * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
  *
  * This file is not normally used.
  * It can be conditionally compiled in by defining RUN_ON_PUMA_WITHOUT_IFADDRS
@@ -25,9 +31,6 @@
     Change History (most recent first):
 
 $Log: mDNSMacOSXPuma.c,v $
-Revision 1.6  2006/08/14 23:24:40  cheshire
-Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
-
 Revision 1.5  2004/09/20 23:52:02  cheshire
 CFSocket{Puma}.c renamed to mDNSMacOSX{Puma}.c
 
index b6d74385cbcefe95db7404d587eabfcf647e184d..6c923772b58c2618587bf59fc3e081f0805f9976 100644 (file)
@@ -22,8 +22,8 @@
                        buildSettings = {
                                FRAMEWORK_SEARCH_PATHS = "";
                                GCC_TREAT_WARNINGS_AS_ERRORS = YES;
-                               HEADER_SEARCH_PATHS = "../mDNSShared \"${APPLE_INTERNAL_DEVELOPER_DIR}/Headers\" \"${CONFIGURATION_TEMP_DIR}\"";
-                               LIBRARY_SEARCH_PATHS = "\"${CONFIGURATION_TEMP_DIR}\"";
+                               HEADER_SEARCH_PATHS = "../mDNSShared \"${APPLE_INTERNAL_DEVELOPER_DIR}/Headers\" \"${OBJROOT}/mDNSResponder.build\"";
+                               LIBRARY_SEARCH_PATHS = "\"${OBJROOT}/mDNSResponder.build\"";
                                MACOSX_DEPLOYMENT_TARGET = 10.2;
                                OPTIMIZATION_CFLAGS = "-O0";
                                OTHER_CFLAGS = "-no-cpp-precomp -mdynamic-no-pic -D__MACOSX__ -DmDNSResponderVersion=${MVERS} -D_LEGACY_NAT_TRAVERSAL_ -DMDNS_DEBUGMSGS=1";
                        );
                        buildSettings = {
                                MVERS = "\"mDNSResponder (Engineering Build)\"";
-                               CONFIGURATION_BUILD_DIR = "${BUILD_DIR}";
-                               CONFIGURATION_TEMP_DIR = "${BUILD_DIR}/mDNSResponder.build";
                        };
                        isa = PBXBuildStyle;
                        name = Development;
                        buildSettings = {
                                FRAMEWORK_SEARCH_PATHS = "";
                                GCC_TREAT_WARNINGS_AS_ERRORS = YES;
-                               HEADER_SEARCH_PATHS = "../mDNSShared \"${APPLE_INTERNAL_DEVELOPER_DIR}/Headers\" \"${CONFIGURATION_TEMP_DIR}\"";
+                               HEADER_SEARCH_PATHS = "../mDNSShared \"${APPLE_INTERNAL_DEVELOPER_DIR}/Headers\" \"${OBJROOT}/mDNSResponder.build\"";
                                INSTALL_PATH = /usr/sbin;
-                               LIBRARY_SEARCH_PATHS = "\"${CONFIGURATION_TEMP_DIR}\"";
+                               LIBRARY_SEARCH_PATHS = "\"${OBJROOT}/mDNSResponder.build\"";
                                MACOSX_DEPLOYMENT_TARGET = 10.2;
                                OTHER_CFLAGS = "-no-cpp-precomp -mdynamic-no-pic -D__MACOSX__ -DmDNSResponderVersion=${MVERS} -D_LEGACY_NAT_TRAVERSAL_";
                                OTHER_LDFLAGS = "-ldnsinfo";
                                DB2CC44D0662DD1100335AB3,
                                DB2CC44E0662DD1100335AB3,
                                DB2CC44F0662DD1100335AB3,
-                               FF2C5FB00A48B8680066DA11,
-                               FF2C5FB20A48B86E0066DA11,
                        );
                        isa = PBXGroup;
                        name = "Java Support";
                                DB2CC45F0662DE4C00335AB3,
                                DB2CC4600662DE4C00335AB3,
                                DB2CC4610662DE4D00335AB3,
-                               FF2C5FB10A48B8680066DA11,
-                               FF2C5FB30A48B86E0066DA11,
                        );
                        isa = PBXSourcesBuildPhase;
                        runOnlyForDeploymentPostprocessing = 0;
                                JAVA_ARCHIVE_COMPRESSION = YES;
                                JAVA_ARCHIVE_TYPE = JAR;
                                JAVA_COMPILER_DEBUGGING_SYMBOLS = NO;
-                               JAVA_COMPILER_SOURCE_VERSION = 1.4;
-                               JAVA_COMPILER_TARGET_VM_VERSION = 1.4;
+                               JAVA_COMPILER_TARGET_VM_VERSION = 1.2;
                                JAVA_SOURCE_SUBDIR = .;
                                LIBRARY_STYLE = STATIC;
                                MACOSX_DEPLOYMENT_TARGET = 10.2;
                                PURE_JAVA = YES;
                                REZ_EXECUTABLE = YES;
                                SECTORDER_FLAGS = "";
-                               STRIPFLAGS = "-S";
                                WARNING_CFLAGS = "-Wmost -Wno-four-char-constants -Wno-unknown-pragmas";
                        };
                        comments = "Multiplatform .jar file that implements Java interface to DNS-SD";
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                        shellPath = /bin/sh;
-                       shellScript = "javah -force -J-Xbootclasspath/p:${CONFIGURATION_TEMP_DIR}/dns_sd.jar.build/JavaClasses -o ${CONFIGURATION_TEMP_DIR}/dns_sd.jar.build/DNSSD.java.h com.apple.dnssd.AppleDNSSD com.apple.dnssd.AppleBrowser com.apple.dnssd.AppleResolver com.apple.dnssd.AppleRegistration com.apple.dnssd.AppleQuery com.apple.dnssd.AppleDomainEnum com.apple.dnssd.AppleService";
+                       shellScript = "if [ -d ${OBJROOT}/mDNSResponder.build/${CONFIGURATION} ]; then BUILD_DIR=${OBJROOT}/mDNSResponder.build/${CONFIGURATION}; else BUILD_DIR=${OBJROOT}/mDNSResponder.build; fi\njavah -force -classpath ${BUILD_DIR}/dns_sd.jar.build/JavaClasses/ -o ${BUILD_DIR}/dns_sd.jar.build/DNSSD.java.h com.apple.dnssd.AppleDNSSD com.apple.dnssd.AppleBrowser com.apple.dnssd.AppleResolver com.apple.dnssd.AppleRegistration com.apple.dnssd.AppleQuery com.apple.dnssd.AppleDomainEnum com.apple.dnssd.AppleService";
                };
                DB2CC4560662DE4500335AB3 = {
                        fileRef = DB2CC4430662DD1100335AB3;
                                DB2CC4650662DF5C00335AB3,
                        );
                        buildSettings = {
+                               DEBUGGING_SYMBOLS = NO;
                                DYLIB_COMPATIBILITY_VERSION = 1;
                                DYLIB_CURRENT_VERSION = 1;
-                               HEADER_SEARCH_PATHS = "../mDNSShared \"${SYSTEM_LIBRARY_DIR}/Frameworks/JavaVM.framework/Versions/A/Headers\" \"${SYSTEM_LIBRARY_DIR}/Frameworks/JavaVM.framework/Versions/1.3.1/Headers\" \"${CONFIGURATION_TEMP_DIR}/dns_sd.jar.build\"";
+                               HEADER_SEARCH_PATHS = "../mDNSShared \"${SYSTEM_LIBRARY_DIR}/Frameworks/JavaVM.framework/Versions/A/Headers\" \"${SYSTEM_LIBRARY_DIR}/Frameworks/JavaVM.framework/Versions/1.3.1/Headers\" \"${OBJROOT}/mDNSResponder.build/dns_sd.jar.build\" \"${OBJROOT}/mDNSResponder.build/${CONFIGURATION}/dns_sd.jar.build\"";
                                INSTALL_PATH = /usr/lib/java;
                                LIBRARY_STYLE = DYNAMIC;
                                MACOSX_DEPLOYMENT_TARGET = 10.2;
                                PRODUCT_NAME = libjdns_sd.jnilib;
                                REZ_EXECUTABLE = YES;
                                SECTORDER_FLAGS = "";
-                               STRIPFLAGS = "-S";
                                WARNING_CFLAGS = "-Wmost -Wno-four-char-constants -Wno-unknown-pragmas";
                        };
                        comments = "Platform-specific JNI library that bridges dns_sd.jar to <dns_sd.h>.";
                                PREBINDING = NO;
                                PRODUCT_NAME = Bonjour;
                                SECTORDER_FLAGS = "";
-                               STRIPFLAGS = "-S";
                                WARNING_CFLAGS = "-Wmost -Wno-four-char-constants -Wno-unknown-pragmas";
                                WRAPPER_EXTENSION = prefPane;
                        };
                        isa = PBXTargetDependency;
                        target = FF2609E107B440DD00CE10E5;
                };
-               FF2C5FB00A48B8680066DA11 = {
-                       fileEncoding = 4;
-                       isa = PBXFileReference;
-                       name = DNSSDRecordRegistrar.java;
-                       path = ../mDNSShared/Java/DNSSDRecordRegistrar.java;
-                       refType = 2;
-               };
-               FF2C5FB10A48B8680066DA11 = {
-                       fileRef = FF2C5FB00A48B8680066DA11;
-                       isa = PBXBuildFile;
-                       settings = {
-                       };
-               };
-               FF2C5FB20A48B86E0066DA11 = {
-                       fileEncoding = 4;
-                       isa = PBXFileReference;
-                       name = RegisterRecordListener.java;
-                       path = ../mDNSShared/Java/RegisterRecordListener.java;
-                       refType = 2;
-               };
-               FF2C5FB30A48B86E0066DA11 = {
-                       fileRef = FF2C5FB20A48B86E0066DA11;
-                       isa = PBXBuildFile;
-                       settings = {
-                       };
-               };
                FF354EB108516C63007C00E1 = {
                        fileEncoding = 4;
                        isa = PBXExecutableFileReference;
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                        shellPath = /bin/sh;
-                       shellScript = "if [ -e /usr/local/include/dnsinfo.h ]\nthen\nrm -f \"${CONFIGURATION_TEMP_DIR}/dnsinfo.h\"\nrm -f \"${CONFIGURATION_TEMP_DIR}/libdnsinfo.a\"\nelse\necho \"#define MDNS_NO_DNSINFO 1\" > ${CONFIGURATION_TEMP_DIR}/dnsinfo.h\ntouch ${CONFIGURATION_TEMP_DIR}/empty.c\ncc ${CONFIGURATION_TEMP_DIR}/empty.c -c -o \"${CONFIGURATION_TEMP_DIR}/libdnsinfo.a\"\nrm -f ${CONFIGURATION_TEMP_DIR}/empty.c\nfi";
+                       shellScript = "if [ -e /usr/local/include/dnsinfo.h ]\nthen\nrm -f \"${OBJROOT}/mDNSResponder.build/dnsinfo.h\"\nrm -f \"${OBJROOT}/mDNSResponder.build/libdnsinfo.a\"\nelse\necho \"#define MDNS_NO_DNSINFO 1\" > ${OBJROOT}/mDNSResponder.build/dnsinfo.h\ntouch ${OBJROOT}/mDNSResponder.build/empty.c\ncc ${OBJROOT}/mDNSResponder.build/empty.c -c -o \"${OBJROOT}/mDNSResponder.build/libdnsinfo.a\"\nrm -f ${OBJROOT}/mDNSResponder.build/empty.c\nfi";
                };
                FF485D5105632E0000130380 = {
                        fileEncoding = 4;
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                        shellPath = /bin/sh;
-                       shellScript = "rm -f ${CONFIGURATION_BUILD_DIR}/dns_sd";
+                       shellScript = "rm -f ${BUILD_DIR}/${CONFIGURATION}/dns_sd";
                };
                FFD41DDF06641BBB00F0C438 = {
                        isa = PBXTargetDependency;
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                        shellPath = /bin/sh;
-                       shellScript = "if [ -e /usr/local/include/dnsinfo.h ]\nthen\nrm -f \"${CONFIGURATION_TEMP_DIR}/dnsinfo.h\"\nrm -f \"${CONFIGURATION_TEMP_DIR}/libdnsinfo.a\"\nelse\necho \"#define MDNS_NO_DNSINFO 1\" > ${CONFIGURATION_TEMP_DIR}/dnsinfo.h\ntouch ${CONFIGURATION_TEMP_DIR}/empty.c\ncc ${CONFIGURATION_TEMP_DIR}/empty.c -c -o \"${CONFIGURATION_TEMP_DIR}/libdnsinfo.a\"\nrm -f ${CONFIGURATION_TEMP_DIR}/empty.c\nfi";
+                       shellScript = "if [ -e /usr/local/include/dnsinfo.h ]\nthen\nrm -f \"${OBJROOT}/mDNSResponder.build/dnsinfo.h\"\nrm -f \"${OBJROOT}/mDNSResponder.build/libdnsinfo.a\"\nelse\necho \"#define MDNS_NO_DNSINFO 1\" > ${OBJROOT}/mDNSResponder.build/dnsinfo.h\ntouch ${OBJROOT}/mDNSResponder.build/empty.c\ncc ${OBJROOT}/mDNSResponder.build/empty.c -c -o \"${OBJROOT}/mDNSResponder.build/libdnsinfo.a\"\nrm -f ${OBJROOT}/mDNSResponder.build/empty.c\nfi";
                };
                FFFB0DA407B43BED00B88D48 = {
                        children = (
                                FFFB0DA807B43C9100B88D48,
                        );
                        buildSettings = {
-                               INSTALL_PATH = "/Library/Application Support/Bonjour";
                                MACOSX_DEPLOYMENT_TARGET = 10.2;
                                OTHER_CFLAGS = "";
                                OTHER_LDFLAGS = "";
                                PRODUCT_NAME = ddnswriteconfig;
                                REZ_EXECUTABLE = YES;
                                SECTORDER_FLAGS = "";
-                               STRIPFLAGS = "-S";
                                WARNING_CFLAGS = "-Wmost -Wno-four-char-constants -Wno-unknown-pragmas";
                        };
                        dependencies = (
                        );
                        isa = PBXToolTarget;
                        name = ddnswriteconfig;
-                       productInstallPath = "/Library/Application Support/Bonjour";
+                       productInstallPath = /usr/local/bin;
                        productName = ddnswriteconfig;
                        productReference = FFFB0DAA07B43C9100B88D48;
                };
index 9c23772e184016d8b9ff71e08c821d3fa24a3652..6aafe37e7d3a6c3ebb93528959bc568bf0660c23 100755 (executable)
@@ -2,27 +2,28 @@
  *
  * Copyright (c) 2002-2004 Apple Computer, Inc. All rights reserved.
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * @APPLE_LICENSE_HEADER_START@
  * 
- *     http://www.apache.org/licenses/LICENSE-2.0
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
  * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
  * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
 
     Change History (most recent first):
 
 $Log: Client.c,v $
-Revision 1.18  2006/08/14 23:24:46  cheshire
-Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
-
-Revision 1.17  2006/06/12 18:22:42  cheshire
-<rdar://problem/4580067> mDNSResponder building warnings under Red Hat 64-bit (LP64) Linux
-
 Revision 1.16  2005/02/04 01:00:53  cheshire
 Add '-d' command-line option to specify domain to browse
 
@@ -280,7 +281,7 @@ int main(int argc, char **argv)
         result = 2;
     }
     if ( (result != 0) || (gMDNSPlatformPosixVerboseLevel > 0) ) {
-        fprintf(stderr, "%s: Finished with status %d, result %d\n", gProgramName, (int)status, result);
+        fprintf(stderr, "%s: Finished with status %ld, result %d\n", gProgramName, status, result);
     }
 
     return 0;
index 15bb86ad793187e5d8f4a75a5bfe484ff6b05754..17843afdda3e18e277760297ab4169cfc23f20e4 100644 (file)
@@ -2,27 +2,28 @@
  *
  * Copyright (c) 2002-2004 Apple Computer, Inc. All rights reserved.
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * @APPLE_LICENSE_HEADER_START@
  * 
- *     http://www.apache.org/licenses/LICENSE-2.0
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
  * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
  * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
 
     Change History (most recent first):
 
 $Log: ExampleClientApp.c,v $
-Revision 1.14  2006/08/14 23:24:46  cheshire
-Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
-
-Revision 1.13  2006/02/23 23:38:43  cheshire
-<rdar://problem/4427969> On FreeBSD 4 "arpa/inet.h" requires "netinet/in.h" be included first
-
 Revision 1.12  2004/11/30 22:37:00  cheshire
 Update copyright dates and add "Mode: C; tab-width: 4" headers
 
@@ -54,8 +55,8 @@ Add log header
 #include <string.h>                    // For strlen() etc.
 #include <unistd.h>                    // For select()
 #include <errno.h>                     // For errno, EINTR
-#include <netinet/in.h>                // For INADDR_NONE
 #include <arpa/inet.h>         // For inet_addr()
+#include <netinet/in.h>                // For INADDR_NONE
 #include <netdb.h>                     // For gethostbyname()
 #include <signal.h>                    // For SIGINT, etc.
 
index 3438260c5ec5aeb3cbe609e83989b4bd0306fd64..fa9f0fccd14025713eeedda49d58a39ee74af230 100644 (file)
@@ -2,24 +2,28 @@
  *
  * Copyright (c) 2002-2003 Apple Computer, Inc. All rights reserved.
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * @APPLE_LICENSE_HEADER_START@
  * 
- *     http://www.apache.org/licenses/LICENSE-2.0
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
  * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
  * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
 
     Change History (most recent first):
 
 $Log: ExampleClientApp.h,v $
-Revision 1.7  2006/08/14 23:24:46  cheshire
-Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
-
 Revision 1.6  2004/11/30 22:37:00  cheshire
 Update copyright dates and add "Mode: C; tab-width: 4" headers
 
index a9aa3b1b532f623a237858a3db3fec8a5de4a231..c1724f2574120b5df85df606df6acc15ecc6f07c 100644 (file)
@@ -2,17 +2,24 @@
  *
  * Copyright (c) 2002-2004 Apple Computer, Inc. All rights reserved.
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * @APPLE_LICENSE_HEADER_START@
  * 
- *     http://www.apache.org/licenses/LICENSE-2.0
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
  * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
  * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
  *
  * Formatting notes:
  * This code follows the "Whitesmiths style" C indentation rules. Plenty of discussion
     Change History (most recent first):
 
 $Log: Identify.c,v $
-Revision 1.36  2006/08/14 23:24:46  cheshire
-Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
-
-Revision 1.35  2006/06/12 18:22:42  cheshire
-<rdar://problem/4580067> mDNSResponder building warnings under Red Hat 64-bit (LP64) Linux
-
 Revision 1.34  2004/12/16 20:17:11  cheshire
 <rdar://problem/3324626> Cache memory management improvements
 
@@ -399,7 +400,7 @@ mDNSexport int main(int argc, char **argv)
        gRRCache, RR_CACHE_SIZE,
        mDNS_Init_DontAdvertiseLocalAddresses,
        mDNS_Init_NoInitCallback, mDNS_Init_NoInitCallbackContext);
-       if (status) { fprintf(stderr, "Daemon start: mDNS_Init failed %d\n", (int)status); return(status); }
+       if (status) { fprintf(stderr, "Daemon start: mDNS_Init failed %ld\n", status); return(status); }
 
        signal(SIGINT, HandleSIG);      // SIGINT is what you get for a Ctrl-C
        signal(SIGTERM, HandleSIG);
index 57824f4e335cd90c5a772aace5e0e75213dc203a..f283913b22750fe11987ebbdb78060d3528adc1e 100755 (executable)
 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 
 # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 #
-# IMPORTANT NOTE: This is a Makefile for *GNU make*
-# On some systems, a different program may be the default "make" command.
-# If "make os=xxx" gives lots of errors like "Missing dependency operator",
-# then try typing "gmake os=xxx" instead.
-#
 # $Log: Makefile,v $
-# Revision 1.71  2006/06/20 23:07:04  rpantos
-# <rdar://problem/3839132> Java needs to implement DNSServiceRegisterRecord equivalent
-#
-# Revision 1.70  2006/05/03 23:35:10  cheshire
-# Add missing dependency: NetMonitor.c textually imports mDNS.c
-#
-# Revision 1.69  2006/02/26 23:18:50  cheshire
-# <rdar://problem/4427969> FreeBSD 4 requires "-pthread" option to compile threaded code
-#
-# Revision 1.68  2006/02/26 01:36:54  cheshire
-# Rename the poorly named "LIBFLAGS" as "LINKOPTS"
-#
-# Revision 1.67  2006/02/25 23:14:29  cheshire
-# Add comment suggesting using "gmake" command
-#
-# Revision 1.66  2006/01/06 01:06:17  cheshire
-# <rdar://problem/3978979> Compile library and client programs in one pass
-#
-# Revision 1.65  2005/12/21 21:15:57  cheshire
-# Add missing dependency: Identify.c textually imports mDNS.c
-#
 # Revision 1.64  2005/10/25 23:55:47  cheshire
 # Add tiger to list of target platforms
 #
@@ -273,9 +247,7 @@ CP = cp
 RM = rm
 LN = ln -s -f
 CFLAGS_COMMON = -I. -I$(COREDIR) -I$(SHAREDDIR) -W -Wall -DPID_FILE=\"/var/run/mdnsd.pid\" -DMDNS_UDS_SERVERPATH=\"/var/run/mdnsd\"
-CFLAGS_PTHREAD =
-LINKOPTS =
-LINKOPTS_PTHREAD = -lpthread
+LIBFLAGS =
 LDSUFFIX = so
 JAVACFLAGS_OS = -fPIC -shared -ldns_sd
 
@@ -302,7 +274,7 @@ CFLAGS_OS = -DNOT_HAVE_DAEMON -DNOT_HAVE_SA_LEN -DNOT_HAVE_SOCKLEN_T -DNOT_HAVE_
         -DLOG_PERROR=0 -D_XPG4_2 -D__EXTENSIONS__ -DHAVE_BROKEN_RECVIF_NAME
 CC = gcc
 LD = gcc -shared
-LINKOPTS = -lsocket -lnsl -lresolv
+LIBFLAGS = -lsocket -lnsl -lresolv
 JAVACFLAGS_OS += -I$(JDK)/include/solaris
 ifneq ($(DEBUG),1)
 STRIP = strip
@@ -328,14 +300,6 @@ LOCALBASE?=/usr/local
 INSTBASE=$(LOCALBASE)
 STARTUPSCRIPTNAME=mdns.sh
 CFLAGS_OS =
-# FreeBSD 4 requires threaded code to be compiled and linked using the "-pthread" option,
-# and requires that the "-lpthread" link option NOT be used
-# This appies only to FreeBSD -- "man cc" on FreeBSD says:
-#   FreeBSD SPECIFIC OPTIONS
-#     -pthread
-#       Link a user-threaded process against libc_r instead of libc.
-CFLAGS_PTHREAD   = -pthread -D_THREAD_SAFE
-LINKOPTS_PTHREAD = -pthread
 JAVACFLAGS_OS += -I$(JDK)/include/freebsd
 LDCONFIG = ldconfig
 else
@@ -348,7 +312,7 @@ else
 ifeq ($(os),jaguar)
 CFLAGS_OS = -DHAVE_IPV6 -no-cpp-precomp -Werror -DNOT_HAVE_SOCKLEN_T
 LD = libtool -dynamic
-LINKOPTS = -lSystem
+LIBFLAGS = -lSystem
 LDSUFFIX = dylib
 JDK = /System/Library/Frameworks/JavaVM.framework/Home
 JAVACFLAGS_OS = -dynamiclib -I/System/Library/Frameworks/JavaVM.framework/Headers -framework JavaVM 
@@ -357,7 +321,7 @@ else
 ifeq ($(os),panther)
 CFLAGS_OS = -DHAVE_IPV6 -no-cpp-precomp -Werror
 LD = libtool -dynamic
-LINKOPTS = -lSystem
+LIBFLAGS = -lSystem
 LDSUFFIX = dylib
 JDK = /System/Library/Frameworks/JavaVM.framework/Home
 JAVACFLAGS_OS = -dynamiclib -I/System/Library/Frameworks/JavaVM.framework/Headers -framework JavaVM 
@@ -367,7 +331,7 @@ ifeq ($(os),tiger)
 CFLAGS_OS = -DHAVE_IPV6 -no-cpp-precomp -Werror -Wdeclaration-after-statement #-Wunreachable-code
 CC = @gcc-4.0
 LD = $(CC) -dynamiclib
-LINKOPTS = -lSystem
+LIBFLAGS = -lSystem
 LDSUFFIX = dylib
 JDK = /System/Library/Frameworks/JavaVM.framework/Home
 JAVACFLAGS_OS = -dynamiclib -I/System/Library/Frameworks/JavaVM.framework/Headers -framework JavaVM 
@@ -435,9 +399,9 @@ CFLAGS = $(CFLAGS_COMMON) $(CFLAGS_OS) $(CFLAGS_DEBUG)
 
 #############################################################################
 
-all: setup Daemon libdns_sd Clients SAClient SAResponder SAProxyResponder Identify NetMonitor dnsextd $(OPTIONALTARG)
+all: setup Daemon libdns_sd Client Responder ProxyResponder Identify NetMonitor dnsextd $(OPTIONALTARG)
 
-install: setup InstalledDaemon InstalledStartup InstalledLib InstalledManPages InstalledClients $(OPTINSTALL)
+install: setup InstalledDaemon InstalledLib InstalledStartup InstalledManPages $(OPTINSTALL)
 
 # 'setup' sets up the build directory structure the way we want
 setup:
@@ -448,9 +412,8 @@ setup:
 
 # clean removes targets and objects
 clean:
-       @if test -d $(OBJDIR)   ; then rm -r $(OBJDIR)   ; fi
-       @if test -d $(BUILDDIR) ; then rm -r $(BUILDDIR) ; fi
-       @$(MAKE) -C ../Clients clean
+       if test -d $(OBJDIR)   ; then rm -r $(OBJDIR)   ; fi
+       if test -d $(BUILDDIR) ; then rm -r $(BUILDDIR) ; fi
 
 #############################################################################
 
@@ -463,7 +426,7 @@ Daemon: setup $(BUILDDIR)/mdnsd
        @echo "Responder daemon done"
 
 $(BUILDDIR)/mdnsd: $(DAEMONOBJS)
-       $(CC) -o $@ $+ $(LINKOPTS)
+       $(CC) -o $@ $+ $(CFLAGS) $(LIBFLAGS)
        @$(STRIP) $@
 
 # libdns_sd target builds the client library
@@ -473,21 +436,15 @@ libdns_sd: setup $(BUILDDIR)/libdns_sd.$(LDSUFFIX)
 CLIENTLIBOBJS = $(OBJDIR)/dnssd_clientlib.c.so.o $(OBJDIR)/dnssd_clientstub.c.so.o $(OBJDIR)/dnssd_ipc.c.so.o
 
 $(BUILDDIR)/libdns_sd.$(LDSUFFIX): $(CLIENTLIBOBJS)
-       @$(LD) $(LINKOPTS) -o $@ $+
+       @$(LD) $(LIBFLAGS) -o $@ $+
        @$(STRIP) $@
 
-Clients: setup libdns_sd ../Clients/build/dns-sd
-       @echo "Clients done"
-
-../Clients/build/dns-sd:
-       @$(MAKE) -C ../Clients
-
 # nss_mdns target builds the Name Service Switch module
 nss_mdns: setup $(BUILDDIR)/$(NSSLIBFILE)
        @echo "Name Service Switch module done"
 
 $(BUILDDIR)/$(NSSLIBFILE): $(CLIENTLIBOBJS) $(OBJDIR)/nss_mdns.c.so.o
-       @$(LD) $(LINKOPTS) -o $@ $+
+       @$(LD) $(LIBFLAGS) -o $@ $+
        @$(STRIP) $@
 
 #############################################################################
@@ -502,18 +459,13 @@ InstalledLib: $(INSTBASE)/lib/libdns_sd.$(LDSUFFIX).$(LIBVERS) $(INSTBASE)/inclu
 InstalledStartup: $(STARTUPSCRIPTDIR)/$(STARTUPSCRIPTNAME)
        @echo $+ " installed"
 
-InstalledManPages: $(MANPATH)/man8/mdnsd.8
-       @echo $+ " installed"
-
-InstalledClients: $(INSTBASE)/bin/dns-sd
+InstalledNSS: $(NSSINSTPATH)/$(NSSLINKNAME) /etc/nss_mdns.conf $(MANPATH)/man5/nss_mdns.conf.5 $(MANPATH)/man8/libnss_mdns.8
        @echo $+ " installed"
 
-InstalledNSS: $(NSSINSTPATH)/$(NSSLINKNAME) /etc/nss_mdns.conf $(MANPATH)/man5/nss_mdns.conf.5 $(MANPATH)/man8/libnss_mdns.8
+InstalledManPages: $(MANPATH)/man8/mdnsd.8
        @echo $+ " installed"
 
-# Note: If daemon already installed, we make sure it's stopped before overwriting it
 $(INSTBASE)/sbin/mdnsd: $(BUILDDIR)/mdnsd
-       @if test -x $@; then $(STARTUPSCRIPTDIR)/$(STARTUPSCRIPTNAME) stop; fi
        $(CP) $< $@
 
 $(INSTBASE)/lib/libdns_sd.$(LDSUFFIX).$(LIBVERS): $(BUILDDIR)/libdns_sd.$(LDSUFFIX)
@@ -527,12 +479,9 @@ endif
 $(INSTBASE)/include/dns_sd.h: $(SHAREDDIR)/dns_sd.h
        $(CP) $< $@
 
-# We make this target dependent on $(INSTBASE)/sbin/mdnsd because we need to ensure
-# that the daemon is installed *before* we try to execute the command to start it.
-$(STARTUPSCRIPTDIR)/$(STARTUPSCRIPTNAME): mdnsd.sh $(STARTUPSCRIPTDIR) $(INSTBASE)/sbin/mdnsd
+$(STARTUPSCRIPTDIR)/$(STARTUPSCRIPTNAME): mdnsd.sh $(STARTUPSCRIPTDIR)
        $(CP) $< $@
        chmod ugo+x $@
-       $@ start
 ifdef RUNLEVELSCRIPTSDIR
 ifeq ($(wildcard $(RUNLEVELSCRIPTSDIR)/runlevels/default), $(RUNLEVELSCRIPTSDIR)/runlevels/default)
        $(LN) $@ $(RUNLEVELSCRIPTSDIR)/runlevels/default/mdns
@@ -546,21 +495,6 @@ else
 endif
 endif
 
-$(MANPATH)/man5/%.5: %.5
-       cp $< $@
-       chmod 444 $@
-
-$(MANPATH)/man8/%.8: %.8
-       cp $< $@
-       chmod 444 $@
-
-$(MANPATH)/man8/mdnsd.8: $(SHAREDDIR)/mDNSResponder.8
-       cp $< $@
-       chmod 444 $@
-
-$(INSTBASE)/bin/dns-sd: ../Clients/build/dns-sd
-       $(CP) $< $@
-
 $(NSSINSTPATH)/$(NSSLINKNAME): $(NSSINSTPATH)/$(NSSLIBFILE)
        $(LN) $< $@
        ldconfig
@@ -577,6 +511,18 @@ $(NSSINSTPATH)/$(NSSLIBFILE): $(BUILDDIR)/$(NSSLIBFILE)
        cp -f /etc/nsswitch.conf /etc/nsswitch.conf.pre-mdns
        sed -e '/mdns/!s/^\(hosts:.*\)dns\(.*\)/\1mdns dns\2/' /etc/nsswitch.conf.pre-mdns > /etc/nsswitch.conf
 
+$(MANPATH)/man5/%.5: %.5
+       cp $< $@
+       chmod 444 $@
+
+$(MANPATH)/man8/%.8: %.8
+       cp $< $@
+       chmod 444 $@
+
+$(MANPATH)/man8/mdnsd.8: $(SHAREDDIR)/mDNSResponder.8
+       cp $< $@
+       chmod 444 $@
+
 #############################################################################
 
 # The following targets build Java wrappers for the dns-sd.h API.
@@ -602,15 +548,13 @@ JARCONTENTS =     $(OBJDIR)/com/apple/dnssd/DNSSDService.class \
                                $(OBJDIR)/com/apple/dnssd/RegisterListener.class \
                                $(OBJDIR)/com/apple/dnssd/QueryListener.class \
                                $(OBJDIR)/com/apple/dnssd/DomainListener.class \
-                               $(OBJDIR)/com/apple/dnssd/RegisterRecordListener.class \
-                               $(OBJDIR)/com/apple/dnssd/DNSSDRecordRegistrar.class \
                                $(OBJDIR)/com/apple/dnssd/DNSSD.class
 
-$(BUILDDIR)/dns_sd.jar: $(JARCONTENTS) setup
+$(BUILDDIR)/dns_sd.jar: $(JARCONTENTS)
        $(JAR) -cf $@ -C $(OBJDIR) com
 
-$(BUILDDIR)/libjdns_sd.$(LDSUFFIX): $(JAVASRC)/JNISupport.c $(OBJDIR)/DNSSD.java.h setup libdns_sd
-       $(CC) -o $@ $< $(JAVACFLAGS) -I$(OBJDIR) -L$(BUILDDIR)
+$(BUILDDIR)/libjdns_sd.$(LDSUFFIX): $(JAVASRC)/JNISupport.c $(OBJDIR)/DNSSD.java.h
+       $(CC) -o $@ $< $(JAVACFLAGS) -I$(OBJDIR)
 
 $(OBJDIR)/com/apple/dnssd/%.class:     $(JAVASRC)/%.java
        $(JAVAC) -d $(OBJDIR) -classpath $(OBJDIR) $<
@@ -629,7 +573,7 @@ $(OBJDIR)/DNSSD.java.h: $(OBJDIR)/com/apple/dnssd/DNSSD.class
 
 # The following target builds documentation for the Java wrappers.
 
-JavaDoc: Java setup
+JavaDoc: setup Java
        $(JAVADOC) $(JAVASRC)/*.java -classpath $(OBJDIR) -d $(BUILDDIR) -public
 
 #############################################################################
@@ -639,13 +583,13 @@ SPECIALOBJ = $(OBJDIR)/mDNSPosix.c.o $(OBJDIR)/mDNSUNP.c.o $(OBJDIR)/mDNSDebug.c
 COMMONOBJ  = $(SPECIALOBJ) $(OBJDIR)/mDNS.c.o
 APPOBJ     = $(COMMONOBJ) $(OBJDIR)/ExampleClientApp.c.o
 
-SAClient: setup $(BUILDDIR)/mDNSClientPosix
+Client: setup $(BUILDDIR)/mDNSClientPosix
        @echo "Embedded Standalone Client done"
 
-SAResponder: setup $(BUILDDIR)/mDNSResponderPosix
+Responder: setup $(BUILDDIR)/mDNSResponderPosix
        @echo "Embedded Standalone Responder done"
 
-SAProxyResponder: setup $(BUILDDIR)/mDNSProxyResponderPosix
+ProxyResponder: setup $(BUILDDIR)/mDNSProxyResponderPosix
        @echo "Embedded Standalone ProxyResponder done"
 
 Identify: setup $(BUILDDIR)/mDNSIdentify
@@ -658,26 +602,22 @@ dnsextd: setup $(BUILDDIR)/dnsextd
        @echo "dnsextd done"
 
 $(BUILDDIR)/mDNSClientPosix:         $(APPOBJ)     $(OBJDIR)/Client.c.o
-       $(CC) $+ -o $@ $(LINKOPTS)
+       $(CC) $+ -o $@ $(LIBFLAGS)
 
 $(BUILDDIR)/mDNSResponderPosix:      $(COMMONOBJ)  $(OBJDIR)/Responder.c.o
-       $(CC) $+ -o $@ $(LINKOPTS)
+       $(CC) $+ -o $@ $(LIBFLAGS)
 
 $(BUILDDIR)/mDNSProxyResponderPosix: $(COMMONOBJ)  $(OBJDIR)/ProxyResponder.c.o
-       $(CC) $+ -o $@ $(LINKOPTS)
+       $(CC) $+ -o $@ $(LIBFLAGS)
 
 $(BUILDDIR)/mDNSIdentify:            $(SPECIALOBJ) $(OBJDIR)/Identify.c.o
-       $(CC) $+ -o $@ $(LINKOPTS)
-
-$(OBJDIR)/Identify.c.o:              $(COREDIR)/mDNS.c # Note: Identify.c textually imports mDNS.c
+       $(CC) $+ -o $@ $(LIBFLAGS)
 
 $(BUILDDIR)/mDNSNetMonitor:          $(SPECIALOBJ) $(OBJDIR)/NetMonitor.c.o
-       $(CC) $+ -o $@ $(LINKOPTS)
-
-$(OBJDIR)/NetMonitor.c.o:            $(COREDIR)/mDNS.c # Note: NetMonitor.c textually imports mDNS.c
+       $(CC) $+ -o $@ $(LIBFLAGS)
 
 $(BUILDDIR)/dnsextd:                 $(SPECIALOBJ) $(OBJDIR)/dnsextd.c.threadsafe.o
-       $(CC) $+ -o $@ $(LINKOPTS) $(LINKOPTS_PTHREAD)
+       $(CC) $+ -o $@ $(LIBFLAGS) -lpthread
 
 #############################################################################
 
@@ -692,7 +632,7 @@ $(OBJDIR)/%.c.o:    $(SHAREDDIR)/%.c
        $(CC) $(CFLAGS) -c -o $@ $<
 
 $(OBJDIR)/%.c.threadsafe.o:    %.c
-       $(CC) $(CFLAGS) $(CFLAGS_PTHREAD) -D_REENTRANT -c -o $@ $<
+       $(CC) $(CFLAGS) -D_REENTRANT -c -o $@ $<
 
 $(OBJDIR)/%.c.so.o:    %.c
        $(CC) $(CFLAGS) -c -fPIC -o $@ $<
index da3e63ea32a0e54474542f8802a6682169d19616..320294fec1289837fdc3901c40a617526da4e366 100644 (file)
@@ -2,17 +2,24 @@
  *
  * Copyright (c) 2002-2004 Apple Computer, Inc. All rights reserved.
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * @APPLE_LICENSE_HEADER_START@
  * 
- *     http://www.apache.org/licenses/LICENSE-2.0
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
  * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
  * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
  *
  * Formatting notes:
  * This code follows the "Whitesmiths style" C indentation rules. Plenty of discussion
     Change History (most recent first):
 
 $Log: NetMonitor.c,v $
-Revision 1.82  2006/08/14 23:24:46  cheshire
-Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
-
-Revision 1.81  2006/07/06 00:01:44  cheshire
-<rdar://problem/4472014> Add Private DNS client functionality to mDNSResponder
-Update mDNSSendDNSMessage() to use uDNS_TCPSocket type instead of "int"
-
-Revision 1.80  2006/06/12 18:22:42  cheshire
-<rdar://problem/4580067> mDNSResponder building warnings under Red Hat 64-bit (LP64) Linux
-
-Revision 1.79  2006/04/26 20:48:33  cheshire
-Make final count of unique source addresses show IPv4 and IPv6 counts separately
-
-Revision 1.78  2006/04/25 00:42:24  cheshire
-Add ability to specify a single interface index to capture on,
-e.g. typically "-i 4" for Ethernet and "-i 5" for AirPort
-
-Revision 1.77  2006/03/02 21:50:45  cheshire
-Removed strange backslash at the end of a line
-
-Revision 1.76  2006/02/23 23:38:43  cheshire
-<rdar://problem/4427969> On FreeBSD 4 "arpa/inet.h" requires "netinet/in.h" be included first
-
-Revision 1.75  2006/01/05 22:33:58  cheshire
-Use IFNAMSIZ (more portable) instead of IF_NAMESIZE
-
 Revision 1.74  2005/12/02 20:08:39  cheshire
 Update "No HINFO" message
 
@@ -313,9 +294,9 @@ Added NetMonitor.c
 #include <signal.h>                    // For SIGINT, SIGTERM
 #include <netdb.h>                     // For gethostbyname()
 #include <sys/socket.h>                // For AF_INET, AF_INET6, etc.
+#include <arpa/inet.h>         // For inet_addr()
 #include <net/if.h>                    // For IF_NAMESIZE
 #include <netinet/in.h>                // For INADDR_NONE
-#include <arpa/inet.h>         // For inet_addr()
 
 #include "mDNSPosix.h"      // Defines the specific types needed to run mDNS on this platform
 #include "ExampleClientApp.h"
@@ -379,7 +360,7 @@ static mDNS mDNSStorage;                                            // mDNS core uses this to store its globals
 static mDNS_PlatformSupport PlatformStorage;   // Stores this platform's globals
 
 struct timeval tv_start, tv_end, tv_interval;
-static int FilterInterface = 0;
+
 static FilterList *Filters;
 #define ExactlyOneFilter (Filters && !Filters->next)
 
@@ -573,7 +554,7 @@ mDNSlocal void SendUnicastQuery(mDNS *const m, HostEntry *entry, domainname *nam
                m->ExpectUnicastResponse = m->timenow;
                }
 
-       mDNSSendDNSMessage(&mDNSStorage, &query, qptr, InterfaceID, target, MulticastDNSPort, mDNSNULL, mDNSNULL);
+       mDNSSendDNSMessage(&mDNSStorage, &query, qptr, InterfaceID, target, MulticastDNSPort, -1, mDNSNULL);
        }
 
 mDNSlocal void AnalyseHost(mDNS *const m, HostEntry *entry, const mDNSInterfaceID InterfaceID)
@@ -710,7 +691,7 @@ mDNSlocal void printstats(int max)
                }
        }
 
-mDNSlocal const mDNSu8 *FindUpdate(mDNS *const m, const DNSMessage *const query, const mDNSu8 *ptr, const mDNSu8 *const end,
+mDNSlocal const mDNSu8 *FindUpdate(mDNS *const m, const DNSMessage *const query, const mDNSu8 *ptr, const mDNSu8 *const end,\
        DNSQuestion *q, LargeCacheRecord *pkt)
        {
        int i;
@@ -732,7 +713,7 @@ mDNSlocal void DisplayPacketHeader(mDNS *const m, const DNSMessage *const msg, c
        struct timeval tv;
        struct tm tm;
        const mDNSu32 index = mDNSPlatformInterfaceIndexfromInterfaceID(m, InterfaceID);
-       char if_name[IFNAMSIZ];         // Older Linux distributions don't define IF_NAMESIZE
+       char if_name[IF_NAMESIZE];
        if_indextoname(index, if_name);
        gettimeofday(&tv, NULL);
        localtime_r((time_t*)&tv.tv_sec, &tm);
@@ -1003,7 +984,6 @@ mDNSexport void mDNSCoreReceive(mDNS *const m, DNSMessage *const msg, const mDNS
        const mDNSu8 StdR = kDNSFlag0_QR_Response | kDNSFlag0_OP_StdQuery;
        const mDNSu8 QR_OP = (mDNSu8)(msg->h.flags.b[0] & kDNSFlag0_QROP_Mask);
        mDNSu8 *ptr = (mDNSu8 *)&msg->h.numQuestions;
-       int goodinterface = (FilterInterface == 0);
 
        (void)dstaddr;  // Unused
        (void)dstport;  // Unused
@@ -1016,8 +996,7 @@ mDNSexport void mDNSCoreReceive(mDNS *const m, DNSMessage *const msg, const mDNS
 
        // For now we're only interested in monitoring IPv4 traffic.
        // All IPv6 packets should just be duplicates of the v4 packets.
-       if (!goodinterface) goodinterface = (FilterInterface == (int)mDNSPlatformInterfaceIndexfromInterfaceID(m, InterfaceID));
-       if (goodinterface && AddressMatchesFilterList(srcaddr))
+       if (AddressMatchesFilterList(srcaddr))
                {
                mDNS_Lock(m);
                if (!mDNSAddrIsDNSMulticast(dstaddr))
@@ -1093,14 +1072,7 @@ mDNSlocal mStatus mDNSNetMonitor(void)
        localtime_r((time_t*)&tv_end.tv_sec, &tm);
        mprintf("End          %3d:%02d:%02d.%06d\n", tm.tm_hour, tm.tm_min, tm.tm_sec, tv_end.tv_usec);
        mprintf("Captured for %3d:%02d:%02d.%06d\n", h, m, s, tv_interval.tv_usec);
-       if (!Filters)
-               {
-               mprintf("Unique source addresses seen on network:");
-               if (IPv4HostList.num) mprintf(" %ld (IPv4)", IPv4HostList.num);
-               if (IPv6HostList.num) mprintf(" %ld (IPv6)", IPv6HostList.num);
-               if (!IPv4HostList.num && !IPv6HostList.num) mprintf(" None");
-               mprintf("\n");
-               }
+       if (!Filters) mprintf("Unique source addresses seen on network: %ld\n", IPv4HostList.num + IPv6HostList.num);
        mprintf("\n");
        mprintf("Modern Query        Packets:      %7d   (avg%5d/min)\n", NumPktQ,        NumPktQ        * mul / div);
        mprintf("Legacy Query        Packets:      %7d   (avg%5d/min)\n", NumPktL,        NumPktL        * mul / div);
@@ -1136,43 +1108,34 @@ mDNSexport int main(int argc, char **argv)
 
        for (i=1; i<argc; i++)
                {
-               if (i+1 < argc && !strcmp(argv[i], "-i") && atoi(argv[i+1]))
+               struct in_addr s4;
+               struct in6_addr s6;
+               FilterList *f;
+               mDNSAddr a;
+               a.type = mDNSAddrType_IPv4;
+
+               if (inet_pton(AF_INET, argv[i], &s4) == 1)
+                       a.ip.v4.NotAnInteger = s4.s_addr;
+               else if (inet_pton(AF_INET6, argv[i], &s6) == 1)
                        {
-                       FilterInterface = atoi(argv[i+1]);
-                       i += 2;
-                       printf("Monitoring interface %d\n", FilterInterface);
+                       a.type = mDNSAddrType_IPv6;
+                       bcopy(&s6, &a.ip.v6, sizeof(a.ip.v6));
                        }
                else
                        {
-                       struct in_addr s4;
-                       struct in6_addr s6;
-                       FilterList *f;
-                       mDNSAddr a;
-                       a.type = mDNSAddrType_IPv4;
-       
-                       if (inet_pton(AF_INET, argv[i], &s4) == 1)
-                               a.ip.v4.NotAnInteger = s4.s_addr;
-                       else if (inet_pton(AF_INET6, argv[i], &s6) == 1)
-                               {
-                               a.type = mDNSAddrType_IPv6;
-                               bcopy(&s6, &a.ip.v6, sizeof(a.ip.v6));
-                               }
-                       else
-                               {
-                               struct hostent *h = gethostbyname(argv[i]);
-                               if (h) a.ip.v4.NotAnInteger = *(long*)h->h_addr;
-                               else goto usage;
-                               }
-                       
-                       f = malloc(sizeof(*f));
-                       f->FilterAddr = a;
-                       f->next = Filters;
-                       Filters = f;
+                       struct hostent *h = gethostbyname(argv[i]);
+                       if (h) a.ip.v4.NotAnInteger = *(long*)h->h_addr;
+                       else goto usage;
                        }
+               
+               f = malloc(sizeof(*f));
+               f->FilterAddr = a;
+               f->next = Filters;
+               Filters = f;
                }
 
        status = mDNSNetMonitor();
-       if (status) { fprintf(stderr, "%s: mDNSNetMonitor failed %d\n", progname, (int)status); return(status); }
+       if (status) { fprintf(stderr, "%s: mDNSNetMonitor failed %ld\n", progname, status); return(status); }
        return(0);
 
 usage:
index 4bd94640787222ab9644b4857cd8cef123cac26b..5963f20b1bb39dd454621d71287922f6b9d95791 100644 (file)
@@ -2,17 +2,24 @@
  *
  * Copyright (c) 2003-2004 Apple Computer, Inc. All rights reserved.
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * @APPLE_LICENSE_HEADER_START@
  * 
- *     http://www.apache.org/licenses/LICENSE-2.0
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
  * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
  * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
 
        File:           daemon.c
 
@@ -21,9 +28,6 @@
        Change History (most recent first):
 
 $Log: PosixDaemon.c,v $
-Revision 1.29.2.1  2006/08/29 06:24:34  cheshire
-Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
-
 Revision 1.29  2005/08/04 03:37:45  mkrochma
 Temporary workaround to fix posix after mDNS_SetPrimaryInterfaceInfo changed
 
index 0daaca75a0ee8a8323e16e947475abd4b6d71523..293ee0a293a0bc10fc5f839c170b0cbedc0cf534 100644 (file)
@@ -2,30 +2,28 @@
  *
  * Copyright (c) 2002-2004 Apple Computer, Inc. All rights reserved.
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * @APPLE_LICENSE_HEADER_START@
  * 
- *     http://www.apache.org/licenses/LICENSE-2.0
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
  * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
  * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
 
     Change History (most recent first):
 
 $Log: ProxyResponder.c,v $
-Revision 1.39  2006/08/14 23:24:46  cheshire
-Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
-
-Revision 1.38  2006/06/12 18:22:42  cheshire
-<rdar://problem/4580067> mDNSResponder building warnings under Red Hat 64-bit (LP64) Linux
-
-Revision 1.37  2006/02/23 23:38:43  cheshire
-<rdar://problem/4427969> On FreeBSD 4 "arpa/inet.h" requires "netinet/in.h" be included first
-
 Revision 1.36  2005/08/04 03:12:47  mkrochma
 <rdar://problem/4199236> Register reverse PTR record using multicast
 
@@ -120,8 +118,8 @@ Add "$Log" header
 #include <unistd.h>                            // For select()
 #include <signal.h>                            // For SIGINT, SIGTERM
 #include <errno.h>                             // For errno, EINTR
-#include <netinet/in.h>                        // For INADDR_NONE
 #include <arpa/inet.h>                 // For inet_addr()
+#include <netinet/in.h>                        // For INADDR_NONE
 #include <netdb.h>                             // For gethostbyname()
 
 #include "mDNSEmbeddedAPI.h"   // Defines the interface to the client layer above
@@ -328,7 +326,7 @@ mDNSexport int main(int argc, char **argv)
                mDNS_Init_NoCache, mDNS_Init_ZeroCacheSize,
                mDNS_Init_DontAdvertiseLocalAddresses,
                mDNS_Init_NoInitCallback, mDNS_Init_NoInitCallbackContext);
-       if (status) { fprintf(stderr, "Daemon start: mDNS_Init failed %d\n", (int)status); return(status); }
+       if (status) { fprintf(stderr, "Daemon start: mDNS_Init failed %ld\n", status); return(status); }
 
        mDNSPosixListenForSignalInEventLoop(SIGINT);
        mDNSPosixListenForSignalInEventLoop(SIGTERM);
index d4bff853b4c1b13801a209b2fb04b8ed85d4cde2..80f8fa3db9ed9f34688a7cdde2fbaf02015133b7 100755 (executable)
@@ -1,31 +1,24 @@
 ReadMe About mDNSPosix
 ----------------------
 
-mDNSPosix is a port of Apple's Multicast DNS and DNS Service Discovery
-code to Posix platforms.
+mDNSPosix is a port of Apple's core mDNS code to Posix platforms.
 
-Multicast DNS and DNS Service Discovery are technologies that allow you
-to register IP-based services and browse the network for those services.
-For more information about mDNS, see the mDNS web site.
+mDNS is short for "multicast DNS", which is a technology that allows you
+to register IP services and browse the network for those services.  For
+more information about mDNS, see the mDNS web site.
 
   <http://www.multicastdns.org/>
 
-Multicast DNS is part of a family of technologies resulting from the
-efforts of the IETF Zeroconf working group.  For information about
-other Zeroconf technologies, see the Zeroconf web site.
+mDNS is part of a family of technologies resulting from the efforts of
+the IETF zeroconf working group.  For information about other zeroconf
+technologies, see the zeroconf web site.
 
   <http://www.zeroconf.org/>
 
 Apple uses the trade mark "Bonjour" to describe our implementation of
-Zeroconf technologies.  This sample is designed to show how easy it is
+zeroconf technologies.  This sample is designed to show how easy it is
 to make a device "Bonjour compatible".
 
-The "Bonjour" trade mark can also be licensed at no charge for
-inclusion on your own products, packaging, manuals, promotional
-materials, or web site. For details and licensing terms, see
-
-  <http://developer.apple.com/bonjour/>
-
 The code in this sample was compiled and tested on Mac OS X (10.1.x,
 10.2, 10.3), Solaris (SunOS 5.8), Linux (Redhat 2.4.9-21, Fedora Core 1), 
 and OpenBSD (2.9). YMMV.
@@ -86,30 +79,26 @@ o Standalone products for dedicated devices (printer, network camera, etc.)
   - mDNSResponderPosix
   - mDNSProxyResponderPosix
 
-o Testing and Debugging tools
-  - dns-sd command-line tool (from the "Clients" folder)
+o Debugging tools
   - mDNSNetMonitor
   - mDNSIdentify
 
-As root type "make install" to install eight things:
+As root type "make install" to install six things:
 o mdnsd                   (usually in /usr/sbin)
 o libmdns                 (usually in /usr/lib)
 o dns_sd.h                (usually in /usr/include)
 o startup scripts         (e.g. in /etc/rc.d)
 o manual pages            (usually in /usr/share/man)
-o dns-sd tool             (usually in /usr/bin)
 o nss_mdns                (usually in /lib)
 o nss configuration files (usually in /etc)
 
-The "make install" concludes by executing the startup script
-(usually "/etc/init.d/mdns start") to start the daemon running.
-You shouldn't need to reboot unless you really want to.
-
-Once the daemon is running, you can use the dns-sd test tool
-to exercise all the major functionality of the daemon. Running
-"dns-sd" with no arguments gives a summary of the available options.
-This test tool is also described in detail, with several examples,
-in Chapter 6 of the O'Reilly "Zero Configuration Networking" book.
+Once you've installed the files in their respective places,
+you need to start the daemon running, either by rebooting,
+or by running the startup script "/etc/init.d/mdns start"
+(the exact path may be different on your system).
+Then you can cd to the "Clients" folder and type "make".
+This builds a test client showing how to exercise all the major
+functionality of the daemon.
 
 
 How It Works
@@ -254,19 +243,17 @@ Caveats
 -------
 Currently the program uses a simple make file.
 
-The Multicast DNS protocol can also operate locally over the loopback
-interface, but this exposed some problems with the underlying network
-stack in early versions of Mac OS X and may expose problems with other
-network stacks too.
+There are various problems with loopback-only self discovery.  The code
+will attempt service discovery on the loopback interface only if no
+other interfaces are available.  However, this exposes a number of
+problems with the underlying network stack (at least on Mac OS X).
 
-o On Mac OS X 10.1.x the code failed to start on the loopback interface
+o On Mac OS X 10.1.x the code fails to start on the loopback interface
   because the IP_ADD_MEMBERSHIP option returns ENOBUFS.
 
-o On Mac OS X 10.2 the loopback-only case failed because
-  "sendto" calls fails with error EHOSTUNREACH. (3016042)
-
-Consequently, the code will attempt service discovery on the loopback
-interface only if no other interfaces are available.
+o On Mac OS X 10.2 the loopback-only case fails because
+  mDNSPlatformSendUDP's call to "sendto" fails with error EHOSTUNREACH
+  [Radar ID 3016042].
 
 I haven't been able to test the loopback-only case on other platforms
 because I don't have access to the physical machine.
@@ -274,7 +261,9 @@ because I don't have access to the physical machine.
 
 Licencing
 ---------
-This source code is Open Source; for details see the "LICENSE" file.
+This code is distributed under the Apple Public Source License.
+Information about the licence is included at the top of each source file.
+
 
 Credits and Version History
 ---------------------------
index 4f6b186e063c9375d52d78feef8dbe7ab16fc706..986333b05892b0ba9a293f956f3ea43d332886b2 100755 (executable)
@@ -2,27 +2,28 @@
  *
  * Copyright (c) 2002-2004 Apple Computer, Inc. All rights reserved.
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * @APPLE_LICENSE_HEADER_START@
  * 
- *     http://www.apache.org/licenses/LICENSE-2.0
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
  * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
  * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
 
     Change History (most recent first):
 
 $Log: Responder.c,v $
-Revision 1.32  2006/08/14 23:24:46  cheshire
-Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
-
-Revision 1.31  2006/06/12 18:22:42  cheshire
-<rdar://problem/4580067> mDNSResponder building warnings under Red Hat 64-bit (LP64) Linux
-
 Revision 1.30  2005/10/26 22:21:16  cheshire
 <rdar://problem/4149841> Potential buffer overflow in mDNSResponderPosix
 
@@ -831,7 +832,7 @@ int main(int argc, char **argv)
         result = 2;
     }
     if ( (result != 0) || (gMDNSPlatformPosixVerboseLevel > 0) ) {
-        fprintf(stderr, "%s: Finished with status %d, result %d\n", gProgramName, (int)status, result);
+        fprintf(stderr, "%s: Finished with status %ld, result %d\n", gProgramName, status, result);
     }
     
     return result;
index 64895aba6e757201837335c58b2224655821c80c..6acf92ef42a06bf580fca2719b6ce9937f4d91bf 100644 (file)
@@ -2,24 +2,28 @@
  *
  * Copyright (c) 2002-2004 Apple Computer, Inc. All rights reserved.
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * @APPLE_LICENSE_HEADER_START@
  * 
- *     http://www.apache.org/licenses/LICENSE-2.0
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
  * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
  * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
 
     Change History (most recent first):
 
 $Log: dnsextd.c,v $
-Revision 1.33.2.2  2006/08/29 06:24:34  cheshire
-Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
-
 Revision 1.33.2.1  2005/08/05 21:14:00  ksekar
 <rdar://problem/4012279> Long-lived queries not working on windows
 Change constant names
index afa9a8003f5eb22dbff4fa9baf3e393811fe7c5d..5290bf7209a28fc93fb1a7bfc86dd18111e85efe 100755 (executable)
@@ -2,17 +2,24 @@
  *
  * Copyright (c) 2002-2004 Apple Computer, Inc. All rights reserved.
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * @APPLE_LICENSE_HEADER_START@
  * 
- *     http://www.apache.org/licenses/LICENSE-2.0
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
  * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
  * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
  *
  * Formatting notes:
  * This code follows the "Whitesmiths style" C indentation rules. Plenty of discussion
        Change History (most recent first):
 
 $Log: mDNSPosix.c,v $
-Revision 1.78.2.1  2006/08/29 06:24:34  cheshire
-Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
-
-Revision 1.78  2006/06/28 09:12:22  cheshire
-Added debugging message
-
-Revision 1.77  2006/03/19 02:00:11  cheshire
-<rdar://problem/4073825> Improve logic for delaying packets after repeated interface transitions
-
-Revision 1.76  2006/01/09 19:29:16  cheshire
-<rdar://problem/4403128> Cap number of "sendto failed" messages we allow mDNSResponder to log
-
-Revision 1.75  2006/01/05 22:04:57  cheshire
-<rdar://problem/4399479> Log error message when send fails with "operation not permitted"
-
-Revision 1.74  2006/01/05 21:45:27  cheshire
-<rdar://problem/4400118> Fix uninitialized structure member in IPv6 code
-
 Revision 1.73  2005/10/11 21:31:46  cheshire
 <rdar://problem/4296177> Don't depend on IP_RECVTTL succeeding (not available on all platforms)
 
@@ -452,20 +441,11 @@ mDNSexport mStatus mDNSPlatformSendUDP(const mDNS *const m, const void *const ms
        if      (err > 0) err = 0;
        else if (err < 0)
                {
-               static int MessageCount = 0;
-        // Don't report EHOSTDOWN (i.e. ARP failure), ENETDOWN, or no route to host for unicast destinations
-               if (!mDNSAddressIsAllDNSLinkGroup(dst))
-                       if (errno == EHOSTDOWN || errno == ENETDOWN || errno == EHOSTUNREACH || errno == ENETUNREACH) return(mStatus_TransientErr);
-
-               if (MessageCount < 1000)
-                       {
-                       MessageCount++;
-                       if (thisIntf)
-                               LogMsg("mDNSPlatformSendUDP got error %d (%s) sending packet to %#a on interface %#a/%s/%d",
-                                                         errno, strerror(errno), dst, &thisIntf->coreIntf.ip, thisIntf->intfName, thisIntf->index);
-                       else
-                               LogMsg("mDNSPlatformSendUDP got error %d (%s) sending packet to %#a", errno, strerror(errno), dst);
-                       }
+               if (thisIntf)
+                       verbosedebugf("mDNSPlatformSendUDP got error %d (%s) sending packet to %#a on interface %#a/%s/%d",
+                                                 errno, strerror(errno), dst, &thisIntf->coreIntf.ip, thisIntf->intfName, thisIntf->index);
+               else
+                       verbosedebugf("mDNSPlatformSendUDP got error %d (%s) sending packet to %#a", errno, strerror(errno), dst);
                }
 
        return PosixErrorToStatus(err);
@@ -691,7 +671,7 @@ mDNSlocal PosixNetworkInterface *SearchForInterfaceByName(mDNS *const m, const c
        return intf;
        }
 
-mDNSexport mDNSInterfaceID mDNSPlatformInterfaceIDfromInterfaceIndex(mDNS *const m, mDNSu32 index)
+mDNSexport mDNSInterfaceID mDNSPlatformInterfaceIDfromInterfaceIndex(const mDNS *const m, mDNSu32 index)
        {
        PosixNetworkInterface *intf;
 
@@ -706,7 +686,7 @@ mDNSexport mDNSInterfaceID mDNSPlatformInterfaceIDfromInterfaceIndex(mDNS *const
        return (mDNSInterfaceID) intf;
        }
        
-mDNSexport mDNSu32 mDNSPlatformInterfaceIndexfromInterfaceID(mDNS *const m, mDNSInterfaceID id)
+mDNSexport mDNSu32 mDNSPlatformInterfaceIndexfromInterfaceID(const mDNS *const m, mDNSInterfaceID id)
        {
        PosixNetworkInterface *intf;
 
@@ -742,7 +722,7 @@ mDNSlocal void ClearInterfaceList(mDNS *const m)
        while (m->HostInterfaces)
                {
                PosixNetworkInterface *intf = (PosixNetworkInterface*)(m->HostInterfaces);
-               mDNS_DeregisterInterface(m, &intf->coreIntf, mDNSfalse);
+               mDNS_DeregisterInterface(m, &intf->coreIntf);
                if (gMDNSPlatformPosixVerboseLevel > 0) fprintf(stderr, "Deregistered interface %s\n", intf->intfName);
                FreePosixNetworkInterface(intf);
                }
@@ -894,7 +874,6 @@ mDNSlocal int SetupSocket(struct sockaddr *intfAddr, mDNSIPPort port, int interf
                        {
                        imr6.ipv6mr_multiaddr       = *(const struct in6_addr*)&AllDNSLinkGroupv6;
                        imr6.ipv6mr_interface       = interfaceIndex;
-                       //LogMsg("Joining %.16a on %d", &imr6.ipv6mr_multiaddr, imr6.ipv6mr_interface);
                        err = setsockopt(*sktPtr, IPPROTO_IPV6, IPV6_JOIN_GROUP, &imr6, sizeof(imr6));
                        if (err < 0)
                                {
@@ -947,7 +926,7 @@ mDNSlocal int SetupSocket(struct sockaddr *intfAddr, mDNSIPPort port, int interf
                        bindAddr6.sin6_family      = AF_INET6;
                        bindAddr6.sin6_port        = port.NotAnInteger;
                        bindAddr6.sin6_flowinfo    = 0;
-                       bindAddr6.sin6_addr        = in6addr_any; // Want to receive multicasts AND unicasts on this socket
+//                     bindAddr6.sin6_addr.s_addr = IN6ADDR_ANY_INIT; // Want to receive multicasts AND unicasts on this socket
                        bindAddr6.sin6_scope_id    = 0;
                        err = bind(*sktPtr, (struct sockaddr *) &bindAddr6, sizeof(bindAddr6));
                        if (err < 0) { err = errno; perror("bind"); fflush(stderr); }
@@ -1036,7 +1015,7 @@ mDNSlocal int SetupOneInterface(mDNS *const m, struct sockaddr *intfAddr, struct
 
        // The interface is all ready to go, let's register it with the mDNS core.
        if (err == 0)
-               err = mDNS_RegisterInterface(m, &intf->coreIntf, mDNSfalse);
+               err = mDNS_RegisterInterface(m, &intf->coreIntf, 0);
 
        // Clean up.
        if (err == 0)
index f62d9c30958bb9c0b5f0c636d52ac3991d33adc9..a5af557e543b7ad34e8cdb4ca0f4ada621545424 100755 (executable)
@@ -2,24 +2,28 @@
  *
  * Copyright (c) 2002-2004 Apple Computer, Inc. All rights reserved.
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * @APPLE_LICENSE_HEADER_START@
  * 
- *     http://www.apache.org/licenses/LICENSE-2.0
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
  * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
  * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
 
     Change History (most recent first):
 
 $Log: mDNSPosix.h,v $
-Revision 1.18  2006/08/14 23:24:47  cheshire
-Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
-
 Revision 1.17  2005/02/04 00:39:59  cheshire
 Move ParseDNSServers() from PosixDaemon.c to mDNSPosix.c so all Posix client layers can use it
 
index ad1821ca5b0ab5e832980e3b7838e5dcff664d3b..222b57215968b853973f5c6fb60cb0e52c90c325 100755 (executable)
@@ -2,34 +2,28 @@
  *
  * Copyright (c) 2002-2004 Apple Computer, Inc. All rights reserved.
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * @APPLE_LICENSE_HEADER_START@
  * 
- *     http://www.apache.org/licenses/LICENSE-2.0
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
  * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
  * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
 
     Change History (most recent first):
 
 $Log: mDNSUNP.c,v $
-Revision 1.34  2006/08/14 23:24:47  cheshire
-Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
-
-Revision 1.33  2006/03/13 23:14:21  cheshire
-<rdar://problem/4427969> Compile problems on FreeBSD
-Use <netinet/in_var.h> instead of <netinet6/in6_var.h>
-
-Revision 1.32  2005/12/21 02:56:43  cheshire
-<rdar://problem/4243433> get_ifi_info() should fake ifi_index when SIOCGIFINDEX undefined
-
-Revision 1.31  2005/12/21 02:46:05  cheshire
-<rdar://problem/4243514> mDNSUNP.c needs to include <sys/param.h> on 4.4BSD Lite
-
 Revision 1.30  2005/11/29 20:03:02  mkrochma
 Wrapped sin_len with #ifndef NOT_HAVE_SA_LEN
 
@@ -141,15 +135,6 @@ First checkin
 #include <unistd.h>
 #include <stdio.h>
 
-/* Some weird platforms derived from 4.4BSD Lite (e.g. EFI) need the ALIGN(P)
-   macro, usually defined in <sys/param.h> or someplace like that, to make sure the
-   CMSG_NXTHDR macro is well-formed. On such platforms, the symbol NEED_ALIGN_MACRO
-   should be set to the name of the header to include to get the ALIGN(P) macro.
-*/
-#ifdef NEED_ALIGN_MACRO
-#include NEED_ALIGN_MACRO
-#endif
-
 /* Solaris defined SIOCGIFCONF etc in <sys/sockio.h> but 
    other platforms don't even have that include file.  So, 
    if we haven't yet got a definition, let's try to find 
@@ -169,9 +154,7 @@ First checkin
 #endif
 
 #if defined(AF_INET6) && HAVE_IPV6 && !HAVE_LINUX
-#include <net/if_var.h>
-#include <netinet/in_var.h>
-// NOTE: netinet/in_var.h implicitly includes netinet6/in6_var.h for us
+#include <netinet6/in6_var.h>
 #endif
 
 #if defined(AF_INET6) && HAVE_IPV6 && HAVE_LINUX
@@ -188,7 +171,8 @@ void plen_to_mask(int plen, char *addr) {
                if(plen>bits_in_block) ones_in_block=bits_in_block;
                else                   ones_in_block=plen;
                block = ones & (ones << (bits_in_block-ones_in_block));
-               i==0 ? sprintf(addr, "%x", block) : sprintf(addr, "%s:%x", addr, block);
+               i==0 ? sprintf(addr, "%x", block) :
+ sprintf(addr, "%s:%x", addr, block);
                plen -= ones_in_block;
                }
        }
@@ -402,11 +386,9 @@ struct ifi_info *get_ifi_info(int family, int doaliases)
         ifi->ifi_index = if_nametoindex(ifr->ifr_name);
 #else
         ifrcopy = *ifr;
-#ifdef SIOCGIFINDEX
                if ( 0 >= ioctl(sockfd, SIOCGIFINDEX, &ifrcopy))
             ifi->ifi_index = ifrcopy.ifr_index;
         else
-#endif
             ifi->ifi_index = index++;  /* SIOCGIFINDEX is broken on Solaris 2.5ish, so fake it */
 #endif
         memcpy(ifi->ifi_name, ifr->ifr_name, IFI_NAME);
@@ -723,7 +705,7 @@ struct in_pktinfo
 #ifdef NOT_HAVE_DAEMON
 #include <fcntl.h>
 #include <sys/stat.h>
-#include <sys/signal.h>
+#include <signal.h>
 
 int daemon(int nochdir, int noclose)
     {
index d0d75c4e16d4ae30e402423d7f2d0ca8d5a64a1b..912c9d8ff1a75c3ed7547b2114e1e4c2e693954b 100755 (executable)
@@ -2,24 +2,28 @@
  *
  * Copyright (c) 2002-2004 Apple Computer, Inc. All rights reserved.
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * @APPLE_LICENSE_HEADER_START@
  * 
- *     http://www.apache.org/licenses/LICENSE-2.0
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
  * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
  * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
 
     Change History (most recent first):
 
 $Log: mDNSUNP.h,v $
-Revision 1.19  2006/08/14 23:24:47  cheshire
-Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
-
 Revision 1.18  2005/04/08 21:37:57  ksekar
 <rdar://problem/3792767> get_ifi_info doesn't return IPv6 interfaces on Linux
 
index d8b8ef40a184b1a889ec1885225f7f5e5fdb6e15..ad06e0163a67b87f366392594493eb5f15c8906f 100644 (file)
@@ -1,32 +1,28 @@
 #!/bin/sh
-# Emacs settings: -*- tab-width: 4 -*-
 #
-# Copyright (c) 2002-2006 Apple Computer, Inc. All rights reserved.
+# Linux /etc/init.d script to start/stop the mdnsd daemon.
+# Copyright (c) 2002-2003 Apple Computer, Inc. All rights reserved.
 #
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
+# @APPLE_LICENSE_HEADER_START@
 # 
-#     http://www.apache.org/licenses/LICENSE-2.0
+# This file contains Original Code and/or Modifications of Original Code
+# as defined in and that are subject to the Apple Public Source License
+# Version 2.0 (the 'License'). You may not use this file except in
+# compliance with the License. Please obtain a copy of the License at
+# http://www.opensource.apple.com/apsl/ and read it before using this
+# file.
 # 
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
+# The Original Code and all software distributed under the License are
+# distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+# EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+# INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+# Please see the License for the specific language governing rights and
 # limitations under the License.
-#
-# Linux /etc/init.d script to start/stop the mdnsd daemon.
+# 
+# @APPLE_LICENSE_HEADER_END@
 #
 # $Log: mdnsd.sh,v $
-# Revision 1.9  2006/09/05 20:00:14  cheshire
-# Moved Emacs settings to second line of file
-#
-# Revision 1.8  2006/08/29 16:42:01  mkrochma
-# Fix POSIX startup script
-#
-# Revision 1.7  2006/08/14 23:24:47  cheshire
-# Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
-#
 # Revision 1.6  2004/12/07 20:30:45  cheshire
 # Fix start-stop-daemon for Suse Linux (don't use -s TERM)
 #
index 651a30d001520cc80ac752170dec23bf37528cd2..35e02fccad407574602b2eba0570c2f97d0d4d53 100755 (executable)
@@ -155,7 +155,7 @@ format_reverse_addr_in (
 
 /*
        Format an address structure as a string appropriate for DNS reverse (PTR)
-       lookup for AF_INET6.  Output is in .ip6.arpa domain.
+       lookup for AF_INET6.  Output is in .ip6.int domain.
        
        Parameters
                prefixlen
@@ -491,6 +491,22 @@ const int MDNS_VERBOSE = 0;
 #define k_aliases_max 15
 #define k_addrs_max 15
 
+const int k_mdnsd_intfs_local = 0;
+       // Tell mdnsd to perform lookups only using link-local interfaces.
+       /*
+               Currently, this feature is buggy.  0 will actually cause mdnsd to
+               do what it thinks is best.  Unfortunately, this is to lookup 'local'
+               addresses locally and remote addresses via the DNS.  Thus, lookups
+               for non-"local" addresses via mdns will not work correctly.
+               
+               Apple is currently modifying mdnsd to allow a special interface id
+               (expected value -2) to mean "always lookup locally".  This constant
+               should be changed once the change is made.
+               
+               AW - 16 June 2004
+        */
+
+
 typedef struct buf_header
 {
        char hostname [k_hostname_maxlen + 1];
@@ -863,13 +879,13 @@ mdns_lookup_name (
        switch (af)
        {
          case AF_INET:
-               rrtype = kDNSServiceType_A;
+               rrtype = T_A;
                result->hostent->h_length = 4;
                        // Length of an A record
                break;
        
          case AF_INET6:
-               rrtype = kDNSServiceType_AAAA;
+               rrtype = T_AAAA;
                result->hostent->h_length = 16;
                        // Length of an AAAA record
                break;
@@ -886,11 +902,11 @@ mdns_lookup_name (
        errcode =
                DNSServiceQueryRecord (
                        &sdref,
-                       kDNSServiceFlagsForceMulticast,         // force multicast query
-                       kDNSServiceInterfaceIndexAny,   // all interfaces
+                       0,              // reserved flags field
+                       k_mdnsd_intfs_local,    // all local interfaces
                        fullname,       // full name to query for
                        rrtype,         // resource record type
-                       kDNSServiceClass_IN,    // internet class records
+                       C_IN,   // internet class records
                        mdns_lookup_callback,   // callback
                        result          // Context - result buffer
                );
@@ -961,11 +977,11 @@ mdns_lookup_addr (
        errcode =
                DNSServiceQueryRecord (
                        &sdref,
-                       kDNSServiceFlagsForceMulticast,         // force multicast query
-                       kDNSServiceInterfaceIndexAny,   // all interfaces
+                       0,              // reserved flags field
+                       k_mdnsd_intfs_local,    // all local interfaces
                        addr_str,       // address string to query for
-                       kDNSServiceType_PTR,    // pointer RRs
-                       kDNSServiceClass_IN,    // internet class records
+                       T_PTR,  // pointer RRs
+                       C_IN,   // internet class records
                        mdns_lookup_callback,   // callback
                        result          // Context - result buffer
                );
@@ -1105,7 +1121,7 @@ mdns_lookup_callback
                }
                
                // If a PTR
-               if (rrtype == kDNSServiceType_PTR)
+               if (rrtype == T_PTR)
                {
                        if (callback_body_ptr (fullname, result, rdlen, rdata) < 0)
                                return;
@@ -1695,14 +1711,8 @@ const char * k_default_domains [] =
        {
                "local",
                "254.169.in-addr.arpa",
-               "8.e.f.ip6.int",
-               "8.e.f.ip6.arpa",
-               "9.e.f.ip6.int",
-               "9.e.f.ip6.arpa",
-               "a.e.f.ip6.int",
-               "a.e.f.ip6.arpa",
-               "b.e.f.ip6.int",
-               "b.e.f.ip6.arpa",
+               "0.8.e.f.ip6.int",
+               "0.8.e.f.ip6.arpa",
                NULL
                        // Always null terminated
        };
@@ -2271,10 +2281,10 @@ rr_to_af (ns_type_t rrtype)
 {
        switch (rrtype)
        {
-         case kDNSServiceType_A:
+         case T_A:
                return AF_INET;
        
-         case kDNSServiceType_AAAA:
+         case T_AAAA:
                return AF_INET6;
        
          default:
@@ -2289,10 +2299,10 @@ af_to_rr (int af)
        switch (af)
        {
          case AF_INET:
-               return kDNSServiceType_A;
+               return T_A;
        
          case AF_INET6:
-               return kDNSServiceType_AAAA;
+               return T_AAAA;
        
          default:
                //return ns_t_invalid;
@@ -2413,9 +2423,9 @@ format_reverse_addr_in6 (
                // divide prefixlen into nibbles, rounding up
 
        // Special handling for first
-       if (i % 2)
+       if (i / 2)
        {
-               curr += sprintf (curr, "%d.", (in_addr_a [i/2] >> 4) & 0x0F);
+               curr += sprintf (curr, "%d.", (in_addr_a [i] >> 4) & 0x0F);
        }
        i >>= 1;
                // Convert i to bytes (divide by 2)
index bdcdad7c771b92ae8faf1d8b617ef51c1ffe57af..8f9b309fb73035f978953fbbcae244e5f5d1cc9b 100755 (executable)
@@ -2,12 +2,6 @@
 
 # Applicable domains
 domain local
+domain 0.8.e.f.ip6.int
+domain 0.8.e.f.ip6.arpa
 domain 254.169.in-addr.arpa
-domain 8.e.f.ip6.int
-domain 9.e.f.ip6.int
-domain a.e.f.ip6.int
-domain b.e.f.ip6.int
-domain 8.e.f.ip6.arpa
-domain 9.e.f.ip6.arpa
-domain a.e.f.ip6.arpa
-domain b.e.f.ip6.arpa
index b58289f30573100f143dba7597c3d65d7d5ef7bf..ac14fc57f08c200c92ddfce74fcfe22c8b1e2a80 100755 (executable)
@@ -1,23 +1,29 @@
 #!/usr/bin/python
-# Emacs settings: -*- tab-width: 4 -*-
+
+# parselog.py, written and contributed by Kevin Marks
 #
 # Copyright (c) 2002-2003 Apple Computer, Inc. All rights reserved.
 #
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-# 
-#     http://www.apache.org/licenses/LICENSE-2.0
-# 
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
+# @APPLE_LICENSE_HEADER_START@
+#
+# This file contains Original Code and/or Modifications of Original Code
+# as defined in and that are subject to the Apple Public Source License
+# Version 2.0 (the 'License'). You may not use this file except in
+# compliance with the License. Please obtain a copy of the License at
+# http://www.opensource.apple.com/apsl/ and read it before using this
+# file.
+#
+# The Original Code and all software distributed under the License are
+# distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+# EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+# INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+# Please see the License for the specific language governing rights and
 # limitations under the License.
 #
-# parselog.py, written and contributed by Kevin Marks
+# @APPLE_LICENSE_HEADER_END@
 #
-# Requires OS X 10.3 Panther or later, for Python and Core Graphics Python APIs
+# Requires OS X 10.3 Panther for Python and Core Graphics Python APIs
 # Invoke from the command line with "parselog.py fname" where fname is a log file made by mDNSNetMonitor
 #
 # Caveats:
 # Filled green  circle: Normal answer             Hollow green  circle: Goodbye message (record going away)
 #                                                 Hollow blue   circle: Legacy query (from old client)
 # $Log: parselog.py,v $
-# Revision 1.4  2006/09/05 20:00:14  cheshire
-# Moved Emacs settings to second line of file
-#
-# Revision 1.3  2006/08/14 23:24:47  cheshire
-# Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
-#
 # Revision 1.2  2003/12/01 21:47:44  cheshire
 # APSL
 #
diff --git a/mDNSShared/CommonServices.h b/mDNSShared/CommonServices.h
deleted file mode 100644 (file)
index beaab56..0000000
+++ /dev/null
@@ -1,1504 +0,0 @@
-/* -*- Mode: C; tab-width: 4 -*-
- *
- * Copyright (c) 1997-2004 Apple Computer, Inc. All rights reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * 
- *     http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
-
-    Change History (most recent first):
-    
-$Log: CommonServices.h,v $
-Revision 1.3.4.1  2006/08/29 06:24:36  cheshire
-Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
-
-Revision 1.3  2004/04/08 09:27:12  bradley
-Added macro for portable specification of callback calling conventions.
-
-Revision 1.2  2004/03/07 05:53:39  bradley
-Fixed NumVersion extraction macros. Updated error code mappings to match latest internal version.
-
-Revision 1.1  2004/01/30 02:25:59  bradley
-Common Services and portability support for various platforms.
-
-*/
-
-//---------------------------------------------------------------------------------------------------------------------------
-/*!    @header         CommonServices
-       
-       Common Services for Mac OS X, Linux, Palm, VxWorks, Windows, and Windows CE.
-*/
-
-#ifndef        __COMMON_SERVICES__
-#define        __COMMON_SERVICES__
-
-#ifdef __cplusplus
-       extern "C" {
-#endif
-
-#if 0
-#pragma mark == Target ==
-#endif
-
-//===========================================================================================================================
-//      Target
-//===========================================================================================================================
-
-// Macintosh
-
-#if( !defined( TARGET_OS_MAC ) )
-       #if( ( macintosh || __MACH__ ) && !KERNEL )
-               // ConditionalMacros.h in CoreServices will define this TARGET_* flag.
-       #else
-               #define TARGET_OS_MAC                   0
-       #endif
-#endif
-
-#if( !defined( TARGET_API_MAC_OSX_KERNEL ) )
-       #if( __MACH__ && KERNEL )
-               #define TARGET_API_MAC_OSX_KERNEL               1
-       #else
-               #define TARGET_API_MAC_OSX_KERNEL               0
-       #endif
-#endif
-
-// Linux
-
-#if( !defined( TARGET_OS_LINUX ) )
-       #if( defined( __linux__ ) )
-               #define TARGET_OS_LINUX                 1
-       #else
-               #define TARGET_OS_LINUX                 0
-       #endif
-#endif
-
-// Palm
-
-#if( !defined( TARGET_OS_PALM ) )
-       #if( defined( __PALMOS_TRAPS__ ) || defined( __PALMOS_ARMLET__ ) )
-               #define TARGET_OS_PALM                  1
-       #else
-               #define TARGET_OS_PALM                  0
-       #endif
-#endif
-
-// VxWorks
-
-#if( !defined( TARGET_OS_VXWORKS ) )
-       
-       // No predefined macro for VxWorks so just assume VxWorks if nothing else is set.
-       
-       #if( !macintosh && !__MACH__  && !defined( __linux__ ) && !defined( __PALMOS_TRAPS__ ) && !defined( __PALMOS_ARMLET__ ) && !defined( _WIN32 ) )
-               #define TARGET_OS_VXWORKS               1
-       #else
-               #define TARGET_OS_VXWORKS               0
-       #endif
-#endif
-
-// Windows
-
-#if( !defined( TARGET_OS_WIN32 ) )
-       #if( macintosh || __MACH__ )
-               // ConditionalMacros.h in CoreServices will define this TARGET_* flag.
-       #else                   
-               #if( defined( _WIN32 ) )
-                       #define TARGET_OS_WIN32         1
-               #else
-                       #define TARGET_OS_WIN32         0
-               #endif
-       #endif
-#endif
-
-// Windows CE
-
-#if( !defined( TARGET_OS_WINDOWS_CE ) )
-       #if( defined( _WIN32_WCE ) )
-               #define TARGET_OS_WINDOWS_CE    1
-       #else
-               #define TARGET_OS_WINDOWS_CE    0
-       #endif
-#endif
-
-#if 0
-#pragma mark == Includes ==
-#endif
-
-//===========================================================================================================================
-//      Includes
-//===========================================================================================================================
-
-#if( !KERNEL )
-       #include        <stddef.h>
-#endif
-       
-#if( ( macintosh || __MACH__ ) && !KERNEL )
-               
-       #if( defined( __MWERKS__ ) )
-               #if( __option( c9x ) )
-                       #include        <stdbool.h>
-               #endif
-       #else
-               #include        <stdbool.h>
-       #endif
-       
-       #include        <stdint.h>
-       
-       #if( __MACH__ )
-               
-               // Mac OS X
-               
-               #include        <sys/types.h>
-               #include        <netinet/in.h>
-               #include        <arpa/inet.h>
-               #include        <fcntl.h>
-               #include        <pthread.h>
-               #include        <sys/ioctl.h>
-               #include        <sys/socket.h>
-               #include        <unistd.h>
-               
-               #include        <CoreServices/CoreServices.h>
-       
-       #else
-               
-               // Classic Mac OS
-               
-               #include        <ConditionalMacros.h>
-               #include        <MacTypes.h>
-       
-       #endif
-       
-#elif( KERNEL )
-       
-       // Mac OS X Kernel
-       
-       #include        <stdint.h>
-       
-       #include        <libkern/OSTypes.h>
-       #include        <sys/types.h>
-       
-#elif( TARGET_OS_LINUX )
-       
-       // Linux (no special includes yet).
-
-#elif( TARGET_OS_PALM )
-       
-       // Palm (no special includes yet).
-
-#elif( TARGET_OS_VXWORKS )
-       
-       // VxWorks
-       
-       #include        "vxWorks.h"
-       
-#elif( TARGET_OS_WIN32 )
-       
-       // Windows
-       
-       #if( !defined( WIN32_WINDOWS ) )
-               #define WIN32_WINDOWS           0x0401
-       #endif
-       
-       #if( !defined( _WIN32_WINDOWS ) )
-               #define _WIN32_WINDOWS          0x0401
-       #endif
-       
-       #if( !defined( WIN32_LEAN_AND_MEAN ) )
-               #define WIN32_LEAN_AND_MEAN                     // Needed to avoid redefinitions by Windows interfaces.
-       #endif
-       
-       #if( defined( __MWERKS__ ) )
-       
-               #if( __option( c9x ) )
-                       #include        <stdbool.h>
-               #endif
-               
-               #include        <stdint.h>
-               
-       #elif( defined( _MSC_VER ) )
-       
-               #pragma warning( disable:4127 )         // Disable "conditional expression is constant" warning for debug macros.
-               #pragma warning( disable:4706 )         // Disable "assignment within conditional expression" for Microsoft headers.
-               
-       #endif
-
-       #include        <windows.h>
-       #include        <winsock2.h>
-       #include        <Ws2tcpip.h>
-       
-       #if( defined( _MSC_VER ) )
-               #pragma warning( default:4706 )
-       #endif
-       
-#else
-       #error unknown OS - update this file to support your OS
-#endif
-
-#if( !defined( TARGET_BUILD_MAIN ) )
-       #if( !TARGET_OS_VXWORKS )
-               #define TARGET_BUILD_MAIN               1
-       #endif
-#endif
-
-#if( __GNUC__ || !TARGET_OS_VXWORKS )
-       #define TARGET_LANGUAGE_C_LIKE          1
-#else
-       #define TARGET_LANGUAGE_C_LIKE          0
-#endif
-
-#if 0
-#pragma mark == CPU ==
-#endif
-
-//===========================================================================================================================
-//     CPU
-//===========================================================================================================================
-
-// PowerPC
-
-#if( !defined( TARGET_CPU_PPC ) )
-       #if( defined( __ppc__ ) || defined( __PPC__ ) || defined( powerpc ) || defined( ppc ) || defined( _M_MPPC ) )
-               #define TARGET_CPU_PPC                          1
-       #else
-               #define TARGET_CPU_PPC                          0
-       #endif
-#endif
-
-// x86
-
-#if( !defined( TARGET_CPU_X86 ) )
-       #if( __INTEL__ || defined( __i386__ ) || defined( i386 ) || defined( intel ) || defined( _M_IX86 ) )
-               #define TARGET_CPU_X86                          1
-       #else
-               #define TARGET_CPU_X86                          0
-       #endif
-#endif
-
-// MIPS
-
-#if( !defined( TARGET_CPU_MIPS ) )
-       #if( __MIPS__ || defined( MIPS32 ) || defined( R3000 ) || defined( R4000 ) || defined( R4650 ) || defined( _M_MRX000 ) )
-               #define TARGET_CPU_MIPS                         1
-       #else
-               #define TARGET_CPU_MIPS                         0
-       #endif
-#endif
-
-#if( !defined( TARGET_CPU_PPC ) && !defined( TARGET_CPU_X86 ) && !defined( TARGET_CPU_MIPS ) )
-       #error unknown CPU - update this file to support your CPU
-#endif
-
-#if 0
-#pragma mark == Byte Order ==
-#endif
-
-//===========================================================================================================================
-//     Byte Order
-//===========================================================================================================================
-
-// TARGET_RT_LITTLE_ENDIAN
-
-#if( !defined( TARGET_RT_LITTLE_ENDIAN ) )
-       #if( MIPSEL || IL_LITTLE_ENDIAN || defined( __LITTLE_ENDIAN__ )                                                                                 || \
-                ( defined(   BYTE_ORDER ) && defined(   LITTLE_ENDIAN ) && (   BYTE_ORDER ==   LITTLE_ENDIAN ) )       || \
-                ( defined(  _BYTE_ORDER ) && defined(  _LITTLE_ENDIAN ) && (  _BYTE_ORDER ==  _LITTLE_ENDIAN ) )       || \
-                ( defined( __BYTE_ORDER ) && defined( __LITTLE_ENDIAN ) && ( __BYTE_ORDER == __LITTLE_ENDIAN ) )       || \
-                TARGET_CPU_X86 || ( defined( TARGET_RT_BIG_ENDIAN ) && !TARGET_RT_BIG_ENDIAN ) )
-               #define TARGET_RT_LITTLE_ENDIAN         1
-       #else
-               #define TARGET_RT_LITTLE_ENDIAN         0
-       #endif
-#endif
-
-// TARGET_RT_BIG_ENDIAN
-
-#if( !defined( TARGET_RT_BIG_ENDIAN ) )
-       #if( MIPSEB || IL_BIG_ENDIAN || defined( __BIG_ENDIAN__ )                                                                               || \
-                ( defined(   BYTE_ORDER ) && defined(   BIG_ENDIAN ) && (   BYTE_ORDER ==   BIG_ENDIAN ) )     || \
-                ( defined(  _BYTE_ORDER ) && defined(  _BIG_ENDIAN ) && (  _BYTE_ORDER ==  _BIG_ENDIAN ) )     || \
-                ( defined( __BYTE_ORDER ) && defined( __BIG_ENDIAN ) && ( __BYTE_ORDER == __BIG_ENDIAN ) )     || \
-               ( defined( TARGET_RT_LITTLE_ENDIAN ) && !TARGET_RT_LITTLE_ENDIAN ) )
-               #define TARGET_RT_BIG_ENDIAN            1
-       #else
-               #define TARGET_RT_BIG_ENDIAN            0
-       #endif
-#endif
-
-#if( defined( TARGET_RT_LITTLE_ENDIAN ) && !defined( TARGET_RT_BIG_ENDIAN ) )
-       #if( TARGET_RT_LITTLE_ENDIAN )
-               #define TARGET_RT_BIG_ENDIAN            0
-       #else
-               #define TARGET_RT_BIG_ENDIAN            1
-       #endif
-#endif
-
-#if( defined( TARGET_RT_BIG_ENDIAN ) && !defined( TARGET_RT_LITTLE_ENDIAN ) )
-       #if( TARGET_RT_BIG_ENDIAN )
-               #define TARGET_RT_LITTLE_ENDIAN         0
-       #else
-               #define TARGET_RT_LITTLE_ENDIAN         1
-       #endif
-#endif
-
-#if( !defined( TARGET_RT_LITTLE_ENDIAN ) || !defined( TARGET_RT_BIG_ENDIAN ) )
-       #error unknown byte order - update this file to support your byte order
-#endif
-
-// TARGET_RT_BYTE_ORDER
-
-#if( !defined( TARGET_RT_BYTE_ORDER_BIG_ENDIAN ) )
-       #define TARGET_RT_BYTE_ORDER_BIG_ENDIAN                 1234
-#endif
-
-#if( !defined( TARGET_RT_BYTE_ORDER_LITTLE_ENDIAN ) )
-       #define TARGET_RT_BYTE_ORDER_LITTLE_ENDIAN              4321
-#endif
-
-#if( !defined( TARGET_RT_BYTE_ORDER ) )
-       #if( TARGET_RT_LITTLE_ENDIAN )
-               #define TARGET_RT_BYTE_ORDER                            TARGET_RT_BYTE_ORDER_LITTLE_ENDIAN
-       #else
-               #define TARGET_RT_BYTE_ORDER                            TARGET_RT_BYTE_ORDER_BIG_ENDIAN
-       #endif
-#endif
-
-#if 0
-#pragma mark == Constants ==
-#endif
-
-//===========================================================================================================================
-//     Constants
-//===========================================================================================================================
-
-#if( !TARGET_OS_MAC )
-       #define CR              '\r'
-#endif
-
-#define LF                     '\n'
-#define        CRSTR           "\r"
-#define        LFSTR           "\n"
-#define CRLF           "\r\n"
-#define CRCR           "\r\r"
-
-#if 0
-#pragma mark == Compatibility ==
-#endif
-
-//===========================================================================================================================
-//     Compatibility
-//===========================================================================================================================
-
-// Macros to allow the same code to work on Windows and other sockets API-compatible platforms.
-
-#if( TARGET_OS_WIN32 )
-       #define close_compat( X )               closesocket( X )
-       #define errno_compat()                  (int) GetLastError()
-       #define set_errno_compat( X )   SetLastError( X )
-       #define EWOULDBLOCK_compat              WSAEWOULDBLOCK
-       #define ETIMEDOUT_compat                WSAETIMEDOUT
-       #define ENOTCONN_compat                 WSAENOTCONN
-       #define IsValidSocket( X )              ( ( X ) != INVALID_SOCKET )
-       #define kInvalidSocketRef               INVALID_SOCKET
-       #if( TARGET_LANGUAGE_C_LIKE )
-               typedef SOCKET                          SocketRef;
-       #endif
-#else
-       #define close_compat( X )               close( X )
-       #define errno_compat()                  errno
-       #define set_errno_compat( X )   do { errno = ( X ); } while( 0 )
-       #define EWOULDBLOCK_compat              EWOULDBLOCK
-       #define ETIMEDOUT_compat                ETIMEDOUT
-       #define ENOTCONN_compat                 ENOTCONN
-       #define IsValidSocket( X )              ( ( X ) >= 0 )
-       #define kInvalidSocketRef               -1
-       #if( TARGET_LANGUAGE_C_LIKE )
-               typedef int                                     SocketRef;
-       #endif
-#endif
-
-// socklen_t is not defined on the following platforms so emulate it if not defined:
-// 
-// - Pre-Panther Mac OS X. Panther defines SO_NOADDRERR so trigger off that.
-// - Windows SDK prior to 2003. 2003+ SDK's define EAI_AGAIN so trigger off that.
-// - VxWorks
-
-#if( TARGET_LANGUAGE_C_LIKE )
-       #if( ( TARGET_OS_MAC && !defined( SO_NOADDRERR ) ) || ( TARGET_OS_WIN32 && !defined( EAI_AGAIN ) ) || TARGET_OS_VXWORKS )
-               typedef int                                             socklen_t;
-       #endif
-#endif
-
-// ssize_t is not defined on the following platforms so emulate it if not defined:
-// 
-// - Mac OS X when not building with BSD headers
-// - Windows
-
-#if( TARGET_LANGUAGE_C_LIKE )
-       #if( ( TARGET_OS_WIN32 || !defined( _BSD_SSIZE_T_DEFINED_ ) ) && !TARGET_OS_VXWORKS )
-               typedef int                                             ssize_t;
-       #endif
-#endif
-
-// sockaddr_storage is not supported on non-IPv6 machines so alias it to an IPv4-compatible structure.
-
-#if( TARGET_LANGUAGE_C_LIKE )
-       #if( !defined( AF_INET6 ) )
-               #define sockaddr_storage                sockaddr_in
-               #define ss_family                               sin_family
-       #endif
-#endif
-
-//---------------------------------------------------------------------------------------------------------------------------
-/*!    @defined        SOCKADDR_IS_IP_LOOPBACK
-       
-       @abstract       Determines if a sockaddr is an IPv4 or IPv6 loopback address (if IPv6 is supported).
-*/
-
-#if( defined( AF_INET6 ) )
-       #define SOCKADDR_IS_IP_LOOPBACK( SA )                                                                                                                   \
-               ( ( (const struct sockaddr *)( SA ) )->sa_family == AF_INET )                                                           \
-               ? ( ( (const struct sockaddr_in *)( SA ) )->sin_addr.s_addr == htonl( INADDR_LOOPBACK ) )       \
-               : ( ( (const struct sockaddr *)( SA ) )->sa_family == AF_INET6 )                                                        \
-                       ? IN6_IS_ADDR_LOOPBACK( &( (const struct sockaddr_in6 *)( SA ) )->sin6_addr )                   \
-                       : 0
-#else
-       #define SOCKADDR_IS_IP_LOOPBACK( SA )                                                                                                                   \
-               ( ( (const struct sockaddr *)( SA ) )->sa_family == AF_INET )                                                           \
-               ? ( ( (const struct sockaddr_in *)( SA ) )->sin_addr.s_addr == htonl( INADDR_LOOPBACK ) )       \
-               : 0
-#endif
-
-//---------------------------------------------------------------------------------------------------------------------------
-/*!    @defined        SOCKADDR_IS_IP_LINK_LOCAL
-       
-       @abstract       Determines if a sockaddr is an IPv4 or IPv6 link-local address (if IPv6 is supported).
-*/
-
-#if( defined( AF_INET6 ) )
-       #define SOCKADDR_IS_IP_LINK_LOCAL( SA )                                                                                                                         \
-               ( ( ( (const struct sockaddr *)( SA ) )->sa_family == AF_INET )                                                                 \
-                 ? ( ( ( (uint8_t *)( &( (const struct sockaddr_in *)( SA ) )->sin_addr ) )[ 0 ] == 169 ) &&   \
-                         ( ( (uint8_t *)( &( (const struct sockaddr_in *)( SA ) )->sin_addr ) )[ 1 ] == 254 ) )        \
-                 : IN6_IS_ADDR_LOOPBACK( &( (const struct sockaddr_in6 *)( SA ) )->sin6_addr ) )
-#else
-       #define SOCKADDR_IS_IP_LINK_LOCAL( SA )                                                                                                                         \
-               ( ( ( (const struct sockaddr *)( SA ) )->sa_family == AF_INET )                                                                 \
-                 ? ( ( ( (uint8_t *)( &( (const struct sockaddr_in *)( SA ) )->sin_addr ) )[ 0 ] == 169 ) &&   \
-                         ( ( (uint8_t *)( &( (const struct sockaddr_in *)( SA ) )->sin_addr ) )[ 1 ] == 254 ) )        \
-                 : 0 )
-#endif
-
-// _beginthreadex and _endthreadex are not supported on Windows CE 2.1 or later (the C runtime issues with leaking 
-// resources have apparently been resolved and they seem to have just ripped out support for the API) so map it to 
-// CreateThread on Windows CE.
-
-#if( TARGET_OS_WINDOWS_CE )
-       #define _beginthreadex_compat( SECURITY_PTR, STACK_SIZE, START_ADDRESS, ARG_LIST, FLAGS, THREAD_ID_PTR )                        \
-               (uintptr_t) CreateThread( SECURITY_PTR, STACK_SIZE, (LPTHREAD_START_ROUTINE) START_ADDRESS, ARG_LIST, FLAGS,    \
-                                         (LPDWORD) THREAD_ID_PTR )
-       
-       #define _endthreadex_compat( RESULT )           ExitThread( (DWORD) RESULT )
-#elif( TARGET_OS_WIN32 )
-       #define _beginthreadex_compat                           _beginthreadex
-       #define _endthreadex_compat                                     _endthreadex
-#endif
-
-// The C99 "inline" keyword is not supported by Microsoft compilers, but they do support __inline so map it when needed.
-
-#if( defined( _MSC_VER ) )
-       #define inline_compat           __inline
-#else
-       #define inline_compat           inline
-#endif
-
-// Calling conventions 
-
-#if( !defined( CALLBACK_COMPAT ) )
-       #if( TARGET_OS_WIN32 || TARGET_OS_WINDOWS_CE )
-               #define CALLBACK_COMPAT         CALLBACK
-       #else
-               #define CALLBACK_COMPAT
-       #endif
-#endif
-
-#if 0
-#pragma mark == Macros ==
-#endif
-
-//---------------------------------------------------------------------------------------------------------------------------
-/*!    @defined        kSizeCString
-
-       @abstract       A meta-value to pass to supported routines to indicate the size should be calculated with strlen.
-*/
-
-#define        kSizeCString            ( (size_t) -1 )
-
-//---------------------------------------------------------------------------------------------------------------------------
-/*!    @defined        sizeof_array
-       
-       @abstract       Determines the number of elements in an array.
-*/
-
-#define        sizeof_array( X )               ( sizeof( X ) / sizeof( X[ 0 ] ) )
-
-//---------------------------------------------------------------------------------------------------------------------------
-/*!    @defined        sizeof_element
-       
-       @abstract       Determines the size of an array element.
-*/
-
-#define        sizeof_element( X )             sizeof( X[ 0 ] )
-
-//---------------------------------------------------------------------------------------------------------------------------
-/*!    @defined        sizeof_string
-       
-       @abstract       Determines the size of a constant C string, excluding the null terminator.
-*/
-
-#define        sizeof_string( X )              ( sizeof( ( X ) ) - 1 )
-
-//---------------------------------------------------------------------------------------------------------------------------
-/*!    @defined        sizeof_field
-       
-       @abstract       Determines the size of a field of a type.
-*/
-
-#define        sizeof_field( TYPE, FIELD )             sizeof( ( ( (TYPE *) 0 )->FIELD ) )
-
-//---------------------------------------------------------------------------------------------------------------------------
-/*!    @function       RoundUp
-
-       @abstract       Rounds X up to a multiple of Y.
-*/
-
-#define        RoundUp( X, Y )         ( ( X ) + ( ( Y ) - ( ( X ) % ( Y ) ) ) )
-
-//---------------------------------------------------------------------------------------------------------------------------
-/*!    @function       IsAligned
-
-       @abstract       Returns non-zero if X is aligned to a Y byte boundary and 0 if not. Y must be a power of 2.
-*/
-
-#define        IsAligned( X, Y )               ( ( ( X ) & ( ( Y ) - 1 ) ) == 0 )
-
-//---------------------------------------------------------------------------------------------------------------------------
-/*!    @function       IsFieldAligned
-
-       @abstract       Returns non-zero if FIELD of type TYPE is aligned to a Y byte boundary and 0 if not. Y must be a power of 2.
-*/
-
-#define        IsFieldAligned( X, TYPE, FIELD, Y )             IsAligned( ( (uintptr_t)( X ) ) + offsetof( TYPE, FIELD ), ( Y ) )
-
-//---------------------------------------------------------------------------------------------------------------------------
-/*!    @function       AlignDown
-
-       @abstract       Aligns X down to a Y byte boundary. Y must be a power of 2.
-*/
-
-#define        AlignDown( X, Y )               ( ( X ) & ~( ( Y ) - 1 ) )
-
-//---------------------------------------------------------------------------------------------------------------------------
-/*!    @function       AlignUp
-
-       @abstract       Aligns X up to a Y byte boundary. Y must be a power of 2.
-*/
-
-#define        AlignUp( X, Y )         ( ( ( X ) + ( ( Y ) - 1 ) ) & ~( ( Y ) - 1 ) )
-
-//---------------------------------------------------------------------------------------------------------------------------
-/*!    @function       Min
-
-       @abstract       Returns the lesser of X and Y.
-*/
-
-#if( !defined( Min ) )
-       #define Min( X, Y )             ( ( ( X ) < ( Y ) ) ? ( X ) : ( Y ) )
-#endif
-
-//---------------------------------------------------------------------------------------------------------------------------
-/*!    @function       Max
-
-       @abstract       Returns the greater of X and Y.
-*/
-
-#if( !defined( Max ) )
-       #define Max( X, Y )             ( ( ( X ) > ( Y ) ) ? ( X ) : ( Y ) )
-#endif
-
-//---------------------------------------------------------------------------------------------------------------------------
-/*!    @function       InsertBits
-
-       @abstract       Inserts BITS (both 0 and 1 bits) into X, controlled by MASK and SHIFT, and returns the result.
-       
-       @discussion
-       
-       MASK is the bitmask of the bits in the final position.
-       SHIFT is the number of bits to shift left for 1 to reach the first bit position of MASK.
-       
-       For example, if you wanted to insert 0x3 into the leftmost 4 bits of a 32-bit value:
-       
-       InsertBits( 0, 0x3, 0xF0000000U, 28 ) == 0x30000000
-*/
-
-#define        InsertBits( X, BITS, MASK, SHIFT )              ( ( ( X ) & ~( MASK ) ) | ( ( ( BITS ) << ( SHIFT ) ) & ( MASK ) ) )
-
-//---------------------------------------------------------------------------------------------------------------------------
-/*!    @function       ExtractBits
-
-       @abstract       Extracts bits from X, controlled by MASK and SHIFT, and returns the result.
-       
-       @discussion
-       
-       MASK is the bitmask of the bits in the final position.
-       SHIFT is the number of bits to shift right to right justify MASK.
-       
-       For example, if you had a 32-bit value (e.g. 0x30000000) wanted the left-most 4 bits (e.g. 3 in this example):
-       
-       ExtractBits( 0x30000000U, 0xF0000000U, 28 ) == 0x3
-*/
-
-#define        ExtractBits( X, MASK, SHIFT )                   ( ( ( X ) >> ( SHIFT ) ) & ( ( MASK ) >> ( SHIFT ) ) )
-
-//---------------------------------------------------------------------------------------------------------------------------
-/*!    @function       Stringify
-
-       @abstract       Stringify's an expression.
-       
-       @discussion
-       
-       Stringify macros to process raw text passed via -D options to C string constants. The double-wrapping is necessary 
-       because the C preprocessor doesn't perform its normal argument expansion pre-scan with stringified macros so the 
-       -D macro needs to be expanded once via the wrapper macro then stringified so the raw text is stringified. Otherwise, 
-       the replacement value would be used instead of the symbolic name (only for preprocessor symbols like #defines).
-       
-       For example:
-       
-               #define kMyConstant             1
-               
-               printf( "%s", Stringify( kMyConstant ) );                       // Prints "kMyConstant"
-               printf( "%s", StringifyExpansion( kMyConstant ) );      // Prints "1"
-               
-       Non-preprocessor symbols do not have this issue. For example:
-       
-               enum
-               {
-                       kMyConstant = 1
-               };
-               
-               printf( "%s", Stringify( kMyConstant ) );                       // Prints "kMyConstant"
-               printf( "%s", StringifyExpansion( kMyConstant ) );      // Prints "kMyConstant"
-       
-       See <http://gcc.gnu.org/onlinedocs/cpp/Argument-Prescan.html> for more info on C preprocessor pre-scanning.
-*/
-
-#define        Stringify( X )                          # X
-#define        StringifyExpansion( X )         Stringify( X )
-
-#if 0
-#pragma mark == Types ==
-#endif
-
-#if( TARGET_LANGUAGE_C_LIKE )
-//===========================================================================================================================
-//      Standard Types
-//===========================================================================================================================
-
-#if( !defined( INT8_MIN ) )
-       
-       #define INT8_MIN                                        SCHAR_MIN
-       
-       #if( defined( _MSC_VER ) )
-
-               // C99 stdint.h not supported in VC++/VS.NET yet.
-
-               typedef INT8                                    int8_t;
-               typedef UINT8                                   uint8_t;
-               typedef INT16                                   int16_t;
-               typedef UINT16                                  uint16_t;
-               typedef INT32                                   int32_t;
-               typedef UINT32                                  uint32_t;
-               typedef __int64                                 int64_t;
-               typedef unsigned __int64                uint64_t;
-               
-       #elif( TARGET_OS_VXWORKS && ( TORNADO_VERSION < 220 ) )
-               typedef long long                               int64_t;
-               typedef unsigned long long              uint64_t;
-       #endif
-       
-       typedef int8_t                                          int_least8_t;
-       typedef int16_t                                         int_least16_t;
-       typedef int32_t                                         int_least32_t;
-       typedef int64_t                                         int_least64_t;
-
-       typedef uint8_t                                         uint_least8_t;
-       typedef uint16_t                                        uint_least16_t;
-       typedef uint32_t                                        uint_least32_t;
-       typedef uint64_t                                        uint_least64_t;
-       
-       typedef int8_t                                          int_fast8_t;
-       typedef int16_t                                         int_fast16_t;
-       typedef int32_t                                         int_fast32_t;
-       typedef int64_t                                         int_fast64_t;
-       
-       typedef uint8_t                                         uint_fast8_t;
-       typedef uint16_t                                        uint_fast16_t;
-       typedef uint32_t                                        uint_fast32_t;
-       typedef uint64_t                                        uint_fast64_t;
-
-       #if( !defined( _MSC_VER ) || TARGET_OS_WINDOWS_CE )
-               typedef long int                                intptr_t;
-               typedef unsigned long int               uintptr_t;
-       #endif
-
-#endif
-
-// Macros for minimum-width integer constants
-
-#if( !defined( INT8_C ) )
-       #define INT8_C( value )                 value
-#endif
-
-#if( !defined( INT16_C ) )
-       #define INT16_C( value )                value
-#endif
-
-#if( !defined( INT32_C ) )
-       #define INT32_C( value )                value ## L
-#endif
-
-#if( !defined( INT64_C ) )
-       #if( defined( _MSC_VER ) )
-               #define INT64_C( value )        value ## i64
-       #else
-               #define INT64_C( value )        value ## LL
-       #endif
-#endif
-
-#if( !defined( UINT8_C ) )
-       #define UINT8_C( value )                value ## U
-#endif
-
-#if( !defined( UINT16_C ) )
-       #define UINT16_C( value )               value ## U
-#endif
-
-#if( !defined( UINT32_C ) )
-       #define UINT32_C( value )               value ## UL
-#endif
-
-#if( !defined( UINT64_C ) )
-       #if( defined( _MSC_VER ) )
-               #define UINT64_C( value )       value ## UI64
-       #else
-               #define UINT64_C( value )       value ## ULL
-       #endif
-#endif
-
-#if 0
-#pragma mark == bool ==
-#endif
-
-//===========================================================================================================================
-//      Boolean Constants and Types
-//===========================================================================================================================
-
-// C++ defines bool, true, and false. Metrowerks allows this to be controlled by the "bool" option though.
-// C99 defines __bool_true_false_are_defined when bool, true, and false are defined.
-// MacTypes.h defines true and false (Mac builds only).
-// 
-// Note: The Metrowerks has to be in its own block because Microsoft Visual Studio .NET does not completely 
-// short-circuit and gets confused by the option( bool ) portion of the conditional.
-
-#if( defined( __MWERKS__ ) )
-       
-       // Note: The following test is done on separate lines because CodeWarrior doesn't like it all on one line.
-       
-       #if( !__bool_true_false_are_defined && ( !defined( __cplusplus ) || !__option( bool ) ) )
-               #define COMMON_SERVICES_NEEDS_BOOL              1
-       #else
-               #define COMMON_SERVICES_NEEDS_BOOL              0
-       #endif
-       
-       // Workaround when building with CodeWarrior, but using the Apple stdbool.h header, which uses _Bool.
-       
-       #if( __bool_true_false_are_defined && !defined( __cplusplus ) && !__option( c9x ) )
-               #define _Bool   int
-       #endif
-       
-       // Workaround when building with CodeWarrior for C++ with bool disabled and using the Apple stdbool.h header, 
-       // which defines true and false to map to C++ true and false (which are not enabled). Serenity Now!
-       
-       #if( __bool_true_false_are_defined && defined( __cplusplus ) && !__option( bool ) )
-               #define true    1
-               #define false   0
-       #endif
-#else
-       #define COMMON_SERVICES_NEEDS_BOOL                      ( !defined( __cplusplus ) && !__bool_true_false_are_defined )
-#endif
-
-#if( COMMON_SERVICES_NEEDS_BOOL )
-       
-       typedef int             bool;
-       
-       #define bool    bool
-       
-       #if( !defined( __MACTYPES__ ) && !defined( true ) && !defined( false ) )
-               #define true    1
-               #define false   0
-       #endif
-       
-       #define __bool_true_false_are_defined           1
-#endif
-
-// IOKit IOTypes.h typedef's bool if TYPE_BOOL is not defined so define it here to prevent redefinition by IOTypes.h.
-
-#if( TARGET_API_MAC_OSX_KERNEL )
-       #define TYPE_BOOL               1
-#endif
-
-//---------------------------------------------------------------------------------------------------------------------------
-/*!    @typedef        CStr255
-       
-       @abstract       255 character null-terminated (C-style) string.
-*/
-
-#if( TARGET_LANGUAGE_C_LIKE )
-       typedef char    CStr255[ 256 ];
-#endif
-
-#endif // TARGET_LANGUAGE_C_LIKE
-
-//---------------------------------------------------------------------------------------------------------------------------
-/*!    @defined        TYPE_LONGLONG_NATIVE
-
-       @abstract       Defines whether long long (or its equivalent) is natively supported or requires special libraries.
-*/
-
-#if( !defined( TYPE_LONGLONG_NATIVE ) )
-       #if( !TARGET_OS_VXWORKS )
-               #define TYPE_LONGLONG_NATIVE                    1
-       #else
-               #define TYPE_LONGLONG_NATIVE                    0
-       #endif
-#endif
-
-//---------------------------------------------------------------------------------------------------------------------------
-/*!    @defined        long_long_compat
-
-       @abstract       Compatibility type to map to the closest thing to long long and unsigned long long.
-       
-       @discussion
-       
-       Neither long long nor unsigned long long are supported by Microsoft compilers, but they do support proprietary
-       "__int64" and "unsigned __int64" equivalents so map to those types if the real long long is not supported.
-*/
-
-#if( TARGET_LANGUAGE_C_LIKE )
-       #if( TARGET_OS_WIN32 )
-               typedef __int64                                 long_long_compat;
-               typedef unsigned __int64                unsigned_long_long_compat;
-       #else
-               typedef signed long long                long_long_compat;
-               typedef unsigned long long              unsigned_long_long_compat;
-       #endif
-#endif
-
-#if 0
-#pragma mark == Errors ==
-#endif
-
-//---------------------------------------------------------------------------------------------------------------------------
-/*!    @enum           OSStatus
-
-       @abstract       Status Code
-       
-       @constant       kNoErr                                              0 No error occurred.
-       @constant       kInProgressErr                              1 Operation in progress.
-       @constant       kUnknownErr                                     -6700 Unknown error occurred.
-       @constant       kOptionErr                                      -6701 Option was not acceptable.
-       @constant       kSelectorErr                            -6702 Selector passed in is invalid or unknown.
-       @constant       kExecutionStateErr                      -6703 Call made in the wrong execution state (e.g. called at interrupt time).
-       @constant       kPathErr                                        -6704 Path is invalid, too long, or otherwise not usable.
-       @constant       kParamErr                                       -6705 Parameter is incorrect, missing, or not appropriate.
-       @constant       kParamCountErr                          -6706 Incorrect or unsupported number of parameters.
-       @constant       kCommandErr                                     -6707 Command invalid or not supported.
-       @constant       kIDErr                                          -6708 Unknown, invalid, or inappropriate identifier.
-       @constant       kStateErr                                       -6709 Not in appropriate state to perform operation.
-       @constant       kRangeErr                                       -6710 Index is out of range or not valid.
-       @constant       kRequestErr                                     -6711 Request was improperly formed or not appropriate.
-       @constant       kResponseErr                            -6712 Response was incorrect or out of sequence.
-       @constant       kChecksumErr                            -6713 Checksum does not match the actual data.
-       @constant       kNotHandledErr                          -6714 Operation was not handled (or not handled completely).
-       @constant       kVersionErr                                     -6715 Version is not incorrect or not compatibile.
-       @constant       kSignatureErr                           -6716 Signature did not match what was expected.
-       @constant       kFormatErr                                      -6717 Unknown, invalid, or inappropriate file/data format.
-       @constant       kNotInitializedErr                      -6718 Action request before needed services were initialized.
-       @constant       kAlreadyInitializedErr          -6719 Attempt made to initialize when already initialized.
-       @constant       kNotInUseErr                            -6720 Object not in use (e.g. cannot abort if not already in use).
-       @constant       kInUseErr                                       -6721 Object is in use (e.g. cannot reuse active param blocks).
-       @constant       kTimeoutErr                                     -6722 Timeout occurred.
-       @constant       kCanceledErr                            -6723 Operation canceled (successful cancel).
-       @constant       kAlreadyCanceledErr                     -6724 Operation has already been canceled.
-       @constant       kCannotCancelErr                        -6725 Operation could not be canceled (maybe already done or invalid).
-       @constant       kDeletedErr                                     -6726 Object has already been deleted.
-       @constant       kNotFoundErr                            -6727 Something was not found.
-       @constant       kNoMemoryErr                            -6728 Not enough memory was available to perform the operation.
-       @constant       kNoResourcesErr                         -6729 Resources unavailable to perform the operation.
-       @constant       kDuplicateErr                           -6730 Duplicate found or something is a duplicate.
-       @constant       kImmutableErr                           -6731 Entity is not changeable.
-       @constant       kUnsupportedDataErr                     -6732 Data is unknown or not supported.
-       @constant       kIntegrityErr                           -6733 Data is corrupt.
-       @constant       kIncompatibleErr                        -6734 Data is not compatible or it is in an incompatible format.
-       @constant       kUnsupportedErr                         -6735 Feature or option is not supported.
-       @constant       kUnexpectedErr                          -6736 Error occurred that was not expected.
-       @constant       kValueErr                                       -6737 Value is not appropriate.
-       @constant       kNotReadableErr                         -6738 Could not read or reading is not allowed.
-       @constant       kNotWritableErr                         -6739 Could not write or writing is not allowed.
-       @constant       kBadReferenceErr                        -6740 An invalid or inappropriate reference was specified.
-       @constant       kFlagErr                                        -6741 An invalid, inappropriate, or unsupported flag was specified.
-       @constant       kMalformedErr                           -6742 Something was not formed correctly.
-       @constant       kSizeErr                                        -6743 Size was too big, too small, or not appropriate.
-       @constant       kNameErr                                        -6744 Name was not correct, allowed, or appropriate.
-       @constant       kNotReadyErr                            -6745 Device or service is not ready.
-       @constant       kReadErr                                        -6746 Could not read.
-       @constant       kWriteErr                                       -6747 Could not write.
-       @constant       kMismatchErr                            -6748 Something does not match.
-       @constant       kDateErr                                        -6749 Date is invalid or out-of-range.
-       @constant       kUnderrunErr                            -6750 Less data than expected.
-       @constant       kOverrunErr                                     -6751 More data than expected.
-       @constant       kEndingErr                                      -6752 Connection, session, or something is ending.
-       @constant       kConnectionErr                          -6753 Connection failed or could not be established.
-       @constant       kAuthenticationErr                      -6754 Authentication failed or is not supported.
-       @constant       kOpenErr                                        -6755 Could not open file, pipe, device, etc.
-       @constant       kTypeErr                                        -6756 Incorrect or incompatible type (e.g. file, data, etc.).
-       @constant       kSkipErr                                        -6757 Items should be or was skipped.
-       @constant       kNoAckErr                                       -6758 No acknowledge.
-       @constant       kCollisionErr                           -6759 Collision occurred (e.g. two on bus at same time).
-       @constant       kBackoffErr                                     -6760 Backoff in progress and operation intentionally failed.
-       @constant       kNoAddressAckErr                        -6761 No acknowledge of address.
-       @constant       kBusyErr                                        -6762 Cannot perform because something is busy.
-       @constant       kNoSpaceErr                                     -6763 Not enough space to perform operation.
-*/
-
-#if( TARGET_LANGUAGE_C_LIKE )
-       #if( !TARGET_OS_MAC && !TARGET_API_MAC_OSX_KERNEL )
-               typedef int32_t         OSStatus;
-       #endif
-#endif
-
-#define kNoErr                                         0
-#define kInProgressErr                         1
-
-// Generic error codes are in the range -6700 to -6779.
-
-#define kGenericErrorBase                      -6700   // Starting error code for all generic errors.
-       
-#define kUnknownErr                                    -6700
-#define kOptionErr                                     -6701
-#define kSelectorErr                           -6702
-#define kExecutionStateErr                     -6703
-#define kPathErr                                       -6704
-#define kParamErr                                      -6705
-#define kParamCountErr                         -6706
-#define kCommandErr                                    -6707
-#define kIDErr                                         -6708
-#define kStateErr                                      -6709
-#define kRangeErr                                      -6710
-#define kRequestErr                                    -6711
-#define kResponseErr                           -6712
-#define kChecksumErr                           -6713
-#define kNotHandledErr                         -6714
-#define kVersionErr                                    -6715
-#define kSignatureErr                          -6716
-#define kFormatErr                                     -6717
-#define kNotInitializedErr                     -6718
-#define kAlreadyInitializedErr         -6719
-#define kNotInUseErr                           -6720
-#define kInUseErr                                      -6721
-#define kTimeoutErr                                    -6722
-#define kCanceledErr                           -6723
-#define kAlreadyCanceledErr                    -6724
-#define kCannotCancelErr                       -6725
-#define kDeletedErr                                    -6726
-#define kNotFoundErr                           -6727
-#define kNoMemoryErr                           -6728
-#define kNoResourcesErr                                -6729
-#define kDuplicateErr                          -6730
-#define kImmutableErr                          -6731
-#define kUnsupportedDataErr                    -6732
-#define kIntegrityErr                          -6733
-#define kIncompatibleErr                       -6734
-#define kUnsupportedErr                                -6735
-#define kUnexpectedErr                         -6736
-#define kValueErr                                      -6737
-#define kNotReadableErr                                -6738
-#define kNotWritableErr                                -6739
-#define        kBadReferenceErr                        -6740
-#define        kFlagErr                                        -6741
-#define        kMalformedErr                           -6742
-#define        kSizeErr                                        -6743
-#define        kNameErr                                        -6744
-#define        kNotReadyErr                            -6745
-#define        kReadErr                                        -6746
-#define        kWriteErr                                       -6747
-#define        kMismatchErr                            -6748
-#define        kDateErr                                        -6749
-#define        kUnderrunErr                            -6750
-#define        kOverrunErr                                     -6751
-#define        kEndingErr                                      -6752
-#define        kConnectionErr                          -6753
-#define        kAuthenticationErr                      -6754
-#define        kOpenErr                                        -6755
-#define        kTypeErr                                        -6756
-#define        kSkipErr                                        -6757
-#define        kNoAckErr                                       -6758
-#define        kCollisionErr                           -6759
-#define        kBackoffErr                                     -6760
-#define        kNoAddressAckErr                        -6761
-#define        kBusyErr                                        -6762
-#define        kNoSpaceErr                                     -6763
-
-#define kGenericErrorEnd                       -6779   // Last generic error code (inclusive)
-
-#if 0
-#pragma mark == Mac Compatibility ==
-#endif
-
-//===========================================================================================================================
-//     Mac Compatibility
-//===========================================================================================================================
-
-//---------------------------------------------------------------------------------------------------------------------------
-/*!    @enum           Duration
-       
-       @abstract       Type used to specify a duration of time.
-       
-       @constant       kDurationImmediate                      Indicates no delay/wait time.
-       @constant       kDurationMicrosecond            Microsecond units.
-       @constant       kDurationMillisecond            Millisecond units.
-       @constant       kDurationSecond                         Second units.
-       @constant       kDurationMinute                         Minute units.
-       @constant       kDurationHour                           Hour units.
-       @constant       kDurationDay                            Day units.
-       @constant       kDurationForever                        Infinite period of time (no timeout).
-
-       @discussion 
-       
-       Duration values are intended to be multiplied by the specific interval to achieve an actual duration. For example, 
-       to wait for 5 seconds you would use "5 * kDurationSecond".
-*/
-
-#if( TARGET_LANGUAGE_C_LIKE )
-       #if( !TARGET_OS_MAC )
-               typedef int32_t         Duration;
-       #endif
-#endif
-
-#define        kDurationImmediate                              0L
-#define        kDurationMicrosecond                    -1L
-#define        kDurationMillisecond                    1L
-#define        kDurationSecond                                 ( 1000L * kDurationMillisecond )
-#define        kDurationMinute                                 ( 60L * kDurationSecond )
-#define        kDurationHour                                   ( 60L * kDurationMinute )
-#define        kDurationDay                                    ( 24L * kDurationHour )
-#define        kDurationForever                                0x7FFFFFFFL
-
-// Seconds <-> Minutes <-> Hours <-> Days <-> Weeks <-> Months <-> Years conversions
-
-#define kNanosecondsPerMicrosecond             1000
-#define kNanosecondsPerMillisecond             1000000
-#define kNanosecondsPerSecond                  1000000000
-#define kMicrosecondsPerSecond                 1000000
-#define kMicrosecondsPerMillisecond            1000
-#define kMillisecondsPerSecond                 1000
-#define kSecondsPerMinute                              60
-#define kSecondsPerHour                                        ( 60 * 60 )                             // 3600
-#define kSecondsPerDay                                 ( 60 * 60 * 24 )                // 86400
-#define kSecondsPerWeek                                        ( 60 * 60 * 24 * 7 )    // 604800
-#define kMinutesPerHour                                        60
-#define kMinutesPerDay                                 ( 60 * 24 )                             // 1440
-#define kHoursPerDay                                   24
-#define kDaysPerWeek                                   7
-#define kWeeksPerYear                                  52
-#define kMonthsPerYear                                 12
-
-//---------------------------------------------------------------------------------------------------------------------------
-/*!    @defined        VersionStages
-
-       @abstract       NumVersion-style version stages.
-*/
-
-#define        kVersionStageDevelopment                0x20
-#define        kVersionStageAlpha                              0x40
-#define        kVersionStageBeta                               0x60
-#define        kVersionStageFinal                              0x80
-
-//---------------------------------------------------------------------------------------------------------------------------
-/*!    @function       NumVersionBuild
-
-       @abstract       Builds a 32-bit Mac-style NumVersion value (e.g. NumVersionBuild( 1, 2, 3, kVersionStageBeta, 4 ) -> 1.2.3b4).
-*/
-
-#define        NumVersionBuild( MAJOR, MINOR, BUGFIX, STAGE, REV )     \
-       ( ( ( ( MAJOR )  & 0xFF ) << 24 ) |                                             \
-         ( ( ( MINOR )  & 0x0F ) << 20 ) |                                             \
-         ( ( ( BUGFIX ) & 0x0F ) << 16 ) |                                             \
-         ( ( ( STAGE )  & 0xFF ) <<  8 ) |                                             \
-         ( ( ( REV )    & 0xFF )       ) )
-
-#define        NumVersionExtractMajor( VERSION )                               ( (uint8_t)( ( ( VERSION ) >> 24 ) & 0xFF ) )
-#define        NumVersionExtractMinorAndBugFix( VERSION )              ( (uint8_t)( ( ( VERSION ) >> 16 ) & 0xFF ) )
-#define        NumVersionExtractMinor( VERSION )                               ( (uint8_t)( ( ( VERSION ) >> 20 ) & 0x0F ) )
-#define        NumVersionExtractBugFix( VERSION )                              ( (uint8_t)( ( ( VERSION ) >> 16 ) & 0x0F ) )
-#define        NumVersionExtractStage( VERSION )                               ( (uint8_t)( ( ( VERSION ) >>  8 ) & 0xFF ) )
-#define        NumVersionExtractRevision( VERSION )                    ( (uint8_t)(   ( VERSION )         & 0xFF ) )
-
-//---------------------------------------------------------------------------------------------------------------------------
-/*!    @function       NumVersionCompare
-
-       @abstract       Compares two NumVersion values and returns the following values:
-       
-               left < right -> -1
-               left > right ->  1
-               left = right ->  0
-*/
-
-#if( TARGET_LANGUAGE_C_LIKE )
-       int     NumVersionCompare( uint32_t inLeft, uint32_t inRight );
-#endif
-
-#if 0
-#pragma mark == Binary Constants ==
-#endif
-
-//---------------------------------------------------------------------------------------------------------------------------
-/*!    @defined        binary_4
-       
-       @abstract       Macro to generate an 4-bit constant using binary notation (e.g. binary_4( 1010 ) == 0xA).
-*/
-
-#define        binary_4( a )                                           binary_4_hex_wrap( hex_digit4( a ) )
-#define binary_4_hex_wrap( a )                         binary_4_hex( a )
-#define binary_4_hex( a )                                      ( 0x ## a )
-
-//---------------------------------------------------------------------------------------------------------------------------
-/*!    @defined        binary_8
-       
-       @abstract       Macro to generate an 8-bit constant using binary notation (e.g. binary_8( 01111011 ) == 0x7B).
-*/
-
-#define        binary_8( a )                                           binary_8_hex_wrap( hex_digit8( a ) )
-#define binary_8_hex_wrap( a )                         binary_8_hex( a )
-#define binary_8_hex( a )                                      ( 0x ## a )
-
-//---------------------------------------------------------------------------------------------------------------------------
-/*!    @defined        binary_16
-       
-       @abstract       Macro to generate an 16-bit constant using binary notation (e.g. binary_16( 01111011, 01111011 ) == 0x7B7B).
-*/
-
-#define        binary_16( a, b )                                       binary_16_hex_wrap( hex_digit8( a ), hex_digit8( b ) )
-#define binary_16_hex_wrap( a, b )                     binary_16_hex( a, b )
-#define binary_16_hex( a, b )                          ( 0x ## a ## b )
-
-//---------------------------------------------------------------------------------------------------------------------------
-/*!    @defined        binary_32
-       
-       @abstract       Macro to generate an 32-bit constant using binary notation 
-                               (e.g. binary_32( 01111011, 01111011, 01111011, 01111011 ) == 0x7B7B7B7B).
-*/
-
-#define        binary_32( a, b, c, d )                         binary_32_hex_wrap( hex_digit8( a ), hex_digit8( b ), hex_digit8( c ), hex_digit8( d ) )
-#define binary_32_hex_wrap( a, b, c, d )       binary_32_hex( a, b, c, d )
-#define binary_32_hex( a, b, c, d )                    ( 0x ## a ## b ## c ## d )
-
-// Binary Constant Helpers
-
-#define hex_digit8( a )                                                HEX_DIGIT_ ## a
-#define hex_digit4( a )                                                HEX_DIGIT_ ## 0000 ## a
-
-#define HEX_DIGIT_00000000                                     00
-#define HEX_DIGIT_00000001                                     01
-#define HEX_DIGIT_00000010                                     02
-#define HEX_DIGIT_00000011                                     03
-#define HEX_DIGIT_00000100                                     04
-#define HEX_DIGIT_00000101                                     05
-#define HEX_DIGIT_00000110                                     06
-#define HEX_DIGIT_00000111                                     07
-#define HEX_DIGIT_00001000                                     08
-#define HEX_DIGIT_00001001                                     09
-#define HEX_DIGIT_00001010                                     0A
-#define HEX_DIGIT_00001011                                     0B
-#define HEX_DIGIT_00001100                                     0C
-#define HEX_DIGIT_00001101                                     0D
-#define HEX_DIGIT_00001110                                     0E
-#define HEX_DIGIT_00001111                                     0F
-#define HEX_DIGIT_00010000                                     10
-#define HEX_DIGIT_00010001                                     11
-#define HEX_DIGIT_00010010                                     12
-#define HEX_DIGIT_00010011                                     13
-#define HEX_DIGIT_00010100                                     14
-#define HEX_DIGIT_00010101                                     15
-#define HEX_DIGIT_00010110                                     16
-#define HEX_DIGIT_00010111                                     17
-#define HEX_DIGIT_00011000                                     18
-#define HEX_DIGIT_00011001                                     19
-#define HEX_DIGIT_00011010                                     1A
-#define HEX_DIGIT_00011011                                     1B
-#define HEX_DIGIT_00011100                                     1C
-#define HEX_DIGIT_00011101                                     1D
-#define HEX_DIGIT_00011110                                     1E
-#define HEX_DIGIT_00011111                                     1F
-#define HEX_DIGIT_00100000                                     20
-#define HEX_DIGIT_00100001                                     21
-#define HEX_DIGIT_00100010                                     22
-#define HEX_DIGIT_00100011                                     23
-#define HEX_DIGIT_00100100                                     24
-#define HEX_DIGIT_00100101                                     25
-#define HEX_DIGIT_00100110                                     26
-#define HEX_DIGIT_00100111                                     27
-#define HEX_DIGIT_00101000                                     28
-#define HEX_DIGIT_00101001                                     29
-#define HEX_DIGIT_00101010                                     2A
-#define HEX_DIGIT_00101011                                     2B
-#define HEX_DIGIT_00101100                                     2C
-#define HEX_DIGIT_00101101                                     2D
-#define HEX_DIGIT_00101110                                     2E
-#define HEX_DIGIT_00101111                                     2F
-#define HEX_DIGIT_00110000                                     30
-#define HEX_DIGIT_00110001                                     31
-#define HEX_DIGIT_00110010                                     32
-#define HEX_DIGIT_00110011                                     33
-#define HEX_DIGIT_00110100                                     34
-#define HEX_DIGIT_00110101                                     35
-#define HEX_DIGIT_00110110                                     36
-#define HEX_DIGIT_00110111                                     37
-#define HEX_DIGIT_00111000                                     38
-#define HEX_DIGIT_00111001                                     39
-#define HEX_DIGIT_00111010                                     3A
-#define HEX_DIGIT_00111011                                     3B
-#define HEX_DIGIT_00111100                                     3C
-#define HEX_DIGIT_00111101                                     3D
-#define HEX_DIGIT_00111110                                     3E
-#define HEX_DIGIT_00111111                                     3F
-#define HEX_DIGIT_01000000                                     40
-#define HEX_DIGIT_01000001                                     41
-#define HEX_DIGIT_01000010                                     42
-#define HEX_DIGIT_01000011                                     43
-#define HEX_DIGIT_01000100                                     44
-#define HEX_DIGIT_01000101                                     45
-#define HEX_DIGIT_01000110                                     46
-#define HEX_DIGIT_01000111                                     47
-#define HEX_DIGIT_01001000                                     48
-#define HEX_DIGIT_01001001                                     49
-#define HEX_DIGIT_01001010                                     4A
-#define HEX_DIGIT_01001011                                     4B
-#define HEX_DIGIT_01001100                                     4C
-#define HEX_DIGIT_01001101                                     4D
-#define HEX_DIGIT_01001110                                     4E
-#define HEX_DIGIT_01001111                                     4F
-#define HEX_DIGIT_01010000                                     50
-#define HEX_DIGIT_01010001                                     51
-#define HEX_DIGIT_01010010                                     52
-#define HEX_DIGIT_01010011                                     53
-#define HEX_DIGIT_01010100                                     54
-#define HEX_DIGIT_01010101                                     55
-#define HEX_DIGIT_01010110                                     56
-#define HEX_DIGIT_01010111                                     57
-#define HEX_DIGIT_01011000                                     58
-#define HEX_DIGIT_01011001                                     59
-#define HEX_DIGIT_01011010                                     5A
-#define HEX_DIGIT_01011011                                     5B
-#define HEX_DIGIT_01011100                                     5C
-#define HEX_DIGIT_01011101                                     5D
-#define HEX_DIGIT_01011110                                     5E
-#define HEX_DIGIT_01011111                                     5F
-#define HEX_DIGIT_01100000                                     60
-#define HEX_DIGIT_01100001                                     61
-#define HEX_DIGIT_01100010                                     62
-#define HEX_DIGIT_01100011                                     63
-#define HEX_DIGIT_01100100                                     64
-#define HEX_DIGIT_01100101                                     65
-#define HEX_DIGIT_01100110                                     66
-#define HEX_DIGIT_01100111                                     67
-#define HEX_DIGIT_01101000                                     68
-#define HEX_DIGIT_01101001                                     69
-#define HEX_DIGIT_01101010                                     6A
-#define HEX_DIGIT_01101011                                     6B
-#define HEX_DIGIT_01101100                                     6C
-#define HEX_DIGIT_01101101                                     6D
-#define HEX_DIGIT_01101110                                     6E
-#define HEX_DIGIT_01101111                                     6F
-#define HEX_DIGIT_01110000                                     70
-#define HEX_DIGIT_01110001                                     71
-#define HEX_DIGIT_01110010                                     72
-#define HEX_DIGIT_01110011                                     73
-#define HEX_DIGIT_01110100                                     74
-#define HEX_DIGIT_01110101                                     75
-#define HEX_DIGIT_01110110                                     76
-#define HEX_DIGIT_01110111                                     77
-#define HEX_DIGIT_01111000                                     78
-#define HEX_DIGIT_01111001                                     79
-#define HEX_DIGIT_01111010                                     7A
-#define HEX_DIGIT_01111011                                     7B
-#define HEX_DIGIT_01111100                                     7C
-#define HEX_DIGIT_01111101                                     7D
-#define HEX_DIGIT_01111110                                     7E
-#define HEX_DIGIT_01111111                                     7F
-#define HEX_DIGIT_10000000                                     80
-#define HEX_DIGIT_10000001                                     81
-#define HEX_DIGIT_10000010                                     82
-#define HEX_DIGIT_10000011                                     83
-#define HEX_DIGIT_10000100                                     84
-#define HEX_DIGIT_10000101                                     85
-#define HEX_DIGIT_10000110                                     86
-#define HEX_DIGIT_10000111                                     87
-#define HEX_DIGIT_10001000                                     88
-#define HEX_DIGIT_10001001                                     89
-#define HEX_DIGIT_10001010                                     8A
-#define HEX_DIGIT_10001011                                     8B
-#define HEX_DIGIT_10001100                                     8C
-#define HEX_DIGIT_10001101                                     8D
-#define HEX_DIGIT_10001110                                     8E
-#define HEX_DIGIT_10001111                                     8F
-#define HEX_DIGIT_10010000                                     90
-#define HEX_DIGIT_10010001                                     91
-#define HEX_DIGIT_10010010                                     92
-#define HEX_DIGIT_10010011                                     93
-#define HEX_DIGIT_10010100                                     94
-#define HEX_DIGIT_10010101                                     95
-#define HEX_DIGIT_10010110                                     96
-#define HEX_DIGIT_10010111                                     97
-#define HEX_DIGIT_10011000                                     98
-#define HEX_DIGIT_10011001                                     99
-#define HEX_DIGIT_10011010                                     9A
-#define HEX_DIGIT_10011011                                     9B
-#define HEX_DIGIT_10011100                                     9C
-#define HEX_DIGIT_10011101                                     9D
-#define HEX_DIGIT_10011110                                     9E
-#define HEX_DIGIT_10011111                                     9F
-#define HEX_DIGIT_10100000                                     A0
-#define HEX_DIGIT_10100001                                     A1
-#define HEX_DIGIT_10100010                                     A2
-#define HEX_DIGIT_10100011                                     A3
-#define HEX_DIGIT_10100100                                     A4
-#define HEX_DIGIT_10100101                                     A5
-#define HEX_DIGIT_10100110                                     A6
-#define HEX_DIGIT_10100111                                     A7
-#define HEX_DIGIT_10101000                                     A8
-#define HEX_DIGIT_10101001                                     A9
-#define HEX_DIGIT_10101010                                     AA
-#define HEX_DIGIT_10101011                                     AB
-#define HEX_DIGIT_10101100                                     AC
-#define HEX_DIGIT_10101101                                     AD
-#define HEX_DIGIT_10101110                                     AE
-#define HEX_DIGIT_10101111                                     AF
-#define HEX_DIGIT_10110000                                     B0
-#define HEX_DIGIT_10110001                                     B1
-#define HEX_DIGIT_10110010                                     B2
-#define HEX_DIGIT_10110011                                     B3
-#define HEX_DIGIT_10110100                                     B4
-#define HEX_DIGIT_10110101                                     B5
-#define HEX_DIGIT_10110110                                     B6
-#define HEX_DIGIT_10110111                                     B7
-#define HEX_DIGIT_10111000                                     B8
-#define HEX_DIGIT_10111001                                     B9
-#define HEX_DIGIT_10111010                                     BA
-#define HEX_DIGIT_10111011                                     BB
-#define HEX_DIGIT_10111100                                     BC
-#define HEX_DIGIT_10111101                                     BD
-#define HEX_DIGIT_10111110                                     BE
-#define HEX_DIGIT_10111111                                     BF
-#define HEX_DIGIT_11000000                                     C0
-#define HEX_DIGIT_11000001                                     C1
-#define HEX_DIGIT_11000010                                     C2
-#define HEX_DIGIT_11000011                                     C3
-#define HEX_DIGIT_11000100                                     C4
-#define HEX_DIGIT_11000101                                     C5
-#define HEX_DIGIT_11000110                                     C6
-#define HEX_DIGIT_11000111                                     C7
-#define HEX_DIGIT_11001000                                     C8
-#define HEX_DIGIT_11001001                                     C9
-#define HEX_DIGIT_11001010                                     CA
-#define HEX_DIGIT_11001011                                     CB
-#define HEX_DIGIT_11001100                                     CC
-#define HEX_DIGIT_11001101                                     CD
-#define HEX_DIGIT_11001110                                     CE
-#define HEX_DIGIT_11001111                                     CF
-#define HEX_DIGIT_11010000                                     D0
-#define HEX_DIGIT_11010001                                     D1
-#define HEX_DIGIT_11010010                                     D2
-#define HEX_DIGIT_11010011                                     D3
-#define HEX_DIGIT_11010100                                     D4
-#define HEX_DIGIT_11010101                                     D5
-#define HEX_DIGIT_11010110                                     D6
-#define HEX_DIGIT_11010111                                     D7
-#define HEX_DIGIT_11011000                                     D8
-#define HEX_DIGIT_11011001                                     D9
-#define HEX_DIGIT_11011010                                     DA
-#define HEX_DIGIT_11011011                                     DB
-#define HEX_DIGIT_11011100                                     DC
-#define HEX_DIGIT_11011101                                     DD
-#define HEX_DIGIT_11011110                                     DE
-#define HEX_DIGIT_11011111                                     DF
-#define HEX_DIGIT_11100000                                     E0
-#define HEX_DIGIT_11100001                                     E1
-#define HEX_DIGIT_11100010                                     E2
-#define HEX_DIGIT_11100011                                     E3
-#define HEX_DIGIT_11100100                                     E4
-#define HEX_DIGIT_11100101                                     E5
-#define HEX_DIGIT_11100110                                     E6
-#define HEX_DIGIT_11100111                                     E7
-#define HEX_DIGIT_11101000                                     E8
-#define HEX_DIGIT_11101001                                     E9
-#define HEX_DIGIT_11101010                                     EA
-#define HEX_DIGIT_11101011                                     EB
-#define HEX_DIGIT_11101100                                     EC
-#define HEX_DIGIT_11101101                                     ED
-#define HEX_DIGIT_11101110                                     EE
-#define HEX_DIGIT_11101111                                     EF
-#define HEX_DIGIT_11110000                                     F0
-#define HEX_DIGIT_11110001                                     F1
-#define HEX_DIGIT_11110010                                     F2
-#define HEX_DIGIT_11110011                                     F3
-#define HEX_DIGIT_11110100                                     F4
-#define HEX_DIGIT_11110101                                     F5
-#define HEX_DIGIT_11110110                                     F6
-#define HEX_DIGIT_11110111                                     F7
-#define HEX_DIGIT_11111000                                     F8
-#define HEX_DIGIT_11111001                                     F9
-#define HEX_DIGIT_11111010                                     FA
-#define HEX_DIGIT_11111011                                     FB
-#define HEX_DIGIT_11111100                                     FC
-#define HEX_DIGIT_11111101                                     FD
-#define HEX_DIGIT_11111110                                     FE
-#define HEX_DIGIT_11111111                                     FF
-
-#if 0
-#pragma mark == Debugging ==
-#endif
-
-//---------------------------------------------------------------------------------------------------------------------------
-/*!    @function       CommonServicesTest
-
-       @abstract       Unit test.
-*/
-
-#if( DEBUG )
-       #if( TARGET_LANGUAGE_C_LIKE )
-               OSStatus        CommonServicesTest( void );
-       #endif
-#endif
-
-#ifdef __cplusplus
-       }
-#endif
-
-#endif // __COMMON_SERVICES__
diff --git a/mDNSShared/DebugServices.c b/mDNSShared/DebugServices.c
deleted file mode 100644 (file)
index 164310a..0000000
+++ /dev/null
@@ -1,3102 +0,0 @@
-/* -*- Mode: C; tab-width: 4 -*-
- *
- * Copyright (c) 1997-2004 Apple Computer, Inc. All rights reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * 
- *     http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
-
-    Change History (most recent first):
-    
-$Log: DebugServices.c,v $
-Revision 1.6  2006/08/14 23:24:56  cheshire
-Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
-
-Revision 1.5  2004/09/17 01:08:57  cheshire
-Renamed mDNSClientAPI.h to mDNSEmbeddedAPI.h
-  The name "mDNSClientAPI.h" is misleading to new developers looking at this code. The interfaces
-  declared in that file are ONLY appropriate to single-address-space embedded applications.
-  For clients on general-purpose computers, the interfaces defined in dns_sd.h should be used.
-
-Revision 1.4  2004/04/15 08:59:08  bradley
-Removed deprecated debug and log levels and replaced them with modern equivalents.
-
-Revision 1.3  2004/04/08 09:29:55  bradley
-Manually do host->network byte order conversion to avoid needing libraries for htons/htonl. Changed
-hex dumps to better separate hex and ASCII. Added support for %.8a syntax in DebugSNPrintF for Fibre
-Channel addresses (00:11:22:33:44:55:66:77). Fixed a few places where HeaderDoc was incorrect.
-
-Revision 1.2  2004/03/07 05:59:34  bradley
-Sync'd with internal version: Added expect macros, error codes, and CoreServices exclusion.
-
-Revision 1.1  2004/01/30 02:27:30  bradley
-Debugging support for various platforms.
-
-
-       To Do:
-       
-       - Use StackWalk on Windows to optionally print stack frames.
-*/
-
-#if 0
-#pragma mark == Includes ==
-#endif
-
-//===========================================================================================================================
-//     Includes
-//===========================================================================================================================
-
-#if( !KERNEL )
-       #include        <ctype.h>
-       #include        <stdio.h>
-       #include        <string.h>
-#endif
-
-#include       "CommonServices.h"
-
-#include       "DebugServices.h"
-
-#if( DEBUG )
-
-#if( TARGET_OS_VXWORKS )
-       #include        "intLib.h"
-#endif
-
-#if( TARGET_OS_WIN32 )
-       #include        <time.h>
-       
-       #if( !TARGET_OS_WINDOWS_CE )
-               #include        <fcntl.h>
-               #include        <io.h>
-       #endif
-#endif
-
-#if( DEBUG_IDEBUG_ENABLED && TARGET_API_MAC_OSX_KERNEL )
-       #include        <IOKit/IOLib.h>
-#endif
-
-// If MDNS_DEBUGMSGS is defined (even if defined 0), it is aware of mDNS and it is probably safe to include mDNSEmbeddedAPI.h.
-
-#if( defined( MDNS_DEBUGMSGS ) )
-       #include        "mDNSEmbeddedAPI.h"
-#endif
-
-#if 0
-#pragma mark == Macros ==
-#endif
-
-//===========================================================================================================================
-//     Macros
-//===========================================================================================================================
-
-#define DebugIsPrint( C )              ( ( ( C ) >= 0x20 ) && ( ( C ) <= 0x7E ) )
-
-#if 0
-#pragma mark == Prototypes ==
-#endif
-
-//===========================================================================================================================
-//     Prototypes
-//===========================================================================================================================
-
-static OSStatus        DebugPrint( DebugLevel inLevel, char *inData, size_t inSize );
-
-// fprintf
-
-#if( DEBUG_FPRINTF_ENABLED )
-       static OSStatus DebugFPrintFInit( DebugOutputTypeFlags inFlags, const char *inFilename );
-       static void             DebugFPrintFPrint( char *inData, size_t inSize );
-#endif
-
-// iDebug (Mac OS X user and kernel)
-
-#if( DEBUG_IDEBUG_ENABLED )
-       static OSStatus DebugiDebugInit( void );
-       static void             DebugiDebugPrint( char *inData, size_t inSize );
-#endif
-
-// kprintf (Mac OS X Kernel)
-
-#if( DEBUG_KPRINTF_ENABLED )
-       static void     DebugKPrintFPrint( char *inData, size_t inSize );
-#endif
-
-// Mac OS X IOLog (Mac OS X Kernel)
-
-#if( DEBUG_MAC_OS_X_IOLOG_ENABLED )
-       static void     DebugMacOSXIOLogPrint( char *inData, size_t inSize );
-#endif
-
-// Mac OS X Log
-
-#if( TARGET_OS_MAC )
-       static OSStatus DebugMacOSXLogInit( void );
-       static void             DebugMacOSXLogPrint( char *inData, size_t inSize );
-#endif
-
-// Windows Debugger
-
-#if( TARGET_OS_WIN32 )
-       static void     DebugWindowsDebuggerPrint( char *inData, size_t inSize );
-#endif
-
-// Windows Event Log
-
-#if( TARGET_OS_WIN32 && !TARGET_OS_WINDOWS_CE )
-       static OSStatus DebugWindowsEventLogInit( const char *inName, HMODULE inModule );
-       static void     DebugWindowsEventLogPrint( DebugLevel inLevel, char *inData, size_t inSize );
-#endif
-
-// DebugLib support
-
-#if( DEBUG_CORE_SERVICE_ASSERTS_ENABLED )
-       static pascal void      
-               DebugAssertOutputHandler( 
-                       OSType                          inComponentSignature, 
-                       UInt32                          inOptions, 
-                       const char *            inAssertionString, 
-                       const char *            inExceptionString, 
-                       const char *            inErrorString, 
-                       const char *            inFileName, 
-                       long                            inLineNumber, 
-                       void *                          inValue, 
-                       ConstStr255Param        inOutputMsg );
-#endif
-
-// Utilities
-
-static char *  DebugNumVersionToString( uint32_t inVersion, char *inString );
-
-#if( TARGET_OS_WIN32 && !TARGET_OS_WINDOWS_CE )
-       static void     DebugWinEnableConsole( void );
-#endif
-
-#if( TARGET_OS_WIN32 )
-       static TCHAR *
-               DebugWinCharToTCharString( 
-                       const char *    inCharString, 
-                       size_t                  inCharCount, 
-                       TCHAR *                 outTCharString, 
-                       size_t                  inTCharCountMax, 
-                       size_t *                outTCharCount );
-#endif
-
-#if 0
-#pragma mark == Globals ==
-#endif
-
-//===========================================================================================================================
-//     Private Globals
-//===========================================================================================================================
-
-#if( TARGET_OS_VXWORKS )
-       // TCP States for inetstatShow.
-
-       extern char **  pTcpstates;             // defined in tcpLib.c
-
-       const char *            kDebugTCPStates[] =
-       {
-               "(0)  TCPS_CLOSED", 
-               "(1)  TCPS_LISTEN", 
-               "(2)  TCPS_SYN_SENT", 
-               "(3)  TCPS_SYN_RECEIVED", 
-               "(4)  TCPS_ESTABLISHED", 
-               "(5)  TCPS_CLOSE_WAIT", 
-               "(6)  TCPS_FIN_WAIT_1", 
-               "(7)  TCPS_CLOSING", 
-               "(8)  TCPS_LAST_ACK", 
-               "(9)  TCPS_FIN_WAIT_2", 
-               "(10) TCPS_TIME_WAIT",
-       };
-#endif
-
-// General
-
-static bool                                                                    gDebugInitialized                               = false;
-static DebugOutputType                                         gDebugOutputType                                = kDebugOutputTypeNone;
-static DebugLevel                                                      gDebugPrintLevelMin                             = kDebugLevelInfo;
-static DebugLevel                                                      gDebugPrintLevelMax                             = kDebugLevelMax;
-static DebugLevel                                                      gDebugBreakLevel                                = kDebugLevelAssert;
-#if( DEBUG_CORE_SERVICE_ASSERTS_ENABLED )
-       static DebugAssertOutputHandlerUPP              gDebugAssertOutputHandlerUPP    = NULL;
-#endif
-
-// Custom
-
-static DebugOutputFunctionPtr                          gDebugCustomOutputFunction              = NULL;
-static void *                                                          gDebugCustomOutputContext               = NULL;
-
-// fprintf
-
-#if( DEBUG_FPRINTF_ENABLED )
-       static FILE *                                                   gDebugFPrintFFile                               = NULL;
-#endif
-
-// MacOSXLog
-
-#if( TARGET_OS_MAC )
-       typedef int     ( *DebugMacOSXLogFunctionPtr )( const char *inFormat, ... );
-       
-       static DebugMacOSXLogFunctionPtr                gDebugMacOSXLogFunction                 = NULL;
-#endif
-
-// WindowsEventLog
-
-
-#if( TARGET_OS_WIN32 && !TARGET_OS_WINDOWS_CE )
-       static HANDLE                                                   gDebugWindowsEventLogEventSource = NULL;
-#endif
-
-#if 0
-#pragma mark -
-#pragma mark == General ==
-#endif
-
-//===========================================================================================================================
-//     DebugInitialize
-//===========================================================================================================================
-
-DEBUG_EXPORT OSStatus  DebugInitialize( DebugOutputType inType, ... )
-{
-       OSStatus                        err;
-       DebugOutputType         type;
-       va_list                         args;
-       
-       va_start( args, inType );
-
-#if( TARGET_OS_VXWORKS )
-       // Set up the TCP state strings if they are not already set up by VxWorks (normally not set up for some reason).
-       
-       if( !pTcpstates )
-       {
-               pTcpstates = (char **) kDebugTCPStates;
-       }
-#endif
-       
-       // Set up DebugLib stuff (if building with Debugging.h).
-       
-#if( DEBUG_CORE_SERVICE_ASSERTS_ENABLED )
-       if( !gDebugAssertOutputHandlerUPP )
-       {
-               gDebugAssertOutputHandlerUPP = NewDebugAssertOutputHandlerUPP( DebugAssertOutputHandler );
-               check( gDebugAssertOutputHandlerUPP );
-               if( gDebugAssertOutputHandlerUPP )
-               {
-                       InstallDebugAssertOutputHandler( gDebugAssertOutputHandlerUPP );
-               }
-       }
-#endif
-       
-       // Pre-process meta-output kind to pick an appropriate output kind for the platform.
-       
-       type = inType;
-       if( type == kDebugOutputTypeMetaConsole )
-       {
-               #if( TARGET_OS_MAC )
-                       type = kDebugOutputTypeMacOSXLog;
-               #elif( TARGET_OS_WIN32 && !TARGET_OS_WINDOWS_CE )
-                       #if( DEBUG_FPRINTF_ENABLED )
-                               type = kDebugOutputTypeFPrintF;
-                       #else
-                               type = kDebugOutputTypeWindowsDebugger;
-                       #endif
-               #elif( TARGET_API_MAC_OSX_KERNEL )
-                       #if( DEBUG_MAC_OS_X_IOLOG_ENABLED )
-                               type = kDebugOutputTypeMacOSXIOLog;
-                       #elif( DEBUG_IDEBUG_ENABLED )
-                               type = kDebugOutputTypeiDebug;
-                       #elif( DEBUG_KPRINTF_ENABLED )
-                               type = kDebugOutputTypeKPrintF;
-                       #endif
-               #elif( TARGET_OS_VXWORKS )
-                       #if( DEBUG_FPRINTF_ENABLED )
-                               type = kDebugOutputTypeFPrintF;
-                       #else
-                               #error target is VxWorks, but fprintf output is disabled
-                       #endif
-               #else
-                       #if( DEBUG_FPRINTF_ENABLED )
-                               type = kDebugOutputTypeFPrintF;
-                       #endif
-               #endif
-       }
-       
-       // Process output kind.
-       
-       gDebugOutputType = type;
-       switch( type )
-       {
-               case kDebugOutputTypeNone:
-                       err = kNoErr;
-                       break;
-
-               case kDebugOutputTypeCustom:
-                       gDebugCustomOutputFunction = va_arg( args, DebugOutputFunctionPtr );
-                       gDebugCustomOutputContext  = va_arg( args, void * );
-                       err = kNoErr;
-                       break;
-
-#if( DEBUG_FPRINTF_ENABLED )
-               case kDebugOutputTypeFPrintF:
-                       if( inType == kDebugOutputTypeMetaConsole )
-                       {
-                               err = DebugFPrintFInit( kDebugOutputTypeFlagsStdErr, NULL );
-                       }
-                       else
-                       {
-                               DebugOutputTypeFlags            flags;
-                               const char *                            filename;
-                               
-                               flags = (DebugOutputTypeFlags) va_arg( args, unsigned int );
-                               if( ( flags & kDebugOutputTypeFlagsTypeMask ) == kDebugOutputTypeFlagsFile )
-                               {
-                                       filename = va_arg( args, const char * );
-                               }
-                               else
-                               {
-                                       filename = NULL;
-                               }
-                               err = DebugFPrintFInit( flags, filename );
-                       }
-                       break;
-#endif
-
-#if( DEBUG_IDEBUG_ENABLED )
-               case kDebugOutputTypeiDebug:
-                       err = DebugiDebugInit();
-                       break;
-#endif
-
-#if( DEBUG_KPRINTF_ENABLED )
-               case kDebugOutputTypeKPrintF:
-                       err = kNoErr;
-                       break;
-#endif
-
-#if( DEBUG_MAC_OS_X_IOLOG_ENABLED )
-               case kDebugOutputTypeMacOSXIOLog:
-                       err = kNoErr;
-                       break;
-#endif
-
-#if( TARGET_OS_MAC )
-               case kDebugOutputTypeMacOSXLog:
-                       err = DebugMacOSXLogInit();
-                       break;
-#endif
-
-#if( TARGET_OS_WIN32 )
-               case kDebugOutputTypeWindowsDebugger:
-                       err = kNoErr;
-                       break;
-#endif
-
-#if( TARGET_OS_WIN32 && !TARGET_OS_WINDOWS_CE )
-               case kDebugOutputTypeWindowsEventLog:
-               {
-                       const char *            name;
-                       HMODULE                         module;
-                       
-                       name   = va_arg( args, const char * );
-                       module = va_arg( args, HMODULE );
-                       err = DebugWindowsEventLogInit( name, module );
-               }
-               break;
-#endif
-
-               default:
-                       err = kParamErr;
-                       goto exit;
-       }
-       gDebugInitialized = true;
-       
-exit:
-       va_end( args );
-       return( err );
-}
-
-//===========================================================================================================================
-//     DebugFinalize
-//===========================================================================================================================
-
-DEBUG_EXPORT void              DebugFinalize( void )
-{
-#if( DEBUG_CORE_SERVICE_ASSERTS_ENABLED )
-       check( gDebugAssertOutputHandlerUPP );
-       if( gDebugAssertOutputHandlerUPP )
-       {
-               InstallDebugAssertOutputHandler( NULL );
-               DisposeDebugAssertOutputHandlerUPP( gDebugAssertOutputHandlerUPP );
-               gDebugAssertOutputHandlerUPP = NULL;
-       }
-#endif
-}
-
-//===========================================================================================================================
-//     DebugGetProperty
-//===========================================================================================================================
-
-DEBUG_EXPORT OSStatus  DebugGetProperty( DebugPropertyTag inTag, ... )
-{
-       OSStatus                        err;
-       va_list                         args;
-       DebugLevel *            level;
-       
-       va_start( args, inTag );
-       switch( inTag )
-       {
-               case kDebugPropertyTagPrintLevelMin:
-                       level  = va_arg( args, DebugLevel * );
-                       *level = gDebugPrintLevelMin;
-                       err = kNoErr;
-                       break;
-               
-               case kDebugPropertyTagPrintLevelMax:
-                       level  = va_arg( args, DebugLevel * );
-                       *level = gDebugPrintLevelMax;
-                       err = kNoErr;
-                       break;
-               
-               case kDebugPropertyTagBreakLevel:
-                       level  = va_arg( args, DebugLevel * );
-                       *level = gDebugBreakLevel;
-                       err = kNoErr;
-                       break;          
-               
-               default:
-                       err = kUnsupportedErr;
-                       break;
-       }
-       va_end( args );
-       return( err );
-}
-
-//===========================================================================================================================
-//     DebugSetProperty
-//===========================================================================================================================
-
-DEBUG_EXPORT OSStatus  DebugSetProperty( DebugPropertyTag inTag, ... )
-{
-       OSStatus                err;
-       va_list                 args;
-       DebugLevel              level;
-       
-       va_start( args, inTag );
-       switch( inTag )
-       {
-               case kDebugPropertyTagPrintLevelMin:
-                       level  = va_arg( args, DebugLevel );
-                       gDebugPrintLevelMin = level;
-                       err = kNoErr;
-                       break;
-               
-               case kDebugPropertyTagPrintLevelMax:
-                       level  = va_arg( args, DebugLevel );
-                       gDebugPrintLevelMax = level;
-                       err = kNoErr;
-                       break;
-               
-               case kDebugPropertyTagBreakLevel:
-                       level  = va_arg( args, DebugLevel );
-                       gDebugBreakLevel = level;
-                       err = kNoErr;
-                       break;          
-               
-               default:
-                       err = kUnsupportedErr;
-                       break;
-       }
-       va_end( args );
-       return( err );
-}
-
-#if 0
-#pragma mark -
-#pragma mark == Output ==
-#endif
-
-//===========================================================================================================================
-//     DebugPrintF
-//===========================================================================================================================
-
-DEBUG_EXPORT size_t    DebugPrintF( DebugLevel inLevel, const char *inFormat, ... )
-{      
-       va_list         args;
-       size_t          n;
-       
-       // Skip if the level is not in the enabled range..
-       
-       if( ( inLevel < gDebugPrintLevelMin ) || ( inLevel > gDebugPrintLevelMax ) )
-       {
-               n = 0;
-               goto exit;
-       }
-       
-       va_start( args, inFormat );
-       n = DebugPrintFVAList( inLevel, inFormat, args );
-       va_end( args );
-
-exit:
-       return( n );
-}
-
-//===========================================================================================================================
-//     DebugPrintFVAList
-//===========================================================================================================================
-
-DEBUG_EXPORT size_t    DebugPrintFVAList( DebugLevel inLevel, const char *inFormat, va_list inArgs )
-{
-       size_t          n;
-       char            buffer[ 512 ];
-       
-       // Skip if the level is not in the enabled range..
-       
-       if( ( inLevel < gDebugPrintLevelMin ) || ( inLevel > gDebugPrintLevelMax ) )
-       {
-               n = 0;
-               goto exit;
-       }
-       
-       n = DebugSNPrintFVAList( buffer, sizeof( buffer ), inFormat, inArgs );
-       DebugPrint( inLevel, buffer, (size_t) n );
-
-exit:
-       return( n );
-}
-
-//===========================================================================================================================
-//     DebugPrint
-//===========================================================================================================================
-
-static OSStatus        DebugPrint( DebugLevel inLevel, char *inData, size_t inSize )
-{
-       OSStatus                err;
-       
-       // Skip if the level is not in the enabled range..
-       
-       if( ( inLevel < gDebugPrintLevelMin ) || ( inLevel > gDebugPrintLevelMax ) )
-       {
-               err = kRangeErr;
-               goto exit;
-       }
-       
-       // Printing is not safe at interrupt time so check for this and warn with an interrupt safe mechanism (if available).
-       
-       if( DebugTaskLevel() & kDebugInterruptLevelMask )
-       {
-               #if( TARGET_OS_VXWORKS )
-                       logMsg( "\ncannot print at interrupt time\n\n", 1, 2, 3, 4, 5, 6 );
-               #endif
-               
-               err = kExecutionStateErr;
-               goto exit;
-       }
-       
-       // Initialize the debugging library if it hasn't already been initialized (allows for zero-config usage).
-       
-       if( !gDebugInitialized )
-       {
-               debug_initialize( kDebugOutputTypeMetaConsole );
-       }
-       
-       // Print based on the current output type.
-       
-       switch( gDebugOutputType )
-       {
-               case kDebugOutputTypeNone:
-                       break;
-               
-               case kDebugOutputTypeCustom:
-                       if( gDebugCustomOutputFunction )
-                       {
-                               gDebugCustomOutputFunction( inData, inSize, gDebugCustomOutputContext );
-                       }
-                       break;
-
-#if( DEBUG_FPRINTF_ENABLED )
-               case kDebugOutputTypeFPrintF:
-                       DebugFPrintFPrint( inData, inSize );
-                       break;
-#endif
-
-#if( DEBUG_IDEBUG_ENABLED )
-               case kDebugOutputTypeiDebug:
-                       DebugiDebugPrint( inData, inSize );
-                       break;
-#endif
-
-#if( DEBUG_KPRINTF_ENABLED )
-               case kDebugOutputTypeKPrintF:
-                       DebugKPrintFPrint( inData, inSize );
-                       break;
-#endif
-
-#if( DEBUG_MAC_OS_X_IOLOG_ENABLED )
-               case kDebugOutputTypeMacOSXIOLog:
-                       DebugMacOSXIOLogPrint( inData, inSize );
-                       break;
-#endif
-
-#if( TARGET_OS_MAC )
-               case kDebugOutputTypeMacOSXLog:
-                       DebugMacOSXLogPrint( inData, inSize );
-                       break;
-#endif
-
-#if( TARGET_OS_WIN32 )
-               case kDebugOutputTypeWindowsDebugger:
-                       DebugWindowsDebuggerPrint( inData, inSize );
-                       break;
-#endif
-
-#if( TARGET_OS_WIN32 && !TARGET_OS_WINDOWS_CE )
-               case kDebugOutputTypeWindowsEventLog:
-                       DebugWindowsEventLogPrint( inLevel, inData, inSize );
-                       break;
-#endif
-
-               default:
-                       break;
-       }
-       err = kNoErr;
-       
-exit:
-       return( err );
-}
-
-//===========================================================================================================================
-//     DebugPrintAssert
-//
-//     Warning: This routine relies on several of the strings being string constants that will exist forever because the
-//           underlying logMsg API that does the printing is asynchronous so it cannot use temporary/stack-based 
-//           pointer variables (e.g. local strings). The debug macros that invoke this function only use constant 
-//           constant strings, but if this function is invoked directly from other places, it must use constant strings.
-//===========================================================================================================================
-
-DEBUG_EXPORT void
-       DebugPrintAssert( 
-               int_least32_t   inErrorCode, 
-               const char *    inAssertString, 
-               const char *    inMessage, 
-               const char *    inFilename, 
-               int_least32_t   inLineNumber, 
-               const char *    inFunction )
-{
-       // Skip if the level is not in the enabled range..
-       
-       if( ( kDebugLevelAssert < gDebugPrintLevelMin ) || ( kDebugLevelAssert > gDebugPrintLevelMax ) )
-       {
-               return;
-       }
-       
-       if( inErrorCode != 0 )
-       {
-               DebugPrintF( 
-                       kDebugLevelAssert, 
-                       "\n"
-                       "[ASSERT] error:  %ld (%m)\n"
-                       "[ASSERT] where:  \"%s\", line %ld, \"%s\"\n"
-                       "\n", 
-                       inErrorCode, inErrorCode, 
-                       inFilename ? inFilename : "", 
-                       inLineNumber, 
-                       inFunction ? inFunction : "" );
-       }
-       else
-       {
-               DebugPrintF( 
-                       kDebugLevelAssert, 
-                       "\n"
-                       "[ASSERT] assert: \"%s\" %s\n"
-                       "[ASSERT] where:  \"%s\", line %ld, \"%s\"\n"
-                       "\n", 
-                       inAssertString ? inAssertString : "", 
-                       inMessage ? inMessage : "", 
-                       inFilename ? inFilename : "", 
-                       inLineNumber, 
-                       inFunction ? inFunction : "" );
-       }
-       
-       // Break into the debugger if enabled.
-       
-       #if( TARGET_OS_WIN32 )
-               if( gDebugBreakLevel <= kDebugLevelAssert )
-               {
-                       if( IsDebuggerPresent() )
-                       {
-                               DebugBreak();
-                       }
-               }
-       #endif
-}
-
-#if 0
-#pragma mark -
-#endif
-
-#if( DEBUG_FPRINTF_ENABLED )
-//===========================================================================================================================
-//     DebugFPrintFInit
-//===========================================================================================================================
-
-static OSStatus        DebugFPrintFInit( DebugOutputTypeFlags inFlags, const char *inFilename )
-{
-       OSStatus                                        err;
-       DebugOutputTypeFlags            typeFlags;
-       
-       typeFlags = inFlags & kDebugOutputTypeFlagsTypeMask;
-       if( typeFlags == kDebugOutputTypeFlagsStdOut )
-       {
-               #if( TARGET_OS_WIN32 )
-                       DebugWinEnableConsole();
-               #endif
-
-               gDebugFPrintFFile = stdout;
-       }
-       else if( typeFlags == kDebugOutputTypeFlagsStdErr )
-       {
-               #if( TARGET_OS_WIN32 )
-                       DebugWinEnableConsole();
-               #endif
-               
-               gDebugFPrintFFile = stdout;
-       }
-       else if( typeFlags == kDebugOutputTypeFlagsFile )
-       {
-               require_action_quiet( inFilename && ( *inFilename != '\0' ), exit, err = kOpenErr );
-               
-               gDebugFPrintFFile = fopen( inFilename, "a" );
-               require_action_quiet( gDebugFPrintFFile, exit, err = kOpenErr );
-       }
-       else
-       {
-               err = kParamErr;
-               goto exit;
-       }
-       err = kNoErr;
-       
-exit:
-       return( err );
-}
-
-//===========================================================================================================================
-//     DebugFPrintFPrint
-//===========================================================================================================================
-
-static void    DebugFPrintFPrint( char *inData, size_t inSize )
-{
-       char *          p;
-       char *          q;
-       
-       // Convert \r to \n. fprintf will interpret \n and convert to whatever is appropriate for the platform.
-       
-       p = inData;
-       q = p + inSize;
-       while( p < q )
-       {
-               if( *p == '\r' )
-               {
-                       *p = '\n';
-               }
-               ++p;
-       }
-       
-       // Write the data and flush.
-       
-       if( gDebugFPrintFFile )
-       {
-               fprintf( gDebugFPrintFFile, "%.*s", (int) inSize, inData );
-               fflush( gDebugFPrintFFile );
-       }
-}
-#endif // DEBUG_FPRINTF_ENABLED
-
-#if( DEBUG_IDEBUG_ENABLED )
-//===========================================================================================================================
-//     DebugiDebugInit
-//===========================================================================================================================
-
-static OSStatus        DebugiDebugInit( void )
-{
-       OSStatus                err;
-       
-       #if( TARGET_API_MAC_OSX_KERNEL )
-               
-               extern uint32_t *               _giDebugReserved1;
-               
-               // Emulate the iDebugSetOutputType macro in iDebugServices.h.
-               // Note: This is not thread safe, but neither is iDebugServices.h nor iDebugKext.
-               
-               if( !_giDebugReserved1 )
-               {
-                       _giDebugReserved1 = (uint32_t *) IOMalloc( sizeof( uint32_t ) );
-                       require_action_quiet( _giDebugReserved1, exit, err = kNoMemoryErr );
-               }
-               *_giDebugReserved1 = 0x00010000U;
-               err = kNoErr;
-exit:
-       #else
-               
-               __private_extern__ void iDebugSetOutputTypeInternal( uint32_t inType );
-               
-               iDebugSetOutputTypeInternal( 0x00010000U );
-               err = kNoErr;
-               
-       #endif
-       
-       return( err );
-}
-
-//===========================================================================================================================
-//     DebugiDebugPrint
-//===========================================================================================================================
-
-static void    DebugiDebugPrint( char *inData, size_t inSize )
-{
-       #if( TARGET_API_MAC_OSX_KERNEL )
-               
-               // Locally declared here so we do not need to include iDebugKext.h.
-               // Note: IOKit uses a global namespace for all code and only a partial link occurs at build time. When the 
-               // KEXT is loaded, the runtime linker will link in this extern'd symbol (assuming iDebug is present).
-               // _giDebugLogInternal is actually part of IOKit proper so this should link even if iDebug is not present.
-               
-               typedef void ( *iDebugLogFunctionPtr )( uint32_t inLevel, uint32_t inTag, const char *inFormat, ... );
-               
-               extern iDebugLogFunctionPtr             _giDebugLogInternal;
-               
-               if( _giDebugLogInternal )
-               {
-                       _giDebugLogInternal( 0, 0, "%.*s", (int) inSize, inData );
-               }
-               
-       #else
-       
-               __private_extern__ void iDebugLogInternal( uint32_t inLevel, uint32_t inTag, const char *inFormat, ... );
-               
-               iDebugLogInternal( 0, 0, "%.*s", (int) inSize, inData );
-       
-       #endif
-}
-#endif
-
-#if( DEBUG_KPRINTF_ENABLED )
-//===========================================================================================================================
-//     DebugKPrintFPrint
-//===========================================================================================================================
-
-static void    DebugKPrintFPrint( char *inData, size_t inSize )
-{
-       extern void     kprintf( const char *inFormat, ... );
-       
-       kprintf( "%.*s", (int) inSize, inData );
-}
-#endif
-
-#if( DEBUG_MAC_OS_X_IOLOG_ENABLED )
-//===========================================================================================================================
-//     DebugMacOSXIOLogPrint
-//===========================================================================================================================
-
-static void    DebugMacOSXIOLogPrint( char *inData, size_t inSize )
-{
-       extern void     IOLog( const char *inFormat, ... );
-       
-       IOLog( "%.*s", (int) inSize, inData );
-}
-#endif
-
-#if( TARGET_OS_MAC )
-//===========================================================================================================================
-//     DebugMacOSXLogInit
-//===========================================================================================================================
-
-static OSStatus        DebugMacOSXLogInit( void )
-{
-       OSStatus                err;
-       CFStringRef             path;
-       CFURLRef                url;
-       CFBundleRef             bundle;
-       CFStringRef             functionName;
-       void *                  functionPtr;
-       
-       bundle = NULL;
-       
-       // Create a bundle reference for System.framework.
-       
-       path = CFSTR( "/System/Library/Frameworks/System.framework" );
-       url = CFURLCreateWithFileSystemPath( NULL, path, kCFURLPOSIXPathStyle, true );
-       require_action_quiet( url, exit, err = memFullErr );
-       
-       bundle = CFBundleCreate( NULL, url );
-       CFRelease( url );
-       require_action_quiet( bundle, exit, err = memFullErr );
-       
-       // Get a ptr to the system's "printf" function from System.framework.
-       
-       functionName = CFSTR( "printf" );
-       functionPtr = CFBundleGetFunctionPointerForName( bundle, functionName );
-       require_action_quiet( functionPtr, exit, err = memFullErr );    
-       
-       // Success! Note: The bundle cannot be released because it would invalidate the function ptr.
-       
-       gDebugMacOSXLogFunction = (DebugMacOSXLogFunctionPtr) functionPtr;
-       bundle = NULL;
-       err = noErr;
-       
-exit:
-       if( bundle )
-       {
-               CFRelease( bundle );
-       }
-       return( err );
-}
-
-//===========================================================================================================================
-//     DebugMacOSXLogPrint
-//===========================================================================================================================
-
-static void    DebugMacOSXLogPrint( char *inData, size_t inSize )
-{      
-       if( gDebugMacOSXLogFunction )
-       {
-               gDebugMacOSXLogFunction( "%.*s", (int) inSize, inData );
-       }
-}
-#endif
-
-#if( TARGET_OS_WIN32 )
-//===========================================================================================================================
-//     DebugWindowsDebuggerPrint
-//===========================================================================================================================
-
-void   DebugWindowsDebuggerPrint( char *inData, size_t inSize )
-{
-       TCHAR                           buffer[ 512 ];
-       const char *            src;
-       const char *            end;
-       TCHAR *                         dst;
-       char                            c;
-       
-       // Copy locally and null terminate the string. This also converts from char to TCHAR in case we are 
-       // building with UNICODE enabled since the input is always char. Also convert \r to \n in the process.
-
-       src = inData;
-       if( inSize >= sizeof_array( buffer ) )
-       {
-               inSize = sizeof_array( buffer ) - 1;
-       }
-       end = src + inSize;
-       dst = buffer;   
-       while( src < end )
-       {
-               c = *src++;
-               if( c == '\r' )
-               {
-                       c = '\n';
-               }
-               *dst++ = (TCHAR) c;
-       }
-       *dst = 0;
-       
-       // Print out the string to the debugger.
-       
-       OutputDebugString( buffer );
-}
-#endif
-
-#if( TARGET_OS_WIN32 && !TARGET_OS_WINDOWS_CE )
-//===========================================================================================================================
-//     DebugWindowsEventLogInit
-//===========================================================================================================================
-
-static OSStatus        DebugWindowsEventLogInit( const char *inName, HMODULE inModule )
-{
-       OSStatus                        err;
-       HKEY                            key;
-       TCHAR                           name[ 128 ];
-       const char *            src;
-       TCHAR                           path[ MAX_PATH ];
-       size_t                          size;
-       DWORD                           typesSupported;
-       DWORD                           n;
-       
-       key = NULL;
-
-       // Use a default name if needed then convert the name to TCHARs so it works on ANSI or Unicode builds.
-
-       if( !inName || ( *inName == '\0' ) )
-       {
-               inName = "DefaultApp";
-       }
-       DebugWinCharToTCharString( inName, kSizeCString, name, sizeof( name ), NULL );
-       
-       // Build the path string using the fixed registry path and app name.
-       
-       src = "SYSTEM\\CurrentControlSet\\Services\\EventLog\\Application\\";
-       DebugWinCharToTCharString( src, kSizeCString, path, sizeof_array( path ), &size );
-       DebugWinCharToTCharString( inName, kSizeCString, path + size, sizeof_array( path ) - size, NULL );
-       
-       // Add/Open the source name as a sub-key under the Application key in the EventLog registry key.
-       
-       err = RegCreateKeyEx( HKEY_LOCAL_MACHINE, path, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &key, NULL );
-       require_noerr_quiet( err, exit );
-       
-       // Set the path in the EventMessageFile subkey. Add 1 to the TCHAR count to include the null terminator.
-       
-       n = GetModuleFileName( inModule, path, sizeof_array( path ) );
-       err = translate_errno( n > 0, (OSStatus) GetLastError(), kParamErr );
-       require_noerr_quiet( err, exit );
-       n += 1;
-       n *= sizeof( TCHAR );
-       
-       err = RegSetValueEx( key, TEXT( "EventMessageFile" ), 0, REG_EXPAND_SZ, (const LPBYTE) path, n );
-       require_noerr_quiet( err, exit );
-       
-       // Set the supported event types in the TypesSupported subkey.
-       
-       typesSupported = EVENTLOG_SUCCESS | EVENTLOG_ERROR_TYPE | EVENTLOG_WARNING_TYPE | EVENTLOG_INFORMATION_TYPE |
-                                        EVENTLOG_AUDIT_SUCCESS | EVENTLOG_AUDIT_FAILURE;
-       err = RegSetValueEx( key, TEXT( "TypesSupported" ), 0, REG_DWORD, (const LPBYTE) &typesSupported, sizeof( DWORD ) );
-       require_noerr_quiet( err, exit );
-       
-       // Set up the event source.
-       
-       gDebugWindowsEventLogEventSource = RegisterEventSource( NULL, name );
-       err = translate_errno( gDebugWindowsEventLogEventSource, (OSStatus) GetLastError(), kParamErr );
-       require_noerr_quiet( err, exit );
-       
-exit:
-       if( key )
-       {
-               RegCloseKey( key );
-       }
-       return( err );
-}
-
-//===========================================================================================================================
-//     DebugWindowsEventLogPrint
-//===========================================================================================================================
-
-static void    DebugWindowsEventLogPrint( DebugLevel inLevel, char *inData, size_t inSize )
-{
-       WORD                            type;
-       TCHAR                           buffer[ 512 ];
-       const char *            src;
-       const char *            end;
-       TCHAR *                         dst;
-       char                            c;
-       const TCHAR *           array[ 1 ];
-       
-       // Map the debug level to a Windows EventLog type.
-       
-       if( inLevel <= kDebugLevelNotice )
-       {
-               type = EVENTLOG_INFORMATION_TYPE;
-       }
-       else if( inLevel <= kDebugLevelWarning )
-       {
-               type = EVENTLOG_WARNING_TYPE;
-       }
-       else
-       {
-               type = EVENTLOG_ERROR_TYPE;
-       }
-       
-       // Copy locally and null terminate the string. This also converts from char to TCHAR in case we are 
-       // building with UNICODE enabled since the input is always char. Also convert \r to \n in the process.
-       
-       src = inData;
-       if( inSize >= sizeof_array( buffer ) )
-       {
-               inSize = sizeof_array( buffer ) - 1;
-       }
-       end = src + inSize;
-       dst = buffer;   
-       while( src < end )
-       {
-               c = *src++;
-               if( c == '\r' )
-               {
-                       c = '\n';
-               }
-               *dst++ = (TCHAR) c;
-       }
-       *dst = 0;
-       
-       // Add the the string to the event log.
-       
-       array[ 0 ] = buffer;
-       if( gDebugWindowsEventLogEventSource )
-       {
-               ReportEvent( gDebugWindowsEventLogEventSource, type, 0, 0x20000001L, NULL, 1, 0, array, NULL );
-       }
-}
-#endif // TARGET_OS_WIN32 && !TARGET_OS_WINDOWS_CE
-
-#if( DEBUG_CORE_SERVICE_ASSERTS_ENABLED )
-//===========================================================================================================================
-//     DebugAssertOutputHandler
-//===========================================================================================================================
-
-static pascal void     
-       DebugAssertOutputHandler( 
-               OSType                          inComponentSignature, 
-               UInt32                          inOptions, 
-               const char *            inAssertString, 
-               const char *            inExceptionString, 
-               const char *            inErrorString, 
-               const char *            inFileName, 
-               long                            inLineNumber, 
-               void *                          inValue, 
-               ConstStr255Param        inOutputMsg )
-{
-       DEBUG_UNUSED( inComponentSignature );
-       DEBUG_UNUSED( inOptions );
-       DEBUG_UNUSED( inExceptionString );
-       DEBUG_UNUSED( inValue );
-       DEBUG_UNUSED( inOutputMsg );
-       
-       DebugPrintAssert( 0, inAssertString, inErrorString, inFileName, (int_least32_t) inLineNumber, "" );
-}
-#endif
-
-#if 0
-#pragma mark -
-#pragma mark == Utilities ==
-#endif
-
-//===========================================================================================================================
-//     DebugSNPrintF
-//
-//     Stolen from mDNS.c's mDNS_snprintf/mDNS_vsnprintf with the following changes:
-//
-//     Changed names to avoid name collisions with the mDNS versions.
-//     Changed types to standard C types since mDNSEmbeddedAPI.h may not be available.
-//     Conditionalized mDNS stuff so it can be used with or with mDNSEmbeddedAPI.h.
-//     Added 64-bit support for %d (%lld), %i (%lli), %u (%llu), %o (%llo), %x (%llx), and %b (%llb).
-//     Added %@   - Cocoa/CoreFoundation object. Param is the object. Strings are used directly. Others use CFCopyDescription.
-//     Added %.8a - FIbre Channel address. Arg=ptr to address.
-//     Added %##a - IPv4 (if AF_INET defined) or IPv6 (if AF_INET6 defined) sockaddr. Arg=ptr to sockaddr.
-//     Added %b   - Binary representation of integer (e.g. 01101011). Modifiers and arg=the same as %d, %x, etc.
-//     Added %C   - Mac-style FourCharCode (e.g. 'APPL'). Arg=32-bit value to print as a Mac-style FourCharCode.
-//     Added %H   - Hex Dump (e.g. "\x6b\xa7" -> "6B A7"). 1st arg=ptr, 2nd arg=size, 3rd arg=max size.
-//     Added %#H  - Hex Dump & ASCII (e.g. "\x41\x62" -> "6B A7 'Ab'"). 1st arg=ptr, 2nd arg=size, 3rd arg=max size.
-//     Added %m   - Error Message (e.g. 0 -> "kNoErr"). Modifiers and error code args are the same as %d, %x, etc.
-//     Added %S   - UTF-16 string. Host order if no BOM. Precision is UTF-16 char count. BOM counts in any precision. Arg=ptr.
-//     Added %#S  - Big Endian UTF-16 string (unless BOM overrides). Otherwise the same as %S.
-//     Added %##S - Little Endian UTF-16 string (unless BOM overrides). Otherwise the same as %S.
-//     Added %U   - Universally Unique Identifier (UUID) (e.g. 6ba7b810-9dad-11d1-80b4-00c04fd430c8). Arg=ptr to 16-byte UUID.
-//===========================================================================================================================
-
-DEBUG_EXPORT size_t DebugSNPrintF(char *sbuffer, size_t buflen, const char *fmt, ...)
-       {
-       size_t length;
-       
-       va_list ptr;
-       va_start(ptr,fmt);
-       length = DebugSNPrintFVAList(sbuffer, buflen, fmt, ptr);
-       va_end(ptr);
-       
-       return(length);
-       }
-
-//===========================================================================================================================
-//     DebugSNPrintFVAList     - va_list version of DebugSNPrintF. See DebugSNPrintF for more info.
-//===========================================================================================================================
-
-DEBUG_EXPORT size_t DebugSNPrintFVAList(char *sbuffer, size_t buflen, const char *fmt, va_list arg)
-       {
-       static const struct DebugSNPrintF_format
-               {
-               unsigned      leftJustify : 1;
-               unsigned      forceSign : 1;
-               unsigned      zeroPad : 1;
-               unsigned      havePrecision : 1;
-               unsigned      hSize : 1;
-               char          lSize;
-               char          altForm;
-               char          sign;             // +, - or space
-               unsigned int  fieldWidth;
-               unsigned int  precision;
-               } DebugSNPrintF_format_default = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
-
-       size_t nwritten = 0;
-       int c;
-       if (buflen == 0) return(0);
-       buflen--;               // Pre-reserve one space in the buffer for the terminating nul
-       if (buflen == 0) goto exit;
-       
-       for (c = *fmt; c != 0; c = *++fmt)
-               {
-               if (c != '%')
-                       {
-                       *sbuffer++ = (char)c;
-                       if (++nwritten >= buflen) goto exit;
-                       }
-               else
-                       {
-                       size_t i=0, j;
-                       // The mDNS Vsprintf Argument Conversion Buffer is used as a temporary holding area for
-                       // generating decimal numbers, hexdecimal numbers, IP addresses, domain name strings, etc.
-                       // The size needs to be enough for a 256-byte domain name plus some error text.
-                       #define mDNS_VACB_Size 300
-                       char mDNS_VACB[mDNS_VACB_Size];
-                       #define mDNS_VACB_Lim (&mDNS_VACB[mDNS_VACB_Size])
-                       #define mDNS_VACB_Remain(s) ((size_t)(mDNS_VACB_Lim - s))
-                       char *s = mDNS_VACB_Lim;
-                       const char *digits = "0123456789ABCDEF";
-                       struct DebugSNPrintF_format F = DebugSNPrintF_format_default;
-       
-                       for(;;) //  decode flags
-                               {
-                               c = *++fmt;
-                               if      (c == '-') F.leftJustify = 1;
-                               else if (c == '+') F.forceSign = 1;
-                               else if (c == ' ') F.sign = ' ';
-                               else if (c == '#') F.altForm++;
-                               else if (c == '0') F.zeroPad = 1;
-                               else break;
-                               }
-       
-                       if (c == '*')   //  decode field width
-                               {
-                               int f = va_arg(arg, int);
-                               if (f < 0) { f = -f; F.leftJustify = 1; }
-                               F.fieldWidth = (unsigned int)f;
-                               c = *++fmt;
-                               }
-                       else
-                               {
-                               for (; c >= '0' && c <= '9'; c = *++fmt)
-                                       F.fieldWidth = (10 * F.fieldWidth) + (c - '0');
-                               }
-       
-                       if (c == '.')   //  decode precision
-                               {
-                               if ((c = *++fmt) == '*')
-                                       { F.precision = va_arg(arg, unsigned int); c = *++fmt; }
-                               else for (; c >= '0' && c <= '9'; c = *++fmt)
-                                               F.precision = (10 * F.precision) + (c - '0');
-                               F.havePrecision = 1;
-                               }
-       
-                       if (F.leftJustify) F.zeroPad = 0;
-       
-                       conv:
-                       switch (c)      //  perform appropriate conversion
-                               {
-                               #if TYPE_LONGLONG_NATIVE
-                                       unsigned_long_long_compat n;
-                                       unsigned_long_long_compat base;
-                               #else
-                                       unsigned long n;
-                                       unsigned long base;
-                               #endif
-                               case 'h' :      F.hSize = 1; c = *++fmt; goto conv;
-                               case 'l' :      // fall through
-                               case 'L' :      F.lSize++; c = *++fmt; goto conv;
-                               case 'd' :
-                               case 'i' :      base = 10;
-                                                       goto canBeSigned;
-                               case 'u' :      base = 10;
-                                                       goto notSigned;
-                               case 'o' :      base = 8;
-                                                       goto notSigned;
-                               case 'b' :      base = 2;
-                                                       goto notSigned;
-                               case 'p' :      n = va_arg(arg, uintptr_t);
-                                                       F.havePrecision = 1;
-                                                       F.precision = (sizeof(uintptr_t) == 4) ? 8 : 16;
-                                                       F.sign = 0;
-                                                       base = 16;
-                                                       c = 'x';
-                                                       goto number;
-                               case 'x' :      digits = "0123456789abcdef";
-                               case 'X' :      base = 16;
-                                                       goto notSigned;
-                               canBeSigned:
-                                                       #if TYPE_LONGLONG_NATIVE
-                                                               if (F.lSize == 1) n = (unsigned_long_long_compat)va_arg(arg, long);
-                                                               else if (F.lSize == 2) n = (unsigned_long_long_compat)va_arg(arg, long_long_compat);
-                                                               else n = (unsigned_long_long_compat)va_arg(arg, int);
-                                                       #else
-                                                               if (F.lSize == 1) n = (unsigned long)va_arg(arg, long);
-                                                               else if (F.lSize == 2) goto exit;
-                                                               else n = (unsigned long)va_arg(arg, int);
-                                                       #endif
-                                                       if (F.hSize) n = (short) n;
-                                                       #if TYPE_LONGLONG_NATIVE
-                                                               if ((long_long_compat) n < 0) { n = (unsigned_long_long_compat)-(long_long_compat)n; F.sign = '-'; }
-                                                       #else
-                                                               if ((long) n < 0) { n = (unsigned long)-(long)n; F.sign = '-'; }
-                                                       #endif
-                                                       else if (F.forceSign) F.sign = '+';
-                                                       goto number;
-                               
-                               notSigned:      if (F.lSize == 1) n = va_arg(arg, unsigned long);
-                                                       else if (F.lSize == 2)
-                                                               {
-                                                               #if TYPE_LONGLONG_NATIVE
-                                                                       n = va_arg(arg, unsigned_long_long_compat);
-                                                               #else
-                                                                       goto exit;
-                                                               #endif
-                                                               }
-                                                       else n = va_arg(arg, unsigned int);
-                                                       if (F.hSize) n = (unsigned short) n;
-                                                       F.sign = 0;
-                                                       goto number;
-                               
-                               number:         if (!F.havePrecision)
-                                                               {
-                                                               if (F.zeroPad)
-                                                                       {
-                                                                       F.precision = F.fieldWidth;
-                                                                       if (F.altForm) F.precision -= 2;
-                                                                       if (F.sign) --F.precision;
-                                                                       }
-                                                               if (F.precision < 1) F.precision = 1;
-                                                               }
-                                                       if (F.precision > mDNS_VACB_Size - 1)
-                                                               F.precision = mDNS_VACB_Size - 1;
-                                                       for (i = 0; n; n /= base, i++) *--s = (char)(digits[n % base]);
-                                                       for (; i < F.precision; i++) *--s = '0';
-                                                       if (F.altForm) { *--s = (char)c; *--s = '0'; i += 2; }
-                                                       if (F.sign) { *--s = F.sign; i++; }
-                                                       break;
-       
-                               case 'a' :      {
-                                                       unsigned char *a = va_arg(arg, unsigned char *);
-                                                       char pre[4] = "";
-                                                       char post[32] = "";
-                                                       if (!a) { static char emsg[] = "<<NULL>>"; s = emsg; i = sizeof(emsg)-1; }
-                                                       else
-                                                               {
-                                                               s = mDNS_VACB;  // Adjust s to point to the start of the buffer, not the end
-                                                               if (F.altForm == 1)
-                                                                       {
-                                                                       #if(defined(MDNS_DEBUGMSGS))
-                                                                               mDNSAddr *ip = (mDNSAddr*)a;
-                                                                               switch (ip->type)
-                                                                                       {
-                                                                                       case mDNSAddrType_IPv4: F.precision =  4; a = (unsigned char *)&ip->ip.v4; break;
-                                                                                       case mDNSAddrType_IPv6: F.precision = 16; a = (unsigned char *)&ip->ip.v6; break;
-                                                                                       default:                F.precision =  0; break;
-                                                                                       }
-                                                                       #else
-                                                                               F.precision = 0;        // mDNSEmbeddedAPI.h not included so no mDNSAddr support
-                                                                       #endif
-                                                                       }
-                                                               else if (F.altForm == 2)
-                                                                       {
-                                                                       #ifdef AF_INET
-                                                                               const struct sockaddr *sa;
-                                                                               unsigned char *port;
-                                                                               sa = (const struct sockaddr*)a;
-                                                                               switch (sa->sa_family)
-                                                                                       {
-                                                                                       case AF_INET:  F.precision =  4; a = (unsigned char*)&((const struct sockaddr_in *)a)->sin_addr;
-                                                                                                      port = (unsigned char*)&((const struct sockaddr_in *)sa)->sin_port;
-                                                                                                      DebugSNPrintF(post, sizeof(post), ":%d", (port[0] << 8) | port[1]); break;
-                                                                                       #ifdef AF_INET6
-                                                                                       case AF_INET6: F.precision = 16; a = (unsigned char*)&((const struct sockaddr_in6 *)a)->sin6_addr; 
-                                                                                                      pre[0] = '['; pre[1] = '\0';
-                                                                                                      port = (unsigned char*)&((const struct sockaddr_in6 *)sa)->sin6_port;
-                                                                                                      DebugSNPrintF(post, sizeof(post), "%%%d]:%d", 
-                                                                                                               (int)((const struct sockaddr_in6 *)sa)->sin6_scope_id,
-                                                                                                               (port[0] << 8) | port[1]); break;
-                                                                                       #endif
-                                                                                       default:       F.precision =  0; break;
-                                                                                       }
-                                                                       #else
-                                                                               F.precision = 0;        // socket interfaces not included so no sockaddr support
-                                                                       #endif
-                                                                       }
-                                                               switch (F.precision)
-                                                                       {
-                                                                       case  4: i = DebugSNPrintF(mDNS_VACB, sizeof(mDNS_VACB), "%d.%d.%d.%d%s",
-                                                                                                               a[0], a[1], a[2], a[3], post); break;
-                                                                       case  6: i = DebugSNPrintF(mDNS_VACB, sizeof(mDNS_VACB), "%02X:%02X:%02X:%02X:%02X:%02X",
-                                                                                                               a[0], a[1], a[2], a[3], a[4], a[5]); break;
-                                                                       case  8: i = DebugSNPrintF(mDNS_VACB, sizeof(mDNS_VACB), "%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X",
-                                                                                                               a[0], a[1], a[2], a[3], a[4], a[5], a[6], a[7]); break;
-                                                                       case 16: i = DebugSNPrintF(mDNS_VACB, sizeof(mDNS_VACB), 
-                                                                                                               "%s%02X%02X:%02X%02X:%02X%02X:%02X%02X:%02X%02X:%02X%02X:%02X%02X:%02X%02X%s",
-                                                                                                               pre, a[0], a[1], a[2], a[3], a[4], a[5], a[6], a[7], a[8], 
-                                                                                                               a[9], a[10], a[11], a[12], a[13], a[14], a[15], post); break;           
-                                                                       default: i = DebugSNPrintF(mDNS_VACB, sizeof(mDNS_VACB), "%s", "<< ERROR: Must specify address size "
-                                                                                                               "(i.e. %.4a=IPv4, %.6a=Ethernet, %.8a=Fibre Channel %.16a=IPv6) >>"); break;
-                                                                       }
-                                                               }
-                                                       }
-                                                       break;
-
-                               case 'U' :      {
-                                                       unsigned char *a = va_arg(arg, unsigned char *);
-                                                       if (!a) { static char emsg[] = "<<NULL>>"; s = emsg; i = sizeof(emsg)-1; }
-                                                       else
-                                                               {
-                                                               s = mDNS_VACB;  // Adjust s to point to the start of the buffer, not the end
-                                                               i = DebugSNPrintF(mDNS_VACB, sizeof(mDNS_VACB), "%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x",
-                                                                               *((uint32_t*) &a[0]), *((uint16_t*) &a[4]), *((uint16_t*) &a[6]), 
-                                                                               a[8], a[9], a[10], a[11], a[12], a[13], a[14], a[15]); break;
-                                                               }
-                                                       }
-                                                       break;
-
-                               case 'c' :      *--s = (char)va_arg(arg, int); i = 1; break;
-       
-                               case 'C' :      if (F.lSize) n = va_arg(arg, unsigned long);
-                                                       else n = va_arg(arg, unsigned int);
-                                                       if (F.hSize) n = (unsigned short) n;
-                                                       c = (int)( n        & 0xFF); *--s = (char)(DebugIsPrint(c) ? c : '^');
-                                                       c = (int)((n >>  8) & 0xFF); *--s = (char)(DebugIsPrint(c) ? c : '^');
-                                                       c = (int)((n >> 16) & 0xFF); *--s = (char)(DebugIsPrint(c) ? c : '^');
-                                                       c = (int)((n >> 24) & 0xFF); *--s = (char)(DebugIsPrint(c) ? c : '^');
-                                                       i = 4;
-                                                       break;
-       
-                               case 's' :      s = va_arg(arg, char *);
-                                                       if (!s) { static char emsg[] = "<<NULL>>"; s = emsg; i = sizeof(emsg)-1; }
-                                                       else switch (F.altForm)
-                                                               {
-                                                               case 0: i=0;
-                                                                               if (F.havePrecision)                            // C string
-                                                                                       {
-                                                                                       while((i < F.precision) && s[i]) i++;
-                                                                                       // Make sure we don't truncate in the middle of a UTF-8 character.
-                                                                                       // If the last character is part of a multi-byte UTF-8 character, back up to the start of it.
-                                                                                       j=0;
-                                                                                       while((i > 0) && ((c = s[i-1]) & 0x80)) { j++; i--; if((c & 0xC0) != 0x80) break; }
-                                                                                       // If the actual count of UTF-8 characters matches the encoded UTF-8 count, add it back.
-                                                                                       if((j > 1) && (j <= 6))
-                                                                                               {
-                                                                                               int test = (0xFF << (8-j)) & 0xFF;
-                                                                                               int mask = test | (1 << ((8-j)-1));
-                                                                                               if((c & mask) == test) i += j;
-                                                                                               }
-                                                                                       }
-                                                                               else
-                                                                                       while(s[i]) i++;
-                                                                               break;                                                          
-                                                               case 1: i = (unsigned char) *s++; break;        // Pascal string
-                                                               case 2: {                                                                       // DNS label-sequence name
-                                                                               unsigned char *a = (unsigned char *)s;
-                                                                               s = mDNS_VACB;  // Adjust s to point to the start of the buffer, not the end
-                                                                               if (*a == 0) *s++ = '.';        // Special case for root DNS name
-                                                                               while (*a)
-                                                                                       {
-                                                                                       if (*a > 63) { s += DebugSNPrintF(s, mDNS_VACB_Remain(s), "<<INVALID LABEL LENGTH %u>>", *a); break; }
-                                                                                       if (s + *a >= &mDNS_VACB[254]) { s += DebugSNPrintF(s, mDNS_VACB_Remain(s), "<<NAME TOO LONG>>"); break; }
-                                                                                       s += DebugSNPrintF(s, mDNS_VACB_Remain(s), "%#s.", a);
-                                                                                       a += 1 + *a;
-                                                                                       }
-                                                                               i = (size_t)(s - mDNS_VACB);
-                                                                               s = mDNS_VACB;  // Reset s back to the start of the buffer
-                                                                               break;
-                                                                               }
-                                                               }
-                                                       if (F.havePrecision && i > F.precision)         // Make sure we don't truncate in the middle of a UTF-8 character
-                                                               { i = F.precision; while (i>0 && (s[i] & 0xC0) == 0x80) i--; }
-                                                       break;
-                               
-                               case 'S':       {       // UTF-16 string
-                                                       unsigned char *a = va_arg(arg, unsigned char *);
-                                                       uint16_t      *u = (uint16_t*)a;
-                                                       if (!u) { static char emsg[] = "<<NULL>>"; s = emsg; i = sizeof(emsg)-1; }
-                                                       if ((!F.havePrecision || F.precision))
-                                                               {
-                                                               if      ((a[0] == 0xFE) && (a[1] == 0xFF)) { F.altForm = 1; u += 1; a += 2; F.precision--; }    // Big Endian
-                                                               else if ((a[0] == 0xFF) && (a[1] == 0xFE)) { F.altForm = 2; u += 1; a += 2; F.precision--; }    // Little Endian
-                                                               }
-                                                       s = mDNS_VACB;  // Adjust s to point to the start of the buffer, not the end
-                                                       switch (F.altForm)
-                                                               {
-                                                               case 0: while ((!F.havePrecision || (i < F.precision)) && u[i] && mDNS_VACB_Remain(s))  // Host Endian
-                                                                                       { c = u[i]; *s++ = (char)(DebugIsPrint(c) ? c : '^'); i++; }
-                                                                               break;
-                                                               case 1: while ((!F.havePrecision || (i < F.precision)) && u[i] && mDNS_VACB_Remain(s))  // Big Endian
-                                                                                       { c = ((a[0] << 8) | a[1]) & 0xFF; *s++ = (char)(DebugIsPrint(c) ? c : '^'); i++; a += 2; }
-                                                                               break;
-                                                               case 2: while ((!F.havePrecision || (i < F.precision)) && u[i] && mDNS_VACB_Remain(s))  // Little Endian
-                                                                                       { c = ((a[1] << 8) | a[0]) & 0xFF; *s++ = (char)(DebugIsPrint(c) ? c : '^'); i++; a += 2; }
-                                                                               break;
-                                                               }
-                                                       }
-                                                       s = mDNS_VACB;  // Reset s back to the start of the buffer
-                                                       break;
-                       
-                       #if TARGET_OS_MAC
-                               case '@':       {       // Cocoa/CoreFoundation object
-                                                       CFTypeRef cfObj;
-                                                       CFStringRef cfStr;
-                                                       cfObj = (CFTypeRef) va_arg(arg, void *);
-                                                       cfStr = (CFGetTypeID(cfObj) == CFStringGetTypeID()) ? (CFStringRef)CFRetain(cfObj) : CFCopyDescription(cfObj);
-                                                       s = mDNS_VACB;  // Adjust s to point to the start of the buffer, not the end
-                                                       if (cfStr)
-                                                               {
-                                                               CFRange range;
-                                                               CFIndex m;
-                                                               range = CFRangeMake(0, CFStringGetLength(cfStr));
-                                                               m = 0;
-                                                               CFStringGetBytes(cfStr, range, kCFStringEncodingUTF8, '^', false, (UInt8*)mDNS_VACB, (CFIndex)sizeof(mDNS_VACB), &m);
-                                                               CFRelease(cfStr);
-                                                               i = (size_t) m;
-                                                               }
-                                                       else
-                                                               {
-                                                               i = DebugSNPrintF(mDNS_VACB, sizeof(mDNS_VACB), "%s", "ERROR: <invalid CF object>" );
-                                                               }
-                                                       }
-                                                       if (F.havePrecision && i > F.precision)         // Make sure we don't truncate in the middle of a UTF-8 character
-                                                               { i = F.precision; while (i>0 && (s[i] & 0xC0) == 0x80) i--; }
-                                                       break;
-                       #endif
-
-                               case 'm' :      {       // Error Message
-                                                       long err;
-                                                       if (F.lSize) err = va_arg(arg, long);
-                                                       else err = va_arg(arg, int);
-                                                       if (F.hSize) err = (short)err;
-                                                       DebugGetErrorString(err, mDNS_VACB, sizeof(mDNS_VACB));
-                                                       s = mDNS_VACB;  // Adjust s to point to the start of the buffer, not the end
-                                                       for(i=0;s[i];i++) {}
-                                                       }
-                                                       break;
-
-                               case 'H' :      {       // Hex Dump
-                                                       void *a = va_arg(arg, void *);
-                                                       size_t size = (size_t)va_arg(arg, int);
-                                                       size_t max = (size_t)va_arg(arg, int);
-                                                       DebugFlags flags = 
-                                                               kDebugFlagsNoAddress | kDebugFlagsNoOffset | kDebugFlagsNoNewLine |
-                                                               kDebugFlags8BitSeparator | kDebugFlagsNo32BitSeparator |
-                                                               kDebugFlagsNo16ByteHexPad | kDebugFlagsNoByteCount;
-                                                       if (F.altForm == 0) flags |= kDebugFlagsNoASCII;
-                                                       size = (max < size) ? max : size;
-                                                       s = mDNS_VACB;  // Adjust s to point to the start of the buffer, not the end
-                                                       i = DebugHexDump(kDebugLevelMax, 0, NULL, 0, 0, NULL, 0, a, a, size, flags, mDNS_VACB, sizeof(mDNS_VACB));
-                                                       }
-                                                       break;
-                               
-                               case 'v' :      {       // Version
-                                                       uint32_t version;
-                                                       version = va_arg(arg, unsigned int);
-                                                       DebugNumVersionToString(version, mDNS_VACB);
-                                                       s = mDNS_VACB;  // Adjust s to point to the start of the buffer, not the end
-                                                       for(i=0;s[i];i++) {}
-                                                       }
-                                                       break;
-
-                               case 'n' :      s = va_arg(arg, char *);
-                                                       if      (F.hSize) * (short *) s = (short)nwritten;
-                                                       else if (F.lSize) * (long  *) s = (long)nwritten;
-                                                       else              * (int   *) s = (int)nwritten;
-                                                       continue;
-       
-                               default:        s = mDNS_VACB;
-                                                       i = DebugSNPrintF(mDNS_VACB, sizeof(mDNS_VACB), "<<UNKNOWN FORMAT CONVERSION CODE %%%c>>", c);
-
-                               case '%' :      *sbuffer++ = (char)c;
-                                                       if (++nwritten >= buflen) goto exit;
-                                                       break;
-                               }
-       
-                       if (i < F.fieldWidth && !F.leftJustify)                 // Pad on the left
-                               do      {
-                                       *sbuffer++ = ' ';
-                                       if (++nwritten >= buflen) goto exit;
-                                       } while (i < --F.fieldWidth);
-       
-                       if (i > buflen - nwritten)      // Make sure we don't truncate in the middle of a UTF-8 character
-                               { i = buflen - nwritten; while (i>0 && (s[i] & 0xC0) == 0x80) i--; }
-                       for (j=0; j<i; j++) *sbuffer++ = *s++;                  // Write the converted result
-                       nwritten += i;
-                       if (nwritten >= buflen) goto exit;
-       
-                       for (; i < F.fieldWidth; i++)                                   // Pad on the right
-                               {
-                               *sbuffer++ = ' ';
-                               if (++nwritten >= buflen) goto exit;
-                               }
-                       }
-               }
-       exit:
-       *sbuffer++ = 0;
-       return(nwritten);
-       }
-
-//===========================================================================================================================
-//     DebugGetErrorString
-//===========================================================================================================================
-
-DEBUG_EXPORT const char *      DebugGetErrorString( int_least32_t inErrorCode, char *inBuffer, size_t inBufferSize )
-{
-       const char *            s;
-       char *                          dst;
-       char *                          end;
-#if( TARGET_OS_WIN32 && !TARGET_OS_WINDOWS_CE )
-       char                            buffer[ 256 ];
-#endif
-       
-       switch( inErrorCode )
-       {
-               #define CaseErrorString( X, STR )                                       case X: s = STR; break
-               #define CaseErrorStringify( X )                                         case X: s = # X; break
-               #define CaseErrorStringifyHardCode( VALUE, X )          case VALUE: s = # X; break
-               
-               // General Errors
-               
-               CaseErrorString( 0,  "no error" );
-               CaseErrorString( 1,  "in-progress/waiting" );
-               CaseErrorString( -1, "catch-all unknown error" );
-                               
-               // ACP Errors
-               
-               CaseErrorStringifyHardCode( -2,  kACPBadRequestErr );
-               CaseErrorStringifyHardCode( -3,  kACPNoMemoryErr );
-               CaseErrorStringifyHardCode( -4,  kACPBadParamErr );
-               CaseErrorStringifyHardCode( -5,  kACPNotFoundErr );
-               CaseErrorStringifyHardCode( -6,  kACPBadChecksumErr );
-               CaseErrorStringifyHardCode( -7,  kACPCommandNotHandledErr );
-               CaseErrorStringifyHardCode( -8,  kACPNetworkErr );
-               CaseErrorStringifyHardCode( -9,  kACPDuplicateCommandHandlerErr );
-               CaseErrorStringifyHardCode( -10, kACPUnknownPropertyErr );
-               CaseErrorStringifyHardCode( -11, kACPImmutablePropertyErr );
-               CaseErrorStringifyHardCode( -12, kACPBadPropertyValueErr );
-               CaseErrorStringifyHardCode( -13, kACPNoResourcesErr );
-               CaseErrorStringifyHardCode( -14, kACPBadOptionErr );
-               CaseErrorStringifyHardCode( -15, kACPBadSizeErr );
-               CaseErrorStringifyHardCode( -16, kACPBadPasswordErr );
-               CaseErrorStringifyHardCode( -17, kACPNotInitializedErr );
-               CaseErrorStringifyHardCode( -18, kACPNonReadablePropertyErr );
-               CaseErrorStringifyHardCode( -19, kACPBadVersionErr );
-               CaseErrorStringifyHardCode( -20, kACPBadSignatureErr );
-               CaseErrorStringifyHardCode( -21, kACPBadIndexErr );
-               CaseErrorStringifyHardCode( -22, kACPUnsupportedErr );
-               CaseErrorStringifyHardCode( -23, kACPInUseErr );
-               CaseErrorStringifyHardCode( -24, kACPParamCountErr );
-               CaseErrorStringifyHardCode( -25, kACPIDErr );
-               CaseErrorStringifyHardCode( -26, kACPFormatErr );
-               CaseErrorStringifyHardCode( -27, kACPUnknownUserErr );
-               CaseErrorStringifyHardCode( -28, kACPAccessDeniedErr );
-               CaseErrorStringifyHardCode( -29, kACPIncorrectFWErr );
-               
-               // Common Services Errors
-               
-               CaseErrorStringify( kUnknownErr );
-               CaseErrorStringify( kOptionErr );
-               CaseErrorStringify( kSelectorErr );
-               CaseErrorStringify( kExecutionStateErr );
-               CaseErrorStringify( kPathErr );
-               CaseErrorStringify( kParamErr );
-               CaseErrorStringify( kParamCountErr );
-               CaseErrorStringify( kCommandErr );
-               CaseErrorStringify( kIDErr );
-               CaseErrorStringify( kStateErr );
-               CaseErrorStringify( kRangeErr );
-               CaseErrorStringify( kRequestErr );
-               CaseErrorStringify( kResponseErr );
-               CaseErrorStringify( kChecksumErr );
-               CaseErrorStringify( kNotHandledErr );
-               CaseErrorStringify( kVersionErr );
-               CaseErrorStringify( kSignatureErr );
-               CaseErrorStringify( kFormatErr );
-               CaseErrorStringify( kNotInitializedErr );
-               CaseErrorStringify( kAlreadyInitializedErr );
-               CaseErrorStringify( kNotInUseErr );
-               CaseErrorStringify( kInUseErr );
-               CaseErrorStringify( kTimeoutErr );
-               CaseErrorStringify( kCanceledErr );
-               CaseErrorStringify( kAlreadyCanceledErr );
-               CaseErrorStringify( kCannotCancelErr );
-               CaseErrorStringify( kDeletedErr );
-               CaseErrorStringify( kNotFoundErr );
-               CaseErrorStringify( kNoMemoryErr );
-               CaseErrorStringify( kNoResourcesErr );
-               CaseErrorStringify( kDuplicateErr );
-               CaseErrorStringify( kImmutableErr );
-               CaseErrorStringify( kUnsupportedDataErr );
-               CaseErrorStringify( kIntegrityErr );
-               CaseErrorStringify( kIncompatibleErr );
-               CaseErrorStringify( kUnsupportedErr );
-               CaseErrorStringify( kUnexpectedErr );
-               CaseErrorStringify( kValueErr );
-               CaseErrorStringify( kNotReadableErr );
-               CaseErrorStringify( kNotWritableErr );
-               CaseErrorStringify( kBadReferenceErr );
-               CaseErrorStringify( kFlagErr );
-               CaseErrorStringify( kMalformedErr );
-               CaseErrorStringify( kSizeErr );
-               CaseErrorStringify( kNameErr );
-               CaseErrorStringify( kNotReadyErr );
-               CaseErrorStringify( kReadErr );
-               CaseErrorStringify( kWriteErr );
-               CaseErrorStringify( kMismatchErr );
-               CaseErrorStringify( kDateErr );
-               CaseErrorStringify( kUnderrunErr );
-               CaseErrorStringify( kOverrunErr );
-               CaseErrorStringify( kEndingErr );
-               CaseErrorStringify( kConnectionErr );
-               CaseErrorStringify( kAuthenticationErr );
-               CaseErrorStringify( kOpenErr );
-               CaseErrorStringify( kTypeErr );
-               CaseErrorStringify( kSkipErr );
-               CaseErrorStringify( kNoAckErr );
-               CaseErrorStringify( kCollisionErr );
-               CaseErrorStringify( kBackoffErr );
-               CaseErrorStringify( kNoAddressAckErr );
-               CaseErrorStringify( kBusyErr );
-               CaseErrorStringify( kNoSpaceErr );
-               
-               // mDNS/DNS-SD Errors
-               
-               CaseErrorStringifyHardCode( -65537, mStatus_UnknownErr );
-               CaseErrorStringifyHardCode( -65538, mStatus_NoSuchNameErr );
-               CaseErrorStringifyHardCode( -65539, mStatus_NoMemoryErr );
-               CaseErrorStringifyHardCode( -65540, mStatus_BadParamErr );
-               CaseErrorStringifyHardCode( -65541, mStatus_BadReferenceErr );
-               CaseErrorStringifyHardCode( -65542, mStatus_BadStateErr );
-               CaseErrorStringifyHardCode( -65543, mStatus_BadFlagsErr );
-               CaseErrorStringifyHardCode( -65544, mStatus_UnsupportedErr );
-               CaseErrorStringifyHardCode( -65545, mStatus_NotInitializedErr );
-               CaseErrorStringifyHardCode( -65546, mStatus_NoCache );
-               CaseErrorStringifyHardCode( -65547, mStatus_AlreadyRegistered );
-               CaseErrorStringifyHardCode( -65548, mStatus_NameConflict );
-               CaseErrorStringifyHardCode( -65549, mStatus_Invalid );
-               CaseErrorStringifyHardCode( -65550, mStatus_GrowCache );
-               CaseErrorStringifyHardCode( -65551, mStatus_BadInterfaceErr );
-               CaseErrorStringifyHardCode( -65552, mStatus_Incompatible );
-               CaseErrorStringifyHardCode( -65791, mStatus_ConfigChanged );
-               CaseErrorStringifyHardCode( -65792, mStatus_MemFree );
-               
-               // RSP Errors
-               
-               CaseErrorStringifyHardCode( -400000, kRSPUnknownErr );
-               CaseErrorStringifyHardCode( -400050, kRSPParamErr );
-               CaseErrorStringifyHardCode( -400108, kRSPNoMemoryErr );
-               CaseErrorStringifyHardCode( -405246, kRSPRangeErr );
-               CaseErrorStringifyHardCode( -409057, kRSPSizeErr );
-               CaseErrorStringifyHardCode( -400200, kRSPHardwareErr );
-               CaseErrorStringifyHardCode( -401712, kRSPTimeoutErr );  
-               CaseErrorStringifyHardCode( -402053, kRSPUnsupportedErr );
-               CaseErrorStringifyHardCode( -402419, kRSPIDErr );
-               CaseErrorStringifyHardCode( -403165, kRSPFlagErr );
-               CaseErrorString(                        -200000, "kRSPControllerStatusBase - 0x50" );           
-               CaseErrorString(                        -200080, "kRSPCommandSucceededErr - 0x50" );
-               CaseErrorString(                        -200001, "kRSPCommandFailedErr - 0x01" );
-               CaseErrorString(                        -200051, "kRSPChecksumErr - 0x33" );
-               CaseErrorString(                        -200132, "kRSPCommandTimeoutErr - 0x84" );
-               CaseErrorString(                        -200034, "kRSPPasswordRequiredErr - 0x22 OBSOLETE" );
-               CaseErrorString(                        -200128, "kRSPCanceledErr - 0x02 Async" );
-               
-               // XML Errors
-               
-               CaseErrorStringifyHardCode( -100043, kXMLNotFoundErr );
-               CaseErrorStringifyHardCode( -100050, kXMLParamErr );
-               CaseErrorStringifyHardCode( -100108, kXMLNoMemoryErr );
-               CaseErrorStringifyHardCode( -100206, kXMLFormatErr );
-               CaseErrorStringifyHardCode( -100586, kXMLNoRootElementErr );
-               CaseErrorStringifyHardCode( -101703, kXMLWrongDataTypeErr );
-               CaseErrorStringifyHardCode( -101726, kXMLKeyErr );
-               CaseErrorStringifyHardCode( -102053, kXMLUnsupportedErr );
-               CaseErrorStringifyHardCode( -102063, kXMLMissingElementErr );
-               CaseErrorStringifyHardCode( -103026, kXMLParseErr );
-               CaseErrorStringifyHardCode( -103159, kXMLBadDataErr );
-               CaseErrorStringifyHardCode( -103170, kXMLBadNameErr );
-               CaseErrorStringifyHardCode( -105246, kXMLRangeErr );
-               CaseErrorStringifyHardCode( -105251, kXMLUnknownElementErr );
-               CaseErrorStringifyHardCode( -108739, kXMLMalformedInputErr );
-               CaseErrorStringifyHardCode( -109057, kXMLBadSizeErr );
-               CaseErrorStringifyHardCode( -101730, kXMLMissingChildElementErr );
-               CaseErrorStringifyHardCode( -102107, kXMLMissingParentElementErr );
-               CaseErrorStringifyHardCode( -130587, kXMLNonRootElementErr );
-               CaseErrorStringifyHardCode( -102015, kXMLDateErr );
-
-       #if( __MACH__ )
-       
-               // Mach Errors
-
-               CaseErrorStringifyHardCode( 0x00002000, MACH_MSG_IPC_SPACE );
-               CaseErrorStringifyHardCode( 0x00001000, MACH_MSG_VM_SPACE );
-               CaseErrorStringifyHardCode( 0x00000800, MACH_MSG_IPC_KERNEL );
-               CaseErrorStringifyHardCode( 0x00000400, MACH_MSG_VM_KERNEL );
-               CaseErrorStringifyHardCode( 0x10000001, MACH_SEND_IN_PROGRESS );
-               CaseErrorStringifyHardCode( 0x10000002, MACH_SEND_INVALID_DATA );
-               CaseErrorStringifyHardCode( 0x10000003, MACH_SEND_INVALID_DEST );
-               CaseErrorStringifyHardCode( 0x10000004, MACH_SEND_TIMED_OUT );
-               CaseErrorStringifyHardCode( 0x10000007, MACH_SEND_INTERRUPTED );
-               CaseErrorStringifyHardCode( 0x10000008, MACH_SEND_MSG_TOO_SMALL );
-               CaseErrorStringifyHardCode( 0x10000009, MACH_SEND_INVALID_REPLY );
-               CaseErrorStringifyHardCode( 0x1000000A, MACH_SEND_INVALID_RIGHT );
-               CaseErrorStringifyHardCode( 0x1000000B, MACH_SEND_INVALID_NOTIFY );
-               CaseErrorStringifyHardCode( 0x1000000C, MACH_SEND_INVALID_MEMORY );
-               CaseErrorStringifyHardCode( 0x1000000D, MACH_SEND_NO_BUFFER );
-               CaseErrorStringifyHardCode( 0x1000000E, MACH_SEND_TOO_LARGE );
-               CaseErrorStringifyHardCode( 0x1000000F, MACH_SEND_INVALID_TYPE );
-               CaseErrorStringifyHardCode( 0x10000010, MACH_SEND_INVALID_HEADER );
-               CaseErrorStringifyHardCode( 0x10000011, MACH_SEND_INVALID_TRAILER );
-               CaseErrorStringifyHardCode( 0x10000015, MACH_SEND_INVALID_RT_OOL_SIZE );
-               CaseErrorStringifyHardCode( 0x10004001, MACH_RCV_IN_PROGRESS );
-               CaseErrorStringifyHardCode( 0x10004002, MACH_RCV_INVALID_NAME );
-               CaseErrorStringifyHardCode( 0x10004003, MACH_RCV_TIMED_OUT );
-               CaseErrorStringifyHardCode( 0x10004004, MACH_RCV_TOO_LARGE );
-               CaseErrorStringifyHardCode( 0x10004005, MACH_RCV_INTERRUPTED );
-               CaseErrorStringifyHardCode( 0x10004006, MACH_RCV_PORT_CHANGED );
-               CaseErrorStringifyHardCode( 0x10004007, MACH_RCV_INVALID_NOTIFY );
-               CaseErrorStringifyHardCode( 0x10004008, MACH_RCV_INVALID_DATA );
-               CaseErrorStringifyHardCode( 0x10004009, MACH_RCV_PORT_DIED );
-               CaseErrorStringifyHardCode( 0x1000400A, MACH_RCV_IN_SET );
-               CaseErrorStringifyHardCode( 0x1000400B, MACH_RCV_HEADER_ERROR );
-               CaseErrorStringifyHardCode( 0x1000400C, MACH_RCV_BODY_ERROR );
-               CaseErrorStringifyHardCode( 0x1000400D, MACH_RCV_INVALID_TYPE );
-               CaseErrorStringifyHardCode( 0x1000400E, MACH_RCV_SCATTER_SMALL );
-               CaseErrorStringifyHardCode( 0x1000400F, MACH_RCV_INVALID_TRAILER );
-               CaseErrorStringifyHardCode( 0x10004011, MACH_RCV_IN_PROGRESS_TIMED );
-
-               // Mach OSReturn Errors
-
-               CaseErrorStringifyHardCode( 0xDC000001, kOSReturnError );
-               CaseErrorStringifyHardCode( 0xDC004001, kOSMetaClassInternal );
-               CaseErrorStringifyHardCode( 0xDC004002, kOSMetaClassHasInstances );
-               CaseErrorStringifyHardCode( 0xDC004003, kOSMetaClassNoInit );
-               CaseErrorStringifyHardCode( 0xDC004004, kOSMetaClassNoTempData );
-               CaseErrorStringifyHardCode( 0xDC004005, kOSMetaClassNoDicts );
-               CaseErrorStringifyHardCode( 0xDC004006, kOSMetaClassNoKModSet );
-               CaseErrorStringifyHardCode( 0xDC004007, kOSMetaClassNoInsKModSet );
-               CaseErrorStringifyHardCode( 0xDC004008, kOSMetaClassNoSuper );
-               CaseErrorStringifyHardCode( 0xDC004009, kOSMetaClassInstNoSuper );
-               CaseErrorStringifyHardCode( 0xDC00400A, kOSMetaClassDuplicateClass );
-
-               // IOKit Errors
-
-               CaseErrorStringifyHardCode( 0xE00002BC, kIOReturnError );
-               CaseErrorStringifyHardCode( 0xE00002BD, kIOReturnNoMemory );
-               CaseErrorStringifyHardCode( 0xE00002BE, kIOReturnNoResources );
-               CaseErrorStringifyHardCode( 0xE00002BF, kIOReturnIPCError );
-               CaseErrorStringifyHardCode( 0xE00002C0, kIOReturnNoDevice );
-               CaseErrorStringifyHardCode( 0xE00002C1, kIOReturnNotPrivileged );
-               CaseErrorStringifyHardCode( 0xE00002C2, kIOReturnBadArgument );
-               CaseErrorStringifyHardCode( 0xE00002C3, kIOReturnLockedRead );
-               CaseErrorStringifyHardCode( 0xE00002C4, kIOReturnLockedWrite );
-               CaseErrorStringifyHardCode( 0xE00002C5, kIOReturnExclusiveAccess );
-               CaseErrorStringifyHardCode( 0xE00002C6, kIOReturnBadMessageID );
-               CaseErrorStringifyHardCode( 0xE00002C7, kIOReturnUnsupported );
-               CaseErrorStringifyHardCode( 0xE00002C8, kIOReturnVMError );
-               CaseErrorStringifyHardCode( 0xE00002C9, kIOReturnInternalError );
-               CaseErrorStringifyHardCode( 0xE00002CA, kIOReturnIOError );
-               CaseErrorStringifyHardCode( 0xE00002CC, kIOReturnCannotLock );
-               CaseErrorStringifyHardCode( 0xE00002CD, kIOReturnNotOpen );
-               CaseErrorStringifyHardCode( 0xE00002CE, kIOReturnNotReadable );
-               CaseErrorStringifyHardCode( 0xE00002CF, kIOReturnNotWritable );
-               CaseErrorStringifyHardCode( 0xE00002D0, kIOReturnNotAligned );
-               CaseErrorStringifyHardCode( 0xE00002D1, kIOReturnBadMedia );
-               CaseErrorStringifyHardCode( 0xE00002D2, kIOReturnStillOpen );
-               CaseErrorStringifyHardCode( 0xE00002D3, kIOReturnRLDError );
-               CaseErrorStringifyHardCode( 0xE00002D4, kIOReturnDMAError );
-               CaseErrorStringifyHardCode( 0xE00002D5, kIOReturnBusy );
-               CaseErrorStringifyHardCode( 0xE00002D6, kIOReturnTimeout );
-               CaseErrorStringifyHardCode( 0xE00002D7, kIOReturnOffline );
-               CaseErrorStringifyHardCode( 0xE00002D8, kIOReturnNotReady );
-               CaseErrorStringifyHardCode( 0xE00002D9, kIOReturnNotAttached );
-               CaseErrorStringifyHardCode( 0xE00002DA, kIOReturnNoChannels );
-               CaseErrorStringifyHardCode( 0xE00002DB, kIOReturnNoSpace );
-               CaseErrorStringifyHardCode( 0xE00002DD, kIOReturnPortExists );
-               CaseErrorStringifyHardCode( 0xE00002DE, kIOReturnCannotWire );
-               CaseErrorStringifyHardCode( 0xE00002DF, kIOReturnNoInterrupt );
-               CaseErrorStringifyHardCode( 0xE00002E0, kIOReturnNoFrames );
-               CaseErrorStringifyHardCode( 0xE00002E1, kIOReturnMessageTooLarge );
-               CaseErrorStringifyHardCode( 0xE00002E2, kIOReturnNotPermitted );
-               CaseErrorStringifyHardCode( 0xE00002E3, kIOReturnNoPower );
-               CaseErrorStringifyHardCode( 0xE00002E4, kIOReturnNoMedia );
-               CaseErrorStringifyHardCode( 0xE00002E5, kIOReturnUnformattedMedia );
-               CaseErrorStringifyHardCode( 0xE00002E6, kIOReturnUnsupportedMode );
-               CaseErrorStringifyHardCode( 0xE00002E7, kIOReturnUnderrun );
-               CaseErrorStringifyHardCode( 0xE00002E8, kIOReturnOverrun );
-               CaseErrorStringifyHardCode( 0xE00002E9, kIOReturnDeviceError     );
-               CaseErrorStringifyHardCode( 0xE00002EA, kIOReturnNoCompletion    );
-               CaseErrorStringifyHardCode( 0xE00002EB, kIOReturnAborted         );
-               CaseErrorStringifyHardCode( 0xE00002EC, kIOReturnNoBandwidth     );
-               CaseErrorStringifyHardCode( 0xE00002ED, kIOReturnNotResponding   );
-               CaseErrorStringifyHardCode( 0xE00002EE, kIOReturnIsoTooOld       );
-               CaseErrorStringifyHardCode( 0xE00002EF, kIOReturnIsoTooNew       );
-               CaseErrorStringifyHardCode( 0xE00002F0, kIOReturnNotFound );
-               CaseErrorStringifyHardCode( 0xE0000001, kIOReturnInvalid );
-
-               // IOKit FireWire Errors
-
-               CaseErrorStringifyHardCode( 0xE0008010, kIOFireWireResponseBase );
-               CaseErrorStringifyHardCode( 0xE0008020, kIOFireWireBusReset );
-               CaseErrorStringifyHardCode( 0xE0008001, kIOConfigNoEntry );
-               CaseErrorStringifyHardCode( 0xE0008002, kIOFireWirePending );
-               CaseErrorStringifyHardCode( 0xE0008003, kIOFireWireLastDCLToken );
-               CaseErrorStringifyHardCode( 0xE0008004, kIOFireWireConfigROMInvalid );
-               CaseErrorStringifyHardCode( 0xE0008005, kIOFireWireAlreadyRegistered );
-               CaseErrorStringifyHardCode( 0xE0008006, kIOFireWireMultipleTalkers );
-               CaseErrorStringifyHardCode( 0xE0008007, kIOFireWireChannelActive );
-               CaseErrorStringifyHardCode( 0xE0008008, kIOFireWireNoListenerOrTalker );
-               CaseErrorStringifyHardCode( 0xE0008009, kIOFireWireNoChannels );
-               CaseErrorStringifyHardCode( 0xE000800A, kIOFireWireChannelNotAvailable );
-               CaseErrorStringifyHardCode( 0xE000800B, kIOFireWireSeparateBus );
-               CaseErrorStringifyHardCode( 0xE000800C, kIOFireWireBadSelfIDs );
-               CaseErrorStringifyHardCode( 0xE000800D, kIOFireWireLowCableVoltage );
-               CaseErrorStringifyHardCode( 0xE000800E, kIOFireWireInsufficientPower );
-               CaseErrorStringifyHardCode( 0xE000800F, kIOFireWireOutOfTLabels );
-               CaseErrorStringifyHardCode( 0xE0008101, kIOFireWireBogusDCLProgram );
-               CaseErrorStringifyHardCode( 0xE0008102, kIOFireWireTalkingAndListening );
-               CaseErrorStringifyHardCode( 0xE0008103, kIOFireWireHardwareSlept );
-               CaseErrorStringifyHardCode( 0xE00087D0, kIOFWMessageServiceIsRequestingClose );
-               CaseErrorStringifyHardCode( 0xE00087D1, kIOFWMessagePowerStateChanged );
-               CaseErrorStringifyHardCode( 0xE00087D2, kIOFWMessageTopologyChanged );
-
-               // IOKit USB Errors
-                               
-               CaseErrorStringifyHardCode( 0xE0004061, kIOUSBUnknownPipeErr );
-               CaseErrorStringifyHardCode( 0xE0004060, kIOUSBTooManyPipesErr );
-               CaseErrorStringifyHardCode( 0xE000405F, kIOUSBNoAsyncPortErr );
-               CaseErrorStringifyHardCode( 0xE000405E, kIOUSBNotEnoughPipesErr );
-               CaseErrorStringifyHardCode( 0xE000405D, kIOUSBNotEnoughPowerErr );
-               CaseErrorStringifyHardCode( 0xE0004057, kIOUSBEndpointNotFound );
-               CaseErrorStringifyHardCode( 0xE0004056, kIOUSBConfigNotFound );
-               CaseErrorStringifyHardCode( 0xE0004051, kIOUSBTransactionTimeout );
-               CaseErrorStringifyHardCode( 0xE0004050, kIOUSBTransactionReturned );
-               CaseErrorStringifyHardCode( 0xE000404F, kIOUSBPipeStalled );
-               CaseErrorStringifyHardCode( 0xE000404E, kIOUSBInterfaceNotFound );
-               CaseErrorStringifyHardCode( 0xE000404D, kIOUSBLowLatencyBufferNotPreviouslyAllocated );
-               CaseErrorStringifyHardCode( 0xE000404C, kIOUSBLowLatencyFrameListNotPreviouslyAllocated );
-               CaseErrorStringifyHardCode( 0xE000404B, kIOUSBHighSpeedSplitError );
-               CaseErrorStringifyHardCode( 0xE0004010, kIOUSBLinkErr );
-               CaseErrorStringifyHardCode( 0xE000400F, kIOUSBNotSent2Err );
-               CaseErrorStringifyHardCode( 0xE000400E, kIOUSBNotSent1Err );
-               CaseErrorStringifyHardCode( 0xE000400D, kIOUSBBufferUnderrunErr );
-               CaseErrorStringifyHardCode( 0xE000400C, kIOUSBBufferOverrunErr );
-               CaseErrorStringifyHardCode( 0xE000400B, kIOUSBReserved2Err );
-               CaseErrorStringifyHardCode( 0xE000400A, kIOUSBReserved1Err );
-               CaseErrorStringifyHardCode( 0xE0004007, kIOUSBWrongPIDErr );
-               CaseErrorStringifyHardCode( 0xE0004006, kIOUSBPIDCheckErr );
-               CaseErrorStringifyHardCode( 0xE0004003, kIOUSBDataToggleErr );
-               CaseErrorStringifyHardCode( 0xE0004002, kIOUSBBitstufErr );
-               CaseErrorStringifyHardCode( 0xE0004001, kIOUSBCRCErr );
-       
-       #endif  // __MACH__
-
-               // Other Errors
-               
-               default:
-                       s = NULL;
-                       #if( TARGET_OS_WIN32 && !TARGET_OS_WINDOWS_CE )
-                               if( inBuffer && ( inBufferSize > 0 ) )
-                               {
-                                       DWORD           n;
-                                       
-                                       n = FormatMessageA( FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, (DWORD) inErrorCode, 
-                                               MAKELANGID( LANG_NEUTRAL, SUBLANG_DEFAULT ), buffer, sizeof( buffer ), NULL );
-                                       if( n > 0 )
-                                       {
-                                               // Remove any trailing CR's or LF's since some messages have them.
-                                               
-                                               while( ( n > 0 ) && isspace( ( (unsigned char *) buffer )[ n - 1 ] ) )
-                                               {
-                                                       buffer[ --n ] = '\0';
-                                               }
-                                               s = buffer;
-                                       }
-                               }
-                       #endif
-                       
-                       if( !s )
-                       {
-                               #if( !TARGET_API_MAC_OSX_KERNEL && !TARGET_OS_WINDOWS_CE )
-                                       s = strerror( inErrorCode );
-                               #endif
-                               if( !s )
-                               {
-                                       s = "<unknown error code>";
-                               }
-                       }
-                       break;
-       }
-       
-       // Copy the string to the output buffer. If no buffer is supplied or it is empty, return an empty string.
-       
-       if( inBuffer && ( inBufferSize > 0 ) )
-       {
-               dst = inBuffer;
-               end = dst + ( inBufferSize - 1 );
-               while( ( ( end - dst ) > 0 ) && ( *s != '\0' ) )
-               {
-                       *dst++ = *s++;
-               }
-               *dst = '\0';
-               s = inBuffer;
-       }
-       return( s );
-}
-
-//===========================================================================================================================
-//     DebugHexDump
-//===========================================================================================================================
-
-DEBUG_EXPORT size_t
-       DebugHexDump( 
-               DebugLevel              inLevel, 
-               int                             inIndent, 
-               const char *    inLabel, 
-               size_t                  inLabelSize, 
-               int                             inLabelMinWidth, 
-               const char *    inType, 
-               size_t                  inTypeSize, 
-               const void *    inDataStart, 
-               const void *    inData, 
-               size_t                  inDataSize, 
-               DebugFlags              inFlags, 
-               char *                  outBuffer, 
-               size_t                  inBufferSize )
-{
-       static const char               kHexChars[] = "0123456789ABCDEF";
-       const uint8_t *                 start;
-       const uint8_t *                 src;
-       char *                                  dst;
-       char *                                  end;
-       size_t                                  n;
-       int                                             offset;
-       int                                             width;
-       const char *                    newline;
-       char                                    separator[ 8 ];
-       char *                                  s;
-       
-       DEBUG_UNUSED( inType );
-       DEBUG_UNUSED( inTypeSize );
-       
-       // Set up the function-wide variables.
-       
-       if( inLabelSize == kSizeCString )
-       {
-               inLabelSize = strlen( inLabel );
-       }
-       start   = (const uint8_t *) inData;
-       src     = start;
-       dst             = outBuffer;
-       end             = dst + inBufferSize;
-       offset  = (int)( (intptr_t) inData - (intptr_t) inDataStart );
-       width   = ( (int) inLabelSize > inLabelMinWidth ) ? (int) inLabelSize : inLabelMinWidth;
-       newline = ( inFlags & kDebugFlagsNoNewLine ) ? "" : "\n";
-               
-       // Set up the separator string. This is used to insert spaces on subsequent "lines" when not using newlines.
-       
-       s = separator;
-       if( inFlags & kDebugFlagsNoNewLine )
-       {
-               if( inFlags & kDebugFlags8BitSeparator )
-               {
-                       *s++ = ' ';
-               }
-               if( inFlags & kDebugFlags16BitSeparator )
-               {
-                       *s++ = ' ';
-               }
-               if( !( inFlags & kDebugFlagsNo32BitSeparator ) )
-               {
-                       *s++ = ' ';
-               }
-               check( ( (size_t)( s - separator ) ) < sizeof( separator ) );
-       }
-       *s = '\0';
-       
-       for( ;; )
-       {
-               char            prefixString[ 32 ];
-               char            hexString[ 64 ];
-               char            asciiString[ 32 ];
-               char            byteCountString[ 32 ];
-               int                     c;
-               size_t          chunkSize;
-               size_t          i;
-               
-               // If this is a label-only item (i.e. no data), print the label (accounting for prefix string spacing) and exit.
-               
-               if( inDataSize == 0 )
-               {
-                       if( inLabel && ( inLabelSize > 0 ) )
-                       {
-                               width = 0;
-                               if( !( inFlags & kDebugFlagsNoAddress ) )
-                               {
-                                       width += 8;                     // "00000000"
-                                       if( !( inFlags & kDebugFlagsNoOffset ) )
-                                       {
-                                               width += 1;             // "+"
-                                       }
-                               }
-                               if( inFlags & kDebugFlags32BitOffset )
-                               {
-                                       width += 8;                     // "00000000"
-                               }
-                               else if( !( inFlags & kDebugFlagsNoOffset ) )
-                               {
-                                       width += 4;                     // "0000"
-                               }
-                               
-                               if( outBuffer )
-                               {
-                                       dst += DebugSNPrintF( dst, (size_t)( end - dst ), "%*s" "%-*.*s" "%.*s" "%s", 
-                                               width, "", 
-                                               ( width > 0 ) ? ": " : "", 
-                                               width, (int) inLabelSize, inLabel, 
-                                               newline );
-                               }
-                               else
-                               {
-                                       dst += DebugPrintF( inLevel, "%*s" "%-*.*s" "%.*s" "%s", 
-                                               width, "", 
-                                               ( width > 0 ) ? ": " : "", 
-                                               width, (int) inLabelSize, inLabel, 
-                                               newline );
-                               }
-                       }
-                       break;
-               }
-               
-               // Build the prefix string. It will be in one of the following formats:
-               //
-               // 1) "00000000+0000[0000]"     (address and offset)
-               // 2) "00000000"                        (address only)
-               // 3) "0000[0000]"                      (offset only)
-               // 4) ""                                        (no address or offset)
-               //
-               // Note: If we're printing multiple "lines", but not printing newlines, a space is used to separate.
-               
-               s = prefixString;
-               if( !( inFlags & kDebugFlagsNoAddress ) )
-               {
-                       *s++ = kHexChars[ ( ( (uintptr_t) src ) >> 28 ) & 0xF ];
-                       *s++ = kHexChars[ ( ( (uintptr_t) src ) >> 24 ) & 0xF ];
-                       *s++ = kHexChars[ ( ( (uintptr_t) src ) >> 20 ) & 0xF ];
-                       *s++ = kHexChars[ ( ( (uintptr_t) src ) >> 16 ) & 0xF ];
-                       *s++ = kHexChars[ ( ( (uintptr_t) src ) >> 12 ) & 0xF ];
-                       *s++ = kHexChars[ ( ( (uintptr_t) src ) >>  8 ) & 0xF ];
-                       *s++ = kHexChars[ ( ( (uintptr_t) src ) >>  4 ) & 0xF ];
-                       *s++ = kHexChars[   ( (uintptr_t) src )         & 0xF ];
-                       
-                       if( !( inFlags & kDebugFlagsNoOffset ) )
-                       {
-                               *s++ = '+';
-                       }
-               }
-               if( !( inFlags & kDebugFlagsNoOffset ) )
-               {
-                       if( inFlags & kDebugFlags32BitOffset )
-                       {
-                               *s++ = kHexChars[ ( offset >> 28 ) & 0xF ];
-                               *s++ = kHexChars[ ( offset >> 24 ) & 0xF ];
-                               *s++ = kHexChars[ ( offset >> 20 ) & 0xF ];
-                               *s++ = kHexChars[ ( offset >> 16 ) & 0xF ];
-                       }
-                       *s++ = kHexChars[ ( offset >> 12 ) & 0xF ];
-                       *s++ = kHexChars[ ( offset >>  8 ) & 0xF ];
-                       *s++ = kHexChars[ ( offset >>  4 ) & 0xF ];
-                       *s++ = kHexChars[   offset         & 0xF ];
-               }
-               if( s != prefixString )
-               {
-                       *s++ = ':';
-                       *s++ = ' ';
-               }
-               check( ( (size_t)( s - prefixString ) ) < sizeof( prefixString ) );
-               *s = '\0';
-               
-               // Build a hex string with a optional spaces after every 1, 2, and/or 4 bytes to make it easier to read.
-               // Optionally pads the hex string with space to fill the full 16 byte range (so it lines up).
-               
-               s = hexString;
-               chunkSize = ( inDataSize < 16 ) ? inDataSize : 16;
-               n = ( inFlags & kDebugFlagsNo16ByteHexPad ) ? chunkSize : 16;
-               for( i = 0; i < n; ++i )
-               {
-                       if( ( inFlags & kDebugFlags8BitSeparator ) && ( i > 0 ) )
-                       {
-                               *s++ = ' ';
-                       }
-                       if( ( inFlags & kDebugFlags16BitSeparator ) && ( i > 0 ) && ( ( i % 2 ) == 0 ) )
-                       {
-                               *s++ = ' ';
-                       }
-                       if( !( inFlags & kDebugFlagsNo32BitSeparator ) && ( i > 0 ) && ( ( i % 4 ) == 0 ) )
-                       {
-                               *s++ = ' ';
-                       }
-                       if( i < chunkSize )
-                       {
-                               *s++ = kHexChars[ src[ i ] >> 4   ];
-                               *s++ = kHexChars[ src[ i ] &  0xF ];
-                       }
-                       else
-                       {
-                               *s++ = ' ';
-                               *s++ = ' ';
-                       }
-               }
-               check( ( (size_t)( s - hexString ) ) < sizeof( hexString ) );
-               *s = '\0';
-               
-               // Build a string with the ASCII version of the data (replaces non-printable characters with '^').
-               // Optionally pads the string with '`' to fill the full 16 byte range (so it lines up).
-               
-               s = asciiString;
-               if( !( inFlags & kDebugFlagsNoASCII ) )
-               {
-                       *s++ = ' ';
-                       *s++ = '|';
-                       for( i = 0; i < n; ++i )
-                       {
-                               if( i < chunkSize )
-                               {
-                                       c = src[ i ];
-                                       if( !DebugIsPrint( c ) )
-                                       {
-                                               c = '^';
-                                       }
-                               }
-                               else
-                               {
-                                       c = '`';
-                               }
-                               *s++ = (char) c;
-                       }
-                       *s++ = '|';
-                       check( ( (size_t)( s - asciiString ) ) < sizeof( asciiString ) );
-               }
-               *s = '\0';
-               
-               // Build a string indicating how bytes are in the hex dump. Only printed on the first line.
-               
-               s = byteCountString;
-               if( !( inFlags & kDebugFlagsNoByteCount ) )
-               {
-                       if( src == start )
-                       {
-                               s += DebugSNPrintF( s, sizeof( byteCountString ), " (%d bytes)", (int) inDataSize );
-                       }
-               }
-               check( ( (size_t)( s - byteCountString ) ) < sizeof( byteCountString ) );
-               *s = '\0';
-               
-               // Build the entire line from all the pieces we've previously built.
-                       
-               if( outBuffer )
-               {
-                       if( src == start )
-                       {
-                               dst += DebugSNPrintF( dst, (size_t)( end - dst ), 
-                                       "%*s"           // Indention
-                                       "%s"            // Separator (only if needed)
-                                       "%s"            // Prefix
-                                       "%-*.*s"        // Label
-                                       "%s"            // Separator
-                                       "%s"            // Hex
-                                       "%s"            // ASCII
-                                       "%s"            // Byte Count
-                                       "%s",           // Newline
-                                       inIndent, "", 
-                                       ( src != start ) ? separator : "", 
-                                       prefixString, 
-                                       width, (int) inLabelSize, inLabel ? inLabel : "", 
-                                       ( width > 0 ) ? " " : "", 
-                                       hexString, 
-                                       asciiString, 
-                                       byteCountString, 
-                                       newline );
-                       }
-                       else
-                       {
-                               dst += DebugSNPrintF( dst, (size_t)( end - dst ), 
-                                       "%*s"           // Indention
-                                       "%s"            // Separator (only if needed)
-                                       "%s"            // Prefix
-                                       "%*s"           // Label Spacing
-                                       "%s"            // Separator
-                                       "%s"            // Hex
-                                       "%s"            // ASCII
-                                       "%s"            // Byte Count
-                                       "%s",           // Newline
-                                       inIndent, "", 
-                                       ( src != start ) ? separator : "", 
-                                       prefixString, 
-                                       width, "", 
-                                       ( width > 0 ) ? " " : "", 
-                                       hexString, 
-                                       asciiString, 
-                                       byteCountString, 
-                                       newline );
-                       }
-               }
-               else
-               {
-                       if( src == start )
-                       {
-                               dst += DebugPrintF( inLevel, 
-                                       "%*s"           // Indention
-                                       "%s"            // Separator (only if needed)
-                                       "%s"            // Prefix
-                                       "%-*.*s"        // Label
-                                       "%s"            // Separator
-                                       "%s"            // Hex
-                                       "%s"            // ASCII
-                                       "%s"            // Byte Count
-                                       "%s",           // Newline
-                                       inIndent, "", 
-                                       ( src != start ) ? separator : "", 
-                                       prefixString, 
-                                       width, (int) inLabelSize, inLabel, 
-                                       ( width > 0 ) ? " " : "", 
-                                       hexString, 
-                                       asciiString, 
-                                       byteCountString, 
-                                       newline );
-                       }
-                       else
-                       {
-                               dst += DebugPrintF( inLevel, 
-                                       "%*s"           // Indention
-                                       "%s"            // Separator (only if needed)
-                                       "%s"            // Prefix
-                                       "%*s"           // Label Spacing
-                                       "%s"            // Separator
-                                       "%s"            // Hex
-                                       "%s"            // ASCII
-                                       "%s"            // Byte Count
-                                       "%s",           // Newline
-                                       inIndent, "", 
-                                       ( src != start ) ? separator : "", 
-                                       prefixString, 
-                                       width, "", 
-                                       ( width > 0 ) ? " " : "", 
-                                       hexString, 
-                                       asciiString, 
-                                       byteCountString, 
-                                       newline );
-                       }
-               }
-               
-               // Move to the next chunk. Exit if there is no more data.
-               
-               offset          += (int) chunkSize;
-               src             += chunkSize;
-               inDataSize      -= chunkSize;
-               if( inDataSize == 0 )
-               {
-                       break;
-               }
-       }
-       
-       // Note: The "dst - outBuffer" size calculation works even if "outBuffer" is NULL because it's all relative.
-       
-       return( (size_t)( dst - outBuffer ) );
-}
-
-//===========================================================================================================================
-//     DebugNumVersionToString
-//===========================================================================================================================
-
-static char *  DebugNumVersionToString( uint32_t inVersion, char *inString )
-{
-       char *          s;
-       uint8_t         majorRev;
-       uint8_t         minor;
-       uint8_t         bugFix;
-       uint8_t         stage;
-       uint8_t         revision;
-       
-       check( inString );
-       
-       majorRev        = (uint8_t)( ( inVersion >> 24 ) & 0xFF );
-       minor           = (uint8_t)( ( inVersion >> 20 ) & 0x0F );
-       bugFix          = (uint8_t)( ( inVersion >> 16 ) & 0x0F );
-       stage           = (uint8_t)( ( inVersion >>  8 ) & 0xFF );
-       revision        = (uint8_t)(   inVersion         & 0xFF );
-       
-       // Convert the major, minor, and bugfix numbers.
-       
-       s  = inString;
-       s += sprintf( s, "%u", majorRev );
-       s += sprintf( s, ".%u", minor );
-       if( bugFix != 0 )
-       {
-               s += sprintf( s, ".%u", bugFix );
-       }
-       
-       // Convert the version stage and non-release revision number.
-       
-       switch( stage )
-       {
-               case kVersionStageDevelopment:
-                       s += sprintf( s, "d%u", revision );
-                       break;
-               
-               case kVersionStageAlpha:
-                       s += sprintf( s, "a%u", revision );
-                       break;
-               
-               case kVersionStageBeta:
-                       s += sprintf( s, "b%u", revision );
-                       break;
-               
-               case kVersionStageFinal:
-                       
-                       // A non-release revision of zero is a special case indicating the software is GM (at the golden master 
-                       // stage) and therefore, the non-release revision should not be added to the string.
-                       
-                       if( revision != 0 )
-                       {
-                               s += sprintf( s, "f%u", revision );
-                       }
-                       break;
-               
-               default:
-                       dlog( kDebugLevelError, "invalid NumVersion stage (0x%02X)\n", stage );
-                       break;
-       }
-       return( inString );
-}
-
-//===========================================================================================================================
-//     DebugTaskLevel
-//===========================================================================================================================
-
-DEBUG_EXPORT uint32_t  DebugTaskLevel( void )
-{
-       uint32_t                level;
-       
-       level = 0;
-       
-#if( TARGET_OS_VXWORKS )
-       if( intContext() )
-       {
-               level |= ( ( 1 << kDebugInterruptLevelShift ) & kDebugInterruptLevelMask );
-       }
-#endif
-       
-       return( level );
-}
-
-#if( TARGET_OS_WIN32 && !TARGET_OS_WINDOWS_CE )
-//===========================================================================================================================
-//     DebugWinEnableConsole
-//===========================================================================================================================
-
-#pragma warning( disable:4311 )
-
-static void    DebugWinEnableConsole( void )
-{
-       static bool             sConsoleEnabled = false;
-       BOOL                    result;
-       int                             fileHandle;
-       FILE *                  file;
-       int                             err;
-       
-       if( sConsoleEnabled )
-       {
-               goto exit;
-       }
-       
-       // Create console window.
-       
-       result = AllocConsole();
-       require_quiet( result, exit );
-
-       // Redirect stdin to the console stdin.
-       
-       fileHandle = _open_osfhandle( (long) GetStdHandle( STD_INPUT_HANDLE ), _O_TEXT );
-       
-       #if( defined( __MWERKS__ ) )
-               file = __handle_reopen( (unsigned long) fileHandle, "r", stdin );
-               require_quiet( file, exit );
-       #else
-               file = _fdopen( fileHandle, "r" );
-               require_quiet( file, exit );
-       
-               *stdin = *file;
-       #endif
-       
-       err = setvbuf( stdin, NULL, _IONBF, 0 );
-       require_noerr_quiet( err, exit );
-       
-       // Redirect stdout to the console stdout.
-               
-       fileHandle = _open_osfhandle( (long) GetStdHandle( STD_OUTPUT_HANDLE ), _O_TEXT );
-       
-       #if( defined( __MWERKS__ ) )
-               file = __handle_reopen( (unsigned long) fileHandle, "w", stdout );
-               require_quiet( file, exit );
-       #else
-               file = _fdopen( fileHandle, "w" );
-               require_quiet( file, exit );
-               
-               *stdout = *file;
-       #endif
-       
-       err = setvbuf( stdout, NULL, _IONBF, 0 );
-       require_noerr_quiet( err, exit );
-       
-       // Redirect stderr to the console stdout.
-       
-       fileHandle = _open_osfhandle( (long) GetStdHandle( STD_OUTPUT_HANDLE ), _O_TEXT );
-       
-       #if( defined( __MWERKS__ ) )
-               file = __handle_reopen( (unsigned long) fileHandle, "w", stderr );
-               require_quiet( file, exit );
-       #else
-               file = _fdopen( fileHandle, "w" );
-               require_quiet( file, exit );
-       
-               *stderr = *file;
-       #endif
-       
-       err = setvbuf( stderr, NULL, _IONBF, 0 );
-       require_noerr_quiet( err, exit );
-       
-       sConsoleEnabled = true;
-       
-exit:
-       return;
-}
-
-#pragma warning( default:4311 )
-
-#endif // TARGET_OS_WIN32 && !TARGET_OS_WINDOWS_CE
-
-#if( TARGET_OS_WIN32 )
-//===========================================================================================================================
-//     DebugWinCharToTCharString
-//===========================================================================================================================
-
-static TCHAR *
-       DebugWinCharToTCharString( 
-               const char *    inCharString, 
-               size_t                  inCharCount, 
-               TCHAR *                 outTCharString, 
-               size_t                  inTCharCountMax, 
-               size_t *                outTCharCount )
-{
-       const char *            src;
-       TCHAR *                         dst;
-       TCHAR *                         end;
-       
-       if( inCharCount == kSizeCString )
-       {
-               inCharCount = strlen( inCharString );
-       }
-       src = inCharString;
-       dst = outTCharString;
-       if( inTCharCountMax > 0 )
-       {
-               inTCharCountMax -= 1;
-               if( inTCharCountMax > inCharCount )
-               {
-                       inTCharCountMax = inCharCount;
-               }
-               
-               end = dst + inTCharCountMax;
-               while( dst < end )
-               {
-                       *dst++ = (TCHAR) *src++;
-               }
-               *dst = 0;
-       }
-       if( outTCharCount )
-       {
-               *outTCharCount = (size_t)( dst - outTCharString );
-       }
-       return( outTCharString );
-}
-#endif
-
-#if 0
-#pragma mark -
-#pragma mark == Debugging ==
-#endif
-
-//===========================================================================================================================
-//     DebugServicesTest
-//===========================================================================================================================
-
-DEBUG_EXPORT OSStatus  DebugServicesTest( void )
-{
-       OSStatus                err;
-       char                    s[ 512 ];
-       uint8_t *               p;
-       uint8_t                 data[] = 
-       {
-               0x11, 0x22, 0x33, 0x44, 
-               0x55, 0x66, 
-               0x77, 0x88, 0x99, 0xAA, 
-               0xBB, 0xCC, 0xDD, 
-               0xEE,
-               0xFF, 
-               0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 
-               0x10, 0x20, 0x30, 0x40, 0x50, 0x60, 0x70, 0x80, 0x90, 0xA0, 
-               0x11, 0x21, 0x31, 0x41, 0x51, 0x61, 0x71, 0x81, 0x91, 0xA1 
-       };
-       
-       debug_initialize( kDebugOutputTypeMetaConsole );        
-       
-       // check's
-       
-       check( 0 && "SHOULD SEE: check" );
-       check( 1 && "SHOULD *NOT* SEE: check (valid)" );
-       check_string( 0, "SHOULD SEE: check_string" );
-       check_string( 1, "SHOULD *NOT* SEE: check_string (valid)" );
-       check_noerr( -123 );
-       check_noerr( 10038 );
-       check_noerr( 22 );
-       check_noerr( 0 );
-       check_noerr_string( -6712, "SHOULD SEE: check_noerr_string" );
-       check_noerr_string( 0, "SHOULD *NOT* SEE: check_noerr_string (valid)" );
-       check_translated_errno( 0 >= 0 && "SHOULD *NOT* SEE", -384, -999 );
-       check_translated_errno( -1 >= 0 && "SHOULD SEE", -384, -999 );
-       check_translated_errno( -1 >= 0 && "SHOULD SEE", 0, -999 );
-       check_ptr_overlap( "SHOULD *NOT* SEE" ? 10 : 0, 10, 22, 10 );
-       check_ptr_overlap( "SHOULD SEE" ? 10 : 0, 10,  5, 10 );
-       check_ptr_overlap( "SHOULD SEE" ? 10 : 0, 10, 12,  6 );
-       check_ptr_overlap( "SHOULD SEE" ? 12 : 0,  6, 10, 10 );
-       check_ptr_overlap( "SHOULD SEE" ? 12 : 0, 10, 10, 10 );
-       check_ptr_overlap( "SHOULD *NOT* SEE" ? 22 : 0, 10, 10, 10 );
-       check_ptr_overlap( "SHOULD *NOT* SEE" ? 10 : 0, 10, 20, 10 );
-       check_ptr_overlap( "SHOULD *NOT* SEE" ? 20 : 0, 10, 10, 10 );
-               
-       // require's
-       
-       require( 0 && "SHOULD SEE", require1 );
-       { err = kResponseErr; goto exit; }
-require1:
-       require( 1 && "SHOULD *NOT* SEE", require2 );
-       goto require2Good;
-require2:
-       { err = kResponseErr; goto exit; }
-require2Good:
-       require_string( 0 && "SHOULD SEE", require3, "SHOULD SEE: require_string" );
-       { err = kResponseErr; goto exit; }
-require3:
-       require_string( 1 && "SHOULD *NOT* SEE", require4, "SHOULD *NOT* SEE: require_string (valid)" );
-       goto require4Good;
-require4:
-       { err = kResponseErr; goto exit; }
-require4Good:
-       require_quiet( 0 && "SHOULD SEE", require5 );
-       { err = kResponseErr; goto exit; }
-require5:
-       require_quiet( 1 && "SHOULD *NOT* SEE", require6 );
-       goto require6Good;
-require6:
-       { err = kResponseErr; goto exit; }
-require6Good:
-       require_noerr( -1, require7 );
-       { err = kResponseErr; goto exit; }
-require7:
-       require_noerr( 0, require8 );
-       goto require8Good;
-require8:
-       { err = kResponseErr; goto exit; }
-require8Good:
-       require_noerr_string( -2, require9, "SHOULD SEE: require_noerr_string");
-       { err = kResponseErr; goto exit; }
-require9:
-       require_noerr_string( 0, require10, "SHOULD *NOT* SEE: require_noerr_string (valid)" );
-       goto require10Good;
-require10:
-       { err = kResponseErr; goto exit; }
-require10Good:
-       require_noerr_action_string( -3, require11, dlog( kDebugLevelMax, "action 1 (expected)\n" ), "require_noerr_action_string" );
-       { err = kResponseErr; goto exit; }
-require11:
-       require_noerr_action_string( 0, require12, dlog( kDebugLevelMax, "action 2\n" ), "require_noerr_action_string (valid)" );
-       goto require12Good;
-require12:
-       { err = kResponseErr; goto exit; }
-require12Good:
-       require_noerr_quiet( -4, require13 );
-       { err = kResponseErr; goto exit; }
-require13:
-       require_noerr_quiet( 0, require14 );
-       goto require14Good;
-require14:
-       { err = kResponseErr; goto exit; }
-require14Good:
-       require_noerr_action( -5, require15, dlog( kDebugLevelMax, "SHOULD SEE: action 3 (expected)\n" ) );
-       { err = kResponseErr; goto exit; }
-require15:
-       require_noerr_action( 0, require16, dlog( kDebugLevelMax, "SHOULD *NOT* SEE: action 4\n" ) );
-       goto require16Good;
-require16:
-       { err = kResponseErr; goto exit; }
-require16Good:
-       require_noerr_action_quiet( -4, require17, dlog( kDebugLevelMax, "SHOULD SEE: action 5 (expected)\n" ) );
-       { err = kResponseErr; goto exit; }
-require17:
-       require_noerr_action_quiet( 0, require18, dlog( kDebugLevelMax, "SHOULD *NOT* SEE: action 6\n" ) );
-       goto require18Good;
-require18:
-       { err = kResponseErr; goto exit; }
-require18Good:
-       require_action( 0 && "SHOULD SEE", require19, dlog( kDebugLevelMax, "SHOULD SEE: action 7 (expected)\n" ) );
-       { err = kResponseErr; goto exit; }
-require19:
-       require_action( 1 && "SHOULD *NOT* SEE", require20, dlog( kDebugLevelMax, "SHOULD *NOT* SEE: action 8\n" ) );
-       goto require20Good;
-require20:
-       { err = kResponseErr; goto exit; }
-require20Good:
-       require_action_quiet( 0, require21, dlog( kDebugLevelMax, "SHOULD SEE: action 9 (expected)\n" ) );
-       { err = kResponseErr; goto exit; }
-require21:
-       require_action_quiet( 1, require22, dlog( kDebugLevelMax, "SHOULD *NOT* SEE: action 10\n" ) );
-       goto require22Good;
-require22:
-       { err = kResponseErr; goto exit; }
-require22Good:
-       require_action_string( 0, require23, dlog( kDebugLevelMax, "SHOULD SEE: action 11 (expected)\n" ), "SHOULD SEE: require_action_string" );
-       { err = kResponseErr; goto exit; }
-require23:
-       require_action_string( 1, require24, dlog( kDebugLevelMax, "SHOULD *NOT* SEE: action 12\n" ), "SHOULD *NOT* SEE: require_action_string" );
-       goto require24Good;
-require24:
-       { err = kResponseErr; goto exit; }
-require24Good:
-
-#if( defined( __MWERKS__ )  )
-       #if( defined( __cplusplus ) && __option( exceptions ) )
-               #define COMPILER_HAS_EXCEPTIONS         1
-       #else
-               #define COMPILER_HAS_EXCEPTIONS         0
-       #endif
-#else
-       #if( defined( __cplusplus ) )
-               #define COMPILER_HAS_EXCEPTIONS         1
-       #else
-               #define COMPILER_HAS_EXCEPTIONS         0
-       #endif
-#endif
-
-#if( COMPILER_HAS_EXCEPTIONS )
-       try
-       {
-               require_throw( 1 && "SHOULD *NOT* SEE" );
-               require_throw( 0 && "SHOULD SEE" );
-       }
-       catch( ... )
-       {
-               goto require26Good;
-       }
-       { err = kResponseErr; goto exit; }
-require26Good:
-#endif
-
-       // translate_errno
-       
-       err = translate_errno( 1 != -1, -123, -567 );
-       require( ( err == 0 ) && "SHOULD *NOT* SEE", exit );
-       
-       err = translate_errno( -1 != -1, -123, -567 );
-       require( ( err == -123 ) && "SHOULD *NOT* SEE", exit );
-       
-       err = translate_errno( -1 != -1, 0, -567 );
-       require( ( err == -567 ) && "SHOULD *NOT* SEE", exit );
-
-       // debug_string
-       
-       debug_string( "debug_string" );
-       
-       // DebugSNPrintF
-       
-       DebugSNPrintF( s, sizeof( s ), "%d", 1234 );
-       require_action( strcmp( s, "1234" ) == 0, exit, err = -1 );
-       
-       DebugSNPrintF( s, sizeof( s ), "%X", 0x2345 );
-       require_action( strcmp( s, "2345" ) == 0, exit, err = -1 );
-       
-       DebugSNPrintF( s, sizeof( s ), "%#s", "\05test" );
-       require_action( strcmp( s, "test" ) == 0, exit, err = -1 );
-       
-       DebugSNPrintF( s, sizeof( s ), "%##s", "\03www\05apple\03com" );
-       require_action( strcmp( s, "www.apple.com." ) == 0, exit, err = -1 );
-       
-       DebugSNPrintF( s, sizeof( s ), "%ld", (long) INT32_C( 2147483647 ) );
-       require_action( strcmp( s, "2147483647" ) == 0, exit, err = -1 );
-       
-       DebugSNPrintF( s, sizeof( s ), "%lu", (unsigned long) UINT32_C( 4294967295 ) );
-       require_action( strcmp( s, "4294967295" ) == 0, exit, err = -1 );
-       
-       #if( TYPE_LONGLONG_NATIVE )
-               DebugSNPrintF( s, sizeof( s ), "%lld", (long_long_compat) INT64_C( 9223372036854775807 ) );
-               require_action( strcmp( s, "9223372036854775807" ) == 0, exit, err = -1 );
-               
-               DebugSNPrintF( s, sizeof( s ), "%lld", (long_long_compat) INT64_C( -9223372036854775807 ) );
-               require_action( strcmp( s, "-9223372036854775807" ) == 0, exit, err = -1 );
-               
-               DebugSNPrintF( s, sizeof( s ), "%llu", (unsigned_long_long_compat) UINT64_C( 18446744073709551615 ) );
-               require_action( strcmp( s, "18446744073709551615" ) == 0, exit, err = -1 );
-       #endif
-       
-       DebugSNPrintF( s, sizeof( s ), "%lb", (unsigned long) binary_32( 01111011, 01111011, 01111011, 01111011 ) );
-       require_action( strcmp( s, "1111011011110110111101101111011" ) == 0, exit, err = -1 );
-       
-       DebugSNPrintF( s, sizeof( s ), "%C", 0x41624364 );      // 'AbCd'
-       require_action( strcmp( s, "AbCd" ) == 0, exit, err = -1 );
-       
-       #if( defined( MDNS_DEBUGMSGS ) )
-       {
-               mDNSAddr                maddr;
-               
-               memset( &maddr, 0, sizeof( maddr ) );
-               maddr.type = mDNSAddrType_IPv4;
-               maddr.ip.v4.b[ 0 ] = 127;
-               maddr.ip.v4.b[ 1 ] = 0;
-               maddr.ip.v4.b[ 2 ] = 0;
-               maddr.ip.v4.b[ 3 ] = 1;
-               DebugSNPrintF( s, sizeof( s ), "%#a", &maddr );
-               require_action( strcmp( s, "127.0.0.1" ) == 0, exit, err = -1 );
-               
-               memset( &maddr, 0, sizeof( maddr ) );
-               maddr.type = mDNSAddrType_IPv6;
-               maddr.ip.v6.b[  0 ]     = 0xFE;
-               maddr.ip.v6.b[  1 ]     = 0x80;
-               maddr.ip.v6.b[ 15 ]     = 0x01;
-               DebugSNPrintF( s, sizeof( s ), "%#a", &maddr );
-               require_action( strcmp( s, "FE80:0000:0000:0000:0000:0000:0000:0001" ) == 0, exit, err = -1 );
-       }
-       #endif
-       
-       #if( AF_INET )
-       {
-               struct sockaddr_in              sa4;
-               
-               memset( &sa4, 0, sizeof( sa4 ) );
-               sa4.sin_family          = AF_INET;
-               p                                       = (uint8_t *) &sa4.sin_port;
-               p[ 0 ]                          = (uint8_t)( ( 80 >> 8 ) & 0xFF );
-               p[ 1 ]                          = (uint8_t)(   80        & 0xFF );
-               p                                       = (uint8_t *) &sa4.sin_addr.s_addr;
-               p[ 0 ]                          = (uint8_t)( ( INADDR_LOOPBACK >> 24 ) & 0xFF );
-               p[ 1 ]                          = (uint8_t)( ( INADDR_LOOPBACK >> 16 ) & 0xFF );
-               p[ 2 ]                          = (uint8_t)( ( INADDR_LOOPBACK >>  8 ) & 0xFF );
-               p[ 3 ]                          = (uint8_t)(   INADDR_LOOPBACK         & 0xFF );
-               DebugSNPrintF( s, sizeof( s ), "%##a", &sa4 );
-               require_action( strcmp( s, "127.0.0.1:80" ) == 0, exit, err = -1 );
-       }
-       #endif
-       
-       #if( AF_INET6 )
-       {
-               struct sockaddr_in6             sa6;
-               
-               memset( &sa6, 0, sizeof( sa6 ) );
-               sa6.sin6_family                         = AF_INET6;
-               p                                                       = (uint8_t *) &sa6.sin6_port;
-               p[ 0 ]                                          = (uint8_t)( ( 80 >> 8 ) & 0xFF );
-               p[ 1 ]                                          = (uint8_t)(   80        & 0xFF );
-               sa6.sin6_addr.s6_addr[  0 ]     = 0xFE;
-               sa6.sin6_addr.s6_addr[  1 ]     = 0x80;
-               sa6.sin6_addr.s6_addr[ 15 ]     = 0x01;
-               sa6.sin6_scope_id                       = 2;
-               DebugSNPrintF( s, sizeof( s ), "%##a", &sa6 );
-               require_action( strcmp( s, "[FE80:0000:0000:0000:0000:0000:0000:0001%2]:80" ) == 0, exit, err = -1 );
-       }
-       #endif
-       
-       // Unicode
-
-       DebugSNPrintF(s, sizeof(s), "%.*s", 4, "tes" );
-       require_action( strcmp( s, "tes" ) == 0, exit, err = kResponseErr );
-       
-       DebugSNPrintF(s, sizeof(s), "%.*s", 4, "test" );
-       require_action( strcmp( s, "test" ) == 0, exit, err = kResponseErr );
-       
-       DebugSNPrintF(s, sizeof(s), "%.*s", 4, "testing" );
-       require_action( strcmp( s, "test" ) == 0, exit, err = kResponseErr );
-       
-       DebugSNPrintF(s, sizeof(s), "%.*s", 4, "te\xC3\xA9" );
-       require_action( strcmp( s, "te\xC3\xA9" ) == 0, exit, err = kResponseErr );
-       
-       DebugSNPrintF(s, sizeof(s), "%.*s", 4, "te\xC3\xA9ing" );
-       require_action( strcmp( s, "te\xC3\xA9" ) == 0, exit, err = kResponseErr );
-       
-       DebugSNPrintF(s, sizeof(s), "%.*s", 4, "tes\xC3\xA9ing" );
-       require_action( strcmp( s, "tes" ) == 0, exit, err = kResponseErr );
-       
-       DebugSNPrintF(s, sizeof(s), "%.*s", 4, "t\xed\x9f\xbf" );
-       require_action( strcmp( s, "t\xed\x9f\xbf" ) == 0, exit, err = kResponseErr );
-       
-       DebugSNPrintF(s, sizeof(s), "%.*s", 4, "t\xed\x9f\xbfing" );
-       require_action( strcmp( s, "t\xed\x9f\xbf" ) == 0, exit, err = kResponseErr );
-       
-       DebugSNPrintF(s, sizeof(s), "%.*s", 4, "te\xed\x9f\xbf" );
-       require_action( strcmp( s, "te" ) == 0, exit, err = kResponseErr );
-       
-       DebugSNPrintF(s, sizeof(s), "%.*s", 4, "te\xed\x9f\xbfing" );
-       require_action( strcmp( s, "te" ) == 0, exit, err = kResponseErr );
-       
-       DebugSNPrintF(s, sizeof(s), "%.*s", 7, "te\xC3\xA9\xed\x9f\xbfing" );
-       require_action( strcmp( s, "te\xC3\xA9\xed\x9f\xbf" ) == 0, exit, err = kResponseErr );
-       
-       DebugSNPrintF(s, sizeof(s), "%.*s", 6, "te\xC3\xA9\xed\x9f\xbfing" );
-       require_action( strcmp( s, "te\xC3\xA9" ) == 0, exit, err = kResponseErr );
-       
-       DebugSNPrintF(s, sizeof(s), "%.*s", 5, "te\xC3\xA9\xed\x9f\xbfing" );
-       require_action( strcmp( s, "te\xC3\xA9" ) == 0, exit, err = kResponseErr );
-
-       #if( TARGET_RT_BIG_ENDIAN )
-               DebugSNPrintF( s, sizeof( s ), "%S", "\x00" "a" "\x00" "b" "\x00" "c" "\x00" "d" "\x00" "\x00" );
-               require_action( strcmp( s, "abcd" ) == 0, exit, err = -1 );
-       #else
-               DebugSNPrintF( s, sizeof( s ), "%S", "a" "\x00" "b" "\x00" "c" "\x00" "d" "\x00" "\x00" "\x00" );
-               require_action( strcmp( s, "abcd" ) == 0, exit, err = -1 );
-       #endif
-       
-       DebugSNPrintF( s, sizeof( s ), "%S", 
-               "\xFE\xFF" "\x00" "a" "\x00" "b" "\x00" "c" "\x00" "d" "\x00" "\x00" ); // Big Endian BOM
-       require_action( strcmp( s, "abcd" ) == 0, exit, err = -1 );
-       
-       DebugSNPrintF( s, sizeof( s ), "%S", 
-               "\xFF\xFE" "a" "\x00" "b" "\x00" "c" "\x00" "d" "\x00" "\x00" "\x00" ); // Little Endian BOM
-       require_action( strcmp( s, "abcd" ) == 0, exit, err = -1 );
-       
-       DebugSNPrintF( s, sizeof( s ), "%#S", "\x00" "a" "\x00" "b" "\x00" "c" "\x00" "d" "\x00" "\x00" );      // Big Endian
-       require_action( strcmp( s, "abcd" ) == 0, exit, err = -1 );
-       
-       DebugSNPrintF( s, sizeof( s ), "%##S", "a" "\x00" "b" "\x00" "c" "\x00" "d" "\x00" "\x00" "\x00" );     // Little Endian
-       require_action( strcmp( s, "abcd" ) == 0, exit, err = -1 );
-       
-       DebugSNPrintF( s, sizeof( s ), "%.*S", 
-               4, "\xFE\xFF" "\x00" "a" "\x00" "b" "\x00" "c" "\x00" "d" );    // Big Endian BOM
-       require_action( strcmp( s, "abc" ) == 0, exit, err = -1 );
-       
-       DebugSNPrintF( s, sizeof( s ), "%.*S", 
-               4, "\xFF\xFE" "a" "\x00" "b" "\x00" "c" "\x00" "d" "\x00" );    // Little Endian BOM
-       require_action( strcmp( s, "abc" ) == 0, exit, err = -1 );
-       
-       #if( TARGET_RT_BIG_ENDIAN )
-               DebugSNPrintF( s, sizeof( s ), "%.*S", 3, "\x00" "a" "\x00" "b" "\x00" "c" "\x00" "d" );
-               require_action( strcmp( s, "abc" ) == 0, exit, err = -1 );
-       #else
-               DebugSNPrintF( s, sizeof( s ), "%.*S", 3, "a" "\x00" "b" "\x00" "c" "\x00" "d" "\x00" );
-               require_action( strcmp( s, "abc" ) == 0, exit, err = -1 );
-       #endif
-       
-       DebugSNPrintF( s, sizeof( s ), "%#.*S", 3, "\x00" "a" "\x00" "b" "\x00" "c" "\x00" "d" );       // Big Endian
-       require_action( strcmp( s, "abc" ) == 0, exit, err = -1 );
-       
-       DebugSNPrintF( s, sizeof( s ), "%##.*S", 3, "a" "\x00" "b" "\x00" "c" "\x00" "d" "\x00" );      // Little Endian
-       require_action( strcmp( s, "abc" ) == 0, exit, err = -1 );
-       
-       // Misc
-       
-       DebugSNPrintF( s, sizeof( s ), "%U", "\x10\xb8\xa7\x6b" "\xad\x9d" "\xd1\x11" "\x80\xb4" "\x00\xc0\x4f\xd4\x30\xc8" );
-       require_action( strcmp( s, "6ba7b810-9dad-11d1-80b4-00c04fd430c8" ) == 0, exit, err = -1 );
-       
-       DebugSNPrintF( s, sizeof( s ), "%m", 0 );
-       require_action( strcmp( s, "no error" ) == 0, exit, err = -1 );
-       
-       DebugSNPrintF( s, sizeof( s ), "%lm", (long) 0 );
-       require_action( strcmp( s, "no error" ) == 0, exit, err = -1 );
-       
-       DebugSNPrintF( s, sizeof( s ), "\"%H\"", "\x6b\xa7\xb8\x10\x9d\xad\x11\xd1\x80\xb4\x00\xc0\x4f\xd4\x30\xc8", 16, 16 );
-       DebugPrintF( kDebugLevelMax, "%s\n\n", s );
-       
-       DebugSNPrintF( s, sizeof( s ), "\"%H\"", 
-               "\x6b\xa7\xb8\x10\x9d\xad\x11\xd1\x80\xb4\x00\xc0\x4f\xd4\x30\xc8"
-               "\x6b\xa7\xb8\x10\x9d\xad\x11\xd1\x80\xb4\x00\xc0\x4f\xd4\x30\xc8", 
-               32, 32 );
-       DebugPrintF( kDebugLevelMax, "%s\n\n", s );
-       
-       DebugSNPrintF( s, sizeof( s ), "\"%H\"", "\x6b\xa7", 2, 2 );
-       DebugPrintF( kDebugLevelMax, "%s\n\n", s );
-       
-       // Hex Dumps
-       
-       s[ 0 ] = '\0';
-       DebugHexDump( kDebugLevelMax, 0, "My Label", kSizeCString, 0, NULL, 0, data, data, sizeof( data ), 
-               kDebugFlagsNone, s, sizeof( s ) );
-       DebugPrintF( kDebugLevelMax, "%s\n", s );
-       
-       s[ 0 ] = '\0';
-       DebugHexDump( kDebugLevelMax, 0, NULL, 0, 0, NULL, 0, data, data, sizeof( data ), 
-               kDebugFlagsNoAddress | kDebugFlagsNoOffset, s, sizeof( s ) );
-       DebugPrintF( kDebugLevelMax, "%s\n", s );
-       
-       s[ 0 ] = '\0';
-       DebugHexDump( kDebugLevelMax, 0, "My Label", kSizeCString, 0, NULL, 0, data, data, sizeof( data ), 
-               kDebugFlagsNoAddress | kDebugFlagsNoOffset, s, sizeof( s ) );
-       DebugPrintF( kDebugLevelMax, "%s\n", s );
-       
-       s[ 0 ] = '\0';
-       DebugHexDump( kDebugLevelMax, 0, "My Label", kSizeCString, 0, NULL, 0, data, data, sizeof( data ), 
-               kDebugFlagsNoAddress, s, sizeof( s ) );
-       DebugPrintF( kDebugLevelMax, "%s\n", s );
-       
-       s[ 0 ] = '\0';
-       DebugHexDump( kDebugLevelMax, 0, NULL, 0, 0, NULL, 0, data, data, sizeof( data ), 
-               kDebugFlagsNoOffset, s, sizeof( s ) );
-       DebugPrintF( kDebugLevelMax, "%s\n", s );
-       
-       s[ 0 ] = '\0';
-       DebugHexDump( kDebugLevelMax, 0, NULL, 0, 0, NULL, 0, data, data, sizeof( data ), 
-               kDebugFlagsNoAddress, s, sizeof( s ) );
-       DebugPrintF( kDebugLevelMax, "%s\n", s );
-       
-       s[ 0 ] = '\0';
-       DebugHexDump( kDebugLevelMax, 0, NULL, 0, 0, NULL, 0, data, data, sizeof( data ), 
-               kDebugFlagsNoOffset, s, sizeof( s ) );
-       DebugPrintF( kDebugLevelMax, "%s\n", s );
-       
-       s[ 0 ] = '\0';
-       DebugHexDump( kDebugLevelMax, 0, NULL, 0, 0, NULL, 0, data, data, sizeof( data ), 
-               kDebugFlagsNoByteCount, s, sizeof( s ) );
-       DebugPrintF( kDebugLevelMax, "%s\n", s );
-       
-       s[ 0 ] = '\0';
-       DebugHexDump( kDebugLevelMax, 0, NULL, 0, 0, NULL, 0, "\x41\x62\x43\x64", "\x41\x62\x43\x64", 4,        // 'AbCd'
-               kDebugFlagsNoAddress | kDebugFlagsNoOffset | kDebugFlagsNoNewLine |
-               kDebugFlagsNo32BitSeparator | kDebugFlagsNo16ByteHexPad | kDebugFlagsNoByteCount, 
-               s, sizeof( s ) );
-       DebugPrintF( kDebugLevelMax, "%s\n", s );
-       
-       s[ 0 ] = '\0';
-       DebugHexDump( kDebugLevelMax, 0, NULL, 0, 0, NULL, 0, data, data, sizeof( data ), 
-               kDebugFlagsNoAddress | kDebugFlagsNoOffset | kDebugFlagsNoASCII | kDebugFlagsNoNewLine |
-               kDebugFlags16BitSeparator | kDebugFlagsNo32BitSeparator |
-               kDebugFlagsNo16ByteHexPad | kDebugFlagsNoByteCount, s, sizeof( s ) );
-       DebugPrintF( kDebugLevelMax, "%s\n", s );
-       
-       s[ 0 ] = '\0';
-       DebugHexDump( kDebugLevelMax, 8, NULL, 0, 0, NULL, 0, data, data, sizeof( data ), kDebugFlagsNone, s, sizeof( s ) );
-       DebugPrintF( kDebugLevelMax, "%s\n", s );
-       
-       // dlog's
-       
-       dlog( kDebugLevelNotice, "dlog\n" );
-       dlog( kDebugLevelNotice, "dlog integer: %d\n", 123 );
-       dlog( kDebugLevelNotice, "dlog string:  \"%s\"\n", "test string" );
-       dlogmem( kDebugLevelNotice, data, sizeof( data ) );
-       
-       // Done
-       
-       DebugPrintF( kDebugLevelMax, "\n\nALL TESTS DONE\n\n" );
-       err = kNoErr;
-       
-exit:
-       if( err )
-       {
-               DebugPrintF( kDebugLevelMax, "\n\n### TEST FAILED ###\n\n" );
-       }
-       return( err );
-}
-
-#endif // DEBUG
diff --git a/mDNSShared/DebugServices.h b/mDNSShared/DebugServices.h
deleted file mode 100644 (file)
index 7111fa2..0000000
+++ /dev/null
@@ -1,1628 +0,0 @@
-/* -*- Mode: C; tab-width: 4 -*-
- *
- * Copyright (c) 1997-2004 Apple Computer, Inc. All rights reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * 
- *     http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
-
-    Change History (most recent first):
-    
-$Log: DebugServices.h,v $
-Revision 1.5  2006/08/14 23:24:56  cheshire
-Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
-
-Revision 1.4  2004/04/15 08:59:08  bradley
-Removed deprecated debug and log levels and replaced them with modern equivalents.
-
-Revision 1.3  2004/04/08 09:29:55  bradley
-Manually do host->network byte order conversion to avoid needing libraries for htons/htonl. Changed
-hex dumps to better separate hex and ASCII. Added support for %.8a syntax in DebugSNPrintF for Fibre
-Channel addresses (00:11:22:33:44:55:66:77). Fixed a few places where HeaderDoc was incorrect.
-
-Revision 1.2  2004/03/07 05:59:34  bradley
-Sync'd with internal version: Added expect macros, error codes, and CoreServices exclusion.
-
-Revision 1.1  2004/01/30 02:27:30  bradley
-Debugging support for various platforms.
-
-*/
-
-//---------------------------------------------------------------------------------------------------------------------------
-/*!    @header         DebugServices
-
-       Debugging Library
-*/
-
-#ifndef        __DEBUG_SERVICES__
-#define        __DEBUG_SERVICES__
-
-#include       <stdarg.h>
-
-#include       "CommonServices.h"
-
-#if( TARGET_OS_VXWORKS )
-       #include        "logLib.h"
-#endif
-
-#if 0
-#pragma mark == Settings ==
-#endif
-
-//===========================================================================================================================
-//     Settings
-//===========================================================================================================================
-
-// General
-
-#if( !defined( DEBUG ) )
-       #define DEBUG           0
-#endif
-
-#if( defined( NDEBUG ) && DEBUG )
-       #error NDEBUG defined and DEBUG is also enabled...they need to be in-sync
-#endif
-       
-// AssertMacros.h/Debugging.h overrides.
-
-#if( !defined( DEBUG_OVERRIDE_APPLE_MACROS ) )
-       #define DEBUG_OVERRIDE_APPLE_MACROS             1
-#endif
-
-// Routine name. Uses ISO __func__ where possible. Otherwise, uses the best thing that is available (if anything).
-
-#if( defined( __MWERKS__ ) || ( __GNUC__ > 2 ) || ( ( __GNUC__ == 2 ) && ( __GNUC_MINOR__ >= 9 ) ) )
-       #define __ROUTINE__                                     __func__
-#elif( defined( __GNUC__ ) )
-       #define __ROUTINE__                                     __PRETTY_FUNCTION__
-#elif( defined( _MSC_VER ) && !defined( _WIN32_WCE ) )
-       #define __ROUTINE__                                     __FUNCTION__
-#else
-       #define __ROUTINE__                                     ""
-#endif
-
-// Variable argument macro support. Use ANSI C99 __VA_ARGS__ where possible. Otherwise, use the next best thing.
-
-#if( defined( __GNUC__ ) )
-       #if( ( __GNUC__ > 3 ) || ( ( __GNUC__ == 3 ) && ( __GNUC_MINOR__ >= 3) ) )
-               #define DEBUG_C99_VA_ARGS               1
-               #define DEBUG_GNU_VA_ARGS               0
-       #else
-               #define DEBUG_C99_VA_ARGS               0
-               #define DEBUG_GNU_VA_ARGS               1
-       #endif
-#elif( defined( __MWERKS__ ) )
-       #define DEBUG_C99_VA_ARGS                       1
-       #define DEBUG_GNU_VA_ARGS                       0
-#else
-       #define DEBUG_C99_VA_ARGS                       0
-       #define DEBUG_GNU_VA_ARGS                       0
-#endif
-
-#if 0
-#pragma mark == Output ==
-#endif
-
-//---------------------------------------------------------------------------------------------------------------------------
-/*!    @defined        DEBUG_FPRINTF_ENABLED
-       
-       @abstract       Enables ANSI C fprintf output.
-*/
-
-#if( !defined( DEBUG_FPRINTF_ENABLED ) )
-       #if( !TARGET_API_MAC_OSX_KERNEL && !TARGET_OS_WINDOWS_CE )
-               #define DEBUG_FPRINTF_ENABLED                   1
-       #else
-               #define DEBUG_FPRINTF_ENABLED                   0
-       #endif
-#else
-       #if( TARGET_API_MAC_OSX_KERNEL || TARGET_OS_WINDOWS_CE )
-               #error fprintf enabled, but not supported on Mac OS X kernel or Windows CE
-       #endif
-#endif
-
-//---------------------------------------------------------------------------------------------------------------------------
-/*!    @defined        DEBUG_MAC_OS_X_IOLOG_ENABLED
-       
-       @abstract       Enables IOLog (Mac OS X Kernel) output.
-*/
-
-#if( !defined( DEBUG_MAC_OS_X_IOLOG_ENABLED ) )
-       #define DEBUG_MAC_OS_X_IOLOG_ENABLED            TARGET_API_MAC_OSX_KERNEL
-#endif
-
-//---------------------------------------------------------------------------------------------------------------------------
-/*!    @defined        DEBUG_KPRINTF_ENABLED
-       
-       @abstract       Enables kprintf (Mac OS X Kernel) output.
-*/
-
-#if( !defined( DEBUG_KPRINTF_ENABLED ) )
-       #define DEBUG_KPRINTF_ENABLED                           TARGET_API_MAC_OSX_KERNEL
-#endif
-
-//---------------------------------------------------------------------------------------------------------------------------
-/*!    @defined        DEBUG_IDEBUG_ENABLED
-       
-       @abstract       Enables iDebug (Mac OS X user and Kernel) output.
-       
-       @discussion
-       
-       For Mac OS X kernel development, iDebug is enabled by default because we can dynamically check for the presence 
-       of iDebug via some exported IOKit symbols. Mac OS X app usage doesn't allow dynamic detection because it relies
-       on statically linking to the iDebugServices.cp file so for Mac OS X app usage, you have to manually enable iDebug.
-*/
-
-#if( !defined( DEBUG_IDEBUG_ENABLED ) )
-       #define DEBUG_IDEBUG_ENABLED                            TARGET_API_MAC_OSX_KERNEL
-#endif
-
-//---------------------------------------------------------------------------------------------------------------------------
-/*!    @defined        DEBUG_CORE_SERVICE_ASSERTS_ENABLED
-       
-       @abstract       Controls whether Core Services assert handling is enabled. Enabling requires CoreServices framework.
-*/
-
-#if( !defined( DEBUG_CORE_SERVICE_ASSERTS_ENABLED ) )
-       #if( defined( __DEBUGGING__ ) )
-               #define DEBUG_CORE_SERVICE_ASSERTS_ENABLED              1
-       #else
-               #define DEBUG_CORE_SERVICE_ASSERTS_ENABLED              0
-       #endif
-#endif
-
-//---------------------------------------------------------------------------------------------------------------------------
-/*!    @typedef        DebugOutputType
-       
-       @abstract       Type of debug output (i.e. where the output goes).
-*/
-
-typedef uint32_t                       DebugOutputType;
-
-#define kDebugOutputTypeNone                           0x6E6F6E65U     // 'none' - no params
-#define kDebugOutputTypeCustom                         0x63757374U     // 'cust' - 1st param = function ptr, 2nd param = context
-#define kDebugOutputTypeFPrintF                                0x66707269U     // 'fpri' - 1st param = DebugOutputTypeFlags [, 2nd param = filename]
-#define kDebugOutputTypeiDebug                         0x69646267U     // 'idbg' - no params
-#define kDebugOutputTypeKPrintF                                0x6B707266U     // 'kprf' - no params
-#define kDebugOutputTypeMacOSXIOLog                    0x696C6F67U     // 'ilog' - no params 
-#define kDebugOutputTypeMacOSXLog                      0x786C6F67U     // 'xlog' - no params
-#define kDebugOutputTypeWindowsDebugger                0x77696E64U     // 'wind' - no params
-#define kDebugOutputTypeWindowsEventLog                0x7765766CU     // 'wevl' - 1st param = C-string name, 2nd param = HMODULE or NULL.
-
-// Console meta output kind - Any kind of Console output (in horizontal order of preference):
-// 
-// Mac OS X                    = ANSI printf (viewable in Console.app)
-// Mac OS X Kernel     = IOLog (/var/log/system.log) or kprintf (serial).
-// Windows                     = ANSI printf (Console window) or OutputDebugString (debugger).
-// Other                       = ANSI printf (viewer varies).
-
-#define kDebugOutputTypeMetaConsole                    0x434F4E53U     // 'CONS' - no params
-
-//---------------------------------------------------------------------------------------------------------------------------
-/*!    @typedef        DebugOutputTypeFlags
-       
-       @abstract       Flags controlling how the output type is configured.
-       
-       @constant       kDebugOutputTypeFlagsTypeMask   Bit mask for the output type (e.g. stdout, stderr, file, etc.).
-       @constant       kDebugOutputTypeFlagsStdOut             fprintf should go to stdout.
-       @constant       kDebugOutputTypeFlagsStdErr             fprintf should go to stderr.
-       @constant       kDebugOutputTypeFlagsFile               fprintf should go to a specific file (filename passed as va_arg).
-*/
-
-typedef unsigned int           DebugOutputTypeFlags;
-
-#define        kDebugOutputTypeFlagsTypeMask   0xF
-#define        kDebugOutputTypeFlagsStdOut             1
-#define        kDebugOutputTypeFlagsStdErr             2
-#define        kDebugOutputTypeFlagsFile               10
-
-//---------------------------------------------------------------------------------------------------------------------------
-/*!    @typedef        DebugOutputFunctionPtr
-       
-       @abstract       Function ptr for a custom callback to print debug output.
-*/
-
-typedef void ( *DebugOutputFunctionPtr )( char *inData, size_t inSize, void *inContext );
-
-//===========================================================================================================================
-//     Constants
-//===========================================================================================================================
-
-#if 0
-#pragma mark == Flags ==
-#endif
-
-//---------------------------------------------------------------------------------------------------------------------------
-/*!    @typedef        DebugFlags
-       
-       @abstract       Flags controlling how output is printed.
-*/
-
-typedef uint32_t               DebugFlags;
-
-#define        kDebugFlagsNone                                 0
-#define        kDebugFlagsNoAddress                    ( 1 << 0 )
-#define        kDebugFlagsNoOffset                             ( 1 << 1 )
-#define        kDebugFlags32BitOffset                  ( 1 << 2 )
-#define        kDebugFlagsNoASCII                              ( 1 << 3 )
-#define        kDebugFlagsNoNewLine                    ( 1 << 4 )
-#define        kDebugFlags8BitSeparator                ( 1 << 5 )
-#define        kDebugFlags16BitSeparator               ( 1 << 6 )
-#define        kDebugFlagsNo32BitSeparator             ( 1 << 7 )
-#define        kDebugFlagsNo16ByteHexPad               ( 1 << 8 )
-#define        kDebugFlagsNoByteCount                  ( 1 << 9 )
-
-//---------------------------------------------------------------------------------------------------------------------------
-/*!    @enum           DebugTaskLevelFlags
-       
-       @abstract       Flags indicating the task level.
-*/
-
-enum
-{
-       kDebugInterruptLevelShift                               = 0, 
-       kDebugInterruptLevelMask                                = 0x00000007,
-       kDebugInVBLTaskMask                                             = 0x00000010,
-       kDebugInDeferredTaskMask                                = 0x00000020,
-    kDebugInSecondaryInterruptHandlerMask      = 0x00000040, 
-       kDebugPageFaultFatalMask                                = 0x00000100,   // There should be a "kPageFaultFatalMask" in Debugging.h.
-       kDebugMPTaskLevelMask                                   = 0x00000200,   // There should be a "kMPTaskLevelMask" in Debugging.h.
-       kDebugInterruptDepthShift                               = 16, 
-       kDebugInterruptDepthMask                                = 0x00FF0000
-};
-
-#define        DebugExtractTaskLevelInterruptLevel( LEVEL )    \
-       ( ( ( LEVEL ) & kDebugInterruptLevelMask ) >> kDebugInterruptLevelShift )
-       
-#define        DebugExtractTaskLevelInterruptDepth( LEVEL )    \
-       ( ( ( LEVEL ) & kDebugInterruptDepthMask ) >> kDebugInterruptDepthShift )
-
-#if 0
-#pragma mark == Levels ==
-#endif
-
-//===========================================================================================================================
-//     Constants & Types - Levels
-//===========================================================================================================================
-
-//---------------------------------------------------------------------------------------------------------------------------
-/*!    @typedef        DebugLevel
-       
-       @abstract       Level used to control debug logging.
-*/
-
-typedef int32_t                        DebugLevel;
-
-// Levels
-
-#define kDebugLevelMask                                        0x0000FFFF
-#define kDebugLevelChatty                              100
-#define kDebugLevelVerbose                             500
-#define kDebugLevelTrace                               800
-#define kDebugLevelInfo                                1000
-#define kDebugLevelNotice                              3000
-#define kDebugLevelWarning                             5000
-#define kDebugLevelAssert                              6000
-#define kDebugLevelRequire                             7000
-#define kDebugLevelError                               8000
-#define kDebugLevelCritical                            9000
-#define kDebugLevelAlert                               10000
-#define kDebugLevelEmergency                   11000
-#define kDebugLevelTragic                              12000
-#define kDebugLevelMax                                 0x0000FFFF
-
-// Level Flags
-       
-#define kDebugLevelFlagMask                            0xFFFF0000
-#define kDebugLevelFlagStackTrace              0x00010000
-#define kDebugLevelFlagDebugBreak              0x00020000
-
-//---------------------------------------------------------------------------------------------------------------------------
-/*!    @typedef        LogLevel
-       
-       @abstract       Level used to control which events are logged.
-*/
-
-typedef int32_t                                                LogLevel;
-
-#define        kLogLevelUninitialized          -1L
-#define kLogLevelAll                           0L
-#define kLogLevelChatty                                100L
-#define kLogLevelVerbose                       500L
-#define kLogLevelTrace                                 800L
-#define kLogLevelInfo                          1000L
-#define kLogLevelNotice                                3000L
-#define kLogLevelWarning                       4000L
-#define kLogLevelAssert                        6000L
-#define kLogLevelRequire                       7000L
-#define kLogLevelError                         8000L
-#define kLogLevelCritical                      9000L
-#define kLogLevelAlert                         10000L
-#define kLogLevelEmergency                     11000L
-#define kLogLevelTragic                                12000L
-#define kLogLevelOff                           0x0000FFFEL
-
-#if 0
-#pragma mark == Properties ==
-#endif
-
-//---------------------------------------------------------------------------------------------------------------------------
-/*!    @typedef        DebugPropertyTag
-       
-       @abstract       Tag for properties.
-*/
-
-typedef uint32_t               DebugPropertyTag;
-
-#define        kDebugPropertyTagPrintLevelMin          0x6D696E70U             // 'minp'       Get: 1st param = DebugLevel *
-                                                                                                                       //                      Set: 1st param = DebugLevel
-
-#define        kDebugPropertyTagPrintLevel                     kDebugPropertyTagPrintLevelMin
-
-#define        kDebugPropertyTagPrintLevelMax          0x706D786CU             // 'maxp'       Get: 1st param = DebugLevel *
-                                                                                                                       //                      Set: 1st param = DebugLevel
-
-#define        kDebugPropertyTagBreakLevel                     0x62726B6CU             // 'brkl'       Get: 1st param = DebugLevel *
-                                                                                                                       //                      Set: 1st param = DebugLevel
-#if 0
-#pragma mark == General macros ==
-#endif
-
-//---------------------------------------------------------------------------------------------------------------------------
-/*!    @defined        DEBUG_UNUSED
-       
-       @abstract       Macro to mark a paramter as unused to avoid unused parameter warnings.
-       
-       @discussion     
-       
-       There is no universally supported pragma/attribute for indicating a variable is unused. DEBUG_UNUSED lets us
-       indicate a variable is unused in a manner that is supported by most compilers.
-*/
-
-#define        DEBUG_UNUSED( X )                       (void)( X )
-
-//---------------------------------------------------------------------------------------------------------------------------
-/*!    @defined        DEBUG_USE_ONLY
-       
-       @abstract       Macro to mark a variable as used only when debugging is enabled.
-       
-       @discussion     
-       
-       Variables are sometimes needed only for debugging. When debugging is turned off, these debug-only variables generate 
-       compiler warnings about unused variables. To eliminate these warnings, use these macros to indicate variables that 
-       are only used for debugging.
-*/
-
-#if( DEBUG )
-       #define DEBUG_USE_ONLY( X )
-#else
-       #define DEBUG_USE_ONLY( X )             (void)( X )
-#endif
-
-//---------------------------------------------------------------------------------------------------------------------------
-/*!    @defined        DEBUG_LOCAL
-       
-       @abstract       Macros to make variables and functions static when debugging is off, but extern when debugging is on.
-       
-       @discussion     
-       
-       Rather than using "static" directly, using this macros allows you to access these variables external while 
-       debugging without being penalized for production builds.
-*/
-
-#if( DEBUG )
-       #define DEBUG_LOCAL
-#else
-       #define DEBUG_LOCAL                     static
-#endif
-
-//---------------------------------------------------------------------------------------------------------------------------
-/*!    @defined        DEBUG_STATIC
-       
-       @abstract       Macros to make variables and functions static when debugging is off, but extern when debugging is on.
-       
-       @discussion     
-       
-       Rather than using "static" directly, using this macros allows you to access these variables external while 
-       debugging without being penalized for production builds.
-*/
-
-#if( DEBUG )
-       #define DEBUG_STATIC
-#else
-       #define DEBUG_STATIC    static
-#endif
-
-//---------------------------------------------------------------------------------------------------------------------------
-/*!    @defined        DEBUG_EXPORT
-       
-       @abstract       Macros to export variables.
-       
-       @discussion     
-       
-       "__private_extern__" is a hack for IOKit to allow symbols to be exported from compilation units, but 
-       // not exported outside a driver (IOKit uses a lame global namespace for symbols). This still does not 
-       // solve the problem of multiple drivers in the same dependency chain since they share symbols.
-*/
-
-#if( TARGET_API_MAC_OSX_KERNEL )
-       #define DEBUG_EXPORT            __private_extern__
-#else
-       #define DEBUG_EXPORT            extern
-#endif
-
-//---------------------------------------------------------------------------------------------------------------------------
-/*!    @defined        debug_add
-       
-       @abstract       Macro to add (or subtract if negative) a value when debugging is on. Does nothing if debugging is off.
-*/
-
-#if( DEBUG )
-       #define debug_add( A, B )               ( A ) += ( B )
-#else
-       #define debug_add( A, B )
-#endif
-
-//---------------------------------------------------------------------------------------------------------------------------
-/*!    @defined        debug_perform
-       
-       @abstract       Macro to perform something in debug-only builds.
-*/
-
-#if( DEBUG )
-       #define debug_perform( X )              do { X; } while( 0 )
-#else
-       #define debug_perform( X )
-#endif
-
-//---------------------------------------------------------------------------------------------------------------------------
-/*!    @function       translate_errno
-
-       @abstract       Returns 0 if the test success. If the test fails, returns errno if non-zero and othewise the alternate error.
-*/
-
-#define translate_errno( TEST, ERRNO, ALTERNATE_ERROR )                ( ( TEST ) ? 0 : ( ERRNO ) ? ( ERRNO ) : ( ALTERNATE_ERROR ) )
-
-#if 0
-#pragma mark == Compile Time macros ==
-#endif
-
-//---------------------------------------------------------------------------------------------------------------------------
-/*!    @defined        check_compile_time
-       
-       @abstract       Performs a compile-time check of something such as the size of an int.
-       
-       @discussion     
-       
-       This declares an array with a size that is determined by a compile-time expression. If the expression evaluates 
-       to 0, the array has a size of -1, which is illegal and generates a compile-time error.
-       
-       For example:
-       
-       check_compile_time( sizeof( int ) == 4 );
-       
-       Note: This only works with compile-time expressions.
-       Note: This only works in places where extern declarations are allowed (e.g. global scope).
-       
-       References:
-       
-       <http://www.jaggersoft.com/pubs/CVu11_3.html>
-       <http://www.jaggersoft.com/pubs/CVu11_5.html>
-       
-       Note: The following macros differ from the macros on the www.jaggersoft.com web site because those versions do not
-       work with GCC due to GCC allow a zero-length array. Using a -1 condition turned out to be more portable.
-*/
-
-#define        check_compile_time( X )         extern int debug_compile_time_name[ ( X ) ? 1 : -1 ]
-
-//---------------------------------------------------------------------------------------------------------------------------
-/*!    @defined        check_compile_time_code
-       
-       @abstract       Perform a compile-time check, suitable for placement in code, of something such as the size of an int.
-       
-       @discussion     
-       
-       This creates a switch statement with an existing case for 0 and an additional case using the result of a 
-       compile-time expression. A switch statement cannot have two case labels with the same constant so if the
-       compile-time expression evaluates to 0, it is illegal and generates a compile-time error. If the compile-time
-       expression does not evaluate to 0, the resulting value is used as the case label and it compiles without error.
-
-       For example:
-       
-       check_compile_time_code( sizeof( int ) == 4 );
-       
-       Note: This only works with compile-time expressions.
-       Note: This does not work in a global scope so it must be inside a function.
-       
-       References:
-       
-       <http://www.jaggersoft.com/pubs/CVu11_3.html>
-       <http://www.jaggersoft.com/pubs/CVu11_5.html>
-*/
-
-#define        check_compile_time_code( X )    switch( 0 ) { case 0: case X:; }
-
-#if 0
-#pragma mark == check macros ==
-#endif
-
-//---------------------------------------------------------------------------------------------------------------------------
-/*!    @defined        check
-       
-       @abstract       Check that an expression is true (non-zero).
-       
-       @discussion     
-       
-       If expression evalulates to false, this prints debugging information (actual expression string, file, line number, 
-       function name, etc.) using the default debugging output method.
-                               
-       Code inside check() statements is not compiled into production builds. 
-*/
-
-#if( DEBUG_OVERRIDE_APPLE_MACROS )
-       #undef check
-#endif
-#if( !defined( check ) )
-       #if( DEBUG )
-               #define check( X )                                                                                                                                                                      \
-                       do                                                                                                                                                                                              \
-                       {                                                                                                                                                                                               \
-                               if( !( X ) )                                                                                                                                                            \
-                               {                                                                                                                                                                                       \
-                                       debug_print_assert( 0, #X, NULL, __FILE__, __LINE__, __ROUTINE__ );                                             \
-                               }                                                                                                                                                                                       \
-                       } while( 0 )
-       #else
-               #define check( X )
-       #endif
-#endif
-
-//---------------------------------------------------------------------------------------------------------------------------
-/*!    @defined        check_string
-       
-       @abstract       Check that an expression is true (non-zero) with an explanation.
-       
-       @discussion     
-       
-       If expression evalulates to false, this prints debugging information (actual expression string, file, line number, 
-       function name, etc.) and a custom explanation string using the default debugging output method.
-                               
-       Code inside check_string() statements is not compiled into production builds. 
-*/
-
-#if( DEBUG_OVERRIDE_APPLE_MACROS )
-       #undef check_string
-#endif
-#if( !defined( check_string ) )
-       #if( DEBUG )
-               #define check_string( X, STR )                                                                                                                                          \
-                       do                                                                                                                                                                                              \
-                       {                                                                                                                                                                                               \
-                               if( !( X ) )                                                                                                                                                            \
-                               {                                                                                                                                                                                       \
-                                       debug_print_assert( 0, #X, STR, __FILE__, __LINE__, __ROUTINE__ );                                              \
-                               }                                                                                                                                                                                       \
-                                                                                                                                                                                                                       \
-                       }       while( 0 )
-       #else
-               #define check_string( X, STR )
-       #endif
-#endif
-
-//---------------------------------------------------------------------------------------------------------------------------
-/*!    @defined        check_noerr
-       
-       @abstract       Check that an error code is noErr (0).
-       
-       @discussion     
-       
-       If the error code is non-0, this prints debugging information (actual expression string, file, line number, 
-       function name, etc.) using the default debugging output method.
-                               
-       Code inside check_noerr() statements is not compiled into production builds. 
-*/
-
-#if( DEBUG_OVERRIDE_APPLE_MACROS )
-       #undef check_noerr
-#endif
-#if( !defined( check_noerr ) )
-       #if( DEBUG )
-               #define check_noerr( ERR )                                                                                                                                                      \
-                       do                                                                                                                                                                                              \
-                       {                                                                                                                                                                                               \
-                               int_least32_t           localErr;                                                                                                                               \
-                                                                                                                                                                                                                       \
-                               localErr = (int_least32_t)( ERR );                                                                                                                      \
-                               if( localErr != 0 )                                                                                                                                             \
-                               {                                                                                                                                                                                       \
-                                       debug_print_assert( localErr, NULL, NULL, __FILE__, __LINE__, __ROUTINE__ );                    \
-                               }                                                                                                                                                                                       \
-                                                                                                                                                                                                                       \
-                       }       while( 0 )
-       #else
-               #define check_noerr( ERR )
-       #endif
-#endif
-
-//---------------------------------------------------------------------------------------------------------------------------
-/*!    @defined        check_noerr_string
-       
-       @abstract       Check that an error code is noErr (0) with an explanation.
-       
-       @discussion     
-       
-       If the error code is non-0, this prints debugging information (actual expression string, file, line number, 
-       function name, etc.) and a custom explanation string using the default debugging output method.
-                               
-       Code inside check_noerr_string() statements is not compiled into production builds. 
-*/
-
-#if( DEBUG_OVERRIDE_APPLE_MACROS )
-       #undef check_noerr_string
-#endif
-#if( !defined( check_noerr_string ) )
-       #if( DEBUG )
-               #define check_noerr_string( ERR, STR )                                                                                                                          \
-                       do                                                                                                                                                                                              \
-                       {                                                                                                                                                                                               \
-                               int_least32_t           localErr;                                                                                                                               \
-                                                                                                                                                                                                                       \
-                               localErr = (int_least32_t)( ERR );                                                                                                                      \
-                               if( localErr != 0 )                                                                                                                                             \
-                               {                                                                                                                                                                                       \
-                                       debug_print_assert( localErr, NULL, STR, __FILE__, __LINE__, __ROUTINE__ );                             \
-                               }                                                                                                                                                                                       \
-                                                                                                                                                                                                                       \
-                       }       while( 0 )
-       #else
-               #define check_noerr_string( ERR, STR )
-       #endif
-#endif
-
-//---------------------------------------------------------------------------------------------------------------------------
-/*!    @defined        check_translated_errno
-       
-       @abstract       Check a condition and prints errno (if non-zero) to the log.
-       
-       @discussion     
-       
-       Code inside check_translated_errno() statements is not compiled into production builds.
-*/
-
-#if( !defined( check_translated_errno ) )
-       #if( DEBUG )
-               #define check_translated_errno( TEST, ERRNO, ALTERNATE_ERROR )                                                                          \
-                       do                                                                                                                                                                                              \
-                       {                                                                                                                                                                                               \
-                               if( !( TEST ) )                                                                                                                                                         \
-                               {                                                                                                                                                                                       \
-                                       int_least32_t           localErr;                                                                                                                       \
-                                                                                                                                                                                                                       \
-                                       localErr = (int_least32_t)( ERRNO );                                                                                                    \
-                                       localErr = ( localErr != 0 ) ? localErr : (int_least32_t)( ALTERNATE_ERROR );                   \
-                                       debug_print_assert( localErr, #TEST, NULL, __FILE__, __LINE__, __ROUTINE__ );                   \
-                               }                                                                                                                                                                                       \
-                                                                                                                                                                                                                       \
-                       }       while( 0 )
-       #else
-               #define check_translated_errno( TEST, ERRNO, ALTERNATE_ERROR )
-       #endif
-#endif
-
-//---------------------------------------------------------------------------------------------------------------------------
-/*!    @defined        check_ptr_overlap
-       
-       @abstract       Checks that two ptrs do not overlap.
-*/
-
-#define        check_ptr_overlap( P1, P1_SIZE, P2, P2_SIZE )                                                                           \
-       do                                                                                                                                                                              \
-       {                                                                                                                                                                               \
-               check( !( ( (uintptr_t)( P1 ) >=     (uintptr_t)( P2 ) ) &&                                             \
-                                 ( (uintptr_t)( P1 ) <  ( ( (uintptr_t)( P2 ) ) + ( P2_SIZE ) ) ) ) );         \
-               check( !( ( (uintptr_t)( P2 ) >=     (uintptr_t)( P1 ) ) &&                                             \
-                                 ( (uintptr_t)( P2 ) <  ( ( (uintptr_t)( P1 ) ) + ( P1_SIZE ) ) ) ) );         \
-                                                                                                                                                                                       \
-       }       while( 0 )
-
-#if 0
-#pragma mark == require macros ==
-#endif
-
-//---------------------------------------------------------------------------------------------------------------------------
-/*!    @defined        require
-       
-       @abstract       Requires that an expression evaluate to true.
-       
-       @discussion     
-       
-       If expression evalulates to false, this prints debugging information (actual expression string, file, line number, 
-       function name, etc.) using the default debugging output method then jumps to a label.
-*/
-
-#if( DEBUG_OVERRIDE_APPLE_MACROS )
-       #undef require
-#endif
-#if( !defined( require ) )
-       #define require( X, LABEL )                                                                                                                                                             \
-               do                                                                                                                                                                                                      \
-               {                                                                                                                                                                                                       \
-                       if( !( X ) )                                                                                                                                                                    \
-                       {                                                                                                                                                                                               \
-                               debug_print_assert( 0, #X, NULL, __FILE__, __LINE__, __ROUTINE__ );                                                     \
-                               goto LABEL;                                                                                                                                                                     \
-                       }                                                                                                                                                                                               \
-                                                                                                                                                                                                                       \
-               }       while( 0 )
-#endif
-
-//---------------------------------------------------------------------------------------------------------------------------
-/*!    @defined        require_string
-       
-       @abstract       Requires that an expression evaluate to true with an explanation.
-       
-       @discussion     
-       
-       If expression evalulates to false, this prints debugging information (actual expression string, file, line number, 
-       function name, etc.) and a custom explanation string using the default debugging output method then jumps to a label.
-*/
-
-#if( DEBUG_OVERRIDE_APPLE_MACROS )
-       #undef require_string
-#endif
-#if( !defined( require_string ) )
-       #define require_string( X, LABEL, STR )                                                                                                                                 \
-               do                                                                                                                                                                                                      \
-               {                                                                                                                                                                                                       \
-                       if( !( X ) )                                                                                                                                                                    \
-                       {                                                                                                                                                                                               \
-                               debug_print_assert( 0, #X, STR, __FILE__, __LINE__, __ROUTINE__ );                                                      \
-                               goto LABEL;                                                                                                                                                                     \
-                       }                                                                                                                                                                                               \
-                                                                                                                                                                                                                       \
-               }       while( 0 )
-#endif
-
-//---------------------------------------------------------------------------------------------------------------------------
-/*!    @defined        require_quiet
-       
-       @abstract       Requires that an expression evaluate to true.
-       
-       @discussion     
-       
-       If expression evalulates to false, this jumps to a label. No debugging information is printed.
-*/
-
-#if( DEBUG_OVERRIDE_APPLE_MACROS )
-       #undef require_quiet
-#endif
-#if( !defined( require_quiet ) )
-       #define require_quiet( X, LABEL )                                                                                                                                               \
-               do                                                                                                                                                                                                      \
-               {                                                                                                                                                                                                       \
-                       if( !( X ) )                                                                                                                                                                    \
-                       {                                                                                                                                                                                               \
-                               goto LABEL;                                                                                                                                                                     \
-                       }                                                                                                                                                                                               \
-                                                                                                                                                                                                                       \
-               }       while( 0 )
-#endif
-
-//---------------------------------------------------------------------------------------------------------------------------
-/*!    @defined        require_noerr
-       
-       @abstract       Require that an error code is noErr (0).
-       
-       @discussion     
-       
-       If the error code is non-0, this prints debugging information (actual expression string, file, line number, 
-       function name, etc.) using the default debugging output method then jumps to a label.
-*/
-
-#if( DEBUG_OVERRIDE_APPLE_MACROS )
-       #undef require_noerr
-#endif
-#if( !defined( require_noerr ) )
-       #define require_noerr( ERR, LABEL )                                                                                                                                             \
-               do                                                                                                                                                                                                      \
-               {                                                                                                                                                                                                       \
-                       int_least32_t           localErr;                                                                                                                                       \
-                                                                                                                                                                                                                       \
-                       localErr = (int_least32_t)( ERR );                                                                                                                              \
-                       if( localErr != 0 )                                                                                                                                                     \
-                       {                                                                                                                                                                                               \
-                               debug_print_assert( localErr, NULL, NULL, __FILE__, __LINE__, __ROUTINE__ );                            \
-                               goto LABEL;                                                                                                                                                                     \
-                       }                                                                                                                                                                                               \
-                                                                                                                                                                                                                       \
-               }       while( 0 )
-#endif
-
-//---------------------------------------------------------------------------------------------------------------------------
-/*!    @defined        require_noerr_string
-       
-       @abstract       Require that an error code is noErr (0).
-       
-       @discussion     
-       
-       If the error code is non-0, this prints debugging information (actual expression string, file, line number, 
-       function name, etc.), and a custom explanation string using the default debugging output method using the 
-       default debugging output method then jumps to a label.
-*/
-
-#if( DEBUG_OVERRIDE_APPLE_MACROS )
-       #undef require_noerr_string
-#endif
-#if( !defined( require_noerr_string ) )
-       #define require_noerr_string( ERR, LABEL, STR )                                                                                                                 \
-               do                                                                                                                                                                                                      \
-               {                                                                                                                                                                                                       \
-                       int_least32_t           localErr;                                                                                                                                       \
-                                                                                                                                                                                                                       \
-                       localErr = (int_least32_t)( ERR );                                                                                                                              \
-                       if( localErr != 0 )                                                                                                                                                     \
-                       {                                                                                                                                                                                               \
-                               debug_print_assert( localErr, NULL, STR, __FILE__, __LINE__, __ROUTINE__ );                                     \
-                               goto LABEL;                                                                                                                                                                     \
-                       }                                                                                                                                                                                               \
-                                                                                                                                                                                                                       \
-               }       while( 0 )
-#endif
-
-//---------------------------------------------------------------------------------------------------------------------------
-/*!    @defined        require_noerr_action_string
-       
-       @abstract       Require that an error code is noErr (0).
-       
-       @discussion     
-       
-       If the error code is non-0, this prints debugging information (actual expression string, file, line number, 
-       function name, etc.), and a custom explanation string using the default debugging output method using the 
-       default debugging output method then executes an action and jumps to a label.
-*/
-
-#if( DEBUG_OVERRIDE_APPLE_MACROS )
-       #undef require_noerr_action_string
-#endif
-#if( !defined( require_noerr_action_string ) )
-       #define require_noerr_action_string( ERR, LABEL, ACTION, STR )                                                                                  \
-               do                                                                                                                                                                                                      \
-               {                                                                                                                                                                                                       \
-                       int_least32_t           localErr;                                                                                                                                       \
-                                                                                                                                                                                                                       \
-                       localErr = (int_least32_t)( ERR );                                                                                                                              \
-                       if( localErr != 0 )                                                                                                                                                     \
-                       {                                                                                                                                                                                               \
-                               debug_print_assert( localErr, NULL, STR, __FILE__, __LINE__, __ROUTINE__ );                                     \
-                               { ACTION; }                                                                                                                                                                     \
-                               goto LABEL;                                                                                                                                                                     \
-                       }                                                                                                                                                                                               \
-                                                                                                                                                                                                                       \
-               }       while( 0 )
-#endif
-
-//---------------------------------------------------------------------------------------------------------------------------
-/*!    @defined        require_noerr_quiet
-       
-       @abstract       Require that an error code is noErr (0).
-       
-       @discussion     
-       
-       If the error code is non-0, this jumps to a label. No debugging information is printed.
-*/
-
-#if( DEBUG_OVERRIDE_APPLE_MACROS )
-       #undef require_noerr_quiet
-#endif
-#if( !defined( require_noerr_quiet ) )
-       #define require_noerr_quiet( ERR, LABEL )                                                                                                                               \
-               do                                                                                                                                                                                                      \
-               {                                                                                                                                                                                                       \
-                       if( ( ERR ) != 0 )                                                                                                                                                              \
-                       {                                                                                                                                                                                               \
-                               goto LABEL;                                                                                                                                                                     \
-                       }                                                                                                                                                                                               \
-                                                                                                                                                                                                                       \
-               }       while( 0 )
-#endif
-
-//---------------------------------------------------------------------------------------------------------------------------
-/*!    @defined        require_noerr_action
-       
-       @abstract       Require that an error code is noErr (0) with an action to execute otherwise.
-       
-       @discussion     
-       
-       If the error code is non-0, this prints debugging information (actual expression string, file, line number, 
-       function name, etc.) using the default debugging output method then executes an action and jumps to a label.
-*/
-
-#if( DEBUG_OVERRIDE_APPLE_MACROS )
-       #undef require_noerr_action
-#endif
-#if( !defined( require_noerr_action ) )
-       #define require_noerr_action( ERR, LABEL, ACTION )                                                                                                              \
-               do                                                                                                                                                                                                      \
-               {                                                                                                                                                                                                       \
-                       int_least32_t           localErr;                                                                                                                                       \
-                                                                                                                                                                                                                       \
-                       localErr = (int_least32_t)( ERR );                                                                                                                              \
-                       if( localErr != 0 )                                                                                                                                                     \
-                       {                                                                                                                                                                                               \
-                               debug_print_assert( localErr, NULL, NULL, __FILE__, __LINE__, __ROUTINE__ );                            \
-                               { ACTION; }                                                                                                                                                                     \
-                               goto LABEL;                                                                                                                                                                     \
-                       }                                                                                                                                                                                               \
-                                                                                                                                                                                                                       \
-               }       while( 0 )
-#endif
-
-//---------------------------------------------------------------------------------------------------------------------------
-/*!    @defined        require_noerr_action_quiet
-       
-       @abstract       Require that an error code is noErr (0) with an action to execute otherwise.
-       
-       @discussion     
-       
-       If the error code is non-0, this executes an action and jumps to a label. No debugging information is printed.
-*/
-
-#if( DEBUG_OVERRIDE_APPLE_MACROS )
-       #undef require_noerr_action_quiet
-#endif
-#if( !defined( require_noerr_action_quiet ) )
-       #define require_noerr_action_quiet( ERR, LABEL, ACTION )                                                                                                \
-               do                                                                                                                                                                                                      \
-               {                                                                                                                                                                                                       \
-                       if( ( ERR ) != 0 )                                                                                                                                                              \
-                       {                                                                                                                                                                                               \
-                               { ACTION; }                                                                                                                                                                     \
-                               goto LABEL;                                                                                                                                                                     \
-                       }                                                                                                                                                                                               \
-                                                                                                                                                                                                                       \
-               }       while( 0 )
-#endif
-
-//---------------------------------------------------------------------------------------------------------------------------
-/*!    @defined        require_action
-       
-       @abstract       Requires that an expression evaluate to true with an action to execute otherwise.
-       
-       @discussion     
-       
-       If expression evalulates to false, this prints debugging information (actual expression string, file, line number, 
-       function name, etc.) using the default debugging output method then executes an action and jumps to a label.
-*/
-
-#if( DEBUG_OVERRIDE_APPLE_MACROS )
-       #undef require_action
-#endif
-#if( !defined( require_action ) )
-       #define require_action( X, LABEL, ACTION )                                                                                                                              \
-               do                                                                                                                                                                                                      \
-               {                                                                                                                                                                                                       \
-                       if( !( X ) )                                                                                                                                                                    \
-                       {                                                                                                                                                                                               \
-                               debug_print_assert( 0, #X, NULL, __FILE__, __LINE__, __ROUTINE__ );                                                     \
-                               { ACTION; }                                                                                                                                                                     \
-                               goto LABEL;                                                                                                                                                                     \
-                       }                                                                                                                                                                                               \
-                                                                                                                                                                                                                       \
-               }       while( 0 )
-#endif
-
-//---------------------------------------------------------------------------------------------------------------------------
-/*!    @defined        require_action_quiet
-       
-       @abstract       Requires that an expression evaluate to true with an action to execute otherwise.
-       
-       @discussion     
-       
-       If expression evalulates to false, this executes an action and jumps to a label. No debugging information is printed.
-*/
-
-#if( DEBUG_OVERRIDE_APPLE_MACROS )
-       #undef require_action_quiet
-#endif
-#if( !defined( require_action_quiet ) )
-       #define require_action_quiet( X, LABEL, ACTION )                                                                                                                \
-               do                                                                                                                                                                                                      \
-               {                                                                                                                                                                                                       \
-                       if( !( X ) )                                                                                                                                                                    \
-                       {                                                                                                                                                                                               \
-                               { ACTION; }                                                                                                                                                                     \
-                               goto LABEL;                                                                                                                                                                     \
-                       }                                                                                                                                                                                               \
-                                                                                                                                                                                                                       \
-               }       while( 0 )
-#endif
-
-//---------------------------------------------------------------------------------------------------------------------------
-/*!    @defined        require_action_string
-       
-       @abstract       Requires that an expression evaluate to true with an explanation and action to execute otherwise.
-       
-       @discussion     
-       
-       If expression evalulates to false, this prints debugging information (actual expression string, file, line number, 
-       function name, etc.) and a custom explanation string using the default debugging output method then executes an
-       action and jumps to a label.
-*/
-
-#if( DEBUG_OVERRIDE_APPLE_MACROS )
-       #undef require_action_string
-#endif
-#if( !defined( require_action_string ) )
-       #define require_action_string( X, LABEL, ACTION, STR )                                                                                                  \
-               do                                                                                                                                                                                                      \
-               {                                                                                                                                                                                                       \
-                       if( !( X ) )                                                                                                                                                                    \
-                       {                                                                                                                                                                                               \
-                               debug_print_assert( 0, #X, STR, __FILE__, __LINE__, __ROUTINE__ );                                              \
-                               { ACTION; }                                                                                                                                                                     \
-                               goto LABEL;                                                                                                                                                                     \
-                       }                                                                                                                                                                                               \
-                                                                                                                                                                                                                       \
-               }       while( 0 )
-
-#endif
-
-//---------------------------------------------------------------------------------------------------------------------------
-/*!    @defined        require_throw
-       
-       @abstract       Requires that an expression evaluates to true or an exception is thrown.
-       
-       @discussion     
-       
-       If the expression evaluates to false, this prints debugging information (actual expression string, file, 
-       line number, function name, etc.) using the default debugging output method then throws an exception.
-*/
-
-#if( defined( __cplusplus ) )
-       #define require_throw( X )                                                                                                                                                              \
-               do                                                                                                                                                                                                      \
-               {                                                                                                                                                                                                       \
-                       if( !( X ) )                                                                                                                                                                    \
-                       {                                                                                                                                                                                               \
-                               debug_print_assert( 0, #X, NULL, __FILE__, __LINE__, __ROUTINE__ );                                                     \
-                               throw kUnknownErr;                                                                                                                                                      \
-                       }                                                                                                                                                                                               \
-                                                                                                                                                                                                                       \
-               }       while( 0 )
-#endif
-
-#if 0
-#pragma mark == Design-By-Contract macros ==
-#endif
-
-//===========================================================================================================================
-//     Design-By-Contract macros
-//===========================================================================================================================
-
-#define        ensure( X )                                                                                                     check( X )
-#define        ensure_string( X, STR )                                                                         check_string( X, STR )
-#define        ensure_noerr( ERR )                                                                                     check_noerr( ERR )
-#define        ensure_noerr_string( ERR, STR )                                                         check_noerr_string( ERR, STR )
-#define        ensure_translated_errno( TEST, ERRNO, ALTERNATE_ERROR )         check_translated_errno( TEST, ERRNO, ALTERNATE_ERROR )
-
-// Note: Design-By-Contract "require" macros are already defined elsewhere.
-
-#if 0
-#pragma mark == Expect macros ==
-#endif
-
-//===========================================================================================================================
-//     Expect macros
-//===========================================================================================================================
-
-// Expect macros allow code to include runtime checking of things that should not happen in shipping code (e.g. internal 
-// programmer errors, such as a NULL parameter where it is not allowed). Once the code has been verified to work correctly 
-// without asserting, the DEBUG_EXPECT_VERIFIED conditional can be set to eliminate the error checking entirely. It can 
-// also be useful to measure the cost of error checking code by profiling with it enable and with it disabled.
-
-#if( DEBUG_EXPECT_VERIFIED )
-       #define require_expect
-       #define require_string_expect
-       #define require_quiet_expect
-       #define require_noerr_expect
-       #define require_noerr_string_expect
-       #define require_noerr_action_string_expect
-       #define require_noerr_quiet_expect
-       #define require_noerr_action_expect
-       #define require_noerr_action_quiet_expect
-       #define require_action_expect
-       #define require_action_quiet_expect
-       #define require_action_string_expect
-#else
-       #define require_expect                                                  require
-       #define require_string_expect                                   require_string
-       #define require_quiet_expect                                    require_quiet
-       #define require_noerr_expect                                    require_noerr
-       #define require_noerr_string_expect                             require_noerr_string
-       #define require_noerr_action_string_expect              require_noerr_action_string
-       #define require_noerr_quiet_expect                              require_noerr_quiet
-       #define require_noerr_action_expect                             require_noerr_action
-       #define require_noerr_action_quiet_expect               require_noerr_action_quiet
-       #define require_action_expect                                   require_action
-       #define require_action_quiet_expect                             require_action_quiet
-       #define require_action_string_expect                    require_action_string
-#endif
-
-#if 0
-#pragma mark == Output macros ==
-#endif
-
-//---------------------------------------------------------------------------------------------------------------------------
-/*!    @defined        debug_string
-       
-       @abstract       Prints a debugging C string.
-*/
-
-#if( DEBUG_OVERRIDE_APPLE_MACROS )
-       #undef debug_string
-#endif
-#if( !defined( debug_string ) )
-       #if( DEBUG )
-               #define debug_string( STR )                                                                                                                                             \
-                       do                                                                                                                                                                                      \
-                       {                                                                                                                                                                                       \
-                               debug_print_assert( 0, NULL, STR, __FILE__, __LINE__, __ROUTINE__ );                                    \
-                                                                                                                                                                                                               \
-                       }       while( 0 )
-       #else
-               #define debug_string( STR )
-       #endif
-#endif
-
-//---------------------------------------------------------------------------------------------------------------------------
-/*!    @defined        debug_print_assert
-       
-       @abstract       Prints an assertion.
-*/
-
-#if( DEBUG )
-       #define debug_print_assert( ERROR_CODE, ASSERT_STRING, MESSAGE, FILENAME, LINE_NUMBER, FUNCTION )       \
-               DebugPrintAssert( ERROR_CODE, ASSERT_STRING, MESSAGE, FILENAME, LINE_NUMBER, FUNCTION )
-#else
-       #define debug_print_assert( ERROR_CODE, ASSERT_STRING, MESSAGE, FILENAME, LINE_NUMBER, FUNCTION )
-#endif
-
-//---------------------------------------------------------------------------------------------------------------------------
-/*!    @defined        dlog
-       
-       @abstract       Prints a debug-only message.
-*/
-
-#if( DEBUG )
-       #if( DEBUG_C99_VA_ARGS )
-               #define dlog( ... )                     DebugPrintF( __VA_ARGS__ )
-       #elif( DEBUG_GNU_VA_ARGS )
-               #define dlog( ARGS... )         DebugPrintF( ## ARGS )                  
-       #else
-               #define dlog                            DebugPrintF
-       #endif
-#else
-       #if( DEBUG_C99_VA_ARGS )
-               #define dlog( ... )
-       #elif( DEBUG_GNU_VA_ARGS )
-               #define dlog( ARGS... )
-       #else
-               #define dlog                            while( 0 )
-       #endif
-#endif
-
-//---------------------------------------------------------------------------------------------------------------------------
-/*!    @defined        dlogv
-       
-       @abstract       Prints a debug-only message.
-*/
-
-#if( DEBUG )
-       #define dlogv( LEVEL, FORMAT, LIST )            DebugPrintFVAList( ( LEVEL ), ( FORMAT ), ( LIST ) )
-#else
-       #define dlogv( LEVEL, FORMAT, LIST )
-#endif
-
-//---------------------------------------------------------------------------------------------------------------------------
-/*!    @defined        dlogmem
-       
-       @abstract       Prints a debug-only dump of memory.
-*/
-
-#if( DEBUG )
-       #define dlogmem( LEVEL, PTR, SIZE )             \
-               DebugHexDump( ( LEVEL ), 0, NULL, 0, 0, NULL, 0, ( PTR ), ( PTR ), ( SIZE ), kDebugFlagsNone, NULL, 0 )
-#else
-       #define dlogmem( LEVEL, PTR, SIZE )
-#endif
-
-//---------------------------------------------------------------------------------------------------------------------------
-/*!    @defined        DebugNSLog
-       
-       @abstract       Debug-only macro for the Cocoa NSLog function.
-*/
-
-#if( DEBUG )
-       #if( DEBUG_C99_VA_ARGS )
-               #define DebugNSLog( ... )                       NSLog( __VA_ARGS__ )
-       #elif( DEBUG_GNU_VA_ARGS )
-               #define DebugNSLog( ARGS... )           NSLog( ## ARGS )
-       #else
-               #define DebugNSLog                                      NSLog
-       #endif
-#else
-       #if( DEBUG_C99_VA_ARGS )
-               #define DebugNSLog( ... )
-       #elif( DEBUG_GNU_VA_ARGS )
-               #define DebugNSLog( ARGS... )
-       #else
-               #define DebugNSLog                                      while( 0 )
-       #endif
-#endif
-
-//---------------------------------------------------------------------------------------------------------------------------
-/*!    @defined        DebugLogMsg
-       
-       @abstract       Debug-only macro for the VxWorks logMsg function.
-*/
-
-#if( TARGET_OS_VXWORKS )
-       #if( DEBUG )
-               #define DebugLogMsg( LEVEL, FORMAT, P1, P2, P3, P4, P5, P6 )                                                    \
-                       do                                                                                                                                                                      \
-                       {                                                                                                                                                                       \
-                               if( ( inLevel >= gDebugPrintLevelMin ) || ( inLevel <= gDebugPrintLevelMax ) )  \
-                               {                                                                                                                                                               \
-                                       logMsg( ( FORMAT ), ( P1 ), ( P2 ), ( P3 ), ( P4 ), ( P5 ), ( P6 ) );           \
-                               }                                                                                                                                                               \
-                                                                                                                                                                                               \
-                       }       while( 0 )
-       #else
-               #define DebugLogMsg( LEVEL, FORMAT, P1, P2, P3, P4, P5, P6 )
-       #endif
-#else
-       #define DebugLogMsg             dlog
-#endif
-
-#if 0
-#pragma mark == Routines - General ==
-#endif
-
-#ifdef __cplusplus
-       extern "C" {
-#endif
-
-//---------------------------------------------------------------------------------------------------------------------------
-/*!    @function       DebugInitialize
-
-       @abstract       Initializes the debugging library for a specific kind of output.
-
-       @param          inType          
-       @param          varArg          Variable number parameters, controlled by the "inType" parameter.
-*/
-
-#if( DEBUG )
-       DEBUG_EXPORT OSStatus   DebugInitialize( DebugOutputType inType, ... );
-#endif
-
-#if( DEBUG )
-       #if( DEBUG_C99_VA_ARGS )
-               #define debug_initialize( ... )                 DebugInitialize( __VA_ARGS__ )
-       #elif( DEBUG_GNU_VA_ARGS )
-               #define debug_initialize( ARGS... )             DebugInitialize( ## ARGS )
-       #else
-               #define debug_initialize                                DebugInitialize
-       #endif
-#else
-       #if( DEBUG_C99_VA_ARGS )
-               #define debug_initialize( ... )
-       #elif( DEBUG_GNU_VA_ARGS )
-               #define debug_initialize( ARGS... )
-       #else
-               #define debug_initialize                                while( 0 )
-       #endif
-#endif
-
-//---------------------------------------------------------------------------------------------------------------------------
-/*!    @function       DebugFinalize
-
-       @abstract       Releases any resources used by the debugging library
-*/
-
-#if( DEBUG )
-       DEBUG_EXPORT void               DebugFinalize( void );
-#endif
-
-#if( DEBUG )                     
-       #define debug_terminate()       DebugFinalize()
-#else
-       #define debug_terminate()
-#endif
-
-//---------------------------------------------------------------------------------------------------------------------------
-/*!    @function       DebugGetProperty
-
-       @abstract       Gets the specified property from the debugging library.
-*/
-
-#if( DEBUG )
-       DEBUG_EXPORT OSStatus   DebugGetProperty( DebugPropertyTag inTag, ... );
-#endif
-
-#if( DEBUG )
-       #if( DEBUG_C99_VA_ARGS )
-               #define debug_get_property( ... )                       DebugGetProperty( __VA_ARGS__ )
-       #elif( DEBUG_GNU_VA_ARGS )
-               #define debug_get_property( ARGS... )           DebugGetProperty( ## ARGS )
-       #else
-               #define debug_get_property                                      DebugGetProperty
-       #endif
-#else
-       #if( DEBUG_C99_VA_ARGS )
-               #define debug_get_property( ... )
-       #elif( DEBUG_GNU_VA_ARGS )
-               #define debug_get_property( ARGS... )
-       #else
-               #define debug_get_property                                      while( 0 )
-       #endif
-#endif
-
-//---------------------------------------------------------------------------------------------------------------------------
-/*!    @function       DebugSetProperty
-
-       @abstract       Sets the specified property from the debugging library.
-*/
-
-#if( DEBUG )
-       DEBUG_EXPORT OSStatus   DebugSetProperty( DebugPropertyTag inTag, ... );
-#endif
-
-#if( DEBUG )
-       #if( DEBUG_C99_VA_ARGS )
-               #define debug_set_property( ... )                       DebugSetProperty( __VA_ARGS__ )
-       #elif( DEBUG_GNU_VA_ARGS )
-               #define debug_set_property( ARGS... )           DebugSetProperty( ## ARGS )
-       #else
-               #define debug_set_property                                      DebugSetProperty
-       #endif
-#else
-       #if( DEBUG_C99_VA_ARGS )
-               #define debug_set_property( ... )
-       #elif( DEBUG_GNU_VA_ARGS )
-               #define debug_set_property( ARGS... )
-       #else
-               #define debug_set_property                                      while( 0 )
-       #endif
-#endif
-
-#if 0
-#pragma mark == Routines - Debugging Output ==
-#endif
-
-//---------------------------------------------------------------------------------------------------------------------------
-/*!    @function       DebugPrintF
-
-       @abstract       Prints a debug message with printf-style formatting.
-       
-       @param          inLevel Error that generated this assert or noErr.
-       
-       @param          inFormatString
-                                       C string containing assertion text.
-
-       @param          VAR_ARG
-                                       Variable number of arguments depending on the format string.
-       
-       @result         Number of bytes printed or -1 on error.
-*/
-
-#if( DEBUG )
-       DEBUG_EXPORT size_t             DebugPrintF( DebugLevel inLevel, const char *inFormat, ... );
-#endif
-
-//---------------------------------------------------------------------------------------------------------------------------
-/*!    @function       DebugPrintFVAList
-
-       @abstract       va_list version of DebugPrintF. See DebugPrintF for more info.
-*/
-
-#if( DEBUG )
-       DEBUG_EXPORT size_t             DebugPrintFVAList( DebugLevel inLevel, const char *inFormat, va_list inArgs );
-#endif
-
-//---------------------------------------------------------------------------------------------------------------------------
-/*!    @function       DebugPrintAssert
-
-       @abstract       Prints a message describing the reason the (e.g. an assert failed), an optional error message, 
-                               an optional source filename, an optional source line number.
-
-       @param          inErrorCode                     Error that generated this assert or noErr.
-       @param          inAssertString          C string containing assertion text.
-       @param          inMessage                       C string containing a message about the assert.
-       @param          inFileName                      C string containing path of file where the error occurred.
-       @param          inLineNumber            Line number in source file where the error occurred.
-       @param          inFunction                      C string containing name of function where assert occurred.
-
-       @discussion
-       
-       Example output: 
-       
-       [ASSERT] assert: "dataPtr != NULL" allocate memory for object failed
-       [ASSERT] where:  "MyFile.c", line 123, ("MyFunction")
-       
-       OR
-       
-       [ASSERT] error:  -6728 (kNoMemoryErr)
-       [ASSERT] where:  "MyFile.c", line 123, ("MyFunction")
-*/
-
-#if( DEBUG )
-       DEBUG_EXPORT void
-               DebugPrintAssert( 
-                       int_least32_t   inErrorCode, 
-                       const char *    inAssertString, 
-                       const char *    inMessage, 
-                       const char *    inFilename, 
-                       int_least32_t   inLineNumber, 
-                       const char *    inFunction );
-#endif
-
-#if 0
-#pragma mark == Routines - Utilities ==
-#endif
-
-//---------------------------------------------------------------------------------------------------------------------------
-/*!    @function       DebugSNPrintF
-       
-       @abstract       Debugging versions of standard C snprintf with extra features.
-       
-       @param          sbuffer         Buffer to receive result. Null terminated unless the buffer size is 0.
-       @param          buflen          Size of the buffer including space for the null terminator.
-       @param          fmt                     printf-style format string.
-       @param          VAR_ARG         Variable number of arguments depending on the format string.
-
-       @result         Number of characters written (minus the null terminator).
-       
-       @discussion     
-       
-       Extra features over the standard C snprintf:
-       <pre>
-               64-bit support for %d (%lld), %i (%lli), %u (%llu), %o (%llo), %x (%llx), and %b (%llb).
-               %@   - Cocoa/CoreFoundation object. Param is the object. Strings are used directly. Others use CFCopyDescription.
-               %a   - Network Address: %.4a=IPv4, %.6a=Ethernet, %.8a Fibre Channel, %.16a=IPv6. Arg=ptr to network address.
-               %#a  - IPv4 or IPv6 mDNSAddr. Arg=ptr to mDNSAddr.
-               %##a - IPv4 (if AF_INET defined) or IPv6 (if AF_INET6 defined) sockaddr. Arg=ptr to sockaddr.
-               %b   - Binary representation of integer (e.g. 01101011). Modifiers and arg=the same as %d, %x, etc.
-               %C   - Mac-style FourCharCode (e.g. 'APPL'). Arg=32-bit value to print as a Mac-style FourCharCode.
-               %H   - Hex Dump (e.g. "\x6b\xa7" -> "6B A7"). 1st arg=ptr, 2nd arg=size, 3rd arg=max size.
-               %#H  - Hex Dump & ASCII (e.g. "\x41\x62" -> "6B A7 'Ab'"). 1st arg=ptr, 2nd arg=size, 3rd arg=max size.
-               %m   - Error Message (e.g. 0 -> "kNoErr"). Modifiers and error code arg=the same as %d, %x, etc.
-               %#s  - Pascal-style length-prefixed string. Arg=ptr to string.
-               %##s - DNS label-sequence name. Arg=ptr to name.
-               %S   - UTF-16 string, 0x0000 terminated. Host order if no BOM. Precision is UTF-16 count. Precision includes BOM.
-               %#S  - Big Endian UTF-16 string (unless BOM overrides). Otherwise, the same as %S.
-               %##S - Little Endian UTF-16 string (unless BOM overrides). Otherwise, the same as %S.
-               %U   - Universally Unique Identifier (UUID) (e.g. 6ba7b810-9dad-11d1-80b4-00c04fd430c8). Arg=ptr to 16-byte UUID.
-       </pre>
-*/
-
-#if( DEBUG )
-       DEBUG_EXPORT size_t DebugSNPrintF(char *sbuffer, size_t buflen, const char *fmt, ...);
-#endif
-
-//---------------------------------------------------------------------------------------------------------------------------
-/*!    @function       DebugSNPrintFVAList
-
-       @abstract       va_list version of DebugSNPrintF. See DebugSNPrintF for more info.
-*/
-
-#if( DEBUG )
-       DEBUG_EXPORT size_t DebugSNPrintFVAList(char *sbuffer, size_t buflen, const char *fmt, va_list arg);
-#endif
-
-//---------------------------------------------------------------------------------------------------------------------------
-/*!    @function       DebugGetErrorString
-
-       @abstract       Gets an error string from an error code.
-
-       @param          inStatus                Error code to get the string for.
-       @param          inBuffer                Optional buffer to copy the string to for non-static strings. May be null.
-       @param          inBufferSize    Size of optional buffer. May be 0.
-       
-       @result         C string containing error string for the error code. Guaranteed to be a valid, static string. If a 
-                               buffer is supplied, the return value will always be a pointer to the supplied buffer, which will 
-                               contain the best available description of the error code. If a buffer is not supplied, the return
-                               value will be the best available description of the error code that can be represented as a static 
-                               string. This allows code that cannot use a temporary buffer to hold the result to still get a useful 
-                               error string in most cases, but also allows code that can use a temporary buffer to get the best 
-                               available description.
-*/
-
-#if( DEBUG )
-       DEBUG_EXPORT const char *       DebugGetErrorString( int_least32_t inErrorCode, char *inBuffer, size_t inBufferSize );
-#endif
-
-//---------------------------------------------------------------------------------------------------------------------------
-/*!    @function       DebugHexDump
-
-       @abstract       Hex dumps data to a string or to the output device.
-*/
-
-#if( DEBUG )
-       DEBUG_EXPORT size_t
-               DebugHexDump( 
-                       DebugLevel              inLevel, 
-                       int                             inIndent, 
-                       const char *    inLabel, 
-                       size_t                  inLabelSize, 
-                       int                             inLabelMinWidth, 
-                       const char *    inType, 
-                       size_t                  inTypeSize, 
-                       const void *    inDataStart, 
-                       const void *    inData, 
-                       size_t                  inDataSize, 
-                       DebugFlags              inFlags, 
-                       char *                  outBuffer, 
-                       size_t                  inBufferSize );
-#endif
-
-#if( DEBUG )
-       #define dloghex( LEVEL, INDENT, LABEL, LABEL_SIZE, LABEL_MIN_SIZE, TYPE, TYPE_SIZE, DATA_START, DATA, DATA_SIZE, FLAGS, BUFFER, BUFFER_SIZE )   \
-               DebugHexDump( ( LEVEL ), (INDENT), ( LABEL ), ( LABEL_SIZE ), ( LABEL_MIN_SIZE ), ( TYPE ), ( TYPE_SIZE ),                                                              \
-                       ( DATA_START ), ( DATA ), ( DATA_SIZE ), ( FLAGS ), ( BUFFER ), ( BUFFER_SIZE ) )
-#else
-       #define dloghex( LEVEL, INDENT, LABEL, LABEL_SIZE, LABEL_MIN_SIZE, TYPE, TYPE_SIZE, DATA_START, DATA, DATA_SIZE, FLAGS, BUFFER, BUFFER_SIZE )
-#endif
-
-//---------------------------------------------------------------------------------------------------------------------------
-/*!    @function       DebugTaskLevel
-
-       @abstract       Returns the current task level.
-
-       @result         Current task level
-       
-       @discussion     
-       
-       Bit masks to isolate portions of the result (note that some masks may also need bit shifts to right justify):
-       <pre>
-               kDebugInterruptLevelMask                                - Indicates the current interrupt level (> 0 means interrupt time).
-               kDebugInVBLTaskMask                                             - Indicates if a VBL task is currently being executed.
-               kDebugInDeferredTaskMask                                - Indicates if a Deferred Task is currently being executed.
-               kDebugInSecondaryInterruptHandlerMask   - Indicates if a Secondary Interrupt Handler is currently being executed.
-               kDebugPageFaultFatalMask                                - Indicates if it is unsafe to cause a page fault (worse than interrupt time).
-               kDebugMPTaskLevelMask                                   - Indicates if being called from an MP task.
-               kDebugInterruptDepthMask                                - 0 means task level, 1 means in interrupt, > 1 means in nested interrupt.
-       </pre>
-       
-       Helpers:
-       <pre>
-               DebugExtractTaskLevelInterruptDepth()   - Macro to extract interrupt depth from task level value.
-       </pre>
-*/
-
-#if( DEBUG )
-       DEBUG_EXPORT uint32_t   DebugTaskLevel( void );
-#endif
-
-//---------------------------------------------------------------------------------------------------------------------------
-/*!    @function       DebugServicesTest
-
-       @abstract       Unit test.
-*/
-
-#if( DEBUG )
-       DEBUG_EXPORT OSStatus   DebugServicesTest( void );
-#endif
-
-#ifdef __cplusplus
-       }
-#endif
-
-#endif // __DEBUG_SERVICES__
index d9f9033425e1a05a10e2bcacb800e091d173db1d..1d231f291171973a3a95ef1329aa3401d13af645 100755 (executable)
@@ -1,18 +1,24 @@
-/* -*- Mode: C; tab-width: 4 -*-
- *
+/*
  * Copyright (c) 2003 Apple Computer, Inc. All rights reserved.
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * @APPLE_LICENSE_HEADER_START@
  * 
- *     http://www.apache.org/licenses/LICENSE-2.0
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
  * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
  * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
 
        File:           GenLinkedList.c
 
@@ -24,9 +30,6 @@
     Change History (most recent first):
 
 $Log: GenLinkedList.c,v $
-Revision 1.4  2006/08/14 23:24:56  cheshire
-Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
-
 Revision 1.3  2004/04/22 21:14:42  cheshire
 Fix comment spelling mistake
 
index 4df6e67c47f15360ee7e2aadce3f772394849082..5a7de91dd9227f2b04daa1284c05761b21e0dd51 100755 (executable)
@@ -1,18 +1,24 @@
-/* -*- Mode: C; tab-width: 4 -*-
- *
+/*
  * Copyright (c) 2003 Apple Computer, Inc. All rights reserved.
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * @APPLE_LICENSE_HEADER_START@
  * 
- *     http://www.apache.org/licenses/LICENSE-2.0
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
  * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
  * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
 
        File:           GenLinkedList.c
 
@@ -24,9 +30,6 @@
     Change History (most recent first):
 
 $Log: GenLinkedList.h,v $
-Revision 1.3  2006/08/14 23:24:56  cheshire
-Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
-
 Revision 1.2  2004/02/05 07:41:08  cheshire
 Add Log header
 
index 85e9d0297bae1aeda3e5b9fd37a01499e7196302..665263d3fbb329f874928c3e6b46dd27efd1f015 100644 (file)
@@ -1,25 +1,28 @@
-/* -*- Mode: Java; tab-width: 4 -*-
- *
+/*
  * Copyright (c) 2004 Apple Computer, Inc. All rights reserved.
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * @APPLE_LICENSE_HEADER_START@
  * 
- *     http://www.apache.org/licenses/LICENSE-2.0
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
  * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
  * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
 
     Change History (most recent first):
 
 $Log: BaseListener.java,v $
-Revision 1.3  2006/08/14 23:25:08  cheshire
-Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
-
 Revision 1.2  2004/04/30 21:48:27  rpantos
 Change line endings for CVS.
 
index b254c9752e00a2efb0a3239345f37a9b75c9ceeb..5bda3ae8cede25ca0a60d377c6de381bf9dceba5 100644 (file)
@@ -1,25 +1,28 @@
-/* -*- Mode: Java; tab-width: 4 -*-
- *
+/*
  * Copyright (c) 2004 Apple Computer, Inc. All rights reserved.
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * @APPLE_LICENSE_HEADER_START@
  * 
- *     http://www.apache.org/licenses/LICENSE-2.0
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
  * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
  * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
 
     Change History (most recent first):
 
 $Log: BrowseListener.java,v $
-Revision 1.3  2006/08/14 23:25:08  cheshire
-Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
-
 Revision 1.2  2004/04/30 21:48:27  rpantos
 Change line endings for CVS.
 
index 5050a7a60ef9ac33d9d27c7b8c3886197638e5a3..73e1626358d3f971403cc08f93b9e5678d9deda3 100644 (file)
@@ -1,25 +1,28 @@
-/* -*- Mode: Java; tab-width: 4 -*-
- *
+/*
  * Copyright (c) 2004 Apple Computer, Inc. All rights reserved.
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * @APPLE_LICENSE_HEADER_START@
  * 
- *     http://www.apache.org/licenses/LICENSE-2.0
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
  * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
  * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
 
     Change History (most recent first):
 
 $Log: DNSRecord.java,v $
-Revision 1.3  2006/08/14 23:25:08  cheshire
-Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
-
 Revision 1.2  2004/12/11 03:00:59  rpantos
 <rdar://problem/3907498> Java DNSRecord API should be cleaned up
 
index a431df17825e3447cf390bdbe66a3bcd8728bb59..d8a7ce1aba660215aef13e99c99cb2a7ce414b4c 100644 (file)
@@ -1,31 +1,28 @@
-/* -*- Mode: Java; tab-width: 4 -*-
- *
+/*
  * Copyright (c) 2004 Apple Computer, Inc. All rights reserved.
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * @APPLE_LICENSE_HEADER_START@
  * 
- *     http://www.apache.org/licenses/LICENSE-2.0
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
  * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
  * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
 
     Change History (most recent first):
 
 $Log: DNSSD.java,v $
-Revision 1.11  2006/08/14 23:25:08  cheshire
-Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
-
-Revision 1.10  2006/06/20 23:05:55  rpantos
-<rdar://problem/3839132> Java needs to implement DNSServiceRegisterRecord equivalent
-
-Revision 1.9  2005/10/26 01:52:24  cheshire
-<rdar://problem/4316286> Race condition in Java code (doesn't work at all on Linux)
-
 Revision 1.8  2005/07/11 01:55:21  cheshire
 <rdar://problem/4175511> Race condition in Java API
 
@@ -54,6 +51,10 @@ First checked in.
        This file declares and implements DNSSD, the central Java factory class
        for doing DNS Service Discovery. It includes the mostly-abstract public
        interface, as well as the Apple* implementation subclasses.
+
+       To do:
+       - implement network interface mappings
+       - RegisterRecord
  */
 
 
@@ -306,18 +307,6 @@ abstract public class      DNSSD
        throws DNSSDException
        { return register( 0, 0, serviceName, regType, null, null, port, null, listener); }
 
-       /** Create a {@link DNSSDRecordRegistrar} allowing efficient registration of 
-               multiple individual records.<P> 
-               <P>
-               @return         A {@link DNSSDRecordRegistrar} that can be used to register records.
-
-               @throws SecurityException If a security manager is present and denies <tt>RuntimePermission("getDNSSDInstance")</tt>.
-               @see    RuntimePermission
-       */
-       public static DNSSDRecordRegistrar      createRecordRegistrar( RegisterRecordListener listener)
-       throws DNSSDException
-       { return getInstance()._createRecordRegistrar( listener); }
-
        /** Query for an arbitrary DNS record.<P> 
                @param  flags
                                        Possible values are: MORE_COMING.
@@ -482,9 +471,6 @@ abstract public class       DNSSD
                                                                        String domain, String host, int port, TXTRecord txtRecord, RegisterListener listener)
        throws DNSSDException;
 
-       abstract protected DNSSDRecordRegistrar _createRecordRegistrar( RegisterRecordListener listener)
-       throws DNSSDException;
-
        abstract protected DNSSDService _queryRecord( int flags, int ifIndex, String serviceName, int rrtype, 
                                                                                int rrclass, QueryListener listener)
        throws DNSSDException;
@@ -606,12 +592,6 @@ class      AppleDNSSD extends DNSSD
                                                                                ( txtRecord != null) ? txtRecord.getRawBytes() : null, client);
        }
 
-       protected DNSSDRecordRegistrar  _createRecordRegistrar( RegisterRecordListener listener)
-       throws DNSSDException
-       {
-               return new AppleRecordRegistrar( listener);
-       }
-
        protected DNSSDService          _queryRecord( int flags, int ifIndex, String serviceName, int rrtype, 
                                                                                int rrclass, QueryListener client)
        throws DNSSDException
@@ -672,8 +652,8 @@ class       AppleService implements DNSSDService, Runnable
 
        public void                             stop() { this.HaltOperation(); }
 
-       /* Block until data arrives, or one second passes. Returns 1 if data present, 0 otherwise. */
-       protected native int    BlockForData();
+       /* Block for timeout ms (or forever if -1). Returns 1 if data present, 0 if timed out, -1 if not browsing. */
+       protected native int    BlockForData( int msTimeout);
 
        /* Call ProcessResults when data appears on socket descriptor. */
        protected native int    ProcessResults();
@@ -692,9 +672,7 @@ class       AppleService implements DNSSDService, Runnable
        {
                while ( true )
                {
-                       // Note: We want to allow our DNS-SD operation to be stopped from other threads, so we have to
-                       // block waiting for data *outside* the synchronized section. Because we're doing this unsynchronized
-                       // we have to write some careful code. Suppose our DNS-SD operation is stopped from some other thread,
+                       // We have to be very careful here. Suppose our DNS-SD operation is stopped from some other thread,
                        // and then immediately afterwards that thread (or some third, unrelated thread) starts a new DNS-SD
                        // operation. The Unix kernel always allocates the lowest available file descriptor to a new socket,
                        // so the same file descriptor is highly likely to be reused for the new operation, and if our old
@@ -713,11 +691,11 @@ class     AppleService implements DNSSDService, Runnable
                        // locking DOESN'T prevent the callback routine from stopping its own operation, but DOES prevent
                        // any other thread from stopping it until after the callback has completed and returned to us here.
 
-                       int result = BlockForData();
+                       int result = BlockForData(-1);
+                       if (result != 1) break; // If socket has been closed, time to terminate this thread
                        synchronized (this)
                        {
                                if (fNativeContext == 0) break; // Some other thread stopped our DNSSD operation; time to terminate this thread
-                               if (result == 0) continue;              // If BlockForData() said there was no data, go back and block again
                                result = ProcessResults();
                                if (fNativeContext == 0) break; // Event listener stopped its own DNSSD operation; terminate this thread
                                if (result != 0) { fListener.operationFailed(this, result); break; }    // If error, notify listener
@@ -814,6 +792,7 @@ class       AppleRegistration extends AppleService implements DNSSDRegistration
                AppleDNSRecord  newRecord = new AppleDNSRecord( this);
 
                this.ThrowOnErr( this.AddRecord( flags, rrType, rData, ttl, newRecord));
+
                return newRecord;
        }
 
@@ -831,35 +810,6 @@ class      AppleRegistration extends AppleService implements DNSSDRegistration
        protected native int    AddRecord( int flags, int rrType, byte[] rData, int ttl, AppleDNSRecord destObj);
 }
 
-class  AppleRecordRegistrar extends AppleService implements DNSSDRecordRegistrar
-{
-       public                  AppleRecordRegistrar( RegisterRecordListener listener) 
-       throws DNSSDException
-       { 
-               super(listener); 
-               this.ThrowOnErr( this.CreateConnection());
-               if ( !AppleDNSSD.hasAutoCallbacks)
-                       new Thread(this).start();
-       }
-
-       public DNSRecord        registerRecord( int flags, int ifIndex, String fullname, int rrtype, 
-                                                                       int rrclass, byte[] rdata, int ttl)
-       throws DNSSDException
-       {
-               AppleDNSRecord  newRecord = new AppleDNSRecord( this);
-
-               this.ThrowOnErr( this.RegisterRecord( flags, ifIndex, fullname, rrtype, rrclass, rdata, ttl, newRecord));
-               return newRecord;
-       }
-
-       // Sets fNativeContext. Returns non-zero on error.
-       protected native int    CreateConnection();
-
-       // Sets fNativeContext. Returns non-zero on error.
-       protected native int    RegisterRecord( int flags, int ifIndex, String fullname, int rrtype, 
-                                                                               int rrclass, byte[] rdata, int ttl, AppleDNSRecord destObj);
-}
-
 class  AppleQuery extends AppleService
 {
        public                  AppleQuery( int flags, int ifIndex, String serviceName, int rrtype, 
index f73afeadd0fb6de9daf24cd2a7a40ab29d3ee570..595e405463ffa02a8e9f9c620c6a4e62a8275ab7 100644 (file)
@@ -1,28 +1,28 @@
-/* -*- Mode: Java; tab-width: 4 -*-
- *
+/*
  * Copyright (c) 2004 Apple Computer, Inc. All rights reserved.
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * @APPLE_LICENSE_HEADER_START@
  * 
- *     http://www.apache.org/licenses/LICENSE-2.0
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
  * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
  * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
 
     Change History (most recent first):
 
 $Log: DNSSDException.java,v $
-Revision 1.4  2006/08/14 23:25:08  cheshire
-Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
-
-Revision 1.3  2005/07/10 22:19:01  cheshire
-Add missing error codes to list of public static final ints
-
 Revision 1.2  2004/04/30 21:48:27  rpantos
 Change line endings for CVS.
 
@@ -50,23 +50,11 @@ abstract public class       DNSSDException extends Exception
     public static final int            BAD_FLAGS           = -65543;
     public static final int            UNSUPPORTED         = -65544;
     public static final int            NOT_INITIALIZED     = -65545;
-    public static final int            NO_CACHE            = -65546;
     public static final int            ALREADY_REGISTERED  = -65547;
     public static final int            NAME_CONFLICT       = -65548;
     public static final int            INVALID             = -65549;
-    public static final int            FIREWALL            = -65550;
     public static final int            INCOMPATIBLE        = -65551;
     public static final int            BAD_INTERFACE_INDEX = -65552;
-    public static final int            REFUSED             = -65553;
-    public static final int            NOSUCHRECORD        = -65554;
-    public static final int            NOAUTH              = -65555;
-    public static final int            NOSUCHKEY           = -65556;
-    public static final int            NATTRAVERSAL        = -65557;
-    public static final int            DOUBLENAT           = -65558;
-    public static final int            BADTIME             = -65559;
-    public static final int            BADSIG              = -65560;
-    public static final int            BADKEY              = -65561;
-    public static final int            TRANSIENT           = -65562;
 
        /** Returns the sub-code that identifies the particular error. */
        abstract public int                     getErrorCode();
diff --git a/mDNSShared/Java/DNSSDRecordRegistrar.java b/mDNSShared/Java/DNSSDRecordRegistrar.java
deleted file mode 100644 (file)
index 825634f..0000000
+++ /dev/null
@@ -1,77 +0,0 @@
-/* -*- Mode: Java; tab-width: 4 -*-
- *
- * Copyright (c) 2006 Apple Computer, Inc. All rights reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * 
- *     http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
-
-       This file declares the public interface to DNSSDRecordRegistrar, a DNSSDService
-       subclass that allows efficient registration of multiple individual records.
-
-    Change History (most recent first):
-
-$Log: DNSSDRecordRegistrar.java,v $
-Revision 1.2  2006/08/14 23:25:08  cheshire
-Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
-
-Revision 1.1  2006/06/20 23:00:12  rpantos
-<rdar://problem/3839132> Java needs to implement DNSServiceRegisterRecord equivalent
-
- */
-
-
-package        com.apple.dnssd;
-
-
-/**    An object for registering records, created by {@link DNSSD#createRecordRegistrar}. */
-
-public interface       DNSSDRecordRegistrar extends DNSSDService
-{
-       /** Register an independent {@link DNSRecord}.<P> 
-               @param  flags
-                                       Possible values are SHARED or UNIQUE (see flag type definitions for details).
-               <P>
-               @param  ifIndex
-                                       If non-zero, specifies the interface on which to register the record
-                                       (the index for a given interface is determined via the if_nametoindex()
-                                       family of calls.)  Passing 0 causes the record to be registered on all interfaces.
-               <P>
-               @param  fullname
-                                       The full domain name of the resource record.
-               <P>
-               @param  rrtype
-                                       The numerical type of the resource record to be queried for (e.g. PTR, SRV, etc)
-                                       as defined in nameser.h.
-               <P>
-               @param  rrclass
-                                       The class of the resource record, as defined in nameser.h 
-                                       (usually 1 for the Internet class).
-               <P>
-               @param  rData
-                                       The new rdata  as it is to appear in the DNS record.
-               <P>
-               @param  ttl
-                                       The time to live of the resource record, in seconds. Pass 0 to use a default value.
-               <P>
-               @param  listener
-                                       This object will get called when the service is registered.
-               <P>
-               @return         A {@link DNSSDService} that can be used to abort the record registration.
-
-               @throws SecurityException If a security manager is present and denies <tt>RuntimePermission("getDNSSDInstance")</tt>.
-               @see    RuntimePermission
-       */
-       public DNSRecord        registerRecord( int flags, int ifIndex, String fullname, int rrtype, 
-                                                                       int rrclass, byte[] rdata, int ttl)
-       throws DNSSDException;
-} 
-
index 86f2d831cd702d06f0f5ed95d3b5d784b69a41fa..4a4942f9d93fb706a1270f83f3522120f88c8406 100644 (file)
@@ -1,25 +1,28 @@
-/* -*- Mode: Java; tab-width: 4 -*-
- *
+/*
  * Copyright (c) 2004 Apple Computer, Inc. All rights reserved.
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * @APPLE_LICENSE_HEADER_START@
  * 
- *     http://www.apache.org/licenses/LICENSE-2.0
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
  * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
  * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
 
     Change History (most recent first):
 
 $Log: DNSSDRegistration.java,v $
-Revision 1.3  2006/08/14 23:25:08  cheshire
-Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
-
 Revision 1.2  2004/12/11 03:01:00  rpantos
 <rdar://problem/3907498> Java DNSRecord API should be cleaned up
 
index d5a8a38825a7ef93d95ef44a06d4629db245009d..98683720f1ad6e20d62009e3af85aac36887b613 100644 (file)
@@ -1,25 +1,28 @@
-/* -*- Mode: Java; tab-width: 4 -*-
- *
+/*
  * Copyright (c) 2004 Apple Computer, Inc. All rights reserved.
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * @APPLE_LICENSE_HEADER_START@
  * 
- *     http://www.apache.org/licenses/LICENSE-2.0
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
  * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
  * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
 
     Change History (most recent first):
 
 $Log: DNSSDService.java,v $
-Revision 1.3  2006/08/14 23:25:08  cheshire
-Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
-
 Revision 1.2  2004/04/30 21:48:27  rpantos
 Change line endings for CVS.
 
index 233c188da00dbd05a5b2caec7f92c4397974044e..bfb319af55d896b2605a2e4c67426c8f73b9d06a 100644 (file)
@@ -1,25 +1,28 @@
-/* -*- Mode: Java; tab-width: 4 -*-
- *
+/*
  * Copyright (c) 2004 Apple Computer, Inc. All rights reserved.
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * @APPLE_LICENSE_HEADER_START@
  * 
- *     http://www.apache.org/licenses/LICENSE-2.0
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
  * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
  * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
 
     Change History (most recent first):
 
 $Log: DomainListener.java,v $
-Revision 1.3  2006/08/14 23:25:08  cheshire
-Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
-
 Revision 1.2  2004/04/30 21:48:27  rpantos
 Change line endings for CVS.
 
index bd40fb9d4ab856dfaecaa31518713fefc79c74e5..902e85d02cefb95eb86823cbc54e1ec1cbabd158 100644 (file)
@@ -1,37 +1,28 @@
-/* -*- Mode: C; tab-width: 4 -*-
- *
+/*
  * Copyright (c) 2004 Apple Computer, Inc. All rights reserved.
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * @APPLE_LICENSE_HEADER_START@
  * 
- *     http://www.apache.org/licenses/LICENSE-2.0
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
  * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
  * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
 
     Change History (most recent first):
 
 $Log: JNISupport.c,v $
-Revision 1.17  2006/08/14 23:25:08  cheshire
-Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
-
-Revision 1.16  2006/07/14 02:35:47  cheshire
-Added (commented out) syslog debugging messages
-
-Revision 1.15  2006/06/27 19:34:43  cheshire
-<rdar://problem/4430023> txtRecord parameter of DNSServiceResolveReply() should be unsigned char *
-
-Revision 1.14  2006/06/20 23:03:35  rpantos
-<rdar://problem/3839132> Java needs to implement DNSServiceRegisterRecord equivalent
-
-Revision 1.13  2005/10/26 01:52:24  cheshire
-<rdar://problem/4316286> Race condition in Java code (doesn't work at all on Linux)
-
 Revision 1.12  2005/07/13 19:20:32  cheshire
 <rdar://problem/4175511> Race condition in Java API
 Additional cleanup suggested by Roger -- NewContext() doesn't need ownerClass parameter any more
@@ -114,8 +105,6 @@ static DWORD        if_nametoindex( const char * nameStr );
 
 #include "DNSSD.java.h"
 
-//#include <syslog.h>
-
 // convenience definition 
 #ifdef __GNUC__
 #define        _UNUSED __attribute__ ((unused))
@@ -273,13 +262,15 @@ JNIEXPORT void JNICALL Java_com_apple_dnssd_AppleService_HaltOperation( JNIEnv *
 }
 
 
-JNIEXPORT jint JNICALL Java_com_apple_dnssd_AppleService_BlockForData( JNIEnv *pEnv, jobject pThis)
-/* Block until data arrives, or one second passes. Returns 1 if data present, 0 otherwise. */
+JNIEXPORT jint JNICALL Java_com_apple_dnssd_AppleService_BlockForData( JNIEnv *pEnv, jobject pThis, jint msTimeout)
+/* Block for timeout ms (or forever if -1). Returns 1 if data present, 0 if timed out, -1 if not browsing. */
 {
-// BlockForData() not supported with AUTO_CALLBACKS 
-#if !AUTO_CALLBACKS
+#if AUTO_CALLBACKS
+       return -1;                              // BlockForData() not supported with AUTO_CALLBACKS 
+#else // AUTO_CALLBACKS
        jclass                  cls = (*pEnv)->GetObjectClass( pEnv, pThis);
        jfieldID                contextField = (*pEnv)->GetFieldID( pEnv, cls, "fNativeContext", "I");
+       jint                    rc = -1;
 
        if ( contextField != 0)
        {
@@ -288,32 +279,18 @@ JNIEXPORT jint JNICALL Java_com_apple_dnssd_AppleService_BlockForData( JNIEnv *p
                {
                        fd_set                  readFDs;
                        int                             sd = DNSServiceRefSockFD( pContext->ServiceRef);
-                       struct timeval  timeout = { 1, 0 };
+                       struct timeval  timeout = { msTimeout / 1000, 10 * (msTimeout % 1000) };
+                       struct timeval  *pTimeout = msTimeout == -1 ? NULL : &timeout;
+                       
                        FD_ZERO( &readFDs);
                        FD_SET( sd, &readFDs);
 
-                       // Q: Why do we poll here?
-                       // A: Because there's no other thread-safe way to do it.
-                       // Mac OS X terminates a select() call if you close one of the sockets it's listening on, but Linux does not,
-                       // and arguably Linux is correct (See <http://www.ussg.iu.edu/hypermail/linux/kernel/0405.1/0418.html>)
-                       // The problem is that the Mac OS X behaviour assumes that it's okay for one thread to close a socket while
-                       // some other thread is monitoring that socket in select(), but the difficulty is that there's no general way
-                       // to make that thread-safe, because there's no atomic way to enter select() and release a lock simultaneously.
-                       // If we try to do this without holding any lock, then right as we jump to the select() routine,
-                       // some other thread could stop our operation (thereby closing the socket),
-                       // and then that thread (or even some third, unrelated thread)
-                       // could do some other DNS-SD operation (or some other operation that opens a new file descriptor)
-                       // and then we'd blindly resume our fall into the select() call, now blocking on a file descriptor
-                       // that may coincidentally have the same numerical value, but is semantically unrelated
-                       // to the true file descriptor we thought we were blocking on.
-                       // We can't stop this race condition from happening, but at least if we wake up once a second we can detect
-                       // when fNativeContext has gone to zero, and thereby discover that we were blocking on the wrong fd.
-
-                       if (select( sd + 1, &readFDs, (fd_set*) NULL, (fd_set*) NULL, &timeout) == 1) return(1);
+                       rc = select( sd + 1, &readFDs, (fd_set*) NULL, (fd_set*) NULL, pTimeout);
                }
        }
-#endif // !AUTO_CALLBACKS
-       return(0);
+
+       return rc;
+#endif // AUTO_CALLBACKS
 }
 
 
@@ -424,7 +401,7 @@ JNIEXPORT jint JNICALL Java_com_apple_dnssd_AppleBrowser_CreateBrowser( JNIEnv *
 
 static void DNSSD_API  ServiceResolveReply( DNSServiceRef sdRef _UNUSED, DNSServiceFlags flags, uint32_t interfaceIndex,
                                                                DNSServiceErrorType errorCode, const char *fullname, const char *hosttarget,
-                                                               uint16_t port, uint16_t txtLen, const unsigned char *txtRecord, void *context)
+                                                               uint16_t port, uint16_t txtLen, const char *txtRecord, void *context)
 {
        OpContext               *pContext = (OpContext*) context;
        jclass                  txtCls;
@@ -535,7 +512,6 @@ JNIEXPORT jint JNICALL Java_com_apple_dnssd_AppleRegistration_BeginRegister( JNI
                                                        jint ifIndex, jint flags, jstring serviceName, jstring regType,
                                                        jstring domain, jstring host, jint port, jbyteArray txtRecord)
 {
-       //syslog(LOG_ERR, "BR");
        jclass                                  cls = (*pEnv)->GetObjectClass( pEnv, pThis);
        jfieldID                                contextField = (*pEnv)->GetFieldID( pEnv, cls, "fNativeContext", "I");
        OpContext                               *pContext = NULL;
@@ -543,8 +519,6 @@ JNIEXPORT jint JNICALL Java_com_apple_dnssd_AppleRegistration_BeginRegister( JNI
        jbyte                                   *pBytes;
        jsize                                   numBytes;
 
-       //syslog(LOG_ERR, "BR: contextField %d", contextField);
-
        if ( contextField != 0)
                pContext = NewContext( pEnv, pThis, "serviceRegistered",
                                                                "(Lcom/apple/dnssd/DNSSDRegistration;ILjava/lang/String;Ljava/lang/String;Ljava/lang/String;)V");
@@ -558,8 +532,6 @@ JNIEXPORT jint JNICALL Java_com_apple_dnssd_AppleRegistration_BeginRegister( JNI
                const char      *domainStr = SafeGetUTFChars( pEnv, domain);
                const char      *hostStr = SafeGetUTFChars( pEnv, host);
 
-               //syslog(LOG_ERR, "BR: regStr %s", regStr);
-
                // Since Java ints are defined to be big-endian, we de-canonicalize 'port' from a 
                // big-endian number into a 16-bit pattern here.
                uint16_t        portBits = port;
@@ -687,119 +659,6 @@ JNIEXPORT jint JNICALL Java_com_apple_dnssd_AppleDNSRecord_Remove( JNIEnv *pEnv,
 }
 
 
-JNIEXPORT jint JNICALL Java_com_apple_dnssd_AppleRecordRegistrar_CreateConnection( JNIEnv *pEnv, jobject pThis)
-{
-       jclass                                  cls = (*pEnv)->GetObjectClass( pEnv, pThis);
-       jfieldID                                contextField = (*pEnv)->GetFieldID( pEnv, cls, "fNativeContext", "I");
-       OpContext                               *pContext = NULL;
-       DNSServiceErrorType             err = kDNSServiceErr_NoError;
-
-       if ( contextField != 0)
-               pContext = NewContext( pEnv, pThis, "recordRegistered", "(Lcom/apple/dnssd/DNSRecord;I)V");
-       else
-               err = kDNSServiceErr_BadParam;
-
-       if ( pContext != NULL)
-       {
-               err = DNSServiceCreateConnection( &pContext->ServiceRef);
-               if ( err == kDNSServiceErr_NoError)
-               {
-                       (*pEnv)->SetIntField( pEnv, pThis, contextField, (jint) pContext);
-               }
-       }
-       else
-               err = kDNSServiceErr_NoMemory;
-
-       return err;
-}
-
-struct RecordRegistrationRef
-{
-       OpContext               *Context;
-       jobject                 RecordObj;
-};
-typedef struct RecordRegistrationRef   RecordRegistrationRef;
-
-static void DNSSD_API  RegisterRecordReply( DNSServiceRef sdRef _UNUSED, 
-                                                               DNSRecordRef recordRef _UNUSED, DNSServiceFlags flags, 
-                                                               DNSServiceErrorType errorCode, void *context)
-{
-       RecordRegistrationRef   *regEnvelope = (RecordRegistrationRef*) context;
-       OpContext               *pContext = regEnvelope->Context;
-
-       SetupCallbackState( &pContext->Env);
-
-       if ( pContext->ClientObj != NULL && pContext->Callback != NULL)
-       {       
-               if ( errorCode == kDNSServiceErr_NoError)
-               {       
-                       (*pContext->Env)->CallVoidMethod( pContext->Env, pContext->ClientObj, pContext->Callback, 
-                                                                                               regEnvelope->RecordObj, flags);
-               }
-               else
-                       ReportError( pContext->Env, pContext->ClientObj, pContext->JavaObj, errorCode);
-       }
-
-       (*pContext->Env)->DeleteWeakGlobalRef( pContext->Env, regEnvelope->RecordObj);
-       free( regEnvelope);
-
-       TeardownCallbackState();
-}
-
-JNIEXPORT jint JNICALL Java_com_apple_dnssd_AppleRecordRegistrar_RegisterRecord( JNIEnv *pEnv, jobject pThis, 
-                                                       jint flags, jint ifIndex, jstring fullname, jint rrType, jint rrClass, 
-                                                       jbyteArray rData, jint ttl, jobject destObj)
-{
-       jclass                                  cls = (*pEnv)->GetObjectClass( pEnv, pThis);
-       jfieldID                                contextField = (*pEnv)->GetFieldID( pEnv, cls, "fNativeContext", "I");
-       jclass                                  destCls = (*pEnv)->GetObjectClass( pEnv, destObj);
-       jfieldID                                recField = (*pEnv)->GetFieldID( pEnv, destCls, "fRecord", "I");
-       const char                              *nameStr = SafeGetUTFChars( pEnv, fullname);
-       OpContext                               *pContext = NULL;
-       DNSServiceErrorType             err = kDNSServiceErr_NoError;
-       jbyte                                   *pBytes;
-       jsize                                   numBytes;
-       DNSRecordRef                    recRef;
-       RecordRegistrationRef   *regEnvelope;
-
-       if ( contextField != 0)
-               pContext = (OpContext*) (*pEnv)->GetIntField( pEnv, pThis, contextField);
-       if ( pContext == NULL || pContext->ServiceRef == NULL || nameStr == NULL)
-               return kDNSServiceErr_BadParam;
-
-       regEnvelope = calloc( 1, sizeof *regEnvelope);
-       if ( regEnvelope == NULL)
-               return kDNSServiceErr_NoMemory;
-       regEnvelope->Context = pContext;
-       regEnvelope->RecordObj = (*pEnv)->NewWeakGlobalRef( pEnv, destObj);     // must convert local ref to global to cache
-
-       pBytes = (*pEnv)->GetByteArrayElements( pEnv, rData, NULL);
-       numBytes = (*pEnv)->GetArrayLength( pEnv, rData);
-
-       err = DNSServiceRegisterRecord( pContext->ServiceRef, &recRef, flags, ifIndex, 
-                                                                       nameStr, rrType, rrClass, numBytes, pBytes, ttl,
-                                                                       RegisterRecordReply, regEnvelope);
-
-       if ( err == kDNSServiceErr_NoError)
-       {
-               (*pEnv)->SetIntField( pEnv, destObj, recField, (jint) recRef);
-       }
-       else
-       {
-               if ( regEnvelope->RecordObj != NULL)
-                       (*pEnv)->DeleteWeakGlobalRef( pEnv, regEnvelope->RecordObj);
-               free( regEnvelope);
-       }
-
-       if ( pBytes != NULL)
-               (*pEnv)->ReleaseByteArrayElements( pEnv, rData, pBytes, 0);
-
-       SafeReleaseUTFChars( pEnv, fullname, nameStr);
-
-       return err;
-}
-
-
 static void DNSSD_API  ServiceQueryReply( DNSServiceRef sdRef _UNUSED, DNSServiceFlags flags, uint32_t interfaceIndex,
                                                                DNSServiceErrorType errorCode, const char *serviceName,
                                                                uint16_t rrtype, uint16_t rrclass, uint16_t rdlen,
@@ -972,7 +831,7 @@ JNIEXPORT jstring JNICALL Java_com_apple_dnssd_AppleDNSSD_GetNameForIfIndex( JNI
 {
        char                                    *p = LOCAL_ONLY_NAME, nameBuff[IF_NAMESIZE];
 
-       if (ifIndex != (jint) kDNSServiceInterfaceIndexLocalOnly)
+       if (ifIndex != kDNSServiceInterfaceIndexLocalOnly)
                p = if_indextoname( ifIndex, nameBuff );
 
        return (*pEnv)->NewStringUTF( pEnv, p);
index 042798c339262c9b26f76adf99f875fa2073f657..7ece74cf449c67c60b9c279407a0a9ea8aa1a3ad 100644 (file)
@@ -1,25 +1,28 @@
-/* -*- Mode: Java; tab-width: 4 -*-
- *
+/*
  * Copyright (c) 2004 Apple Computer, Inc. All rights reserved.
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * @APPLE_LICENSE_HEADER_START@
  * 
- *     http://www.apache.org/licenses/LICENSE-2.0
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
  * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
  * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
 
     Change History (most recent first):
 
 $Log: QueryListener.java,v $
-Revision 1.3  2006/08/14 23:25:08  cheshire
-Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
-
 Revision 1.2  2004/04/30 21:48:27  rpantos
 Change line endings for CVS.
 
index ea573f0152d626661f8e0670368e609cca5967c3..a6cf33191dff1529f482dd3e79c446cab86a91ae 100644 (file)
@@ -1,25 +1,28 @@
-/* -*- Mode: Java; tab-width: 4 -*-
- *
+/*
  * Copyright (c) 2004 Apple Computer, Inc. All rights reserved.
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * @APPLE_LICENSE_HEADER_START@
  * 
- *     http://www.apache.org/licenses/LICENSE-2.0
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
  * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
  * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
 
     Change History (most recent first):
 
 $Log: RegisterListener.java,v $
-Revision 1.3  2006/08/14 23:25:08  cheshire
-Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
-
 Revision 1.2  2004/04/30 21:48:27  rpantos
 Change line endings for CVS.
 
diff --git a/mDNSShared/Java/RegisterRecordListener.java b/mDNSShared/Java/RegisterRecordListener.java
deleted file mode 100644 (file)
index 247e5d5..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-/* -*- Mode: Java; tab-width: 4 -*-
- *
- * Copyright (c) 2004 Apple Computer, Inc. All rights reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * 
- *     http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
-
-    Change History (most recent first):
-
-$Log: RegisterRecordListener.java,v $
-Revision 1.2  2006/08/14 23:25:08  cheshire
-Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
-
-Revision 1.1  2006/06/20 23:00:12  rpantos
-<rdar://problem/3839132> Java needs to implement DNSServiceRegisterRecord equivalent
-
-
- */
-
-
-package        com.apple.dnssd;
-
-
-/**    A listener that receives results from {@link DNSSDRecordRegistrar#registerRecord}. */
-
-public interface RegisterRecordListener extends BaseListener
-{
-       /** Called when a record registration succeeds.<P> 
-
-               @param  record
-                                       A {@link DNSRecord}. 
-               <P>
-               @param  flags
-                                       Currently ignored, reserved for future use.
-               <P>
-       */
-       void    recordRegistered( DNSRecord record, int flags);
-}
-
index 168edb21f29d5a6f58240c20ff6780935019275f..0e213531178d557789c6f31c2e3e89d2a4648df5 100644 (file)
@@ -1,25 +1,28 @@
-/* -*- Mode: Java; tab-width: 4 -*-
- *
+/*
  * Copyright (c) 2004 Apple Computer, Inc. All rights reserved.
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * @APPLE_LICENSE_HEADER_START@
  * 
- *     http://www.apache.org/licenses/LICENSE-2.0
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
  * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
  * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
 
     Change History (most recent first):
 
 $Log: ResolveListener.java,v $
-Revision 1.3  2006/08/14 23:25:08  cheshire
-Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
-
 Revision 1.2  2004/04/30 21:48:27  rpantos
 Change line endings for CVS.
 
index 9dbe14e021948c4a60cc2f36bdd9afa5e27948fd..5eed93eb74b44179ab9313d6fa999bce13a7b3d9 100644 (file)
@@ -1,25 +1,28 @@
-/* -*- Mode: Java; tab-width: 4 -*-
- *
+/*
  * Copyright (c) 2004 Apple Computer, Inc. All rights reserved.
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * @APPLE_LICENSE_HEADER_START@
  * 
- *     http://www.apache.org/licenses/LICENSE-2.0
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
  * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
  * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
 
     Change History (most recent first):
 
 $Log: TXTRecord.java,v $
-Revision 1.6  2006/08/14 23:25:08  cheshire
-Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
-
 Revision 1.5  2004/08/25 21:54:36  rpantos
 <rdar://problem/3773973> Fix getValue() for values containing '='.
 
index d6385b5989d3f6864d41029967b181aaca84654d..6ec40da052ad9c2a8856cb36a3e852db4e4f1d79 100644 (file)
@@ -2,24 +2,28 @@
  *
  * Copyright (c) 2004 Apple Computer, Inc. All rights reserved.
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * 
- *     http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
+ * @APPLE_LICENSE_HEADER_START@
+ *
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
+ *
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
  * limitations under the License.
+ *
+ * @APPLE_LICENSE_HEADER_END@
 
     Change History (most recent first):
 
 $Log: PlatformCommon.c,v $
-Revision 1.7  2006/08/14 23:24:56  cheshire
-Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
-
 Revision 1.6  2005/04/08 21:30:16  ksekar
 <rdar://problem/4007457> Compiling problems with mDNSResponder-98 on Solaris/Sparc v9
 Patch submitted by Bernd Kuhls
index ed18d857d95de941c88882c94e8bf7fdb1f88094..46a672ad66b4b591347dd11f526fbabfc8c9a1b2 100644 (file)
@@ -2,24 +2,28 @@
  *
  * Copyright (c) 2004 Apple Computer, Inc. All rights reserved.
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * 
- *     http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
+ * @APPLE_LICENSE_HEADER_START@
+ *
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
+ *
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
  * limitations under the License.
+ *
+ * @APPLE_LICENSE_HEADER_END@
 
     Change History (most recent first):
 
 $Log: PlatformCommon.h,v $
-Revision 1.4  2006/08/14 23:24:56  cheshire
-Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
-
 Revision 1.3  2005/01/19 19:19:21  ksekar
 <rdar://problem/3960191> Need a way to turn off domain discovery
 
index 0e4e2b6ffe4fdf4be0b5c5c9ac36c5b7a2df4720..3611200db597036fc98a6f8bfb66e019fc779bab 100644 (file)
@@ -1,26 +1,25 @@
-.\" -*- tab-width: 4 -*-
-.\" 
 .\" Copyright (c) 2004 Apple Computer, Inc. All Rights Reserved.
 .\" 
-.\" Licensed under the Apache License, Version 2.0 (the "License");
-.\" you may not use this file except in compliance with the License.
-.\" You may obtain a copy of the License at
+.\" @APPLE_LICENSE_HEADER_START@
 .\" 
-.\"     http://www.apache.org/licenses/LICENSE-2.0
+.\" This file contains Original Code and/or Modifications of Original Code
+.\" as defined in and that are subject to the Apple Public Source License
+.\" Version 2.0 (the 'License'). You may not use this file except in
+.\" compliance with the License. Please obtain a copy of the License at
+.\" http://www.opensource.apple.com/apsl/ and read it before using this
+.\" file.
 .\" 
-.\" Unless required by applicable law or agreed to in writing, software
-.\" distributed under the License is distributed on an "AS IS" BASIS,
-.\" WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-.\" See the License for the specific language governing permissions and
+.\" The Original Code and all software distributed under the License are
+.\" distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+.\" EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+.\" INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+.\" FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+.\" Please see the License for the specific language governing rights and
 .\" limitations under the License.
+.\" 
+.\" @APPLE_LICENSE_HEADER_END@
 .\"
 .\" $Log: dns-sd.1,v $
-.\" Revision 1.6  2006/08/14 23:24:56  cheshire
-.\" Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
-.\"
-.\" Revision 1.5  2005/07/04 23:12:35  cheshire
-.\" <rdar://problem/4103628> The dns-sd command first appeared in Mac OS X 10.4 (Tiger)
-.\"
 .\" Revision 1.4  2005/02/16 02:29:32  cheshire
 .\" Update terminology
 .\"
@@ -212,4 +211,4 @@ bugs are tracked in Apple Radar component "mDNSResponder".
 .Sh HISTORY
 The
 .Nm
-command first appeared in Mac OS X 10.4 (Tiger).
+command first appeared in Mac OS X 10.3 (Panther).
index b7eb8a229a41ae3dc69691dbf2be2bc8cc3d5811..99bff67400bed47d6b642183e3be87aae677ef99 100755 (executable)
@@ -1,5 +1,4 @@
-/* -*- Mode: C; tab-width: 4 -*-
- *
+/*
  * Copyright (c) 2003-2004, Apple Computer, Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without 
 #endif
 
 /* standard calling convention under Win32 is __stdcall */
-/* Note: When compiling Intel EFI (Extensible Firmware Interface) under MS Visual Studio, the */
-/* _WIN32 symbol is defined by the compiler even though it's NOT compiling code for Windows32 */
-#if defined(_WIN32) && !defined(EFI32) && !defined(EFI64)
+#if defined(_WIN32)
 #define DNSSD_API __stdcall
 #else
 #define DNSSD_API
 #endif
 
+#if defined(__FreeBSD_version) && (__FreeBSD_version < 500000)
 /* stdint.h does not exist on FreeBSD 4.x; its types are defined in sys/types.h instead */
-#if defined(__FreeBSD__) && (__FreeBSD__ < 5)
 #include <sys/types.h>
-
-/* Likewise, on Sun, standard integer types are in sys/types.h */
 #elif defined(__sun__)
 #include <sys/types.h>
-
-/* EFI does not have stdint.h, or anything else equivalent */
-#elif defined(EFI32) || defined(EFI64)
-typedef UINT8       uint8_t;
-typedef INT8        int8_t;
-typedef UINT16      uint16_t;
-typedef INT16       int16_t;
-typedef UINT32      uint32_t;
-typedef INT32       int32_t;
-
-/* Windows has its own differences */
 #elif defined(_WIN32)
 #include <windows.h>
 #define _UNUSED
@@ -72,8 +56,6 @@ typedef INT16       int16_t;
 typedef UINT32      uint32_t;
 typedef INT32       int32_t;
 #endif
-
-/* All other Posix platforms use stdint.h */
 #else
 #include <stdint.h>
 #endif
@@ -146,15 +128,10 @@ enum
      * (queries from hosts more than one hop away; hosts not directly connected to the local link).
      */
 
-    kDNSServiceFlagsForceMulticast      = 0x400,
+    kDNSServiceFlagsForceMulticast      = 0x400
     /* Flag for signifying that a query or registration should be performed exclusively via multicast DNS,
      * even for a name in a domain (e.g. foo.apple.com.) that would normally imply unicast DNS.
      */
-     
-    kDNSServiceFlagsReturnCNAME         = 0x800
-    /* Flag for returning CNAME records in the DNSServiceQueryRecord call. CNAME records are
-     * normally followed without indicating to the client that there was a CNAME record.
-     */
     };
 
 /*
@@ -202,7 +179,7 @@ enum
     kDNSServiceType_KEY       = 25,     /* Security key. */
     kDNSServiceType_PX        = 26,     /* X.400 mail mapping. */
     kDNSServiceType_GPOS      = 27,     /* Geographical position (withdrawn). */
-    kDNSServiceType_AAAA      = 28,     /* IPv6 Address. */
+    kDNSServiceType_AAAA      = 28,     /* Ip6 Address. */
     kDNSServiceType_LOC       = 29,     /* Location Information. */
     kDNSServiceType_NXT       = 30,     /* Next domain (security). */
     kDNSServiceType_EID       = 31,     /* Endpoint identifier. */
@@ -212,7 +189,7 @@ enum
     kDNSServiceType_NAPTR     = 35,     /* Naming Authority PoinTeR */
     kDNSServiceType_KX        = 36,     /* Key Exchange */
     kDNSServiceType_CERT      = 37,     /* Certification record */
-    kDNSServiceType_A6        = 38,     /* IPv6 Address (deprecated) */
+    kDNSServiceType_A6        = 38,     /* IPv6 address (deprecates AAAA) */
     kDNSServiceType_DNAME     = 39,     /* Non-terminal DNAME (for IPv6) */
     kDNSServiceType_SINK      = 40,     /* Kitchen sink (experimentatl) */
     kDNSServiceType_OPT       = 41,     /* EDNS0 option (meta-RR) */
@@ -324,7 +301,7 @@ enum
  * 
  * If the client passes 0 for interface index, that means "do the right thing",
  * which (at present) means, "if the name is in an mDNS local multicast domain
- * (e.g. 'local.', '254.169.in-addr.arpa.', '{8,9,A,B}.E.F.ip6.arpa.') then multicast
+ * (e.g. 'local.', '254.169.in-addr.arpa.', '0.8.E.F.ip6.arpa.') then multicast
  * on all applicable interfaces, otherwise send via unicast to the appropriate
  * DNS server." Normally, most clients will use 0 for interface index to
  * automatically get the default sensible behaviour.
@@ -629,9 +606,6 @@ typedef void (DNSSD_API *DNSServiceRegisterReply)
  *                  i.e. it creates a TXT record of length one containing a single empty string.
  *                  RFC 1035 doesn't allow a TXT record to contain *zero* strings, so a single empty
  *                  string is the smallest legal DNS TXT record.
- *                  As with the other parameters, the DNSServiceRegister call copies the txtRecord
- *                  data; e.g. if you allocated the storage for the txtRecord parameter with malloc()
- *                  then you can safely free that memory right after the DNSServiceRegister call returns.
  *
  * callBack:        The function to be called when the registration completes or asynchronously
  *                  fails.  The client MAY pass NULL for the callback -  The client will NOT be notified
@@ -647,6 +621,7 @@ typedef void (DNSSD_API *DNSServiceRegisterReply)
  *                  errors are delivered to the callback), otherwise returns an error code indicating
  *                  the error that occurred (the callback is never invoked and the DNSServiceRef
  *                  is not initialized.)
+ *
  */
 
 DNSServiceErrorType DNSSD_API DNSServiceRegister
@@ -673,12 +648,6 @@ DNSServiceErrorType DNSSD_API DNSServiceRegister
  * The record can later be updated or deregistered by passing the RecordRef initialized
  * by this function to DNSServiceUpdateRecord() or DNSServiceRemoveRecord().
  *
- * Note that the DNSServiceAddRecord/UpdateRecord/RemoveRecord are *NOT* thread-safe
- * with respect to a single DNSServiceRef. If you plan to have multiple threads
- * in your program simultaneously add, update, or remove records from the same
- * DNSServiceRef, then it's the caller's responsibility to use a mutext lock
- * or take similar appropriate precautions to serialize those calls.
- *
  *
  * Parameters;
  *
@@ -928,23 +897,9 @@ DNSServiceErrorType DNSSD_API DNSServiceBrowse
  *
  * txtRecord:       The service's primary txt record, in standard txt record format.
  *
+
  * context:         The context pointer that was passed to the callout.
  *
- * NOTE: In earlier versions of this header file, the txtRecord parameter was declared "const char *"
- * This is incorrect, since it contains length bytes which are values in the range 0 to 255, not -128 to +127.
- * Depending on your compiler settings, this change may cause signed/unsigned mismatch warnings.
- * These should be fixed by updating your own callback function definition to match the corrected
- * function signature using "const unsigned char *txtRecord". Making this change may also fix inadvertent
- * bugs in your callback function, where it could have incorrectly interpreted a length byte with value 250
- * as being -6 instead, with various bad consequences ranging from incorrect operation to software crashes.
- * If you need to maintain portable code that will compile cleanly with both the old and new versions of
- * this header file, you should update your callback function definition to use the correct unsigned value,
- * and then in the place where you pass your callback function to DNSServiceResolve(), use a cast to eliminate
- * the compiler warning, e.g.:
- *   DNSServiceResolve(sd, flags, index, name, regtype, domain, (DNSServiceResolveReply)MyCallback, context);
- * This will ensure that your code compiles cleanly without warnings (and more importantly, works correctly)
- * with both the old header and with the new corrected version.
- *
  */
 
 typedef void (DNSSD_API *DNSServiceResolveReply)
@@ -957,7 +912,7 @@ typedef void (DNSSD_API *DNSServiceResolveReply)
     const char                          *hosttarget,
     uint16_t                            port,
     uint16_t                            txtLen,
-    const unsigned char                 *txtRecord,
+    const char                          *txtRecord,
     void                                *context
     );
 
@@ -1050,7 +1005,7 @@ DNSServiceErrorType DNSSD_API DNSServiceCreateConnection(DNSServiceRef *sdRef);
  * DNSServiceRegisterRecordReply() parameters:
  *
  * sdRef:           The connected DNSServiceRef initialized by
- *                  DNSServiceCreateConnection().
+ *                  DNSServiceDiscoveryConnect().
  *
  * RecordRef:       The DNSRecordRef initialized by DNSServiceRegisterRecord().  If the above
  *                  DNSServiceRef is passed to DNSServiceRefDeallocate(), this DNSRecordRef is
@@ -1265,7 +1220,7 @@ DNSServiceErrorType DNSSD_API DNSServiceQueryRecord
  *
  */
 
-DNSServiceErrorType DNSSD_API DNSServiceReconfirmRecord
+void DNSSD_API DNSServiceReconfirmRecord
     (
     DNSServiceFlags                    flags,
     uint32_t                           interfaceIndex,
@@ -1471,6 +1426,7 @@ DNSServiceErrorType DNSSD_API TXTRecordSetValue
  * return value:    Returns kDNSServiceErr_NoError on success.
  *                  Returns kDNSServiceErr_NoSuchKey if the "key" does not
  *                  exist in the TXTRecordRef.
+ *
  */
 
 DNSServiceErrorType DNSSD_API TXTRecordRemoveValue
@@ -1490,6 +1446,7 @@ DNSServiceErrorType DNSSD_API TXTRecordRemoveValue
  *                  which you can pass directly to DNSServiceRegister() or
  *                  to DNSServiceUpdateRecord().
  *                  Returns 0 if the TXTRecordRef is empty.
+ *
  */
 
 uint16_t DNSSD_API TXTRecordGetLength
@@ -1507,6 +1464,7 @@ uint16_t DNSSD_API TXTRecordGetLength
  * return value:    Returns a pointer to the raw bytes inside the TXTRecordRef
  *                  which you can pass directly to DNSServiceRegister() or
  *                  to DNSServiceUpdateRecord().
+ *
  */
 
 const void * DNSSD_API TXTRecordGetBytesPtr
@@ -1561,6 +1519,7 @@ const void * DNSSD_API TXTRecordGetBytesPtr
  *
  * return value:    Returns 1 if the TXT Record contains the specified key.
  *                  Otherwise, it returns 0.
+ *
  */
 
 int DNSSD_API TXTRecordContainsKey
index 796ca84ce56e632ea1ec6ae4ce98cb22d3fce30c..12009f68574e9b0ff26586a818b102bb28afe7c6 100644 (file)
@@ -1,23 +1,25 @@
-.\" -*- tab-width: 4 -*-
-.\" 
 .\" Copyright (c) 2004 Apple Computer, Inc. All Rights Reserved.
 .\" 
-.\" Licensed under the Apache License, Version 2.0 (the "License");
-.\" you may not use this file except in compliance with the License.
-.\" You may obtain a copy of the License at
+.\" @APPLE_LICENSE_HEADER_START@
 .\" 
-.\"     http://www.apache.org/licenses/LICENSE-2.0
+.\" This file contains Original Code and/or Modifications of Original Code
+.\" as defined in and that are subject to the Apple Public Source License
+.\" Version 2.0 (the 'License'). You may not use this file except in
+.\" compliance with the License. Please obtain a copy of the License at
+.\" http://www.opensource.apple.com/apsl/ and read it before using this
+.\" file.
 .\" 
-.\" Unless required by applicable law or agreed to in writing, software
-.\" distributed under the License is distributed on an "AS IS" BASIS,
-.\" WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-.\" See the License for the specific language governing permissions and
+.\" The Original Code and all software distributed under the License are
+.\" distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+.\" EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+.\" INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+.\" FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+.\" Please see the License for the specific language governing rights and
 .\" limitations under the License.
+.\" 
+.\" @APPLE_LICENSE_HEADER_END@
 .\"
 .\" $Log: dnsextd.8,v $
-.\" Revision 1.2  2006/08/14 23:24:56  cheshire
-.\" Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
-.\"
 .\" Revision 1.1  2004/08/15 18:49:18  cheshire
 .\" <rdar://problem/3763030> No man page for dnsextd
 .\"
diff --git a/mDNSShared/dnsextd.c b/mDNSShared/dnsextd.c
deleted file mode 100644 (file)
index be795c5..0000000
+++ /dev/null
@@ -1,2118 +0,0 @@
-/* -*- Mode: C; tab-width: 4 -*-
- *
- * Copyright (c) 2002-2004 Apple Computer, Inc. All rights reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * 
- *     http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
-
-    Change History (most recent first):
-
-$Log: dnsextd.c,v $
-Revision 1.33.2.2  2006/08/29 06:24:36  cheshire
-Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
-
-Revision 1.33.2.1  2005/08/05 21:14:00  ksekar
-<rdar://problem/4012279> Long-lived queries not working on windows
-Change constant names
-
-Revision 1.33  2005/03/11 19:09:02  ksekar
-Fixed ZERO_LLQID macro
-
-Revision 1.32  2005/03/10 22:54:33  ksekar
-<rdar://problem/4046285> dnsextd leaks memory/ports
-
-Revision 1.31  2005/02/24 02:37:57  ksekar
-<rdar://problem/4021977> dnsextd memory management improvements
-
-Revision 1.30  2005/01/27 22:57:56  cheshire
-Fix compile errors on gcc4
-
-Revision 1.29  2004/12/22 00:13:50  ksekar
-<rdar://problem/3873993> Change version, port, and polling interval for LLQ
-
-Revision 1.28  2004/12/17 00:30:00  ksekar
-<rdar://problem/3924045> dnsextd memory leak
-
-Revision 1.27  2004/12/17 00:27:32  ksekar
-Ignore SIGPIPE
-
-Revision 1.26  2004/12/17 00:21:33  ksekar
-Fixes for new CacheRecord structure with indirect name pointer
-
-Revision 1.25  2004/12/16 20:13:02  cheshire
-<rdar://problem/3324626> Cache memory management improvements
-
-Revision 1.24  2004/12/14 17:09:06  ksekar
-fixed incorrect usage instructions
-
-Revision 1.23  2004/12/06 20:24:31  ksekar
-<rdar://problem/3907303> dnsextd leaks sockets
-
-Revision 1.22  2004/12/03 20:20:29  ksekar
-<rdar://problem/3904149> dnsextd: support delivery of large records via LLQ events
-
-Revision 1.21  2004/12/03 06:11:34  ksekar
-<rdar://problem/3885059> clean up dnsextd arguments
-
-Revision 1.20  2004/12/01 04:27:28  cheshire
-<rdar://problem/3872803> Darwin patches for Solaris and Suse
-Don't use uint32_t, etc. -- they require stdint.h, which doesn't exist on FreeBSD 4.x, Solaris, etc.
-
-Revision 1.19  2004/12/01 01:16:29  cheshire
-Solaris compatibility fixes
-
-Revision 1.18  2004/11/30 23:51:06  cheshire
-Remove double semicolons
-
-Revision 1.17  2004/11/30 22:37:01  cheshire
-Update copyright dates and add "Mode: C; tab-width: 4" headers
-
-Revision 1.16  2004/11/25 02:02:28  ksekar
-Fixed verbose log message argument
-
-Revision 1.15  2004/11/19 02:35:02  ksekar
-<rdar://problem/3886317> Wide Area Security: Add LLQ-ID to events
-
-Revision 1.14  2004/11/17 06:17:58  cheshire
-Update comments to show correct SRV names: _dns-update._udp.<zone>. and _dns-llq._udp.<zone>.
-
-Revision 1.13  2004/11/13 02:22:36  ksekar
-<rdar://problem/3878201> Refresh Acks from daemon malformatted
-
-Revision 1.12  2004/11/12 01:05:01  ksekar
-<rdar://problem/3876757> dnsextd: daemon registers the SRV same record
-twice at startup
-
-Revision 1.11  2004/11/12 01:03:31  ksekar
-<rdar://problem/3876776> dnsextd: KnownAnswers (CacheRecords) leaked
-
-Revision 1.10  2004/11/12 00:35:28  ksekar
-<rdar://problem/3876705> dnsextd: uninitialized pointer can cause crash
-
-Revision 1.9  2004/11/10 20:38:17  ksekar
-<rdar://problem/3874168> dnsextd: allow a "fudge" in LLQ lease echo
-
-Revision 1.8  2004/11/01 17:48:14  cheshire
-Changed SOA serial number back to signed. RFC 1035 may describe it as "unsigned", but
-it's wrong. The SOA serial is a modular counter, as explained in "DNS & BIND", page
-137. Since C doesn't have a modular type, we used signed, C's closest approximation.
-
-Revision 1.7  2004/10/30 00:06:58  ksekar
-<rdar://problem/3722535> Support Long Lived Queries in DNS Extension daemon
-
-Revision 1.6  2004/09/17 01:08:54  cheshire
-Renamed mDNSClientAPI.h to mDNSEmbeddedAPI.h
-  The name "mDNSClientAPI.h" is misleading to new developers looking at this code. The interfaces
-  declared in that file are ONLY appropriate to single-address-space embedded applications.
-  For clients on general-purpose computers, the interfaces defined in dns_sd.h should be used.
-
-Revision 1.5  2004/09/16 00:50:54  cheshire
-Don't use MSG_WAITALL -- it returns "Invalid argument" on some Linux versions
-
-Revision 1.4  2004/09/14 23:27:48  cheshire
-Fix compile errors
-
-Revision 1.3  2004/09/02 01:39:40  cheshire
-For better readability, follow consistent convention that QR bit comes first, followed by OP bits
-
-Revision 1.2  2004/08/24 23:27:57  cheshire
-Fixes for Linux compatibility:
-Don't use strings.h
-Don't assume SIGINFO
-Don't try to set servaddr.sin_len on platforms that don't have sa_len
-
-Revision 1.1  2004/08/11 00:43:26  ksekar
-<rdar://problem/3722542>: DNS Extension daemon for DNS Update Lease
-
-*/
-
-#include "../mDNSCore/mDNSEmbeddedAPI.h"
-#include "../mDNSCore/DNSCommon.h"
-#include "../mDNSCore/mDNS.c"
-//!!!KRS we #include mDNS.c for the various constants defined there  - we should move these to DNSCommon.h
-
-#include <signal.h>
-#include <pthread.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-#include <stdio.h>
-#include <syslog.h>
-#include <string.h>
-#include <sys/time.h>
-#include <time.h>
-#include <errno.h>
-
-// Compatibility workaround
-#ifndef AF_LOCAL
-#define AF_LOCAL AF_UNIX
-#endif
-
-//
-// Constants
-//
-
-#define LOOPBACK "127.0.0.1"
-#define NS_PORT 53
-#define DAEMON_PORT 5352                // default, may be overridden via command line argument
-#define LISTENQ 128                     // tcp connection backlog
-#define RECV_BUFLEN 9000                
-#define LEASETABLE_INIT_NBUCKETS 256    // initial hashtable size (doubles as table fills)
-#define LLQ_TABLESIZE 1024              // !!!KRS make this dynamically growable
-#define EXPIRATION_INTERVAL 300          // check for expired records every 5 minutes
-#define SRV_TTL 7200                    // TTL For _dns-update SRV records
-
-// LLQ Lease bounds (seconds)
-#define LLQ_MIN_LEASE (15 * 60)
-#define LLQ_MAX_LEASE (120 * 60)
-#define LLQ_LEASE_FUDGE 60
-
-// LLQ SOA poll interval (microseconds)
-#define LLQ_MONITOR_ERR_INTERVAL (60 * 1000000)
-#define LLQ_MONITOR_INTERVAL 250000
-#ifdef SIGINFO
-#define INFO_SIGNAL SIGINFO
-#else
-#define INFO_SIGNAL SIGUSR1
-#endif
-
-#define SAME_INADDR(x,y) (*((mDNSu32 *)&x) == *((mDNSu32 *)&y))
-#define ZERO_LLQID(x) (!memcmp(x, "\x0\x0\x0\x0\x0\x0\x0\x0", 8))
-
-//
-// Data Structures
-// Structs/fields that must be locked for thread safety are explicitly commented
-//
-
-typedef struct
-       {
-    struct sockaddr_in src;
-    size_t len;
-    DNSMessage msg;
-    // Note: extra storage for oversized (TCP) messages goes here
-       } PktMsg;
-
-// lease table entry
-typedef struct RRTableElem
-       {
-    struct RRTableElem *next;
-    struct sockaddr_in cli;   // client's source address
-    long expire;              // expiration time, in seconds since epoch
-    domainname zone;          // from zone field of update message
-    domainname name;          // name of the record
-    CacheRecord rr;           // last field in struct allows for allocation of oversized RRs
-       } RRTableElem;
-
-typedef enum
-       {
-       RequestReceived = 0,
-       ChallengeSent   = 1,
-       Established     = 2
-       } LLQState;
-
-typedef struct AnswerListElem
-       {
-    struct AnswerListElem *next;
-    domainname name;
-    mDNSu16 type;
-    CacheRecord *KnownAnswers;  // All valid answers delivered to client
-    CacheRecord *EventList;     // New answers (adds/removes) to be sent to client
-    int refcount;          
-       } AnswerListElem;
-
-// llq table entry
-typedef struct LLQEntry
-       {
-    struct LLQEntry *next;     
-    struct sockaddr_in cli;   // clien'ts source address 
-    domainname qname;
-    mDNSu16 qtype;
-    mDNSu8 id[8];
-    LLQState state;
-    mDNSu32 lease;            // original lease, in seconds
-    mDNSs32 expire;           // expiration, absolute, in seconds since epoch
-    AnswerListElem *AnswerList;
-       } LLQEntry;
-
-// daemon-wide information
-typedef struct 
-       {
-    // server variables - read only after initialization (no locking)
-    struct in_addr saddr;      // server address
-    domainname zone;           // zone being updated
-    int tcpsd;                 // listening TCP socket
-    int udpsd;                 // listening UDP socket
-
-    // daemon variables - read only after initialization (no locking)
-    uDNS_AuthInfo *AuthInfo;   // linked list of keys for signing deletion updates
-    mDNSIPPort port;           // listening port
-
-    // lease table variables (locked via mutex after initialization)
-    RRTableElem **table;       // hashtable for records with leases
-    pthread_mutex_t tablelock; // mutex for lease table
-    mDNSs32 nbuckets;          // buckets allocated
-    mDNSs32 nelems;            // elements in table
-
-    // LLQ table variables
-    LLQEntry *LLQTable[LLQ_TABLESIZE];  // !!!KRS change this and RRTable to use a common data structure
-    AnswerListElem *AnswerTable[LLQ_TABLESIZE];
-    int LLQEventListenSock;       // Unix domain socket pair - polling thread writes to ServPollSock, which wakes
-    int LLQServPollSock;          // the main thread listening on EventListenSock, indicating that the zone has changed
-       } DaemonInfo;
-
-// args passed to UDP request handler thread as void*
-typedef struct
-       {
-    PktMsg pkt;
-    struct sockaddr_in cliaddr;
-    DaemonInfo *d;
-       } UDPRequestArgs;
-
-// args passed to TCP request handler thread as void*
-typedef struct
-       {
-    int sd;                     // socket connected to client
-    struct sockaddr_in cliaddr; 
-    DaemonInfo *d;
-       } TCPRequestArgs;
-
-//
-// Global Variables
-//
-
-// booleans to determine runtime output
-// read-only after initialization (no mutex protection)
-static mDNSBool foreground = 0;
-static mDNSBool verbose = 0;
-
-// globals set via signal handler (accessed exclusively by main select loop and signal handler)
-static mDNSBool terminate = 0;
-static mDNSBool dumptable = 0;
-
-//
-// Logging Routines
-// Log messages are delivered to syslog unless -f option specified
-//
-
-// common message logging subroutine
-mDNSlocal void PrintLog(const char *buffer)
-       {
-       if (foreground) 
-               {
-               fprintf(stderr,"%s\n", buffer);
-               fflush(stderr);
-               }
-       else                            
-               {
-               openlog("dnsextd", LOG_CONS | LOG_PERROR, LOG_DAEMON);
-               syslog(LOG_ERR, "%s", buffer);
-               closelog();
-               }
-       }
-
-// Verbose Logging (conditional on -v option)
-mDNSlocal void VLog(const char *format, ...)
-       {
-       char buffer[512];
-       va_list ptr;
-
-       if (!verbose) return;
-       va_start(ptr,format);
-       buffer[mDNS_vsnprintf((char *)buffer, sizeof(buffer), format, ptr)] = 0;
-       va_end(ptr);
-       PrintLog(buffer);
-       }
-
-// Unconditional Logging
-mDNSlocal void Log(const char *format, ...)
-       {
-       char buffer[512];
-       va_list ptr;
-
-       va_start(ptr,format);
-       buffer[mDNS_vsnprintf((char *)buffer, sizeof(buffer), format, ptr)] = 0;
-       va_end(ptr);
-       PrintLog(buffer);
-       }
-
-// Error Logging
-// prints message "dnsextd <function>: <operation> - <error message>" 
-// must be compiled w/ -D_REENTRANT  for thread-safe errno usage
-mDNSlocal void LogErr(const char *fn, const char *operation)
-       {
-       char buf[512];
-       snprintf(buf, sizeof(buf), "%s: %s - %s", fn, operation, strerror(errno));
-       PrintLog(buf);
-       }
-
-//
-// Networking Utility Routines
-//
-
-// Convert DNS Message Header from Network to Host byte order
-mDNSlocal void HdrNToH(PktMsg *pkt)
-       {
-       // Read the integer parts which are in IETF byte-order (MSB first, LSB second)
-       mDNSu8 *ptr = (mDNSu8 *)&pkt->msg.h.numQuestions;
-       pkt->msg.h.numQuestions   = (mDNSu16)((mDNSu16)ptr[0] <<  8 | ptr[1]);
-       pkt->msg.h.numAnswers     = (mDNSu16)((mDNSu16)ptr[2] <<  8 | ptr[3]);
-       pkt->msg.h.numAuthorities = (mDNSu16)((mDNSu16)ptr[4] <<  8 | ptr[5]);
-       pkt->msg.h.numAdditionals = (mDNSu16)((mDNSu16)ptr[6] <<  8 | ptr[7]);
-       }
-
-// Convert DNS Message Header from Host to Network byte order
-mDNSlocal void HdrHToN(PktMsg *pkt)
-       {
-       mDNSu16 numQuestions   = pkt->msg.h.numQuestions;
-       mDNSu16 numAnswers     = pkt->msg.h.numAnswers;
-       mDNSu16 numAuthorities = pkt->msg.h.numAuthorities;
-       mDNSu16 numAdditionals = pkt->msg.h.numAdditionals;
-       mDNSu8 *ptr = (mDNSu8 *)&pkt->msg.h.numQuestions;
-
-       // Put all the integer values in IETF byte-order (MSB first, LSB second)
-       *ptr++ = (mDNSu8)(numQuestions   >> 8);
-       *ptr++ = (mDNSu8)(numQuestions   &  0xFF);
-       *ptr++ = (mDNSu8)(numAnswers     >> 8);
-       *ptr++ = (mDNSu8)(numAnswers     &  0xFF);
-       *ptr++ = (mDNSu8)(numAuthorities >> 8);
-       *ptr++ = (mDNSu8)(numAuthorities &  0xFF);
-       *ptr++ = (mDNSu8)(numAdditionals >> 8);
-       *ptr++ = (mDNSu8)(numAdditionals &  0xFF);
-       }
-
-// create a socket connected to nameserver
-// caller terminates connection via close()
-mDNSlocal int ConnectToServer(DaemonInfo *d)
-       {
-       struct sockaddr_in servaddr;
-       int sd;
-       
-       bzero(&servaddr, sizeof(servaddr));
-       if (d->saddr.s_addr) servaddr.sin_addr = d->saddr;
-       else                 inet_pton(AF_INET, LOOPBACK, &d->saddr);  // use loopback if server not explicitly specified                       
-       servaddr.sin_port = htons(NS_PORT);
-       servaddr.sin_family = AF_INET;
-#ifndef NOT_HAVE_SA_LEN
-       servaddr.sin_len = sizeof(servaddr); 
-#endif
-       sd = socket(AF_INET, SOCK_STREAM, 0);
-       if (sd < 0) { LogErr("ConnectToServer", "socket");  return -1; }
-       if (connect(sd, (struct sockaddr *)&servaddr, sizeof(servaddr)) < 0) { LogErr("ConnectToServer", "connect"); return -1; }
-       return sd;
-       }
-
-// send an entire block of data over a connected socket, blocking if buffers are full
-mDNSlocal int MySend(int sd, const void *msg, int len)
-       {
-       int n, nsent = 0;
-
-       while (nsent < len)
-               {
-               n = send(sd, (char *)msg + nsent, len - nsent, 0);
-               if (n < 0) { LogErr("MySend", "send");  return -1; }
-               nsent += n;
-               }
-       return 0;
-       }
-
-// Transmit a DNS message, prefixed by its length, over TCP, blocking if necessary
-mDNSlocal int SendTCPMsg(int sd, PktMsg *pkt)
-       {
-       // send the lenth, in network byte order
-       mDNSu16 len = htons((mDNSu16)pkt->len);
-       if (MySend(sd, &len, sizeof(len)) < 0) return -1;
-
-       // send the message
-       return MySend(sd, &pkt->msg, pkt->len);
-       }
-
-// Receive len bytes, waiting until we have all of them.
-// Returns number of bytes read (which should always be the number asked for).
-static int my_recv(const int sd, void *const buf, const int len)
-    {
-    // Don't use "MSG_WAITALL"; it returns "Invalid argument" on some Linux versions;
-    // use an explicit while() loop instead.
-    // Also, don't try to do '+=' arithmetic on the original "void *" pointer --
-    // arithmetic on "void *" pointers is compiler-dependent.
-    int remaining = len;
-    char *ptr = (char *)buf;
-    while (remaining)
-       {
-       ssize_t num_read = recv(sd, ptr, remaining, 0);
-       if ((num_read == 0) || (num_read < 0) || (num_read > remaining)) return -1;
-       ptr       += num_read;
-       remaining -= num_read;
-       }
-    return(len);
-    }
-
-// Return a DNS Message read off of a TCP socket, or NULL on failure
-// If storage is non-null, result is placed in that buffer.  Otherwise,
-// returned value is allocated with Malloc, and contains sufficient extra
-// storage for a Lease OPT RR
-
-mDNSlocal PktMsg *ReadTCPMsg(int sd, PktMsg *storage)
-       {       
-       int nread, allocsize;
-       mDNSu16 msglen = 0;     
-       PktMsg *pkt = NULL;
-       unsigned int srclen;
-       
-       nread = my_recv(sd, &msglen, sizeof(msglen));
-       if (nread < 0) { LogErr("TCPRequestForkFn", "recv"); goto error; }
-       msglen = ntohs(msglen);
-       if (nread != sizeof(msglen)) { Log("Could not read length field of message"); goto error; }     
-
-       if (storage)
-               {
-               if (msglen > sizeof(storage->msg)) { Log("ReadTCPMsg: provided buffer too small."); goto error; }
-               pkt = storage;
-               }
-       else
-               {
-               // buffer extra space to add an OPT RR
-               if (msglen > sizeof(DNSMessage)) allocsize = sizeof(PktMsg) - sizeof(DNSMessage) + msglen;
-               else                             allocsize = sizeof(PktMsg);            
-               pkt = malloc(allocsize);
-               if (!pkt) { LogErr("ReadTCPMsg", "malloc"); goto error; }
-               bzero(pkt, sizeof(*pkt));
-               }
-       
-       pkt->len = msglen;
-       srclen = sizeof(pkt->src);
-       if (getpeername(sd, (struct sockaddr *)&pkt->src, &srclen) ||
-               srclen != sizeof(pkt->src)) { LogErr("ReadTCPMsg", "getpeername"); bzero(&pkt->src, sizeof(pkt->src)); }
-       nread = my_recv(sd, &pkt->msg, msglen);
-       if (nread < 0) { LogErr("TCPRequestForkFn", "recv"); goto error; }
-       if (nread != msglen) { Log("Could not read entire message"); goto error; }
-       if (pkt->len < sizeof(DNSMessageHeader))
-               { Log("ReadTCPMsg: Message too short (%d bytes)", pkt->len);  goto error; }     
-       HdrNToH(pkt);
-       return pkt;
-       //!!!KRS convert to HBO here?
-       error:
-       if (pkt && pkt != storage) free(pkt);
-       return NULL;
-       }
-
-//
-// Dynamic Update Utility Routines
-//
-
-// Get the lease life of records in a dynamic update
-// returns -1 on error or if no lease present
-mDNSlocal mDNSs32 GetPktLease(PktMsg *pkt)
-       {
-       mDNSs32 lease = -1;
-       const mDNSu8 *ptr = NULL, *end = (mDNSu8 *)&pkt->msg + pkt->len;
-       LargeCacheRecord lcr;
-       int i;
-       
-       HdrNToH(pkt);
-       ptr = LocateAdditionals(&pkt->msg, end);
-       if (ptr) 
-               for (i = 0; i < pkt->msg.h.numAdditionals; i++)
-                       {
-                       ptr = GetLargeResourceRecord(NULL, &pkt->msg, ptr, end, 0, kDNSRecordTypePacketAdd, &lcr);
-                       if (!ptr) { Log("Unable to read additional record"); break; }
-                       if (lcr.r.resrec.rrtype == kDNSType_OPT)
-                               {
-                               if (lcr.r.resrec.rdlength < LEASE_OPT_RDLEN) continue;
-                               if (lcr.r.resrec.rdata->u.opt.opt != kDNSOpt_Lease) continue;
-                               lease = (mDNSs32)lcr.r.resrec.rdata->u.opt.OptData.lease;
-                               break;
-                               }
-                       }
-
-       HdrHToN(pkt);
-       return lease;
-       }
-
-// check if a request and server response complete a successful dynamic update
-mDNSlocal mDNSBool SuccessfulUpdateTransaction(PktMsg *request, PktMsg *reply)
-       {
-       char buf[32];
-       char *vlogmsg = NULL;
-       
-       // check messages
-       if (!request || !reply) { vlogmsg = "NULL message"; goto failure; }
-       if (request->len < sizeof(DNSMessageHeader) || reply->len < sizeof(DNSMessageHeader)) { vlogmsg = "Malformatted message"; goto failure; }
-
-       // check request operation
-       if ((request->msg.h.flags.b[0] & kDNSFlag0_QROP_Mask) != (request->msg.h.flags.b[0] & kDNSFlag0_QROP_Mask))
-               { vlogmsg = "Request opcode not an update"; goto failure; }
-
-       // check result
-       if ((reply->msg.h.flags.b[1] & kDNSFlag1_RC)) { vlogmsg = "Reply contains non-zero rcode";  goto failure; }
-       if ((reply->msg.h.flags.b[0] & kDNSFlag0_QROP_Mask) != (kDNSFlag0_OP_Update | kDNSFlag0_QR_Response))
-               { vlogmsg = "Reply opcode not an update response"; goto failure; }
-
-       VLog("Successful update from %s", inet_ntop(AF_INET, &request->src.sin_addr, buf, 32));
-       return mDNStrue;                
-
-       failure:
-       VLog("Request %s: %s", inet_ntop(AF_INET, &request->src.sin_addr, buf, 32), vlogmsg);
-       return mDNSfalse;
-       }
-
-// Allocate an appropriately sized CacheRecord and copy data from original.
-// Name pointer in CacheRecord object is set to point to the name specified
-//
-mDNSlocal CacheRecord *CopyCacheRecord(const CacheRecord *orig, domainname *name)
-       {
-       CacheRecord *cr;
-       size_t size = sizeof(*cr);
-       if (orig->resrec.rdlength > InlineCacheRDSize) size += orig->resrec.rdlength - InlineCacheRDSize;
-       cr = malloc(size);
-       if (!cr) { LogErr("CopyCacheRecord", "malloc"); return NULL; }
-       memcpy(cr, orig, size);
-       cr->resrec.rdata = (RData*)&cr->rdatastorage;
-       cr->resrec.name = name;
-       
-       return cr;
-       }
-
-
-//
-// Lease Hashtable Utility Routines
-//
-
-// double hash table size
-// caller must lock table prior to invocation
-mDNSlocal void RehashTable(DaemonInfo *d)
-       {
-       RRTableElem *ptr, *tmp, **new;
-       int i, bucket, newnbuckets = d->nbuckets * 2;
-
-       VLog("Rehashing lease table (new size %d buckets)", newnbuckets);
-       new = malloc(sizeof(RRTableElem *) * newnbuckets);
-       if (!new) { LogErr("RehashTable", "malloc");  return; }
-       bzero(new, newnbuckets * sizeof(RRTableElem *));
-
-       for (i = 0; i < d->nbuckets; i++)
-               {
-               ptr = d->table[i];
-               while (ptr)
-                       {
-                       bucket = ptr->rr.resrec.namehash % newnbuckets;
-                       tmp = ptr;
-                       ptr = ptr->next;
-                       tmp->next = new[bucket];
-                       new[bucket] = tmp;
-                       }
-               }
-       d->nbuckets = newnbuckets;
-       free(d->table);
-       d->table = new;
-       }
-
-// print entire contents of hashtable, invoked via SIGINFO
-mDNSlocal void PrintLeaseTable(DaemonInfo *d)
-       {
-       int i;
-       RRTableElem *ptr;
-       char rrbuf[80], addrbuf[16];
-       struct timeval now;
-       int hr, min, sec;
-
-       if (gettimeofday(&now, NULL)) { LogErr("PrintTable", "gettimeofday"); return; }
-       if (pthread_mutex_lock(&d->tablelock)) { LogErr("PrintTable", "pthread_mutex_lock"); return; }
-       
-       Log("Dumping Lease Table Contents (table contains %d resource records)", d->nelems);
-       for (i = 0; i < d->nbuckets; i++)
-               {
-               for (ptr = d->table[i]; ptr; ptr = ptr->next)
-                       {
-                       hr = ((ptr->expire - now.tv_sec) / 60) / 60;
-                       min = ((ptr->expire - now.tv_sec) / 60) % 60;
-                       sec = (ptr->expire - now.tv_sec) % 60;
-                       Log("Update from %s, Expires in %d:%d:%d\n\t%s", inet_ntop(AF_INET, &ptr->cli.sin_addr, addrbuf, 16), hr, min, sec,
-                               GetRRDisplayString_rdb(&ptr->rr.resrec, &ptr->rr.resrec.rdata->u, rrbuf));
-                       }
-               }
-       pthread_mutex_unlock(&d->tablelock);
-       }
-
-//
-// Startup SRV Registration Routines 
-// Register _dns-update._udp/_tcp.<zone> SRV records indicating the port on which
-// the daemon accepts requests  
-//
-
-// delete all RRS of a given name/type
-mDNSlocal mDNSu8 *putRRSetDeletion(DNSMessage *msg, mDNSu8 *ptr, mDNSu8 *limit,  ResourceRecord *rr)
-       {
-       ptr = putDomainNameAsLabels(msg, ptr, limit, rr->name);
-       if (!ptr || ptr + 10 >= limit) return NULL;  // out of space
-       ptr[0] = (mDNSu8)(rr->rrtype  >> 8);
-       ptr[1] = (mDNSu8)(rr->rrtype  &  0xFF);
-       ptr[2] = (mDNSu8)((mDNSu16)kDNSQClass_ANY >> 8);
-       ptr[3] = (mDNSu8)((mDNSu16)kDNSQClass_ANY &  0xFF);
-       bzero(ptr+4, sizeof(rr->rroriginalttl) + sizeof(rr->rdlength)); // zero ttl/rdata
-       msg->h.mDNS_numUpdates++;
-       return ptr + 10;
-       }
-
-mDNSlocal mDNSu8 *PutUpdateSRV(DaemonInfo *d, PktMsg *pkt, mDNSu8 *ptr, char *regtype, mDNSBool registration)
-       {
-       AuthRecord rr;
-       char hostname[1024], buf[80];
-       mDNSu8 *end = (mDNSu8 *)&pkt->msg + sizeof(DNSMessage);
-       
-       mDNS_SetupResourceRecord(&rr, NULL, 0, kDNSType_SRV, SRV_TTL, kDNSRecordTypeUnique, NULL, NULL);
-       rr.resrec.rrclass = kDNSClass_IN;
-       rr.resrec.rdata->u.srv.priority = 0;
-       rr.resrec.rdata->u.srv.weight = 0;
-       rr.resrec.rdata->u.srv.port.NotAnInteger = d->port.NotAnInteger;
-       if (!gethostname(hostname, 1024) < 0 || MakeDomainNameFromDNSNameString(&rr.resrec.rdata->u.srv.target, hostname))
-               rr.resrec.rdata->u.srv.target.c[0] = '\0';
-       
-       MakeDomainNameFromDNSNameString(rr.resrec.name, regtype);
-       AppendDomainName(rr.resrec.name, &d->zone);
-       VLog("%s  %s", registration ? "Registering SRV record" : "Deleting existing RRSet",
-                GetRRDisplayString_rdb(&rr.resrec, &rr.resrec.rdata->u, buf));
-       if (registration) ptr = PutResourceRecord(&pkt->msg, ptr, &pkt->msg.h.mDNS_numUpdates, &rr.resrec);
-       else              ptr = putRRSetDeletion(&pkt->msg, ptr, end, &rr.resrec);
-       return ptr;
-       }
-
-
-// perform dynamic update.
-// specify deletion by passing false for the register parameter, otherwise register the records.
-mDNSlocal int UpdateSRV(DaemonInfo *d, mDNSBool registration)
-       {
-       int sd = -1;
-       mDNSOpaque16 id;
-       PktMsg pkt;
-       mDNSu8 *ptr = pkt.msg.data;
-       mDNSu8 *end = (mDNSu8 *)&pkt.msg + sizeof(DNSMessage);
-       mDNSu16 nAdditHBO;  // num additionas, in host byte order, required by message digest routine
-       PktMsg *reply = NULL;
-
-       int result = -1;        
-
-       // Initialize message
-       id.NotAnInteger = 0;
-       InitializeDNSMessage(&pkt.msg.h, id, UpdateReqFlags);
-       pkt.src.sin_addr.s_addr = htonl(INADDR_ANY); // address field set solely for verbose logging in subroutines
-       pkt.src.sin_family = AF_INET;
-       
-       // format message body
-       ptr = putZone(&pkt.msg, ptr, end, &d->zone, mDNSOpaque16fromIntVal(kDNSClass_IN));
-       if (!ptr) goto end;
-
-       ptr = PutUpdateSRV(d, &pkt, ptr, "_dns-update._udp.", registration); if (!ptr) goto end;
-       ptr = PutUpdateSRV(d, &pkt, ptr, "_dns-update._tcp.", registration); if (!ptr) goto end;
-       ptr = PutUpdateSRV(d, &pkt, ptr, "_dns-llq._udp.", registration);    if (!ptr) goto end;        
-       
-       nAdditHBO = pkt.msg.h.numAdditionals;
-       HdrHToN(&pkt);
-       if (d->AuthInfo)
-               {
-               ptr = DNSDigest_SignMessage(&pkt.msg, &ptr, &nAdditHBO, d->AuthInfo);
-               if (!ptr) goto end;
-               }
-       pkt.len = ptr - (mDNSu8 *)&pkt.msg;
-       
-       // send message, receive reply
-       sd = ConnectToServer(d);
-       if (sd < 0) { Log("UpdateSRV: ConnectToServer failed"); goto end; }  
-       if (SendTCPMsg(sd, &pkt)) { Log("UpdateSRV: SendTCPMsg failed"); }
-       reply = ReadTCPMsg(sd, NULL);
-       if (!SuccessfulUpdateTransaction(&pkt, reply))
-               Log("SRV record registration failed with rcode %d", reply->msg.h.flags.b[1] & kDNSFlag1_RC);
-       else result = 0;
-       
-       end:
-       if (!ptr) { Log("UpdateSRV: Error constructing lease expiration update"); }
-       if (sd >= 0) close(sd); 
-       if (reply) free(reply);
-       return result;
-       }
-
-// wrapper routines/macros
-#define ClearUpdateSRV(d) UpdateSRV(d, 0)
-
-// clear any existing records prior to registration
-mDNSlocal int SetUpdateSRV(DaemonInfo *d)
-       {
-       int err;
-
-       err = ClearUpdateSRV(d);         // clear any existing record
-       if (!err) err = UpdateSRV(d, 1);
-       return err;
-       }
-
-//
-// Argument Parsing and Configuration
-//
-
-// read authentication information for a zone from command line argument
-// global optind corresponds to keyname argument on entry
-mDNSlocal int ReadAuthKey(int argc, char *argv[], DaemonInfo *d)
-       {
-       uDNS_AuthInfo *auth = NULL;
-       unsigned char keybuf[512];
-       mDNSs32 keylen;
-       
-       auth = malloc(sizeof(*auth));
-       if (!auth) { perror("ReadAuthKey, malloc");  goto error; }
-       auth->next = NULL;
-       if (argc < optind + 1) return -1;  // keyname + secret 
-       if (!MakeDomainNameFromDNSNameString(&auth->keyname, optarg))
-               { fprintf(stderr, "Bad key name %s", optarg); goto error; }
-       keylen = DNSDigest_Base64ToBin(argv[optind++], keybuf, 512);
-       if (keylen < 0)
-               { fprintf(stderr, "Bad shared secret %s (must be base-64 encoded string)", argv[optind-1]); goto error; }
-       DNSDigest_ConstructHMACKey(auth, keybuf, (mDNSu32)keylen);
-       d->AuthInfo = auth;
-       return 0;
-
-       error:
-       if (auth) free(auth);
-       return -1;      
-       }
-
-mDNSlocal int SetPort(DaemonInfo *d, char *PortAsString)
-       {
-       long l;
-
-       l = strtol(PortAsString, NULL, 10);                    // convert string to long
-       if ((!l && errno == EINVAL) || l > 65535) return -1;   // error check conversion
-       d->port.NotAnInteger = htons((mDNSu16)l);              // set to network byte order
-       return 0;
-       }
-       
-mDNSlocal void PrintUsage(void)
-       {
-       fprintf(stderr, "Usage: dnsextd -z <zone> [-vf] [ -s server ] [-k keyname secret] ...\n"
-                       "Use \"dnsextd -h\" for help\n");
-       }
-
-mDNSlocal void PrintHelp(void)
-       {
-       fprintf(stderr, "\n\n");
-       PrintUsage();
-
-       fprintf(stderr, 
-                       "dnsextd is a daemon that implements DNS extensions supporting Dynamic DNS Update Leases\n"
-            "and Long Lived Queries, used in Wide-Area DNS Service Discovery, on behalf of name servers\n"
-                       "that do not natively support these extensions.  (See dns-sd.org for more info on DNS Service\n"
-                       "Discovery, Update Leases, and Long Lived Queries.)\n\n"
-
-            "dnsextd requires one argument,the zone, which is the domain for which Update Leases\n"
-            "and Long Lived Queries are to be administered.  dnsextd communicates directly with the\n"
-                       "primary master server for this zone.\n\n"
-
-                       "The options are as follows:\n\n"
-
-                       "-f    Run daemon in foreground.\n\n"
-
-                       "-h    Print help.\n\n"
-
-                       "-k    Specify TSIG authentication key for dynamic updates from daemon to name server.\n"
-                       "      -k option is followed by the name of the key, and the shared secret as a base-64\n"
-            "      encoded string.  This key/secret are used by the daemon to delete resource records\n"
-            "      from the server when leases expire.  Clients are responsible for signing their\n"
-            "      update requests.\n\n"
-                       
-                       "-s    Specify address (IPv4 address in dotted-decimal notation) of the Primary Master\n"
-                       "      name server.  Defaults to loopback (127.0.0.1), i.e. daemon and name server\n"
-                       "      running on the same machine.\n\n"
-
-                       "-v    Verbose output.\n\n"
-               );                 
-       }
-
-// Note: ProcessArgs called before process is daemonized, and therefore must open no descriptors
-// returns 0 (success) if program is to continue execution
-// output control arguments (-f, -v) do not affect this routine
-mDNSlocal int ProcessArgs(int argc, char *argv[], DaemonInfo *d)
-       {
-       int opt;
-
-       if (argc < 2) goto arg_error;
-
-       d->port.NotAnInteger = htons(DAEMON_PORT);  // default, may be overriden by command option
-       while ((opt = getopt(argc, argv, "z:p:hfvs:k:")) != -1)
-               {
-               switch(opt)
-                       {
-                       case 'p': if (SetPort(d, optarg) < 0) goto arg_error;
-                                 break;
-
-                       case 'h': PrintHelp();    return -1;
-                       case 'f': foreground = 1; break;
-                       case 'v': verbose = 1;    break;
-                       case 's': if (!inet_pton(AF_INET, optarg, &d->saddr)) goto arg_error;
-                                     break;
-                       case 'k': if (ReadAuthKey(argc, argv, d) < 0) goto arg_error;
-                                     break;
-                       case 'z': if (!MakeDomainNameFromDNSNameString(&d->zone, optarg))
-                                         {
-                                                 fprintf(stderr, "Bad zone %s", optarg);
-                                                 goto arg_error;
-                                                 }
-                                     break;
-                       default:  goto arg_error;                               
-                       }
-               }
-               
-       if (!d->zone.c[0]) goto arg_error;  // zone is the only required argument
-       if (d->AuthInfo) AssignDomainName(&d->AuthInfo->zone, &d->zone); // if we have a shared secret, use it for the entire zone
-       return 0;
-       
-       arg_error:
-       PrintUsage();
-       return -1;
-       }
-
-
-//
-// Initialization Routines
-//
-
-// Allocate memory, initialize locks and bookkeeping variables
-mDNSlocal int InitLeaseTable(DaemonInfo *d)
-       {
-       if (pthread_mutex_init(&d->tablelock, NULL)) { LogErr("InitLeaseTable", "pthread_mutex_init"); return -1; }
-       d->nbuckets = LEASETABLE_INIT_NBUCKETS;
-       d->nelems = 0;
-       d->table = malloc(sizeof(RRTableElem *) * LEASETABLE_INIT_NBUCKETS);
-       if (!d->table) { LogErr("InitLeaseTable", "malloc"); return -1; }
-       bzero(d->table, sizeof(RRTableElem *) * LEASETABLE_INIT_NBUCKETS);
-       return 0;
-       }
-mDNSlocal int SetupSockets(DaemonInfo *daemon)
-       {
-       struct sockaddr_in daddr;
-       int sockpair[2];
-       
-       // set up sockets on which we receive requests
-       bzero(&daddr, sizeof(daddr));
-       daddr.sin_family = AF_INET;
-       daddr.sin_addr.s_addr = htonl(INADDR_ANY);
-
-       if (daemon->port.NotAnInteger) daddr.sin_port = daemon->port.NotAnInteger;
-       else                           daddr.sin_port = htons(DAEMON_PORT);
-       
-       daemon->tcpsd = socket(AF_INET, SOCK_STREAM, 0);
-       if (!daemon->tcpsd) { LogErr("SetupSockets", "socket");  return -1; }
-       if (bind(daemon->tcpsd, (struct sockaddr *)&daddr, sizeof(daddr)) < 0) { LogErr("SetupSockets", "bind"); return -1; }
-       if (listen(daemon->tcpsd, LISTENQ) < 0) { LogErr("SetupSockets", "listen"); return -1; }
-
-       daemon->udpsd = socket(AF_INET, SOCK_DGRAM, 0);
-       if (!daemon->udpsd) { LogErr("SetupSockets", "socket");  return -1; }
-       if (bind(daemon->udpsd, (struct sockaddr *)&daddr, sizeof(daddr)) < 0) { LogErr("SetupSockets", "bind"); return -1; }
-
-       // set up Unix domain socket pair for LLQ polling thread to signal main thread that a change to the zone occurred
-       if (socketpair(AF_LOCAL, SOCK_STREAM, 0, sockpair) < 0) { LogErr("SetupSockets", "socketpair"); return -1; }
-       daemon->LLQEventListenSock = sockpair[0];
-       daemon->LLQServPollSock = sockpair[1];
-       return 0;
-       }
-
-//
-// periodic table updates
-//
-
-// Delete a resource record from the nameserver via a dynamic update
-mDNSlocal void DeleteRecord(DaemonInfo *d, CacheRecord *rr, domainname *zone)
-       {
-       int sd = -1;
-       mDNSOpaque16 id;
-       PktMsg pkt;
-       mDNSu8 *ptr = pkt.msg.data;
-       mDNSu8 *end = (mDNSu8 *)&pkt.msg + sizeof(DNSMessage);
-       mDNSu16 nAdditHBO;  // num additionas, in host byte order, required by message digest routine
-       char buf[80];
-       PktMsg *reply = NULL;
-       
-       VLog("Expiring record %s", GetRRDisplayString_rdb(&rr->resrec, &rr->resrec.rdata->u, buf));     
-       sd = ConnectToServer(d);
-       if (sd < 0) { Log("DeleteRecord: ConnectToServer failed"); goto end; }
-       
-       id.NotAnInteger = 0;
-       InitializeDNSMessage(&pkt.msg.h, id, UpdateReqFlags);
-       
-       ptr = putZone(&pkt.msg, ptr, end, zone, mDNSOpaque16fromIntVal(rr->resrec.rrclass));
-       if (!ptr) goto end;
-       ptr = putDeletionRecord(&pkt.msg, ptr, &rr->resrec);
-       if (!ptr) goto end;
-
-       nAdditHBO = pkt.msg.h.numAdditionals;
-       HdrHToN(&pkt);
-
-       if (d->AuthInfo)
-               {
-               ptr = DNSDigest_SignMessage(&pkt.msg, &ptr, &nAdditHBO, d->AuthInfo);
-               if (!ptr) goto end;
-               }
-
-       pkt.len = ptr - (mDNSu8 *)&pkt.msg;
-       pkt.src.sin_addr.s_addr = htonl(INADDR_ANY); // address field set solely for verbose logging in subroutines
-       pkt.src.sin_family = AF_INET;
-       if (SendTCPMsg(sd, &pkt)) { Log("DeleteRecord: SendTCPMsg failed"); }
-       reply = ReadTCPMsg(sd, NULL);
-       if (!SuccessfulUpdateTransaction(&pkt, reply))
-               Log("Expiration update failed with rcode %d", reply->msg.h.flags.b[1] & kDNSFlag1_RC);
-                                         
-       end:
-       if (!ptr) { Log("DeleteRecord: Error constructing lease expiration update"); }
-       if (sd >= 0) close(sd); 
-       if (reply) free(reply);
-       }
-
-// iterate over table, deleting expired records
-mDNSlocal void DeleteExpiredRecords(DaemonInfo *d)
-       {
-       int i;
-       RRTableElem *ptr, *prev, *fptr; 
-       struct timeval now;
-
-       if (gettimeofday(&now, NULL)) { LogErr("DeleteExpiredRecords ", "gettimeofday"); return; }
-       if (pthread_mutex_lock(&d->tablelock)) { LogErr("DeleteExpiredRecords", "pthread_mutex_lock"); return; }
-       for (i = 0; i < d->nbuckets; i++)
-               {
-               ptr = d->table[i];
-               prev = NULL;
-               while (ptr)
-                       {
-                       if (ptr->expire - now.tv_sec < 0)
-                               {
-                               // delete record from server
-                               DeleteRecord(d, &ptr->rr, &ptr->zone);
-                               if (prev) prev->next = ptr->next;
-                               else d->table[i] = ptr->next;
-                               fptr = ptr;
-                               ptr = ptr->next;
-                               free(fptr);
-                               d->nelems--;
-                               }
-                       else
-                               {
-                               prev = ptr;
-                               ptr = ptr->next;
-                               }
-                       }
-               }
-       pthread_mutex_unlock(&d->tablelock);
-       }
-
-//
-// main update request handling
-//
-
-// Add, delete, or refresh records in table based on contents of a successfully completed dynamic update
-mDNSlocal void UpdateLeaseTable(PktMsg *pkt, DaemonInfo *d, mDNSs32 lease)
-       {
-       RRTableElem **rptr, *tmp;
-       int i, allocsize, bucket;
-       LargeCacheRecord lcr;
-       ResourceRecord *rr = &lcr.r.resrec;
-       const mDNSu8 *ptr, *end;
-       struct timeval time;
-       DNSQuestion zone;
-       char buf[80];
-       
-       if (pthread_mutex_lock(&d->tablelock)) { LogErr("UpdateLeaseTable", "pthread_mutex_lock"); return; }
-       HdrNToH(pkt);
-       ptr = pkt->msg.data;
-       end = (mDNSu8 *)&pkt->msg + pkt->len;
-       ptr = getQuestion(&pkt->msg, ptr, end, 0, &zone);
-       if (!ptr) { Log("UpdateLeaseTable: cannot read zone");  goto cleanup; }
-       ptr = LocateAuthorities(&pkt->msg, end);
-       if (!ptr) { Log("UpdateLeaseTable: Format error");  goto cleanup; }
-       
-       for (i = 0; i < pkt->msg.h.mDNS_numUpdates; i++)
-               {
-               mDNSBool DeleteAllRRSets = mDNSfalse, DeleteOneRRSet = mDNSfalse, DeleteOneRR = mDNSfalse;
-               
-               ptr = GetLargeResourceRecord(NULL, &pkt->msg, ptr, end, 0, kDNSRecordTypePacketAns, &lcr);
-               if (!ptr) { Log("UpdateLeaseTable: GetLargeResourceRecord returned NULL"); goto cleanup; }
-               bucket = rr->namehash % d->nbuckets;
-               rptr = &d->table[bucket];
-
-               // handle deletions             
-               if (rr->rrtype == kDNSQType_ANY && !rr->rroriginalttl && rr->rrclass == kDNSQClass_ANY && !rr->rdlength)
-                       DeleteAllRRSets = mDNStrue; // delete all rrsets for a name
-               else if (!rr->rroriginalttl && rr->rrclass == kDNSQClass_ANY && !rr->rdlength)
-                       DeleteOneRRSet = mDNStrue;
-               else if (!rr->rroriginalttl && rr->rrclass == kDNSClass_NONE)
-                       DeleteOneRR = mDNStrue;
-
-               if (DeleteAllRRSets || DeleteOneRRSet || DeleteOneRR)
-                       {
-                       while (*rptr)
-                         {
-                         if (SameDomainName((*rptr)->rr.resrec.name, rr->name) &&
-                                (DeleteAllRRSets ||
-                                (DeleteOneRRSet && (*rptr)->rr.resrec.rrtype == rr->rrtype) ||
-                                 (DeleteOneRR && SameResourceRecord(&(*rptr)->rr.resrec, rr))))
-                                 {
-                                 tmp = *rptr;
-                                 VLog("Received deletion update for %s", GetRRDisplayString_rdb(&tmp->rr.resrec, &tmp->rr.resrec.rdata->u, buf));
-                                 *rptr = (*rptr)->next;
-                                 free(tmp);
-                                 d->nelems--;
-                                 }
-                         else rptr = &(*rptr)->next;
-                         }
-                       }
-               else if (lease > 0)
-                       {
-                       // see if add or refresh
-                       while (*rptr && !SameResourceRecord(&(*rptr)->rr.resrec, rr)) rptr = &(*rptr)->next;
-                       if (*rptr)
-                               {
-                               // refresh
-                               if (gettimeofday(&time, NULL)) { LogErr("UpdateLeaseTable", "gettimeofday"); goto cleanup; }
-                               (*rptr)->expire = time.tv_sec + (unsigned)lease;
-                               VLog("Refreshing lease for %s", GetRRDisplayString_rdb(&lcr.r.resrec, &lcr.r.resrec.rdata->u, buf));                                    
-                               }
-                       else
-                               {
-                               // New record - add to table
-                               if (d->nelems > d->nbuckets)
-                                       {
-                                       RehashTable(d);
-                                       bucket = rr->namehash % d->nbuckets;
-                                       rptr = &d->table[bucket];
-                                       }
-                               if (gettimeofday(&time, NULL)) { LogErr("UpdateLeaseTable", "gettimeofday"); goto cleanup; }
-                               allocsize = sizeof(RRTableElem);
-                               if (rr->rdlength > InlineCacheRDSize) allocsize += (rr->rdlength - InlineCacheRDSize);
-                               tmp = malloc(allocsize);
-                               if (!tmp) { LogErr("UpdateLeaseTable", "malloc"); goto cleanup; }
-                               memcpy(&tmp->rr, &lcr.r, sizeof(CacheRecord) + rr->rdlength - InlineCacheRDSize);
-                               tmp->rr.resrec.rdata = (RData *)&tmp->rr.rdatastorage;
-                               AssignDomainName(&tmp->name, rr->name);
-                               tmp->rr.resrec.name = &tmp->name;
-                               tmp->expire = time.tv_sec + (unsigned)lease;
-                               tmp->cli.sin_addr = pkt->src.sin_addr;
-                               AssignDomainName(&tmp->zone, &zone.qname);
-                               tmp->next = d->table[bucket];
-                               d->table[bucket] = tmp;
-                               d->nelems++;
-                               VLog("Adding update for %s to lease table", GetRRDisplayString_rdb(&lcr.r.resrec, &lcr.r.resrec.rdata->u, buf));
-                               }
-                       }
-               }
-                                       
-       cleanup:
-       pthread_mutex_unlock(&d->tablelock);
-       HdrHToN(pkt);
-       }
-
-// Given a successful reply from a server, create a new reply that contains lease information
-// Replies are currently not signed !!!KRS change this
-mDNSlocal PktMsg *FormatLeaseReply(DaemonInfo *d, PktMsg *orig, mDNSu32 lease)
-       {
-       PktMsg *reply;
-       mDNSu8 *ptr, *end;
-       mDNSOpaque16 flags;
-
-       (void)d;  //unused
-       reply = malloc(sizeof(*reply));
-       if (!reply) { LogErr("FormatLeaseReply", "malloc"); return NULL; }
-       flags.b[0] = kDNSFlag0_QR_Response | kDNSFlag0_OP_Update;
-       flags.b[1] = 0;
-       InitializeDNSMessage(&reply->msg.h, orig->msg.h.id, flags);
-       reply->src.sin_addr.s_addr = htonl(INADDR_ANY);            // unused except for log messages
-       reply->src.sin_family = AF_INET;
-       ptr = reply->msg.data;
-       end = (mDNSu8 *)&reply->msg + sizeof(DNSMessage);
-       ptr = putUpdateLease(&reply->msg, ptr, lease);
-       if (!ptr) { Log("FormatLeaseReply: putUpdateLease failed"); free(reply); return NULL; }                            
-       reply->len = ptr - (mDNSu8 *)&reply->msg;
-       return reply;
-       }
-
-// pkt is thread-local, not requiring locking
-mDNSlocal PktMsg *HandleRequest(PktMsg *pkt, DaemonInfo *d)
-       {
-       int sd = -1;
-       PktMsg *reply = NULL, *LeaseReply;
-       mDNSs32 lease;
-       char buf[32];
-       
-       // send msg to server, read reply
-       sd = ConnectToServer(d);
-       if (sd < 0)
-               { Log("Discarding request from %s due to connection errors", inet_ntop(AF_INET, &pkt->src.sin_addr, buf, 32)); goto cleanup; }
-       if (SendTCPMsg(sd, pkt) < 0)
-               { Log("Couldn't relay message from %s to server.  Discarding.", inet_ntop(AF_INET, &pkt->src.sin_addr, buf, 32)); goto cleanup; }
-       reply = ReadTCPMsg(sd, NULL);
-       
-       // process reply
-       if (!SuccessfulUpdateTransaction(pkt, reply))
-               { VLog("Message from %s not a successful update.", inet_ntop(AF_INET, &pkt->src.sin_addr, buf, 32));  goto cleanup; }   
-       lease = GetPktLease(pkt);
-       UpdateLeaseTable(pkt, d, lease);
-       if (lease > 0)
-               {
-               LeaseReply = FormatLeaseReply(d, reply, lease);
-               if (!LeaseReply) Log("HandleRequest - unable to format lease reply");
-               free(reply); 
-               reply = LeaseReply;
-               }
-       cleanup:
-       if (sd >= 0) close(sd);
-       return reply;
-       }
-
-
-//
-// LLQ Support Routines
-//
-
-// Set fields of an LLQ Opt Resource Record
-mDNSlocal void FormatLLQOpt(AuthRecord *opt, int opcode, mDNSu8 *id, mDNSs32 lease)
-       {
-       bzero(opt, sizeof(*opt));
-       mDNS_SetupResourceRecord(opt, mDNSNULL, mDNSInterface_Any, kDNSType_OPT, kStandardTTL, kDNSRecordTypeKnownUnique, mDNSNULL, mDNSNULL);
-       opt->resrec.rdlength = LLQ_OPT_RDLEN;
-       opt->resrec.rdestimate = LLQ_OPT_RDLEN;
-       opt->resrec.rdata->u.opt.opt = kDNSOpt_LLQ;
-       opt->resrec.rdata->u.opt.optlen = sizeof(LLQOptData);
-       opt->resrec.rdata->u.opt.OptData.llq.vers = kLLQ_Vers;
-       opt->resrec.rdata->u.opt.OptData.llq.llqOp = opcode;
-       opt->resrec.rdata->u.opt.OptData.llq.err = LLQErr_NoError;
-       memcpy(opt->resrec.rdata->u.opt.OptData.llq.id, id, 8);
-       opt->resrec.rdata->u.opt.OptData.llq.lease = lease;
-       }
-
-// Calculate effective remaining lease of an LLQ
-mDNSlocal mDNSu32 LLQLease(LLQEntry *e)
-       {
-       struct timeval t;
-       
-       gettimeofday(&t, NULL);
-       if (e->expire < t.tv_sec) return 0;
-       else return e->expire - t.tv_sec;
-       }
-
-mDNSlocal void DeleteLLQ(DaemonInfo *d, LLQEntry *e)
-       {
-       int  bucket = DomainNameHashValue(&e->qname) % LLQ_TABLESIZE;
-       LLQEntry **ptr = &d->LLQTable[bucket];
-       AnswerListElem *a = e->AnswerList;
-       char addr[32];
-       
-       inet_ntop(AF_INET, &e->cli.sin_addr, addr, 32);
-       VLog("Deleting LLQ table entry for %##s client %s", e->qname.c, addr);
-
-       // free shared answer structure if ref count drops to zero
-       if (a && !(--a->refcount))
-               {
-               CacheRecord *cr = a->KnownAnswers, *tmp;
-               AnswerListElem **tbl = &d->AnswerTable[bucket];
-
-               while (cr)
-                       {
-                       tmp = cr;
-                       cr = cr->next;
-                       free(tmp);
-                       }
-
-               while (*tbl && *tbl != a) tbl = &(*tbl)->next;
-               if (*tbl) { *tbl = (*tbl)->next; free(a); }
-               else Log("Error: DeleteLLQ - AnswerList not found in table");
-               }
-
-       // remove LLQ from table, free memory
-       while(*ptr && *ptr != e) ptr = &(*ptr)->next;
-       if (!*ptr) { Log("Error: DeleteLLQ - LLQ not in table"); return; }
-       *ptr = (*ptr)->next;
-       free(e);        
-       }
-
-mDNSlocal int SendLLQ(DaemonInfo *d, PktMsg *pkt, struct sockaddr_in dst)
-       {
-       char addr[32];
-       int err = -1;
-
-       HdrHToN(pkt);
-       if (sendto(d->udpsd, &pkt->msg, pkt->len, 0, (struct sockaddr *)&dst, sizeof(dst)) != (int)pkt->len)
-               {
-               LogErr("DaemonInfo", "sendto");
-               Log("Could not send response to client %s", inet_ntop(AF_INET, &dst.sin_addr, addr, 32));
-               }
-       else err = 0;
-       HdrNToH(pkt);
-       return err;
-       }
-
-// if non-negative, sd is a TCP socket connected to the nameserver
-// otherwise, this routine creates and closes its own socket
-mDNSlocal CacheRecord *AnswerQuestion(DaemonInfo *d, AnswerListElem *e, int sd)
-       {
-       PktMsg q;
-       int i;
-       const mDNSu8 *ansptr;
-       mDNSu8 *end = q.msg.data;
-       mDNSOpaque16 id, flags = QueryFlags;
-       PktMsg *reply = NULL;
-       LargeCacheRecord lcr;
-       CacheRecord *AnswerList = NULL;
-       mDNSu8 rcode;
-       mDNSBool CloseSDOnExit = sd < 0;
-       
-       VLog("Querying server for %##s type %d", e->name.c, e->type);
-       
-       flags.b[0] |= kDNSFlag0_RD;  // recursion desired
-       id.NotAnInteger = 0;
-       InitializeDNSMessage(&q.msg.h, id, flags);
-       
-       end = putQuestion(&q.msg, end, end + AbsoluteMaxDNSMessageData, &e->name, e->type, kDNSClass_IN);
-       if (!end) { Log("Error: AnswerQuestion - putQuestion returned NULL"); goto end; }
-       q.len = (int)(end - (mDNSu8 *)&q.msg);
-       
-       if (sd < 0) sd = ConnectToServer(d);
-       if (sd < 0) { Log("AnswerQuestion: ConnectToServer failed"); goto end; }
-       if (SendTCPMsg(sd, &q)) { Log("AnswerQuestion: SendTCPMsg failed"); close(sd); goto end; }
-       reply = ReadTCPMsg(sd, NULL);
-
-       if ((reply->msg.h.flags.b[0] & kDNSFlag0_QROP_Mask) != (kDNSFlag0_QR_Response | kDNSFlag0_OP_StdQuery))
-               { Log("AnswerQuestion: %##s type %d - Invalid response flags from server"); goto end; }
-       rcode = (mDNSu8)(reply->msg.h.flags.b[1] & kDNSFlag1_RC);
-       if (rcode && rcode != kDNSFlag1_RC_NXDomain) { Log("AnswerQuestion: %##s type %d - non-zero rcode %d from server", e->name.c, e->type, rcode); goto end; }
-
-       end = (mDNSu8 *)&reply->msg + reply->len;
-       ansptr = LocateAnswers(&reply->msg, end);
-       if (!ansptr) { Log("Error: AnswerQuestion - LocateAnswers returned NULL"); goto end; }
-
-       for (i = 0; i < reply->msg.h.numAnswers; i++)
-               {
-               ansptr = GetLargeResourceRecord(NULL, &reply->msg, ansptr, end, 0, kDNSRecordTypePacketAns, &lcr);
-               if (!ansptr) { Log("AnswerQuestions: GetLargeResourceRecord returned NULL"); goto end; }
-               if (lcr.r.resrec.rrtype != e->type || lcr.r.resrec.rrclass != kDNSClass_IN || !SameDomainName(lcr.r.resrec.name, &e->name))
-                       {
-                       Log("AnswerQuestion: response %##s type #d does not answer question %##s type #d.  Discarding",
-                                 lcr.r.resrec.name->c, lcr.r.resrec.rrtype, e->name.c, e->type);
-                       }
-               else
-                       {
-                       CacheRecord *cr = CopyCacheRecord(&lcr.r, &e->name);
-                       if (!cr) { Log("Error: AnswerQuestion - CopyCacheRecord returned NULL"); goto end; }                                               
-                       cr->next = AnswerList;
-                       AnswerList = cr;
-                       }
-               }
-       
-       end:
-       if (sd > -1 && CloseSDOnExit) close(sd);
-       if (reply) free(reply);
-       return AnswerList;
-       }
-
-// Routine sets EventList to contain Add/Remove events, and deletes any removes from the KnownAnswer list
-mDNSlocal void UpdateAnswerList(DaemonInfo *d, AnswerListElem *a, int sd)
-       {
-       CacheRecord *cr, *NewAnswers, **na, **ka; // "new answer", "known answer"
-
-       // get up to date answers
-       NewAnswers = AnswerQuestion(d, a, sd);
-       
-       // first pass - mark all answers for deletion
-       for (ka = &a->KnownAnswers; *ka; ka = &(*ka)->next)
-               (*ka)->resrec.rroriginalttl = (unsigned)-1; // -1 means delete
-
-       // second pass - mark answers pre-existent
-       for (ka = &a->KnownAnswers; *ka; ka = &(*ka)->next)
-               {
-               for (na = &NewAnswers; *na; na = &(*na)->next)
-                       {
-                       if (SameResourceRecord(&(*ka)->resrec, &(*na)->resrec))
-                               { (*ka)->resrec.rroriginalttl = 0; break; } // 0 means no change
-                       }
-               }
-
-       // third pass - add new records to Event list
-       na = &NewAnswers;
-       while (*na)             
-               {
-               for (ka = &a->KnownAnswers; *ka; ka = &(*ka)->next)
-                       if (SameResourceRecord(&(*ka)->resrec, &(*na)->resrec)) break;
-               if (!*ka)
-                       {
-                       // answer is not in list - splice from NewAnswers list, add to Event list
-                       cr = *na;
-                       *na = (*na)->next;        // splice from list
-                       cr->next = a->EventList;  // add spliced record to event list
-                       a->EventList = cr;
-                       cr->resrec.rroriginalttl = 1; // 1 means add
-                       }
-               else na = &(*na)->next;
-               }
-       
-       // move all the removes from the answer list to the event list  
-       ka = &a->KnownAnswers;
-       while (*ka) 
-               {
-               if ((*ka)->resrec.rroriginalttl == (unsigned)-1)
-                       {
-                       cr = *ka;
-                       *ka = (*ka)->next;
-                       cr->next = a->EventList;
-                       a->EventList = cr;
-                       }
-               else ka = &(*ka)->next;
-               }
-       
-       // lastly, free the remaining records (known answers) in NewAnswers list
-       while (NewAnswers)
-               {
-               cr = NewAnswers;
-               NewAnswers = NewAnswers->next;
-               free(cr);
-               }       
-       }
-
-mDNSlocal void SendEvents(DaemonInfo *d, LLQEntry *e)
-       {
-       PktMsg  response;
-       CacheRecord *cr;
-       mDNSu8 *end = (mDNSu8 *)&response.msg.data;
-       mDNSOpaque16 msgID;
-       char rrbuf[80], addrbuf[32];
-       AuthRecord opt;
-       
-       msgID.NotAnInteger = random();
-       if (verbose) inet_ntop(AF_INET, &e->cli.sin_addr, addrbuf, 32);
-       InitializeDNSMessage(&response.msg.h, msgID, ResponseFlags);
-       end = putQuestion(&response.msg, end, end + AbsoluteMaxDNSMessageData, &e->qname, e->qtype, kDNSClass_IN);
-       if (!end) { Log("Error: SendEvents - putQuestion returned NULL"); return; }
-       
-       // put adds/removes in packet
-       for (cr = e->AnswerList->EventList; cr; cr = cr->next)
-               {
-               if (verbose) GetRRDisplayString_rdb(&cr->resrec, &cr->resrec.rdata->u, rrbuf);
-               VLog("%s (%s): %s", addrbuf, (mDNSs32)cr->resrec.rroriginalttl < 0 ? "Remove": "Add", rrbuf);                            
-               end = PutResourceRecordTTLJumbo(&response.msg, end, &response.msg.h.numAnswers, &cr->resrec, cr->resrec.rroriginalttl);
-               if (!end) { Log("Error: SendEvents - UpdateAnswerList returned NULL"); return; }
-               }
-                          
-       FormatLLQOpt(&opt, kLLQOp_Event, e->id, LLQLease(e));
-       end = PutResourceRecordTTLJumbo(&response.msg, end, &response.msg.h.numAdditionals, &opt.resrec, 0);
-       if (!end) { Log("Error: SendEvents - PutResourceRecordTTLJumbo"); return; }
-
-       response.len = (int)(end - (mDNSu8 *)&response.msg);
-       if (SendLLQ(d, &response, e->cli) < 0) LogMsg("Error: SendEvents - SendLLQ");           
-       }
-
-mDNSlocal void PrintLLQTable(DaemonInfo *d)
-       {
-       LLQEntry *e;
-       char addr[32];
-       int i;
-       
-       Log("Printing LLQ table contents");
-
-       for (i = 0; i < LLQ_TABLESIZE; i++)
-               {
-               e = d->LLQTable[i];
-               while(e)
-                       {
-                       inet_ntop(AF_INET, &e->cli.sin_addr, addr, 32);
-                       Log("LLQ from %##s type %d lease %d (%d remaining)",
-                               addr, e->qname.c, e->qtype, e->lease, LLQLease(e));
-                       e = e->next;
-                       }
-               }
-       }
-
-// Send events to clients as a result of a change in the zone
-mDNSlocal void GenLLQEvents(DaemonInfo *d)
-       {
-       LLQEntry **e;
-       int i, sd;
-       struct timeval t;
-
-       VLog("Generating LLQ Events");
-
-       gettimeofday(&t, NULL);
-       sd = ConnectToServer(d);
-       if (sd < 0) { Log("GenLLQEvents: ConnectToServer failed"); return; }
-
-       // get all answers up to date
-       for (i = 0; i < LLQ_TABLESIZE; i++)
-               {
-               AnswerListElem *a = d->AnswerTable[i];
-               while(a)
-                       {
-                       UpdateAnswerList(d, a, sd);
-                       a = a->next;
-                       }
-               }
-
-    // for each established LLQ, send events
-       for (i = 0; i < LLQ_TABLESIZE; i++)
-               {
-               e = &d->LLQTable[i];
-               while(*e)
-                       {
-                       if ((*e)->expire < t.tv_sec) DeleteLLQ(d, *e);
-                       else
-                               {
-                               if ((*e)->state == Established && (*e)->AnswerList->EventList) SendEvents(d, *e);
-                               e = &(*e)->next;
-                               }
-                       }
-               }
-       
-       // now that all LLQs are updated, we move Add events from the Event list to the Known Answer list, and free Removes
-       for (i = 0; i < LLQ_TABLESIZE; i++)
-               {
-               AnswerListElem *a = d->AnswerTable[i];
-               while(a)
-                       {
-                       if (a->EventList)
-                               {
-                               CacheRecord *cr = a->EventList, *tmp;
-                               while (cr)
-                                       {
-                                       tmp = cr;
-                                       cr = cr->next;
-                                       if ((signed)tmp->resrec.rroriginalttl < 0) free(tmp);
-                                       else
-                                               {
-                                               tmp->next = a->KnownAnswers;
-                                               a->KnownAnswers = tmp;  
-                                               tmp->resrec.rroriginalttl = 0;
-                                               }
-                                       }
-                               a->EventList = NULL;
-                               }
-                       a = a->next;
-                       }
-               }       
-               
-       close(sd);
-       }
-
-// Monitor zone for changes that may produce LLQ events
-mDNSlocal void *LLQEventMonitor(void *DInfoPtr)
-       {
-       DaemonInfo *d = DInfoPtr;
-       PktMsg q;
-       mDNSu8 *end = q.msg.data;
-       const mDNSu8 *ptr;
-       mDNSOpaque16 id, flags = QueryFlags;
-       PktMsg reply;
-       mDNSs32 serial = 0;
-       mDNSBool SerialInitialized = mDNSfalse;
-       int sd;
-    LargeCacheRecord lcr;
-       ResourceRecord *rr = &lcr.r.resrec;
-       int i, sleeptime = 0;
-       domainname zone;
-       char pingmsg[4];
-       
-       // create question
-       id.NotAnInteger = 0;
-       InitializeDNSMessage(&q.msg.h, id, flags);
-       AssignDomainName(&zone, &d->zone);
-       end = putQuestion(&q.msg, end, end + AbsoluteMaxDNSMessageData, &zone, kDNSType_SOA, kDNSClass_IN);
-       if (!end) { Log("Error: LLQEventMonitor - putQuestion returned NULL"); return NULL; }
-       q.len = (int)(end - (mDNSu8 *)&q.msg);
-
-       sd = ConnectToServer(d);
-       if (sd < 0) { Log("LLQEventMonitor: ConnectToServer failed"); return NULL; }
-
-       while(1)
-               {
-               usleep(sleeptime);
-               sleeptime = LLQ_MONITOR_ERR_INTERVAL;  // if we bail on error below, rate limit retry
-               
-               // send message, receive response
-               if (SendTCPMsg(sd, &q)) { Log("LLQEventMonitor: SendTCPMsg failed"); continue; }
-               if (!ReadTCPMsg(sd, &reply)) { Log("LLQEventMonitor: ReadTCPMsg failed"); continue; }
-               end = (mDNSu8 *)&reply.msg + reply.len;
-               if (reply.msg.h.flags.b[1] & kDNSFlag1_RC) { Log("LLQEventMonitor - received non-zero rcode"); continue; }
-
-               // find answer
-               ptr = LocateAnswers(&reply.msg, end);
-               if (!ptr) { Log("Error: LLQEventMonitor - LocateAnswers returned NULL"); continue; }
-               for (i = 0; i < reply.msg.h.numAnswers; i++)
-                       {
-                       ptr = GetLargeResourceRecord(NULL, &reply.msg, ptr, end, 0, kDNSRecordTypePacketAns, &lcr);
-                       if (!ptr) { Log("Error: LLQEventMonitor - GetLargeResourceRecord  returned NULL"); continue; }
-                       if (rr->rrtype != kDNSType_SOA || rr->rrclass != kDNSClass_IN || !SameDomainName(rr->name, &zone)) continue;
-                       if (!SerialInitialized)
-                               {
-                               // first time through loop
-                               SerialInitialized = mDNStrue;
-                               serial = rr->rdata->u.soa.serial;
-                               sleeptime = LLQ_MONITOR_INTERVAL;
-                               break;
-                               }
-                       else if (rr->rdata->u.soa.serial != serial)
-                               {
-                               // update serial, wake main thread
-                               serial = rr->rdata->u.soa.serial;
-                               VLog("LLQEventMonitor: zone changed. Signaling main thread.");
-                               if (send(d->LLQServPollSock, pingmsg, sizeof(pingmsg), 0) != sizeof(pingmsg))
-                                       { LogErr("LLQEventMonitor", "send"); break; }
-                               }
-                       sleeptime = LLQ_MONITOR_INTERVAL;
-                       break;                  
-                       }
-               if (!ptr) Log("LLQEventMonitor: response to query did not contain SOA");
-               }
-       }
-
-mDNSlocal void SetAnswerList(DaemonInfo *d, LLQEntry *e)
-       {
-       int bucket = DomainNameHashValue(&e->qname) % LLQ_TABLESIZE;
-       AnswerListElem *a = d->AnswerTable[bucket];
-       while (a && (a->type != e->qtype ||!SameDomainName(&a->name, &e->qname))) a = a->next;
-       if (!a)
-               {
-               a = malloc(sizeof(*a));
-               if (!a) { LogErr("SetAnswerList", "malloc"); return; }
-               AssignDomainName(&a->name, &e->qname);
-               a->type = e->qtype;
-               a->refcount = 0;
-               a->KnownAnswers = NULL;
-               a->EventList = NULL;
-               a->next = d->AnswerTable[bucket];
-               d->AnswerTable[bucket] = a;
-
-               // to get initial answer list, call UpdateAnswerList and move cache records from EventList to KnownAnswers
-               UpdateAnswerList(d, a, -1);
-               a->KnownAnswers = a->EventList;
-               a->EventList = NULL;
-               }
-       
-       e->AnswerList = a;
-       a->refcount ++;
-       }
-       
- // Allocate LLQ entry, insert into table
-mDNSlocal LLQEntry *NewLLQ(DaemonInfo *d, struct sockaddr_in cli, domainname *qname, mDNSu16 qtype, mDNSu32 lease)
-       {
-       char addr[32];
-       struct timeval t;
-       int bucket = DomainNameHashValue(qname) % LLQ_TABLESIZE;
-       LLQEntry *e;
-
-       e = malloc(sizeof(*e));
-       if (!e) { LogErr("NewLLQ", "malloc"); return NULL; }
-
-       inet_ntop(AF_INET, &cli.sin_addr, addr, 32);
-       VLog("Allocating LLQ entry for client %s question %##s type %d", addr, qname->c, qtype);
-       
-       // initialize structure
-       e->cli = cli;
-       AssignDomainName(&e->qname, qname);
-       e->qtype = qtype;
-       memset(e->id, 0, 8);
-       e->state = RequestReceived;
-       e->AnswerList = NULL;
-       
-       if (lease < LLQ_MIN_LEASE) lease = LLQ_MIN_LEASE;
-       else if (lease > LLQ_MAX_LEASE) lease = LLQ_MIN_LEASE;
-       gettimeofday(&t, NULL);
-       e->expire = t.tv_sec + (int)lease;
-       e->lease = lease;
-       
-       // add to table
-       e->next = d->LLQTable[bucket];
-       d->LLQTable[bucket] = e;
-       
-       return e;
-       }
-
-// Handle a refresh request from client
-mDNSlocal void LLQRefresh(DaemonInfo *d, LLQEntry *e, LLQOptData *llq, mDNSOpaque16 msgID)
-       {
-       AuthRecord opt;
-       PktMsg ack;
-       mDNSu8 *end = (mDNSu8 *)&ack.msg.data;
-       char addr[32];
-
-       inet_ntop(AF_INET, &e->cli.sin_addr, addr, 32);
-       VLog("%s LLQ for %##s from %s", llq->lease ? "Refreshing" : "Deleting", e->qname.c, addr);
-       
-       if (llq->lease)
-               {
-               if (llq->lease < LLQ_MIN_LEASE) llq->lease = LLQ_MIN_LEASE;
-               else if (llq->lease > LLQ_MAX_LEASE) llq->lease = LLQ_MIN_LEASE;
-               }
-       
-       ack.src.sin_addr.s_addr = 0; // unused 
-       InitializeDNSMessage(&ack.msg.h, msgID, ResponseFlags);
-       end = putQuestion(&ack.msg, end, end + AbsoluteMaxDNSMessageData, &e->qname, e->qtype, kDNSClass_IN);
-       if (!end) { Log("Error: putQuestion"); return; }
-
-       FormatLLQOpt(&opt, kLLQOp_Refresh, e->id, llq->lease ? LLQLease(e) : 0);
-       end = PutResourceRecordTTLJumbo(&ack.msg, end, &ack.msg.h.numAdditionals, &opt.resrec, 0);
-       if (!end) { Log("Error: PutResourceRecordTTLJumbo"); return; }
-
-       ack.len = (int)(end - (mDNSu8 *)&ack.msg);
-       if (SendLLQ(d, &ack, e->cli)) Log("Error: LLQRefresh"); 
-
-       if (llq->lease) e->state = Established;
-       else DeleteLLQ(d, e);   
-       }
-
-// Complete handshake with Ack an initial answers
-mDNSlocal void LLQCompleteHandshake(DaemonInfo *d, LLQEntry *e, LLQOptData *llq, mDNSOpaque16 msgID)
-       {
-       char addr[32];
-       CacheRecord *ptr;
-       AuthRecord opt;
-       PktMsg ack;
-       mDNSu8 *end = (mDNSu8 *)&ack.msg.data;
-       char rrbuf[80], addrbuf[32];
-       
-       inet_ntop(AF_INET, &e->cli.sin_addr, addr, 32);
-
-       if (memcmp(llq->id, e->id, 8)           ||
-               llq->vers  != kLLQ_Vers             ||
-               llq->llqOp != kLLQOp_Setup          ||
-               llq->err   != LLQErr_NoError        ||
-               llq->lease > e->lease + LLQ_LEASE_FUDGE ||
-               llq->lease < e->lease - LLQ_LEASE_FUDGE)
-               { Log("Incorrect challenge response from %s", addr); return; }
-
-       if (e->state == Established) VLog("Retransmitting LLQ ack + answers for %##s", e->qname.c);
-       else                         VLog("Delivering LLQ ack + answers for %##s", e->qname.c);  
-       
-       // format ack + answers
-       ack.src.sin_addr.s_addr = 0; // unused 
-       InitializeDNSMessage(&ack.msg.h, msgID, ResponseFlags);
-       end = putQuestion(&ack.msg, end, end + AbsoluteMaxDNSMessageData, &e->qname, e->qtype, kDNSClass_IN);
-       if (!end) { Log("Error: putQuestion"); return; }
-       
-       if (e->state != Established) { SetAnswerList(d, e); e->state = Established; }
-       
-       if (verbose) inet_ntop(AF_INET, &e->cli.sin_addr, addrbuf, 32);
-       for (ptr = e->AnswerList->KnownAnswers; ptr; ptr = ptr->next)
-               {
-               if (verbose) GetRRDisplayString_rdb(&ptr->resrec, &ptr->resrec.rdata->u, rrbuf);
-               VLog("%s Intitial Answer - %s", addr, rrbuf);
-               end = PutResourceRecordTTLJumbo(&ack.msg, end, &ack.msg.h.numAnswers, &ptr->resrec, 1);
-               if (!end) { Log("Error: PutResourceRecordTTLJumbo"); return; }
-               }
-
-       FormatLLQOpt(&opt, kLLQOp_Setup, e->id, LLQLease(e));
-       end = PutResourceRecordTTLJumbo(&ack.msg, end, &ack.msg.h.numAdditionals, &opt.resrec, 0);
-       if (!end) { Log("Error: PutResourceRecordTTLJumbo"); return; }
-
-       ack.len = (int)(end - (mDNSu8 *)&ack.msg);
-       if (SendLLQ(d, &ack, e->cli)) Log("Error: LLQCompleteHandshake");
-       }
-
-mDNSlocal void LLQSetupChallenge(DaemonInfo *d, LLQEntry *e, LLQOptData *llq, mDNSOpaque16 msgID)
-       {
-       struct timeval t;
-       mDNSu32 randval;
-       PktMsg challenge;
-       mDNSu8 *end = challenge.msg.data;
-       AuthRecord opt;
-
-       if (e->state == ChallengeSent) VLog("Retransmitting LLQ setup challenge for %##s", e->qname.c);
-       else                           VLog("Sending LLQ setup challenge for %##s", e->qname.c);
-       
-       if (!ZERO_LLQID(llq->id)) { Log("Error: LLQSetupChallenge - nonzero ID"); return; } // server bug
-       if (llq->llqOp != kLLQOp_Setup) { Log("LLQSetupChallenge - incorrrect operation from client"); return; } // client error
-       
-       if (ZERO_LLQID(e->id)) // don't regenerate random ID for retransmissions
-               {
-               // construct ID <time><random>
-               gettimeofday(&t, NULL);
-               randval = random();
-               memcpy(e->id, &t.tv_sec, sizeof(t.tv_sec));
-               memcpy(e->id + sizeof(t.tv_sec), &randval, sizeof(randval));                       
-               }
-
-       // format response (query + LLQ opt rr)
-       challenge.src.sin_addr.s_addr = 0; // unused 
-       InitializeDNSMessage(&challenge.msg.h, msgID, ResponseFlags);
-       end = putQuestion(&challenge.msg, end, end + AbsoluteMaxDNSMessageData, &e->qname, e->qtype, kDNSClass_IN);
-       if (!end) { Log("Error: putQuestion"); return; }        
-       FormatLLQOpt(&opt, kLLQOp_Setup, e->id, LLQLease(e));
-       end = PutResourceRecordTTLJumbo(&challenge.msg, end, &challenge.msg.h.numAdditionals, &opt.resrec, 0);
-       if (!end) { Log("Error: PutResourceRecordTTLJumbo"); return; }
-       challenge.len = (int)(end - (mDNSu8 *)&challenge.msg);
-       if (SendLLQ(d, &challenge, e->cli)) { Log("Error: LLQSetupChallenge"); return; }
-       e->state = ChallengeSent;
-       }
-
-// Take action on an LLQ message from client.  Entry must be initialized and in table
-mDNSlocal void UpdateLLQ(DaemonInfo *d, LLQEntry *e, LLQOptData *llq, mDNSOpaque16 msgID)
-       {
-       switch(e->state)
-               {
-               case RequestReceived:
-                       LLQSetupChallenge(d, e, llq, msgID);
-                       return;
-               case ChallengeSent:
-                       if (ZERO_LLQID(llq->id)) LLQSetupChallenge(d, e, llq, msgID); // challenge sent and lost
-                       else LLQCompleteHandshake(d, e, llq, msgID);
-                       return;
-               case Established:
-                       if (ZERO_LLQID(llq->id))
-                               {
-                               // client started over.  reset state.
-                               LLQEntry *newe = NewLLQ(d, e->cli, &e->qname, e->qtype, llq->lease);
-                               if (!newe) return;
-                               DeleteLLQ(d, e);
-                               LLQSetupChallenge(d, newe, llq, msgID);
-                               return;
-                               }
-                       else if (llq->llqOp == kLLQOp_Setup)
-                               { LLQCompleteHandshake(d, e, llq, msgID); return; } // Ack lost                         
-                       else if (llq->llqOp == kLLQOp_Refresh)
-                               { LLQRefresh(d, e, llq, msgID); return; }
-                       else { Log("Unhandled message for established LLQ"); return; }
-               }       
-       }
-
-mDNSlocal LLQEntry *LookupLLQ(DaemonInfo *d, struct sockaddr_in cli, domainname *qname, mDNSu16 qtype, mDNSu8 *id)
-       {       
-       int bucket = bucket = DomainNameHashValue(qname) % LLQ_TABLESIZE;
-       LLQEntry *ptr = d->LLQTable[bucket];
-
-       while(ptr)
-               {
-               if (((ptr->state == ChallengeSent && ZERO_LLQID(id)) || // zero-id due to packet loss OK in state ChallengeSent
-                        !memcmp(id, ptr->id, 8)) &&                        // id match
-                       SAME_INADDR(cli, ptr->cli) && qtype == ptr->qtype && SameDomainName(&ptr->qname, qname)) // same source, type, qname
-                       return ptr;
-               ptr = ptr->next;
-               }
-       return NULL;
-       }
-
-mDNSlocal int RecvLLQ(DaemonInfo *d, PktMsg *pkt)
-       {
-       DNSQuestion q;
-       LargeCacheRecord opt;
-       int i, err = -1;
-       char addr[32];
-       const mDNSu8 *qptr = pkt->msg.data;
-    const mDNSu8 *end = (mDNSu8 *)&pkt->msg + pkt->len;
-       const mDNSu8 *aptr = LocateAdditionals(&pkt->msg, end);
-       LLQOptData *llq = NULL;
-       LLQEntry *e = NULL;
-       
-       HdrNToH(pkt);   
-       inet_ntop(AF_INET, &pkt->src.sin_addr, addr, 32);
-
-       VLog("Received LLQ msg from %s", addr);
-       // sanity-check packet
-       if (!pkt->msg.h.numQuestions || !pkt->msg.h.numAdditionals)
-               {
-               Log("Malformatted LLQ from %s with %d questions, %d additionals", addr, pkt->msg.h.numQuestions, pkt->msg.h.numAdditionals);                    
-               goto end;
-               }
-
-       // find the OPT RR - must be last in message
-       for (i = 0; i < pkt->msg.h.numAdditionals; i++)
-               {
-               aptr = GetLargeResourceRecord(NULL, &pkt->msg, aptr, end, 0, kDNSRecordTypePacketAdd, &opt); 
-               if (!aptr) { Log("Malformatted LLQ from %s: could not get Additional record %d", addr, i); goto end; }
-               }
-
-       // validate OPT
-       if (opt.r.resrec.rrtype != kDNSType_OPT) { Log("Malformatted LLQ from %s: last Additional not an Opt RR", addr); goto end; }
-       if (opt.r.resrec.rdlength < pkt->msg.h.numQuestions * LLQ_OPT_RDLEN) { Log("Malformatted LLQ from %s: Opt RR to small (%d bytes for %d questions)", addr, opt.r.resrec.rdlength, pkt->msg.h.numQuestions); }
-       
-       // dispatch each question
-       for (i = 0; i < pkt->msg.h.numQuestions; i++)
-               {
-               qptr = getQuestion(&pkt->msg, qptr, end, 0, &q);
-               if (!qptr) { Log("Malformatted LLQ from %s: cannot read question %d", addr, i); goto end; }
-               llq = (LLQOptData *)&opt.r.resrec.rdata->u.opt.OptData.llq + i; // point into OptData at index i
-               if (llq->vers != kLLQ_Vers) { Log("LLQ from %s contains bad version %d (expected %d)", addr, llq->vers, kLLQ_Vers); goto end; }
-               
-               e = LookupLLQ(d, pkt->src, &q.qname, q.qtype, llq->id);
-               if (!e)
-                       {
-                       // no entry - if zero ID, create new
-                       e = NewLLQ(d, pkt->src, &q.qname, q.qtype, llq->lease);
-                       if (!e) goto end;
-                       }
-               UpdateLLQ(d, e, llq, pkt->msg.h.id);
-               }
-       err = 0;
-       
-       end:
-       HdrHToN(pkt);
-       return err;
-       }
-
-mDNSlocal mDNSBool IsLLQRequest(PktMsg *pkt)
-       {
-       const mDNSu8 *ptr = NULL, *end = (mDNSu8 *)&pkt->msg + pkt->len;
-       LargeCacheRecord lcr;
-       int i;
-       mDNSBool result = mDNSfalse;
-       
-       HdrNToH(pkt);           
-       if ((mDNSu8)(pkt->msg.h.flags.b[0] & kDNSFlag0_QROP_Mask) != (mDNSu8)(kDNSFlag0_QR_Query | kDNSFlag0_OP_StdQuery)) goto end;
-
-       if (!pkt->msg.h.numAdditionals) goto end;
-       ptr = LocateAdditionals(&pkt->msg, end);
-       if (!ptr) goto end;
-
-       // find last Additional
-       for (i = 0; i < pkt->msg.h.numAdditionals; i++)
-               {
-               ptr = GetLargeResourceRecord(NULL, &pkt->msg, ptr, end, 0, kDNSRecordTypePacketAdd, &lcr);
-               if (!ptr) { Log("Unable to read additional record"); goto end; }
-               }
-       
-       if (lcr.r.resrec.rrtype == kDNSType_OPT &&
-               lcr.r.resrec.rdlength >= LLQ_OPT_RDLEN &&
-               lcr.r.resrec.rdata->u.opt.opt == kDNSOpt_LLQ)
-               { result = mDNStrue; goto end; }
-
-       end:
-       HdrHToN(pkt);
-       return result;
-       }
-
-// !!!KRS implement properly
-mDNSlocal mDNSBool IsLLQAck(PktMsg *pkt)
-       {
-       if (pkt->msg.h.flags.NotAnInteger == ResponseFlags.NotAnInteger &&
-               pkt->msg.h.numQuestions && !pkt->msg.h.numAnswers && !pkt->msg.h.numAuthorities) return mDNStrue;
-       return mDNSfalse;
-       }
-
-
-// request handler wrappers for TCP and UDP requests
-// (read message off socket, fork thread that invokes main processing routine and handles cleanup)
-mDNSlocal void *UDPUpdateRequestForkFn(void *vptr)
-       {
-       char buf[32];
-       UDPRequestArgs *req = vptr;
-       PktMsg *reply = NULL;
-       
-       VLog("Received UDP request: %d bytes from %s", req->pkt.len, inet_ntop(AF_INET, &req->pkt.src.sin_addr, buf, 32));  
-       //!!!KRS strictly speaking, we shouldn't use TCP for a UDP request because the server may give us a long answer that would require truncation for UDP delivery to client
-       reply = HandleRequest(&req->pkt, req->d);
-       if (reply)
-               {
-               if (sendto(req->d->udpsd, &reply->msg, reply->len, 0, (struct sockaddr *)&req->pkt.src, sizeof(req->pkt.src)) != (int)reply->len)
-                       LogErr("UDPUpdateRequestForkFn", "sendto");             
-               }
-
-       if (reply) free(reply);         
-       free(req);
-       pthread_exit(NULL);
-       }
-
-//!!!KRS this needs to be changed to use non-blocking sockets
-mDNSlocal int RecvUDPRequest(int sd, DaemonInfo *d)
-       {
-       UDPRequestArgs *req;
-       pthread_t tid;
-       unsigned int clisize = sizeof(req->cliaddr);
-       
-       req = malloc(sizeof(UDPRequestArgs));
-       if (!req) { LogErr("RecvUDPRequest", "malloc"); return -1; }
-       bzero(req, sizeof(*req));
-       req->d = d;
-       req->pkt.len = recvfrom(sd, &req->pkt.msg, sizeof(req->pkt.msg), 0, (struct sockaddr *)&req->cliaddr, &clisize);
-       if ((int)req->pkt.len < 0) { LogErr("RecvUDPRequest", "recvfrom"); free(req); return -1; }
-       if (clisize != sizeof(req->cliaddr)) { Log("Client address of unknown size %d", clisize); free(req); return -1; }
-       req->pkt.src = req->cliaddr;
-
-       if (IsLLQRequest(&req->pkt))
-               {
-               // LLQ messages handled by main thread
-               int err = RecvLLQ(d, &req->pkt);
-               free(req);
-               return err;
-               }
-
-       if (IsLLQAck(&req->pkt)) { free(req); return 0; } // !!!KRS need to do acks + retrans
-       
-       if (pthread_create(&tid, NULL, UDPUpdateRequestForkFn, req)) { LogErr("RecvUDPRequest", "pthread_create"); free(req); return -1; }
-       pthread_detach(tid);
-       return 0;
-       }
-
-mDNSlocal void *TCPRequestForkFn(void *vptr)
-       {
-       TCPRequestArgs *req = vptr;
-       PktMsg *in = NULL, *out = NULL;
-       char buf[32];
-       
-    //!!!KRS if this read blocks indefinitely, we can run out of threads
-       // read the request
-       in = ReadTCPMsg(req->sd, NULL);
-       if (!in)
-               {
-               LogMsg("TCPRequestForkFn: Could not read message from %s", inet_ntop(AF_INET, &req->cliaddr.sin_addr, buf, 32));
-               goto cleanup;
-               }
-
-       VLog("Received TCP request: %d bytes from %s", in->len, inet_ntop(AF_INET, &req->cliaddr.sin_addr, buf, 32));   
-       // create the reply
-       out = HandleRequest(in, req->d);
-       if (!out)
-               {
-               LogMsg("TCPRequestForkFn: No reply for client %s", inet_ntop(AF_INET, &req->cliaddr.sin_addr, buf, 32));
-               goto cleanup;
-               }
-
-       // deliver reply to client
-       if (SendTCPMsg(req->sd, out) < 0) 
-               {
-               LogMsg("TCPRequestForkFn: Unable to send reply to client %s", inet_ntop(AF_INET, &req->cliaddr.sin_addr, buf, 32));
-               goto cleanup;
-               }
-               
-       cleanup:
-       free(req);
-       if (in) free(in);
-       if (out) free(out);
-       pthread_exit(NULL);
-       }
-
-mDNSlocal int RecvTCPRequest(int sd, DaemonInfo *d)
-       {
-       TCPRequestArgs *req;
-       pthread_t tid;
-       unsigned int clilen = sizeof(req->cliaddr);
-       
-       req = malloc(sizeof(TCPRequestArgs));
-       if (!req) { LogErr("RecvTCPRequest", "malloc"); return -1; }
-       bzero(req, sizeof(*req));
-       req->d = d;
-       req->sd = accept(sd, (struct sockaddr *)&req->cliaddr, &clilen);
-       if (req->sd < 0) { LogErr("RecvTCPRequest", "accept"); return -1; }     
-       if (clilen != sizeof(req->cliaddr)) { Log("Client address of unknown size %d", clilen); free(req); return -1; }
-       if (pthread_create(&tid, NULL, TCPRequestForkFn, req)) { LogErr("RecvTCPRequest", "pthread_create"); free(req); return -1; }
-       pthread_detach(tid);
-       return 0;
-       }
-
-// main event loop
-// listen for incoming requests, periodically check table for expired records, respond to signals
-mDNSlocal int ListenForUpdates(DaemonInfo *d)
-       {
-       int err;
-       int maxfdp1;
-       fd_set rset;
-       struct timeval timenow, timeout = { 0, 0 };
-       long NextTableCheck = 0;
-       
-       VLog("Listening for requests...");
-
-       FD_ZERO(&rset);
-       maxfdp1 = d->tcpsd + 1;
-       if (d->udpsd + 1 > maxfdp1) maxfdp1 = d->udpsd + 1;
-       if (d->LLQEventListenSock + 1 > maxfdp1) maxfdp1 = d->LLQEventListenSock + 1;
-       
-       while(1)
-               {
-               // expire records if necessary, set timeout
-               if (gettimeofday(&timenow, NULL)) { LogErr("ListenForUpdates", "gettimeofday"); return -1; }
-               if (timenow.tv_sec >= NextTableCheck)
-                       {
-                       DeleteExpiredRecords(d);
-                       NextTableCheck = timenow.tv_sec + EXPIRATION_INTERVAL;
-                       }
-               timeout.tv_sec = NextTableCheck - timenow.tv_sec;
-               
-               FD_SET(d->tcpsd, &rset);
-               FD_SET(d->udpsd, &rset);
-               FD_SET(d->LLQEventListenSock, &rset);
-               
-               err = select(maxfdp1, &rset, NULL, NULL, &timeout);             
-               if (err < 0)
-                       {
-                       if (errno == EINTR)
-                               {
-                               if (terminate) { DeleteExpiredRecords(d); return 0; }
-                               else if (dumptable) { PrintLeaseTable(d); PrintLLQTable(d); dumptable = 0; }
-                               else Log("Received unhandled signal - continuing"); 
-                               }
-                       else { LogErr("ListenForUpdates", "select"); return -1; }
-                       }
-               else
-                       {
-                       if (FD_ISSET(d->tcpsd, &rset)) RecvTCPRequest(d->tcpsd, d);
-                       if (FD_ISSET(d->udpsd, &rset)) RecvUDPRequest(d->udpsd, d); 
-                       if (FD_ISSET(d->LLQEventListenSock, &rset))
-                               {
-                               // clear signalling data off socket
-                               char buf[32];
-                               recv(d->LLQEventListenSock, buf, 32, 0);
-                               GenLLQEvents(d);
-                               }
-                       }
-               }
-       return 0;
-       }
-
-// signal handler sets global variables, which are inspected by main event loop
-// (select automatically returns due to the handled signal)
-mDNSlocal void HndlSignal(int sig)
-       {
-       if (sig == SIGTERM || sig == SIGINT ) { terminate = 1; return; }
-       if (sig == INFO_SIGNAL)               { dumptable = 1; return; }
-       }
-
-int main(int argc, char *argv[])
-       {
-       pthread_t LLQtid;
-       DaemonInfo *d;
-
-       d = malloc(sizeof(*d));
-       if (!d) { LogErr("main", "malloc"); exit(1); }
-       bzero(d, sizeof(DaemonInfo));
-       
-       if (signal(SIGTERM,     HndlSignal) == SIG_ERR) perror("Can't catch SIGTERM");
-       if (signal(INFO_SIGNAL, HndlSignal) == SIG_ERR) perror("Can't catch SIGINFO");
-       if (signal(SIGINT,      HndlSignal) == SIG_ERR) perror("Can't catch SIGINT");
-       if (signal(SIGPIPE,     SIG_IGN  )  == SIG_ERR) perror("Can't ignore SIGPIPE");
-       
-       if (ProcessArgs(argc, argv, d) < 0) exit(1);
-
-       if (!foreground)
-               {
-               if (daemon(0,0))
-                       {
-                       LogErr("main", "daemon");
-                       fprintf(stderr, "Could not daemonize process, running in foreground");
-                       foreground = 1;
-                       }       
-               }
-
-       if (InitLeaseTable(d) < 0) exit(1);
-       if (SetupSockets(d) < 0) exit(1); 
-       if (SetUpdateSRV(d) < 0) exit(1);
-       
-       if (pthread_create(&LLQtid, NULL, LLQEventMonitor, d)) { LogErr("main", "pthread_create"); }    
-       else
-               {
-               pthread_detach(LLQtid);
-               ListenForUpdates(d);
-               }
-               
-       if (ClearUpdateSRV(d) < 0) exit(1);  // clear update srv's even if ListenForUpdates or pthread_create returns an error
-       free(d);
-       exit(0);
-       }
index e080dda478fefcb66838187b3d9c8b865f83f52c..6284b1e388170b1666fed01d5d72147fdea12b03 100755 (executable)
@@ -1,5 +1,4 @@
-/* -*- Mode: C; tab-width: 4 -*-
- *
+/*
  * Copyright (c) 2004, Apple Computer, Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without 
@@ -28,9 +27,6 @@
    Change History (most recent first):
 
 $Log: dnssd_clientlib.c,v $
-Revision 1.11  2006/08/14 23:05:53  cheshire
-Added "tab-width" emacs header line
-
 Revision 1.10  2005/04/06 02:06:56  shersche
 Add DNSSD_API macro to TXTRecord API calls
 
index 9cff8246cb5ee324d768c8a7a1d595881445c641..7259a9c71173c701e3a01d36a7e8635770da00b8 100644 (file)
@@ -1,18 +1,24 @@
-/* -*- Mode: C; tab-width: 4 -*-
- *
+/*
  * Copyright (c) 2003 Apple Computer, Inc. All rights reserved.
  * 
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * @APPLE_LICENSE_HEADER_START@
  * 
- *     http://www.apache.org/licenses/LICENSE-2.0
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
  * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
  * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
 
  * This file defines a simple shim layer between a client calling the "/usr/include/dns_sd.h" APIs
  * and an implementation of mDNSCore ("mDNSEmbeddedAPI.h" APIs) in the same address space.
        Change History (most recent first):
 
 $Log: dnssd_clientshim.c,v $
-Revision 1.10  2006/08/14 23:24:56  cheshire
-Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
-
-Revision 1.9  2006/07/24 23:45:55  cheshire
-<rdar://problem/4605276> DNSServiceReconfirmRecord() should return error code
-
 Revision 1.8  2004/12/16 20:47:34  cheshire
 <rdar://problem/3324626> Cache memory management improvements
 
@@ -704,7 +704,7 @@ fail:
 // is run against this Extension, it will get a reasonable error code instead of just
 // failing to launch (Strong Link) or calling an unresolved symbol and crashing (Weak Link)
 #if !MDNS_BUILDINGSTUBLIBRARY
-DNSServiceErrorType DNSSD_API DNSServiceReconfirmRecord
+void DNSServiceReconfirmRecord
        (
        DNSServiceFlags                    flags,
        uint32_t                           interfaceIndex,
@@ -722,6 +722,5 @@ DNSServiceErrorType DNSSD_API DNSServiceReconfirmRecord
        (void)rrclass;                  // Unused
        (void)rdlen;                    // Unused
        (void)rdata;                    // Unused
-       return(kDNSServiceErr_Unsupported);
        }
 #endif
index 97732b0f2d4e6e2f9b5ba63e1b4f69c6484cc035..b5582592127c18ebcddff69a11d2332397becce4 100755 (executable)
     Change History (most recent first):
 
 $Log: dnssd_clientstub.c,v $
-Revision 1.53  2006/09/07 04:43:12  herscher
-Fix compile error on Win32 platform by moving inclusion of syslog.h
-
-Revision 1.52  2006/08/15 23:04:21  mkrochma
-<rdar://problem/4090354> Client should be able to specify service name w/o callback
-
-Revision 1.51  2006/07/24 23:45:55  cheshire
-<rdar://problem/4605276> DNSServiceReconfirmRecord() should return error code
-
-Revision 1.50  2006/06/28 08:22:27  cheshire
-<rdar://problem/4605264> dnssd_clientstub.c needs to report unlink failures in syslog
-
-Revision 1.49  2006/06/28 07:58:59  cheshire
-Minor textual tidying
-
 Revision 1.48  2005/06/30 18:01:00  shersche
 <rdar://problem/4096913> Clients shouldn't wait ten seconds to connect to mDNSResponder
 
@@ -121,7 +106,7 @@ Revision 1.25  2004/07/26 05:54:02  shersche
 DNSServiceProcessResult() returns NoError if socket read returns EWOULDBLOCK
 
 Revision 1.24  2004/07/20 06:46:21  shersche
-<rdar://problem/3730123> fix endless loop in read_all() if recv returns 0
+<rdar://problem/3730123> fix endless loop in my_read() if recv returns 0
 Bug #: 3730123
 
 Revision 1.23  2004/06/29 00:48:38  cheshire
@@ -191,44 +176,41 @@ Update to APSL 2.0
 
 #include <errno.h>
 #include <stdlib.h>
-
-#include "dnssd_ipc.h"
-
 #if defined(_WIN32)
-
 #include <winsock2.h>
 #include <windows.h>
-
 #define sockaddr_mdns sockaddr_in
 #define AF_MDNS AF_INET
+extern BOOL
+IsSystemServiceDisabled();
+#else
+#include <sys/time.h>
+#include <sys/socket.h>
+#define sockaddr_mdns sockaddr_un
+#define AF_MDNS AF_LOCAL
+#endif
+
+#include "dnssd_ipc.h"
 
-// disable warning: "'type cast' : from data pointer 'void *' to function pointer"
+#if defined(_WIN32)
+// disable warning: "'type cast' : from data pointer 'void *' to
+// function pointer"
 #pragma warning(disable:4055)
 
-// disable warning: "nonstandard extension, function/data pointer conversion in expression"
+// disable warning: "nonstandard extension, function/data pointer
+// conversion in expression"
 #pragma warning(disable:4152)
 
-extern BOOL IsSystemServiceDisabled();
-
 #define sleep(X) Sleep((X) * 1000)
 
 static int g_initWinsock = 0;
-
-#else
-
-#include <sys/time.h>
-#include <sys/socket.h>
-#include <syslog.h>
-
-#define sockaddr_mdns sockaddr_un
-#define AF_MDNS AF_LOCAL
-
 #endif
 
+
 // <rdar://problem/4096913> Specifies how many times we'll try and connect to the
 // server.
 
-#define DNSSD_CLIENT_MAXTRIES 4
+#define DNSSD_CLIENT_MAXTRIES  4
 
 #define CTL_PATH_PREFIX "/tmp/dnssd_clippath."
 // error socket (if needed) is named "dnssd_clipath.[pid].xxx:n" where xxx are the
@@ -257,7 +239,7 @@ typedef struct _DNSRecordRef_t
 // exported functions
 
 // write len bytes.  return 0 on success, -1 on error
-static int write_all(dnssd_sock_t sd, char *buf, int len)
+static int my_write(dnssd_sock_t sd, char *buf, int len)
     {
     // Don't use "MSG_WAITALL"; it returns "Invalid argument" on some Linux versions; use an explicit while() loop instead.
     //if (send(sd, buf, len, MSG_WAITALL) != len)   return -1;
@@ -272,7 +254,7 @@ static int write_all(dnssd_sock_t sd, char *buf, int len)
     }
 
 // read len bytes.  return 0 on success, -1 on error
-static int read_all(dnssd_sock_t sd, char *buf, int len)
+static int my_read(dnssd_sock_t sd, char *buf, int len)
     {
     // Don't use "MSG_WAITALL"; it returns "Invalid argument" on some Linux versions; use an explicit while() loop instead.
     //if (recv(sd, buf, len, MSG_WAITALL) != len)  return -1;
@@ -308,7 +290,7 @@ static ipc_msg_hdr *create_hdr(uint32_t op, size_t *len, char **data_start, int
     if (!reuse_socket)
         {
 #if defined(USE_TCP_LOOPBACK)
-               *len += 2;  // Allocate space for two-byte port number
+               *len += 2;      // Allocate space for two-byte port number
 #else
                struct timeval time;
                if (gettimeofday(&time, NULL) < 0) return NULL;
@@ -336,7 +318,7 @@ static ipc_msg_hdr *create_hdr(uint32_t op, size_t *len, char **data_start, int
        // Put dummy data in for the port, since we don't know what
        // it is yet.  The data will get filled in before we
        // send the message. This happens in deliver_request().
-       if (!reuse_socket)  put_short(0, data_start);
+       if (!reuse_socket)      put_short(0, data_start);
 #else
     if (!reuse_socket)  put_string(ctrl_path, data_start);
 #endif
@@ -378,9 +360,9 @@ static DNSServiceRef connect_to_server(void)
        sdr->sockfd = socket(AF_DNSSD, SOCK_STREAM, 0);
        if (sdr->sockfd == dnssd_InvalidSocket) { free(sdr); return NULL; }
 #if defined(USE_TCP_LOOPBACK)
-       saddr.sin_family      = AF_INET;
-       saddr.sin_addr.s_addr = inet_addr(MDNS_TCP_SERVERADDR);
-       saddr.sin_port        = htons(MDNS_TCP_SERVERPORT);
+       saddr.sin_family                =       AF_INET;
+       saddr.sin_addr.s_addr   =       inet_addr(MDNS_TCP_SERVERADDR);
+       saddr.sin_port                  =       htons(MDNS_TCP_SERVERPORT);
 #else
        saddr.sun_family = AF_LOCAL;
        strcpy(saddr.sun_path, MDNS_UDS_SERVERPATH);
@@ -388,14 +370,14 @@ static DNSServiceRef connect_to_server(void)
        while (1)
                {
                int err = connect(sdr->sockfd, (struct sockaddr *) &saddr, sizeof(saddr));
-               if (!err) break; // If we succeeded, return sdr
+               if (!err) break;                // If we succeeded, return sdr
                // If we failed, then it may be because the daemon is still launching.
                // This can happen for processes that launch early in the boot process, while the
                // daemon is still coming up. Rather than fail here, we'll wait a bit and try again.
                // If, after four seconds, we still can't connect to the daemon,
                // then we give up and return a failure code.
                if (++NumTries < DNSSD_CLIENT_MAXTRIES)
-                       sleep(1); // Sleep a bit, then try again
+                       sleep(1);               // Sleep a bit, then try again
                else
                        {
                        dnssd_close(sdr->sockfd);
@@ -412,7 +394,7 @@ static DNSServiceErrorType deliver_request(void *msg, DNSServiceRef sdr, int reu
     ipc_msg_hdr *hdr = msg;
     uint32_t datalen = hdr->datalen;
     dnssd_sockaddr_t caddr, daddr;  // (client and daemon address structs)
-    char *const data = (char *)msg + sizeof(ipc_msg_hdr);
+    char *data = (char *)msg + sizeof(ipc_msg_hdr);
     dnssd_sock_t listenfd = dnssd_InvalidSocket, errsd = dnssd_InvalidSocket;
        int ret;
        dnssd_socklen_t len = (dnssd_socklen_t) sizeof(caddr);
@@ -438,19 +420,17 @@ static DNSServiceErrorType deliver_request(void *msg, DNSServiceRef sdr, int reu
                        if (getsockname(listenfd, (struct sockaddr*) &caddr, &len) < 0) goto cleanup;
                        listen(listenfd, 1);
                        port.s = caddr.sin_port;
-                       data[0] = port.b[0];  // don't switch the byte order, as the
-                       data[1] = port.b[1];  // daemon expects it in network byte order
+                       data[0] = port.b[0];    // don't switch the byte order, as the
+                       data[1] = port.b[1];    // daemon expects it in network byte order
                        }
 #else
                        {
                        mode_t mask = umask(0);
                        caddr.sun_family = AF_LOCAL;
-// According to Stevens (section 3.2), there is no portable way to
-// determine whether sa_len is defined on a particular platform.
-#ifndef NOT_HAVE_SA_LEN
+#ifndef NOT_HAVE_SA_LEN                // According to Stevens (section 3.2), there is no portable way to
+                                                               // determine whether sa_len is defined on a particular platform.
                        caddr.sun_len = sizeof(struct sockaddr_un);
 #endif
-                       //syslog(LOG_WARNING, "deliver_request: creating UDS: %s\n", data);
                        strcpy(caddr.sun_path, data);
                        ret = bind(listenfd, (struct sockaddr *)&caddr, sizeof(caddr));
                        umask(mask);
@@ -461,9 +441,7 @@ static DNSServiceErrorType deliver_request(void *msg, DNSServiceRef sdr, int reu
                }
 
        ConvertHeaderBytes(hdr);
-       //syslog(LOG_WARNING, "deliver_request writing %ld bytes\n", datalen + sizeof(ipc_msg_hdr));
-       //syslog(LOG_WARNING, "deliver_request name is %s\n", (char *)msg + sizeof(ipc_msg_hdr));
-    if (write_all(sdr->sockfd, msg, datalen + sizeof(ipc_msg_hdr)) < 0)
+    if (my_write(sdr->sockfd, msg, datalen + sizeof(ipc_msg_hdr)) < 0)
         goto cleanup;
     free(msg);
     msg = NULL;
@@ -471,32 +449,22 @@ static DNSServiceErrorType deliver_request(void *msg, DNSServiceRef sdr, int reu
     if (reuse_sd) errsd = sdr->sockfd;
     else
         {
-               //syslog(LOG_WARNING, "deliver_request: accept\n");
         len = sizeof(daddr);
         errsd = accept(listenfd, (struct sockaddr *)&daddr, &len);
-               //syslog(LOG_WARNING, "deliver_request: accept returned %d\n", errsd);
         if (errsd < 0)  goto cleanup;
         }
 
-    if (read_all(errsd, (char*)&err, (int)sizeof(err)) < 0)
+    if (my_read(errsd, (char*)&err, (int)sizeof(err)) < 0)
         err = kDNSServiceErr_Unknown;
     else
        err = ntohl(err);
 
-       //syslog(LOG_WARNING, "deliver_request: retrieved error code %d\n", err);
-
 cleanup:
-       if (!reuse_sd)
-               {
-               if (listenfd > 0) dnssd_close(listenfd);
-               if (errsd    > 0) dnssd_close(errsd);
+    if (!reuse_sd && listenfd > 0) dnssd_close(listenfd);
+    if (!reuse_sd && errsd > 0) dnssd_close(errsd);
 #if !defined(USE_TCP_LOOPBACK)
-               // syslog(LOG_WARNING, "deliver_request: removing UDS: %s\n", data);
-               if (unlink(data) != 0)
-                       syslog(LOG_WARNING, "WARNING: unlink(\"%s\") failed errno %d (%s)", data, errno, strerror(errno));
-               // else syslog(LOG_WARNING, "deliver_request: removed UDS: %s\n", data);
+    if (!reuse_sd && data) unlink(data);
 #endif
-               }
     if (msg) free(msg);
     return err;
     }
@@ -517,7 +485,7 @@ DNSServiceErrorType DNSSD_API DNSServiceProcessResult(DNSServiceRef sdRef)
     if (!sdRef || sdRef->sockfd < 0 || !sdRef->process_reply)
         return kDNSServiceErr_BadReference;
 
-    if (read_all(sdRef->sockfd, (void *)&hdr, sizeof(hdr)) < 0)
+    if (my_read(sdRef->sockfd, (void *)&hdr, sizeof(hdr)) < 0)
                // return NoError on EWOULDBLOCK. This will handle the case
                // where a non-blocking socket is told there is data, but
                // it was a false positive.
@@ -527,7 +495,7 @@ DNSServiceErrorType DNSSD_API DNSServiceProcessResult(DNSServiceRef sdRef)
         return kDNSServiceErr_Incompatible;
     data = malloc(hdr.datalen);
     if (!data) return kDNSServiceErr_NoMemory;
-    if (read_all(sdRef->sockfd, data, hdr.datalen) < 0)
+    if (my_read(sdRef->sockfd, data, hdr.datalen) < 0)
         return kDNSServiceErr_Unknown;
     sdRef->process_reply(sdRef, &hdr, data);
     free(data);
@@ -550,7 +518,7 @@ static void handle_resolve_response(DNSServiceRef sdr, ipc_msg_hdr *hdr, char *d
     union { uint16_t s; u_char b[2]; } port;
     uint32_t ifi;
     DNSServiceErrorType err;
-    unsigned char *txtrecord;
+    char *txtrecord;
     int str_error = 0;
     (void)hdr;                 //unused
 
@@ -562,7 +530,7 @@ static void handle_resolve_response(DNSServiceRef sdr, ipc_msg_hdr *hdr, char *d
     port.b[0] = *data++;
     port.b[1] = *data++;
     txtlen = get_short(&data);
-    txtrecord = (unsigned char *)get_rdata(&data, txtlen);
+    txtrecord = get_rdata(&data, txtlen);
 
        if (!err && str_error) err = kDNSServiceErr_Unknown;
     ((DNSServiceResolveReply)sdr->app_callback)(sdr, flags, ifi, err, fullname, target, port.s, txtlen, txtrecord, sdr->app_context);
@@ -658,16 +626,16 @@ static void handle_query_response(DNSServiceRef sdr, ipc_msg_hdr *hdr, char *dat
     }
 
 DNSServiceErrorType DNSSD_API DNSServiceQueryRecord
-    (
   DNSServiceRef              *sdRef,
   DNSServiceFlags             flags,
   uint32_t                    interfaceIndex,
   const char                 *name,
   uint16_t                    rrtype,
   uint16_t                    rrclass,
   DNSServiceQueryRecordReply  callBack,
   void                       *context
   )
+(
DNSServiceRef                         *sdRef,
DNSServiceFlags                        flags,
uint32_t                              interfaceIndex,
const char                            *name,
uint16_t                              rrtype,
uint16_t                              rrclass,
DNSServiceQueryRecordReply            callBack,
void                                  *context
+ )
     {
     char *msg = NULL, *ptr;
     size_t len;
@@ -739,15 +707,15 @@ static void handle_browse_response(DNSServiceRef sdr, ipc_msg_hdr *hdr, char *da
     }
 
 DNSServiceErrorType DNSSD_API DNSServiceBrowse
-       (
      DNSServiceRef         *sdRef,
      DNSServiceFlags        flags,
      uint32_t               interfaceIndex,
      const char            *regtype,
      const char            *domain,
      DNSServiceBrowseReply  callBack,
      void                  *context
      )
+(
DNSServiceRef                      *sdRef,
DNSServiceFlags              flags,
uint32_t                     interfaceIndex,
const char                         *regtype,
const char                         *domain,
DNSServiceBrowseReply        callBack,
void                               *context
+ )
     {
     char *msg = NULL, *ptr;
     size_t len;
@@ -795,10 +763,10 @@ error:
     }
 
 DNSServiceErrorType DNSSD_API DNSServiceSetDefaultDomainForUser
-       (
      DNSServiceFlags  flags,
      const char      *domain
      )
+(
DNSServiceFlags                    flags,
const char                         *domain
+ )
     {
     DNSServiceRef sdr;
     DNSServiceErrorType err;
@@ -812,7 +780,7 @@ DNSServiceErrorType DNSSD_API DNSServiceSetDefaultDomainForUser
 
     sdr = connect_to_server();
     if (!sdr) { free(hdr); return kDNSServiceErr_Unknown; }
-    err = deliver_request((char *)hdr, sdr, 1); // deliver_request frees the message for us
+    err = deliver_request((char *)hdr, sdr, 1);                // deliver_request frees the message for us
        DNSServiceRefDeallocate(sdr);
        return err;
     }
@@ -873,8 +841,8 @@ DNSServiceErrorType DNSSD_API DNSServiceRegister
     if (!name[0]  && (flags & kDNSServiceFlagsNoAutoRename))
         return kDNSServiceErr_BadParam;
 
-    // no callback must have auto-rename
-    if (!callBack && (flags & kDNSServiceFlagsNoAutoRename)) return kDNSServiceErr_BadParam;
+    // no callback must have auto-name
+    if (!callBack && name[0]) return kDNSServiceErr_BadParam;
 
     len = sizeof(DNSServiceFlags);
     len += sizeof(uint32_t);  // interfaceIndex
@@ -938,13 +906,13 @@ static void handle_enumeration_response(DNSServiceRef sdr, ipc_msg_hdr *hdr, cha
     }
 
 DNSServiceErrorType DNSSD_API DNSServiceEnumerateDomains
-       (
      DNSServiceRef             *sdRef,
      DNSServiceFlags            flags,
      uint32_t                   interfaceIndex,
      DNSServiceDomainEnumReply  callBack,
      void                      *context
      )
+(
DNSServiceRef                    *sdRef,
+ DNSServiceFlags            flags,
+ uint32_t                   interfaceIndex,
+ DNSServiceDomainEnumReply  callBack,
void                             *context
+ )
     {
     char *msg = NULL, *ptr;
     size_t len;
@@ -1021,20 +989,20 @@ DNSServiceErrorType DNSSD_API DNSServiceCreateConnection(DNSServiceRef *sdRef)
     }
 
 DNSServiceErrorType DNSSD_API DNSServiceRegisterRecord
-    (
   DNSServiceRef                  sdRef,
   DNSRecordRef                  *RecordRef,
   DNSServiceFlags                flags,
   uint32_t                       interfaceIndex,
   const char                    *fullname,
   uint16_t                       rrtype,
   uint16_t                       rrclass,
   uint16_t                       rdlen,
   const void                    *rdata,
   uint32_t                       ttl,
   DNSServiceRegisterRecordReply  callBack,
   void                          *context
   )
+(
DNSServiceRef                 sdRef,
DNSRecordRef                          *RecordRef,
DNSServiceFlags               flags,
uint32_t                              interfaceIndex,
const char                            *fullname,
uint16_t                              rrtype,
uint16_t                              rrclass,
uint16_t                              rdlen,
const void                            *rdata,
uint32_t                              ttl,
DNSServiceRegisterRecordReply         callBack,
void                                  *context
+ )
     {
     char *msg = NULL, *ptr;
     size_t len;
@@ -1089,13 +1057,13 @@ error:
 //sdRef returned by DNSServiceRegister()
 DNSServiceErrorType DNSSD_API DNSServiceAddRecord
     (
-    DNSServiceRef    sdRef,
-    DNSRecordRef    *RecordRef,
-    DNSServiceFlags  flags,
-    uint16_t         rrtype,
-    uint16_t         rdlen,
-    const void      *rdata,
-    uint32_t         ttl
+    DNSServiceRef                      sdRef,
+    DNSRecordRef                       *RecordRef,
+    DNSServiceFlags               flags,
+    uint16_t                   rrtype,
+    uint16_t                   rdlen,
+    const void                         *rdata,
+    uint32_t                   ttl
     )
     {
     ipc_msg_hdr *hdr;
@@ -1141,12 +1109,12 @@ error:
 //DNSRecordRef returned by DNSServiceRegisterRecord or DNSServiceAddRecord
 DNSServiceErrorType DNSSD_API DNSServiceUpdateRecord
     (
-    DNSServiceRef    sdRef,
-    DNSRecordRef     RecordRef,
-    DNSServiceFlags  flags,
-    uint16_t         rdlen,
-    const void      *rdata,
-    uint32_t         ttl
+    DNSServiceRef              sdRef,
+    DNSRecordRef                       RecordRef,
+    DNSServiceFlags               flags,
+    uint16_t                   rdlen,
+    const void                         *rdata,
+    uint32_t                   ttl
     )
     {
     ipc_msg_hdr *hdr;
@@ -1171,11 +1139,11 @@ DNSServiceErrorType DNSSD_API DNSServiceUpdateRecord
     }
 
 DNSServiceErrorType DNSSD_API DNSServiceRemoveRecord
-       (
      DNSServiceRef    sdRef,
      DNSRecordRef     RecordRef,
      DNSServiceFlags  flags
      )
+(
DNSServiceRef            sdRef,
DNSRecordRef                  RecordRef,
DNSServiceFlags          flags
+ )
     {
     ipc_msg_hdr *hdr;
     size_t len = 0;
@@ -1195,16 +1163,16 @@ DNSServiceErrorType DNSSD_API DNSServiceRemoveRecord
     return err;
     }
 
-DNSServiceErrorType DNSSD_API DNSServiceReconfirmRecord
-       (
      DNSServiceFlags  flags,
      uint32_t         interfaceIndex,
      const char      *fullname,
      uint16_t         rrtype,
      uint16_t         rrclass,
      uint16_t         rdlen,
      const void      *rdata
      )
+void DNSSD_API DNSServiceReconfirmRecord
+(
DNSServiceFlags              flags,
uint32_t                     interfaceIndex,
const char                         *fullname,
uint16_t                     rrtype,
uint16_t                     rrclass,
uint16_t                     rdlen,
const void                         *rdata
+ )
     {
     char *ptr;
     size_t len;
@@ -1217,9 +1185,9 @@ DNSServiceErrorType DNSSD_API DNSServiceReconfirmRecord
     len += 3 * sizeof(uint16_t);
     len += rdlen;
     tmp = connect_to_server();
-    if (!tmp) return(kDNSServiceErr_Unknown);
+    if (!tmp) return;
     hdr = create_hdr(reconfirm_record_request, &len, &ptr, 1);
-    if (!hdr) return(kDNSServiceErr_Unknown);
+    if (!hdr) return;
 
     put_flags(flags, &ptr);
     put_long(interfaceIndex, &ptr);
@@ -1229,9 +1197,8 @@ DNSServiceErrorType DNSSD_API DNSServiceReconfirmRecord
     put_short(rdlen, &ptr);
     put_rdata(rdlen, rdata, &ptr);
        ConvertHeaderBytes(hdr);
-    write_all(tmp->sockfd, (char *)hdr, (int) len);
+    my_write(tmp->sockfd, (char *)hdr, (int) len);
     free(hdr);
     DNSServiceRefDeallocate(tmp);
-    return(kDNSServiceErr_NoError);
     }
 
index 460cfa93b9e1169ad95d9727a03000dff10b95e1..6a0236df98a2c982bdc18d7ba2aa3aa815b6659a 100644 (file)
@@ -1,5 +1,4 @@
-/* -*- Mode: C; tab-width: 4 -*-
- *
+/*
  * Copyright (c) 2003-2004, Apple Computer, Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without 
@@ -28,9 +27,6 @@
        Change History (most recent first):
 
 $Log: dnssd_ipc.c,v $
-Revision 1.16  2006/08/14 23:05:53  cheshire
-Added "tab-width" emacs header line
-
 Revision 1.15  2005/01/27 22:57:56  cheshire
 Fix compile errors on gcc4
 
index 53d324f966b5350fe43e11a1a05cee327940036d..32d7872e1c420ef71f4b427acd3c2fdb439514ce 100644 (file)
@@ -1,5 +1,4 @@
-/* -*- Mode: C; tab-width: 4 -*-
- *
+/*
  * Copyright (c) 2003-2004, Apple Computer, Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without 
     Change History (most recent first):
 
 $Log: dnssd_ipc.h,v $
-Revision 1.23  2006/08/14 23:05:53  cheshire
-Added "tab-width" emacs header line
-
-Revision 1.22  2006/06/28 08:56:26  cheshire
-Added "_op" to the end of the operation code enum values,
-to differentiate them from the routines with the same names
-
 Revision 1.21  2005/09/29 06:38:13  herscher
 Remove #define MSG_WAITALL on Windows.  We don't use this macro anymore, and it's presence causes warnings to be emitted when compiling against the latest Microsoft Platform SDK.
 
@@ -181,12 +173,12 @@ typedef enum
 
 typedef enum
     {
-    enumeration_reply_op = 64,
-    reg_service_reply_op,
-    browse_reply_op,
-    resolve_reply_op,
-    query_reply_op,
-    reg_record_reply_op
+    enumeration_reply = 64,
+    reg_service_reply,
+    browse_reply,
+    resolve_reply,
+    query_reply,
+    reg_record_reply
     } reply_op_t;
 
 typedef struct ipc_msg_hdr_struct ipc_msg_hdr;
index 38ae2db0a1c1e972e568da1b8bb57be53e350e3a..b02dd17c0ba28b771d64f2076d89a071f1c2f3ab 100644 (file)
@@ -1,23 +1,25 @@
-.\" -*- tab-width: 4 -*-
-.\" 
 .\" Copyright (c) 2004 Apple Computer, Inc. All Rights Reserved.
 .\" 
-.\" Licensed under the Apache License, Version 2.0 (the "License");
-.\" you may not use this file except in compliance with the License.
-.\" You may obtain a copy of the License at
+.\" @APPLE_LICENSE_HEADER_START@
 .\" 
-.\"     http://www.apache.org/licenses/LICENSE-2.0
+.\" This file contains Original Code and/or Modifications of Original Code
+.\" as defined in and that are subject to the Apple Public Source License
+.\" Version 2.0 (the 'License'). You may not use this file except in
+.\" compliance with the License. Please obtain a copy of the License at
+.\" http://www.opensource.apple.com/apsl/ and read it before using this
+.\" file.
 .\" 
-.\" Unless required by applicable law or agreed to in writing, software
-.\" distributed under the License is distributed on an "AS IS" BASIS,
-.\" WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-.\" See the License for the specific language governing permissions and
+.\" The Original Code and all software distributed under the License are
+.\" distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+.\" EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+.\" INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+.\" FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+.\" Please see the License for the specific language governing rights and
 .\" limitations under the License.
+.\" 
+.\" @APPLE_LICENSE_HEADER_END@
 .\"
 .\" $Log: mDNS.1,v $
-.\" Revision 1.8  2006/08/14 23:24:56  cheshire
-.\" Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
-.\"
 .\" Revision 1.7  2005/02/16 02:29:32  cheshire
 .\" Update terminology
 .\"
index d7b19f0b7a711c7c56036f36d089293caf65bbb8..fcf16ffbbb9fe3f92b2d7f3a400c636a806bbc85 100644 (file)
@@ -1,18 +1,24 @@
-/* -*- Mode: C; tab-width: 4 -*-
- *
+/*
  * Copyright (c) 2003 Apple Computer, Inc. All rights reserved.
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * @APPLE_LICENSE_HEADER_START@
  * 
- *     http://www.apache.org/licenses/LICENSE-2.0
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
  * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
  * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
 
        File:           mDNSDebug.c
 
@@ -23,9 +29,6 @@
     Change History (most recent first):
 
 $Log: mDNSDebug.c,v $
-Revision 1.7  2006/08/14 23:24:56  cheshire
-Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
-
 Revision 1.6  2005/01/27 22:57:56  cheshire
 Fix compile errors on gcc4
 
index 11f81689166e32d8138bb8a422c31ebc1723ff29..352ad6de970edcdc30cf652ad434969322f92d36 100644 (file)
@@ -1,23 +1,25 @@
-.\" -*- tab-width: 4 -*-
-.\" 
 .\" Copyright (c) 2003-2004 Apple Computer, Inc. All Rights Reserved.
 .\" 
-.\" Licensed under the Apache License, Version 2.0 (the "License");
-.\" you may not use this file except in compliance with the License.
-.\" You may obtain a copy of the License at
+.\" @APPLE_LICENSE_HEADER_START@
 .\" 
-.\"     http://www.apache.org/licenses/LICENSE-2.0
+.\" This file contains Original Code and/or Modifications of Original Code
+.\" as defined in and that are subject to the Apple Public Source License
+.\" Version 2.0 (the 'License'). You may not use this file except in
+.\" compliance with the License. Please obtain a copy of the License at
+.\" http://www.opensource.apple.com/apsl/ and read it before using this
+.\" file.
 .\" 
-.\" Unless required by applicable law or agreed to in writing, software
-.\" distributed under the License is distributed on an "AS IS" BASIS,
-.\" WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-.\" See the License for the specific language governing permissions and
+.\" The Original Code and all software distributed under the License are
+.\" distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+.\" EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+.\" INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+.\" FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+.\" Please see the License for the specific language governing rights and
 .\" limitations under the License.
+.\" 
+.\" @APPLE_LICENSE_HEADER_END@
 .\"
 .\" $Log: mDNSResponder.8,v $
-.\" Revision 1.7  2006/08/14 23:24:56  cheshire
-.\" Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
-.\"
 .\" Revision 1.6  2005/02/10 22:35:28  cheshire
 .\" <rdar://problem/3727944> Update name
 .\"
index 67302620a6850e43fc0cab2f0fdc45ea30604c09..406b7ab520ed7370d002c22789cbbcd0097d0937 100644 (file)
@@ -1,86 +1,29 @@
 /* -*- Mode: C; tab-width: 4 -*-
  *
- * Copyright (c) 2003-2006 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2003 Apple Computer, Inc. All rights reserved.
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * @APPLE_LICENSE_HEADER_START@
  * 
- *     http://www.apache.org/licenses/LICENSE-2.0
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
  * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
  * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
 
     Change History (most recent first):
 
 $Log: uds_daemon.c,v $
-Revision 1.201.2.1  2006/08/29 06:24:36  cheshire
-Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
-
-Revision 1.201  2006/06/29 03:02:47  cheshire
-<rdar://problem/4607042> mDNSResponder NXDOMAIN and CNAME support
-
-Revision 1.200  2006/06/28 08:56:26  cheshire
-Added "_op" to the end of the operation code enum values,
-to differentiate them from the routines with the same names
-
-Revision 1.199  2006/06/28 08:53:39  cheshire
-Added (commented out) debugging messages
-
-Revision 1.198  2006/06/27 20:16:07  cheshire
-Fix code layout
-
-Revision 1.197  2006/05/18 01:32:35  cheshire
-<rdar://problem/4472706> iChat: Lost connection with Bonjour
-(mDNSResponder insufficiently defensive against malformed browsing PTR responses)
-
-Revision 1.196  2006/05/05 07:07:13  cheshire
-<rdar://problem/4538206> mDNSResponder fails when UDS reads deliver partial data
-
-Revision 1.195  2006/04/25 20:56:28  mkrochma
-Added comment about previous checkin
-
-Revision 1.194  2006/04/25 18:29:36  mkrochma
-Workaround for warning: unused variable 'status' when building mDNSPosix
-
-Revision 1.193  2006/03/19 17:14:38  cheshire
-<rdar://problem/4483117> Need faster purging of stale records
-read_rr_from_ipc_msg was not setting namehash and rdatahash
-
-Revision 1.192  2006/03/18 20:58:32  cheshire
-Misplaced curly brace
-
-Revision 1.191  2006/03/10 22:19:43  cheshire
-Update debugging message in resolve_result_callback() to indicate whether event is ADD or RMV
-
-Revision 1.190  2006/03/10 21:56:12  cheshire
-<rdar://problem/4111464> After record update, old record sometimes remains in cache
-When service TXT and SRV record both change, clients with active resolve calls get *two* callbacks, one
-when the TXT data changes, and then immediately afterwards a second callback with the new port number
-This change suppresses the first unneccessary (and confusing) callback
-
-Revision 1.189  2006/01/06 00:56:31  cheshire
-<rdar://problem/4400573> Should remove PID file on exit
-
-Revision 1.188  2005/10/11 22:15:03  cheshire
-<rdar://problem/4296042> Add memory corruption safeguards to uds_daemon.c
-Only compile uds_validatelists() when building for Mac OS X
-
-Revision 1.187  2005/10/11 20:30:27  cheshire
-<rdar://problem/4296042> Add memory corruption safeguards to uds_daemon.c
-
-Revision 1.186  2005/09/12 07:11:53  herscher
-<rdar://problem/4248878> Lazily call RegisterSearchDomains to workaround crashes of several routers. This code is conditionally compiled, and currently is only enabled on Windows platforms.
-
-Revision 1.185  2005/07/29 00:55:10  ksekar
-Removed validation check in uds_validatelists which generated false alarms
-
-Revision 1.184  2005/07/04 22:40:26  cheshire
-Additional debugging code to help catch memory corruption
-
 Revision 1.183  2005/06/13 22:39:11  cheshire
 <rdar://problem/4144870> Missing return statement in handle_enum_request() error handling
 
@@ -603,7 +546,7 @@ Revision 1.25  2003/10/22 23:37:49  ksekar
 <rdar://problem/3459141>: crash/hang in abort_client
 
 Revision 1.24  2003/10/21 20:59:40  ksekar
-<rdar://problem/3335216>: handle blocked clients more efficiently
+<rdar://problem/3335216>: handle blocked clients moreefficiently
 
 Revision 1.23  2003/09/23 02:12:43  cheshire
 Also include port number in list of services registered via new UDS API
@@ -647,10 +590,9 @@ Update to APSL 2.0
 
 #if defined(_WIN32)
 #include <process.h>
-#define MDNS_LAZY_REGISTER_SEARCH_DOMAINS
 #define dnssd_strerror(X)      win32_strerror(X)
 #define usleep(X)                              Sleep(((X)+999)/1000)
-static char *  win32_strerror(int inErrorCode);
+static char * win32_strerror(int inErrorCode);
 #else
 #include <fcntl.h>
 #include <errno.h>
@@ -677,10 +619,6 @@ static char *      win32_strerror(int inErrorCode);
 #endif // LOCAL_PEERCRED
 #endif //__MACOSX__
 
-#if defined(MDNS_LAZY_REGISTER_SEARCH_DOMAINS)
-extern mStatus dDNS_RegisterSearchDomains( mDNS * const m );
-#endif
-
 // Types and Data Structures
 // ----------------------------------------------------------------------
 
@@ -852,7 +790,8 @@ typedef struct
     // const ResourceRecord *srv;
     mDNSBool   srv;
     mDNSBool   txt;
-    rdataSRV   srvdata;
+    domainname target;
+    mDNSIPPort port;
     mDNSu16    txtlen;
     mDNSu8     txtdata[AbsoluteMaxDNSMessageData];
     } resolve_termination_t;
@@ -880,50 +819,53 @@ static request_state      *       all_requests    =       NULL;
 #define MSG_PAD_BYTES 5                              // pad message buffer (read from client) with n zero'd bytes to guarantee
                                                      // n get_string() calls w/o buffer overrun
 // private function prototypes
-mDNSlocal void connect_callback(void *info);
-mDNSlocal int read_msg(request_state *rs);
-mDNSlocal int send_msg(reply_state *rs);
-mDNSlocal void abort_request(request_state *rs);
-mDNSlocal void request_callback(void *info);
-mDNSlocal void handle_resolve_request(request_state *rstate);
-mDNSlocal void question_result_callback(mDNS *const m, DNSQuestion *question, const ResourceRecord *const answer, mDNSBool AddRecord);
-mDNSlocal void question_termination_callback(void *context);
-mDNSlocal void handle_browse_request(request_state *request);
-mDNSlocal void browse_termination_callback(void *context);
-mDNSlocal void handle_regservice_request(request_state *request);
-mDNSlocal void regservice_termination_callback(void *context);
-mDNSlocal void regservice_callback(mDNS *const m, ServiceRecordSet *const srs, mStatus result);
-mDNSlocal mStatus handle_add_request(request_state *rstate);
-mDNSlocal mStatus handle_update_request(request_state *rstate);
-mDNSlocal void append_reply(request_state *req, reply_state *rep);
-mDNSlocal int build_domainname_from_strings(domainname *srv, char *name, char *regtype, char *domain);
-mDNSlocal void enum_termination_callback(void *context);
-mDNSlocal void enum_result_callback(mDNS *const m, DNSQuestion *question, const ResourceRecord *const answer, mDNSBool AddRecord);
-mDNSlocal void handle_query_request(request_state *rstate);
-mDNSlocal reply_state *format_enumeration_reply(request_state *rstate, const char *domain, DNSServiceFlags flags, uint32_t ifi, DNSServiceErrorType err);
-mDNSlocal void handle_enum_request(request_state *rstate);
-mDNSlocal mStatus handle_regrecord_request(request_state *rstate);
-mDNSlocal void regrecord_callback(mDNS *const m, AuthRecord * rr, mStatus result);
-mDNSlocal void connected_registration_termination(void *context);
-mDNSlocal void handle_reconfirm_request(request_state *rstate);
-mDNSlocal AuthRecord *read_rr_from_ipc_msg(char *msgbuf, int ttl, int validate_flags);
-mDNSlocal mStatus handle_removerecord_request(request_state *rstate);
-mDNSlocal void reset_connected_rstate(request_state *rstate);
-mDNSlocal int deliver_error(request_state *rstate, mStatus err);
-mDNSlocal int deliver_async_error(request_state *rs, reply_op_t op, mStatus err);
-mDNSlocal transfer_state send_undelivered_error(request_state *rs);
-mDNSlocal reply_state *create_reply(reply_op_t op, size_t datalen, request_state *request);
-mDNSlocal void update_callback(mDNS *const m, AuthRecord *const rr, RData *oldrd);
-mDNSlocal void my_perror(char *errmsg);
-mDNSlocal void unlink_request(request_state *rs);
-mDNSlocal void resolve_result_callback(mDNS *const m, DNSQuestion *question, const ResourceRecord *const answer, mDNSBool AddRecord);
-mDNSlocal void resolve_termination_callback(void *context);
-mDNSlocal int validate_message(request_state *rstate);
-mDNSlocal mStatus remove_extra(request_state *rstate, service_instance *serv);
-mDNSlocal mStatus remove_record(request_state *rstate);
-mDNSlocal void free_service_instance(service_instance *srv);
-mDNSlocal uint32_t dnssd_htonl(uint32_t l);
-mDNSlocal void handle_setdomain_request(request_state *rstate);
+static void connect_callback(void *info);
+static int read_msg(request_state *rs);
+static int send_msg(reply_state *rs);
+static void abort_request(request_state *rs);
+static void request_callback(void *info);
+static void handle_resolve_request(request_state *rstate);
+static void question_result_callback(mDNS *const m, DNSQuestion *question, const ResourceRecord *const answer, mDNSBool AddRecord);
+static void question_termination_callback(void *context);
+static void handle_browse_request(request_state *request);
+static void browse_termination_callback(void *context);
+static void browse_result_callback(mDNS *const m, DNSQuestion *question, const ResourceRecord *const answer, mDNSBool AddRecord);
+static void handle_regservice_request(request_state *request);
+static void regservice_termination_callback(void *context);
+static void process_service_registration(ServiceRecordSet *const srs, mDNSBool SuppressError);
+static void regservice_callback(mDNS *const m, ServiceRecordSet *const srs, mStatus result);
+static mStatus handle_add_request(request_state *rstate);
+static mStatus handle_update_request(request_state *rstate);
+static mStatus gen_rr_response(domainname *servicename, mDNSInterfaceID id, request_state *request, reply_state **rep);
+static void append_reply(request_state *req, reply_state *rep);
+static int build_domainname_from_strings(domainname *srv, char *name, char *regtype, char *domain);
+static void enum_termination_callback(void *context);
+static void enum_result_callback(mDNS *const m, DNSQuestion *question, const ResourceRecord *const answer, mDNSBool AddRecord);
+static void handle_query_request(request_state *rstate);
+static reply_state *format_enumeration_reply(request_state *rstate, const char *domain, DNSServiceFlags flags, uint32_t ifi, DNSServiceErrorType err);
+static void handle_enum_request(request_state *rstate);
+static mStatus handle_regrecord_request(request_state *rstate);
+static void regrecord_callback(mDNS *const m, AuthRecord * rr, mStatus result);
+static void connected_registration_termination(void *context);
+static void handle_reconfirm_request(request_state *rstate);
+static AuthRecord *read_rr_from_ipc_msg(char *msgbuf, int ttl, int validate_flags);
+static mStatus handle_removerecord_request(request_state *rstate);
+static void reset_connected_rstate(request_state *rstate);
+static int deliver_error(request_state *rstate, mStatus err);
+static int deliver_async_error(request_state *rs, reply_op_t op, mStatus err);
+static transfer_state send_undelivered_error(request_state *rs);
+static reply_state *create_reply(reply_op_t op, size_t datalen, request_state *request);
+static void update_callback(mDNS *const m, AuthRecord *const rr, RData *oldrd);
+static void my_perror(char *errmsg);
+static void unlink_request(request_state *rs);
+static void resolve_result_callback(mDNS *const m, DNSQuestion *question, const ResourceRecord *const answer, mDNSBool AddRecord);
+static void resolve_termination_callback(void *context);
+static int validate_message(request_state *rstate);
+static mStatus remove_extra(request_state *rstate, service_instance *serv);
+static mStatus remove_record(request_state *rstate);
+static void free_service_instance(service_instance *srv);
+static uint32_t dnssd_htonl(uint32_t l);
+static void handle_setdomain_request(request_state *rstate);
 
 // initialization, setup/teardown functions
 
@@ -958,7 +900,7 @@ mDNSlocal void LogClientInfo(request_state *req)
                }
        }
 
-mDNSlocal void FatalError(char *errmsg)
+static void FatalError(char *errmsg)
        {
        LogMsg("%s: %s", errmsg, dnssd_strerror(dnssd_errno()));
        *(long*)0 = 0;  // On OS X abort() doesn't generate a crash log, but writing to zero does
@@ -1095,8 +1037,6 @@ int udsserver_exit(void)
                debugf("Unable to remove %s", MDNS_UDS_SERVERPATH);
 #endif
 
-       if (PID_FILE[0]) unlink(PID_FILE);
-
     return 0;
     }
 
@@ -1148,7 +1088,7 @@ mDNSs32 udsserver_idle(mDNSs32 nextevent)
                        else if (nextevent - now > mDNSPlatformOneSecond) nextevent = now + mDNSPlatformOneSecond;  // try again in a second
                        }
         if (result == t_terminated || result == t_error)
-        //since we're already doing a list traversal, we unlink the request manually instead of calling unlink_request()
+        //since we're already doing a list traversal, we unlink the request manunally instead of calling unlink_request()
             {
             tmp = req;
             if (prev) prev->next = req->next;
@@ -1165,7 +1105,7 @@ mDNSs32 udsserver_idle(mDNSs32 nextevent)
     return nextevent;
     }
 
-mDNSexport void udsserver_info(mDNS *const m)
+void udsserver_info(mDNS *const m)
     {
        mDNSs32 now = mDNS_TimeNow(m);
        mDNSu32 CacheUsed = 0, CacheActive = 0;
@@ -1176,7 +1116,6 @@ mDNSexport void udsserver_info(mDNS *const m)
 
     LogMsgNoIdent("Timenow 0x%08lX (%ld)", (mDNSu32)now, now);
 
-    LogMsgNoIdent("Slt Q   TTL U Type  if     len rdata");
        for (slot = 0; slot < CACHE_HASH_SLOTS; slot++)
                for(cg = m->rrcache_hash[slot]; cg; cg=cg->next)
                        {
@@ -1186,14 +1125,10 @@ mDNSexport void udsserver_info(mDNS *const m)
                                mDNSs32 remain = rr->resrec.rroriginalttl - (now - rr->TimeRcvd) / mDNSPlatformOneSecond;
                                CacheUsed++;
                                if (rr->CRActiveQuestion) CacheActive++;
-                               LogMsgNoIdent("%3d %s%6ld %s %-6s%-6s%s",
-                                       slot,
-                                       rr->CRActiveQuestion ? "*" : " ",
-                                       remain,
-                                       (rr->resrec.RecordType & kDNSRecordTypePacketUniqueMask) ? "-" : " ",
-                                       DNSTypeName(rr->resrec.rrtype),
-                                       ((NetworkInterfaceInfo *)rr->resrec.InterfaceID)->ifname,
-                                       CRDisplayString(m, rr));
+                               LogMsgNoIdent("%s%6ld %s%-6s%-6s%s",
+                                       rr->CRActiveQuestion ? "*" : " ", remain,
+                                       (rr->resrec.RecordType & kDNSRecordTypePacketUniqueMask) ? "-" : " ", DNSTypeName(rr->resrec.rrtype),
+                                       ((NetworkInterfaceInfo *)rr->resrec.InterfaceID)->ifname, CRDisplayString(m, rr));
                                usleep(1000);   // Limit rate a little so we don't flood syslog too fast
                                }
                        }
@@ -1211,17 +1146,7 @@ mDNSexport void udsserver_info(mDNS *const m)
     LogMsgNoIdent("Timenow 0x%08lX (%ld)", (mDNSu32)now, now);
     }
 
-#if __MACOSX__ && MACOSX_MDNS_MALLOC_DEBUGGING
-mDNSexport void uds_validatelists(void)
-       {
-       request_state *req;
-       for (req = all_requests; req; req=req->next)
-               if (req->sd < 0 && req->sd != -2)
-                       LogMemCorruption("UDS request list: %p is garbage (%X)", req, req->sd);
-       }
-#endif
-
-mDNSlocal void rename_service(service_instance *srv)
+static void rename_service(service_instance *srv)
        {
        if (srv->autoname && !SameDomainLabel(srv->name.c, gmDNS->nicelabel.c))
                {
@@ -1231,10 +1156,11 @@ mDNSlocal void rename_service(service_instance *srv)
                }
        }
 
-mDNSexport void udsserver_handle_configchange(void)
+void udsserver_handle_configchange(void)
     {
     request_state *req;
 
+    
     for (req = all_requests; req; req = req->next)
         {
                if (req->service_registration)
@@ -1246,7 +1172,7 @@ mDNSexport void udsserver_handle_configchange(void)
                }
     }
 
-mDNSlocal void connect_callback(void *info)
+static void connect_callback(void *info)
     {
     dnssd_sock_t sd;
        dnssd_socklen_t len;
@@ -1303,7 +1229,7 @@ mDNSlocal void connect_callback(void *info)
     }
 
 // handler
-mDNSlocal void request_callback(void *info)
+static void request_callback(void *info)
        {
        request_state *rstate = info;
        transfer_state result;
@@ -1373,8 +1299,6 @@ mDNSlocal void request_callback(void *info)
                        return;
                        }
 
-               //LogOperation("request_callback: Opened dedicated errfd %d", errfd);
-
                #if defined(USE_TCP_LOOPBACK)
                        {
                        mDNSOpaque16 port;
@@ -1394,10 +1318,8 @@ mDNSlocal void request_callback(void *info)
                        strcpy(cliaddr.sun_path, ctrl_path);
                        }
                #endif
-               //LogOperation("request_callback: Connecting to “%s”", cliaddr.sun_path);
                if (connect(errfd, (struct sockaddr *)&cliaddr, sizeof(cliaddr)) < 0)
                        {
-                       //LogOperation("request_callback: Couldn't connect to “%s”", cliaddr.sun_path);
                        my_perror("ERROR: connect");
                        abort_request(rstate);
                        unlink_request(rstate);
@@ -1424,7 +1346,6 @@ mDNSlocal void request_callback(void *info)
                        default: LogMsg("%3d: ERROR: udsserver_recv_request - unsupported request type: %d", rstate->sd, rstate->hdr.op);
                        }
 
-               //LogOperation("request_callback: Returning error code %d on socket %d", err, errfd);
                err = dnssd_htonl(err);
                nwritten = send(errfd, (dnssd_sockbuf_t) &err, sizeof(err), 0);
                // On a freshly-created Unix Domain Socket, the kernel should *never* fail to buffer a four-byte write for us.
@@ -1432,9 +1353,7 @@ mDNSlocal void request_callback(void *info)
                if (nwritten < (int)sizeof(err))
                        LogMsg("ERROR: failed to write error response back to caller: %d %d %s",
                                nwritten, dnssd_errno(), dnssd_strerror(dnssd_errno()));
-               //else LogOperation("request_callback: Returned  error code %d on socket %d", err, errfd);
                dnssd_close(errfd);
-               //LogOperation("request_callback: Closed errfd %d", errfd);
                reset_connected_rstate(rstate);         // Reset ready to accept the next request on this pipe
                }
        else
@@ -1462,7 +1381,7 @@ mDNSlocal void request_callback(void *info)
 // massage the name parameters appropriately, but the rest of the operations (making the query call,
 // delivering the result to the client, and termination) are identical.
 
-mDNSlocal void handle_query_request(request_state *rstate)
+static void handle_query_request(request_state *rstate)
     {
     DNSServiceFlags flags;
     uint32_t ifi;
@@ -1505,7 +1424,6 @@ mDNSlocal void handle_query_request(request_state *rstate)
     q->LongLived        = (flags & kDNSServiceFlagsLongLivedQuery) != 0;
     q->ExpectUnique     = mDNSfalse;
     q->ForceMCast       = (flags & kDNSServiceFlagsForceMulticast) != 0;
-    q->ReturnCNAME      = (flags & kDNSServiceFlagsReturnCNAME) != 0;
     q->QuestionCallback = question_result_callback;
     q->QuestionContext  = rstate;
 
@@ -1529,7 +1447,7 @@ error:
     return;
     }
 
-mDNSlocal void handle_resolve_request(request_state *rstate)
+static void handle_resolve_request(request_state *rstate)
     {
     DNSServiceFlags flags;
     uint32_t interfaceIndex;
@@ -1629,7 +1547,7 @@ bad_param:
     unlink_request(rstate);
     }
     
-mDNSlocal void resolve_termination_callback(void *context)
+static void resolve_termination_callback(void *context)
     {
     resolve_termination_t *term = context;
     request_state *rs;
@@ -1649,8 +1567,8 @@ mDNSlocal void resolve_termination_callback(void *context)
     rs->termination_context = NULL;
     }
 
-mDNSlocal void resolve_result_callback(mDNS *const m, DNSQuestion *question, const ResourceRecord *const answer, mDNSBool AddRecord)
-       {
+static void resolve_result_callback(mDNS *const m, DNSQuestion *question, const ResourceRecord *const answer, mDNSBool AddRecord)
+{
     size_t len = 0;
     char fullname[MAX_ESCAPED_DOMAIN_NAME], target[MAX_ESCAPED_DOMAIN_NAME];
     char *data;
@@ -1660,8 +1578,7 @@ mDNSlocal void resolve_result_callback(mDNS *const m, DNSQuestion *question, con
     resolve_termination_t *res = rs->termination_context;
     (void)m; // Unused
 
-       LogOperation("%3d: DNSServiceResolve(%##s, %s) %s %s",
-               rs->sd, question->qname.c, DNSTypeName(question->qtype), AddRecord ? "ADD" : "RMV", RRDisplayString(m, answer));
+       LogOperation("%3d: DNSServiceResolve(%##s, %s) RESULT %s", rs->sd, question->qname.c, DNSTypeName(question->qtype), RRDisplayString(m, answer));
     
     // This code used to do this trick of just keeping a copy of the pointer to
     // the answer record in the cache, but the unicast query code doesn't currently
@@ -1669,24 +1586,18 @@ mDNSlocal void resolve_result_callback(mDNS *const m, DNSQuestion *question, con
     
        if (!AddRecord)
                {
-               // After unicast query code is updated to store its records in the common cache, use this...
-               // if (answer->rrtype == kDNSType_SRV && res->srv == answer) res->srv = mDNSNULL;
                // if (answer->rrtype == kDNSType_TXT && res->txt == answer) res->txt = mDNSNULL;
-               // intead of this...
-               if (answer->rrtype == kDNSType_SRV && res->srv &&                                    SameRDataBody(answer, (RDataBody *)&res->srvdata))
-                       res->srv = mDNSfalse;
-               if (answer->rrtype == kDNSType_TXT && res->txt && answer->rdlength == res->txtlen && SameRDataBody(answer, (RDataBody *)&res->txtdata))
-                       res->txt = mDNSfalse;
+               // if (answer->rrtype == kDNSType_SRV && res->srv == answer) res->srv = mDNSNULL;
                return;
                }
 
-       // After unicast query code is updated to store its records in the common cache, use this...
-    // if (answer->rrtype == kDNSType_SRV) res->srv = answer;
     // if (answer->rrtype == kDNSType_TXT) res->txt = answer;
-       // intead of this...
+    // if (answer->rrtype == kDNSType_SRV) res->srv = answer;
+
     if (answer->rrtype == kDNSType_SRV)
        {
-       res->srvdata = answer->rdata->u.srv;
+       AssignDomainName(&res->target, &answer->rdata->u.srv.target);
+       res->port = answer->rdata->u.srv.port;
        res->srv = mDNStrue;
        }
     if (answer->rrtype == kDNSType_TXT)
@@ -1700,7 +1611,7 @@ mDNSlocal void resolve_result_callback(mDNS *const m, DNSQuestion *question, con
     if (!res->txt || !res->srv) return;                // only deliver result to client if we have both answers
     
     ConvertDomainNameToCString(answer->name, fullname);
-    ConvertDomainNameToCString(&res->srvdata.target, target);
+    ConvertDomainNameToCString(&res->target, target);
 
     // calculate reply length
     len += sizeof(DNSServiceFlags);
@@ -1712,7 +1623,7 @@ mDNSlocal void resolve_result_callback(mDNS *const m, DNSQuestion *question, con
     len += res->txtlen;
     
     // allocate/init reply header
-    rep =  create_reply(resolve_reply_op, len, rs);
+    rep =  create_reply(resolve_reply, len, rs);
     rep->rhdr->flags = dnssd_htonl(0);
     rep->rhdr->ifi   = dnssd_htonl(mDNSPlatformInterfaceIndexfromInterfaceID(gmDNS, answer->InterfaceID));
     rep->rhdr->error = dnssd_htonl(kDNSServiceErr_NoError);
@@ -1722,8 +1633,8 @@ mDNSlocal void resolve_result_callback(mDNS *const m, DNSQuestion *question, con
     // write reply data to message
     put_string(fullname, &data);
     put_string(target, &data);
-       *data++ = res->srvdata.port.b[0];
-       *data++ = res->srvdata.port.b[1];
+       *data++ = res->port.b[0];
+       *data++ = res->port.b[1];
     put_short(res->txtlen, &data);
     put_rdata(res->txtlen, res->txtdata, &data);
     
@@ -1739,7 +1650,7 @@ mDNSlocal void resolve_result_callback(mDNS *const m, DNSQuestion *question, con
     }
 
 // what gets called when a resolve is completed and we need to send the data back to the client
-mDNSlocal void question_result_callback(mDNS *const m, DNSQuestion *question, const ResourceRecord *const answer, mDNSBool AddRecord)
+static void question_result_callback(mDNS *const m, DNSQuestion *question, const ResourceRecord *const answer, mDNSBool AddRecord)
     {
     char *data;
     char name[MAX_ESCAPED_DOMAIN_NAME];
@@ -1751,12 +1662,6 @@ mDNSlocal void question_result_callback(mDNS *const m, DNSQuestion *question, co
        LogOperation("%3d: DNSServiceQueryRecord(%##s, %s) RESULT %s", req->sd, question->qname.c, DNSTypeName(question->qtype), RRDisplayString(m, answer));
     //mDNS_StopQuery(m, question);
     
-       if (answer->rdlength == 0)
-               {
-               deliver_async_error(req, query_reply_op, kDNSServiceErr_NoSuchRecord);
-               return;
-               }
-    
     // calculate reply data length
     len = sizeof(DNSServiceFlags);
     len += 2 * sizeof(uint32_t);  // if index + ttl
@@ -1766,10 +1671,10 @@ mDNSlocal void question_result_callback(mDNS *const m, DNSQuestion *question, co
     ConvertDomainNameToCString(answer->name, name);
     len += strlen(name) + 1;
     
-    rep =  create_reply(query_reply_op, len, req);
+    rep =  create_reply(query_reply, len, req);
 
     rep->rhdr->flags = dnssd_htonl(AddRecord ? kDNSServiceFlagsAdd : 0);
-    rep->rhdr->ifi   = dnssd_htonl(mDNSPlatformInterfaceIndexfromInterfaceID(gmDNS, answer->InterfaceID));
+    rep->rhdr->ifi  dnssd_htonl(mDNSPlatformInterfaceIndexfromInterfaceID(gmDNS, answer->InterfaceID));
     rep->rhdr->error = dnssd_htonl(kDNSServiceErr_NoError);
 
     data = rep->sdata;
@@ -1785,7 +1690,7 @@ mDNSlocal void question_result_callback(mDNS *const m, DNSQuestion *question, co
     return;
     }
 
-mDNSlocal void question_termination_callback(void *context)
+static void question_termination_callback(void *context)
     {
     DNSQuestion *q = context;
        LogOperation("%3d: DNSServiceQueryRecord(%##s, %s) STOP", ((request_state *)q->QuestionContext)->sd, q->qname.c, DNSTypeName(q->qtype));
@@ -1796,7 +1701,7 @@ mDNSlocal void question_termination_callback(void *context)
 // If there's a comma followed by another character,
 // FindFirstSubType overwrites the comma with a nul and returns the pointer to the next character.
 // Otherwise, it returns a pointer to the final nul at the end of the string
-mDNSlocal char *FindFirstSubType(char *p)
+static char *FindFirstSubType(char *p)
        {
        while (*p)
                {
@@ -1811,7 +1716,7 @@ mDNSlocal char *FindFirstSubType(char *p)
 // FindNextSubType overwrites the comma with a nul and returns the pointer to the next character.
 // If it finds an illegal unescaped dot in the subtype name, it returns mDNSNULL
 // Otherwise, it returns a pointer to the final nul at the end of the string
-mDNSlocal char *FindNextSubType(char *p)
+static char *FindNextSubType(char *p)
        {
        while (*p)
                {
@@ -1865,14 +1770,14 @@ mDNSexport AuthRecord *AllocateSubTypes(mDNSs32 NumSubTypes, char *p)
        }
 
 #ifdef _HAVE_SETDOMAIN_SUPPORT_
-mDNSlocal void free_defdomain(mDNS *const m, AuthRecord *const rr, mStatus result)
+static void free_defdomain(mDNS *const m, AuthRecord *const rr, mStatus result)
        {
        (void)m;  // unused
        if (result == mStatus_MemFree) free(rr->RecordContext);  // context is the enclosing list structure
        }
 #endif
 
-mDNSlocal void handle_setdomain_request(request_state *request)
+static void handle_setdomain_request(request_state *request)
        {
        mStatus err = mStatus_NoError;
        char *ptr;
@@ -1961,80 +1866,11 @@ mDNSlocal void handle_setdomain_request(request_state *request)
     unlink_request(request);
     }
 
-// Generates a response message giving name, type, domain, plus interface index,
-// suitable for a browse result or service registration result.
-// On successful completion rep is set to point to a malloc'd reply_state struct
-mDNSlocal mStatus GenerateNTDResponse(domainname *servicename, mDNSInterfaceID id, request_state *request, reply_state **rep)
-       {
-       domainlabel name;
-       domainname type, dom;
-       *rep = NULL;
-       if (!DeconstructServiceName(servicename, &name, &type, &dom))
-               return kDNSServiceErr_Invalid;
-       else
-               {
-               char namestr[MAX_DOMAIN_LABEL+1];
-               char typestr[MAX_ESCAPED_DOMAIN_NAME];
-               char domstr [MAX_ESCAPED_DOMAIN_NAME];
-               int len;
-               char *data;
-       
-               ConvertDomainLabelToCString_unescaped(&name, namestr);
-               ConvertDomainNameToCString(&type, typestr);
-               ConvertDomainNameToCString(&dom, domstr);
-               
-               // Calculate reply data length
-               len = sizeof(DNSServiceFlags);
-               len += sizeof(uint32_t);  // if index
-               len += sizeof(DNSServiceErrorType);
-               len += (int) (strlen(namestr) + 1);
-               len += (int) (strlen(typestr) + 1);
-               len += (int) (strlen(domstr) + 1);
-               
-               // Build reply header
-               *rep = create_reply(query_reply_op, len, request);
-               (*rep)->rhdr->flags = dnssd_htonl(0);
-               (*rep)->rhdr->ifi   = dnssd_htonl(mDNSPlatformInterfaceIndexfromInterfaceID(gmDNS, id));
-               (*rep)->rhdr->error = dnssd_htonl(kDNSServiceErr_NoError);
-               
-               // Build reply body
-               data = (*rep)->sdata;
-               put_string(namestr, &data);
-               put_string(typestr, &data);
-               put_string(domstr, &data);
-
-               return mStatus_NoError;
-               }
-       }
-
-mDNSlocal void FoundInstance(mDNS *const m, DNSQuestion *question, const ResourceRecord *const answer, mDNSBool AddRecord)
-       {
-       request_state *req = question->QuestionContext;
-       reply_state *rep;
-       (void)m; // Unused
-
-       if (answer->rrtype != kDNSType_PTR)
-               { LogMsg("%3d: FoundInstance: Should not be called with rrtype %d (not a PTR record)", req->sd, answer->rrtype); return; }
-
-       if (GenerateNTDResponse(&answer->rdata->u.name, answer->InterfaceID, req, &rep) != mStatus_NoError)
-               {
-               LogMsg("%3d: FoundInstance: %##s PTR %##s received from network is not valid DNS-SD service pointer",
-                       req->sd, answer->name->c, answer->rdata->u.name.c);
-               return;
-               }
-
-       LogOperation("%3d: DNSServiceBrowse(%##s, %s) RESULT %s %s",
-               req->sd, question->qname.c, DNSTypeName(question->qtype), AddRecord ? "Add" : "Rmv", RRDisplayString(m, answer));
-
-       if (AddRecord) rep->rhdr->flags |= dnssd_htonl(kDNSServiceFlagsAdd);
-       append_reply(req, rep);
-       }
-
-mDNSlocal mStatus add_domain_to_browser(browser_info_t *info, const domainname *d)
+static mStatus add_domain_to_browser(browser_info_t *info, const domainname *d)
        {
        browser_t *b, *p;
        mStatus err;
-
+   
        for (p = info->browsers; p; p = p->next)
                {
                if (SameDomainName(&p->domain, d))
@@ -2044,7 +1880,7 @@ mDNSlocal mStatus add_domain_to_browser(browser_info_t *info, const domainname *
        b = mallocL("browser_t", sizeof(*b));
        if (!b) return mStatus_NoMemoryErr;
        AssignDomainName(&b->domain, d);
-       err = mDNS_StartBrowse(gmDNS, &b->q, &info->regtype, d, info->interface_id, info->ForceMCast, FoundInstance, info->rstate);
+       err = mDNS_StartBrowse(gmDNS, &b->q, &info->regtype, d, info->interface_id, info->ForceMCast, browse_result_callback, info->rstate);
        if (err)
                {
                LogMsg("mDNS_StartBrowse returned %d for type %##s domain %##s", err, info->regtype.c, d->c);
@@ -2058,7 +1894,7 @@ mDNSlocal mStatus add_domain_to_browser(browser_info_t *info, const domainname *
                return err;
        }
 
-mDNSlocal void handle_browse_request(request_state *request)
+static void handle_browse_request(request_state *request)
     {
     DNSServiceFlags flags;
     uint32_t interfaceIndex;
@@ -2092,13 +1928,6 @@ mDNSlocal void handle_browse_request(request_state *request)
     InterfaceID = mDNSPlatformInterfaceIDfromInterfaceIndex(gmDNS, interfaceIndex);
     if (interfaceIndex && !InterfaceID) { err = mStatus_BadParamErr;  goto error; }
 
-#if defined(MDNS_LAZY_REGISTER_SEARCH_DOMAINS)
-       if ( !domain || ( domain[0] == '\0' ) )
-               {
-               dDNS_RegisterSearchDomains( gmDNS );
-               }
-#endif
-               
        typedn.c[0] = 0;
        NumSubTypes = ChopSubTypes(regtype);    // Note: Modifies regtype string to remove trailing subtypes
        if (NumSubTypes < 0 || NumSubTypes > 1) { err = mStatus_BadParamErr;  goto error; }
@@ -2160,7 +1989,31 @@ error:
     unlink_request(request);
     }
 
-mDNSlocal void browse_termination_callback(void *context)
+static void browse_result_callback(mDNS *const m, DNSQuestion *question, const ResourceRecord *const answer, mDNSBool AddRecord)
+    {
+    request_state *req = question->QuestionContext;
+    reply_state *rep;
+    mStatus err;
+    (void)m; // Unused
+       LogOperation("%3d: DNSServiceBrowse(%##s, %s) RESULT %s %s",
+               req->sd, question->qname.c, DNSTypeName(question->qtype), AddRecord ? "Add" : "Rmv", RRDisplayString(m, answer));
+
+    err = gen_rr_response(&answer->rdata->u.name, answer->InterfaceID, req, &rep);
+    if (err)
+        {
+        if (deliver_async_error(req, browse_reply, err) < 0)
+            {
+            abort_request(req);
+            unlink_request(req);
+            }
+        return;
+        }
+    if (AddRecord) rep->rhdr->flags |= dnssd_htonl(kDNSServiceFlagsAdd);  // non-zero TTL indicates add
+    append_reply(req, rep);
+    return;
+    }
+
+static void browse_termination_callback(void *context)
     {
        browser_info_t *info = context;
        browser_t *ptr;
@@ -2201,10 +2054,8 @@ mDNSexport void udsserver_default_browse_domain_changed(const domainname *d, mDN
                                        *ptr = (*ptr)->next;
                                        if (remove->q.LongLived)
                                                {
-                                               // Give goodbyes for known answers.
-                                               // Note that this a special case where we know that the QuestionCallback function is our own
-                                               // code (it's FoundInstance), and that callback routine doesn't ever cancel its operation, so we
-                                               // don't need to guard against the question being cancelled mid-loop the way the mDNSCore routines do.
+                                               // give goodbyes for known answers.
+                                               // note that since events are sent to client via udsserver_idle(), we don't need to worry about the question being cancelled mid-loop
                                                CacheRecord *ka = remove->q.uDNS_info.knownAnswers;
                                                while (ka) { remove->q.QuestionCallback(gmDNS, &remove->q, &ka->resrec, mDNSfalse); ka = ka->next; }
                                                }
@@ -2257,7 +2108,7 @@ mDNSexport int CountExistingRegistrations(domainname *srv, mDNSIPPort port)
        return(count);
        }
 
-mDNSlocal mStatus register_service_instance(request_state *request, const domainname *domain)
+static mStatus register_service_instance(request_state *request, const domainname *domain)
        {
        service_info *info = request->service_registration;
        service_instance *ptr, *instance;
@@ -2342,7 +2193,7 @@ mDNSexport void udsserver_default_reg_domain_changed(const domainname *d, mDNSBo
        }
 
 // service registration
-mDNSlocal void handle_regservice_request(request_state *request)
+static void handle_regservice_request(request_state *request)
     {
     DNSServiceFlags flags;
     uint32_t ifi;
@@ -2395,7 +2246,7 @@ mDNSlocal void handle_regservice_request(request_state *request)
                if (!service->txtdata) { my_perror("ERROR: malloc"); result = mStatus_NoMemoryErr; goto finish; }
                memcpy(service->txtdata, get_rdata(&ptr, service->txtlen), service->txtlen);
                }
-       else service->txtdata = NULL;
+       else service->txtdata = NULL;              
 
        // Check for sub-types after the service type
        service->num_subtypes = ChopSubTypes(service->type_as_string);  // Note: Modifies regtype string to remove trailing subtypes
@@ -2491,7 +2342,7 @@ bad_param:
 // handles name conflicts, and delivers completed registration information to the client (via
 // process_service_registraion())
 
-mDNSlocal void regservice_callback(mDNS *const m, ServiceRecordSet *const srs, mStatus result)
+static void regservice_callback(mDNS *const m, ServiceRecordSet *const srs, mStatus result)
     {
     mStatus err;
        mDNSBool SuppressError = mDNSfalse;
@@ -2505,7 +2356,7 @@ mDNSlocal void regservice_callback(mDNS *const m, ServiceRecordSet *const srs, m
                service_info *info = instance->request->service_registration;
                if (info->default_domain && !instance->default_local) SuppressError = mDNStrue;
         // don't send errors up to client for wide-area, empty-string registrations
-               }
+               }                       
        
     if (result == mStatus_NoError)
                LogOperation("%3d: DNSServiceRegister(%##s, %u) REGISTERED  ",  instance->sd, srs->RR_SRV.resrec.name->c, mDNSVal16(srs->RR_SRV.resrec.rdata->u.srv.port));
@@ -2518,7 +2369,6 @@ mDNSlocal void regservice_callback(mDNS *const m, ServiceRecordSet *const srs, m
 
     if (result == mStatus_NoError)
                {
-               request_state *req = instance->request;
                if (instance->allowremotequery)
                        {
                        ExtraResourceRecord *e;
@@ -2528,22 +2378,7 @@ mDNSlocal void regservice_callback(mDNS *const m, ServiceRecordSet *const srs, m
                        srs->RR_TXT.AllowRemoteQuery = mDNStrue;
                        for (e = instance->srs.Extras; e; e = e->next) e->r.AllowRemoteQuery = mDNStrue;
                        }
-        
-               if (!req) LogMsg("ERROR: regservice_callback - null request object");
-               else
-                       {
-                       reply_state *rep;
-                       if (GenerateNTDResponse(srs->RR_SRV.resrec.name, srs->RR_SRV.resrec.InterfaceID, req, &rep) != mStatus_NoError)
-                               LogMsg("%3d: regservice_callback: %##s is not valid DNS-SD SRV name", req->sd, srs->RR_SRV.resrec.name->c);
-                       else
-                               {
-                               transfer_state send_result = send_msg(rep);
-                               if (send_result == t_error || send_result == t_terminated)
-                                       { abort_request(req); unlink_request(req); freeL("reply_state", rep); }
-                               else if (send_result == t_complete) freeL("regservice_callback", rep);
-                               else append_reply(req, rep);
-                               }
-                       }
+        process_service_registration(srs, SuppressError);
         if (instance->autoname && CountPeerRegistrations(m, srs) == 0)
                RecordUpdatedNiceLabel(m, 0);   // Successfully got new name, tell user immediately
                return;
@@ -2582,7 +2417,7 @@ mDNSlocal void regservice_callback(mDNS *const m, ServiceRecordSet *const srs, m
                    request_state *rs = instance->request;
                        if (!rs) { LogMsg("ERROR: regservice_callback: received result %ld with a NULL request pointer", result); return; }
                        free_service_instance(instance);
-                       if (!SuppressError && deliver_async_error(rs, reg_service_reply_op, result) < 0)
+                       if (!SuppressError && deliver_async_error(rs, reg_service_reply, result) < 0)
                 {
                 abort_request(rs);
                 unlink_request(rs);
@@ -2596,7 +2431,7 @@ mDNSlocal void regservice_callback(mDNS *const m, ServiceRecordSet *const srs, m
                if (!rs) { LogMsg("ERROR: regservice_callback: received result %ld with a NULL request pointer", result); return; }
         if (result != mStatus_NATTraversal) LogMsg("ERROR: unknown result in regservice_callback: %ld", result);
                free_service_instance(instance);
-        if (!SuppressError && deliver_async_error(rs, reg_service_reply_op, result) < 0)
+        if (!SuppressError && deliver_async_error(rs, reg_service_reply, result) < 0)
             {
             abort_request(rs);
             unlink_request(rs);
@@ -2618,7 +2453,7 @@ mDNSexport void FreeExtraRR(mDNS *const m, AuthRecord *const rr, mStatus result)
        freeL("ExtraResourceRecord", extra);
        }
 
-mDNSlocal mStatus add_record_to_service(request_state *rstate, service_instance *instance, uint16_t rrtype, uint16_t rdlen, char *rdata, uint32_t ttl)
+static mStatus add_record_to_service(request_state *rstate, service_instance *instance, uint16_t rrtype, uint16_t rdlen, char *rdata, uint32_t ttl)
        {
        ServiceRecordSet *srs = &instance->srs;
     ExtraResourceRecord *extra;
@@ -2648,7 +2483,7 @@ mDNSlocal mStatus add_record_to_service(request_state *rstate, service_instance
        return result;
        }
 
-mDNSlocal mStatus handle_add_request(request_state *rstate)
+static mStatus handle_add_request(request_state *rstate)
     {
     uint32_t ttl;
     uint16_t rrtype, rdlen;
@@ -2682,7 +2517,7 @@ mDNSlocal mStatus handle_add_request(request_state *rstate)
        return(result);
     }
 
-mDNSlocal mStatus update_record(AuthRecord *rr, uint16_t rdlen, char *rdata, uint32_t ttl)
+static mStatus update_record(AuthRecord *rr, uint16_t rdlen, char *rdata, uint32_t ttl)
        {
        int rdsize;
        RData *newrd;
@@ -2705,7 +2540,7 @@ mDNSlocal mStatus update_record(AuthRecord *rr, uint16_t rdlen, char *rdata, uin
        return result;
        }
 
-mDNSlocal mStatus handle_update_request(request_state *rstate)
+static mStatus handle_update_request(request_state *rstate)
     {
        uint16_t rdlen;
     char *ptr, *rdata;
@@ -2764,13 +2599,43 @@ end:
     return(result);
     }
     
-mDNSlocal void update_callback(mDNS *const m, AuthRecord *const rr, RData *oldrd)
+static void update_callback(mDNS *const m, AuthRecord *const rr, RData *oldrd)
     {
     (void)m; // Unused
     if (oldrd != &rr->rdatastorage) freeL("update_callback", oldrd);
     }
+    
+static void process_service_registration(ServiceRecordSet *const srs, mDNSBool SuppressError)
+    {
+    reply_state *rep;
+    transfer_state send_result;
+    mStatus err;
+    service_instance *instance = srs->ServiceContext;
+    request_state *req = instance->request;
 
-mDNSlocal void free_service_instance(service_instance *srv)
+       if (!req) { LogMsg("ERROR: process_service_registration - null request object"); return; }
+    err = gen_rr_response(srs->RR_SRV.resrec.name, srs->RR_SRV.resrec.InterfaceID, req, &rep);
+    if (err)
+        {
+        if (SuppressError && deliver_async_error(req, reg_service_reply, err) < 0)
+            {
+            abort_request(req);
+            unlink_request(req);
+            }
+        return;
+        }
+    send_result = send_msg(rep);
+    if (send_result == t_error || send_result == t_terminated)
+        {
+        abort_request(req);
+        unlink_request(req);
+        freeL("process_service_registration", rep);
+        }
+    else if (send_result == t_complete) freeL("process_service_registration", rep);
+    else append_reply(req, rep);
+    }
+
+static void free_service_instance(service_instance *srv)
        {
        request_state *rstate = srv->request;
        ExtraResourceRecord *e = srv->srs.Extras, *tmp;
@@ -2804,7 +2669,7 @@ mDNSlocal void free_service_instance(service_instance *srv)
        freeL("regservice_callback", srv);
        }
 
-mDNSlocal void regservice_termination_callback(void *context)
+static void regservice_termination_callback(void *context)
     {
        service_info *info = context;
        service_instance *i, *p;
@@ -2825,7 +2690,7 @@ mDNSlocal void regservice_termination_callback(void *context)
        freeL("service_info", info);
        }
 
-mDNSlocal mStatus handle_regrecord_request(request_state *rstate)
+static mStatus handle_regrecord_request(request_state *rstate)
     {
     AuthRecord *rr;
     registered_record_entry *re;
@@ -2868,7 +2733,7 @@ mDNSlocal mStatus handle_regrecord_request(request_state *rstate)
     return(result);
     }
 
-mDNSlocal void regrecord_callback(mDNS *const m, AuthRecord * rr, mStatus result)
+static void regrecord_callback(mDNS *const m, AuthRecord * rr, mStatus result)
     {
     registered_record_entry *re = rr->RecordContext;
        request_state *rstate = re ? re->rstate : NULL;
@@ -2894,7 +2759,7 @@ mDNSlocal void regrecord_callback(mDNS *const m, AuthRecord * rr, mStatus result
     len += sizeof(uint32_t);                //interfaceIndex
     len += sizeof(DNSServiceErrorType);
     
-    reply = create_reply(reg_record_reply_op, len, rstate);
+    reply = create_reply(reg_record_reply, len, rstate);
     reply->mhdr->client_context = re->client_context;
     reply->rhdr->flags = dnssd_htonl(0);
     reply->rhdr->ifi = dnssd_htonl(mDNSPlatformInterfaceIndexfromInterfaceID(gmDNS, rr->resrec.InterfaceID));
@@ -2920,7 +2785,7 @@ mDNSlocal void regrecord_callback(mDNS *const m, AuthRecord * rr, mStatus result
     else if (ts == t_morecoming) append_reply(rstate, reply);   // client is blocked, link reply into list
        }
 
-mDNSlocal void connected_registration_termination(void *context)
+static void connected_registration_termination(void *context)
     {
     int shared;
     registered_record_entry *fptr, *ptr = ((request_state *)context)->reg_recs;
@@ -2935,7 +2800,7 @@ mDNSlocal void connected_registration_termination(void *context)
                }
        }
     
-mDNSlocal mStatus handle_removerecord_request(request_state *rstate)
+static mStatus handle_removerecord_request(request_state *rstate)
     {
     mStatus err = mStatus_BadReferenceErr;
     char *ptr;
@@ -2963,7 +2828,7 @@ mDNSlocal mStatus handle_removerecord_request(request_state *rstate)
     }
 
 // remove a resource record registered via DNSServiceRegisterRecord()
-mDNSlocal mStatus remove_record(request_state *rstate)
+static mStatus remove_record(request_state *rstate)
     {
     int shared;
     mStatus err = mStatus_UnknownErr;
@@ -2987,7 +2852,7 @@ mDNSlocal mStatus remove_record(request_state *rstate)
        return err;
     }
 
-mDNSlocal mStatus remove_extra(request_state *rstate, service_instance *serv)
+static mStatus remove_extra(request_state *rstate, service_instance *serv)
        {
        mStatus err = mStatus_BadReferenceErr;
        ExtraResourceRecord *ptr;
@@ -3001,7 +2866,7 @@ mDNSlocal mStatus remove_extra(request_state *rstate, service_instance *serv)
        }
 
 // domain enumeration
-mDNSlocal void handle_enum_request(request_state *rstate)
+static void handle_enum_request(request_state *rstate)
     {
     DNSServiceFlags flags;
     uint32_t ifi;
@@ -3037,10 +2902,6 @@ mDNSlocal void handle_enum_request(request_state *rstate)
     term = mallocL("handle_enum_request", sizeof(enum_termination_t));
     if (!def || !all || !term) FatalError("ERROR: malloc");
 
-#if defined(MDNS_LAZY_REGISTER_SEARCH_DOMAINS)
-       dDNS_RegisterSearchDomains( gmDNS );
-#endif
-               
     // enumeration requires multiple questions, so we must link all the context pointers so that
     // necessary context can be reached from the callbacks
     def->rstate = rstate;
@@ -3077,7 +2938,7 @@ mDNSlocal void handle_enum_request(request_state *rstate)
         }
     }
 
-mDNSlocal void enum_result_callback(mDNS *const m, DNSQuestion *question, const ResourceRecord *const answer, mDNSBool AddRecord)
+static void enum_result_callback(mDNS *const m, DNSQuestion *question, const ResourceRecord *const answer, mDNSBool AddRecord)
     {
     char domain[MAX_ESCAPED_DOMAIN_NAME];
     domain_enum_t *de = question->QuestionContext;
@@ -3093,7 +2954,7 @@ mDNSlocal void enum_result_callback(mDNS *const m, DNSQuestion *question, const
         flags |= kDNSServiceFlagsAdd;
         if (de->type == mDNS_DomainTypeRegistrationDefault || de->type == mDNS_DomainTypeBrowseDefault)
             flags |= kDNSServiceFlagsDefault;
-       }
+       }       
     ConvertDomainNameToCString(&answer->rdata->u.name, domain);
        // note that we do NOT propagate specific interface indexes to the client - for example, a domain we learn from
        // a machine's system preferences may be discovered on the LocalOnly interface, but should be browsed on the
@@ -3109,18 +2970,19 @@ mDNSlocal void enum_result_callback(mDNS *const m, DNSQuestion *question, const
     return;
     }
 
-mDNSlocal reply_state *format_enumeration_reply(request_state *rstate, const char *domain, DNSServiceFlags flags, uint32_t ifi, DNSServiceErrorType err)
+static reply_state *format_enumeration_reply(request_state *rstate, const char *domain, DNSServiceFlags flags, uint32_t ifi, DNSServiceErrorType err)
     {
     size_t len;
     reply_state *reply;
     char *data;
-
+    
+    
     len = sizeof(DNSServiceFlags);
     len += sizeof(uint32_t);
     len += sizeof(DNSServiceErrorType);
     len += strlen(domain) + 1;
-
-    reply = create_reply(enumeration_reply_op, len, rstate);
+  
+    reply = create_reply(enumeration_reply, len, rstate);
     reply->rhdr->flags = dnssd_htonl(flags);
     reply->rhdr->ifi = dnssd_htonl(ifi);
     reply->rhdr->error = dnssd_htonl(err);
@@ -3129,7 +2991,7 @@ mDNSlocal reply_state *format_enumeration_reply(request_state *rstate, const cha
     return reply;
     }
 
-mDNSlocal void enum_termination_callback(void *context)
+static void enum_termination_callback(void *context)
     {
     enum_termination_t *t = context;
     mDNS *coredata = gmDNS;
@@ -3142,27 +3004,21 @@ mDNSlocal void enum_termination_callback(void *context)
     freeL("enum_termination_callback", t);
     }
 
-mDNSlocal void handle_reconfirm_request(request_state *rstate)
+static void handle_reconfirm_request(request_state *rstate)
     {
-    AuthRecord *rr = read_rr_from_ipc_msg(rstate->msgdata, 0, 0);
-    if (rr)
-               {
-               mStatus status = mDNS_ReconfirmByValue(gmDNS, &rr->resrec);
-               LogOperation(
-                       (status == mStatus_NoError) ?
-                       "%3d: DNSServiceReconfirmRecord(%s) interface %d initiated" :
-                       "%3d: DNSServiceReconfirmRecord(%s) interface %d failed: %d",
-                       rstate->sd, RRDisplayString(gmDNS, &rr->resrec),
-                       mDNSPlatformInterfaceIndexfromInterfaceID(gmDNS, rr->resrec.InterfaceID), status);
-               status = 0;  // Adding this line eliminates a build failure when building mDNSPosix on Tiger
-               }
-       abort_request(rstate);
-       unlink_request(rstate);
-       freeL("handle_reconfirm_request", rr);
-       }
+    AuthRecord *rr;
+
+    rr = read_rr_from_ipc_msg(rstate->msgdata, 0, 1);
+    if (!rr) return;
+       LogOperation("%3d: DNSServiceReconfirmRecord(%##s) %s", rstate->sd, RRDisplayString(gmDNS, &rr->resrec));
+    mDNS_ReconfirmByValue(gmDNS, &rr->resrec);
+    abort_request(rstate);
+    unlink_request(rstate);
+    freeL("handle_reconfirm_request", rr);
+    }
 
 // setup rstate to accept new reg/dereg requests
-mDNSlocal void reset_connected_rstate(request_state *rstate)
+static void reset_connected_rstate(request_state *rstate)
     {
     rstate->ts = t_morecoming;
     rstate->hdr_bytes = 0;
@@ -3175,7 +3031,7 @@ mDNSlocal void reset_connected_rstate(request_state *rstate)
 // returns a resource record (allocated w/ malloc) containing the data found in an IPC message
 // data must be in format flags, interfaceIndex, name, rrtype, rrclass, rdlen, rdata, (optional)ttl
 // (ttl only extracted/set if ttl argument is non-zero).  returns NULL for a bad-parameter error
-mDNSlocal AuthRecord *read_rr_from_ipc_msg(char *msgbuf, int GetTTL, int validate_flags)
+static AuthRecord *read_rr_from_ipc_msg(char *msgbuf, int GetTTL, int validate_flags)
     {
     char *rdata, name[256];
     AuthRecord *rr;
@@ -3219,20 +3075,65 @@ mDNSlocal AuthRecord *read_rr_from_ipc_msg(char *msgbuf, int GetTTL, int validat
         freeL("read_rr_from_ipc_msg", rr);
         return NULL;
        }
-    
     if (flags & kDNSServiceFlagsAllowRemoteQuery) rr->AllowRemoteQuery  = mDNStrue;
     rr->resrec.rrclass = class;
     rr->resrec.rdlength = rdlen;
     rr->resrec.rdata->MaxRDLength = rdlen;
     rdata = get_rdata(&msgbuf, rdlen);
     memcpy(rr->resrec.rdata->u.data, rdata, rdlen);
-    if (GetTTL) rr->resrec.rroriginalttl = get_long(&msgbuf);
-    rr->resrec.namehash = DomainNameHashValue(rr->resrec.name);
-    SetNewRData(&rr->resrec, mDNSNULL, 0);     // Sets rr->rdatahash for us
+    if (GetTTL)
+       {
+        rr->resrec.rroriginalttl = get_long(&msgbuf);
+       }
     return rr;
     }
 
-mDNSlocal int build_domainname_from_strings(domainname *srv, char *name, char *regtype, char *domain)
+// generate a response message for a browse result, service registration result, or any other call with the
+// identical callback signature.  on successful completion rep is set to point to a malloc'd reply_state struct,
+// and mStatus_NoError is returned.  otherwise the appropriate error is returned.
+
+static mStatus gen_rr_response(domainname *servicename, mDNSInterfaceID id, request_state *request, reply_state **rep)
+    {
+    char *data;
+    int len;
+    domainlabel name;
+    domainname type, dom;
+       char namestr[MAX_DOMAIN_LABEL+1];               // Unescaped name: up to 63 bytes plus C-string terminating NULL.
+       char typestr[MAX_ESCAPED_DOMAIN_NAME];
+       char domstr [MAX_ESCAPED_DOMAIN_NAME];
+
+    *rep = NULL;
+    
+    if (!DeconstructServiceName(servicename, &name, &type, &dom))
+        return kDNSServiceErr_Unknown;
+
+    ConvertDomainLabelToCString_unescaped(&name, namestr);
+    ConvertDomainNameToCString(&type, typestr);
+    ConvertDomainNameToCString(&dom, domstr);
+
+    // calculate reply data length
+    len = sizeof(DNSServiceFlags);
+    len += sizeof(uint32_t);  // if index
+    len += sizeof(DNSServiceErrorType);
+    len += (int) (strlen(namestr) + 1);
+    len += (int) (strlen(typestr) + 1);
+    len += (int) (strlen(domstr) + 1);
+    
+    *rep = create_reply(query_reply, len, request);
+
+    (*rep)->rhdr->flags = dnssd_htonl(0);
+    (*rep)->rhdr->ifi = dnssd_htonl(mDNSPlatformInterfaceIndexfromInterfaceID(gmDNS, id));
+    (*rep)->rhdr->error = dnssd_htonl(kDNSServiceErr_NoError);
+
+    data = (*rep)->sdata;
+    
+    put_string(namestr, &data);
+    put_string(typestr, &data);
+    put_string(domstr, &data);
+    return mStatus_NoError;
+    }
+
+static int build_domainname_from_strings(domainname *srv, char *name, char *regtype, char *domain)
     {
     domainlabel n;
     domainname d, t;
@@ -3245,7 +3146,7 @@ mDNSlocal int build_domainname_from_strings(domainname *srv, char *name, char *r
     }
 
 // append a reply to the list in a request object
-mDNSlocal void append_reply(request_state *req, reply_state *rep)
+static void append_reply(request_state *req, reply_state *rep)
     {
     reply_state *ptr;
 
@@ -3262,7 +3163,7 @@ mDNSlocal void append_reply(request_state *req, reply_state *rep)
 // read_msg may be called any time when the transfer state (rs->ts) is t_morecoming.
 // returns the current state of the request (morecoming, error, complete, terminated.)
 // if there is no data on the socket, the socket will be closed and t_terminated will be returned
-mDNSlocal int read_msg(request_state *rs)
+static int read_msg(request_state *rs)
     {
     uint32_t nleft;
     int nread;
@@ -3337,8 +3238,8 @@ mDNSlocal int read_msg(request_state *rs)
                 return t_error;
                }
             rs->msgdata = rs->msgbuf;
-            bzero(rs->msgbuf, rs->hdr.datalen + MSG_PAD_BYTES);
             }
+            bzero(rs->msgbuf, rs->hdr.datalen + MSG_PAD_BYTES);
         nleft = rs->hdr.datalen - rs->data_bytes;
         nread = recv(rs->sd, rs->msgbuf + rs->data_bytes, nleft, 0);
         if (nread == 0)        { rs->ts = t_terminated;  return t_terminated;  }
@@ -3365,7 +3266,7 @@ rerror:
     return t_error;
     }
 
-mDNSlocal int send_msg(reply_state *rs)
+static int send_msg(reply_state *rs)
     {
     ssize_t nwriten;
     
@@ -3417,11 +3318,12 @@ mDNSlocal int send_msg(reply_state *rs)
     return rs->ts;
     }
 
-mDNSlocal reply_state *create_reply(reply_op_t op, size_t datalen, request_state *request)
-       {
+static reply_state *create_reply(reply_op_t op, size_t datalen, request_state *request)
+{
     reply_state *reply;
     int totallen;
 
+    
     if ((unsigned)datalen < sizeof(reply_hdr))
         {
         LogMsg("ERROR: create_reply - data length less than lenght of required fields");
@@ -3448,7 +3350,7 @@ mDNSlocal reply_state *create_reply(reply_op_t op, size_t datalen, request_state
     return reply;
     }
 
-mDNSlocal int deliver_error(request_state *rstate, mStatus err)
+static int deliver_error(request_state *rstate, mStatus err)
        {
        int nwritten = -1;
        undelivered_error_t *undeliv;
@@ -3480,7 +3382,7 @@ mDNSlocal int deliver_error(request_state *rstate, mStatus err)
        }
 
 // returns 0 on success, -1 if send is incomplete, or on terminal failure (request is aborted)
-mDNSlocal transfer_state send_undelivered_error(request_state *rs)
+static transfer_state send_undelivered_error(request_state *rs)
        {
        int nwritten;
        
@@ -3508,7 +3410,7 @@ mDNSlocal transfer_state send_undelivered_error(request_state *rs)
 // send bogus data along with an error code to the app callback
 // returns 0 on success (linking reply into list of not fully delivered),
 // -1 on failure (request should be aborted)
-mDNSlocal int deliver_async_error(request_state *rs, reply_op_t op, mStatus err)
+static int deliver_async_error(request_state *rs, reply_op_t op, mStatus err)
     {
     int len;
     reply_state *reply;
@@ -3529,7 +3431,7 @@ mDNSlocal int deliver_async_error(request_state *rs, reply_op_t op, mStatus err)
     return 0;
     }
 
-mDNSlocal void abort_request(request_state *rs)
+static void abort_request(request_state *rs)
     {
     reply_state *rep, *ptr;
 
@@ -3537,10 +3439,7 @@ mDNSlocal void abort_request(request_state *rs)
     if (rs->msgbuf) freeL("abort_request", rs->msgbuf);
        LogOperation("%3d: Removing FD", rs->sd);
     udsSupportRemoveFDFromEventLoop(rs->sd);                                   // Note: This also closes file descriptor rs->sd for us
-
-       // Don't use dnssd_InvalidSocket (-1) because that's the sentinel value MACOSX_MDNS_MALLOC_DEBUGGING uses
-       // for detecting when the memory for an object is inadvertently freed while the object is still on some list
-    rs->sd = -2;
+    rs->sd = dnssd_InvalidSocket;
 
     // free pending replies
     rep = rs->replies;
@@ -3559,7 +3458,7 @@ mDNSlocal void abort_request(request_state *rs)
         }
     }
 
-mDNSlocal void unlink_request(request_state *rs)
+static void unlink_request(request_state *rs)
     {
     request_state *ptr;
     
@@ -3579,7 +3478,7 @@ mDNSlocal void unlink_request(request_state *rs)
     }
 
 //hack to search-replace perror's to LogMsg's
-mDNSlocal void my_perror(char *errmsg)
+static void my_perror(char *errmsg)
     {
     LogMsg("%s: %s", errmsg, dnssd_strerror(dnssd_errno()));
     }
@@ -3588,7 +3487,7 @@ mDNSlocal void my_perror(char *errmsg)
 // without overrunning it.
 // returns 0 on success, -1 on error.
 
-mDNSlocal int validate_message(request_state *rstate)
+static int validate_message(request_state *rstate)
     {
     uint32_t min_size;
     
@@ -3647,7 +3546,7 @@ mDNSlocal int validate_message(request_state *rstate)
     
     }
 
-mDNSlocal uint32_t dnssd_htonl(uint32_t l)
+static uint32_t dnssd_htonl(uint32_t l)
        {
        uint32_t        ret;
        char    *       data;
@@ -3661,7 +3560,7 @@ mDNSlocal uint32_t dnssd_htonl(uint32_t l)
 
 #if defined(_WIN32)
 
-mDNSlocal char * win32_strerror(int inErrorCode)
+static char * win32_strerror(int inErrorCode)
        {
        static char buffer[1024];
        DWORD       n;
index 358e121fd4ecb6a0a9d88c675fcbb5f70dce39b3..55688b75b35dae4021ce784790dced48659298de 100644 (file)
@@ -1,18 +1,24 @@
-/* -*- Mode: C; tab-width: 4 -*-
- *
+/*
  * Copyright (c) 2002-2003 Apple Computer, Inc. All rights reserved.
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * @APPLE_LICENSE_HEADER_START@
  * 
- *     http://www.apache.org/licenses/LICENSE-2.0
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
  * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
  * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
 
        File:           uds_daemon.h
 
@@ -23,9 +29,6 @@
     Change History (most recent first):
 
 $Log: uds_daemon.h,v $
-Revision 1.15  2006/08/14 23:24:57  cheshire
-Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
-
 Revision 1.14  2005/01/27 17:48:39  cheshire
 Added comment about CFSocketInvalidate closing the underlying socket
 
index 70670c89042d7a9b3858d4f4edd86f9cd793a8bc..988a41cfe7f731a37247a2f76c11de83684bdb31 100644 (file)
@@ -1,28 +1,28 @@
-/* -*- Mode: C; tab-width: 4 -*-
- *
+/*
  * Copyright (c) 2002-2005 Apple Computer, Inc. All rights reserved.
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * @APPLE_LICENSE_HEADER_START@
  * 
- *     http://www.apache.org/licenses/LICENSE-2.0
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
  * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
  * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
 
     Change History (most recent first):
 
 $Log: mDNSVxWorks.c,v $
-Revision 1.30  2006/08/14 23:25:18  cheshire
-Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
-
-Revision 1.29  2006/03/19 02:00:12  cheshire
-<rdar://problem/4073825> Improve logic for delaying packets after repeated interface transitions
-
 Revision 1.28  2005/05/30 07:36:38  bradley
 New implementation of the mDNS platform plugin for VxWorks 5.5 or later with IPv6 support.
 
@@ -609,7 +609,7 @@ mDNSexport mDNSs32  mDNSPlatformUTC( void )
 //     mDNSPlatformInterfaceIDfromInterfaceIndex
 //===========================================================================================================================
 
-mDNSexport mDNSInterfaceID     mDNSPlatformInterfaceIDfromInterfaceIndex( mDNS *const inMDNS, mDNSu32 inIndex )
+mDNSexport mDNSInterfaceID     mDNSPlatformInterfaceIDfromInterfaceIndex( const mDNS *const inMDNS, mDNSu32 inIndex )
 {
        NetworkInterfaceInfoVxWorks *           i;
        
@@ -630,7 +630,7 @@ mDNSexport mDNSInterfaceID  mDNSPlatformInterfaceIDfromInterfaceIndex( mDNS *cons
 //     mDNSPlatformInterfaceIndexfromInterfaceID
 //===========================================================================================================================
 
-mDNSexport mDNSu32     mDNSPlatformInterfaceIndexfromInterfaceID( mDNS *const inMDNS, mDNSInterfaceID inID )
+mDNSexport mDNSu32     mDNSPlatformInterfaceIndexfromInterfaceID( const mDNS *const inMDNS, mDNSInterfaceID inID )
 {
        NetworkInterfaceInfoVxWorks *           i;
        
@@ -1106,7 +1106,7 @@ mDNSlocal int     SetupActiveInterfaces( mDNS *const inMDNS, mDNSs32 inUTC )
                        // If it's is an old one that went away and came back in less than a minute, we're in a flapping scenario.
                        
                        flapping = ( ( inUTC - i->lastSeen ) > 0 ) && ( ( inUTC - i->lastSeen ) < 60 );
-                       mDNS_RegisterInterface( inMDNS, n, flapping );
+                       mDNS_RegisterInterface( inMDNS, n, flapping ? mDNSPlatformOneSecond * 5 : 0 );
                        if( mDNSAddressIsNonLinkLocalIPv4( &i->ifinfo.ip ) ) ++count;
                        
                        dmsg( kDebugLevelInfo, DEBUG_NAME "%s:   Registered    %8s(%u) InterfaceID %#p %#a%s%s\n", __ROUTINE__, 
@@ -1189,7 +1189,7 @@ mDNSlocal int     ClearInactiveInterfaces( mDNS *const inMDNS, mDNSs32 inUTC, mDNSBo
                                i->ifinfo.ifname, i->scopeID, i->ifinfo.InterfaceID, &i->ifinfo.ip, 
                                i->ifinfo.InterfaceActive ? " (Primary)" : "" );
                        
-                       mDNS_DeregisterInterface( inMDNS, &i->ifinfo, mDNSfalse );
+                       mDNS_DeregisterInterface( inMDNS, &i->ifinfo );
                        i->ifinfo.InterfaceID = NULL;
                        if( mDNSAddressIsNonLinkLocalIPv4( &i->ifinfo.ip ) ) ++count;
                }
index eb62b4877ece633877a74aa87f343383a280218c..50552f3962aa519577b0856889127592501da875 100644 (file)
@@ -1,25 +1,28 @@
-/* -*- Mode: C; tab-width: 4 -*-
- *
+/*
  * Copyright (c) 2002-2005 Apple Computer, Inc. All rights reserved.
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * @APPLE_LICENSE_HEADER_START@
  * 
- *     http://www.apache.org/licenses/LICENSE-2.0
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
  * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
  * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
 
     Change History (most recent first):
 
 $Log: mDNSVxWorks.h,v $
-Revision 1.5  2006/08/14 23:25:18  cheshire
-Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
-
 Revision 1.4  2005/05/30 07:36:38  bradley
 New implementation of the mDNS platform plugin for VxWorks 5.5 or later with IPv6 support.
 
index 0a041ce29905c48debb4c55c98e2b72fb86a17fb..d8c2824f792e850dbfb7e3aa5ac36db4ab2dcd51 100644 (file)
@@ -1,18 +1,24 @@
-/* -*- Mode: C; tab-width: 4 -*-
- *
+/*
  * Copyright (c) 2002-2003 Apple Computer, Inc. All rights reserved.
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * @APPLE_LICENSE_HEADER_START@
  * 
- *     http://www.apache.org/licenses/LICENSE-2.0
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
  * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
  * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
 
        Contains:       mDNS platform plugin for VxWorks.
 
        Change History (most recent first):
 
 $Log: mDNSVxWorksIPv4Only.c,v $
-Revision 1.29  2006/08/14 23:25:18  cheshire
-Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
-
-Revision 1.28  2006/03/19 02:00:12  cheshire
-<rdar://problem/4073825> Improve logic for delaying packets after repeated interface transitions
-
 Revision 1.27  2004/12/17 23:37:49  cheshire
 <rdar://problem/3485365> Guard against repeating wireless dissociation/re-association
 (and other repetitive configuration changes)
@@ -1104,7 +1104,7 @@ mDNSlocal mStatus SetupInterface( mDNS * const inMDNS, const struct ifaddrs *inA
        item->hostSet.Advertise               = inMDNS->AdvertiseLocalAddresses;
        item->hostSet.McastTxRx               = mDNStrue;
 
-       err = mDNS_RegisterInterface( inMDNS, &item->hostSet, mDNSfalse );
+       err = mDNS_RegisterInterface( inMDNS, &item->hostSet, 0 );
        require_noerr( err, exit );
        item->hostRegistered = mDNStrue;
        
@@ -1146,7 +1146,7 @@ mDNSlocal mStatus TearDownInterface( mDNS * const inMDNS, MDNSInterfaceItem *inI
        if( inItem->hostRegistered )
        {
                inItem->hostRegistered = mDNSfalse;
-               mDNS_DeregisterInterface( inMDNS, &inItem->hostSet, mDNSfalse );
+               mDNS_DeregisterInterface( inMDNS, &inItem->hostSet );
        }
        
        // Close the multicast socket.
index 9b24f19577fa06ddfd1a741b5689f546964e4c67..3c3cdf574eb666c09c6fda16101a551a9c2612ce 100644 (file)
@@ -1,18 +1,24 @@
-/* -*- Mode: C; tab-width: 4 -*-
- *
+/*
  * Copyright (c) 2002-2003 Apple Computer, Inc. All rights reserved.
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * @APPLE_LICENSE_HEADER_START@
  * 
- *     http://www.apache.org/licenses/LICENSE-2.0
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
  * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
  * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
 
        Contains:       mDNS platform plugin for VxWorks.
 
@@ -21,9 +27,6 @@
        Change History (most recent first):
 
 $Log: mDNSVxWorksIPv4Only.h,v $
-Revision 1.4  2006/08/14 23:25:18  cheshire
-Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
-
 Revision 1.3  2004/09/17 01:08:57  cheshire
 Renamed mDNSClientAPI.h to mDNSEmbeddedAPI.h
   The name "mDNSClientAPI.h" is misleading to new developers looking at this code. The interfaces
index 16a1001cc3d4e0422c9b35da3ca6b0af7820ac0d..75eaa2dbe14a67bea1cf597605da24d52a89239f 100644 (file)
@@ -1,25 +1,28 @@
-/* -*- Mode: C; tab-width: 4 -*-
- *
+/*
  * Copyright (c) 1997-2004 Apple Computer, Inc. All rights reserved.
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * @APPLE_LICENSE_HEADER_START@
  * 
- *     http://www.apache.org/licenses/LICENSE-2.0
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
  * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
  * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
 
     Change History (most recent first):
     
 $Log: CommonServices.h,v $
-Revision 1.3.4.1  2006/08/29 06:24:39  cheshire
-Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
-
 Revision 1.3  2004/04/08 09:27:12  bradley
 Added macro for portable specification of callback calling conventions.
 
index 3b280a4cfcd9c7d22f5b9653a70c261c97ba752e..092331a1f7716dd7374ce839ae78af74dcbfaa3b 100755 (executable)
@@ -1,25 +1,28 @@
-/* -*- Mode: C; tab-width: 4 -*-
- *
+/*
  * Copyright (c) 2002-2004 Apple Computer, Inc. All rights reserved.
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * @APPLE_LICENSE_HEADER_START@
  * 
- *     http://www.apache.org/licenses/LICENSE-2.0
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
  * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
  * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
 
     Change History (most recent first):
 
 $Log: ConfigDialog.cpp,v $
-Revision 1.3  2006/08/14 23:25:28  cheshire
-Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
-
 Revision 1.2  2005/03/03 19:55:21  shersche
 <rdar://problem/4034481> ControlPanel source code isn't saving CVS log info
 
index 0a38b16d5dff324e789520300e68cae953a954db..2d361a8024fe3836b88d45baa66eec387430c7bc 100644 (file)
@@ -1,25 +1,28 @@
-/* -*- Mode: C; tab-width: 4 -*-
- *
+/*
  * Copyright (c) 2002-2004 Apple Computer, Inc. All rights reserved.
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * @APPLE_LICENSE_HEADER_START@
  * 
- *     http://www.apache.org/licenses/LICENSE-2.0
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
  * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
  * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
 
     Change History (most recent first):
 
 $Log: ConfigDialog.h,v $
-Revision 1.3  2006/08/14 23:25:28  cheshire
-Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
-
 Revision 1.2  2005/03/03 19:55:21  shersche
 <rdar://problem/4034481> ControlPanel source code isn't saving CVS log info
 
index bcf0f7a0cd0ba07edc01b11d00f153d01071f5eb..c9a41238160ac76aaf1bb7c4148670e2e53ad33d 100755 (executable)
@@ -1,25 +1,28 @@
-/* -*- Mode: C; tab-width: 4 -*-
- *
+/*
  * Copyright (c) 2002-2004 Apple Computer, Inc. All rights reserved.
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * @APPLE_LICENSE_HEADER_START@
  * 
- *     http://www.apache.org/licenses/LICENSE-2.0
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
  * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
  * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
 
     Change History (most recent first):
 
 $Log: ConfigPropertySheet.cpp,v $
-Revision 1.5  2006/08/14 23:25:28  cheshire
-Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
-
 Revision 1.4  2005/10/05 20:46:50  herscher
 <rdar://problem/4192011> Move Wide-Area preferences to another part of the registry so they don't removed during an update-install.
 
index b92fc1fce994f2e1f0e5ad613fb2082e6728c6a3..a954f18578abc39d734c2a27ec3be779968503fb 100755 (executable)
@@ -1,25 +1,28 @@
-/* -*- Mode: C; tab-width: 4 -*-
- *
+/*
  * Copyright (c) 2002-2004 Apple Computer, Inc. All rights reserved.
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * @APPLE_LICENSE_HEADER_START@
  * 
- *     http://www.apache.org/licenses/LICENSE-2.0
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
  * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
  * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
 
     Change History (most recent first):
 
 $Log: ConfigPropertySheet.h,v $
-Revision 1.5  2006/08/14 23:25:28  cheshire
-Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
-
 Revision 1.4  2005/03/03 19:55:21  shersche
 <rdar://problem/4034481> ControlPanel source code isn't saving CVS log info
 
@@ -71,12 +74,9 @@ protected:
        DECLARE_MESSAGE_MAP()
 
        afx_msg BOOL    OnInitDialog();
-       afx_msg BOOL    OnCommand( WPARAM wParam, LPARAM lParam );
-
-       afx_msg LONG    OnDataReady( WPARAM inWParam, LPARAM inLParam );
-
-       afx_msg LONG    OnRegistryChanged( WPARAM inWParam, LPARAM inLParam );
-
+       afx_msg BOOL    OnCommand( WPARAM wParam, LPARAM lParam );\r
+       afx_msg LONG    OnDataReady( WPARAM inWParam, LPARAM inLParam );\r
+       afx_msg LONG    OnRegistryChanged( WPARAM inWParam, LPARAM inLParam );\r
        void                    OnEndDialog();
 
 private:
index ea0321e8df11f016bb4b1d4bb00713e12b4c1190..03db2cb72dd1b116c121c9337478c1343b50c7a4 100755 (executable)
@@ -1,25 +1,28 @@
-/* -*- Mode: C; tab-width: 4 -*-
- *
+/*
  * Copyright (c) 2002-2004 Apple Computer, Inc. All rights reserved.
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * @APPLE_LICENSE_HEADER_START@
  * 
- *     http://www.apache.org/licenses/LICENSE-2.0
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
  * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
  * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
 
     Change History (most recent first):
 
 $Log: ControlPanel.cpp,v $
-Revision 1.3  2006/08/14 23:25:28  cheshire
-Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
-
 Revision 1.2  2005/03/03 19:55:22  shersche
 <rdar://problem/4034481> ControlPanel source code isn't saving CVS log info
 
index efb5c3b2fb79766f0d5e15e84e92ad5d41628f89..04491d09115a98a2e94cd65b8d40e4b20e803d67 100644 (file)
@@ -1,25 +1,28 @@
-; -*- tab-width: 4 -*-
 ;
 ; Copyright (c) 2002-2004 Apple Computer, Inc. All rights reserved.
 ;
-; Licensed under the Apache License, Version 2.0 (the "License");
-; you may not use this file except in compliance with the License.
-; You may obtain a copy of the License at
+; @APPLE_LICENSE_HEADER_START@
 ; 
-;     http://www.apache.org/licenses/LICENSE-2.0
+; This file contains Original Code and/or Modifications of Original Code
+; as defined in and that are subject to the Apple Public Source License
+; Version 2.0 (the 'License'). You may not use this file except in
+; compliance with the License. Please obtain a copy of the License at
+; http://www.opensource.apple.com/apsl/ and read it before using this
+; file.
 ; 
-; Unless required by applicable law or agreed to in writing, software
-; distributed under the License is distributed on an "AS IS" BASIS,
-; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-; See the License for the specific language governing permissions and
+; The Original Code and all software distributed under the License are
+; distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+; EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+; INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+; FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+; Please see the License for the specific language governing rights and
 ; limitations under the License.
+; 
+; @APPLE_LICENSE_HEADER_END@
 ;
 ;  Change History (most recent first):
 ;
 ;  $Log: ControlPanel.def,v $
-;  Revision 1.4  2006/08/14 23:25:28  cheshire
-;  Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
-;
 ;  Revision 1.3  2005/03/03 19:55:22  shersche
 ;  <rdar://problem/4034481> ControlPanel source code isn't saving CVS log info
 ;
index 926ba94d0e946a4da9764b3c5537da47d5359295..847639e1f4b53ff43d8dc45dfaac6eb2bf2b9925 100644 (file)
@@ -1,25 +1,28 @@
-/* -*- Mode: C; tab-width: 4 -*-
- *
+/*
  * Copyright (c) 2002-2004 Apple Computer, Inc. All rights reserved.
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * @APPLE_LICENSE_HEADER_START@
  * 
- *     http://www.apache.org/licenses/LICENSE-2.0
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
  * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
  * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
 
     Change History (most recent first):
 
 $Log: ControlPanel.h,v $
-Revision 1.3  2006/08/14 23:25:28  cheshire
-Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
-
 Revision 1.2  2005/03/03 19:55:21  shersche
 <rdar://problem/4034481> ControlPanel source code isn't saving CVS log info
 
index 5d6c90afec817c491e808578833b883c598934ed..375d0f44167a8293013ce17b391e7b78a27813e9 100755 (executable)
@@ -1,25 +1,28 @@
-/* -*- Mode: C; tab-width: 4 -*-
- *
+/*
  * Copyright (c) 2002-2004 Apple Computer, Inc. All rights reserved.
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * @APPLE_LICENSE_HEADER_START@
  * 
- *     http://www.apache.org/licenses/LICENSE-2.0
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
  * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
  * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
 
     Change History (most recent first):
 
 $Log: FirstPage.cpp,v $
-Revision 1.6  2006/08/14 23:25:28  cheshire
-Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
-
 Revision 1.5  2005/10/05 20:46:50  herscher
 <rdar://problem/4192011> Move Wide-Area preferences to another part of the registry so they don't removed during an update-install.
 
index b990f3d43145ebeb6690755469c82184618ab1d3..6d875e1376afc08d7a670712182bd57f460885b3 100755 (executable)
@@ -1,25 +1,28 @@
-/* -*- Mode: C; tab-width: 4 -*-
- *
+/*
  * Copyright (c) 2002-2004 Apple Computer, Inc. All rights reserved.
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * @APPLE_LICENSE_HEADER_START@
  * 
- *     http://www.apache.org/licenses/LICENSE-2.0
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
  * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
  * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
 
     Change History (most recent first):
 
 $Log: FirstPage.h,v $
-Revision 1.4  2006/08/14 23:25:28  cheshire
-Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
-
 Revision 1.3  2005/03/07 18:27:42  shersche
 <rdar://problem/4037940> Fix problem when ControlPanel commits changes to the browse domain list
 
index eb830df113d35365d5954f919a0e19f495bed20e..83058b3fc2aa9232c16be2507d95f284c97ee324 100755 (executable)
@@ -1,25 +1,28 @@
-/* -*- Mode: C; tab-width: 4 -*-
- *
+/*
  * Copyright (c) 2002-2004 Apple Computer, Inc. All rights reserved.
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * @APPLE_LICENSE_HEADER_START@
  * 
- *     http://www.apache.org/licenses/LICENSE-2.0
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
  * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
  * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
 
     Change History (most recent first):
 
 $Log: SecondPage.cpp,v $
-Revision 1.7  2006/08/14 23:25:28  cheshire
-Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
-
 Revision 1.6  2005/10/05 20:46:50  herscher
 <rdar://problem/4192011> Move Wide-Area preferences to another part of the registry so they don't removed during an update-install.
 
index f60612ecfa381f65851857933b588177eadf1c09..917608edad7806ae6aec3b1c84fd8df12b4c9427 100755 (executable)
@@ -1,25 +1,28 @@
-/* -*- Mode: C; tab-width: 4 -*-
- *
+/*
  * Copyright (c) 2002-2004 Apple Computer, Inc. All rights reserved.
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * @APPLE_LICENSE_HEADER_START@
  * 
- *     http://www.apache.org/licenses/LICENSE-2.0
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
  * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
  * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
 
     Change History (most recent first):
 
 $Log: SecondPage.h,v $
-Revision 1.5  2006/08/14 23:25:28  cheshire
-Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
-
 Revision 1.4  2005/04/05 03:52:14  shersche
 <rdar://problem/4066485> Registering with shared secret key doesn't work. Additionally, mDNSResponder wasn't dynamically re-reading it's DynDNS setup after setting a shared secret key.
 
index 066fa98767e0242786af1eb224fc7037f88fc86b..8f0260bac3675abc51d272f06a85b9c5c84c3a31 100644 (file)
@@ -1,25 +1,28 @@
-/* -*- Mode: C; tab-width: 4 -*-
- *
+/*
  * Copyright (c) 2002-2004 Apple Computer, Inc. All rights reserved.
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * @APPLE_LICENSE_HEADER_START@
  * 
- *     http://www.apache.org/licenses/LICENSE-2.0
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
  * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
  * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
 
     Change History (most recent first):
 
 $Log: SharedSecret.cpp,v $
-Revision 1.5  2006/08/14 23:25:28  cheshire
-Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
-
 Revision 1.4  2005/10/18 06:13:41  herscher
 <rdar://problem/4192119> Prepend "$" to key name to ensure that secure updates work if the domain name and key name are the same
 
@@ -125,7 +128,7 @@ CSharedSecret::Commit( CString zone )
                m_key += '.';
        }
 
-       // <rdar://problem/4192119>
+       // <rdar://problem/ >
        //
        // Prepend "$" to the key name, so that there will
        // be no conflict between the zone name and the key
index f5f64351c597599c7d584e892f932593ba85aa2a..c757df9c0f84ac97cfe4c74616d0d046b3873af7 100644 (file)
@@ -1,25 +1,28 @@
-/* -*- Mode: C; tab-width: 4 -*-
- *
+/*
  * Copyright (c) 2002-2004 Apple Computer, Inc. All rights reserved.
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * @APPLE_LICENSE_HEADER_START@
  * 
- *     http://www.apache.org/licenses/LICENSE-2.0
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
  * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
  * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
 
     Change History (most recent first):
 
 $Log: SharedSecret.h,v $
-Revision 1.4  2006/08/14 23:25:28  cheshire
-Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
-
 Revision 1.3  2005/04/06 02:04:49  shersche
 <rdar://problem/4066485> Registering with shared secret doesn't work
 
index a4834185065ea365f6f86821516913e8e664f7ca..b8cef51e9072df63812ac44ba368663955306c99 100755 (executable)
@@ -1,25 +1,28 @@
-/* -*- Mode: C; tab-width: 4 -*-
- *
+/*
  * Copyright (c) 2002-2004 Apple Computer, Inc. All rights reserved.
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * @APPLE_LICENSE_HEADER_START@
  * 
- *     http://www.apache.org/licenses/LICENSE-2.0
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
  * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
  * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
 
     Change History (most recent first):
 
 $Log: ThirdPage.cpp,v $
-Revision 1.5  2006/08/14 23:25:29  cheshire
-Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
-
 Revision 1.4  2005/10/05 20:46:50  herscher
 <rdar://problem/4192011> Move Wide-Area preferences to another part of the registry so they don't removed during an update-install.
 
index 6c1146c86e1b8efbdb8477c55ce19b1c9979eaa2..9fe742038706758451be7e94edb90e72012aac3e 100755 (executable)
@@ -1,25 +1,28 @@
-/* -*- Mode: C; tab-width: 4 -*-
- *
+/*
  * Copyright (c) 2002-2004 Apple Computer, Inc. All rights reserved.
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * @APPLE_LICENSE_HEADER_START@
  * 
- *     http://www.apache.org/licenses/LICENSE-2.0
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
  * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
  * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
 
     Change History (most recent first):
 
 $Log: ThirdPage.h,v $
-Revision 1.3  2006/08/14 23:25:29  cheshire
-Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
-
 Revision 1.2  2005/03/03 19:55:21  shersche
 <rdar://problem/4034481> ControlPanel source code isn't saving CVS log info
 
@@ -33,13 +36,10 @@ Revision 1.2  2005/03/03 19:55:21  shersche
 
 #include <DebugServices.h>
 #include <list>
-#include "afxcmn.h"
-
-#include "afxwin.h"
-
-
-
+#include "afxcmn.h"\r
+#include "afxwin.h"\r
 
+\r
 
 //---------------------------------------------------------------------------------------------------------------------------
 //     CThirdPage
@@ -86,82 +86,44 @@ private:
        BOOL                    m_modified;
 
 public:
-private:
-
-       static int CALLBACK 
-
-       SortFunc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort);
-
-
-
-       CListCtrl       m_browseListCtrl;
-
-       bool            m_initialized;
-
-       bool            m_firstTime;
-
-
-
-public:
-
-
-
-       afx_msg void OnBnClickedAddBrowseDomain();
-
-       afx_msg void OnBnClickedRemoveBrowseDomain();
-
-       afx_msg void OnLvnItemchangedBrowseList(NMHDR *pNMHDR, LRESULT *pResult);
-
-       CButton m_removeButton;
-
-};
-
-
-
-
-
+private:\r
+       static int CALLBACK \r
+       SortFunc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort);\r
+\r
+       CListCtrl       m_browseListCtrl;\r
+       bool            m_initialized;\r
+       bool            m_firstTime;\r
+\r
+public:\r
+\r
+       afx_msg void OnBnClickedAddBrowseDomain();\r
+       afx_msg void OnBnClickedRemoveBrowseDomain();\r
+       afx_msg void OnLvnItemchangedBrowseList(NMHDR *pNMHDR, LRESULT *pResult);\r
+       CButton m_removeButton;\r
+};\r
+\r
+\r
 //---------------------------------------------------------------------------------------------------------------------------
 //     CAddBrowseDomain
 //---------------------------------------------------------------------------------------------------------------------------
-
-
-class CAddBrowseDomain : public CDialog
-
-{
-
-       DECLARE_DYNAMIC(CAddBrowseDomain)
-
-
-
-public:
-
-       CAddBrowseDomain(CWnd* pParent = NULL);   // standard constructor
-
-       virtual ~CAddBrowseDomain();
-
-
-
-// Dialog Data
-
-       enum { IDD = IDR_ADD_BROWSE_DOMAIN };
-
-
-
-protected:
-
-       virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
-
-       virtual BOOL OnInitDialog();
-
-       virtual void OnOK();
-
-       DECLARE_MESSAGE_MAP()
-
-public:
-
-       CComboBox       m_comboBox;
-
-       CString         m_text;
-
-};
-
+\r
+class CAddBrowseDomain : public CDialog\r
+{\r
+       DECLARE_DYNAMIC(CAddBrowseDomain)\r
+\r
+public:\r
+       CAddBrowseDomain(CWnd* pParent = NULL);   // standard constructor\r
+       virtual ~CAddBrowseDomain();\r
+\r
+// Dialog Data\r
+       enum { IDD = IDR_ADD_BROWSE_DOMAIN };\r
+\r
+protected:\r
+       virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support\r
+       virtual BOOL OnInitDialog();\r
+       virtual void OnOK();\r
+       DECLARE_MESSAGE_MAP()\r
+public:\r
+       CComboBox       m_comboBox;\r
+       CString         m_text;\r
+};\r
index 4bab622206c2b3ccb2aea0c6b846f465cc580b7c..ad80318a0e34460fbba1302fd88c44e2790af02c 100755 (executable)
@@ -1,25 +1,28 @@
-/* -*- Mode: C; tab-width: 4 -*-
- *
+/*
  * Copyright (c) 1997-2004 Apple Computer, Inc. All rights reserved.
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * @APPLE_LICENSE_HEADER_START@
  * 
- *     http://www.apache.org/licenses/LICENSE-2.0
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
  * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
  * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
 
     Change History (most recent first):
     
 $Log: stdafx.cpp,v $
-Revision 1.3  2006/08/14 23:25:29  cheshire
-Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
-
 Revision 1.2  2005/03/03 19:55:22  shersche
 <rdar://problem/4034481> ControlPanel source code isn't saving CVS log info
 
index 1a04b6c72a058c5bafaeb397b1d475e6538d63cc..7e63ac4c495712b330bc7a21004cf8f09c0a352a 100755 (executable)
@@ -1,25 +1,28 @@
-/* -*- Mode: C; tab-width: 4 -*-
- *
+/*
  * Copyright (c) 1997-2004 Apple Computer, Inc. All rights reserved.
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * @APPLE_LICENSE_HEADER_START@
  * 
- *     http://www.apache.org/licenses/LICENSE-2.0
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
  * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
  * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
 
     Change History (most recent first):
     
 $Log: stdafx.h,v $
-Revision 1.4  2006/08/14 23:25:29  cheshire
-Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
-
 Revision 1.3  2005/10/19 19:50:35  herscher
 Workaround a bug in the latest Microsoft Platform SDK when compiling C++ files that include (directly or indirectly) <WspiApi.h>
 
@@ -71,8 +74,6 @@ Revision 1.2  2005/03/03 19:55:21  shersche
 #ifndef _AFX_NO_AFXCMN_SUPPORT
 #include <afxcmn.h>                    // MFC support for Windows Common Controls
 #endif // _AFX_NO_AFXCMN_SUPPORT
-#include <afxdlgs.h>
-
-#include <cpl.h>            // Control Panel Applet functions and defines
-
+#include <afxdlgs.h>\r
+#include <cpl.h>            // Control Panel Applet functions and defines\r
 #include <afxtempl.h>       // MFC Template support
index 4a71579c8e453da58986c5c86837e2cb818c23eb..c32676cd859eb474e92fe6f9b1d17278da3d4b85 100755 (executable)
@@ -1,25 +1,28 @@
-/* -*- Mode: C; tab-width: 4 -*-
- *
+/*
  * Copyright (c) 2003-2004 Apple Computer, Inc. All rights reserved.
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * @APPLE_LICENSE_HEADER_START@
  * 
- *     http://www.apache.org/licenses/LICENSE-2.0
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
  * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
  * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
 
     Change History (most recent first):
 
 $Log: AssemblyInfo.cpp,v $
-Revision 1.5  2006/08/14 23:25:43  cheshire
-Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
-
 Revision 1.4  2004/07/26 21:03:00  shersche
 enable strong naming for dnssd.NET assembly
 
index 1886c4475f12eb05ff60ac6aa627502cb14c5293..f64b951bc833f42b120c26045eeead40c409993a 100755 (executable)
@@ -1,25 +1,28 @@
-/* -*- Mode: C; tab-width: 4 -*-
- *
+/*
  * Copyright (c) 2003-2004 Apple Computer, Inc. All rights reserved.
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * @APPLE_LICENSE_HEADER_START@
  * 
- *     http://www.apache.org/licenses/LICENSE-2.0
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
  * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
  * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
 
     Change History (most recent first):
 
 $Log: PString.h,v $
-Revision 1.3  2006/08/14 23:25:43  cheshire
-Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
-
 Revision 1.2  2004/07/19 16:08:56  shersche
 fix problems in UTF8/Unicode string translations
 
@@ -46,8 +49,7 @@ namespace Apple
                        {
                                Byte unicodeBytes[] = Encoding::Unicode->GetBytes(string);
                                Byte utf8Bytes[] = Encoding::Convert(Encoding::Unicode, Encoding::UTF8, unicodeBytes);
-                               m_p = Marshal::AllocHGlobal(utf8Bytes->Length + 1);
-
+                               m_p = Marshal::AllocHGlobal(utf8Bytes->Length + 1);\r
                                Byte __pin * p = &utf8Bytes[0];
                                char * hBytes = static_cast<char*>(m_p.ToPointer());
                                memcpy(hBytes, p, utf8Bytes->Length);
index 54ff68e5b429947c59a6039730c89b2c88d34606..b09cb841fa43e912d2e7f4e575e3728f8bed4762 100755 (executable)
@@ -1,25 +1,28 @@
-/* -*- Mode: C; tab-width: 4 -*-
- *
+/*
  * Copyright (c) 2003-2004 Apple Computer, Inc. All rights reserved.
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * @APPLE_LICENSE_HEADER_START@
  * 
- *     http://www.apache.org/licenses/LICENSE-2.0
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
  * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
  * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
 
     Change History (most recent first):
 
 $Log: Stdafx.cpp,v $
-Revision 1.3  2006/08/14 23:25:43  cheshire
-Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
-
 Revision 1.2  2005/02/05 02:37:01  cheshire
 Convert newlines to Unix-style (ASCII 10)
 
index 7fbc319892d74c8c7f21aa68a0be81f7c43d6cc3..00a0820544383b61015937943b20addac4875f89 100755 (executable)
@@ -1,25 +1,28 @@
-/* -*- Mode: C; tab-width: 4 -*-
- *
+/*
  * Copyright (c) 2003-2004 Apple Computer, Inc. All rights reserved.
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * @APPLE_LICENSE_HEADER_START@
  * 
- *     http://www.apache.org/licenses/LICENSE-2.0
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
  * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
  * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
 
     Change History (most recent first):
 
 $Log: Stdafx.h,v $
-Revision 1.5  2006/08/14 23:25:43  cheshire
-Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
-
 Revision 1.4  2005/10/19 19:50:35  herscher
 Workaround a bug in the latest Microsoft Platform SDK when compiling C++ files that include (directly or indirectly) <WspiApi.h>
 
index f5ba48623a146145a17665c82cd1645d66de588c..36a5452fd820c84c17468ddbff975a2780ed64d1 100755 (executable)
@@ -1,25 +1,28 @@
-/* -*- Mode: C; tab-width: 4 -*-
- *
+/*
  * Copyright (c) 2003-2004 Apple Computer, Inc. All rights reserved.
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * @APPLE_LICENSE_HEADER_START@
  * 
- *     http://www.apache.org/licenses/LICENSE-2.0
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
  * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
  * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
 
     Change History (most recent first):
 
 $Log: dnssd_NET.cpp,v $
-Revision 1.10  2006/08/14 23:25:43  cheshire
-Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
-
 Revision 1.9  2004/09/16 18:17:13  shersche
 Use background threads, cleanup to parameter names.
 Submitted by: prepin@gmail.com
index 999e6898af3b620b0a18a55baee92498f19e5e59..6faeb3dcdfdc4fd6563dece9cdb2716712935250 100755 (executable)
@@ -1,18 +1,24 @@
-/* -*- Mode: C; tab-width: 4 -*-
- *
+/*
  * Copyright (c) 2003-2004 Apple Computer, Inc. All rights reserved.
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * @APPLE_LICENSE_HEADER_START@
  * 
- *     http://www.apache.org/licenses/LICENSE-2.0
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
  * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
  * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
 
  * 
  * NOTE:
@@ -34,9 +40,6 @@
     Change History (most recent first):
 
 $Log: dnssd_NET.h,v $
-Revision 1.9  2006/08/14 23:25:43  cheshire
-Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
-
 Revision 1.8  2005/02/10 22:35:33  cheshire
 <rdar://problem/3727944> Update name
 
index 0e3ea786a4cfcb353261343c1dc019a8bb232f77..6dd9e97f7cd3def5481a060165f972fda098a3dc 100644 (file)
@@ -1,25 +1,28 @@
-/* -*- Mode: C; tab-width: 4 -*-
- *
+/*
  * Copyright (c) 2004 Apple Computer, Inc. All rights reserved.
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * @APPLE_LICENSE_HEADER_START@
  * 
- *     http://www.apache.org/licenses/LICENSE-2.0
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
  * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
  * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
 
     Change History (most recent first):
     
 $Log: dllmain.c,v $
-Revision 1.4  2006/08/14 23:25:41  cheshire
-Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
-
 Revision 1.3  2005/07/07 19:18:29  shersche
 Fix error in previous checkin, change SystemServiceIsDisabled() to IsSystemServiceDisabled()
 
index 52ba5b3a94f1e0ff2cf7934ae98640dcd9b1b321..624904634ef993868bef82e493b3b0b5d5760345 100644 (file)
@@ -1,25 +1,28 @@
-; -*- tab-width: 4 -*-
 ;
 ; Copyright (c) 2003-2004 Apple Computer, Inc. All rights reserved.
 ;
-; Licensed under the Apache License, Version 2.0 (the "License");
-; you may not use this file except in compliance with the License.
-; You may obtain a copy of the License at
+; @APPLE_LICENSE_HEADER_START@
 ; 
-;     http://www.apache.org/licenses/LICENSE-2.0
+; This file contains Original Code and/or Modifications of Original Code
+; as defined in and that are subject to the Apple Public Source License
+; Version 2.0 (the 'License'). You may not use this file except in
+; compliance with the License. Please obtain a copy of the License at
+; http://www.opensource.apple.com/apsl/ and read it before using this
+; file.
 ; 
-; Unless required by applicable law or agreed to in writing, software
-; distributed under the License is distributed on an "AS IS" BASIS,
-; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-; See the License for the specific language governing permissions and
+; The Original Code and all software distributed under the License are
+; distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+; EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+; INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+; FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+; Please see the License for the specific language governing rights and
 ; limitations under the License.
+; 
+; @APPLE_LICENSE_HEADER_END@
 ;
 ;      Change History (most recent first):
 ;    
 ; $Log: dnssd.def,v $
-; Revision 1.3  2006/08/14 23:25:41  cheshire
-; Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
-;
 ; Revision 1.2  2004/07/19 07:43:59  shersche
 ; export TXTRecord APIs
 ;
index 82e9c9e20a57199ee6a6a7cdc48b62f1bc83774d..ce71791318819b8355cc0b5d44586d360c68ed07 100644 (file)
@@ -1,25 +1,28 @@
-/* -*- Mode: C; tab-width: 4 -*-
- *
+/*
  * Copyright (c) 2002-2004 Apple Computer, Inc. All rights reserved.
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * @APPLE_LICENSE_HEADER_START@
  * 
- *     http://www.apache.org/licenses/LICENSE-2.0
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
  * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
  * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
 
     Change History (most recent first):
 
 $Log: Application.rc2,v $
-Revision 1.3  2006/08/14 23:25:48  cheshire
-Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
-
 Revision 1.2  2004/07/13 21:24:26  rpantos
 Fix for <rdar://problem/3701120>.
 
index 641349dda8ed8ea4b68625129914135d1e1e14ff..5984f335e56b1a1106de421fa84b25a3caf2c696 100644 (file)
@@ -1,25 +1,28 @@
-/* -*- Mode: C; tab-width: 4 -*-
- *
+/*
  * Copyright (c) 2002-2004 Apple Computer, Inc. All rights reserved.
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * @APPLE_LICENSE_HEADER_START@
  * 
- *     http://www.apache.org/licenses/LICENSE-2.0
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
  * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
  * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
 
     Change History (most recent first):
     
 $Log: AboutDialog.cpp,v $
-Revision 1.3  2006/08/14 23:25:49  cheshire
-Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
-
 Revision 1.2  2004/07/13 21:24:26  rpantos
 Fix for <rdar://problem/3701120>.
 
index 98f4103349c29a9b21a8c3857e24fef7bee728a4..82634323d9fb392c1be7097377667a17606340bc 100644 (file)
@@ -1,25 +1,28 @@
-/* -*- Mode: C; tab-width: 4 -*-
- *
+/*
  * Copyright (c) 2002-2004 Apple Computer, Inc. All rights reserved.
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * @APPLE_LICENSE_HEADER_START@
  * 
- *     http://www.apache.org/licenses/LICENSE-2.0
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
  * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
  * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
 
     Change History (most recent first):
     
 $Log: AboutDialog.h,v $
-Revision 1.3  2006/08/14 23:25:49  cheshire
-Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
-
 Revision 1.2  2004/07/13 21:24:26  rpantos
 Fix for <rdar://problem/3701120>.
 
index b3a377e404a35c78b0e1383d282b3e02915b62ff..8d1dcfdf4f0d7c6fb6f7a8eb46f663e75dc9c163 100644 (file)
@@ -1,25 +1,28 @@
-/* -*- Mode: C; tab-width: 4 -*-
- *
+/*
  * Copyright (c) 2002-2004 Apple Computer, Inc. All rights reserved.
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * @APPLE_LICENSE_HEADER_START@
  * 
- *     http://www.apache.org/licenses/LICENSE-2.0
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
  * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
  * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
 
     Change History (most recent first):
     
 $Log: Application.cpp,v $
-Revision 1.3  2006/08/14 23:25:49  cheshire
-Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
-
 Revision 1.2  2004/07/13 21:24:26  rpantos
 Fix for <rdar://problem/3701120>.
 
index b21deda5ff8ccf34a744946d246e591eb9d3b94b..498dd07559e53fc00c79cdac903bf30be4af0df5 100644 (file)
@@ -1,25 +1,28 @@
-/* -*- Mode: C; tab-width: 4 -*-
- *
+/*
  * Copyright (c) 2002-2004 Apple Computer, Inc. All rights reserved.
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * @APPLE_LICENSE_HEADER_START@
  * 
- *     http://www.apache.org/licenses/LICENSE-2.0
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
  * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
  * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
 
     Change History (most recent first):
     
 $Log: Application.h,v $
-Revision 1.3  2006/08/14 23:25:49  cheshire
-Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
-
 Revision 1.2  2004/07/13 21:24:26  rpantos
 Fix for <rdar://problem/3701120>.
 
index f917ce8a062d1f97056e8216f6b27d1de9cbc430..ab5f1002e571c171fc5e0985f2a6fa63f5206f1a 100644 (file)
@@ -1,25 +1,28 @@
-/* -*- Mode: C; tab-width: 4 -*-
- *
+/*
  * Copyright (c) 2002-2004 Apple Computer, Inc. All rights reserved.
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * @APPLE_LICENSE_HEADER_START@
  * 
- *     http://www.apache.org/licenses/LICENSE-2.0
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
  * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
  * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
 
     Change History (most recent first):
     
 $Log: ChooserDialog.cpp,v $
-Revision 1.4  2006/08/14 23:25:49  cheshire
-Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
-
 Revision 1.3  2005/02/10 22:35:35  cheshire
 <rdar://problem/3727944> Update name
 
index 833661009ccefccb808e3af3e270005848670493..8bda96cda02df1f4749d0b8aeb8e6e647ee873d6 100644 (file)
@@ -1,25 +1,28 @@
-/* -*- Mode: C; tab-width: 4 -*-
- *
+/*
  * Copyright (c) 2002-2004 Apple Computer, Inc. All rights reserved.
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * @APPLE_LICENSE_HEADER_START@
  * 
- *     http://www.apache.org/licenses/LICENSE-2.0
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
  * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
  * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
 
     Change History (most recent first):
     
 $Log: ChooserDialog.h,v $
-Revision 1.3  2006/08/14 23:25:49  cheshire
-Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
-
 Revision 1.2  2004/07/13 21:24:26  rpantos
 Fix for <rdar://problem/3701120>.
 
index b4209d08614cf0e00221f1193c2dce499dfea7fa..c3869e7f1fbed1b1a9d45e7ecc19dd16ddf6d3c9 100644 (file)
@@ -1,25 +1,28 @@
-/* -*- Mode: C; tab-width: 4 -*-
- *
+/*
  * Copyright (c) 2003-2004 Apple Computer, Inc. All rights reserved.
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * @APPLE_LICENSE_HEADER_START@
  * 
- *     http://www.apache.org/licenses/LICENSE-2.0
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
  * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
  * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
 
     Change History (most recent first):
     
 $Log: LoginDialog.cpp,v $
-Revision 1.2  2006/08/14 23:25:49  cheshire
-Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
-
 Revision 1.1  2004/06/18 04:04:36  rpantos
 Move up one level
 
index 4149fc8bfd8fee9455f542f7dba14388b94c487f..caf641a578f6b6f43d58a079ae8eb7ed45fc7505 100644 (file)
@@ -1,25 +1,28 @@
-/* -*- Mode: C; tab-width: 4 -*-
- *
+/*
  * Copyright (c) 2003-2004 Apple Computer, Inc. All rights reserved.
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * @APPLE_LICENSE_HEADER_START@
  * 
- *     http://www.apache.org/licenses/LICENSE-2.0
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
  * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
  * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
 
     Change History (most recent first):
     
 $Log: LoginDialog.h,v $
-Revision 1.2  2006/08/14 23:25:49  cheshire
-Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
-
 Revision 1.1  2004/06/18 04:04:36  rpantos
 Move up one level
 
index 7c4030536c6870715daba62f78990fe7b7bb117c..1ccc754dd894f11fb0c2153f69fc9072bae01bbc 100644 (file)
@@ -1,25 +1,28 @@
-/* -*- Mode: C; tab-width: 4 -*-
- *
+/*
  * Copyright (c) 2002-2004 Apple Computer, Inc. All rights reserved.
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * @APPLE_LICENSE_HEADER_START@
  * 
- *     http://www.apache.org/licenses/LICENSE-2.0
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
  * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
  * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
 
     Change History (most recent first):
     
 $Log: StdAfx.cpp,v $
-Revision 1.3  2006/08/14 23:25:49  cheshire
-Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
-
 Revision 1.2  2004/07/13 21:24:26  rpantos
 Fix for <rdar://problem/3701120>.
 
index 958c12e53fa97438c2dda293c5d285155cb6416a..cb8031ecb0995fb23235efc9cbe8d75997c708d7 100644 (file)
@@ -1,25 +1,28 @@
-/* -*- Mode: C; tab-width: 4 -*-
- *
+/*
  * Copyright (c) 2002-2004 Apple Computer, Inc. All rights reserved.
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * @APPLE_LICENSE_HEADER_START@
  * 
- *     http://www.apache.org/licenses/LICENSE-2.0
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
  * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
  * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
 
     Change History (most recent first):
     
 $Log: StdAfx.h,v $
-Revision 1.3  2006/08/14 23:25:49  cheshire
-Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
-
 Revision 1.2  2004/07/13 21:24:26  rpantos
 Fix for <rdar://problem/3701120>.
 
index 257197622e3b569014385d275e85da3332a84dd9..39bb5294ca8045909ef1f8f3079821674ec5daa7 100644 (file)
@@ -1,25 +1,28 @@
-/* -*- Mode: C; tab-width: 4 -*-
- *
+/*
  * Copyright (c) 2002-2004 Apple Computer, Inc. All rights reserved.
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * @APPLE_LICENSE_HEADER_START@
  * 
- *     http://www.apache.org/licenses/LICENSE-2.0
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
  * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
  * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
 
     Change History (most recent first):
     
 $Log: Application.cpp,v $
-Revision 1.3  2006/08/14 23:25:55  cheshire
-Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
-
 Revision 1.2  2004/07/13 21:24:27  rpantos
 Fix for <rdar://problem/3701120>.
 
index 76e80983ed3a536a01fbba68594848885380745a..08409b154478900af7c9b5a4de1fd8f120c69c8f 100644 (file)
@@ -1,25 +1,28 @@
-/* -*- Mode: C; tab-width: 4 -*-
- *
+/*
  * Copyright (c) 2002-2004 Apple Computer, Inc. All rights reserved.
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * @APPLE_LICENSE_HEADER_START@
  * 
- *     http://www.apache.org/licenses/LICENSE-2.0
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
  * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
  * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
 
     Change History (most recent first):
     
 $Log: Application.h,v $
-Revision 1.3  2006/08/14 23:25:55  cheshire
-Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
-
 Revision 1.2  2004/07/13 21:24:27  rpantos
 Fix for <rdar://problem/3701120>.
 
index 01fa3a003342fba98e69ce161276dc733438c81d..2bdd05b38f48b0d3f4cf4d98bcb1dede254c346d 100644 (file)
@@ -1,25 +1,28 @@
-/* -*- Mode: C; tab-width: 4 -*-
- *
+/*
  * Copyright (c) 2002-2004 Apple Computer, Inc. All rights reserved.
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * @APPLE_LICENSE_HEADER_START@
  * 
- *     http://www.apache.org/licenses/LICENSE-2.0
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
  * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
  * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
 
     Change History (most recent first):
     
 $Log: BrowserDialog.cpp,v $
-Revision 1.3  2006/08/14 23:25:55  cheshire
-Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
-
 Revision 1.2  2004/07/13 21:24:27  rpantos
 Fix for <rdar://problem/3701120>.
 
index 206ca91f315e2a2e2a33a41707c494850a3bdfb2..e0a77239331c93dc0c8dc0ee92d7b9472f71b63a 100644 (file)
@@ -1,25 +1,28 @@
-/* -*- Mode: C; tab-width: 4 -*-
- *
+/*
  * Copyright (c) 2002-2004 Apple Computer, Inc. All rights reserved.
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * @APPLE_LICENSE_HEADER_START@
  * 
- *     http://www.apache.org/licenses/LICENSE-2.0
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
  * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
  * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
 
     Change History (most recent first):
     
 $Log: BrowserDialog.h,v $
-Revision 1.3  2006/08/14 23:25:55  cheshire
-Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
-
 Revision 1.2  2004/07/13 21:24:27  rpantos
 Fix for <rdar://problem/3701120>.
 
index dbbcc18800968f9022982a35d3e4ef3df99858b6..919256eed57e8ffc6b618404df4fd145e17451c8 100644 (file)
@@ -1,25 +1,28 @@
-/* -*- Mode: C; tab-width: 4 -*-
- *
+/*
  * Copyright (c) 2002-2004 Apple Computer, Inc. All rights reserved.
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * @APPLE_LICENSE_HEADER_START@
  * 
- *     http://www.apache.org/licenses/LICENSE-2.0
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
  * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
  * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
 
     Change History (most recent first):
     
 $Log: StdAfx.cpp,v $
-Revision 1.3  2006/08/14 23:25:55  cheshire
-Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
-
 Revision 1.2  2004/07/13 21:24:27  rpantos
 Fix for <rdar://problem/3701120>.
 
index 4cdcef7bbbe769ca7d3f50dfd20d986a35a89c1c..f598c267b754b4d38d98f0e8a8c41d0193b20f1f 100644 (file)
@@ -1,25 +1,28 @@
-/* -*- Mode: C; tab-width: 4 -*-
- *
+/*
  * Copyright (c) 2002-2004 Apple Computer, Inc. All rights reserved.
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * @APPLE_LICENSE_HEADER_START@
  * 
- *     http://www.apache.org/licenses/LICENSE-2.0
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
  * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
  * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
 
     Change History (most recent first):
     
 $Log: StdAfx.h,v $
-Revision 1.3  2006/08/14 23:25:55  cheshire
-Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
-
 Revision 1.2  2004/07/13 21:24:27  rpantos
 Fix for <rdar://problem/3701120>.
 
index 015690f5214d4155fa437097b8d60bb4bc229f0a..258363eb1221d9ba0d81e4ded7b52ae8cb4c618f 100644 (file)
@@ -1,25 +1,28 @@
-/* -*- Mode: C; tab-width: 4 -*-
- *
+/*
  * Copyright (c) 2002-2004 Apple Computer, Inc. All rights reserved.
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * @APPLE_LICENSE_HEADER_START@
  * 
- *     http://www.apache.org/licenses/LICENSE-2.0
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
  * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
  * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
 
     Change History (most recent first):
        
 $Log: Tool.c,v $
-Revision 1.4  2006/08/14 23:25:59  cheshire
-Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
-
 Revision 1.3  2004/09/16 01:58:25  cheshire
 Fix compiler warnings
 
index 9d6829a6a97a3268955a53864c3c979a1610170d..64697489e3d5a99428991fe0cbe0bbadfc562771 100644 (file)
@@ -1,25 +1,28 @@
-/* -*- Mode: C; tab-width: 4 -*-
- *
+/*
  * Copyright (c) 2002-2004 Apple Computer, Inc. All rights reserved.
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * @APPLE_LICENSE_HEADER_START@
  * 
- *     http://www.apache.org/licenses/LICENSE-2.0
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
  * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
  * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
 
     Change History (most recent first):
 
 $Log: ToolPrefixWindows.h,v $
-Revision 1.2  2006/08/14 23:25:59  cheshire
-Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
-
 Revision 1.1  2004/06/18 04:07:54  rpantos
 Move up one level
 
index 85015ed7b778c7a00395f48ea010aaafe67d09cb..7b73d2e837521ac1bb7c3174f75d74b60da2f07c 100644 (file)
@@ -1,25 +1,28 @@
-/* -*- Mode: C; tab-width: 4 -*-
- *
+/*
  * Copyright (c) 2002-2004 Apple Computer, Inc. All rights reserved.
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * @APPLE_LICENSE_HEADER_START@
  * 
- *     http://www.apache.org/licenses/LICENSE-2.0
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
  * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
  * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
 
     Change History (most recent first):
     
 $Log: ToolPrefixWindowsDebug.h,v $
-Revision 1.2  2006/08/14 23:25:59  cheshire
-Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
-
 Revision 1.1  2004/06/18 04:07:54  rpantos
 Move up one level
 
index 7a7f99f8751cf82347c660e3c3f0cc8fd051d500..94e2d0218138ebc8e894eb2c474684bd99bb82bc 100644 (file)
@@ -1,25 +1,28 @@
-/* -*- Mode: C; tab-width: 4 -*-
- *
+/*
  * Copyright (c) 2002-2004 Apple Computer, Inc. All rights reserved.
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * @APPLE_LICENSE_HEADER_START@
  * 
- *     http://www.apache.org/licenses/LICENSE-2.0
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
  * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
  * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
 
     Change History (most recent first):
 
 $Log: DNSServiceDiscovery.c,v $
-Revision 1.9  2006/08/14 23:26:01  cheshire
-Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
-
 Revision 1.8  2004/09/17 01:08:58  cheshire
 Renamed mDNSClientAPI.h to mDNSEmbeddedAPI.h
   The name "mDNSClientAPI.h" is misleading to new developers looking at this code. The interfaces
index 460bb13d327d9abce7d62ef7dfe11d0cd0bcb870..084b0b811d1b1137ffc484b3cc434eb12a161d03 100644 (file)
@@ -1,25 +1,28 @@
-/* -*- Mode: C; tab-width: 4 -*-
- *
+/*
  * Copyright (c) 2002-2004 Apple Computer, Inc. All rights reserved.
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * @APPLE_LICENSE_HEADER_START@
  * 
- *     http://www.apache.org/licenses/LICENSE-2.0
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
  * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
  * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
 
     Change History (most recent first):
 
 $Log: DNSServiceDiscovery.h,v $
-Revision 1.5  2006/08/14 23:26:01  cheshire
-Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
-
 Revision 1.4  2004/05/06 18:42:58  ksekar
 General dns_sd.h API cleanup, including the following radars:
 <rdar://problem/3592068>: Remove flags with zero value
index e5d6d0d08e0dd9e3c40fcc03799386729572d135..c32ebb01d3acdd25b1637c379ae162db01017619 100755 (executable)
@@ -1,25 +1,28 @@
-/* -*- Mode: C; tab-width: 4 -*-
- *
+/*
  * Copyright (c) 2002-2004 Apple Computer, Inc. All rights reserved.
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * @APPLE_LICENSE_HEADER_START@
  * 
- *     http://www.apache.org/licenses/LICENSE-2.0
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
  * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
  * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
 
     Change History (most recent first):
     
 $Log: DNSServices.c,v $
-Revision 1.33  2006/08/14 23:26:01  cheshire
-Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
-
 Revision 1.32  2004/12/16 20:13:02  cheshire
 <rdar://problem/3324626> Cache memory management improvements
 
index 3e4c005fba22158e136c4a2ab9e75bb53f9605b0..8e16a8c3c6300bb8967435a74d6fddf35004188c 100755 (executable)
@@ -1,25 +1,28 @@
-/* -*- Mode: C; tab-width: 4 -*-
- *
+/*
  * Copyright (c) 2002-2004 Apple Computer, Inc. All rights reserved.
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * @APPLE_LICENSE_HEADER_START@
  * 
- *     http://www.apache.org/licenses/LICENSE-2.0
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
  * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
  * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
 
     Change History (most recent first):
     
 $Log: DNSServices.h,v $
-Revision 1.12  2006/08/14 23:26:01  cheshire
-Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
-
 Revision 1.11  2004/07/13 21:24:28  rpantos
 Fix for <rdar://problem/3701120>.
 
index ffbb1f69230eb3b665b7ab42f23846b3ffa29fe4..7562c2e741615329bf6de158f0598488fa06e12b 100644 (file)
@@ -1,25 +1,28 @@
-/* -*- Mode: C; tab-width: 4 -*-
- *
+/*
  * Copyright (c) 1997-2004 Apple Computer, Inc. All rights reserved.
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * @APPLE_LICENSE_HEADER_START@
  * 
- *     http://www.apache.org/licenses/LICENSE-2.0
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
  * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
  * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
 
     Change History (most recent first):
     
 $Log: DebugServices.c,v $
-Revision 1.5.2.1  2006/08/29 06:24:39  cheshire
-Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
-
 Revision 1.5  2004/09/17 01:08:57  cheshire
 Renamed mDNSClientAPI.h to mDNSEmbeddedAPI.h
   The name "mDNSClientAPI.h" is misleading to new developers looking at this code. The interfaces
index ee2c1af57defd175aed48a56a5575e8b15d7da39..e6874067f97b381e37b455e06a360e42a3323164 100644 (file)
@@ -1,25 +1,28 @@
-/* -*- Mode: C; tab-width: 4 -*-
- *
+/*
  * Copyright (c) 1997-2004 Apple Computer, Inc. All rights reserved.
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * @APPLE_LICENSE_HEADER_START@
  * 
- *     http://www.apache.org/licenses/LICENSE-2.0
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
  * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
  * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
 
     Change History (most recent first):
     
 $Log: DebugServices.h,v $
-Revision 1.4.4.1  2006/08/29 06:24:39  cheshire
-Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
-
 Revision 1.4  2004/04/15 08:59:08  bradley
 Removed deprecated debug and log levels and replaced them with modern equivalents.
 
index c47a9c4b8a039aa6d5467ac4af76eeeefb0da585..42511a31c47ed841cf3320727cc766e72200bdaa 100644 (file)
@@ -1,25 +1,28 @@
-/* -*- Mode: C; tab-width: 4 -*-
- *
+/*
  * Copyright (c) 2004 Apple Computer, Inc. All rights reserved.
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * @APPLE_LICENSE_HEADER_START@
  * 
- *     http://www.apache.org/licenses/LICENSE-2.0
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
  * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
  * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
 
     Change History (most recent first):
 
 $Log: jdns_sd.rc,v $
-Revision 1.4  2006/08/14 23:26:04  cheshire
-Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
-
 Revision 1.3  2004/10/19 03:41:42  shersche
 <rdar://problem/3843396> Include "afxres.h" to resource script so it gets compiled correctly
 Bug #: 3843396
index 99a79877d696c18a97240ef989e58fc6bd37c45c..8a115ee238c5812a6ac824500c5cee12231b505a 100644 (file)
@@ -1,26 +1,25 @@
-# -*- tab-width: 4 -*-
-#
 # Copyright (c) 2002-2004 Apple Computer, Inc. All rights reserved.
 #
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
+# @APPLE_LICENSE_HEADER_START@
 # 
-#     http://www.apache.org/licenses/LICENSE-2.0
+# This file contains Original Code and/or Modifications of Original Code
+# as defined in and that are subject to the Apple Public Source License
+# Version 2.0 (the 'License'). You may not use this file except in
+# compliance with the License. Please obtain a copy of the License at
+# http://www.opensource.apple.com/apsl/ and read it before using this
+# file.
 # 
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
+# The Original Code and all software distributed under the License are
+# distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+# EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+# INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+# Please see the License for the specific language governing rights and
 # limitations under the License.
+# 
+# @APPLE_LICENSE_HEADER_END@
 #
 # $Log: makefile,v $
-# Revision 1.9  2006/08/14 23:26:04  cheshire
-# Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
-#
-# Revision 1.8  2006/07/05 20:57:22  cheshire
-# <rdar://problem/3839132> Java needs to implement DNSServiceRegisterRecord equivalent
-#
 # Revision 1.7  2005/10/19 17:19:56  herscher
 # Change JDK to use JAVA_HOME environment variable
 #
@@ -143,8 +142,6 @@ JARCONTENTS =       $(OBJDIR)\com\apple\dnssd\DNSSDService.class \
                                $(OBJDIR)\com\apple\dnssd\RegisterListener.class \
                                $(OBJDIR)\com\apple\dnssd\QueryListener.class \
                                $(OBJDIR)\com\apple\dnssd\DomainListener.class \
-                               $(OBJDIR)\com\apple\dnssd\DNSSDRecordRegistrar.class \
-                               $(OBJDIR)\com\apple\dnssd\RegisterRecordListener.class \
                                $(OBJDIR)\com\apple\dnssd\DNSSD.class
 
 $(BUILDDIR)\dns_sd.jar: $(JARCONTENTS)
index 63a7df1d795dd91ca9b634aa227519fae73ae6cb..364865596e1bc2c0ed9f502693c69da4288bdab3 100644 (file)
@@ -1,25 +1,28 @@
-/* -*- Mode: C; tab-width: 4 -*-
- *
+/*
  * Copyright (c) 2003-2004 Apple Computer, Inc. All rights reserved.
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * @APPLE_LICENSE_HEADER_START@
  * 
- *     http://www.apache.org/licenses/LICENSE-2.0
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
  * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
  * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
 
     Change History (most recent first):
        
 $Log: NSPTool.c,v $
-Revision 1.4  2006/08/14 23:26:06  cheshire
-Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
-
 Revision 1.3  2004/08/26 04:46:49  shersche
 Add -q switch for silent operation
 
index 4ae504fda5e0dd91468a39cf0036d807228b236f..af06d929e83c58a2ebd2b9846e6b7146f02b80a5 100644 (file)
@@ -1,25 +1,28 @@
-/* -*- Mode: C; tab-width: 4 -*-
- *
+/*
  * Copyright (c) 2003-2004 Apple Computer, Inc. All rights reserved.
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * @APPLE_LICENSE_HEADER_START@
  * 
- *     http://www.apache.org/licenses/LICENSE-2.0
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
  * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
  * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
 
     Change History (most recent first):
 
 $Log: Prefix.h,v $
-Revision 1.2  2006/08/14 23:26:06  cheshire
-Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
-
 Revision 1.1  2004/06/18 04:14:26  rpantos
 Move up one level.
 
index c86b7ec2175d9abef046147405de312292933715..dc94ba9a2f26974e671af40c2a386b1a3d896c91 100644 (file)
@@ -1,25 +1,28 @@
-/* -*- Mode: C; tab-width: 4 -*-
- *
+/*
  * Copyright (c) 2002-2004 Apple Computer, Inc. All rights reserved.
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * @APPLE_LICENSE_HEADER_START@
  * 
- *     http://www.apache.org/licenses/LICENSE-2.0
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
  * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
  * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
 
     Change History (most recent first):
     
 $Log: RegNames.h,v $
-Revision 1.3  2006/08/14 23:25:20  cheshire
-Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
-
 Revision 1.2  2005/10/05 18:05:28  herscher
 <rdar://problem/4192011> Save Wide-Area preferences in a different spot in the registry so they don't get removed when doing an update install.
 
index 79019daceff5b1abd1b5a80c22bf65abe8191941..ba235c8ebe861da768f476f7fc0491801b9edca8 100755 (executable)
@@ -1,25 +1,28 @@
-/* -*- Mode: C; tab-width: 4 -*-
- *
+/*
  * Copyright (c) 2003-2004 Apple Computer, Inc. All rights reserved.
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * @APPLE_LICENSE_HEADER_START@
  * 
- *     http://www.apache.org/licenses/LICENSE-2.0
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
  * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
  * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
 
     Change History (most recent first):
     
 $Log: Firewall.cpp,v $
-Revision 1.4  2006/08/14 23:26:07  cheshire
-Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
-
 Revision 1.3  2005/09/29 06:33:54  herscher
 <rdar://problem/4278931> Fix compilation error when using latest Microsoft Platform SDK.
 
index e84a93044affd62722a81c7198c9ef0e707e6cdf..ac2dfad870dc7b2c4deb66d820982ba70ea853cc 100755 (executable)
@@ -1,88 +1,59 @@
-/* -*- Mode: C; tab-width: 4 -*-
- *
+/*
  * Copyright (c) 2003-2004 Apple Computer, Inc. All rights reserved.
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * @APPLE_LICENSE_HEADER_START@
  * 
- *     http://www.apache.org/licenses/LICENSE-2.0
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
  * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
  * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
 
     Change History (most recent first):
     
 $Log: Firewall.h,v $
-Revision 1.2  2006/08/14 23:26:07  cheshire
-Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
-
 Revision 1.1  2004/09/13 07:32:31  shersche
 Wrapper for Windows Firewall API code
-
-
-
-
-*/
-
-
-
-#ifndef _Firewall_h
-
-#define _Firewall_h
-
-
-
-
-
-#include "CommonServices.h"
-
-#include "DebugServices.h"
-
-
-
-
-
-#if defined(__cplusplus)
-
-extern "C"
-
-{
-
-#endif
-
-
-
-
-
-OSStatus
-
-mDNSAddToFirewall
-
-               (
-
-               LPWSTR  executable,
-
-               LPWSTR  name
-
-               );
-
-
-
-
-
-#if defined(__cplusplus)
-
-}
-
-#endif
-
-
-
-
-
-#endif
-
+\r
+\r
+*/\r
+\r
+#ifndef _Firewall_h\r
+#define _Firewall_h\r
+\r
+\r
+#include "CommonServices.h"\r
+#include "DebugServices.h"\r
+\r
+\r
+#if defined(__cplusplus)\r
+extern "C"\r
+{\r
+#endif\r
+\r
+\r
+OSStatus\r
+mDNSAddToFirewall\r
+               (\r
+               LPWSTR  executable,\r
+               LPWSTR  name\r
+               );\r
+\r
+\r
+#if defined(__cplusplus)\r
+}\r
+#endif\r
+\r
+\r
+#endif\r
index a64b0e419a3bd5de647e207b85a85390c6f8ffd0..150aa3bb73506001da002c3ae039bf28b934539f 100644 (file)
@@ -1,25 +1,28 @@
-/* -*- Mode: C; tab-width: 4 -*-
- *
+/*
  * Copyright (c) 2003-2004 Apple Computer, Inc. All rights reserved.
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * @APPLE_LICENSE_HEADER_START@
  * 
- *     http://www.apache.org/licenses/LICENSE-2.0
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
  * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
  * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
 
     Change History (most recent first):
     
 $Log: Prefix.h,v $
-Revision 1.2  2006/08/14 23:26:07  cheshire
-Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
-
 Revision 1.1  2004/06/18 04:16:41  rpantos
 Move up one level.
 
index c14288fbe61643a367727f596cb6dce96fad6e19..f85b176e6438a46882d767c1550bf3fe31144851 100644 (file)
@@ -1,25 +1,28 @@
-/* -*- Mode: C; tab-width: 4 -*-
- *
+/*
  * Copyright (c) 2003-2004 Apple Computer, Inc. All rights reserved.
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * @APPLE_LICENSE_HEADER_START@
  * 
- *     http://www.apache.org/licenses/LICENSE-2.0
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
  * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
  * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
 
     Change History (most recent first):
     
 $Log: Service.c,v $
-Revision 1.39  2006/08/14 23:26:07  cheshire
-Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
-
 Revision 1.38  2005/10/05 20:55:15  herscher
 <rdar://problem/4096464> Don't call SetLLRoute on loopback interface
 
@@ -27,7 +30,7 @@ Revision 1.37  2005/10/05 18:05:28  herscher
 <rdar://problem/4192011> Save Wide-Area preferences in a different spot in the registry so they don't get removed when doing an update install.
 
 Revision 1.36  2005/09/11 22:12:42  herscher
-<rdar://problem/4247793> Remove dependency on WMI.  Ensure that the Windows firewall is turned on before trying to configure it.
+<rdar://4247793> Remove dependency on WMI.  Ensure that the Windows firewall is turned on before trying to configure it.
 
 Revision 1.35  2005/06/30 18:29:49  shersche
 <rdar://problem/4090059> Don't overwrite the localized service description text
index c0f4d01c4fdc0d600169f7ed280287f8a9063c5d..a5723063e5ff21d70bcf6b1445b6f671390af896 100755 (executable)
@@ -1,28 +1,28 @@
-/* -*- Mode: C; tab-width: 4 -*-
- *
+/*
  * Copyright (c) 2002-2004 Apple Computer, Inc. All rights reserved.
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * @APPLE_LICENSE_HEADER_START@
  * 
- *     http://www.apache.org/licenses/LICENSE-2.0
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
  * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
  * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
 
     Change History (most recent first):
     
 $Log: VPCDetect.cpp,v $
-Revision 1.3  2006/08/14 23:25:20  cheshire
-Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
-
-Revision 1.2  2006/02/26 19:31:05  herscher
-<rdar://problem/4455038> Bonjour For Windows takes 90 seconds to start. This was caused by a bad interaction between the VirtualPC check, and the removal of the WMI dependency.  The problem was fixed by: 1) checking to see if WMI is running before trying to talk to it.  2) Retrying the VirtualPC check every 10 seconds upon failure, stopping after 10 unsuccessful tries.
-
 Revision 1.1  2005/11/27 20:21:16  herscher
 <rdar://problem/4210580> Workaround Virtual PC bug that incorrectly modifies incoming mDNS packets
 
@@ -40,75 +40,55 @@ static BOOL g_doneCheck = FALSE;
 static BOOL g_isVPC            = FALSE;
 
 
-mStatus
-IsVPCRunning( BOOL * inVirtualPC )
+BOOL
+IsVPCRunning()
 {
        IWbemLocator                    *       pLoc            = 0;
        IWbemServices                   *       pSvc            = 0;
     IEnumWbemClassObject       *       pEnumerator = NULL;
        bool                                            coInit          = false;
        HRESULT                                         hres;
-       SC_HANDLE                                       scm                     = NULL;
-       SC_HANDLE                                       service         = NULL;
-       SERVICE_STATUS                          status;
-       mStatus                                         err;
-       BOOL                                            ok          = TRUE;
-
-       // Initialize flag
-
-       *inVirtualPC = FALSE;
-
-       // Find out if WMI is running
-
-       scm = OpenSCManager( 0, 0, SC_MANAGER_CONNECT );
-       err = translate_errno( scm, (OSStatus) GetLastError(), kOpenErr );
-       require_noerr( err, exit );
-
-       service = OpenService( scm, TEXT( "winmgmt" ), SERVICE_QUERY_STATUS );
-       err = translate_errno( service, (OSStatus) GetLastError(), kNotFoundErr );
-       require_noerr( err, exit );
-       
-       ok = QueryServiceStatus( service, &status );
-       err = translate_errno( ok, (OSStatus) GetLastError(), kAuthenticationErr );
-       require_noerr( err, exit );
-       require_action( status.dwCurrentState == SERVICE_RUNNING, exit, err = kUnknownErr );
-       
+
+       // Short circuit if we've already done this
+
+       require_action_quiet( !g_doneCheck, exit, g_doneCheck = TRUE );
+
     // Initialize COM.
 
        hres = CoInitializeEx(0, COINIT_MULTITHREADED);
-       require_action( SUCCEEDED( hres ), exit, err = kUnknownErr );
+       require_action( SUCCEEDED( hres ), exit, g_isVPC = false );
        coInit = true;
 
        // Initialize Security
 
        hres =  CoInitializeSecurity(NULL, -1, NULL, NULL, RPC_C_AUTHN_LEVEL_DEFAULT, RPC_C_IMP_LEVEL_IMPERSONATE, NULL, EOAC_NONE, NULL );
-       require_action( SUCCEEDED( hres ), exit, err = kUnknownErr );
+       require_action( SUCCEEDED( hres ), exit, g_isVPC = false );
 
                       
     // Obtain the initial locator to Windows Management on a particular host computer.
 
     hres = CoCreateInstance( CLSID_WbemLocator, 0, CLSCTX_INPROC_SERVER, IID_IWbemLocator, (LPVOID *) &pLoc );
-       require_action( SUCCEEDED( hres ), exit, err = kUnknownErr );
+       require_action( SUCCEEDED( hres ), exit, g_isVPC = false );
  
     // Connect to the root\cimv2 namespace with the
     // current user and obtain pointer pSvc
     // to make IWbemServices calls.
 
-       hres = pLoc->ConnectServer( _bstr_t(L"ROOT\\CIMV2"), NULL, NULL, 0, WBEM_FLAG_CONNECT_USE_MAX_WAIT, 0, 0, &pSvc );
-       require_action( SUCCEEDED( hres ), exit, err = kUnknownErr );
+       hres = pLoc->ConnectServer( _bstr_t(L"ROOT\\CIMV2"), NULL, NULL, 0, NULL, 0, 0, &pSvc );
+       require_action( SUCCEEDED( hres ), exit, g_isVPC = false );
     
     // Set the IWbemServices proxy so that impersonation
     // of the user (client) occurs.
 
        hres = CoSetProxyBlanket( pSvc, RPC_C_AUTHN_WINNT, RPC_C_AUTHZ_NONE, NULL, RPC_C_AUTHN_LEVEL_CALL, RPC_C_IMP_LEVEL_IMPERSONATE, NULL, EOAC_NONE );
-       require_action( SUCCEEDED( hres ), exit, err = kUnknownErr );
+       require_action( SUCCEEDED( hres ), exit, g_isVPC = false );
 
     // Use the IWbemServices pointer to make requests of WMI. 
     // Make requests here:
 
        hres = pSvc->ExecQuery( bstr_t("WQL"), bstr_t("SELECT * from Win32_BaseBoard"), WBEM_FLAG_FORWARD_ONLY | WBEM_FLAG_RETURN_IMMEDIATELY, NULL, &pEnumerator);
     
-       require_action( SUCCEEDED( hres ), exit, err = kUnknownErr );
+       require_action( SUCCEEDED( hres ), exit, g_isVPC = false );
 
        do
        {
@@ -134,7 +114,7 @@ IsVPCRunning( BOOL * inVirtualPC )
 
                                if (wcscmp( wstring, L"microsoft corporation" ) == 0 )
                                {
-                                       *inVirtualPC = TRUE;
+                                       g_isVPC = true;
                                }
                        }
                
@@ -159,20 +139,15 @@ exit:
        CoUninitialize();
        }
 
-       if ( service )
+       if ( !g_doneCheck )
        {
-               CloseServiceHandle( service );
-       }
-
-       if ( scm )
-       {
-               CloseServiceHandle( scm );
-       }
+               g_doneCheck = TRUE;
 
-       if ( *inVirtualPC )
-       {
-               dlog( kDebugLevelTrace, "Virtual PC detected" );
+               if ( g_isVPC )
+               {
+                       dlog( kDebugLevelTrace, "Virtual PC detected" );
+               }
        }
 
-       return err;
+       return g_isVPC;
 }
index 0b7ce19efb48c1ca8b0e268545aedac31d045fea..ed709acb626260cd40f2a527f66eb9a4b91fa966 100644 (file)
@@ -1,28 +1,28 @@
-/* -*- Mode: C; tab-width: 4 -*-
- *
+/*
  * Copyright (c) 2002-2004 Apple Computer, Inc. All rights reserved.
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * @APPLE_LICENSE_HEADER_START@
  * 
- *     http://www.apache.org/licenses/LICENSE-2.0
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
  * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
  * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
 
     Change History (most recent first):
     
 $Log: VPCDetect.h,v $
-Revision 1.3  2006/08/14 23:25:20  cheshire
-Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
-
-Revision 1.2  2006/02/26 19:31:05  herscher
-<rdar://problem/4455038> Bonjour For Windows takes 90 seconds to start. This was caused by a bad interaction between the VirtualPC check, and the removal of the WMI dependency.  The problem was fixed by: 1) checking to see if WMI is running before trying to talk to it.  2) Retrying the VirtualPC check every 10 seconds upon failure, stopping after 10 unsuccessful tries.
-
 Revision 1.1  2005/11/27 20:21:16  herscher
 <rdar://problem/4210580> Workaround Virtual PC bug that incorrectly modifies incoming mDNS packets
 
@@ -31,7 +31,6 @@ Revision 1.1  2005/11/27 20:21:16  herscher
 #pragma once
 
 #include <windows.h>
-#include <mDNSEmbeddedAPI.h>
 
 
 #if defined(__cplusplus)
@@ -40,8 +39,8 @@ extern "C"
 #endif
 
 
-extern mStatus
-IsVPCRunning( BOOL * inVirtualPC );
+extern BOOL
+IsVPCRunning();
 
 
 #if defined(__cplusplus)
index 654b07a5b074e8ad8f1081a7c137a950b657b30c..ca20ae00d53057d8c1f3cc732266e6bf5b5be646 100644 (file)
@@ -1,25 +1,28 @@
-/* -*- Mode: C; tab-width: 4 -*-
- *
+/*
  * Copyright (c) 1997-2004 Apple Computer, Inc. All rights reserved.
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * @APPLE_LICENSE_HEADER_START@
  * 
- *     http://www.apache.org/licenses/LICENSE-2.0
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
  * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
  * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
 
     Change History (most recent first):
     
 $Log: WinServices.cpp,v $
-Revision 1.2  2006/08/14 23:25:20  cheshire
-Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
-
 Revision 1.1  2004/06/18 05:23:33  rpantos
 First checked in
 
index 9d9db91d4bba5059893a66938eaaaf5dc6edd770..9700cd47311d60d8345782a5b41ce81d0681af50 100644 (file)
@@ -1,25 +1,28 @@
-/* -*- Mode: C; tab-width: 4 -*-
- *
+/*
  * Copyright (c) 1997-2004 Apple Computer, Inc. All rights reserved.
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * @APPLE_LICENSE_HEADER_START@
  * 
- *     http://www.apache.org/licenses/LICENSE-2.0
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
  * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
  * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
 
     Change History (most recent first):
     
 $Log: WinServices.h,v $
-Revision 1.2  2006/08/14 23:25:21  cheshire
-Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
-
 Revision 1.1  2004/06/18 05:23:33  rpantos
 First checked in
 
index 4bb081bdf5e4c65d6dc856f9acc303cdc95109fe..8256ddf7c38adecc54aad5a360702f03b8741a2f 100644 (file)
@@ -1,31 +1,28 @@
-/* -*- Mode: C; tab-width: 4 -*-
- *
+/*
  * Copyright (c) 2004 Apple Computer, Inc. All rights reserved.
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * @APPLE_LICENSE_HEADER_START@
  * 
- *     http://www.apache.org/licenses/LICENSE-2.0
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
  * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
  * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
 
     Change History (most recent first):
 
 $Log: WinVersRes.h,v $
-Revision 1.54  2006/08/14 23:25:21  cheshire
-Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
-
-Revision 1.53  2006/02/28 20:07:53  herscher
-Bump to 1.0.3.1
-
-Revision 1.52  2006/01/09 20:45:29  cheshire
-Update copyright date to 2006
-
 Revision 1.51  2005/11/28 19:49:56  herscher
 Bump to 1.0.2.9
 
@@ -187,12 +184,12 @@ First checked in.
 #define MASTER_PROD_NAME       "Bonjour"
 
 // Define the product version for mDNSResponder on Windows
-#define MASTER_PROD_VERS               1,0,3,1
-#define MASTER_PROD_VERS_STR   "1,0,3,1"
-#define MASTER_PROD_VERS_STR2  "1.0.3.1"
-#define MASTER_PROD_VERS_STR3 "Explorer Plugin 1.0.3.1"
+#define MASTER_PROD_VERS               1,0,2,9
+#define MASTER_PROD_VERS_STR   "1,0,2,9"
+#define MASTER_PROD_VERS_STR2  "1.0.2.9"
+#define MASTER_PROD_VERS_STR3 "Explorer Plugin 1.0.2.9"
 
 // Define the legal copyright
-#define MASTER_LEGAL_COPYRIGHT "Copyright (C) 2003-2006 Apple Computer, Inc."
+#define MASTER_LEGAL_COPYRIGHT "Copyright (C) 2003-2005 Apple Computer, Inc."
 
 #endif // WINRESVERS_H
index 0e24e0bc3311a02597b30b299b8df78cbebe546b..0435517fb7d74c53e807628942681f614a20f7b3 100755 (executable)
@@ -1,25 +1,28 @@
-/* -*- Mode: C; tab-width: 4 -*-
- *
+/*
  * Copyright (c) 2002-2004 Apple Computer, Inc. All rights reserved.
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * @APPLE_LICENSE_HEADER_START@
  * 
- *     http://www.apache.org/licenses/LICENSE-2.0
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
  * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
  * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
 
     Change History (most recent first):
 
 $Log: dDNS.c,v $
-Revision 1.8.2.1  2006/08/29 06:24:39  cheshire
-Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
-
 Revision 1.8  2005/09/12 07:13:33  herscher
 <rdar://problem/4248878> Workaround for router crash.  Lazily call RegisterSearchDomains rather than call it always at startup.
 
index f3e6c887c740dcaefe9ee0e513b89dc1547ab696..12c56da3930761ca9d9cdb509ab5d36a124b2e9b 100755 (executable)
@@ -1,18 +1,24 @@
-/* -*- Mode: C; tab-width: 4 -*-
- *
+/*
  * Copyright (c) 2002-2004 Apple Computer, Inc. All rights reserved.
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * @APPLE_LICENSE_HEADER_START@
  * 
- *     http://www.apache.org/licenses/LICENSE-2.0
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
  * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
  * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
 
     Change History (most recent first):
 
 #pragma mark - DynDNS structures
 #endif
 
+#if WIN32
+// named type definition in parentheses \r
+#      pragma warning( disable: 4115 ) \r
+#endif\r
+
 typedef struct IPAddrListElem
        {
        mDNSAddr addr;
index 953ef202f9821faeebd0fa584139750e85c15623..19f8570f4b07ee59629c6f681e2e5be912c4dd09 100755 (executable)
@@ -1,18 +1,24 @@
-/* -*- Mode: C; tab-width: 4 -*-
- *
+/*
  * Copyright (c) 2002-2004 Apple Computer, Inc. All rights reserved.
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * @APPLE_LICENSE_HEADER_START@
  * 
- *     http://www.apache.org/licenses/LICENSE-2.0
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
  * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
  * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
 
     Change History (most recent first):
     
index 2f5d46cd62a870ffc270fbc00eb701b3f8966802..7084d16b2a0dc1e86bc27e534a2d78c5d405cbfe 100755 (executable)
@@ -1,18 +1,24 @@
-/* -*- Mode: C; tab-width: 4 -*-
- *
+/*
  * Copyright (c) 2002-2004 Apple Computer, Inc. All rights reserved.
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * @APPLE_LICENSE_HEADER_START@
  * 
- *     http://www.apache.org/licenses/LICENSE-2.0
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
  * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
  * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
 
     Change History (most recent first):
 
index 9b081be4f44c7fc3e5b54dfe6494b1b6a5d7abd6..952dc44ca808e8fc0ad537337d594ce57cc75a7e 100755 (executable)
@@ -1,18 +1,24 @@
-/* -*- Mode: C; tab-width: 4 -*-
- *
+/*
  * Copyright (c) 2002-2004 Apple Computer, Inc. All rights reserved.
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * @APPLE_LICENSE_HEADER_START@
  * 
- *     http://www.apache.org/licenses/LICENSE-2.0
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
  * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
  * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
 
     Change History (most recent first):
 
index 41ddc4db3dc152e8ee8170c3ecc49612b93d1c92..93a14a71eb991e3888d4de3d788262f13fc590a0 100755 (executable)
@@ -1,31 +1,28 @@
-/* -*- Mode: C; tab-width: 4 -*-
- *
+/*
  * Copyright (c) 2002-2004 Apple Computer, Inc. All rights reserved.
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * @APPLE_LICENSE_HEADER_START@
  * 
- *     http://www.apache.org/licenses/LICENSE-2.0
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
  * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
  * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
 
     Change History (most recent first):
     
 $Log: mDNSWin32.c,v $
-Revision 1.107.2.1  2006/08/29 06:24:39  cheshire
-Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
-
-Revision 1.107  2006/03/19 02:00:13  cheshire
-<rdar://problem/4073825> Improve logic for delaying packets after repeated interface transitions
-
-Revision 1.106  2006/02/26 19:31:05  herscher
-<rdar://problem/4455038> Bonjour For Windows takes 90 seconds to start. This was caused by a bad interaction between the VirtualPC check, and the removal of the WMI dependency.  The problem was fixed by: 1) checking to see if WMI is running before trying to talk to it.  2) Retrying the VirtualPC check every 10 seconds upon failure, stopping after 10 unsuccessful tries.
-
 Revision 1.105  2005/11/27 20:21:16  herscher
 <rdar://problem/4210580> Workaround Virtual PC bug that incorrectly modifies incoming mDNS packets
 
@@ -455,9 +452,6 @@ Multicast DNS platform plugin for Win32
 
 #define kIPv6IfIndexBase                                                       (10000000L)
 
-#define kRetryVPCRate                                                          (-100000000)
-#define kRetryVPCMax                                                           (10)
-
 
 #if 0
 #pragma mark == Prototypes ==
@@ -480,8 +474,6 @@ mDNSlocal mStatus                   SetupSocket( mDNS * const inMDNS, const struct sockaddr *inA
 mDNSlocal mStatus                      SockAddrToMDNSAddr( const struct sockaddr * const inSA, mDNSAddr *outIP, mDNSIPPort *outPort );
 mDNSlocal mStatus                      SetupNotifications( mDNS * const inMDNS );
 mDNSlocal mStatus                      TearDownNotifications( mDNS * const inMDNS );
-mDNSlocal mStatus           SetupRetryVPCCheck( mDNS * const inMDNS );
-mDNSlocal mStatus           TearDownRetryVPCCheck( mDNS * const inMDNS );
 
 mDNSlocal mStatus                      SetupThread( mDNS * const inMDNS );
 mDNSlocal mStatus                      TearDownThread( const mDNS * const inMDNS );
@@ -493,7 +485,6 @@ mDNSlocal void                              ProcessingThreadInterfaceListChanged( mDNS *inMDNS );
 mDNSlocal void                         ProcessingThreadComputerDescriptionChanged( mDNS * inMDNS );
 mDNSlocal void                         ProcessingThreadTCPIPConfigChanged( mDNS * inMDNS );
 mDNSlocal void                         ProcessingThreadDynDNSConfigChanged( mDNS * inMDNS );
-mDNSlocal void              ProcessingThreadRetryVPCCheck( mDNS * inMDNS );
 
 
 // Platform Accessors
@@ -649,12 +640,6 @@ mStatus    mDNSPlatformInit( mDNS * const inMDNS )
        inMDNS->HISoftware.c[ 0 ] = (mDNSu8) mDNSPlatformStrLen( &inMDNS->HISoftware.c[ 1 ] );
        dlog( kDebugLevelInfo, DEBUG_NAME "HISoftware: %#s\n", inMDNS->HISoftware.c );
 #endif
-
-       // Bookkeeping
-
-       inMDNS->p->vpcCheckCount                        = 0;
-       inMDNS->p->vpcCheckEvent                        = NULL;
-       inMDNS->p->timersCount                          = 0;
        
        // Set up the IPv4 unicast socket
 
@@ -681,8 +666,16 @@ mStatus    mDNSPlatformInit( mDNS * const inMDNS )
        {
                DWORD size;
 
-               err = WSAIoctl( inMDNS->p->unicastSock4, SIO_GET_EXTENSION_FUNCTION_POINTER, &kWSARecvMsgGUID, 
+               // If we are running inside VPC, then we won't use WSARecvMsg because it will give us bogus information due to
+               // a bug in VPC itself.
+
+               err = IsVPCRunning();
+
+               if ( !err )
+               {
+                       err = WSAIoctl( inMDNS->p->unicastSock4, SIO_GET_EXTENSION_FUNCTION_POINTER, &kWSARecvMsgGUID, 
                                                        sizeof( kWSARecvMsgGUID ), &inMDNS->p->unicastSock4RecvMsgPtr, sizeof( inMDNS->p->unicastSock4RecvMsgPtr ), &size, NULL, NULL );
+               }
                
                if ( err )
                {
@@ -783,9 +776,6 @@ void        mDNSPlatformClose( mDNS * const inMDNS )
        err = TearDownInterfaceList( inMDNS );
        check_noerr( err );
        check( !inMDNS->p->inactiveInterfaceList );
-
-       err = TearDownRetryVPCCheck( inMDNS );
-       check_noerr( err );
                
        err = TearDownSynchronizationObjects( inMDNS );
        check_noerr( err );
@@ -1156,7 +1146,7 @@ exit:
 //     mDNSPlatformInterfaceIDfromInterfaceIndex
 //===========================================================================================================================
 
-mDNSInterfaceID        mDNSPlatformInterfaceIDfromInterfaceIndex( mDNS * const inMDNS, mDNSu32 inIndex )
+mDNSInterfaceID        mDNSPlatformInterfaceIDfromInterfaceIndex( const mDNS * const inMDNS, mDNSu32 inIndex )
 {
        mDNSInterfaceID         id;
        
@@ -1186,7 +1176,7 @@ mDNSInterfaceID   mDNSPlatformInterfaceIDfromInterfaceIndex( mDNS * const inMDNS,
 //     mDNSPlatformInterfaceIndexfromInterfaceID
 //===========================================================================================================================
        
-mDNSu32        mDNSPlatformInterfaceIndexfromInterfaceID( mDNS * const inMDNS, mDNSInterfaceID inID )
+mDNSu32        mDNSPlatformInterfaceIndexfromInterfaceID( const mDNS * const inMDNS, mDNSInterfaceID inID )
 {
        mDNSu32         index;
        
@@ -2807,12 +2797,12 @@ mDNSlocal mStatus       SetupInterface( mDNS * const inMDNS, const struct ifaddrs *inI
 
                #if( !TARGET_OS_WINDOWS_CE )
                {
-                       DWORD size;
+                       DWORD           size;
 
                        // If we are running inside VPC, then we won't use WSARecvMsg because it will give us bogus information due to
                        // a bug in VPC itself.
                        
-                       err = inMDNS->p->inVirtualPC;
+                       err = IsVPCRunning();
 
                        if ( !err )
                        {
@@ -2855,7 +2845,7 @@ mDNSlocal mStatus SetupInterface( mDNS * const inMDNS, const struct ifaddrs *inI
        
        ifd->interfaceInfo.Advertise = inMDNS->AdvertiseLocalAddresses;
        
-       err = mDNS_RegisterInterface( inMDNS, &ifd->interfaceInfo, mDNSfalse );
+       err = mDNS_RegisterInterface( inMDNS, &ifd->interfaceInfo, 0 );
        require_noerr( err, exit );
        ifd->hostRegistered = mDNStrue;
        
@@ -2893,7 +2883,7 @@ mDNSlocal mStatus TearDownInterface( mDNS * const inMDNS, mDNSInterfaceData *inI
        if( inIFD->hostRegistered )
        {
                inIFD->hostRegistered = mDNSfalse;
-               mDNS_DeregisterInterface( inMDNS, &inIFD->interfaceInfo, mDNSfalse );
+               mDNS_DeregisterInterface( inMDNS, &inIFD->interfaceInfo );
        }
        
        // Tear down the multicast socket.
@@ -3285,64 +3275,6 @@ mDNSlocal mStatus        TearDownNotifications( mDNS * const inMDNS )
        return( mStatus_NoError );
 }
 
-
-//===========================================================================================================================
-//     SetupRetryVPCCheck
-//===========================================================================================================================
-
-mDNSlocal mStatus
-SetupRetryVPCCheck( mDNS * const inMDNS )
-{
-    LARGE_INTEGER      liDueTime;
-       BOOL                    ok;
-       mStatus                 err;
-
-       dlog( kDebugLevelTrace, DEBUG_NAME "setting up retry VirtualPC check\n" );
-    
-       liDueTime.QuadPart = kRetryVPCRate;
-
-    // Create a waitable timer.
-    
-       inMDNS->p->vpcCheckEvent = CreateWaitableTimer( NULL, TRUE, TEXT( "VPCCheckTimer" ) );
-       err = translate_errno( inMDNS->p->vpcCheckEvent, (mStatus) GetLastError(), kUnknownErr );
-       require_noerr( err, exit );
-
-    // Set a timer to wait for 10 seconds.
-    
-       ok = SetWaitableTimer( inMDNS->p->vpcCheckEvent, &liDueTime, 0, NULL, NULL, 0 );
-       err = translate_errno( ok, (OSStatus) GetLastError(), kUnknownErr );
-       require_noerr( err, exit );
-
-       inMDNS->p->timersCount++;
-
-exit:
-
-       return err;
-}
-
-
-//===========================================================================================================================
-//     TearDownRetryVPCCheck
-//===========================================================================================================================
-
-mDNSlocal mStatus
-TearDownRetryVPCCheck( mDNS * const inMDNS )
-{
-       dlog( kDebugLevelTrace, DEBUG_NAME "tearing down retry VirtualPC check\n" );
-
-       if ( inMDNS->p->vpcCheckEvent )
-       {
-               CancelWaitableTimer( inMDNS->p->vpcCheckEvent );
-               CloseHandle( inMDNS->p->vpcCheckEvent );
-
-               inMDNS->p->vpcCheckEvent = NULL;
-               inMDNS->p->timersCount--;
-       }
-
-       return ( mStatus_NoError );
-}
-
-
 #if 0
 #pragma mark -
 #endif
@@ -3549,13 +3481,6 @@ mDNSlocal unsigned WINAPI        ProcessingThread( LPVOID inParam )
                                                
                                                signaledObject = waitList[ waitItemIndex ];
        
-                                               if ( m->p->vpcCheckEvent == signaledObject )
-                                               {
-                                                       ProcessingThreadRetryVPCCheck( m );
-                                                       ++n;
-
-                                                       break;
-                                               }
 #if ( MDNS_WINDOWS_ENABLE_IPV4 )
                                                if ( m->p->unicastSock4ReadEvent == signaledObject )
                                                {
@@ -3653,15 +3578,7 @@ mDNSlocal mStatus ProcessingThreadInitialize( mDNS * const inMDNS )
        BOOL            wasSet;
        
        inMDNS->p->threadID = GetCurrentThreadId();
-
-       err = IsVPCRunning( &inMDNS->p->inVirtualPC );
-
-       if ( err )
-       {
-               TearDownRetryVPCCheck( inMDNS );
-               SetupRetryVPCCheck( inMDNS );
-       }
-
+       
        err = SetupInterfaceList( inMDNS );
        require_noerr( err, exit );
 
@@ -3676,7 +3593,6 @@ exit:
        if( err )
        {
                TearDownInterfaceList( inMDNS );
-               TearDownRetryVPCCheck( inMDNS );
        }
        inMDNS->p->initStatus = err;
        
@@ -3706,7 +3622,7 @@ mDNSlocal mStatus ProcessingThreadSetupWaitList( mDNS * const inMDNS, HANDLE **o
        
        // Allocate an array to hold all the objects to wait on.
        
-       waitListCount = kWaitListFixedItemCount + inMDNS->p->timersCount + inMDNS->p->interfaceCount + gTCPConnections;
+       waitListCount = kWaitListFixedItemCount + inMDNS->p->interfaceCount + gTCPConnections;
        waitList = (HANDLE *) malloc( waitListCount * sizeof( *waitList ) );
        require_action( waitList, exit, err = mStatus_NoMemoryErr );
        waitItemPtr = waitList;
@@ -3719,13 +3635,6 @@ mDNSlocal mStatus        ProcessingThreadSetupWaitList( mDNS * const inMDNS, HANDLE **o
        *waitItemPtr++ = inMDNS->p->descChangedEvent;
        *waitItemPtr++ = inMDNS->p->tcpipChangedEvent;
        *waitItemPtr++ = inMDNS->p->ddnsChangedEvent;
-
-       // Add timers
-
-       if ( inMDNS->p->vpcCheckEvent )
-       {
-               *waitItemPtr++ = inMDNS->p->vpcCheckEvent;
-       }
        
        // Append all the dynamic wait items to the list.
 #if ( MDNS_WINDOWS_ENABLE_IPV4 )
@@ -4047,44 +3956,6 @@ mDNSlocal void   ProcessingThreadDynDNSConfigChanged( mDNS *inMDNS )
 }
 
 
-//===========================================================================================================================
-//     ProcessingThreadRetryVPCCheck
-//===========================================================================================================================
-
-mDNSlocal void
-ProcessingThreadRetryVPCCheck( mDNS * inMDNS )
-{
-       mStatus err = mStatus_NoError;
-
-       dlog( kDebugLevelTrace, DEBUG_NAME "in ProcessingThreadRetryVPCCheck\n" );
-       
-       TearDownRetryVPCCheck( inMDNS );
-       
-       if ( inMDNS->p->vpcCheckCount < kRetryVPCMax )
-       {
-               inMDNS->p->vpcCheckCount++;
-
-               err = IsVPCRunning( &inMDNS->p->inVirtualPC );
-               require_noerr( err, exit );
-       
-               if ( inMDNS->p->inVirtualPC )
-               {
-                       ProcessingThreadInterfaceListChanged( inMDNS );
-               }
-       }
-
-exit:
-
-       if ( err )
-       {
-               SetupRetryVPCCheck( inMDNS );
-       }
-
-       return; 
-}
-
-
-
 #if 0
 #pragma mark -
 #pragma mark == Utilities ==
index d5c59c889c13fadc6648e6faf561725e3a92089f..1a9755debfac1546e647f73ee795cba4c133c381 100755 (executable)
@@ -1,28 +1,28 @@
-/* -*- Mode: C; tab-width: 4 -*-
- *
+/*
  * Copyright (c) 2002-2004 Apple Computer, Inc. All rights reserved.
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * @APPLE_LICENSE_HEADER_START@
  * 
- *     http://www.apache.org/licenses/LICENSE-2.0
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
  * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
  * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
 
     Change History (most recent first):
     
 $Log: mDNSWin32.h,v $
-Revision 1.24.2.1  2006/08/29 06:24:39  cheshire
-Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
-
-Revision 1.24  2006/02/26 19:31:04  herscher
-<rdar://problem/4455038> Bonjour For Windows takes 90 seconds to start. This was caused by a bad interaction between the VirtualPC check, and the removal of the WMI dependency.  The problem was fixed by: 1) checking to see if WMI is running before trying to talk to it.  2) Retrying the VirtualPC check every 10 seconds upon failure, stopping after 10 unsuccessful tries.
-
 Revision 1.23  2005/10/05 20:55:14  herscher
 <rdar://problem/4096464> Don't call SetLLRoute on loopback interface
 
@@ -198,14 +198,10 @@ struct    mDNS_PlatformSupport_struct
        HANDLE                                          ddnsChangedEvent;       // DynDNS config changed
        HANDLE                                          wakeupEvent;
        HANDLE                                          initEvent;
-       HANDLE                                          vpcCheckEvent;          // Timer handle to check if we're running in Virtual PC
-       int                                                     vpcCheckCount;
        HKEY                                            descKey;
        HKEY                                            tcpipKey;
        HKEY                                            ddnsKey;
        mStatus                                         initStatus;
-       mDNSBool                                        inVirtualPC;
-       int                                                     timersCount;
        mDNSBool                                        registeredLoopback4;
        SocketRef                                       interfaceListChangedSocket;
        int                                                     interfaceCount;
index db0d802f9188411cb586f0329514c80b62ed895e..f0937f5e1429c054dabd8e347106236e2f12dacc 100644 (file)
@@ -1,29 +1,28 @@
-/* -*- Mode: C; tab-width: 4 -*-
- *
+/*
  * Copyright (c) 2003-2004 Apple Computer, Inc. All rights reserved.
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * @APPLE_LICENSE_HEADER_START@
  * 
- *     http://www.apache.org/licenses/LICENSE-2.0
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
  * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
  * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
 
     Change History (most recent first):
     
 $Log: mdnsNSP.c,v $
-Revision 1.20  2006/08/14 23:26:10  cheshire
-Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
-
-Revision 1.19  2006/06/08 23:09:37  cheshire
-Updated comment: Correct IPv6LL reverse-mapping domains are '{8,9,A,B}.E.F.ip6.arpa.',
-not only '0.8.E.F.ip6.arpa.' (Actual code still needs to be fixed.)
-
 Revision 1.18  2005/10/17 05:45:36  herscher
 Fix typo in previous checkin
 
@@ -682,7 +681,7 @@ DEBUG_LOCAL int WSPAPI
                require_action( InHostsTable( translated ) == FALSE, exit, err = WSASERVICE_NOT_FOUND );
        }
 
-       // The name ends in .local ( and isn't in the hosts table ), {8,9,A,B}.E.F.ip6.arpa, or .254.169.in-addr.arpa so start the resolve operation. Lazy initialize DNS-SD if needed.
+       // The name ends in .local ( and isn't in the hosts table ), .0.8.e.f.ip6.arpa, or .254.169.in-addr.arpa so start the resolve operation. Lazy initialize DNS-SD if needed.
                
        NSPLock();
        
index 7c24bae20f59518bc2c2d25751b5a0c546a1d57f..338e5a5428fe727b484ae83e7416f61788562e77 100644 (file)
@@ -1,25 +1,28 @@
-; -*- tab-width: 4 -*-
 ;
 ; Copyright (c) 2003-2004 Apple Computer, Inc. All rights reserved.
 ;
-; Licensed under the Apache License, Version 2.0 (the "License");
-; you may not use this file except in compliance with the License.
-; You may obtain a copy of the License at
+; @APPLE_LICENSE_HEADER_START@
 ; 
-;     http://www.apache.org/licenses/LICENSE-2.0
+; This file contains Original Code and/or Modifications of Original Code
+; as defined in and that are subject to the Apple Public Source License
+; Version 2.0 (the 'License'). You may not use this file except in
+; compliance with the License. Please obtain a copy of the License at
+; http://www.opensource.apple.com/apsl/ and read it before using this
+; file.
 ; 
-; Unless required by applicable law or agreed to in writing, software
-; distributed under the License is distributed on an "AS IS" BASIS,
-; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-; See the License for the specific language governing permissions and
+; The Original Code and all software distributed under the License are
+; distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+; EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+; INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+; FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+; Please see the License for the specific language governing rights and
 ; limitations under the License.
+; 
+; @APPLE_LICENSE_HEADER_END@
 ;
 ;      Change History (most recent first):
 ;    
 ; $Log: mdnsNSP.def,v $
-; Revision 1.4  2006/08/14 23:26:10  cheshire
-; Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
-;
 ; Revision 1.3  2005/01/28 23:48:46  shersche
 ; <rdar://problem/3942551> Export DllRegisterServer, DllUnregisterServer which can be called from the Installer or regsvr32
 ; Bug #: 3942551