+ if(ip6->ip6_nxt==IPPROTO_TCP)
+ {
+ const tcphdr *tcp = reinterpret_cast<const tcphdr *>(ip6+1);
+ handle_tcp(ctx, tcp, len-sizeof(ip6_hdr));
+ }
+ else if(ip6->ip6_nxt==IPPROTO_UDP)
+ {
+ const udphdr *udp = reinterpret_cast<const udphdr *>(ip6+1);
+ handle_udp(ctx, udp, len-sizeof(ip6_hdr));
+ }
+ else if(ip6->ip6_nxt==IPPROTO_ICMPV6)
+ {
+ const icmp6_hdr *icmp6 = reinterpret_cast<const icmp6_hdr *>(ip6+1);
+ handle_icmp6(ctx, icmp6, len-sizeof(ip6_hdr));
+ }
+ else
+ IO::print("Unknown next header in ip6: %d\n", ip6->ip6_nxt);
+}
+
+void NetVis::handle_tcp(CaptureContext &ctx, const tcphdr *tcp, unsigned)
+{
+ ctx.src_port = &get_port(ntohs(tcp->source));
+ ctx.dst_port = &get_port(ntohs(tcp->dest));
+ handle_packet(ctx);
+}
+
+void NetVis::handle_udp(CaptureContext &ctx, const udphdr *udp, unsigned)
+{
+ ctx.src_port = &get_port(ntohs(udp->source));
+ ctx.dst_port = &get_port(ntohs(udp->dest));
+ handle_packet(ctx);
+}
+
+void NetVis::handle_icmp(CaptureContext &ctx, const icmphdr *, unsigned)
+{
+ ctx.src_port = &get_port(0x10000|IPPROTO_ICMP);
+ ctx.dst_port = ctx.src_port;
+ handle_packet(ctx);
+}
+
+void NetVis::handle_icmp6(CaptureContext &ctx, const icmp6_hdr *, unsigned)
+{
+ ctx.src_port = &get_port(0x10000|IPPROTO_ICMPV6);
+ ctx.dst_port = ctx.src_port;
+ handle_packet(ctx);
+}
+
+void NetVis::handle_packet(CaptureContext &ctx)
+{
+ Port *port = 0;
+ if(ctx.src_port && ctx.dst_port)
+ {
+ if(ctx.src_port->is_registered()!=ctx.dst_port->is_registered())