|
DRCL J-Sim API | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectdrcl.DrclObj
drcl.comp.Component
drcl.inet.NodeBuilder
The container class for automating the process of constructing a network node.
This class has a set of build(...) methods to build the internal
structure of nodes. But before using this class to build other nodes, one needs
to build the NodeBuilder first. Building a NodeBuilder is no difference from
building a real node (i.e., adding components and connecting them).
But since the relation between the modules in the upper protocol layer (UPL) and
the core service layer (CSL) is defined, we can further automate the process by
having a set of port naming rules for a protocol:
| Rules | How NodeBuilder Behaves | |
|---|---|---|
| If a protocol wants to have (service), or listen to (event)... |
then it must have (port) | when sees this port, NodeBuilder connects it with (port) of CSL |
| data services | down@ | <protocol ID>@up |
| packet arrival events | .pktarrival@ | .pktarrival@ |
| identity services | .service_id@ | .service_id@ |
| identity events | .id@ | .id@ |
| routing table services | .service_rt@ | .service_rt@ |
| unicast route query | .ucastquery@ | .ucastquery@ |
| multicast route query | .mcastquery@ | .mcastquery@ |
| unicast route events | .rt_ucast@ | .rt_ucast@ |
| multicast route events | .rt_mcast@ | .rt_mcast@ |
| interface/neighbor services | .service_if@ | .service_if@ |
| neighbor events (physical) | .if@ | .if@ |
| neighbor events (virtual) | .vif@ | .vif@ |
| packet filter configuration service | .configswitch@ | .configswitch@ |
If a protocol follows the rules, then we can simply add the protocol to
NodeBuilder and NodeBuilder will take care of the connections between
the protocol and CSL. At the end of build(...),
NodeBuilder uses CSL builder to build the internal structure of
CSL. If CSL builder is not specified in the build(...) method,
the default CSL builder is used.
If the upper-protocol-layer modules in a node forms a layered protocol
stack, then one may use a node map to further ease the task of building
a NodeBuilder.
A node map is a plain text which describes the layering relation between
modules. For example, the node map for a UDP application laying on top of
UDP at port 1100 is as follows:
udp 17/csl drcl.inet.transport.UDP app 1100/udp Application_Class
And then we can use the loadmap(String) method
to load a node map into a NodeBuilder. Each line in a node
map corresponds to a module. The syntax is as follows:
<module_id> <port>/<lower_layer_module_id> <module_class>
After parsing a line, NodeBuilder creates the module and
connects the down@ port of the module to the <port>@up
port of the lower layer module. If the lower layer module does not
multiplex/demultiplex, then <port> should be given by "-"
(the "minus" sign). In this case, NodeBuilder
connects the down@ port of the module to the up@ port
of the lower layer module.
The current implementation of NodeBuilder requires that the
lower layer module be defined ahead. The core service layer (csl)
is pre-defined. One may use it as lower layer module without defining it.
If the lower layer module is the core service layer (csl), then
we may omit the <port>/csl field if the protocol is known to
INET. (INET recognizes many Internet standard protocols such as TCP, UDP, IGMP,
DV, OSPF and so on).
There are four build(...) methods in NodeBuilder
for including a node map as an argument:
public void build(Object c_, String nodemap_); public void build(Object[] cc_, String nodemap_); public void build(Object c_, CSLBuilder cb_, String nodemap_); public void build(Object[] cc_, CSLBuilder cb_, String nodemap_);
These methods call loadmap(String) first and then calls the
corresponding build(...) methods without the node map argument.
Note that loading a node map overrides the existing structure in the NodeBuilder.
One may use the same NodeBuilder instance to build different types
of nodes with different node maps.
Some properties can be set in the NodeBuilder.
When the build(...) method is called, these properties are conveyed
and set in the nodes being built. It is
particularly useful when one wishes to set these properties that are common to
the nodes being built. The following table lists the properties defined in the
this class:
| Property | "Set" Method | Description |
|---|---|---|
| interface bandwidth | setBandwidth(double) |
Sets the bandwidth (in bps) of interfaces. The default value applies if non-positive value is given. |
| interface buffer size | setBufferSize(int) |
Sets the buffer size (in bytes or packets, depending on the buffer mode) of interfaces. The default value applies if non-positive value is given. |
| interface buffer mode | setBufferMode(String mode_) |
Sets the buffer mode. The mode_ argument
could be "byte" or "packet". |
| interface maximum transmission unit (MTU) |
setMTU(int) |
Sets the MTU (in bytes) of interfaces, including the size of the packet header (if there is any) for link transimission. The default value applies if negative value is given. Giving zero turns off MTU check (e.g., fragmentation in CSL). |
In addition to relying on NodeBuilder to create service
and event ports at CSL on demands (of UPL modules), one can command
NodeBuilder to create some or all of those ports, including
"up" ports.
To make it happen, one simply adds the service and event ports to the
NodeBuilder, and then, when building a node, the NodeBuilder
duplicates all the service and event ports on it at the CSL created for the
node.
Service and Event Ports at CSL,
CSLBuilder,
Serialized Form| Nested Class Summary |
| Nested classes inherited from class drcl.comp.Component |
Component.Locks |
| Field Summary |
| Constructor Summary | |
NodeBuilder()
|
|
NodeBuilder(java.lang.String id_)
|
|
| Method Summary | |
void |
build(java.lang.Object c_)
Builds the node structure inside the specified container. |
void |
build(java.lang.Object[] cc_)
Builds up the node structure inside the specified containers. |
void |
build(java.lang.Object[] cc_,
CSLBuilder cb_)
Builds up the node structure inside the specified containers together with the CSL builder. |
void |
build(java.lang.Object[] cc_,
CSLBuilder cb_,
java.lang.String map_)
Builds up the node structure inside the specified containers together with the CSL builder and the node map. |
void |
build(java.lang.Object[] cc_,
java.lang.String map_)
Builds up the node structure inside the specified containers with a node map. |
void |
build(java.lang.Object c_,
CSLBuilder cb_)
Builds the node structure inside the specified container together with the CSL builder. |
void |
build(java.lang.Object c_,
CSLBuilder cb_,
java.lang.String map_)
Builds the node structure inside the specified container together with the CSL builder and a map. |
void |
build(java.lang.Object c_,
java.lang.String map_)
Builds the node structure inside the specified container with a node map. |
void |
duplicate(java.lang.Object source_)
Duplicates the content of source_, including ID, name, child components and connections among them, to this component. |
void |
extract(Node node_)
Extracts the structure of an existing Node to the builder. |
double |
getBandwidth()
|
java.lang.String |
getBufferMode()
|
int |
getBufferSize()
|
double |
getLinkPropDelay()
Returns the (global) emulated link propagation delay setting. |
int |
getMTU()
|
java.lang.String |
info()
Returns information regarding this component. |
boolean |
isLinkEmulationEnabled()
|
void |
loadmap(java.lang.String map_)
Loads the node map into this node builder. |
void |
setBandwidth(double bw_)
Sets the bandwidth (in bps) for all the interfaces. |
void |
setBufferMode(java.lang.String mode_)
Sets the buffer mode of all the interfaces. |
void |
setBufferSize(int bs_)
Sets the buffer size (in bytes) for all the interfaces. |
void |
setLinkEmulationEnabled(boolean enabled_)
|
void |
setLinkPropDelay(double delay_)
Sets the (global) emulated link propagation delay setting. |
void |
setMTU(int mtu_)
Sets the maximum transmission unit (MTU) for all interfaces. |
| Methods inherited from class drcl.DrclObj |
clone |
| Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
public NodeBuilder()
public NodeBuilder(java.lang.String id_)
| Method Detail |
public void duplicate(java.lang.Object source_)
Component
duplicate in interface ObjectDuplicableduplicate in class Componentpublic java.lang.String info()
Component
info in class Componentpublic void extract(Node node_)
public void build(java.lang.Object[] cc_)
build(cc_, (CSLBuilder)null).
build(Object[], CSLBuilder)
public void build(java.lang.Object[] cc_,
java.lang.String map_)
build(cc_, null, map_).
build(Object[], CSLBuilder, String)
public void build(java.lang.Object[] cc_,
CSLBuilder cb_,
java.lang.String map_)
loadmap(map_) to create protocols and
applications, and then build(cc_, cb_) to build the nodes.
cc_ - array of components in which the node structure is constructed.
Components other than drcl.inet.Node are omitted processed.cb_ - the CSL builder.map_ - the node map.loadmap(String),
build(Object[], CSLBuilder)public void loadmap(java.lang.String map_)
public void build(java.lang.Object[] cc_,
CSLBuilder cb_)
cb_ is null, then this method finds the
CSL builder inside this node builder as a child component with ID "csl".
If no CSL builder exists, the default CSL builder
(CSLBuilder.DEFAULT_BUILDER) is used.
cc_ - array of components in which the node structure is constructed.
Components other than drcl.inet.Node are omitted processed.cb_ - the CSL builder.CSLBuilderpublic void build(java.lang.Object c_)
build(new Object[]{c_}, (CSLBuilder)null).
c_ - the container component.build(Object[], CSLBuilder)
public void build(java.lang.Object c_,
java.lang.String map_)
build(new Object[]{c_}, null, map_).
c_ - the container component.map_ - the node map.build(Object[], CSLBuilder, String)
public void build(java.lang.Object c_,
CSLBuilder cb_)
build(new Object[]{c_}, cb_).
c_ - the container component.cb_ - the CSL builder.build(Object[], CSLBuilder)
public void build(java.lang.Object c_,
CSLBuilder cb_,
java.lang.String map_)
build(new Object[]{c_}, cb_, map_).
c_ - the container component.cb_ - the CSL builder.map_ - the node map.build(Object[], CSLBuilder, String)public void setBandwidth(double bw_)
public double getBandwidth()
public void setBufferSize(int bs_)
public int getBufferSize()
public void setMTU(int mtu_)
public int getMTU()
public void setBufferMode(java.lang.String mode_)
mode_ - can be either "packet" or "byte".public java.lang.String getBufferMode()
public void setLinkEmulationEnabled(boolean enabled_)
public boolean isLinkEmulationEnabled()
public void setLinkPropDelay(double delay_)
public double getLinkPropDelay()
|
DRCL J-Sim API | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||