Skip to content
Snippets Groups Projects
Commit f8be7089 authored by tho's avatar tho
Browse files

some very small fixes

parent 0cbe00f3
No related branches found
No related tags found
No related merge requests found
......@@ -27,26 +27,21 @@
// 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////////////////////////////////////////
......
File deleted
/** \mainpage Examples
\anchor Examples_Main
\ref sniffer
*/
......
......@@ -118,27 +118,30 @@ class Sniffer
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[])
......
......@@ -128,7 +128,7 @@ namespace senf {
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)
......@@ -135,6 +135,9 @@ namespace senf {
/**< 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. */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment