28 #include <boost/unordered/unordered_map.hpp> 33 #include <senf/Ext/NetEmu/WLAN/MmapSocketSourceRadioTap.hh> 34 #include <senf/Ext/NetEmu/Ethernet/MmapSocketSourceEthernet.hh> 52 PayloadMap::iterator it(
payloadMap_.find(eth->type_length()));
54 payloadMap_.insert( std::make_pair(eth->type_length(), 1));
65 std::cout <<
"." << std::flush;
69 if (eth->type_length() == 0x8847) {
71 eth->source() << eth->destination();
72 eth->destination() << tmp;
82 typedef boost::unordered_map<boost::uint16_t, unsigned>
EtherTypeMap;
86 logSeqNoErrors_(logSeqNoErrors)
88 route(input,output).autoThrottling(
false);
93 void dump(std::ostream &os) {
95 for (EtherTypeMap::value_type & entry : payloadMap_) {
96 os << std::hex <<
"0x" << entry.first <<
"/" << std::dec << entry.second <<
";";
109 if (eth->type_length() != 0) {
120 route(input,output).autoThrottling(
false);
127 template<
class SOURCE_TYPE>
133 Forwarder forwarder1, forwarder2;
143 source( socket, configuration.numBuffers),
144 analyzer( configuration.logSeqNoErrors),
145 timer(
"report", boost::bind(&
Dummy::report, this)),
150 senf::ppi::connect( source, monitorDataFilter);
151 senf::ppi::connect( monitorDataFilter, forwarder1);
152 senf::ppi::connect( monitorDataFilter.monitor, discardSink2);
153 senf::ppi::connect( forwarder1, analyzer);
154 senf::ppi::connect( analyzer,forwarder2);
158 senf::ppi::connect( forwarder2, sink);
161 senf::ppi::connect( forwarder2, discardSink);
166 monitorDataFilter.
promisc(
true);
173 log <<
"rxDropped " << source.dropped();
174 log <<
", filterStats "; monitorDataFilter.
stats().
dump(log);
175 log <<
", etherTypeMap "; analyzer.
dump(log);
182 int main(
int argc,
char const * argv[])
186 if (!configuration.
parse( argc, argv)) {
int main(int argc, char const *argv[])
void dump(std::ostream &os) const
#define SENF_LOG_BLOCK(args)
std::string outputInterface
MonitorDataFilter header.
Route< connector::InputConnector, connector::OutputConnector > & route(connector::InputConnector &input, connector::OutputConnector &output)
static SENF_CLOCKSERVICE_CONSTEXPR clock_type seconds(int64_type const &v)
senf::ppi::connector::ActiveOutput< senf::EthernetPacket > output
Annotations public header.
senf::ppi::connector::PassiveInput< senf::EthernetPacket > input
Dummy(Configuration &configuration)
Analyzer(bool logSeqNoErrors)
void timeout(ClockService::clock_type const &timeout, bool initiallyEnabled=true)
int run(int argc, char const *argv[])
std::string monitorInterface
senf::ppi::connector::ActiveOutput< senf::EthernetPacket > output
boost::unordered_map< boost::uint16_t, unsigned > EtherTypeMap
#define SENF_PPI_MODULE(name)
bool parse(int argc, char const *argv[])
void dump(std::ostream &os)
void onRequest(Handler handler)
MACAddress hardwareAddress() const
ProtocolClientSocketHandle< PacketSocketProtocol > PacketSocketHandle
void id(senf::MACAddress const &_id)
WLANInterface public header.
MonitorDataFilterStatistics stats()
senf::ppi::connector::PassiveInput< senf::EthernetPacket > input
ConcretePacket< EthernetPacketType > EthernetPacket
unsigned framePredecessorLost