// Custom includes
#include <string>
#include <fstream>
-
#include <sys/socket.h>
#include <netinet/in.h>
#include <netinet/tcp.h>
#include <sys/ioctl.h>
-#include <linux/sockios.h> //
-
+#include <linux/sockios.h>
#include <string>
#include <iostream>
#include <iomanip>
#include "Socket/UDPSocketHandle.hh"
#include "Scheduler/Scheduler.hh"
#include "Utils/membind.hh"
-
#include "Packets/EthernetPacket.hh"
-
-
-//#include "Sniffer.mpp"
+//#include "MCSniffer.mpp"
#define prefix_
///////////////////////////////cc.p////////////////////////////////////////
senf::PacketSocketHandle sock;
public:
- Sniffer(std::string const & interface)
- { sock.bind(senf::LLSocketAddress(interface)); }
+ Sniffer(std::string const & interface)
+ {
+ sock.bind(senf::LLSocketAddress(interface));
+ }
- void run()
- {
- senf::Scheduler::instance().add(sock, senf::membind(&Sniffer::dumpPacket, this));
- senf::Scheduler::instance().process();
- }
+ void run()
+ {
+ senf::Scheduler::instance().add(
+ sock, senf::membind(&Sniffer::dumpPacket, this));
+ senf::Scheduler::instance().process();
+ }
private:
void dumpPacket(senf::FileHandle /* ignored */, senf::Scheduler::EventId event)
- {
- std::string data (sock.read());
- senf::EthernetPacket::ptr packet (
- senf::Packet::create<senf::EthernetPacket>(
- data.begin(), data.end()));
- packet->dump(std::cout);
- hexdump(packet->last()->begin(),
- packet->last()->end());
- std::cout << "\n\n";
- }
+ {
+ std::string data (sock.read());
+ senf::EthernetPacket::ptr packet (
+ senf::Packet::create<senf::EthernetPacket>(
+ data.begin(), data.end()));
+ packet->dump(std::cout);
+ hexdump(packet->last()->begin(),
+ packet->last()->end());
+ std::cout << "\n\n";
+ }
};
int scheduler_main(int argc, char const * argv[])
callback will be called for the given type of event on
the given arbitrary file-descriptor or
handle-like object. If there already is a Callback
- register ed for one of the events requested, the new
+ registered for one of the events requested, the new
handler will replace the old one.
\param[in] handle file descriptor or handle providing
the Handle interface defined above.
-// $Id$
+// $Id:SocketHandle.hh 218 2007-03-20 14:39:32Z tho $
//
// Copyright (C) 2006
// Fraunhofer Institut fuer offene Kommunikationssysteme (FOKUS)
/**< Formats the complete state map value and returns it as
a single multi-line string.
+ param lod level of detail requested. The interpretation
+ of this value is protocol specific
+
\implementation This member will be re-implemented in
every derived class. See the state()
documentation. */