EPONImplementationforOMNet++
0.8Beta
|
TODO - Generated class. More...
#include <EPON_OLT_vlanBridgeRelay.h>
Protected Member Functions | |
virtual void | initialize () |
virtual void | handleFromLAN (EtherFrame *frame) |
virtual int | findVlanServiceIndex (uint16_t vlan) |
Search the service module and see the position of specific vlan. | |
virtual std::vector< uint16_t > | findLLiDsForServiceIndex (int index) |
Search the ONU Table and return the llids in position "index". |
TODO - Generated class.
std::vector< uint16_t > EPON_OLT_vlanBridgeRelay::findLLiDsForServiceIndex | ( | int | index | ) | [protected, virtual] |
Search the ONU Table and return the llids in position "index".
{ std::vector<uint16_t> res; for (int i=0; i<onutbl->getTableSize(); i++){ // Probably not useful... but... if (onutbl->getEntry(i)->getLLIDsNum() < index) continue; res.push_back(onutbl->getEntry(i)->getLLID(index)); } return res; }
int EPON_OLT_vlanBridgeRelay::findVlanServiceIndex | ( | uint16_t | vlan | ) | [protected, virtual] |
Search the service module and see the position of specific vlan.
{ if (!serviceList) return -1; for (uint8_t i=0; i<serviceList->size(); i++){ if (serviceList->at(i).vlan == vlan) return i; } return -1; }
void EPON_OLT_vlanBridgeRelay::handleFromLAN | ( | EtherFrame * | frame | ) | [protected, virtual] |
Reimplemented from EPON_OLT_relayDefault.
{ updateTableFromFrame(frame); mac_llid ml; ml.mac = frame->getDest(); // Check table ... if port is the same as incoming drop std::string port = getPortForAddress(ml); if (port == "ethOut") { delete frame; return; } // Get the vlan info uint16_t vlan=0; EthernetDot1QFrame * frame_d1q = dynamic_cast<EthernetDot1QFrame *>(frame); if (frame_d1q) vlan = frame_d1q->getVlanID(); // Do MAPINGS HERE (vlan or anything other to LLID) // currently use the default /* * NOTE: The following code works... but is logically wrong. * It is bases on the EtherSwitch code... but we don't have * multiple Ethernet (copper) interfaces yet (Increases complexity) * * On extended versions you could only bridge vlan <-> llid. * (vlan zero (0) -> BC) */ // No vlan -> BC or NO services defined if (vlan == 0 || serviceList == NULL){ EV << "OLT_vlan Relay: No vlan info"<<endl; frame->setControlInfo(new EPON_LLidCtrlInfo(LLID_EPON_BC) ); }else{ std::vector<uint16_t> srvLLiDs; srvLLiDs = findLLiDsForServiceIndex( findVlanServiceIndex(vlan) ); mac_llid tmp_ml; tmp_ml.mac = frame->getDest(); // Scan the MAC-Address table for this ML for (int i=0; i<(int)srvLLiDs.size(); i++){ tmp_ml.llid=srvLLiDs[i]; if (getPortForAddress(tmp_ml) == "toPONout"){ EtherFrame * frame_dup = frame->dup(); frame_dup->setControlInfo(new EPON_LLidCtrlInfo(tmp_ml.llid) ); send(frame_dup, "toPONout"); } } // Delete the original frame and return delete frame; return; } send(frame, "toPONout"); }
void EPON_OLT_vlanBridgeRelay::initialize | ( | ) | [protected, virtual] |
Reimplemented from EPON_OLT_relayDefault.