diff options
Diffstat (limited to 'src')
-rwxr-xr-x | src/bp_gtest.cpp | 17 | ||||
-rwxr-xr-x | src/bp_sim.cpp | 82 | ||||
-rwxr-xr-x | src/bp_sim.h | 7 | ||||
-rwxr-xr-x | src/common/Network/Packet/IPHeader.cpp | 2 | ||||
-rwxr-xr-x | src/common/Network/Packet/TCPHeader.cpp | 2 | ||||
-rwxr-xr-x | src/common/c_common.h | 2 | ||||
-rw-r--r-- | src/gtest/trex_stateless_gtest.cpp | 6 | ||||
-rwxr-xr-x | src/gtest/tuple_gen_test.cpp | 8 | ||||
-rwxr-xr-x | src/main.cpp | 21 | ||||
-rwxr-xr-x | src/nat_check.cpp | 4 | ||||
-rwxr-xr-x | src/platform_cfg.cpp | 6 | ||||
-rwxr-xr-x | src/rx_check.cpp | 24 | ||||
-rwxr-xr-x | src/rx_check_header.cpp | 10 | ||||
-rwxr-xr-x | src/time_histogram.cpp | 6 | ||||
-rwxr-xr-x | src/tuple_gen.h | 3 | ||||
-rwxr-xr-x | src/utl_json.cpp | 4 | ||||
-rwxr-xr-x | src/utl_yaml.cpp | 2 |
17 files changed, 114 insertions, 92 deletions
diff --git a/src/bp_gtest.cpp b/src/bp_gtest.cpp index e3145f2a..03ab74bd 100755 --- a/src/bp_gtest.cpp +++ b/src/bp_gtest.cpp @@ -66,7 +66,7 @@ int test_priorty_queue(void){ int i; for (i=0; i<10; i++) { node = new CGenNode(); - printf(" +%x \n",node); + printf(" +%p \n",node); node->m_flow_id = 10-i; node->m_pkt_info = (CFlowPktInfo *)(uintptr_t)i; node->m_time = (double)i+0.1; @@ -74,7 +74,7 @@ int test_priorty_queue(void){ } while (!p_queue.empty()) { node = p_queue.top(); - printf(" -->%x \n",node); + printf(" -->%p \n",node); //node->Dump(stdout); p_queue.pop(); //delete node; @@ -159,7 +159,7 @@ public: bool init(void){ - uint16 * ports; + uint16 * ports = NULL; CTupleBase tuple; CErfIF erf_vif; @@ -663,6 +663,7 @@ TEST_F(basic, latency1) { po->preview.setFileWrite(true); uint8_t mac[]={0,0,0,1,0,0}; + (void)mac; CErfIF erf_vif; erf_vif.set_review_mode(&CGlobalInfo::m_options.preview); @@ -714,6 +715,7 @@ TEST_F(basic, latency2) { uint8_t mac[]={0,0,0,1,0,0}; + (void)mac; mac[0]=0; mac[1]=0; @@ -728,14 +730,13 @@ TEST_F(basic, latency2) { int i; for (i=0; i<100; i++) { - uint8_t *p; rte_mbuf_t * m=l.generate_pkt(0); - p=rte_pktmbuf_mtod(m, uint8_t*); + rte_pktmbuf_mtod(m, uint8_t*); //utl_DumpBuffer(stdout,p,l.get_pkt_size(),0); port0.update_packet(m); - p=rte_pktmbuf_mtod(m, uint8_t*); + rte_pktmbuf_mtod(m, uint8_t*); //utl_DumpBuffer(stdout,p,l.get_pkt_size(),0); //printf("offset is : %d \n",l.get_payload_offset()); @@ -763,6 +764,7 @@ TEST_F(basic, latency3) { uint8_t mac[]={0,0,0,1,0,0}; + (void)mac; mac[0]=0; @@ -850,6 +852,7 @@ public: TEST_F(basic, latency4) { uint8_t mac[]={0,0,0,1,0,0}; + (void)mac; mac[0]=0; mac[1]=0; @@ -2125,7 +2128,7 @@ class CRxCheck1 : public CRxCheckCallbackBase { public: virtual void handle_packet(rte_mbuf_t * m){ - char *mp=rte_pktmbuf_mtod(m, char*); + rte_pktmbuf_mtod(m, char*); CRx_check_header * rx_p; rte_mbuf_t * m2 = m->next; rx_p=(CRx_check_header *)rte_pktmbuf_mtod(m2, char*); diff --git a/src/bp_sim.cpp b/src/bp_sim.cpp index d59da900..65dba06d 100755 --- a/src/bp_sim.cpp +++ b/src/bp_sim.cpp @@ -72,11 +72,11 @@ void CGlobalMemory::Dump(FILE *fd){ c_size=c_size*2; } - fprintf(fd," %-40s : %lu \n",names[i].c_str(),m_mbuf[i]); + fprintf(fd," %-40s : %lu \n",names[i].c_str(),(ulong)m_mbuf[i]); } c_total += (m_mbuf[MBUF_DP_FLOWS] * sizeof(CGenNode)); - fprintf(fd," %-40s : %lu \n","get_each_core_dp_flows",get_each_core_dp_flows()); + fprintf(fd," %-40s : %lu \n","get_each_core_dp_flows",(ulong)get_each_core_dp_flows()); fprintf(fd," %-40s : %s \n","Total memory",double_to_human_str(c_total,"bytes",KBYE_1024).c_str() ); } @@ -240,7 +240,7 @@ bool CPlatformSocketInfoConfig::init(){ } if ( m_thread_phy_to_virtual[phy_thread] ){ - printf("ERROR physical thread %d defined twice %d \n",phy_thread); + printf("ERROR physical thread %d defined twice\n",phy_thread); exit(1); } m_thread_phy_to_virtual[phy_thread]=virt_thread; @@ -269,7 +269,7 @@ bool CPlatformSocketInfoConfig::init(){ void CPlatformSocketInfoConfig::dump(FILE *fd){ - fprintf(fd," core_mask %x \n",get_cores_mask()); + fprintf(fd," core_mask %llx \n",(unsigned long long)get_cores_mask()); fprintf(fd," sockets :"); int i; for (i=0; i<MAX_SOCKETS_SUPPORTED; i++) { @@ -821,7 +821,6 @@ void CPacketIndication::UpdatePacketPadding(){ void CPacketIndication::RefreshPointers(){ char *pobase=getBasePtr(); - CPacketIndication * obj=this; m_ether = (EthernetHeader *) (pobase + m_ether_offset); l3.m_ipv4 = (IPHeader *) (pobase + m_ip_offset); @@ -1672,7 +1671,6 @@ char * CFlowPktInfo::push_ipv4_option_offline(uint8_t bytes){ void CFlowPktInfo::mask_as_learn(){ - char *p; CNatOption *lpNat; if ( m_pkt_indication.is_ipv6() ){ lpNat=(CNatOption *)push_ipv6_option_offline(CNatOption::noOPTION_LEN); @@ -2266,7 +2264,7 @@ void CCCapFileMemoryUsage::dump(FILE *fd){ int c_total=0; for (i=0; i<CCCapFileMemoryUsage::MASK_SIZE; i++) { - fprintf(fd," size_%-7d : %lu \n",c_size,m_buf[i]); + fprintf(fd," size_%-7d : %lu \n",c_size, (ulong)m_buf[i]); c_total +=m_buf[i]*c_size; c_size = c_size*2; } @@ -2441,7 +2439,6 @@ void operator >> (const YAML::Node& node, CFlowYamlInfo & fi) { if ( node.FindValue("dyn_pyload") ){ - int i; const YAML::Node& dyn_pyload = node["dyn_pyload"]; for(unsigned i=0;i<dyn_pyload.size();i++) { CFlowYamlDpPkt fd; @@ -2840,8 +2837,20 @@ void CFlowStats::DumpHeader(FILE *fd){ void CFlowStats::Dump(FILE *fd){ //"name","cps","f-pkts","f-bytes","Mb/sec","MB/sec","c-flows","PPS","total-Mbytes-duration","errors","flows" fprintf(fd," %02d, %-40s ,%4.2f,%4.2f, %5.0f , %7.0f ,%7.2f ,%7.2f , %7.2f , %10.0f , %5.0f , %7.0f , %llu , %llu \n", - m_id,m_name.c_str(),m_cps,get_normal_cps(), - m_pkt,m_bytes,duration_sec,m_mb_sec,m_mB_sec,m_c_flows,m_pps,m_total_Mbytes,m_errors,m_flows); + m_id, + m_name.c_str(), + m_cps, + get_normal_cps(), + m_pkt, + m_bytes, + duration_sec, + m_mb_sec, + m_mB_sec, + m_c_flows, + m_pps, + m_total_Mbytes, + (unsigned long long)m_errors, + (unsigned long long)m_flows); } bool CFlowGeneratorRecPerThread::Create(CTupleGeneratorSmart * global_gen, @@ -3046,21 +3055,20 @@ void CGenNode::DumpHeader(FILE *fd){ } void CGenNode::Dump(FILE *fd){ - fprintf(fd,"%.6f,%llx,%p,%llu,%d,%d,%d,%d,%d,%d,%x,%x,%d\n",m_time,m_flow_id,m_pkt_info, - m_pkt_info->m_pkt_indication.m_packet->pkt_cnt, - m_pkt_info->m_pkt_indication.m_packet->pkt_len, - m_pkt_info->m_pkt_indication.m_desc.getId(), - (m_pkt_info->m_pkt_indication.m_desc.IsInitSide()?1:0), - m_pkt_info->m_pkt_indication.m_desc.IsLastPkt(), + fprintf(fd,"%.6f,%llx,%p,%llu,%d,%d,%d,%d,%d,%d,%x,%x,%d\n", + m_time, + (unsigned long long)m_flow_id, + m_pkt_info, + (unsigned long long)m_pkt_info->m_pkt_indication.m_packet->pkt_cnt, + m_pkt_info->m_pkt_indication.m_packet->pkt_len, + m_pkt_info->m_pkt_indication.m_desc.getId(), + (m_pkt_info->m_pkt_indication.m_desc.IsInitSide()?1:0), + m_pkt_info->m_pkt_indication.m_desc.IsLastPkt(), m_type, m_thread_id, m_src_ip, m_dest_ip, - m_src_port - - - - ); + m_src_port); } @@ -3118,7 +3126,7 @@ int CNodeGenerator::close_file(CFlowGenListPerThread * thread){ int CNodeGenerator::update_stats(CGenNode * node){ if ( m_preview_mode.getVMode() >2 ){ - fprintf(stdout," %llu ,",m_cnt); + fprintf(stdout," %llu ,", (unsigned long long)m_cnt); node->Dump(stdout); m_cnt++; } @@ -4520,9 +4528,12 @@ void CTupleTemplateGenerator::Generate(){ #endif +static uint32_t get_rand_32(uint32_t MinimumRange, + uint32_t MaximumRange) __attribute__ ((unused)); + +static uint32_t get_rand_32(uint32_t MinimumRange, + uint32_t MaximumRange) { -static uint32_t get_rand_32(uint32_t MinimumRange , - uint32_t MaximumRange ){ enum {RANDS_NUM = 2 , RAND_MAX_BITS = 0xf , UNSIGNED_INT_BITS = 0x20 , TWO_BITS_MASK = 0x3}; const double TWO_POWER_32_BITS = 0x10000000 * (double)0x10; @@ -4755,7 +4766,6 @@ void CCPortLatency::reset(){ static uint8_t nat_is_port_can_send(uint8_t port_id){ - uint8_t offset= ((port_id>>1)<<1); uint8_t client_index = (port_id %2); return (client_index ==0 ?1:0); } @@ -4877,7 +4887,7 @@ void CCPortLatency::dump_counters_json(std::string & json ){ } void CCPortLatency::DumpCounters(FILE *fd){ - #define DP_A1(f) if (f) fprintf(fd," %-40s : %llu \n",#f,f) + #define DP_A1(f) if (f) fprintf(fd," %-40s : %llu \n",#f, (unsigned long long)f) fprintf(fd," counter \n"); fprintf(fd," -----------\n"); @@ -4896,7 +4906,7 @@ void CCPortLatency::DumpCounters(FILE *fd){ fprintf(fd," -----------\n"); m_hist.Dump(fd); - fprintf(fd," %-40s : %llu \n","jitter",get_jitter_usec()); + fprintf(fd," %-40s : %lu \n","jitter", (ulong)get_jitter_usec()); } bool CCPortLatency::dump_packet(rte_mbuf_t * m){ @@ -4920,6 +4930,9 @@ bool CCPortLatency::dump_packet(rte_mbuf_t * m){ if ( unlikely( CGlobalInfo::m_options.preview.get_vlan_mode_enable() ) ){ vlan_offset=4; } + + (void)vlan_offset; + // utl_DumpBuffer(stdout,p,pkt_size,0); return (0); @@ -4955,9 +4968,7 @@ bool CCPortLatency::check_packet(rte_mbuf_t * m,CRx_check_header * & rx_p){ uint16_t vlan_offset=parser.m_vlan_offset; uint8_t *p=rte_pktmbuf_mtod(m, uint8_t*); - rx_p=(CRx_check_header *)0; - bool managed_by_ip_options=false; - bool is_rx_check=true; + rx_p = (CRx_check_header *)0; if ( !parser.IsLatencyPkt() ){ @@ -5074,7 +5085,7 @@ void CLatencyManager::Delete(){ static uint8_t swap_port(uint8_t port_id){ uint8_t offset= ((port_id>>1)<<1); uint8_t client_index = (port_id %2); - return (offset+client_index^1); + return (offset + (client_index ^ 1)); } @@ -5197,8 +5208,6 @@ void CLatencyManager::run_rx_queue_msgs(uint8_t thread_id, CGenNodeMsgBase * msg=(CGenNodeMsgBase *)node; - CGenNodeLatencyPktInfo * msg1=(CGenNodeLatencyPktInfo *)msg; - uint8_t msg_type = msg->m_msg_type; switch (msg_type ) { case CGenNodeMsgBase::LATENCY_PKT: @@ -5321,7 +5330,7 @@ void CLatencyManager::start(int iter){ } if ( iter>0 ){ if ( ( cnt>iter) ){ - printf("stop due iter %d %d \n",iter); + printf("stop due iter %d\n",iter); break; } } @@ -5490,8 +5499,8 @@ void CLatencyManager::DumpRxCheckVerification(FILE *fd, fprintf(fd," rx_checker is disabled \n"); return; } - fprintf(fd," rx_check Tx : %u \n",total_tx_rx_check); - fprintf(fd," rx_check Rx : %u \n",m_rx_check_manager.getTotalRx() ); + fprintf(fd," rx_check Tx : %llu \n", (unsigned long long)total_tx_rx_check); + fprintf(fd," rx_check Rx : %llu \n", (unsigned long long)m_rx_check_manager.getTotalRx() ); fprintf(fd," rx_check verification :" ); if (m_rx_check_manager.getTotalRx() == total_tx_rx_check) { fprintf(fd," OK \n" ); @@ -6744,7 +6753,6 @@ bool CSimplePacketParser::Parse(){ EthernetHeader *m_ether = (EthernetHeader *)p; IPHeader * ipv4=0; IPv6Header * ipv6=0; - uint16_t pkt_size=rte_pktmbuf_pkt_len(m); m_vlan_offset=0; m_option_offset=0; diff --git a/src/bp_sim.h b/src/bp_sim.h index c201cd20..36595581 100755 --- a/src/bp_sim.h +++ b/src/bp_sim.h @@ -894,6 +894,8 @@ public: /* number of main active sockets. socket #0 is always used */ virtual socket_id_t max_num_active_sockets()=0; + virtual ~CPlatformSocketInfoBase() {} + public: /* which socket to allocate memory to each port */ virtual socket_id_t port_to_socket(port_id_t port)=0; @@ -1337,8 +1339,8 @@ public: -#define DP(f) if (f) printf(" %-40s: %llu \n",#f,f) -#define DP_name(n,f) if (f) printf(" %-40s: %llu \n",n,f) +#define DP(f) if (f) printf(" %-40s: %llu \n",#f,(unsigned long long)f) +#define DP_name(n,f) if (f) printf(" %-40s: %llu \n",n,(unsigned long long)f) #define DP_S(f,f_s) if (f) printf(" %-40s: %s \n",#f,f_s.c_str()) @@ -2380,6 +2382,7 @@ public: return (uint32_t)((uintptr_t)( ((char *)l3.m_ipv4)-getBasePtr()) ); }else{ BP_ASSERT(0); + return (0); } } diff --git a/src/common/Network/Packet/IPHeader.cpp b/src/common/Network/Packet/IPHeader.cpp index 3b90a1aa..c3363603 100755 --- a/src/common/Network/Packet/IPHeader.cpp +++ b/src/common/Network/Packet/IPHeader.cpp @@ -52,7 +52,7 @@ void IPHeader::dump(FILE *fd) { fprintf(fd, "\nIPHeader"); fprintf(fd, "\nSource 0x%.8lX, Destination 0x%.8lX, Protocol 0x%.1X", - getSourceIp(), getDestIp(), getProtocol()); + (ulong)getSourceIp(), (ulong)getDestIp(), (uint)getProtocol()); fprintf(fd, "\nTTL : %d, Id : 0x%.2X, Ver %d, Header Length %d, Total Length %d", getTimeToLive(), getId(), getVersion(), getHeaderLength(), getTotalLength()); if(isFragmented()) diff --git a/src/common/Network/Packet/TCPHeader.cpp b/src/common/Network/Packet/TCPHeader.cpp index bf28db2e..1826cef8 100755 --- a/src/common/Network/Packet/TCPHeader.cpp +++ b/src/common/Network/Packet/TCPHeader.cpp @@ -25,7 +25,7 @@ void TCPHeader::dump(FILE *fd) fprintf(fd, "\nSourcePort 0x%.4X, DestPort 0x%.4X", getSourcePort(), getDestPort()); fprintf(fd, "\nSeqNum 0x%.8lX, AckNum 0x%.8lX, Window %d", - getSeqNumber(), getAckNumber(), getWindowSize()); + (ulong)getSeqNumber(), (ulong)getAckNumber(), getWindowSize()); fprintf(fd, "\nHeader Length : %d, Checksum : 0x%.4X", getHeaderLength(), getChecksum()); fprintf(fd, "\nFlags : SYN - %d, FIN - %d, ACK - %d, URG - %d, RST - %d, PSH - %d", diff --git a/src/common/c_common.h b/src/common/c_common.h index d8320aaa..3e43644f 100755 --- a/src/common/c_common.h +++ b/src/common/c_common.h @@ -46,7 +46,7 @@ typedef void* c_pvoid; #ifdef _DEBUG #define BP_ASSERT(a) assert(a) #else - #define BP_ASSERT(a) + #define BP_ASSERT(a) (void (a)) #endif #endif diff --git a/src/gtest/trex_stateless_gtest.cpp b/src/gtest/trex_stateless_gtest.cpp index 0341516c..2bab4dff 100644 --- a/src/gtest/trex_stateless_gtest.cpp +++ b/src/gtest/trex_stateless_gtest.cpp @@ -82,7 +82,7 @@ private: void CTRexDpStreamModeSingleBurst::dump(FILE *fd){ fprintf (fd," pps : %f \n",m_pps); - fprintf (fd," total_packets : %llu \n",m_total_packets); + fprintf (fd," total_packets : %llu \n", (unsigned long long)m_total_packets); } @@ -130,9 +130,9 @@ private: void CTRexDpStreamModeMultiBurst::dump(FILE *fd){ fprintf (fd," pps : %f \n",m_pps); - fprintf (fd," total_packets : %llu \n",m_pkts_per_burst); + fprintf (fd," total_packets : %llu \n", (unsigned long long)m_pkts_per_burst); fprintf (fd," ibg : %f \n",m_ibg); - fprintf (fd," num_of_bursts : %llu \n",m_number_of_bursts); + fprintf (fd," num_of_bursts : %lu \n", (ulong)m_number_of_bursts); } diff --git a/src/gtest/tuple_gen_test.cpp b/src/gtest/tuple_gen_test.cpp index 8a774e38..f3b9fa1e 100755 --- a/src/gtest/tuple_gen_test.cpp +++ b/src/gtest/tuple_gen_test.cpp @@ -161,7 +161,6 @@ TEST(tuple_gen,clientPoolL) { 0,0); CTupleBase result; uint32_t result_src; - uint32_t result_dest; uint16_t result_port; for(int i=0;i<10;i++) { @@ -186,7 +185,6 @@ TEST(tuple_gen,clientPool) { 0,0); CTupleBase result; uint32_t result_src; - uint32_t result_dest; uint16_t result_port; for(int i=0;i<10;i++) { @@ -436,7 +434,6 @@ TEST(tuple_gen,template1) { template_1.GenerateTuple(result); uint32_t result_src = result.getClient(); uint32_t result_dest = result.getServer(); - uint16_t result_port = result.getClientPort(); //printf(" %x %x %x \n",result_src,result_dest,result_port); EXPECT_EQ(result_src, (uint32_t)(0x10000001+i)); EXPECT_EQ(result_dest, (uint32_t)(((0x12121212)) )); @@ -489,9 +486,6 @@ TEST(tuple_gen,no_free) { int i; for (i=0; i<65557; i++) { template_1.GenerateTuple(result); - uint32_t result_src = result.getClient(); - uint32_t result_dest = result.getServer(); - uint16_t result_port = result.getClientPort(); } // should have error EXPECT_TRUE((gen.getErrorAllocationCounter()>0)?true:false); @@ -514,8 +508,6 @@ TEST(tuple_gen,try_to_free) { int i; for (i=0; i<65557; i++) { template_1.GenerateTuple(result); - uint32_t result_src = result.getClient(); - uint32_t result_dest = result.getServer(); uint16_t result_port = result.getClientPort(); gen.FreePort(0,result.getClientId(),result_port); } diff --git a/src/main.cpp b/src/main.cpp index bd64c5a4..03f5d6ed 100755 --- a/src/main.cpp +++ b/src/main.cpp @@ -214,11 +214,12 @@ void * thread_task(void *info){ char buf[100]; sprintf(buf,"my%d.erf",obj->thread_id); - volatile int i; lpt->start_generate_stateful(buf,*obj->preview_info); lpt->m_node_gen.DumpHist(stdout); printf("end thread %d \n",obj->thread_id); } + + return (NULL); } @@ -405,8 +406,6 @@ void update_tcp_seq_num(CCapFileFlowInfo * obj, int i; for (i=pkt_id+1; i<s; i++) { - uint32_t seq; - uint32_t ack; pkt=obj->GetPacket(i); tcp=pkt->m_pkt_indication.l4.m_tcp; @@ -490,7 +489,7 @@ int manipolate_capfile() { CCapFileFlowInfo flow_info; flow_info.Create(); - int res=flow_info.load_cap_file("avl/delay_10_rtsp_0.pcap",0,0); + flow_info.load_cap_file("avl/delay_10_rtsp_0.pcap",0,0); change_pkt_len(&flow_info,4-1 ,6); change_pkt_len(&flow_info,5-1 ,6); @@ -515,7 +514,7 @@ int manipolate_capfile_sip() { CCapFileFlowInfo flow_info; flow_info.Create(); - int res=flow_info.load_cap_file("avl/delay_10_sip_0.pcap",0,0); + flow_info.load_cap_file("avl/delay_10_sip_0.pcap",0,0); change_pkt_len(&flow_info,1-1 ,6+6); change_pkt_len(&flow_info,2-1 ,6+6); @@ -532,8 +531,8 @@ int manipolate_capfile_sip1() { CCapFileFlowInfo flow_info; flow_info.Create(); - int res=flow_info.load_cap_file("avl/delay_sip_0.pcap",0,0); - CFlowPktInfo * pkt=flow_info.GetPacket(1); + flow_info.load_cap_file("avl/delay_sip_0.pcap",0,0); + flow_info.GetPacket(1); change_pkt_len(&flow_info,1-1 ,6+6+10); @@ -620,6 +619,8 @@ bool CMergeCapFileRec::Create(std::string cap_file, m_limit_number_of_packets =0; m_start_time = pkt->m_packet->get_time() ; m_offset = offset; + + return (true); } @@ -663,12 +664,12 @@ bool CMergeCapFile::run_merge(std::string to_cap_file){ int min_index=0; double min_time; - fprintf(stdout," --------------\n",cnt); + fprintf(stdout," --------------\n"); fprintf(stdout," pkt : %d \n",cnt); for (i=0; i<MERGE_CAP_FILES; i++) { m[i].Dump(stdout,i); } - fprintf(stdout," --------------\n",cnt); + fprintf(stdout," --------------\n"); bool valid = false; for (i=0; i<MERGE_CAP_FILES; i++) { @@ -702,6 +703,8 @@ bool CMergeCapFile::run_merge(std::string to_cap_file){ }; m_results.save_to_erf(to_cap_file,1); + + return (true); } diff --git a/src/nat_check.cpp b/src/nat_check.cpp index 676c1292..170d2de6 100755 --- a/src/nat_check.cpp +++ b/src/nat_check.cpp @@ -171,8 +171,8 @@ void CNatRxManager::handle_packet_ipv4(CNatOption * option, } -#define MYDP(f) if (f) fprintf(fd," %-40s: %llu \n",#f,f) -#define MYDP_A(f) fprintf(fd," %-40s: %llu \n",#f,f) +#define MYDP(f) if (f) fprintf(fd," %-40s: %llu \n",#f,(unsigned long long)f) +#define MYDP_A(f) fprintf(fd," %-40s: %llu \n",#f, (unsigned long long)f) diff --git a/src/platform_cfg.cpp b/src/platform_cfg.cpp index 92ffefbd..df04cd89 100755 --- a/src/platform_cfg.cpp +++ b/src/platform_cfg.cpp @@ -127,7 +127,7 @@ void CPlatformMemoryYamlInfo::Dump(FILE *fd){ int i=0; for (i=0; i<MBUF_SIZE; i++) { - fprintf(fd," %-40s : %lu \n",names[i].c_str(),m_mbuf[i]); + fprintf(fd," %-40s : %lu \n",names[i].c_str(), (ulong)m_mbuf[i]); } } @@ -379,7 +379,7 @@ void CPlatformYamlInfo::Dump(FILE *fd){ }else{ fprintf(fd," port limit : not configured \n"); } - fprintf(fd," port_bandwidth_gb : %lu \n",m_port_bandwidth_gb); + fprintf(fd," port_bandwidth_gb : %lu \n", (ulong)m_port_bandwidth_gb); if ( m_if_mask_exist && m_if_mask.size() ) { fprintf(fd," if_mask : "); @@ -387,7 +387,7 @@ void CPlatformYamlInfo::Dump(FILE *fd){ for (i=0; i<(int)m_if_mask.size(); i++) { fprintf(fd," %s,",m_if_mask[i].c_str()); } - fprintf(fd,"\n",m_if_mask[i].c_str()); + fprintf(fd,"\n"); }else{ fprintf(fd," if_mask : None \n"); diff --git a/src/rx_check.cpp b/src/rx_check.cpp index 3a67ca23..59b42e1a 100755 --- a/src/rx_check.cpp +++ b/src/rx_check.cpp @@ -45,8 +45,8 @@ void CRxCheckFlowTableStats::Clear(){ } -#define MYDP(f) if (f) fprintf(fd," %-40s: %llu \n",#f,f) -#define MYDP_A(f) fprintf(fd," %-40s: %llu \n",#f,f) +#define MYDP(f) if (f) fprintf(fd," %-40s: %llu \n",#f,(unsigned long long)f) +#define MYDP_A(f) fprintf(fd," %-40s: %llu \n",#f,(unsigned long long)f) #define MYDP_J(f) json+=add_json(#f,f); #define MYDP_J_LAST(f) json+=add_json(#f,f,true); @@ -146,7 +146,7 @@ void CRxCheckFlowTableMap::dump_all(FILE *fd){ rx_check_flow_map_iter_t it; for (it= m_map.begin(); it != m_map.end(); ++it) { CRxCheckFlow *lp = it->second; - printf ("flow_id: %d \n",lp->m_flow_id); + printf ("flow_id: %llu \n",(unsigned long long)lp->m_flow_id); } } @@ -208,7 +208,7 @@ std::string CPerTxthreadTemplateInfo::dump_as_json(std::string name){ int i; for (i=0;i<MAX_TEMPLATES_STATS;i++){ char buff[200]; - sprintf(buff,"%llu",m_template_info[i]); + sprintf(buff,"%llu", (unsigned long long)m_template_info[i]); json+=std::string(buff); if ( i < MAX_TEMPLATES_STATS-1) { json+=std::string(","); @@ -231,7 +231,7 @@ void CPerTxthreadTemplateInfo::Dump(FILE *fd){ int i; for (i=0; i<MAX_TEMPLATES_STATS; i++) { if (m_template_info[i]) { - fprintf (fd," template id: %llu %llu \n",i,m_template_info[i]); + fprintf (fd," template id: %d %llu \n",i, (unsigned long long)m_template_info[i]); } } } @@ -484,7 +484,7 @@ void RxCheckManager::DumpTemplate(FILE *fd,bool verbose){ if (cnt==0){ fprintf(fd,"\n"); } - fprintf(fd,"[id:%2d val:%8d,rx:%8d], ",i,lp->get_error_counter(),lp->get_rx_counter()); + fprintf(fd,"[id:%2d val:%8llu,rx:%8llu], ",i, (unsigned long long)lp->get_error_counter(), (unsigned long long)lp->get_rx_counter()); cnt++; if (cnt>5) { cnt=0; @@ -500,7 +500,11 @@ void RxCheckManager::DumpTemplateFull(FILE *fd){ int i; for (i=0; i<MAX_TEMPLATES_STATS;i++ ) { CPerTemplateInfo * lp=get_template(i); - fprintf(fd," template_id_%2d , errors:%8d, jitter: %lu rx : %lu \n",i,lp->get_error_counter(),lp->get_jitter_usec(),lp->get_rx_counter() ); + fprintf(fd," template_id_%2d , errors:%8llu, jitter: %llu rx : %llu \n", + i, + (unsigned long long)lp->get_error_counter(), + (unsigned long long)lp->get_jitter_usec(), + (unsigned long long)lp->get_rx_counter() ); } } @@ -514,7 +518,11 @@ void RxCheckManager::DumpShort(FILE *fd){ DumpTemplate(fd,false); fprintf(fd,"\n"); fprintf(fd,"---\n"); - fprintf(fd," active flows: %8d, fif: %8d, drop: %8d, errors: %8d \n",m_stats.m_active,m_stats.m_fif,m_stats.m_err_drop,m_stats.get_total_err()); + fprintf(fd," active flows: %8llu, fif: %8llu, drop: %8llu, errors: %8llu \n", + (unsigned long long)m_stats.m_active, + (unsigned long long)m_stats.m_fif, + (unsigned long long)m_stats.m_err_drop, + (unsigned long long)m_stats.get_total_err()); fprintf(fd,"------------------------------------------------------------------------------------------------------------\n"); } diff --git a/src/rx_check_header.cpp b/src/rx_check_header.cpp index 8ee580db..5934ee15 100755 --- a/src/rx_check_header.cpp +++ b/src/rx_check_header.cpp @@ -42,11 +42,11 @@ void CRx_check_header::dump(FILE *fd){ void CNatOption::dump(FILE *fd){ - fprintf(fd," op : %lx \n",get_option_type()); - fprintf(fd," ol : %lx \n",get_option_len()); - fprintf(fd," thread_id : %lx \n",get_thread_id()); - fprintf(fd," magic : %lx \n",get_magic()); - fprintf(fd," fid : %lx \n",get_fid()); + fprintf(fd," op : %x \n",get_option_type()); + fprintf(fd," ol : %x \n",get_option_len()); + fprintf(fd," thread_id : %x \n",get_thread_id()); + fprintf(fd," magic : %x \n",get_magic()); + fprintf(fd," fid : %x \n",get_fid()); utl_DumpBuffer(stdout,(void *)&u.m_data[0],8,0); } diff --git a/src/time_histogram.cpp b/src/time_histogram.cpp index f1b47e59..96796bfc 100755 --- a/src/time_histogram.cpp +++ b/src/time_histogram.cpp @@ -182,10 +182,10 @@ void CTimeHistogram::DumpWinMax(FILE *fd){ } void CTimeHistogram::Dump(FILE *fd){ - fprintf (fd," min_delta : %lu usec \n",get_usec(m_min_delta)); + fprintf (fd," min_delta : %lu usec \n", (ulong)get_usec(m_min_delta)); fprintf (fd," cnt : %lu \n",m_cnt); fprintf (fd," high_cnt : %lu \n",m_high_cnt); - fprintf (fd," max_d_time : %lu usec\n",get_usec(m_max_dt)); + fprintf (fd," max_d_time : %lu usec\n", (ulong)get_usec(m_max_dt)); //fprintf (fd," average : %.0f usec\n", get_total_average()); fprintf (fd," sliding_average : %.0f usec\n", get_average_latency()); fprintf (fd," precent : %.1f %%\n",(100.0*(double)m_high_cnt/(double)m_cnt)); @@ -198,7 +198,7 @@ void CTimeHistogram::Dump(FILE *fd){ for (j=0; j<HISTOGRAM_SIZE_LOG; j++) { for (i=0; i<HISTOGRAM_SIZE; i++) { if (m_hcnt[j][i] >0 ) { - fprintf (fd," h[%lu] : %lu \n",(base*(i+1)),m_hcnt[j][i]); + fprintf (fd," h[%u] : %llu \n",(base*(i+1)),(unsigned long long)m_hcnt[j][i]); } } base=base*10; diff --git a/src/tuple_gen.h b/src/tuple_gen.h index 29adbd69..d34e27bc 100755 --- a/src/tuple_gen.h +++ b/src/tuple_gen.h @@ -553,6 +553,9 @@ public: class CServerPoolBase { public: + + virtual ~CServerPoolBase() {} + virtual void GenerateTuple(CTupleBase& tuple) = 0; virtual uint16_t GenerateOnePort(uint32_t idx) = 0; virtual void Delete() = 0; diff --git a/src/utl_json.cpp b/src/utl_json.cpp index 990346f5..fb55be0a 100755 --- a/src/utl_json.cpp +++ b/src/utl_json.cpp @@ -25,7 +25,7 @@ limitations under the License. std::string add_json(std::string name, uint32_t counter,bool last){ char buff[200]; - sprintf(buff,"\"%s\":%lu",name.c_str(),counter); + sprintf(buff,"\"%s\":%lu",name.c_str(), (ulong)counter); std::string s= std::string(buff); if (!last) { s+=","; @@ -35,7 +35,7 @@ std::string add_json(std::string name, uint32_t counter,bool last){ std::string add_json(std::string name, uint64_t counter,bool last){ char buff[200]; - sprintf(buff,"\"%s\":%llu",name.c_str(),counter); + sprintf(buff,"\"%s\":%llu",name.c_str(), (unsigned long long)counter); std::string s= std::string(buff); if (!last) { s+=","; diff --git a/src/utl_yaml.cpp b/src/utl_yaml.cpp index 5f3ca735..828817e4 100755 --- a/src/utl_yaml.cpp +++ b/src/utl_yaml.cpp @@ -104,6 +104,8 @@ bool utl_yaml_read_uint16(const YAML::Node& node, val = (uint16_t)val_tmp; res=true; } + + return (res); } bool utl_yaml_read_bool(const YAML::Node& node, |