X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fnetvis.h;h=68eed052f3649255d4d9ee74655e624a89327968;hb=597a794cd648dd7b4c9d442fdc39f5961a38aba0;hp=a205d0564af72b89e340173b212614cc54a5c404;hpb=afeb198dfbe4929c8d95487bca64a84ec3b92148;p=netvis.git diff --git a/source/netvis.h b/source/netvis.h index a205d05..68eed05 100644 --- a/source/netvis.h +++ b/source/netvis.h @@ -11,11 +11,15 @@ Distributed unter the GPL #include #include #include +#include +#include +#include +#include #include #include -#include -#include -#include +#include +#include +#include #include #include #include @@ -26,9 +30,21 @@ 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; @@ -67,10 +83,13 @@ private: 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