flowsim.core
Interface Node

All Known Implementing Classes:
NodeImpl

public abstract interface Node

A node consists of an id/name, interfaces and services on its ports. Every interface is a LinkManager instance.

See Also:
LinkManager, Service

Method Summary
 int add_iface(LinkManager f)
          Add an interface on the first available iface number.
 void attach_monitor(NodeMonitor nm)
          Add monitor to this node, which will be notified when the ifaces change, ...
 int get_id()
          Get id of this node.
 LinkManager get_iface(int i)
          Get interface (modelled by a LinkManager) number i.
 int get_iface(Node n)
          Get iface-number which goes to a node.
 int get_ifaces_count()
          Get number of connected (!=null) interfaces.
 Link get_link(int n)
          Get Link instance of this interface.
 int get_max_ifaces()
          Get maximum number of interfaces which can be added to this node.
 java.lang.String get_name()
          Get name of this node.
 Node get_peer(int n)
          Get peer-node of this interface.
 Service get_service(int port)
          Get service (port listener).
 void remove_monitor(NodeMonitor nm)
          Remove monitor from this node.
 void set_iface(int n, LinkManager f)
          Set interface number n to a LinkManager.
 void set_service(Service service, int port)
          Set service (port listener).
 

Method Detail

get_id

public int get_id()
Get id of this node. This number should be unique among every created nodes.

get_name

public java.lang.String get_name()
Get name of this node. Used for print/debug/display purproses.

get_max_ifaces

public int get_max_ifaces()
Get maximum number of interfaces which can be added to this node.

get_ifaces_count

public int get_ifaces_count()
Get number of connected (!=null) interfaces.

set_iface

public void set_iface(int n,
                      LinkManager f)
Set interface number n to a LinkManager.
Parameters:
f - interface instance, null if none.

add_iface

public int add_iface(LinkManager f)
Add an interface on the first available iface number.
Returns:
iface number.

get_iface

public LinkManager get_iface(int i)
Get interface (modelled by a LinkManager) number i.

get_iface

public int get_iface(Node n)
Get iface-number which goes to a node.
Returns:
iface-number or -1 if node isn't a peer.

get_link

public Link get_link(int n)
Get Link instance of this interface. This is like get_iface(n).get_link().

get_peer

public Node get_peer(int n)
Get peer-node of this interface. This is like get_link(n).get_peer().

get_service

public Service get_service(int port)
Get service (port listener).
Parameters:
port - port of the service.

set_service

public void set_service(Service service,
                        int port)
Set service (port listener).
Parameters:
service - Service instance.
port - Port number (first is 0).

attach_monitor

public void attach_monitor(NodeMonitor nm)
Add monitor to this node, which will be notified when the ifaces change, ...
Parameters:
nm - the monitor

remove_monitor

public void remove_monitor(NodeMonitor nm)
Remove monitor from this node.
Parameters:
nm - the monitor