verinec.netsim.components
Class Node

java.lang.Object
  extended by desmoj.core.simulator.NamedObject
      extended by desmoj.core.simulator.ModelComponent
          extended by verinec.netsim.components.Node

public class Node
extends ModelComponent

A Node represents a Network Component in the Network

Version:
$Revision:835 $
Author:
Dominik Jungo

Field Summary
private  ApplicationLayer applicationlayer
           
private  AddressTable arptable
           
private  Vector datalinklayers
           
private  Firewall firewall
           
private  Logger jlogger
           
private  NetworkLayer networklayer
           
private  String nodeID
           
private  SocketSimProccessTable processes
           
private  RoutingTable routingtable
           
private  List services
           
private  TransportLayer transportlayer
           
 
Constructor Summary
Node(Model model, Element element)
          Constructs a Node with the parameters in the element
 
Method Summary
private  void bind(DataLinkLayer dl, String binding)
          binds a nic to a "physical cable"
private  void createApplicationLayer(Element element)
           
private  void createHardware(Element element)
          Creates the "hardware part" of the node
private  void createNetworkLayer(Element element)
          Creates the "layer 3 part" of the node
private  void createNIC(Element element)
          Creates a NIC
 void createNICethernet(Element element)
          Creates a ethernet NIC if now hwaddress is given, a random one is generated.
 void createNICserial(Element element)
          Creates a serial NIC
 void createNICwlan(Element element)
          Creates a wlan NIC
private  void createServices(Element element)
          Creates the application layer with all specified services
private  void createTransportLayer()
          Creates the "layer 4 part" of the node
 Firewall getFirewall()
          gets the nodes firewall
 String getNodeID()
          gets the nodes identifier
 SimProcess getProcess(IAddress localhost, IAddress dsthost, int dstport)
          gets the Sim Proccess that was registered before
 SimProcess getProcess(int dstport)
          gets the Sim Proccess that was registered before
 TransportLayer getTransportlayer()
          gets the nodes transport layer
 boolean isPacketForwarding()
           
 void registerClient(IPAddress src, IPAddress dst, int port, SimProcess process)
          Registeres a SimProcess with a port of a Socket.
 void registerClient(Socket socket, SimProcess process)
          Registeres a SimProcess with a port of a Socket.
 void registerServer(int port, SimProcess process)
          Registeres a SimProcess with a port of a ServerSocket.
private  void setNodeID(String string)
          sets the nodes identifier
 void setTransportlayer(TransportLayer layer)
          sets the nodes transport layer
 
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

transportlayer

private TransportLayer transportlayer

datalinklayers

private Vector datalinklayers

networklayer

private NetworkLayer networklayer

applicationlayer

private ApplicationLayer applicationlayer

nodeID

private String nodeID

arptable

private AddressTable arptable

routingtable

private RoutingTable routingtable

processes

private SocketSimProccessTable processes

jlogger

private Logger jlogger

firewall

private Firewall firewall

services

private List services
Constructor Detail

Node

public Node(Model model,
            Element element)
     throws NetSimException
Constructs a Node with the parameters in the element

Parameters:
model - The network model this component is associated to
element - specification of the node
Throws:
NetSimException - when something gows wrong building the node
Method Detail

createApplicationLayer

private void createApplicationLayer(Element element)

createNetworkLayer

private void createNetworkLayer(Element element)
Creates the "layer 3 part" of the node

Parameters:
element - element hardware specification

createTransportLayer

private void createTransportLayer()
Creates the "layer 4 part" of the node


createHardware

private void createHardware(Element element)
                     throws NetSimException
Creates the "hardware part" of the node

Parameters:
element - hardware specification
Throws:
NetSimException - when something goes wring constructing the interface. This may come from an unknown interface type.

createNIC

private void createNIC(Element element)
                throws NetSimException
Creates a NIC

Parameters:
element - NIC specification
Throws:
NetSimException - when something goes wrong constructing the node. e.g when an unknown interface type is used.

createNICethernet

public void createNICethernet(Element element)
Creates a ethernet NIC if now hwaddress is given, a random one is generated. Note this can lead to collisions with existing addresses!

Parameters:
element - NIC specification

bind

private void bind(DataLinkLayer dl,
                  String binding)
binds a nic to a "physical cable"

Parameters:
dl - a nic
binding - a binding name

createNICwlan

public void createNICwlan(Element element)
Creates a wlan NIC

Parameters:
element - NIC specification

createNICserial

public void createNICserial(Element element)
Creates a serial NIC

Parameters:
element - NIC specification

createServices

private void createServices(Element element)
Creates the application layer with all specified services

Parameters:
element - service specifications

getFirewall

public Firewall getFirewall()
gets the nodes firewall

Returns:
the nodes firewall

getNodeID

public String getNodeID()
gets the nodes identifier

Returns:
the nodes identifier

setNodeID

private void setNodeID(String string)
sets the nodes identifier

Parameters:
string - new identifier

getTransportlayer

public TransportLayer getTransportlayer()
gets the nodes transport layer

Returns:
the nodes transport layer

setTransportlayer

public void setTransportlayer(TransportLayer layer)
sets the nodes transport layer

Parameters:
layer - a new transport layer

getProcess

public SimProcess getProcess(IAddress localhost,
                             IAddress dsthost,
                             int dstport)
gets the Sim Proccess that was registered before

Parameters:
localhost - local host of the registered Socket
dsthost - destination host of the registered Socket
dstport - destination port of the registered Socket
Returns:
the SimProccess

getProcess

public SimProcess getProcess(int dstport)
gets the Sim Proccess that was registered before

Parameters:
dstport - destination port of the registered Socket
Returns:
the SimProccess

registerServer

public void registerServer(int port,
                           SimProcess process)
Registeres a SimProcess with a port of a ServerSocket. This may be used later to passivate the Proccess.

Parameters:
port - port of a ServerSocket
process - the proccess

registerClient

public void registerClient(Socket socket,
                           SimProcess process)
Registeres a SimProcess with a port of a Socket. This may be used later to passivate the Proccess.

Parameters:
socket - a Socket
process - a Proccess

registerClient

public void registerClient(IPAddress src,
                           IPAddress dst,
                           int port,
                           SimProcess process)
Registeres a SimProcess with a port of a Socket. This may be used later to passivate the Proccess.

Parameters:
src - source address of the Socket
dst - destination address of the Socket
port - destination port of the Socket
process - a Proccess

isPacketForwarding

public boolean isPacketForwarding()

Copyright © 2005 Verinec, DIUF