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.
Files changed (231) hide show
  1. package/README.md +27 -536
  2. package/android/build.gradle +2 -2
  3. package/android/src/main/java/com/balthazargronon/RCTZeroconf/Zeroconf.java +16 -4
  4. package/android/src/main/java/com/balthazargronon/RCTZeroconf/ZeroconfModule.java +95 -13
  5. package/android/src/main/java/com/balthazargronon/RCTZeroconf/nsd/NsdServiceImpl.java +184 -64
  6. package/android/src/main/java/com/balthazargronon/RCTZeroconf/nsd/ServiceInfoCallbacks.java +89 -0
  7. package/android/src/main/java/com/balthazargronon/RCTZeroconf/rx2dnssd/DnssdImpl.java +114 -39
  8. package/android/src/main/jni/Android.mk +1 -24
  9. package/android/src/main/jni/Application.mk +1 -1
  10. package/dist/index.js +244 -27
  11. package/index.d.ts +95 -9
  12. package/ios/RNZeroconf/RNNetServiceSerializer.h +10 -2
  13. package/ios/RNZeroconf/RNNetServiceSerializer.m +51 -59
  14. package/ios/RNZeroconf/RNZeroconf.h +1 -3
  15. package/ios/RNZeroconf/RNZeroconf.m +642 -175
  16. package/package.json +39 -1
  17. package/react-native-zeroconf.podspec +12 -6
  18. package/src/index.js +222 -31
  19. package/android/src/main/java/com/github/druk/dnssd/DNSSDBindable.java +0 -67
  20. package/android/src/main/java/com/github/druk/rx2dnssd/Rx2DnssdBindable.java +0 -35
  21. package/android/src/main/jni/mdnsresponder/Android.bp +0 -215
  22. package/android/src/main/jni/mdnsresponder/Clients/ClientCommon.c +0 -75
  23. package/android/src/main/jni/mdnsresponder/Clients/ClientCommon.h +0 -41
  24. package/android/src/main/jni/mdnsresponder/Clients/Makefile +0 -54
  25. package/android/src/main/jni/mdnsresponder/Clients/ReadMe.txt +0 -25
  26. package/android/src/main/jni/mdnsresponder/Clients/dns-sd.c +0 -1351
  27. package/android/src/main/jni/mdnsresponder/Makefile +0 -41
  28. package/android/src/main/jni/mdnsresponder/PrivateDNS.txt +0 -275
  29. package/android/src/main/jni/mdnsresponder/android/caseMapping/Iphlpapi.h +0 -1
  30. package/android/src/main/jni/mdnsresponder/android/caseMapping/README +0 -3
  31. package/android/src/main/jni/mdnsresponder/android/caseMapping/Resource.h +0 -1
  32. package/android/src/main/jni/mdnsresponder/android/caseMapping/Ws2tcpip.h +0 -1
  33. package/android/src/main/jni/mdnsresponder/android/caseMapping/ipExport.h +0 -1
  34. package/android/src/main/jni/mdnsresponder/android/windows_firewall_dummy.c +0 -10
  35. package/android/src/main/jni/mdnsresponder/mDNSCore/Implementer Notes.txt +0 -66
  36. package/android/src/main/jni/mdnsresponder/mDNSPosix/Client.c +0 -223
  37. package/android/src/main/jni/mdnsresponder/mDNSPosix/ExampleClientApp.c +0 -91
  38. package/android/src/main/jni/mdnsresponder/mDNSPosix/ExampleClientApp.h +0 -18
  39. package/android/src/main/jni/mdnsresponder/mDNSPosix/Identify.c +0 -378
  40. package/android/src/main/jni/mdnsresponder/mDNSPosix/Makefile +0 -520
  41. package/android/src/main/jni/mdnsresponder/mDNSPosix/NetMonitor.c +0 -1010
  42. package/android/src/main/jni/mdnsresponder/mDNSPosix/ProxyResponder.c +0 -300
  43. package/android/src/main/jni/mdnsresponder/mDNSPosix/ReadMe.txt +0 -314
  44. package/android/src/main/jni/mdnsresponder/mDNSPosix/Responder.c +0 -792
  45. package/android/src/main/jni/mdnsresponder/mDNSPosix/Services.txt +0 -36
  46. package/android/src/main/jni/mdnsresponder/mDNSPosix/libnss_mdns.8 +0 -148
  47. package/android/src/main/jni/mdnsresponder/mDNSPosix/mdnsd.sh +0 -73
  48. package/android/src/main/jni/mdnsresponder/mDNSPosix/nss_ReadMe.txt +0 -125
  49. package/android/src/main/jni/mdnsresponder/mDNSPosix/nss_mdns.c +0 -2723
  50. package/android/src/main/jni/mdnsresponder/mDNSPosix/nss_mdns.conf +0 -13
  51. package/android/src/main/jni/mdnsresponder/mDNSPosix/nss_mdns.conf.5 +0 -135
  52. package/android/src/main/jni/mdnsresponder/mDNSPosix/parselog.py +0 -247
  53. package/android/src/main/jni/mdnsresponder/mDNSResponder.sln +0 -400
  54. package/android/src/main/jni/mdnsresponder/mDNSShared/DebugServices.c +0 -3075
  55. package/android/src/main/jni/mdnsresponder/mDNSShared/dns-sd.1 +0 -194
  56. package/android/src/main/jni/mdnsresponder/mDNSShared/dnsextd.8 +0 -69
  57. package/android/src/main/jni/mdnsresponder/mDNSShared/dnsextd.c +0 -3146
  58. package/android/src/main/jni/mdnsresponder/mDNSShared/dnsextd.conf +0 -60
  59. package/android/src/main/jni/mdnsresponder/mDNSShared/dnsextd_lexer.l +0 -84
  60. package/android/src/main/jni/mdnsresponder/mDNSShared/dnsextd_parser.y +0 -585
  61. package/android/src/main/jni/mdnsresponder/mDNSShared/mDNS.1 +0 -198
  62. package/android/src/main/jni/mdnsresponder/mDNSShared/mDNSResponder.8 +0 -116
  63. package/android/src/main/jni/mdnsresponder/mDNSWindows/ControlPanel/BrowsingPage.cpp +0 -441
  64. package/android/src/main/jni/mdnsresponder/mDNSWindows/ControlPanel/BrowsingPage.h +0 -156
  65. package/android/src/main/jni/mdnsresponder/mDNSWindows/ControlPanel/ConfigDialog.cpp +0 -59
  66. package/android/src/main/jni/mdnsresponder/mDNSWindows/ControlPanel/ConfigDialog.h +0 -48
  67. package/android/src/main/jni/mdnsresponder/mDNSWindows/ControlPanel/ConfigPropertySheet.cpp +0 -301
  68. package/android/src/main/jni/mdnsresponder/mDNSWindows/ControlPanel/ConfigPropertySheet.h +0 -105
  69. package/android/src/main/jni/mdnsresponder/mDNSWindows/ControlPanel/ControlPanel.cpp +0 -380
  70. package/android/src/main/jni/mdnsresponder/mDNSWindows/ControlPanel/ControlPanel.def +0 -20
  71. package/android/src/main/jni/mdnsresponder/mDNSWindows/ControlPanel/ControlPanel.h +0 -84
  72. package/android/src/main/jni/mdnsresponder/mDNSWindows/ControlPanel/ControlPanel.rc +0 -141
  73. package/android/src/main/jni/mdnsresponder/mDNSWindows/ControlPanel/ControlPanel.vcproj +0 -727
  74. package/android/src/main/jni/mdnsresponder/mDNSWindows/ControlPanel/ControlPanelDll.rc +0 -123
  75. package/android/src/main/jni/mdnsresponder/mDNSWindows/ControlPanel/ControlPanelExe.cpp +0 -373
  76. package/android/src/main/jni/mdnsresponder/mDNSWindows/ControlPanel/ControlPanelExe.h +0 -48
  77. package/android/src/main/jni/mdnsresponder/mDNSWindows/ControlPanel/ControlPanelExe.rc +0 -123
  78. package/android/src/main/jni/mdnsresponder/mDNSWindows/ControlPanel/ControlPanelExe.vcproj +0 -764
  79. package/android/src/main/jni/mdnsresponder/mDNSWindows/ControlPanel/ControlPanelLocRes.rc +0 -270
  80. package/android/src/main/jni/mdnsresponder/mDNSWindows/ControlPanel/ControlPanelLocRes.vcproj +0 -487
  81. package/android/src/main/jni/mdnsresponder/mDNSWindows/ControlPanel/ControlPanelRes.rc +0 -134
  82. package/android/src/main/jni/mdnsresponder/mDNSWindows/ControlPanel/ControlPanelRes.vcproj +0 -518
  83. package/android/src/main/jni/mdnsresponder/mDNSWindows/ControlPanel/FourthPage.cpp +0 -197
  84. package/android/src/main/jni/mdnsresponder/mDNSWindows/ControlPanel/FourthPage.h +0 -87
  85. package/android/src/main/jni/mdnsresponder/mDNSWindows/ControlPanel/RegistrationPage.cpp +0 -387
  86. package/android/src/main/jni/mdnsresponder/mDNSWindows/ControlPanel/RegistrationPage.h +0 -75
  87. package/android/src/main/jni/mdnsresponder/mDNSWindows/ControlPanel/SecondPage.cpp +0 -544
  88. package/android/src/main/jni/mdnsresponder/mDNSWindows/ControlPanel/SecondPage.h +0 -107
  89. package/android/src/main/jni/mdnsresponder/mDNSWindows/ControlPanel/ServicesPage.cpp +0 -273
  90. package/android/src/main/jni/mdnsresponder/mDNSWindows/ControlPanel/ServicesPage.h +0 -123
  91. package/android/src/main/jni/mdnsresponder/mDNSWindows/ControlPanel/SharedSecret.cpp +0 -115
  92. package/android/src/main/jni/mdnsresponder/mDNSWindows/ControlPanel/SharedSecret.h +0 -54
  93. package/android/src/main/jni/mdnsresponder/mDNSWindows/ControlPanel/res/ControlPanel.dll.manifest +0 -10
  94. package/android/src/main/jni/mdnsresponder/mDNSWindows/ControlPanel/res/ControlPanel.exe.manifest +0 -17
  95. package/android/src/main/jni/mdnsresponder/mDNSWindows/ControlPanel/res/ControlPanel.manifest +0 -17
  96. package/android/src/main/jni/mdnsresponder/mDNSWindows/ControlPanel/res/ControlPanel.rc2 +0 -13
  97. package/android/src/main/jni/mdnsresponder/mDNSWindows/ControlPanel/res/ControlPanel64.manifest +0 -17
  98. package/android/src/main/jni/mdnsresponder/mDNSWindows/ControlPanel/res/EnergySaver.ico +0 -0
  99. package/android/src/main/jni/mdnsresponder/mDNSWindows/ControlPanel/res/controlpanel.ico +0 -0
  100. package/android/src/main/jni/mdnsresponder/mDNSWindows/ControlPanel/res/failure.ico +0 -0
  101. package/android/src/main/jni/mdnsresponder/mDNSWindows/ControlPanel/res/success.ico +0 -0
  102. package/android/src/main/jni/mdnsresponder/mDNSWindows/ControlPanel/resource.h +0 -56
  103. package/android/src/main/jni/mdnsresponder/mDNSWindows/ControlPanel/stdafx.cpp +0 -20
  104. package/android/src/main/jni/mdnsresponder/mDNSWindows/ControlPanel/stdafx.h +0 -64
  105. package/android/src/main/jni/mdnsresponder/mDNSWindows/DLL/dll.aps +0 -0
  106. package/android/src/main/jni/mdnsresponder/mDNSWindows/DLL/dll.rc +0 -102
  107. package/android/src/main/jni/mdnsresponder/mDNSWindows/DLL/dllmain.c +0 -112
  108. package/android/src/main/jni/mdnsresponder/mDNSWindows/DLL/dnssd.def +0 -48
  109. package/android/src/main/jni/mdnsresponder/mDNSWindows/DLL/dnssd.vcproj +0 -472
  110. package/android/src/main/jni/mdnsresponder/mDNSWindows/DLL/resource.h +0 -27
  111. package/android/src/main/jni/mdnsresponder/mDNSWindows/DLL.NET/AssemblyInfo.cpp +0 -84
  112. package/android/src/main/jni/mdnsresponder/mDNSWindows/DLL.NET/PString.h +0 -70
  113. package/android/src/main/jni/mdnsresponder/mDNSWindows/DLL.NET/Stdafx.cpp +0 -22
  114. package/android/src/main/jni/mdnsresponder/mDNSWindows/DLL.NET/Stdafx.h +0 -33
  115. package/android/src/main/jni/mdnsresponder/mDNSWindows/DLL.NET/dnssd_NET.cpp +0 -1234
  116. package/android/src/main/jni/mdnsresponder/mDNSWindows/DLL.NET/dnssd_NET.h +0 -1392
  117. package/android/src/main/jni/mdnsresponder/mDNSWindows/DLL.NET/dnssd_NET.ico +0 -0
  118. package/android/src/main/jni/mdnsresponder/mDNSWindows/DLL.NET/dnssd_NET.rc +0 -113
  119. package/android/src/main/jni/mdnsresponder/mDNSWindows/DLL.NET/dnssd_NET.vcproj +0 -446
  120. package/android/src/main/jni/mdnsresponder/mDNSWindows/DLL.NET/resource.h +0 -3
  121. package/android/src/main/jni/mdnsresponder/mDNSWindows/DLLStub/DLLStub.cpp +0 -693
  122. package/android/src/main/jni/mdnsresponder/mDNSWindows/DLLStub/DLLStub.h +0 -52
  123. package/android/src/main/jni/mdnsresponder/mDNSWindows/DLLStub/DLLStub.vcproj +0 -324
  124. package/android/src/main/jni/mdnsresponder/mDNSWindows/DLLX/DLLX.cpp +0 -208
  125. package/android/src/main/jni/mdnsresponder/mDNSWindows/DLLX/DLLX.def +0 -35
  126. package/android/src/main/jni/mdnsresponder/mDNSWindows/DLLX/DLLX.idl +0 -491
  127. package/android/src/main/jni/mdnsresponder/mDNSWindows/DLLX/DLLX.rc +0 -126
  128. package/android/src/main/jni/mdnsresponder/mDNSWindows/DLLX/DLLX.rgs +0 -11
  129. package/android/src/main/jni/mdnsresponder/mDNSWindows/DLLX/DLLX.vcproj +0 -625
  130. package/android/src/main/jni/mdnsresponder/mDNSWindows/DLLX/DNSSD.cpp +0 -892
  131. package/android/src/main/jni/mdnsresponder/mDNSWindows/DLLX/DNSSDEventManager.cpp +0 -31
  132. package/android/src/main/jni/mdnsresponder/mDNSWindows/DLLX/DNSSDEventManager.h +0 -133
  133. package/android/src/main/jni/mdnsresponder/mDNSWindows/DLLX/DNSSDEventManager.rgs +0 -27
  134. package/android/src/main/jni/mdnsresponder/mDNSWindows/DLLX/DNSSDRecord.cpp +0 -101
  135. package/android/src/main/jni/mdnsresponder/mDNSWindows/DLLX/DNSSDRecord.h +0 -185
  136. package/android/src/main/jni/mdnsresponder/mDNSWindows/DLLX/DNSSDRecord.rgs +0 -27
  137. package/android/src/main/jni/mdnsresponder/mDNSWindows/DLLX/DNSSDService.cpp +0 -2095
  138. package/android/src/main/jni/mdnsresponder/mDNSWindows/DLLX/DNSSDService.h +0 -429
  139. package/android/src/main/jni/mdnsresponder/mDNSWindows/DLLX/DNSSDService.rgs +0 -27
  140. package/android/src/main/jni/mdnsresponder/mDNSWindows/DLLX/StringServices.cpp +0 -344
  141. package/android/src/main/jni/mdnsresponder/mDNSWindows/DLLX/StringServices.h +0 -102
  142. package/android/src/main/jni/mdnsresponder/mDNSWindows/DLLX/TXTRecord.cpp +0 -381
  143. package/android/src/main/jni/mdnsresponder/mDNSWindows/DLLX/TXTRecord.h +0 -203
  144. package/android/src/main/jni/mdnsresponder/mDNSWindows/DLLX/TXTRecord.rgs +0 -27
  145. package/android/src/main/jni/mdnsresponder/mDNSWindows/DLLX/_IDNSSDEvents_CP.h +0 -358
  146. package/android/src/main/jni/mdnsresponder/mDNSWindows/DLLX/dlldatax.c +0 -51
  147. package/android/src/main/jni/mdnsresponder/mDNSWindows/DLLX/dlldatax.h +0 -49
  148. package/android/src/main/jni/mdnsresponder/mDNSWindows/DLLX/resource.h +0 -30
  149. package/android/src/main/jni/mdnsresponder/mDNSWindows/DLLX/stdafx.h +0 -88
  150. package/android/src/main/jni/mdnsresponder/mDNSWindows/DNSServiceBrowser/Windows/ApplicationVS2002.sln +0 -21
  151. package/android/src/main/jni/mdnsresponder/mDNSWindows/DNSServiceBrowser/Windows/ApplicationVS2002.vcproj +0 -253
  152. package/android/src/main/jni/mdnsresponder/mDNSWindows/DNSServiceBrowser/Windows/ApplicationVS2003.sln +0 -21
  153. package/android/src/main/jni/mdnsresponder/mDNSWindows/DNSServiceBrowser/Windows/ApplicationVS2003.vcproj +0 -267
  154. package/android/src/main/jni/mdnsresponder/mDNSWindows/DNSServiceBrowser/Windows/Resources/Application.ico +0 -0
  155. package/android/src/main/jni/mdnsresponder/mDNSWindows/DNSServiceBrowser/Windows/Resources/Application.rc +0 -323
  156. package/android/src/main/jni/mdnsresponder/mDNSWindows/DNSServiceBrowser/Windows/Resources/Application.rc2 +0 -20
  157. package/android/src/main/jni/mdnsresponder/mDNSWindows/DNSServiceBrowser/Windows/Resources/Resource.h +0 -53
  158. package/android/src/main/jni/mdnsresponder/mDNSWindows/DNSServiceBrowser/Windows/Sources/AboutDialog.cpp +0 -71
  159. package/android/src/main/jni/mdnsresponder/mDNSWindows/DNSServiceBrowser/Windows/Sources/AboutDialog.h +0 -62
  160. package/android/src/main/jni/mdnsresponder/mDNSWindows/DNSServiceBrowser/Windows/Sources/Application.cpp +0 -111
  161. package/android/src/main/jni/mdnsresponder/mDNSWindows/DNSServiceBrowser/Windows/Sources/Application.h +0 -68
  162. package/android/src/main/jni/mdnsresponder/mDNSWindows/DNSServiceBrowser/Windows/Sources/ChooserDialog.cpp +0 -1426
  163. package/android/src/main/jni/mdnsresponder/mDNSWindows/DNSServiceBrowser/Windows/Sources/ChooserDialog.h +0 -131
  164. package/android/src/main/jni/mdnsresponder/mDNSWindows/DNSServiceBrowser/Windows/Sources/LoginDialog.cpp +0 -109
  165. package/android/src/main/jni/mdnsresponder/mDNSWindows/DNSServiceBrowser/Windows/Sources/LoginDialog.h +0 -53
  166. package/android/src/main/jni/mdnsresponder/mDNSWindows/DNSServiceBrowser/Windows/Sources/StdAfx.cpp +0 -18
  167. package/android/src/main/jni/mdnsresponder/mDNSWindows/DNSServiceBrowser/Windows/Sources/StdAfx.h +0 -48
  168. package/android/src/main/jni/mdnsresponder/mDNSWindows/DNSServiceBrowser/WindowsCE/Application.vcc +0 -37
  169. package/android/src/main/jni/mdnsresponder/mDNSWindows/DNSServiceBrowser/WindowsCE/Application.vcp +0 -868
  170. package/android/src/main/jni/mdnsresponder/mDNSWindows/DNSServiceBrowser/WindowsCE/Application.vcw +0 -29
  171. package/android/src/main/jni/mdnsresponder/mDNSWindows/DNSServiceBrowser/WindowsCE/Resources/Application.ico +0 -0
  172. package/android/src/main/jni/mdnsresponder/mDNSWindows/DNSServiceBrowser/WindowsCE/Resources/Application.rc +0 -194
  173. package/android/src/main/jni/mdnsresponder/mDNSWindows/DNSServiceBrowser/WindowsCE/Resources/Application.rc2 +0 -13
  174. package/android/src/main/jni/mdnsresponder/mDNSWindows/DNSServiceBrowser/WindowsCE/Resources/newres.h +0 -28
  175. package/android/src/main/jni/mdnsresponder/mDNSWindows/DNSServiceBrowser/WindowsCE/Resources/resource.h +0 -22
  176. package/android/src/main/jni/mdnsresponder/mDNSWindows/DNSServiceBrowser/WindowsCE/Sources/Application.cpp +0 -92
  177. package/android/src/main/jni/mdnsresponder/mDNSWindows/DNSServiceBrowser/WindowsCE/Sources/Application.h +0 -57
  178. package/android/src/main/jni/mdnsresponder/mDNSWindows/DNSServiceBrowser/WindowsCE/Sources/BrowserDialog.cpp +0 -394
  179. package/android/src/main/jni/mdnsresponder/mDNSWindows/DNSServiceBrowser/WindowsCE/Sources/BrowserDialog.h +0 -84
  180. package/android/src/main/jni/mdnsresponder/mDNSWindows/DNSServiceBrowser/WindowsCE/Sources/StdAfx.cpp +0 -18
  181. package/android/src/main/jni/mdnsresponder/mDNSWindows/DNSServiceBrowser/WindowsCE/Sources/StdAfx.h +0 -46
  182. package/android/src/main/jni/mdnsresponder/mDNSWindows/Java/Java.vcproj +0 -111
  183. package/android/src/main/jni/mdnsresponder/mDNSWindows/Java/jdns_sd.rc +0 -62
  184. package/android/src/main/jni/mdnsresponder/mDNSWindows/Java/makefile +0 -143
  185. package/android/src/main/jni/mdnsresponder/mDNSWindows/Java/makefile64 +0 -143
  186. package/android/src/main/jni/mdnsresponder/mDNSWindows/NSPTool/NSPTool.aps +0 -0
  187. package/android/src/main/jni/mdnsresponder/mDNSWindows/NSPTool/NSPTool.c +0 -581
  188. package/android/src/main/jni/mdnsresponder/mDNSWindows/NSPTool/NSPTool.rc +0 -103
  189. package/android/src/main/jni/mdnsresponder/mDNSWindows/NSPTool/NSPTool.vcproj +0 -409
  190. package/android/src/main/jni/mdnsresponder/mDNSWindows/NSPTool/Prefix.h +0 -28
  191. package/android/src/main/jni/mdnsresponder/mDNSWindows/NSPTool/resource.h +0 -27
  192. package/android/src/main/jni/mdnsresponder/mDNSWindows/PosixCompat.c +0 -128
  193. package/android/src/main/jni/mdnsresponder/mDNSWindows/PosixCompat.h +0 -70
  194. package/android/src/main/jni/mdnsresponder/mDNSWindows/README.txt +0 -85
  195. package/android/src/main/jni/mdnsresponder/mDNSWindows/RegNames.h +0 -57
  196. package/android/src/main/jni/mdnsresponder/mDNSWindows/Secret.c +0 -338
  197. package/android/src/main/jni/mdnsresponder/mDNSWindows/Secret.h +0 -42
  198. package/android/src/main/jni/mdnsresponder/mDNSWindows/SystemService/EventLog.mc +0 -11
  199. package/android/src/main/jni/mdnsresponder/mDNSWindows/SystemService/EventLogMessages.bin +0 -0
  200. package/android/src/main/jni/mdnsresponder/mDNSWindows/SystemService/Firewall.cpp +0 -484
  201. package/android/src/main/jni/mdnsresponder/mDNSWindows/SystemService/Firewall.h +0 -79
  202. package/android/src/main/jni/mdnsresponder/mDNSWindows/SystemService/Prefix.h +0 -30
  203. package/android/src/main/jni/mdnsresponder/mDNSWindows/SystemService/Service.aps +0 -0
  204. package/android/src/main/jni/mdnsresponder/mDNSWindows/SystemService/Service.c +0 -2669
  205. package/android/src/main/jni/mdnsresponder/mDNSWindows/SystemService/Service.h +0 -30
  206. package/android/src/main/jni/mdnsresponder/mDNSWindows/SystemService/Service.mcp +0 -0
  207. package/android/src/main/jni/mdnsresponder/mDNSWindows/SystemService/Service.rc +0 -114
  208. package/android/src/main/jni/mdnsresponder/mDNSWindows/SystemService/Service.vcproj +0 -562
  209. package/android/src/main/jni/mdnsresponder/mDNSWindows/SystemService/main.c +0 -32
  210. package/android/src/main/jni/mdnsresponder/mDNSWindows/SystemService/res/mDNSResponder.manifest +0 -12
  211. package/android/src/main/jni/mdnsresponder/mDNSWindows/SystemService/res/mDNSResponder64.manifest +0 -12
  212. package/android/src/main/jni/mdnsresponder/mDNSWindows/SystemService/resource.h +0 -17
  213. package/android/src/main/jni/mdnsresponder/mDNSWindows/SystemService/resrc1.h +0 -15
  214. package/android/src/main/jni/mdnsresponder/mDNSWindows/VPCDetect.cpp +0 -165
  215. package/android/src/main/jni/mdnsresponder/mDNSWindows/VPCDetect.h +0 -36
  216. package/android/src/main/jni/mdnsresponder/mDNSWindows/WinServices.cpp +0 -93
  217. package/android/src/main/jni/mdnsresponder/mDNSWindows/WinServices.h +0 -34
  218. package/android/src/main/jni/mdnsresponder/mDNSWindows/WinVersRes.h +0 -35
  219. package/android/src/main/jni/mdnsresponder/mDNSWindows/isocode.h +0 -135
  220. package/android/src/main/jni/mdnsresponder/mDNSWindows/loclibrary.c +0 -268
  221. package/android/src/main/jni/mdnsresponder/mDNSWindows/loclibrary.h +0 -54
  222. package/android/src/main/jni/mdnsresponder/mDNSWindows/mDNSWin32.c +0 -5200
  223. package/android/src/main/jni/mdnsresponder/mDNSWindows/mDNSWin32.h +0 -208
  224. package/android/src/main/jni/mdnsresponder/mDNSWindows/mdnsNSP/ReadMe.txt +0 -15
  225. package/android/src/main/jni/mdnsresponder/mDNSWindows/mdnsNSP/mdnsNSP.aps +0 -0
  226. package/android/src/main/jni/mdnsresponder/mDNSWindows/mdnsNSP/mdnsNSP.c +0 -2430
  227. package/android/src/main/jni/mdnsresponder/mDNSWindows/mdnsNSP/mdnsNSP.def +0 -24
  228. package/android/src/main/jni/mdnsresponder/mDNSWindows/mdnsNSP/mdnsNSP.rc +0 -104
  229. package/android/src/main/jni/mdnsresponder/mDNSWindows/mdnsNSP/mdnsNSP.vcproj +0 -457
  230. package/android/src/main/jni/mdnsresponder/mDNSWindows/mdnsNSP/resource.h +0 -27
  231. package/android/src/main/jni/mdnsresponder/mdnsd.rc +0 -7
@@ -1,41 +0,0 @@
1
- #
2
- # Top level makefile for Build & Integration.
3
- #
4
- # This file is used to facilitate checking the mDNSResponder project
5
- # directly out of CVS and submitting to B&I at Apple.
6
- #
7
- # The various platform directories contain makefiles or projects
8
- # specific to that platform.
9
- #
10
- # B&I builds must respect the following target:
11
- # install:
12
- # installsrc:
13
- # installhdrs:
14
- # clean:
15
- #
16
-
17
- include /Developer/Makefiles/pb_makefiles/platform.make
18
-
19
- MVERS = "mDNSResponder-320.10.80"
20
-
21
- DDNSWRITECONFIG = "$(DSTROOT)/Library/Application Support/Bonjour/ddnswriteconfig"
22
-
23
- installSome:
24
- cd "$(SRCROOT)/mDNSMacOSX"; xcodebuild install OBJROOT=$(OBJROOT) SYMROOT=$(SYMROOT) DSTROOT=$(DSTROOT) MVERS=$(MVERS) SDKROOT=$(SDKROOT) -target Build\ Some
25
-
26
- SystemLibraries:
27
- cd "$(SRCROOT)/mDNSMacOSX"; xcodebuild install OBJROOT=$(OBJROOT) SYMROOT=$(SYMROOT) DSTROOT=$(DSTROOT) MVERS=$(MVERS) SDKROOT=$(SDKROOT) -target SystemLibraries
28
-
29
- install:
30
- cd "$(SRCROOT)/mDNSMacOSX"; xcodebuild install OBJROOT=$(OBJROOT) SYMROOT=$(SYMROOT) DSTROOT=$(DSTROOT) MVERS=$(MVERS) SDKROOT=$(SDKROOT)
31
- # Make sure ddnswriteconfig is owned by root:wheel, then make it setuid root executable
32
- if test -e $(DDNSWRITECONFIG) ; then chown 0:80 $(DDNSWRITECONFIG) ; chmod 4555 $(DDNSWRITECONFIG) ; fi
33
-
34
- installsrc:
35
- ditto . "$(SRCROOT)"
36
-
37
- installhdrs::
38
- cd "$(SRCROOT)/mDNSMacOSX"; xcodebuild installhdrs OBJROOT=$(OBJROOT) SYMROOT=$(SYMROOT) DSTROOT=$(DSTROOT) MVERS=$(MVERS) SDKROOT=$(SDKROOT) -target SystemLibraries
39
-
40
- clean::
41
- echo clean
@@ -1,275 +0,0 @@
1
- Private DNS
2
-
3
- Summary
4
-
5
- Private DNS is an extension to standard Wide Area Bonjour that allows
6
- for secure, encrypted, and authorized communications. Private data sent
7
- from a client to a DNS server is encrypted using Transport Layer
8
- Security (TLS), ensuring that the data is hidden from prying eyes, and
9
- contains Transaction Signatures (TSIG), so the server can authorize the
10
- request. TSIGs are typically associated with Dynamic Updates; we are
11
- using them for standard and long-lived queries as well. Private DNS also
12
- protects Dynamic Updates from eavesdropping, by wrapping the update in a
13
- TLS communication channel if the server has been configured appropriately.
14
-
15
- Architectural Overview
16
-
17
- mDNSResponder has been modified to automatically issue a private query
18
- when necessary. After receiving an NXDOMAIN error, mDNSResponder checks
19
- in the system keychain to see if the user has a DNS query key (TSIG key)
20
- for the name in question, or for a parent of that name. If a suitable
21
- key is found, mDNSResponder looks up the zone data associated with the
22
- name of the question. After determining the correct name server,
23
- mDNSResponder looks up an additional SRV record "_dns-private._tcp". If
24
- it finds this record, mDNSResponder will re-issue the query privately.
25
- If either there is no _dns-private._tcp record, or there is no secret
26
- key, the call fails as it initially did, with an NXDOMAIN error.
27
-
28
- Once the secret key is found and the SRV record is looked up, mDNSResponder
29
- opens a TLS connection to the server on the port specified in the SRV
30
- record just looked up. After the connection succeeds, mDNSResponder
31
- can proceed to use that communication channel to make requests of
32
- the server. Every private packet must also have a TSIG record;
33
- the DNS server uses this TSIG record to allow access to its data.
34
-
35
- When setting up a long-lived query over TCP (with or without TLS)
36
- TCP's standard three-way handshake makes the full four-packet LLQ setup
37
- exchange described in <http://files.dns-sd.org/draft-sekar-dns-llq.txt>
38
- unnecessary. Instead, when connecting over TCP, the client simply sends
39
- a setup message and expects to receive ACK + Answers. The setup message
40
- sent is formatted as described in the LLQ document, however there is
41
- an additional TSIG' resource record added to the end of it. The TSIG
42
- resource records looks and acts exactly as it does in a secure update.
43
- So when the server receives an LLQ (or a standard query), it looks to
44
- see if the zone that is being referenced is public or private. If it's
45
- private, then it makes sure that the client is authorized to query that
46
- zone (by using the TSIG signature) and returns the appropriate data.
47
- When a zone is configured as private, the server will do this type of
48
- authorization checking for every query except those queries that are
49
- looking for SOA and NS records.
50
-
51
- Implementation Issues
52
-
53
- dnsextd
54
-
55
- dnsextd has been modified to behave much like a DNS firewall. The "real"
56
- DNS server is configured to listen on non-standard ports on the loopback
57
- interface. dnsextd then listens on the standard DNS ports (TCP/UDP port
58
- 53) and intercepts all DNS traffic. It is responsible for determining
59
- what zone a DNS request is associated with, determining whether the
60
- client is allowed access to that zone, and returning the appropriate
61
- information back to the caller. If the packet is allowed access, dnsextd
62
- forwards the request to the "real" nameserver, and returns the result to
63
- the caller.
64
-
65
- It was tempting to use BIND9's facility for configuring TSIG enabled
66
- queries while doing this work. However after proceeding down that path,
67
- enough subtle interaction problems were found that it was not practical
68
- to pursue this direction, so instead dnsextd does all TSIG processing
69
- for queries itself. It does continue to use BIND9 for processing TSIG
70
- enabled dynamic updates, though one minor downside with this is that
71
- there are two configuration files (named.conf or dnsextd.conf) that have
72
- the same secret key information. That seems redundant and error-prone,
73
- and moving all TSIG processing for both queries and updates into dnsextd
74
- would fix this.
75
-
76
- All private LLQ operations are TSIG-enabled and sent over a secure
77
- encrypted TLS channel. To accommodate service providers who don't want
78
- to have to keep open a large number of TLS connections to a large number
79
- of client machines, the server has the option of dropping the TLS
80
- connection after initial LLQ setup and sending subsequent events and
81
- refreshes using unencrypted UDP packets. This results in less load on
82
- the server, at the cost of slightly lower security (LLQs can only be set
83
- up by an authorized client, but once set up, subsequent change event
84
- packets sent over unencrypted UDP could be observed by an eavesdropper).
85
- A potential solution to this deficiency might be in using DTLS, which is
86
- a protocol based on TLS that is capable of securing datagram traffic.
87
- More investigation needs to be done to see if DTLS is suitable for
88
- private DNS.
89
-
90
- It was necessary to relax one of the checks that dnsextd performs during
91
- processing of an LLQ refresh. Prior to these changes, dnsextd would
92
- verify that the refresh request came from the same entity that setup the
93
- LLQ by comparing both the IP Address and port number of the request
94
- packet with the IP Address and port number of the setup packet. Because
95
- of the preceding issue, a refresh request might be sent over two
96
- different sockets. While their IP addresses would be the same, their
97
- port numbers could potentially differ. This check has been modified to
98
- only check that the IP addresses match.
99
-
100
- When setting up a semi-private LLQ (where the request and initial answer
101
- set is sent over TLS/TCP, but subsequent change events are sent over
102
- unencrypted UDP), dnsextd uses the port number of the client's TCP
103
- socket to determine the UDP event port number. While this eliminates the
104
- need to pass the UDP event port number in the LLQ setup request
105
- (obviating a potential data mismatch error), I think it does more harm
106
- than good, for three reasons:
107
-
108
- 1) We are relying that all the routers out there implement the Port
109
- Mapping Protocol spec correctly.
110
-
111
- 2) Upon setup every LLQ must NAT map two ports. Upon tear down every LLQ
112
- must tear down two NAT mappings.
113
-
114
- 3) Every LLQ opens up two sockets (TCP and UDP), rather than just the
115
- one TCP socket.
116
-
117
- All of this just to avoid sending two bytes in the LLQ setup packet
118
- doesn't seem logical. The approach also necessitates creating an
119
- additional UDP socket for every private LLQ, port mapping both the TCP
120
- socket as well as the UDP socket, and moderately increasing the
121
- complexity and efficiency of the code. Because of this we plan to allow
122
- the LLQ setup packet to specify a different UDP port for change event
123
- packets. This will allow mDNSResponder to receive all UDP change event
124
- packets on a single UDP port, instead of a different one for each LLQ.
125
-
126
- Currently, dnsextd is buggy on multi-homed hosts. If it receives a
127
- packet on interface 2, it will reply on interface 1 causing an error in
128
- the client program.
129
-
130
- dnsextd doesn't fully process all of its option parameters.
131
- Specifically, it doesn't process the keywords: "listen-on",
132
- "nameserver", "private", and "llq". It defaults to expecting the "real"
133
- nameserver to be listening on 127.0.0.1:5030.
134
-
135
-
136
- mDNSResponder
137
-
138
- Currently, mDNSResponder attempts to issue private queries for all
139
- queries that initially result in an NXDOMAIN error. This behavior might
140
- be modified in future versions, however it seems patently incorrect to
141
- do this for reverse name lookups. The code that attempts to get the zone
142
- data associated with the name will never find the zone for a reverse
143
- name lookup, and so will issue a number of wasteful DNS queries.
144
-
145
- mDNSResponder doesn't handle SERV_FULL or STATIC return codes after
146
- setting up an LLQ over TCP. This isn't a terrible problem right now,
147
- because dnsextd doesn't ever return them, but this should be fixed so
148
- that mDNSResponder will work when talking to other servers that do
149
- return these error codes.
150
-
151
-
152
- Configuration:
153
-
154
- Sample named.conf:
155
-
156
- //
157
- // Include keys file
158
- //
159
- include "/etc/rndc.key";
160
- // Declares control channels to be used by the rndc utility.
161
- //
162
- // It is recommended that 127.0.0.1 be the only address used.
163
- // This also allows non-privileged users on the local host to manage
164
- // your name server.
165
-
166
- //
167
- // Default controls
168
- //
169
- controls
170
- {
171
- inet 127.0.0.1 port 54 allow { any; } keys { "rndc-key"; };
172
- };
173
-
174
- options
175
- {
176
- directory "/var/named";
177
- /*
178
- * If there is a firewall between you and nameservers you want
179
- * to talk to, you might need to uncomment the query-source
180
- * directive below. Previous versions of BIND always asked
181
- * questions using port 53, but BIND 8.1 uses an unprivileged
182
- * port by default.
183
- */
184
-
185
- forwarders
186
- {
187
- 65.23.128.2;
188
- 65.23.128.3;
189
- };
190
-
191
- listen-on port 5030 { 127.0.0.1; };
192
- recursion true;
193
- };
194
-
195
- //
196
- // a caching only nameserver config
197
- //
198
- zone "." IN
199
- {
200
- type hint;
201
- file "named.ca";
202
- };
203
-
204
- zone "localhost" IN
205
- {
206
- type master;
207
- file "localhost.zone";
208
- allow-update { none; };
209
- };
210
-
211
- zone "0.0.127.in-addr.arpa" IN
212
- {
213
- type master;
214
- file "named.local";
215
- allow-update { none; };
216
- };
217
-
218
- zone "hungrywolf.org." in
219
- {
220
- type master;
221
- file "db.hungrywolf.org";
222
- allow-update { key hungrywolf.org.; };
223
- };
224
-
225
- zone "157.23.65.in-addr.arpa" IN
226
- {
227
- file "db.65.23.157";
228
- type master;
229
- };
230
-
231
- zone "100.255.17.in-addr.arpa" IN
232
- {
233
- file "db.17.255.100";
234
- type master;
235
- };
236
-
237
- zone "66.6.24.in-addr.arpa" IN
238
- {
239
- file "db.24.6.66";
240
- type master;
241
- };
242
-
243
- key hungrywolf.org.
244
- {
245
- algorithm hmac-md5;
246
- secret "c8LWr16K6ju6KMO5zT6Tyg==";
247
- };
248
-
249
- logging
250
- {
251
- category default { _default_log; };
252
-
253
- channel _default_log
254
- {
255
- file "/Library/Logs/named.log";
256
- severity info;
257
- print-time yes;
258
- };
259
- };
260
-
261
-
262
- Sample dnsextd.conf:
263
-
264
- options { };
265
-
266
- key "hungrywolf.org."
267
- {
268
- secret "c8LWr16K6ju6KMO5zT6Tyg==";
269
- };
270
-
271
- zone "hungrywolf.org."
272
- {
273
- type private;
274
- allow-query { key hungrywolf.org.; };
275
- };
@@ -1 +0,0 @@
1
- #include <iphlpapi.h>
@@ -1,3 +0,0 @@
1
- Windows filesystems, and consequently Windows C include files, are
2
- case-insensitive. This folder provides alternately-cased versions of header
3
- files for cases where that becomes a problem.
@@ -1 +0,0 @@
1
- #include <resource.h>
@@ -1 +0,0 @@
1
- #include <ws2tcpip.h>
@@ -1 +0,0 @@
1
- #include <ipexport.h>
@@ -1,10 +0,0 @@
1
- int mDNSIsFileAndPrintSharingEnabled(int *ignored) {
2
- (void)ignored;
3
- return 0;
4
- }
5
-
6
- int mDNSAddToFirewall(const char* ignored, const char* also_ignored) {
7
- (void)ignored;
8
- (void)also_ignored;
9
- return 0;
10
- }
@@ -1,66 +0,0 @@
1
- February 2002:
2
-
3
- The mDNSResponder code has a slight architectural change to improve
4
- efficiency.
5
-
6
- The mDNSResponder code previously called ScheduleNextTask() after every
7
- operation, to calculate the time at which it needed to be called back to
8
- perform its next timed operation. When the workload is light, and
9
- protocol operations are rare and far apart, this makes sense.
10
-
11
- However, on networks where there is a lot of mDNS traffic (or the CPU is
12
- slow), this leads to the following anomolous behaviour: mDNSResponder
13
- spends a lot of CPU time working out what to do next, when what it needs
14
- to do next should be obvious: Finish processing the big backlog of
15
- packets that have been received.
16
-
17
- To remedy this, mDNSResponder now only executes ScheduleNextTask() when
18
- there is no other obvious work waiting to be done. However, the
19
- mDNSResponder code does not have direct access to this knowledge. Only
20
- the platform layer below knows whether there are packets waiting to be
21
- processed. Only the client layer above knows whether it is in the
22
- process of performing a long sequence of back-to-back mDNS API calls.
23
-
24
- This means that the new architecture places an additional responsibility
25
- on the client layer and/or platform support layer. As long as they have
26
- immediate work to do, they should call the appropriate mDNSCore routines
27
- to accomplish that work. With each call, mDNSCore will do only what it
28
- immediately has to do to satisfy the call. Any optional work will be
29
- deferred. As soon as there is no more immediate work to do, the calling
30
- layer MUST call mDNS_Execute(). Failure to call mDNS_Execute() will lead
31
- to unreliable or incorrect operation.
32
-
33
- The value returned from mDNS_Execute() is the next time (in absolute
34
- platform time units) at which mDNS_Execute() MUST be called again to
35
- perform its next necessary operation (e.g. transmitting its next
36
- scheduled query packet, etc.) Note that the time returned is an absolute
37
- time, not the time *interval* between now and the next required call.
38
- For OS APIs that work in terms of intervals instead of absolute times,
39
- mDNSPlatformTimeNow() must be subtracted from the absolute time to get
40
- the interval between now and the next event.
41
-
42
- In a single-threaded application using a blocking select() call as its
43
- main synchronization point, this means that you should call
44
- mDNS_Execute() before calling select(), and the timeout value you pass
45
- to select() MUST NOT be larger than that indicated by the result
46
- returned from mDNS_Execute(). After the blocking select() call returns,
47
- you should do whatever work you have to do, and then, if mDNS packets
48
- were received, or mDNS API calls were made, be sure to call
49
- mDNS_Execute() again, and if necessary adjust your timeout value
50
- accordingly, before going back into the select() call.
51
-
52
- In an asynchronous or interrupt-driven application, there are three
53
- places that should call mDNS_Execute():
54
-
55
- 1. After delivering received packets, the platform support layer should
56
- call mDNS_Execute(), and use the value returned to set the platform
57
- callback timer to fire at the indicated time.
58
-
59
- 2. After making any mDNS API call or series of calls, the client layer
60
- should call mDNS_Execute(), and use the value returned to set the
61
- platform callback timer to fire at the indicated time.
62
-
63
- 3. When the platform callback timer fires, it should call mDNS_Execute()
64
- (to allow mDNSCore to perform its necessary work) and then the timer
65
- routine use the result returned to reset itself to fire at the right
66
- time for the next scheduled event.
@@ -1,223 +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 <assert.h>
19
- #include <signal.h>
20
- #include <stdio.h>
21
- #include <string.h>
22
- #include <unistd.h>
23
- #include <stdlib.h>
24
-
25
- #include "mDNSEmbeddedAPI.h"// Defines the interface to the mDNS core code
26
- #include "mDNSPosix.h" // Defines the specific types needed to run mDNS on this platform
27
- #include "ExampleClientApp.h"
28
-
29
- // Globals
30
- static mDNS mDNSStorage; // mDNS core uses this to store its globals
31
- static mDNS_PlatformSupport PlatformStorage; // Stores this platform's globals
32
- #define RR_CACHE_SIZE 500
33
- static CacheEntity gRRCache[RR_CACHE_SIZE];
34
-
35
- mDNSexport const char ProgramName[] = "mDNSClientPosix";
36
-
37
- static const char *gProgramName = ProgramName;
38
-
39
- static void BrowseCallback(mDNS *const m, DNSQuestion *question, const ResourceRecord *const answer, QC_result AddRecord)
40
- // A callback from the core mDNS code that indicates that we've received a
41
- // response to our query. Note that this code runs on the main thread
42
- // (in fact, there is only one thread!), so we can safely printf the results.
43
- {
44
- domainlabel name;
45
- domainname type;
46
- domainname domain;
47
- char nameC [MAX_DOMAIN_LABEL+1]; // Unescaped name: up to 63 bytes plus C-string terminating NULL.
48
- char typeC [MAX_ESCAPED_DOMAIN_NAME];
49
- char domainC[MAX_ESCAPED_DOMAIN_NAME];
50
- const char *state;
51
-
52
- (void)m; // Unused
53
- (void)question; // Unused
54
-
55
- assert(answer->rrtype == kDNSType_PTR);
56
-
57
- DeconstructServiceName(&answer->rdata->u.name, &name, &type, &domain);
58
-
59
- ConvertDomainLabelToCString_unescaped(&name, nameC);
60
- ConvertDomainNameToCString(&type, typeC);
61
- ConvertDomainNameToCString(&domain, domainC);
62
-
63
- // If the TTL has hit 0, the service is no longer available.
64
- if (!AddRecord) {
65
- state = "Lost ";
66
- } else {
67
- state = "Found";
68
- }
69
- fprintf(stderr, "*** %s name = '%s', type = '%s', domain = '%s'\n", state, nameC, typeC, domainC);
70
- }
71
-
72
- static mDNSBool CheckThatServiceTypeIsUsable(const char *serviceType, mDNSBool printExplanation)
73
- // Checks that serviceType is a reasonable service type
74
- // label and, if it isn't and printExplanation is true, prints
75
- // an explanation of why not.
76
- {
77
- mDNSBool result;
78
-
79
- result = mDNStrue;
80
- if (result && strlen(serviceType) > 63) {
81
- if (printExplanation) {
82
- fprintf(stderr,
83
- "%s: Service type specified by -t is too long (must be 63 characters or less)\n",
84
- gProgramName);
85
- }
86
- result = mDNSfalse;
87
- }
88
- if (result && serviceType[0] == 0) {
89
- if (printExplanation) {
90
- fprintf(stderr,
91
- "%s: Service type specified by -t can't be empty\n",
92
- gProgramName);
93
- }
94
- result = mDNSfalse;
95
- }
96
- return result;
97
- }
98
-
99
- static const char kDefaultServiceType[] = "_afpovertcp._tcp";
100
- static const char kDefaultDomain[] = "local.";
101
-
102
- static void PrintUsage()
103
- {
104
- fprintf(stderr,
105
- "Usage: %s [-v level] [-t type] [-d domain]\n",
106
- gProgramName);
107
- fprintf(stderr, " -v verbose mode, level is a number from 0 to 2\n");
108
- fprintf(stderr, " 0 = no debugging info (default)\n");
109
- fprintf(stderr, " 1 = standard debugging info\n");
110
- fprintf(stderr, " 2 = intense debugging info\n");
111
- fprintf(stderr, " -t uses 'type' as the service type (default is '%s')\n", kDefaultServiceType);
112
- fprintf(stderr, " -d uses 'domain' as the domain to browse (default is '%s')\n", kDefaultDomain);
113
- }
114
-
115
- static const char *gServiceType = kDefaultServiceType;
116
- static const char *gServiceDomain = kDefaultDomain;
117
-
118
- static void ParseArguments(int argc, char **argv)
119
- // Parses our command line arguments into the global variables
120
- // listed above.
121
- {
122
- int ch;
123
-
124
- // Set gProgramName to the last path component of argv[0]
125
-
126
- gProgramName = strrchr(argv[0], '/');
127
- if (gProgramName == NULL) {
128
- gProgramName = argv[0];
129
- } else {
130
- gProgramName += 1;
131
- }
132
-
133
- // Parse command line options using getopt.
134
-
135
- do {
136
- ch = getopt(argc, argv, "v:t:d:");
137
- if (ch != -1) {
138
- switch (ch) {
139
- case 'v':
140
- gMDNSPlatformPosixVerboseLevel = atoi(optarg);
141
- if (gMDNSPlatformPosixVerboseLevel < 0 || gMDNSPlatformPosixVerboseLevel > 2) {
142
- fprintf(stderr,
143
- "%s: Verbose mode must be in the range 0..2\n",
144
- gProgramName);
145
- exit(1);
146
- }
147
- break;
148
- case 't':
149
- gServiceType = optarg;
150
- if ( ! CheckThatServiceTypeIsUsable(gServiceType, mDNStrue) ) {
151
- exit(1);
152
- }
153
- break;
154
- case 'd':
155
- gServiceDomain = optarg;
156
- break;
157
- case '?':
158
- default:
159
- PrintUsage();
160
- exit(1);
161
- break;
162
- }
163
- }
164
- } while (ch != -1);
165
-
166
- // Check for any left over command line arguments.
167
-
168
- if (optind != argc) {
169
- fprintf(stderr, "%s: Unexpected argument '%s'\n", gProgramName, argv[optind]);
170
- exit(1);
171
- }
172
- }
173
-
174
- int main(int argc, char **argv)
175
- // The program's main entry point. The program does a trivial
176
- // mDNS query, looking for all AFP servers in the local domain.
177
- {
178
- int result;
179
- mStatus status;
180
- DNSQuestion question;
181
- domainname type;
182
- domainname domain;
183
-
184
- // Parse our command line arguments. This won't come back if there's an error.
185
- ParseArguments(argc, argv);
186
-
187
- // Initialise the mDNS core.
188
- status = mDNS_Init(&mDNSStorage, &PlatformStorage,
189
- gRRCache, RR_CACHE_SIZE,
190
- mDNS_Init_DontAdvertiseLocalAddresses,
191
- mDNS_Init_NoInitCallback, mDNS_Init_NoInitCallbackContext);
192
- if (status == mStatus_NoError) {
193
-
194
- // Construct and start the query.
195
-
196
- MakeDomainNameFromDNSNameString(&type, gServiceType);
197
- MakeDomainNameFromDNSNameString(&domain, gServiceDomain);
198
-
199
- status = mDNS_StartBrowse(&mDNSStorage, &question, &type, &domain, mDNSInterface_Any, mDNSfalse, BrowseCallback, NULL);
200
-
201
- // Run the platform main event loop until the user types ^C.
202
- // The BrowseCallback routine is responsible for printing
203
- // any results that we find.
204
-
205
- if (status == mStatus_NoError) {
206
- fprintf(stderr, "Hit ^C when you're bored waiting for responses.\n");
207
- ExampleClientEventLoop(&mDNSStorage);
208
- mDNS_StopQuery(&mDNSStorage, &question);
209
- mDNS_Close(&mDNSStorage);
210
- }
211
- }
212
-
213
- if (status == mStatus_NoError) {
214
- result = 0;
215
- } else {
216
- result = 2;
217
- }
218
- if ( (result != 0) || (gMDNSPlatformPosixVerboseLevel > 0) ) {
219
- fprintf(stderr, "%s: Finished with status %d, result %d\n", gProgramName, (int)status, result);
220
- }
221
-
222
- return 0;
223
- }