EPONImplementationforOMNet++
0.8Beta
|
The default relay way. More...
#include <EPON_OLT_relayDefault.h>
Public Member Functions | |
virtual | ~EPON_OLT_relayDefault () |
Protected Member Functions | |
virtual void | initialize () |
virtual void | handleMessage (cMessage *msg) |
virtual void | handleFromPON (EtherFrame *frame) |
virtual void | handleFromLAN (EtherFrame *frame) |
virtual cModule * | findModuleUp (const char *name) |
Protected Attributes | |
long | numProcessedFrames |
long | numDroppedFrames |
SrvList * | serviceList |
ONUTable * | onutbl |
The default relay way.
As mentioned in the MACVlanRelayUnitBase this module is responsible for packet differentiation. The specific module is based on the destination MAC address and is going to forward the frame to all the known LLIDs. If the LLID is -1 (UNDEFINED) then the frame is going to be broadcasted. The same will happen if we do not know any LLID for that MAC address.
NOTE here that mapping to LLIDs could be done with various ways based on the VLAN or on the DSCP in the IP header or even per-port or pre-defined per destination. Depending on the scenario, someone can extend the MACVlanRelayUnitBase and change the relay's behavior.
EPON_OLT_relayDefault::~EPON_OLT_relayDefault | ( | ) | [virtual] |
{ }
cModule * EPON_OLT_relayDefault::findModuleUp | ( | const char * | name | ) | [protected, virtual] |
{ cModule *mod = NULL; for (cModule *curmod=this; !mod && curmod; curmod=curmod->getParentModule()) mod = curmod->getSubmodule(name); return mod; }
void EPON_OLT_relayDefault::handleFromLAN | ( | EtherFrame * | frame | ) | [protected, virtual] |
Reimplemented in EPON_OLT_vlanBridgeRelay.
{ updateTableFromFrame(frame); mac_llid ml; // Check table ... if port is the same as incoming drop ml.mac = frame->getDest(); std::string port = getPortForAddress(ml); if (port == "ethOut") { delete frame; return; } // Do MAPINGS HERE (vlan or anything other to LLID) // currently use the default std::vector<port_llid> vec = getLLIDsForAddress(frame->getDest()); if (vec.size()!=0){ // Send to the known llids only for (uint32_t i = 0; i<vec.size(); i++){ EtherFrame *frame_tmp = frame->dup(); // Get this llid and this port, duplicate and send port_llid tmp_pl = (port_llid)vec[i]; // If we don't know ... lets BC if (tmp_pl.llid == -1) tmp_pl.llid = LLID_EPON_BC; EV << "Adding LLID to the frame info... : "<<ml.llid<<endl; frame_tmp->setControlInfo(new EPON_LLidCtrlInfo(tmp_pl.llid) ); send(frame_tmp, tmp_pl.port.c_str()); // Break after a BC do not flood the net if (tmp_pl.llid == LLID_EPON_BC) break; } delete frame; }else{ // Add LLID info... to be used in MAC Layer EV << "Adding BC LLID to the frame info... "<<endl; ml.llid = LLID_EPON_BC; EPON_LLidCtrlInfo * nfo = new EPON_LLidCtrlInfo(ml.llid); frame->setControlInfo(nfo); send(frame, "toPONout"); } }
void EPON_OLT_relayDefault::handleFromPON | ( | EtherFrame * | frame | ) | [protected, virtual] |
{ mac_llid ml; ml.llid=-1; //Check frame preamble (dist between ONUs ONLY) EPON_LLidCtrlInfo * nfo = dynamic_cast<EPON_LLidCtrlInfo *>(frame->getControlInfo()); if (nfo!=NULL){ if (nfo->llid != LLID_EPON_BC) ml.llid = nfo->llid; } ml.mac = frame->getSrc(); updateTableWithAddress(ml, "toPONout"); // We do not need to scan the table since we still // have no vlans. Each ONU is considered to be a different // net (subnet) so the frame must go directly to wire. send(frame, "ethOut"); }
void EPON_OLT_relayDefault::handleMessage | ( | cMessage * | msg | ) | [protected, virtual] |
{ // Self Message if (msg->isSelfMessage()) { EV << "Self-message " << msg << " received\n"; delete msg; error("Unknown self message received!"); return; } // Network Message cGate *ingate = msg->getArrivalGate(); EV << "Frame " << msg << " arrived on port " << ingate->getName() << "...\n"; EtherFrame *frame = check_and_cast<EtherFrame *>(msg); if (ingate->getId() == gate( "toPONin")->getId()){ handleFromPON(frame); } else if (ingate->getId() == gate( "ethIn")->getId()){ handleFromLAN(frame); } else{ EV << "Message received in UNKNOWN PORT\n"; return; } }
void EPON_OLT_relayDefault::initialize | ( | ) | [protected, virtual] |
Reimplemented in EPON_OLT_vlanBridgeRelay.
{ MACVlanRelayUnitBase::initialize(); if (dynamic_cast<ServiceConfig *>( findModuleUp("serviceConfig")) != NULL){ serviceList = &(dynamic_cast<ServiceConfig *>( findModuleUp("serviceConfig"))->srvs); } // ONU table onutbl = NULL; onutbl = dynamic_cast<ONUTable *>( findModuleUp("onuTable")); if (!onutbl) error("Shit... no ONU table found ?!?!"); numProcessedFrames = numDroppedFrames = 0; WATCH(numProcessedFrames); WATCH(numDroppedFrames); }
long EPON_OLT_relayDefault::numDroppedFrames [protected] |
long EPON_OLT_relayDefault::numProcessedFrames [protected] |
ONUTable* EPON_OLT_relayDefault::onutbl [protected] |
SrvList* EPON_OLT_relayDefault::serviceList [protected] |