X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fnetvis.h;h=68eed052f3649255d4d9ee74655e624a89327968;hb=597a794cd648dd7b4c9d442fdc39f5961a38aba0;hp=3739d330ec941de08c03c2698a576269bcfa4b7a;hpb=42bd2e83d66a98584540dd8cc5b47ee2349fe844;p=netvis.git diff --git a/source/netvis.h b/source/netvis.h index 3739d33..68eed05 100644 --- a/source/netvis.h +++ b/source/netvis.h @@ -11,23 +11,40 @@ Distributed unter the GPL #include #include #include +#include +#include +#include +#include #include #include -#include -#include -#include +#include +#include +#include #include #include #include +class History; class Host; class Packet; class Port; class Resolver; -class NetVis: public Msp::Application +class NetVis: public Msp::RegisteredApplication { private: + struct CaptureContext + { + const pcap_pkthdr *cap_hdr; + Host *src_host; + Port *src_port; + Host *dst_host; + Port *dst_port; + unsigned size; + + CaptureContext(); + }; + std::string iface; pcap_t *pcap; Resolver *resolver; @@ -43,8 +60,7 @@ private: std::map disabled_hosts; std::list packets; std::map ports; - bool draw_labels; - bool blend; + History *history; Msp::Time::TimeStamp tick_t; Msp::Time::TimeStamp fps_t; @@ -63,14 +79,17 @@ private: void render(); Host &get_host(unsigned); Msp::GL::Color generate_color(bool) const; - const Port &get_port(unsigned); - void key_press(unsigned, unsigned, wchar_t); + Port &get_port(unsigned); + void create_history_texture(); static void capture_handler(unsigned char *, const pcap_pkthdr *, const unsigned char *); + void handle_ethernet(CaptureContext &, const ethhdr *, unsigned); + void handle_ipv4(CaptureContext &, const iphdr *, unsigned); + void handle_tcp(CaptureContext &, const tcphdr *, unsigned); + void handle_udp(CaptureContext &, const udphdr *, unsigned); + void handle_packet(CaptureContext &); void sighandler(int); - - static Application::RegApp reg; }; #endif