react-native-zeroconf 0.15.2 → 0.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +27 -536
- package/android/build.gradle +2 -2
- package/android/src/main/java/com/balthazargronon/RCTZeroconf/Zeroconf.java +16 -4
- package/android/src/main/java/com/balthazargronon/RCTZeroconf/ZeroconfModule.java +95 -13
- package/android/src/main/java/com/balthazargronon/RCTZeroconf/nsd/NsdServiceImpl.java +184 -64
- package/android/src/main/java/com/balthazargronon/RCTZeroconf/nsd/ServiceInfoCallbacks.java +89 -0
- package/android/src/main/java/com/balthazargronon/RCTZeroconf/rx2dnssd/DnssdImpl.java +114 -39
- package/android/src/main/jni/Android.mk +1 -24
- package/android/src/main/jni/Application.mk +1 -1
- package/dist/index.js +244 -27
- package/index.d.ts +95 -9
- package/ios/RNZeroconf/RNNetServiceSerializer.h +10 -2
- package/ios/RNZeroconf/RNNetServiceSerializer.m +51 -59
- package/ios/RNZeroconf/RNZeroconf.h +1 -3
- package/ios/RNZeroconf/RNZeroconf.m +642 -175
- package/package.json +39 -1
- package/react-native-zeroconf.podspec +12 -6
- package/src/index.js +222 -31
- package/android/src/main/java/com/github/druk/dnssd/DNSSDBindable.java +0 -67
- package/android/src/main/java/com/github/druk/rx2dnssd/Rx2DnssdBindable.java +0 -35
- package/android/src/main/jni/mdnsresponder/Android.bp +0 -215
- package/android/src/main/jni/mdnsresponder/Clients/ClientCommon.c +0 -75
- package/android/src/main/jni/mdnsresponder/Clients/ClientCommon.h +0 -41
- package/android/src/main/jni/mdnsresponder/Clients/Makefile +0 -54
- package/android/src/main/jni/mdnsresponder/Clients/ReadMe.txt +0 -25
- package/android/src/main/jni/mdnsresponder/Clients/dns-sd.c +0 -1351
- package/android/src/main/jni/mdnsresponder/Makefile +0 -41
- package/android/src/main/jni/mdnsresponder/PrivateDNS.txt +0 -275
- package/android/src/main/jni/mdnsresponder/android/caseMapping/Iphlpapi.h +0 -1
- package/android/src/main/jni/mdnsresponder/android/caseMapping/README +0 -3
- package/android/src/main/jni/mdnsresponder/android/caseMapping/Resource.h +0 -1
- package/android/src/main/jni/mdnsresponder/android/caseMapping/Ws2tcpip.h +0 -1
- package/android/src/main/jni/mdnsresponder/android/caseMapping/ipExport.h +0 -1
- package/android/src/main/jni/mdnsresponder/android/windows_firewall_dummy.c +0 -10
- package/android/src/main/jni/mdnsresponder/mDNSCore/Implementer Notes.txt +0 -66
- package/android/src/main/jni/mdnsresponder/mDNSPosix/Client.c +0 -223
- package/android/src/main/jni/mdnsresponder/mDNSPosix/ExampleClientApp.c +0 -91
- package/android/src/main/jni/mdnsresponder/mDNSPosix/ExampleClientApp.h +0 -18
- package/android/src/main/jni/mdnsresponder/mDNSPosix/Identify.c +0 -378
- package/android/src/main/jni/mdnsresponder/mDNSPosix/Makefile +0 -520
- package/android/src/main/jni/mdnsresponder/mDNSPosix/NetMonitor.c +0 -1010
- package/android/src/main/jni/mdnsresponder/mDNSPosix/ProxyResponder.c +0 -300
- package/android/src/main/jni/mdnsresponder/mDNSPosix/ReadMe.txt +0 -314
- package/android/src/main/jni/mdnsresponder/mDNSPosix/Responder.c +0 -792
- package/android/src/main/jni/mdnsresponder/mDNSPosix/Services.txt +0 -36
- package/android/src/main/jni/mdnsresponder/mDNSPosix/libnss_mdns.8 +0 -148
- package/android/src/main/jni/mdnsresponder/mDNSPosix/mdnsd.sh +0 -73
- package/android/src/main/jni/mdnsresponder/mDNSPosix/nss_ReadMe.txt +0 -125
- package/android/src/main/jni/mdnsresponder/mDNSPosix/nss_mdns.c +0 -2723
- package/android/src/main/jni/mdnsresponder/mDNSPosix/nss_mdns.conf +0 -13
- package/android/src/main/jni/mdnsresponder/mDNSPosix/nss_mdns.conf.5 +0 -135
- package/android/src/main/jni/mdnsresponder/mDNSPosix/parselog.py +0 -247
- package/android/src/main/jni/mdnsresponder/mDNSResponder.sln +0 -400
- package/android/src/main/jni/mdnsresponder/mDNSShared/DebugServices.c +0 -3075
- package/android/src/main/jni/mdnsresponder/mDNSShared/dns-sd.1 +0 -194
- package/android/src/main/jni/mdnsresponder/mDNSShared/dnsextd.8 +0 -69
- package/android/src/main/jni/mdnsresponder/mDNSShared/dnsextd.c +0 -3146
- package/android/src/main/jni/mdnsresponder/mDNSShared/dnsextd.conf +0 -60
- package/android/src/main/jni/mdnsresponder/mDNSShared/dnsextd_lexer.l +0 -84
- package/android/src/main/jni/mdnsresponder/mDNSShared/dnsextd_parser.y +0 -585
- package/android/src/main/jni/mdnsresponder/mDNSShared/mDNS.1 +0 -198
- package/android/src/main/jni/mdnsresponder/mDNSShared/mDNSResponder.8 +0 -116
- package/android/src/main/jni/mdnsresponder/mDNSWindows/ControlPanel/BrowsingPage.cpp +0 -441
- package/android/src/main/jni/mdnsresponder/mDNSWindows/ControlPanel/BrowsingPage.h +0 -156
- package/android/src/main/jni/mdnsresponder/mDNSWindows/ControlPanel/ConfigDialog.cpp +0 -59
- package/android/src/main/jni/mdnsresponder/mDNSWindows/ControlPanel/ConfigDialog.h +0 -48
- package/android/src/main/jni/mdnsresponder/mDNSWindows/ControlPanel/ConfigPropertySheet.cpp +0 -301
- package/android/src/main/jni/mdnsresponder/mDNSWindows/ControlPanel/ConfigPropertySheet.h +0 -105
- package/android/src/main/jni/mdnsresponder/mDNSWindows/ControlPanel/ControlPanel.cpp +0 -380
- package/android/src/main/jni/mdnsresponder/mDNSWindows/ControlPanel/ControlPanel.def +0 -20
- package/android/src/main/jni/mdnsresponder/mDNSWindows/ControlPanel/ControlPanel.h +0 -84
- package/android/src/main/jni/mdnsresponder/mDNSWindows/ControlPanel/ControlPanel.rc +0 -141
- package/android/src/main/jni/mdnsresponder/mDNSWindows/ControlPanel/ControlPanel.vcproj +0 -727
- package/android/src/main/jni/mdnsresponder/mDNSWindows/ControlPanel/ControlPanelDll.rc +0 -123
- package/android/src/main/jni/mdnsresponder/mDNSWindows/ControlPanel/ControlPanelExe.cpp +0 -373
- package/android/src/main/jni/mdnsresponder/mDNSWindows/ControlPanel/ControlPanelExe.h +0 -48
- package/android/src/main/jni/mdnsresponder/mDNSWindows/ControlPanel/ControlPanelExe.rc +0 -123
- package/android/src/main/jni/mdnsresponder/mDNSWindows/ControlPanel/ControlPanelExe.vcproj +0 -764
- package/android/src/main/jni/mdnsresponder/mDNSWindows/ControlPanel/ControlPanelLocRes.rc +0 -270
- package/android/src/main/jni/mdnsresponder/mDNSWindows/ControlPanel/ControlPanelLocRes.vcproj +0 -487
- package/android/src/main/jni/mdnsresponder/mDNSWindows/ControlPanel/ControlPanelRes.rc +0 -134
- package/android/src/main/jni/mdnsresponder/mDNSWindows/ControlPanel/ControlPanelRes.vcproj +0 -518
- package/android/src/main/jni/mdnsresponder/mDNSWindows/ControlPanel/FourthPage.cpp +0 -197
- package/android/src/main/jni/mdnsresponder/mDNSWindows/ControlPanel/FourthPage.h +0 -87
- package/android/src/main/jni/mdnsresponder/mDNSWindows/ControlPanel/RegistrationPage.cpp +0 -387
- package/android/src/main/jni/mdnsresponder/mDNSWindows/ControlPanel/RegistrationPage.h +0 -75
- package/android/src/main/jni/mdnsresponder/mDNSWindows/ControlPanel/SecondPage.cpp +0 -544
- package/android/src/main/jni/mdnsresponder/mDNSWindows/ControlPanel/SecondPage.h +0 -107
- package/android/src/main/jni/mdnsresponder/mDNSWindows/ControlPanel/ServicesPage.cpp +0 -273
- package/android/src/main/jni/mdnsresponder/mDNSWindows/ControlPanel/ServicesPage.h +0 -123
- package/android/src/main/jni/mdnsresponder/mDNSWindows/ControlPanel/SharedSecret.cpp +0 -115
- package/android/src/main/jni/mdnsresponder/mDNSWindows/ControlPanel/SharedSecret.h +0 -54
- package/android/src/main/jni/mdnsresponder/mDNSWindows/ControlPanel/res/ControlPanel.dll.manifest +0 -10
- package/android/src/main/jni/mdnsresponder/mDNSWindows/ControlPanel/res/ControlPanel.exe.manifest +0 -17
- package/android/src/main/jni/mdnsresponder/mDNSWindows/ControlPanel/res/ControlPanel.manifest +0 -17
- package/android/src/main/jni/mdnsresponder/mDNSWindows/ControlPanel/res/ControlPanel.rc2 +0 -13
- package/android/src/main/jni/mdnsresponder/mDNSWindows/ControlPanel/res/ControlPanel64.manifest +0 -17
- package/android/src/main/jni/mdnsresponder/mDNSWindows/ControlPanel/res/EnergySaver.ico +0 -0
- package/android/src/main/jni/mdnsresponder/mDNSWindows/ControlPanel/res/controlpanel.ico +0 -0
- package/android/src/main/jni/mdnsresponder/mDNSWindows/ControlPanel/res/failure.ico +0 -0
- package/android/src/main/jni/mdnsresponder/mDNSWindows/ControlPanel/res/success.ico +0 -0
- package/android/src/main/jni/mdnsresponder/mDNSWindows/ControlPanel/resource.h +0 -56
- package/android/src/main/jni/mdnsresponder/mDNSWindows/ControlPanel/stdafx.cpp +0 -20
- package/android/src/main/jni/mdnsresponder/mDNSWindows/ControlPanel/stdafx.h +0 -64
- package/android/src/main/jni/mdnsresponder/mDNSWindows/DLL/dll.aps +0 -0
- package/android/src/main/jni/mdnsresponder/mDNSWindows/DLL/dll.rc +0 -102
- package/android/src/main/jni/mdnsresponder/mDNSWindows/DLL/dllmain.c +0 -112
- package/android/src/main/jni/mdnsresponder/mDNSWindows/DLL/dnssd.def +0 -48
- package/android/src/main/jni/mdnsresponder/mDNSWindows/DLL/dnssd.vcproj +0 -472
- package/android/src/main/jni/mdnsresponder/mDNSWindows/DLL/resource.h +0 -27
- package/android/src/main/jni/mdnsresponder/mDNSWindows/DLL.NET/AssemblyInfo.cpp +0 -84
- package/android/src/main/jni/mdnsresponder/mDNSWindows/DLL.NET/PString.h +0 -70
- package/android/src/main/jni/mdnsresponder/mDNSWindows/DLL.NET/Stdafx.cpp +0 -22
- package/android/src/main/jni/mdnsresponder/mDNSWindows/DLL.NET/Stdafx.h +0 -33
- package/android/src/main/jni/mdnsresponder/mDNSWindows/DLL.NET/dnssd_NET.cpp +0 -1234
- package/android/src/main/jni/mdnsresponder/mDNSWindows/DLL.NET/dnssd_NET.h +0 -1392
- package/android/src/main/jni/mdnsresponder/mDNSWindows/DLL.NET/dnssd_NET.ico +0 -0
- package/android/src/main/jni/mdnsresponder/mDNSWindows/DLL.NET/dnssd_NET.rc +0 -113
- package/android/src/main/jni/mdnsresponder/mDNSWindows/DLL.NET/dnssd_NET.vcproj +0 -446
- package/android/src/main/jni/mdnsresponder/mDNSWindows/DLL.NET/resource.h +0 -3
- package/android/src/main/jni/mdnsresponder/mDNSWindows/DLLStub/DLLStub.cpp +0 -693
- package/android/src/main/jni/mdnsresponder/mDNSWindows/DLLStub/DLLStub.h +0 -52
- package/android/src/main/jni/mdnsresponder/mDNSWindows/DLLStub/DLLStub.vcproj +0 -324
- package/android/src/main/jni/mdnsresponder/mDNSWindows/DLLX/DLLX.cpp +0 -208
- package/android/src/main/jni/mdnsresponder/mDNSWindows/DLLX/DLLX.def +0 -35
- package/android/src/main/jni/mdnsresponder/mDNSWindows/DLLX/DLLX.idl +0 -491
- package/android/src/main/jni/mdnsresponder/mDNSWindows/DLLX/DLLX.rc +0 -126
- package/android/src/main/jni/mdnsresponder/mDNSWindows/DLLX/DLLX.rgs +0 -11
- package/android/src/main/jni/mdnsresponder/mDNSWindows/DLLX/DLLX.vcproj +0 -625
- package/android/src/main/jni/mdnsresponder/mDNSWindows/DLLX/DNSSD.cpp +0 -892
- package/android/src/main/jni/mdnsresponder/mDNSWindows/DLLX/DNSSDEventManager.cpp +0 -31
- package/android/src/main/jni/mdnsresponder/mDNSWindows/DLLX/DNSSDEventManager.h +0 -133
- package/android/src/main/jni/mdnsresponder/mDNSWindows/DLLX/DNSSDEventManager.rgs +0 -27
- package/android/src/main/jni/mdnsresponder/mDNSWindows/DLLX/DNSSDRecord.cpp +0 -101
- package/android/src/main/jni/mdnsresponder/mDNSWindows/DLLX/DNSSDRecord.h +0 -185
- package/android/src/main/jni/mdnsresponder/mDNSWindows/DLLX/DNSSDRecord.rgs +0 -27
- package/android/src/main/jni/mdnsresponder/mDNSWindows/DLLX/DNSSDService.cpp +0 -2095
- package/android/src/main/jni/mdnsresponder/mDNSWindows/DLLX/DNSSDService.h +0 -429
- package/android/src/main/jni/mdnsresponder/mDNSWindows/DLLX/DNSSDService.rgs +0 -27
- package/android/src/main/jni/mdnsresponder/mDNSWindows/DLLX/StringServices.cpp +0 -344
- package/android/src/main/jni/mdnsresponder/mDNSWindows/DLLX/StringServices.h +0 -102
- package/android/src/main/jni/mdnsresponder/mDNSWindows/DLLX/TXTRecord.cpp +0 -381
- package/android/src/main/jni/mdnsresponder/mDNSWindows/DLLX/TXTRecord.h +0 -203
- package/android/src/main/jni/mdnsresponder/mDNSWindows/DLLX/TXTRecord.rgs +0 -27
- package/android/src/main/jni/mdnsresponder/mDNSWindows/DLLX/_IDNSSDEvents_CP.h +0 -358
- package/android/src/main/jni/mdnsresponder/mDNSWindows/DLLX/dlldatax.c +0 -51
- package/android/src/main/jni/mdnsresponder/mDNSWindows/DLLX/dlldatax.h +0 -49
- package/android/src/main/jni/mdnsresponder/mDNSWindows/DLLX/resource.h +0 -30
- package/android/src/main/jni/mdnsresponder/mDNSWindows/DLLX/stdafx.h +0 -88
- package/android/src/main/jni/mdnsresponder/mDNSWindows/DNSServiceBrowser/Windows/ApplicationVS2002.sln +0 -21
- package/android/src/main/jni/mdnsresponder/mDNSWindows/DNSServiceBrowser/Windows/ApplicationVS2002.vcproj +0 -253
- package/android/src/main/jni/mdnsresponder/mDNSWindows/DNSServiceBrowser/Windows/ApplicationVS2003.sln +0 -21
- package/android/src/main/jni/mdnsresponder/mDNSWindows/DNSServiceBrowser/Windows/ApplicationVS2003.vcproj +0 -267
- package/android/src/main/jni/mdnsresponder/mDNSWindows/DNSServiceBrowser/Windows/Resources/Application.ico +0 -0
- package/android/src/main/jni/mdnsresponder/mDNSWindows/DNSServiceBrowser/Windows/Resources/Application.rc +0 -323
- package/android/src/main/jni/mdnsresponder/mDNSWindows/DNSServiceBrowser/Windows/Resources/Application.rc2 +0 -20
- package/android/src/main/jni/mdnsresponder/mDNSWindows/DNSServiceBrowser/Windows/Resources/Resource.h +0 -53
- package/android/src/main/jni/mdnsresponder/mDNSWindows/DNSServiceBrowser/Windows/Sources/AboutDialog.cpp +0 -71
- package/android/src/main/jni/mdnsresponder/mDNSWindows/DNSServiceBrowser/Windows/Sources/AboutDialog.h +0 -62
- package/android/src/main/jni/mdnsresponder/mDNSWindows/DNSServiceBrowser/Windows/Sources/Application.cpp +0 -111
- package/android/src/main/jni/mdnsresponder/mDNSWindows/DNSServiceBrowser/Windows/Sources/Application.h +0 -68
- package/android/src/main/jni/mdnsresponder/mDNSWindows/DNSServiceBrowser/Windows/Sources/ChooserDialog.cpp +0 -1426
- package/android/src/main/jni/mdnsresponder/mDNSWindows/DNSServiceBrowser/Windows/Sources/ChooserDialog.h +0 -131
- package/android/src/main/jni/mdnsresponder/mDNSWindows/DNSServiceBrowser/Windows/Sources/LoginDialog.cpp +0 -109
- package/android/src/main/jni/mdnsresponder/mDNSWindows/DNSServiceBrowser/Windows/Sources/LoginDialog.h +0 -53
- package/android/src/main/jni/mdnsresponder/mDNSWindows/DNSServiceBrowser/Windows/Sources/StdAfx.cpp +0 -18
- package/android/src/main/jni/mdnsresponder/mDNSWindows/DNSServiceBrowser/Windows/Sources/StdAfx.h +0 -48
- package/android/src/main/jni/mdnsresponder/mDNSWindows/DNSServiceBrowser/WindowsCE/Application.vcc +0 -37
- package/android/src/main/jni/mdnsresponder/mDNSWindows/DNSServiceBrowser/WindowsCE/Application.vcp +0 -868
- package/android/src/main/jni/mdnsresponder/mDNSWindows/DNSServiceBrowser/WindowsCE/Application.vcw +0 -29
- package/android/src/main/jni/mdnsresponder/mDNSWindows/DNSServiceBrowser/WindowsCE/Resources/Application.ico +0 -0
- package/android/src/main/jni/mdnsresponder/mDNSWindows/DNSServiceBrowser/WindowsCE/Resources/Application.rc +0 -194
- package/android/src/main/jni/mdnsresponder/mDNSWindows/DNSServiceBrowser/WindowsCE/Resources/Application.rc2 +0 -13
- package/android/src/main/jni/mdnsresponder/mDNSWindows/DNSServiceBrowser/WindowsCE/Resources/newres.h +0 -28
- package/android/src/main/jni/mdnsresponder/mDNSWindows/DNSServiceBrowser/WindowsCE/Resources/resource.h +0 -22
- package/android/src/main/jni/mdnsresponder/mDNSWindows/DNSServiceBrowser/WindowsCE/Sources/Application.cpp +0 -92
- package/android/src/main/jni/mdnsresponder/mDNSWindows/DNSServiceBrowser/WindowsCE/Sources/Application.h +0 -57
- package/android/src/main/jni/mdnsresponder/mDNSWindows/DNSServiceBrowser/WindowsCE/Sources/BrowserDialog.cpp +0 -394
- package/android/src/main/jni/mdnsresponder/mDNSWindows/DNSServiceBrowser/WindowsCE/Sources/BrowserDialog.h +0 -84
- package/android/src/main/jni/mdnsresponder/mDNSWindows/DNSServiceBrowser/WindowsCE/Sources/StdAfx.cpp +0 -18
- package/android/src/main/jni/mdnsresponder/mDNSWindows/DNSServiceBrowser/WindowsCE/Sources/StdAfx.h +0 -46
- package/android/src/main/jni/mdnsresponder/mDNSWindows/Java/Java.vcproj +0 -111
- package/android/src/main/jni/mdnsresponder/mDNSWindows/Java/jdns_sd.rc +0 -62
- package/android/src/main/jni/mdnsresponder/mDNSWindows/Java/makefile +0 -143
- package/android/src/main/jni/mdnsresponder/mDNSWindows/Java/makefile64 +0 -143
- package/android/src/main/jni/mdnsresponder/mDNSWindows/NSPTool/NSPTool.aps +0 -0
- package/android/src/main/jni/mdnsresponder/mDNSWindows/NSPTool/NSPTool.c +0 -581
- package/android/src/main/jni/mdnsresponder/mDNSWindows/NSPTool/NSPTool.rc +0 -103
- package/android/src/main/jni/mdnsresponder/mDNSWindows/NSPTool/NSPTool.vcproj +0 -409
- package/android/src/main/jni/mdnsresponder/mDNSWindows/NSPTool/Prefix.h +0 -28
- package/android/src/main/jni/mdnsresponder/mDNSWindows/NSPTool/resource.h +0 -27
- package/android/src/main/jni/mdnsresponder/mDNSWindows/PosixCompat.c +0 -128
- package/android/src/main/jni/mdnsresponder/mDNSWindows/PosixCompat.h +0 -70
- package/android/src/main/jni/mdnsresponder/mDNSWindows/README.txt +0 -85
- package/android/src/main/jni/mdnsresponder/mDNSWindows/RegNames.h +0 -57
- package/android/src/main/jni/mdnsresponder/mDNSWindows/Secret.c +0 -338
- package/android/src/main/jni/mdnsresponder/mDNSWindows/Secret.h +0 -42
- package/android/src/main/jni/mdnsresponder/mDNSWindows/SystemService/EventLog.mc +0 -11
- package/android/src/main/jni/mdnsresponder/mDNSWindows/SystemService/EventLogMessages.bin +0 -0
- package/android/src/main/jni/mdnsresponder/mDNSWindows/SystemService/Firewall.cpp +0 -484
- package/android/src/main/jni/mdnsresponder/mDNSWindows/SystemService/Firewall.h +0 -79
- package/android/src/main/jni/mdnsresponder/mDNSWindows/SystemService/Prefix.h +0 -30
- package/android/src/main/jni/mdnsresponder/mDNSWindows/SystemService/Service.aps +0 -0
- package/android/src/main/jni/mdnsresponder/mDNSWindows/SystemService/Service.c +0 -2669
- package/android/src/main/jni/mdnsresponder/mDNSWindows/SystemService/Service.h +0 -30
- package/android/src/main/jni/mdnsresponder/mDNSWindows/SystemService/Service.mcp +0 -0
- package/android/src/main/jni/mdnsresponder/mDNSWindows/SystemService/Service.rc +0 -114
- package/android/src/main/jni/mdnsresponder/mDNSWindows/SystemService/Service.vcproj +0 -562
- package/android/src/main/jni/mdnsresponder/mDNSWindows/SystemService/main.c +0 -32
- package/android/src/main/jni/mdnsresponder/mDNSWindows/SystemService/res/mDNSResponder.manifest +0 -12
- package/android/src/main/jni/mdnsresponder/mDNSWindows/SystemService/res/mDNSResponder64.manifest +0 -12
- package/android/src/main/jni/mdnsresponder/mDNSWindows/SystemService/resource.h +0 -17
- package/android/src/main/jni/mdnsresponder/mDNSWindows/SystemService/resrc1.h +0 -15
- package/android/src/main/jni/mdnsresponder/mDNSWindows/VPCDetect.cpp +0 -165
- package/android/src/main/jni/mdnsresponder/mDNSWindows/VPCDetect.h +0 -36
- package/android/src/main/jni/mdnsresponder/mDNSWindows/WinServices.cpp +0 -93
- package/android/src/main/jni/mdnsresponder/mDNSWindows/WinServices.h +0 -34
- package/android/src/main/jni/mdnsresponder/mDNSWindows/WinVersRes.h +0 -35
- package/android/src/main/jni/mdnsresponder/mDNSWindows/isocode.h +0 -135
- package/android/src/main/jni/mdnsresponder/mDNSWindows/loclibrary.c +0 -268
- package/android/src/main/jni/mdnsresponder/mDNSWindows/loclibrary.h +0 -54
- package/android/src/main/jni/mdnsresponder/mDNSWindows/mDNSWin32.c +0 -5200
- package/android/src/main/jni/mdnsresponder/mDNSWindows/mDNSWin32.h +0 -208
- package/android/src/main/jni/mdnsresponder/mDNSWindows/mdnsNSP/ReadMe.txt +0 -15
- package/android/src/main/jni/mdnsresponder/mDNSWindows/mdnsNSP/mdnsNSP.aps +0 -0
- package/android/src/main/jni/mdnsresponder/mDNSWindows/mdnsNSP/mdnsNSP.c +0 -2430
- package/android/src/main/jni/mdnsresponder/mDNSWindows/mdnsNSP/mdnsNSP.def +0 -24
- package/android/src/main/jni/mdnsresponder/mDNSWindows/mdnsNSP/mdnsNSP.rc +0 -104
- package/android/src/main/jni/mdnsresponder/mDNSWindows/mdnsNSP/mdnsNSP.vcproj +0 -457
- package/android/src/main/jni/mdnsresponder/mDNSWindows/mdnsNSP/resource.h +0 -27
- package/android/src/main/jni/mdnsresponder/mdnsd.rc +0 -7
|
@@ -1,300 +0,0 @@
|
|
|
1
|
-
/* -*- Mode: C; tab-width: 4 -*-
|
|
2
|
-
*
|
|
3
|
-
* Copyright (c) 2002-2004 Apple Computer, Inc. All rights reserved.
|
|
4
|
-
*
|
|
5
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
-
* you may not use this file except in compliance with the License.
|
|
7
|
-
* You may obtain a copy of the License at
|
|
8
|
-
*
|
|
9
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
-
*
|
|
11
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
-
* See the License for the specific language governing permissions and
|
|
15
|
-
* limitations under the License.
|
|
16
|
-
*/
|
|
17
|
-
|
|
18
|
-
#include <stdio.h> // For printf()
|
|
19
|
-
#include <stdlib.h> // For exit() etc.
|
|
20
|
-
#include <string.h> // For strlen() etc.
|
|
21
|
-
#include <unistd.h> // For select()
|
|
22
|
-
#include <signal.h> // For SIGINT, SIGTERM
|
|
23
|
-
#include <errno.h> // For errno, EINTR
|
|
24
|
-
#include <netinet/in.h> // For INADDR_NONE
|
|
25
|
-
#include <arpa/inet.h> // For inet_addr()
|
|
26
|
-
#include <netdb.h> // For gethostbyname()
|
|
27
|
-
|
|
28
|
-
#include "mDNSEmbeddedAPI.h" // Defines the interface to the client layer above
|
|
29
|
-
#include "mDNSPosix.h" // Defines the specific types needed to run mDNS on this platform
|
|
30
|
-
#include "ExampleClientApp.h"
|
|
31
|
-
|
|
32
|
-
// Compatibility workaround: Solaris 2.5 has no INADDR_NONE
|
|
33
|
-
#ifndef INADDR_NONE
|
|
34
|
-
#define INADDR_NONE (mDNSu32)0xffffffff
|
|
35
|
-
#endif
|
|
36
|
-
|
|
37
|
-
//*************************************************************************************************************
|
|
38
|
-
// Globals
|
|
39
|
-
static mDNS mDNSStorage; // mDNS core uses this to store its globals
|
|
40
|
-
static mDNS_PlatformSupport PlatformStorage; // Stores this platform's globals
|
|
41
|
-
mDNSexport const char ProgramName[] = "mDNSProxyResponderPosix";
|
|
42
|
-
|
|
43
|
-
//*************************************************************************************************************
|
|
44
|
-
// Proxy Host Registration
|
|
45
|
-
|
|
46
|
-
typedef struct
|
|
47
|
-
{
|
|
48
|
-
mDNSv4Addr ip;
|
|
49
|
-
domainlabel hostlabel; // Conforms to standard DNS letter-digit-hyphen host name rules
|
|
50
|
-
AuthRecord RR_A; // 'A' (address) record for our ".local" name
|
|
51
|
-
AuthRecord RR_PTR; // PTR (reverse lookup) record
|
|
52
|
-
} ProxyHost;
|
|
53
|
-
|
|
54
|
-
mDNSlocal void HostNameCallback(mDNS *const m, AuthRecord *const rr, mStatus result)
|
|
55
|
-
{
|
|
56
|
-
ProxyHost *f = (ProxyHost*)rr->RecordContext;
|
|
57
|
-
if (result == mStatus_NoError)
|
|
58
|
-
debugf("Host name successfully registered: %##s", rr->resrec.name->c);
|
|
59
|
-
else
|
|
60
|
-
{
|
|
61
|
-
debugf("Host name conflict for %##s", rr->resrec.name->c);
|
|
62
|
-
mDNS_Deregister(m, &f->RR_A);
|
|
63
|
-
mDNS_Deregister(m, &f->RR_PTR);
|
|
64
|
-
exit(-1);
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
mDNSlocal mStatus mDNS_RegisterProxyHost(mDNS *m, ProxyHost *p)
|
|
69
|
-
{
|
|
70
|
-
char buffer[32];
|
|
71
|
-
|
|
72
|
-
mDNS_SetupResourceRecord(&p->RR_A, mDNSNULL, mDNSInterface_Any, kDNSType_A, 60, kDNSRecordTypeUnique, AuthRecordAny, HostNameCallback, p);
|
|
73
|
-
mDNS_SetupResourceRecord(&p->RR_PTR, mDNSNULL, mDNSInterface_Any, kDNSType_PTR, 60, kDNSRecordTypeKnownUnique, AuthRecordAny, HostNameCallback, p);
|
|
74
|
-
|
|
75
|
-
p->RR_A.namestorage.c[0] = 0;
|
|
76
|
-
AppendDomainLabel(&p->RR_A.namestorage, &p->hostlabel);
|
|
77
|
-
AppendLiteralLabelString(&p->RR_A.namestorage, "local");
|
|
78
|
-
|
|
79
|
-
// Note: This is reverse order compared to a normal dotted-decimal IP address, so we can't use our customary "%.4a" format code
|
|
80
|
-
mDNS_snprintf(buffer, sizeof(buffer), "%d.%d.%d.%d.in-addr.arpa.", p->ip.b[3], p->ip.b[2], p->ip.b[1], p->ip.b[0]);
|
|
81
|
-
MakeDomainNameFromDNSNameString(&p->RR_PTR.namestorage, buffer);
|
|
82
|
-
p->RR_PTR.ForceMCast = mDNStrue; // This PTR points to our dot-local name, so don't ever try to write it into a uDNS server
|
|
83
|
-
|
|
84
|
-
p->RR_A. resrec.rdata->u.ipv4 = p->ip;
|
|
85
|
-
AssignDomainName(&p->RR_PTR.resrec.rdata->u.name, p->RR_A.resrec.name);
|
|
86
|
-
|
|
87
|
-
mDNS_Register(m, &p->RR_A);
|
|
88
|
-
mDNS_Register(m, &p->RR_PTR);
|
|
89
|
-
|
|
90
|
-
debugf("Made Proxy Host Records for %##s", p->RR_A.resrec.name->c);
|
|
91
|
-
|
|
92
|
-
return(mStatus_NoError);
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
//*************************************************************************************************************
|
|
96
|
-
// Service Registration
|
|
97
|
-
|
|
98
|
-
// This sample ServiceCallback just calls mDNS_RenameAndReregisterService to automatically pick a new
|
|
99
|
-
// unique name for the service. For a device such as a printer, this may be appropriate.
|
|
100
|
-
// For a device with a user interface, and a screen, and a keyboard, the appropriate
|
|
101
|
-
// response may be to prompt the user and ask them to choose a new name for the service.
|
|
102
|
-
mDNSlocal void ServiceCallback(mDNS *const m, ServiceRecordSet *const sr, mStatus result)
|
|
103
|
-
{
|
|
104
|
-
switch (result)
|
|
105
|
-
{
|
|
106
|
-
case mStatus_NoError: debugf("Callback: %##s Name Registered", sr->RR_SRV.resrec.name->c); break;
|
|
107
|
-
case mStatus_NameConflict: debugf("Callback: %##s Name Conflict", sr->RR_SRV.resrec.name->c); break;
|
|
108
|
-
case mStatus_MemFree: debugf("Callback: %##s Memory Free", sr->RR_SRV.resrec.name->c); break;
|
|
109
|
-
default: debugf("Callback: %##s Unknown Result %ld", sr->RR_SRV.resrec.name->c, result); break;
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
if (result == mStatus_NoError)
|
|
113
|
-
{
|
|
114
|
-
char buffer[MAX_ESCAPED_DOMAIN_NAME];
|
|
115
|
-
ConvertDomainNameToCString(sr->RR_SRV.resrec.name, buffer);
|
|
116
|
-
printf("Service %s now registered and active\n", buffer);
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
if (result == mStatus_NameConflict)
|
|
120
|
-
{
|
|
121
|
-
char buffer1[MAX_ESCAPED_DOMAIN_NAME], buffer2[MAX_ESCAPED_DOMAIN_NAME];
|
|
122
|
-
ConvertDomainNameToCString(sr->RR_SRV.resrec.name, buffer1);
|
|
123
|
-
mDNS_RenameAndReregisterService(m, sr, mDNSNULL);
|
|
124
|
-
ConvertDomainNameToCString(sr->RR_SRV.resrec.name, buffer2);
|
|
125
|
-
printf("Name Conflict! %s renamed as %s\n", buffer1, buffer2);
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
// RegisterService() is a simple wrapper function which takes C string
|
|
130
|
-
// parameters, converts them to domainname parameters, and calls mDNS_RegisterService()
|
|
131
|
-
mDNSlocal void RegisterService(mDNS *m, ServiceRecordSet *recordset,
|
|
132
|
-
const char name[], const char type[], const char domain[],
|
|
133
|
-
const domainname *host, mDNSu16 PortAsNumber, int argc, char **argv)
|
|
134
|
-
{
|
|
135
|
-
domainlabel n;
|
|
136
|
-
domainname t, d;
|
|
137
|
-
unsigned char txtbuffer[1024], *bptr = txtbuffer;
|
|
138
|
-
char buffer[MAX_ESCAPED_DOMAIN_NAME];
|
|
139
|
-
|
|
140
|
-
MakeDomainLabelFromLiteralString(&n, name);
|
|
141
|
-
MakeDomainNameFromDNSNameString(&t, type);
|
|
142
|
-
MakeDomainNameFromDNSNameString(&d, domain);
|
|
143
|
-
while (argc)
|
|
144
|
-
{
|
|
145
|
-
int len = strlen(argv[0]);
|
|
146
|
-
if (len > 255 || bptr + 1 + len >= txtbuffer + sizeof(txtbuffer)) break;
|
|
147
|
-
printf("STR: %s\n", argv[0]);
|
|
148
|
-
bptr[0] = len;
|
|
149
|
-
strcpy((char*)(bptr+1), argv[0]);
|
|
150
|
-
bptr += 1 + len;
|
|
151
|
-
argc--;
|
|
152
|
-
argv++;
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
mDNS_RegisterService(m, recordset,
|
|
156
|
-
&n, &t, &d, // Name, type, domain
|
|
157
|
-
host, mDNSOpaque16fromIntVal(PortAsNumber),
|
|
158
|
-
txtbuffer, bptr-txtbuffer, // TXT data, length
|
|
159
|
-
mDNSNULL, 0, // Subtypes
|
|
160
|
-
mDNSInterface_Any, // Interface ID
|
|
161
|
-
ServiceCallback, mDNSNULL, 0); // Callback, context, flags
|
|
162
|
-
|
|
163
|
-
ConvertDomainNameToCString(recordset->RR_SRV.resrec.name, buffer);
|
|
164
|
-
printf("Made Service Records for %s\n", buffer);
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
//*************************************************************************************************************
|
|
168
|
-
// Service non-existence assertion
|
|
169
|
-
// (claiming a service name without actually providing a service at that name, to prevent anyone else using that name)
|
|
170
|
-
// This is useful to avoid confusion between similar services
|
|
171
|
-
// e.g. A printer that implements IPP printing service using the name "My Printer", but doesn't implement LPR service,
|
|
172
|
-
// should also claim the LPR service name "My Printer" to stop a different printer offering LPR service under the same name,
|
|
173
|
-
// since it would be confusing to users to have two equivalent services with the same name.
|
|
174
|
-
|
|
175
|
-
mDNSlocal void NoSuchServiceCallback(mDNS *const m, AuthRecord *const rr, mStatus result)
|
|
176
|
-
{
|
|
177
|
-
const domainname *proxyhostname = (const domainname *)rr->RecordContext;
|
|
178
|
-
switch (result)
|
|
179
|
-
{
|
|
180
|
-
case mStatus_NoError: debugf("Callback: %##s Name Registered", rr->resrec.name->c); break;
|
|
181
|
-
case mStatus_NameConflict: debugf("Callback: %##s Name Conflict", rr->resrec.name->c); break;
|
|
182
|
-
case mStatus_MemFree: debugf("Callback: %##s Memory Free", rr->resrec.name->c); break;
|
|
183
|
-
default: debugf("Callback: %##s Unknown Result %ld", rr->resrec.name->c, result); break;
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
if (result == mStatus_NoError)
|
|
187
|
-
{
|
|
188
|
-
char buffer[MAX_ESCAPED_DOMAIN_NAME];
|
|
189
|
-
ConvertDomainNameToCString(rr->resrec.name, buffer);
|
|
190
|
-
printf("Non-existence assertion %s now registered and active\n", buffer);
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
if (result == mStatus_NameConflict)
|
|
194
|
-
{
|
|
195
|
-
domainlabel n;
|
|
196
|
-
domainname t, d;
|
|
197
|
-
char buffer1[MAX_ESCAPED_DOMAIN_NAME], buffer2[MAX_ESCAPED_DOMAIN_NAME];
|
|
198
|
-
ConvertDomainNameToCString(rr->resrec.name, buffer1);
|
|
199
|
-
DeconstructServiceName(rr->resrec.name, &n, &t, &d);
|
|
200
|
-
IncrementLabelSuffix(&n, mDNStrue);
|
|
201
|
-
mDNS_RegisterNoSuchService(m, rr, &n, &t, &d, proxyhostname, mDNSInterface_Any, NoSuchServiceCallback, mDNSNULL, mDNSfalse);
|
|
202
|
-
ConvertDomainNameToCString(rr->resrec.name, buffer2);
|
|
203
|
-
printf("Name Conflict! %s renamed as %s\n", buffer1, buffer2);
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
mDNSlocal void RegisterNoSuchService(mDNS *m, AuthRecord *const rr, domainname *proxyhostname,
|
|
208
|
-
const char name[], const char type[], const char domain[])
|
|
209
|
-
{
|
|
210
|
-
domainlabel n;
|
|
211
|
-
domainname t, d;
|
|
212
|
-
char buffer[MAX_ESCAPED_DOMAIN_NAME];
|
|
213
|
-
MakeDomainLabelFromLiteralString(&n, name);
|
|
214
|
-
MakeDomainNameFromDNSNameString(&t, type);
|
|
215
|
-
MakeDomainNameFromDNSNameString(&d, domain);
|
|
216
|
-
mDNS_RegisterNoSuchService(m, rr, &n, &t, &d, proxyhostname, mDNSInterface_Any, NoSuchServiceCallback, proxyhostname, mDNSfalse);
|
|
217
|
-
ConvertDomainNameToCString(rr->resrec.name, buffer);
|
|
218
|
-
printf("Made Non-existence Record for %s\n", buffer);
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
//*************************************************************************************************************
|
|
222
|
-
// Main
|
|
223
|
-
|
|
224
|
-
mDNSexport int main(int argc, char **argv)
|
|
225
|
-
{
|
|
226
|
-
mStatus status;
|
|
227
|
-
sigset_t signals;
|
|
228
|
-
|
|
229
|
-
if (argc < 3) goto usage;
|
|
230
|
-
|
|
231
|
-
status = mDNS_Init(&mDNSStorage, &PlatformStorage,
|
|
232
|
-
mDNS_Init_NoCache, mDNS_Init_ZeroCacheSize,
|
|
233
|
-
mDNS_Init_DontAdvertiseLocalAddresses,
|
|
234
|
-
mDNS_Init_NoInitCallback, mDNS_Init_NoInitCallbackContext);
|
|
235
|
-
if (status) { fprintf(stderr, "Daemon start: mDNS_Init failed %d\n", (int)status); return(status); }
|
|
236
|
-
|
|
237
|
-
mDNSPosixListenForSignalInEventLoop(SIGINT);
|
|
238
|
-
mDNSPosixListenForSignalInEventLoop(SIGTERM);
|
|
239
|
-
|
|
240
|
-
if (!strcmp(argv[1], "-"))
|
|
241
|
-
{
|
|
242
|
-
domainname proxyhostname;
|
|
243
|
-
AuthRecord proxyrecord;
|
|
244
|
-
if (argc < 5) goto usage;
|
|
245
|
-
proxyhostname.c[0] = 0;
|
|
246
|
-
AppendLiteralLabelString(&proxyhostname, argv[2]);
|
|
247
|
-
AppendLiteralLabelString(&proxyhostname, "local");
|
|
248
|
-
RegisterNoSuchService(&mDNSStorage, &proxyrecord, &proxyhostname, argv[3], argv[4], "local.");
|
|
249
|
-
}
|
|
250
|
-
else
|
|
251
|
-
{
|
|
252
|
-
ProxyHost proxyhost;
|
|
253
|
-
ServiceRecordSet proxyservice;
|
|
254
|
-
|
|
255
|
-
proxyhost.ip.NotAnInteger = inet_addr(argv[1]);
|
|
256
|
-
if (proxyhost.ip.NotAnInteger == INADDR_NONE) // INADDR_NONE is 0xFFFFFFFF
|
|
257
|
-
{
|
|
258
|
-
struct hostent *h = gethostbyname(argv[1]);
|
|
259
|
-
if (h) proxyhost.ip.NotAnInteger = *(long*)h->h_addr;
|
|
260
|
-
}
|
|
261
|
-
if (proxyhost.ip.NotAnInteger == INADDR_NONE) // INADDR_NONE is 0xFFFFFFFF
|
|
262
|
-
{
|
|
263
|
-
fprintf(stderr, "%s is not valid host address\n", argv[1]);
|
|
264
|
-
return(-1);
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
MakeDomainLabelFromLiteralString(&proxyhost.hostlabel, argv[2]);
|
|
268
|
-
|
|
269
|
-
mDNS_RegisterProxyHost(&mDNSStorage, &proxyhost);
|
|
270
|
-
|
|
271
|
-
if (argc >=6)
|
|
272
|
-
RegisterService(&mDNSStorage, &proxyservice, argv[3], argv[4], "local.",
|
|
273
|
-
proxyhost.RR_A.resrec.name, atoi(argv[5]), argc-6, &argv[6]);
|
|
274
|
-
}
|
|
275
|
-
|
|
276
|
-
do
|
|
277
|
-
{
|
|
278
|
-
struct timeval timeout = { 0x3FFFFFFF, 0 }; // wait until SIGINT or SIGTERM
|
|
279
|
-
mDNSBool gotSomething;
|
|
280
|
-
mDNSPosixRunEventLoopOnce(&mDNSStorage, &timeout, &signals, &gotSomething);
|
|
281
|
-
}
|
|
282
|
-
while ( !( sigismember( &signals, SIGINT) || sigismember( &signals, SIGTERM)));
|
|
283
|
-
|
|
284
|
-
mDNS_Close(&mDNSStorage);
|
|
285
|
-
|
|
286
|
-
return(0);
|
|
287
|
-
|
|
288
|
-
usage:
|
|
289
|
-
fprintf(stderr, "%s ip hostlabel [srvname srvtype port txt [txt ...]]\n", argv[0]);
|
|
290
|
-
fprintf(stderr, "ip Real IP address (or valid host name) of the host where the service actually resides\n");
|
|
291
|
-
fprintf(stderr, "hostlabel First label of the dot-local host name to create for this host, e.g. \"foo\" for \"foo.local.\"\n");
|
|
292
|
-
fprintf(stderr, "srvname Descriptive name of service, e.g. \"Stuart's Ink Jet Printer\"\n");
|
|
293
|
-
fprintf(stderr, "srvtype IANA service type, e.g. \"_ipp._tcp\" or \"_ssh._tcp\", etc.\n");
|
|
294
|
-
fprintf(stderr, "port Port number where the service resides (1-65535)\n");
|
|
295
|
-
fprintf(stderr, "txt Additional name/value pairs specified in service definition, e.g. \"pdl=application/postscript\"\n");
|
|
296
|
-
fprintf(stderr, "e.g. %s 169.254.12.34 thehost (just create a dot-local host name)\n", argv[0]);
|
|
297
|
-
fprintf(stderr, "or %s 169.254.12.34 thehost \"My Printer\" _printer._tcp. 515 rp=lpt1 pdl=application/postscript\n", argv[0]);
|
|
298
|
-
fprintf(stderr, "or %s - thehost \"My Printer\" _printer._tcp. (assertion of non-existence)\n", argv[0]);
|
|
299
|
-
return(-1);
|
|
300
|
-
}
|
|
@@ -1,314 +0,0 @@
|
|
|
1
|
-
ReadMe About mDNSPosix
|
|
2
|
-
----------------------
|
|
3
|
-
|
|
4
|
-
mDNSPosix is a port of Apple's Multicast DNS and DNS Service Discovery
|
|
5
|
-
code to Posix platforms.
|
|
6
|
-
|
|
7
|
-
Multicast DNS and DNS Service Discovery are technologies that allow you
|
|
8
|
-
to register IP-based services and browse the network for those services.
|
|
9
|
-
For more information about mDNS, see the mDNS web site.
|
|
10
|
-
|
|
11
|
-
<http://www.multicastdns.org/>
|
|
12
|
-
|
|
13
|
-
Multicast DNS is part of a family of technologies resulting from the
|
|
14
|
-
efforts of the IETF Zeroconf working group. For information about
|
|
15
|
-
other Zeroconf technologies, see the Zeroconf web site.
|
|
16
|
-
|
|
17
|
-
<http://www.zeroconf.org/>
|
|
18
|
-
|
|
19
|
-
Apple uses the trade mark "Bonjour" to describe our implementation of
|
|
20
|
-
Zeroconf technologies. This sample is designed to show how easy it is
|
|
21
|
-
to make a device "Bonjour compatible".
|
|
22
|
-
|
|
23
|
-
The "Bonjour" trade mark can also be licensed at no charge for
|
|
24
|
-
inclusion on your own products, packaging, manuals, promotional
|
|
25
|
-
materials, or web site. For details and licensing terms, see
|
|
26
|
-
|
|
27
|
-
<http://developer.apple.com/bonjour/>
|
|
28
|
-
|
|
29
|
-
The code in this sample was compiled and tested on Mac OS X (10.1.x,
|
|
30
|
-
10.2, 10.3), Solaris (SunOS 5.8), Linux (Redhat 2.4.9-21, Fedora Core 1),
|
|
31
|
-
and OpenBSD (2.9). YMMV.
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
Packing List
|
|
35
|
-
------------
|
|
36
|
-
|
|
37
|
-
The sample uses the following directories:
|
|
38
|
-
|
|
39
|
-
o mDNSCore -- A directory containing the core mDNS code. This code
|
|
40
|
-
is written in pure ANSI C and has proved to be very portable.
|
|
41
|
-
Every platform needs this core protocol engine code.
|
|
42
|
-
|
|
43
|
-
o mDNSShared -- A directory containing useful code that's not core to
|
|
44
|
-
the main protocol engine itself, but nonetheless useful, and used by
|
|
45
|
-
more than one (but not necessarily all) platforms.
|
|
46
|
-
|
|
47
|
-
o mDNSPosix -- The files that are specific to Posix platforms: Linux,
|
|
48
|
-
Solaris, FreeBSD, NetBSD, OpenBSD, etc. This code will also work on
|
|
49
|
-
OS X, though that's not its primary purpose.
|
|
50
|
-
|
|
51
|
-
o Clients -- Example client code showing how to use the API to the
|
|
52
|
-
services provided by the daemon.
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
Building the Code
|
|
56
|
-
-----------------
|
|
57
|
-
|
|
58
|
-
The sample does not use autoconf technology, primarily because I didn't
|
|
59
|
-
want to delay shipping while I learnt how to use it. Thus the code
|
|
60
|
-
builds using a very simple make file. To build the sample you should
|
|
61
|
-
cd to the mDNSPosix directory and type "make os=myos", e.g.
|
|
62
|
-
|
|
63
|
-
make os=panther
|
|
64
|
-
|
|
65
|
-
For Linux you would change that to:
|
|
66
|
-
|
|
67
|
-
make os=linux
|
|
68
|
-
|
|
69
|
-
There are definitions for each of the platforms I ported to. If you're
|
|
70
|
-
porting to any other platform please add appropriate definitions for it
|
|
71
|
-
and send us the diffs so they can be incorporated into the main
|
|
72
|
-
distribution.
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
Using the Sample
|
|
76
|
-
----------------
|
|
77
|
-
When you compile, you will get:
|
|
78
|
-
|
|
79
|
-
o Main products for general-purpose use (e.g. on a desktop computer):
|
|
80
|
-
- mdnsd
|
|
81
|
-
- libmdns
|
|
82
|
-
- nss_mdns (See nss_ReadMe.txt for important information about nss_mdns)
|
|
83
|
-
|
|
84
|
-
o Standalone products for dedicated devices (printer, network camera, etc.)
|
|
85
|
-
- mDNSClientPosix
|
|
86
|
-
- mDNSResponderPosix
|
|
87
|
-
- mDNSProxyResponderPosix
|
|
88
|
-
|
|
89
|
-
o Testing and Debugging tools
|
|
90
|
-
- dns-sd command-line tool (from the "Clients" folder)
|
|
91
|
-
- mDNSNetMonitor
|
|
92
|
-
- mDNSIdentify
|
|
93
|
-
|
|
94
|
-
As root type "make install" to install eight things:
|
|
95
|
-
o mdnsd (usually in /usr/sbin)
|
|
96
|
-
o libmdns (usually in /usr/lib)
|
|
97
|
-
o dns_sd.h (usually in /usr/include)
|
|
98
|
-
o startup scripts (e.g. in /etc/rc.d)
|
|
99
|
-
o manual pages (usually in /usr/share/man)
|
|
100
|
-
o dns-sd tool (usually in /usr/bin)
|
|
101
|
-
o nss_mdns (usually in /lib)
|
|
102
|
-
o nss configuration files (usually in /etc)
|
|
103
|
-
|
|
104
|
-
The "make install" concludes by executing the startup script
|
|
105
|
-
(usually "/etc/init.d/mdns start") to start the daemon running.
|
|
106
|
-
You shouldn't need to reboot unless you really want to.
|
|
107
|
-
|
|
108
|
-
Once the daemon is running, you can use the dns-sd test tool
|
|
109
|
-
to exercise all the major functionality of the daemon. Running
|
|
110
|
-
"dns-sd" with no arguments gives a summary of the available options.
|
|
111
|
-
This test tool is also described in detail, with several examples,
|
|
112
|
-
in Chapter 6 of the O'Reilly "Zero Configuration Networking" book.
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
How It Works
|
|
116
|
-
------------
|
|
117
|
-
+--------------------+
|
|
118
|
-
| Client Application |
|
|
119
|
-
+----------------+ +--------------------+
|
|
120
|
-
| uds_daemon.c | <--- Unix Domain Socket ---> | libmdns |
|
|
121
|
-
+----------------+ +--------------------+
|
|
122
|
-
| mDNSCore |
|
|
123
|
-
+----------------+
|
|
124
|
-
| mDNSPosix.c |
|
|
125
|
-
+----------------+
|
|
126
|
-
|
|
127
|
-
mdnsd is divided into three sections.
|
|
128
|
-
|
|
129
|
-
o mDNSCore is the main protocol engine
|
|
130
|
-
o mDNSPosix.c provides the glue it needs to run on a Posix OS
|
|
131
|
-
o uds_daemon.c exports a Unix Domain Socket interface to
|
|
132
|
-
the services provided by mDNSCore
|
|
133
|
-
|
|
134
|
-
Client applications link with the libmdns, which implements the functions
|
|
135
|
-
defined in the dns_sd.h header file, and implements the IPC protocol
|
|
136
|
-
used to communicate over the Unix Domain Socket interface to the daemon.
|
|
137
|
-
|
|
138
|
-
Note that, strictly speaking, nss_mdns could be just another client of
|
|
139
|
-
mdnsd, linking with libmdns just like any other client. However, because
|
|
140
|
-
of its central role in the normal operation of multicast DNS, it is built
|
|
141
|
-
and installed along with the other essential system support components.
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
Clients for Embedded Systems
|
|
145
|
-
----------------------------
|
|
146
|
-
|
|
147
|
-
For small devices with very constrained resources, with a single address
|
|
148
|
-
space and (typically) no virtual memory, the uds_daemon.c/UDS/libmdns
|
|
149
|
-
layer may be eliminated, and the Client Application may live directly
|
|
150
|
-
on top of mDNSCore:
|
|
151
|
-
|
|
152
|
-
+--------------------+
|
|
153
|
-
| Client Application |
|
|
154
|
-
+--------------------+
|
|
155
|
-
| mDNSCore |
|
|
156
|
-
+--------------------+
|
|
157
|
-
| mDNSPosix.c |
|
|
158
|
-
+--------------------+
|
|
159
|
-
|
|
160
|
-
Programming to this model is more work, so using the daemon and its
|
|
161
|
-
library is recommended if your platform is capable of that.
|
|
162
|
-
|
|
163
|
-
The runtime behaviour when using the embedded model is as follows:
|
|
164
|
-
|
|
165
|
-
1. The application calls mDNS_Init, which in turns calls the platform
|
|
166
|
-
(mDNSPlatformInit).
|
|
167
|
-
|
|
168
|
-
2. mDNSPlatformInit gets a list of interfaces (get_ifi_info) and registers
|
|
169
|
-
each one with the core (mDNS_RegisterInterface). For each interface
|
|
170
|
-
it also creates a multicast socket (SetupSocket).
|
|
171
|
-
|
|
172
|
-
3. The application then calls select() repeatedly to handle file descriptor
|
|
173
|
-
events. Before calling select() each time, the application calls
|
|
174
|
-
mDNSPosixGetFDSet() to give mDNSPosix.c a chance to add its own file
|
|
175
|
-
descriptors to the set, and then after select() returns, it calls
|
|
176
|
-
mDNSPosixProcessFDSet() to give mDNSPosix.c a chance to receive and
|
|
177
|
-
process any packets that may have arrived.
|
|
178
|
-
|
|
179
|
-
4. When the core needs to send a UDP packet it calls
|
|
180
|
-
mDNSPlatformSendUDP. That routines finds the interface that
|
|
181
|
-
corresponds to the source address requested by the core, and
|
|
182
|
-
sends the datagram using the UDP socket created for the
|
|
183
|
-
interface. If the socket is flow send-side controlled it just
|
|
184
|
-
drops the packet.
|
|
185
|
-
|
|
186
|
-
5. When SocketDataReady runs it uses a complex routine,
|
|
187
|
-
"recvfrom_flags", to actually receive the packet. This is required
|
|
188
|
-
because the core needs information about the packet that is
|
|
189
|
-
only available via the "recvmsg" call, and that call is complex
|
|
190
|
-
to implement in a portable way. I got my implementation of
|
|
191
|
-
"recvfrom_flags" from Stevens' "UNIX Network Programming", but
|
|
192
|
-
I had to modify it further to work with Linux.
|
|
193
|
-
|
|
194
|
-
One thing to note is that the Posix platform code is very deliberately
|
|
195
|
-
not multi-threaded. I do everything from a main loop that calls
|
|
196
|
-
"select()". This is good because it avoids all the problems that often
|
|
197
|
-
accompany multi-threaded code. If you decide to use threads in your
|
|
198
|
-
platform, you will have to implement the mDNSPlatformLock() and
|
|
199
|
-
mDNSPlatformUnlock() calls which are currently no-ops in mDNSPosix.c.
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
Once you've built the embedded samples you can test them by first
|
|
203
|
-
running the client, as shown below.
|
|
204
|
-
|
|
205
|
-
quinn% build/mDNSClientPosix
|
|
206
|
-
Hit ^C when you're bored waiting for responses.
|
|
207
|
-
|
|
208
|
-
By default the client starts a search for AppleShare servers and then
|
|
209
|
-
sits and waits, printing a message when services appear and disappear.
|
|
210
|
-
|
|
211
|
-
To continue with the test you should start the responder in another
|
|
212
|
-
shell window.
|
|
213
|
-
|
|
214
|
-
quinn% build/mDNSResponderPosix -n Foo
|
|
215
|
-
|
|
216
|
-
This will start the responder and tell it to advertise a AppleShare
|
|
217
|
-
service "Foo". In the client window you will see the client print out
|
|
218
|
-
the following as the service shows up on the network.
|
|
219
|
-
|
|
220
|
-
quinn% build/mDNSClientPosix
|
|
221
|
-
Hit ^C when you're bored waiting for responses.
|
|
222
|
-
*** Found name = 'Foo', type = '_afpovertcp._tcp.', domain = 'local.'
|
|
223
|
-
|
|
224
|
-
Back in the responder window you can quit the responder cleanly using
|
|
225
|
-
SIGINT (typically ^C).
|
|
226
|
-
|
|
227
|
-
quinn% build/mDNSResponderPosix -n Foo
|
|
228
|
-
^C
|
|
229
|
-
quinn%
|
|
230
|
-
|
|
231
|
-
As the responder quits it will multicast that the "Foo" service is
|
|
232
|
-
disappearing and the client will see that notification and print a
|
|
233
|
-
message to that effect (shown below). Finally, when you're done with
|
|
234
|
-
the client you can use SIGINT to quit it.
|
|
235
|
-
|
|
236
|
-
quinn% build/mDNSClientPosix
|
|
237
|
-
Hit ^C when you're bored waiting for responses.
|
|
238
|
-
*** Found name = 'Foo', type = '_afpovertcp._tcp.', domain = 'local.'
|
|
239
|
-
*** Lost name = 'Foo', type = '_afpovertcp._tcp.', domain = 'local.'
|
|
240
|
-
^C
|
|
241
|
-
quinn%
|
|
242
|
-
|
|
243
|
-
If things don't work, try starting each program in verbose mode (using
|
|
244
|
-
the "-v 1" option, or very verbose mode with "-v 2") to see if there's
|
|
245
|
-
an obvious cause.
|
|
246
|
-
|
|
247
|
-
That's it for the core functionality. Each program supports a variety
|
|
248
|
-
of other options. For example, you can advertise and browse for a
|
|
249
|
-
different service type using the "-t type" option. Use the "-?" option
|
|
250
|
-
on each program for more user-level information.
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
Caveats
|
|
254
|
-
-------
|
|
255
|
-
Currently the program uses a simple make file.
|
|
256
|
-
|
|
257
|
-
The Multicast DNS protocol can also operate locally over the loopback
|
|
258
|
-
interface, but this exposed some problems with the underlying network
|
|
259
|
-
stack in early versions of Mac OS X and may expose problems with other
|
|
260
|
-
network stacks too.
|
|
261
|
-
|
|
262
|
-
o On Mac OS X 10.1.x the code failed to start on the loopback interface
|
|
263
|
-
because the IP_ADD_MEMBERSHIP option returns ENOBUFS.
|
|
264
|
-
|
|
265
|
-
o On Mac OS X 10.2 the loopback-only case failed because
|
|
266
|
-
"sendto" calls fails with error EHOSTUNREACH. (3016042)
|
|
267
|
-
|
|
268
|
-
Consequently, the code will attempt service discovery on the loopback
|
|
269
|
-
interface only if no other interfaces are available.
|
|
270
|
-
|
|
271
|
-
I haven't been able to test the loopback-only case on other platforms
|
|
272
|
-
because I don't have access to the physical machine.
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
Licencing
|
|
276
|
-
---------
|
|
277
|
-
This source code is Open Source; for details see the "LICENSE" file.
|
|
278
|
-
|
|
279
|
-
Credits and Version History
|
|
280
|
-
---------------------------
|
|
281
|
-
If you find any problems with this sample, mail <dts@apple.com> and I
|
|
282
|
-
will try to fix them up.
|
|
283
|
-
|
|
284
|
-
1.0a1 (Jul 2002) was a prerelease version that was distributed
|
|
285
|
-
internally at Apple.
|
|
286
|
-
|
|
287
|
-
1.0a2 (Jul 2002) was a prerelease version that was distributed
|
|
288
|
-
internally at Apple.
|
|
289
|
-
|
|
290
|
-
1.0a3 (Aug 2002) was the first shipping version. The core mDNS code is
|
|
291
|
-
the code from Mac OS 10.2 (Jaguar) GM.
|
|
292
|
-
|
|
293
|
-
Share and Enjoy
|
|
294
|
-
|
|
295
|
-
Apple Developer Technical Support
|
|
296
|
-
Networking, Communications, Hardware
|
|
297
|
-
|
|
298
|
-
6 Aug 2002
|
|
299
|
-
|
|
300
|
-
Impact: A local network user may cause a denial of the Bonjour service
|
|
301
|
-
Description: An error handling issue exists in the Bonjour Namespace
|
|
302
|
-
Provider. A local network user may send a maliciously crafted multicast
|
|
303
|
-
DNS packet leading to an unexpected termination of the Bonjour service.
|
|
304
|
-
This update addresses the issue by performing additional validation of
|
|
305
|
-
multicast DNS packets. This issue does not affect systems running Mac OS
|
|
306
|
-
X or Windows.
|
|
307
|
-
CVE-ID
|
|
308
|
-
CVE-2011-0220 : JaeSeung Song of the Department of Computing at Imperial
|
|
309
|
-
College London
|
|
310
|
-
|
|
311
|
-
To Do List
|
|
312
|
-
----------
|
|
313
|
-
• port to a System V that's not Solaris
|
|
314
|
-
• use sig_atomic_t for signal to main thread flags
|