public abstract class NetworkElement
extends java.lang.Object
send(NetworkElement, Packet)
for downcall
and handle(NetworkElement, Packet)
for upcall, from components that
are above or below this component in the protocol stack.Modifier and Type | Field and Description |
---|---|
protected double |
lastTimeProcessCalled
Indicates when the last time the method
process(int)
was called, so that the Link knows how much time elapsed
since the last call. |
(package private) java.lang.String |
name
The given name of this network element, used
mostly for reporting/debugging purposes.
|
protected Simulator |
simulator
Object that provides the runtime environment,
mainly stuff related to the simulation clock,
such as timer management and the reference time.
|
Constructor and Description |
---|
NetworkElement(Simulator simulator_,
java.lang.String name_) |
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getName()
Attribute getter.
|
Simulator |
getSimulator()
Getter method.
|
abstract void |
handle(NetworkElement source_,
Packet packet_)
The method to receive packets from a lower-layer protocol.
|
abstract void |
process(int mode_)
The method used by the simulator to signal the passage of time
to this network element.
|
abstract void |
send(NetworkElement source_,
Packet packet_)
The method to send data from an upper-layer protocol.
Note that parameter source_ is usually ignored
but Link.send(NetworkElement, Packet) uses it to
distinguish the nodes connected to its ends. |
protected double lastTimeProcessCalled
process(int)
was called, so that the Link knows how much time elapsed
since the last call.java.lang.String name
protected Simulator simulator
public NetworkElement(Simulator simulator_, java.lang.String name_)
public java.lang.String getName()
name
public Simulator getSimulator()
public abstract void handle(NetworkElement source_, Packet packet_)
source_
- the immediate source network element that passes this packet;
which may not be the original source that generated this packetpacket_
- a packet to receive from below and processpublic abstract void process(int mode_)
lastTimeProcessCalled
).mode_
- the processing mode, depends on the actual network elementSimulator.run(java.nio.ByteBuffer, int)
public abstract void send(NetworkElement source_, Packet packet_)
source_
is usually ignored
but Link.send(NetworkElement, Packet)
uses it to
distinguish the nodes connected to its ends.source_
- the immediate source network element that sends this packet;
note that this may not be the original source that generated this packet,
but rather a router that simply relays someone else's packetpacket_
- a packet from above to transmit