J-Sim v1.3p4 API

drcl.inet
Class InetUtil

java.lang.Object
  extended by drcl.inet.InetUtil
All Implemented Interfaces:
InetConstants

public class InetUtil
extends java.lang.Object
implements InetConstants

The utility class that offers tools for building a network topology and so on.


Field Summary
 
Fields inherited from interface drcl.inet.InetConstants
BYTE_MODE, DEFAULT_BANDWIDTH, DEFAULT_BUFFER_SIZE, DEFAULT_MTU, EVENT_DEFAULT_IDENTITY_SET, EVENT_DEFAULT_IDENTITY_UNSET, EVENT_ID_CHANGED_PORT_ID, EVENT_IDENTITY_ADDED, EVENT_IDENTITY_REMOVED, EVENT_IF_NEIGHBOR_DOWN, EVENT_IF_NEIGHBOR_UP, EVENT_IF_PORT_ID, EVENT_LINK_BROKEN, EVENT_LINK_BROKEN_PORT_ID, EVENT_MCAST_HOST_PORT_ID, EVENT_PKT_ARRIVAL, EVENT_PKT_ARRIVAL_PORT_ID, EVENT_RT_ENTRY_ADDED, EVENT_RT_ENTRY_MODIFIED, EVENT_RT_ENTRY_REMOVED, EVENT_RT_MCAST_CHANGED_PORT_ID, EVENT_RT_UCAST_CHANGED_PORT_ID, EVENT_VIF_NEIGHBOR_DOWN, EVENT_VIF_NEIGHBOR_UP, EVENT_VIF_PORT_ID, HOST_ENTRY_EXT, ID_CSL, ID_TRACE_RT, MCAST_QUERY_PORT_ID, PACKET_MODE, PID_AODV, PID_DV, PID_DVMRP, PID_HELLO, PID_IGMP, PID_OSPF, PID_RSVP, PID_TCP, PID_TRACE_RT, PID_UDP, SERVICE_CONFIGSW_PORT_ID, SERVICE_ID_PORT_ID, SERVICE_IF_PORT_ID, SERVICE_MCAST_PORT_ID, SERVICE_RT_PORT_ID, UCAST_QUERY_PORT_ID
 
Constructor Summary
InetUtil()
           
 
Method Summary
static void configure(Component network_)
          Configures the "host" routing entries and the interface info at the area boundary routers.
static void configure(java.lang.Object[] nodes_)
          Configures the "host" routing entries and the interface info at the area boundary routers.
static void configureFlat(Component network_)
          Calls configureFlat(network_.getAllComponents(), true, true).
static void configureFlat(Component network_, boolean reassignNodeID_, boolean setupInterface_)
          Calls configureFlat(network_.getAllComponents(), reassignNodeID_, setupInterface_).
static void configureFlat(java.lang.Object[] nodes_)
          Calls configureFlat(nodes_, true, true).
static void configureFlat(java.lang.Object[] nodes_, boolean reassignNodeID_, boolean setupInterface_)
          Sets up the "host" routing entries and the interface info at the area boundary routers in the flat network.
static void connect(Component p1_, Component p2_)
          Connects two protocol components.
static boolean connect(Component p1_, Component p2_, int protocolID_)
          Connects two protocol components with the specified protocol ID.
static void connectNeighbors(Component network_)
          Setup a bidiretional route between every pair of directly connected nodes in the network.
static void connectNeighbors(java.lang.Object[] nodes_)
          Setup a bidiretional route between every pair of directly connected nodes in the given node array.
static void connectTCP(Component p1_, Component p2_)
          Connects two TCP components (TCP-TCPSink or TCPb's) with protocol ID automatically assigned
static boolean connectTCP(Component p1_, Component p2_, int protocolID_)
          Connects two TCP components (TCP-TCPSink or TCPb's) with the specified protocol ID.
static int[][] createMeshAdjMatrix(int nc_, int nr_)
          Creates and returns the adjacency matrix for a regular mesh topology of the given size.
static void createNodes(Component network_, int nNodes_)
          Creates nodes.
static void createNodes(Component network_, int startIndex_, int endIndex_)
          Creates nodes.
static void createNodes(Component network_, java.lang.String idPrefix_, int nNodes_)
          Creates nodes.
static void createNodes(Component network_, java.lang.String idPrefix_, int nNodes_, boolean assignAddress_)
           
static void createNodes(Component network_, java.lang.String idPrefix_, int startIndex_, int endIndex_)
          Creates nodes.
static void createNodes(Component network_, java.lang.String idPrefix_, int startIndex_, int endIndex_, long[] ids_)
           
static void createTopology(Component network_, int[][] adjMatrix_)
          Creates a network topology based on an adjacency matrix.
static void createTopology(Component network_, int[][] adjMatrix_, boolean assignAddress_)
          Creates a network topology based on an adjacency matrix.
static void createTopology(Component network_, int[][] adjMatrix_, Link link_)
          Creates a network topology based on an adjacency matrix.
static void createTopology(Component network_, int[][] adjMatrix_, Link link_, boolean assignAddress_)
          Creates a network topology based on an adjacency matrix.
static void createTopology(Component network_, int[][] adjMatrix_, long[] ids_)
          Creates a network topology based on an adjacency matrix.
static void createTopology(Component network_, int[][] adjMatrix_, long[] ids_, Link link_)
          Creates a network topology based on an adjacency matrix.
static void createTopology(Component network_, java.lang.Object[] existing_, int[][] adjMatrix_)
          Creates a network topology based on an adjacency matrix.
static void createTopology(Component network_, java.lang.Object[] existing_, int[][] adjMatrix_, boolean assignAddress_)
          Creates a network topology based on an adjacency matrix.
static void createTopology(Component network_, java.lang.Object[] existing_, int[][] adjMatrix_, Link link_)
          Creates a network topology based on an adjacency matrix.
static void createTopology(Component network_, java.lang.Object[] existing_, int[][] adjMatrix_, Link link_, boolean assignAddress_)
          Creates a network topology based on an adjacency matrix.
static void createTopology(Component network_, java.lang.Object[] existing_, int[][] adjMatrix_, long[] ids_)
          Creates a network topology based on an adjacency matrix.
static void createTopology(Component network_, java.lang.Object[] existing_, int[][] adjMatrix_, long[] ids_, Link link_)
          Creates a network topology based on an adjacency matrix.
static void createTopology(Component network_, java.lang.String routerIDPrefix_, java.lang.String hostIDPrefix_, int[][] adjMatrix_, Link link_)
          Creates a network topology based on an adjacency matrix.
static void createTopology(Component network_, java.lang.String routerIDPrefix_, java.lang.String hostIDPrefix_, int[][] adjMatrix_, Link link_, boolean assignAddress_)
          Creates a network topology based on an adjacency matrix.
static void createTopology(Component network_, java.lang.String routerIDPrefix_, java.lang.String hostIDPrefix_, int[][] adjMatrix_, long[] ids_, Link link_)
          Creates a network topology based on an adjacency matrix.
static void createTopology(Component network_, java.lang.String routerIDPrefix_, java.lang.String hostIDPrefix_, java.lang.Object[] existing_, int[][] adjMatrix_, Link link_)
          Creates a network topology based on an adjacency matrix.
static void createTopology(Component network_, java.lang.String routerIDPrefix_, java.lang.String hostIDPrefix_, java.lang.Object[] existing_, int[][] adjMatrix_, Link link_, boolean assignAddress_)
          Creates a network topology based on an adjacency matrix.
static void createTopology(Component network_, java.lang.String routerIDPrefix_, java.lang.String hostIDPrefix_, java.lang.Object[] existing_, int[][] adjMatrix_, long[] ids_, Link link_)
          Creates a network topology based on an adjacency matrix.
static void createTopology(Component network_, java.lang.String routerIDPrefix_, java.lang.String hostIDPrefix_, java.lang.Object[] existing_, int[][] adjMatrix_, long[] ids_, Link link_, boolean assignAddress_)
          Creates a network topology based on an adjacency matrix.
static Component createTrafficSource(TrafficModel trafficModel_, long dest_)
          Returns a traffic generator component that can be attached to core service layer.
static Component createTrafficSource(TrafficModel trafficModel_, long src_, long dest_, long tos_)
          Returns a traffic generator component that generates Inet packets.
static Component createTrafficSource(TrafficModel trafficModel_, Node dest_)
          Returns a traffic generator component that can be attached to core service layer.
static Component createTrafficSource(TrafficModel trafficModel_, java.lang.String id_, Node src_, Node dest_, long tos_, int protocol_)
          Creates a traffic generator component that generates Inet packets and installs it on the source node.
static TrafficSourceComponent createTrafficSource(TrafficModel trafficSourceModel_, TrafficModel trafficShaperModel_, long dest_)
          Returns a ``shaped'' traffic source component that can be attached to core service layer.
static TrafficSourceComponent createTrafficSource(TrafficModel trafficSourceModel_, TrafficModel trafficShaperModel_, long src_, long dest_, long tos_)
          Returns a ``shaped'' traffic source component that generates Inet packets.
static TrafficSourceComponent createTrafficSource(TrafficModel trafficSourceModel_, TrafficModel trafficShaperModel_, java.lang.String id_, Node src_, Node dest_, long tos_, int protocol_)
          Creates a ``shaped'' traffic source component that generates Inet packets and installs it on the source node.
static int[][] getAdjMatrixFromFile(java.lang.String filename_)
           
static int getPID(Component c_)
          Returns the protocol ID of the component if the component is a well-defined protocol.
static void setAddressByCIDR(Network network_)
           
static void setAddressByCIDR(Network network_, long baseAddress_)
           
static void setAddressByCIDR(java.lang.Object[] nodes_)
           
static void setAddressByCIDR(java.lang.Object[] nodes_, long baseAddress_)
           
static void setAddressByID(Network network_)
          Assigns network addresses to all nodes in the network by extracting from component IDs.
static void setAddressByID(Node node_)
          Assigns a network address to the argument node by extracting from its component ID.
static void setAddressByID(java.lang.Object[] nodes_)
          Assigns network addresses to nodes by extracting from component IDs.
static void setIDByAddress(Component network_)
           
static void setIDByAddress(java.lang.Object[] nodes_)
           
static void setNamTraceOn(Component net_, NamTrace nam_)
          Sets up a NamTrace on a network component.
static void setNamTraceOn(Component net_, NamTrace nam_, java.lang.String filename_, java.lang.String[] colors_)
          Sets up a NamTrace on a network component.
static NamTrace setNamTraceOn(Component net_, java.lang.String filename_, java.lang.String[] colors_)
          Sets up a NamTrace on a network component.
static void setupBRoute(Node sourceNode, Node destNode)
          Setup a bidiretional route between two directly connected nodes.
static void setupRoute(Node sourceNode, Node destNode)
          Setup a route between two directly connected nodes.
static void setupRoutes(Component src_, Component dest_, long destAddr_, long destAddrMask_)
          Sets up routing table entries between two nodes.
static void setupRoutes(Component network_, int[][] adjMatrix_)
          Sets up unicast routes (min-hop) in the network in one shot.
static void setupRoutes(Component network_, int[][] adjMatrix_, long[] addr_)
          Same as setupRoutes(Component, int[][]) except that this method allows node addresses to be arbitrary as specified in addr_.
static void setupRoutes(Component network_, int[][] adjMatrix_, long[] addr_, LinkCost linkcost_)
          Same as #setupRoutes(Component, int[][], LinkCost) except that this method allows node addresses to be arbitrary as specified in addr_.
static void setupRoutes(Component src_, java.lang.Object[] dest_, long destAddr_)
          Sets up routing table entries between the source node and multiple destination nodes.
static void setupRoutes(Component src_, java.lang.Object[] dest_, long destAddr_, long destAddrMask_)
          Sets up routing table entries between the source node and multiple destination nodes.
static void setupRoutes(Component src_, java.lang.Object[] dests_, long srcAddr_, long srcAddrMask_, long destAddr_, long destAddrMask_)
          Sets up routing table entries between the source node and multiple destination nodes.
static void setupRoutes(Node[] nodes_, int[][] adjMatrix_, LinkCost linkcost_)
          Sets up unicast routes (min-cost) in the network in one shot.
static void setupRoutes(Node src_, Node dest_)
           
static void setupRoutes(Node src_, Node dest_, java.lang.String bidirect_)
           
static void setupVIF(Node n1_, int vifindex1_, int mtu1_, Node n2_, int vifindex2_, int mtu2_)
          Sets up virtual interfaces between two nodes.
static void setupVIF(Node n1_, int vifindex1_, Node n2_, int vifindex2_)
           
static void setupVIF(Node n1_, int vifindex1_, Node n2_, int vifindex2_, int mtu_)
           
static java.lang.String toString(Network network_)
          Prints the network address and mask of the specified network.
static java.lang.String traceRoute(Node from_, Node to_)
          Returns the result of trace route in the format of "(hop): (hop_address), if=(outgoing_interface)", a line for each hop.
static java.lang.String traceRoute(Node from_, Node to_, long dest_)
          Returns the result of trace route in the format of "(hop): (hop_address), if=(outgoing_interface)", a line for each hop.
static java.lang.Object[] traceRouteInObj(Node from_, Node to_)
          Returns the result of trace route in an array.
static java.lang.Object[] traceRouteInObj(Node from_, Node to_, long dest_)
          Returns the result of trace route in an array.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

InetUtil

public InetUtil()
Method Detail

traceRoute

public static java.lang.String traceRoute(Node from_,
                                          Node to_)
Returns the result of trace route in the format of "(hop): (hop_address), if=(outgoing_interface)", a line for each hop.

See Also:
traceRouteInObj(Node, Node)

traceRoute

public static java.lang.String traceRoute(Node from_,
                                          Node to_,
                                          long dest_)
Returns the result of trace route in the format of "(hop): (hop_address), if=(outgoing_interface)", a line for each hop.

See Also:
traceRouteInObj(Node, Node)

traceRouteInObj

public static java.lang.Object[] traceRouteInObj(Node from_,
                                                 Node to_)
Returns the result of trace route in an array. The result is based on the routing table in the nodes. Every two elements in the array represent address (Long) and interface (Integer) for the corresponding hop along the route. Returns partial route if destination is not reachable for any reason.


traceRouteInObj

public static java.lang.Object[] traceRouteInObj(Node from_,
                                                 Node to_,
                                                 long dest_)
Returns the result of trace route in an array. The result is based on the routing table in the nodes. Every two elements in the array represent address (Long) and interface (Integer) for the corresponding hop along the route. Returns partial route if destination is not reachable for any reason.

Parameters:
dest_ - destination address. Node to_ must contain this address.

createMeshAdjMatrix

public static int[][] createMeshAdjMatrix(int nc_,
                                          int nr_)
Creates and returns the adjacency matrix for a regular mesh topology of the given size.

Parameters:
nc_ - # of columns in the mesh.
nr_ - # of rows in the mesh.

createNodes

public static void createNodes(Component network_,
                               int startIndex_,
                               int endIndex_)
Creates nodes.

Parameters:
endIndex_ - exclusive.

createNodes

public static void createNodes(Component network_,
                               java.lang.String idPrefix_,
                               int startIndex_,
                               int endIndex_)
Creates nodes.

Parameters:
endIndex_ - exclusive.

createNodes

public static void createNodes(Component network_,
                               java.lang.String idPrefix_,
                               int startIndex_,
                               int endIndex_,
                               long[] ids_)

createNodes

public static void createNodes(Component network_,
                               int nNodes_)
Creates nodes.


createNodes

public static void createNodes(Component network_,
                               java.lang.String idPrefix_,
                               int nNodes_)
Creates nodes.


createNodes

public static void createNodes(Component network_,
                               java.lang.String idPrefix_,
                               int nNodes_,
                               boolean assignAddress_)

getAdjMatrixFromFile

public static int[][] getAdjMatrixFromFile(java.lang.String filename_)
                                    throws java.lang.Exception
Throws:
java.lang.Exception

createTopology

public static void createTopology(Component network_,
                                  int[][] adjMatrix_)
Creates a network topology based on an adjacency matrix. The method calls createTopology(network_, "n", "h", null, adjMatrix_, null, null, true).

See Also:
createTopology(Component, String, String, Object[], int[][], long[], Link, boolean)

createTopology

public static void createTopology(Component network_,
                                  int[][] adjMatrix_,
                                  boolean assignAddress_)
Creates a network topology based on an adjacency matrix. The method calls createTopology(network_, "n", "h", null, adjMatrix_, null, null, assignAddress_).

See Also:
createTopology(Component, String, String, Object[], int[][], long[], Link, boolean)

createTopology

public static void createTopology(Component network_,
                                  int[][] adjMatrix_,
                                  long[] ids_)
Creates a network topology based on an adjacency matrix. The method calls createTopology(network_, "n", "h", null, adjMatrix_, ids_, null, true).

See Also:
createTopology(Component, String, String, Object[], int[][], long[], Link, boolean)

createTopology

public static void createTopology(Component network_,
                                  java.lang.Object[] existing_,
                                  int[][] adjMatrix_)
Creates a network topology based on an adjacency matrix. The method calls createTopology(network_, "n", "h", existing_, adjMatrix_, null, null, true).

See Also:
createTopology(Component, String, String, Object[], int[][], long[], Link, boolean)

createTopology

public static void createTopology(Component network_,
                                  java.lang.Object[] existing_,
                                  int[][] adjMatrix_,
                                  boolean assignAddress_)
Creates a network topology based on an adjacency matrix. The method calls createTopology(network_, "n", "h", existing_, adjMatrix_, null, null, assignAddress_).

See Also:
createTopology(Component, String, String, Object[], int[][], long[], Link, boolean)

createTopology

public static void createTopology(Component network_,
                                  java.lang.Object[] existing_,
                                  int[][] adjMatrix_,
                                  long[] ids_)
Creates a network topology based on an adjacency matrix. The method calls createTopology(network_, "n", "h", existing_, adjMatrix_, ids_, null, true).

See Also:
createTopology(Component, String, String, Object[], int[][], long[], Link, boolean)

createTopology

public static void createTopology(Component network_,
                                  int[][] adjMatrix_,
                                  Link link_)
Creates a network topology based on an adjacency matrix. The method calls createTopology(network_, "n", "h", null, adjMatrix_, null, link_, true).

See Also:
createTopology(Component, String, String, Object[], int[][], long[], Link, boolean)

createTopology

public static void createTopology(Component network_,
                                  int[][] adjMatrix_,
                                  Link link_,
                                  boolean assignAddress_)
Creates a network topology based on an adjacency matrix. The method calls createTopology(network_, "n", "h", null, adjMatrix_, null, link_, assignAddress_).

See Also:
createTopology(Component, String, String, Object[], int[][], long[], Link, boolean)

createTopology

public static void createTopology(Component network_,
                                  int[][] adjMatrix_,
                                  long[] ids_,
                                  Link link_)
Creates a network topology based on an adjacency matrix. The method calls createTopology(network_, "n", "h", null, adjMatrix_, ids_, link_, true).

See Also:
createTopology(Component, String, String, Object[], int[][], long[], Link, boolean)

createTopology

public static void createTopology(Component network_,
                                  java.lang.Object[] existing_,
                                  int[][] adjMatrix_,
                                  Link link_)
Creates a network topology based on an adjacency matrix. The method calls createTopology(network_, "n", "h", existing_, adjMatrix_, null, link_, true).

See Also:
createTopology(Component, String, String, Object[], int[][], long[], Link, boolean)

createTopology

public static void createTopology(Component network_,
                                  java.lang.Object[] existing_,
                                  int[][] adjMatrix_,
                                  Link link_,
                                  boolean assignAddress_)
Creates a network topology based on an adjacency matrix. The method calls createTopology(network_, "n", "h", existing_, adjMatrix_, null, link_, assignAddress_).

See Also:
createTopology(Component, String, String, Object[], int[][], long[], Link, boolean)

createTopology

public static void createTopology(Component network_,
                                  java.lang.Object[] existing_,
                                  int[][] adjMatrix_,
                                  long[] ids_,
                                  Link link_)
Creates a network topology based on an adjacency matrix. The method calls createTopology(network_, "n", "h", existing_, adjMatrix_, ids_, link_, true).

See Also:
createTopology(Component, String, String, Object[], int[][], long[], Link, boolean)

createTopology

public static void createTopology(Component network_,
                                  java.lang.String routerIDPrefix_,
                                  java.lang.String hostIDPrefix_,
                                  int[][] adjMatrix_,
                                  Link link_)
Creates a network topology based on an adjacency matrix. The method calls createTopology(network_, nodeIDPrefix_, nodeIDPrefix_, null, adjMatrix_, null, link_, true).

See Also:
createTopology(Component, String, String, Object[], int[][], long[], Link, boolean)

createTopology

public static void createTopology(Component network_,
                                  java.lang.String routerIDPrefix_,
                                  java.lang.String hostIDPrefix_,
                                  int[][] adjMatrix_,
                                  long[] ids_,
                                  Link link_)
Creates a network topology based on an adjacency matrix. The method calls createTopology(network_, nodeIDPrefix_, nodeIDPrefix_, null, adjMatrix_, ids_, link_, true).

See Also:
createTopology(Component, String, String, Object[], int[][], long[], Link, boolean)

createTopology

public static void createTopology(Component network_,
                                  java.lang.String routerIDPrefix_,
                                  java.lang.String hostIDPrefix_,
                                  int[][] adjMatrix_,
                                  Link link_,
                                  boolean assignAddress_)
Creates a network topology based on an adjacency matrix. The method calls createTopology(network_, nodeIDPrefix_, nodeIDPrefix_, null, adjMatrix_, null, link_, assignAddress_).

See Also:
createTopology(Component, String, String, Object[], int[][], long[], Link, boolean)

createTopology

public static void createTopology(Component network_,
                                  java.lang.String routerIDPrefix_,
                                  java.lang.String hostIDPrefix_,
                                  java.lang.Object[] existing_,
                                  int[][] adjMatrix_,
                                  Link link_)
Creates a network topology based on an adjacency matrix. The method calls createTopology(network_, nodeIDPrefix_, nodeIDPrefix_, existing_, adjMatrix_, null, link_, true).

See Also:
createTopology(Component, String, String, Object[], int[][], long[], Link, boolean)

createTopology

public static void createTopology(Component network_,
                                  java.lang.String routerIDPrefix_,
                                  java.lang.String hostIDPrefix_,
                                  java.lang.Object[] existing_,
                                  int[][] adjMatrix_,
                                  Link link_,
                                  boolean assignAddress_)
Creates a network topology based on an adjacency matrix. The method calls createTopology(network_, nodeIDPrefix_, nodeIDPrefix_, existing_, adjMatrix_, null, link_, assignAddress_).

See Also:
createTopology(Component, String, String, Object[], int[][], long[], Link, boolean)

createTopology

public static void createTopology(Component network_,
                                  java.lang.String routerIDPrefix_,
                                  java.lang.String hostIDPrefix_,
                                  java.lang.Object[] existing_,
                                  int[][] adjMatrix_,
                                  long[] ids_,
                                  Link link_)
Creates a network topology based on an adjacency matrix. The method calls createTopology(network_, nodeIDPrefix_, nodeIDPrefix_, existing_, adjMatrix_, ids_, link_, true).

See Also:
createTopology(Component, String, String, Object[], int[][], long[], Link, boolean)

createTopology

public static void createTopology(Component network_,
                                  java.lang.String routerIDPrefix_,
                                  java.lang.String hostIDPrefix_,
                                  java.lang.Object[] existing_,
                                  int[][] adjMatrix_,
                                  long[] ids_,
                                  Link link_,
                                  boolean assignAddress_)
Creates a network topology based on an adjacency matrix. The adjacency matrix is a two-dimensional array. The length of the first dimension, i.e., adjMatrix_.length, is the number of nodes. Each element in the first dimension is a one-dimensional array, which represents the neighbors of the node. The position of a neighbor in this one-dimensional array is the ID of the port that the node uses to connect to the neighbor. Nodes are indexed as 0, 1,..., (adjMatrix_.length-1). The neighbors are represented by their indices. Each node may have a different number of neighbors. As a result, the adjacency matrix looks like below:

  Port index -->        (port 0@)          (port 1@)
          node   (node 0)        neighbor(0,0)      neighbor(0,1)     ... neighbor(0, nb0)
          index  (node 1)        neighbor(1,0)      neighbor(1,1)     ... neighbor(1, nb1)
           |    ...
           V    (node (n-1))    neighbor((n-1),0)  neighbor((n-1),1) ... neighbor((n-1), nbn-1)
         

where n is the number of nodes, nbi is the number of neighbors of node i. The method distiguishes hosts and routers when specifying node IDs. Hosts are nodes with exactly one neighbor. Routers are nodes with more than one neighbor. Nodes are not created if it has no neighbor.

Parameters:
network_ - the component to put all the created nodes and links in.
routerIDPrefix_ - ID prefix for routers. The component ID of a node created is set to the concatenation of the ID prefix and the node index in the adjacency matrix. If a node has more than one connection, then it is considered as a router and this argument is used as its ID prefix to construct its component ID.
hostIDPrefix_ - ID prefix for hosts. If a node has none or one connection, then it is considered as a host, and this argument is used as its ID prefix to construct its component ID. See routerIDPrefix_.
existing_ - Array of the existing nodes/networks that are used in constructing the topology One may use existing components in creating the topology. The existing components are put in an array. The indices to this array are the node indices as to adjMatrix_. When creating the topology, a node is retrieved from this array, instead of created anew, only if the index does not excess the size of the array and the corresponding element in this array is not null.
adjMatrix_ - The adjacency matrix. See above.
ids_ - One may explicitly specify the ID's for the nodes. The indices to this array are the node indices as to adjMatrix_. If the array is not null, then its values are used, instead of the node indices, to construct the component ID's. See routerIDPrefix_.
link_ - the link component used to connect nodes. Nodes are directly connected if null is specified.
assignAddress_ - if true, this method will assign network addresses to all newly created nodes based on the component ID's.

setAddressByID

public static void setAddressByID(Network network_)
Assigns network addresses to all nodes in the network by extracting from component IDs. The method calls setAddressByID(network_.getAllComponents()).

Parameters:
network_ - the network component.
See Also:
setAddressByID(Object[])

setAddressByID

public static void setAddressByID(Node node_)
Assigns a network address to the argument node by extracting from its component ID.


setAddressByID

public static void setAddressByID(java.lang.Object[] nodes_)
Assigns network addresses to nodes by extracting from component IDs.

Parameters:
nodes_ - array of components. Components that are not drcl.inet.Node are omitted processed.

setIDByAddress

public static void setIDByAddress(Component network_)

setIDByAddress

public static void setIDByAddress(java.lang.Object[] nodes_)

setAddressByCIDR

public static void setAddressByCIDR(Network network_)

setAddressByCIDR

public static void setAddressByCIDR(Network network_,
                                    long baseAddress_)

setAddressByCIDR

public static void setAddressByCIDR(java.lang.Object[] nodes_)

setAddressByCIDR

public static void setAddressByCIDR(java.lang.Object[] nodes_,
                                    long baseAddress_)

createTrafficSource

public static Component createTrafficSource(TrafficModel trafficModel_,
                                            Node dest_)
Returns a traffic generator component that can be attached to core service layer.


createTrafficSource

public static Component createTrafficSource(TrafficModel trafficModel_,
                                            long dest_)
Returns a traffic generator component that can be attached to core service layer.


createTrafficSource

public static TrafficSourceComponent createTrafficSource(TrafficModel trafficSourceModel_,
                                                         TrafficModel trafficShaperModel_,
                                                         long dest_)
Returns a ``shaped'' traffic source component that can be attached to core service layer.


createTrafficSource

public static Component createTrafficSource(TrafficModel trafficModel_,
                                            long src_,
                                            long dest_,
                                            long tos_)
Returns a traffic generator component that generates Inet packets.


createTrafficSource

public static TrafficSourceComponent createTrafficSource(TrafficModel trafficSourceModel_,
                                                         TrafficModel trafficShaperModel_,
                                                         long src_,
                                                         long dest_,
                                                         long tos_)
Returns a ``shaped'' traffic source component that generates Inet packets.


createTrafficSource

public static Component createTrafficSource(TrafficModel trafficModel_,
                                            java.lang.String id_,
                                            Node src_,
                                            Node dest_,
                                            long tos_,
                                            int protocol_)
Creates a traffic generator component that generates Inet packets and installs it on the source node.

Parameters:
id_ - the component ID of the generator.
protocol_ - the protocol ID for the generator.

createTrafficSource

public static TrafficSourceComponent createTrafficSource(TrafficModel trafficSourceModel_,
                                                         TrafficModel trafficShaperModel_,
                                                         java.lang.String id_,
                                                         Node src_,
                                                         Node dest_,
                                                         long tos_,
                                                         int protocol_)
Creates a ``shaped'' traffic source component that generates Inet packets and installs it on the source node.

Parameters:
id_ - the component ID of the generator.
protocol_ - the protocol ID for the generator.

toString

public static java.lang.String toString(Network network_)
Prints the network address and mask of the specified network.


setupVIF

public static void setupVIF(Node n1_,
                            int vifindex1_,
                            Node n2_,
                            int vifindex2_)

setupVIF

public static void setupVIF(Node n1_,
                            int vifindex1_,
                            Node n2_,
                            int vifindex2_,
                            int mtu_)

setupVIF

public static void setupVIF(Node n1_,
                            int vifindex1_,
                            int mtu1_,
                            Node n2_,
                            int vifindex2_,
                            int mtu2_)
Sets up virtual interfaces between two nodes.

Parameters:
mtu_ - may be less than zero if the interface has the maximum MTU.

configure

public static void configure(Component network_)
Configures the "host" routing entries and the interface info at the area boundary routers. In the INET framework, an area is encapsulated in a Network component. An area boundary router is defined as the one that has one or more connections (to other hosts/routers) that either cross its parent (Network) component's boundary or are connected to hosts. A host is a node that has only one connection AND does not contain routing table in it.


configure

public static void configure(java.lang.Object[] nodes_)
Configures the "host" routing entries and the interface info at the area boundary routers. In the INET framework, an area is encapsulated in a Network component. An area boundary router is defined as the one that has one or more connections (to other hosts/routers) that either cross its parent (Network) component's boundary or are connected to hosts. A host is a node that has only one connection AND does not contain routing table in it.


configureFlat

public static void configureFlat(Component network_)
Calls configureFlat(network_.getAllComponents(), true, true).


configureFlat

public static void configureFlat(Component network_,
                                 boolean reassignNodeID_,
                                 boolean setupInterface_)
Calls configureFlat(network_.getAllComponents(), reassignNodeID_, setupInterface_).


configureFlat

public static void configureFlat(java.lang.Object[] nodes_)
Calls configureFlat(nodes_, true, true).


configureFlat

public static void configureFlat(java.lang.Object[] nodes_,
                                 boolean reassignNodeID_,
                                 boolean setupInterface_)
Sets up the "host" routing entries and the interface info at the area boundary routers in the flat network. In a flat network, an area (or subnet) consists of a router and one or more hosts. The router is called the area boundary router (ABR). ABR may connect to one or more routers outside the area. A host is a node that has only one connection AND does not contain routing table in it.

The area can be represented by an area address in the format of a base address and a mask.

The interfaces of an ABR connected to other routers (outside of the area) are on the boundary of the area and called boundary interfaces. The method performs three tasks (two are optional and controlled by two flags in the arguments): (1) set up routing table entries in each ABR for the ABR to reach the hosts that are connected to it; (2) re-assign node IDs (addresses) to ABRs and hosts (optional); (3) put the area/subnet address to the boundary interfaces of ABRs (optional). This information can be used by a dynamic routing protocol for distributing route entries in a more compact fashion.

Parameters:
nodes_ - contains all the ABRs to be configured.
reassignNodeID_ - set to true if one wishes to re-assign node IDs (addresses) automatically; set to false to keep current node IDs.
setupInterface_ - set to true if one wishes to set up area/subnet address on the boundary interfaces.

setupRoutes

public static void setupRoutes(Component network_,
                               int[][] adjMatrix_)
Sets up unicast routes (min-hop) in the network in one shot. It sets up routes bi-directionally for every pair of nodes in the network. Assumes that nodes are addressed at 0, 1, 2 and so on. It runs n times of the shortest path algorithm to compute a shortest path tree for each node as source. This may take a long time for large networks.

Parameters:
network_ - contains all the nodes to be configured.
adjMatrix_ - adjacency matrix describing network topology.

setupRoutes

public static void setupRoutes(Node[] nodes_,
                               int[][] adjMatrix_,
                               LinkCost linkcost_)
Sets up unicast routes (min-cost) in the network in one shot. It sets up routes bi-directionally for every pair of nodes in the network. Assumes that nodes are addressed at 0, 1, 2 and so on. It runs n times of the shortest path algorithm to This may take a long time for large networks.

Parameters:
nodes_ - array of nodes to be configured.
adjMatrix_ - adjacency matrix describing network topology.
linkcost_ - cost matrix for network links; use downstream node index as the first argument and the interface index of the downstream node (to the upstream node) as the 2nd argument. The interface index should be consistent with that in adjMatrix_. For the format of adjMatrix, see createTopology(Component,String, String,Object[],int[][],long[],drcl.inet.Link,boolean)

setupRoutes

public static void setupRoutes(Component network_,
                               int[][] adjMatrix_,
                               long[] addr_)
Same as setupRoutes(Component, int[][]) except that this method allows node addresses to be arbitrary as specified in addr_.

Parameters:
network_ - contains all the nodes to be configured.
adjMatrix_ - adjacency matrix describing network topology.
addr_ - node addresses. Indexing is matched between addr_ and adjMatrix_.

setupRoutes

public static void setupRoutes(Component network_,
                               int[][] adjMatrix_,
                               long[] addr_,
                               LinkCost linkcost_)
Same as #setupRoutes(Component, int[][], LinkCost) except that this method allows node addresses to be arbitrary as specified in addr_.

Parameters:
network_ - contains all the nodes to be configured.
adjMatrix_ - adjacency matrix describing network topology.
addr_ - node addresses. Indexing is matched between addr_ and adjMatrix_.
linkcost_ - see setupRoutes(Node[],int[][],LinkCost).

setupRoutes

public static void setupRoutes(Node src_,
                               Node dest_)

setupRoutes

public static void setupRoutes(Node src_,
                               Node dest_,
                               java.lang.String bidirect_)

setupRoutes

public static void setupRoutes(Component src_,
                               Component dest_,
                               long destAddr_,
                               long destAddrMask_)
Sets up routing table entries between two nodes. Useful for hierarchical network where dest_ could be a network component with (destAddr_, destAddrMask_) as its network address.

Parameters:
destAddr_ - destination address, could be a multicast address.

setupRoutes

public static void setupRoutes(Component src_,
                               java.lang.Object[] dest_,
                               long destAddr_)
Sets up routing table entries between the source node and multiple destination nodes.

Parameters:
destAddr_ - destination address, could be a multicast address.

setupRoutes

public static void setupRoutes(Component src_,
                               java.lang.Object[] dest_,
                               long destAddr_,
                               long destAddrMask_)
Sets up routing table entries between the source node and multiple destination nodes.

Parameters:
destAddr_ - destination address, could be a multicast address.

setupRoutes

public static void setupRoutes(Component src_,
                               java.lang.Object[] dests_,
                               long srcAddr_,
                               long srcAddrMask_,
                               long destAddr_,
                               long destAddrMask_)
Sets up routing table entries between the source node and multiple destination nodes. Useful for hierarchical network where dest_ could be a network component with (destAddr_, destAddrMask_) as its network address.

Parameters:
destAddr_ - destination address, could be a multicast address.

setupRoute

public static void setupRoute(Node sourceNode,
                              Node destNode)
Setup a route between two directly connected nodes. (c) 2002, Infonet Group, University of Namur, Belgium


setupBRoute

public static void setupBRoute(Node sourceNode,
                               Node destNode)
Setup a bidiretional route between two directly connected nodes. (c) 2002, Infonet Group, University of Namur, Belgium


connectNeighbors

public static void connectNeighbors(Component network_)
Setup a bidiretional route between every pair of directly connected nodes in the network.


connectNeighbors

public static void connectNeighbors(java.lang.Object[] nodes_)
Setup a bidiretional route between every pair of directly connected nodes in the given node array.


setNamTraceOn

public static NamTrace setNamTraceOn(Component net_,
                                     java.lang.String filename_,
                                     java.lang.String[] colors_)
Sets up a NamTrace on a network component. This method creates a NamTrace component and hooks it up with all the nodes, links and queues in the network component. Currently, this method only works for flat point-to-point network topology.


setNamTraceOn

public static void setNamTraceOn(Component net_,
                                 NamTrace nam_,
                                 java.lang.String filename_,
                                 java.lang.String[] colors_)
Sets up a NamTrace on a network component. This method creates a NamTrace component and hooks it up with all the nodes, links and queues in the network component. If nam_ is not added to a component hierarchy, it is added to net_. A FileComponent is added to net_ and connected to nam_ to save the NAM trace. Currently, this method only works for flat point-to-point network topology.


setNamTraceOn

public static void setNamTraceOn(Component net_,
                                 NamTrace nam_)
Sets up a NamTrace on a network component. This method hooks up all the nodes, links and queues in the network component. Currently, this method only works for flat point-to-point network topology.


getPID

public static int getPID(Component c_)
Returns the protocol ID of the component if the component is a well-defined protocol. The protocol name is obtained from Component.getName().

Returns:
-1 if the protocol ID is not defined.

connectTCP

public static void connectTCP(Component p1_,
                              Component p2_)
Connects two TCP components (TCP-TCPSink or TCPb's) with protocol ID automatically assigned. * The TCP components must be added to a Node before one can call this method.


connectTCP

public static boolean connectTCP(Component p1_,
                                 Component p2_,
                                 int protocolID_)
Connects two TCP components (TCP-TCPSink or TCPb's) with the specified protocol ID. The TCP components must be added to a Node before one can call this method. Returns false if the protcol ID is already in use.


connect

public static void connect(Component p1_,
                           Component p2_)
Connects two protocol components. It assigns protocol ID automatically.


connect

public static boolean connect(Component p1_,
                              Component p2_,
                              int protocolID_)
Connects two protocol components with the specified protocol ID. Returns false if the protcol ID is already in use.


J-Sim v1.3p4 API