// 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; /** *
* The fully qualified service name is build using up to 5 components with the following structure: * *
* <app>.<protocol>.<servicedomain>.<parentdomain>.* *
* <Instance>.<app>.<protocol>.<servicedomain>.<parentdomain>.
* <sub>._sub.<app>.<protocol>.<servicedomain>.<parentdomain>. *
_http._tcp.local.
.
* @param name
* unqualified service instance name, such as foobar
* @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 _http._tcp.local.
.
* @param name
* unqualified service instance name, such as foobar
* @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 _http._tcp.local.
.
* @param name
* unqualified service instance name, such as foobar
* @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 _http._tcp.local.
.
* @param name
* unqualified service instance name, such as foobar
* @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 _http._tcp.local.
.
* @param name
* unqualified service instance name, such as foobar
* @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_http._tcp.local.
.
* @param name
* unqualified service instance name, such as foobar
* @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_http._tcp.local.
.
* @param name
* unqualified service instance name, such as foobar
* @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 _http._tcp.local.
.
* @param name
* unqualified service instance name, such as foobar
* @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 _http._tcp.local.
.
* @param name
* unqualified service instance name, such as foobar
* @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 true
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 _http._tcp.local.
.
* @param name
* unqualified service instance name, such as foobar
* @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 true
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 _http._tcp.local.
.
* @param name
* unqualified service instance name, such as foobar
* @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 true
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_http._tcp.local.
.
* @param name
* unqualified service instance name, such as foobar
* @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 true
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_http._tcp.local.
.
* @param name
* unqualified service instance name, such as foobar
* @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 true
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 _http._tcp.local.
.
* @param name
* unqualified service instance name, such as foobar
* @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 true
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 true
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 Maptrue
if the service info has data, false
otherwise.
*/
public abstract boolean hasData();
/**
* Fully qualified service type name, such as _http._tcp.local.
*
* @return service type name
*/
public abstract String getType();
/**
* Fully qualified service type name with the subtype if appropriate, such as _printer._sub._http._tcp.local.
*
* @return service type name
*/
public abstract String getTypeWithSubtype();
/**
* Unqualified service instance name, such as foobar
.
*
* @return service name
*/
public abstract String getName();
/**
* The key is used to retrieve service info in hash tables.foobar._http._tcp.local.
.
*
* @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.* In a multi-homed environment service info can be associated with more than one address. *
* * @return list of InetAddress objects */ public abstract InetAddress[] getInetAddresses(); /** * Returns a list of all IPv4 InetAddresses that can be used for this service. ** In a multi-homed environment service info can be associated with more than one address. *
* * @return list of InetAddress objects */ public abstract Inet4Address[] getInet4Addresses(); /** * Returns a list of all IPv6 InetAddresses that can be used for this service. ** In a multi-homed environment service info can be associated with more than one address. *
* * @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.true
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