X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fnetvis.h;fp=source%2Fnetvis.h;h=daec1cfade0116cbfa08b5632e253752b81ba8e1;hb=229e1d6ab66a9e987ffe3cd4a8de7c7f874f6de1;hp=0000000000000000000000000000000000000000;hpb=d60114dae1afaba8269e0cf65c9375a7380f5807;p=netvis.git diff --git a/source/netvis.h b/source/netvis.h new file mode 100644 index 0000000..daec1cf --- /dev/null +++ b/source/netvis.h @@ -0,0 +1,48 @@ +#ifndef NETVIS_H_ +#define NETVIS_H_ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +class Packet; +class Host; + +class NetVis: public Msp::Application +{ +private: + std::string iface; + pcap_t *pcap; + std::list packets; + std::map hosts; + Msp::Graphics::Display *dpy; + Msp::Graphics::Window *wnd; + Msp::Graphics::GLContext *glc; + Msp::Time::TimeStamp last_tick; + std::map port_colors; + Msp::GL::Font *font; + Msp::GL::Texture2D *font_tex; + +public: + NetVis(int, char **); + int main(); + const Msp::GL::Font &get_font() const { return *font; } + const std::map &get_hosts() const { return hosts; } +private: + virtual void tick(); + Host &get_host(unsigned); + Msp::GL::Color &get_port_color(unsigned); + + static void capture_handler(unsigned char *, const pcap_pkthdr *, const unsigned char *); + + static Application::RegApp reg; +}; + +#endif