public class TCPNetIF extends java.lang.Object implements NetIF, java.lang.Runnable
On the reading side, it queues up Datagrams that come from the remote end.
It also implements control datagrams, so one end can inform the other end of stuff.
Constructor and Description |
---|
TCPNetIF(TCPEndPointDst dst,
NetIFListener l)
Construct a TCPNetIF around a Socket.
|
TCPNetIF(TCPEndPointSrc src,
NetIFListener l)
Construct a TCPNetIF around a Socket.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Close a NetIF -- must be synchronized to prevent close() exiting prematurely when a
remoteClose has already been encountered -- close will never exit until the netif actually
is closed -- synchronized on "closed" object to prevent lock ups with other sync objects
|
boolean |
connect()
Activate
|
protected boolean |
controlClose()
Consturct and send a control message.
|
boolean |
enqueueDatagram(Datagram dg)
Puts a datagram on the incoming queue for this network interface
|
boolean |
equals(java.lang.Object obj) |
Address |
getAddress()
Get the Address for this connection.
|
FabricDevice |
getFabricDevice()
Accessor function for the fabric device associated with this
|
int |
getID()
Get the ID of this NetIF.
|
java.lang.String |
getName()
Get the name of this NetIF.
|
NetIFListener |
getNetIFListener()
Get the Listener of this NetIF.
|
Address |
getRemoteRouterAddress()
Get the Address of the remote router this NetIF is connected to
|
java.lang.String |
getRemoteRouterName()
Get the name of the remote router this NetIF is connected to.
|
RouterPort |
getRouterPort()
Get the RouterPort a NetIF is plugIged into.
|
NetStats |
getStats()
Get the interface stats.
|
int |
getWeight()
Get the weight of this NetIF.
|
boolean |
isClosed()
Is closed.
|
boolean |
isLocal()
Is this a local interface
|
boolean |
outQueueHandler(Datagram dg,
DatagramDevice dd)
Finally send the datagram onwards
|
void |
remoteClose()
Close a netIF given remote end has called close -- this is done as a
spawned process since it would otherwise block out queues which might need
to be written to during close
|
void |
run()
Run method loops and grabs input from connection to queue in
fabricDevice
|
boolean |
sendDatagram(Datagram dg)
Send a Datagram -- sets source to this interface and puts the datagram
on the incoming queue for this interface
|
void |
setAddress(Address addr)
Set the Address for this connection.
|
void |
setID(int id)
Set the ID of this NetIF.
|
void |
setLocal(boolean l) |
void |
setName(java.lang.String n)
Set the name of this NetIF.
|
void |
setNetIFListener(NetIFListener l)
Set the Listener of this NetIF.
|
void |
setRemoteRouterAddress(Address addr)
Set the Address of the remote router this NetIF is connected to.
|
void |
setRemoteRouterName(java.lang.String name)
Set the name of the remote router this NetIF is connected to.
|
void |
setRouterPort(RouterPort rp)
Set the RouterPort a NetIF is plugIged into.
|
void |
setWeight(int w)
Set the weight of this NetIF.
|
void |
start()
Start the netIF -- TODO make the queue lengths settable in router
control
|
java.lang.String |
toString()
To String
|
public TCPNetIF(TCPEndPointSrc src, NetIFListener l) throws java.io.IOException
java.io.IOException
public TCPNetIF(TCPEndPointDst dst, NetIFListener l) throws java.io.IOException
java.io.IOException
public void start()
public void run()
run
in interface java.lang.Runnable
public boolean connect() throws java.io.IOException
public java.lang.String getName()
getName
in interface DatagramDevice
public void setName(java.lang.String n)
setName
in interface DatagramDevice
public int getWeight()
public void setWeight(int w)
public Address getAddress()
getAddress
in interface DatagramDevice
public void setAddress(Address addr)
setAddress
in interface DatagramDevice
public java.lang.String getRemoteRouterName()
getRemoteRouterName
in interface NetIF
public void setRemoteRouterName(java.lang.String name)
setRemoteRouterName
in interface NetIF
public Address getRemoteRouterAddress()
getRemoteRouterAddress
in interface NetIF
public void setRemoteRouterAddress(Address addr)
setRemoteRouterAddress
in interface NetIF
public NetIFListener getNetIFListener()
getNetIFListener
in interface DatagramDevice
public void setNetIFListener(NetIFListener l)
setNetIFListener
in interface DatagramDevice
public RouterPort getRouterPort()
getRouterPort
in interface NetIF
public void setRouterPort(RouterPort rp)
setRouterPort
in interface NetIF
public boolean sendDatagram(Datagram dg) throws java.net.NoRouteToHostException
sendDatagram
in interface DatagramDevice
java.net.NoRouteToHostException
public boolean enqueueDatagram(Datagram dg) throws java.net.NoRouteToHostException
enqueueDatagram
in interface DatagramDevice
java.net.NoRouteToHostException
public boolean outQueueHandler(Datagram dg, DatagramDevice dd)
outQueueHandler
in interface DatagramDevice
public void remoteClose()
remoteClose
in interface NetIF
public void close()
protected boolean controlClose()
public NetStats getStats()
public FabricDevice getFabricDevice()
getFabricDevice
in interface DatagramDevice
public java.lang.String toString()
toString
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public boolean isLocal()
NetIF
public void setLocal(boolean l)
User Space Routing 0.10.3