com.aelitis.net.udp.uc.impl
Class PRUDPPacketHandlerImpl

java.lang.Object
  extended by com.aelitis.net.udp.uc.impl.PRUDPPacketHandlerImpl
All Implemented Interfaces:
PRUDPPacketHandler

public class PRUDPPacketHandlerImpl
extends java.lang.Object
implements PRUDPPacketHandler


Nested Class Summary
protected static interface PRUDPPacketHandlerImpl.PacketTransformer
           
 
Field Summary
 
Fields inherited from interface com.aelitis.net.udp.uc.PRUDPPacketHandler
PRIORITY_HIGH, PRIORITY_IMMEDIATE, PRIORITY_LOW, PRIORITY_MEDIUM
 
Constructor Summary
protected PRUDPPacketHandlerImpl(int _port, java.net.InetAddress _bind_ip, PRUDPPacketHandlerImpl.PacketTransformer _packet_transformer)
           
 
Method Summary
 void addPrimordialHandler(PRUDPPrimordialHandler handler)
           
protected  void calcBind()
           
protected  void checkTargetAddress(java.net.InetSocketAddress address)
           
protected  void checkTimeouts()
           
 void closeSession()
           
 void destroy()
           
 java.net.InetAddress getBindIP()
           
 int getPort()
           
 long getReceiveQueueLength()
           
 PRUDPRequestHandler getRequestHandler()
           
 long getSendQueueLength()
           
 PRUDPPacketHandlerStats getStats()
           
 boolean hasPrimordialHandler()
           
 PRUDPPacketHandler openSession(java.net.InetSocketAddress target)
           
 void primordialSend(byte[] buffer, java.net.InetSocketAddress target)
           
protected  void process(java.net.DatagramPacket dg_packet, long receive_time)
           
protected  void receiveLoop(AESemaphore init_sem)
           
 void removePrimordialHandler(PRUDPPrimordialHandler handler)
           
 void send(PRUDPPacket request_packet, java.net.InetSocketAddress destination_address)
          Send only
 PRUDPPacket sendAndReceive(java.net.PasswordAuthentication auth, PRUDPPacket request_packet, java.net.InetSocketAddress destination_address)
          Synchronous send and receive
 PRUDPPacket sendAndReceive(java.net.PasswordAuthentication auth, PRUDPPacket request_packet, java.net.InetSocketAddress destination_address, long timeout)
           
 PRUDPPacket sendAndReceive(java.net.PasswordAuthentication auth, PRUDPPacket request_packet, java.net.InetSocketAddress destination_address, long timeout, int priority)
           
 PRUDPPacketHandlerRequestImpl sendAndReceive(java.net.PasswordAuthentication auth, PRUDPPacket request_packet, java.net.InetSocketAddress destination_address, PRUDPPacketReceiver receiver, long timeout, int priority)
           
 PRUDPPacket sendAndReceive(PRUDPPacket request_packet, java.net.InetSocketAddress destination_address)
           
 void sendAndReceive(PRUDPPacket request_packet, java.net.InetSocketAddress destination_address, PRUDPPacketReceiver receiver, long timeout, int priority)
          Asynchronous send and receive
protected  void setDefaultBindAddress(java.net.InetAddress address)
           
 void setDelays(int _send_delay, int _receive_delay, int _queued_request_timeout)
           
 void setExplicitBindAddress(java.net.InetAddress address)
           
 void setRequestHandler(PRUDPRequestHandler _request_handler)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PRUDPPacketHandlerImpl

protected PRUDPPacketHandlerImpl(int _port,
                                 java.net.InetAddress _bind_ip,
                                 PRUDPPacketHandlerImpl.PacketTransformer _packet_transformer)
Method Detail

hasPrimordialHandler

public boolean hasPrimordialHandler()
Specified by:
hasPrimordialHandler in interface PRUDPPacketHandler

addPrimordialHandler

public void addPrimordialHandler(PRUDPPrimordialHandler handler)
Specified by:
addPrimordialHandler in interface PRUDPPacketHandler

removePrimordialHandler

public void removePrimordialHandler(PRUDPPrimordialHandler handler)
Specified by:
removePrimordialHandler in interface PRUDPPacketHandler

setRequestHandler

public void setRequestHandler(PRUDPRequestHandler _request_handler)
Specified by:
setRequestHandler in interface PRUDPPacketHandler

getRequestHandler

public PRUDPRequestHandler getRequestHandler()
Specified by:
getRequestHandler in interface PRUDPPacketHandler

getPort

public int getPort()
Specified by:
getPort in interface PRUDPPacketHandler

getBindIP

public java.net.InetAddress getBindIP()
Specified by:
getBindIP in interface PRUDPPacketHandler

setDefaultBindAddress

protected void setDefaultBindAddress(java.net.InetAddress address)

setExplicitBindAddress

public void setExplicitBindAddress(java.net.InetAddress address)
Specified by:
setExplicitBindAddress in interface PRUDPPacketHandler

calcBind

protected void calcBind()

receiveLoop

protected void receiveLoop(AESemaphore init_sem)

checkTimeouts

protected void checkTimeouts()

process

protected void process(java.net.DatagramPacket dg_packet,
                       long receive_time)

sendAndReceive

public PRUDPPacket sendAndReceive(PRUDPPacket request_packet,
                                  java.net.InetSocketAddress destination_address)
                           throws PRUDPPacketHandlerException
Throws:
PRUDPPacketHandlerException

sendAndReceive

public PRUDPPacket sendAndReceive(java.net.PasswordAuthentication auth,
                                  PRUDPPacket request_packet,
                                  java.net.InetSocketAddress destination_address)
                           throws PRUDPPacketHandlerException
Description copied from interface: PRUDPPacketHandler
Synchronous send and receive

Specified by:
sendAndReceive in interface PRUDPPacketHandler
Returns:
Throws:
PRUDPPacketHandlerException

sendAndReceive

public PRUDPPacket sendAndReceive(java.net.PasswordAuthentication auth,
                                  PRUDPPacket request_packet,
                                  java.net.InetSocketAddress destination_address,
                                  long timeout)
                           throws PRUDPPacketHandlerException
Specified by:
sendAndReceive in interface PRUDPPacketHandler
Throws:
PRUDPPacketHandlerException

sendAndReceive

public PRUDPPacket sendAndReceive(java.net.PasswordAuthentication auth,
                                  PRUDPPacket request_packet,
                                  java.net.InetSocketAddress destination_address,
                                  long timeout,
                                  int priority)
                           throws PRUDPPacketHandlerException
Specified by:
sendAndReceive in interface PRUDPPacketHandler
Throws:
PRUDPPacketHandlerException

sendAndReceive

public void sendAndReceive(PRUDPPacket request_packet,
                           java.net.InetSocketAddress destination_address,
                           PRUDPPacketReceiver receiver,
                           long timeout,
                           int priority)
                    throws PRUDPPacketHandlerException
Description copied from interface: PRUDPPacketHandler
Asynchronous send and receive

Specified by:
sendAndReceive in interface PRUDPPacketHandler
Throws:
PRUDPPacketHandlerException

sendAndReceive

public PRUDPPacketHandlerRequestImpl sendAndReceive(java.net.PasswordAuthentication auth,
                                                    PRUDPPacket request_packet,
                                                    java.net.InetSocketAddress destination_address,
                                                    PRUDPPacketReceiver receiver,
                                                    long timeout,
                                                    int priority)
                                             throws PRUDPPacketHandlerException
Throws:
PRUDPPacketHandlerException

send

public void send(PRUDPPacket request_packet,
                 java.net.InetSocketAddress destination_address)
          throws PRUDPPacketHandlerException
Description copied from interface: PRUDPPacketHandler
Send only

Specified by:
send in interface PRUDPPacketHandler
Throws:
PRUDPPacketHandlerException

checkTargetAddress

protected void checkTargetAddress(java.net.InetSocketAddress address)
                           throws PRUDPPacketHandlerException
Throws:
PRUDPPacketHandlerException

setDelays

public void setDelays(int _send_delay,
                      int _receive_delay,
                      int _queued_request_timeout)
Specified by:
setDelays in interface PRUDPPacketHandler

getSendQueueLength

public long getSendQueueLength()

getReceiveQueueLength

public long getReceiveQueueLength()

primordialSend

public void primordialSend(byte[] buffer,
                           java.net.InetSocketAddress target)
                    throws PRUDPPacketHandlerException
Specified by:
primordialSend in interface PRUDPPacketHandler
Throws:
PRUDPPacketHandlerException

getStats

public PRUDPPacketHandlerStats getStats()
Specified by:
getStats in interface PRUDPPacketHandler

destroy

public void destroy()
Specified by:
destroy in interface PRUDPPacketHandler

openSession

public PRUDPPacketHandler openSession(java.net.InetSocketAddress target)
                               throws PRUDPPacketHandlerException
Specified by:
openSession in interface PRUDPPacketHandler
Throws:
PRUDPPacketHandlerException

closeSession

public void closeSession()
                  throws PRUDPPacketHandlerException
Specified by:
closeSession in interface PRUDPPacketHandler
Throws:
PRUDPPacketHandlerException