本文整理汇总了C++中Switch::addMACEntry方法的典型用法代码示例。如果您正苦于以下问题:C++ Switch::addMACEntry方法的具体用法?C++ Switch::addMACEntry怎么用?C++ Switch::addMACEntry使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Switch
的用法示例。
在下文中一共展示了Switch::addMACEntry方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SetUp
virtual void SetUp()
{
host1 = new Host("TestHost1", 2, &netSystem);
host2 = new Host("TestHost2", 2, &netSystem);
uint8_t mac1[6] = {0xBC,0xBC,0xBC,0xBC,0xBC,0xBC};
uint8_t mac1_2[6] = {0xCB,0xCB,0xCB,0xCB,0xCB,0xCB};
uint8_t mac2[6] = {0xCD,0xCD,0xCD,0xCD,0xCD,0xCD};
uint8_t mac2_2[6] = {0xDC,0xDC,0xDC,0xDC,0xDC,0xDC};
uint8_t ip1[4] = {192,168,0,7};
uint8_t ip1_2[4] = {192,168,0,8};
uint8_t ip2[4] = {10,0,1,4};
uint8_t ip2_2[4] = {10,0,1,5};
host1->setMACAddr(mac1, 0);
host1->setMACAddr(mac1_2, 1);
host1->setARPTable(mac2, ip2);
host1->setARPTable(mac2_2, ip2_2);
host1->setIPAddr(ip1, 0);
host1->setIPAddr(ip1_2, 1);
host1->setRoutingTable(ip2, 16, 0);
host1->setRoutingTable(ip2_2, 16, 1);
host2->setMACAddr(mac2, 0);
host2->setMACAddr(mac2_2, 1);
host2->setARPTable(mac1, ip1);
host2->setARPTable(mac1_2, ip1_2);
host2->setIPAddr(ip2, 0);
host2->setIPAddr(ip2_2, 1);
host2->setRoutingTable(ip1, 16, 0);
host2->setRoutingTable(ip1_2, 16, 1);
host1->getPort(0)->setPropagationDelay(TimeUtil::makeTime(1, TimeUtil::MSEC));
host1->getPort(1)->setPropagationDelay(TimeUtil::makeTime(1, TimeUtil::MSEC));
host2->getPort(0)->setPropagationDelay(TimeUtil::makeTime(1, TimeUtil::MSEC));
host2->getPort(1)->setPropagationDelay(TimeUtil::makeTime(1, TimeUtil::MSEC));
switchingHub = new Switch("Switch1", &netSystem);
switchingHub->addPort(host1->getPort(0));
switchingHub->addPort(host1->getPort(1));
switchingHub->addPort(host2->getPort(0));
switchingHub->addPort(host2->getPort(1));
switchingHub->addMACEntry(host1->getPort(0), mac1);
switchingHub->addMACEntry(host1->getPort(1), mac1_2);
switchingHub->addMACEntry(host2->getPort(0), mac2);
switchingHub->addMACEntry(host2->getPort(1), mac2_2);
ethernet1 = new Ethernet(host1);
ethernet2 = new Ethernet(host2);
ipv4_1 = new IPv4(host1);
ipv4_2 = new IPv4(host2);
interface = Target::allocate(host1);
interface2 = TCPSolutionProvider::allocate(host2, false, false, false);
interface->initialize();
interface2->initialize();
}