verinec.netsim.components.layers
Class TransportLayer

java.lang.Object
  extended by desmoj.core.simulator.NamedObject
      extended by desmoj.core.simulator.ModelComponent
          extended by verinec.netsim.components.layers.abstractNetworkLayer
              extended by verinec.netsim.components.layers.TransportLayer
All Implemented Interfaces:
Observer, Subject

public class TransportLayer
extends abstractNetworkLayer

Transport Layer (Layer 4 in the OSI Model)

Version:
$Revision: 794 $
Author:
Dominik Jungo

Field Summary
private  Vector datagramSockets
           
 int maxTCPSegmentSize
          the size of a tcp Segment
private  RoutingTable routingtable
           
private  Vector Sockets
           
 
Constructor Summary
TransportLayer(Model owner, EventProcessor processor, RoutingTable routingtable)
          Constructs a new TransportLayer
 
Method Summary
 void bind(SocketImpl impl)
          Binds a SocketImplementation with a localaddress on this host
 void bindUDP(DatagramSocketImpl impl)
          Binds a DatagramSocketImplementation on this host
 IAddress getInterface(IAddress dst)
          gets the address used as localhost when sending data to dst
 IAddress getLocalAddress()
          gets the local IPAddress of this Layer, which is the first Address associated to this Layer
 SocketImpl getSocketImpl(int port)
          Gets a SocketImpl associated to a given port
 SocketImpl getSocketImpl(int localport, IAddress remoteaddress, int remoteport)
          gets a bound socket from this host, null if there isn't a bound socket with specified parameters
 DatagramSocketImpl getUDPSocketImpl(int port)
          Gets a Datagram SocketImpl associated to a given port
 boolean isPortFree(int port)
          checks if a a socket is port to a given portnumber
 boolean isUDPPortFree(int port)
          checks if a a datagram socket is port to a given portnumber
 void sendDown(Packet packet, double timeoffset, ILogger logger)
          Sends a Packet to the lower Layers(Observers).
 void unbind(SocketImpl impl)
          removes a Socket from the bound Sockets list
 void unbindUDP(DatagramSocketImpl impl)
          removes a datagram Socket from the bound Sockets list
 
Methods inherited from class verinec.netsim.components.layers.abstractNetworkLayer
addAddress, addProcessor, addresses, attachLower, attachUpper, compareAddress, detachLower, detachUpper, getDownEvent, getFirstAddress, getLayerName, getLowerobserver, getNode, getProcessor, getUpEvent, processorelements, sendUp, setNode
 
Methods inherited from class desmoj.core.simulator.ModelComponent
current, currentEntity, currentEvent, currentModel, currentSimProcess, currentTime, debugIsOn, debugOff, debugOn, epsilon, getModel, isExperimentCompatible, isModelCompatible, sendDebugNote, sendMessage, sendTraceNote, sendWarning, skipTraceNote, skipTraceNote, traceIsOn, traceOff, traceOn
 
Methods inherited from class desmoj.core.simulator.NamedObject
getName, getQuotedName, rename, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

routingtable

private RoutingTable routingtable

Sockets

private Vector Sockets

datagramSockets

private Vector datagramSockets

maxTCPSegmentSize

public int maxTCPSegmentSize
the size of a tcp Segment

Constructor Detail

TransportLayer

public TransportLayer(Model owner,
                      EventProcessor processor,
                      RoutingTable routingtable)
Constructs a new TransportLayer

Parameters:
owner - a model
processor - a processor
routingtable - a routing table
Method Detail

sendDown

public void sendDown(Packet packet,
                     double timeoffset,
                     ILogger logger)
Description copied from interface: Subject
Sends a Packet to the lower Layers(Observers). This is equivalent to the Notify Method

Specified by:
sendDown in interface Subject
Overrides:
sendDown in class abstractNetworkLayer
Parameters:
packet - The Packet to be sent down
timeoffset - timeoffset added to now, when tje packet should arrive
logger - logger used to log all events caused by this event
See Also:
abstractNetworkLayer.sendDown(verinec.netsim.entities.packets.Packet, double, verinec.netsim.loggers.ILogger)

getLocalAddress

public IAddress getLocalAddress()
gets the local IPAddress of this Layer, which is the first Address associated to this Layer

Returns:
the local IPAddress of this Layer

getInterface

public IAddress getInterface(IAddress dst)
gets the address used as localhost when sending data to dst

Parameters:
dst - an address
Returns:
the address used as localhost when sending data to dst

bind

public void bind(SocketImpl impl)
Binds a SocketImplementation with a localaddress on this host

Parameters:
impl - a Socket Implementation

isPortFree

public boolean isPortFree(int port)
checks if a a socket is port to a given portnumber

Parameters:
port - a portnumber to check
Returns:
true if no socket is bound to given portnumber, false otherwise

getSocketImpl

public SocketImpl getSocketImpl(int localport,
                                IAddress remoteaddress,
                                int remoteport)
gets a bound socket from this host, null if there isn't a bound socket with specified parameters

Parameters:
localport - localport of the bound socket
remoteaddress - remote adddress of the bound socket
remoteport - remote port of the bound socket
Returns:
the bound socket

getSocketImpl

public SocketImpl getSocketImpl(int port)
Gets a SocketImpl associated to a given port

Parameters:
port - a port
Returns:
the SocketImpl associated to the given port

getUDPSocketImpl

public DatagramSocketImpl getUDPSocketImpl(int port)
Gets a Datagram SocketImpl associated to a given port

Parameters:
port - a port
Returns:
the SocketImpl associated to the given port

unbind

public void unbind(SocketImpl impl)
removes a Socket from the bound Sockets list

Parameters:
impl - a Socket the should be removed from the bound list

isUDPPortFree

public boolean isUDPPortFree(int port)
checks if a a datagram socket is port to a given portnumber

Parameters:
port - a portnumber to check
Returns:
true if no socket is bound to given portnumber, false otherwise

bindUDP

public void bindUDP(DatagramSocketImpl impl)
Binds a DatagramSocketImplementation on this host

Parameters:
impl - a Socket Implementation

unbindUDP

public void unbindUDP(DatagramSocketImpl impl)
removes a datagram Socket from the bound Sockets list

Parameters:
impl - a datagram Socket the should be removed from the bound list

Copyright © 2005 Verinec, DIUF