FrameAnalyzer.hh
Go to the documentation of this file.
1 //
2 // Copyright (c) 2020 Fraunhofer Institute for Applied Information Technology (FIT)
3 // Network Research Group (NET)
4 // Schloss Birlinghoven, 53754 Sankt Augustin, GERMANY
5 // Contact: support@wiback.org
6 //
7 // This file is part of the SENF code tree.
8 // It is licensed under the 3-clause BSD License (aka New BSD License).
9 // See LICENSE.txt in the top level directory for details or visit
10 // https://opensource.org/licenses/BSD-3-Clause
11 //
12 
13 
14 #ifndef __FRAMEANALYZER_HH__
15 #define __FRAMEANALYZER_HH__
16 
17 // Custom includes
18 #include <boost/ptr_container/ptr_map.hpp>
22 #include <senf/PPI/Module.hh>
23 #include "PacketStatistics.hh"
24 #include "Configuration.hh"
25 
27 
30 {
32 
33 public:
35 
36  FrameAnalyzer(Configuration const & configuration);
37 
38 protected:
40  boost::ptr_map<std::pair<PacketStatistics::Type,std::uint32_t>,PacketStatistics> packetStatsMap;
41 
42  PacketStatistics *flowStats(PacketStatistics::Type, std::uint32_t flowId);
43 
44  void resetStats();
45 
46  void resetStartTime();
48  return startTime_;
49  }
50 
51 private:
55  senf::ClockService::clock_type nextTimeout_;
56  std::uint64_t numPackets_;
57  bool mplsDetected_;
58 
59  void request();
60  void timerEvent();
61  void initWaitEvent();
62 
63  bool handleDataFrame(senf::EthernetPacket const & eth, senf::AnnotationsPacket const & ap);
64 
65  bool handleUDPPacket(senf::EthernetPacket const & eth, senf::AnnotationsPacket const & ap,
66  senf::IPv4Packet const & ip4, senf::UDPPacket const & udp);
67  bool handleMPLSPacket(senf::EthernetPacket const & eth, senf::AnnotationsPacket const & ap,
68  senf::MPLSPacket const & mpls, senf::TIMPacket const & tim);
69 
70  void report(senf::ClockService::clock_type const & timestamp, senf::ClockService::clock_type const & actualDuration);
71 };
72 
74 #endif
75 
config::time_type clock_type
senf::ClockService::clock_type const & startTime()
PacketStatistics * flowStats(PacketStatistics::Type, std::uint32_t flowId)
#define SENF_PPI_MODULE(name)
Configuration const & configuration_
senf::ppi::connector::PassiveInput< senf::EthernetPacket > input
FrameAnalyzer(Configuration const &configuration)
ConcretePacket< EthernetPacketType > EthernetPacket
AnnotationsPacket public header.
void resetStartTime()
boost::ptr_map< std::pair< PacketStatistics::Type, std::uint32_t >, PacketStatistics > packetStatsMap
ConcretePacket< UDPPacketType > UDPPacket
ConcretePacket< IPv4PacketType > IPv4Packet