flowsim.core
Interface Flow

All Known Subinterfaces:
FCBEFlow, QoSUnicastFlow, RoutedFlow, UnicastFlow
All Known Implementing Classes:
FlowImpl

public abstract interface Flow

A flow simulates a stream of data packets in the network. Flow objects have a source node (from), bandwidth (bw), flow-id (flowid) and differentiated-services-id (ds). They can be started, stopped, blocked and forwarded to an interface.

See Also:
Node

Method Summary
 void attach_monitor(FlowMonitor monitor)
          Add a FlowMonitor to this flow.
 void block()
          Block the flow.
 void detach_monitor(FlowMonitor monitor)
          Remove a FlowMonitor from this flow.
 int get_available_bw()
          Get maximal bandwidth which will be given to this flow, if it "desired" maximal bandwidth.
 int get_bw()
          Get bandwidth used/required by this flow.
 int get_desired_bw()
          Get wanted bandwidth of this flow.
 int get_ds()
          Get differentiated-services 'byte' of this flow.
 int get_flowid()
          Set flow-id of this flow.
 Service get_from_service()
          Get source service.
 Node get_from()
          Get source node.
 boolean is_blocked()
          Was this flow blocked?
 boolean is_running()
          Is this flow still active (i.e.
 void set_bw(int available_bw, int bw)
          Set available and used bandwidth by this flow.
 void set_desired_bw(int bw)
          Set wanted bandwidth of this flow.
 void set_ds(int ds)
          Set differentiated-services 'byte' of this flow.
 void set_flowid(int flowid)
          Get flow-id of this flow.
 void set_from_service(Service from)
          Set source service.
 void start()
          Start the flow of data.
 void stop()
          Stop the flow.
 double utility()
          Utility of this flow.
 

Method Detail

get_from

public Node get_from()
Get source node.
Returns:
source node.

get_from_service

public Service get_from_service()
Get source service. Optional, can return null.
Returns:
source service or null if source wasn't a service (or didn't tell so)

set_from_service

public void set_from_service(Service from)
Set source service.

get_bw

public int get_bw()
Get bandwidth used/required by this flow.
Returns:
bandwidth in bits/second.

get_desired_bw

public int get_desired_bw()
Get wanted bandwidth of this flow.
Returns:
bandwidth in bits/second.

get_available_bw

public int get_available_bw()
Get maximal bandwidth which will be given to this flow, if it "desired" maximal bandwidth.
Returns:
bandwidth in bits/second.

set_bw

public void set_bw(int available_bw,
                   int bw)
Set available and used bandwidth by this flow. This method should be only called by LinkManagers. Use set_desired_bw to set the wanted bandwidth of the flow, the final decision belongs the LinkManager...
Parameters:
bw - bandwidth in bits/second.

set_desired_bw

public void set_desired_bw(int bw)
Set wanted bandwidth of this flow. This value will be used by the LinkManager to determine the real allocated bandwidth, which will be set by him with 'set_bw'.
Parameters:
bw - bandwidth in bits/second.
See Also:
LinkManager

get_flowid

public int get_flowid()
Set flow-id of this flow. The flow-id can be used for example to choose a color in a nam-trace or to recognise a certain type of flows.

set_flowid

public void set_flowid(int flowid)
Get flow-id of this flow.

get_ds

public int get_ds()
Get differentiated-services 'byte' of this flow. This field, also known as 'type-of-service' (TOS), is used in diffserv networks. It is normally a byte, but is in flowsim for the sake of commodity an 'int'.

set_ds

public void set_ds(int ds)
Set differentiated-services 'byte' of this flow.

start

public void start()
Start the flow of data.

stop

public void stop()
Stop the flow.

block

public void block()
Block the flow. Sets the 'blocked' status and stops the flow.

is_running

public boolean is_running()
Is this flow still active (i.e. are packets still sent?)

is_blocked

public boolean is_blocked()
Was this flow blocked?

utility

public double utility()
Utility of this flow.
Returns:
utility in the range [0,1].

attach_monitor

public void attach_monitor(FlowMonitor monitor)
Add a FlowMonitor to this flow. The FlowMonitor will be notified when the flow starts, stops, blocks and changes bandwidth.

detach_monitor

public void detach_monitor(FlowMonitor monitor)
Remove a FlowMonitor from this flow.