本文整理汇总了C++中Switch::enablePCAPLogging方法的典型用法代码示例。如果您正苦于以下问题:C++ Switch::enablePCAPLogging方法的具体用法?C++ Switch::enablePCAPLogging怎么用?C++ Switch::enablePCAPLogging使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Switch
的用法示例。
在下文中一共展示了Switch::enablePCAPLogging方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SetUp
virtual void SetUp()
{
prev_log = NetworkLog::defaultLevel;
NetworkLog::defaultLevel |= (
//(1 << NetworkLog::SYSCALL_RAISED) |
//(1 << NetworkLog::SYSCALL_FINISHED) |
//(1 << NetworkLog::PACKET_ALLOC) |
//(1 << NetworkLog::PACKET_CLONE) |
//(1 << NetworkLog::PACKET_FREE) |
//(1 << NetworkLog::PACKET_TO_MODULE) |
//(1 << NetworkLog::PACKET_FROM_MODULE) |
//(1 << NetworkLog::PACKET_TO_HOST) |
//(1 << NetworkLog::PACKET_FROM_HOST) |
//(1 << NetworkLog::PACKET_QUEUE) |
//(1 << NetworkLog::TCP_LOG) |
0UL
);
client_hosts = new Host*[num_client];
ethernet_clients = new Ethernet*[num_client];
ipv4_clients = new IPv4*[num_client];
interface_clients = new HostModule*[num_client];
server_host = new Host("CongestionServer", 1, &netSystem);
uint8_t server_mac[6] = {0xBC,0xBC,0xBC,0xBC,0xBC,0xBC};
uint8_t server_ip[4] = {192,168,1,7};
uint8_t server_mask[4] = {192,168,1,0};
uint8_t client_mask[4] = {10,0,1,0};
ethernet_server = new Ethernet(server_host);
ipv4_server = new IPv4(server_host);
server_host->setMACAddr(server_mac, 0);
server_host->setIPAddr(server_ip, 0);
server_host->setRoutingTable(client_mask, 24, 0);
server_host->getPort(0)->setPropagationDelay(propagationDelay);
server_host->getPort(0)->setPortSpeed(port_speed);
interface_server = Adversary::allocate(server_host);
interface_server->initialize();
switchingHub = new Switch("Switch1", &netSystem);
switchingHub->addPort(server_host->getPort(0));
switchingHub->addMACEntry(server_host->getPort(0), server_mac);
char name_buf[128];
for(int k=0; k<num_client; k++)
{
snprintf(name_buf, sizeof(name_buf), "CongestionClient%d", k);
client_hosts[k] = new Host(name_buf, 2, &netSystem);
ethernet_clients[k] = new Ethernet(client_hosts[k]);
ipv4_clients[k] = new IPv4(client_hosts[k]);
interface_clients[k] = Target::allocate(client_hosts[k]);
interface_clients[k]->initialize();
uint8_t client_ip[4] = {10,0,1,10};
client_ip[3] += k;
uint8_t client_mac[6] = {0xEE,0xEE,0xEE,0xEE,0xEE,0x00};
client_mac[5] += k;
client_hosts[k]->setMACAddr(client_mac, 0);
client_hosts[k]->setIPAddr(client_ip, 0);
client_hosts[k]->setRoutingTable(server_mask, 24, 0);
client_hosts[k]->setARPTable(server_mac, server_ip);
client_hosts[k]->getPort(0)->setPropagationDelay(propagationDelay);
client_hosts[k]->getPort(0)->setPortSpeed(port_speed);
server_host->setARPTable(client_mac, client_ip);
switchingHub->addPort(client_hosts[k]->getPort(0));
switchingHub->addMACEntry(client_hosts[k]->getPort(0), client_mac);
}
switchingHub->setLinkSpeed(port_speed);
switchingHub->setQueueSize(64);
const ::testing::TestInfo* const test_info = ::testing::UnitTest::GetInstance()->current_test_info();
std::string file_name(test_info->name());
file_name.append(".pcap");
switchingHub->enablePCAPLogging(file_name, 64);
}