Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

updated with way cleaner use of jmdns (no src copy anymore)

* the jmdns jar wrongly contained duplicate .class files
* clean the jar and use it instead of copying the sources
* patched netbeans project to bundle jmdns in the android application (apk)
** added option in the "dex" call (search for ADDED in nbproject/build-impl.xml)
  • Loading branch information...
commit ed71dfcf99e42ae13ccd0a2d4c68df3c53f3051a 1 parent 89f1474
@twitwi authored
Showing with 36 additions and 28,582 deletions.
  1. +1 −0  .gitignore
  2. +1 −0  AndroidDnssdDiscovery/bundled-libs/jmdns.jar
  3. +1 −0  AndroidDnssdDiscovery/nbproject/build-impl.xml
  4. +1 −1  AndroidDnssdDiscovery/nbproject/project.properties
  5. +0 −422 AndroidDnssdDiscovery/src/javax/jmdns/JmDNS.java
  6. +0 −396 AndroidDnssdDiscovery/src/javax/jmdns/JmmDNS.java
  7. +0 −150 AndroidDnssdDiscovery/src/javax/jmdns/NetworkTopologyDiscovery.java
  8. +0 −45 AndroidDnssdDiscovery/src/javax/jmdns/NetworkTopologyEvent.java
  9. +0 −30 AndroidDnssdDiscovery/src/javax/jmdns/NetworkTopologyListener.java
  10. +0 −74 AndroidDnssdDiscovery/src/javax/jmdns/ServiceEvent.java
  11. +0 −727 AndroidDnssdDiscovery/src/javax/jmdns/ServiceInfo.java
  12. +0 −49 AndroidDnssdDiscovery/src/javax/jmdns/ServiceListener.java
  13. +0 −35 AndroidDnssdDiscovery/src/javax/jmdns/ServiceTypeListener.java
  14. +0 −533 AndroidDnssdDiscovery/src/javax/jmdns/impl/DNSCache.java
  15. +0 −296 AndroidDnssdDiscovery/src/javax/jmdns/impl/DNSEntry.java
  16. +0 −553 AndroidDnssdDiscovery/src/javax/jmdns/impl/DNSIncoming.java
  17. +0 −28 AndroidDnssdDiscovery/src/javax/jmdns/impl/DNSListener.java
  18. +0 −307 AndroidDnssdDiscovery/src/javax/jmdns/impl/DNSMessage.java
  19. +0 −451 AndroidDnssdDiscovery/src/javax/jmdns/impl/DNSOutgoing.java
  20. +0 −328 AndroidDnssdDiscovery/src/javax/jmdns/impl/DNSQuestion.java
  21. +0 −984 AndroidDnssdDiscovery/src/javax/jmdns/impl/DNSRecord.java
  22. +0 −559 AndroidDnssdDiscovery/src/javax/jmdns/impl/DNSStatefulObject.java
  23. +0 −352 AndroidDnssdDiscovery/src/javax/jmdns/impl/DNSTaskStarter.java
  24. +0 −422 AndroidDnssdDiscovery/src/javax/jmdns/impl/HostInfo.java
  25. +0 −2,215 AndroidDnssdDiscovery/src/javax/jmdns/impl/JmDNSImpl.java
  26. +0 −585 AndroidDnssdDiscovery/src/javax/jmdns/impl/JmmDNSImpl.java
  27. +0 −286 AndroidDnssdDiscovery/src/javax/jmdns/impl/ListenerStatus.java
  28. +0 −114 AndroidDnssdDiscovery/src/javax/jmdns/impl/NetworkTopologyDiscoveryImpl.java
  29. +0 −82 AndroidDnssdDiscovery/src/javax/jmdns/impl/NetworkTopologyEventImpl.java
  30. +0 −124 AndroidDnssdDiscovery/src/javax/jmdns/impl/ServiceEventImpl.java
  31. +0 −1,320 AndroidDnssdDiscovery/src/javax/jmdns/impl/ServiceInfoImpl.java
  32. +0 −90 AndroidDnssdDiscovery/src/javax/jmdns/impl/SocketListener.java
  33. +0 −60 AndroidDnssdDiscovery/src/javax/jmdns/impl/constants/DNSConstants.java
  34. +0 −87 AndroidDnssdDiscovery/src/javax/jmdns/impl/constants/DNSLabel.java
  35. +0 −86 AndroidDnssdDiscovery/src/javax/jmdns/impl/constants/DNSOperationCode.java
  36. +0 −78 AndroidDnssdDiscovery/src/javax/jmdns/impl/constants/DNSOptionCode.java
  37. +0 −138 AndroidDnssdDiscovery/src/javax/jmdns/impl/constants/DNSRecordClass.java
  38. +0 −312 AndroidDnssdDiscovery/src/javax/jmdns/impl/constants/DNSRecordType.java
  39. +0 −149 AndroidDnssdDiscovery/src/javax/jmdns/impl/constants/DNSResultCode.java
  40. +0 −215 AndroidDnssdDiscovery/src/javax/jmdns/impl/constants/DNSState.java
  41. +0 −2  AndroidDnssdDiscovery/src/javax/jmdns/impl/constants/package-info.java
  42. +0 −2  AndroidDnssdDiscovery/src/javax/jmdns/impl/package-info.java
  43. +0 −223 AndroidDnssdDiscovery/src/javax/jmdns/impl/tasks/DNSTask.java
  44. +0 −61 AndroidDnssdDiscovery/src/javax/jmdns/impl/tasks/RecordReaper.java
  45. +0 −157 AndroidDnssdDiscovery/src/javax/jmdns/impl/tasks/Responder.java
  46. +0 −2  AndroidDnssdDiscovery/src/javax/jmdns/impl/tasks/package-info.java
  47. +0 −116 AndroidDnssdDiscovery/src/javax/jmdns/impl/tasks/resolver/DNSResolverTask.java
  48. +0 −102 AndroidDnssdDiscovery/src/javax/jmdns/impl/tasks/resolver/ServiceInfoResolver.java
  49. +0 −77 AndroidDnssdDiscovery/src/javax/jmdns/impl/tasks/resolver/ServiceResolver.java
  50. +0 −75 AndroidDnssdDiscovery/src/javax/jmdns/impl/tasks/resolver/TypeResolver.java
  51. +0 −2  AndroidDnssdDiscovery/src/javax/jmdns/impl/tasks/resolver/package-info.java
  52. +0 −146 AndroidDnssdDiscovery/src/javax/jmdns/impl/tasks/state/Announcer.java
  53. +0 −143 AndroidDnssdDiscovery/src/javax/jmdns/impl/tasks/state/Canceler.java
  54. +0 −188 AndroidDnssdDiscovery/src/javax/jmdns/impl/tasks/state/DNSStateTask.java
  55. +0 −161 AndroidDnssdDiscovery/src/javax/jmdns/impl/tasks/state/Prober.java
  56. +0 −141 AndroidDnssdDiscovery/src/javax/jmdns/impl/tasks/state/Renewer.java
  57. +0 −2  AndroidDnssdDiscovery/src/javax/jmdns/impl/tasks/state/package-info.java
  58. +0 −9 AndroidDnssdDiscovery/src/javax/jmdns/package-info.java
  59. +1 −0  AndroidDnssdDiscoveryEclipse/.classpath
  60. +1 −0  AndroidDnssdDiscoveryEclipse/jmdns.jar
  61. +0 −422 AndroidDnssdDiscoveryEclipse/src/javax/jmdns/JmDNS.java
  62. +0 −396 AndroidDnssdDiscoveryEclipse/src/javax/jmdns/JmmDNS.java
  63. +0 −150 AndroidDnssdDiscoveryEclipse/src/javax/jmdns/NetworkTopologyDiscovery.java
  64. +0 −45 AndroidDnssdDiscoveryEclipse/src/javax/jmdns/NetworkTopologyEvent.java
  65. +0 −30 AndroidDnssdDiscoveryEclipse/src/javax/jmdns/NetworkTopologyListener.java
  66. +0 −74 AndroidDnssdDiscoveryEclipse/src/javax/jmdns/ServiceEvent.java
  67. +0 −727 AndroidDnssdDiscoveryEclipse/src/javax/jmdns/ServiceInfo.java
  68. +0 −49 AndroidDnssdDiscoveryEclipse/src/javax/jmdns/ServiceListener.java
  69. +0 −35 AndroidDnssdDiscoveryEclipse/src/javax/jmdns/ServiceTypeListener.java
  70. +0 −533 AndroidDnssdDiscoveryEclipse/src/javax/jmdns/impl/DNSCache.java
  71. +0 −296 AndroidDnssdDiscoveryEclipse/src/javax/jmdns/impl/DNSEntry.java
  72. +0 −553 AndroidDnssdDiscoveryEclipse/src/javax/jmdns/impl/DNSIncoming.java
  73. +0 −28 AndroidDnssdDiscoveryEclipse/src/javax/jmdns/impl/DNSListener.java
  74. +0 −307 AndroidDnssdDiscoveryEclipse/src/javax/jmdns/impl/DNSMessage.java
  75. +0 −451 AndroidDnssdDiscoveryEclipse/src/javax/jmdns/impl/DNSOutgoing.java
  76. +0 −328 AndroidDnssdDiscoveryEclipse/src/javax/jmdns/impl/DNSQuestion.java
  77. +0 −984 AndroidDnssdDiscoveryEclipse/src/javax/jmdns/impl/DNSRecord.java
  78. +0 −559 AndroidDnssdDiscoveryEclipse/src/javax/jmdns/impl/DNSStatefulObject.java
  79. +0 −352 AndroidDnssdDiscoveryEclipse/src/javax/jmdns/impl/DNSTaskStarter.java
  80. +0 −422 AndroidDnssdDiscoveryEclipse/src/javax/jmdns/impl/HostInfo.java
  81. +0 −2,215 AndroidDnssdDiscoveryEclipse/src/javax/jmdns/impl/JmDNSImpl.java
  82. +0 −585 AndroidDnssdDiscoveryEclipse/src/javax/jmdns/impl/JmmDNSImpl.java
  83. +0 −286 AndroidDnssdDiscoveryEclipse/src/javax/jmdns/impl/ListenerStatus.java
  84. +0 −114 AndroidDnssdDiscoveryEclipse/src/javax/jmdns/impl/NetworkTopologyDiscoveryImpl.java
  85. +0 −82 AndroidDnssdDiscoveryEclipse/src/javax/jmdns/impl/NetworkTopologyEventImpl.java
  86. +0 −124 AndroidDnssdDiscoveryEclipse/src/javax/jmdns/impl/ServiceEventImpl.java
  87. +0 −1,319 AndroidDnssdDiscoveryEclipse/src/javax/jmdns/impl/ServiceInfoImpl.java
  88. +0 −90 AndroidDnssdDiscoveryEclipse/src/javax/jmdns/impl/SocketListener.java
  89. +0 −60 AndroidDnssdDiscoveryEclipse/src/javax/jmdns/impl/constants/DNSConstants.java
  90. +0 −87 AndroidDnssdDiscoveryEclipse/src/javax/jmdns/impl/constants/DNSLabel.java
  91. +0 −86 AndroidDnssdDiscoveryEclipse/src/javax/jmdns/impl/constants/DNSOperationCode.java
  92. +0 −78 AndroidDnssdDiscoveryEclipse/src/javax/jmdns/impl/constants/DNSOptionCode.java
  93. +0 −138 AndroidDnssdDiscoveryEclipse/src/javax/jmdns/impl/constants/DNSRecordClass.java
  94. +0 −312 AndroidDnssdDiscoveryEclipse/src/javax/jmdns/impl/constants/DNSRecordType.java
  95. +0 −149 AndroidDnssdDiscoveryEclipse/src/javax/jmdns/impl/constants/DNSResultCode.java
  96. +0 −215 AndroidDnssdDiscoveryEclipse/src/javax/jmdns/impl/constants/DNSState.java
  97. +0 −2  AndroidDnssdDiscoveryEclipse/src/javax/jmdns/impl/constants/package-info.java
  98. +0 −2  AndroidDnssdDiscoveryEclipse/src/javax/jmdns/impl/package-info.java
  99. +0 −223 AndroidDnssdDiscoveryEclipse/src/javax/jmdns/impl/tasks/DNSTask.java
  100. +0 −61 AndroidDnssdDiscoveryEclipse/src/javax/jmdns/impl/tasks/RecordReaper.java
  101. +0 −157 AndroidDnssdDiscoveryEclipse/src/javax/jmdns/impl/tasks/Responder.java
  102. +0 −2  AndroidDnssdDiscoveryEclipse/src/javax/jmdns/impl/tasks/package-info.java
  103. +0 −116 AndroidDnssdDiscoveryEclipse/src/javax/jmdns/impl/tasks/resolver/DNSResolverTask.java
  104. +0 −102 AndroidDnssdDiscoveryEclipse/src/javax/jmdns/impl/tasks/resolver/ServiceInfoResolver.java
  105. +0 −77 AndroidDnssdDiscoveryEclipse/src/javax/jmdns/impl/tasks/resolver/ServiceResolver.java
  106. +0 −75 AndroidDnssdDiscoveryEclipse/src/javax/jmdns/impl/tasks/resolver/TypeResolver.java
  107. +0 −2  AndroidDnssdDiscoveryEclipse/src/javax/jmdns/impl/tasks/resolver/package-info.java
  108. +0 −146 AndroidDnssdDiscoveryEclipse/src/javax/jmdns/impl/tasks/state/Announcer.java
  109. +0 −143 AndroidDnssdDiscoveryEclipse/src/javax/jmdns/impl/tasks/state/Canceler.java
  110. +0 −188 AndroidDnssdDiscoveryEclipse/src/javax/jmdns/impl/tasks/state/DNSStateTask.java
  111. +0 −161 AndroidDnssdDiscoveryEclipse/src/javax/jmdns/impl/tasks/state/Prober.java
  112. +0 −141 AndroidDnssdDiscoveryEclipse/src/javax/jmdns/impl/tasks/state/Renewer.java
  113. +0 −2  AndroidDnssdDiscoveryEclipse/src/javax/jmdns/impl/tasks/state/package-info.java
  114. +0 −9 AndroidDnssdDiscoveryEclipse/src/javax/jmdns/package-info.java
  115. +30 −0 README.txt
  116. BIN  jmdns.jar
View
1  .gitignore
@@ -3,3 +3,4 @@ AndroidDnssdDiscovery/build
AndroidDnssdDiscovery/nbproject/private
AndroidDnssdDiscoveryEclipse/bin
AndroidDnssdDiscoveryEclipse/gen
+unjar
View
1  AndroidDnssdDiscovery/bundled-libs/jmdns.jar
View
1  AndroidDnssdDiscovery/nbproject/build-impl.xml
@@ -413,6 +413,7 @@ is divided into following sections:
<arg value="--output=${basedir}/${intermediate.dex}"/>
<arg value="--positions=lines"/>
<arg path="${build.classes.dir}"/>
+ <arg path="bundled-libs"/> <!-- ADDED -->
</exec>
</target>
<target depends="init,compile,-pre-pre-jar,-pre-jar" if="assets.available" name="-package-res-and-assets" unless="bootclasspath1.available">
View
2  AndroidDnssdDiscovery/nbproject/project.properties
@@ -17,7 +17,7 @@ dist.apk=${dist.dir}/AndroidDnssdDiscovery.apk
dist.dir=dist
dist.javadoc.dir=${dist.dir}/javadoc
excludes=
-file.reference.jmdns.jar=bundled-libs/jmdns.jar
+file.reference.jmdns.jar=../jmdns.jar
file.reference.projects-AndroidDnssdDiscovery=.
gen.source.dir=${src.dir}
includes=**
View
422 AndroidDnssdDiscovery/src/javax/jmdns/JmDNS.java
@@ -1,422 +0,0 @@
-// /Copyright 2003-2005 Arthur van Hoff, Rick Blair
-// Licensed under Apache License version 2.0
-// Original license LGPL
-
-package javax.jmdns;
-
-import java.io.Closeable;
-import java.io.IOException;
-import java.net.InetAddress;
-import java.util.Collection;
-import java.util.Map;
-
-import javax.jmdns.impl.JmDNSImpl;
-
-/**
- * mDNS implementation in Java.
- *
- * @author Arthur van Hoff, Rick Blair, Jeff Sonstein, Werner Randelshofer, Pierre Frisch, Scott Lewis, Scott Cytacki
- */
-public abstract class JmDNS implements Closeable {
-
- /**
- *
- */
- public static interface Delegate {
-
- /**
- * This method is called if JmDNS cannot recover from an I/O error.
- *
- * @param dns
- * target DNS
- * @param infos
- * service info registered with the DNS
- */
- public void cannotRecoverFromIOError(JmDNS dns, Collection<ServiceInfo> infos);
-
- }
-
- /**
- * The version of JmDNS.
- */
- public static final String VERSION = "3.4.0";
-
- /**
- * <p>
- * Create an instance of JmDNS.
- * </p>
- * <p>
- * <b>Note:</b> This is a convenience method. The preferred constructor is {@link #create(InetAddress, String)}.<br/>
- * Check that your platform correctly handle the default localhost IP address and the local hostname. In doubt use the explicit constructor.<br/>
- * This call is equivalent to <code>create(null, null)</code>.
- * </p>
- *
- * @see #create(InetAddress, String)
- * @return jmDNS instance
- * @exception IOException
- * if an exception occurs during the socket creation
- */
- public static JmDNS create() throws IOException {
- return new JmDNSImpl(null, null);
- }
-
- /**
- * <p>
- * Create an instance of JmDNS and bind it to a specific network interface given its IP-address.
- * </p>
- * <p>
- * <b>Note:</b> This is a convenience method. The preferred constructor is {@link #create(InetAddress, String)}.<br/>
- * Check that your platform correctly handle the default localhost IP address and the local hostname. In doubt use the explicit constructor.<br/>
- * This call is equivalent to <code>create(addr, null)</code>.
- * </p>
- *
- * @see #create(InetAddress, String)
- * @param addr
- * IP address to bind to.
- * @return jmDNS instance
- * @exception IOException
- * if an exception occurs during the socket creation
- */
- public static JmDNS create(final InetAddress addr) throws IOException {
- return new JmDNSImpl(addr, null);
- }
-
- /**
- * <p>
- * Create an instance of JmDNS.
- * </p>
- * <p>
- * <b>Note:</b> This is a convenience method. The preferred constructor is {@link #create(InetAddress, String)}.<br/>
- * Check that your platform correctly handle the default localhost IP address and the local hostname. In doubt use the explicit constructor.<br/>
- * This call is equivalent to <code>create(null, name)</code>.
- * </p>
- *
- * @see #create(InetAddress, String)
- * @param name
- * name of the newly created JmDNS
- * @return jmDNS instance
- * @exception IOException
- * if an exception occurs during the socket creation
- */
- public static JmDNS create(final String name) throws IOException {
- return new JmDNSImpl(null, name);
- }
-
- /**
- * <p>
- * Create an instance of JmDNS and bind it to a specific network interface given its IP-address.
- * </p>
- * If <code>addr</code> parameter is null this method will try to resolve to a local IP address of the machine using a network discovery:
- * <ol>
- * <li>Check the system property <code>net.mdns.interface</code></li>
- * <li>Check the JVM local host</li>
- * <li>Use the {@link NetworkTopologyDiscovery} to find a valid network interface and IP.</li>
- * <li>In the last resort bind to the loopback address. This is non functional in most cases.</li>
- * </ol>
- * If <code>name</code> parameter is null will use the hostname. The hostname is determined by the following algorithm:
- * <ol>
- * <li>Get the hostname from the InetAdress obtained before.</li>
- * <li>If the hostname is a reverse lookup default to <code>JmDNS name</code> or <code>computer</code> if null.</li>
- * <li>If the name contains <code>'.'</code> replace them by <code>'-'</code></li>
- * <li>Add <code>.local.</code> at the end of the name.</li>
- * </ol>
- * <p>
- * <b>Note:</b> If you need to use a custom {@link NetworkTopologyDiscovery} it must be setup before any call to this method. This is done by setting up a {@link NetworkTopologyDiscovery.Factory.ClassDelegate} and installing it using
- * {@link NetworkTopologyDiscovery.Factory#setClassDelegate(NetworkTopologyDiscovery.Factory.ClassDelegate)}. This must be done before creating a {@link JmDNS} or {@link JmmDNS} instance.
- * </p>
- *
- * @param addr
- * IP address to bind to.
- * @param name
- * name of the newly created JmDNS
- * @return jmDNS instance
- * @exception IOException
- * if an exception occurs during the socket creation
- */
- public static JmDNS create(final InetAddress addr, final String name) throws IOException {
- return new JmDNSImpl(addr, name);
- }
-
- /**
- * Return the name of the JmDNS instance. This is an arbitrary string that is useful for distinguishing instances.
- *
- * @return name of the JmDNS
- */
- public abstract String getName();
-
- /**
- * Return the HostName associated with this JmDNS instance. Note: May not be the same as what started. The host name is subject to negotiation.
- *
- * @return Host name
- */
- public abstract String getHostName();
-
- /**
- * Return the address of the interface to which this instance of JmDNS is bound.
- *
- * @return Internet Address
- * @exception IOException
- * if there is an error in the underlying protocol, such as a TCP error.
- */
- public abstract InetAddress getInterface() throws IOException;
-
- /**
- * Get service information. If the information is not cached, the method will block until updated information is received.
- * <p/>
- * Usage note: Do not call this method from the AWT event dispatcher thread. You will make the user interface unresponsive.
- *
- * @param type
- * fully qualified service type, such as <code>_http._tcp.local.</code> .
- * @param name
- * unqualified service name, such as <code>foobar</code> .
- * @return null if the service information cannot be obtained
- */
- public abstract ServiceInfo getServiceInfo(String type, String name);
-
- /**
- * Get service information. If the information is not cached, the method will block for the given timeout until updated information is received.
- * <p/>
- * Usage note: If you call this method from the AWT event dispatcher thread, use a small timeout, or you will make the user interface unresponsive.
- *
- * @param type
- * full qualified service type, such as <code>_http._tcp.local.</code> .
- * @param name
- * unqualified service name, such as <code>foobar</code> .
- * @param timeout
- * timeout in milliseconds. Typical timeout should be 5s.
- * @return null if the service information cannot be obtained
- */
- public abstract ServiceInfo getServiceInfo(String type, String name, long timeout);
-
- /**
- * Get service information. If the information is not cached, the method will block until updated information is received.
- * <p/>
- * Usage note: Do not call this method from the AWT event dispatcher thread. You will make the user interface unresponsive.
- *
- * @param type
- * fully qualified service type, such as <code>_http._tcp.local.</code> .
- * @param name
- * unqualified service name, such as <code>foobar</code> .
- * @param persistent
- * if <code>true</code> ServiceListener.resolveService will be called whenever new new information is received.
- * @return null if the service information cannot be obtained
- */
- public abstract ServiceInfo getServiceInfo(String type, String name, boolean persistent);
-
- /**
- * Get service information. If the information is not cached, the method will block for the given timeout until updated information is received.
- * <p/>
- * Usage note: If you call this method from the AWT event dispatcher thread, use a small timeout, or you will make the user interface unresponsive.
- *
- * @param type
- * full qualified service type, such as <code>_http._tcp.local.</code> .
- * @param name
- * unqualified service name, such as <code>foobar</code> .
- * @param timeout
- * timeout in milliseconds. Typical timeout should be 5s.
- * @param persistent
- * if <code>true</code> ServiceListener.resolveService will be called whenever new new information is received.
- * @return null if the service information cannot be obtained
- */
- public abstract ServiceInfo getServiceInfo(String type, String name, boolean persistent, long timeout);
-
- /**
- * Request service information. The information about the service is requested and the ServiceListener.resolveService method is called as soon as it is available.
- * <p/>
- * Usage note: Do not call this method from the AWT event dispatcher thread. You will make the user interface unresponsive.
- *
- * @param type
- * full qualified service type, such as <code>_http._tcp.local.</code> .
- * @param name
- * unqualified service name, such as <code>foobar</code> .
- */
- public abstract void requestServiceInfo(String type, String name);
-
- /**
- * Request service information. The information about the service is requested and the ServiceListener.resolveService method is called as soon as it is available.
- * <p/>
- * Usage note: Do not call this method from the AWT event dispatcher thread. You will make the user interface unresponsive.
- *
- * @param type
- * full qualified service type, such as <code>_http._tcp.local.</code> .
- * @param name
- * unqualified service name, such as <code>foobar</code> .
- * @param persistent
- * if <code>true</code> ServiceListener.resolveService will be called whenever new new information is received.
- */
- public abstract void requestServiceInfo(String type, String name, boolean persistent);
-
- /**
- * Request service information. The information about the service is requested and the ServiceListener.resolveService method is called as soon as it is available.
- *
- * @param type
- * full qualified service type, such as <code>_http._tcp.local.</code> .
- * @param name
- * unqualified service name, such as <code>foobar</code> .
- * @param timeout
- * timeout in milliseconds
- */
- public abstract void requestServiceInfo(String type, String name, long timeout);
-
- /**
- * Request service information. The information about the service is requested and the ServiceListener.resolveService method is called as soon as it is available.
- *
- * @param type
- * full qualified service type, such as <code>_http._tcp.local.</code> .
- * @param name
- * unqualified service name, such as <code>foobar</code> .
- * @param persistent
- * if <code>true</code> ServiceListener.resolveService will be called whenever new new information is received.
- * @param timeout
- * timeout in milliseconds
- */
- public abstract void requestServiceInfo(String type, String name, boolean persistent, long timeout);
-
- /**
- * Listen for service types.
- *
- * @param listener
- * listener for service types
- * @exception IOException
- * if there is an error in the underlying protocol, such as a TCP error.
- */
- public abstract void addServiceTypeListener(ServiceTypeListener listener) throws IOException;
-
- /**
- * Remove listener for service types.
- *
- * @param listener
- * listener for service types
- */
- public abstract void removeServiceTypeListener(ServiceTypeListener listener);
-
- /**
- * Listen for services of a given type. The type has to be a fully qualified type name such as <code>_http._tcp.local.</code>.
- *
- * @param type
- * full qualified service type, such as <code>_http._tcp.local.</code>.
- * @param listener
- * listener for service updates
- */
- public abstract void addServiceListener(String type, ServiceListener listener);
-
- /**
- * Remove listener for services of a given type.
- *
- * @param type
- * full qualified service type, such as <code>_http._tcp.local.</code>.
- * @param listener
- * listener for service updates
- */
- public abstract void removeServiceListener(String type, ServiceListener listener);
-
- /**
- * Register a service. The service is registered for access by other jmdns clients. The name of the service may be changed to make it unique.<br>
- * Note that the given {@code ServiceInfo} is bound to this {@code JmDNS} instance, and should not be reused for any other {@linkplain #registerService(ServiceInfo)}.
- *
- * @param info
- * service info to register
- * @exception IOException
- * if there is an error in the underlying protocol, such as a TCP error.
- */
- public abstract void registerService(ServiceInfo info) throws IOException;
-
- /**
- * Unregister a service. The service should have been registered.
- * <p>
- * <b>Note:</b> Unregistered services will not disappear form the list of services immediately. According to the specification, when unregistering services we send goodbye packets and then wait <b>1s</b> before purging the cache.<br/>
- * This is support for shared records that can be rescued by some other cooperation DNS.
- *
- * <pre>
- * Clients receiving a Multicast DNS Response with a TTL of zero SHOULD NOT immediately delete the record from the cache, but instead record a TTL of 1 and then delete the record one second later.
- * </pre>
- *
- * </p>
- *
- * @param info
- * service info to remove
- */
- public abstract void unregisterService(ServiceInfo info);
-
- /**
- * Unregister all services.
- */
- public abstract void unregisterAllServices();
-
- /**
- * Register a service type. If this service type was not already known, all service listeners will be notified of the new service type.
- * <p>
- * Service types are automatically registered as they are discovered.
- * </p>
- *
- * @param type
- * full qualified service type, such as <code>_http._tcp.local.</code>.
- * @return <code>true</code> if the type or subtype was added, <code>false</code> if the type was already registered.
- */
- public abstract boolean registerServiceType(String type);
-
- /**
- * List Services and serviceTypes. Debugging Only
- *
- * @deprecated since 3.2.2
- */
- @Deprecated
- public abstract void printServices();
-
- /**
- * Returns a list of service infos of the specified type.
- *
- * @param type
- * Service type name, such as <code>_http._tcp.local.</code>.
- * @return An array of service instance.
- */
- public abstract ServiceInfo[] list(String type);
-
- /**
- * Returns a list of service infos of the specified type.
- *
- * @param type
- * Service type name, such as <code>_http._tcp.local.</code>.
- * @param timeout
- * timeout in milliseconds. Typical timeout should be 6s.
- * @return An array of service instance.
- */
- public abstract ServiceInfo[] list(String type, long timeout);
-
- /**
- * Returns a list of service infos of the specified type sorted by subtype. Any service that do not register a subtype is listed in the empty subtype section.
- *
- * @param type
- * Service type name, such as <code>_http._tcp.local.</code>.
- * @return A dictionary of service info by subtypes.
- */
- public abstract Map<String, ServiceInfo[]> listBySubtype(String type);
-
- /**
- * Returns a list of service infos of the specified type sorted by subtype. Any service that do not register a subtype is listed in the empty subtype section.
- *
- * @param type
- * Service type name, such as <code>_http._tcp.local.</code>.
- * @param timeout
- * timeout in milliseconds. Typical timeout should be 6s.
- * @return A dictionary of service info by subtypes.
- */
- public abstract Map<String, ServiceInfo[]> listBySubtype(String type, long timeout);
-
- /**
- * Returns the instance delegate
- *
- * @return instance delegate
- */
- public abstract Delegate getDelegate();
-
- /**
- * Sets the instance delegate
- *
- * @param value
- * new instance delegate
- * @return previous instance delegate
- */
- public abstract Delegate setDelegate(Delegate value);
-
-}
View
396 AndroidDnssdDiscovery/src/javax/jmdns/JmmDNS.java
@@ -1,396 +0,0 @@
-/**
- *
- */
-package javax.jmdns;
-
-import java.io.Closeable;
-import java.io.IOException;
-import java.net.InetAddress;
-import java.util.Map;
-import java.util.concurrent.atomic.AtomicReference;
-
-import javax.jmdns.impl.JmmDNSImpl;
-
-/**
- * <p>
- * Java Multihomed Multicast DNS
- * </p>
- * Uses an underlying {@link JmDNS} instance for each {@link InetAddress} found on this computer.<br/>
- * This class will monitor network topology changes, and will create or destroy JmDNS instances as required. It is your responsibility to maintain services registration (hint: use a {@link NetworkTopologyListener}).<br/>
- * Most of this class methods have no notion of transaction: if an Exception is raised in the middle of execution, you may be in an incoherent state.
- * <p>
- * <b>Note:</b> This API is experimental and may change in the future please let us know what work and what does not work in you application.
- * </p>
- *
- * @author C&eacute;drik Lime, Pierre Frisch
- */
-public interface JmmDNS extends Closeable {
-
- /**
- * JmmDNS.Factory enable the creation of new instance of JmmDNS.
- */
- public static final class Factory {
- private static volatile JmmDNS _instance;
-
- /**
- * This interface defines a delegate to the EOClassDescriptionRegister class to enable subclassing.
- */
- public static interface ClassDelegate {
-
- /**
- * Allows the delegate the opportunity to construct and return a different JmmDNS.
- *
- * @return Should return a new JmmDNS.
- * @see #classDelegate()
- * @see #setClassDelegate(ClassDelegate anObject)
- */
- public JmmDNS newJmmDNS();
-
- }
-
- private static final AtomicReference<ClassDelegate> _databaseClassDelegate = new AtomicReference<ClassDelegate>();
-
- private Factory() {
- super();
- }
-
- /**
- * Assigns <code>delegate</code> as JmmDNS's class delegate. The class delegate is optional.
- *
- * @param delegate
- * The object to set as JmmDNS's class delegate.
- * @see #classDelegate()
- * @see JmmDNS.Factory.ClassDelegate
- */
- public static void setClassDelegate(ClassDelegate delegate) {
- _databaseClassDelegate.set(delegate);
- }
-
- /**
- * Returns JmmDNS's class delegate.
- *
- * @return JmmDNS's class delegate.
- * @see #setClassDelegate(ClassDelegate anObject)
- * @see JmmDNS.Factory.ClassDelegate
- */
- public static ClassDelegate classDelegate() {
- return _databaseClassDelegate.get();
- }
-
- /**
- * Returns a new instance of JmmDNS using the class delegate if it exists.
- *
- * @return new instance of JmmDNS
- */
- protected static JmmDNS newJmmDNS() {
- JmmDNS dns = null;
- ClassDelegate delegate = _databaseClassDelegate.get();
- if (delegate != null) {
- dns = delegate.newJmmDNS();
- }
- return (dns != null ? dns : new JmmDNSImpl());
- }
-
- /**
- * Return the instance of the Multihommed Multicast DNS.
- *
- * @return the JmmDNS
- */
- public static JmmDNS getInstance() {
- if (_instance == null) {
- synchronized (Factory.class) {
- if (_instance == null) {
- _instance = JmmDNS.Factory.newJmmDNS();
- }
- }
- }
- return _instance;
- }
- }
-
- /**
- * Return the names of the JmDNS instances.
- *
- * @return list of name of the JmDNS
- * @see javax.jmdns.JmDNS#getName()
- */
- public abstract String[] getNames();
-
- /**
- * Return the list HostName associated with this JmmDNS instance.
- *
- * @return list of host names
- * @see javax.jmdns.JmDNS#getHostName()
- */
- public abstract String[] getHostNames();
-
- /**
- * Return the list of addresses of the interface to which this instance of JmmDNS is bound.
- *
- * @return list of Internet Address
- * @exception IOException
- * @see javax.jmdns.JmDNS#getInterface()
- */
- public abstract InetAddress[] getInterfaces() throws IOException;
-
- /**
- * Get service information. If the information is not cached, the method will block until updated information is received on all DNS.
- * <p/>
- * Usage note: Do not call this method from the AWT event dispatcher thread. You will make the user interface unresponsive.
- *
- * @param type
- * fully qualified service type, such as <code>_http._tcp.local.</code> .
- * @param name
- * unqualified service name, such as <code>foobar</code> .
- * @return list of service info. If no service info is found the list is empty.
- * @see javax.jmdns.JmDNS#getServiceInfo(java.lang.String, java.lang.String)
- */
- public abstract ServiceInfo[] getServiceInfos(String type, String name);
-
- /**
- * Get service information. If the information is not cached, the method will block until updated information is received on all DNS.
- * <p/>
- * Usage note: If you call this method from the AWT event dispatcher thread, use a small timeout, or you will make the user interface unresponsive.
- *
- * @param type
- * full qualified service type, such as <code>_http._tcp.local.</code> .
- * @param name
- * unqualified service name, such as <code>foobar</code> .
- * @param timeout
- * timeout in milliseconds. Typical timeout should be 5s.
- * @return list of service info. If no service info is found the list is empty.
- * @see javax.jmdns.JmDNS#getServiceInfo(java.lang.String, java.lang.String, long)
- */
- public abstract ServiceInfo[] getServiceInfos(String type, String name, long timeout);
-
- /**
- * Get service information. If the information is not cached, the method will block until updated information is received on all DNS.
- * <p/>
- * Usage note: If you call this method from the AWT event dispatcher thread, use a small timeout, or you will make the user interface unresponsive.
- *
- * @param type
- * full qualified service type, such as <code>_http._tcp.local.</code> .
- * @param name
- * unqualified service name, such as <code>foobar</code> .
- * @param persistent
- * if <code>true</code> ServiceListener.resolveService will be called whenever new new information is received.
- * @return list of service info. If no service info is found the list is empty.
- * @see javax.jmdns.JmDNS#getServiceInfo(java.lang.String, java.lang.String, boolean)
- */
- public abstract ServiceInfo[] getServiceInfos(String type, String name, boolean persistent);
-
- /**
- * Get service information. If the information is not cached, the method will block until updated information is received on all DNS.
- * <p/>
- * Usage note: If you call this method from the AWT event dispatcher thread, use a small timeout, or you will make the user interface unresponsive.
- *
- * @param type
- * full qualified service type, such as <code>_http._tcp.local.</code> .
- * @param name
- * unqualified service name, such as <code>foobar</code> .
- * @param timeout
- * timeout in milliseconds. Typical timeout should be 5s.
- * @param persistent
- * if <code>true</code> ServiceListener.resolveService will be called whenever new new information is received.
- * @return list of service info. If no service info is found the list is empty.
- * @see javax.jmdns.JmDNS#getServiceInfo(java.lang.String, java.lang.String, boolean, long)
- */
- public abstract ServiceInfo[] getServiceInfos(String type, String name, boolean persistent, long timeout);
-
- /**
- * Request service information. The information about the service is requested and the ServiceListener.resolveService method is called as soon as it is available.
- *
- * @param type
- * full qualified service type, such as <code>_http._tcp.local.</code> .
- * @param name
- * unqualified service name, such as <code>foobar</code> .
- * @see javax.jmdns.JmDNS#requestServiceInfo(java.lang.String, java.lang.String)
- */
- public abstract void requestServiceInfo(String type, String name);
-
- /**
- * Request service information. The information about the service is requested and the ServiceListener.resolveService method is called as soon as it is available.
- *
- * @param type
- * full qualified service type, such as <code>_http._tcp.local.</code> .
- * @param name
- * unqualified service name, such as <code>foobar</code> .
- * @param persistent
- * if <code>true</code> ServiceListener.resolveService will be called whenever new new information is received.
- * @see javax.jmdns.JmDNS#requestServiceInfo(java.lang.String, java.lang.String, boolean)
- */
- public abstract void requestServiceInfo(String type, String name, boolean persistent);
-
- /**
- * Request service information. The information about the service is requested and the ServiceListener.resolveService method is called as soon as it is available.
- *
- * @param type
- * full qualified service type, such as <code>_http._tcp.local.</code> .
- * @param name
- * unqualified service name, such as <code>foobar</code> .
- * @param timeout
- * timeout in milliseconds
- * @see javax.jmdns.JmDNS#requestServiceInfo(java.lang.String, java.lang.String, long)
- */
- public abstract void requestServiceInfo(String type, String name, long timeout);
-
- /**
- * Request service information. The information about the service is requested and the ServiceListener.resolveService method is called as soon as it is available.
- *
- * @param type
- * full qualified service type, such as <code>_http._tcp.local.</code> .
- * @param name
- * unqualified service name, such as <code>foobar</code> .
- * @param persistent
- * if <code>true</code> ServiceListener.resolveService will be called whenever new new information is received.
- * @param timeout
- * timeout in milliseconds
- * @see javax.jmdns.JmDNS#requestServiceInfo(java.lang.String, java.lang.String, boolean, long)
- */
- public abstract void requestServiceInfo(String type, String name, boolean persistent, long timeout);
-
- /**
- * Listen for service types.
- *
- * @param listener
- * listener for service types
- * @exception IOException
- * @see javax.jmdns.JmDNS#addServiceTypeListener(javax.jmdns.ServiceTypeListener)
- */
- public abstract void addServiceTypeListener(ServiceTypeListener listener) throws IOException;
-
- /**
- * Remove listener for service types.
- *
- * @param listener
- * listener for service types
- * @see javax.jmdns.JmDNS#removeServiceTypeListener(javax.jmdns.ServiceTypeListener)
- */
- public abstract void removeServiceTypeListener(ServiceTypeListener listener);
-
- /**
- * Listen for services of a given type. The type has to be a fully qualified type name such as <code>_http._tcp.local.</code>.
- *
- * @param type
- * full qualified service type, such as <code>_http._tcp.local.</code>.
- * @param listener
- * listener for service updates
- * @see javax.jmdns.JmDNS#addServiceListener(java.lang.String, javax.jmdns.ServiceListener)
- */
- public abstract void addServiceListener(String type, ServiceListener listener);
-
- /**
- * Remove listener for services of a given type.
- *
- * @param type
- * full qualified service type, such as <code>_http._tcp.local.</code>.
- * @param listener
- * listener for service updates
- * @see javax.jmdns.JmDNS#removeServiceListener(java.lang.String, javax.jmdns.ServiceListener)
- */
- public abstract void removeServiceListener(String type, ServiceListener listener);
-
- /**
- * Register a service. The service is registered for access by other jmdns clients. The name of the service may be changed to make it unique.<br>
- * <b>Note</b> the Service info is cloned for each network interface.
- *
- * @param info
- * service info to register
- * @exception IOException
- * @see javax.jmdns.JmDNS#registerService(javax.jmdns.ServiceInfo)
- */
- public abstract void registerService(ServiceInfo info) throws IOException;
-
- /**
- * Unregister a service. The service should have been registered.
- *
- * @param info
- * service info to remove
- * @see javax.jmdns.JmDNS#unregisterService(javax.jmdns.ServiceInfo)
- */
- public abstract void unregisterService(ServiceInfo info);
-
- /**
- * Unregister all services.
- *
- * @see javax.jmdns.JmDNS#unregisterAllServices()
- */
- public abstract void unregisterAllServices();
-
- /**
- * Register a service type. If this service type was not already known, all service listeners will be notified of the new service type. Service types are automatically registered as they are discovered.
- *
- * @param type
- * full qualified service type, such as <code>_http._tcp.local.</code>.
- * @see javax.jmdns.JmDNS#registerServiceType(java.lang.String)
- */
- public abstract void registerServiceType(String type);
-
- /**
- * Returns a list of service infos of the specified type.
- *
- * @param type
- * Service type name, such as <code>_http._tcp.local.</code>.
- * @return An array of service instance.
- * @see javax.jmdns.JmDNS#list(java.lang.String)
- */
- public abstract ServiceInfo[] list(String type);
-
- /**
- * Returns a list of service infos of the specified type.
- *
- * @param type
- * Service type name, such as <code>_http._tcp.local.</code>.
- * @param timeout
- * timeout in milliseconds. Typical timeout should be 6s.
- * @return An array of service instance.
- * @see javax.jmdns.JmDNS#list(java.lang.String, long)
- */
- public abstract ServiceInfo[] list(String type, long timeout);
-
- /**
- * Returns a list of service infos of the specified type sorted by subtype. Any service that do not register a subtype is listed in the empty subtype section.
- *
- * @param type
- * Service type name, such as <code>_http._tcp.local.</code>.
- * @return A dictionary of service info by subtypes.
- * @see javax.jmdns.JmDNS#listBySubtype(java.lang.String)
- */
- public abstract Map<String, ServiceInfo[]> listBySubtype(String type);
-
- /**
- * Returns a list of service infos of the specified type sorted by subtype. Any service that do not register a subtype is listed in the empty subtype section.
- *
- * @param type
- * Service type name, such as <code>_http._tcp.local.</code>.
- * @param timeout
- * timeout in milliseconds. Typical timeout should be 6s.
- * @return A dictionary of service info by subtypes.
- * @see javax.jmdns.JmDNS#listBySubtype(java.lang.String, long)
- */
- public abstract Map<String, ServiceInfo[]> listBySubtype(String type, long timeout);
-
- /**
- * Listen to network changes.
- *
- * @param listener
- * listener for network changes
- */
- public abstract void addNetworkTopologyListener(NetworkTopologyListener listener);
-
- /**
- * Remove listener for network changes.
- *
- * @param listener
- * listener for network changes
- */
- public abstract void removeNetworkTopologyListener(NetworkTopologyListener listener);
-
- /**
- * Returns list of network change listeners
- *
- * @return list of network change listeners
- */
- public abstract NetworkTopologyListener[] networkListeners();
-
-}
View
150 AndroidDnssdDiscovery/src/javax/jmdns/NetworkTopologyDiscovery.java
@@ -1,150 +0,0 @@
-package javax.jmdns;
-
-import java.net.InetAddress;
-import java.net.NetworkInterface;
-import java.util.concurrent.atomic.AtomicReference;
-
-import javax.jmdns.impl.NetworkTopologyDiscoveryImpl;
-
-/**
- * This class is used to resolve the list of Internet address to use when attaching JmDNS to the network.
- * <p>
- * To create you own filtering class for Internet Addresses you will need to implement the class and the factory delegate. These must be called before any other call to JmDNS.
- *
- * <pre>
- * public static class MyNetworkTopologyDiscovery implements NetworkTopologyDiscovery {
- *
- * &#064;Override
- * public InetAddress[] getInetAddresses() {
- * // TODO Auto-generated method stub
- * return null;
- * }
- *
- * &#064;Override
- * public boolean useInetAddress(NetworkInterface networkInterface, InetAddress interfaceAddress) {
- * // TODO Auto-generated method stub
- * return false;
- * }
- *
- * }
- *
- * public static class MyClass implements NetworkTopologyDiscovery.Factory.ClassDelegate {
- * public MyClass() {
- * super();
- * NetworkTopologyDiscovery.Factory.setClassDelegate(this);
- *
- * // Access JmDNS or JmmDNS
- * }
- *
- * &#064;Override
- * public NetworkTopologyDiscovery newNetworkTopologyDiscovery() {
- * return new MyNetworkTopologyDiscovery();
- * }
- *
- * }
- * </pre>
- *
- * </p>
- *
- * @author Pierre Frisch
- */
-public interface NetworkTopologyDiscovery {
-
- /**
- * NetworkTopologyDiscovery.Factory enable the creation of new instance of NetworkTopologyDiscovery.
- */
- public static final class Factory {
- private static volatile NetworkTopologyDiscovery _instance;
-
- /**
- * This interface defines a delegate to the NetworkTopologyDiscovery.Factory class to enable subclassing.
- */
- public static interface ClassDelegate {
-
- /**
- * Allows the delegate the opportunity to construct and return a different NetworkTopologyDiscovery.
- *
- * @return Should return a new NetworkTopologyDiscovery Object.
- * @see #classDelegate()
- * @see #setClassDelegate(ClassDelegate anObject)
- */
- public NetworkTopologyDiscovery newNetworkTopologyDiscovery();
- }
-
- private static final AtomicReference<Factory.ClassDelegate> _databaseClassDelegate = new AtomicReference<Factory.ClassDelegate>();
-
- private Factory() {
- super();
- }
-
- /**
- * Assigns <code>delegate</code> as NetworkTopologyDiscovery's class delegate. The class delegate is optional.
- *
- * @param delegate
- * The object to set as NetworkTopologyDiscovery's class delegate.
- * @see #classDelegate()
- * @see JmmDNS.Factory.ClassDelegate
- */
- public static void setClassDelegate(Factory.ClassDelegate delegate) {
- _databaseClassDelegate.set(delegate);
- }
-
- /**
- * Returns NetworkTopologyDiscovery's class delegate.
- *
- * @return NetworkTopologyDiscovery's class delegate.
- * @see #setClassDelegate(ClassDelegate anObject)
- * @see JmmDNS.Factory.ClassDelegate
- */
- public static Factory.ClassDelegate classDelegate() {
- return _databaseClassDelegate.get();
- }
-
- /**
- * Returns a new instance of NetworkTopologyDiscovery using the class delegate if it exists.
- *
- * @return new instance of NetworkTopologyDiscovery
- */
- protected static NetworkTopologyDiscovery newNetworkTopologyDiscovery() {
- NetworkTopologyDiscovery instance = null;
- Factory.ClassDelegate delegate = _databaseClassDelegate.get();
- if (delegate != null) {
- instance = delegate.newNetworkTopologyDiscovery();
- }
- return (instance != null ? instance : new NetworkTopologyDiscoveryImpl());
- }
-
- /**
- * Return the instance of the Multihommed Multicast DNS.
- *
- * @return the JmmDNS
- */
- public static NetworkTopologyDiscovery getInstance() {
- if (_instance == null) {
- synchronized (NetworkTopologyDiscovery.Factory.class) {
- if (_instance == null) {
- _instance = NetworkTopologyDiscovery.Factory.newNetworkTopologyDiscovery();
- }
- }
- }
- return _instance;
- }
- }
-
- /**
- * Get all local Internet Addresses for the machine.
- *
- * @return Set of InetAddress
- */
- public abstract InetAddress[] getInetAddresses();
-
- /**
- * Check if a given InetAddress should be used for mDNS
- *
- * @param networkInterface
- * @param interfaceAddress
- * @return <code>true</code> is the address is to be used, <code>false</code> otherwise.
- */
- public boolean useInetAddress(NetworkInterface networkInterface, InetAddress interfaceAddress);
-
-}
View
45 AndroidDnssdDiscovery/src/javax/jmdns/NetworkTopologyEvent.java
@@ -1,45 +0,0 @@
-/**
- *
- */
-package javax.jmdns;
-
-import java.net.InetAddress;
-import java.util.EventObject;
-
-/**
- * @author C&eacute;drik Lime, Pierre Frisch
- */
-public abstract class NetworkTopologyEvent extends EventObject {
-
- /**
- *
- */
- private static final long serialVersionUID = -8630033521752540987L;
-
- /**
- * Constructs a Service Event.
- *
- * @param eventSource
- * The DNS on which the Event initially occurred.
- * @exception IllegalArgumentException
- * if source is null.
- */
- protected NetworkTopologyEvent(final Object eventSource) {
- super(eventSource);
- }
-
- /**
- * Returns the JmDNS instance associated with the event or null if it is a generic event.
- *
- * @return JmDNS instance
- */
- public abstract JmDNS getDNS();
-
- /**
- * The Internet address affected by this event.
- *
- * @return InetAddress
- */
- public abstract InetAddress getInetAddress();
-
-}
View
30 AndroidDnssdDiscovery/src/javax/jmdns/NetworkTopologyListener.java
@@ -1,30 +0,0 @@
-/**
- *
- */
-package javax.jmdns;
-
-import java.util.EventListener;
-
-/**
- * Listener for network topology updates.
- *
- * @author C&eacute;drik Lime, Pierre Frisch
- */
-public interface NetworkTopologyListener extends EventListener {
- /**
- * A network address has been added.<br/>
- *
- * @param event
- * The NetworkTopologyEvent providing the name and fully qualified type of the service.
- */
- void inetAddressAdded(NetworkTopologyEvent event);
-
- /**
- * A network address has been removed.
- *
- * @param event
- * The NetworkTopologyEvent providing the name and fully qualified type of the service.
- */
- void inetAddressRemoved(NetworkTopologyEvent event);
-
-}
View
74 AndroidDnssdDiscovery/src/javax/jmdns/ServiceEvent.java
@@ -1,74 +0,0 @@
-// Copyright 2003-2005 Arthur van Hoff, Rick Blair
-// Licensed under Apache License version 2.0
-// Original license LGPL
-
-package javax.jmdns;
-
-import java.util.EventObject;
-
-/**
- *
- */
-public abstract class ServiceEvent extends EventObject implements Cloneable {
-
- /**
- *
- */
- private static final long serialVersionUID = -8558445644541006271L;
-
- /**
- * Constructs a Service Event.
- *
- * @param eventSource
- * The object on which the Event initially occurred.
- * @exception IllegalArgumentException
- * if source is null.
- */
- public ServiceEvent(final Object eventSource) {
- super(eventSource);
- }
-
- /**
- * Returns the JmDNS instance which originated the event.
- *
- * @return JmDNS instance
- */
- public abstract JmDNS getDNS();
-
- /**
- * Returns the fully qualified type of the service.
- *
- * @return type of the service.
- */
- public abstract String getType();
-
- /**
- * Returns the instance name of the service. Always returns null, if the event is sent to a service type listener.
- *
- * @return name of the service
- */
- public abstract String getName();
-
- /**
- * Returns the service info record, or null if the service could not be resolved. Always returns null, if the event is sent to a service type listener.
- *
- * @return service info record
- * @see javax.jmdns.ServiceEvent#getInfo()
- */
- public abstract ServiceInfo getInfo();
-
- /*
- * (non-Javadoc)
- * @see java.lang.Object#clone()
- */
- @Override
- public ServiceEvent clone() {
- try {
- return (ServiceEvent) super.clone();
- } catch (CloneNotSupportedException exception) {
- // clone is supported
- return null;
- }
- }
-
-}
View
727 AndroidDnssdDiscovery/src/javax/jmdns/ServiceInfo.java
@@ -1,727 +0,0 @@
-// Copyright 2003-2005 Arthur van Hoff, Rick Blair
-// Licensed under Apache License version 2.0
-// Original license LGPL
-package javax.jmdns;
-
-import java.net.Inet4Address;
-import java.net.Inet6Address;
-import java.net.InetAddress;
-import java.util.Enumeration;
-import java.util.Map;
-
-import javax.jmdns.impl.ServiceInfoImpl;
-
-/**
- * <p>
- * The fully qualified service name is build using up to 5 components with the following structure:
- *
- * <pre>
- * &lt;app&gt;.&lt;protocol&gt;.&lt;servicedomain&gt;.&lt;parentdomain&gt;.<br/>
- * &lt;Instance&gt;.&lt;app&gt;.&lt;protocol&gt;.&lt;servicedomain&gt;.&lt;parentdomain&gt;.<br/>
- * &lt;sub&gt;._sub.&lt;app&gt;.&lt;protocol&gt;.&lt;servicedomain&gt;.&lt;parentdomain&gt;.
- * </pre>
- *
- * <ol>
- * <li>&lt;servicedomain&gt;.&lt;parentdomain&gt;: This is the domain scope of the service typically "local.", but this can also be something similar to "in-addr.arpa." or "ip6.arpa."</li>
- * <li>&lt;protocol&gt;: This is either "_tcp" or "_udp"</li>
- * <li>&lt;app&gt;: This define the application protocol. Typical example are "_http", "_ftp", etc.</li>
- * <li>&lt;Instance&gt;: This is the service name</li>
- * <li>&lt;sub&gt;: This is the subtype for the application protocol</li>
- * </ol>
- * </p>
- */
-public abstract class ServiceInfo implements Cloneable {
-
- /**
- * This is the no value text byte. According top the specification it is one byte with 0 value.
- */
- public static final byte[] NO_VALUE = new byte[0];
-
- /**
- * Fields for the fully qualified map.
- */
- public enum Fields {
- /**
- * Domain Field.
- */
- Domain,
- /**
- * Protocol Field.
- */
- Protocol,
- /**
- * Application Field.
- */
- Application,
- /**
- * Instance Field.
- */
- Instance,
- /**
- * Subtype Field.
- */
- Subtype
- }
-
- /**
- * Construct a service description for registering with JmDNS.
- *
- * @param type
- * fully qualified service type name, such as <code>_http._tcp.local.</code>.
- * @param name
- * unqualified service instance name, such as <code>foobar</code>
- * @param port
- * the local port on which the service runs
- * @param text
- * string describing the service
- * @return new service info
- */
- public static ServiceInfo create(final String type, final String name, final int port, final String text) {
- return new ServiceInfoImpl(type, name, "", port, 0, 0, false, text);
- }
-
- /**
- * Construct a service description for registering with JmDNS.
- *
- * @param type
- * fully qualified service type name, such as <code>_http._tcp.local.</code>.
- * @param name
- * unqualified service instance name, such as <code>foobar</code>
- * @param subtype
- * service subtype see draft-cheshire-dnsext-dns-sd-06.txt chapter 7.1 Selective Instance Enumeration
- * @param port
- * the local port on which the service runs
- * @param text
- * string describing the service
- * @return new service info
- */
- public static ServiceInfo create(final String type, final String name, final String subtype, final int port, final String text) {
- return new ServiceInfoImpl(type, name, subtype, port, 0, 0, false, text);
- }
-
- /**
- * Construct a service description for registering with JmDNS.
- *
- * @param type
- * fully qualified service type name, such as <code>_http._tcp.local.</code>.
- * @param name
- * unqualified service instance name, such as <code>foobar</code>
- * @param port
- * the local port on which the service runs
- * @param weight
- * weight of the service
- * @param priority
- * priority of the service
- * @param text
- * string describing the service
- * @return new service info
- */
- public static ServiceInfo create(final String type, final String name, final int port, final int weight, final int priority, final String text) {
- return new ServiceInfoImpl(type, name, "", port, weight, priority, false, text);
- }
-
- /**
- * Construct a service description for registering with JmDNS.
- *
- * @param type
- * fully qualified service type name, such as <code>_http._tcp.local.</code>.
- * @param name
- * unqualified service instance name, such as <code>foobar</code>
- * @param subtype
- * service subtype see draft-cheshire-dnsext-dns-sd-06.txt chapter 7.1 Selective Instance Enumeration
- * @param port
- * the local port on which the service runs
- * @param weight
- * weight of the service
- * @param priority
- * priority of the service
- * @param text
- * string describing the service
- * @return new service info
- */
- public static ServiceInfo create(final String type, final String name, final String subtype, final int port, final int weight, final int priority, final String text) {
- return new ServiceInfoImpl(type, name, subtype, port, weight, priority, false, text);
- }
-
- /**
- * Construct a service description for registering with JmDNS. The properties hashtable must map property names to either Strings or byte arrays describing the property values.
- *
- * @param type
- * fully qualified service type name, such as <code>_http._tcp.local.</code>.
- * @param name
- * unqualified service instance name, such as <code>foobar</code>
- * @param port
- * the local port on which the service runs
- * @param weight
- * weight of the service
- * @param priority
- * priority of the service
- * @param props
- * properties describing the service
- * @return new service info
- */
- public static ServiceInfo create(final String type, final String name, final int port, final int weight, final int priority, final Map<String, ?> props) {
- return new ServiceInfoImpl(type, name, "", port, weight, priority, false, props);
- }
-
- /**
- * Construct a service description for registering with JmDNS. The properties hashtable must map property names to either Strings or byte arrays describing the property values.
- *
- * @param type
- * fully qualified service type name, such as <code>_http._tcp.local.</code>.
- * @param name
- * unqualified service instance name, such as <code>foobar</code>
- * @param subtype
- * service subtype see draft-cheshire-dnsext-dns-sd-06.txt chapter 7.1 Selective Instance Enumeration
- * @param port
- * the local port on which the service runs
- * @param weight
- * weight of the service
- * @param priority
- * priority of the service
- * @param props
- * properties describing the service
- * @return new service info
- */
- public static ServiceInfo create(final String type, final String name, final String subtype, final int port, final int weight, final int priority, final Map<String, ?> props) {
- return new ServiceInfoImpl(type, name, subtype, port, weight, priority, false, props);
- }
-
- /**
- * Construct a service description for registering with JmDNS.
- *
- * @param type
- * fully qualified service type name, such as <code>_http._tcp.local.</code>.
- * @param name
- * unqualified service instance name, such as <code>foobar</code>
- * @param port
- * the local port on which the service runs
- * @param weight
- * weight of the service
- * @param priority
- * priority of the service
- * @param text
- * bytes describing the service
- * @return new service info
- */
- public static ServiceInfo create(final String type, final String name, final int port, final int weight, final int priority, final byte[] text) {
- return new ServiceInfoImpl(type, name, "", port, weight, priority, false, text);
- }
-
- /**
- * Construct a service description for registering with JmDNS.
- *
- * @param type
- * fully qualified service type name, such as <code>_http._tcp.local.</code>.
- * @param name
- * unqualified service instance name, such as <code>foobar</code>
- * @param subtype
- * service subtype see draft-cheshire-dnsext-dns-sd-06.txt chapter 7.1 Selective Instance Enumeration
- * @param port
- * the local port on which the service runs
- * @param weight
- * weight of the service
- * @param priority
- * priority of the service
- * @param text
- * bytes describing the service
- * @return new service info
- */
- public static ServiceInfo create(final String type, final String name, final String subtype, final int port, final int weight, final int priority, final byte[] text) {
- return new ServiceInfoImpl(type, name, subtype, port, weight, priority, false, text);
- }
-
- /**
- * Construct a service description for registering with JmDNS.
- *
- * @param type
- * fully qualified service type name, such as <code>_http._tcp.local.</code>.
- * @param name
- * unqualified service instance name, such as <code>foobar</code>
- * @param port
- * the local port on which the service runs
- * @param weight
- * weight of the service
- * @param priority
- * priority of the service
- * @param persistent
- * if <code>true</code> ServiceListener.resolveService will be called whenever new new information is received.
- * @param text
- * string describing the service
- * @return new service info
- */
- public static ServiceInfo create(final String type, final String name, final int port, final int weight, final int priority, final boolean persistent, final String text) {
- return new ServiceInfoImpl(type, name, "", port, weight, priority, persistent, text);
- }
-
- /**
- * Construct a service description for registering with JmDNS.
- *
- * @param type
- * fully qualified service type name, such as <code>_http._tcp.local.</code>.
- * @param name
- * unqualified service instance name, such as <code>foobar</code>
- * @param subtype
- * service subtype see draft-cheshire-dnsext-dns-sd-06.txt chapter 7.1 Selective Instance Enumeration
- * @param port
- * the local port on which the service runs
- * @param weight
- * weight of the service
- * @param priority
- * priority of the service
- * @param persistent
- * if <code>true</code> ServiceListener.resolveService will be called whenever new new information is received.
- * @param text
- * string describing the service
- * @return new service info
- */
- public static ServiceInfo create(final String type, final String name, final String subtype, final int port, final int weight, final int priority, final boolean persistent, final String text) {
- return new ServiceInfoImpl(type, name, subtype, port, weight, priority, persistent, text);
- }
-
- /**
- * Construct a service description for registering with JmDNS. The properties hashtable must map property names to either Strings or byte arrays describing the property values.
- *
- * @param type
- * fully qualified service type name, such as <code>_http._tcp.local.</code>.
- * @param name
- * unqualified service instance name, such as <code>foobar</code>
- * @param port
- * the local port on which the service runs
- * @param weight
- * weight of the service
- * @param priority
- * priority of the service
- * @param persistent
- * if <code>true</code> ServiceListener.resolveService will be called whenever new new information is received.
- * @param props
- * properties describing the service
- * @return new service info
- */
- public static ServiceInfo create(final String type, final String name, final int port, final int weight, final int priority, final boolean persistent, final Map<String, ?> props) {
- return new ServiceInfoImpl(type, name, "", port, weight, priority, persistent, props);
- }
-
- /**
- * Construct a service description for registering with JmDNS. The properties hashtable must map property names to either Strings or byte arrays describing the property values.
- *
- * @param type
- * fully qualified service type name, such as <code>_http._tcp.local.</code>.
- * @param name
- * unqualified service instance name, such as <code>foobar</code>
- * @param subtype
- * service subtype see draft-cheshire-dnsext-dns-sd-06.txt chapter 7.1 Selective Instance Enumeration
- * @param port
- * the local port on which the service runs
- * @param weight
- * weight of the service
- * @param priority
- * priority of the service
- * @param persistent
- * if <code>true</code> ServiceListener.resolveService will be called whenever new new information is received.
- * @param props
- * properties describing the service
- * @return new service info
- */
- public static ServiceInfo create(final String type, final String name, final String subtype, final int port, final int weight, final int priority, final boolean persistent, final Map<String, ?> props) {
- return new ServiceInfoImpl(type, name, subtype, port, weight, priority, persistent, props);
- }
-
- /**
- * Construct a service description for registering with JmDNS.
- *
- * @param type
- * fully qualified service type name, such as <code>_http._tcp.local.</code>.
- * @param name
- * unqualified service instance name, such as <code>foobar</code>
- * @param port
- * the local port on which the service runs
- * @param weight
- * weight of the service
- * @param priority
- * priority of the service
- * @param persistent
- * if <code>true</code> ServiceListener.resolveService will be called whenever new new information is received.
- * @param text
- * bytes describing the service
- * @return new service info
- */
- public static ServiceInfo create(final String type, final String name, final int port, final int weight, final int priority, final boolean persistent, final byte[] text) {
- return new ServiceInfoImpl(type, name, "", port, weight, priority, persistent, text);
- }
-
- /**
- * Construct a service description for registering with JmDNS.
- *
- * @param type
- * fully qualified service type name, such as <code>_http._tcp.local.</code>.
- * @param name
- * unqualified service instance name, such as <code>foobar</code>
- * @param subtype
- * service subtype see draft-cheshire-dnsext-dns-sd-06.txt chapter 7.1 Selective Instance Enumeration
- * @param port
- * the local port on which the service runs
- * @param weight
- * weight of the service
- * @param priority
- * priority of the service
- * @param persistent
- * if <code>true</code> ServiceListener.resolveService will be called whenever new new information is received.
- * @param text
- * bytes describing the service
- * @return new service info
- */
- public static ServiceInfo create(final String type, final String name, final String subtype, final int port, final int weight, final int priority, final boolean persistent, final byte[] text) {
- return new ServiceInfoImpl(type, name, subtype, port, weight, priority, persistent, text);
- }
-
- /**
- * Construct a service description for registering with JmDNS. The properties hashtable must map property names to either Strings or byte arrays describing the property values.
- *
- * @param qualifiedNameMap
- * dictionary of values to build the fully qualified service name. Mandatory keys are Application and Instance. The Domain default is local, the Protocol default is tcp and the subtype default is none.
- * @param port
- * the local port on which the service runs
- * @param weight
- * weight of the service
- * @param priority
- * priority of the service
- * @param persistent
- * if <code>true</code> ServiceListener.resolveService will be called whenever new new information is received.
- * @param props
- * properties describing the service
- * @return new service info
- */
- public static ServiceInfo create(final Map<Fields, String> qualifiedNameMap, final int port, final int weight, final int priority, final boolean persistent, final Map<String, ?> props) {
- return new ServiceInfoImpl(qualifiedNameMap, port, weight, priority, persistent, props);
- }
-
- /**
- * Returns true if the service info is filled with data.
- *
- * @return <code>true</code> if the service info has data, <code>false</code> otherwise.
- */
- public abstract boolean hasData();
-
- /**
- * Fully qualified service type name, such as <code>_http._tcp.local.</code>
- *
- * @return service type name
- */
- public abstract String getType();
-
- /**
- * Fully qualified service type name with the subtype if appropriate, such as <code>_printer._sub._http._tcp.local.</code>
- *
- * @return service type name
- */
- public abstract String getTypeWithSubtype();
-
- /**
- * Unqualified service instance name, such as <code>foobar</code> .
- *
- * @return service name
- */
- public abstract String getName();
-
- /**
- * The key is used to retrieve service info in hash tables.<br/>
- * The key is the lower case qualified name.
- *
- * @return the key
- */
- public abstract String getKey();
-
- /**
- * Fully qualified service name, such as <code>foobar._http._tcp.local.</code> .
- *
- * @return qualified service name
- */
- public abstract String getQualifiedName();
-
- /**
- * Get the name of the server.
- *
- * @return server name
- */
- public abstract String getServer();
-
- /**
- * Returns the host IP address string in textual presentation.<br/>
- * <b>Note:</b> This can be either an IPv4 or an IPv6 representation.
- *
- * @return the host raw IP address in a string format.
- * @deprecated since 3.2.3
- * @see #getHostAddresses()
- */
- @Deprecated
- public abstract String getHostAddress();
-
- /**
- * Returns the host IP addresses string in textual presentation.
- *
- * @return list of host raw IP address in a string format.
- */
- public abstract String[] getHostAddresses();
-
- /**
- * Get the host address of the service.<br/>
- *
- * @return host Internet address
- * @deprecated since 3.1.8
- * @see #getInetAddresses()
- */
- @Deprecated
- public abstract InetAddress getAddress();
-
- /**
- * Get the InetAddress of the service. This will return the IPv4 if it exist, otherwise it return the IPv6 if set.<br/>
- * <b>Note:</b> This return null if the service IP address cannot be resolved.
- *
- * @return Internet address
- * @deprecated since 3.2.3
- * @see #getInetAddresses()
- */
- @Deprecated
- public abstract InetAddress getInetAddress();
-
- /**
- * Get the IPv4 InetAddress of the service.<br/>
- * <b>Note:</b> This return null if the service IPv4 address cannot be resolved.
- *
- * @return Internet address
- * @deprecated since 3.2.3
- * @see #getInet4Addresses()
- */
- @Deprecated
- public abstract Inet4Address getInet4Address();
-
- /**
- * Get the IPv6 InetAddress of the service.<br/>
- * <b>Note:</b> This return null if the service IPv6 address cannot be resolved.
- *
- * @return Internet address
- * @deprecated since 3.2.3
- * @see #getInet6Addresses()
- */
- @Deprecated
- public abstract Inet6Address getInet6Address();
-
- /**
- * Returns a list of all InetAddresses that can be used for this service.
- * <p>
- * In a multi-homed environment service info can be associated with more than one address.
- * </p>
- *
- * @return list of InetAddress objects
- */
- public abstract InetAddress[] getInetAddresses();
-
- /**
- * Returns a list of all IPv4 InetAddresses that can be used for this service.
- * <p>
- * In a multi-homed environment service info can be associated with more than one address.
- * </p>
- *
- * @return list of InetAddress objects
- */
- public abstract Inet4Address[] getInet4Addresses();
-
- /**
- * Returns a list of all IPv6 InetAddresses that can be used for this service.
- * <p>
- * In a multi-homed environment service info can be associated with more than one address.
- * </p>
- *
- * @return list of InetAddress objects
- */
- public abstract Inet6Address[] getInet6Addresses();
-
- /**
- * Get the port for the service.
- *
- * @return service port
- */
- public abstract int getPort();
-
- /**
- * Get the priority of the service.
- *
- * @return service priority
- */
- public abstract int getPriority();
-
- /**
- * Get the weight of the service.
- *
- * @return service weight
- */
- public abstract int getWeight();
-
- /**
- * Get the text for the service as raw bytes.
- *
- * @return raw service text
- */
- public abstract byte[] getTextBytes();
-
- /**
- * Get the text for the service. This will interpret the text bytes as a UTF8 encoded string. Will return null if the bytes are not a valid UTF8 encoded string.<br/>
- * <b>Note:</b> Do not use. This method make the assumption that the TXT record is one string. This is false. The TXT record is a series of key value pairs.
- *
- * @return service text
- * @see #getPropertyNames()
- * @see #getPropertyBytes(String)
- * @see #getPropertyString(String)
- * @deprecated since 3.1.7
- */
- @Deprecated
- public abstract String getTextString();
-
- /**
- * Get the URL for this service. An http URL is created by combining the address, port, and path properties.
- *
- * @return service URL
- * @deprecated since 3.2.3
- * @see #getURLs()
- */
- @Deprecated
- public abstract String getURL();
-
- /**
- * Get the list of URL for this service. An http URL is created by combining the address, port, and path properties.
- *
- * @return list of service URL
- */
- public abstract String[] getURLs();
-
- /**
- * Get the URL for this service. An URL is created by combining the protocol, address, port, and path properties.
- *
- * @param protocol
- * requested protocol
- * @return service URL
- * @deprecated since 3.2.3
- * @see #getURLs()
- */
- @Deprecated
- public abstract String getURL(String protocol);
-
- /**
- * Get the list of URL for this service. An URL is created by combining the protocol, address, port, and path properties.
- *
- * @param protocol
- * requested protocol
- * @return list of service URL
- */
- public abstract String[] getURLs(String protocol);
-
- /**
- * Get a property of the service. This involves decoding the text bytes into a property list. Returns null if the property is not found or the text data could not be decoded correctly.
- *
- * @param name
- * property name
- * @return raw property text
- */
- public abstract byte[] getPropertyBytes(final String name);
-
- /**
- * Get a property of the service. This involves decoding the text bytes into a property list. Returns null if the property is not found, the text data could not be decoded correctly, or the resulting bytes are not a valid UTF8 string.
- *
- * @param name
- * property name
- * @return property text
- */
- public abstract String getPropertyString(final String name);
-
- /**
- * Enumeration of the property names.
- *
- * @return property name enumeration
- */
- public abstract Enumeration<String> getPropertyNames();
-
- /**
- * Returns a description of the service info suitable for printing.
- *
- * @return service info description
- */
- public abstract String getNiceTextString();
-
- /**
- * Set the text for the service. Setting the text will fore a re-announce of the service.
- *
- * @param text
- * the raw byte representation of the text field.
- * @exception IllegalStateException
- * if attempting to set the text for a non persistent service info.
- */
- public abstract void setText(final byte[] text) throws IllegalStateException;
-
- /**
- * Set the text for the service. Setting the text will fore a re-announce of the service.
- *
- * @param props
- * a key=value map that will be encoded into raw bytes.
- * @exception IllegalStateException
- * if attempting to set the text for a non persistent service info.
- */
- public abstract void setText(final Map<String, ?> props) throws IllegalStateException;
-
- /**
- * Returns <code>true</code> if ServiceListener.resolveService will be called whenever new new information is received.
- *
- * @return the persistent
- */
- public abstract boolean isPersistent();
-
- /**
- * Returns the domain of the service info suitable for printing.
- *
- * @return service domain
- */
- public abstract String getDomain();
-
- /**
- * Returns the protocol of the service info suitable for printing.
- *
- * @return service protocol
- */
- public abstract String getProtocol();
-
- /**
- * Returns the application of the service info suitable for printing.
- *
- * @return service application
- */
- public abstract String getApplication();
-
- /**
- * Returns the sub type of the service info suitable for printing.
- *
- * @return service sub type
- */
- public abstract String getSubtype();
-
- /**
- * Returns a dictionary of the fully qualified name component of this service.
- *
- * @return dictionary of the fully qualified name components
- */
- public abstract Map<Fields, String> getQualifiedNameMap();
-
- /*
- * (non-Javadoc)
- * @see java.lang.Object#clone()
- */
- @Override
- public ServiceInfo clone() {
- try {
- return (ServiceInfo) super.clone();
- } catch (CloneNotSupportedException exception) {
- // clone is supported
- return null;
- }
- }
-
-}
View
49 AndroidDnssdDiscovery/src/javax/jmdns/ServiceListener.java
@@ -1,49 +0,0 @@
-// Copyright 2003-2005 Arthur van Hoff, Rick Blair
-// Licensed under Apache License version 2.0
-// Original license LGPL
-
-package javax.jmdns;
-
-import java.util.EventListener;
-
-/**
- * Listener for service updates.
- *
- * @author Arthur van Hoff, Werner Randelshofer, Pierre Frisch
- */
-public interface ServiceListener extends EventListener {
- /**
- * A service has been added.<br/>
- * <b>Note:</b>This event is only the service added event. The service info associated with this event does not include resolution information.<br/>
- * To get the full resolved information you need to listen to {@link #serviceResolved(ServiceEvent)} or call {@link JmDNS#getServiceInfo(String, String, long)}
- *
- * <pre>
- * ServiceInfo info = event.getDNS().getServiceInfo(event.getType(), event.getName())
- * </pre>
- * <p>
- * Please note that service resolution may take a few second to resolve.
- * </p>
- *
- * @param event
- * The ServiceEvent providing the name and fully qualified type of the service.
- */
- void serviceAdded(ServiceEvent event);
-
- /**
- * A service has been removed.
- *
- * @param event
- * The ServiceEvent providing the name and fully qualified type of the service.
- */
- void serviceRemoved(ServiceEvent event);
-
- /**
- * A service has been resolved. Its details are now available in the ServiceInfo record.<br/>
- * <b>Note:</b>This call back will never be called if the service does not resolve.<br/>
- *
- * @param event
- * The ServiceEvent providing the name, the fully qualified type of the service, and the service info record.
- */
- void serviceResolved(ServiceEvent event);
-
-}
View
35 AndroidDnssdDiscovery/src/javax/jmdns/ServiceTypeListener.java
@@ -1,35 +0,0 @@
-// Copyright 2003-2005 Arthur van Hoff, Rick Blair
-// Licensed under Apache License version 2.0
-// Original license LGPL
-
-package javax.jmdns;
-
-import java.util.EventListener;
-
-/**
- * Listener for service types.
- *
- * @author Arthur van Hoff, Werner Randelshofer
- */
-public interface ServiceTypeListener extends EventListener {
- /**
- * A new service type was discovered.
- *
- * @param event
- * The service event providing the fully qualified type of the service.
- */
- void serviceTypeAdded(ServiceEvent event);
-
- /**
- * A new subtype for the service type was discovered.
- *
- * <pre>
- * &lt;sub&gt;._sub.&lt;app&gt;.&lt;protocol&gt;.&lt;servicedomain&gt;.&lt;parentdomain&gt;.
- * </pre>
- *
- * @param event
- * The service event providing the fully qualified type of the service with subtype.
- * @since 3.2.0
- */
- void subTypeForServiceTypeAdded(ServiceEvent event);
-}
View
533 AndroidDnssdDiscovery/src/javax/jmdns/impl/DNSCache.java
@@ -1,533 +0,0 @@
-// Copyright 2003-2005 Arthur van Hoff Rick Blair
-// Licensed under Apache License version 2.0
-// Original license LGPL
-
-package javax.jmdns.impl;
-
-import java.util.AbstractMap;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import javax.jmdns.impl.constants.DNSRecordClass;
-import javax.jmdns.impl.constants.DNSRecordType;
-
-/**
- * A table of DNS entries. This is a map table which can handle multiple entries with the same name.
- * <p/>
- * Storing multiple entries with the same name is implemented using a linked list. This is hidden from the user and can change in later implementation.
- * <p/>
- * Here's how to iterate over all entries:
- *
- * <pre>
- * for (Iterator i=dnscache.allValues().iterator(); i.hasNext(); ) {
- * DNSEntry entry = i.next();
- * ...do something with entry...
- * }
- * </pre>
- * <p/>
- * And here's how to iterate over all entries having a given name:
- *
- * <pre>
- * for (Iterator i=dnscache.getDNSEntryList(name).iterator(); i.hasNext(); ) {
- * DNSEntry entry = i.next();
- * ...do something with entry...
- * }
- * </pre>
- *
- * @author Arthur van Hoff, Werner Randelshofer, Rick Blair, Pierre Frisch
- */
-public class DNSCache extends AbstractMap<String, List<? extends DNSEntry>> {
-
- // private static Logger logger = Logger.getLogger(DNSCache.class.getName());
-
- private transient Set<Map.Entry<String, List<? extends DNSEntry>>> _entrySet = null;
-
- /**
- *
- */
- public static final DNSCache EmptyCache = new _EmptyCache();
-
- static final class _EmptyCache extends DNSCache {
-
- /**
- * {@inheritDoc}
- */
- @Override
- public int size() {
- return 0;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean isEmpty() {
- return true;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean containsKey(Object key) {
- return false;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean containsValue(Object value) {
- return false;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public List<DNSEntry> get(Object key) {
- return null;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Set<String> keySet() {
- return Collections.emptySet();
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Collection<List<? extends DNSEntry>> values() {
- return Collections.emptySet();
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Set<Map.Entry<String, List<? extends DNSEntry>>> entrySet() {
- return Collections.emptySet();
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean equals(Object o) {
- return (o instanceof Map) && ((Map<?, ?>) o).size() == 0;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public List<? extends DNSEntry> put(String key, List<? extends DNSEntry> value) {
- return null;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public int hashCode() {
- return 0;
- }
-
- }
-
- /**
- *
- */
- protected static class _CacheEntry extends Object implements Map.Entry<String, List<? extends DNSEntry>> {
-
- private List<? extends DNSEntry> _value;
-
- private String _key;
-
- /**
- * @param key
- * @param value
- */
- protected _CacheEntry(String key, List<? extends DNSEntry> value) {
- super();
- _key = (key != null ? key.trim().toLowerCase() : null);
- _value = value;
- }
-
- /**
- * @param entry
- */
- protected _CacheEntry(Map.Entry<String, List<? extends DNSEntry>> entry) {
- super();
- if (entry instanceof _CacheEntry) {
- _key = ((_CacheEntry) entry).getKey();
- _value = ((_CacheEntry) entry).getValue();
- }
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public String getKey() {
- return (_key != null ? _key : "");
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public List<? extends DNSEntry> getValue() {
- return _value;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public List<? extends DNSEntry> setValue(List<? extends DNSEntry> value) {
- List<? extends DNSEntry> oldValue = _value;
- _value = value;
- return oldValue;
- }
-
- /**
- * Returns <tt>true</tt> if this list contains no elements.
- *
- * @return <tt>true</tt> if this list contains no elements
- */
- public boolean isEmpty() {
- return this.getValue().isEmpty();
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean equals(Object entry) {
- if (!(entry instanceof Map.Entry)) {
- return false;
- }
- return this.getKey().equals(((Map.Entry<?, ?>) entry).getKey()) && this.getValue().equals(((Map.Entry<?, ?>) entry).getValue());
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public int hashCode() {
- return (_key == null ? 0 : _key.hashCode());
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public synchronized String toString() {
- StringBuffer aLog = new StringBuffer(200);
- aLog.append("\n\t\tname '");
- aLog.append(_key);
- aLog.append("' ");
- if ((_value != null) && (!_value.isEmpty())) {
- for (DNSEntry entry : _value) {
- aLog.append("\n\t\t\t");
- aLog.append(entry.toString());
- }
- } else {
- aLog.append(" no entries");
- }
- return aLog.toString();
- }
- }
-
- /**
- *
- */
- public DNSCache() {
- this(1024);
- }
-
- /**