summaryrefslogtreecommitdiffstats
path: root/src/bp_sim.cpp
diff options
context:
space:
mode:
authorIdo Barnea <ibarnea@cisco.com>2016-07-20 10:19:11 +0300
committerIdo Barnea <ibarnea@cisco.com>2016-08-03 16:35:11 +0300
commit810dd7d0a48c17679e385b93d595a92b51254ce4 (patch)
tree09f9ca6ddd2358c688c2ba41b4297d39928eea2f /src/bp_sim.cpp
parent0f863b48e742ecd6b6dd522803e95a528024bbc9 (diff)
ipv6 flow stat on vm working
Diffstat (limited to 'src/bp_sim.cpp')
-rwxr-xr-xsrc/bp_sim.cpp91
1 files changed, 0 insertions, 91 deletions
diff --git a/src/bp_sim.cpp b/src/bp_sim.cpp
index d2b75122..2d1d020b 100755
--- a/src/bp_sim.cpp
+++ b/src/bp_sim.cpp
@@ -6453,97 +6453,6 @@ void CFlowYamlDynamicPyloadPlugin::Dump(FILE *fd){
}
}
-uint16_t CSimplePacketParser::getPktSize(){
- uint16_t ip_len=0;
- if (m_ipv4) {
- ip_len=m_ipv4->getTotalLength();
- }
- if (m_ipv6) {
- ip_len=m_ipv6->getSize()+m_ipv6->getPayloadLen();
- }
- return ( ip_len +m_vlan_offset+14);
-}
-
-uint16_t CSimplePacketParser::getIpId() {
- if (m_ipv4) {
- return ( m_ipv4->getId() );
- }
-
- return (0);
-}
-
-uint8_t CSimplePacketParser::getTTl(){
- if (m_ipv4) {
- return ( m_ipv4->getTimeToLive() );
- }
- if (m_ipv6) {
- return ( m_ipv6->getHopLimit() );
- }
- return (0);
-}
-
-bool CSimplePacketParser::Parse(){
-
- rte_mbuf_t * m=m_m;
- uint8_t *p=rte_pktmbuf_mtod(m, uint8_t*);
- EthernetHeader *m_ether = (EthernetHeader *)p;
- IPHeader * ipv4=0;
- IPv6Header * ipv6=0;
- m_vlan_offset=0;
- m_option_offset=0;
-
- uint8_t protocol = 0;
-
- // Retrieve the protocol type from the packet
- switch( m_ether->getNextProtocol() ) {
- case EthernetHeader::Protocol::IP :
- // IPv4 packet
- ipv4=(IPHeader *)(p+14);
- m_l4 = (uint8_t *)ipv4 + ipv4->getHeaderLength();
- protocol = ipv4->getProtocol();
- m_option_offset = 14 + IPV4_HDR_LEN;
- break;
- case EthernetHeader::Protocol::IPv6 :
- // IPv6 packet
- ipv6=(IPv6Header *)(p+14);
- m_l4 = (uint8_t *)ipv6 + ipv6->getHeaderLength();
- protocol = ipv6->getNextHdr();
- m_option_offset = 14 +IPV6_HDR_LEN;
- break;
- case EthernetHeader::Protocol::VLAN :
- m_vlan_offset = 4;
- switch ( m_ether->getVlanProtocol() ){
- case EthernetHeader::Protocol::IP:
- // IPv4 packet
- ipv4=(IPHeader *)(p+18);
- m_l4 = (uint8_t *)ipv4 + ipv4->getHeaderLength();
- protocol = ipv4->getProtocol();
- m_option_offset = 18+ IPV4_HDR_LEN;
- break;
- case EthernetHeader::Protocol::IPv6 :
- // IPv6 packet
- ipv6=(IPv6Header *)(p+18);
- m_l4 = (uint8_t *)ipv6 + ipv6->getHeaderLength();
- protocol = ipv6->getNextHdr();
- m_option_offset = 18 + IPV6_HDR_LEN;
- break;
- default:
- break;
- }
- default:
- break;
- }
- m_protocol =protocol;
- m_ipv4=ipv4;
- m_ipv6=ipv6;
-
- if ( protocol == 0 ){
- return (false);
- }
- return (true);
-}
-
-
/* free the right object.
it is classic to use virtual function but we can't do it here and we don't even want to use callback function
as we want to save space and in most cases there is nothing to free.