nl.mansoft
Class Jipv6DatagramSocketImpl

java.lang.Object
  extended by java.net.DatagramSocketImpl
      extended by nl.mansoft.Jipv6DatagramSocketImpl
All Implemented Interfaces:
SocketOptions, UDPListener

public class Jipv6DatagramSocketImpl
extends DatagramSocketImpl
implements UDPListener

This class provides DatagramSocketImpl using jipv6. Example usage to be used in main() of an application or init() of an applet. 145.100.190.242 is the IPv4 address of a 6bed4 server.

   InetAddress jipv6Address = Jipv6DatagramSocketImpl.connect6bed4("145.100.190.242");
   if (jipv6Address != null)
   {
      try {
          DatagramSocket.setDatagramSocketImplFactory(new Jipv6DatagramSocketImplFactory());
      }
      catch (IOException ex) {
         // error handling
      }
   }
 


Field Summary
protected  IPv6Packet ipv6PacketReceive
           
protected  IPv6Packet ipv6PacketSend
           
protected  java.util.concurrent.ArrayBlockingQueue<IPv6Packet> queue
           
protected  UDPPacket udpPacketReceive
           
protected  UDPPacket udpPacketSend
           
 
Fields inherited from class java.net.DatagramSocketImpl
fd, localPort
 
Fields inherited from interface java.net.SocketOptions
IP_MULTICAST_IF, IP_MULTICAST_IF2, IP_MULTICAST_LOOP, IP_TOS, SO_BINDADDR, SO_BROADCAST, SO_KEEPALIVE, SO_LINGER, SO_OOBINLINE, SO_RCVBUF, SO_REUSEADDR, SO_SNDBUF, SO_TIMEOUT, TCP_NODELAY
 
Method Summary
protected  void bind(int port, InetAddress address)
           
protected  void close()
           
protected  void connect(InetAddress address, int port)
           
static InetAddress connect6bed4(String server)
          Creates a tunnel to a 6bed4 server
static InetAddress connectTSP(String server)
          Creates a tunnel to a TSP server This function is not implemented yet.
protected  void create()
          Creates a datagram socket.
 Object getOption(int arg0)
           
protected  int getTimeToLive()
           
protected  byte getTTL()
           
protected  void join(InetAddress addr)
           
protected  void joinGroup(SocketAddress addr, NetworkInterface netInterface)
           
protected  void leave(InetAddress addr)
           
protected  void leaveGroup(SocketAddress addr, NetworkInterface netInterface)
           
 void packetReceived(IPv6Packet ip, UDPPacket udp)
           
protected  int peek(InetAddress sender)
           
protected  int peekData(DatagramPacket pack)
           
protected  void processReceivePacket(IPv6Packet packet, DatagramPacket pack)
           
protected  void receive(DatagramPacket pack)
           
protected  void send(DatagramPacket pack)
           
 void setOption(int arg0, Object arg1)
           
protected  void setTimeToLive(int ttl)
           
protected  void setTTL(byte ttl)
           
 
Methods inherited from class java.net.DatagramSocketImpl
disconnect, getFileDescriptor, getLocalPort
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ipv6PacketReceive

protected IPv6Packet ipv6PacketReceive

ipv6PacketSend

protected IPv6Packet ipv6PacketSend

udpPacketReceive

protected UDPPacket udpPacketReceive

udpPacketSend

protected UDPPacket udpPacketSend

queue

protected java.util.concurrent.ArrayBlockingQueue<IPv6Packet> queue
Method Detail

connectTSP

public static InetAddress connectTSP(String server)
Creates a tunnel to a TSP server This function is not implemented yet.

Parameters:
server - the IPv4 address of a TSP server.
Returns:
the assigned IPv6 address by the TSP server.

connect6bed4

public static InetAddress connect6bed4(String server)
Creates a tunnel to a 6bed4 server

Parameters:
server - the IPv4 address of a 6bed4 server.
Returns:
the assigned IPv6 address by the 6bed4 server.

bind

protected void bind(int port,
                    InetAddress address)
             throws SocketException
Specified by:
bind in class DatagramSocketImpl
Throws:
SocketException

connect

protected void connect(InetAddress address,
                       int port)
Overrides:
connect in class DatagramSocketImpl

close

protected void close()
Specified by:
close in class DatagramSocketImpl

create

protected void create()
               throws SocketException
Creates a datagram socket. This implementation currently doesn't support ephemeral ports so applications should always bind the source port by using bind(int port, InetAddress address)

Specified by:
create in class DatagramSocketImpl
Throws:
SocketException - if there is an error in the underlying protocol, such as a TCP error.

getOption

public Object getOption(int arg0)
                 throws SocketException
Specified by:
getOption in interface SocketOptions
Throws:
SocketException

getTTL

protected byte getTTL()
               throws IOException
Specified by:
getTTL in class DatagramSocketImpl
Throws:
IOException

getTimeToLive

protected int getTimeToLive()
                     throws IOException
Specified by:
getTimeToLive in class DatagramSocketImpl
Throws:
IOException

join

protected void join(InetAddress addr)
             throws IOException
Specified by:
join in class DatagramSocketImpl
Throws:
IOException

joinGroup

protected void joinGroup(SocketAddress addr,
                         NetworkInterface netInterface)
                  throws IOException
Specified by:
joinGroup in class DatagramSocketImpl
Throws:
IOException

leave

protected void leave(InetAddress addr)
              throws IOException
Specified by:
leave in class DatagramSocketImpl
Throws:
IOException

leaveGroup

protected void leaveGroup(SocketAddress addr,
                          NetworkInterface netInterface)
                   throws IOException
Specified by:
leaveGroup in class DatagramSocketImpl
Throws:
IOException

peek

protected int peek(InetAddress sender)
            throws IOException
Specified by:
peek in class DatagramSocketImpl
Throws:
IOException

processReceivePacket

protected void processReceivePacket(IPv6Packet packet,
                                    DatagramPacket pack)
                             throws UnknownHostException
Throws:
UnknownHostException

peekData

protected int peekData(DatagramPacket pack)
                throws IOException
Specified by:
peekData in class DatagramSocketImpl
Throws:
IOException

receive

protected void receive(DatagramPacket pack)
                throws IOException
Specified by:
receive in class DatagramSocketImpl
Throws:
IOException

send

protected void send(DatagramPacket pack)
             throws IOException
Specified by:
send in class DatagramSocketImpl
Throws:
IOException

setOption

public void setOption(int arg0,
                      Object arg1)
               throws SocketException
Specified by:
setOption in interface SocketOptions
Throws:
SocketException

setTTL

protected void setTTL(byte ttl)
               throws IOException
Specified by:
setTTL in class DatagramSocketImpl
Throws:
IOException

setTimeToLive

protected void setTimeToLive(int ttl)
                      throws IOException
Specified by:
setTimeToLive in class DatagramSocketImpl
Throws:
IOException

packetReceived

public void packetReceived(IPv6Packet ip,
                           UDPPacket udp)
Specified by:
packetReceived in interface UDPListener