com.solers.slp
Class NetworkManager

java.lang.Object
  |
  +--com.solers.slp.NetworkManager

class NetworkManager
extends Object

NetworkManager is a singleton which controls the sending and receiving of datagram packets for UAs, and the TCP connection for SAs.

Author:
Patrick Callis

Field Summary
private  SLPConfiguration _conf
           
private static NetworkManager _singleton
           
(package private)  org.apache.log4j.Category cat
          Default logging category
private  Vector daAddresses
          List of known DA urls
private static short nextXid
           
private  ByteArrayOutputStream saBos
          Used for writing SA messages
private  DataOutputStream saDos
          Wrapper for ByteArrayOutputStream
(package private) static String SLP_DA_TYPE
           
(package private) static String SLP_MCAST_ADDRESS
           
(package private) static int SLP_RESERVED_PORT
           
(package private)  org.apache.log4j.Category traceDA
          DA Traffic logging category
(package private)  org.apache.log4j.Category traceDrop
          Drop logging category
(package private)  org.apache.log4j.Category traceMsg
          Message logging category
(package private)  org.apache.log4j.Category traceReg
          Reg logging category
 
Constructor Summary
private NetworkManager()
           
 
Method Summary
(package private)  Socket connectToSlpd()
          Opens a TCP connection to the slp daemon running on the localhost.
(package private)  void findDA()
          Searches for a DA
(package private)  InetAddress getDaAddress()
          Returns either the current DA's address, or the SLP multicast address if no DAs are available.
(package private) static NetworkManager getInstance()
          Returns the singleton instance of a NetworkManager
(package private)  short nextXid()
          Returns the next XID to use.
(package private)  void saMessage(SLPMessage message)
          Sends a message as an SA.
private  short saReadAck(short xid, DataInputStream istream)
          Reads the ack response to an SA message.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

cat

org.apache.log4j.Category cat
Default logging category

traceDA

org.apache.log4j.Category traceDA
DA Traffic logging category

traceMsg

org.apache.log4j.Category traceMsg
Message logging category

traceDrop

org.apache.log4j.Category traceDrop
Drop logging category

traceReg

org.apache.log4j.Category traceReg
Reg logging category

SLP_RESERVED_PORT

static final int SLP_RESERVED_PORT

SLP_MCAST_ADDRESS

static final String SLP_MCAST_ADDRESS

SLP_DA_TYPE

static final String SLP_DA_TYPE

_singleton

private static NetworkManager _singleton

nextXid

private static short nextXid

saBos

private ByteArrayOutputStream saBos
Used for writing SA messages

saDos

private DataOutputStream saDos
Wrapper for ByteArrayOutputStream

daAddresses

private Vector daAddresses
List of known DA urls

_conf

private SLPConfiguration _conf
Constructor Detail

NetworkManager

private NetworkManager()
Method Detail

getInstance

static NetworkManager getInstance()
Returns the singleton instance of a NetworkManager

connectToSlpd

Socket connectToSlpd()
               throws IOException
Opens a TCP connection to the slp daemon running on the localhost. This connection is used for all SA requests/responses.

findDA

void findDA()
Searches for a DA

getDaAddress

InetAddress getDaAddress()
Returns either the current DA's address, or the SLP multicast address if no DAs are available.

nextXid

short nextXid()
Returns the next XID to use.

saMessage

void saMessage(SLPMessage message)
         throws ServiceLocationException
Sends a message as an SA. SA Messages are to the slp daemon running on the localhost. Note that this is a TCP connection.

saReadAck

private short saReadAck(short xid,
                        DataInputStream istream)
                 throws IOException
Reads the ack response to an SA message.