#include <MACRelayUnit.h>
void inet::MACRelayUnit::broadcastFrame |
( |
EtherFrame * |
frame, |
|
|
int |
inputport |
|
) |
| |
|
protectedvirtual |
Utility function: sends the frame on all ports except inputport.
The message pointer should not be referenced any more after this call.
Referenced by handleAndDispatchFrame().
104 for (
int i = 0; i <
numPorts; ++i) {
105 if (i != inputport) {
107 send(frame->dup(),
"ifOut", i);
static simsignal_t packetSentToLowerSignal
Definition: LayeredProtocolBase.h:32
int numPorts
Definition: MACRelayUnit.h:32
void inet::MACRelayUnit::finish |
( |
| ) |
|
|
overrideprotectedvirtual |
Writes statistics.
long numDiscardedFrames
Definition: MACRelayUnit.h:36
long numProcessedFrames
Definition: MACRelayUnit.h:35
void inet::MACRelayUnit::handleAndDispatchFrame |
( |
EtherFrame * |
frame | ) |
|
|
protectedvirtual |
Updates address table with source address, determines output port and sends out (or broadcasts) frame on ports.
Includes calls to updateTableWithAddress() and getPortForAddress().
The message pointer should not be referenced any more after this call.
Referenced by handleMessage().
64 int inputport = frame->getArrivalGate()->getIndex();
72 if (frame->getDest().isBroadcast()) {
73 EV <<
"Broadcasting broadcast frame " << frame << endl;
83 if (inputport == outputport) {
84 EV <<
"Output port is same as input port, " << frame->getFullName()
85 <<
" dest " << frame->getDest() <<
", discarding frame\n";
91 if (outputport >= 0) {
92 EV <<
"Sending frame " << frame <<
" with dest address " << frame->getDest() <<
" to port " << outputport << endl;
94 send(frame,
"ifOut", outputport);
97 EV <<
"Dest address " << frame->getDest() <<
" unknown, broadcasting frame " << frame << endl;
virtual void broadcastFrame(EtherFrame *frame, int inputport)
Utility function: sends the frame on all ports except inputport.
Definition: MACRelayUnit.cc:102
static simsignal_t packetSentToLowerSignal
Definition: LayeredProtocolBase.h:32
long numDiscardedFrames
Definition: MACRelayUnit.h:36
long numProcessedFrames
Definition: MACRelayUnit.h:35
virtual int getPortForAddress(MACAddress &address, unsigned int vid=0)=0
For a known arriving port, V-TAG and destination MAC.
IMACAddressTable * addressTable
Definition: MACRelayUnit.h:31
virtual bool updateTableWithAddress(int portno, MACAddress &address, unsigned int vid=0)=0
Register a new MAC address at AddressTable.
void inet::MACRelayUnit::handleMessage |
( |
cMessage * |
msg | ) |
|
|
overrideprotectedvirtual |
Calls handleIncomingFrame() for frames arrived from outside, and processFrame() for self messages.
52 EV <<
"Message '" << msg <<
"' arrived when module status is down, dropped it\n";
56 EtherFrame *frame = check_and_cast<EtherFrame *>(msg);
virtual void handleAndDispatchFrame(EtherFrame *frame)
Updates address table with source address, determines output port and sends out (or broadcasts) frame...
Definition: MACRelayUnit.cc:62
bool isOperational
Definition: MACRelayUnit.h:38
static simsignal_t packetReceivedFromLowerSignal
Definition: LayeredProtocolBase.h:33
Perform one stage of a lifecycle operation.
Processing may be done entirely within this method, or may be a longer process that involves nonzero simulation time or several events, and is triggered by this method call.
Return value: true = "done"; false = "not yet done, will invoke
doneCallback when done"
Implements inet::ILifecycle.
128 Enter_Method_Silent();
130 if (dynamic_cast<NodeStartOperation *>(operation)) {
135 else if (dynamic_cast<NodeShutdownOperation *>(operation)) {
140 else if (dynamic_cast<NodeCrashOperation *>(operation)) {
146 throw cRuntimeError(
"Unsupported operation '%s'", operation->getClassName());
Definition: NodeOperations.h:49
Stage
Definition: NodeOperations.h:71
Stage
Definition: NodeOperations.h:126
virtual void start()
Definition: MACRelayUnit.cc:114
virtual void stop()
Definition: MACRelayUnit.cc:120
Stage
Definition: NodeOperations.h:46
Definition: NodeOperations.h:127
Definition: NodeOperations.h:77
void inet::MACRelayUnit::initialize |
( |
int |
stage | ) |
|
|
overrideprotectedvirtual |
33 if (gate(
"ifIn", 0)->size() !=
numPorts)
34 throw cRuntimeError(
"the sizes of the ifIn[] and ifOut[] gate vectors must be the same");
38 addressTable = check_and_cast<IMACAddressTable *>(getModuleByPath(par(
"macTablePath")));
44 NodeStatus *nodeStatus =
dynamic_cast<NodeStatus *
>(
findContainingNode(
this)->getSubmodule(
"status"));
bool isOperational
Definition: MACRelayUnit.h:38
cModule * findContainingNode(const cModule *from)
Find the node containing the given module.
Definition: ModuleAccess.cc:56
Local initializations.
Definition: InitStages.h:35
Initialization of link-layer protocols.
Definition: InitStages.h:59
long numDiscardedFrames
Definition: MACRelayUnit.h:36
long numProcessedFrames
Definition: MACRelayUnit.h:35
int numPorts
Definition: MACRelayUnit.h:32
IMACAddressTable * addressTable
Definition: MACRelayUnit.h:31
Definition: NodeStatus.h:40
virtual int inet::MACRelayUnit::numInitStages |
( |
| ) |
const |
|
inlineoverrideprotectedvirtual |
The number of initialization stages.
Definition: InitStages.h:116
void inet::MACRelayUnit::start |
( |
| ) |
|
|
protectedvirtual |
Referenced by handleOperationStage().
virtual void clearTable()=0
For lifecycle: clears all entries from the vlanAddressTable.
bool isOperational
Definition: MACRelayUnit.h:38
IMACAddressTable * addressTable
Definition: MACRelayUnit.h:31
void inet::MACRelayUnit::stop |
( |
| ) |
|
|
protectedvirtual |
Referenced by handleOperationStage().
virtual void clearTable()=0
For lifecycle: clears all entries from the vlanAddressTable.
bool isOperational
Definition: MACRelayUnit.h:38
IMACAddressTable * addressTable
Definition: MACRelayUnit.h:31
bool inet::MACRelayUnit::isOperational = false |
|
protected |
long inet::MACRelayUnit::numDiscardedFrames = 0 |
|
protected |
int inet::MACRelayUnit::numPorts = 0 |
|
protected |
long inet::MACRelayUnit::numProcessedFrames = 0 |
|
protected |
The documentation for this class was generated from the following files: