Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

com.strangeberry.rendezvous
Class Rendezvous  view Rendezvous download Rendezvous.java

java.lang.Object
  extended bycom.strangeberry.rendezvous.DNSConstants
      extended bycom.strangeberry.rendezvous.Rendezvous

public class Rendezvous
extends DNSConstants

Rendezvous implementation in Java.

Version:
%I%, %G%

Nested Class Summary
(package private) static class Rendezvous.Listener
          Listener for record updates.
(package private)  class Rendezvous.RecordReaper
          Schedule questions
(package private)  class Rendezvous.ServiceBrowser
          Browse for a service of a given type
(package private)  class Rendezvous.Shutdown
          Shutdown operations.
(package private)  class Rendezvous.SocketListener
          Listen for multicast packets.
 
Field Summary
(package private)  java.util.Vector browsers
           
(package private)  DNSCache cache
           
(package private) static int CLASS_ANY
           
(package private) static int CLASS_CH
           
(package private) static int CLASS_CS
           
(package private) static int CLASS_HS
           
(package private) static int CLASS_IN
           
(package private) static int CLASS_MASK
           
(package private) static int CLASS_NONE
           
(package private) static int CLASS_UNIQUE
           
(package private) static int debug
           
(package private) static int DNS_PORT
           
(package private)  boolean done
           
(package private) static int FLAGS_AA
           
(package private) static int FLAGS_AD
           
(package private) static int FLAGS_CD
           
(package private) static int FLAGS_QR_MASK
           
(package private) static int FLAGS_QR_QUERY
           
(package private) static int FLAGS_QR_RESPONSE
           
(package private) static int FLAGS_RA
           
(package private) static int FLAGS_RD
           
(package private) static int FLAGS_TC
           
(package private) static int FLAGS_Z
           
(package private)  java.net.InetAddress group
           
(package private)  java.util.Vector listeners
           
(package private) static int MAX_MSG_ABSOLUTE
           
(package private) static int MAX_MSG_TYPICAL
           
(package private) static java.lang.String MDNS_GROUP
           
(package private) static int MDNS_PORT
           
(package private)  java.util.Hashtable services
           
(package private)  java.lang.Thread shutdown
           
(package private)  java.net.MulticastSocket socket
           
(package private) static int TYPE_A
           
(package private) static int TYPE_ANY
           
(package private) static int TYPE_CNAME
           
(package private) static int TYPE_HINFO
           
(package private) static int TYPE_MB
           
(package private) static int TYPE_MD
           
(package private) static int TYPE_MF
           
(package private) static int TYPE_MG
           
(package private) static int TYPE_MINFO
           
(package private) static int TYPE_MR
           
(package private) static int TYPE_MX
           
(package private) static int TYPE_NS
           
(package private) static int TYPE_NULL
           
(package private) static int TYPE_PTR
           
(package private) static int TYPE_SOA
           
(package private) static int TYPE_SRV
           
(package private) static int TYPE_TXT
           
(package private) static int TYPE_WKS
           
 
Constructor Summary
Rendezvous()
          Create an instance of Rendezvous.
Rendezvous(java.net.InetAddress addr)
          Create an instance of Rendezvous and bind it to a specific network interface given its IP-address.
 
Method Summary
(package private)  void addListener(Rendezvous.Listener listener, DNSQuestion question)
          Add a listener for a question.
 void addServiceListener(java.lang.String type, ServiceListener listener)
          Listen for services of a given type.
(package private)  void checkService(ServiceInfo info)
          Check that a service name is unique.
 void close()
          Close down rendezvous.
 ServiceInfo getServiceInfo(java.lang.String type, java.lang.String name)
          Get service information.
 ServiceInfo getServiceInfo(java.lang.String type, java.lang.String name, int timeout)
          Get service information.
(package private)  void handleQuery(DNSIncoming in, java.net.InetAddress addr, int port)
          Handle an incoming query.
(package private)  void handleResponse(DNSIncoming msg)
          Handle an incoming response.
(package private)  void init(java.net.InetAddress intf)
          Initialize everything.
(package private)  void print()
          List cache entries, for debugging only.
 void registerService(ServiceInfo info)
          Register a service.
(package private)  void removeListener(Rendezvous.Listener listener)
          Remove a listener from all outstanding questions.
 void removeServiceListener(ServiceListener listener)
          Remove listener for services of a given type.
(package private)  void send(DNSOutgoing out)
          Send a message an outgoing multicast DNS message.
 void unregisterAllServices()
          Unregister a service.
 void unregisterService(ServiceInfo info)
          Unregister a service.
(package private)  void updateRecord(long now, DNSRecord rec)
          Notify all listeners that a record was updated.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

debug

static int debug

group

java.net.InetAddress group

socket

java.net.MulticastSocket socket

listeners

java.util.Vector listeners

browsers

java.util.Vector browsers

cache

DNSCache cache

services

java.util.Hashtable services

shutdown

java.lang.Thread shutdown

done

boolean done

MDNS_GROUP

static final java.lang.String MDNS_GROUP
See Also:
Constant Field Values

MDNS_PORT

static final int MDNS_PORT
See Also:
Constant Field Values

DNS_PORT

static final int DNS_PORT
See Also:
Constant Field Values

MAX_MSG_TYPICAL

static final int MAX_MSG_TYPICAL
See Also:
Constant Field Values

MAX_MSG_ABSOLUTE

static final int MAX_MSG_ABSOLUTE
See Also:
Constant Field Values

FLAGS_QR_MASK

static final int FLAGS_QR_MASK
See Also:
Constant Field Values

FLAGS_QR_QUERY

static final int FLAGS_QR_QUERY
See Also:
Constant Field Values

FLAGS_QR_RESPONSE

static final int FLAGS_QR_RESPONSE
See Also:
Constant Field Values

FLAGS_AA

static final int FLAGS_AA
See Also:
Constant Field Values

FLAGS_TC

static final int FLAGS_TC
See Also:
Constant Field Values

FLAGS_RD

static final int FLAGS_RD
See Also:
Constant Field Values

FLAGS_RA

static final int FLAGS_RA
See Also:
Constant Field Values

FLAGS_Z

static final int FLAGS_Z
See Also:
Constant Field Values

FLAGS_AD

static final int FLAGS_AD
See Also:
Constant Field Values

FLAGS_CD

static final int FLAGS_CD
See Also:
Constant Field Values

CLASS_IN

static final int CLASS_IN
See Also:
Constant Field Values

CLASS_CS

static final int CLASS_CS
See Also:
Constant Field Values

CLASS_CH

static final int CLASS_CH
See Also:
Constant Field Values

CLASS_HS

static final int CLASS_HS
See Also:
Constant Field Values

CLASS_NONE

static final int CLASS_NONE
See Also:
Constant Field Values

CLASS_ANY

static final int CLASS_ANY
See Also:
Constant Field Values

CLASS_MASK

static final int CLASS_MASK
See Also:
Constant Field Values

CLASS_UNIQUE

static final int CLASS_UNIQUE
See Also:
Constant Field Values

TYPE_A

static final int TYPE_A
See Also:
Constant Field Values

TYPE_NS

static final int TYPE_NS
See Also:
Constant Field Values

TYPE_MD

static final int TYPE_MD
See Also:
Constant Field Values

TYPE_MF

static final int TYPE_MF
See Also:
Constant Field Values

TYPE_CNAME

static final int TYPE_CNAME
See Also:
Constant Field Values

TYPE_SOA

static final int TYPE_SOA
See Also:
Constant Field Values

TYPE_MB

static final int TYPE_MB
See Also:
Constant Field Values

TYPE_MG

static final int TYPE_MG
See Also:
Constant Field Values

TYPE_MR

static final int TYPE_MR
See Also:
Constant Field Values

TYPE_NULL

static final int TYPE_NULL
See Also:
Constant Field Values

TYPE_WKS

static final int TYPE_WKS
See Also:
Constant Field Values

TYPE_PTR

static final int TYPE_PTR
See Also:
Constant Field Values

TYPE_HINFO

static final int TYPE_HINFO
See Also:
Constant Field Values

TYPE_MINFO

static final int TYPE_MINFO
See Also:
Constant Field Values

TYPE_MX

static final int TYPE_MX
See Also:
Constant Field Values

TYPE_TXT

static final int TYPE_TXT
See Also:
Constant Field Values

TYPE_SRV

static final int TYPE_SRV
See Also:
Constant Field Values

TYPE_ANY

static final int TYPE_ANY
See Also:
Constant Field Values
Constructor Detail

Rendezvous

public Rendezvous()
           throws java.io.IOException
Create an instance of Rendezvous.


Rendezvous

public Rendezvous(java.net.InetAddress addr)
           throws java.io.IOException
Create an instance of Rendezvous and bind it to a specific network interface given its IP-address.

Method Detail

init

void init(java.net.InetAddress intf)
    throws java.io.IOException
Initialize everything.


getServiceInfo

public ServiceInfo getServiceInfo(java.lang.String type,
                                  java.lang.String name)
Get service information. If the information is not cached, the method will block until updated informatin is received.


getServiceInfo

public ServiceInfo getServiceInfo(java.lang.String type,
                                  java.lang.String name,
                                  int timeout)
Get service information. If the information is not cached, the method will block for the given timeout until updated informatin is received.


addServiceListener

public void addServiceListener(java.lang.String type,
                               ServiceListener listener)
Listen for services of a given type. The type has to be a fully qualified type name such as _http._tcp.local..


removeServiceListener

public void removeServiceListener(ServiceListener listener)
Remove listener for services of a given type.


registerService

public void registerService(ServiceInfo info)
                     throws java.io.IOException
Register a service. The service is registered for access by other rendezvous clients. The name of the service may be changed to make it unique.


unregisterService

public void unregisterService(ServiceInfo info)
Unregister a service. The service should have been registered.


unregisterAllServices

public void unregisterAllServices()
Unregister a service.


checkService

void checkService(ServiceInfo info)
            throws java.io.IOException,
                   java.lang.InterruptedException
Check that a service name is unique.


addListener

void addListener(Rendezvous.Listener listener,
                 DNSQuestion question)
Add a listener for a question. The listener will receive updates to of answers to the question as they arrive, or from the cache if they are already available.


removeListener

void removeListener(Rendezvous.Listener listener)
Remove a listener from all outstanding questions. The listener will no longer receive any updates.


updateRecord

void updateRecord(long now,
                  DNSRecord rec)
Notify all listeners that a record was updated.


handleResponse

void handleResponse(DNSIncoming msg)
              throws java.io.IOException
Handle an incoming response. Cache answers, and pass them on to the appropriate questions.


handleQuery

void handleQuery(DNSIncoming in,
                 java.net.InetAddress addr,
                 int port)
           throws java.io.IOException
Handle an incoming query. See if we can answer any part of it given our registered records.


send

void send(DNSOutgoing out)
    throws java.io.IOException
Send a message an outgoing multicast DNS message.


close

public void close()
Close down rendezvous. Release all resources and unregister all services.


print

void print()
List cache entries, for debugging only.